pi-dev-flow 0.81.0 → 0.82.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 +10 -0
- package/README.md +3 -1
- package/docs/gates.md +1 -1
- package/docs/playbook.md +1 -1
- package/extensions/dev-flow.ts +42 -11
- package/package.json +1 -1
- package/skills/dev-flow/references/implement.md +10 -4
- package/skills/dev-flow/references/plan.md +3 -0
- package/skills/dev-flow/references/reflect.md +7 -0
- package/src/core.ts +35 -4
- package/src/projectmd.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.82.0] - 2026-11-05
|
|
8
|
+
|
|
9
|
+
**A feature split off mid-flow is parked in the roadmap with its notes, and a hand-made feature dir can be adopted instead of deleted.**
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- **A feature split off mid-flow no longer ends up as an unpickable ghost.** An agent asked for "a separate flow" wrote `.dev-flow/<new>/plan/` by hand; the next session's `flow start` said it already existed, `flow use` found no state, and doctor offered to delete it. A bound session can no longer write another feature's dir or a hand-made `<x>/plan/` (the refusal names the roadmap route); `flow start <slug> --confirmed` adopts an existing ghost and keeps its plan files; `flow use` on a ghost points there.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **Roadmap spin-offs carry a brief.** `flow roadmap add "<title>" --slug=<slug> --brief=<notes>` (or `--brief-file=<path>`) adds and stamps the item in one call, records `— split from <bound slug>`, and keeps the notes under it as quoted lines. `flow start <slug>` seeds `plan/plan.md` with the item and brief. Tidy removes a done item's brief with it.
|
|
16
|
+
|
|
7
17
|
## [0.81.0] - 2026-11-04
|
|
8
18
|
|
|
9
19
|
**Temp-dir fixtures stay outside the repo for git; a UI flag can be added at plan; compaction keeps the real stage.**
|
package/README.md
CHANGED
|
@@ -253,7 +253,9 @@ While a feature is active, every tool call passes a guard:
|
|
|
253
253
|
```
|
|
254
254
|
|
|
255
255
|
`roadmap.md` is your backlog of future features (`flow roadmap add / pick / done`), also advisory — a
|
|
256
|
-
shipped feature checks off the item it was picked from.
|
|
256
|
+
shipped feature checks off the item it was picked from. A new feature that comes up mid-flow is parked
|
|
257
|
+
there as a spin-off (`flow roadmap add "<title>" --slug=<slug> --brief=<notes>`); `flow start <slug>`
|
|
258
|
+
later seeds its plan from the brief.
|
|
257
259
|
|
|
258
260
|
## Documentation
|
|
259
261
|
|
package/docs/gates.md
CHANGED
|
@@ -20,7 +20,7 @@ so it needs no `--confirmed`.
|
|
|
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
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
|
-
| `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 |
|
|
23
|
+
| `roadmap [add "<feature>" [--slug=<slug>] [--brief=<notes>\|--brief-file=<path>] \| 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 (`--slug=` stamps it like pick, `--brief=`/`--brief-file=` keeps notes under it as ` > ` lines, and a bound session records `— split from <slug>` — the spin-off route for a new feature surfaced mid-flow), `pick <n> <slug>` stamps open item n with `(slug)` so `flow start <slug>` can take it (start seeds `plan/plan.md` with the item and its brief) — **`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]` | — | — |
|
|
26
26
|
| `help` (`--help`, `-h`) | — | — (prints the gate help — answerable in any repo, at any stage, with no `.dev-flow/`) |
|
package/docs/playbook.md
CHANGED
|
@@ -200,7 +200,7 @@ On a **fresh repo** it prints the setup brief: the detection report, plus one qu
|
|
|
200
200
|
|
|
201
201
|
`--track` commits the playbook as a playbook chore (`git add -f` + the main-hook prefix). `--draft` prints the draft, or the current file, without writing.
|
|
202
202
|
|
|
203
|
-
On an **existing file** init is doctor mode. It reports drift, dead commands and scripts, an unparseable manifest, dual configs, and **ghost feature dirs** (a `.dev-flow/<slug>/` whose `state.json` is gone). It offers to delete ghost dirs on your confirm, and says so instead when no UI is present. It never runs your commands.
|
|
203
|
+
On an **existing file** init is doctor mode. It reports drift, dead commands and scripts, an unparseable manifest, dual configs, and **ghost feature dirs** (a `.dev-flow/<slug>/` whose `state.json` is gone). It offers to delete ghost dirs on your confirm, and says so instead when no UI is present; to keep one as a new feature's draft, decline and run `flow start <slug> --confirmed`, which adopts it. It never runs your commands.
|
|
204
204
|
|
|
205
205
|
When a hook manager sets `core.hooksPath` (husky, lefthook…), git ignores `.git/hooks`, so init prints the main-branch guard lines for you to add to that hook instead of installing one that would never run. An existing foreign `pre-commit` gets the same printout.
|
|
206
206
|
|
package/extensions/dev-flow.ts
CHANGED
|
@@ -112,6 +112,7 @@ import {
|
|
|
112
112
|
roadmapDone,
|
|
113
113
|
roadmapDoneForSlug,
|
|
114
114
|
roadmapOpenCount,
|
|
115
|
+
roadmapBriefFor,
|
|
115
116
|
roadmapPick,
|
|
116
117
|
roadmapTidy,
|
|
117
118
|
shouldSelfCompact,
|
|
@@ -285,7 +286,7 @@ const initiated = (root: string): boolean => existsSync(path.join(dfDir(root), "
|
|
|
285
286
|
* with parseMergeStyle so a typo is reported instead of ignored. */
|
|
286
287
|
function flagValue(rest: string[], name: string): string | null {
|
|
287
288
|
for (const a of rest) {
|
|
288
|
-
const m = a.match(new RegExp(`^--${name}=(
|
|
289
|
+
const m = a.match(new RegExp(`^--${name}=([\\s\\S]+)$`)); // a --brief= value spans lines
|
|
289
290
|
if (m) return m[1];
|
|
290
291
|
}
|
|
291
292
|
return null;
|
|
@@ -383,7 +384,7 @@ async function releaseTags(root: string): Promise<string[] | null> {
|
|
|
383
384
|
}
|
|
384
385
|
|
|
385
386
|
const GATE_HELP =
|
|
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
|
|
387
|
+
"help [--json] | init [--force|--draft|--write <text>|--write-file <path>|--answers key=value…|--answers-file <path>] [--confirmed] [--track] | reflect [<note>|list|tidy|move <n> --playbook|--code|done <n> [<what>]] | roadmap [add <text> [--slug=<slug>] [--brief=<notes>|--brief-file=<path>]|pick <n> <slug>|done <n>|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> (or add --slug=) stamps an item for flow start, which seeds the new plan from its brief; finish checks it off — a new feature asked for mid-flow is parked there, never as a hand-made .dev-flow/<slug>/; start <slug> --confirmed adopts such a ghost dir — doctor reviews structure, git consistency and open reflections (never writes); doctor <note> prints an investigation brief — version prints the build the disk ships and any other dev-flow copies in this process (--check-upstream asks the registry)";
|
|
387
388
|
const featDir = (root: string, slug: string) => path.join(dfDir(root), slug);
|
|
388
389
|
const stateFile = (root: string, slug: string) => path.join(featDir(root, slug), "state.json");
|
|
389
390
|
const claimFile = (root: string, slug: string) => path.join(featDir(root, slug), "claim.json");
|
|
@@ -1647,8 +1648,8 @@ async function gateInit(o: GateCtx): Promise<RunResult> {
|
|
|
1647
1648
|
// ghosts: feature dirs whose state.json is gone — inert, invisible to status and guards, and only findable by eye
|
|
1648
1649
|
const ghosts = ghostFeatureDirs(root);
|
|
1649
1650
|
if (ghosts.length) {
|
|
1650
|
-
if (!ui.hasUI) notes.push(`${ghosts.length} ghost feature dir(s) — a plan/ with no state.json, no flow owns them (${ghosts.join(", ")}); delete them or run flow init interactively`);
|
|
1651
|
-
else if (await ui.confirm("Remove ghost feature dirs?", `${ghosts.map((g) => `${g} — plan/ with no state.json`).join("\n")}\n\nNo flow owns these; their plan/*.md is not recoverable afterwards.`)) {
|
|
1651
|
+
if (!ui.hasUI) notes.push(`${ghosts.length} ghost feature dir(s) — a plan/ with no state.json, no flow owns them (${ghosts.join(", ")}); adopt one with flow start <slug> --confirmed, delete them, or run flow init interactively`);
|
|
1652
|
+
else if (await ui.confirm("Remove ghost feature dirs?", `${ghosts.map((g) => `${g} — plan/ with no state.json`).join("\n")}\n\nNo flow owns these; their plan/*.md is not recoverable afterwards. To keep one as a new feature's draft, decline and run flow start <slug> --confirmed.`)) {
|
|
1652
1653
|
for (const g of ghosts) rmSync(path.join(root, g), { recursive: true, force: true });
|
|
1653
1654
|
notes.push(`removed ${ghosts.length} ghost feature dir(s): ${ghosts.map((g) => g.slice(".dev-flow/".length)).join(", ")}`);
|
|
1654
1655
|
} else notes.push(`kept ${ghosts.length} ghost feature dir(s) — inert, remove them whenever you like`);
|
|
@@ -1778,7 +1779,14 @@ async function gateInit(o: GateCtx): Promise<RunResult> {
|
|
|
1778
1779
|
async function gateStart(o: GateCtx): Promise<RunResult> {
|
|
1779
1780
|
const { root, sess, cfg, rest, flag, slugArg } = o;
|
|
1780
1781
|
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 };
|
|
1781
|
-
|
|
1782
|
+
// a ghost (plan/ but no state.json — typically a spin-off someone wrote by hand) is adopted, never a dead end:
|
|
1783
|
+
// "already exists, flow use it" sent the agent to use, which found no state, and doctor offered to delete it
|
|
1784
|
+
const ghost = existsSync(featDir(root, slugArg)) && !existsSync(stateFile(root, slugArg)) && existsSync(path.join(featDir(root, slugArg), "plan"));
|
|
1785
|
+
if (ghost && !flag("confirmed")) {
|
|
1786
|
+
const files = listFiles(path.join(featDir(root, slugArg), "plan"));
|
|
1787
|
+
return { text: `.dev-flow/${slugArg}/ is a ghost — plan/ (${files.join(", ") || "empty"}) but no state.json, so no flow owns it. Adopt it as this feature's draft plan: flow start ${slugArg} --confirmed (the operator agrees in chat), or delete the dir to start clean`, isError: true };
|
|
1788
|
+
}
|
|
1789
|
+
if (existsSync(featDir(root, slugArg)) && !ghost) {
|
|
1782
1790
|
// --ui on the plan-stage feature this session drives: the operator asked for mockups after the start,
|
|
1783
1791
|
// so turn the mockup gate on instead of refusing — a UI feature left at ui=false skips the mockup
|
|
1784
1792
|
// proof at approve and every (ui) checklist item (lettuce rail-ui-fixes shipped 20 ungated mockups)
|
|
@@ -1840,7 +1848,19 @@ async function gateStart(o: GateCtx): Promise<RunResult> {
|
|
|
1840
1848
|
// stamp the dev-flow build that started this feature — a stuck flow can later be read against its tooling.
|
|
1841
1849
|
// the stamp is what ran, not what the disk claims (that mismatch is the warning above).
|
|
1842
1850
|
const state = newState(slugArg, flag("ui"), flag("patch"), flag("docs"), loadedVersion() ?? undefined);
|
|
1843
|
-
|
|
1851
|
+
const planDir = path.join(featDir(root, slugArg), "plan");
|
|
1852
|
+
if (ghost) notes.push(`adopted ghost .dev-flow/${slugArg}/ — its plan/ (${listFiles(planDir).join(", ") || "empty"}) is this feature's draft`);
|
|
1853
|
+
mkdirSync(planDir, { recursive: true });
|
|
1854
|
+
// a roadmap item stamped for this slug carries its brief into the plan: the spin-off's context outlives the session that split it
|
|
1855
|
+
const picked = roadmapBriefFor(readRoadmap(root), slugArg);
|
|
1856
|
+
if (picked) {
|
|
1857
|
+
const planMd = path.join(planDir, "plan.md");
|
|
1858
|
+
const carried = `> Carried over from the roadmap: ${picked.item}${picked.brief ? `\n>\n${picked.brief.split("\n").map((l) => `> ${l}`.trimEnd()).join("\n")}` : ""}\n`;
|
|
1859
|
+
if (!existsSync(planMd)) {
|
|
1860
|
+
writeFileSync(planMd, `# ${slugArg} — plan (draft)\n\n${carried}`);
|
|
1861
|
+
notes.push(`roadmap item "${picked.item}" seeded plan/plan.md${picked.brief ? " with its brief" : ""} — a draft: plan it out and approve as usual`);
|
|
1862
|
+
} else notes.push(`roadmap item "${picked.item}"${picked.brief ? ` — brief:\n${picked.brief}` : ""}`);
|
|
1863
|
+
}
|
|
1844
1864
|
writeState(root, state);
|
|
1845
1865
|
sess.bind(slugArg);
|
|
1846
1866
|
sess.rename(slugArg);
|
|
@@ -1994,9 +2014,17 @@ async function gateRoadmap(o: GateCtx): Promise<RunResult> {
|
|
|
1994
2014
|
return { text: [`roadmap — ${open} open (${done} done):`, ...openChecklistItems(text).map((l, i) => ` ${i + 1}. ${l.slice(6)}`)].join("\n") };
|
|
1995
2015
|
}
|
|
1996
2016
|
case "add": {
|
|
1997
|
-
if (!args.length) return { text: 'usage: flow roadmap add "<future feature>"', isError: true };
|
|
1998
|
-
|
|
1999
|
-
|
|
2017
|
+
if (!args.length) return { text: 'usage: flow roadmap add "<future feature>" [--slug=<slug>] [--brief=<notes>|--brief-file=<path>]', isError: true };
|
|
2018
|
+
// a spin-off: --slug stamps it like pick (flow start finds it), the brief carries what was worked
|
|
2019
|
+
// out in chat into the new feature's plan, and a bound session records where it was split from
|
|
2020
|
+
const slug = flagValue(rest, "slug");
|
|
2021
|
+
if (slug !== null && !validSlug(slug)) return { text: `--slug=${slug} is not a slug (lowercase, dashes)`, isError: true };
|
|
2022
|
+
const briefFile = flagValue(rest, "brief-file");
|
|
2023
|
+
if (briefFile !== null && !existsSync(path.resolve(root, briefFile))) return { text: `--brief-file=${briefFile} does not exist`, isError: true };
|
|
2024
|
+
const brief = briefFile !== null ? readFileSync(path.resolve(root, briefFile), "utf8") : (flagValue(rest, "brief") ?? "");
|
|
2025
|
+
const item = [args.join(" "), sess.slug && sess.slug !== slug ? `— split from ${sess.slug}` : "", slug ? `(${slug})` : ""].filter(Boolean).join(" ");
|
|
2026
|
+
save(appendRoadmapItem(text, item, brief));
|
|
2027
|
+
return { text: `roadmap: added — ${open + 1} open${slug ? `; stamped for ${slug}${brief.trim() ? " with a brief" : ""} — flow start ${slug} seeds its plan from it${sess.slug ? ` (after ${sess.slug} ships)` : ""}` : ""}` };
|
|
2000
2028
|
}
|
|
2001
2029
|
case "pick": {
|
|
2002
2030
|
const slug = args[1] ?? "";
|
|
@@ -2017,7 +2045,7 @@ async function gateRoadmap(o: GateCtx): Promise<RunResult> {
|
|
|
2017
2045
|
return { text: `roadmap: dropped ${done} done item(s) — ${open} open` };
|
|
2018
2046
|
}
|
|
2019
2047
|
default:
|
|
2020
|
-
return { text: "usage: flow roadmap [list|add <text
|
|
2048
|
+
return { text: "usage: flow roadmap [list|add <text> [--slug=<slug>] [--brief=<notes>|--brief-file=<path>]|pick <n> <slug>|done <n>|tidy]", isError: true };
|
|
2021
2049
|
}
|
|
2022
2050
|
}
|
|
2023
2051
|
|
|
@@ -2123,7 +2151,10 @@ async function gateUse(o: GateCtx): Promise<RunResult> {
|
|
|
2123
2151
|
const { root, sess, slugArg } = o;
|
|
2124
2152
|
if (!slugArg) return { text: "usage: flow use <slug>", isError: true };
|
|
2125
2153
|
const st = readState(root, slugArg);
|
|
2126
|
-
if (!st)
|
|
2154
|
+
if (!st) {
|
|
2155
|
+
const ghost = existsSync(path.join(featDir(root, slugArg), "plan"));
|
|
2156
|
+
return { text: ghost ? `.dev-flow/${slugArg}/ is a ghost — plan/ but no state.json, so there is nothing to resume: flow start ${slugArg} --confirmed adopts its plan as a new feature` : `no unfinished feature ${slugArg}`, isError: true };
|
|
2157
|
+
}
|
|
2127
2158
|
const prior = readClaim(root, slugArg);
|
|
2128
2159
|
const takeover = claimBlocks(prior, sess.key) ? ` — taken over from live session (pid ${prior!.pid})` : "";
|
|
2129
2160
|
sess.bind(slugArg);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.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": [
|
|
@@ -137,10 +137,16 @@ Verify lands the feature in **pre-release**.
|
|
|
137
137
|
Mid-stage additions — do not bounce the flow, do not grow it silently:
|
|
138
138
|
**this feature grew** → stay at implement, append a `**Added mid-stage:**` line
|
|
139
139
|
to `plan.md` (what was asked and how), implement, `flow check` again — edits
|
|
140
|
-
make the checks stale, so verify re-covers the addition. **Different problem** →
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
make the checks stale, so verify re-covers the addition. **Different problem** →
|
|
141
|
+
a spin-off: once the operator agrees to split it, park it in the roadmap with
|
|
142
|
+
what you worked out — `flow roadmap add "<title>" --slug=<new-slug>
|
|
143
|
+
--brief=<notes>` (or `--brief-file=<path>`; the item records it was split from
|
|
144
|
+
this feature) — then finish this feature, and `flow start <new-slug>` (any
|
|
145
|
+
session, fresh is fine) seeds the new `plan/plan.md` from the brief. **Never
|
|
146
|
+
create `.dev-flow/<new-slug>/` by hand**: a plan dir with no `state.json` is a
|
|
147
|
+
ghost no gate picks up (the guard refuses it; `flow start <slug> --confirmed`
|
|
148
|
+
adopts one that already exists). Never fold two features into one plan, PR and
|
|
149
|
+
verify — the audit trail is the point. **Heavily amended plan** → show it and have the
|
|
144
150
|
operator re-approve in chat; verify remains the checkpoint — no reopen command
|
|
145
151
|
exists by design.
|
|
146
152
|
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
name is itself the gate's proof: **plan.md** — a preliminary direction
|
|
18
18
|
belongs *inside* plan.md (marked draft), never a separate
|
|
19
19
|
`pre-plan`/`direction.md` file: the approve gate requires plan.md by name.
|
|
20
|
+
Scope splits off at plan (the operator wants part of it later)? Park that
|
|
21
|
+
part with `flow roadmap add "<title>" --slug=<slug> --brief=<notes>` — never
|
|
22
|
+
a second `.dev-flow/<slug>/` written by hand.
|
|
20
23
|
First check
|
|
21
24
|
`git log origin/<default>..<default> --oneline`: local-only default-branch
|
|
22
25
|
commits fall out of the worktree's base (push them or re-plan).
|
|
@@ -76,5 +76,12 @@ content, you maintain and honor it. Advisory like reflections, never gating:
|
|
|
76
76
|
- Handed a feature: `flow roadmap pick <n> <slug>` stamps the item with the
|
|
77
77
|
slug (pick is one verb — it starts nothing), then `flow start <slug>` builds
|
|
78
78
|
it as a normal flow; its `flow finish` checks the item off automatically.
|
|
79
|
+
- **Spin-off** (a new feature surfaced mid-flow, split off on the operator's
|
|
80
|
+
word): `flow roadmap add "<title>" --slug=<slug> --brief=<notes>` (or
|
|
81
|
+
`--brief-file=<path>`) adds and stamps in one call; the brief sits under the
|
|
82
|
+
item as ` > ` lines and a bound session's slug is recorded as `— split from
|
|
83
|
+
<slug>`. `flow start <slug>` seeds `plan/plan.md` with the item and brief (a
|
|
84
|
+
draft — plan and approve as usual). A hand-made `.dev-flow/<slug>/plan/` with
|
|
85
|
+
no `state.json` is a ghost: `flow start <slug> --confirmed` adopts it.
|
|
79
86
|
- Shipped outside a flow: `flow roadmap done <n>` (date-stamped by hand);
|
|
80
87
|
`flow roadmap tidy` drops checked lines when history clutters the list.
|
package/src/core.ts
CHANGED
|
@@ -1473,6 +1473,12 @@ export function writeGuard(o: { abs: string; dfDir: string; features: FeatureRef
|
|
|
1473
1473
|
// agent owns stay writable with no binding; project.md is refused above, state/claim.json too.
|
|
1474
1474
|
if (DF_ADVISORY_FILES.has(path.relative(dfDir, abs))) return null;
|
|
1475
1475
|
if (!bound) return `.dev-flow/ holds flow state — an unbound session may write only its advisory files there (.dev-flow/reflections.md, .dev-flow/roadmap.md); bind with flow start <slug> or flow use <slug>, and a throwaway script goes outside the repo (under $TMPDIR)`;
|
|
1476
|
+
// another feature's directory, or a hand-made one shaped like a feature (`<x>/plan/…`): a plan dir
|
|
1477
|
+
// with no state.json is a ghost no gate can pick up — `flow start` refuses the existing dir, `flow use`
|
|
1478
|
+
// finds no state, doctor offers to delete it. A spin-off feature is parked in the roadmap instead.
|
|
1479
|
+
const [top, second] = path.relative(dfDir, abs).split(path.sep);
|
|
1480
|
+
if (top !== bound.state.slug && (second === "plan" || o.features.some((f) => f.state.slug === top)))
|
|
1481
|
+
return `.dev-flow/${top}/ is not this session's feature (${bound.state.slug}) — never create a feature dir by hand: park a new feature with flow roadmap add "<title>" --slug=${top} --brief=<notes> (the brief seeds its plan), and flow start ${top} once ${bound.state.slug} ships`;
|
|
1476
1482
|
return null;
|
|
1477
1483
|
}
|
|
1478
1484
|
if (bound) {
|
|
@@ -1961,9 +1967,27 @@ const isOpenItem = (line: string) => line.trim().startsWith("- [ ] ");
|
|
|
1961
1967
|
const isDoneItem = (line: string) => /^\s*-\s*\[[xX]\]\s/.test(line);
|
|
1962
1968
|
const stampItem = (line: string, stamp: string) => `- [x] ${line.trim().slice(6)} — done: ${stamp}`;
|
|
1963
1969
|
|
|
1964
|
-
/**
|
|
1965
|
-
|
|
1966
|
-
|
|
1970
|
+
/** A brief line under a roadmap item: indented blockquote (` > …`). The quote keeps a brief's own
|
|
1971
|
+
* `- [ ]` lines from counting as backlog items (item matching trims, then wants a leading dash). */
|
|
1972
|
+
const isBriefLine = (line: string) => /^\s+>/.test(line);
|
|
1973
|
+
|
|
1974
|
+
/** Append an open item to roadmap.md content; a header is minted from empty content. An optional
|
|
1975
|
+
* brief (the notes a spin-off feature carries into its plan) lands as indented ` > ` lines under it. */
|
|
1976
|
+
export function appendRoadmapItem(text: string, item: string, brief?: string): string {
|
|
1977
|
+
const body = (brief ?? "").replace(/\r/g, "").trim();
|
|
1978
|
+
const quoted = body ? `${body.split("\n").map((l) => ` > ${l}`.trimEnd()).join("\n")}\n` : "";
|
|
1979
|
+
return `${text.trimEnd() || ROADMAP_HEADER.trimEnd()}\n- [ ] ${item.trim()}\n${quoted}`;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
/** The open item stamped `(slug)` and its brief (quote markers stripped) — what flow start seeds a
|
|
1983
|
+
* picked feature's plan with. Null when no open item carries the stamp. */
|
|
1984
|
+
export function roadmapBriefFor(text: string, slug: string): { item: string; brief: string } | null {
|
|
1985
|
+
const lines = text.split("\n");
|
|
1986
|
+
const i = lines.findIndex((l) => isOpenItem(l) && l.includes(`(${slug})`));
|
|
1987
|
+
if (i === -1) return null;
|
|
1988
|
+
const brief: string[] = [];
|
|
1989
|
+
for (let j = i + 1; j < lines.length && isBriefLine(lines[j]); j++) brief.push(lines[j].replace(/^\s+> ?/, ""));
|
|
1990
|
+
return { item: lines[i].trim().slice(6), brief: brief.join("\n").trim() };
|
|
1967
1991
|
}
|
|
1968
1992
|
|
|
1969
1993
|
/** Number of open roadmap items. */
|
|
@@ -2012,7 +2036,14 @@ export function roadmapDoneForSlug(text: string, slug: string, stamp: string): {
|
|
|
2012
2036
|
|
|
2013
2037
|
/** Drop the done (`- [x]`) items; preamble and open items stay verbatim. */
|
|
2014
2038
|
export function roadmapTidy(text: string): string {
|
|
2015
|
-
|
|
2039
|
+
// a done item's brief goes with it — left behind it would read as the brief of the item above
|
|
2040
|
+
let dropping = false;
|
|
2041
|
+
const out = text.split("\n").filter((l) => {
|
|
2042
|
+
if (isBriefLine(l)) return !dropping;
|
|
2043
|
+
dropping = isDoneItem(l);
|
|
2044
|
+
return !dropping;
|
|
2045
|
+
});
|
|
2046
|
+
return out.join("\n").replace(/\n{3,}/g, "\n\n");
|
|
2016
2047
|
}
|
|
2017
2048
|
|
|
2018
2049
|
/** How far before pi's own compaction threshold dev-flow compacts (one fat tool turn). */
|
package/src/projectmd.ts
CHANGED
|
@@ -477,7 +477,7 @@ export function doctorFindings(root: string, cfg: Config, md: ParsedMd | null):
|
|
|
477
477
|
if (cfg.commands.run && !cfg.checkList.some((c) => c.name === "health")) f.push('run command configured but no tier-1 health check — add commands.health or a flow-check so "running and healthy" is enforced');
|
|
478
478
|
if (cfg.commands.dev && !healthProbe(cfg)) f.push("dev deploy configured but no health check — flow verify cannot prove the deploy came back serving this build: add commands.health or a flow-check health block");
|
|
479
479
|
if (!cfg.checkList.length) f.push("implement tier-1 gates nothing — no test, no health, no flow-check block: 'flow check' would pass vacuously");
|
|
480
|
-
for (const g of ghostFeatureDirs(root)) f.push(`${g} has a plan/ but no state.json — ghost of a closed or
|
|
480
|
+
for (const g of ghostFeatureDirs(root)) f.push(`${g} has a plan/ but no state.json — ghost of a closed, aborted or hand-made feature (flow start <slug> --confirmed adopts it as a new feature; flow init offers to remove it)`);
|
|
481
481
|
return f;
|
|
482
482
|
}
|
|
483
483
|
|