#!/usr/bin/env python3
"""Run for each fresh base/head server; provide checkout and a synthetic project repo."""
import argparse,pathlib,subprocess
p=argparse.ArgumentParser()
p.add_argument('checkout');p.add_argument('project');p.add_argument('--home',default='.t3')
a=p.parse_args();repo=pathlib.Path(a.project).resolve()
(repo/'emit.py').write_text("import sys\nsys.stdout.write('😀' + 'b' * 1999)\n")
exclude=repo/'.git/info/exclude'
with exclude.open('a') as f:f.write('\nemit.py\n')
def cli(args):
 return subprocess.run(['node','apps/server/src/bin.ts',*args,'--base-dir',a.home],cwd=a.checkout,check=True)
cli(['project','add','--title','Emoji tail proof',str(repo)])
cli(['thread','start','--provider','codex','--model','gpt-6-luna','--title','emoji tail',str(repo),'Run exactly this shell command once and do nothing else: python3 emit.py','--wait','--json'])
