pi-dev-flow 0.64.0 → 0.64.2

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,19 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.64.2] - 2026-10-25
8
+
9
+ ### Changed
10
+
11
+ - **Structured stage reports — a tier-3 communication convention, documented and injected.** `docs/playbook.md` gains a "Structured stage reports" section: every stage report opens with one inline `◆ <stage> · <slug>` line (mode + grant mark, ui, then per-stage decision fields — plan status, commits/tier-1/deploy, the version decision with its pending/bump/no-version states, PR/tag/artifact proofs, finish cleanup state) and closes with exactly one plain-chat checkpoint rendered as three markdown bullets (context / options incl. yolo / recommend) plus the single verb. The shape is plain markdown, never fenced — fenced header blocks rendered as horizontal-scroll boxes in web UIs. This repo's `project.md` carries the matching per-stage prose so every session inherits the contract at stage start; gates and guardrails are untouched — the contract is advisory like all tier-3 prose.
12
+ - **Repo dogfood of `/flow-simplify`, shipped as a patch**: dropped the one dead import `tsc --noUnusedLocals` reports repo-wide (`unreleasedBody` in `test/core.test.ts`), and collapsed the thrice-duplicated yolo-word intake — the byte-identical `--yolo` acceptance block and its error string in the verify, release and finish gates — into one `takeYoloWord` helper, so the operator-word wording lives in one place. Also committed the `package-lock.json` version fields `npm install` rewrites in every worktree since the 0.64.1 bump left them unsynced.
13
+
14
+ ## [0.64.1] - 2026-10-24
15
+
16
+ ### Changed
17
+
18
+ - **Whole-repo `/flow-simplify` pass on dev-flow itself.** A full simplification sweep (dead-code hunt with grep + semantic confirmation, sliding-window duplication scan across `src/` and `extensions/`) found a lean codebase and three honest cuts: the `STAGES` constant in core was a zero-reference export (stage order lives in the state transitions and `MD_STAGES`), and `changelogEntry`/`MergeStyle` were imported by files that never used them (tsc `--noUnusedLocals`-confirmed). The one real duplication — the recorded `seedData` step written twice, once in the verify deploy probe and once in `flow health` — now lives in a single `seedStep` helper; as a side effect `flow health` names the seed command in its failure message the way verify always did. Cross-file duplicate blocks of four or more lines: none found; the one remaining structural weight (`runFlow`'s size) is an architecture reshuffle left for its own flow.
19
+
7
20
  ## [0.64.0] - 2026-10-24
8
21
 
9
22
  ### Fixed
package/docs/playbook.md CHANGED
@@ -173,3 +173,44 @@ shipped, dedupe new findings, put the fix decision to the operator) — and noth
173
173
  Future features have their own file: `.dev-flow/roadmap.md`, a gitignored backlog `flow roadmap`
174
174
  manages (add / pick → `flow start` / done / tidy) — a picked item is checked off by `finish` when
175
175
  its feature ships, and it never gates either.
