#!/usr/bin/env bash
# Run each commit's real app in its own installed worktree first:
# T3CODE_DEV_SEED=0 vp run dev
# Add the worktree as a project using `node apps/server/src/bin.ts project add . --title 'Cursor default proof' --base-dir .t3`.
# Enable Cursor in Settings > Providers, wait for its live catalog.
# Open the startup pairing URL in this isolated browser session before running this script.
# Usage: browser-repro.sh ORIGIN SESSION OUTPUT_DIRECTORY
set -eu
origin=$1
session=$2
out=$3
browser=${BROWSER_BIN:-agent-browser}
ab() { "$browser" --session "$session" "$@"; }
ab open "$origin/settings/threads"
ab find role button click --name 'GPT-6-Astra' --exact
ab find role button click --name 'Cursor' --exact
ab find role option click --name 'Grok 4.7 , Cursor Add to favorites' --exact
ab find role button click --name 'Close' --exact
# Once the Settings backdrop has closed:
ab find role button click --name 'New thread' --exact
# Verify the selected project is Cursor default proof and leave model/traits untouched.
# Hide the thread details panel before recording to keep environment identity private.
ab find role button click --name 'Toggle thread details panel' --exact
ab record start "$out/grok.webm"
ab find role textbox fill --name 'Message New thread' 'Reply with OK only.'
ab press Enter
# After the app displays OK and returns to an idle composer:
# agent-browser --session "$session" record stop
# agent-browser --session "$session" eval 'document.activeElement.blur()'
# Capture two screenshots 500 ms apart and compare them before accepting the still.
# Run inspect-cursor.py WORKTREE before|after COMMIT to inspect Cursor's persisted checkpoint.
