#!/usr/bin/env bash
set -eu
# Run in the selected checkout after vp i. Use a fresh dev DB (T3CODE_DEV_SEED=0).
# Start the server: T3CODE_ENVIRONMENT_LABEL='Handoff proof' T3CODE_DEV_SEED=0 vp run dev
# Use driver.mjs settings to enable opencode and pi, and set worktreesDirectory to a synthetic directory.
repo="$1"
mkdir -p "$repo"
git -C "$repo" init
git -C "$repo" -c user.name=Evidence -c user.email=evidence@example.com commit --allow-empty -m 'Initial synthetic repository'
node apps/server/src/bin.ts project add --base-dir .t3 --title 'OpenCode handoff evidence' "$repo"
# Start a thread with the printed project id:
# node apps/server/src/bin.ts thread start --base-dir .t3 --provider opencode --model openai/gpt-5.6-luna --title 'Handoff streaming proof' --json <project-id> 'Reply with the single word ready.'
# Then use driver.mjs to select pi, send the handoff request (repeat after context transfer if necessary),
# select opencode, send 'Run the shell command pwd and reply with its output only.', stop, and send
# 'Reply with the single word hello.' Keep the web client open on the thread and record that interaction.
