import pathlib,subprocess,sys
root=pathlib.Path.cwd(); home=root/'.t3'; project=home/'sample-project'; project.mkdir(parents=True,exist_ok=True)
(project/'README.md').write_text('# Sample project\n')
def run(args): return subprocess.run(args,check=True,capture_output=True,text=True).stdout
run(['git','-C',str(project),'init','-q']); run(['git','-C',str(project),'add','.']); run(['git','-C',str(project),'-c','user.name=Sample','-c','user.email=sample@example.invalid','commit','-qm','Initial sample'])
def cli(args): return run(['node','apps/server/src/bin.ts',*args,'--base-dir',str(home)])
cli(['project','add',str(project),'--title','Sample project'])
for i in range(1,15):
 cli(['thread','start',str(project),'Hello','--title',f'Sample thread {i}','--provider','devReplay','--model','showcase','--wait','--json'])
 print(f'Created sample thread {i}',flush=True)
