#!/usr/bin/env bash
set -eu
# Run from the checkout being verified. DATA is an empty, task-owned directory.
: "${DATA:?}" "${OPENCODE_BINARY:?}" "${SYNTHETIC_REPO:?}"
export T3CODE_DEV_SEED=0
export XDG_DATA_HOME="$DATA/data" XDG_CONFIG_HOME="$DATA/config"
export XDG_STATE_HOME="$DATA/state" XDG_CACHE_HOME="$DATA/cache"
# Prepare an OpenCode configuration with an authenticated anthropic provider in
# $XDG_CONFIG_HOME/opencode/opencode.json. Credentials are intentionally omitted.
# Prepare .t3/userdata/settings.json with other providers disabled and:
# providerInstances.opencode = {driver:'opencode', enabled:true,
#   config:{binaryPath:OPENCODE_BINARY}}
# Start `vp run dev` in a retained terminal; wait for its Listening and pairing lines.
# Create SYNTHETIC_REPO as a git repository containing README.md and an initial commit.
node apps/server/src/bin.ts project add "$SYNTHETIC_REPO" --title 'Usage demo' --base-dir .t3
node apps/server/src/bin.ts thread start "$SYNTHETIC_REPO" \
 'Reply with exactly: usage proof. Do not use tools.' \
 --title 'Original reply' --provider opencode --model anthropic/claude-haiku-5-5 \
 --base-dir .t3 --wait --json
# Create another git worktree of SYNTHETIC_REPO on branch usage-fork.
# Pair an isolated browser with the app, set 1440x1000 and light theme, open Usage,
# select Cost, 30 days, OpenCode only. Use the native-proof.py forks and reply actions.
