#!/usr/bin/env python3
"""Prepare disposable real npm CLI installs and settings before starting a fresh dev server.
Usage: python seed.py NEW_RUN_DIRECTORY
Then run T3CODE_DEV_SEED=0 T3CODE_ENVIRONMENT_LABEL='Provider update demo'
T3CODE_ENVIRONMENT_MACHINE_KIND=laptop vp run dev:server --home-dir RUN/home
--port PORT --host 0.0.0.0 from the desired commit's checkout.
Serve that checkout's mobile bundle with vp run dev:client --port METRO_PORT,
install via vp run mobile:install ios --session SESSION, and pair with the repo helper.
Settings > Environments > Manage Provider update demo; swipe 200 730 200 270.
Run driver.py from that checkout, using the same session.
"""
import json,pathlib,subprocess,sys
run=pathlib.Path(sys.argv[1]).resolve();run.mkdir(parents=True,exist_ok=False)
prefix=run/'tools'
subprocess.run(['npm','install','-g','--prefix',str(prefix),'@openai/codex@0.172.0','@anthropic-ai/claude-code@2.1.330'],check=True)
providers={k:{'driver':k,'enabled':False} for k in ['cursor','muse','pi','opencode','antigravity']}
for driver,binary in [('codex','codex'),('claudeAgent','claude')]:
 providers[driver]={'driver':driver,'enabled':True,'config':{'binaryPath':str(prefix/'bin'/binary)}}
settings=run/'home/userdata/settings.json';settings.parent.mkdir(parents=True)
settings.write_text(json.dumps({'providerInstances':providers}))
