#!/usr/bin/env bash
set -euo pipefail
repo="$1"
home="$2"
port="$3"
workspace="$4"
mkdir -p "$workspace"
git -C "$workspace" init -q -b main
printf 'Synthetic shortcut proof project\n' > "$workspace/README.md"
git -C "$workspace" add README.md
git -C "$workspace" -c user.name=Proof -c user.email=proof@example.invalid commit -qm Initial
cd "$repo"
export T3CODE_PORT="$port"
node apps/server/src/bin.ts project add "$workspace" --title 'Shortcut proof' --base-dir "$home"
for title in 'Update the readme' 'Tidy the styles'; do
  node apps/server/src/bin.ts thread start "$workspace" 'Show a sample response' --title "$title" --provider devReplay --model multi-turn --wait --json --base-dir "$home"
done
