#!/usr/bin/env bash
# Run from each installed worktree against its own fresh dev server.
# Start server with T3CODE_DEV_SEED=0 and GOOGLE_GEMINI_BASE_URL set to the test gateway.
# Enable antigravity: Gemini API key, non-empty placeholder key.
set -euo pipefail
: "${SCRATCH_PROJECT:?Set to a scratch git repository}"
node apps/server/src/bin.ts project add --base-dir .t3 "$SCRATCH_PROJECT"
node apps/server/src/bin.ts thread start --base-dir .t3 --provider antigravity --model gemini-3.8-flash --option effort=low --title 'Background wait proof' --wait --json "$SCRATCH_PROJECT" 'Start the shell command `sleep 15 && echo finished` in the background. Then call the T3 MCP tool t3_background_wait with that background task id. Report the exact result or error text verbatim, then report the command output once it finishes.'
