#!/usr/bin/env bash
set -eu
# Usage: bash seed.sh CHECKOUT T3_HOME THROWAWAY_REPOSITORY
# Start each checkout with T3CODE_DEV_SEED=0 and the test hub's
# GOOGLE_GEMINI_BASE_URL in the server environment before running this.
checkout=$1
t3_data=$2
repo=$3
mkdir -p "$repo"
git init -q --initial-branch=main "$repo"
if ! git -C "$repo" rev-parse --verify HEAD >/dev/null 2>&1; then
  git -C "$repo" -c user.name=Demo -c user.email=demo@example.invalid commit --allow-empty -qm Initial
fi
cd "$checkout"
node apps/server/src/bin.ts project add "$repo" --title 'Approval demo' --base-dir "$t3_data"