176
+
177
+ ### Structured stage reports (a prose convention, not a gate)
178
+
179
+ The gates enforce *state*; how the agent *talks* about that state at each stage is a tier-3 convention —
180
+ type `prose.implement`-style guidance into the stage sections and every session inherits it. The contract
181
+ this repo runs on has two fixed shapes, both **plain markdown inline lines — never fenced** (a code block
182
+ renders monospace with a horizontal scrollbar in web UIs; fences stay for diffs and command output).
183
+
184
+ **The stage line.** Every stage report opens with one inline line: a `◆` marker, the stage and slug, then
185
+ the *decision record* as `·`-separated `key value` pairs with backticked values. The core — stage · slug ·
186
+ mode (+ grant mark: `✓` operator-granted, `?` proposed) · ui — repeats at every stage; stage-specific
187
+ fields append:
188
+
189
+ | Stage | Fields after the core | Example |
190
+ |---|---|---|
191
+ | pre-flow | mode proposal + why, detected knob defaults, merge-policy state | **◆ pre-flow · new work** — mode `normal` (proposed: touches behavior) · ui on · forge `github` ✓ · merge policy **missing** |
192
+ | plan | plan.md status, mockups `rendered/total`, open questions | **◆ plan · `dark-mode`** — `normal` ✓ · ui on · plan `created` · mockups `3/3` · open questions `0` |
193
+ | implement | commits `N ahead, M uncommitted`, tier-1, tier-2, deploy/health, branch@sha | **◆ implement · `dark-mode`** — `normal` ✓ · ui on · commits `2 ahead, 0 uncommitted` · tier-1 `5/5` · deploy `health PASS` · `feat/dark-mode@a1b2c3` |
194
+ | pre-release | **version decision** — `pending` / `bump <patch\|minor\|major> → vX.Y.Z (pending your word)` / `no-version [your word]` — tag, changelog, fold, review tally, merge style | **◆ pre-release · `dark-mode`** — `normal` ✓ · ui on · version **`bump minor → 0.56.0 (pending your word)`** · tag `v0.56.0` · changelog `ready` · review `0 must / 0 should` · merge `merge` |
195
+ | release | PR + state, merge style used, tag state, artifact proof, forge release state (one line per step — this stage has no checkpoint) | **◆ release · `dark-mode`** — PR `#131 merged` · merge `--merge (playbook)` · tag `v0.56.0 pushed` · artifact `npm view OK` · forge release `created` |
196
+ | finish | release recorded, main state, unmerged commits, reflections open, release-checklist open | **◆ finish · `dark-mode`** — release `recorded` · main `clean, pushed` · unmerged `0` · reflections `2 open` |
197
+
198
+ A decision that was *not* made is recorded as `pending` — never left unstated, never silently invented
199
+ (a version bump needs the operator's word; `no-version` too).
200
+
201
+ **The checkpoint.** Exactly one per stage, as a plain chat message (a structured-question tool is
202
+ not chat and never licenses `--confirmed`), three markdown bullets and the single verb, **yolo** named
203
+ as an available answer:
204
+
205
+ > **CHECKPOINT — Release?**
206
+ > - **context** — checks green; manifest ahead of last tag; `Unreleased` folded.
207
+ > - **options** — *release* → bump minor 0.56.0, tag `v0.56.0`, forge release · *no-version* → merge only, entry rides under `Unreleased` · *edit* — what to change · *yolo* → release with the parameters above, remaining gates run back to back
208
+ > - **recommend** — *release* — user-facing feature, minor per playbook semver
209
+ >
210
+ > Answer in chat: **Release?** (or yolo)
211
+
212
+ After each gate that advances a stage, one short echo line confirms the new state before new work
213
+ (`▶ stage: implement — 2 commits ahead, tier-1 5/5`). Mid-stage additions amend `plan.md` with an
214
+ `**Added mid-stage:**` line instead of opening a second checkpoint — the verb count stays one per
215
+ stage. The contract is advisory like all tier-3 prose: gates refuse what gates refuse regardless of
216
+ how neatly the report is formatted.
@@ -34,7 +34,6 @@ import {
34
34
  appendRoadmapItem,
35
35
  bashFlowGuard,
36
36
  checkFingerprint,
37
- changelogEntry,
38
37
  changelogVersionsBetween,
39
38
  normalizeReleaseBody,
40
39
  pendingEntryLines,
@@ -606,6 +605,16 @@ async function runChecks(root: string, state: FlowState, cfg: Config, checks: St
606
605
  * the pre-deploy record must survive the gate that schedules the deploy. */
607
606
  const healthRerunsAfterDeploy = (cfg: Config) => !!cfg.commands.dev && !!healthProbe(cfg);
608
607
 
608
+ /** Seed pre-existing data before a health probe, recording the step (`flow health` and the verify
609
+ * deploy probe both do this). Returns an error result on failure, null when seeded or not configured. */
610
+ async function seedStep(root: string, state: FlowState, cfg: Config): Promise<{ text: string; isError: true } | null> {
611
+ if (!cfg.commands.seedData) return null;
612
+ const seed = await sh(cfg.commands.seedData, gateCwd(root, state));
613
+ state.checks.seedData = { ok: seed.ok, at: now() };
614
+ writeState(root, state);
615
+ return seed.ok ? null : { text: `seedData FAILED (${cfg.commands.seedData}):\n${tail(seed.out)}`, isError: true };
616
+ }
617
+
609
618
  /** Fingerprint of the working-tree state the checks ran against: paths (`status --porcelain`),
610
619
  * tracked content (a hash of the uncommitted diff) and HEAD. Null when git cannot answer — a
611
620
  * measurement failure must never mark a green record stale (see freshenChecks). */
@@ -757,6 +766,13 @@ async function runFlow(args: string[], root: string, ui: Ui, sess: Session): Pro
757
766
  if (!initiated(root) && sub !== "init" && sub !== "version") return { text: "dev-flow is not initiated here — no .dev-flow/project.md — run flow init first", isError: true };
758
767
  const cfg = loadProject(dfDir(root)).cfg;
759
768
  const flag = (name: string) => rest.includes(`--${name}`);
769
+ // the yolo word at Verified?/Release?/Finish?: the operator said it in chat, then re-run with --confirmed; checks and guardrails stay enforced
770
+ const takeYoloWord = (state: FlowState): string | null => {
771
+ if (!flag("yolo")) return null;
772
+ if (!state.yolo && !flag("confirmed")) return "yolo is the operator's word — the operator must have said it in chat, then re-run with --yolo --confirmed";
773
+ state.yolo = true;
774
+ return null;
775
+ };
760
776
  const slugArg = rest.find((a) => !a.startsWith("--"));
761
777
 
762
778
  switch (sub) {
@@ -1202,12 +1218,8 @@ ${mdDigest(draftRefresh)}`))
1202
1218
  const probe = healthProbe(cfg);
1203
1219
  if (!probe) did.push("health: none configured");
1204
1220
  else {
1205
- if (cfg.commands.seedData) {
1206
- const seed = await sh(cfg.commands.seedData, gateCwd(root, state!));
1207
- state!.checks.seedData = { ok: seed.ok, at: now() };
1208
- writeState(root, state!);
1209
- if (!seed.ok) return { text: `seedData FAILED (${cfg.commands.seedData}):\n${tail(seed.out)}`, isError: true };
1210
- }
1221
+ const seedFail = await seedStep(root, state!, cfg);
1222
+ if (seedFail) return seedFail;
1211
1223
  const probed = await runHealthProbe(probe, gateCwd(root, state!), cfg.healthWait);
1212
1224
  state!.checks.health = { ok: probed.ok, at: now() };
1213
1225
  await stampChecks(root, state!, ["health"]);
@@ -1220,11 +1232,9 @@ ${mdDigest(draftRefresh)}`))
1220
1232
  } else did.push("dev: none configured");
1221
1233
  }
