#!/usr/bin/env bash
set -eu
# Run once in each installed checkout, with its own fresh dev server running:
# T3CODE_DEV_SEED=0 vp run dev
# Usage: bash reproduce.sh CHECKOUT SYNTHETIC_PROJECT
cd "$1"
project="$2"
mkdir -p "$project"
printf 'alpha before\nalpha zebra-needle match\nalpha after\n' > "$project/alpha.txt"
printf 'beta before\nbeta zebra-needle match\nbeta after\n' > "$project/beta.txt"
git init -q "$project"
# Enable the Cursor provider in this isolated app's Settings first.
node apps/server/src/bin.ts project add "$project" --title 'Grep content proof' --base-dir .t3
node apps/server/src/bin.ts thread start "$project" 'Use grep exactly once to search zebra-needle in this project, output_mode content, with one line of context before and after. Do not call any other tools. Then say done.' --provider cursor --model auto --title 'Content grep with context' --base-dir .t3 --wait --json
# Open that thread in the paired web client, light theme, 1280x800.
# Hide sidebar and thread details. Expand Worked for, Searched code 1 time,
# then Searched zebra-needle. Record the final expansion.
# Browser driver used on both completed threads:
# Array.from(document.querySelectorAll('span')).find(e => e.textContent === 'Searched zebra-needle').click()
