pi-dev-flow 0.88.0 → 0.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.89.0] - 2026-11-09
8
+
9
+ **The release call is made with Verified?, and Release? answers itself when nothing but the release prep changed.**
10
+
11
+ - The versioned-or-unreleased call is now made with Verified? instead of at Release? (gh#198). On a versioned project the Verified? question also asks "a patch, minor or major release, or merge unreleased?", and `flow verify --confirmed --version=patch|minor|major` (or an exact version) / `--no-version` records the answer, so pre-release prepares the right bump (or the Unreleased line) the first time. A playbook can make the call for every flow with `version = versioned | unversioned`. A patch/minor/major call is counted from the newest tag at release time, so when another flow ships the number first the gate names the next one instead of looping between "already tagged" and "not the chosen version". The release gate refuses a bump that doesn't match the call, an exact version another flow already took (with a request to ask the operator again), and a bump on a flow that merges unreleased.
12
+ - Release? now answers itself by default (`ask = on-change` in `## release`) when the call is on record and nothing but release prep landed after Verified?. It still asks, and says why, when code changed after Verified?, no call is recorded, the session build is stale, `yolo = until-release` is set, or a playbook-made versioned call turns out to be a major bump. Set `ask = always` to have Release? asked on every flow, as before.
13
+
7
14
  ## [0.88.0] - 2026-11-09
8
15
 
9
16
  **Recording a release waits for its CI, review fixes can be re-verified, and `--confirmed` needs your actual word.**
package/README.md CHANGED
@@ -103,6 +103,7 @@ walking five stages with a gate between each:
103
103
  │ pre-release │ review, docs, changelog entry, version bump
104
104
  └────────┬────────┘
105
105
  Release? · refuses unless the version passes the last tag and the changelog agrees
106
+ (answers itself when only that prep changed since Verified?)
106
107
  ┌────────▼────────┐
107
108
  │ release │ PR → merge → annotated tag → release notes
108
109
  └────────┬────────┘
@@ -115,12 +116,12 @@ walking five stages with a gate between each:
115
116
  | Stage | What the agent does | It asks you |
116
117
  |---|---|---|
117
118
  | **plan** | reads the code, asks its clarifying questions, writes the spec to `.dev-flow/session-renewal/plan/plan.md` | **Approve?** — the plan is right, build it |
118
- | **implement** | works in a fresh worktree on `feat/session-renewal`, commits in small steps, runs your `test` command to green, walks the manual checks with you | **Verified?** — after you used it running |
119
- | **pre-release** | review and fixes, docs, changelog, version bump, checks re-run; shows the PR summary and the version it means to tag | **Release?** — ship it |
119
+ | **implement** | works in a fresh worktree on `feat/session-renewal`, commits in small steps, runs your `test` command to green, walks the manual checks with you | **Verified?** — after you used it running; with it, the release call: a patch, minor or major release, or merge unreleased |
120
+ | **pre-release** | review and fixes, docs, changelog, the bump you chose, checks re-run; shows the PR summary and the version it tags | **Release?** — only when something beyond that prep changed since Verified? (set `ask = always` under `## release` to be asked every time) |
120
121
  | **release** | PR → merge → annotated tag → release notes; only here may git touch main | **Finish?** — clean up, we're done |
121
122
  | **done** | removes the worktree, branch and `.dev-flow/session-renewal/` | — |
122
123
 
123
- Four answers from you; everything between them was the agent's problem and your playbook's gates. If
124
+ Three or four answers from you; everything between them was the agent's problem and your playbook's gates. If
124
125
  the feature grows mid-flight it is folded into this one (the plan gains an `Added mid-stage:` line and
125
126
  checks re-run); a *different* problem waits for the next flow — one feature, one plan, one PR.
126
127
 
@@ -131,8 +132,10 @@ Your answers at a checkpoint:
131
132
  back with every check still enforced. Attach your wishes to the word: *"yolo, patch bump"*,
132
133
  *"yolo, no tag"*. Release? is asked anyway when commits landed after Verified?, or always when
133
134
  the playbook sets `yolo = until-release` under `## release`.
134
- - **no version this time** (at Release?) — merge and changelog land, no bump or tag; the next
135
- versioned release folds your `Unreleased` entry under its heading.
135
+ - **merge unreleased** (the release call at Verified?, or a change of mind at Release?) — merge and
136
+ changelog land, no bump or tag; the next versioned release folds your `Unreleased` entry under its
137
+ heading. A patch/minor/major call is turned into a number when the release runs, so a parallel flow
138
+ that ships first just moves yours to the next one.
136
139
 
137
140
  Two things you grant rather than run: a **mode** when the agent proposes one (`normal` is the
138
141
  default; `--patch` for a small change you intend to ship now, `--docs` for docs-only work — both skip
package/docs/gates.md CHANGED
@@ -17,8 +17,8 @@ so it needs no `--confirmed`. The agent's own `flow` call never opens a dialog (
17
17
  | `test` | records a check | — (runs the `test` command/check, records pass/fail) |
18
18
  | `check` | records all tier-1 checks | — (runs every `flow-check`/test/health from project.md `## implement`); a `--docs` feature runs none of them and says `docs mode: project commands skipped` — a docs flow builds nothing, so a fresh checkout must not read as a failed deploy (#96) |
19
19
  | `health` | records a check | — (runs `seedData` + the health command, retrying up to `healthWait` seconds; app must be up locally with real data) |
20
- | `verify [--yolo] [--port=<n>\|--replace]` | implement → pre-release | **at pre-release it is the re-verify** (gh#187): after review fixes it runs the same build, deploy and probes over the current tree (no rebase), re-asks Verified? — a standing yolo never answers it — and on the answer moves the verdict (`verifiedHead`) to that tree, staying in pre-release; **without `--confirmed` it is the review deploy**: it fetches and, when the branch is behind `origin/<default>` (or local `<default>` with no remote), **rebases** it — untracked files never block, uncommitted tracked edits and conflicts refuse (the rebase is aborted, the branch untouched); when the dev port (playbook `port`, or the whole stack when none is set) was last deployed by **another live flow** it refuses with `NEEDS-OPERATOR Dev port?`, the measured RAM/disk against `instanceMem`/`instanceDisk`, and the options: run alongside on the next free port (offered only when `parallelDev` is not `no`, `dev`/`health` read `$DEV_FLOW_PORT`, and the resources fit), `--replace`, or wait — nothing is built first; then it deploys and returns `deployed for review` with the chat question. **With `--confirmed`** it never rewrites history: a default branch that moved since refuses (re-run `flow verify`). With `servedBuild` set the served commit must be the worktree's HEAD. Otherwise: all tier-1 checks green — a check with no passing record is **run by the gate itself** (`checks ran at the gate (test)`) rather than refused and pointed at `flow check`, since entering the stage or editing the worktree is what cleared it — and so is a record whose worktree fingerprint differs from the tree now (`stale record(s) rerun after a worktree change: …`): a change made through bash fires no edit-tool hook, the fingerprint is what notices the tree moved — and a failure there prints the run output, **the feature branch holds at least one commit** (verify refuses a branch with nothing committed — the checks describe the working tree, so an uncommitted state has never been recorded — except a **release-only flow** (#161): on a versioned project an empty branch over unreleased commits on the default branch (since the newest local version tag, or all of them before the first release) passes, the line says `release-only flow: N unreleased commit(s)`, and the version bump is the pre-release commit; with nothing unreleased the refusal says there is nothing to release; and prints `commits: N ahead of <default>, M uncommitted path(s)` with what it ran; uncommitted paths are reported, never gated), build (if configured) green, `dev` deploy (if configured) runs first so you can review the running app **and the health probe (if configured) re-runs against what it just deployed, retrying every 2s up to `healthWait` seconds** (a failing probe refuses the gate and reports how many attempts it took: the `flow check` PASS predates the deploy, and a service that needs seconds after its container starts is not a broken deploy; with no probe the output says `health: none configured`); with **no `dev` command but a `health` probe configured the gate live-re-probes the app before asking** (`health: live re-probe PASS` — a killed server refuses with `live probe FAILED`, because process death dirties no worktree fingerprint and a green record alone cannot prove liveness: start the app and rerun), tier-2 checklist (ui-only items excluded for non-UI features) confirmed as a set; a `--docs` feature runs none of it (`docs mode: project commands skipped`) and only asks you; **one question** — or `--confirmed`; `--yolo --confirmed` = you answered 'yolo' at Verified? — answers it and pre-confirms the rest |
21
- | `release [--yolo|--no-version|--no-fold-check|--no-marker-check]` | pre-release → release | checks re-greened after the prep edits; `release.preflight` (when set) passes in the worktree — the build the tag will trigger, proven before anything ships; **the branch adds no merge-conflict marker lines** vs its merge base (#164: a hand-resolved merge that kept a `<<<<<<<`/`>>>>>>>` line is refused with `file:line`; `--no-marker-check` on the operator's word when the lines are meant); **commits after Verified?** are named in the Release? question and the approved line (#162: the operator's word covers the HEAD verify stamped — a warning, never a refusal); a **standing yolo** (given at an earlier checkpoint) does not answer Release? when such commits exist, nor ever under `yolo = until-release` in `## release` — the gate returns NEEDS-OPERATOR Release? (gh#176), while `--confirmed` (the operator's answer, a yolo said at Release? included) still passes; **the worktree holds no uncommitted paths** (gh#131: a merge ships the branch, not the working tree — an uncommitted fix at this gate is a fix that never ships; the refusal lists the paths, and the approved line prints `commits: N ahead of <default>, M uncommitted path(s)` like verify's); with `versioning.file`: the manifest version parses and is **not tagged yet** (the bump must be ahead of the last release); with `release.changelog` the gate **proves the entry mechanically** (#97): a **heading names the version** (prose that mentions it, or a `1.2.0-beta` section when releasing `1.2.0`, is not an entry), **this branch touched the file** (an inherited changelog is not release prep), **every entry that was pending before the release survives inside the new section** — compared on normalized lines, so re-indenting a fold is free while rewording or deleting one is refused by naming the line — and **nothing is left under `Unreleased`**. The proofs guard the **baseline's** pending lines — they do not freeze the wording of the entry this flow writes, so a branch that landed as several iteration commits is free to state its result as one entry (see the changelog-writer rule in the pre-release reference). The pending baseline is the newest tag's changelog (what actually shipped), else the branch's merge base; when neither resolves, the two git-dependent proofs are skipped **with a printed advisory** rather than refusing a legal release for a topology reason, and the content proofs (the heading, its body) always run; tier-2 `## pre-release` checklist confirmed; the manifest version it validates is **stamped as the release's version of record** (`release-done` publishes that, whatever the checkouts say later); **one question** (Release?) — or `--confirmed`; `--no-version` (your call at Release?) ships this flow as **merge + changelog** — the bump/tag requirements and the tag checks at `release-done` are skipped for it, but the branch must still add its **own line under `Unreleased`** (a `--docs` flow is exempt — #163: a playbook/docs change owes no user-facing entry; one it writes is welcome, not proven) (editing an older section releases nothing) and it rides there until the next versioned release folds it (default: versioned); `--no-fold-check` is the operator-granted escape from the line-level fold proofs — one flow, stamped in the gate output, the heading and touched proofs stay; **stale session build** (loaded build behind the checkout): the gate prints both builds, lists what shipped between them (those proofs will not run this release) and folds *update (/reload, then re-run) or proceed with the old release?* into the Release? question — the operator's word, recorded in the release output, **never a block**: publishing under an older gate is a legitimate choice (hotfix, offline reload) |
20
+ | `verify [--yolo] [--port=<n>\|--replace] [--version=<v>\|--no-version]` | implement → pre-release | **the release call rides on Verified?** (gh#198): on a versioned project (`versionFile`) whose playbook leaves `version = ask`, the NEEDS-OPERATOR Verified? also asks *a patch, minor or major release (each with the number it makes from the manifest's current version), or merge unreleased?*, and `--confirmed --version=patch|minor|major` (or an exact `--version=<v>`) / `--confirmed --no-version` records the answer (`release call: …` in the output, the version on the stage line) so pre-release prepares the right thing; a playbook `version = versioned \| unversioned` makes the call for every flow, and a re-verify keeps the recorded call unless it is given again; **at pre-release it is the re-verify** (gh#187): after review fixes it runs the same build, deploy and probes over the current tree (no rebase), re-asks Verified? — a standing yolo never answers it — and on the answer moves the verdict (`verifiedHead`) to that tree, staying in pre-release; **without `--confirmed` it is the review deploy**: it fetches and, when the branch is behind `origin/<default>` (or local `<default>` with no remote), **rebases** it — untracked files never block, uncommitted tracked edits and conflicts refuse (the rebase is aborted, the branch untouched); when the dev port (playbook `port`, or the whole stack when none is set) was last deployed by **another live flow** it refuses with `NEEDS-OPERATOR Dev port?`, the measured RAM/disk against `instanceMem`/`instanceDisk`, and the options: run alongside on the next free port (offered only when `parallelDev` is not `no`, `dev`/`health` read `$DEV_FLOW_PORT`, and the resources fit), `--replace`, or wait — nothing is built first; then it deploys and returns `deployed for review` with the chat question. **With `--confirmed`** it never rewrites history: a default branch that moved since refuses (re-run `flow verify`). With `servedBuild` set the served commit must be the worktree's HEAD. Otherwise: all tier-1 checks green — a check with no passing record is **run by the gate itself** (`checks ran at the gate (test)`) rather than refused and pointed at `flow check`, since entering the stage or editing the worktree is what cleared it — and so is a record whose worktree fingerprint differs from the tree now (`stale record(s) rerun after a worktree change: …`): a change made through bash fires no edit-tool hook, the fingerprint is what notices the tree moved — and a failure there prints the run output, **the feature branch holds at least one commit** (verify refuses a branch with nothing committed — the checks describe the working tree, so an uncommitted state has never been recorded — except a **release-only flow** (#161): on a versioned project an empty branch over unreleased commits on the default branch (since the newest local version tag, or all of them before the first release) passes, the line says `release-only flow: N unreleased commit(s)`, and the version bump is the pre-release commit; with nothing unreleased the refusal says there is nothing to release; and prints `commits: N ahead of <default>, M uncommitted path(s)` with what it ran; uncommitted paths are reported, never gated), build (if configured) green, `dev` deploy (if configured) runs first so you can review the running app **and the health probe (if configured) re-runs against what it just deployed, retrying every 2s up to `healthWait` seconds** (a failing probe refuses the gate and reports how many attempts it took: the `flow check` PASS predates the deploy, and a service that needs seconds after its container starts is not a broken deploy; with no probe the output says `health: none configured`); with **no `dev` command but a `health` probe configured the gate live-re-probes the app before asking** (`health: live re-probe PASS` — a killed server refuses with `live probe FAILED`, because process death dirties no worktree fingerprint and a green record alone cannot prove liveness: start the app and rerun), tier-2 checklist (ui-only items excluded for non-UI features) confirmed as a set; a `--docs` feature runs none of it (`docs mode: project commands skipped`) and only asks you; **one question** — or `--confirmed`; `--yolo --confirmed` = you answered 'yolo' at Verified? — answers it and pre-confirms the rest |
21
+ | `release [--yolo|--version=<v>|--no-version|--no-fold-check|--no-marker-check]` | pre-release → release | **the branch carries the release call** (gh#198), checked before the generic version proofs: a patch/minor/major call is **counted from the newest tag at release time**, so when a parallel flow released the number first the refusal names the new one (`bump VERSION to 1.2.0 (minor past 1.1.0) — v1.1.0 was released since Verified?`) and the call still stands; an exact version another flow already tagged is refused as **taken**, for the operator to re-make; a manifest that does not say the version the operator chose, or a bump on a flow whose call is *merge unreleased* (the manifest differs from the merge base's), is refused — re-make the call with `--version=<v>` / `--no-version` and `--confirmed` on the operator's word; **`release.ask = on-change`** (the default; `ask = always` asks every time) answers Release? itself (`auto-answered: release.ask = on-change — …` in the approved line) when the call is on record, a Verified? tree is on record, nothing but release prep landed after it, the session build is current, the playbook does not set `yolo = until-release`, and a playbook-made versioned call is not a major bump — otherwise Release? is asked as before, naming why (`asked: …`) — a call re-made on the release command without `--confirmed` is one of those reasons, since the call is the operator's, and with no call on record it asks that too; checks re-greened after the prep edits; `release.preflight` (when set) passes in the worktree — the build the tag will trigger, proven before anything ships; **the branch adds no merge-conflict marker lines** vs its merge base (#164: a hand-resolved merge that kept a `<<<<<<<`/`>>>>>>>` line is refused with `file:line`; `--no-marker-check` on the operator's word when the lines are meant); **commits after Verified?** are named in the Release? question and the approved line (#162: the operator's word covers the HEAD verify stamped — a warning, never a refusal); a **standing yolo** (given at an earlier checkpoint) does not answer Release? when such commits exist, nor ever under `yolo = until-release` in `## release` — the gate returns NEEDS-OPERATOR Release? (gh#176), while `--confirmed` (the operator's answer, a yolo said at Release? included) still passes; **the worktree holds no uncommitted paths** (gh#131: a merge ships the branch, not the working tree — an uncommitted fix at this gate is a fix that never ships; the refusal lists the paths, and the approved line prints `commits: N ahead of <default>, M uncommitted path(s)` like verify's); with `versioning.file`: the manifest version parses and is **not tagged yet** (the bump must be ahead of the last release); with `release.changelog` the gate **proves the entry mechanically** (#97): a **heading names the version** (prose that mentions it, or a `1.2.0-beta` section when releasing `1.2.0`, is not an entry), **this branch touched the file** (an inherited changelog is not release prep), **every entry that was pending before the release survives inside the new section** — compared on normalized lines, so re-indenting a fold is free while rewording or deleting one is refused by naming the line — and **nothing is left under `Unreleased`**. The proofs guard the **baseline's** pending lines — they do not freeze the wording of the entry this flow writes, so a branch that landed as several iteration commits is free to state its result as one entry (see the changelog-writer rule in the pre-release reference). The pending baseline is the newest tag's changelog (what actually shipped), else the branch's merge base; when neither resolves, the two git-dependent proofs are skipped **with a printed advisory** rather than refusing a legal release for a topology reason, and the content proofs (the heading, its body) always run; tier-2 `## pre-release` checklist confirmed; the manifest version it validates is **stamped as the release's version of record** (`release-done` publishes that, whatever the checkouts say later); **one question** (Release?) — or `--confirmed`; `--no-version` (your call at Release?) ships this flow as **merge + changelog** — the bump/tag requirements and the tag checks at `release-done` are skipped for it, but the branch must still add its **own line under `Unreleased`** (a `--docs` flow is exempt — #163: a playbook/docs change owes no user-facing entry; one it writes is welcome, not proven) (editing an older section releases nothing) and it rides there until the next versioned release folds it (default: versioned); `--no-fold-check` is the operator-granted escape from the line-level fold proofs — one flow, stamped in the gate output, the heading and touched proofs stay; **stale session build** (loaded build behind the checkout): the gate prints both builds, lists what shipped between them (those proofs will not run this release) and folds *update (/reload, then re-run) or proceed with the old release?* into the Release? question — the operator's word, recorded in the release output, **never a block**: publishing under an older gate is a legitimate choice (hotfix, offline reload) |
22
22
  | `release-done` | records the release (the stage stays `release`) | **no question — the Release? answer covered the publication**; verify approval; the version published is the one `release` **stamped** from the manifest it validated (a main checkout still behind cannot republish the previous version), and it must not be older than the newest matching tag **on origin** (tag lists come from `git ls-remote`, so an unfetched clone does not decide what exists; when an origin exists but cannot be asked (offline, no ssh agent) **both release gates refuse** rather than answering with local tags); with `versioning.file`: that tag exists, is reachable from the default branch **and is on origin** (a local-only tag is not a release); with `release.artifact`: the published-artifact check runs (`{version}`/`{tag}` placeholders — the line it prints names the version it verified; skip once with `--no-artifact-check`, operator-instructed only; on GitHub a miss right after the tag push **waits for the CI runs that tag started** — up to 15 min, plus a minute's grace for a registry that lags the green run — then probes again, and a refusal names a failed or still-running run with its URL, gh#179) · creates the forge release from the tag, its body **the `release.changelog` entry for that version** — the changelog is the source of truth, and the tag's annotation stands in only when the changelog has no entry for the version, else nothing (and it says why — a body that is really a shell error is dropped, never shipped) — `gh` for GitHub, `glab` for GitLab) and then **proves the release exists**: it asks the forge (`gh release view <tag>` / `glab release view <tag>`) and refuses when nothing is there, because #51, #60 and #63 were three ways of ending `release recorded as complete` with nothing published — and when the changelog was the body it **reads the stored body back** and refuses a mismatch, so the release page and the changelog cannot drift (#97; normalized before comparing, skipped with a printed note on another forge). Skipping is deliberate and loud — `--no-release-create`, `release.releases = false` or `forge = self` each print that no forge release was created, and the view check is skipped for them; **with a `merge` policy** it also proves the merge that shipped matches it — branch ancestry plus what the forge says (`gh pr view` / `glab api`), so a squash under `merge = merge` (or a merge commit under `merge = squash`) refuses the release record, while a shape it cannot see prints an advisory instead (#97's split: an invisible topology never blocks a legal release); when the release went out on a stale build the operator acknowledged at the release gate, it prints that acknowledgement in place of the after-the-fact version-skew warning, and that warning prints the session vs disk version pair plus the duplicate-copy note when a second copy is registered (#117) |
23
23
  | `finish [--yolo] [--no-reflect] [--note=<text>] [slug]` | release → done — **records an unrecorded release first** (published but `release-done` never ran: finish runs its proofs itself — that gate asks nothing, so it is not a separate step; its refusal is finish's) — **then the closing reflection**: while no reflection is recorded for the flow, finish starts the reflect worker before it touches anything and stops for the operator's fold/drop (or Finish? when nothing was found); a flow with **no friction** (no gate refusal, no guard block, no `--note`) skips the worker unless the playbook sets `reflect = always`; the re-run with `--confirmed` does the cleanup. `--no-reflect --confirmed` skips it on the operator's explicit word (yolo never does); `--note=` hands the worker the operator's friction notes. Cleanup (removes worktree + branch, deletes `.dev-flow/<slug>/`, and deletes `origin/<branch>` **only** when its merged state is verified — ancestor of the default branch or a merged PR/MR via `gh`/`glab`; unverifiable branches stay with a note) | a release is recorded (`release-done` ran), the main checkout is clean **and** pushed to `origin/<default>`, and the worktree has no uncommitted changes (the refusal lists the paths, not just the count — gh#131); when the clean checkout trails `origin/<default>` the gate **fast-forwards local main** as it closes out (never a merge — anything that cannot fast-forward prints the operator's exact `git pull --ff-only` command); **one question** (Finish? — mentions unmerged-looking commits with the playbook's `merge` policy in mind, and warns when the forge release create failed at `release-done` and no retry succeeded) — or `--confirmed`; under `merge = merge`, commits that never reached the default branch are a **policy violation**: `yolo` does not answer it, only your explicit answer does; to abandon an unreleased feature use `abort` |
24
24
  | `reflect ["<note>"|list|tidy|move <n> --playbook|--code|done <n> ["<what>"]]` | — | `reflect "<note>"` queues a suggestion in **this project's** `reflections.md` (never gates; gate flags such as `--confirmed` are ignored, they never become part of the note). `--playbook` (alias `--docs`) files it under `## playbook` — the fix lives only in `project.md`, a docs flow implements it; `--code` files it under `## code` — the fix touches project code, a patch flow implements it. `--plugin` **never writes**: dev-flow feedback is filed upstream, so it prints the recipe — `gh issue list --repo <dev-flow repo> --state all --search …` first, then `gh issue create` with a body ending `— reflection from <slug> <date>` (in the dev-flow repo itself plugin is code → `## code`). With no flag the wording guesses (plugin-shaped → the recipe; otherwise `## playbook`) and the echo prints why. `reflect list` numbers the open items with their section; `reflect move <n> --playbook|--code` re-files one; `reflect done <n> ["<what>"]` checks a fixed one off (`— fixed: <date> <slug> — <what>`) so doctor stops re-reporting it; a legacy `## plugin` row is flagged by list and doctor (file it upstream, check it off `— filed: gh#NNN`). `reflect tidy` drops the closed (`- [x]`) items — the preamble and open items stay verbatim and a `## section` heading left empty goes with its items. **Nudges are timed, not constant**: `⚑ fix the open reflections now?` prints when an item recurred this session, is ≥ 14 days old, ≥ 3 playbook items wait, or a code item waits while between flows — at finish, in an unbound session and in doctor, never mid-feature; `↻ N closed reflection(s)` prints at ≥ 5 closed, closed ≥ open (≥ 3), or a closed item ≥ 30 days old. Bare `reflect` prints the **session-reflection protocol** (from the `/flow reflect` bar it additionally wakes the model): bound to a flow, delegate the review to `flow_stage` op `reflect`; unbound, review inline; re-check every open item against the playbook and **newer dev-flow versions** (`npm view pi-dev-flow version`; the operator performs updates); show the operator a numbered list with a fold/drop recommendation per finding and stop; fold docs/code → `reflect --playbook|--code`, fold plugin → the upstream issue, drop → nothing recorded |
package/docs/playbook.md CHANGED
@@ -171,6 +171,12 @@ gate prints `health: none configured` and `flow doctor` flags the combination. T
171
171
  `merge = squash | merge | rebase | any` — how a merged PR lands on the default branch (see below) — and
172
172
  `yolo = all | until-release`: with `until-release` a yolo given at an earlier checkpoint never answers Release?
173
173
  (for repos whose rules want the release word given after the commits exist; default `all`) — and
174
+ `version = ask | versioned | unversioned` (gh#198): who makes the release call — `ask` (default) puts *a patch, minor or
175
+ major release, or merge unreleased?* into the Verified? question (a kind is turned into a number at release, from the
176
+ newest tag, so parallel flows never fight over one); the other two make it for every flow — and
177
+ `ask = on-change | always`: with `on-change` (default) Release? answers itself when the call is on record and nothing but
178
+ release prep (the bump, the changelog) changed since Verified? (a stale build, `yolo = until-release` or a major
179
+ bump the operator did not name still ask; `always` asks it every flow, as before 0.89) — and
174
180
  `reflect = on-friction | always`: when `flow finish` runs the closing reflection worker. `on-friction` (default)
175
181
  skips it for a flow that hit no gate refusal and no guard block and carries no `--note`; `always` runs it every
176
182
  time. `## global` also takes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dev-flow",
3
- "version": "0.88.0",
3
+ "version": "0.89.0",
4
4
  "description": "Enforced feature workflow for Pi: plan → implement → pre-release → release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -35,7 +35,13 @@ note). Other sessions' worktrees are theirs.
35
35
  — say what changed for the user and how to see it, not which modules
36
36
  changed.
37
37
  Report opening: **🔨 implement · `<slug>`** (the gate's stage line).
38
- 3. Answer → `flow verify --confirmed` (yolo → `--yolo --confirmed`). If the
38
+ - Versioned project, playbook `version = ask` (the default): the gate's
39
+ question also asks the **release call** — a patch, minor or major
40
+ release (propose one by the playbook's versioning rule) or merge
41
+ unreleased. Record the kind, not a number, unless the operator names one:
42
+ the gate counts it from the newest tag, so a parallel release moves it.
43
+ 3. Answer → `flow verify --confirmed` (yolo → `--yolo --confirmed`), plus
44
+ `--version=patch|minor|major` (or `--version=<exact>`) or `--no-version`. If the
39
45
  default branch moved since the review deploy it refuses: run `flow verify`
40
46
  again first. Fixes → iterate and re-verify; that loop is free.
41
47
 
@@ -17,7 +17,11 @@ and settle the scheme with the operator; never invent one.
17
17
  Otherwise `flow release` warns that the fix shipped after Verified?.
18
18
  2. **Docs**: update them to match the change.
19
19
  3. **Changelog + bump** — manifest, changelog heading and tag must agree;
20
- commit the prep on the feature branch.
20
+ commit the prep on the feature branch. The release call recorded with
21
+ Verified? decides which: its kind, counted from the newest tag (the gate
22
+ names the number — another flow that released first moves it), an exact
23
+ version (taken by another flow → ask again, never pick one), or
24
+ *merge unreleased* — no bump, the line goes under `Unreleased`.
21
25
  - **The changelog writer reviews the branch, not its commit list**: read
22
26
  `git log <default>..HEAD` *and* `git diff <default>...HEAD`, then write
23
27
  what the branch delivers in the reader's terms (what was broken, what
@@ -32,17 +36,25 @@ and settle the scheme with the operator; never invent one.
32
36
  changelog this branch never touched. `--no-fold-check` only on the
33
37
  operator's word.
34
38
  4. `flow check` — the prep made the earlier checks stale.
35
- 5. **Ask Release? and stop.** Say in a few lines what the PR delivers (the
36
- changelog entry usually is that), plus the version. Report opening: **🔍 pre-release · `<slug>`** (the gate's
37
- stage line; the version field reads `pending` until decided — never
38
- invent a bump or a no-version decision). Answer → `flow release
39
- --confirmed`.
39
+ 5. **Run `flow release`.** By default (`ask = on-change`) it answers
40
+ Release? itself when the release call is on record and only the prep
41
+ landed since Verified? — say in a few lines what the PR delivers (the
42
+ changelog entry usually is that) and the version, and carry on with the
43
+ release stage.
44
+ 6. **It returned `NEEDS-OPERATOR Release?`** (it says why: code after
45
+ Verified?, no call on record, a stale build, `yolo = until-release`, a
46
+ major bump, or the playbook's `ask = always`) → **ask Release? and
47
+ stop**, with the same summary and the version. Report opening:
48
+ **🔍 pre-release · `<slug>`** (the gate's stage line; the version field
49
+ reads `pending` until decided — never invent a bump or a no-version
50
+ decision). Answer → `flow release --confirmed`.
40
51
  - Standing yolo → run `flow release` without asking. It still returns
41
52
  `NEEDS-OPERATOR Release?` when commits landed after Verified? or the
42
53
  playbook says `yolo = until-release` — then ask.
43
54
  - Operator ships **without a version** → `flow release --no-version
44
55
  --confirmed`: no bump or tag, but the branch must add its line under
45
- `Unreleased`.
56
+ `Unreleased`. A changed call is `--version=<v>` / `--no-version` with
57
+ `--confirmed`, on their word.
46
58
 
47
59
  The gate re-checks tier-1, requires the manifest ahead of the last tag and a
48
60
  changelog **heading** for that version written on this branch.
@@ -3,7 +3,8 @@
3
3
  ## Stage: release
4
4
 
5
5
  Main-repo git (merge, tag, push on the default branch) is allowed only here.
6
- Nothing in this stage asks the operator anything — Release? covered it. Report
6
+ Nothing in this stage asks the operator anything — Release? covered it (answered
7
+ by the operator, or by the gate itself under `ask = on-change`). Report
7
8
  each step with the gate's stage line, **🚀 release · `<slug>`**; no `Done:` /
8
9
  `Next steps:` block.
9
10
 
package/src/core.ts CHANGED
@@ -48,6 +48,8 @@ export interface FlowState {
48
48
  staleBuild?: string; // release ran under an older dev-flow than the checkout by operator choice ("<loaded> (checkout <disk>)"); release-done repeats the acknowledgement
49
49
  pendingAsk?: string; // the checkpoint word a gate asked for and has not been given ("Approve?", "Verified?", …) — presentation only (💬 in the footer), it never gates
50
50
  releaseOnly?: boolean; // verify found nothing on the branch but unreleased work on main: this flow only cuts the version (#161)
51
+ versionChoice?: string; // the operator's release call, recorded with Verified? (gh#198): patch | minor | major (counted from the newest tag at release, so a parallel flow taking the number moves it), an exact version, "next" (playbook version = versioned: any bump past the last tag) or "unreleased"
52
+ versionFrom?: string; // the manifest version when the call was recorded — what a patch/minor/major call was counted from at Verified?
51
53
  verifiedHead?: string; // HEAD the operator's Verified? was given over — release names commits after it, so the word is not recorded as the verdict for a tree nobody looked at (#162)
52
54
  reflectedAt?: string; // a reflect worker reported for this flow — finish runs one first while this is unset (only --no-reflect --confirmed skips it)
53
55
  devPort?: number; // the port the operator chose for this flow's dev deploy when the default was held by another flow — finish stops it (devDown)
@@ -119,7 +121,7 @@ export interface Config {
119
121
  /** Bytes one dev instance needs (playbook `instanceMem` / `instanceDisk`, e.g. 2G) — the side-by-side feasibility check. */
120
122
  instanceMem?: number;
121
123
  instanceDisk?: number;
122
- release: { review: string; changelog?: string; releases?: boolean; artifact?: string; preflight?: string; merge?: MergeStyle | "any"; /** `until-release`: a standing yolo never answers Release? (gh#176) */ yolo?: "all" | "until-release"; /** `always`: finish runs the closing reflection even on a flow with no friction */ reflect?: "always" | "on-friction" };
124
+ release: { review: string; changelog?: string; releases?: boolean; artifact?: string; preflight?: string; merge?: MergeStyle | "any"; /** `until-release`: a standing yolo never answers Release? (gh#176) */ yolo?: "all" | "until-release"; /** `always`: finish runs the closing reflection even on a flow with no friction */ reflect?: "always" | "on-friction"; /** who decides versioned vs unreleased: asked with Verified? (`ask`, default) or fixed by the playbook (gh#198) */ version?: "ask" | "versioned" | "unversioned"; /** `on-change` (default): Release? answers itself when nothing but release prep changed since Verified? and the version choice is on record; `always` asks it every time (gh#198) */ ask?: "always" | "on-change" };
123
125
  mainHook: boolean; // flow init installs a pre-commit hook blocking main commits
124
126
  /** `inject` (default): the class default timeout is armed silently on every shell call.
125
127
  * `require`: a shell call without its own visible timeout is refused (costs a turn per miss). */
@@ -497,6 +499,49 @@ export function pickReleaseNotes(src: { changelog: string | null; version: strin
497
499
  return { notes: "", source: "none" };
498
500
  }
499
501
 
502
+ /** gh#198 — the operator's release call: a bump kind (`patch|minor|major`, turned into a number at release from
503
+ * the newest tag), an exact version (`1.2.0`, a pre-release suffix allowed), `next` (the playbook says
504
+ * versioned: any bump past the last tag) or `unreleased` (merge + changelog only). */
505
+ export const VERSION_ARG_RE = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/;
506
+ export type BumpKind = "patch" | "minor" | "major";
507
+ export const isBumpKind = (c: string | null | undefined): c is BumpKind => c === "patch" || c === "minor" || c === "major";
508
+
509
+ /** `from` bumped by one `kind` step (a pre-release suffix is dropped), or null when `from` is not x.y.z. */
510
+ export function bumpVersion(from: string | null | undefined, kind: BumpKind): string | null {
511
+ const m = from?.match(/^(\d+)\.(\d+)\.(\d+)/);
512
+ if (!m) return null;
513
+ const [maj, min, pat] = [Number(m[1]), Number(m[2]), Number(m[3])];
514
+ return kind === "major" ? `${maj + 1}.0.0` : kind === "minor" ? `${maj}.${min + 1}.0` : `${maj}.${min}.${pat + 1}`;
515
+ }
516
+
517
+ /** The call a playbook makes for every flow (`release.version`), or undefined when the operator is asked. */
518
+ export const playbookVersionChoice = (cfg: Config): string | undefined =>
519
+ cfg.release.version === "versioned" ? "next" : cfg.release.version === "unversioned" ? "unreleased" : undefined;
520
+
521
+ /** `to` raises the major version over `from` (1.x → 2.0, and 0.x → 1.0). */
522
+ export function majorBump(from: string, to: string): boolean {
523
+ const maj = (v: string) => Number.parseInt(v.split(".")[0] ?? "", 10);
524
+ return Number.isFinite(maj(from)) && Number.isFinite(maj(to)) && maj(to) > maj(from);
525
+ }
526
+
527
+ /** A recorded call in the operator's words. */
528
+ export const describeVersionChoice = (c: string, from?: string | null): string =>
529
+ c === "unreleased"
530
+ ? "merge unreleased (no bump, no tag)"
531
+ : c === "next"
532
+ ? "a versioned release (playbook: version = versioned)"
533
+ : isBumpKind(c)
534
+ ? `a ${c} release${bumpVersion(from, c) ? ` (${from} → ${bumpVersion(from, c)})` : ""}`
535
+ : `release ${c}`;
536
+
537
+ /** Does the version flag pair on a verify/release call parse? Returns the call it makes, null for none, or an error. */
538
+ export function versionArg(value: string | null, noVersion: boolean): { choice: string | null } | { error: string } {
539
+ if (value !== null && noVersion) return { error: "--version=<v> and --no-version contradict each other — pass the one the operator chose" };
540
+ if (value !== null && !isBumpKind(value.trim()) && !VERSION_ARG_RE.test(value.trim()))
541
+ return { error: `--version=${value} is not a release call — pass what the operator chose: patch, minor, major, or an exact version such as 1.4.0` };
542
+ return { choice: value !== null ? value.trim() : noVersion ? "unreleased" : null };
543
+ }
544
+
500
545
  /**
501
546
  * Gate: pre-release → release ("Release?"). Machine-proves the parts of release prep that can be
502
547
  * proven — checks re-greened after the prep edits, manifest bumped past the last tag, and the
@@ -2190,7 +2235,13 @@ export function nextHint(state: FlowState, cfg: Config): string {
2190
2235
  if (state.docs) return `edit in ${state.worktree} (docs mode: no project commands), tick the tier-2 checklist with the operator, ask Verified?, then flow verify --confirmed`;
2191
2236
  return `build and test in ${state.worktree}, commit as you go, flow check; then flow verify (deploys for review), look yourself, keep the app running, ask Verified? and run flow verify --confirmed on the answer`;
2192
2237
  case "pre-release": {
2193
- const prep = [cfg.release.changelog ? `prepare ${cfg.release.changelog} (fold Unreleased lines verbatim)` : "", cfg.versioning.file ? `bump version in ${cfg.versioning.file}` : ""].filter(Boolean).join(" and ");
2238
+ // gh#198: the release call made with Verified? decides which prep this is
2239
+ const vc = state.versionChoice;
2240
+ const auto = cfg.release.ask !== "always" ? " (release.ask = on-change: it asks Release? only when something beyond the prep changed)" : "";
2241
+ if (vc === "unreleased")
2242
+ return `${cfg.release.review}, fix must/should${state.docs ? "" : " (a fix that changes behaviour: flow verify redeploys and re-asks Verified? over it)"}, update docs${cfg.release.changelog && !state.docs ? `, add this flow's line under Unreleased in ${cfg.release.changelog} (the call is merge unreleased: no bump)` : ""}, flow check; show the PR summary, then run flow release${auto || " and ask Release?"}`;
2243
+ const prep = [cfg.release.changelog ? `prepare ${cfg.release.changelog} (fold Unreleased lines verbatim)` : "", cfg.versioning.file ? `bump version in ${cfg.versioning.file}${isBumpKind(vc) ? ` to ${bumpVersion(state.versionFrom, vc) ?? `the next ${vc}`} (a ${vc} release, the operator's call — the gate counts it from the newest tag, so a flow that released first moves the number)` : vc && vc !== "next" ? ` to ${vc} (the operator's call)` : ""}` : ""].filter(Boolean).join(" and ");
2244
+ if (vc && prep) return `${cfg.release.review}, fix must/should${state.docs ? "" : " (a fix that changes behaviour: flow verify redeploys and re-asks Verified? over it)"}, update docs, ${prep}, flow check; show the PR summary, version and changelog, then run flow release${auto || " and ask Release?"}`;
2194
2245
  if (state.docs && prep) return `${cfg.release.review}, fix must/should; a docs flow usually ships unversioned — ask the operator (flow release --no-version on their word); versioned instead: ${prep}; then ask Release? and run flow release`;
2195
2246
  return `${cfg.release.review}, fix must/should${state.docs ? "" : " (a fix that changes behaviour: flow verify redeploys and re-asks Verified? over it)"}, update docs${prep ? `, ${prep}` : ""}, flow check; show the PR summary, version and changelog, ask Release? and run flow release`;
2196
2247
  }
package/src/present.ts CHANGED
@@ -117,7 +117,7 @@ export function stageLine(state: FlowState, cfg: Config, f: StageFacts = {}): st
117
117
  else if (items) fields.push("tier-2 `confirmed` ✓");
118
118
  }
119
119
  if (stage === "pre-release" || stage === "release") {
120
- const version = state.noVersion ? "version `no-version` ✓" : state.releaseVersion ? `version \`${state.releaseVersion}\` ✓` : f.manifest ? `version \`${f.manifest}\` ~` : "version `pending` ?";
120
+ const version = state.noVersion ? "version `no-version` ✓" : state.releaseVersion ? `version \`${state.releaseVersion}\` ✓` : state.versionChoice && state.versionChoice !== "next" && state.versionChoice !== "unreleased" ? `version \`${state.versionChoice}\` ✓` : f.manifest ? `version \`${f.manifest}\` ~` : "version `pending` ?";
121
121
  fields.push(version);
122
122
  const merge = cfg.release.merge;
123
123
  fields.push(merge ? `merge \`${merge}\` ✓playbook` : "merge `unset` ?");
@@ -207,7 +207,7 @@ export function agentText(text: string, v: GateView): string {
207
207
 
208
208
  /** Flags only dev-flow's gates take. A generic CLI flag (`docker compose up -d --no-deps`, `gh pr merge --merge`)
209
209
  * in a report of what the agent ran is not a dev-flow command handed to the operator. */
210
- const GATE_FLAGS = "confirmed|ui|patch|docs|yolo|replace|port|no-version|no-fold-check|no-marker-check|no-artifact-check|no-release-create|no-reflect|check-upstream|answers|answers-file|write-file|brief|brief-file|playbook|note";
210
+ const GATE_FLAGS = "version=|confirmed|ui|patch|docs|yolo|replace|port|no-version|no-fold-check|no-marker-check|no-artifact-check|no-release-create|no-reflect|check-upstream|answers|answers-file|write-file|brief|brief-file|playbook|note";
211
211
  const ASK_COMMAND_RE = new RegExp(`(?:^|[\\s\`'"(*_])/?flow (?:${FLOW_VERBS})\\b|(?:^|[\\s\`])--(?:${GATE_FLAGS})\\b|\\bflow_stage\\b|(?:^|[\\s\`])/flow\\b`);
212
212
  /** An imperative addressed to the operator: the verb opens a clause (or follows please/then/just), or a "you can" form. */
213
213
  const ASK_VERB_RE = /(?:^|[:;,.!?(—–]\s*|\b(?:please|then|just|now|simply|and)\s+)(?:run|type|enter|use|try|send|invoke)\b|\byou (?:can|could|may|should|need to|might)\b|\bplease\b/i;
package/src/projectmd.ts CHANGED
@@ -64,6 +64,8 @@ const KEYMAP: Record<string, Record<string, string>> = {
64
64
  merge: "release.merge", // how a merged branch lands: squash | merge | rebase | any
65
65
  yolo: "release.yolo", // how far a standing yolo reaches: all (default) | until-release (gh#176)
66
66
  reflect: "release.reflect", // when finish runs the closing reflection: on-friction (default) | always
67
+ version: "release.version", // who decides versioned vs unreleased: ask (with Verified?, default) | versioned | unversioned (gh#198)
68
+ ask: "release.ask", // when Release? is asked: on-change (default) | always (gh#198)
67
69
  },
68
70
  };
69
71
  // pre-release owns release preparation; the release keys are accepted under both sections so
@@ -178,6 +180,14 @@ export function parseProjectMd(text: string): ParsedMd {
178
180
  p.warn.push(`${where}: reflect = "${m[2]}" — expected always or on-friction, keeping on-friction`);
179
181
  return;
180
182
  }
183
+ if (mapped === "release.version" && !/^(ask|versioned|unversioned)$/.test(m[2].trim())) {
184
+ p.warn.push(`${where}: version = "${m[2]}" — expected ask, versioned or unversioned, keeping ask`);
185
+ return;
186
+ }
187
+ if (mapped === "release.ask" && !/^(always|on-change)$/.test(m[2].trim())) {
188
+ p.warn.push(`${where}: ask = "${m[2]}" — expected on-change or always, keeping on-change`);
189
+ return;
190
+ }
181
191
  p.flow[stage as MdStage][mapped] = m[2];
182
192
  }
183
193
  }
@@ -236,7 +236,7 @@ export async function releaseTags(root: string): Promise<string[] | null> {
236
236
  }
237
237
 
238
238
  export const GATE_HELP =
239
- "help [--json] | init [--force|--draft|--write <text>|--write-file <path>|--answers key=value…|--answers-file <path>] [--confirmed] [--track] | reflect [<note>|list|tidy|move <n> --playbook|--code|done <n> [<what>]] | roadmap [add <text> [--slug=<slug>] [--brief=<notes>|--brief-file=<path>]|pick <n> <slug>|done <n>|drop <n>|tidy] | doctor [<issue note>] | status [slug] [--json] | start <slug> [--ui|--patch|--docs --confirmed] [--force] [--merge=squash|merge|rebase|any] [--check-upstream] | use <slug> | test | check | health | approve [--yolo] | verify [--yolo] [--port=<n>|--replace] | release [--yolo|--no-version|--no-fold-check|--no-marker-check] | release-done [--no-artifact-check|--no-release-create] | finish [--yolo] [--no-reflect] [--note=<text>] [slug] | abort [slug] | version [--check-upstream] — state gates take [slug] and --confirmed (the operator already answered in chat); without it the agent's call returns NEEDS-OPERATOR with the question to ask in chat (it never opens a dialog), and the /flow slash command asks in a dialog — verify without --confirmed rebases a branch that is behind the default branch and deploys for review; --port=<n> / --replace answer its Dev port? question when another flow holds the stack — --ui/--patch/--docs and --merge=<style> on start are operator-granted (--confirmed); start refuses until the playbook has a merge policy and writes the answer into project.md — --yolo (with --confirmed) answers that checkpoint and pre-confirms every later one; checks and guardrails stay — release --no-version ships merge + changelog only (no bump, tag or forge release); --no-fold-check skips the changelog fold line proofs on the operator's word; --no-marker-check lets a branch add conflict-marker-shaped lines on purpose — finish runs the closing reflection worker first (before removing anything) and stops for the operator's fold/drop; the re-run with --confirmed cleans up; --no-reflect --confirmed skips it on the operator's explicit word (yolo never does), --note= hands the worker the operator's friction notes — release names a session running an older dev-flow build than the disk ships and asks update (/reload) or proceed — recorded, never a block — reflect <note> queues a project suggestion in reflections.md (--playbook = docs-flow fix, --code = patch-flow fix); --plugin never writes — dev-flow feedback goes upstream and it prints the GitHub issue recipe; bare reflect prints the session-reflection protocol (bound: run flow_stage op reflect); list numbers open items, move <n> re-files one, done <n> checks a fixed one off, tidy drops closed ones — roadmap manages .dev-flow/roadmap.md: pick <n> <slug> (or add --slug=) stamps an item for flow start, which seeds the new plan from its brief; finish checks it off; drop <n> removes an item nobody wants any more (done would record it as shipped) — a new feature asked for mid-flow is parked there, never as a hand-made .dev-flow/<slug>/; start <slug> --confirmed adopts such a ghost dir — doctor reviews structure, git consistency and open reflections (never writes); doctor <note> prints an investigation brief — version prints the build the disk ships and any other dev-flow copies in this process (--check-upstream asks the registry)";
239
+ "help [--json] | init [--force|--draft|--write <text>|--write-file <path>|--answers key=value…|--answers-file <path>] [--confirmed] [--track] | reflect [<note>|list|tidy|move <n> --playbook|--code|done <n> [<what>]] | roadmap [add <text> [--slug=<slug>] [--brief=<notes>|--brief-file=<path>]|pick <n> <slug>|done <n>|drop <n>|tidy] | doctor [<issue note>] | status [slug] [--json] | start <slug> [--ui|--patch|--docs --confirmed] [--force] [--merge=squash|merge|rebase|any] [--check-upstream] | use <slug> | test | check | health | approve [--yolo] | verify [--yolo] [--port=<n>|--replace] [--version=<v>|--no-version] | release [--yolo|--version=<v>|--no-version|--no-fold-check|--no-marker-check] | release-done [--no-artifact-check|--no-release-create] | finish [--yolo] [--no-reflect] [--note=<text>] [slug] | abort [slug] | version [--check-upstream] — state gates take [slug] and --confirmed (the operator already answered in chat); without it the agent's call returns NEEDS-OPERATOR with the question to ask in chat (it never opens a dialog), and the /flow slash command asks in a dialog — verify without --confirmed rebases a branch that is behind the default branch and deploys for review; --port=<n> / --replace answer its Dev port? question when another flow holds the stack — --ui/--patch/--docs and --merge=<style> on start are operator-granted (--confirmed); start refuses until the playbook has a merge policy and writes the answer into project.md — --yolo (with --confirmed) answers that checkpoint and pre-confirms every later one; checks and guardrails stay — verify --confirmed carries the operator's release call: --version=<v> (ship that version) or --no-version (merge unreleased), asked with Verified?; release takes the same flags when the call changed — release --no-version ships merge + changelog only (no bump, tag or forge release); --no-fold-check skips the changelog fold line proofs on the operator's word; --no-marker-check lets a branch add conflict-marker-shaped lines on purpose — finish runs the closing reflection worker first (before removing anything) and stops for the operator's fold/drop; the re-run with --confirmed cleans up; --no-reflect --confirmed skips it on the operator's explicit word (yolo never does), --note= hands the worker the operator's friction notes — release names a session running an older dev-flow build than the disk ships and asks update (/reload) or proceed — recorded, never a block — reflect <note> queues a project suggestion in reflections.md (--playbook = docs-flow fix, --code = patch-flow fix); --plugin never writes — dev-flow feedback goes upstream and it prints the GitHub issue recipe; bare reflect prints the session-reflection protocol (bound: run flow_stage op reflect); list numbers open items, move <n> re-files one, done <n> checks a fixed one off, tidy drops closed ones — roadmap manages .dev-flow/roadmap.md: pick <n> <slug> (or add --slug=) stamps an item for flow start, which seeds the new plan from its brief; finish checks it off; drop <n> removes an item nobody wants any more (done would record it as shipped) — a new feature asked for mid-flow is parked there, never as a hand-made .dev-flow/<slug>/; start <slug> --confirmed adopts such a ghost dir — doctor reviews structure, git consistency and open reflections (never writes); doctor <note> prints an investigation brief — version prints the build the disk ships and any other dev-flow copies in this process (--check-upstream asks the registry)";
240
240
  export const featDir = (root: string, slug: string) => path.join(dfDir(root), slug);
241
241
  export const stateFile = (root: string, slug: string) => path.join(featDir(root, slug), "state.json");
242
242
  export const claimFile = (root: string, slug: string) => path.join(featDir(root, slug), "claim.json");
@@ -1,17 +1,34 @@
1
1
  /** dev-flow runtime — The gates that ship: verify, release, release-done, finish. Moved out of extensions/dev-flow.ts as is (exports added). */
2
2
  import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
3
  import path from "node:path";
4
- import { applicableItems, changelogVersionsBetween, normalizeReleaseBody, pendingEntryLines, pickReleaseNotes, checklistHash, checklistPending, cmpVersions, freshenChecks, healthProbe, mergeShapeProof, preReleaseGate, reflectionNudges, conflictMarkerLines, isReleaseOnly, looksLikeShellError, needsOperator, newestTaggedVersion, nextHint, releaseGate, parseVersion, roadmapDoneForSlug, sq, tagNotesCommand, verifyGate, versionTagGate, servedBuildMatches } from "../core.ts";
4
+ import { applicableItems, changelogVersionsBetween, normalizeReleaseBody, pendingEntryLines, pickReleaseNotes, checklistHash, checklistPending, cmpVersions, freshenChecks, healthProbe, mergeShapeProof, preReleaseGate, reflectionNudges, conflictMarkerLines, isReleaseOnly, looksLikeShellError, needsOperator, newestTaggedVersion, nextHint, releaseGate, parseVersion, roadmapDoneForSlug, sq, tagNotesCommand, verifyGate, versionTagGate, servedBuildMatches, versionArg, playbookVersionChoice, describeVersionChoice, majorBump, bumpVersion, isBumpKind } from "../core.ts";
5
+ import type { Config, FlowState } from "../core.ts";
5
6
  import { AGENT_MARK } from "../present.ts";
6
7
  import { buildSkew, copyWarning, currentBranch, featDir, flagValue, forgeMergeStyle, forgeOf, gateCwd, mergeBase, needState, now, originUrl, readReflectionsText, readRoadmap, readState, releaseTags, roadmapFile, sh, tail, worktreeAbs, writeState } from "./base.ts";
7
8
  import { type RunResult, branchState, catchUp, describeBranchState, devEnv, devPortOf, devSlotCheck, healthRerunsAfterDeploy, pendingChecks, probeHealth, readDevPorts, runChecks, slotKey, triedNote, unreleasedOnMain, worktreeFingerprint, writeDevPorts } from "./checks.ts";
8
9
  import { type GateCtx, markPendingAsk } from "./gates.ts";
9
10
 
11
+ /** gh#198: the version question asked with Verified? — null when it is not the operator's to answer here
12
+ * (no manifest to version, the playbook decides, or an earlier Verified? already recorded the call). */
13
+ function versionQuestion(root: string, state: FlowState, cfg: Config): { ask: string; flags: string } | null {
14
+ if (!cfg.versioning.file || playbookVersionChoice(cfg) || state.versionChoice) return null;
15
+ const file = path.join(gateCwd(root, state), cfg.versioning.file);
16
+ const now = existsSync(file) ? parseVersion(cfg.versioning.file, readFileSync(file, "utf8")) : null;
17
+ const kinds = (["patch", "minor", "major"] as const).map((k) => `${k}${bumpVersion(now, k) ? ` (→ ${bumpVersion(now, k)})` : ""}`).join(", ");
18
+ return {
19
+ ask: `also ask the release call: a ${kinds} release — propose one by the playbook's versioning rule${now ? ` (${cfg.versioning.file} is at ${now})` : ""} — or merge unreleased (no bump, no tag)${state.docs ? "; a docs flow usually merges unreleased" : ""}`,
20
+ flags: "--version=patch|minor|major (or the exact version they named) or --no-version (merge unreleased)",
21
+ };
22
+ }
23
+
10
24
  export async function gateVerify(o: GateCtx): Promise<RunResult> {
11
25
  const { root, ui, sess, cfg, flag, slugArg, takeYoloWord } = o;
12
26
  const { state, err } = needState(root, sess, slugArg);
13
27
  if (err) return err;
14
28
  const items = applicableItems(cfg, state!, "implement");
29
+ // gh#198: the release call (versioned vs unreleased) rides on the Verified? answer — the prep that follows depends on it
30
+ const verArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
31
+ if ("error" in verArg) return { text: `verify gate FAILED:\n- ${verArg.error}`, isError: true };
15
32
  // the operator reviews the tree that ships: catch up with the default branch before anything runs
16
33
  const caught = state!.stage === "implement" ? await catchUp(root, state!, cfg, flag("confirmed")) : { note: "" };
17
34
  if ("text" in caught) return caught;
@@ -109,7 +126,8 @@ export async function gateVerify(o: GateCtx): Promise<RunResult> {
109
126
  if (!ui.hasUI) {
110
127
  const port = devPortOf(state!, cfg);
111
128
  const what = state!.docs ? "ready for review" : cfg.commands.dev ? `deployed for review${port !== undefined ? ` on port ${port}` : ""}` : "live app re-probed for review";
112
- return { text: `${needsOperator(`${what}${reverify ? ` — a re-verify over the review fixes since ${state!.verifiedHead?.slice(0, 7) ?? "the last Verified?"}` : ""} — the app stays up until you answer`, "Verified?", "look at the change in the running app yourself first (the playbook's self-check), then ask the operator Verified? in chat and run flow verify --confirmed once they answer. Keep it running until they answer.")}\n${ran}` };
129
+ const vq = versionQuestion(root, state!, cfg);
130
+ return { text: `${needsOperator(`${what}${reverify ? ` — a re-verify over the review fixes since ${state!.verifiedHead?.slice(0, 7) ?? "the last Verified?"}` : ""} — the app stays up until you answer${vq ? ` — ${vq.ask}` : ""}`, "Verified?", `look at the change in the running app yourself first (the playbook's self-check), then ask the operator Verified? in chat and run flow verify --confirmed${vq ? ` ${vq.flags}` : ""} once they answer. Keep it running until they answer.`)}\n${ran}` };
113
131
  }
114
132
  const ok = await ui.confirm("Operator verification", `Verified? All checks green${cfg.commands.dev && !state!.docs ? `; dev deploy is up for review (${cfg.commands.dev})` : ""} \u2014 does it work?`);
115
133
  if (!ok) {
@@ -129,21 +147,38 @@ export async function gateVerify(o: GateCtx): Promise<RunResult> {
129
147
  const vHead = await sh("git rev-parse HEAD", gateCwd(root, state!));
130
148
  if (vHead.ok && vHead.out.trim()) state!.verifiedHead = vHead.out.trim();
131
149
  else delete state!.verifiedHead;
150
+ // gh#198: the operator's call, else the playbook's, else whatever an earlier Verified? recorded
151
+ const choice = verArg.choice ?? state!.versionChoice ?? playbookVersionChoice(cfg);
152
+ if (choice) {
153
+ if (choice !== state!.versionChoice || !state!.versionFrom) {
154
+ const mf = cfg.versioning.file ? path.join(gateCwd(root, state!), cfg.versioning.file) : "";
155
+ const from = mf && existsSync(mf) ? parseVersion(cfg.versioning.file!, readFileSync(mf, "utf8")) : null;
156
+ if (from) state!.versionFrom = from;
157
+ }
158
+ state!.versionChoice = choice;
159
+ if (choice === "unreleased") state!.noVersion = true;
160
+ else delete state!.noVersion;
161
+ }
162
+ const choiceNote = choice ? `\nrelease call: ${describeVersionChoice(choice, state!.versionFrom)}` : "";
132
163
  const before = state!.stage;
133
164
  state!.stage = "pre-release";
134
165
  delete state!.pendingAsk;
135
166
  writeState(root, state!);
136
167
  if (before === "pre-release")
137
- return { text: `re-verified${audit} over ${state!.verifiedHead?.slice(0, 7) ?? "the current tree"} — the Verified? word now covers the review fixes; still in pre-release.\n${ran}\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
138
- return { text: `verified${audit} — entering pre-release stage.\n${ran}\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
168
+ return { text: `re-verified${audit} over ${state!.verifiedHead?.slice(0, 7) ?? "the current tree"} — the Verified? word now covers the review fixes; still in pre-release.${choiceNote}\n${ran}\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
169
+ return { text: `verified${audit} — entering pre-release stage.${choiceNote}\n${ran}\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
139
170
  }
140
171
 
141
172
  export async function gateRelease(o: GateCtx): Promise<RunResult> {
142
173
  const { root, ui, sess, cfg, flag, slugArg, takeYoloWord } = o;
143
174
  const { state, err } = needState(root, sess, slugArg);
144
175
  if (err) return err;
145
- // operator's word at Release?: this flow ships without a version bump or tag — recorded only once Release? is answered
146
- const noVersion = flag("no-version") || !!state!.noVersion;
176
+ // operator's word at Release?: this flow ships without a version bump or tag — recorded only once Release? is answered.
177
+ // gh#198: --version=<v> / --no-version here re-make the call recorded with Verified? (the operator changed their mind)
178
+ const relArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
179
+ if ("error" in relArg) return { text: `release gate FAILED:\n- ${relArg.error}`, isError: true };
180
+ const choice = relArg.choice ?? state!.versionChoice ?? playbookVersionChoice(cfg);
181
+ const noVersion = choice === "unreleased" || (!relArg.choice && !!state!.noVersion);
147
182
  // (versioned) items stand down on an unversioned flow — the set confirmed here is the one that applies to it
148
183
  const items = applicableItems(cfg, { ...state!, noVersion }, "pre-release");
149
184
  // yolo is the operator's word at Release? — pre-confirms Finish?; publishing guardrails stay enforced
@@ -205,6 +240,33 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
205
240
  const prep = { manifestVersion: manifestVer, remoteTags, changelog, changelogChanged, changelogBase, noFoldCheck: flag("no-fold-check"), conflictMarkers, noMarkerCheck: flag("no-marker-check") };
206
241
  // same freshness rule as verify: a green predating a worktree write may not stand for the tree this gate blesses
207
242
  if (freshenChecks(state!, await worktreeFingerprint(wtCwd)).length) writeState(root, state!);
243
+ // gh#198: the branch must carry the call the operator made — a bump they did not choose, or a bump on a flow
244
+ // they said merges unreleased, is prep that contradicts the word Release? would stand on. It runs before the
245
+ // generic proofs: when a parallel flow released first, "already tagged" alone would send the agent round a loop.
246
+ const tagOf = (v: string) => cfg.versioning.pattern.replace("{version}", v);
247
+ const newest = cfg.versioning.file && !noVersion ? newestTaggedVersion(cfg.versioning.pattern, remoteTags) : null;
248
+ if (cfg.versioning.file && choice && choice !== "next") {
249
+ const re = "ask the operator, then re-run with --version=<their call> or --no-version and --confirmed on their answer";
250
+ let baseVer: string | null = null;
251
+ if (markerBase) {
252
+ const was = await sh(`git show ${sq(`${markerBase}:${cfg.versioning.file}`)} 2>/dev/null`, wtCwd);
253
+ baseVer = was.ok && was.out.trim() ? parseVersion(cfg.versioning.file, was.out) : null;
254
+ }
255
+ if (isBumpKind(choice)) {
256
+ // counted from what actually shipped last, so a flow that took the number first moves this one along
257
+ const from = newest ?? baseVer ?? state!.versionFrom ?? null;
258
+ const want = bumpVersion(from, choice);
259
+ const moved = from && state!.versionFrom && from !== state!.versionFrom ? ` — ${tagOf(from)} was released since Verified? (the call was counted from ${state!.versionFrom} then)` : "";
260
+ if (want && manifestVer !== want)
261
+ return { text: `release gate FAILED:\n- the operator's call is a ${choice} release: bump ${cfg.versioning.file} to ${want} (${choice} past ${from})${moved}, and head its changelog entry ${want} — it says ${manifestVer ?? "no version"}`, isError: true };
262
+ } else if (choice !== "unreleased") {
263
+ if (remoteTags.includes(tagOf(choice)))
264
+ return { text: `release gate FAILED:\n- ${choice}, the operator's call at Verified?, is taken: ${tagOf(choice)} was released since (another flow got there first) — ${re}; propose the same kind of step past ${newest ?? choice}, never pick the number yourself`, isError: true };
265
+ if (manifestVer && manifestVer !== choice)
266
+ return { text: `release gate FAILED:\n- the operator's release call is ${choice}, but ${cfg.versioning.file} says ${manifestVer} — bump it to ${choice}, or, if the call changed, ${re}`, isError: true };
267
+ } else if (manifestVer && baseVer && baseVer !== manifestVer)
268
+ return { text: `release gate FAILED:\n- the operator's call is to merge unreleased, but the branch bumps ${cfg.versioning.file} ${baseVer} → ${manifestVer} — revert the bump (the entry goes under Unreleased), or, if the call changed, ${re}`, isError: true };
269
+ }
208
270
  // tier-2 pre-release confirmation is recorded by this very command, so it is excluded here
209
271
  const preGate = preReleaseGate({ ...state!, noVersion, confirmations: { ...state!.confirmations, "pre-release": { hash: checklistHash(items), at: now() } } }, cfg, prep);
210
272
  if (preGate.length) return { text: `release gate FAILED:\n- ${preGate.join("\n- ")}`, isError: true };
@@ -274,12 +336,34 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
274
336
  : postVerify
275
337
  ? "a yolo given earlier does not cover commits that landed after Verified? — ask Release? with them named"
276
338
  : "";
277
- let audit = flag("confirmed") ? " (confirmed by operator instruction)" : state!.yolo ? " (yolo: pre-confirmed)" : "";
278
- const askPending = !flag("confirmed") && (!state!.yolo || !!yoloHeld);
339
+ // gh#198: release.ask = on-change — Release? answers itself when it would only re-confirm Verified?: the call
340
+ // is on record, nothing but release prep landed since, and no other question (stale build, a major bump) is open
341
+ const onChange = cfg.release.ask !== "always" && !flag("confirmed") && !state!.yolo;
342
+ const askWhy = !onChange
343
+ ? ""
344
+ : !state!.verifiedHead
345
+ ? "no Verified? tree on record to compare against"
346
+ : cfg.versioning.file && !choice
347
+ ? "no release call on record — ask it with Release?: patch, minor, major, or merge unreleased"
348
+ : relArg.choice && relArg.choice !== state!.versionChoice
349
+ ? `the release call changed since Verified? (${state!.versionChoice ?? "none"} → ${relArg.choice}) — the operator makes that call`
350
+ : postVerify
351
+ ? "commits beyond release prep landed after Verified?"
352
+ : stale
353
+ ? "the session build is behind the checkout"
354
+ : cfg.release.yolo === "until-release"
355
+ ? "the playbook sets yolo = until-release"
356
+ : choice === "next" && newest && manifestVer && majorBump(newest, manifestVer)
357
+ ? `${newest} → ${manifestVer} is a major bump — the playbook's versioned call does not choose that`
358
+ : "";
359
+ const auto = onChange && !askWhy;
360
+ let audit = flag("confirmed") ? " (confirmed by operator instruction)" : auto ? ` (auto-answered: release.ask = on-change — ${describeVersionChoice(choice ?? "next", state!.versionFrom)} was the call at Verified?, and only release prep landed since)` : state!.yolo ? " (yolo: pre-confirmed)" : "";
361
+ const askPending = !auto && !flag("confirmed") && (!state!.yolo || !!yoloHeld);
279
362
  if (askPending) {
280
363
  markPendingAsk(root, state!, "Release?");
281
364
  if (!ui.hasUI) {
282
- return { text: needsOperator(`ready to publish${yoloHeld ? ` (${yoloHeld})` : ""}${stale ? ` — also: ${staleAsk}` : ""}${postVerify ? ` — ${postVerify}` : ""}`, "Release?", `re-run with --confirmed once the operator answered 'Release?' in chat${stale ? " (and the stale-build question)" : ""}`), isError: true };
365
+ const callAsk = cfg.versioning.file && !choice ? " — also ask the release call: a patch, minor or major release, or merge unreleased (no bump, no tag)?" : "";
366
+ return { text: needsOperator(`ready to publish${yoloHeld ? ` (${yoloHeld})` : ""}${askWhy ? ` (asked: ${askWhy})` : ""}${stale ? ` — also: ${staleAsk}` : ""}${postVerify ? ` — ${postVerify}` : ""}${callAsk}`, "Release?", `re-run with --confirmed once the operator answered 'Release?' in chat${stale ? " (and the stale-build question)" : ""}${callAsk ? " (add --version=patch|minor|major, an exact version, or --no-version for their release call)" : ""}`), isError: true };
283
367
  }
284
368
  const ok = await ui.confirm("Enter release", `Release ${state!.slug}${manifestVer ? ` v${manifestVer}` : ""}${noVersion ? " (unversioned — merge + changelog entry only: no bump, no tag for this flow)" : ""}? Publishing starts: PR, merge${noVersion ? "" : ", tag"} — release-done afterwards needs no further answer.${staleAsk ? `\n\n${staleAsk}` : ""}${postVerify ? `\n\n${postVerify}` : ""}${yoloHeld ? `\n\n(${yoloHeld})` : ""}`);
285
369
  if (!ok) {
@@ -290,6 +374,8 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
290
374
  audit = " (confirmed in dialog)";
291
375
  }
292
376
  if (noVersion) state!.noVersion = true;
377
+ else delete state!.noVersion;
378
+ if (choice) state!.versionChoice = choice;
293
379
  if (unverifiedChange) state!.friction = (state!.friction ?? 0) + 1;
294
380
  state!.confirmations = { ...state!.confirmations, "pre-release": { hash: checklistHash(items), at: now() } };
295
381
  state!.approvals["pre-release"] = now();