1222
1234
  const ran = [branchLine, ...did].join("; ");
1223
- // yolo is the operator's word at Verified? — answers this question and pre-confirms the later ones; --confirmed anchors it, checks and guardrails stay
1224
- if (flag("yolo")) {
1225
- if (!state!.yolo && !flag("confirmed")) return { text: "yolo is the operator's word — the operator must have said it in chat, then re-run with --yolo --confirmed", isError: true };
1226
- state!.yolo = true;
1227
- }
1235
+ // yolo is the operator's word at Verified? — answers this question and pre-confirms the later ones
1236
+ const yoloWord = takeYoloWord(state!);
1237
+ if (yoloWord) return { text: yoloWord, isError: true };
1228
1238
  const audit = flag("confirmed") ? " (confirmed by operator instruction)" : state!.yolo ? " (yolo: pre-confirmed)" : "";
1229
1239
  if (!flag("confirmed") && !state!.yolo) {
1230
1240
  // these commands already ran — say so even on the way out
@@ -1259,12 +1269,8 @@ ${mdDigest(draftRefresh)}`))
1259
1269
  const { state, err } = needState(root, sess, slugArg);
1260
1270
  if (err) return err;
1261
1271
  if (!cfg.commands.health) return { text: "no commands.health configured — add `health = <command>` (or a flow-check health block) under ## implement in .dev-flow/project.md", isError: true };
1262
- if (cfg.commands.seedData) {
1263
- const seed = await sh(cfg.commands.seedData, gateCwd(root, state!));
1264
- state!.checks.seedData = { ok: seed.ok, at: now() };
1265
- writeState(root, state!);
1266
- if (!seed.ok) return { text: `seedData FAILED:\n${tail(seed.out)}`, isError: true };
1267
- }
1272
+ const seedFail = await seedStep(root, state!, cfg);
1273
+ if (seedFail) return seedFail;
1268
1274
  const res = await runHealthProbe(cfg.commands.health, gateCwd(root, state!), cfg.healthWait);
1269
1275
  state!.checks.health = { ok: res.ok, at: now() };
1270
1276
  await stampChecks(root, state!, ["health"]);
@@ -1278,11 +1284,9 @@ ${mdDigest(draftRefresh)}`))
1278
1284
  if (err) return err;
