#!/usr/bin/env bash
# Manual proof command sequence, executed separately in each commit's fresh worktree.
# WORKTREE, SCRATCH and REAL_CLAUDE are caller-selected absolute paths.
# Start with no rejection flag. The wrapper delegates to Claude Code 2.1.325.
set -eu
cd "$WORKTREE"
git init "$SCRATCH/demo"
git -C "$SCRATCH/demo" -c user.name=Demo -c user.email=demo@example.com commit --allow-empty -m initial
# In a retained terminal: PATH="$SCRATCH:$PATH" T3CODE_DEV_SEED=0 vp run dev
node apps/server/src/bin.ts project add --base-dir .t3 --title 'Claude resume proof' "$SCRATCH/demo"
node apps/server/src/bin.ts thread start --base-dir .t3 --provider claudeAgent --model haiku --title 'Resume recovery' --wait --json "$SCRATCH/demo" 'Reply only ok'
# Set THREAD to the returned threadId.
touch "$SCRATCH/reject-resume"
node apps/server/src/bin.ts thread send --base-dir .t3 --wait --json "$THREAD" 'Reply only ok'
node apps/server/src/bin.ts thread send --base-dir .t3 --wait --json "$THREAD" 'Reply only ok'
# Stop the retained dev task; restart using the identical command and existing .t3.
# Open the thread in the web client using /<environmentId>/<encoded threadId>.
node apps/server/src/bin.ts thread send --base-dir .t3 --wait --json "$THREAD" 'Reply only ok' || true
# Record the web client while executing these same two commands (retry.py automates them).
node apps/server/src/bin.ts thread send --base-dir .t3 --wait --json "$THREAD" 'Reply only ok' || true
node apps/server/src/bin.ts thread send --base-dir .t3 --wait --json "$THREAD" 'Reply only ok' || true
