pi-dev-flow 0.58.1 → 0.59.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.
@@ -8,6 +8,8 @@ description: >
8
8
  outside this flow fails at the guard.
9
9
  ---
10
10
 
11
+ <!-- dev-flow:core:start -->
12
+
11
13
  # dev-flow: the stage-by-stage playbook
12
14
 
13
15
  Only the **flow tool** advances stages, and each gate refuses until its exit
@@ -19,391 +21,67 @@ Ground rules:
19
21
  - **The flow tool is the only invocation.** `flow` is **not a shell command**: a
20
22
  bash call named `flow` has no binary behind it (the guard refuses it and names
21
23
  the tool call) — never reach for bash, `npx`, or a path to run a gate.
22
- - **You run the gates; the operator says words.** Never ask the operator to type
23
- a `/flow ...` command — not at a checkpoint, not "just to check status", not as
24
- a shortcut. Ask the checkpoint word in chat, then run the gate yourself.
25
- `/flow` is the operator's **manual override**: surface it only when the session
26
- is demonstrably wrong, stuck, or claiming a gate result it never ran (and
27
- `/reload` when `flow version` says this session runs an older build).
28
-
24
+ - **You run the gates; the operator says words.** Ask the checkpoint word in
25
+ chat, then run the gate yourself. **Checkpoints are one verb: Approve? /
26
+ Verified? / Release? / Finish?** — ask exactly that word as a **plain chat
27
+ message**, mention that **yolo** is an available answer, and stop. The same
28
+ verb (or an explicit equivalent) in chat is the answer; then run that gate
29
+ with `--confirmed` — zero dialogs, **exactly one checkpoint per stage**. A
30
+ structured question tool is not chat and never
31
+ licenses `--confirmed`; never infer the answer. Never ask the operator to type
32
+ a `/flow ...` command: `/flow` is their **manual override** — surface it only
33
+ when the session is demonstrably wrong, stuck, or claiming a gate result it
34
+ never ran (and `/reload` when `flow version` says this session runs an older
35
+ build).
36
+ - **yolo** at any checkpoint → run that gate `--yolo --confirmed`; every later
37
+ checkpoint is pre-confirmed — run the remaining gates back to back without
38
+ asking, honoring guidance attached to the word ("yolo, create a patch
39
+ version release" → bump patch; "yolo, no tag" → `--no-version`). Checks and
40
+ guardrails stay fully enforced — a flow-guard `confirm` rule still asks the
41
+ operator.
42
+ - At Release?, choosing **no version/tag for this flow** →
43
+ `flow release --no-version --confirmed` — the merge still owes a changelog
44
+ entry under `Unreleased`, which the next versioned release folds under its
45
+ version heading (default is versioned: bump + tag).
29
46
  - **One session = exactly one feature** (flow + branch + worktree); parallel
30
47
  sessions, one feature each, are the model. A session binds **explicitly and
31
- only**: `flow start <slug>` sets the bind (main checkout must be on the
32
- default branch); `flow use <slug>` takes over an open or foreign-held
33
- feature. Nothing auto-binds — a new session with unfinished features stays
34
- unbound until someone says `flow use`. Unbound: the footer shows only the
35
- open-feature count, gates demand an explicit slug and main-checkout writes
36
- stay blocked. There is no bypass — an unbound session cannot edit source.
48
+ only**: `flow start <slug>` binds its own feature (main checkout must be on
49
+ the default branch); `flow use <slug>` takes one over. Nothing auto-binds.
50
+ Unbound: gates demand an explicit slug and main-checkout writes stay
51
+ blocked — there is no bypass, an unbound session cannot edit source.
37
52
  - **Project `flow-guard` rules** (`deny`/`confirm`/`protect`/`forbid` in
38
53
  project.md `## global`) apply at **every** stage and are judged ahead of
39
54
  dev-flow's verdicts — operator safety rules, not flow discipline. When one
40
55
  fires, its reason is the answer: stop, show it, let the operator decide;
41
56
  never route around it.
42
- - **Every bash/shell call states its own `timeout`** or the guard refuses it
43
- (`bashTimeout = require`, the default; the playbook may set `inject`). Name
44
- the budget you actually expect.
45
- - `.dev-flow/<slug>/state.json` is flow-owned — never read or write it;
46
- `flow status` is your view. **project.md is the operator-owned playbook**
47
- (test/build/run commands, default branch, forge, worktree path, safety
48
- rules): read freely, **never edit** — changes go through `flow init --write`
49
- on the operator's word. In-life playbook updates run as a docs flow:
50
- project.md is editable only inside a docs/patch flow's worktree and is
51
- committed to git like any file. A leftover `project.json` is never read; the
52
- doctor flags it.
57
+ - **`.dev-flow/<slug>/state.json` is flow-owned** — never read or write it;
58
+ `flow status` is your view. **project.md is the operator-owned playbook**:
59
+ read freely, **never edit** — it changes through `flow init --write` on the
60
+ operator's word (`flow doctor` reviews what it lacks).
61
+ - **Every bash/shell call states its own `timeout`** or the guard refuses it.
62
+ - **A guard blocking you means you are skipping a stage or writing outside your
63
+ feature** — run the gate instead of working around it. The guard reads
64
+ **commands**: quoted text is an argument's prose (a PR body discussing a
65
+ commit is not a commit), and a wrapper that execs its argument
66
+ (`sh -c "git push origin main"`) is judged on its payload.
67
+ - Abandon a feature with `flow abort <slug>` — never unbind by hand. A gate
68
+ refusal lists exactly what is missing: fix that, rerun the gate.
53
69
  - Also obey the repo's own AGENTS.md and project skills: dev-flow sequences
