#!/usr/bin/env bash
# Run from each installed checkout; use a different empty HOME_DIR per commit.
# Place prompt.txt and opencode.jsonc beside this script. No live state is copied.
set -eu
: "${HOME_DIR:?Set a fresh T3 home}"
: "${PROJECT_DIR:?Set the synthetic project's folder}"
mkdir -p "$HOME_DIR/userdata" "$PROJECT_DIR"
cp "$(dirname "$0")/opencode.jsonc" "$PROJECT_DIR/opencode.jsonc"
git -C "$PROJECT_DIR" init --initial-branch=main
git -C "$PROJECT_DIR" add opencode.jsonc
git -C "$PROJECT_DIR" -c user.name=Evidence -c user.email=evidence@example.invalid commit -m 'Synthetic project configuration'
cat > "$HOME_DIR/userdata/settings.json" <<'JSON'
{"providerInstances":{"opencode":{"driver":"opencode","enabled":true},"codex":{"driver":"codex","enabled":false},"claudeAgent":{"driver":"claudeAgent","enabled":false}},"defaultModelSelection":{"instanceId":"opencode","model":"openai/gpt-6-luna"}}
JSON
# In a retained second terminal, start the app and wait for its Listening line:
# T3CODE_DEV_SEED=0 vp run dev --home-dir "$HOME_DIR" --no-seed
# Then run the remaining commands here:
opencode --version
(cd "$PROJECT_DIR"; opencode models uni)
node apps/server/src/bin.ts project add "$PROJECT_DIR" --title 'Local model proof' --base-dir "$HOME_DIR"
node apps/server/src/bin.ts thread start "$PROJECT_DIR" - --title 'Project local model proof' --provider opencode --model openai/gpt-6-luna --base-dir "$HOME_DIR" --wait --json < "$(dirname "$0")/prompt.txt"
# Open the app using its pairing URL, then open the returned thread by its link.
# Use light theme and 1280x800 CSS pixels. Hide the sidebars, expand Worked for,
# and expand each tool row to inspect its actual input and output.
