"""Run from either checkout with its isolated dev server already started.
Set GOOGLE_GEMINI_BASE_URL in the server environment to your authorized endpoint.
In Settings > Providers add Antigravity, choose Gemini API key, enter your key,
and click Connect. The proof used agy 1.5.12 and Gemini 3.8 Flash / Low.
"""
import argparse, pathlib, subprocess, json
parser=argparse.ArgumentParser()
parser.add_argument('--workspace-root',type=pathlib.Path,required=True)
parser.add_argument('--home',default='.t3')
parser.add_argument('--side',choices=['alpha','beta'],required=True)
a=parser.parse_args()
for name in ['alpha','beta']:
    workspace=a.workspace_root/name
    skill=workspace/'.agent/skills'/f'{name}-only'
    skill.mkdir(parents=True,exist_ok=True)
    (skill/'SKILL.md').write_text(f'---\nname: {name}-only\ndescription: Skill only in {name}\n---\nReply ok.\n')
    subprocess.run(['git','init','-q',str(workspace)],check=True)
    subprocess.run(['node','apps/server/src/bin.ts','project','add',str(workspace),'--title',name,'--base-dir',a.home],check=True)
subprocess.run(['node','apps/server/src/bin.ts','thread','start',str(a.workspace_root/a.side),'Reply with just the word ok.','--title',a.side.title()+' commands','--provider','antigravity','--model','gemini-3.8-flash','--option','thought_level=low','--wait','--json','--base-dir',a.home],check=True)
# Open /<environmentId>/<threadId> in the paired browser. Close Thread details.
# After alpha: type /only and confirm /alpha-only. Then run --side beta.
# Open beta, type /only, then reopen alpha and focus its /only draft.
# Base offers /beta-only in alpha; head retains /alpha-only.
