#!/usr/bin/env bash
# Commands used for each side, parameterized to omit private locations.
# Run from the checkout with its fresh dev server already running.
# Start that server with T3CODE_DEV_SEED=0 and GOOGLE_GEMINI_BASE_URL set externally.
# Before starting a turn, execute configure-provider.js in its paired web page.
set -eu
fixture="$1"
home_dir="$2"
output_dir="$3"
mkdir -p "$fixture" "$output_dir"
printf '# Tiny Math\n\nA small arithmetic library. math.js exports add and multiply.\n' > "$fixture/README.md"
printf 'export const add = (a, b) => a + b;\nexport const multiply = (a, b) => a * b;\n' > "$fixture/math.js"
git init -q --initial-branch=main "$fixture"
git -C "$fixture" add .
git -C "$fixture" -c user.name=Evidence -c user.email=evidence@example.invalid commit -qm 'Initial synthetic fixture'
node apps/server/src/bin.ts project add "$fixture" --base-dir "$home_dir"
node apps/server/src/bin.ts thread start --base-dir "$home_dir" --provider antigravity --model gemini-4-hydrogen --title 'Native research subagent' --json "$fixture" - < prompt.txt > "$output_dir/start.json"
# Open /<environmentId>/<threadId> in the paired web client and record until settled.
# Expand Worked for on both sides. Base: expand Run invoke_subagent.
# Head: open Codebase Researcher and expand its prompt.
