fix(release,capitalize): finish runs in the main loop under the ask prompt; a declined prompt stops the flow (BLK-018 b)

This commit is contained in:
bchanot committed 2026-11-02 18:45:26 +01:00
1 parent dc780efb65
commit 536d39e811
3 files changed
+35 -63

No files matched your search

+2 -2
View File
@@ -331,7 +331,7 @@ Skip this step entirely (go to STEP 6, which prints the hold note) on
Otherwise, from the `chore/<name>` branch, THREE separate Bash calls, never combined. INVARIANT: no `git push` inside any Bash call of this skill (push-guard reads command text; the lib pushes develop itself in auto-push mode). The hints that tell the USER what to type (`! git push …`) are prose, kept on single lines.
1. `bash "$HOME/.claude/lib/gitflow.sh" finish chore <name>` — merge → develop, delete branch, push develop in auto-push mode. rc≠0 → go to STEP 6 with the `finish failed` line (rc 1/4 skip calls 2-3; rc 5/2/6 with the ancestor check true still run them so the push state is reported): rc 4 = conflict, develop mid-merge, `chore/<name>` kept, NOT merged; rc 1 = checkout failed, NOT merged; rc 5/2/6 come from the delete AFTER the merge: check `git merge-base --is-ancestor chore/<name> develop` and report `merged, branch not deleted (rc <n>)` when it holds, `NOT merged` otherwise. Never say "merged" without that check.
1. `bash "$HOME/.claude/lib/gitflow.sh" finish chore <name>` — merge → develop, delete branch, push develop in auto-push mode. rc≠0 → go to STEP 6 with the `finish failed` line (rc 1/4 skip calls 2-3; rc 5/2/6 with the ancestor check true still run them so the push state is reported): rc 4 = conflict, develop mid-merge, `chore/<name>` kept, NOT merged; rc 1 = checkout failed, NOT merged; rc 5/2/6 come from the delete AFTER the merge: check `git merge-base --is-ancestor chore/<name> develop` and report `merged, branch not deleted (rc <n>)` when it holds, `NOT merged` otherwise. Never say "merged" without that check. Finish prompt declined (the ask rule on `gitflow.sh finish`) → nothing merged, the chore branch kept: report it, never retry the finish in another form.
2. `bash "$HOME/.claude/lib/gitflow.sh" push-mode` → `auto | manual | invalid` (stderr names an invalid value).
3. `git rev-list --count origin/develop..develop 2>/dev/null || echo unknown` → `ahead` (0 = on origin; `unknown` = no origin/develop ref, e.g. no origin remote).
@@ -355,7 +355,7 @@ CAPITALIZE COMPLETE — <YYYY-MM-DD> (<pre-wipe flush | session-close>)
TODO.md : checked <N>, added <M>
journal.md : +1 line under ## <date>
committed : <mem_hash> (chore(memory): …) | ⚠️ NOT committed (rc 3 — see closing line)
persisted : develop <short> pushed | merged, manual push mode: not pushed | merged, not on origin (no origin/develop) | merged, push FAILED | merged, autopush invalid, nothing pushed (<ahead> behind) | merged, autopush invalid, pushed anyway (stale hook or manual push) | finish rc <n>, not merged | merged, branch not deleted (rc <n>) | on chore/<name>, not merged (--no-push)
persisted : develop <short> pushed | no (finish prompt declined, branch kept) | merged, manual push mode: not pushed | merged, not on origin (no origin/develop) | merged, push FAILED | merged, autopush invalid, nothing pushed (<ahead> behind) | merged, autopush invalid, pushed anyway (stale hook or manual push) | finish rc <n>, not merged | merged, branch not deleted (rc <n>) | on chore/<name>, not merged (--no-push)
dropped as already-captured: LRN-023, BLK-006
ignored as noise: push/tag release
```
+20 -16
View File
@@ -20,14 +20,15 @@ Turns the accumulated work on `develop` into a tagged release on `main`. THIN OR
**Division of labour (lib = mechanic, skill = judgment):** the tag lives HERE, not in `gitflow.sh`, because it is release-specific (version + message + human decision) while the lib's fan-out is generic. **Consequence (accepted):** a release cut by calling `gitflow finish` directly, bypassing this skill, fans out but is NOT tagged — `/release-candidate` is the canonical release path.
The two mechanical spans (prep, finish+tag) run on the sonnet-pinned
`release-executor` subagent (dispatch makes the pin effective) — no model
gate needed here, dispatch does the job. This dispatcher keeps everything
the executor must never own: the version-NUMBER decision (judgment — derives
from semver change nature), and the two human gates (when to release, and
The prep span runs on the sonnet-pinned `release-executor` subagent
(dispatch makes the pin effective) — no model gate needed here, dispatch
does the job. This dispatcher keeps everything the executor must never own:
the version-NUMBER decision (judgment — derives from semver change nature),
the finish and tag (STEP 5, main loop), and the two human gates (when to
release, and
the tag push (auto-push mode; in manual push mode the user pushes main,
develop and the tag in one command)). A human gate sits BETWEEN the two
spans by construction, so the executor is never dispatched twice in one call.
develop and the tag in one command)). A human gate sits between the prep
span and the finish (STEP 4), so the executor is never dispatched twice.
## When to use
- `develop` is ahead of `main` and you want to publish a version.
@@ -40,7 +41,7 @@ Not for: integrating a feature/bugfix → `gitflow finish` (via /ship-feature).
- The number DERIVES from the change nature (semver), not the reverse: a migration-requiring/breaking change → MAJOR; new features → MINOR; fixes → PATCH. Personal repo ⇒ "breaking" = requires a migration of your own usage. Decide the number BEFORE running.
## Flow
**REQUIRED:** `lib/gitflow.sh` (the release mechanic, via the `release-executor` subagent). Clean tree, identity set, `develop` ahead of `main`.
**REQUIRED:** `lib/gitflow.sh` (the release mechanic; the `release-executor` subagent runs the prep only). Clean tree, identity set, `develop` ahead of `main`.
### STEP 1 — Preconditions
```bash
@@ -84,16 +85,19 @@ Proceed only on an explicit human go. **Never fire on "tests pass"** — a
green suite means ready to release, not authorized to. `hold` → stop here;
the prepped `release/<X.Y.Z>` branch stays as-is for a later run.
### STEP 5 — Dispatch: finish + tag
### STEP 5 — Finish + tag (main loop)
The finish runs HERE: the `ask` rule on `gitflow.sh finish` prompts, and a
sub-agent cannot put that prompt to you (BLK-018 option b).
```bash
git branch --show-current # must print release/<X.Y.Z>, else STOP
bash "$HOME/.claude/lib/gitflow.sh" finish
```
Agent(subagent_type="release-executor")
prompt: "SPAN: finish <X.Y.Z>"
Prompt declined → nothing merged, the release branch kept: say so and STOP.
A merge conflict → STOP, surface it verbatim (a human call). Then, on main:
```bash
git tag -a v<X.Y.Z> main -m "release <X.Y.Z>"
```
Parse the `RELEASE-EXEC REPORT`:
- `STATUS: DONE` → continue to STEP 6, carrying the `TAG` value forward.
- `STATUS: BLOCKED` → surface the blocker verbatim (e.g. a merge conflict
the fan-out hit), STOP — resolving a conflicted fan-out is a human call,
not an auto-retry.
The tag stays local until STEP 6. Carry `TAG=v<X.Y.Z>` forward.
### STEP 6 — Tag push GATE (ASK)
Read the state, separate Bash calls: