chore(tools): add idempotent Gitea backlog seeder

Add tools/seed-gitea.sh, which bootstraps the Gitea repo from BACKLOG.md:
the label taxonomy, the seven iteration milestones, and all 26 slice
issues (S-00..S-25). Driven by curl/jq against the Gitea API; reads
GITEA_TOKEN from the environment. Idempotent — every item is matched
before creation, so a partial or failed run can be re-run safely.

Document it in tools/README.md (prerequisites, usage, what it creates,
verification). Overlaps part of S-00's "labels/milestones exist in
Gitea" acceptance; the authoritative runbook moves to docs/ under S-00.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit was merged in pull request #27.
This commit is contained in:
2026-06-03 11:59:35 +02:00
parent 1daf7a5b59
commit c746648e5c
2 changed files with 484 additions and 0 deletions

54
tools/README.md Normal file
View File

@@ -0,0 +1,54 @@
# tools/
Repo bootstrap and maintenance scripts. Not part of the application runtime.
## `seed-gitea.sh` — bootstrap the Gitea backlog
One-time (idempotent) script that creates the project's backlog in Gitea from the
contents of [`BACKLOG.md`](../BACKLOG.md): the label taxonomy, the iteration
milestones, and all 26 slice issues (`S-00``S-25`). Gitea is the system of record
(see `CLAUDE.md` §7); this script just gets the empty repo to that starting state.
It overlaps part of **S-00**'s acceptance ("milestones, labels … exist in Gitea").
The authoritative operational write-up will move to `docs/runbooks/` and
`docs/gitea-workflow.md` when S-00 is implemented.
### Prerequisites
- `curl` and `jq` on `PATH`.
- A Gitea **personal access token** with scopes **`write:issue`** and
**`write:repository`** (Gitea → Settings → Applications → Generate New Token).
### Usage
```sh
GITEA_TOKEN=<your-pat> bash tools/seed-gitea.sh
```
The token is read from the environment only — it is never written to disk or
committed. The target repo (`eho/register-referentie` on
`git.labs.respellion.tech`) is hard-coded near the top of the script; edit the
`BASE`/`OWNER`/`REPO` variables to point elsewhere.
### What it creates
| Step | Items |
|------|-------|
| Labels | `type:{slice,bug,adr-proposal,chore}` + 12 `area:*` labels (16 total) |
| Milestones | `Iteration 0 — Foundations``Iteration 6 — Production Posture` (7 total) |
| Issues | `S-00``S-25` (26 total), each with body, milestone, and area labels |
### Idempotency
Every item is matched by name (labels), title (milestones), or issue title prefix
(`S-NN · …`) before creation, and skipped if it already exists. A partial or failed
run can be re-run safely — the second run reports every item as `skip`.
### Verify (no token needed — reads are anonymous)
```sh
B=https://git.labs.respellion.tech/api/v1/repos/eho/register-referentie
curl -s "$B/labels?limit=100" | jq length # expect 16
curl -s "$B/milestones?state=all&limit=100" | jq length # expect 7
curl -s "$B/issues?state=all&type=issues&limit=100" | jq length # expect 26
```