"""Run from either installed checkout with its isolated dev server running.
Start the server with T3CODE_DEV_SEED=0 and the account's GROK_XAI_API_BASE_URL.
Enable providerInstances.grok = {"driver":"grok","enabled":true} in the
isolated settings.json before starting it. Requires real Grok 1.0.77 auth.
Usage: python3 driver.py /path/to/new/synthetic/project
The prompt is byte-identical to the one used for both evidence runs.
"""
import pathlib, subprocess, sys
project = pathlib.Path(sys.argv[1]).resolve()
project.mkdir(parents=True, exist_ok=False)
(project / 'README.md').write_text('Synthetic early completion reproduction.\n')
def run(*args, **kwargs):
    return subprocess.run(args, check=True, **kwargs)
run('git','init','-q',str(project))
run('git','-C',str(project),'add','README.md')
run('git','-C',str(project),'-c','user.name=Proof','-c','user.email=proof@example.test','commit','-qm','Synthetic project')
run('node','apps/server/src/bin.ts','project','add','--base-dir','.t3','--title','Early completion proof',str(project))
prompt = pathlib.Path(__file__).with_name('prompt.txt').read_text()
run('node','apps/server/src/bin.ts','thread','start','--base-dir','.t3','--provider','grok','--model','grok-4.7','--title','Grok early completion',str(project),'-',input=prompt,text=True)
