pi-dev-flow 0.92.0 → 0.92.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,17 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.92.1] - 2026-11-14
8
+
9
+ **Stage workers are told your guard rules, a docs flow's worker runs no project checks, and `flow reflect done` closes a batch.**
10
+
11
+ ### Changed
12
+ - **`flow reflect done` closes several notes at once (gh#220).** A fold that fixed nine notes checked them off by patching `reflections.md` with a script, because nothing pointed the session at the command. `flow reflect done 3,4,7 "<what fixed them>"` now closes a batch, and one bad number closes none. `flow reflect list` tells the agent to use it instead of editing the file.
13
+
14
+ ### Fixed
15
+ - **Worker briefs carry your guard rules (gh#214).** A `flow_stage` worker has no operator, so a command your `confirm` rule matches can never be granted. A review worker chained a read-only check with a `docker compose down`; the guard refused the whole call and the check was silently dropped. Every worker brief now lists the playbook's `deny`, `confirm`, `protect` and `forbid` rules, says not to try or work around them, says to run each probe as its own call, and has the worker report a blocked check under `checks not run:`.
16
+ - **A docs flow's worker is no longer told to run project checks (gh#211).** On a `--docs` flow the gates skip the project's commands and no setup runs in the worktree, but the review brief still listed the test and health commands. The worker installed every dependency to run checks its own gate had skipped. The brief now says there are none to run.
17
+
7
18
  ## [0.92.0] - 2026-11-14
8
19
 
9
20
  **The gates stop repeating work and asking empty questions, and on GitHub `flow release` publishes the release itself.**
package/docs/playbook.md CHANGED
@@ -147,6 +147,8 @@ forbid docker/secrets :: secret storage
147
147
 
148
148
  Tips:
149
149
  - Text after ` :: ` is the reason, shown when the rule fires.
150
+ - `flow_stage` workers get these rules in their brief. A worker has no one to ask, so `confirm` and
151
+ `protect` are refusals for it, and the reason you write is what it reads.
150
152
  - An invalid regex makes the playbook invalid, and `flow init` refuses it.
151
153
  - Match the **verb** you mean, not a flag. `\bgit\b[^\n]*--force` also blocks
152
154
  `git filter-branch --force`.
@@ -26,7 +26,7 @@ dev-flow repo, filed only when you say so.
26
26
  | `flow reflect "<note>"` | guesses the section from the wording and says why |
27
27
  | `flow reflect list` | numbers the open notes |
28
28
  | `flow reflect move <n> --code` | moves a note to the other section |
29
- | `flow reflect done <n> "<what>"` | checks a note off as fixed |
29
+ | `flow reflect done <n> "<what>"` | checks a note off as fixed. `done 3,4,7 "<what>"` closes several at once; one bad number closes none. |
30
30
  | `flow reflect tidy` | removes the checked-off notes |
31
31
 
32
32
  `flow status` and `flow doctor` show how many notes are open.
@@ -344,8 +344,10 @@ export default function devFlow(pi: ExtensionAPI) {
344
344
  defaultBranch: cfg.defaultBranch,
345
345
  commits: await git(`git log --oneline ${sq(cfg.defaultBranch)}..HEAD`),
346
346
  status: await git("git status --short"),
347
- checks: cfg.checkList.map((c) => ({ name: c.name, command: c.cmd })),
347
+ checks: st.docs ? [] : cfg.checkList.map((c) => ({ name: c.name, command: c.cmd })),
348
348
  preamble: cfg.workerPreamble,
349
+ docs: !!st.docs,
350
+ guard: cfg.guard,
349
351
  note: String(params.note ?? ""),
350
352
  });
351
353
  let brief: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dev-flow",
3
- "version": "0.92.0",
3
+ "version": "0.92.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": [
@@ -18,7 +18,7 @@ friction only, never the same issue twice. `.dev-flow/reflections.md` holds
18
18
  itself, plugin feedback is code.
19
19
  - No flag → the wording decides and the printed line says why.
20
20
  - `flow reflect list` numbers the queue; `flow reflect move <n>
21
- --playbook|--code` re-files; `flow reflect done <n> ["<what fixed it>"]`
21
+ --playbook|--code` re-files; `flow reflect done <n>[,<n>…] ["<what fixed it>"]`
22
22
  checks one off; `flow reflect tidy` drops closed items. The numbers are
23
23
  row numbers: checking items off leaves the others' numbers alone, so a
24
24
  batch of `done` calls read off one `list` is safe; after `move` or `tidy`,
@@ -33,7 +33,8 @@ doctor` — never mid-feature. One line; the operator decides.
33
33
 
34
34
  **Folding items in** on the operator's word: investigate, propose, confirm,
35
35
  open the routed flow and apply it there (`project.md` is editable only in a
36
- docs/patch worktree), then `flow reflect done <n> "<what>"` once merged.
36
+ docs/patch worktree), then `flow reflect done <n> "<what>"` once merged (`done 3,4,7 "<what>"`
37
+ closes a batch) — never by editing `reflections.md`.
37
38
 
38
39
  **GitHub issues** fold into `flow doctor` / `reflect list` when the repo has a
39
40
  GitHub remote: a local row an open issue covers shows `⟷ gh#NNN` (check it off
package/src/core.ts CHANGED
@@ -2446,9 +2446,32 @@ export interface WorkerBriefInput {
2446
2446
  checks: { name: string; command: string }[];
2447
2447
  /** the playbook's `flow-worker` lines (gh#201): setup a worker needs before any project check can run */
2448
2448
  preamble?: string[];
2449
+ /** a --docs flow: the gates skip every project command, and no setup ran in the worktree — the brief hands out none (gh#211) */
2450
+ docs?: boolean;
2451
+ /** the playbook's guard rules (gh#214): a worker has no operator, so a `confirm` refusal has no answer — it must know not to try */
2452
+ guard?: GuardRules;
2449
2453
  note: string;
2450
2454
  }
2451
2455
 
2456
+ /** The playbook's guard rules as a brief section (gh#214). A worker has no operator: a command a `confirm` rule
2457
+ * matches can never be granted, and the refusal takes the whole bash call down — chained read-only parts too. */
2458
+ function workerGuardLines(guard: GuardRules | undefined): string[] {
2459
+ if (!guard) return [];
2460
+ const rows = (rules: GuardRule[]) => rules.map((r) => ` - \`${r.pattern}\`${r.why ? ` — ${r.why}` : ""}`);
2461
+ const blocked = [...guard.deny, ...guard.confirm];
2462
+ const paths = [...guard.protect, ...guard.forbid];
2463
+ if (!blocked.length && !paths.length) return [];
2464
+ return [
2465
+ "## Guard rules (from the project's playbook)",
2466
+ "A guard checks every command and path. You have no operator to ask, so a rule that needs their OK is a refusal for you: do not try the command, and do not work around it (a copy of a file, another directory, a different spelling).",
2467
+ ...(blocked.length ? ["- Commands matching these patterns (regular expressions) are refused:", ...rows(blocked)] : []),
2468
+ ...(paths.length ? ["- Paths matching these are not yours to write:", ...rows(paths)] : []),
2469
+ "- A refusal stops the whole bash call, so the read-only parts chained with the refused command do not run either: run each probe as its own call.",
2470
+ "- A check you could not run because of a rule: name it and the rule under `checks not run:` in the REPORT — never report it as passed.",
2471
+ "",
2472
+ ];
2473
+ }
2474
+
2452
2475
  /** The facts every worker needs, so the driver's note can be just the slice. The plan path is absolute:
2453
2476
  * it lives in the MAIN checkout's gitignored .dev-flow/, never inside the worktree. */
2454
2477
  export function buildWorkerBrief(o: WorkerBriefInput): string {
@@ -2464,10 +2487,13 @@ export function buildWorkerBrief(o: WorkerBriefInput): string {
2464
2487
  `- Branch base: ${o.defaultBranch}`,
2465
2488
  `- Commits on the branch so far:\n${o.commits.trim() ? o.commits.trim().split("\n").map((l) => ` ${l}`).join("\n") : " (none)"}`,
2466
2489
  `- Uncommitted now: ${o.status.trim() ? `\n${o.status.trim().split("\n").map((l) => ` ${l}`).join("\n")}` : "clean"}`,
2467
- `- Project checks (run them before you report${o.preamble?.length ? ", in a shell that ran the setup below first" : ""}):\n${checks}`,
2490
+ o.docs
2491
+ ? "- Project checks: none — this is a docs flow. The gates skip the project's commands and no setup ran in this worktree (no installed dependencies): do not install, build or run the test suite; check the docs against the code by reading."
2492
+ : `- Project checks (run them before you report${o.preamble?.length ? ", in a shell that ran the setup below first" : ""}):\n${checks}`,
2468
2493
  "- You hold no flow tool: gates, checkpoints and the operator stay with the driving session.",
2469
2494
  "",
2470
- ...(o.preamble?.length
2495
+ ...workerGuardLines(o.guard),
2496
+ ...(o.preamble?.length && !o.docs
2471
2497
  ? ["## Setup (from the project's playbook)", "Run these lines in every shell that runs a project check: each bash call is a fresh shell, so prefix the check with them or chain them with `&&`.", "```sh", ...o.preamble, "```", ""]
2472
2498
  : []),
2473
2499
  "## Your task",
@@ -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] [--no-ui --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] | finish [--yolo] [--no-reflect] [--note=<text>] [--no-artifact-check|--no-release-create] [slug] | abort [slug] [--purge] | 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 on start is the agent's call whenever screens change (it only adds the mockup gate); --patch/--docs are proposed at start and granted by the Approve? answer; --no-ui (clearing ui on a plan-stage feature) and --merge=<style> 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 — on GitHub release then publishes itself (push, PR, CI wait, merge in the playbook style, annotated tag) and records the release; a 'publish stopped' or 'publish waiting' result is resumed by re-running flow release; publish = manual in the playbook (or another forge) leaves those steps to the agent, and finish records the release (--no-artifact-check / --no-release-create skip a proof on the operator's word) — 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 — abort unbinds and keeps the worktree; abort --purge (--confirmed, the operator's Purge? answer) removes the worktree, branch and feature folder of a dropped feature, never anything on origin — 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>[,<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] [--no-ui --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] | finish [--yolo] [--no-reflect] [--note=<text>] [--no-artifact-check|--no-release-create] [slug] | abort [slug] [--purge] | 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 on start is the agent's call whenever screens change (it only adds the mockup gate); --patch/--docs are proposed at start and granted by the Approve? answer; --no-ui (clearing ui on a plan-stage feature) and --merge=<style> 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 — on GitHub release then publishes itself (push, PR, CI wait, merge in the playbook style, annotated tag) and records the release; a 'publish stopped' or 'publish waiting' result is resumed by re-running flow release; publish = manual in the playbook (or another forge) leaves those steps to the agent, and finish records the release (--no-artifact-check / --no-release-create skip a proof on the operator's word) — 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 — abort unbinds and keeps the worktree; abort --purge (--confirmed, the operator's Purge? answer) removes the worktree, branch and feature folder of a dropped feature, never anything on origin — 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");
@@ -6,6 +6,7 @@ import { dedupeReflections, linkedTag, parseGhIssues, similarNote, type FoldResu
6
6
  import { dfDir, now, originUrl, readReflections, readReflectionsText, sh } from "./base.ts";
7
7
  import { type RunResult, type Session } from "./checks.ts";
8
8
  import { isSelfRepo } from "./setup.ts";
9
+ import { AGENT_MARK } from "../present.ts";
9
10
 
10
11
  /** The dev-flow repo plugin notes are filed against: the manifest's repository field; the dev-flow
11
12
  * checkout itself falls back to its origin. */
@@ -93,6 +94,8 @@ export async function reflectList(root: string): Promise<RunResult> {
93
94
  const link = fold.state === "ok" ? fold.result.linked.find((l) => l.item === i) : undefined;
94
95
  return ` ${it.n}. [${it.section}] ${it.line.replace(/^- \[ \] /, "")}${link ? linkedTag(link.issue) : ""}`;
95
96
  }),
97
+ // gh#220: the command that closes a row has to be in front of the session that is about to hand-edit the file
98
+ `${AGENT_MARK}close fixed rows with flow reflect done <n>[,<n>…] "<what fixed it>" — never by editing reflections.md`,
96
99
  ]
97
100
  : fold.state === "absent" || fold.state === "skipped"
98
101
  ? ["reflections: nothing open"]
@@ -148,15 +151,23 @@ function noOpenRow(text: string, n: number, items: readonly ReflectItem[]): stri
148
151
  export function reflectDoneNote(root: string, sess: Session, args: string[]): RunResult {
149
152
  const text = readReflectionsText(root);
150
153
  const items = reflectItems(text);
151
- const n = Number(args[0]);
152
- const it = items.find((x) => x.n === n);
153
- if (!it) return { text: `done: ${noOpenRow(text, n, items)}`, isError: true };
154
+ // gh#220: a fold closes several rows with one fix — `done 3,4,7 "<what>"` checks them off together. Checking a
155
+ // row off leaves the other numbers as they are, so the batch is all or nothing: one bad number closes none.
156
+ const nums = [...new Set(String(args[0] ?? "").split(",").map((p) => p.trim()).filter(Boolean).map(Number))];
157
+ if (!nums.length) return { text: 'usage: flow reflect done <n>[,<n>…] "<what fixed it>"', isError: true };
158
+ const picked = nums.map((n) => ({ n, it: items.find((x) => x.n === n) }));
159
+ const bad = picked.filter((p) => !p.it);
160
+ if (bad.length) return { text: `done: ${bad.map((p) => noOpenRow(text, p.n, items)).join("; ")}${nums.length > 1 ? " — nothing was checked off" : ""}`, isError: true };
154
161
  const stamp = [now().slice(0, 10), sess.slug].filter(Boolean).join(" ");
155
162
  const what = args.slice(1).join(" ").trim();
156
- const next = reflectDone(text, n, what ? `${stamp} — ${what}` : stamp)!;
163
+ let next = text;
164
+ for (const n of nums) next = reflectDone(next, n, what ? `${stamp} — ${what}` : stamp)!;
157
165
  writeFileSync(path.join(dfDir(root), "reflections.md"), next);
158
166
  const { tidy } = reflectionNudges(next, now().slice(0, 10));
159
- return { text: `reflect: item ${n} checked off — ${it.body}${what ? ` — fixed: ${what}` : ""}` + (tidy ? `\n${tidy}` : "") };
167
+ const head = nums.length === 1
168
+ ? `reflect: item ${nums[0]} checked off — ${picked[0].it!.body}${what ? ` — fixed: ${what}` : ""}`
169
+ : `reflect: ${nums.length} items checked off${what ? ` — fixed: ${what}` : ""}\n${picked.map((p) => ` ${p.n}. ${p.it!.body}`).join("\n")}`;
170
+ return { text: head + (tidy ? `\n${tidy}` : "") };
160
171
  }
161
172
 
162
173
  /** `flow reflect tidy` — drop the closed (`- [x]`) items; the `— fixed:` note already recorded the outcome. */