"""Create the synthetic fixture used on both sides; pass a new destination per run."""
import datetime
import pathlib
import subprocess
import sys
root = pathlib.Path(sys.argv[1]) / datetime.datetime.now(datetime.timezone.utc).strftime('%Y%m%dT%H%M%SZ') / 'review-demo'
root.mkdir(parents=True)
def git(*args):
    return subprocess.check_output(['git', '-C', str(root), *args], text=True).strip()
git('init', '-b', 'main')
(root / 'total.js').write_text('export function total(prices) {\n  return prices.reduce((sum, price) => sum + price, 0);\n}\n')
git('add', 'total.js')
git('-c', 'user.name=Evidence', '-c', 'user.email=evidence@example.com', 'commit', '-m', 'Initial synthetic sample')
(root / 'total.js').write_text('export function total(prices) {\n  return prices.reduce((sum, price) => sum - price, 0);\n}\n')
print(root)
