#!/usr/bin/env bash
set -euo pipefail
# Run from a T3 Code checkout; pass a fresh workspace and isolated T3 home.
workspace=$1
t3_home=$2
mkdir -p "$workspace"
printf 'export const greeting = "hello";\n' > "$workspace/greeting.ts"
printf 'export const legacy = "old";\n' > "$workspace/legacy.ts"
git -C "$workspace" init -q -b main
git -C "$workspace" add .
git -C "$workspace" -c user.name=Evidence -c user.email=evidence@example.invalid commit -qm Initial
node apps/server/src/bin.ts project add "$workspace" --title 'Multi-file patch demo' --base-dir "$t3_home"
node apps/server/src/bin.ts thread start "$workspace" 'Use exactly one apply_patch tool call to add farewell.ts containing export const farewell = "bye";, change greeting.ts to export const greeting = "hi";, and delete legacy.ts. Do not use any other tool, run tests, or commit. Reply Done.' --title 'Codex multi-file patch' --provider codex --model gpt-6-luna --wait --json --base-dir "$t3_home"
