import os, subprocess, sys
from pathlib import Path
repo=Path.cwd()
workspace=Path(sys.argv[1]).resolve()
workspace.mkdir(parents=True,exist_ok=True)
subprocess.run(['git','init',str(workspace)],check=True,capture_output=True)
for home,label in [('.t3','Alpha'),('.t3-lab','Lab')]:
 def cli(args):
  return subprocess.run(['node','apps/server/src/bin.ts',*args,'--base-dir',str(repo/home)],check=True,text=True,capture_output=True).stdout
 print(cli(['project','add',str(workspace),'--title','Filter proof']))
 for suffix in ['live','archived']:
  print(cli(['thread','start',str(workspace),'Show recorded output','--title',f'{label}-{suffix}','--provider','devReplay','--model','command-output' if label=='Alpha' else 'multi-turn','--wait','--json']))
