#!/usr/bin/env python3
"""Run from either installed checkout with its fresh dev server running.
Usage: python3 seed.py <new-synthetic-workspace> <isolated-t3-home>
First add Cursor in Settings > Providers; CURSOR_API_KEY must reach the server.
No secret is supplied. Never use a live T3 home.
"""
import json, pathlib, subprocess, sys
workspace, home = map(pathlib.Path, sys.argv[1:])
workspace.mkdir(parents=True, exist_ok=False)
def run(*args):
    return subprocess.check_output(args, text=True)
run('git','init','--quiet','--initial-branch=main',str(workspace))
run('git','-C',str(workspace),'-c','user.name=Demo','-c','user.email=demo@example.invalid','commit','--allow-empty','-m','Initial demo')
cli = ['node','apps/server/src/bin.ts']
print(run(*cli,'project','add',str(workspace),'--title','Secret restart demo','--base-dir',str(home)))
prompt = 'Call T3 request_secret now for a secret named Staging DB password and wait for its result. Do not run shell commands or do anything else. This is synthetic test data.'
print(run(*cli,'thread','start',str(workspace),prompt,'--provider','cursor','--model','composer-2.5','--title','Secret steering restart','--json','--base-dir',str(home)))
# Open the returned thread through its environment/thread link. Hide thread details.
# Wait for the unanswered Staging DB password card. Start a browser recording.
# Upload steering.png to input[type=file]. Fill the Message Secret steering restart
# textbox with: Never mind the password. Just reply with the word OK.
# Click the Steer message button. Wait for OK and the terminal composer.
# Capture the card and OK together; do not answer or decline the card.
