pi-dev-flow 0.54.0 → 0.55.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 +6 -0
- package/docs/gates.md +2 -2
- package/docs/headless.md +5 -2
- package/extensions/dev-flow.ts +44 -11
- package/package.json +1 -1
- package/skills/dev-flow/SKILL.md +8 -3
- package/src/core.ts +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.55.0] - 2026-10-22
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **A stale session build is a question at `flow release`, not a stop.** Gates execute the dev-flow build the session loaded at start, and the checkout moves past it with every release — and shipping from behind had already cost releases: 0.53.0 and 0.53.1 were both published under 0.52.2 code (so #97's changelog proofs never fired and the release pages took tag annotations), and the 0.54.0 release itself ran under loaded 0.53.0, so its own new proofs (merge shape, artifact freshness) never fired in-session. The old answer was prose — *stop and ask the operator to `/reload` before publishing* — a refusal with no gate behind it, and a refusal is the wrong shape: publishing under an older gate is a legitimate operator choice (hotfix, offline reload), exactly the emergency the relaxed modes exist for. Now, when the loaded build is **behind** the checkout's, `flow release` prints both builds, lists the changelog versions that shipped between them (the proofs that will not run this release), and folds *update (`/reload`, then re-run) or proceed with the old release?* into the Release? question — still exactly one checkpoint. The decision is stamped into the release (`staleBuild`) and `release-done` repeats the acknowledgement in place of its bare after-the-fact warning, which stays as the backstop for headless runs; a session build **ahead** of the checkout's manifest is asked nothing, because no proof is missing there. `DEV_FLOW_LOADED_VERSION` lets the smoke suite stand in for an old session — the override can only ever make a gate more cautious, never lift a proof.
|
|
12
|
+
|
|
7
13
|
## [0.54.0] - 2026-10-22
|
|
8
14
|
|
|
9
15
|
### Added
|
package/docs/gates.md
CHANGED
|
@@ -16,8 +16,8 @@ so it needs no `--confirmed`.
|
|
|
16
16
|
| `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) |
|
|
17
17
|
| `health` | records a check | — (runs `seedData` + the health command, retrying up to `healthWait` seconds; app must be up locally with real data) |
|
|
18
18
|
| `verify [--yolo]` | implement → pre-release | 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 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 — 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`), 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 |
|
|
19
|
-
| `release [--yolo|--no-version|--no-fold-check]` | pre-release → release | checks re-greened after the prep edits; 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 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`** (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 |
|
|
20
|
-
| `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) · 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) |
|
|
19
|
+
| `release [--yolo|--no-version|--no-fold-check]` | pre-release → release | checks re-greened after the prep edits; 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 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`** (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
|
+
| `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) · 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 |
|
|
21
21
|
| `finish [--yolo] [slug]` | release → done (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; **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` |
|
|
22
22
|
| `reflect ["<note>"]` | — | `reflect "<note>"` queues a suggestion in `reflections.md` (never gates; gate flags such as `--confirmed` are ignored, they never become part of the note). Bare `reflect` prints the full **session-reflection protocol** for the agent (from the `/flow reflect` bar it additionally wakes the model, so the protocol executes immediately): review the whole session log, re-check every open item against the current playbook and **newer dev-flow versions** (`npm view pi-dev-flow version` vs the running version — dev-flow ships from npm; recommend `pi install npm:pi-dev-flow` + `/reload`, the operator performs updates), dedupe new findings against the open ones, then report playbook vs plugin items to the operator and ask whether to fix now — plugin items: search upstream issues first (`gh issue list --repo <upstream> --state all --search …`; an author-addressed match is reported back, no match → `gh issue create` with a detailed description and a suggested fix), playbook items: `flow doctor` routes each to the docs flow that implements it |
|
|
23
23
|
| `roadmap [add "<feature>" \| pick <n> <slug> \| done <n> \| tidy]` | — | manages `.dev-flow/roadmap.md`, the gitignored backlog of future features (`- [ ]` checklist): bare prints the numbered open items, `add` appends one, `pick <n> <slug>` stamps open item n with `(slug)` so `flow start <slug>` can take it — **`finish` checks the stamped item off when that feature ships**; `done <n>` checks off by hand (items shipped outside a flow), `tidy` drops the checked lines. Never gates; the open count is surfaced in `status` and session context |
|
package/docs/headless.md
CHANGED
|
@@ -38,5 +38,8 @@ The contract a headless driver (a session with no UI) relies on:
|
|
|
38
38
|
- **Edits invalidate checks.** Any worktree write clears recorded checks and the tier-2
|
|
39
39
|
confirmation — re-run `flow check` before `verify` after the last edit.
|
|
40
40
|
- **Version skew.** Gates execute the dev-flow build the session loaded at start; `flow version`
|
|
41
|
-
reports when the checkout has moved ahead of it
|
|
42
|
-
|
|
41
|
+
reports when the checkout has moved ahead of it. `flow release` turns the skew into a question —
|
|
42
|
+
update (`/reload`, then re-run) or proceed with the old release — never a block: publishing under
|
|
43
|
+
an older gate is a legitimate choice. The operator's proceed is stamped into the release and
|
|
44
|
+
`release-done` repeats the acknowledgement (its after-the-fact warning stays for a release that
|
|
45
|
+
went out without the question being answered).
|
package/extensions/dev-flow.ts
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
appendRoadmapItem,
|
|
33
33
|
bashFlowGuard,
|
|
34
34
|
changelogEntry,
|
|
35
|
+
changelogVersionsBetween,
|
|
35
36
|
normalizeReleaseBody,
|
|
36
37
|
pendingEntryLines,
|
|
37
38
|
pickReleaseNotes,
|
|
@@ -113,8 +114,13 @@ import { detectProject } from "../src/detect.ts";
|
|
|
113
114
|
|
|
114
115
|
const execAsync = promisify(exec);
|
|
115
116
|
|
|
116
|
-
/** The dev-flow build this session actually loaded — see sessionRunsOlderBuild.
|
|
117
|
-
|
|
117
|
+
/** The dev-flow build this session actually loaded — see sessionRunsOlderBuild. Read at call time, and
|
|
118
|
+
* DEV_FLOW_LOADED_VERSION can stand in for it (the smoke suite runs gates in-process and needs to
|
|
119
|
+
* pretend it is an old session): the override can only ever make a gate more cautious — it never
|
|
120
|
+
* lifts a proof, it turns a release into a warn-and-ask. */
|
|
121
|
+
function loadedVersion(): string | null {
|
|
122
|
+
return process.env.DEV_FLOW_LOADED_VERSION?.trim() || pluginVersion(import.meta.dirname).version;
|
|
123
|
+
}
|
|
118
124
|
|
|
119
125
|
interface Ui {
|
|
120
126
|
hasUI: boolean;
|
|
@@ -241,7 +247,7 @@ async function releaseTags(root: string): Promise<string[] | null> {
|
|
|
241
247
|
}
|
|
242
248
|
|
|
243
249
|
const GATE_HELP =
|
|
244
|
-
"help [--json] | init [--force|--draft|--write <text>] | reflect [<note>] | roadmap [add <text>|pick <n> <slug>|done <n>|tidy] | doctor [<issue note>] | status [slug] [--json] | start <slug> [--ui] [--force] [--patch|--docs --confirmed] [--merge=squash|merge|rebase|any] [--check-upstream] | use <slug> | test | check | health | approve [--yolo] | verify [--yolo] | release [--yolo|--no-version|--no-fold-check] | release-done [--no-artifact-check|--no-release-create] | finish [--yolo] [slug] | abort [slug] | version [--check-upstream] — start preflights the playbook before creating anything: it prints playbook gaps and warns when the session runs an older dev-flow build, and it refuses until a merge policy is set (ask the operator squash / merge / rebase / any in chat, then re-run with --merge=<style> --confirmed — the answer is written into project.md and enforced from then on: gh/glab merges that contradict it are blocked, and release-done proves what actually landed); version prints the loaded build (--check-upstream also asks the registry for the published one) — reflect <note> queues a suggestion in reflections.md (gate flags like --confirmed are ignored there); bare reflect prints the full session-reflection protocol (review the session log, re-check open items against shipped fixes and newer dev-flow versions, dedupe and report new findings, put the fix decision to the operator); roadmap manages .dev-flow/roadmap.md, the gitignored backlog of future features (bare lists open items; add appends one; pick <n> <slug> stamps open item <n> with the slug a later flow start uses — flow finish checks it off when that feature ships; done <n> checks off by hand; tidy drops done items); bare doctor reviews structure, git consistency and open reflections (routes each fix to a flow; it never writes); doctor <note> prints an investigation brief for a fresh observation; state gates take [slug] and --confirmed (the operator already answered in chat); --patch/--docs likewise need --confirmed (the operator granted the mode); --yolo on any state gate (approve/verify/release/finish) = the operator said \"yolo\" at that checkpoint: it answers that question and pre-confirms every later one (needs --confirmed; checks and guardrails stay); release --no-fold-check = operator-granted escape from the changelog fold proofs (the entries pending before the release are not line-checked; the entry heading and the 'this branch touched the changelog' proofs stay); release --no-version = this flow ships merge + changelog only — no bump, tag or forge release; the entry rides under Unreleased until the next versioned release folds it (default: versioned)";
|
|
250
|
+
"help [--json] | init [--force|--draft|--write <text>] | reflect [<note>] | roadmap [add <text>|pick <n> <slug>|done <n>|tidy] | doctor [<issue note>] | status [slug] [--json] | start <slug> [--ui] [--force] [--patch|--docs --confirmed] [--merge=squash|merge|rebase|any] [--check-upstream] | use <slug> | test | check | health | approve [--yolo] | verify [--yolo] | release [--yolo|--no-version|--no-fold-check] | release-done [--no-artifact-check|--no-release-create] | finish [--yolo] [slug] | abort [slug] | version [--check-upstream] — start preflights the playbook before creating anything: it prints playbook gaps and warns when the session runs an older dev-flow build, and it refuses until a merge policy is set (ask the operator squash / merge / rebase / any in chat, then re-run with --merge=<style> --confirmed — the answer is written into project.md and enforced from then on: gh/glab merges that contradict it are blocked, and release-done proves what actually landed); version prints the loaded build (--check-upstream also asks the registry for the published one) — reflect <note> queues a suggestion in reflections.md (gate flags like --confirmed are ignored there); bare reflect prints the full session-reflection protocol (review the session log, re-check open items against shipped fixes and newer dev-flow versions, dedupe and report new findings, put the fix decision to the operator); roadmap manages .dev-flow/roadmap.md, the gitignored backlog of future features (bare lists open items; add appends one; pick <n> <slug> stamps open item <n> with the slug a later flow start uses — flow finish checks it off when that feature ships; done <n> checks off by hand; tidy drops done items); bare doctor reviews structure, git consistency and open reflections (routes each fix to a flow; it never writes); doctor <note> prints an investigation brief for a fresh observation; state gates take [slug] and --confirmed (the operator already answered in chat); --patch/--docs likewise need --confirmed (the operator granted the mode); --yolo on any state gate (approve/verify/release/finish) = the operator said \"yolo\" at that checkpoint: it answers that question and pre-confirms every later one (needs --confirmed; checks and guardrails stay); release --no-fold-check = operator-granted escape from the changelog fold proofs (the entries pending before the release are not line-checked; the entry heading and the 'this branch touched the changelog' proofs stay); release --no-version = this flow ships merge + changelog only — no bump, tag or forge release; the entry rides under Unreleased until the next versioned release folds it (default: versioned); when the session runs an older dev-flow build than the checkout, release names both builds, lists what the running code can no longer prove, and asks the operator update (/reload) or proceed with the old release — an operator decision recorded in state and repeated by release-done, never a block";
|
|
245
251
|
const featDir = (root: string, slug: string) => path.join(dfDir(root), slug);
|
|
246
252
|
const stateFile = (root: string, slug: string) => path.join(featDir(root, slug), "state.json");
|
|
247
253
|
const claimFile = (root: string, slug: string) => path.join(featDir(root, slug), "claim.json");
|
|
@@ -561,7 +567,7 @@ function reflectNote(root: string, sess: Session, note: string[]): RunResult {
|
|
|
561
567
|
async function runFlow(args: string[], root: string, ui: Ui, sess: Session): Promise<RunResult> {
|
|
562
568
|
const [sub = "status", ...rest] = args;
|
|
563
569
|
// help and version are questions about the plugin, not the repo: answerable with no .dev-flow/ at all
|
|
564
|
-
if (sub === "help" || sub === "--help" || sub === "-h") return { text: rest.includes("--json") ? gateHelpJson(GATE_HELP,
|
|
570
|
+
if (sub === "help" || sub === "--help" || sub === "-h") return { text: rest.includes("--json") ? gateHelpJson(GATE_HELP, loadedVersion()) : `usage: flow <sub> — ${GATE_HELP}` };
|
|
565
571
|
if (!existsSync(dfDir(root)) && sub !== "init" && sub !== "version") return { text: "no .dev-flow/ in this repo — run flow init first", isError: true };
|
|
566
572
|
const cfg = loadProject(dfDir(root)).cfg;
|
|
567
573
|
const flag = (name: string) => rest.includes(`--${name}`);
|
|
@@ -715,7 +721,7 @@ ${mdDigest(draftRefresh)}`))
|
|
|
715
721
|
// --- preflight: is this session running the current build, and is the playbook complete? ---
|
|
716
722
|
const notes: string[] = [];
|
|
717
723
|
const self = pluginVersion(import.meta.dirname);
|
|
718
|
-
const behind = sessionRunsOlderBuild(
|
|
724
|
+
const behind = sessionRunsOlderBuild(loadedVersion(), self.version);
|
|
719
725
|
if (behind) notes.push(`warning: this session runs dev-flow ${behind}, the checkout has ${self.version} — /reload before trusting what a gate prints`);
|
|
720
726
|
if (flag("check-upstream")) {
|
|
721
727
|
const pub = await sh("npm view pi-dev-flow version", root);
|
|
@@ -869,7 +875,7 @@ ${mdDigest(draftRefresh)}`))
|
|
|
869
875
|
case "version": {
|
|
870
876
|
// the plugin's own version — separate from the project's versioning.file version the release gates use
|
|
871
877
|
const self = pluginVersion(import.meta.dirname);
|
|
872
|
-
const behind = sessionRunsOlderBuild(
|
|
878
|
+
const behind = sessionRunsOlderBuild(loadedVersion(), self.version);
|
|
873
879
|
const head = self.version ? `dev-flow ${self.version} (pi-dev-flow at ${self.dir})` : `dev-flow version unknown — no pi-dev-flow package.json above ${self.dir}`;
|
|
874
880
|
// --check-upstream is the one that asks the registry; plain flow version stays offline and instant
|
|
875
881
|
if (flag("check-upstream")) {
|
|
@@ -1101,10 +1107,32 @@ ${mdDigest(draftRefresh)}`))
|
|
|
1101
1107
|
// tier-2 pre-release confirmation is recorded by this very command, so it is excluded here
|
|
1102
1108
|
const preGate = preReleaseGate({ ...state!, confirmations: { ...state!.confirmations, "pre-release": { hash: checklistHash(items), at: now() } } }, cfg, prep);
|
|
1103
1109
|
if (preGate.length) return { text: `release gate FAILED:\n- ${preGate.join("\n- ")}`, isError: true };
|
|
1110
|
+
// a stale session build is the operator's decision, never a block: publishing under an older gate is a
|
|
1111
|
+
// legitimate choice (hotfix, offline reload), and refusing would close exactly the emergency the relaxed
|
|
1112
|
+
// modes exist for. The gate names both builds, lists what the running code is missing, and folds the
|
|
1113
|
+
// update-or-proceed question into the Release? checkpoint — the operator's word, recorded in state.
|
|
1114
|
+
const selfBuild = pluginVersion(import.meta.dirname);
|
|
1115
|
+
const behind = sessionRunsOlderBuild(loadedVersion(), selfBuild.version);
|
|
1116
|
+
// truly behind, not merely different: a session whose loaded build is NEWER than the checkout's manifest
|
|
1117
|
+
// has every proof the checkout would run, and asking about it would be noise.
|
|
1118
|
+
const stale = !!behind && !!selfBuild.version && cmpVersions(behind, selfBuild.version) < 0;
|
|
1119
|
+
let staleAsk = "";
|
|
1120
|
+
let staleNote = "";
|
|
1121
|
+
if (stale) {
|
|
1122
|
+
const clPath = path.join(selfBuild.dir, "CHANGELOG.md");
|
|
1123
|
+
const missing = existsSync(clPath) && selfBuild.version ? changelogVersionsBetween(readFileSync(clPath, "utf8"), behind, selfBuild.version) : [];
|
|
1124
|
+
staleAsk =
|
|
1125
|
+
` This session runs dev-flow ${behind}, the checkout ships ${selfBuild.version ?? "?"} — gate proofs shipped between the two will NOT run. ` +
|
|
1126
|
+
(missing.length
|
|
1127
|
+
? `Shipped since ${behind}: ${missing.slice(0, 8).join(", ")}${missing.length > 8 ? ` …(${missing.length} total)` : ""} — see ${clPath}. `
|
|
1128
|
+
: `What shipped between them is not readable from the checkout's CHANGELOG.md — read it before deciding. `) +
|
|
1129
|
+
`Update (/reload, then re-run flow release on the current build) or proceed with the old release?`;
|
|
1130
|
+
staleNote = `released under dev-flow ${behind} (checkout ${selfBuild.version ?? "?"}) by operator choice — proofs newer than ${behind} did not run`;
|
|
1131
|
+
}
|
|
1104
1132
|
const audit = flag("confirmed") ? " (confirmed by operator instruction)" : state!.yolo ? " (yolo: pre-confirmed)" : "";
|
|
1105
1133
|
if (!flag("confirmed") && !state!.yolo) {
|
|
1106
|
-
if (!ui.hasUI) return { text: needsOperator(
|
|
1107
|
-
const ok = await ui.confirm("Enter release", `Release ${state!.slug}${manifestVer ? ` v${manifestVer}` : ""}${state!.noVersion ? " (unversioned — merge + changelog entry only: no bump, no tag for this flow)" : ""}? Publishing starts: PR, merge${state!.noVersion ? "" : ", tag"} — release-done afterwards needs no further answer
|
|
1134
|
+
if (!ui.hasUI) return { text: needsOperator(`release confirmation needs the operator: confirm interactively, or re-run with --confirmed once the operator answered 'Release?' in chat${stale ? ` — the operator must also answer the stale-build question: ${staleAsk}` : ""}`, "Release?"), isError: true };
|
|
1135
|
+
const ok = await ui.confirm("Enter release", `Release ${state!.slug}${manifestVer ? ` v${manifestVer}` : ""}${state!.noVersion ? " (unversioned — merge + changelog entry only: no bump, no tag for this flow)" : ""}? Publishing starts: PR, merge${state!.noVersion ? "" : ", tag"} — release-done afterwards needs no further answer.${staleAsk ? `\n\n${staleAsk}` : ""}`);
|
|
1108
1136
|
if (!ok) return { text: "release declined — keep preparing in pre-release" };
|
|
1109
1137
|
}
|
|
1110
1138
|
state!.confirmations = { ...state!.confirmations, "pre-release": { hash: checklistHash(items), at: now() } };
|
|
@@ -1121,8 +1149,9 @@ ${mdDigest(draftRefresh)}`))
|
|
|
1121
1149
|
// the version of record is fixed here, from the manifest this gate validated: release-done must not
|
|
1122
1150
|
// re-read a checkout that may still be behind (#52)
|
|
1123
1151
|
if (!state!.noVersion && manifestVer) state!.releaseVersion = manifestVer;
|
|
1152
|
+
if (stale) state!.staleBuild = `${behind} (checkout ${selfBuild.version ?? "?"})`;
|
|
1124
1153
|
writeState(root, state!);
|
|
1125
|
-
return { text: `release approved${audit}${state!.noVersion ? " — unversioned: no bump or tag; your changelog entry rides under Unreleased until the next versioned release folds it" : ""} — entering release stage.${manifestVer ? ` Version ${manifestVer}.` : ""}${foldNote}\n${nextHint(state!, cfg)}` };
|
|
1154
|
+
return { text: `release approved${audit}${state!.noVersion ? " — unversioned: no bump or tag; your changelog entry rides under Unreleased until the next versioned release folds it" : ""} — entering release stage.${manifestVer ? ` Version ${manifestVer}.` : ""}${foldNote}${staleNote ? ` ${staleNote}.` : ""}\n${nextHint(state!, cfg)}` };
|
|
1126
1155
|
}
|
|
1127
1156
|
|
|
1128
1157
|
case "release-done": {
|
|
@@ -1233,7 +1262,7 @@ ${mdDigest(draftRefresh)}`))
|
|
|
1233
1262
|
ghNote = gr.ok ? `${forge} release ${tag} created. ${notesNote}`.trim() : `${forge} release skipped: ${tail(gr.out)}`;
|
|
1234
1263
|
}
|
|
1235
1264
|
}
|
|
1236
|
-
const behind = sessionRunsOlderBuild(
|
|
1265
|
+
const behind = sessionRunsOlderBuild(loadedVersion(), pluginVersion(import.meta.dirname).version);
|
|
1237
1266
|
const openRelease = checklistPending(cfg, state!, "release");
|
|
1238
1267
|
// release-stage items have no gate of their own: the operator's Finish? answer is what closes them, so
|
|
1239
1268
|
// name them at the last objective gate — on the way out too, or the refusal hides half the story
|
|
@@ -1267,7 +1296,11 @@ ${mdDigest(draftRefresh)}`))
|
|
|
1267
1296
|
state!.approvals.release = now();
|
|
1268
1297
|
const tailNote = [
|
|
1269
1298
|
// a session that shipped from behind: the code it runs is not the code the checkout just released
|
|
1270
|
-
|
|
1299
|
+
state!.staleBuild
|
|
1300
|
+
? `stale build acknowledged at release gate: this session ran dev-flow ${state!.staleBuild} — proofs newer than it did not run.`
|
|
1301
|
+
: behind
|
|
1302
|
+
? `warning: this session runs dev-flow ${behind}, not the build in the checkout — /reload before trusting what it printed.`
|
|
1303
|
+
: "",
|
|
1271
1304
|
mergeNote,
|
|
1272
1305
|
openNote,
|
|
1273
1306
|
ghNote,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.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": [
|
package/skills/dev-flow/SKILL.md
CHANGED
|
@@ -299,9 +299,14 @@ the worktree unless noted:
|
|
|
299
299
|
`flow finish` closes the feature out. Skipping the forge release
|
|
300
300
|
(`--no-release-create`, once, or `release.releases = false`, always) and
|
|
301
301
|
the artifact check (`--no-artifact-check`, once) are operator calls only —
|
|
302
|
-
act when told, never on your own. If
|
|
303
|
-
|
|
304
|
-
|
|
302
|
+
act when told, never on your own. If this session runs an older build than
|
|
303
|
+
the checkout, **the release gate asks instead of blocking**: it prints both
|
|
304
|
+
builds, lists what shipped between them (those proofs will not run), and
|
|
305
|
+
puts the choice to the operator — **update (`/reload` and re-run) or
|
|
306
|
+
proceed with the old release?** Publishing under an older gate is a
|
|
307
|
+
legitimate choice (hotfix, offline reload); the answer is recorded in the
|
|
308
|
+
release output and `release-done` repeats the acknowledgement as the
|
|
309
|
+
backstop for headless runs.
|
|
305
310
|
Release-stage checklist items have no gate of their own: `release-done`
|
|
306
311
|
lists the open ones and the Finish? answer closes them.
|
|
307
312
|
|
package/src/core.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface FlowState {
|
|
|
40
40
|
setupAt?: string; // commands.setup exited 0 in this worktree — a reused worktree reruns it only when unset (#49)
|
|
41
41
|
releaseVersion?: string; // the manifest version the release gate approved — release-done publishes this, not whatever a checkout says later (#52)
|
|
42
42
|
forgeReleaseSkipped?: string; // a gh/glab release create that failed: release-done says so, finish names it so the missing forge release cannot slip past (#63)
|
|
43
|
+
staleBuild?: string; // release ran under an older dev-flow than the checkout by operator choice ("<loaded> (checkout <disk>)"); release-done repeats the acknowledgement
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
/** Tier-2 item: operator prose; uiOnly items ("(ui)" in project.md) apply only to --ui features. */
|
|
@@ -460,6 +461,22 @@ export function sessionRunsOlderBuild(loaded: string | null, disk: string | null
|
|
|
460
461
|
return loaded && disk && loaded !== disk ? loaded : "";
|
|
461
462
|
}
|
|
462
463
|
|
|
464
|
+
/** The changelog's version headings strictly between `from` (exclusive) and `to` (inclusive), newest
|
|
465
|
+
* first — what a session running `from` is missing against a checkout on `to`, i.e. the gate proofs
|
|
466
|
+
* that will not run. Only `## [0.54.0]` / `## 0.54.0` headings with a parseable numeric-dot version
|
|
467
|
+
* count; everything else (Unreleased, prose, `v` prefixes) is skipped, and so are unparseable bounds. */
|
|
468
|
+
export function changelogVersionsBetween(changelog: string, from: string, to: string): string[] {
|
|
469
|
+
const versioned = (v: string) => /^\d+\.\d+\.\d+/.test(v);
|
|
470
|
+
if (!versioned(from) || !versioned(to)) return [];
|
|
471
|
+
const found: string[] = [];
|
|
472
|
+
for (const m of changelog.matchAll(/^##\s+\[?([^\]\s]+)\]?/gm)) {
|
|
473
|
+
const v = m[1];
|
|
474
|
+
if (!versioned(v) || found.includes(v)) continue;
|
|
475
|
+
if (cmpVersions(v, from) > 0 && cmpVersions(v, to) <= 0) found.push(v);
|
|
476
|
+
}
|
|
477
|
+
return found.sort((a, b) => cmpVersions(b, a));
|
|
478
|
+
}
|
|
479
|
+
|
|
463
480
|
/** Owner/slug from any GitHub repo reference — "owner/repo", "github.com/owner/repo", git+https or scp-style git@github.com:owner/repo.git; "" when it is not GitHub. */
|
|
464
481
|
export function githubSlug(ref: string): string {
|
|
465
482
|
const m = ref.match(/github\.com[/:]([\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/|$)/) ?? /^[\w.-]+\/[\w.-]+$/.exec(ref);
|