Files
viexp/scripts/gitea-bootstrap.sh

57 lines
2.6 KiB
Bash

#!/usr/bin/env bash
# viexp Gitea bootstrap — create labels, sprint milestones and seed issues.
# Re-runnable: existing items are detected and reused.
# Auth: reads the token saved by `tea login add` from ~/.config/tea/config.yml.
# NOTE (Gitea 1.26.2): the repo *project board* has no API on this instance —
# create "viexp development" once via the web UI (Issues → Projects).
set -u
TOKEN=$(grep -E '^\s*token:' ~/.config/tea/config.yml | head -1 | sed -E 's/^\s*token:\s*//; s/"//g')
API=https://git.v-port.ru/api/v1
REPO=vaskes/viexp
TZOFF=$(date +%:z)
req() { local m=$1 p=$2 d=${3:-}
if [ -n "$d" ]; then curl -s -X "$m" "$API$p" -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' -d "$d"
else curl -s -X "$m" "$API$p" -H "Authorization: token $TOKEN"; fi
}
echo "== labels =="
declare -a LABELS=(
'type/bug|ee0701|Something broken in shipped code'
'type/feature|84b6eb|New app capability'
'type/docs|d4c5f9|Documentation and vault work'
'type/research|fad8c7|Investigation / spike output expected'
'type/chore|ededed|Tooling, CI, maintenance'
'type/spike|fef2c0|Time-boxed experiment'
'priority/P0|b60205|Blocks the sprint'
'priority/P1|d93f0b|Important this sprint'
'priority/P2|fbca04|Normal'
'priority/P3|0e8a16|Nice to have'
'lang/english|5319e7|English-practice artifact'
)
for L in "${LABELS[@]}"; do
IFS='|' read -r name color desc <<< "$L"
req POST "/repos/$REPO/labels" "{\"name\":\"$name\",\"color\":\"$color\",\"description\":\"$desc\"}" >/dev/null
done
req GET "/repos/$REPO/labels" | jq -r '.[].name' | tr '\n' ' '; echo
echo "== milestones (sprints; see docs/roadmap.md) =="
create_ms() { # title description due
local existing
existing=$(req GET "/repos/$REPO/milestones?state=all" | jq -r --arg t "$1" '.[] | select(.title==$t) | .id')
if [ -n "$existing" ] && [ "$existing" != "null" ]; then echo "$existing"; return; fi
req POST "/repos/$REPO/milestones" "{\"title\":\"$1\",\"description\":\"$2\",\"due_on\":\"$3\"}" | jq -r '.id // empty'
}
S0="Sprint 0 — Setup & deconstruction"
S1="Sprint 1 — Rust core via vls"
create_ms "$S0" "Toolchain, CI, board, vault. ~6h." "2026-10-31T23:59:59$TZOFF" >/dev/null
create_ms "$S1" "viexp ls subcommand: colors, sizes, sorting, tests. 20h." "2026-11-30T23:59:59$TZOFF" >/dev/null
req GET "/repos/$REPO/milestones?state=all" | jq -r '.[] | "\(.id) \(.title)"'
echo "== issues =="
bash "$(dirname "$0")/gitea-issues.sh"
echo "== project board =="
echo "No API on Gitea 1.26.2 — create 'viexp development' board in the web UI (Issues → Projects), columns:"
echo " Backlog → In Progress → Review → Done (sprints tracked by milestones)"