#!/usr/bin/env bash
# Run from the commit checkout before its dev server starts.
# Inputs: isolated T3 home, synthetic project path, Grok launcher path.
set -euo pipefail
state_dir=$1
project_dir=$2
launcher=$3
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
mkdir -p "$state_dir/userdata" "$project_dir"
cp "$script_dir/effort.py" "$project_dir/effort.py"
git -C "$project_dir" init -q
git -C "$project_dir" add effort.py
git -C "$project_dir" -c user.name=Evidence -c user.email=evidence@example.invalid commit -qm 'Initialize demonstration'
python3 - "$state_dir/userdata/settings.json" "$launcher" <<'PY'
import json,pathlib,sys
f=pathlib.Path(sys.argv[1])
d=json.loads(f.read_text()) if f.exists() else {}
d.setdefault('providerInstances',{})['grok']={'driver':'grok','displayName':'Grok','enabled':True,'config':{'binaryPath':sys.argv[2]}}
f.write_text(json.dumps(d,indent=2))
PY
# Start T3CODE_DEV_SEED=0 vp run dev, then use the app's CLI to add the project:
# node apps/server/src/bin.ts project add "$project_dir" --title 'Effort demonstration' --base-dir "$state_dir"
# Select the reported provider/model and Low effort in the app. Send the
# journal-reader prompt from browser-actions.json. Change only effort to High,
# send it again, then Low and send again. Finally send the delegation prompt.
