pi-dev-flow 0.96.0 → 0.96.1

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.96.1] - 2026-11-23
8
+
9
+ **A fold flow (started with `--reflections`) always merges unreleased with no release call, and finishes without the closing reflection.**
10
+
11
+ ### Changed
12
+ - **A fold flow merges unreleased and skips the closing reflection.** A flow started with `--reflections` (the start `flow reflect plan` prints) fixes reflection notes. On a versioned project it now always merges unreleased: Approve? asks no release call, the entry goes under Unreleased, and `--version=<kind>` or `flow bump <kind>` is refused. `flow finish` no longer runs the closing reflection on it, whatever the friction or `reflect = always`, so a clean fold flow's Finish? answers itself. `flow doctor` and the "fix the open reflections now?" nudge point at `flow reflect plan` instead of a bare `flow start … --docs|--patch`, so every fold flow is linked to the notes it closes.
13
+
7
14
  ## [0.96.0] - 2026-11-23
8
15
 
9
16
  **The release call is a kind of bump (patch, minor, major or unreleased) made at Approve?, changeable until the tag; the tag takes the number the merge commit's version file carries. Also: lettuce-style versions order and bump by their x.y.z part, and a tag-push run no longer counts as the merge commit's CI.**
package/docs/gates.md CHANGED
@@ -69,7 +69,7 @@ kept. Only the kind of step is recorded, never a number: the number is counted f
69
69
  when the release runs, so a flow that released first moves yours along instead of colliding with it.
70
70
  No later gate asks the call again. You can change it at any point until the tag is cut: say so,
71
71
  and the agent runs `flow bump <patch|minor|major|none> --confirmed`, or passes
72
- `--version=<kind>` / `--no-version` on a confirmed `verify` or `release` call. A flow approved by an
72
+ `--version=<kind>` / `--no-version` on a confirmed `verify` or `release` call. A fold flow — one started with `--reflections`, as `flow reflect plan` prints it — is never asked the call: on a versioned project it always merges unreleased, and `--version=<kind>` or `flow bump <kind>` is refused. A flow approved by an
73
73
  older dev-flow, with no call on record, is asked at Verified? instead.
74
74
 
75
75
  ## test, check, health
