"""Synthetic GitLab reproduction seed. Usage: python3 seed.py NEW_DIRECTORY REPO_HTTPS_URL
Create an empty private GitLab project first, then run this script and open an MR
from hello-bye to main. Add this checkout to each fresh T3 server with:
node apps/server/src/bin.ts project add NEW_DIRECTORY --title 'Review guide sample' --base-dir .t3
"""
from pathlib import Path
import subprocess
import sys
p = Path(sys.argv[1]); p.mkdir(parents=True)
def git(*args):
    subprocess.run(['git', *args], cwd=p, check=True)
git('init', '-b', 'main')
git('config', 'user.name', 'Scenario')
git('config', 'user.email', 'scenario@example.invalid')
(p / 'bye.txt').write_text('bye\n')
git('add', '.')
git('commit', '-m', 'Initial sample')
git('remote', 'add', 'origin', sys.argv[2])
git('push', '-u', 'origin', 'main')
git('checkout', '-b', 'hello-bye')
(p / 'bye.txt').unlink()
(p / 'hello.txt').write_text('hello\n')
git('add', '-A')
git('commit', '-m', 'Replace bye with hello')
git('push', '-u', 'origin', 'hello-bye')
