#!/usr/bin/env bash
set -euo pipefail
checkout="$1"
repo="$2"
mkdir -p "$repo"
cd "$repo"
git init -q -b main
printf "export const title = 'Demo';\nexport const count = 1;\n" > app.ts
git add app.ts
git -c user.name=Demo -c user.email=demo@example.invalid commit -qm 'Initial demo'
printf "const oldName = 'sample';\nconst otherName = 'value';\nconsole.log(oldName, otherName);\n" >> app.ts
cd "$checkout"
node apps/server/src/bin.ts project add "$repo" --title 'Review demo' --base-dir "$checkout/.t3"
node apps/server/src/bin.ts thread start "$repo" 'first' --title 'Review demo' --provider devReplay --model multi-turn --wait --json --base-dir "$checkout/.t3"
