"""Synthetic seed used on both commits. Run from either installed checkout while its
fresh T3 dev server runs with T3CODE_DEV_SEED=0. Then follow the UI steps below.

UI driver (T3 preview tools, Chromium 1280x800 CSS pixels):
1. Open checkout-A in IntelliJ IDEA Community 2025.2.4 on Linux/Xvfb 1920x1080.
2. Open the created Checkout-B thread. Set preferred editor to IntelliJ IDEA.
3. Hide thread details. Right-click Greeter.java L7:C16 in the replay response;
   choose Open in IntelliJ IDEA. Observe IDE project header and position status.
4. On head choose New Window and Trust Project when prompted.
5. Close B's IDE window and any externally opened file in A before the next case.
6. Open the thread terminal. Print src/Greeter.java:3:14, clear the prompt, and
   Ctrl-click the printed path. Observe project header and position status.
7. On head choose New Window. Check B at 3:14. Base retains A while displaying B.

The recording files show the T3 interaction followed by the concurrent IDE
recording. Paths are redacted. No app launch/navigation code was changed; only
the replay fixture text was replaced identically on both commits.
AI-assisted; verified with the tests and tools listed above.
"""
from pathlib import Path
import argparse
import subprocess

parser = argparse.ArgumentParser()
parser.add_argument('--seed-root', type=Path, required=True)
parser.add_argument('--base-dir', default='.t3')
args = parser.parse_args()
root = args.seed_root.resolve()
for name in ['checkout-A', 'checkout-B']:
    project = root / name
    (project / 'src').mkdir(parents=True, exist_ok=True)
    (project / 'src/Greeter.java').write_text(
        'public class Greeter {\n  public static void main(String[] args) {\n'
        '    String message = "Hello from '+name+'";\n'
        '    System.out.println(message);\n  }\n\n'
        '  public String greeting() {\n    return "'+name+'";\n  }\n}\n')
    subprocess.run(['git', 'init', '-q', str(project)], check=True)
fixture = Path('apps/server/src/orchestration-v2/testkit/fixtures/multi_turn/registry_transcript.ndjson')
fixture.write_text(fixture.read_text().replace(
    'first fixture turn complete',
    'Open [src/Greeter.java:7:16](src/Greeter.java:7:16) in the thread project.'))
print('Wait for the dev server to finish restarting after the fixture change.')
print('Then run these commands from this checkout:')
print('node apps/server/src/bin.ts project add', root/'checkout-B', '--title Checkout-B --base-dir', args.base_dir)
print('node apps/server/src/bin.ts thread start', root/'checkout-B', '"Inspect the Java source" --title "Open positioned Java file" --provider devReplay --model multi-turn --wait --json --base-dir', args.base_dir)
print("Terminal command: PS1=''; printf '\\033[2J\\033[Hsrc/Greeter.java:3:14\\n'")
