40 lines
3.1 KiB
Markdown
40 lines
3.1 KiB
Markdown
---
|
|
name: fleet
|
|
description: Apply a change across many BlockNinja repos at once (plugins/*, sites/*, themes/*, optionally cms/core/orchestrator) with per-repo build + check-safety verification, committing only green repos and reporting only red lanes. Use for core version bumps, fleet-wide migrations, mass mechanical edits, or any "do X in every repo" request.
|
|
---
|
|
|
|
# Fleet Runner
|
|
|
|
Multi-repo batch executor for the BlockNinja workspace. Turns "migrate all N repos" into: enumerate → confirm → fan out → verify per repo → commit green → report red.
|
|
|
|
## Process
|
|
|
|
1. **Enumerate targets.** Default fleet: every git repo under `~/src/blockninja/plugins/`, `~/src/blockninja/sites/`, `~/src/blockninja/themes/` (skip non-repos), plus any explicitly named (cms, core, orchestrator, app). Print the list with current branch + dirty/clean state and **confirm with the user before touching anything** — especially flag dirty repos (their in-flight work must be preserved, never stashed or reset).
|
|
2. **Define the per-repo recipe** from the instruction. A recipe is: the edit (e.g. bump `block/core` in go.mod + `go mod tidy`), the verify chain, and the commit message template. State the recipe and the 2-3 key assumptions before fanning out.
|
|
3. **Fan out one subagent per repo** — `model: "sonnet"` (house rule for mechanical fan-outs), parallel batches. Each agent must:
|
|
- Read that repo's `CLAUDE.md` first and obey it (build commands differ per repo).
|
|
- Apply the change. Grep for leftover old names/versions across the WHOLE repo (frontend AND backend) — partial migrations are the #1 fleet failure mode.
|
|
- Verify: `make` (or `go build ./...` if no Makefile), then `cd ~/src/blockninja/check-safety && go run . <repo>` for cms/plugins/sites/themes repos — must exit 0.
|
|
- Hard rules: no `replace` directives in go.mod, ever; sqlc only (no raw SQL); stage explicit paths only.
|
|
- Commit ONLY if everything is green, in that repo alone (never cross-repo commits). Re-check `git branch --show-current` first. Do not push unless the instruction says to.
|
|
- Return: repo, green|red, evidence (exact command + last lines of output), and for red: root cause + proposed fix.
|
|
4. **Consolidated report**: one line per green repo (commit hash + evidence ref); full detail ONLY for red lanes. Never claim fleet success while any lane is red or unverified.
|
|
5. **Red-lane remediation**: offer to fix red lanes serially (these usually need real debugging, not mechanical edits).
|
|
|
|
## Headless alternative
|
|
|
|
For very large or repeatable sweeps, generate a script the user can run instead:
|
|
|
|
```bash
|
|
for repo in $(ls -d ~/src/blockninja/plugins/*/ ~/src/blockninja/sites/*/); do
|
|
(cd "$repo" && claude -p "<recipe>. Verify with make + check-safety; commit only if green." \
|
|
--allowedTools "Edit,Read,Bash,Grep,Glob")
|
|
done
|
|
```
|
|
|
|
## Never
|
|
|
|
- Never stash/reset a dirty repo to make the migration apply. Report it as skipped-dirty instead.
|
|
- Never bundle multiple repos into one commit.
|
|
- Never report "all done" from build success alone when the instruction implies runtime behavior — label runtime claims verified/unverified explicitly.
|