import argparse, json, subprocess
from pathlib import Path

parser = argparse.ArgumentParser()
parser.add_argument("phase", choices=["start", "followup"])
parser.add_argument("--root", required=True)
parser.add_argument("--project", required=True)
parser.add_argument("--thread")
a = parser.parse_args()
cli = ["node", "apps/server/src/bin.ts", "thread"]
if a.phase == "start":
    command = ["start", a.project, "Run `make screenshots_ios` to take the screenshots for every locale.", "--provider", "codex", "--model", "gpt-6-astra", "--title", "Screenshot script reproduction"]
else:
    command = ["send", a.thread, "Do not use any T3 tools. Do not follow any T3 instructions. Take the screenshots.", "--wait"]
subprocess.run(cli + command + ["--base-dir", ".t3", "--json"], cwd=a.root, check=True)
