#!/usr/bin/env bash
# Run in each commit's checkout after seed-reproduction.py CHECKOUT and vp i.
# Start the isolated backend with T3CODE_DEV_SEED=0 vp run dev --host 0.0.0.0.
set -euo pipefail
git init svg-demo
node apps/server/src/bin.ts project add ./svg-demo --title 'SVG crash demo' --base-dir .t3
node apps/server/src/bin.ts thread start ./svg-demo 'Show control SVG' --title 'Control SVG' --provider devReplay --model svg-control --base-dir .t3 --wait --json
node apps/server/src/bin.ts thread start ./svg-demo 'Show font variation SVG' --title 'Font variation SVG' --provider devReplay --model svg-variation --base-dir .t3 --wait --json
# Prepare and install each checkout's native client with mobile:install.
# Start Metro, pair using the test-t3-mobile helper, then open Control SVG.
# Record the same control -> back -> Font variation SVG interaction:
agent-device record start before-or-after.mp4 --scope device --hide-touches --session "$DEVICE_SESSION"
agent-device click 'label="Navigate up"' --settle --session "$DEVICE_SESSION"
agent-device click 'label="Font variation SVG, Done"' --settle --session "$DEVICE_SESSION"
agent-device appstate --session "$DEVICE_SESSION"
agent-device screenshot result.png --session "$DEVICE_SESSION"
agent-device record stop --session "$DEVICE_SESSION"
