#!/usr/bin/env bash
set -euo pipefail
checkout="$1"
state_dir="$2"
workspace="$3"
mkdir -p "$workspace"
printf '%s\n' '# Citation demonstration' > "$workspace/README.md"
git -C "$workspace" init --quiet --initial-branch=main
git -C "$workspace" add README.md
git -C "$workspace" -c user.name=Scenario -c user.email=scenario@example.invalid commit --quiet -m 'Initial sample'
cd "$checkout"
node apps/server/src/bin.ts project add "$workspace" --title citation-demo --base-dir "$state_dir"
node apps/server/src/bin.ts thread start "$workspace" 'Explain the sample' --title 'Long assistant citation' --provider devReplay --model multi-turn --wait --json --base-dir "$state_dir"
