pi-dev-flow 0.79.0 → 0.81.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 +31 -0
- package/docs/gates.md +5 -5
- package/docs/playbook.md +1 -1
- package/extensions/dev-flow.ts +186 -29
- package/package.json +1 -1
- package/skills/dev-flow/references/finish.md +3 -1
- package/skills/dev-flow/references/implement.md +10 -2
- package/skills/dev-flow/references/plan.md +6 -1
- package/skills/dev-flow/references/reflect.md +7 -4
- package/skills/dev-flow/references/start.md +3 -1
- package/src/core.ts +256 -16
- package/src/projectmd.ts +11 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,37 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.81.0] - 2026-11-04
|
|
8
|
+
|
|
9
|
+
**Temp-dir fixtures stay outside the repo for git; a UI flag can be added at plan; compaction keeps the real stage.**
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- **Tests that make temp dirs no longer find the enclosing repo under dev-flow.** Since 0.79.0 a bound feature's commands run with `TMPDIR` in `.dev-flow/<slug>/tmp/`, inside the checkout, so git walked up out of a test's `mkdtemp` fixture and answered with the project's repo; a suite asserting "no repository here" failed only under the gates. That dir is now also the commands' `GIT_CEILING_DIRECTORIES` (an inherited list is kept).
|
|
13
|
+
- **The "this session runs an older dev-flow" warning named the versions backwards** in projects that install dev-flow: after an in-place update it said the session ran the new build and the install shipped the old one. The loaded version is now the one read at load, and the shipped one is read fresh.
|
|
14
|
+
- **A flow-aware compaction can no longer carry a stale stage forward.** Its summary ends with a block written from `state.json` (stage, approvals, checks, next) that says it outranks the prose above it; one pre-release summary had still said "implement, next: flow verify".
|
|
15
|
+
- **An implement worker sharing a dirty worktree is told the uncommitted paths are the driver's**: commit only its own paths by name, never `git add -A` / `commit -a`.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- `flow start <slug> --ui --confirmed` on the plan-stage feature this session drives switches the mockup gate on instead of refusing with "already exists". Past plan it refuses, and a plain re-start names `flow use`.
|
|
19
|
+
- The approve gate refuses a mockup that links another feature's worktree (href, src or `@import`); at plan, link the main checkout's stylesheet.
|
|
20
|
+
|
|
21
|
+
## [0.80.0] - 2026-11-03
|
|
22
|
+
|
|
23
|
+
**A reflection that runs out of time still hands back its findings; release-only flows pass verify.**
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- **A reflection cut at its budget no longer loses its findings.** `flow_stage` workers are steered at 75% of their budget to wrap up and write the REPORT (the gh#142 grace, lost in the 0.73 slim-down, is back for every op). A worker still cut at the budget gets one tool-less prompt for its REPORT, and the result comes back marked partial instead of "aborted".
|
|
27
|
+
- **The reflect worker reads instead of digging.** Before it starts, the tool writes a line-tagged digest of the driver and every worker transcript into `.dev-flow/<slug>/tmp/reflect/`: operator messages, flow calls and answers, tool errors, NEEDS-OPERATOR, repeated commands. A 2.5 MB driver transcript digests to about 25 KB. The upstream issue list (all states) is prefetched into the brief, the brief states the budget, and the worker is told it reviews the session, not the product.
|
|
28
|
+
- **Release refuses leftover merge-conflict markers** (#164). A `<<<<<<<` / `|||||||` / `>>>>>>>` line the branch adds is named with `file:line`; `--no-marker-check` is the operator's escape.
|
|
29
|
+
- **A review worker on a `--docs` / `--patch` flow is no longer sent after a missing plan.md** (#167). The brief says the flow has no plan file and to judge the work against the task.
|
|
30
|
+
- **`--docs --no-version` no longer owes a changelog line** (#163), and the pre-release hint for a docs flow says unversioned is the usual path instead of "bump version" (#166).
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- `flow reflect done <n> ["<what>"]` checks a fixed item off, so doctor stops re-reporting it (#165).
|
|
34
|
+
- `- [ ] (versioned) item` in the playbook: a checklist item that only applies when the flow ships a version. It stands down on `--no-version`, so release-done stops listing tag/image proofs an unversioned flow can never satisfy (#166).
|
|
35
|
+
- **Release-only flows** (#161): on a versioned project, `flow verify` accepts an empty branch when the default branch has unreleased commits since the newest version tag. The version bump is the pre-release commit, as the playbook says, and the release gate does not count it as a post-verify change. With nothing unreleased, verify says there is nothing to release.
|
|
36
|
+
- `flow release` names commits made after the operator's Verified? (verify now stamps the HEAD it was given over). It warns and never refuses (#162).
|
|
37
|
+
|
|
7
38
|
## [0.79.0] - 2026-11-03
|
|
8
39
|
|
|
9
40
|
**Scratch files live in the feature folder and go away at finish.**
|
package/docs/gates.md
CHANGED
|
@@ -9,17 +9,17 @@ so it needs no `--confirmed`.
|
|
|
9
9
|
|
|
10
10
|
| Gate | Advances | Refuses unless |
|
|
11
11
|
|---|---|---|
|
|
12
|
-
| `start <slug> [--ui|--patch|--docs --confirmed] [--merge=squash\|merge\|rebase\|any] [--check-upstream]` | → plan | slug is new (binds the session); `--ui` and the relaxed modes are operator-granted in chat, anchored by `--confirmed` (`--ui` = the plan gate demands rendered mockups); `--patch` = chore release, no plan document, every gate unchanged; `--docs` = docs-only, no plan document and no tier-1 checks (worktree and release intact). Start prints the dev-flow build and stamps it into the feature state (`flow status` shows `flow=<ver>`), warns when **this session runs an older build than the checkout** (`--check-upstream` also asks npm for the published one), prints the playbook gaps `flow doctor` would report — and **refuses while the playbook has no `merge` policy**: it names the question (squash / merge / rebase / any), the style its own history suggests, and the re-run `--merge=<style> --confirmed`, which writes the answer into `## release` (single-line insert, validated, `.bak` kept, committed as a playbook chore only when the playbook is the only dirty path) and never asks again |
|
|
12
|
+
| `start <slug> [--ui|--patch|--docs --confirmed] [--merge=squash\|merge\|rebase\|any] [--check-upstream]` | → plan | slug is new (binds the session); `--ui` and the relaxed modes are operator-granted in chat, anchored by `--confirmed` (`--ui` = the plan gate demands rendered mockups; on an existing feature still at plan, `start <slug> --ui --confirmed` from its bound session switches the flag on instead of refusing); `--patch` = chore release, no plan document, every gate unchanged; `--docs` = docs-only, no plan document and no tier-1 checks (worktree and release intact). Start prints the dev-flow build and stamps it into the feature state (`flow status` shows `flow=<ver>`), warns when **this session runs an older build than the checkout** (`--check-upstream` also asks npm for the published one), prints the playbook gaps `flow doctor` would report — and **refuses while the playbook has no `merge` policy**: it names the question (squash / merge / rebase / any), the style its own history suggests, and the re-run `--merge=<style> --confirmed`, which writes the answer into `## release` (single-line insert, validated, `.bak` kept, committed as a playbook chore only when the playbook is the only dirty path) and never asks again |
|
|
13
13
|
| `use <slug>` | — (binds this session to a feature) | slug unfinished — the binding is persisted to disk as a claim (`flow version` lists every dev-flow copy registered in the process, and a copy whose in-memory bindings never saw the bind attributes commands from the claim, so a two-sources setup does not misjudge your git) |
|
|
14
|
-
| `approve [--yolo]` | plan → implement (creates worktree + branch) | `plan/plan.md` exists **by name** (a separate pre-plan/direction file does not open the gate — a preliminary direction belongs inside plan.md); if `--ui`, rendered mockup screenshots (per `mockupGlobs`, default `*.png`) exist under `plan/` — headless chromium renders embedded in plan.md, and the gate opens plan.md to prove it: every image file under `plan/` must appear in an embed (``, case-insensitive) and every `mockups/<screen>.html` must carry an embedded `<screen>-<width>.` shot
|
|
14
|
+
| `approve [--yolo]` | plan → implement (creates worktree + branch) | `plan/plan.md` exists **by name** (a separate pre-plan/direction file does not open the gate — a preliminary direction belongs inside plan.md); if `--ui`, rendered mockup screenshots (per `mockupGlobs`, default `*.png`) exist under `plan/` — headless chromium renders embedded in plan.md, and the gate opens plan.md to prove it: every image file under `plan/` must appear in an embed (``, case-insensitive) and every `mockups/<screen>.html` must carry an embedded `<screen>-<width>.` shot, and no mockup may link (href/src/@import) into another feature's `.dev-flow/<other>/worktree/`; **one question** — or `--confirmed` after you answered in chat; **yolo** (your chat answer at **any** checkpoint question) → run that gate with `--yolo --confirmed` (`approve`/`verify`/`release`/`finish`): that question is answered and every later one (Verified?/Release?/Finish?) is pre-confirmed — the agent then runs the remaining gates back to back, honoring guidance attached to the yolo word (e.g. "yolo, create a patch version release") — checks and guardrails stay fully enforced. `commands.setup` runs in the worktree and is retried until it succeeds once (a worktree left behind by a failed setup is set up on the next `approve`, never silently reused); a `--docs` feature runs no project command at all and says `setup skipped (docs mode)` |
|
|
15
15
|
| `test` | records a check | — (runs the `test` command/check, records pass/fail) |
|
|
16
16
|
| `check` | records all tier-1 checks | — (runs every `flow-check`/test/health from project.md `## implement`); a `--docs` feature runs none of them and says `docs mode: project commands skipped` — a docs flow builds nothing, so a fresh checkout must not read as a failed deploy (#96) |
|
|
17
17
|
| `health` | records a check | — (runs `seedData` + the health command, retrying up to `healthWait` seconds; app must be up locally with real data) |
|
|
18
|
-
| `verify [--yolo]` | implement → pre-release | all tier-1 checks green — a check with no passing record is **run by the gate itself** (`checks ran at the gate (test)`) rather than refused and pointed at `flow check`, since entering the stage or editing the worktree is what cleared it — and so is a record whose worktree fingerprint differs from the tree now (`stale record(s) rerun after a worktree change: …`): a change made through bash fires no edit-tool hook, the fingerprint is what notices the tree moved — and a failure there prints the run output, **the feature branch holds at least one commit** (verify refuses a branch with nothing committed — the checks describe the working tree, so an uncommitted state has never been recorded — and prints `commits: N ahead of <default>, M uncommitted path(s)` with what it ran; uncommitted paths are reported, never gated), build (if configured) green, `dev` deploy (if configured) runs first so you can review the running app **and the health probe (if configured) re-runs against what it just deployed, retrying every 2s up to `healthWait` seconds** (a failing probe refuses the gate and reports how many attempts it took: the `flow check` PASS predates the deploy, and a service that needs seconds after its container starts is not a broken deploy; with no probe the output says `health: none configured`); with **no `dev` command but a `health` probe configured the gate live-re-probes the app before asking** (`health: live re-probe PASS` — a killed server refuses with `live probe FAILED`, because process death dirties no worktree fingerprint and a green record alone cannot prove liveness: start the app and rerun), tier-2 checklist (ui-only items excluded for non-UI features) confirmed as a set; a `--docs` feature runs none of it (`docs mode: project commands skipped`) and only asks you; **one question** — or `--confirmed`; `--yolo --confirmed` = you answered 'yolo' at Verified? — answers it and pre-confirms the rest |
|
|
19
|
-
| `release [--yolo|--no-version|--no-fold-check]` | pre-release → release | checks re-greened after the prep edits; `release.preflight` (when set) passes in the worktree — the build the tag will trigger, proven before anything ships; **the worktree holds no uncommitted paths** (gh#131: a merge ships the branch, not the working tree — an uncommitted fix at this gate is a fix that never ships; the refusal lists the paths, and the approved line prints `commits: N ahead of <default>, M uncommitted path(s)` like verify's); with `versioning.file`: the manifest version parses and is **not tagged yet** (the bump must be ahead of the last release); with `release.changelog` the gate **proves the entry mechanically** (#97): a **heading names the version** (prose that mentions it, or a `1.2.0-beta` section when releasing `1.2.0`, is not an entry), **this branch touched the file** (an inherited changelog is not release prep), **every entry that was pending before the release survives inside the new section** — compared on normalized lines, so re-indenting a fold is free while rewording or deleting one is refused by naming the line — and **nothing is left under `Unreleased`**. The proofs guard the **baseline's** pending lines — they do not freeze the wording of the entry this flow writes, so a branch that landed as several iteration commits is free to state its result as one entry (see the changelog-writer rule in the pre-release reference). The pending baseline is the newest tag's changelog (what actually shipped), else the branch's merge base; when neither resolves, the two git-dependent proofs are skipped **with a printed advisory** rather than refusing a legal release for a topology reason, and the content proofs (the heading, its body) always run; tier-2 `## pre-release` checklist confirmed; the manifest version it validates is **stamped as the release's version of record** (`release-done` publishes that, whatever the checkouts say later); **one question** (Release?) — or `--confirmed`; `--no-version` (your call at Release?) ships this flow as **merge + changelog** — the bump/tag requirements and the tag checks at `release-done` are skipped for it, but the branch must still add its **own line under `Unreleased`** (editing an older section releases nothing) and it rides there until the next versioned release folds it (default: versioned); `--no-fold-check` is the operator-granted escape from the line-level fold proofs — one flow, stamped in the gate output, the heading and touched proofs stay; **stale session build** (loaded build behind the checkout): the gate prints both builds, lists what shipped between them (those proofs will not run this release) and folds *update (/reload, then re-run) or proceed with the old release?* into the Release? question — the operator's word, recorded in the release output, **never a block**: publishing under an older gate is a legitimate choice (hotfix, offline reload) |
|
|
18
|
+
| `verify [--yolo]` | implement → pre-release | all tier-1 checks green — a check with no passing record is **run by the gate itself** (`checks ran at the gate (test)`) rather than refused and pointed at `flow check`, since entering the stage or editing the worktree is what cleared it — and so is a record whose worktree fingerprint differs from the tree now (`stale record(s) rerun after a worktree change: …`): a change made through bash fires no edit-tool hook, the fingerprint is what notices the tree moved — and a failure there prints the run output, **the feature branch holds at least one commit** (verify refuses a branch with nothing committed — the checks describe the working tree, so an uncommitted state has never been recorded — except a **release-only flow** (#161): on a versioned project an empty branch over unreleased commits on the default branch (since the newest local version tag, or all of them before the first release) passes, the line says `release-only flow: N unreleased commit(s)`, and the version bump is the pre-release commit; with nothing unreleased the refusal says there is nothing to release; and prints `commits: N ahead of <default>, M uncommitted path(s)` with what it ran; uncommitted paths are reported, never gated), build (if configured) green, `dev` deploy (if configured) runs first so you can review the running app **and the health probe (if configured) re-runs against what it just deployed, retrying every 2s up to `healthWait` seconds** (a failing probe refuses the gate and reports how many attempts it took: the `flow check` PASS predates the deploy, and a service that needs seconds after its container starts is not a broken deploy; with no probe the output says `health: none configured`); with **no `dev` command but a `health` probe configured the gate live-re-probes the app before asking** (`health: live re-probe PASS` — a killed server refuses with `live probe FAILED`, because process death dirties no worktree fingerprint and a green record alone cannot prove liveness: start the app and rerun), tier-2 checklist (ui-only items excluded for non-UI features) confirmed as a set; a `--docs` feature runs none of it (`docs mode: project commands skipped`) and only asks you; **one question** — or `--confirmed`; `--yolo --confirmed` = you answered 'yolo' at Verified? — answers it and pre-confirms the rest |
|
|
19
|
+
| `release [--yolo|--no-version|--no-fold-check|--no-marker-check]` | pre-release → release | checks re-greened after the prep edits; `release.preflight` (when set) passes in the worktree — the build the tag will trigger, proven before anything ships; **the branch adds no merge-conflict marker lines** vs its merge base (#164: a hand-resolved merge that kept a `<<<<<<<`/`>>>>>>>` line is refused with `file:line`; `--no-marker-check` on the operator's word when the lines are meant); **commits after Verified?** are named in the Release? question and the approved line (#162: the operator's word covers the HEAD verify stamped — a warning, never a refusal); **the worktree holds no uncommitted paths** (gh#131: a merge ships the branch, not the working tree — an uncommitted fix at this gate is a fix that never ships; the refusal lists the paths, and the approved line prints `commits: N ahead of <default>, M uncommitted path(s)` like verify's); with `versioning.file`: the manifest version parses and is **not tagged yet** (the bump must be ahead of the last release); with `release.changelog` the gate **proves the entry mechanically** (#97): a **heading names the version** (prose that mentions it, or a `1.2.0-beta` section when releasing `1.2.0`, is not an entry), **this branch touched the file** (an inherited changelog is not release prep), **every entry that was pending before the release survives inside the new section** — compared on normalized lines, so re-indenting a fold is free while rewording or deleting one is refused by naming the line — and **nothing is left under `Unreleased`**. The proofs guard the **baseline's** pending lines — they do not freeze the wording of the entry this flow writes, so a branch that landed as several iteration commits is free to state its result as one entry (see the changelog-writer rule in the pre-release reference). The pending baseline is the newest tag's changelog (what actually shipped), else the branch's merge base; when neither resolves, the two git-dependent proofs are skipped **with a printed advisory** rather than refusing a legal release for a topology reason, and the content proofs (the heading, its body) always run; tier-2 `## pre-release` checklist confirmed; the manifest version it validates is **stamped as the release's version of record** (`release-done` publishes that, whatever the checkouts say later); **one question** (Release?) — or `--confirmed`; `--no-version` (your call at Release?) ships this flow as **merge + changelog** — the bump/tag requirements and the tag checks at `release-done` are skipped for it, but the branch must still add its **own line under `Unreleased`** (a `--docs` flow is exempt — #163: a playbook/docs change owes no user-facing entry; one it writes is welcome, not proven) (editing an older section releases nothing) and it rides there until the next versioned release folds it (default: versioned); `--no-fold-check` is the operator-granted escape from the line-level fold proofs — one flow, stamped in the gate output, the heading and touched proofs stay; **stale session build** (loaded build behind the checkout): the gate prints both builds, lists what shipped between them (those proofs will not run this release) and folds *update (/reload, then re-run) or proceed with the old release?* into the Release? question — the operator's word, recorded in the release output, **never a block**: publishing under an older gate is a legitimate choice (hotfix, offline reload) |
|
|
20
20
|
| `release-done` | records the release (the stage stays `release`) | **no question — the Release? answer covered the publication**; verify approval; the version published is the one `release` **stamped** from the manifest it validated (a main checkout still behind cannot republish the previous version), and it must not be older than the newest matching tag **on origin** (tag lists come from `git ls-remote`, so an unfetched clone does not decide what exists; when an origin exists but cannot be asked (offline, no ssh agent) **both release gates refuse** rather than answering with local tags); with `versioning.file`: that tag exists, is reachable from the default branch **and is on origin** (a local-only tag is not a release); with `release.artifact`: the published-artifact check runs (`{version}`/`{tag}` placeholders — the line it prints names the version it verified; skip once with `--no-artifact-check`, operator-instructed only) · creates the forge release from the tag, its body **the `release.changelog` entry for that version** — the changelog is the source of truth, and the tag's annotation stands in only when the changelog has no entry for the version, else nothing (and it says why — a body that is really a shell error is dropped, never shipped) — `gh` for GitHub, `glab` for GitLab) and then **proves the release exists**: it asks the forge (`gh release view <tag>` / `glab release view <tag>`) and refuses when nothing is there, because #51, #60 and #63 were three ways of ending `release recorded as complete` with nothing published — and when the changelog was the body it **reads the stored body back** and refuses a mismatch, so the release page and the changelog cannot drift (#97; normalized before comparing, skipped with a printed note on another forge). Skipping is deliberate and loud — `--no-release-create`, `release.releases = false` or `forge = self` each print that no forge release was created, and the view check is skipped for them; **with a `merge` policy** it also proves the merge that shipped matches it — branch ancestry plus what the forge says (`gh pr view` / `glab api`), so a squash under `merge = merge` (or a merge commit under `merge = squash`) refuses the release record, while a shape it cannot see prints an advisory instead (#97's split: an invisible topology never blocks a legal release); when the release went out on a stale build the operator acknowledged at the release gate, it prints that acknowledgement in place of the after-the-fact version-skew warning, and that warning prints the session vs disk version pair plus the duplicate-copy note when a second copy is registered (#117) |
|
|
21
21
|
| `finish [--yolo] [slug]` | release → done (removes worktree + branch, deletes `.dev-flow/<slug>/`, and deletes `origin/<branch>` **only** when its merged state is verified — ancestor of the default branch or a merged PR/MR via `gh`/`glab`; unverifiable branches stay with a note) | a release is recorded (`release-done` ran), the main checkout is clean **and** pushed to `origin/<default>`, and the worktree has no uncommitted changes (the refusal lists the paths, not just the count — gh#131); when the clean checkout trails `origin/<default>` the gate **fast-forwards local main** as it closes out (never a merge — anything that cannot fast-forward prints the operator's exact `git pull --ff-only` command); **one question** (Finish? — mentions unmerged-looking commits with the playbook's `merge` policy in mind, and warns when the forge release create failed at `release-done` and no retry succeeded) — or `--confirmed`; under `merge = merge`, commits that never reached the default branch are a **policy violation**: `yolo` does not answer it, only your explicit answer does; to abandon an unreleased feature use `abort` |
|
|
22
|
-
| `reflect ["<note>"|list|tidy|move <n> --playbook|--code]` | — | `reflect "<note>"` queues a suggestion in **this project's** `reflections.md` (never gates; gate flags such as `--confirmed` are ignored, they never become part of the note). `--playbook` (alias `--docs`) files it under `## playbook` — the fix lives only in `project.md`, a docs flow implements it; `--code` files it under `## code` — the fix touches project code, a patch flow implements it. `--plugin` **never writes**: dev-flow feedback is filed upstream, so it prints the recipe — `gh issue list --repo <dev-flow repo> --state all --search …` first, then `gh issue create` with a body ending `— reflection from <slug> <date>` (in the dev-flow repo itself plugin is code → `## code`). With no flag the wording guesses (plugin-shaped → the recipe; otherwise `## playbook`) and the echo prints why. `reflect list` numbers the open items with their section; `reflect move <n> --playbook|--code` re-files one; a legacy `## plugin` row is flagged by list and doctor (file it upstream, check it off `— filed: gh#NNN`). `reflect tidy` drops the closed (`- [x]`) items — the preamble and open items stay verbatim and a `## section` heading left empty goes with its items. **Nudges are timed, not constant**: `⚑ fix the open reflections now?` prints when an item recurred this session, is ≥ 14 days old, ≥ 3 playbook items wait, or a code item waits while between flows — at finish, in an unbound session and in doctor, never mid-feature; `↻ N closed reflection(s)` prints at ≥ 5 closed, closed ≥ open (≥ 3), or a closed item ≥ 30 days old. Bare `reflect` prints the **session-reflection protocol** (from the `/flow reflect` bar it additionally wakes the model): bound to a flow, delegate the review to `flow_stage` op `reflect`; unbound, review inline; re-check every open item against the playbook and **newer dev-flow versions** (`npm view pi-dev-flow version`; the operator performs updates); show the operator a numbered list with a fold/drop recommendation per finding and stop; fold docs/code → `reflect --playbook|--code`, fold plugin → the upstream issue, drop → nothing recorded |
|
|
22
|
+
| `reflect ["<note>"|list|tidy|move <n> --playbook|--code|done <n> ["<what>"]]` | — | `reflect "<note>"` queues a suggestion in **this project's** `reflections.md` (never gates; gate flags such as `--confirmed` are ignored, they never become part of the note). `--playbook` (alias `--docs`) files it under `## playbook` — the fix lives only in `project.md`, a docs flow implements it; `--code` files it under `## code` — the fix touches project code, a patch flow implements it. `--plugin` **never writes**: dev-flow feedback is filed upstream, so it prints the recipe — `gh issue list --repo <dev-flow repo> --state all --search …` first, then `gh issue create` with a body ending `— reflection from <slug> <date>` (in the dev-flow repo itself plugin is code → `## code`). With no flag the wording guesses (plugin-shaped → the recipe; otherwise `## playbook`) and the echo prints why. `reflect list` numbers the open items with their section; `reflect move <n> --playbook|--code` re-files one; `reflect done <n> ["<what>"]` checks a fixed one off (`— fixed: <date> <slug> — <what>`) so doctor stops re-reporting it; a legacy `## plugin` row is flagged by list and doctor (file it upstream, check it off `— filed: gh#NNN`). `reflect tidy` drops the closed (`- [x]`) items — the preamble and open items stay verbatim and a `## section` heading left empty goes with its items. **Nudges are timed, not constant**: `⚑ fix the open reflections now?` prints when an item recurred this session, is ≥ 14 days old, ≥ 3 playbook items wait, or a code item waits while between flows — at finish, in an unbound session and in doctor, never mid-feature; `↻ N closed reflection(s)` prints at ≥ 5 closed, closed ≥ open (≥ 3), or a closed item ≥ 30 days old. Bare `reflect` prints the **session-reflection protocol** (from the `/flow reflect` bar it additionally wakes the model): bound to a flow, delegate the review to `flow_stage` op `reflect`; unbound, review inline; re-check every open item against the playbook and **newer dev-flow versions** (`npm view pi-dev-flow version`; the operator performs updates); show the operator a numbered list with a fold/drop recommendation per finding and stop; fold docs/code → `reflect --playbook|--code`, fold plugin → the upstream issue, drop → nothing recorded |
|
|
23
23
|
| `roadmap [add "<feature>" \| pick <n> <slug> \| done <n> \| tidy]` | — | manages `.dev-flow/roadmap.md`, the gitignored backlog of future features (`- [ ]` checklist): bare prints the numbered open items, `add` appends one, `pick <n> <slug>` stamps open item n with `(slug)` so `flow start <slug>` can take it — **`finish` checks the stamped item off when that feature ships**; `done <n>` checks off by hand (items shipped outside a flow), `tidy` drops the checked lines. Never gates; the open count is surfaced in `status` and session context |
|
|
24
24
|
| `doctor ["<issue note>"]` | — | read-only findings: playbook drift, dead commands/scripts, untracked playbook, ghost feature dirs, orphan worktrees/branches — the state of an **aborted** feature is never a finding (its worktree cleanup is by design — gh#138) — **plus a review of every open reflection, each routed to the flow that should fix it** (playbook item → docs flow; plugin item → upstream issue, or a patch/normal flow inside the dev-flow repo) — every item is labelled from the `## section` it is filed under (the file is the record, so the table cannot disagree with it) and items sitting outside both sections are named rather than silently bucketed. It writes nothing and asks nothing, safe for agents and CI at any stage; the agent investigates, you confirm, the routed flow implements. `doctor "<note>"` prints an investigation brief and a fix route for a fresh observation, including the section it would be filed under and why |
|
|
25
25
|
| `status [slug]` / `abort [slug]` | — | — |
|
package/docs/playbook.md
CHANGED
|
@@ -52,7 +52,7 @@ executable checks and hard safety rules:
|
|
|
52
52
|
|---|---|---|
|
|
53
53
|
| 1 — executable | ` ```flow` (`key = value`) config blocks; ` ```flow-check <name>` command blocks | gates run every check, record pass/fail against a worktree fingerprint, a changed tree makes them stale — hard |
|
|
54
54
|
| 1 — guard | ` ```flow-guard ` (`deny`/`confirm`/`protect`/`forbid`) rules in `## global` | enforced on every bash command and every edit/write path, at every stage — hard block or operator confirmation |
|
|
55
|
-
| 2 — checklist | `- [ ] item` lines (`- [ ] (ui) item` = only for `--ui` features) | gate confirms cover them as a set (hashed: changing the items asks again); `(ui)` items never appear for non-UI features |
|
|
55
|
+
| 2 — checklist | `- [ ] item` lines (`- [ ] (ui) item` = only for `--ui` features; `- [ ] (versioned) item` = only when the flow ships a version — it stands down on `--no-version`) | gate confirms cover them as a set (hashed: changing the items asks again); `(ui)` items never appear for non-UI features, `(versioned)` items never for an unversioned flow (a deploy proof of the tagged image, say) |
|
|
56
56
|
| 3 — prose | any other text | injected to the agent when its stage begins — advisory |
|
|
57
57
|
|
|
58
58
|
Example `## implement` section:
|
package/extensions/dev-flow.ts
CHANGED
|
@@ -72,6 +72,7 @@ import {
|
|
|
72
72
|
guessReflectSections,
|
|
73
73
|
reflectItems,
|
|
74
74
|
reflectMove,
|
|
75
|
+
reflectDone,
|
|
75
76
|
reflectProtocol,
|
|
76
77
|
reflectUnfiledCount,
|
|
77
78
|
reflectLegacyPluginCount,
|
|
@@ -82,6 +83,13 @@ import {
|
|
|
82
83
|
parseReflectReport,
|
|
83
84
|
renderReflectFindings,
|
|
84
85
|
childSessionFiles,
|
|
86
|
+
conflictMarkerLines,
|
|
87
|
+
isReleaseOnly,
|
|
88
|
+
digestTranscript,
|
|
89
|
+
workerSteer,
|
|
90
|
+
WORKER_STEER_AT,
|
|
91
|
+
WORKER_SALVAGE,
|
|
92
|
+
WORKER_SALVAGE_MS,
|
|
85
93
|
WORKER_NUDGE_READONLY,
|
|
86
94
|
type SessionHeaderInfo,
|
|
87
95
|
reflectionLine,
|
|
@@ -115,6 +123,9 @@ import {
|
|
|
115
123
|
subst,
|
|
116
124
|
sq,
|
|
117
125
|
featureTmpDir,
|
|
126
|
+
featureTmpEnv,
|
|
127
|
+
compactionStateBlock,
|
|
128
|
+
foreignWorktreeLinks,
|
|
118
129
|
withTmpDir,
|
|
119
130
|
tagNotesCommand,
|
|
120
131
|
validSlug,
|
|
@@ -147,17 +158,20 @@ import { detectProject, type Detection } from "../src/detect.ts";
|
|
|
147
158
|
|
|
148
159
|
const execAsync = promisify(exec);
|
|
149
160
|
|
|
150
|
-
/**
|
|
151
|
-
*
|
|
152
|
-
|
|
153
|
-
|
|
161
|
+
/** This build's own identity, read once at load: it is what this session's code IS — an update that
|
|
162
|
+
* rewrites the package on disk later does not change the code already running. */
|
|
163
|
+
const SELF_BUILD = pluginVersion(import.meta.dirname);
|
|
164
|
+
|
|
165
|
+
/** The dev-flow build this session actually loaded — see sessionRunsOlderBuild. The load-time
|
|
166
|
+
* manifest, never a fresh read: re-reading the package after an in-place update reported the NEW
|
|
167
|
+
* version as loaded and the stale one as shipped (lettuce rail-ui-fixes, 0.79.0 → 0.80.0).
|
|
168
|
+
* DEV_FLOW_LOADED_VERSION (read at call time) can stand in for it (the smoke suite runs gates
|
|
169
|
+
* in-process and needs to pretend it is an old session): the override can only ever make a gate more
|
|
170
|
+
* cautious — it never lifts a proof, it turns a release into a warn-and-ask. */
|
|
154
171
|
function loadedVersion(): string | null {
|
|
155
|
-
return process.env.DEV_FLOW_LOADED_VERSION?.trim() ||
|
|
172
|
+
return process.env.DEV_FLOW_LOADED_VERSION?.trim() || SELF_BUILD.version;
|
|
156
173
|
}
|
|
157
174
|
|
|
158
|
-
/** This build's own identity, read once (the guard hot path must not re-walk the fs per call). */
|
|
159
|
-
const SELF_BUILD = pluginVersion(import.meta.dirname);
|
|
160
|
-
|
|
161
175
|
/** The dev-flow build this session *should* be running, as the disk describes it, and how to call it.
|
|
162
176
|
* In the dev-flow repo that is the checkout's own manifest: main moves ahead of the installed copy at
|
|
163
177
|
* every release, while `loadedVersion()` and the plugin's own package.json are the same file — so a
|
|
@@ -166,7 +180,7 @@ const SELF_BUILD = pluginVersion(import.meta.dirname);
|
|
|
166
180
|
function checkoutBuild(root: string): { version: string | null; dir: string; repo: string; label: string } {
|
|
167
181
|
return isSelfRepo(root)
|
|
168
182
|
? { ...pluginVersion(root), label: "this checkout" }
|
|
169
|
-
: { ...
|
|
183
|
+
: { ...pluginVersion(import.meta.dirname), label: "the dev-flow install" }; // fresh: what the disk ships NOW
|
|
170
184
|
}
|
|
171
185
|
|
|
172
186
|
/** The build this session runs vs the one the disk ships: `behind` is the loaded version when they differ
|
|
@@ -369,7 +383,7 @@ async function releaseTags(root: string): Promise<string[] | null> {
|
|
|
369
383
|
}
|
|
370
384
|
|
|
371
385
|
const GATE_HELP =
|
|
372
|
-
"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] | roadmap [add <text>|pick <n> <slug>|done <n>|tidy] | doctor [<issue note>] | status [slug] [--json] | start <slug> [--ui|--patch|--docs --confirmed] [--force] [--merge=squash|merge|rebase|any] [--check-upstream] | use <slug> | test | check | health | approve [--yolo] | verify [--yolo] | release [--yolo|--no-version|--no-fold-check] | release-done [--no-artifact-check|--no-release-create] | finish [--yolo] [slug] | abort [slug] | version [--check-upstream] — state gates take [slug] and --confirmed (the operator already answered in chat); without it they ask in a dialog, or refuse with NEEDS-OPERATOR when no UI is present — --ui/--patch/--docs and --merge=<style> on start 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 — 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 — 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, tidy drops closed ones — roadmap manages .dev-flow/roadmap.md: pick <n> <slug> stamps an item for flow start, finish checks it off — doctor reviews structure, git consistency and open reflections (never writes); doctor <note> prints an investigation brief — version prints the build the disk ships and any other dev-flow copies in this process (--check-upstream asks the registry)";
|
|
386
|
+
"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>|pick <n> <slug>|done <n>|tidy] | doctor [<issue note>] | status [slug] [--json] | start <slug> [--ui|--patch|--docs --confirmed] [--force] [--merge=squash|merge|rebase|any] [--check-upstream] | use <slug> | test | check | health | approve [--yolo] | verify [--yolo] | release [--yolo|--no-version|--no-fold-check|--no-marker-check] | release-done [--no-artifact-check|--no-release-create] | finish [--yolo] [slug] | abort [slug] | version [--check-upstream] — state gates take [slug] and --confirmed (the operator already answered in chat); without it they ask in a dialog, or refuse with NEEDS-OPERATOR when no UI is present — --ui/--patch/--docs and --merge=<style> on start 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 — 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 — 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> stamps an item for flow start, finish checks it off — doctor reviews structure, git consistency and open reflections (never writes); doctor <note> prints an investigation brief — version prints the build the disk ships and any other dev-flow copies in this process (--check-upstream asks the registry)";
|
|
373
387
|
const featDir = (root: string, slug: string) => path.join(dfDir(root), slug);
|
|
374
388
|
const stateFile = (root: string, slug: string) => path.join(featDir(root, slug), "state.json");
|
|
375
389
|
const claimFile = (root: string, slug: string) => path.join(featDir(root, slug), "claim.json");
|
|
@@ -610,7 +624,7 @@ function gateCwd(root: string, state: FlowState): string {
|
|
|
610
624
|
function featureEnv(root: string, state: FlowState): Record<string, string> {
|
|
611
625
|
const dir = featureTmpDir(dfDir(root), state.slug);
|
|
612
626
|
mkdirSync(dir, { recursive: true });
|
|
613
|
-
return
|
|
627
|
+
return featureTmpEnv(dir);
|
|
614
628
|
}
|
|
615
629
|
|
|
616
630
|
/** Tier-1 checks the gate still has to see green. Entering a stage — and every edit of the worktree —
|
|
@@ -716,10 +730,23 @@ async function branchState(cwd: string, defaultBranch: string): Promise<BranchSt
|
|
|
716
730
|
};
|
|
717
731
|
}
|
|
718
732
|
|
|
733
|
+
/** Commits HEAD carries since the newest local version tag (all of them before the first release) —
|
|
734
|
+
* local refs only, so the probe stays offline-safe. HEAD is the default branch's tip on an empty branch. */
|
|
735
|
+
async function unreleasedOnMain(cwd: string, pattern: string): Promise<{ count: number | null; since: string | null }> {
|
|
736
|
+
const tags = await sh("git tag --list", cwd);
|
|
737
|
+
const newest = tags.ok ? newestTaggedVersion(pattern, tags.out.split("\n").map((t) => t.trim()).filter(Boolean)) : null;
|
|
738
|
+
const since = newest ? pattern.replace("{version}", newest) : null;
|
|
739
|
+
const r = await sh(since ? `git rev-list --count ${sq(since)}..HEAD` : "git rev-list --count HEAD", cwd);
|
|
740
|
+
const n = Number.parseInt(r.out.trim(), 10);
|
|
741
|
+
return { count: r.ok && Number.isFinite(n) ? n : null, since };
|
|
742
|
+
}
|
|
743
|
+
|
|
719
744
|
function describeBranchState(b: BranchState, defaultBranch: string): string {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
745
|
+
if (b.commitsAhead === null) return `commits: unknown (no merge base with ${defaultBranch} — the commit proof is skipped)`;
|
|
746
|
+
const line = `commits: ${b.commitsAhead} ahead of ${defaultBranch}, ${b.uncommitted} uncommitted path(s)`;
|
|
747
|
+
return b.commitsAhead === 0 && (b.unreleased?.count ?? 0) > 0
|
|
748
|
+
? `${line} — release-only flow: ${b.unreleased!.count} unreleased commit(s) on ${defaultBranch}${b.unreleased!.since ? ` since ${b.unreleased!.since}` : " (nothing tagged yet)"}; verify proves that tree, the version bump is the pre-release commit`
|
|
749
|
+
: line;
|
|
723
750
|
}
|
|
724
751
|
|
|
725
752
|
// ---------------------------------------------------------------- gate runner
|
|
@@ -941,6 +968,21 @@ function reflectMoveNote(root: string, args: string[], forced: ReflectTarget | n
|
|
|
941
968
|
return { text: twin ? `reflect: item ${n} was already recorded under ## ${section} — the duplicate is gone (${note})` : `reflect: item ${n} re-filed under ## ${section} — ${note}` };
|
|
942
969
|
}
|
|
943
970
|
|
|
971
|
+
/** `flow reflect done <n> [what fixed it]` — check a folded/fixed item off, so doctor stops re-reporting it (#165). */
|
|
972
|
+
function reflectDoneNote(root: string, sess: Session, args: string[]): RunResult {
|
|
973
|
+
const text = readReflectionsText(root);
|
|
974
|
+
const items = reflectItems(text);
|
|
975
|
+
const n = Number(args[0]);
|
|
976
|
+
if (!Number.isInteger(n) || n < 1 || n > items.length)
|
|
977
|
+
return { text: items.length ? `done: open item 1–${items.length} required — flow reflect list numbers them` : "done: nothing open in reflections.md", isError: true };
|
|
978
|
+
const stamp = [now().slice(0, 10), sess.slug].filter(Boolean).join(" ");
|
|
979
|
+
const what = args.slice(1).join(" ").trim();
|
|
980
|
+
const next = reflectDone(text, n, what ? `${stamp} — ${what}` : stamp)!;
|
|
981
|
+
writeFileSync(path.join(dfDir(root), "reflections.md"), next);
|
|
982
|
+
const { tidy } = reflectionNudges(next, now().slice(0, 10));
|
|
983
|
+
return { text: `reflect: item ${n} checked off — ${items[n - 1].body}` + (tidy ? `\n${tidy}` : "") };
|
|
984
|
+
}
|
|
985
|
+
|
|
944
986
|
/** `flow reflect tidy` — drop the closed (`- [x]`) items; the `— fixed:` note already recorded the outcome. */
|
|
945
987
|
function reflectTidy(root: string): RunResult {
|
|
946
988
|
const file = path.join(dfDir(root), "reflections.md");
|
|
@@ -1043,6 +1085,7 @@ async function gateVerify(o: GateCtx): Promise<RunResult> {
|
|
|
1043
1085
|
if (err) return err;
|
|
1044
1086
|
const items = applicableItems(cfg, state!, "implement");
|
|
1045
1087
|
const branch = await branchState(gateCwd(root, state!), cfg.defaultBranch);
|
|
1088
|
+
if (branch.commitsAhead === 0 && cfg.versioning.file) branch.unreleased = await unreleasedOnMain(gateCwd(root, state!), cfg.versioning.pattern);
|
|
1046
1089
|
const branchLine = describeBranchState(branch, cfg.defaultBranch);
|
|
1047
1090
|
// A green record belongs to the tree it ran against. A worktree change made through bash (sed,
|
|
1048
1091
|
// a formatter, codegen) fires no edit-tool invalidation — the fingerprint is what notices the
|
|
@@ -1125,6 +1168,12 @@ async function gateVerify(o: GateCtx): Promise<RunResult> {
|
|
|
1125
1168
|
const final = verifyGate(state!, cfg, branch);
|
|
1126
1169
|
if (final.length) return { text: `verify gate FAILED:\n- ${final.join("\n- ")}`, isError: true };
|
|
1127
1170
|
state!.approvals.verify = now();
|
|
1171
|
+
if (isReleaseOnly(cfg, branch)) state!.releaseOnly = true;
|
|
1172
|
+
else delete state!.releaseOnly;
|
|
1173
|
+
// the tree the word was given over (#162) — a git that cannot answer leaves it unset, never a refusal
|
|
1174
|
+
const vHead = await sh("git rev-parse HEAD", gateCwd(root, state!));
|
|
1175
|
+
if (vHead.ok && vHead.out.trim()) state!.verifiedHead = vHead.out.trim();
|
|
1176
|
+
else delete state!.verifiedHead;
|
|
1128
1177
|
state!.stage = "pre-release";
|
|
1129
1178
|
delete state!.pendingAsk;
|
|
1130
1179
|
writeState(root, state!);
|
|
@@ -1135,9 +1184,10 @@ async function gateRelease(o: GateCtx): Promise<RunResult> {
|
|
|
1135
1184
|
const { root, ui, sess, cfg, flag, slugArg, takeYoloWord } = o;
|
|
1136
1185
|
const { state, err } = needState(root, sess, slugArg);
|
|
1137
1186
|
if (err) return err;
|
|
1138
|
-
const items = applicableItems(cfg, state!, "pre-release");
|
|
1139
1187
|
// operator's word at Release?: this flow ships without a version bump or tag — recorded only once Release? is answered
|
|
1140
1188
|
const noVersion = flag("no-version") || !!state!.noVersion;
|
|
1189
|
+
// (versioned) items stand down on an unversioned flow — the set confirmed here is the one that applies to it
|
|
1190
|
+
const items = applicableItems(cfg, { ...state!, noVersion }, "pre-release");
|
|
1141
1191
|
// yolo is the operator's word at Release? — pre-confirms Finish?; publishing guardrails stay enforced
|
|
1142
1192
|
const yoloWord = takeYoloWord(state!);
|
|
1143
1193
|
if (yoloWord) return { text: yoloWord, isError: true };
|
|
@@ -1190,7 +1240,11 @@ async function gateRelease(o: GateCtx): Promise<RunResult> {
|
|
|
1190
1240
|
}
|
|
1191
1241
|
}
|
|
1192
1242
|
}
|
|
1193
|
-
|
|
1243
|
+
// #164: a hand-resolved merge can commit a leftover marker — content to git, so nothing else catches it
|
|
1244
|
+
const markerBase = await mergeBase(wtCwd, cfg.defaultBranch);
|
|
1245
|
+
const markerDiff = markerBase ? await sh(`git diff -U0 --no-color --no-ext-diff ${sq(markerBase)} HEAD`, wtCwd) : null;
|
|
1246
|
+
const conflictMarkers = markerDiff?.ok ? conflictMarkerLines(markerDiff.out) : undefined;
|
|
1247
|
+
const prep = { manifestVersion: manifestVer, remoteTags, changelog, changelogChanged, changelogBase, noFoldCheck: flag("no-fold-check"), conflictMarkers, noMarkerCheck: flag("no-marker-check") };
|
|
1194
1248
|
// same freshness rule as verify: a green predating a worktree write may not stand for the tree this gate blesses
|
|
1195
1249
|
if (freshenChecks(state!, await worktreeFingerprint(wtCwd)).length) writeState(root, state!);
|
|
1196
1250
|
// tier-2 pre-release confirmation is recorded by this very command, so it is excluded here
|
|
@@ -1223,14 +1277,27 @@ async function gateRelease(o: GateCtx): Promise<RunResult> {
|
|
|
1223
1277
|
`Update (/reload, then re-run flow release on the current build) or proceed with the old release?`;
|
|
1224
1278
|
staleNote = `released under dev-flow ${behind} (${selfBuild.label} ${selfBuild.version ?? "?"}) by operator choice — proofs newer than ${behind} did not run`;
|
|
1225
1279
|
}
|
|
1280
|
+
// #162: Verified? was answered over one tree; commits after it ship under that word unless someone says
|
|
1281
|
+
// so. A warning, never a refusal — doc-only moves after verify are normal; the operator decides.
|
|
1282
|
+
let postVerify = "";
|
|
1283
|
+
if (state!.verifiedHead) {
|
|
1284
|
+
const since = await sh(`git log --oneline --no-decorate ${sq(state!.verifiedHead)}..HEAD`, wtCwd);
|
|
1285
|
+
const commits = since.ok ? since.out.split("\n").filter((l) => l.trim()) : [];
|
|
1286
|
+
// a release-only flow commits its bump and changelog after verify by design — only other files count
|
|
1287
|
+
const prepFiles = new Set([cfg.versioning.file, cfg.release.changelog, cfg.versioning.file === "package.json" ? "package-lock.json" : ""].filter(Boolean) as string[]);
|
|
1288
|
+
const touched = state!.releaseOnly && commits.length ? await sh(`git diff --name-only ${sq(state!.verifiedHead)} HEAD`, wtCwd) : null;
|
|
1289
|
+
const prepOnly = !!touched?.ok && touched.out.split("\n").filter((l) => l.trim()).every((f) => prepFiles.has(f.trim()));
|
|
1290
|
+
if (commits.length && !prepOnly)
|
|
1291
|
+
postVerify = `${commits.length} commit(s) landed after the operator's Verified? (given over ${state!.verifiedHead.slice(0, 7)}): ${commits.slice(0, 6).join(" | ")}${commits.length > 6 ? ` …(${commits.length - 6} more)` : ""} — the verify verdict does not cover them: if behaviour changed, have the operator check the current build before Release?, and either way say in the PR body which commit the verdict was given over`;
|
|
1292
|
+
}
|
|
1226
1293
|
const audit = flag("confirmed") ? " (confirmed by operator instruction)" : state!.yolo ? " (yolo: pre-confirmed)" : "";
|
|
1227
1294
|
const askPending = !flag("confirmed") && !state!.yolo;
|
|
1228
1295
|
if (askPending) {
|
|
1229
1296
|
markPendingAsk(root, state!, "Release?");
|
|
1230
1297
|
if (!ui.hasUI) {
|
|
1231
|
-
return { text: needsOperator(`release confirmation needs the operator: confirm interactively, or re-run with --confirmed once the operator answered 'Release?' in chat${stale ? ` — the operator must also answer the stale-build question: ${staleAsk}` : ""}`, "Release?"), isError: true };
|
|
1298
|
+
return { text: needsOperator(`release confirmation needs the operator: confirm interactively, or re-run with --confirmed once the operator answered 'Release?' in chat${stale ? ` — the operator must also answer the stale-build question: ${staleAsk}` : ""}${postVerify ? ` — tell them: ${postVerify}` : ""}`, "Release?"), isError: true };
|
|
1232
1299
|
}
|
|
1233
|
-
const ok = await ui.confirm("Enter release", `Release ${state!.slug}${manifestVer ? ` v${manifestVer}` : ""}${noVersion ? " (unversioned — merge + changelog entry only: no bump, no tag for this flow)" : ""}? Publishing starts: PR, merge${noVersion ? "" : ", tag"} — release-done afterwards needs no further answer.${staleAsk ? `\n\n${staleAsk}` : ""}`);
|
|
1300
|
+
const ok = await ui.confirm("Enter release", `Release ${state!.slug}${manifestVer ? ` v${manifestVer}` : ""}${noVersion ? " (unversioned — merge + changelog entry only: no bump, no tag for this flow)" : ""}? Publishing starts: PR, merge${noVersion ? "" : ", tag"} — release-done afterwards needs no further answer.${staleAsk ? `\n\n${staleAsk}` : ""}${postVerify ? `\n\n${postVerify}` : ""}`);
|
|
1234
1301
|
if (!ok) {
|
|
1235
1302
|
delete state!.pendingAsk;
|
|
1236
1303
|
writeState(root, state!);
|
|
@@ -1255,7 +1322,7 @@ async function gateRelease(o: GateCtx): Promise<RunResult> {
|
|
|
1255
1322
|
if (stale) state!.staleBuild = `${behind} (${selfBuild.label} ${selfBuild.version ?? "?"})`;
|
|
1256
1323
|
delete state!.pendingAsk;
|
|
1257
1324
|
writeState(root, state!);
|
|
1258
|
-
return { text: `release approved${audit}${state!.noVersion ? " — unversioned: no bump or tag; your changelog entry rides under Unreleased until the next versioned release folds it" : ""} — entering release stage.${manifestVer ? ` Version ${manifestVer}.` : ""}${foldNote}${staleNote ? ` ${staleNote}.` : ""}\n${describeBranchState(branchProof, cfg.defaultBranch)}\n${nextHint(state!, cfg)}` };
|
|
1325
|
+
return { text: `release approved${audit}${state!.noVersion ? " — unversioned: no bump or tag; your changelog entry rides under Unreleased until the next versioned release folds it" : ""} — entering release stage.${manifestVer ? ` Version ${manifestVer}.` : ""}${foldNote}${staleNote ? ` ${staleNote}.` : ""}${postVerify ? ` Warning: ${postVerify}.` : ""}\n${describeBranchState(branchProof, cfg.defaultBranch)}\n${nextHint(state!, cfg)}` };
|
|
1259
1326
|
}
|
|
1260
1327
|
|
|
1261
1328
|
async function gateReleaseDone(o: GateCtx): Promise<RunResult> {
|
|
@@ -1711,7 +1778,20 @@ async function gateInit(o: GateCtx): Promise<RunResult> {
|
|
|
1711
1778
|
async function gateStart(o: GateCtx): Promise<RunResult> {
|
|
1712
1779
|
const { root, sess, cfg, rest, flag, slugArg } = o;
|
|
1713
1780
|
if (!slugArg || !validSlug(slugArg)) return { text: "usage: flow start <slug> [--ui] [--patch|--docs] [--merge=squash|merge|rebase|any] (slug: lowercase, dashes); --ui/--patch/--docs are operator-granted — ask the operator in chat, then add --confirmed", isError: true };
|
|
1714
|
-
if (existsSync(featDir(root, slugArg)))
|
|
1781
|
+
if (existsSync(featDir(root, slugArg))) {
|
|
1782
|
+
// --ui on the plan-stage feature this session drives: the operator asked for mockups after the start,
|
|
1783
|
+
// so turn the mockup gate on instead of refusing — a UI feature left at ui=false skips the mockup
|
|
1784
|
+
// proof at approve and every (ui) checklist item (lettuce rail-ui-fixes shipped 20 ungated mockups)
|
|
1785
|
+
const existing = readState(root, slugArg);
|
|
1786
|
+
if (flag("ui") && existing && sess.slug === slugArg) {
|
|
1787
|
+
if (!flag("confirmed")) return { text: "--ui is operator-granted — it adds a rendered-mockup requirement to the plan gate; ask the operator, then re-run with --confirmed", isError: true };
|
|
1788
|
+
if (existing.ui) return { text: `feature ${slugArg} already has the ui flag` };
|
|
1789
|
+
if (existing.stage !== "plan") return { text: `feature ${slugArg} is at ${existing.stage} — the ui flag can be set only at plan (the mockup gate is approve's); render the screens anyway and say so in the verify report`, isError: true };
|
|
1790
|
+
writeState(root, { ...existing, ui: true });
|
|
1791
|
+
return { text: `ui flag set on existing feature ${slugArg} (plan stage): the approve gate now requires rendered mockups under plan/mockups/ (${cfg.mockupGlobs.join(", ")}), each embedded in plan.md, and the (ui) checklist items apply` };
|
|
1792
|
+
}
|
|
1793
|
+
return { text: `feature ${slugArg} already exists — flow use ${slugArg} to resume it${existing?.stage === "plan" ? `; to add the mockup gate at plan, run flow start ${slugArg} --ui --confirmed from the session bound to it` : ""}`, isError: true };
|
|
1794
|
+
}
|
|
1715
1795
|
// relaxed modes are operator-granted: --confirmed anchors a literal chat grant, same convention as the gate verbs
|
|
1716
1796
|
if (flag("patch") && flag("docs")) return { text: "--patch and --docs are exclusive — ask the operator which mode they grant", isError: true };
|
|
1717
1797
|
const mode = flag("patch") ? "patch" : flag("docs") ? "docs" : null;
|
|
@@ -1775,7 +1855,9 @@ async function gateApprove(o: GateCtx): Promise<RunResult> {
|
|
|
1775
1855
|
// the embed proofs read the plan document itself: a render that exists on disk but is not
|
|
1776
1856
|
// embedded in plan.md is one the operator would never be shown
|
|
1777
1857
|
const planMd = path.join(planDir, "plan.md");
|
|
1778
|
-
const
|
|
1858
|
+
const planFiles = listFiles(planDir);
|
|
1859
|
+
const mockupHtml = planFiles.filter((f) => /^mockups\/.+\.html?$/i.test(f)).map((f) => ({ file: f, html: readFileSync(path.join(planDir, f), "utf8") }));
|
|
1860
|
+
const errs = approveGate(state!, cfg, planFiles, existsSync(planMd) ? readFileSync(planMd, "utf8") : undefined, foreignWorktreeLinks(dfDir(root), state!.slug, mockupHtml));
|
|
1779
1861
|
if (errs.length) return { text: `plan gate FAILED:\n- ${errs.join("\n- ")}`, isError: true };
|
|
1780
1862
|
const planItems = applicableItems(cfg, state!, "plan");
|
|
1781
1863
|
const audit = flag("confirmed") ? " (confirmed by operator instruction)" : "";
|
|
@@ -1876,6 +1958,7 @@ async function gateReflect(o: GateCtx): Promise<RunResult> {
|
|
|
1876
1958
|
if (words.length === 1 && words[0] === "tidy") return reflectTidy(root);
|
|
1877
1959
|
if (words.length === 1 && words[0] === "list") return await reflectList(root);
|
|
1878
1960
|
if (words[0] === "move") return reflectMoveNote(root, words.slice(1), forced);
|
|
1961
|
+
if (words[0] === "done") return reflectDoneNote(root, sess, words.slice(1));
|
|
1879
1962
|
if (words.length) return await reflectNote(root, sess, words, forced);
|
|
1880
1963
|
const self = pluginVersion(import.meta.dirname);
|
|
1881
1964
|
const upstream = await pluginUpstream(root);
|
|
@@ -2092,6 +2175,43 @@ const workerSessions = new Set<string>();
|
|
|
2092
2175
|
/** Toolset per worker op: an implementer codes, a reviewer reads and runs commands only. */
|
|
2093
2176
|
const WORKER_TOOLS: Record<WorkerOp, string[]> = { implement: ["read", "bash", "edit", "write"], review: ["read", "bash"], reflect: ["read", "bash"] };
|
|
2094
2177
|
|
|
2178
|
+
/** Test-only timer override: the smoke suite drives the steer, the hard cut and the salvage grace in ms. */
|
|
2179
|
+
export const workerTiming: { softMs?: number; hardMs?: number; graceMs?: number } = {};
|
|
2180
|
+
|
|
2181
|
+
/** The upstream dev-flow repo's issues in every state, for the reflect brief's dedupe — prefetched so
|
|
2182
|
+
* the worker reads a list instead of looping gh searches. null = gh could not answer (the brief then
|
|
2183
|
+
* falls back to the search recipe). */
|
|
2184
|
+
async function upstreamIssueList(root: string, repo: string): Promise<{ number: number; title: string; state: string }[] | null> {
|
|
2185
|
+
if (!repo || process.env.DEV_FLOW_NO_ISSUES) return null;
|
|
2186
|
+
const r = await sh(`gh issue list --repo ${sq(repo)} --state all --json number,title,state --limit 200`, root, 15_000);
|
|
2187
|
+
if (!r.ok) return null;
|
|
2188
|
+
try {
|
|
2189
|
+
const a = JSON.parse(r.out) as { number?: unknown; title?: unknown; state?: unknown }[];
|
|
2190
|
+
return Array.isArray(a) ? a.filter((i) => Number.isInteger(i?.number)).map((i) => ({ number: Number(i.number), title: String(i.title ?? ""), state: String(i.state ?? "") })) : null;
|
|
2191
|
+
} catch {
|
|
2192
|
+
return null;
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
/** Seam: the smoke suite stubs the prefetch instead of calling gh against the real upstream. */
|
|
2197
|
+
export const reflectSeams = { upstreamIssues: upstreamIssueList };
|
|
2198
|
+
|
|
2199
|
+
/** Build the reflect worker's transcript digests in the feature's scratch dir (driver first). A
|
|
2200
|
+
* transcript that cannot be read is skipped — the brief still names the raw file. */
|
|
2201
|
+
function writeTranscriptDigests(root: string, slug: string, files: string[]): { transcript: string; digest: string }[] {
|
|
2202
|
+
const dir = path.join(featureTmpDir(dfDir(root), slug), "reflect");
|
|
2203
|
+
const out: { transcript: string; digest: string }[] = [];
|
|
2204
|
+
for (const f of files) {
|
|
2205
|
+
try {
|
|
2206
|
+
mkdirSync(dir, { recursive: true });
|
|
2207
|
+
const digest = path.join(dir, `${path.basename(f, ".jsonl")}.digest.txt`);
|
|
2208
|
+
writeFileSync(digest, digestTranscript(readFileSync(f, "utf8")));
|
|
2209
|
+
out.push({ transcript: f, digest });
|
|
2210
|
+
} catch { /* unreadable transcript: the raw path stays in the brief */ }
|
|
2211
|
+
}
|
|
2212
|
+
return out;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2095
2215
|
/** Line 1 of every pi session file in `dir` — the header that names a worker's parent session. A
|
|
2096
2216
|
* file is read up to its first newline only (transcripts grow large); unreadable files are skipped. */
|
|
2097
2217
|
function sessionHeaders(dir: string | undefined): SessionHeaderInfo[] {
|
|
@@ -2467,15 +2587,20 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2467
2587
|
? await (async () => {
|
|
2468
2588
|
const items = readReflections(root);
|
|
2469
2589
|
const fold = await foldView(root, items);
|
|
2590
|
+
const upstream = await pluginUpstream(root);
|
|
2591
|
+
const children = lineage.file ? childSessionFiles(lineage.file, sessionHeaders(lineage.dir)) : [];
|
|
2470
2592
|
return buildReflectBrief({
|
|
2471
2593
|
slug: st.slug, root, today: now().slice(0, 10),
|
|
2472
2594
|
driverFile: lineage.file ?? null,
|
|
2473
|
-
children
|
|
2595
|
+
children,
|
|
2596
|
+
digests: lineage.file ? writeTranscriptDigests(root, st.slug, [lineage.file, ...children.map((c) => c.file)]) : [],
|
|
2597
|
+
upstreamIssues: (await reflectSeams.upstreamIssues(root, upstream)) ?? undefined,
|
|
2598
|
+
budgetMin,
|
|
2474
2599
|
reflectionsFile: path.join(dfDir(root), "reflections.md"),
|
|
2475
2600
|
items,
|
|
2476
2601
|
projectMd: path.join(dfDir(root), "project.md"),
|
|
2477
2602
|
version: pluginVersion(import.meta.dirname).version,
|
|
2478
|
-
upstream
|
|
2603
|
+
upstream,
|
|
2479
2604
|
selfRepo,
|
|
2480
2605
|
projectIssues: fold.state === "ok" && !selfRepo ? { repo: fold.slug, issues: fold.result.upstreamOnly.map((i) => ({ number: i.number, title: i.title })) } : undefined,
|
|
2481
2606
|
note: String(params.note ?? ""),
|
|
@@ -2483,7 +2608,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2483
2608
|
})()
|
|
2484
2609
|
: buildWorkerBrief({
|
|
2485
2610
|
op: wop, slug: st.slug, workDir: work,
|
|
2486
|
-
planFile: path.join(featDir(root, st.slug), "plan", "plan.md"),
|
|
2611
|
+
planFile: ((f) => (existsSync(f) ? f : null))(path.join(featDir(root, st.slug), "plan", "plan.md")),
|
|
2487
2612
|
defaultBranch: cfg.defaultBranch,
|
|
2488
2613
|
commits: await git(`git log --oneline ${sq(cfg.defaultBranch)}..HEAD`),
|
|
2489
2614
|
status: await git("git status --short"),
|
|
@@ -2495,11 +2620,20 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2495
2620
|
const subagent = !lineage.id || !lineage.file ? undefined : { parentId: lineage.id, parentFile: lineage.file, toolCallId: id, profile: `flow-${wop}`, description: name, task: brief };
|
|
2496
2621
|
let child: AgentSession | undefined;
|
|
2497
2622
|
let timedOut = false;
|
|
2623
|
+
let steered = false;
|
|
2624
|
+
let salvaged = false;
|
|
2498
2625
|
let crash: string | null = null;
|
|
2499
2626
|
let nudges = 0;
|
|
2500
2627
|
let report = parseWorkerReport("");
|
|
2501
2628
|
const abortChild = () => void Promise.resolve(child?.abort()).catch(() => {});
|
|
2502
|
-
const
|
|
2629
|
+
const hardMs = workerTiming.hardMs ?? budgetMin * 60_000;
|
|
2630
|
+
// grace before the cliff (gh#142): steered at 75% to wrap up, so a long run hands back a REPORT
|
|
2631
|
+
// instead of being cut mid-thought — the hard timer stays the backstop
|
|
2632
|
+
const softTimer = setTimeout(() => {
|
|
2633
|
+
steered = true;
|
|
2634
|
+
try { void Promise.resolve(child?.steer(workerSteer(wop, budgetMin))).catch(() => {}); } catch { /* the hard cut follows */ }
|
|
2635
|
+
}, workerTiming.softMs ?? Math.round(hardMs * WORKER_STEER_AT));
|
|
2636
|
+
const timer = setTimeout(() => { timedOut = true; abortChild(); }, hardMs);
|
|
2503
2637
|
signal?.addEventListener("abort", abortChild);
|
|
2504
2638
|
let unsub: (() => void) | undefined;
|
|
2505
2639
|
let releaseLive: (status: string) => void = () => {};
|
|
@@ -2524,9 +2658,24 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2524
2658
|
await child.prompt(wop === "implement" ? WORKER_NUDGE : WORKER_NUDGE_READONLY);
|
|
2525
2659
|
report = parseWorkerReport(child.getLastAssistantText() ?? "");
|
|
2526
2660
|
}
|
|
2661
|
+
// cut at the budget without a REPORT: one short, tool-less turn to hand back what it found —
|
|
2662
|
+
// an aborted reflection otherwise loses every finding it had already made
|
|
2663
|
+
if (!report.found && timedOut && !signal?.aborted) {
|
|
2664
|
+
salvaged = true;
|
|
2665
|
+
const grace = setTimeout(abortChild, workerTiming.graceMs ?? WORKER_SALVAGE_MS);
|
|
2666
|
+
try {
|
|
2667
|
+
await child.prompt(WORKER_SALVAGE);
|
|
2668
|
+
report = parseWorkerReport(child.getLastAssistantText() ?? "");
|
|
2669
|
+
} catch {
|
|
2670
|
+
/* a failed salvage is still an interrupted run, not a crash */
|
|
2671
|
+
} finally {
|
|
2672
|
+
clearTimeout(grace);
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2527
2675
|
} catch (e) {
|
|
2528
2676
|
crash = e instanceof Error ? e.message : String(e);
|
|
2529
2677
|
} finally {
|
|
2678
|
+
clearTimeout(softTimer);
|
|
2530
2679
|
clearTimeout(timer);
|
|
2531
2680
|
signal?.removeEventListener("abort", abortChild);
|
|
2532
2681
|
unsub?.();
|
|
@@ -2536,14 +2685,20 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2536
2685
|
const headAfter = (await git("git rev-parse HEAD")).trim();
|
|
2537
2686
|
const newCommits = headBefore && headAfter && headBefore !== headAfter ? await git(`git log --oneline ${sq(headBefore)}..HEAD`) : "";
|
|
2538
2687
|
const dirty = (await git("git status --short")).trim();
|
|
2539
|
-
const outcome = crash
|
|
2688
|
+
const outcome = crash
|
|
2689
|
+
? `crashed: ${crash}`
|
|
2690
|
+
: timedOut
|
|
2691
|
+
? `interrupted at the ${budgetMin}-min budget${steered ? " (steered to wrap up at " + Math.round(WORKER_STEER_AT * 100) + "%)" : ""}${report.found ? " — REPORT salvaged after the cut, treat it as partial" : salvaged ? " — the salvage prompt got no REPORT either" : ""}`
|
|
2692
|
+
: report.found
|
|
2693
|
+
? `reported${steered ? " (after the wrap-up steer)" : ""}`
|
|
2694
|
+
: `ended without REPORT after ${nudges} nudge(s)`;
|
|
2540
2695
|
// the terminal entry is what settles the Agents menu row (a persisted `running` the host
|
|
2541
2696
|
// cannot prove live displays as `interrupted`); a no-REPORT run is a failure, not a ✓.
|
|
2542
2697
|
if (subagent) {
|
|
2543
2698
|
const doneAt = now();
|
|
2544
2699
|
const final = crash
|
|
2545
2700
|
? { version: 1, status: "failed", completedAt: doneAt, error: crash }
|
|
2546
|
-
:
|
|
2701
|
+
: signal?.aborted || (timedOut && !report.found)
|
|
2547
2702
|
? { version: 1, status: "aborted", completedAt: doneAt }
|
|
2548
2703
|
: report.found
|
|
2549
2704
|
? { version: 1, status: "completed", completedAt: doneAt, result: report.body }
|
|
@@ -2554,7 +2709,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2554
2709
|
}
|
|
2555
2710
|
releaseLive("failed"); // idempotent guard: a throw between claim and result must not leave a live row
|
|
2556
2711
|
try { if (child) workerSessions.delete(child.sessionManager.getSessionId()); } catch { /* id-less session: nothing was registered */ }
|
|
2557
|
-
try { child?.setSessionName(`${report.found && !crash && !
|
|
2712
|
+
try { child?.setSessionName(`${report.found && !crash && !signal?.aborted ? (timedOut ? "◐" : "✓") : "✗"} ${name}${report.verdict ? ` · ${report.verdict}` : ""}`); } catch { /* visibility only */ }
|
|
2558
2713
|
const parts = [`${glyph} ${wop} worker ${outcome} (${Math.round((Date.now() - started) / 60_000)} min)`];
|
|
2559
2714
|
let reflected: ReturnType<typeof parseReflectReport> | null = null;
|
|
2560
2715
|
if (wop === "reflect") {
|
|
@@ -2650,7 +2805,9 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2650
2805
|
const headers = auth.headers ? (Object.fromEntries(Object.entries(auth.headers).filter(([, v]) => v !== null)) as Record<string, string>) : undefined;
|
|
2651
2806
|
// same function pi itself calls — same split-turn merge, file lists and prompts, just flow-aware instructions
|
|
2652
2807
|
const result = await compactionTakeover.run(event.preparation, model, auth.apiKey, headers, flowCompactInstructions(st!), event.signal, undefined, undefined, auth.env);
|
|
2653
|
-
|
|
2808
|
+
// re-read: the summarize call took a while, and the block must state the disk as it is now
|
|
2809
|
+
const now = readState(root, st!.slug) ?? st!;
|
|
2810
|
+
return { compaction: { ...result, summary: result.summary + compactionStateBlock(now, loadProject(dfDir(root)).cfg) } };
|
|
2654
2811
|
} catch {
|
|
2655
2812
|
return undefined; // pi's default compaction proceeds untouched
|
|
2656
2813
|
} finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.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": [
|
|
@@ -14,7 +14,9 @@ the session context goes with it. Run the end-of-session reflection now:
|
|
|
14
14
|
**docs** (fix only in `project.md` → docs flow), **code** (fix in this
|
|
15
15
|
project's code, maybe the playbook too → patch flow) or **plugin** (dev-flow
|
|
16
16
|
itself → GitHub issue upstream), with a **fold** or **drop** recommendation.
|
|
17
|
-
`note` = anything the operator said about friction this session.
|
|
17
|
+
`note` = anything the operator said about friction this session. The tool
|
|
18
|
+
prebuilds a line-tagged digest of every transcript and prefetches the
|
|
19
|
+
upstream issues, so the worker reads instead of dumping and searching. If the
|
|
18
20
|
worker fails, run the review inline (bare `flow reflect` prints the protocol).
|
|
19
21
|
2. Show the operator the list with your recommendation per item and ask
|
|
20
22
|
**fold or drop** for each (`fold 1,3 drop 2` is a fine answer) — then stop.
|
|
@@ -17,14 +17,18 @@ feature).
|
|
|
17
17
|
the end faces review blind and is not crash-safe. The gate enforces the
|
|
18
18
|
habit: `flow verify` refuses while the branch holds **no commit** (checks
|
|
19
19
|
describe the working tree, so nothing committed means nothing reviewed was
|
|
20
|
-
ever recorded
|
|
20
|
+
ever recorded; a **release-only flow** — a versioned project whose code is
|
|
21
|
+
already on main, unreleased since the last tag — passes with an empty branch,
|
|
22
|
+
and its bump is the pre-release commit) and every verify line reports
|
|
21
23
|
`commits: N ahead of <default>, M uncommitted path(s)` — uncommitted paths
|
|
22
24
|
never block verify, they are what the operator sees they are approving.
|
|
23
25
|
2. Write tests as you go (project framework: the `test` key / `flow-check`
|
|
24
26
|
blocks).
|
|
25
27
|
Throwaway scripts and scratch output go in `$TMPDIR` (or `mktemp`), not a
|
|
26
28
|
hard-coded `/tmp/...`: in a bound session, and in every command a gate runs,
|
|
27
|
-
it is `.dev-flow/<slug>/tmp/`, and finish removes it with the feature.
|
|
29
|
+
it is `.dev-flow/<slug>/tmp/`, and finish removes it with the feature. The
|
|
30
|
+
same commands get that dir as `GIT_CEILING_DIRECTORIES`, so a test fixture
|
|
31
|
+
made under it is not inside the checkout (git does not climb out of it).
|
|
28
32
|
3. `flow check` runs every tier-1 check (test, health, named `flow-check`
|
|
29
33
|
blocks) and records each against a fingerprint of the worktree; any later
|
|
30
34
|
worktree change makes them stale — verify reruns stale checks itself.
|
|
@@ -111,6 +115,10 @@ resending the same note.
|
|
|
111
115
|
- One worker at a time per session. The worker holds no flow tool, so gates
|
|
112
116
|
and checkpoints stay with you. Its transcript nests under this session in
|
|
113
117
|
pi's picker.
|
|
118
|
+
- Budget (`budgetMin`; default 60 implement, 30 review, 20 reflect): at 75% the
|
|
119
|
+
worker is steered to wrap up and report. A worker cut at the budget is asked
|
|
120
|
+
once, with no tools, for its REPORT, so what it found comes back marked
|
|
121
|
+
partial instead of being lost.
|
|
114
122
|
|
|
115
123
|
`flow verify` re-runs build, runs the `dev` deploy when configured (the
|
|
116
124
|
operator reviews the running app; the gate **prints what it ran** —
|
|
@@ -22,7 +22,12 @@
|
|
|
22
22
|
commits fall out of the worktree's base (push them or re-plan).
|
|
23
23
|
4. **UI flag set?** Mockups live in `plan/mockups/`, one HTML per screen/state
|
|
24
24
|
(`<screen>.html`), linking the project's real stylesheet and class names
|
|
25
|
-
where they exist (relative links work from `.dev-flow/`).
|
|
25
|
+
where they exist (relative links work from `.dev-flow/`). At plan the
|
|
26
|
+
feature has **no worktree yet** — link the main checkout's stylesheet
|
|
27
|
+
(`../../../../<path>` from `plan/mockups/`), never another feature's
|
|
28
|
+
worktree (the approve gate refuses it: that branch drifts and is removed at
|
|
29
|
+
its finish); after approve, re-render against this feature's worktree any
|
|
30
|
+
mockup you keep using. Every mockup
|
|
26
31
|
must be **rendered** — an unrendered mockup is not a mockup:
|
|
27
32
|
- Headless chromium: PATH `chromium`/`chromium-browser`/`google-chrome`,
|
|
28
33
|
else playwright's
|
|
@@ -25,7 +25,9 @@ Gate flags are ignored (`flow reflect "<note>" --confirmed` queues the note
|
|
|
25
25
|
alone). With no flag the wording guesses (plugin-shaped → the upstream recipe,
|
|
26
26
|
otherwise `## playbook`) and the printed line says why; `flow reflect list`
|
|
27
27
|
numbers the queue and `flow reflect move <n> --playbook|--code` re-files an
|
|
28
|
-
item — never hand-retype it.
|
|
28
|
+
item — never hand-retype it. `flow reflect done <n> ["<what fixed it>"]` checks
|
|
29
|
+
an item off once a flow has fixed it (`— fixed: <date> <slug> — <what>`), so
|
|
30
|
+
doctor stops re-reporting it. A legacy `## plugin` row from an older dev-flow is
|
|
29
31
|
flagged by `flow doctor` / `reflect list`: file it upstream and check it off
|
|
30
32
|
`— filed: gh#NNN`. For a note to chase **now**: `flow doctor "<observation>"`
|
|
31
33
|
prints an investigation brief without queueing.
|
|
@@ -50,9 +52,10 @@ prints an investigation brief without queueing.
|
|
|
50
52
|
- Plain `flow doctor` reviews the open items and **routes** each — `## playbook`
|
|
51
53
|
→ docs flow, `## code` → patch flow. To fold items in on the operator's word:
|
|
52
54
|
investigate, propose the fix, get confirmation, open the routed flow and apply
|
|
53
|
-
it there — project.md is editable only in a docs/patch worktree.
|
|
54
|
-
off
|
|
55
|
-
|
|
55
|
+
it there — project.md is editable only in a docs/patch worktree. Once it is
|
|
56
|
+
merged, check the item off with `flow reflect done <n> "<what>"` (or by hand in
|
|
57
|
+
the gitignored `.dev-flow/reflections.md`: `- [x]` and a `— folded: <what>` or
|
|
58
|
+
`— fixed: <what>` note).
|
|
56
59
|
- **Open GitHub issues fold into the view** when the repo has a GitHub remote: `flow doctor` and
|
|
57
60
|
`flow reflect list` list them under the local queue (read-time fold — issues are never imported,
|
|
58
61
|
each item keeps one home). A local row an open issue already covers carries `⟷ gh#NNN` — fold it
|
|
@@ -27,7 +27,9 @@ writing.
|
|
|
27
27
|
|
|
28
28
|
`flow start <slug> [--ui --confirmed]` — `--ui` adds a rendered-mockup gate to plan, so it is
|
|
29
29
|
operator-granted like `--patch`/`--docs`: propose it when screens change, start with it only on their word;
|
|
30
|
-
slug lowercase words-dashed; check `flow status` for an active feature first.
|
|
30
|
+
slug lowercase words-dashed; check `flow status` for an active feature first. Screens turned out to
|
|
31
|
+
change after a plain start (the operator asks for mockups)? While the feature is still at plan,
|
|
32
|
+
`flow start <slug> --ui --confirmed` from its session switches the mockup gate on; past plan it refuses.
|
|
31
33
|
|
|
32
34
|
`flow start` **preflights** before it creates anything: it warns when this session runs an older dev-flow
|
|
33
35
|
build than the checkout (`/reload` before trusting gate output), prints the playbook gaps `flow doctor`
|
package/src/core.ts
CHANGED
|
@@ -47,14 +47,18 @@ export interface FlowState {
|
|
|
47
47
|
forgeReleaseSkipped?: string; // a gh/glab release create that failed: release-done says so, finish names it so the missing forge release cannot slip past (#63)
|
|
48
48
|
staleBuild?: string; // release ran under an older dev-flow than the checkout by operator choice ("<loaded> (checkout <disk>)"); release-done repeats the acknowledgement
|
|
49
49
|
pendingAsk?: string; // the checkpoint word a gate asked for and has not been given ("Approve?", "Verified?", …) — presentation only (💬 in the footer), it never gates
|
|
50
|
+
releaseOnly?: boolean; // verify found nothing on the branch but unreleased work on main: this flow only cuts the version (#161)
|
|
51
|
+
verifiedHead?: string; // HEAD the operator's Verified? was given over — release names commits after it, so the word is not recorded as the verdict for a tree nobody looked at (#162)
|
|
50
52
|
reflectedAt?: string; // a flow_stage reflect worker reported for this flow — finish names a missing one (advisory, never a block)
|
|
51
53
|
aborted?: string; // flow abort on a feature whose worktree exists: the state is a deliberate abandoned-feature record (gh#138) — the doctor's git-consistency sweep must never flag its hand-removed worktree as drift
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
/** Tier-2 item: operator prose; uiOnly items ("(ui)" in project.md) apply only to --ui features
|
|
56
|
+
/** Tier-2 item: operator prose; uiOnly items ("(ui)" in project.md) apply only to --ui features;
|
|
57
|
+
* versionedOnly items ("(versioned)") presuppose a bump/tag and stand down on a --no-version flow (#166). */
|
|
55
58
|
export interface ChecklistItem {
|
|
56
59
|
text: string;
|
|
57
60
|
uiOnly: boolean;
|
|
61
|
+
versionedOnly?: boolean;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
export interface Commands {
|
|
@@ -238,7 +242,32 @@ const IMG_EXT = /\.(?:png|jpe?g|webp|gif)$/i;
|
|
|
238
242
|
* planDoc is the text of plan/plan.md (undefined = absent) — the embed proofs read the plan
|
|
239
243
|
* document itself. Before it, the gate checked only that *a* *.md and *a* *.png existed, which
|
|
240
244
|
* let a pre-plan/direction file with unembedded screenshots walk through Approve. */
|
|
241
|
-
|
|
245
|
+
/** Links in a feature's mockup HTML that resolve into ANOTHER feature's worktree, as `file: href`.
|
|
246
|
+
* At plan this feature has no worktree yet, and a sibling's is a tempting stand-in for "the branch's
|
|
247
|
+
* stylesheet" — but it is a different branch that drifts or vanishes when that feature finishes, so
|
|
248
|
+
* every later re-render silently describes someone else's styles (lettuce rail-ui-fixes linked
|
|
249
|
+
* status-and-loading's). `mockups` are paths relative to plan/ with their HTML; dfDir is absolute. */
|
|
250
|
+
export function foreignWorktreeLinks(dfDir: string, slug: string, mockups: { file: string; html: string }[]): string[] {
|
|
251
|
+
const out: string[] = [];
|
|
252
|
+
const base = path.join(dfDir, slug, "plan");
|
|
253
|
+
for (const m of mockups) {
|
|
254
|
+
const refs = [
|
|
255
|
+
...m.html.matchAll(/\b(?:href|src)\s*=\s*["']([^"']+)["']/gi),
|
|
256
|
+
...m.html.matchAll(/@import\s+(?:url\(\s*)?["']?([^"')\s;]+)/gi),
|
|
257
|
+
].map((x) => x[1]);
|
|
258
|
+
for (const ref of refs) {
|
|
259
|
+
if (/^(?:https?:|data:|#|mailto:)/i.test(ref)) continue;
|
|
260
|
+
const p = ref.replace(/^file:\/\//i, "").split(/[?#]/)[0];
|
|
261
|
+
const abs = path.isAbsolute(p) ? path.normalize(p) : path.resolve(path.dirname(path.join(base, m.file)), p);
|
|
262
|
+
const rel = path.relative(dfDir, abs);
|
|
263
|
+
const owner = /^([^/\\]+)[/\\]worktree(?:[/\\]|$)/.exec(rel)?.[1];
|
|
264
|
+
if (owner && owner !== slug && !rel.startsWith("..")) out.push(`${m.file}: ${ref}`);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return out;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function approveGate(state: FlowState, cfg: Config, planFiles: string[], planDoc?: string, foreignLinks: string[] = []): string[] {
|
|
242
271
|
const errs: string[] = [];
|
|
243
272
|
if (state.stage !== "plan") errs.push(`stage is "${state.stage}", approval only applies to "plan"`);
|
|
244
273
|
if (!state.patch && !state.docs && !planFiles.includes("plan.md"))
|
|
@@ -260,6 +289,8 @@ export function approveGate(state: FlowState, cfg: Config, planFiles: string[],
|
|
|
260
289
|
});
|
|
261
290
|
if (unrendered.length) errs.push(`mockups without an embedded render — ${unrendered.join(", ")} (render each screen and name the shot after it: <screen>-<width>.png)`);
|
|
262
291
|
}
|
|
292
|
+
if (foreignLinks.length)
|
|
293
|
+
errs.push(`mockups link another feature's worktree — ${foreignLinks.join(", ")}: that branch drifts and is removed at its finish; at plan link the main checkout's stylesheet (this feature's worktree does not exist until approve) and re-render`);
|
|
263
294
|
return errs;
|
|
264
295
|
}
|
|
265
296
|
|
|
@@ -270,15 +301,29 @@ export function approveGate(state: FlowState, cfg: Config, planFiles: string[],
|
|
|
270
301
|
export interface BranchState {
|
|
271
302
|
commitsAhead: number | null;
|
|
272
303
|
uncommitted: number;
|
|
304
|
+
/** Only measured when nothing is committed on a versioned project: commits on the default branch since
|
|
305
|
+
* the newest version tag (every commit when none is tagged yet), and that tag. > 0 = a release-only
|
|
306
|
+
* flow — main carries the code, the flow only cuts the version (#161). null = git could not answer. */
|
|
307
|
+
unreleased?: { count: number | null; since: string | null };
|
|
273
308
|
}
|
|
274
309
|
|
|
310
|
+
/** A release-only flow: nothing on the branch, but the default branch holds unreleased work to version (#161). */
|
|
311
|
+
export const isReleaseOnly = (cfg: Config, branch?: BranchState | null): boolean =>
|
|
312
|
+
!!cfg.versioning.file && branch?.commitsAhead === 0 && (branch.unreleased?.count ?? 0) > 0;
|
|
313
|
+
|
|
275
314
|
/** Gate: implement → release. Tier 1: every parsed check green; tier 2: checklist confirmed;
|
|
276
315
|
* the branch must hold at least one commit — checks describe the working tree, so with nothing
|
|
277
316
|
* committed the operator is asked to approve state no gate has ever seen. */
|
|
278
317
|
export function verifyGate(state: FlowState, cfg: Config, branch?: BranchState | null): string[] {
|
|
279
318
|
const errs: string[] = [];
|
|
280
319
|
if (state.stage !== "implement") errs.push(`stage is "${state.stage}", verify only applies to "implement"`);
|
|
281
|
-
|
|
320
|
+
// a release-only flow (#161) proves main's committed tree here; its version bump is the pre-release commit
|
|
321
|
+
if (branch && branch.commitsAhead === 0 && !isReleaseOnly(cfg, branch))
|
|
322
|
+
errs.push(
|
|
323
|
+
cfg.versioning.file && branch.unreleased?.count === 0
|
|
324
|
+
? `nothing committed on the feature branch, and ${branch.unreleased.since ? `nothing landed on the default branch since ${branch.unreleased.since}` : "the default branch has nothing to release"} — there is nothing to verify or release`
|
|
325
|
+
: "nothing committed on the feature branch yet — commit as you go, verify proves a committed state",
|
|
326
|
+
);
|
|
282
327
|
if (!state.docs) for (const c of cfg.checkList) if (!state.checks[c.name]?.ok) errs.push(`check "${c.name}" has not passed — run flow check`);
|
|
283
328
|
const pend = checklistPending(cfg, state, "implement");
|
|
284
329
|
if (pend) errs.push(`tier-2 checklist not confirmed (${pend} item(s)) — run flow verify after ticking them off`);
|
|
@@ -301,6 +346,30 @@ export interface ReleasePrep {
|
|
|
301
346
|
changelogBase?: { pending: string[]; source: "tag" | "merge-base" | "none" };
|
|
302
347
|
/** Operator-granted escape from the line-level fold proofs (`flow release --no-fold-check`). */
|
|
303
348
|
noFoldCheck?: boolean;
|
|
349
|
+
/** Conflict-marker lines the branch adds vs its merge base (`file:line: text`) — a hand-resolved merge
|
|
350
|
+
* that kept one ships it otherwise (#164). Undefined = not measured (no merge base). */
|
|
351
|
+
conflictMarkers?: string[];
|
|
352
|
+
/** Operator-granted escape for a branch that adds marker-shaped lines on purpose (`--no-marker-check`). */
|
|
353
|
+
noMarkerCheck?: boolean;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/** Added lines in a unified diff (`git diff -U0 <base>`) that are merge-conflict markers, as
|
|
357
|
+
* `file:line: text`. Only the unambiguous markers count — `<<<<<<<`, `|||||||`, `>>>>>>>` at the line start
|
|
358
|
+
* followed by a space or the end of the line; a bare `=======` is also a markdown heading underline. */
|
|
359
|
+
export function conflictMarkerLines(diff: string): string[] {
|
|
360
|
+
const out: string[] = [];
|
|
361
|
+
let file = "";
|
|
362
|
+
let line = 0;
|
|
363
|
+
for (const l of (diff ?? "").split("\n")) {
|
|
364
|
+
if (l.startsWith("+++ ")) { file = l.slice(4).replace(/^b\//, ""); continue; }
|
|
365
|
+
const h = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(l);
|
|
366
|
+
if (h) { line = Number(h[1]); continue; }
|
|
367
|
+
if (l.startsWith("+")) {
|
|
368
|
+
if (/^(<{7}|\|{7}|>{7})( |$)/.test(l.slice(1))) out.push(`${file}:${line}: ${l.slice(1).slice(0, 80)}`);
|
|
369
|
+
line++;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return out;
|
|
304
373
|
}
|
|
305
374
|
|
|
306
375
|
/** One changelog line as the fold proofs compare it: indentation, bullet style and whitespace runs are
|
|
@@ -386,10 +455,14 @@ export function preReleaseGate(state: FlowState, cfg: Config, prep: ReleasePrep)
|
|
|
386
455
|
if (!state.docs) for (const c of cfg.checkList) if (!state.checks[c.name]?.ok) errs.push(`check "${c.name}" has not passed — run flow check`);
|
|
387
456
|
const pend = checklistPending(cfg, state, "pre-release");
|
|
388
457
|
if (pend) errs.push(`tier-2 checklist not confirmed (${pend} item(s)) — run flow release after ticking them off`);
|
|
458
|
+
if (prep.conflictMarkers?.length && !prep.noMarkerCheck)
|
|
459
|
+
errs.push(`the branch adds ${prep.conflictMarkers.length} merge-conflict marker line(s) — a hand-resolved merge kept them; fix and commit (or, when the lines are meant, re-run with --no-marker-check on the operator's word):\n ${prep.conflictMarkers.slice(0, 5).join("\n ")}${prep.conflictMarkers.length > 5 ? `\n …(${prep.conflictMarkers.length - 5} more)` : ""}`);
|
|
389
460
|
if (state.noVersion) {
|
|
390
461
|
// unversioned flow (operator granted --no-version): no bump, no tag, no forge release —
|
|
391
|
-
// but the merge still owes a changelog line under Unreleased, folded by the next versioned release
|
|
392
|
-
|
|
462
|
+
// but the merge still owes a changelog line under Unreleased, folded by the next versioned release.
|
|
463
|
+
// A --docs flow does not (#163): it changes the playbook/docs, which many projects keep out of a
|
|
464
|
+
// user-facing changelog — an entry it writes is still welcome, just not proven.
|
|
465
|
+
if (cfg.release.changelog && !state.docs) {
|
|
393
466
|
if (!prep.changelog) errs.push(`release.changelog "${cfg.release.changelog}" does not exist — an unversioned release must record its entry there (under Unreleased)`);
|
|
394
467
|
else {
|
|
395
468
|
if (prep.changelogChanged === false) errs.push(`${prep.changelog.file} is unchanged on this branch — an unversioned release must add its entry (under Unreleased)`);
|
|
@@ -448,7 +521,7 @@ export function unreleasedPending(content: string): boolean {
|
|
|
448
521
|
|
|
449
522
|
export function checklistHash(items: ChecklistItem[]): string {
|
|
450
523
|
return createHash("sha1")
|
|
451
|
-
.update(items.map((i) => `${i.uiOnly ? "(ui) " : ""}${i.text}`).join("\n"))
|
|
524
|
+
.update(items.map((i) => `${i.uiOnly ? "(ui) " : ""}${i.versionedOnly ? "(versioned) " : ""}${i.text}`).join("\n"))
|
|
452
525
|
.digest("hex")
|
|
453
526
|
.slice(0, 12);
|
|
454
527
|
}
|
|
@@ -485,7 +558,7 @@ export function freshenChecks(state: FlowState, fp: string | null, keep: (name:
|
|
|
485
558
|
|
|
486
559
|
/** Items that apply to this feature — "(ui)" items only when the UI flag is set. */
|
|
487
560
|
export function applicableItems(cfg: Config, state: FlowState, stage: string): ChecklistItem[] {
|
|
488
|
-
return (cfg.checklist[stage] ?? []).filter((i) => !i.uiOnly || state.ui);
|
|
561
|
+
return (cfg.checklist[stage] ?? []).filter((i) => (!i.uiOnly || state.ui) && (!i.versionedOnly || !state.noVersion));
|
|
489
562
|
}
|
|
490
563
|
|
|
491
564
|
/** Items exist for the stage and current confirmation does not match their hash; returns pending count or 0. */
|
|
@@ -1331,10 +1404,20 @@ export function featureTmpDir(dfDir: string, slug: string): string {
|
|
|
1331
1404
|
return path.join(dfDir, slug, "tmp");
|
|
1332
1405
|
}
|
|
1333
1406
|
|
|
1334
|
-
/** The
|
|
1407
|
+
/** The env every process of a bound feature gets: TMPDIR in the feature's scratch dir, and that dir as a
|
|
1408
|
+
* git ceiling. The scratch dir sits inside the repo, so without the ceiling git walks up out of a
|
|
1409
|
+
* test's mkdtemp fixture and answers with the enclosing checkout — a suite asserting "no repo here"
|
|
1410
|
+
* goes red only under dev-flow (lettuce rail-ui-fixes: a build-info test failed every gate run).
|
|
1411
|
+
* Commands run from the worktree or the main checkout never climb through the scratch dir, so they
|
|
1412
|
+
* are untouched. An inherited ceiling list is kept. */
|
|
1413
|
+
export function featureTmpEnv(dir: string, inherited = process.env.GIT_CEILING_DIRECTORIES): Record<string, string> {
|
|
1414
|
+
return { TMPDIR: dir, GIT_CEILING_DIRECTORIES: inherited ? `${dir}${path.delimiter}${inherited}` : dir };
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
/** The agent's shell command with the feature env (featureTmpEnv) exported (newline-prefixed, the
|
|
1335
1418
|
* shape pi's own commandPrefix uses — the command itself stays byte-for-byte what the guards judged). */
|
|
1336
1419
|
export function withTmpDir(command: string, dir: string): string {
|
|
1337
|
-
return `export TMPDIR=${sq(dir)}\n${command}`;
|
|
1420
|
+
return `export TMPDIR=${sq(dir)} GIT_CEILING_DIRECTORIES=${sq(dir)}\${GIT_CEILING_DIRECTORIES:+:\$GIT_CEILING_DIRECTORIES}\n${command}`;
|
|
1338
1421
|
}
|
|
1339
1422
|
|
|
1340
1423
|
export function inScratchDir(abs: string, repoRoot?: string | null): boolean {
|
|
@@ -1703,6 +1786,20 @@ export function reflectMove(text: string, n: number, section: ReflectSection): s
|
|
|
1703
1786
|
return appendReflection(lines.join("\n"), [section], line.trim());
|
|
1704
1787
|
}
|
|
1705
1788
|
|
|
1789
|
+
/** Check open item `n` (the `flow reflect list` numbering) off: `- [x] … — fixed: <note>` — the convention
|
|
1790
|
+
* doctor reads as closed, so a folded item stops re-nagging (#165). null when there is no item `n`. */
|
|
1791
|
+
export function reflectDone(text: string, n: number, note: string): string | null {
|
|
1792
|
+
const lines = text.split("\n");
|
|
1793
|
+
let seen = 0;
|
|
1794
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1795
|
+
if (!isOpenItem(lines[i])) continue;
|
|
1796
|
+
if (++seen !== n) continue;
|
|
1797
|
+
lines[i] = `${lines[i].replace(/^(\s*)- \[ \] /, "$1- [x] ").trimEnd()} — fixed: ${note.trim()}`;
|
|
1798
|
+
return lines.join("\n");
|
|
1799
|
+
}
|
|
1800
|
+
return null;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1706
1803
|
/** What `flow doctor <note>` prints: the note is an investigation order, not an answer —
|
|
1707
1804
|
* the plugin has no LLM; the agent investigates, the gates confirm, the flow implements. */
|
|
1708
1805
|
export function investigationBrief(note: string, selfRepo: boolean): string[] {
|
|
@@ -1954,6 +2051,24 @@ function mergeHintFor(cfg: Config): string {
|
|
|
1954
2051
|
}
|
|
1955
2052
|
|
|
1956
2053
|
/** What the agent/user should do next, per stage. */
|
|
2054
|
+
/** The block a flow-aware compaction appends to its summary: the flow's state as the disk holds it.
|
|
2055
|
+
* A summarizer merging an older summary can carry a stale stage forward (lettuce rail-ui-fixes: a
|
|
2056
|
+
* pre-release compaction still said "implement, next: flow verify"); this block is written from
|
|
2057
|
+
* state.json, never by the model, and says it outranks the prose above it. */
|
|
2058
|
+
export function compactionStateBlock(state: FlowState, cfg: Config): string {
|
|
2059
|
+
const approvals = Object.keys(state.approvals ?? {});
|
|
2060
|
+
const checks = Object.entries(state.checks ?? {}).map(([k, v]) => `${k}:${v?.ok ? "ok" : "FAILED"}`);
|
|
2061
|
+
return [
|
|
2062
|
+
"",
|
|
2063
|
+
"---",
|
|
2064
|
+
"[dev-flow state on disk — authoritative; where the summary above disagrees, this wins]",
|
|
2065
|
+
`- feature ${state.slug}${state.patch ? " (patch)" : state.docs ? " (docs)" : ""}${state.ui ? " (UI)" : ""} — stage: ${state.stage}${state.branch ? `, branch ${state.branch}` : ""}`,
|
|
2066
|
+
`- approvals recorded: ${approvals.length ? approvals.join(", ") : "none"}`,
|
|
2067
|
+
`- checks: ${checks.length ? checks.join(", ") : "none recorded"}`,
|
|
2068
|
+
`- next: ${nextHint(state, cfg)}`,
|
|
2069
|
+
].join("\n");
|
|
2070
|
+
}
|
|
2071
|
+
|
|
1957
2072
|
export function nextHint(state: FlowState, cfg: Config): string {
|
|
1958
2073
|
switch (state.stage) {
|
|
1959
2074
|
case "plan":
|
|
@@ -1964,6 +2079,8 @@ export function nextHint(state: FlowState, cfg: Config): string {
|
|
|
1964
2079
|
if (state.docs) return `implement in the worktree ${state.worktree} — docs mode runs no project command (no build, no dev deploy, no health probe); tick the tier-2 checklist with the operator, then ask them Verified? in chat and run flow verify --confirmed when they answer`;
|
|
1965
2080
|
return `implement in the worktree ${state.worktree}, add tests, run flow check (tier-1 checks, incl. health with seeded data); tick the tier-2 checklist with the operator, then ask them Verified? in chat and run flow verify --confirmed when they answer — keep the app running when you ask Verified?: the operator reviews the live app; never clean up the test server before the checkpoint is answered (with no dev deploy configured, verify live-re-probes health itself and refuses while nothing is answering)`;
|
|
1966
2081
|
case "pre-release":
|
|
2082
|
+
if (state.docs && (cfg.versioning.file || cfg.release.changelog))
|
|
2083
|
+
return `${cfg.release.review} → fix must-have/should-have → docs flow: it usually ships unversioned — ask the operator; with their word, flow release --no-version needs no bump, no tag and (docs mode) no changelog entry. Shipping it versioned instead:${cfg.release.changelog ? ` prepare ${cfg.release.changelog}` : ""}${cfg.versioning.file ? `${cfg.release.changelog ? " and" : ""} bump version in ${cfg.versioning.file}` : ""}. Then show the operator the PR summary, ask Release? and run flow release`;
|
|
1967
2084
|
return `${cfg.release.review} → fix must-have/should-have → update docs${cfg.release.changelog ? ` → prepare ${cfg.release.changelog} (a heading for the new version, carrying every pending Unreleased line over as it stands)` : ""}${cfg.versioning.file ? ` → bump version in ${cfg.versioning.file}` : ""}, re-run flow check, then show the operator the PR summary, version and changelog, ask Release? and run flow release`;
|
|
1968
2085
|
case "release":
|
|
1969
2086
|
return state.approvals.release
|
|
@@ -2085,7 +2202,8 @@ export interface WorkerBriefInput {
|
|
|
2085
2202
|
op: Exclude<WorkerOp, "reflect">;
|
|
2086
2203
|
slug: string;
|
|
2087
2204
|
workDir: string;
|
|
2088
|
-
|
|
2205
|
+
/** null = no plan file on disk (a --docs / --patch flow needs none) — the brief says so instead of sending the worker after an ENOENT */
|
|
2206
|
+
planFile: string | null;
|
|
2089
2207
|
defaultBranch: string;
|
|
2090
2208
|
commits: string; // `git log --oneline <base>..HEAD`
|
|
2091
2209
|
status: string; // `git status --short`
|
|
@@ -2102,7 +2220,9 @@ export function buildWorkerBrief(o: WorkerBriefInput): string {
|
|
|
2102
2220
|
"",
|
|
2103
2221
|
"## Facts",
|
|
2104
2222
|
`- Worktree (your cwd; work only here): ${o.workDir}`,
|
|
2105
|
-
|
|
2223
|
+
o.planFile
|
|
2224
|
+
? `- Approved plan (read it first; it is outside the worktree): ${o.planFile}`
|
|
2225
|
+
: "- Plan: none — this flow (--docs / --patch) has no plan file by design; judge the work against the task below and the commits",
|
|
2106
2226
|
`- Branch base: ${o.defaultBranch}`,
|
|
2107
2227
|
`- Commits on the branch so far:\n${o.commits.trim() ? o.commits.trim().split("\n").map((l) => ` ${l}`).join("\n") : " (none)"}`,
|
|
2108
2228
|
`- Uncommitted now: ${o.status.trim() ? `\n${o.status.trim().split("\n").map((l) => ` ${l}`).join("\n")}` : "clean"}`,
|
|
@@ -2118,12 +2238,17 @@ export function buildWorkerBrief(o: WorkerBriefInput): string {
|
|
|
2118
2238
|
? [
|
|
2119
2239
|
"## Contract",
|
|
2120
2240
|
"- Use the edit/write tools for source changes. Commit as you go on the feature branch (small, meaningful commits).",
|
|
2241
|
+
...(o.status.trim()
|
|
2242
|
+
? [
|
|
2243
|
+
"- The uncommitted paths above are the driving session's work in progress, not yours: never stage or commit them. Commit only your own paths by name (`git add <paths>` then `git commit -m … -- <paths>`); never `git add -A`, `git add .` or `git commit -a`. Check `git diff --cached --name-only` before every commit.",
|
|
2244
|
+
]
|
|
2245
|
+
: []),
|
|
2121
2246
|
"- Do not stop to narrate — keep working until the slice is done or you are blocked.",
|
|
2122
2247
|
"- Finish with a final message whose last section starts with a line `REPORT` followed by: done, commits, open items, risks.",
|
|
2123
2248
|
]
|
|
2124
2249
|
: [
|
|
2125
2250
|
"## Contract",
|
|
2126
|
-
|
|
2251
|
+
`- Check, don't fix: read ${o.planFile ? "the plan" : "the task"}, the diff (\`git diff ${o.defaultBranch}...HEAD\`) and the code; run the checks and any probe that proves a claim. Change no files, make no commits.`,
|
|
2127
2252
|
"- Look for correctness bugs, claims in docs/changelog the code does not back, missing tests for risky paths, and plan items not delivered.",
|
|
2128
2253
|
"- Finish with a final message whose last section starts with a line `REPORT` followed by: `verdict: PASS` or `verdict: FAIL`, then findings (most severe first, each with file:line and how you proved it).",
|
|
2129
2254
|
];
|
|
@@ -2149,8 +2274,107 @@ export const WORKER_NUDGE = "You stopped before finishing and without the REPORT
|
|
|
2149
2274
|
/** The nudge a read-only worker (review, reflect) gets — it has nothing to commit. */
|
|
2150
2275
|
export const WORKER_NUDGE_READONLY = "You stopped before finishing and without the REPORT section. Continue the task now (keep using tools; change no files). When it is done — or you are truly blocked — end with the `REPORT` section the contract asks for.";
|
|
2151
2276
|
|
|
2277
|
+
/** Share of the budget at which a worker is steered to wrap up (gh#142's grace, restored for every op). */
|
|
2278
|
+
export const WORKER_STEER_AT = 0.75;
|
|
2279
|
+
|
|
2280
|
+
/** Grace after the hard cut: one REPORT-only prompt, so an interrupted worker hands back what it found. */
|
|
2281
|
+
export const WORKER_SALVAGE_MS = 3 * 60_000;
|
|
2282
|
+
|
|
2283
|
+
/** The steer a worker gets at WORKER_STEER_AT of its budget — wrap up while there is time to. */
|
|
2284
|
+
export function workerSteer(op: WorkerOp, budgetMin: number): string {
|
|
2285
|
+
const left = Math.max(1, Math.round(budgetMin * (1 - WORKER_STEER_AT)));
|
|
2286
|
+
return op === "implement"
|
|
2287
|
+
? `Time check: about ${left} min of your ${budgetMin}-min budget are left. Finish the edit in hand, commit what works, and end with the REPORT section now (done, commits, open items, risks) — an honest partial report beats being cut off.`
|
|
2288
|
+
: `Time check: about ${left} min of your ${budgetMin}-min budget are left. Stop probing and write the REPORT section now with what you have — rows you could not fully prove say so in their evidence. Being cut off loses every finding.`;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
/** The prompt an interrupted worker gets once after the hard cut — report only, no more tools. */
|
|
2292
|
+
export const WORKER_SALVAGE = "Your time budget is spent and your last turn was interrupted. Do not call any more tools. Reply now with only the REPORT section the contract asks for, from what you already found (mark anything unfinished or unproven as such).";
|
|
2293
|
+
|
|
2152
2294
|
// ------------------------------------------------------------- reflect worker (flow_stage op "reflect")
|
|
2153
2295
|
|
|
2296
|
+
/** Compact, line-referenced digest of a pi session JSONL for the reflect worker. A driver transcript
|
|
2297
|
+
* runs to megabytes; the worker used to spend half its budget dumping and paging it. The digest keeps
|
|
2298
|
+
* what a reflection looks for — operator messages, flow gate calls and their answers, tool errors,
|
|
2299
|
+
* refusals, repeated commands — each tagged `L<n>` (the JSONL line) so the worker can open the raw
|
|
2300
|
+
* entry when one needs context. Pure: text in, text out. */
|
|
2301
|
+
export function digestTranscript(jsonl: string, opts: { maxChars?: number } = {}): string {
|
|
2302
|
+
const max = opts.maxChars ?? 80_000;
|
|
2303
|
+
const clip = (t: string, n: number) => {
|
|
2304
|
+
const one = t.replace(/\s+/g, " ").trim();
|
|
2305
|
+
return one.length > n ? `${one.slice(0, n)}…` : one;
|
|
2306
|
+
};
|
|
2307
|
+
const textOf = (c: unknown): string =>
|
|
2308
|
+
typeof c === "string" ? c : Array.isArray(c) ? c.filter((b) => b && (b as { type?: string }).type === "text").map((b) => String((b as { text?: unknown }).text ?? "")).join("\n") : "";
|
|
2309
|
+
const out: string[] = [];
|
|
2310
|
+
const calls = new Map<string, { line: number; name: string; args: string }>();
|
|
2311
|
+
const cmdCount = new Map<string, { n: number; first: number }>();
|
|
2312
|
+
let entries = 0, toolCalls = 0, errors = 0, first = "", last = "";
|
|
2313
|
+
const lines = (jsonl ?? "").split("\n");
|
|
2314
|
+
for (let i = 0; i < lines.length; i++) {
|
|
2315
|
+
const raw = lines[i].trim();
|
|
2316
|
+
if (!raw) continue;
|
|
2317
|
+
let e: Record<string, unknown>;
|
|
2318
|
+
try { e = JSON.parse(raw); } catch { continue; }
|
|
2319
|
+
entries++;
|
|
2320
|
+
const L = `L${i + 1}`;
|
|
2321
|
+
const ts = typeof e.timestamp === "string" ? e.timestamp : "";
|
|
2322
|
+
if (ts) { first ||= ts; last = ts; }
|
|
2323
|
+
if (e.type === "compaction") { out.push(`${L} ── compaction (earlier context summarized)`); continue; }
|
|
2324
|
+
if (e.type === "custom_message" && e.customType === "flow") { out.push(`${L} /flow → ${clip(textOf(e.content), 400)}`); continue; }
|
|
2325
|
+
if (e.type !== "message") continue;
|
|
2326
|
+
const m = (e.message ?? {}) as { role?: string; content?: unknown; toolCallId?: string; toolName?: string; isError?: boolean };
|
|
2327
|
+
if (m.role === "user") {
|
|
2328
|
+
const t = textOf(m.content);
|
|
2329
|
+
if (t.trim()) out.push(`${L} OPERATOR: ${clip(t, 900)}`);
|
|
2330
|
+
} else if (m.role === "assistant") {
|
|
2331
|
+
const blocks = Array.isArray(m.content) ? (m.content as Record<string, unknown>[]) : [];
|
|
2332
|
+
const said = blocks.filter((b) => b.type === "text").map((b) => String(b.text ?? "")).join(" ");
|
|
2333
|
+
if (said.trim()) out.push(`${L} agent: ${clip(said, 300)}`);
|
|
2334
|
+
for (const b of blocks) {
|
|
2335
|
+
if (b.type !== "toolCall") continue;
|
|
2336
|
+
toolCalls++;
|
|
2337
|
+
const name = String(b.name ?? "?");
|
|
2338
|
+
const a = (b.arguments ?? {}) as Record<string, unknown>;
|
|
2339
|
+
const args = name === "bash" ? String(a.command ?? "") : name === "flow" ? (Array.isArray(a.args) ? (a.args as unknown[]).join(" ") : JSON.stringify(a)) : JSON.stringify(a);
|
|
2340
|
+
calls.set(String(b.id ?? ""), { line: i + 1, name, args });
|
|
2341
|
+
if (name === "bash") {
|
|
2342
|
+
const k = clip(args, 200);
|
|
2343
|
+
const c = cmdCount.get(k);
|
|
2344
|
+
if (c) c.n++; else cmdCount.set(k, { n: 1, first: i + 1 });
|
|
2345
|
+
}
|
|
2346
|
+
if (name === "flow" || name === "flow_stage") out.push(`${L} ${name} ${clip(name === "flow" ? args : `${String(a.op ?? "")} ${String(a.note ?? "")}`, 300)}`);
|
|
2347
|
+
}
|
|
2348
|
+
} else if (m.role === "toolResult") {
|
|
2349
|
+
const call = calls.get(String(m.toolCallId ?? ""));
|
|
2350
|
+
const name = call?.name ?? m.toolName ?? "?";
|
|
2351
|
+
const res = textOf(m.content);
|
|
2352
|
+
if (m.isError) {
|
|
2353
|
+
errors++;
|
|
2354
|
+
out.push(`${L} ERROR ${name}${call ? ` (call L${call.line}: ${clip(call.args, 160)})` : ""} → ${clip(res, 400)}`);
|
|
2355
|
+
} else if (name === "flow" || name === "flow_stage") {
|
|
2356
|
+
out.push(`${L} ↳ ${clip(res, name === "flow_stage" ? 600 : 400)}`);
|
|
2357
|
+
} else if (/NEEDS-OPERATOR/.test(res.slice(0, 600))) {
|
|
2358
|
+
out.push(`${L} GUARD ${name}${call ? ` (call L${call.line}: ${clip(call.args, 160)})` : ""} → ${clip(res, 300)}`);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
const repeats = [...cmdCount.entries()].filter(([, c]) => c.n >= 3).sort((a, b) => b[1].n - a[1].n).slice(0, 15);
|
|
2363
|
+
const head = [
|
|
2364
|
+
`digest: ${entries} entries, ${toolCalls} tool calls, ${errors} tool errors${first ? `, ${first} → ${last}` : ""}`,
|
|
2365
|
+
"(L<n> = line in the raw JSONL — open it with: sed -n '<n>p' <file> | jq . — only when a row needs context)",
|
|
2366
|
+
...(repeats.length ? ["repeated shell commands (≥3×):", ...repeats.map(([k, c]) => ` ×${c.n} from L${c.first}: ${k}`)] : []),
|
|
2367
|
+
"",
|
|
2368
|
+
];
|
|
2369
|
+
let body = out.join("\n");
|
|
2370
|
+
if (body.length > max) {
|
|
2371
|
+
// keep both ends: the start frames the task, the end holds the release and the operator's last words
|
|
2372
|
+
const half = Math.floor(max / 2);
|
|
2373
|
+
body = `${body.slice(0, half)}\n… (digest clipped — ${body.length - max} chars dropped from the middle; grep the raw JSONL for that span) …\n${body.slice(-half)}`;
|
|
2374
|
+
}
|
|
2375
|
+
return [...head, body].join("\n");
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2154
2378
|
/** A pi session file and the `parentSession` its header names (line 1 of the JSONL). */
|
|
2155
2379
|
export interface SessionHeaderInfo {
|
|
2156
2380
|
file: string;
|
|
@@ -2192,6 +2416,12 @@ export interface ReflectBriefInput {
|
|
|
2192
2416
|
selfRepo: boolean;
|
|
2193
2417
|
/** open issues on this project's own GitHub repo (the read-time fold), when gh could list them */
|
|
2194
2418
|
projectIssues?: { repo: string; issues: { number: number; title: string }[] };
|
|
2419
|
+
/** the upstream dev-flow repo's issues (all states), prefetched so dedupe is a read, not a gh loop */
|
|
2420
|
+
upstreamIssues?: { number: number; title: string; state: string }[];
|
|
2421
|
+
/** pre-built transcript digests (driver first), one per transcript, in the feature's scratch dir */
|
|
2422
|
+
digests?: { transcript: string; digest: string }[];
|
|
2423
|
+
/** the wall-clock budget the worker runs under, in minutes */
|
|
2424
|
+
budgetMin?: number;
|
|
2195
2425
|
note: string;
|
|
2196
2426
|
}
|
|
2197
2427
|
|
|
@@ -2202,6 +2432,9 @@ export function buildReflectBrief(o: ReflectBriefInput): string {
|
|
|
2202
2432
|
const up = o.upstream || "(unknown — say so in the REPORT)";
|
|
2203
2433
|
const open = o.items.length ? o.items.map((it, i) => ` ${i + 1}. [${it.section}] ${it.line.replace(/^- \[ \] /, "")}`).join("\n") : " (none)";
|
|
2204
2434
|
const kids = o.children.length ? o.children.map((c) => ` - ${c.file}${c.name ? ` (${c.name})` : ""}`).join("\n") : " (none — no flow_stage worker ran in this session)";
|
|
2435
|
+
const digests = o.digests?.length ? o.digests.map((d) => ` - ${d.digest} (of ${path.basename(d.transcript)})`).join("\n") : "";
|
|
2436
|
+
const upIssues = o.upstreamIssues ? (o.upstreamIssues.length ? o.upstreamIssues.map((i) => ` gh#${i.number} [${i.state.toLowerCase()}] ${i.title}`).join("\n") : " (none)") : "";
|
|
2437
|
+
const budget = o.budgetMin ? `${o.budgetMin} min` : "a fixed wall-clock budget";
|
|
2205
2438
|
const issues = o.projectIssues ? (o.projectIssues.issues.length ? o.projectIssues.issues.map((i) => ` gh#${i.number} ${i.title}`).join("\n") : " (none open)") : "";
|
|
2206
2439
|
return [
|
|
2207
2440
|
`You are a fresh, independent reviewer of the dev-flow session for feature \`${o.slug}\`: find what went wrong or was slow, and say where each fix belongs.`,
|
|
@@ -2210,17 +2443,24 @@ export function buildReflectBrief(o: ReflectBriefInput): string {
|
|
|
2210
2443
|
`- Repo (your cwd): ${o.root} — today is ${o.today}`,
|
|
2211
2444
|
`- Driver session transcript (read it in full): ${o.driverFile ?? "(unknown — the session is not file-backed; say so and review what you can)"}`,
|
|
2212
2445
|
`- Sub-agent (flow_stage worker) transcripts:\n${kids}`,
|
|
2213
|
-
|
|
2446
|
+
...(digests
|
|
2447
|
+
? [`- **Start here — digests already built for you** (operator messages, flow calls and answers, tool errors, guard refusals, repeated commands; each row tagged L<n> = its line in the raw JSONL). Read these in full; open a raw entry only when a row needs context (sed -n '<n>p' <file> | jq .). Do not re-dump the raw transcripts:\n${digests}`]
|
|
2448
|
+
: ["- Transcripts are pi JSONL, one entry per line (type session / message / custom …; messages carry role, content, tool calls and tool results). Skim with jq or grep — e.g. jq -c 'select(.type==\"message\")' <file> — for tool errors, guard or gate refusals, NEEDS-OPERATOR, retries, repeated commands, operator corrections; then read the surrounding entries."]),
|
|
2214
2449
|
`- This project's playbook: ${o.projectMd}`,
|
|
2215
2450
|
`- This project's reflection queue: ${o.reflectionsFile} — open items:\n${open}`,
|
|
2216
2451
|
`- dev-flow ${o.version ?? "(version unknown)"}; upstream repo: ${up}${o.selfRepo ? " — this checkout IS dev-flow, so plugin findings are this project's code findings" : ""}`,
|
|
2217
|
-
...(o.
|
|
2452
|
+
...(o.upstreamIssues && o.upstream
|
|
2453
|
+
? [`- Issues on ${o.upstream} (all states) — dedupe plugin findings against this list; cite gh#N when one covers it. Run gh issue view <N> --repo ${o.upstream} only for a likely match:\n${upIssues}`]
|
|
2454
|
+
: o.upstream && !o.selfRepo
|
|
2455
|
+
? [`- Dedupe plugin findings upstream (read-only): gh issue list --repo ${o.upstream} --state all --search "<keywords>" — cite gh#N when one covers it (fixed / won't-fix / open).`]
|
|
2456
|
+
: []),
|
|
2218
2457
|
...(o.projectIssues ? [`- Open issues on this project's repo ${o.projectIssues.repo}:\n${issues}`] : []),
|
|
2219
|
-
"- You hold no flow tool and write nothing: no file edits, no commits, no gh issue create. The driving session and the operator decide.",
|
|
2458
|
+
"- You hold no flow tool and write nothing: no file edits, no commits, no gh issue create, no scratch dumps outside $TMPDIR. The driving session and the operator decide.",
|
|
2459
|
+
`- Budget: ${budget}, wall clock. Aim to write the REPORT by about 60% of it; an interrupted run loses every finding.`,
|
|
2220
2460
|
"",
|
|
2221
2461
|
"## Your task",
|
|
2222
2462
|
o.note.trim() ? `Operator context: ${o.note.trim()}` : "(no extra context from the driver)",
|
|
2223
|
-
"1. Review the transcripts for real friction only: wrong turns, repeated failures, misfiring guards or gates, playbook drift, slow paths with an obvious fix. One-off typos, environment hiccups and things already fixed later in the session are not findings.",
|
|
2463
|
+
"1. Review the transcripts for real friction only: wrong turns, repeated failures, misfiring guards or gates, playbook drift, slow paths with an obvious fix. One-off typos, environment hiccups and things already fixed later in the session are not findings. You review the session, not the product: evidence is a transcript line — do not re-audit the project's source to second-guess what the session shipped.",
|
|
2224
2464
|
`2. Classify each finding: docs — the fix lives only in this project's playbook (project.md) → docs flow; code — the fix touches this project's code (maybe the playbook too) → patch flow; plugin — dev-flow's own behaviour or wording → upstream GitHub issue${o.selfRepo ? " (here: report it as code)" : ""}.`,
|
|
2225
2465
|
"3. Dedupe each finding against the open items above and the issues; a finding an open item already covers is not new — mark that item recurred instead.",
|
|
2226
2466
|
"4. Recommend fold (worth recording / filing) or drop (one-off, environmental, operator choice, already covered) with a one-clause reason.",
|
package/src/projectmd.ts
CHANGED
|
@@ -189,9 +189,16 @@ export function parseProjectMd(text: string): ParsedMd {
|
|
|
189
189
|
if (!stage || stage === "global" || !MD_STAGES.includes(stage as MdStage)) return; // preamble/unknown → not injected
|
|
190
190
|
const item = line.match(CHECK_ITEM);
|
|
191
191
|
if (item) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
// qualifiers lead the item in any order: (ui) = --ui features only, (versioned) = not on a --no-version flow
|
|
193
|
+
let text = item[1].trim();
|
|
194
|
+
let uiOnly = false;
|
|
195
|
+
let versionedOnly = false;
|
|
196
|
+
for (let q = /^\((ui|versioned)\)\s+/.exec(text); q; q = /^\((ui|versioned)\)\s+/.exec(text)) {
|
|
197
|
+
if (q[1] === "ui") uiOnly = true;
|
|
198
|
+
else versionedOnly = true;
|
|
199
|
+
text = text.slice(q[0].length);
|
|
200
|
+
}
|
|
201
|
+
(p.checklist[stage] ??= []).push(versionedOnly ? { text, uiOnly, versionedOnly } : { text, uiOnly });
|
|
195
202
|
return;
|
|
196
203
|
}
|
|
197
204
|
if (/^(#|```|<!--|\s*$)/.test(line) && !line.startsWith("### ")) return; // h1/html comments/blank are not prose
|
|
@@ -508,7 +515,7 @@ export function mdDigest(text: string): string {
|
|
|
508
515
|
}
|
|
509
516
|
if (s === "pre-release" && !keys.file && !p.flow.release["versioning.file"]) bits.push("version: no version file set — releases cannot bump or tag");
|
|
510
517
|
const items = p.checklist[s] ?? [];
|
|
511
|
-
if (items.length) bits.push(`manual check: ${items.map((i) => `${i.uiOnly ? "(UI only) " : ""}\"${i.text}\"`).join(" · ")}`);
|
|
518
|
+
if (items.length) bits.push(`manual check: ${items.map((i) => `${i.uiOnly ? "(UI only) " : ""}${i.versionedOnly ? "(versioned only) " : ""}\"${i.text}\"`).join(" · ")}`);
|
|
512
519
|
if (p.prose[s]) bits.push(`guidance: "${p.prose[s].replace(/\s+/g, " ").trim()}"`);
|
|
513
520
|
if (bits.length) rows.push(`${label} — ${bits.join(" · ")}`);
|
|
514
521
|
}
|