1279
1285
  const items = applicableItems(cfg, state!, "pre-release");
1280
1286
  if (flag("no-version")) state!.noVersion = true; // operator's word at Release?: this flow ships without a version bump or tag
1281
- // yolo is the operator's word at Release? — answers this question and pre-confirms Finish?; publishing guardrails stay enforced
1282
- if (flag("yolo")) {
1283
- if (!state!.yolo && !flag("confirmed")) return { text: "yolo is the operator's word — the operator must have said it in chat, then re-run with --yolo --confirmed", isError: true };
1284
- state!.yolo = true;
1285
- }
1287
+ // yolo is the operator's word at Release? — pre-confirms Finish?; publishing guardrails stay enforced
1288
+ const yoloWord = takeYoloWord(state!);
1289
+ if (yoloWord) return { text: yoloWord, isError: true };
1286
1290
  // prep evidence is read from the worktree: the bump and changelog entry exist on the branch before the PR merges
1287
1291
  const wtCwd = gateCwd(root, state!);
1288
1292
  const manifestVer = cfg.versioning.file && existsSync(path.join(wtCwd, cfg.versioning.file))
@@ -1596,10 +1600,8 @@ ${mdDigest(draftRefresh)}`))
1596
1600
  const forgeSkipNote = state!.forgeReleaseSkipped ? ` WARNING: the forge release was not created (${state!.forgeReleaseSkipped}) — recreate it manually or re-run release-done before finishing.` : "";
1597
1601
  // the one finish question — asked after the safety checks so it can never be a wasted question
1598
1602
  // yolo works uniformly at every gate: at Finish? nothing later remains to pre-confirm, the flag just answers this one
1599
- if (flag("yolo")) {
1600
- if (!state!.yolo && !flag("confirmed")) return { text: "yolo is the operator's word — the operator must have said it in chat, then re-run with --yolo --confirmed", isError: true };
1601
- state!.yolo = true;
1602
- }
1603
+ const yoloWord = takeYoloWord(state!);
1604
+ if (yoloWord) return { text: yoloWord, isError: true };
1603
1605
  if (!flag("confirmed") && !state!.yolo) {
1604
1606
  if (!ui.hasUI) return { text: needsOperator(`finish needs the operator: ask them Finish? in chat, then re-run with --confirmed (or run /flow finish interactively)${forgeSkipNote}`, "Finish?"), isError: true };
1605
1607
  const ok = await ui.confirm("Finish feature", `Finish ${state!.slug}?${unmergedNote}${forgeSkipNote} Removes worktree, branch ${state!.branch || "-"} and .dev-flow/${state!.slug}/.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dev-flow",
3
- "version": "0.64.0",
3
+ "version": "0.64.2",
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/src/core.ts CHANGED
@@ -10,7 +10,6 @@ import os from "node:os";
10
10
  import path from "node:path";
11
11
 
12
12
  export type Stage = "plan" | "implement" | "pre-release" | "release" | "done";
13
- export const STAGES: Stage[] = ["plan", "implement", "pre-release", "release", "done"];
14
13
 
15
14
  export interface Check {
16
15
  ok: boolean;
package/src/projectmd.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { existsSync, readdirSync, readFileSync } from "node:fs";
9
9
  import path from "node:path";
10
- import { applyAnswer, type ChecklistItem, type Config, DEFAULTS, healthProbe, parseMergeStyle, parseVersion, toSeconds, type GuardRules, type MergeStyle, type StageCheck } from "./core.ts";
10
+ import { applyAnswer, type ChecklistItem, type Config, DEFAULTS, healthProbe, parseMergeStyle, parseVersion, toSeconds, type GuardRules, type StageCheck } from "./core.ts";
11
11
 
12
12
  export const MD_STAGES = ["global", "plan", "implement", "pre-release", "release"] as const;
13
13
  export type MdStage = (typeof MD_STAGES)[number];