#!/usr/bin/env bash
set -euo pipefail
# Run from the checkout with its fresh dev server already running.
# Synthetic fixtures only; argument is a fresh directory for this run.
fixture_dir="$1"
mkdir -p "$fixture_dir"
for project in projA projB; do
  mkdir -p "$fixture_dir/$project"
  git -C "$fixture_dir/$project" init -q
  git -C "$fixture_dir/$project" -c user.name=Fixture -c user.email=fixture@example.invalid commit --allow-empty -qm 'Synthetic fixture'
  node apps/server/src/bin.ts project add --base-dir .t3 --title "$project" "$fixture_dir/$project"
  node apps/server/src/bin.ts thread start --base-dir .t3 --provider devReplay --model showcase --title "$project existing chat" "$fixture_dir/$project" 'Synthetic seed conversation'
done
