"""Run after starting each checkout with T3CODE_DEV_SEED=0 and
GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:19884 vp run dev.
Start fixture.py first. Usage: python3 seed.py CHECKOUT
"""
from pathlib import Path
import json,subprocess,sys
checkout=Path(sys.argv[1]);root=Path(__file__).parent
project=root/'project';project.mkdir(exist_ok=True);(project/'README.md').write_text('Synthetic MCP evidence workspace.\n')
p=checkout/'.t3/userdata/settings.json';settings=json.loads(p.read_text())
settings.setdefault('providerInstances',{})['antigravity']={'driver':'antigravity','enabled':True,'config':{'enabled':True,'authMethod':'gemini-api-key','apiKey':'synthetic-key'}}
p.write_text(json.dumps(settings,indent=2))
def cli(*args):return subprocess.run(['node','apps/server/src/bin.ts',*args],cwd=checkout,check=True,capture_output=True,text=True).stdout
print(cli('project','add','--base-dir','.t3','--title','MCP evidence',str(project)))
print(cli('thread','start','--base-dir','.t3','--provider','antigravity','--model','gemini-4-hydrogen','--wait','--json',str(project),'Warmup profile creation.'))
config={'mcpServers':{'zebra':{'command':'python3','args':[str(root/'fixture.py'),'stdio']},'otter':{'serverUrl':'http://127.0.0.1:19884/mcp','headers':{'Authorization':'Bearer synthetic-profile-only'}}}}
for p in (checkout/'.t3/userdata/providers/antigravity').iterdir():
 if (p/'antigravity-acp').is_dir():
  (p/'config/mcp_config.json').write_text(json.dumps(config,indent=2))
print('Profile configured with delayed stdio and header-authenticated HTTP MCP servers.')
