#!/usr/bin/env bash
set -euo pipefail
# Run once per checkout against its isolated running dev server.
# Usage: bash seed.sh <checkout> <isolated-home> <synthetic-project>
repo=$1
data_dir=$2
project_dir=$3
mkdir -p "$project_dir"
git -C "$project_dir" init --quiet --initial-branch=main
git -C "$project_dir" -c user.name=Scenario -c user.email=scenario@example.invalid commit --allow-empty -m 'Initial commit'
cd "$repo"
node apps/server/src/bin.ts project add "$project_dir" --title preview-demo --base-dir "$data_dir"
# Wait for Replay (dev)'s multi-turn model to appear before starting the thread.
node apps/server/src/bin.ts thread start "$project_dir" hello --title 'Floating preview layout' --provider devReplay --model multi-turn --wait --json --base-dir "$data_dir"
# Pass the returned threadId to manual-driver.cjs with the server origin, data directory,
# installed Chromium executable, and a new output directory.
