import subprocess, sys, json
from pathlib import Path
from datetime import datetime, timezone
checkout, project, side = sys.argv[1:]
run = Path(__file__).parent / (side + '-' + datetime.now(timezone.utc).strftime('%Y%m%dT%H%M%SZ'))
run.mkdir()
command = "echo '" + ' '.join(f'w{i:04d}🚀' for i in range(1,1101)) + " zzzzz'"
prompt = 'Run this shell command verbatim, without shortening or changing any token. Then reply done.\n' + command
(run/'prompt.txt').write_text(prompt)
args = ['node','apps/server/src/bin.ts','thread','start', project, '-', '--base-dir','.t3','--provider','antigravity','--model','gemini-3.8-flash','--title','Unicode command truncation','--wait','--json']
p = subprocess.run(args, cwd=checkout, input=prompt, text=True, capture_output=True)
(run/'turn.json').write_text(p.stdout)
(run/'stderr.txt').write_text(p.stderr)
print(run)
print(p.stdout)
print(p.stderr)
sys.exit(p.returncode)