@@ -50,7 +50,7 @@ The review is skipped when the flow ran into no friction: no guard block, no gat
50
50
  process reason (wrong stage, a missing plan, a proof that doesn't hold), no gate refusing twice in a
51
51
  row, no code change after Verified?, and no `--note`. A failing test or build is not friction by
52
52
  itself: finding it is what the checks are for. Set `reflect = always` in the playbook's `## release` section to run it every time. Only
53
- your explicit `--no-reflect` skips it; *yolo* doesn't.
53
+ your explicit `--no-reflect` skips it; *yolo* doesn't. A fold flow (started with `--reflections`) never runs it: it fixes notes, it doesn't review for new ones.
54
54
 
55
55
  ## Nudges
56
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dev-flow",
3
- "version": "0.96.0",
3
+ "version": "0.96.1",
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": [
@@ -8,7 +8,9 @@ unbinds the session — so anything that needs them runs first.
8
8
  1. **`flow finish [--note="<friction the operator mentioned>"]`**
9
9
  - Published by hand and not recorded yet → it runs the release record
10
10
  first (no question).
11
- - **Closing reflection** — while none is recorded, a read-only worker
11
+ - **Closing reflection** — skipped on a fold flow (started with
12
+ `--reflections`: it fixes reflections, it doesn't review for new ones).
13
+ Otherwise, while none is recorded, a read-only worker
12
14
  reviews this session's transcript and every worker transcript, dedupes
13
15
  against `.dev-flow/reflections.md` and upstream issues, and returns
14
16
  numbered findings, each **docs** / **code** / **plugin** with a **fold**
@@ -59,6 +59,7 @@ No code edits before approval. Reads are always allowed.
59
59
  `--no-version` (yolo → add `--yolo`); without the call the gate refuses and keeps nothing.
60
60
  The call is not asked again. The operator can change it at any later point until the tag: `flow bump
61
61
  <patch|minor|major|none> --confirmed`, or `--version=<kind>` / `--no-version` on a confirmed verify or release call.
62
+ A fold flow — one started with `--reflections`, as `flow reflect plan` prints it — carries no call: on a versioned project it always merges unreleased, and `--version=<kind>` or `flow bump <kind>` is refused.
62
63
 
63
64
  Approval creates the worktree and branch and runs `commands.setup` there; a
64
65
  failing setup fails the gate and the next approve retries it. `(ui)` playbook
@@ -8,8 +8,8 @@ friction only, never the same issue twice. `.dev-flow/reflections.md` holds
8
8
 
9
9
  | Command | Files under | Fixed by |
10
10
  | --- | --- | --- |
11
- | `flow reflect --playbook "<note>"` | `## playbook` (fix lives in `project.md`) | a docs flow: `flow start fold-<topic> --docs` |
12
- | `flow reflect --code "<note>"` | `## code` (this project's code, maybe the playbook) | a patch flow: `flow start fix-<topic> --patch` (normal when bigger) |
11
+ | `flow reflect --playbook "<note>"` | `## playbook` (fix lives in `project.md`) | a docs fold flow: the `--reflections` start `flow reflect plan` prints |
12
+ | `flow reflect --code "<note>"` | `## code` (this project's code, maybe the playbook) | a patch fold flow: the `--reflections` start `flow reflect plan` prints (normal when bigger) |
13
13
  | `flow reflect --plugin "<note>"` | nothing — prints the upstream recipe | a GitHub issue, filed only on the operator's word |
14
14
 
15
15
  - `--plugin`: search first (`gh issue list --repo <dev-flow repo> --state all
@@ -46,7 +46,10 @@ rows it fixes: `flow start fix-<topic> --patch --reflections=r3,r7`. Fix them
46
46
  on the branch, and run `flow reflect defer <id> "<why>"` for any linked row
47
47
  the flow won't fix. `finish` closes the others as fixed by the flow, so never
48
48
  check linked rows off by hand. Rows not linked to a flow are closed with
49
- `flow reflect done <id> "<what>"`. Never edit `reflections.md`.
49
+ `flow reflect done <id> "<what>"`. Never edit `reflections.md`. A fold flow
50
+ always merges unreleased on a versioned project (no release call at
51
+ Approve?, the entry goes under Unreleased) and finishes without a closing
52
+ reflection.
50
53
 
51
54
  **GitHub issues** fold into `flow doctor` / `reflect list` when the repo has a
52
55
  GitHub remote: a local row an open issue covers shows `⟷ gh#NNN` (check it off
package/src/core.ts CHANGED
@@ -612,6 +612,13 @@ export function releaseCallQuestion(now: string | null, file: string, docs?: boo
612
612
  };
613
613
  }
614
614
 
615
+ /** A fold flow — one started with `--reflections`, fixing reflection rows — always merges unreleased: the fix rides
616
+ * under Unreleased until the next versioned release. Null when `choice` is allowed. */
617
+ export function foldCallError(state: FlowState, choice: string | null | undefined): string | null {
618
+ if (!state.reflections?.length || !choice || choice === "unreleased") return null;
619
+ return `a fold flow (linked reflections ${state.reflections.map((r) => `r${r.id}`).join(", ")}) always merges unreleased — the fix rides under Unreleased until the next versioned release`;
620
+ }
621
+
615
622
  /** Does `manifest` carry the operator's release call? `newest` is the newest tagged release, `base` the manifest the
616
623
  * branch started from. Null when it does; otherwise what to fix, with the number the call means today. */
617
624
  export function releaseCallProof(choice: string, manifest: string | null, newest: string | null, base: string | null, file: string): { error: string; want?: string } | null {
@@ -2282,8 +2289,8 @@ export interface ReflectionRoute {
2282
2289
  route: string;
2283
2290
  }
2284
2291
 
2285
- const DOCS_ROUTE = "docs flow (flow start fold-<topic> --docs) — project.md edits only pass its worktree";
2286
- const CODE_ROUTE = "patch flow (flow start fix-<topic> --patch), normal flow when bigger";
2292
+ const DOCS_ROUTE = "docs flow (flow reflect plan prints its --reflections start) — project.md edits only pass its worktree";
2293
+ const CODE_ROUTE = "patch flow (flow reflect plan prints its --reflections start), normal flow when bigger";
2287
2294
 
2288
2295
  export function reflectionRoutes(items: ReflectItem[], selfRepo: boolean): ReflectionRoute[] {
2289
2296
  return items.map((it) => {
@@ -2454,8 +2461,8 @@ export function reflectionNudges(text: string, today: string, opts: { recurred?:
2454
2461
  if (code && opts.between) why.push("between flows");
2455
2462
  let fix: string | null = null;
2456
2463
  if (open.length && why.length) {
2457
- const split = [docs ? `${docs} playbook item(s) → one docs flow (flow start fold-<topic> --docs)` : "", code ? `${code} code item(s) → patch flow (flow start fix-<topic> --patch)` : ""].filter(Boolean).join("; ");
2458
- fix = `⚑ fix the open reflections now? (${why.join(", ")}) — ${split}; flow reflect plan groups them into flows`;
2464
+ const split = [docs ? `${docs} playbook item(s) → one docs flow` : "", code ? `${code} code item(s) → patch flow(s)` : ""].filter(Boolean).join("; ");
2465
+ fix = `⚑ fix the open reflections now? (${why.join(", ")}) — ${split}; flow reflect plan groups them into flows and prints each start command`;
2459
2466
  }
2460
2467
  const closedLines = text.split("\n").filter(isDoneItem);
2461
2468
  const closed = closedLines.length;
@@ -1,7 +1,7 @@
1
1
  /** dev-flow runtime — The gate runner and the gates that do not ship anything. Moved out of extensions/dev-flow.ts as is (exports added). */
2
2
  import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
3
  import path from "node:path";
4
- import { skipsChecks, approveGate, versionArg, playbookVersionChoice, releaseCallQuestion, describeVersionChoice, applicableItems, appendRoadmapItem, checklistHash, claimBlocks, doneItemCount, detectForge, gateHelpJson, healthProbe, parseMergeStyle, investigationBrief, pluginVersion, reflectProtocol, reflectUnfiledCount, reflectionNudges, reflectionRoutes, listFiles, needsOperator, newState, nextHint, openChecklistItems, releaseGate, roadmapDone, roadmapDrop, roadmapOpenCount, roadmapOpenRows, roadmapBriefFor, roadmapPick, roadmapTidy, statusJson, subst, sq, featureTmpDir, foreignWorktreeLinks, validSlug, verifyGate, STAGE_EMOJI, type ReflectTarget, type Config, type FlowState, parseRowIds, DF_GITIGNORE } from "../core.ts";
4
+ import { foldCallError, skipsChecks, approveGate, versionArg, playbookVersionChoice, releaseCallQuestion, describeVersionChoice, applicableItems, appendRoadmapItem, checklistHash, claimBlocks, doneItemCount, detectForge, gateHelpJson, healthProbe, parseMergeStyle, investigationBrief, pluginVersion, reflectProtocol, reflectUnfiledCount, reflectionNudges, reflectionRoutes, listFiles, needsOperator, newState, nextHint, openChecklistItems, releaseGate, roadmapDone, roadmapDrop, roadmapOpenCount, roadmapOpenRows, roadmapBriefFor, roadmapPick, roadmapTidy, statusJson, subst, sq, featureTmpDir, foreignWorktreeLinks, validSlug, verifyGate, STAGE_EMOJI, type ReflectTarget, type Config, type FlowState, parseRowIds, DF_GITIGNORE } from "../core.ts";
5
5
  import { applyAnswers, buildDraft, doctorFindings, ghostFeatureDirs, ghostInfo, lineDiff, loadProject, mdDigest, parseAnswers, parseProjectMd } from "../projectmd.ts";
6
6
  import { linkedTag } from "../fold.ts";
7
7
  import { detectProject } from "../detect.ts";
@@ -412,8 +412,13 @@ export async function gateStart(o: GateCtx): Promise<RunResult> {
412
412
  const state = newState(slugArg, flag("ui"), flag("patch"), flag("docs"), loadedVersion() ?? undefined);
413
413
  if (linked.length) {
414
414
  state.reflections = linked;
415
+ // a fold flow fixes rows: on a versioned project it always merges unreleased, so no release call is asked
416
+ if (cfg.versioning.file) {
417
+ state.versionChoice = "unreleased";
418
+ state.noVersion = true;
419
+ }
415
420
  const rows = readReflections(root).filter((i) => linked.some((l) => l.id === i.n));
416
- notes.push(`linked reflections (finish closes each as fixed by this flow; one it does not fix: flow reflect defer <id> "<why>"):\n${rows.map((i) => ` r${i.n}. ${i.line.replace(/^- \[ \] /, "").replace(/^\[r\d+\]\s*/, "")}`).join("\n")}`);
421
+ notes.push(`linked reflections (finish closes each as fixed by this flow; one it does not fix: flow reflect defer <id> "<why>"):\n${rows.map((i) => ` r${i.n}. ${i.line.replace(/^- \[ \] /, "").replace(/^\[r\d+\]\s*/, "")}`).join("\n")}\nfold flow: it merges unreleased (entry under Unreleased, no bump, no tag — no release call is asked) and finishes without a closing reflection`);
417
422
  }
418
423
  const planDir = path.join(featDir(root, slugArg), "plan");
419
424
  if (ghost) notes.push(gi!.plan ? `adopted ghost .dev-flow/${slugArg}/ — its plan/ (${listFiles(planDir).join(", ") || "empty"}) is this feature's draft` : `adopted ghost .dev-flow/${slugArg}/ — kept ${gi!.entries.join(", ") || "nothing (it was empty)"}`);
@@ -451,6 +456,8 @@ export async function gateApprove(o: GateCtx): Promise<RunResult> {
451
456
  // the release call is made here, with the plan: only the kind of step is recorded, never a number
452
457
  const relArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
453
458
  if ("error" in relArg) return { text: `plan gate FAILED:\n- ${relArg.error}`, isError: true };
459
+ const foldErr = foldCallError(state!, relArg.choice);
460
+ if (foldErr) return { text: `plan gate FAILED:\n- ${foldErr}`, isError: true };
454
461
  const call = relArg.choice ?? state!.versionChoice ?? playbookVersionChoice(cfg);
455
462
  const callQ = cfg.versioning.file && !call ? releaseCallQuestion(manifestAt(root, cfg.versioning.file), cfg.versioning.file, state!.docs) : null;
456
463
  if (relArg.choice && relArg.choice !== "unreleased" && !cfg.versioning.file) return { text: "plan gate FAILED:\n- --version needs a version file to bump: the playbook sets none (versionFile under ## release)", isError: true };
@@ -528,6 +535,8 @@ export async function gateBump(o: GateCtx): Promise<RunResult> {
528
535
  const { state, err } = needState(root, sess, slug);
529
536
  if (err) return err;
530
537
  const choice = arg.choice!;
538
+ const foldErr = foldCallError(state!, choice);
539
+ if (foldErr) return { text: `bump FAILED:\n- ${foldErr}`, isError: true };
531
540
  if (!cfg.versioning.file && choice !== "unreleased") return { text: "bump FAILED:\n- the playbook sets no version file (versionFile under ## release), so there is nothing to bump — set one first", isError: true };
532
541
  if (state!.publish?.tag || state!.approvals.release) return { text: `bump FAILED:\n- ${state!.publish?.tag ?? "the release"} is already ${state!.publish?.tag ? "tagged" : "recorded"} — the call cannot change after the tag`, isError: true };
533
542
  const was = state!.versionChoice;
@@ -1,7 +1,7 @@
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 { skipsChecks, 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, prepFiles, versionArg, playbookVersionChoice, describeVersionChoice, majorBump, releaseCallQuestion, releaseCallProof, cmpRelease, versionCore, resolvedDevEnv, reviewOwed, localDefaultAhead, failTail, operatorDirt } from "../core.ts";
4
+ import { foldCallError, skipsChecks, 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, prepFiles, versionArg, playbookVersionChoice, describeVersionChoice, majorBump, releaseCallQuestion, releaseCallProof, cmpRelease, versionCore, resolvedDevEnv, reviewOwed, localDefaultAhead, failTail, operatorDirt } from "../core.ts";
5
5
  import type { Config, FlowState } from "../core.ts";
6
6
  import { AGENT_MARK } from "../present.ts";
7
7
  import { manifestAt, recordReleaseCall, refreshDocsCode, buildSkew, copyWarning, currentBranch, featDir, flagValue, forgeMergeStyle, forgeOf, gateCwd, mergeBase, needState, now, originUrl, readReflectionsText, readRoadmap, readState, releaseTags, roadmapFile, sh, tail, worktreeAbs, writeState } from "./base.ts";
@@ -25,6 +25,8 @@ export async function gateVerify(o: GateCtx): Promise<RunResult> {
25
25
  // the release call is made at Approve?; a --version/--no-version on the Verified? answer changes it (or makes it, for an older flow)
26
26
  const verArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
27
27
  if ("error" in verArg) return { text: `verify gate FAILED:\n- ${verArg.error}`, isError: true };
28
+ const foldErr = foldCallError(state!, verArg.choice);
29
+ if (foldErr) return { text: `verify gate FAILED:\n- ${foldErr}`, isError: true };
28
30
  // the operator reviews the tree that ships: catch up with the default branch before anything runs
29
31
  const caught = state!.stage === "implement" ? await catchUp(root, state!, cfg, flag("confirmed")) : { note: "" };
30
32
  if ("text" in caught) return caught;
@@ -226,6 +228,8 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
226
228
  // call before the tag, a resumed publish included
227
229
  const relArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
228
230
  if ("error" in relArg) return { text: `release gate FAILED:\n- ${relArg.error}`, isError: true };
231
+ const foldErr = foldCallError(state!, relArg.choice);
232
+ if (foldErr) return { text: `release gate FAILED:\n- ${foldErr}`, isError: true };
229
233
  if (state!.stage === "release" && state!.approvals["pre-release"]) {
230
234
  if (state!.approvals.release) return { text: `release already recorded.\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
231
235
  let callNote = "";
@@ -853,19 +857,21 @@ export async function gateFinishCore(o: GateCtx): Promise<RunResult> {
853
857
  // transcripts and .dev-flow/<slug>/tmp, and finish is about to drop that folder and the binding — a
854
858
  // reflection asked for after finish has nothing bound to run against. Only the operator's explicit
855
859
  // --no-reflect skips it; yolo never does (it answers checkpoints, it does not waive the review).
856
- const skipReflect = flag("no-reflect");
860
+ // a fold flow fixes reflections; it does not review for new ones — it never runs the closing reflection
861
+ const fold = !!state!.reflections?.length;
862
+ const skipReflect = flag("no-reflect") && !fold;
857
863
  if (skipReflect && !flag("confirmed")) return { text: "--no-reflect is the operator's word — ask them whether to skip the closing reflection, then re-run with --no-reflect --confirmed", isError: true };
858
864
  // a flow that never hit a refusal, a guard block or a change shipped after Verified?, with no friction note
859
865
  // from the operator, has nothing
860
866
  // for the reflection worker to find — skip the worker run unless the playbook says reflect = always
861
867
  const note = flagValue(o.rest, "note") ?? "";
862
- const quiet = !state!.reflectedAt && !skipReflect && cfg.release.reflect !== "always" && !(state!.friction ?? 0) && !note.trim();
868
+ const quiet = !state!.reflectedAt && !skipReflect && (fold || (cfg.release.reflect !== "always" && !(state!.friction ?? 0) && !note.trim()));
863
869
  if (quiet) {
864
870
  state!.reflectedAt = now();
865
871
  state!.reflectQuiet = true;
866
872
  writeState(root, state!);
867
873
  }
868
- const quietNote = quiet ? " closing reflection skipped: no refusals, guard blocks or unverified changes this flow (playbook reflect = always runs it anyway)." : "";
874
+ const quietNote = quiet && fold ? " closing reflection skipped: a fold flow (it fixes reflections, it does not review for new ones)." : quiet ? " closing reflection skipped: no refusals, guard blocks or unverified changes this flow (playbook reflect = always runs it anyway)." : "";
869
875
  if (!state!.reflectedAt && !skipReflect) {
870
876
  const skipHint = "or — only on the operator's explicit word — flow finish --no-reflect --confirmed";
871
877
  if (!o.hooks.reflect) return { text: `finish: no reflection recorded for ${state!.slug} and no reflect worker available here — run flow_stage(op: "reflect") first, ${skipHint}`, isError: true };