54
70
  stages, the project defines its conventions.
55
- - **A guard blocking you means you are skipping a stage or writing outside
56
- your feature** — run the gate instead of working around it. The guard reads
57
- **commands**: quoted text is an argument's prose (a PR body discussing a
58
- commit is not a commit); a wrapper that execs its argument
59
- (`sh -c "git push origin main"`) is judged on its payload — blocked commands
60
- cannot ride through one.
61
- - **Checkpoints are one verb: Approve? / Verified? / Release? / Finish?** —
62
- ask exactly that word as a **plain chat message**, mention that **yolo** is
63
- an available answer, and stop. Never ask the operator to run a flow command
64
- at a checkpoint — you run the gate when they have answered. The same verb
65
- (or an explicit equivalent) in chat is the answer; then run that gate with
66
- `--confirmed` — zero dialogs, **exactly one checkpoint per stage**. A
67
- structured question tool (AskUserQuestion-style) is not chat and never
68
- licenses `--confirmed`; never infer the answer.
69
- - **yolo** at any checkpoint → run that gate `--yolo --confirmed`; every
70
- later checkpoint is pre-confirmed — run the remaining gates back to back
71
- without asking, honoring guidance attached to the word ("yolo, create a
72
- patch version release" → bump patch; "yolo, no tag" → `--no-version`).
73
- Checks and guardrails stay fully enforced — a flow-guard `confirm` rule
74
- still asks the operator.
75
- - At Release?, choosing **no version/tag for this flow** →
76
- `flow release --no-version --confirmed` — the merge still owes a changelog
77
- entry under `Unreleased`, which the next versioned release folds under its
78
- version heading (default is versioned: bump + tag).
79
- - **Modes are proposed, never taken**: every `flow start` carries the mode and
80
- a one-line why; the operator grants it in chat and the gate refuses
81
- `--patch`/`--docs` until the grant is anchored with `--confirmed` — never
82
- self-grant. `normal` (default): a written plan is enforced (`plan/plan.md`
83
- before Approve?). `--patch`: a small change you intend to release
84
- (one-file fix, version chore) — no plan file, one chat line is the plan,
85
- everything else identical. `--docs`: docs-only — no plan file **and no
86
- tier-1 checks** (build/lint/test); worktree discipline and the full release
87
- stay. A change that grows past one line or touches behavior is a normal
88
- feature, not patch/docs.
89
-
90
- ## Start
91
-
92
- **No `.dev-flow/`?** `flow init` analyzes the repo and prints a **setup
93
- brief**: what was detected plus one question per knob detection cannot decide
94
- (forge github/gitlab/self, version manifest and tag convention, automatic
95
- forge releases, registry artifacts like Docker Hub, the real
96
- test/build/lint/health commands, tier-2 items, prose). Relay the questions
97
- (one per knob, detected default shown, explain in a line when not obvious),
98
- fill `flow init --draft` with the answers, present it, then apply
99
- `flow init --write "<content>"` **only after the operator confirms** — never
100
- hand-edit, never write project.md before the confirmation. The playbook
101
- belongs in git; the chore is legal unbound:
102
- `git add -f .dev-flow/project.md && DEV_FLOW_ALLOW_MAIN=1 git commit -m "track project.md"`
103
- (force — a tracked file outranks a `.gitignore` of `.dev-flow/`; the env
104
- prefix lets the installed hook accept a main commit that only touches the
105
- playbook). **With existing config** `flow init` is a **doctor**: discuss
106
- findings, fix via the same write path, never overwrite hand edits without
107
- confirming; ghost feature dirs (a `plan/` whose `state.json` is gone) come
108
- with a delete offer — surface the dialog, never delete on your own.
109
- `flow doctor` runs the same probes **read-only** (prefer it when you only want
110
- findings); `--force` re-detects from scratch, `--draft` prints without
111
- writing.
112
-
113
- `flow start <slug> [--ui]` — `--ui` whenever anything user-visible is touched;
114
- slug lowercase words-dashed; check `flow status` for an active feature first.
115
-
116
- `flow start` **preflights** before it creates anything: it warns when this session runs an older dev-flow
117
- build than the checkout (`/reload` before trusting gate output), prints the playbook gaps `flow doctor`
118
- would report, and **refuses while the playbook has no merge policy**. That refusal is a question: ask the
119
- operator how a merged PR should land on the default branch — `squash`, `merge` (a merge commit), `rebase`,
120
- or `any` (no policy) — with the suggestion the refusal read off their own history, then re-run
121
- `flow start <slug> --merge=<style> --confirmed`. The gate writes the answer into `## release` (single-line
122
- insert, validated, `.bak` kept) and never asks again. Never pick the style yourself and never write
123
- `project.md` by hand to get rid of the question.
124
-
125
- ## Stage: plan
126
-
127
- 1. Research the code the plan needs (reads are always allowed).
128
- 2. **Clarify before drafting**: preliminary direction in chat (findings, shape
129
- of the fix, open unknowns), mode proposal with its reason, your questions
130
- and the operator's; draft only after the direction is confirmed.
131
- 3. Write `.dev-flow/<slug>/plan/plan.md` — problem, approach, files to touch,
132
- test strategy, risks; reviewable, not exhaustive. First check
133
- `git log origin/<default>..<default> --oneline`: local-only default-branch
134
- commits fall out of the worktree's base (push them or re-plan).
135
- 4. **UI flag set?** Mockups live in `plan/mockups/`, one HTML per screen/state
136
- (`<screen>.html`), linking the project's real stylesheet and class names
137
- where they exist (relative links work from `.dev-flow/`). Every mockup
138
- must be **rendered** — an unrendered mockup is not a mockup:
139
- - Headless chromium: PATH `chromium`/`chromium-browser`/`google-chrome`,
140
- else playwright's
141
- `~/.cache/ms-playwright/*/chrome-headless-shell-linux64/chrome-headless-shell`.
142
- Render at the project's widths (default phone 390, desktop 1280):
143
- `<binary> --no-sandbox --disable-gpu --hide-scrollbars --virtual-time-budget=5000 --window-size=<width>,<height> --screenshot=plan/mockups/<screen>-<width>.png file://<absolute path to html>`
144
- — height per screen, re-render if clipped.
145
- - Embed every render in plan.md under its section —
146
- `![<screen> — phone](mockups/<screen>-390.png)`. Image syntax only (a
147
- filename in prose is a broken link); before Approve? re-check that every
148
- tag points at an existing file.
149
- - No chromium anywhere → tell the operator and ask; `*.html`-only plans
150
- only with their OK (knob: `mockupGlobs`); never fake or skip silently.
151
- - Gotchas: for a component question prefer a **static strip** — standalone
152
- HTML with the real stylesheet carrying only the markup in question, one
153
- first-try render; a full-page render is for layout context only. Shots
154
- start top-left and never scroll — hide what is above a below-the-fold
155
- region (inline `<style>`) or use a strip. `--user-data-dir` profiles keep
156
- localStorage between shots — fresh profile dir per intended UI state.
157
- Planned behavior must be visibly patched into the shot and captioned as
158
- such — never caption the current app's render with the behavior you plan
159
- to add. The app's repaint can destroy a transient state (an inline
160
- editor) — freeze it for the shot (e.g. stub the render entry point after
161
- opening). If the harness fights the same shot twice, verify that state
162
- via DOM/code and move on — screenshots are a spot-check, not a test loop.
163
- 5. Tell the user the plan is ready and **stop** — one word: **Approve?**
164
- Answered → `flow approve --confirmed` (yolo → `flow approve --yolo
165
- --confirmed`).
166
-
167
- Approval creates the worktree and branch, running `commands.setup` inside when
168
- configured — a failing setup fails the gate and the next `approve` **retries**
169
- setup in the kept worktree (stamping `setupAt` on success) instead of silently
170
- reusing it. A `--docs` feature runs no project command at all. No code edits
171
- before approval. `(ui)` playbook items never apply to non-UI features or
172
- appear in prompts.
173
-
174
- ## Stage: implement
175
-
176
- Work happens **only in the worktree** the gate created (path in `flow status`
177
- or the injection line) — writes elsewhere are blocked; other sessions'
178
- worktrees are theirs (attribution guards judge every path by its owning
179
- feature).
180
-
181
- 1. Implement per the approved plan with project conventions and the **stage
182
- guidance injected at stage start** (tier-3 prose — your playbook's
183
- `prose.implement`, or dev-flow's built-in senior-discipline guidance when
184
- the playbook sets none). Commit in the worktree
185
- **as you go** — small reviewable commits; a twelve-file monolith saved for
186
- the end faces review blind and is not crash-safe. The gate enforces the
187
- habit: `flow verify` refuses while the branch holds **no commit** (checks
188
- describe the working tree, so nothing committed means nothing reviewed was
189
- ever recorded) and every verify line reports
190
- `commits: N ahead of <default>, M uncommitted path(s)` — uncommitted paths
191
- never block verify, they are what the operator sees they are approving.
192
- 2. Write tests as you go (project framework: the `test` key / `flow-check`
193
- blocks).
194
- 3. `flow check` runs every tier-1 check (test, health, named `flow-check`
195
- blocks) and records each; any later worktree edit invalidates checks and
196
- the tier-2 confirmation — rerun before verify.
197
- 4. UI flag set? An actual browser visual pass (screenshot or the project's
198
- automated pass) — not just a typecheck.
199
- 5. Done means **running and healthy with pre-existing data**, not "compiles":
200
- `commands.seedData` (if set) puts real data in place, the app starts with
201
- the `run` command, and the health check passes — `flow check` covers it
202
- (seedData runs before health) and `flow verify` probes **the deployed app
203
- again**, because the deploy is what has to be proven. Probes retry every 2s
204
- up to `healthWait` (default 30s) — a service needing a moment after its
205
- container starts is not a failed deploy; say so rather than declaring a
206
- healthy deploy broken. Walk the **tier-2 checklist** (`- [ ]`) with the
207
- operator honestly — it cannot be scripted. Then ask **Verified?** →
208
- `flow verify --confirmed`. Fixes = iterate and re-verify; that loop is
209
- free.
210
-
211
- `flow verify` re-runs build, runs the `dev` deploy when configured (the
212
- operator reviews the running app; the gate **prints what it ran** —
213
- `build ran (…)` / `dev ran (…)` / `dev: none configured`; the command must
214
- **background and exit**, e.g. `docker compose up -d .` — verify waits and kills
215
- runs past 15 min), re-runs the health probe **against what it just deployed**
216
- (`seedData` first when configured; a failing probe retries every 2s up to
217
- `healthWait`, then refuses the gate reporting its attempts — a pre-deploy PASS
218
- describes a container that no longer exists; no probe prints
219
- `health: none configured` and the doctor flags it), and demands all tier-1
220
- checks green before the single question. The operator's confirm covers the
221
- tier-2 list as a set (hashed; edits reset it). A `--docs` feature prints
222
- `docs mode: project commands skipped` and asks only the verify question.
223
- Verify lands the feature in **pre-release**.
224
-
225
- Mid-stage additions — do not bounce the flow, do not grow it silently:
226
- **this feature grew** → stay at implement, append a `**Added mid-stage:**` line
227
- to `plan.md` (what was asked and how), implement, `flow check` again — edits
228
- invalidate checks and the tier-2 confirmation, so verify re-covers the
229
- addition. **Different problem** → finish this feature first, then a new flow
230
- (`flow start <new-slug>` after this one ships); never fold two features into
231
- one plan, PR and verify — the
232
- audit trail is the point. **Heavily amended plan** → show it and have the
233
- operator re-approve in chat; verify remains the checkpoint — no reopen command
234
- exists by design.
235
-
236
- ## Stage: pre-release
237
-
238
- Implemented, tested, running locally; prepare the release entirely in the
239
- worktree — main-repo git state stays off-limits until this gate hands over.
240
- **Versioning:** the `versioning.file` manifest is the single source of truth
241
- and tags are `versioning.pattern` rendered from it — one number everywhere. If
242
- `versioning.file` is unset, stop and clarify the scheme with the user; never
243
- invent one mid-release. Sequence:
244
-
245
- 1. `/flow-review` the change; fix every **Must fix** and **Should fix**
246
- finding; `flow test` again if code changed.
247
- 2. Update documentation to reflect the change.
248
- 3. Update the changelog and bump the manifest to the exact version you will
249
- tag — manifest, changelog and tag must agree; commit the prep on the feature
250
- branch. A versioned release **folds the `Unreleased` section** (entries
251
- `--no-version` flows left there) under the new version heading: the gate
252
- refuses while entries remain, refuses a fold that **drops or rewrites** one
253
- (move the lines as they are and reword afterwards in a follow-up), and
254
- refuses a changelog this branch never touched. `--no-fold-check` skips only
255
- the line proofs, on the operator's word.
256
- 4. `flow check` — the prep edits invalidated the implement checks; the release
257
- gate demands them green again.
258
- 5. State what the PR will contain, present version and changelog entry,
259
- **stop** — **Release?** → `flow release --confirmed`. The gate re-checks
260
- tier-1, requires the manifest **ahead of the last tag**, a changelog
261
- **heading** naming that version (a mention in prose is not an entry) and that
262
- this branch prepared the entry. Operator ships this flow **without
263
- version/tag** → `flow release --no-version --confirmed` — no bump, but the
264
- changelog entry under `Unreleased` is still required: the gate proves the
265
- branch **added a line there**, not that it edited some older section.
266
-
267
- ## Stage: release
268
-
269
- Cleared for main-repo git (merge/tag/push on the default branch is allowed only
270
- here) — this stage publishes; the preparation happened in pre-release. Run in
271
- the worktree unless noted:
272
-
273
- 1. Commit everything, push the feature branch, open the PR, wait for the merge
274
- (`gh pr merge` or ask the user) — with the **playbook's merge style spelled out**
275
- (`gh pr merge --squash` under `merge = squash`): the guard blocks a style that contradicts the
276
- playbook and asks the operator about a merge with no style flag, so let the playbook decide rather
277
- than the forge default. Merge without `--delete-branch`: it fails when
278
- the default branch is checked out in the main worktree, and `flow finish`
279
- deletes the branch on merge proof anyway.
280
- 2. `git fetch`, confirm the merge landed, create the **annotated** tag
281
- (`git tag -a`) and push the ref explicitly (`git push origin v<ver>`) —
282
- never `--follow-tags` (it silently skips lightweight tags: they never reach
283
- the remote, CI never publishes). After the merge a tag points at what
284
- actually shipped. If CI publishes from the tag, set `release.artifact` in
285
- the playbook — `release-done` then verifies the published artifact and
286
- refuses local-only tags outright. Unversioned flow (`--no-version` granted):
287
- no bump, no tag — publish the merge only (your entry rides under
288
- `Unreleased` until the next versioned release folds it), `release-done`
289
- asks nothing version-side.
290
- 3. `flow release-done` — **no question** (the Release? answer covered the
291
- publication). It re-verifies (tag on the default branch, on origin, artifact
292
- when configured) against **the version the release gate stamped** — never a
293
- re-read from a checkout that may be behind — and refuses anything older than
294
- the newest matching tag on origin (lists come from `git ls-remote`, so an
295
- unfetched clone never decides what is tagged). It creates the forge release
296
- — `gh` for GitHub, `glab` for GitLab, nothing for `forge = self`, advisory
297
- note if a CLI or remote is missing; body = the `release.changelog` entry for
298
- that version — the changelog is what the release page must read like — else
299
- the tag's annotation, else nothing with the reason printed (annotate with
300
- `git tag -a`), and it reads the stored body back and refuses a mismatch
301
- (#97) — and records the release;
302
- `flow finish` closes the feature out. Skipping the forge release
303
- (`--no-release-create`, once, or `release.releases = false`, always) and
304
- the artifact check (`--no-artifact-check`, once) are operator calls only —
305
- act when told, never on your own. If this session runs an older build than
306
- the checkout, **the release gate asks instead of blocking**: it prints both
307
- builds, lists what shipped between them (those proofs will not run), and
308
- puts the choice to the operator — **update (`/reload` and re-run) or
309
- proceed with the old release?** Publishing under an older gate is a
310
- legitimate choice (hotfix, offline reload); the answer is recorded in the
311
- release output and `release-done` repeats the acknowledgement as the
312
- backstop for headless runs.
313
- Release-stage checklist items have no gate of their own: `release-done`
314
- lists the open ones and the Finish? answer closes them.
315
-
316
- ## Stage: finish
317
-
318
- **Reflect before you finish** — `flow finish` deletes `.dev-flow/<slug>/` and
319
- the session context goes with it. Run the end-of-session reflection (bare
320
- `flow reflect` protocol under *Reflect*) now and park real issues with
321
- `flow reflect`; then:
322
-
323
- - issues parked → ask **Fold? Fix? Drop?** and stop: fold = write the items
324
- into `.dev-flow/reflections.md` (your queue), fix = route them now via
325
- `flow doctor`, drop = discard them. The answer replaces **Finish?** — act
326
- on it, then run `flow finish --confirmed` without asking again;
327
- - nothing parked → ask the operator **Finish?** → `flow finish --confirmed`.
328
-
329
- The question covers the whole cleanup and mentions any commits that look
330
- unmerged. `flow finish [slug]`:
331
-
332
- - refuses until `release-done` recorded the release — abandoned features go
333
- through `flow abort` instead;
334
- - requires the main checkout **clean and pushed** — an uncommitted changelog or
335
- a local-only release commit is exactly what it protects against;
336
- - removes the worktree and branch, then deletes `.dev-flow/<slug>/` and
337
- unbinds the session. A feature branch still on `origin` is deleted **only on
338
- proof it was merged** — ancestor of `origin/<default>`, or a merged PR via gh
339
- or glab (what a squash leaves behind); otherwise kept with a note. Uncommitted worktree edits block
340
- finish; commits that never reached the default branch are read against the playbook's `merge` policy —
341
- expected under `squash`/`rebase`, a **violation** under `merge` (which `yolo` cannot answer for), and
342
- called out at Finish? without an operator answer → stop and show them.
343
-
344
- Production deployment stays manual and out of scope: never ask the operator
345
- whether a prod deploy happened.
346
-
347
- ## When things go sideways
348
-
349
- - Abandon a feature: `flow abort <slug>` unbinds — at plan stage (nothing
350
- approved) it removes the feature outright; once a worktree exists the state
351
- stays for manual recovery and the exact removal commands are printed.
352
- - A gate refuses: its reasons list exactly what is missing — fix that, rerun
353
- the gate.
354
-
355
- ## Reflect (your suggestion queue)
356
-
357
- Anything the playbook or plugin should improve (drifted commands, gate friction,
358
- a plugin bug) gets parked, not complained about:
359
- `flow reflect "<one-line note>"`; gate flags are ignored —
360
- `flow reflect "<note>" --confirmed` queues the note alone. For a note to chase
361
- **now**: `flow doctor "<observation>"` prints an investigation brief without
362
- queueing. Notes land under `## playbook` or `## plugin` — the wording decides,
363
- a note about both goes to both. The open count shows in status and stage
364
- context; the operator decides:
365
71
 
366
- - Reflect real friction only, one line each, never the same issue twice.
367
- - **`flow reflect tidy` drops the closed (`- [x]`) items** — the `— fixed:` note has
368
- already recorded the outcome, so the check-off is history and the file stays
369
- scannable. Queueing a note, bare `reflect` and `doctor` all print the closed
370
- count with this verb when the pile grows; offer the tidy to the operator then.
371
- - **Bare `flow reflect` is the end-of-session reflection** — it runs as part
372
- of every finish (before the slug folder is deleted — see Stage: finish) and
373
- whenever the operator asks. It prints the
374
- protocol: review the full session log (messages, tool calls, results);
375
- re-check each open item against the current playbook and newer dev-flow
376
- versions (`npm view pi-dev-flow version` vs the running version, or
377
- `git ls-remote` for a git-installed copy — a newer one that fixes an
378
- item → recommend updating the plugin, check it off); queue deduplicated new
379
- findings; report playbook vs plugin items structurally; ask whether to fix
380
- now. The command writes nothing; you execute the protocol.
381
- - Plain `flow doctor` reviews the open items and **routes** each to the flow
382
- that implements it — playbook item → docs flow; plugin item → upstream issue
383
- (or a patch/normal flow in the dev-flow repo). To fold items in on the
384
- operator's word: investigate, propose the fix, get confirmation, open the
385
- routed flow (playbook items: `flow start fold-<topic> --docs --confirmed`)
386
- and apply it there — project.md is editable only in that worktree. Check
387
- items off in `.dev-flow/reflections.md` (your queue, gitignored, yours to
388
- edit; not `project.md`) with `- [x]` and a `— folded: <what>` or
389
- `— fixed: <what>` note.
390
- - `## plugin` items, on the operator's go: search upstream first —
391
- `gh issue list --repo <dev-flow repo> --state all --search "<keywords>"` —
392
- an issue the author already answered (fixed or won't-fix) is reported back,
393
- never re-filed; no match → offer to file one (`gh issue create`; `glab issue
394
- create` on GitLab) with a detailed description, session evidence and a
395
- suggested fix; the operator confirms.
72
+ <!-- dev-flow:core:end -->
396
73
 
397
- ## Roadmap (your backlog)
74
+ ## Which stage you are in
398
75
 
399
- `.dev-flow/roadmap.md` — a gitignored `- [ ]` checklist; the operator owns the
400
- content, you maintain and honor it. Advisory like reflections, never gating:
76
+ Everything the stage demands lives beside this file, one file per stage: the
77
+ session's stage injection names the file to read now, and this is the map.
401
78
 
402
- - `flow roadmap` lists the open items (the count is surfaced in status and
403
- stage context). Update on the operator's request —
404
- `flow roadmap add "<feature>"` or direct file edits are equally fine.
405
- - Handed a feature: `flow roadmap pick <n> <slug>` stamps the item with the
406
- slug (pick is one verb — it starts nothing), then `flow start <slug>` builds
407
- it as a normal flow; its `flow finish` checks the item off automatically.
408
- - Shipped outside a flow: `flow roadmap done <n>` (date-stamped by hand);
409
- `flow roadmap tidy` drops checked lines when history clutters the list.
79
+ | Read | For |
80
+ | --- | --- |
81
+ | `references/start.md` | `flow init` (no `.dev-flow/` yet), mode grants (`--patch`, `--docs`), playbook ownership |
82
+ | `references/plan.md` | plan stage — research, clarify, plan file, mockups, Approve? |
83
+ | `references/implement.md` | implement stage — worktree, commits, checks, tier-2 list, Verified? |
84
+ | `references/pre-release.md` | pre-release — `/flow-review`, docs, changelog + bump, Release? |
85
+ | `references/release.md` | release — PR and merge style, tag, forge release, release-done; hands over to finish |
86
+ | `references/finish.md` | the close-out after `release-done` — reflect first, Finish?, worktree and branch cleanup |
87
+ | `references/reflect.md` | reflections (the suggestion queue) and the roadmap backlog |
@@ -0,0 +1,35 @@
1
+ > Part of the **dev-flow** playbook. The always-on ground rules live in
2
+ > [../SKILL.md](../SKILL.md); this file is the detail for one stage — read it
3
+ > when the session reaches that stage.
4
+
5
+ ## Stage: finish
6
+
7
+ **Reflect before you finish** — `flow finish` deletes `.dev-flow/<slug>/` and
8
+ the session context goes with it. Run the end-of-session reflection (bare
9
+ `flow reflect` protocol under *Reflect*) now and park real issues with
10
+ `flow reflect`; then:
11
+
12
+ - issues parked → ask **Fold? Fix? Drop?** and stop: fold = write the items
13
+ into `.dev-flow/reflections.md` (your queue), fix = route them now via
14
+ `flow doctor`, drop = discard them. The answer replaces **Finish?** — act
15
+ on it, then run `flow finish --confirmed` without asking again;
16
+ - nothing parked → ask the operator **Finish?** → `flow finish --confirmed`.
17
+
18
+ The question covers the whole cleanup and mentions any commits that look
19
+ unmerged. `flow finish [slug]`:
20
+
21
+ - refuses until `release-done` recorded the release — abandoned features go
22
+ through `flow abort` instead;
23
+ - requires the main checkout **clean and pushed** — an uncommitted changelog or
24
+ a local-only release commit is exactly what it protects against;
25
+ - removes the worktree and branch, then deletes `.dev-flow/<slug>/` and
26
+ unbinds the session. A feature branch still on `origin` is deleted **only on
27
+ proof it was merged** — ancestor of `origin/<default>`, or a merged PR via gh
28
+ or glab (what a squash leaves behind); otherwise kept with a note. Uncommitted worktree edits block
29
+ finish; commits that never reached the default branch are read against the playbook's `merge` policy —
30
+ expected under `squash`/`rebase`, a **violation** under `merge` (which `yolo` cannot answer for), and
31
+ called out at Finish? without an operator answer → stop and show them.
32
+
33
+ Production deployment stays manual and out of scope: never ask the operator
34
+ whether a prod deploy happened.
35
+
@@ -0,0 +1,66 @@
1
+ > Part of the **dev-flow** playbook. The always-on ground rules live in
2
+ > [../SKILL.md](../SKILL.md); this file is the detail for one stage — read it
3
+ > when the session reaches that stage.
4
+
5
+ ## Stage: implement
6
+
7
+ Work happens **only in the worktree** the gate created (path in `flow status`
8
+ or the injection line) — writes elsewhere are blocked; other sessions'
9
+ worktrees are theirs (attribution guards judge every path by its owning
10
+ feature).
11
+
12
+ 1. Implement per the approved plan with project conventions and the **stage
13
+ guidance injected at stage start** (tier-3 prose — your playbook's
14
+ `prose.implement`, or dev-flow's built-in senior-discipline guidance when
15
+ the playbook sets none). Commit in the worktree
16
+ **as you go** — small reviewable commits; a twelve-file monolith saved for
17
+ the end faces review blind and is not crash-safe. The gate enforces the
18
+ habit: `flow verify` refuses while the branch holds **no commit** (checks
19
+ describe the working tree, so nothing committed means nothing reviewed was
20
+ ever recorded) and every verify line reports
21
+ `commits: N ahead of <default>, M uncommitted path(s)` — uncommitted paths
22
+ never block verify, they are what the operator sees they are approving.
23
+ 2. Write tests as you go (project framework: the `test` key / `flow-check`
24
+ blocks).
25
+ 3. `flow check` runs every tier-1 check (test, health, named `flow-check`
26
+ blocks) and records each; any later worktree edit invalidates checks and
27
+ the tier-2 confirmation — rerun before verify.
28
+ 4. UI flag set? An actual browser visual pass (screenshot or the project's
29
+ automated pass) — not just a typecheck.
30
+ 5. Done means **running and healthy with pre-existing data**, not "compiles":
31
+ `commands.seedData` (if set) puts real data in place, the app starts with
32
+ the `run` command, and the health check passes — `flow check` covers it
33
+ (seedData runs before health) and `flow verify` probes **the deployed app
34
+ again**, because the deploy is what has to be proven. Probes retry every 2s
35
+ up to `healthWait` (default 30s) — a service needing a moment after its
36
+ container starts is not a failed deploy; say so rather than declaring a
37
+ healthy deploy broken. Walk the **tier-2 checklist** (`- [ ]`) with the
38
+ operator honestly — it cannot be scripted. Then ask **Verified?** →
39
+ `flow verify --confirmed`. Fixes = iterate and re-verify; that loop is
40
+ free.
41
+
42
+ `flow verify` re-runs build, runs the `dev` deploy when configured (the
43
+ operator reviews the running app; the gate **prints what it ran** —
44
+ `build ran (…)` / `dev ran (…)` / `dev: none configured`; the command must
45
+ **background and exit**, e.g. `docker compose up -d .` — verify waits and kills
46
+ runs past 15 min), re-runs the health probe **against what it just deployed**
47
+ (`seedData` first when configured; a failing probe retries every 2s up to
48
+ `healthWait`, then refuses the gate reporting its attempts — a pre-deploy PASS
49
+ describes a container that no longer exists; no probe prints
50
+ `health: none configured` and the doctor flags it), and demands all tier-1
51
+ checks green before the single question. The operator's confirm covers the
52
+ tier-2 list as a set (hashed; edits reset it). A `--docs` feature prints
53
+ `docs mode: project commands skipped` and asks only the verify question.
54
+ Verify lands the feature in **pre-release**.
55
+
56
+ Mid-stage additions — do not bounce the flow, do not grow it silently:
57
+ **this feature grew** → stay at implement, append a `**Added mid-stage:**` line
58
+ to `plan.md` (what was asked and how), implement, `flow check` again — edits
59
+ invalidate checks and the tier-2 confirmation, so verify re-covers the
60
+ addition. **Different problem** → finish this feature first, then a new flow
61
+ (`flow start <new-slug>` after this one ships); never fold two features into
62
+ one plan, PR and verify — the
63
+ audit trail is the point. **Heavily amended plan** → show it and have the
64
+ operator re-approve in chat; verify remains the checkpoint — no reopen command
65
+ exists by design.
66
+
@@ -0,0 +1,53 @@
1
+ > Part of the **dev-flow** playbook. The always-on ground rules live in
2
+ > [../SKILL.md](../SKILL.md); this file is the detail for one stage — read it
3
+ > when the session reaches that stage.
4
+
5
+ ## Stage: plan
6
+
7
+ 1. Research the code the plan needs (reads are always allowed).
8
+ 2. **Clarify before drafting**: preliminary direction in chat (findings, shape
9
+ of the fix, open unknowns), mode proposal with its reason, your questions
10
+ and the operator's; draft only after the direction is confirmed.
11
+ 3. Write `.dev-flow/<slug>/plan/plan.md` — problem, approach, files to touch,
12
+ test strategy, risks; reviewable, not exhaustive. First check
13
+ `git log origin/<default>..<default> --oneline`: local-only default-branch
14
+ commits fall out of the worktree's base (push them or re-plan).
15
+ 4. **UI flag set?** Mockups live in `plan/mockups/`, one HTML per screen/state
16
+ (`<screen>.html`), linking the project's real stylesheet and class names
17
+ where they exist (relative links work from `.dev-flow/`). Every mockup
18
+ must be **rendered** — an unrendered mockup is not a mockup:
19
+ - Headless chromium: PATH `chromium`/`chromium-browser`/`google-chrome`,
20
+ else playwright's
21
+ `~/.cache/ms-playwright/*/chrome-headless-shell-linux64/chrome-headless-shell`.
22
+ Render at the project's widths (default phone 390, desktop 1280):
23
+ `<binary> --no-sandbox --disable-gpu --hide-scrollbars --virtual-time-budget=5000 --window-size=<width>,<height> --screenshot=plan/mockups/<screen>-<width>.png file://<absolute path to html>`
24
+ — height per screen, re-render if clipped.
25
+ - Embed every render in plan.md under its section —
26
+ `![<screen> — phone](mockups/<screen>-390.png)`. Image syntax only (a
27
+ filename in prose is a broken link); before Approve? re-check that every
28
+ tag points at an existing file.
29
+ - No chromium anywhere → tell the operator and ask; `*.html`-only plans
30
+ only with their OK (knob: `mockupGlobs`); never fake or skip silently.
31
+ - Gotchas: for a component question prefer a **static strip** — standalone
32
+ HTML with the real stylesheet carrying only the markup in question, one
33
+ first-try render; a full-page render is for layout context only. Shots
34
+ start top-left and never scroll — hide what is above a below-the-fold
35
+ region (inline `<style>`) or use a strip. `--user-data-dir` profiles keep
36
+ localStorage between shots — fresh profile dir per intended UI state.
37
+ Planned behavior must be visibly patched into the shot and captioned as
38
+ such — never caption the current app's render with the behavior you plan
39
+ to add. The app's repaint can destroy a transient state (an inline
40
+ editor) — freeze it for the shot (e.g. stub the render entry point after
41
+ opening). If the harness fights the same shot twice, verify that state
42
+ via DOM/code and move on — screenshots are a spot-check, not a test loop.
43
+ 5. Tell the user the plan is ready and **stop** — one word: **Approve?**
44
+ Answered → `flow approve --confirmed` (yolo → `flow approve --yolo
45
+ --confirmed`).
46
+
47
+ Approval creates the worktree and branch, running `commands.setup` inside when
48
+ configured — a failing setup fails the gate and the next `approve` **retries**
49
+ setup in the kept worktree (stamping `setupAt` on success) instead of silently
50
+ reusing it. A `--docs` feature runs no project command at all. No code edits
51
+ before approval. `(ui)` playbook items never apply to non-UI features or
52
+ appear in prompts.
53
+