#!/usr/bin/env bash
# Run from apps/server in the chosen checkout. Supply fresh RUN_DIR, PORT and INSPECT_PORT.
set -euo pipefail
mkdir -p "$RUN_DIR/proj"
git -C "$RUN_DIR/proj" init -q
git -C "$RUN_DIR/proj" -c user.name=Synthetic -c user.email=synthetic@example.com commit --allow-empty -qm seed
T3CODE_DEV_SEED=0 node --inspect="127.0.0.1:$INSPECT_PORT" src/bin.ts serve --base-dir "$RUN_DIR/home" --port "$PORT" --dev-url http://127.0.0.1:1 "$RUN_DIR/proj"
# In another shell, register the project with:
# node src/bin.ts project add --base-dir "$RUN_DIR/home" "$RUN_DIR/proj"
# Then run drive.sh 5 40 with RUN_DIR, SERVER_DIR, HEAP_SCRIPT and INSPECT_PORT set.
