#!/usr/bin/env bash
# Run once per checkout with a fresh database, from the checkout root.
# Requires: an independent OpenCode 2.2.7 server with isolated XDG directories,
# an authenticated inexpensive model, and MODEL set to its advertised slug.
set -euo pipefail
: "${MODEL:?Set an advertised model slug}"
# In another terminal first: T3CODE_DEV_SEED=0 vp run dev
# Pair the web browser with the printed startup URL.
# Settings > Providers > Add provider > OpenCode > Next > Next:
# set Binary path to OpenCode 2.2.7, Server URL to the independent server,
# and Server password to its generated password; choose Add instance.
# Refresh provider status after configuring the external server's model access.
node apps/server/src/bin.ts project add --base-dir .t3 --title 'Tool availability check' .
node apps/server/src/bin.ts thread start --base-dir .t3 \
  --provider opencode --model "$MODEL" --title 'External server tool check' \
  . 'List your tools whose names contain pull_request.' --wait --json
# Open the completed thread in the web client.
# Query the independent server's /api/session for the matching session and directory.
# Capture its MCP list and instructions using capture-instructions.py.
# Rendered transcript images preserve the response, with runtime attribution redacted.
