pi-dev-flow 0.92.1 → 0.94.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 +33 -0
- package/docs/gates.md +30 -8
- package/docs/guardrails.md +5 -1
- package/docs/playbook.md +2 -2
- package/extensions/dev-flow.ts +27 -4
- package/package.json +1 -1
- package/skills/dev-flow/SKILL.md +6 -6
- package/skills/dev-flow/references/implement.md +10 -1
- package/skills/dev-flow/references/pre-release.md +12 -6
- package/skills/dev-flow/references/reflect.md +5 -3
- package/skills/flow-review/SKILL.md +1 -1
- package/src/core.ts +174 -34
- package/src/present.ts +6 -3
- package/src/projectmd.ts +41 -7
- package/src/runtime/base.ts +18 -3
- package/src/runtime/checks.ts +30 -9
- package/src/runtime/gates.ts +69 -14
- package/src/runtime/publish.ts +30 -5
- package/src/runtime/ship.ts +68 -20
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,39 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.94.0] - 2026-11-19
|
|
8
|
+
|
|
9
|
+
**The review runs before Verified?, so you're asked Verified? once; an unanswered re-verify holds the release; your Release? word stands on the first call under `yolo = until-release`; and `flow roadmap done` closes the items you named.**
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- **The review runs before Verified?, so you're asked Verified? once (gh#248).** The review step ran after your Verified?, so every finding changed the tree you had already approved and the agent asked again. One flow asked three times. The review now runs in implement once `flow check` is green, and the first `flow verify` refuses until one is on record (a review worker records itself; an inline one is recorded with `flow review done "<verdict>"`). Your one look covers the tree that ships. A flow already at pre-release without a review still owes it at release.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- **An unanswered re-verify holds the release (gh#249).** When `flow verify` at pre-release asked Verified? again, nothing recorded that it was waiting. The agent took your "verified", went straight to release prep and shipped without recording it, so the release went out under the older word with only a warning. `flow release` now refuses until the answer is recorded with `flow verify --confirmed`.
|
|
16
|
+
- **Your Release? word stands on the first call under `yolo = until-release` (gh#206).** On a yolo flow the knob made the gate ask Release? itself first, so an answer you had already given in chat was refused twice and you had to repeat it. A plain `--confirmed` now stands like on any flow. A replayed `--yolo --confirmed` (gh#219) and a release with commits after Verified? or a stale build are still asked first.
|
|
17
|
+
- **`flow roadmap done` closes the items you named (gh#245).** The list was numbered over open items only, so closing item 6 renumbered the rest: for "close 6 and 7", a second `done 7` hit the item that used to be 8. Numbers are now row numbers: a done item keeps its row, so the other numbers stay where the list printed them. `done 6,7` closes several in one call, and one bad number closes none. `drop` takes a batch too, and `drop` and `tidy` say the numbers changed.
|
|
18
|
+
|
|
19
|
+
## [0.93.0] - 2026-11-18
|
|
20
|
+
|
|
21
|
+
**`flow release` needs a review on record and opens the PR with the body your template asks for; checks stay passed across a commit of the same tree; feature worktrees take only their own feature's work; and `flow finish` names what is really wrong.**
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- **The flow tool names a wrongly shaped `args` (gh#238).** An `args` array that arrived marshalled as one JSON string was dispatched with the whole blob as the subcommand, and the reply was the full usage with the diagnosis buried in it. The tool now refuses with "args must be an array of strings; this arrived as one string holding an array" and shows the elements to pass. An unknown subcommand gets a one-line reply that leads with the word and lists the known ones.
|
|
25
|
+
- **The reflection digest marks only real guard blocks as `GUARD` (gh#239).** A successful command whose output happened to contain `NEEDS-OPERATOR` (a grep of the source, a quoted refusal) was tagged as a guard event, and a review worker went looking for a block that never happened. Guard blocks reach the transcript as error results, so `GUARD` is now only an error result that begins with the guard's marker.
|
|
26
|
+
- **A passing check survives committing the tree it passed on (gh#231).** A check's record was tied to HEAD plus the uncommitted diff. Running `flow check` over a fix and then committing that same fix made the record stale, and `flow release` re-ran a minute-long suite over an identical tree. The record is now tied to the tree's content (every file's blob, computed without writing to the repo), so only a real change makes it stale. When the gate does re-run a check it says why: the tree changed, the last run failed, or no run is on record.
|
|
27
|
+
- **`flow release` opens the PR with the body your repo's template asks for (gh#240).** The gate built the PR body from the changelog entry, so a repo's `.github/pull_request_template.md` gate list (what changed, who verified it, over which commit) never reached the PR. It had to be patched in after the merge. The gate now uses `.dev-flow/<slug>/pr-body.md` when the agent wrote one. In a repo with a PR template it refuses, before Release? is asked, until that file exists. The publish result says which body the PR got.
|
|
28
|
+
- **A flow's scratch dir no longer piles up `mktemp` leftovers (gh#243).** Every process a flow runs gets `.dev-flow/<slug>/tmp` as `TMPDIR`, and tooling that never removes its `mktemp` directories left over a thousand of them after one flow. Each check run now sweeps entries that look like `mktemp` output and haven't been touched for an hour. A name the project chose (a dev server's cache) is never swept, and neither is anything recent. Worker briefs also say to remove what they create there.
|
|
29
|
+
- **The ground rules say not to batch a gate with the git step it reads (gh#236).** In one session the agent put gates in the same tool batch as the command they depend on (commit then verify, merge then finish, checkout main then start, verify then release). The gate ran first and refused, four times across flows. The injected rules now say to call a gate only after that step has returned.
|
|
30
|
+
- **The stage line names the open checklist items (gh#241).** It showed tier-2 as a bare count (`tier-2 \`4 open\` ?`), and since implement and pre-release have different lists the count changed with no explanation. Finding the items meant re-reading `project.md`. The stage line now names the current stage's items, clipped, up to four plus a count.
|
|
31
|
+
- **`flow doctor` checks a script against the package.json it runs in (gh#227).** `cd storefront && npm run build` was checked against the root package.json and flagged on every start, status and doctor run. A leading relative `cd`, `npm --prefix`, `pnpm -C` and `yarn --cwd` now pick the package.json. A directory it can't resolve (an absolute or `$VAR` path) is skipped, not flagged.
|
|
32
|
+
- **`flow release` requires a review on record (gh#233).** The pre-release hint said to run the review step, but nothing checked it ran, and a 566-line change shipped unreviewed. The release gate now refuses until a review is recorded: a `flow_stage` review worker records itself, and an inline `/flow-review` is recorded with `flow review done "<verdict>"`. The verdict stays advisory. Shipping without a review is the operator's word (`flow review --skip`, asked as **Skip review?**). Docs flows and release-only cuts owe none, and `review = ""` under `## release` turns the requirement off.
|
|
33
|
+
- **A failing check shows its errors, not just its last lines (gh#242).** `flow check` printed the last 15 lines of a failing command, and for a lint step those were pre-existing warnings and "exited with code 1". The two files it refused were 200 lines up, and finding them took running the linter by hand. A failing check or build now lifts the error-level lines from the part of the output that gets cut, each with the line before it (where formatters name the file), above the usual tail.
|
|
34
|
+
- **A branch switch earlier in a command decides where a later merge lands (gh#235).** The guard read each directory's branch before the command ran, so `git checkout team-test && git merge feat/x` in the main checkout was refused as "merging into main". The agent then merged in a /tmp worktree the guard couldn't see. A `checkout`/`switch` to a branch earlier in the chain now moves the branch the later segments are judged on. A path restore (`git checkout -- f`) doesn't.
|
|
35
|
+
- **An empty playbook value turns the setting off (gh#226, gh#229).** `changelog =` was read as a single space and `changelog = ""` as a literal `""`, so a project couldn't opt out of a changelog, though the gate's own hint said to. An empty `health =` likewise showed up as `health: PASS ( )`. An empty value, `""` or `''` now means unset for the command and release keys (`changelog`, `review`, `health`, `test`, …). The missing-changelog refusal names the opt-out, and `flow verify` no longer claims it re-probed a live app when no dev deploy or health probe is configured.
|
|
36
|
+
- **`flow finish` no longer blames a squash merge for a PR that just merged (gh#237).** Under `merge = merge`, a branch missing from main was always reported as squash- or rebase-merged, even when the forge reported no merged PR yet or a real merge commit that this clone hadn't fetched. The refusal now says which: not merged yet, main behind the forge (fetch and re-run), or the squash or rebase the forge reports.
|
|
37
|
+
- **`flow finish` checks the local default branch, not wherever the main checkout happens to be (gh#234, gh#228).** With the main checkout on another branch, finish said "push the release (git push origin main)", which was wrong. And the playbook commit from `flow init --track` sat on local main, so finish sent the agent to merge origin into local main and push main directly. Finish now compares local main with origin wherever the checkout is, and names the local-only commits and the checkout's branch. Playbook-only commits are a note, not a block, and fast-forwarding local main works off-branch too.
|
|
38
|
+
- **A feature worktree takes only its own feature's work (gh#232).** After a release was recorded, an agent created a branch in the same worktree, committed a redesign and merged it to production with no plan, check, review or Verified?. The guard now refuses `git branch <name>` in a feature worktree (as it already did `checkout -b`), any commit, merge, cherry-pick or revert while the worktree is on another branch, and any commit once the release is recorded. Each refusal says to start a new flow.
|
|
39
|
+
|
|
7
40
|
## [0.92.1] - 2026-11-14
|
|
8
41
|
|
|
9
42
|
**Stage workers are told your guard rules, a docs flow's worker runs no project checks, and `flow reflect done` closes a batch.**
|
package/docs/gates.md
CHANGED
|
@@ -88,6 +88,7 @@ Run without `--confirmed`, it deploys for your review:
|
|
|
88
88
|
4. Asks **Verified?**
|
|
89
89
|
|
|
90
90
|
It refuses if:
|
|
91
|
+
- no review is on record (see below);
|
|
91
92
|
- the branch has no commits (except a release-only flow on a versioned project with unreleased
|
|
92
93
|
commits on main);
|
|
93
94
|
- a check, the build or the post-deploy health probe fails;
|
|
@@ -102,8 +103,17 @@ With `--confirmed`, it never rewrites history. If main moved since the review de
|
|
|
102
103
|
your review, it only checks that the app still answers. If the tree changed, or the app stopped
|
|
103
104
|
answering, it deploys again.
|
|
104
105
|
|
|
105
|
-
**
|
|
106
|
-
|
|
106
|
+
**The review comes before Verified?** The playbook's review step (`release.review`, `/flow-review`
|
|
107
|
+
by default) runs in implement, once `flow check` is green, and the first `flow verify` refuses until
|
|
108
|
+
it is on record: a `flow_stage` review worker records itself, and an inline review is recorded with
|
|
109
|
+
`flow review done "<verdict>"`. Run after Verified?, every review finding changed the tree you had
|
|
110
|
+
already approved and you were asked again. Reviewed first, your one look covers the tree that ships.
|
|
111
|
+
Docs flows and release-only cuts owe none, `review = ""` under `## release` turns it off, and
|
|
112
|
+
skipping it is your call (`flow review --skip`, asked as **Skip review?**).
|
|
113
|
+
|
|
114
|
+
**At pre-release, `verify` is the re-verify:** after a late fix, it re-runs the build, deploy and
|
|
115
|
+
probes on the current tree and asks Verified? again. A standing yolo never answers this, and
|
|
116
|
+
`flow release` refuses until the answer is recorded with `flow verify --confirmed`.
|
|
107
117
|
|
|
108
118
|
## release: Release?
|
|
109
119
|
|
|
@@ -122,10 +132,16 @@ Proves the branch is ready to ship:
|
|
|
122
132
|
before a commit holding only release prep (version file, changelog) stay green without a re-run;
|
|
123
133
|
set `recheck = always` in `## release` to re-run them anyway. `release.preflight` passes if set.
|
|
124
134
|
- There are no leftover conflict markers (`<<<<<<<`) and no uncommitted files in the worktree.
|
|
135
|
+
- **A review is on record.** It normally ran before Verified? (see [verify](#verify-verified)); a
|
|
136
|
+
flow that reached pre-release without one owes it here. The verdict stays advisory; only that a
|
|
137
|
+
review ran is checked.
|
|
138
|
+
- **No re-verify is waiting.** When `flow verify` at pre-release asked Verified? again, the answer
|
|
139
|
+
has to be recorded (`flow verify --confirmed`) before the release ships under it.
|
|
125
140
|
|
|
126
141
|
**Release? often answers itself** (`ask = on-change`, the default). That happens when your call is
|
|
127
|
-
on record and only release prep (bump, changelog) changed since Verified?. A `--confirmed` given before the gate asked doesn't count where a question
|
|
128
|
-
or a stale build): the gate asks first.
|
|
142
|
+
on record and only release prep (bump, changelog) changed since Verified?. A `--confirmed` given before the gate asked doesn't count where a question carries news you haven't
|
|
143
|
+
seen (commits after Verified? on a yolo flow, or a stale build): the gate asks first. A yolo held back
|
|
144
|
+
only by `yolo = until-release` is asked like any flow, so your chat answer stands on the first call.
|
|
129
145
|
|
|
130
146
|
It still asks when:
|
|
131
147
|
- code changed after Verified?;
|
|
@@ -142,7 +158,10 @@ Escape hatches, used only on your word: `--no-fold-check` skips the line-level c
|
|
|
142
158
|
|
|
143
159
|
On GitHub, the same `flow release` call then publishes. Your Release? answer is what authorizes it:
|
|
144
160
|
|
|
145
|
-
1. Pushes the branch and opens the PR
|
|
161
|
+
1. Pushes the branch and opens the PR. The body is `.dev-flow/<slug>/pr-body.md` when the agent
|
|
162
|
+
wrote one, else the changelog entry. If the repo has a pull-request template
|
|
163
|
+
(`.github/pull_request_template.md`), the gate refuses until `pr-body.md` exists, before
|
|
164
|
+
Release? is asked, so the template's sections are filled before the merge.
|
|
146
165
|
2. Waits for the PR's CI, up to 30 minutes. A repo with no CI is given a minute for checks to show up.
|
|
147
166
|
3. Merges in the playbook's `merge` style.
|
|
148
167
|
4. Creates an annotated tag on the PR's merge commit and pushes it (versioned flows).
|
|
@@ -188,8 +207,11 @@ call it.
|
|
|
188
207
|
the remote branch only once it's proven merged. If local main is just behind origin, it
|
|
189
208
|
fast-forwards it.
|
|
190
209
|
|
|
191
|
-
It refuses until the release is recorded, the main checkout is clean
|
|
192
|
-
|
|
210
|
+
It refuses until the release is recorded, the main checkout is clean, the local default branch has
|
|
211
|
+
nothing origin lacks, and the worktree has no uncommitted changes. It reads the local default branch
|
|
212
|
+
even when the main checkout is on another branch, and names the commits that are local-only.
|
|
213
|
+
Playbook commits from `flow init --track` are only noted: they reach origin through a docs flow,
|
|
214
|
+
never a direct push. Under `merge = merge`, commits missing from main are a policy violation that
|
|
193
215
|
yolo can't answer.
|
|
194
216
|
|
|
195
217
|
**Finish? answers itself on a clean flow** (`finish = on-change`, the default): the release is
|
|
@@ -202,7 +224,7 @@ To drop an unreleased feature, use `flow abort` instead.
|
|
|
202
224
|
## reflect, roadmap, doctor
|
|
203
225
|
|
|
204
226
|
- `flow reflect …` manages the notes queue. See [reflections](reflections.md).
|
|
205
|
-
- `flow roadmap [add "<feature>" [--slug=] [--brief=] | pick <n> <slug> | done <n> | drop <n> | tidy]`
|
|
227
|
+
- `flow roadmap [add "<feature>" [--slug=] [--brief=] | pick <n> <slug> | done <n>[,<n>…] | drop <n>[,<n>…] | tidy]` — `<n>` is the row number the list prints; `done` leaves the others in place, `drop` and `tidy` renumber
|
|
206
228
|
manages `.dev-flow/roadmap.md`. `pick` stamps an item for `flow start <slug>`, and `finish` checks
|
|
207
229
|
it off when the feature ships.
|
|
208
230
|
- `flow doctor ["<note>"]` is a read-only health report: playbook drift, dead commands, ghost
|
package/docs/guardrails.md
CHANGED
|
@@ -28,7 +28,11 @@ playbook, dev-flow stays silent.
|
|
|
28
28
|
- Paths are checked after resolving symlinks.
|
|
29
29
|
- Scratch files outside the repo (the OS temp dir) are always fine. A bound feature's `TMPDIR`
|
|
30
30
|
points to `.dev-flow/<slug>/tmp/`, which is cleaned up at finish.
|
|
31
|
-
- Creating a new branch inside a feature worktree is refused
|
|
31
|
+
- Creating a new branch inside a feature worktree is refused (`checkout -b`, `switch -c` and
|
|
32
|
+
`git branch <name>`). An unrelated fix gets its own flow.
|
|
33
|
+
- A worktree only takes its own feature's commits: a commit, merge, cherry-pick or revert while the
|
|
34
|
+
worktree is on any other branch is refused. Once the release is recorded the worktree takes no new
|
|
35
|
+
commits at all; follow-up work is a new flow, and release chores go in the main checkout.
|
|
32
36
|
|
|
33
37
|
**No work outside a flow.**
|
|
34
38
|
- In a repo with `.dev-flow/`, an unbound session can't edit source files. Everything starts with
|
package/docs/playbook.md
CHANGED
|
@@ -169,7 +169,7 @@ These go under `## pre-release` or `## release`. Either section works.
|
|
|
169
169
|
|---|---|---|
|
|
170
170
|
| `versionFile` | — | the version manifest (`package.json`, `VERSION`, …). Without it, releases are unversioned. |
|
|
171
171
|
| `versionTag` | `v{version}` | tag format |
|
|
172
|
-
| `changelog` | `CHANGELOG.md` | set it empty to opt out |
|
|
172
|
+
| `changelog` | `CHANGELOG.md` | set it empty (`changelog =` or `changelog = ""`) to opt out |
|
|
173
173
|
| `merge` | *(asked)* | how a PR lands: `squash`, `merge`, `rebase` or `any`. See below. |
|
|
174
174
|
| `version` | `ask` | who makes the release call: `ask` (you, at Verified?), or `versioned` / `unversioned` for every flow |
|
|
175
175
|
| `ask` | `on-change` | `on-change`: Release? answers itself when only release prep changed. `always`: ask every time. |
|
|
@@ -178,7 +178,7 @@ These go under `## pre-release` or `## release`. Either section works.
|
|
|
178
178
|
| `recheck` | `prep-skip` | `prep-skip`: checks stay green across a commit that holds only the version bump and changelog. `always`: re-run them. |
|
|
179
179
|
| `yolo` | `all` | `until-release`: a yolo given earlier never answers Release?. The gate asks, and only your answer to that question releases. |
|
|
180
180
|
| `reflect` | `on-friction` | `always`: run the closing reflection on every finish |
|
|
181
|
-
| `review` | `/flow-review` | the review step
|
|
181
|
+
| `review` | `/flow-review` | the review step, run in implement before Verified?. `flow verify` requires one on record (see [gates](gates.md#verify-verified)), and so does `flow release`; set it empty to turn that off. |
|
|
182
182
|
| `preflight` | — | runs in the worktree at `flow release` before anything ships, for example `docker build .` |
|
|
183
183
|
| `artifact` | — | proves the release was published, for example `npm view <pkg>@{version} version` |
|
|
184
184
|
| `releases` | `true` | `false` skips creating a forge release |
|
package/extensions/dev-flow.ts
CHANGED
|
@@ -24,7 +24,7 @@ import path from "node:path";
|
|
|
24
24
|
import { Type } from "typebox";
|
|
25
25
|
import { compact, defineTool, isToolCallEventType, type AgentSession, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
26
26
|
import { type ExtensionAPI, type ToolCallEvent, type ToolCallEventResult, type TurnEndEvent, type TurnEndEventResult } from "@earendil-works/pi-coding-agent";
|
|
27
|
-
import { ALLOW_REWRITE, applicableItems, openItemsNote, bashFlowGuard, checklistPending, checkoutInvocation, claimBlocks, featureBranchPrefix, FLOW_SHELL_HINT, flowShellInvocation, forcePushInvocation, freshenChecks, gitInvocation, guardBash, guardPath, mergeStyleInvocation, parsePushRefs, playbookTamper, playbookOnlyChange, pluginVersion, reflectionNudges, buildReflectBrief, parseReflectReport, renderReflectFindings, childSessionFiles, workerSteer, WORKER_STEER_AT, WORKER_SALVAGE, WORKER_SALVAGE_MS, WORKER_NUDGE_READONLY, stageReference, needsOperator, NEEDS_OPERATOR, nextHint, roadmapOpenCount, shouldTakeOverCompaction, stageGuidance, stateTamper, statusFor, sq, featureTmpDir, compactionStateBlock, withTmpDir, widgetLines, chipLabel, writeGuard, buildWorkerBrief, clampBudgetMin, parseWorkerReport, workerTurnError, hollowStop, hollowStopNote, workerOpError, WORKER_NUDGE, WORKER_NUDGES, releaseOrderInvocation, type WorkerOp, type FlowState, type PushRef } from "../src/core.ts";
|
|
27
|
+
import { ALLOW_REWRITE, applicableItems, openItemsNote, bashFlowGuard, checklistPending, checkoutInvocation, claimBlocks, featureBranchPrefix, FLOW_SHELL_HINT, flowShellInvocation, forcePushInvocation, freshenChecks, gitInvocation, guardBash, guardPath, mergeStyleInvocation, parsePushRefs, playbookTamper, playbookOnlyChange, pluginVersion, reflectionNudges, buildReflectBrief, parseReflectReport, renderReflectFindings, childSessionFiles, workerSteer, WORKER_STEER_AT, WORKER_SALVAGE, WORKER_SALVAGE_MS, WORKER_NUDGE_READONLY, stageReference, needsOperator, NEEDS_OPERATOR, nextHint, roadmapOpenCount, shouldTakeOverCompaction, stageGuidance, stateTamper, statusFor, sq, featureTmpDir, compactionStateBlock, withTmpDir, widgetLines, chipLabel, writeGuard, buildWorkerBrief, clampBudgetMin, parseWorkerReport, workerTurnError, hollowStop, hollowStopNote, workerOpError, WORKER_NUDGE, WORKER_NUDGES, releaseOrderInvocation, worktreeWorkGuard, flowArgsShapeError, type WorkerOp, type FlowState, type PushRef } from "../src/core.ts";
|
|
28
28
|
import { loadProject } from "../src/projectmd.ts";
|
|
29
29
|
import { bashTimeout, requireTimeout, timeoutClass } from "../src/timeouts.ts";
|
|
30
30
|
import { AGENT_MARK, operatorCommandAsks, operatorCommandCorrection, viewHeader, askLine, type GateView } from "../src/present.ts";
|
|
@@ -232,6 +232,8 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
232
232
|
args: Type.Array(Type.String(), { description: 'Gate invocation, e.g. ["status"] or ["start", "my-slug"]' }),
|
|
233
233
|
}),
|
|
234
234
|
execute: async (id, params, signal, onUpdate, ctx) => {
|
|
235
|
+
const shape = flowArgsShapeError((params as { args?: unknown }).args);
|
|
236
|
+
if (shape) return { content: [{ type: "text", text: shape }], details: {}, isError: true };
|
|
235
237
|
const root = await flowRoot(ctx.cwd);
|
|
236
238
|
// the agent's call never opens a dialog (#181): a dialog inside a tool call blocks the turn, so nobody
|
|
237
239
|
// can talk to the agent while it waits, and the agent cannot see who answered. Gates answer with the
|
|
@@ -498,8 +500,17 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
498
500
|
} else if (newCommits.trim() || dirty) {
|
|
499
501
|
parts.push("note: the reviewer changed the tree — treat its verdict with suspicion and inspect the change");
|
|
500
502
|
}
|
|
503
|
+
if (wop === "review" && report.found) {
|
|
504
|
+
// gh#233: the record flow release reads — a review ran for this flow. The verdict stays advisory.
|
|
505
|
+
const cur = readState(root, st.slug);
|
|
506
|
+
if (cur && (cur.stage === "implement" || cur.stage === "pre-release")) {
|
|
507
|
+
const head = (headAfter || "").trim();
|
|
508
|
+
cur.review = { by: "worker", at: now(), ...(head ? { head } : {}), ...(report.verdict ? { verdict: report.verdict } : {}) };
|
|
509
|
+
writeState(root, cur);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
501
512
|
parts.push(`transcript: ${transcript || "(unknown)"}`);
|
|
502
|
-
parts.push(wop === "implement" ? "Next: read the report, decide what is left, and drive the gates yourself." : "
|
|
513
|
+
parts.push(wop === "implement" ? "Next: read the report, decide what is left, and drive the gates yourself." : "Review recorded for flow release; the verdict itself is advisory: fix what is real (inline is fine for small things), then carry on.");
|
|
503
514
|
return { content: [{ type: "text", text: parts.join("\n\n") }], details: { op: wop, outcome, verdict: report.verdict, commits: newCommits.trim().split("\n").filter(Boolean).length } };
|
|
504
515
|
}
|
|
505
516
|
|
|
@@ -515,7 +526,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
515
526
|
name: "flow_stage",
|
|
516
527
|
label: "Stage worker",
|
|
517
528
|
description:
|
|
518
|
-
'Optional: hand a slice of work to a fresh pi session so this conversation stays lean. op "implement" (stage implement) — the worker edits and commits a slice on the feature branch; op "review" (implement or pre-release) — a fresh read-only reviewer that returns findings and a PASS/FAIL verdict (advisory:
|
|
529
|
+
'Optional: hand a slice of work to a fresh pi session so this conversation stays lean. op "implement" (stage implement) — the worker edits and commits a slice on the feature branch; op "review" (implement or pre-release) — a fresh read-only reviewer that returns findings and a PASS/FAIL verdict (the verdict is advisory; that a review ran is recorded — run it in implement once flow check is green: flow verify requires a review on record before it asks Verified?); op "reflect" (any stage; flow finish runs it itself before cleanup) — a fresh read-only reviewer of this session\'s transcript and every worker transcript that returns classified reflection findings (docs / code / plugin) with a fold-or-drop recommendation each, for the operator to decide. The plan path, branch, commits so far and the project checks are added to the brief automatically — `note` is just the slice: what to do, operator answers and decisions the worker cannot see. The worker holds no flow tool; gates and checkpoints stay with you. Delegate an implement slice when it is in the plan, provable by flow check, needs no operator input mid-slice and is big enough (≈4+ files or heavy reading) to crowd this context; small work, small fixes, mid-debug work, operator-judged work and final integration stay inline (criteria: references/implement.md). In pi-web the worker appears in the session\'s Agents menu as a subagent (running while it works, then its final status); the opened transcript holds its report.',
|
|
519
530
|
promptSnippet: 'flow_stage(op: "implement"|"review"|"reflect", note, label?) — optional fresh-session worker for a big implement slice, an independent review, or a reflection (flow finish runs the closing one itself); gates stay with you; in pi-web workers show up as subagents in the Agents menu',
|
|
520
531
|
parameters: Type.Object({
|
|
521
532
|
op: Type.String({ description: '"implement" (a worker edits + commits a slice), "review" (read-only reviewer, findings + verdict) or "reflect" (read-only reviewer of the session transcripts, reflection findings + fold/drop recommendations)' }),
|
|
@@ -756,10 +767,14 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
756
767
|
return branchCache.get(at)!;
|
|
757
768
|
};
|
|
758
769
|
const worktrees = featureRefs(guardRoot).map((f) => f.worktreeAbs).filter((w): w is string => !!w);
|
|
770
|
+
// gh#235: a checkout/switch earlier in the chain moves the branch the later segments run on — the probe
|
|
771
|
+
// reads the branch before anything runs, so `git checkout team-test && git merge feat/x` was judged as a
|
|
772
|
+
// merge into main
|
|
773
|
+
const switched = new Map<string, string>();
|
|
759
774
|
for (const g of inv.gitSegs) {
|
|
760
775
|
const gitDir = g.dir ? path.resolve(ctx.cwd, g.dir) : ctx.cwd;
|
|
761
776
|
const seg = gitInvocation(g.seg); // parsed once per segment — this runs on every bash call of every session
|
|
762
|
-
const branch = await branchOf(g.dir);
|
|
777
|
+
const branch = switched.get(gitDir) ?? (await branchOf(g.dir));
|
|
763
778
|
let pushRefs: PushRef[] | undefined;
|
|
764
779
|
const gp = seg.pushes;
|
|
765
780
|
if (gp.length) {
|
|
@@ -781,10 +796,18 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
781
796
|
}
|
|
782
797
|
const reason = bashFlowGuard({ command: g.seg, branch, stage: bound?.stage ?? null, defaultBranch: cfg.defaultBranch, pushRefs, playbookChore, dir: gitDir, attribution: bound ? undefined : `not attributed to a bound feature (session ${key}; dev-flow ${loadedVersion() ?? "?"} at ${SELF_BUILD.dir}) — run flow use <slug> here if a binding is missing` });
|
|
783
798
|
if (reason) return { block: true, reason };
|
|
799
|
+
// gh#232: a feature worktree takes its feature's commits and nothing else
|
|
800
|
+
const home = featureRefs(guardRoot).find((f) => f.worktreeAbs && (gitDir === f.worktreeAbs || gitDir.startsWith(f.worktreeAbs + path.sep)));
|
|
801
|
+
if (home) {
|
|
802
|
+
const wtReason = worktreeWorkGuard({ subs: seg.subs, command: g.seg, branch, home: { slug: home.state.slug, branch: home.state.branch, released: !!home.state.approvals.release, wt: path.relative(guardRoot, home.worktreeAbs!) || home.worktreeAbs! } });
|
|
803
|
+
if (wtReason) return { block: true, reason: wtReason };
|
|
804
|
+
}
|
|
784
805
|
// A feature worktree stays on its feature branch: a side branch cut inside it repurposes the
|
|
785
806
|
// worktree (and leaves it off its branch for the next gate); out-of-flow fixes get their own flow.
|
|
786
807
|
const co = checkoutInvocation(g.seg);
|
|
787
808
|
if (!co) continue;
|
|
809
|
+
// a path restore (`git checkout -- f`, `git checkout f`) is not a switch: only a branch that exists or is created moves
|
|
810
|
+
if (co.creates || (!/\s--(\s|$)/.test(g.seg) && (await sh(`git -C ${sq(gitDir)} rev-parse --verify -q ${sq(`refs/heads/${co.target}`)}`, ctx.cwd)).ok)) switched.set(gitDir, co.target);
|
|
788
811
|
const homeWt = worktrees.find((w) => gitDir === w || gitDir.startsWith(w + path.sep));
|
|
789
812
|
if (co.creates && homeWt) return { block: true, reason: `a feature worktree stays on its own branch — not creating ${co.target} in ${homeWt}; an unrelated fix is its own flow (flow start <slug> --patch)` };
|
|
790
813
|
// Branch discipline: feature branches live in their worktree — never checked out or created (-b) in the main checkout
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.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
|
@@ -39,8 +39,7 @@ criteria hold. Call it with an args array — `["start", "dark-mode"]`,
|
|
|
39
39
|
- **Talk outcomes, not internals.** Chat is for the operator: what changed or
|
|
40
40
|
is wrong, why it matters, in plain words and a few lines. Name a file or
|
|
41
41
|
function only when they must act on it — no code-path walkthroughs or
|
|
42
|
-
internal identifiers
|
|
43
|
-
in full when asked.
|
|
42
|
+
internal identifiers; give depth when asked.
|
|
44
43
|
- **yolo** at a checkpoint → that gate with `--yolo --confirmed`; run the
|
|
45
44
|
remaining gates back to back without asking, honoring guidance attached to
|
|
46
45
|
the word ("yolo, patch bump", "yolo, no tag" → `--no-version`). Checks,
|
|
@@ -56,8 +55,9 @@ criteria hold. Call it with an args array — `["start", "dark-mode"]`,
|
|
|
56
55
|
- **A guard blocking you means you skipped a stage or wrote outside your
|
|
57
56
|
feature** — run the gate instead of working around it. A refusal lists what
|
|
58
57
|
is missing: fix that, rerun.
|
|
59
|
-
- **Every bash call has a timeout** (class default when unstated)
|
|
60
|
-
|
|
58
|
+
- **Every bash call has a timeout** (a class default when unstated).
|
|
59
|
+
- **Run a gate only after the git/gh step it reads has returned**, never in
|
|
60
|
+
the same batch.
|
|
61
61
|
- Abandon a feature with `flow abort <slug>`. The repo's own AGENTS.md and
|
|
62
62
|
project skills still apply.
|
|
63
63
|
|
|
@@ -71,8 +71,8 @@ The stage injection names the file to read now; this is the map.
|
|
|
71
71
|
| --- | --- |
|
|
72
72
|
| `references/start.md` | `flow init`, starting a feature, modes (`--patch`, `--docs`, `--ui`), merge policy |
|
|
73
73
|
| `references/plan.md` | plan — research, clarify, plan file, mockups, Approve? |
|
|
74
|
-
| `references/implement.md` | implement — worktree, commits, checks, workers, Verified? |
|
|
75
|
-
| `references/pre-release.md` | pre-release —
|
|
74
|
+
| `references/implement.md` | implement — worktree, commits, checks, workers, review, Verified? |
|
|
75
|
+
| `references/pre-release.md` | pre-release — docs, changelog + bump, Release? |
|
|
76
76
|
| `references/release.md` | release — PR, CI, merge, tag; hands over to finish |
|
|
77
77
|
| `references/finish.md` | finish — closing reflection, fold/drop, cleanup |
|
|
78
78
|
| `references/reflect.md` | reflections and the roadmap backlog |
|
|
@@ -22,6 +22,14 @@ note). Other sessions' worktrees are theirs.
|
|
|
22
22
|
5. UI feature → a real browser visual pass, not just a typecheck.
|
|
23
23
|
6. Walk the **tier-2 checklist** (`- [ ]` items) with the operator honestly —
|
|
24
24
|
it cannot be scripted.
|
|
25
|
+
7. **Review before Verified?**: once `flow check` is green, run the playbook's
|
|
26
|
+
review step (`/flow-review`, or `flow_stage` op `"review"` for a fresh
|
|
27
|
+
reviewer); fix every **Must fix** and **Should fix**, `flow check` again,
|
|
28
|
+
then record it: `flow review done "<verdict in a line>"` (a worker records
|
|
29
|
+
itself). `flow verify` refuses until a review is on record, so the
|
|
30
|
+
operator's Verified? covers the reviewed tree and review fixes never re-ask
|
|
31
|
+
it. Run the review once; skipping it is the operator's word
|
|
32
|
+
(`flow review --skip`, asked as **Skip review?**).
|
|
25
33
|
|
|
26
34
|
### Verified? — two calls
|
|
27
35
|
|
|
@@ -51,7 +59,8 @@ note). Other sessions' worktrees are theirs.
|
|
|
51
59
|
deploy again when the tree is the one it deployed for review — it only
|
|
52
60
|
probes that the app still answers. If the
|
|
53
61
|
default branch moved since the review deploy it refuses: run `flow verify`
|
|
54
|
-
again first. Fixes → iterate and re-verify; that loop is free
|
|
62
|
+
again first. Fixes → iterate and re-verify; that loop is free (a fix that
|
|
63
|
+
changes behaviour needs no new review unless it is large).
|
|
55
64
|
|
|
56
65
|
Verify lands the feature in **pre-release**. A `--docs` feature runs no
|
|
57
66
|
project command and asks only the question.
|
|
@@ -9,12 +9,14 @@ release gate hands over.
|
|
|
9
9
|
tags are `versioning.pattern` rendered from it. No `versioning.file` → stop
|
|
10
10
|
and settle the scheme with the operator; never invent one.
|
|
11
11
|
|
|
12
|
-
1. **Review**:
|
|
13
|
-
|
|
12
|
+
1. **Review**: it ran in implement, before Verified? — don't run it again.
|
|
13
|
+
A flow that reached pre-release without one (started on an older dev-flow)
|
|
14
|
+
runs it now: `/flow-review`, fix, `flow check`, `flow review done
|
|
15
|
+
"<verdict>"`; `flow release` refuses until a review is on record.
|
|
14
16
|
- A fix that changes behaviour → `flow verify` again: it redeploys, then
|
|
15
17
|
ask **Verified?** over the fixed build and run `flow verify --confirmed`
|
|
16
18
|
on the answer (stays in pre-release; a standing yolo does not answer it).
|
|
17
|
-
|
|
19
|
+
`flow release` refuses while that re-verify is unanswered.
|
|
18
20
|
2. **Docs**: update them to match the change.
|
|
19
21
|
3. **Changelog + bump** — manifest, changelog heading and tag must agree;
|
|
20
22
|
commit the prep on the feature branch. The release call recorded with
|
|
@@ -35,14 +37,18 @@ and settle the scheme with the operator; never invent one.
|
|
|
35
37
|
dropped or rewritten pending line, leftovers under `Unreleased`, and a
|
|
36
38
|
changelog this branch never touched. `--no-fold-check` only on the
|
|
37
39
|
operator's word.
|
|
38
|
-
4.
|
|
40
|
+
4. **PR body**: if the repo has a pull-request template, write
|
|
41
|
+
`.dev-flow/<slug>/pr-body.md` from it (every section; the changelog entry; the
|
|
42
|
+
commit Verified? was given over). `flow release` opens the PR with it, and
|
|
43
|
+
refuses without it.
|
|
44
|
+
5. No `flow check` is owed after the prep commit: the gate keeps green checks across a commit that
|
|
39
45
|
holds only the bump and changelog, and runs any stale check itself.
|
|
40
|
-
|
|
46
|
+
6. **Run `flow release`.** By default (`ask = on-change`) it answers
|
|
41
47
|
Release? itself when the release call is on record and only the prep
|
|
42
48
|
landed since Verified? — say in a few lines what the PR delivers (the
|
|
43
49
|
changelog entry usually is that) and the version, and carry on with the
|
|
44
50
|
release stage.
|
|
45
|
-
|
|
51
|
+
7. **It returned `NEEDS-OPERATOR Release?`** (it says why: code after
|
|
46
52
|
Verified?, no call on record, a stale build, `yolo = until-release`, a
|
|
47
53
|
major bump, or the playbook's `ask = always`) → **ask Release? and
|
|
48
54
|
stop**, with the same summary and the version. Report opening:
|
|
@@ -54,6 +54,8 @@ never gating.
|
|
|
54
54
|
--slug=<slug> --brief=<notes>` — `flow start <slug>` later seeds the plan
|
|
55
55
|
from the brief. A hand-made `.dev-flow/<slug>/plan/` is a ghost; `flow start
|
|
56
56
|
<slug> --confirmed` adopts it.
|
|
57
|
-
- Shipped outside a flow: `flow roadmap done <n
|
|
58
|
-
checked lines. Not wanted any more (never
|
|
59
|
-
`done` would claim it shipped.
|
|
57
|
+
- Shipped outside a flow: `flow roadmap done <n>` (several: `done 6,7` in one
|
|
58
|
+
call); `flow roadmap tidy` drops checked lines. Not wanted any more (never
|
|
59
|
+
built): `flow roadmap drop <n>` — `done` would claim it shipped.
|
|
60
|
+
- `<n>` is the row number `flow roadmap` prints: `done` leaves every other
|
|
61
|
+
number in place; `drop` and `tidy` renumber, so list again after them.
|
|
@@ -4,7 +4,7 @@ description: >
|
|
|
4
4
|
Read-only senior-engineer review of a change before it ships: correct, safe,
|
|
5
5
|
holds under load, tested, fast, lean — judged also against the flow's plan.
|
|
6
6
|
Report only, changes no code. Use for "review this", "code review", "is this
|
|
7
|
-
ready to ship?", and as the dev-flow
|
|
7
|
+
ready to ship?", and as the dev-flow review step (implement, before Verified?). Default target:
|
|
8
8
|
the bound flow's branch diff against the default branch.
|
|
9
9
|
argument-hint: "[ref | base..head | file...]"
|
|
10
10
|
---
|