#!/usr/bin/env bash
set -euo pipefail
# Run in each tested checkout against its own fresh isolated T3 home.
# Server startup must use T3CODE_DEV_SEED=0 and the dev replay provider.
# Pass the isolated home and the same synthetic git workspace as arguments.
evidence_home=$1
evidence_workspace=$2
mkdir -p "$evidence_workspace"
git init --quiet --initial-branch=main "$evidence_workspace"
git -C "$evidence_workspace" -c user.name=Scenario -c user.email=scenario@example.invalid commit --quiet --allow-empty -m 'Initial commit'
node apps/server/src/bin.ts project add "$evidence_workspace" --title composer-demo --base-dir "$evidence_home"
for prefix in Formatting Proof Evidence; do
  for label in backtick asterisk underscore; do
    node apps/server/src/bin.ts thread start "$evidence_workspace" 'Ready to edit' --title "$prefix $label" --provider devReplay --model multi-turn --wait --json --base-dir "$evidence_home"
  done
done
# AI-assisted; verified with the tests and tools listed above.
