#!/usr/bin/env bash
# Synthetic GitLab fixture; run once, then add the same clone to each fresh T3 server.
set -euo pipefail
fixture_name="${1:?unique GitLab project name}"
workspace="${2:?clone destination}"
project=$(glab api projects -X POST -f "name=$fixture_name" -f visibility=public -f initialize_with_readme=true)
project_id=$(printf '%s' "$project" | jq -r .id)
repo_url=$(printf '%s' "$project" | jq -r .http_url_to_repo)
glab api "projects/$project_id/labels" -X POST -f name=constructor -f color='#ff0000'
glab api "projects/$project_id/labels" -X POST -f name=__proto__ -f color='#00ff00'
glab api "projects/$project_id/labels" -X POST -f name=normal -f color='#112233'
glab api "projects/$project_id/repository/branches" -X POST -f branch=proof -f ref=main
glab api "projects/$project_id/repository/files/proof.txt" -X POST -f branch=proof -f content='Synthetic label color proof' -f commit_message='Add proof fixture'
glab api "projects/$project_id/merge_requests" -X POST -f source_branch=proof -f target_branch=main -f title='Prototype label colors' -f labels='constructor,__proto__,normal'
git clone "$repo_url" "$workspace"
# In each commit's checkout, after starting T3CODE_DEV_SEED=0 vp run dev --host 0.0.0.0:
# node apps/server/src/bin.ts project add "$workspace" --title 'Proto labels' --base-dir <isolated-home>
# Pair the Android dev client; Pulls > Filter pull requests > Project > Proto labels.
# For the final isolated comparison, remove the automatic 'server' project from each
# disposable dev server with `t3 project remove <server-workspace> --force --base-dir <isolated-home>`.
# Relaunch the client to discard previously seen GitHub label facets.
