pi-dev-flow 0.58.0 → 0.59.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 +16 -0
- package/README.md +11 -0
- package/docs/development.md +21 -0
- package/docs/guardrails.md +1 -0
- package/extensions/dev-flow.ts +84 -9
- package/package.json +1 -1
- package/skills/dev-flow/SKILL.md +53 -375
- package/skills/dev-flow/references/finish.md +35 -0
- package/skills/dev-flow/references/implement.md +66 -0
- package/skills/dev-flow/references/plan.md +53 -0
- package/skills/dev-flow/references/pre-release.md +35 -0
- package/skills/dev-flow/references/reflect.md +60 -0
- package/skills/dev-flow/references/release.md +56 -0
- package/skills/dev-flow/references/start.md +68 -0
- package/src/core.ts +33 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.59.0] - 2026-10-23
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **The playbook's ground rules are now handed to the session, not left waiting to be read.** Pi lists a skill's name, description and path and loads the file only if the model chooses to — so a session could open in a dev-flow repo having never seen the rules the guards enforce, guess at a checkpoint, and then argue with the refusal that followed. `skills/dev-flow/SKILL.md` now carries a marker-delimited **core**: flow-is-a-tool-not-a-shell-command, you-run-the-gates with the checkpoint verbs and yolo, binds are explicit, `state.json` and `project.md` are read-only, project `flow-guard` rules outrank flow, the bash `timeout` rule, `flow abort` for abandonment. The extension extracts that block and appends it to the hidden `[dev-flow]` line it already writes — **once per session**: a `dev-flow-skill` entry records the injection so a reload, resume or fork does not pay the ~1k tokens twice; a compaction that summarizes it away re-arms exactly one re-injection, recorded on the branch as well as in memory, so a session that survives a compaction as a reload gets the rules back instead of quietly running without them; a branch rewound or forked past the injection gets them back too. A copy shipped without its `skills/` directory, or a skill whose markers were damaged, leaves every message exactly as it was — the extractor returns nothing rather than throwing inside a guard hook — and `package.test.ts` refuses a core over 4,000 characters, because that budget is what every session in a dev-flow repo pays.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **The rest of the skill is one file per stage, and each stage names its own.** The stage detail moved verbatim into `skills/dev-flow/references/{start,plan,implement,pre-release,release,finish,reflect}.md` (SKILL.md: 25,817 → 5,085 chars), and a bound session's stage turn now ends with the absolute path of the one file its stage needs (`…/references/plan.md` at plan), so the model reads a 3k-char stage brief instead of either guessing what a gate wants or hauling the whole playbook into context. pi never advertises the reference files — only `SKILL.md` registers as a skill, and a directory holding one is not scanned deeper — and the tests keep both halves honest: every stage has a file, the map in `SKILL.md` names every file, and `release.md` hands over to `finish.md`, because the state machine has no finish stage that could name it.
|
|
16
|
+
|
|
17
|
+
## [0.58.1] - 2026-10-23
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- `flow finish` now closes with a prompt to **re-read `flow status` before reporting open flows** — a sibling feature finished while a session was running, and the agent reported the session-start status, naming the shipped flow as open while the footer count was already correct. A stale after-finish report can no longer mislead the operator about what is still in flight.
|
|
22
|
+
|
|
7
23
|
## [0.58.0] - 2026-10-23
|
|
8
24
|
|
|
9
25
|
### Added
|
package/README.md
CHANGED
|
@@ -163,6 +163,17 @@ your playbook's `prose.implement` replaces it wholesale whenever you write your
|
|
|
163
163
|
rules adapt ponytail, obra/superpowers and pi-development-system — all MIT, credited in the
|
|
164
164
|
skill files.)
|
|
165
165
|
|
|
166
|
+
## The playbook the agent always has
|
|
167
|
+
|
|
168
|
+
Pi lists a skill's name and description and loads the file only if the model chooses to read it —
|
|
169
|
+
and a session that never read the playbook is the one that guesses at a gate, then argues with the
|
|
170
|
+
guard. So dev-flow injects what must never be missing: the ground rules of `skills/dev-flow/SKILL.md`
|
|
171
|
+
(the flow tool is the only invocation, checkpoints are words in chat, binds are explicit, the
|
|
172
|
+
playbook and state files are read-only) land in the session once, roughly a thousand tokens, and a
|
|
173
|
+
compaction that summarizes them away brings them back exactly once. The per-stage detail — mockup harness,
|
|
174
|
+
release sequence, reflection protocol — stays on disk, and each stage's turn names the one file to
|
|
175
|
+
read. Nothing to configure; reloads, resumed and forked sessions do not pay for it twice.
|
|
176
|
+
|
|
166
177
|
## What is enforced
|
|
167
178
|
|
|
168
179
|
While a feature is active, every tool call passes a guard:
|
package/docs/development.md
CHANGED
|
@@ -17,6 +17,27 @@ installed copy, point pi at it explicitly for that run: `pi -e .`.
|
|
|
17
17
|
A release cannot update a session that is already running — pi keeps the code it loaded at startup.
|
|
18
18
|
After merging and tagging, `/reload` in every session that must carry the new behavior.
|
|
19
19
|
|
|
20
|
+
## The skill: an injected core, plus references a stage reads
|
|
21
|
+
|
|
22
|
+
Pi advertises a skill (name, description, path) and loads `SKILL.md` only when the model decides to
|
|
23
|
+
read it — nothing makes a skill always-on. A session that never reads the playbook is a session that
|
|
24
|
+
guesses at a gate and then fights the guard, so `skills/dev-flow/SKILL.md` is split:
|
|
25
|
+
|
|
26
|
+
- The **core** — the ground rules every turn needs — sits between `<!-- dev-flow:core:start -->` and
|
|
27
|
+
`<!-- dev-flow:core:end -->`. The extension extracts that span and injects it into the hidden
|
|
28
|
+
`[dev-flow]` message **once per session**: a `dev-flow-skill` entry records the fact, so a reload,
|
|
29
|
+
resume or fork does not pay it twice, and a compaction that summarizes it away re-arms exactly one
|
|
30
|
+
re-injection. That budget is what every session in a dev-flow repo pays, so `package.test.ts`
|
|
31
|
+
refuses a core over **4,000 characters**.
|
|
32
|
+
- Everything else lives in `references/<stage>.md` — stage prose moved verbatim. The stage injection
|
|
33
|
+
names the one file the current stage needs (`…/references/plan.md` at plan), and the map under the
|
|
34
|
+
core lists them all. `references/` stays invisible to pi: only `SKILL.md` registers, and a
|
|
35
|
+
directory holding one is not scanned deeper.
|
|
36
|
+
|
|
37
|
+
When a stage grows, add to its reference file — do not grow the core. The tests guard both halves:
|
|
38
|
+
every stage has a file, the map names every file, and `release.md` hands over to `finish.md` because
|
|
39
|
+
the state machine has no finish stage that could name it.
|
|
40
|
+
|
|
20
41
|
## Publishing
|
|
21
42
|
|
|
22
43
|
`pi-dev-flow` is published to npm by `.github/workflows/release.yml`, triggered by the `v*` tag the
|
package/docs/guardrails.md
CHANGED
|
@@ -10,6 +10,7 @@ While a feature is active, the extension intercepts every tool call:
|
|
|
10
10
|
- **Flow by default**: in a repo with `.dev-flow/`, an unbound session cannot touch source files at all — every request goes through `flow start`/`flow use`; there is no bypass. `flow start` refuses when the main checkout isn't on the default branch, worktrees are always created from the default branch, and the agent cannot check feature branches out in the main checkout.
|
|
11
11
|
- **Gates can't be skipped**: flow state is untouchable by the agent (edit tool and bash) — writing `state.json`, moving it away, or deleting a feature directory or the whole `.dev-flow/` folder all block; the `project.md` playbook is operator-owned — the main-checkout copy is blocked for the agent outright, and only a **docs or patch flow's** worktree copy may be edited (normal features route playbook changes to their own flow); every sanctioned playbook overwrite keeps the previous file as `project.md.bak`; editing worktree code invalidates a passing test check until `flow test` reruns.
|
|
12
12
|
- **Your project's own rules**: every `deny`/`confirm`/`protect`/`forbid` rule from the `flow-guard` block in project.md `## global` runs on every bash command and every edit/write path — in every stage and binding, ahead of dev-flow's own verdicts. A block always carries the reason you wrote.
|
|
13
|
+
- **The rules reach the agent, they are not left in a file it may never read**: pi advertises a skill and loads it only if the model chooses to, so the ground rules of the dev-flow skill are injected into every session once (and again after a compaction that summarized them away), and each stage's turn names the one playbook file that stage needs. The guards enforce the same discipline either way — this is what makes the agent follow it without being stuck.
|
|
13
14
|
- **A forced push asks the operator**: `git push` carrying `--force`, `--force-with-lease…` or `-f` is confirmed before it runs — a rewritten branch is history CI and other sessions already have. The one spelling that answers for it is the prefix the refusal prints (`DEV_FLOW_ALLOW_REWRITE=1 git push -f …`), the same "the operator said so" contract as `DEV_FLOW_ALLOW_MAIN`. Local history rewrites (`git filter-branch --force`) are not pushes and stay free, so a project never needs a blunt flag-only deny of its own.
|
|
14
15
|
- **Shell calls can't hang forever**: pi kills a shell command only when the model passed a `timeout` — it omits one in ~75% of calls, so a `gh` waiting on a prompt or a dead `curl` froze sessions for hours. By default the call is therefore **refused** until the model states one (`bashTimeout = require`): the refusal names the exact value the class table would have armed, so the retry is a one-token fix and the call line in the transcript shows the timeout that is actually running. The injected class default (30s quick inspection · 120s local git and unknown · 180s network · 300s containers/services · 900s builds/tests/installs · 1,200s watchers like `gh run watch`) stays armed underneath either way, and absurd explicit values clamp to 1,800s. A project that would rather not nag sets `bashTimeout = inject` in `## global` — then the default is armed silently and the call passes. It applies to every session that loads the package, flow-bound or not (a session with no playbook has no way to opt out).
|
|
15
16
|
- **Compact-aware**: dev-flow paces compaction the way pi counts it: the self-compaction trigger uses the *effective* `reserveTokens` (settings and per-model overrides, not the built-in default) and is checked at every turn end, not only when a run settles. When pi force-compacts on its threshold anyway — the chat-only states (open tier-2 dialog, plan discussion not yet in `plan/`) refuse to self-compact by design — dev-flow takes the compaction over and redoes it with flow-aware summary instructions (overflow recovery keeps pi's compact-and-retry and is left alone). Auto-compaction turned off in settings is honored; a note about any compaction dev-flow could not shape still lands in `reflections.md`.
|
package/extensions/dev-flow.ts
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
* release stage; edits confined to the plan dir or the worktree; state.json
|
|
13
13
|
* is untouchable and the project.md playbook is operator-owned.
|
|
14
14
|
* 3. before_agent_start injects the active stage so the model always knows
|
|
15
|
-
* where it is and which gate comes next
|
|
15
|
+
* where it is and which gate comes next, plus the skill's always-on core once
|
|
16
|
+
* per session (pi only advertises a skill; it never loads it unasked) and the
|
|
17
|
+
* one playbook reference file the current stage needs.
|
|
16
18
|
*
|
|
17
19
|
* The stage logic lives in src/core.ts (unit-tested); this file is pi wiring.
|
|
18
20
|
* Inactive (fully pass-through) in repos without a .dev-flow/ directory.
|
|
@@ -46,6 +48,7 @@ import {
|
|
|
46
48
|
closedReflectionCount,
|
|
47
49
|
compactionReflectionLine,
|
|
48
50
|
detectForge,
|
|
51
|
+
extractSkillCore,
|
|
49
52
|
featureBranchPrefix,
|
|
50
53
|
FLOW_SHELL_HINT,
|
|
51
54
|
flowShellInvocation,
|
|
@@ -73,6 +76,7 @@ import {
|
|
|
73
76
|
reflectionRoutes,
|
|
74
77
|
reflectionsTidy,
|
|
75
78
|
reflectionsTidyHint,
|
|
79
|
+
stageReference,
|
|
76
80
|
sessionRunsOlderBuild,
|
|
77
81
|
|
|
78
82
|
listFiles,
|
|
@@ -158,7 +162,7 @@ function copyWarning(): string | null {
|
|
|
158
162
|
}
|
|
159
163
|
/** Test seam: the smoke suite cannot load a second copy of this module, so it plants registry
|
|
160
164
|
* entries and asserts the warnings the real duplicate would print. */
|
|
161
|
-
export const testSeams = { copies: COPIES };
|
|
165
|
+
export const testSeams = { copies: COPIES, skillCore: { value: undefined as string | null | undefined } };
|
|
162
166
|
|
|
163
167
|
interface Ui {
|
|
164
168
|
hasUI: boolean;
|
|
@@ -324,6 +328,32 @@ const sessionKey = (ctx: { cwd: string; sessionManager?: { getSessionId(): strin
|
|
|
324
328
|
ctx.sessionManager?.getSessionId() ? `sid:${ctx.sessionManager.getSessionId()}` : `cwd:${ctx.cwd}`;
|
|
325
329
|
/** Sessions with a dev-flow-initiated compaction in flight (prevents stacked compactions). */
|
|
326
330
|
const compacting = new Set<string>();
|
|
331
|
+
/** Sessions that already received the skill's always-on core this session. The `dev-flow-skill`
|
|
332
|
+
* entry records the injection in the session branch, so /reload, resume and fork restore the fact
|
|
333
|
+
* instead of paying ~1k tokens a second time. */
|
|
334
|
+
const coreInjected = new Set<string>();
|
|
335
|
+
/** Sessions whose last compaction dropped the core out of context — the next run pays it once more. */
|
|
336
|
+
const coreStale = new Set<string>();
|
|
337
|
+
/** The skill dir of THIS loaded copy. Since 0.57.1 dropped the `.pi/extensions` dogfood shim, the
|
|
338
|
+
* copy a session runs and a development checkout are different installs, so playbook paths
|
|
339
|
+
* resolve from the code actually loaded — never from cwd. */
|
|
340
|
+
const SKILL_DIR = path.join(import.meta.dirname, "..", "skills", "dev-flow");
|
|
341
|
+
let skillCoreCache: string | null | undefined;
|
|
342
|
+
/** The core block between SKILL.md's markers, read once per process (/reload reloads the module
|
|
343
|
+
* and picks up edits). Null — no file, no markers, empty core — leaves every message exactly as it
|
|
344
|
+
* was: a copy shipped without its skill must not take the guards, or the run, down. */
|
|
345
|
+
function skillCore(): string | null {
|
|
346
|
+
// Seam first: a test cannot ship a copy of the package with its skills/ directory deleted.
|
|
347
|
+
if (testSeams.skillCore.value !== undefined) return testSeams.skillCore.value;
|
|
348
|
+
if (skillCoreCache === undefined) {
|
|
349
|
+
try {
|
|
350
|
+
skillCoreCache = extractSkillCore(readFileSync(path.join(SKILL_DIR, "SKILL.md"), "utf8"));
|
|
351
|
+
} catch {
|
|
352
|
+
skillCoreCache = null;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return skillCoreCache;
|
|
356
|
+
}
|
|
327
357
|
|
|
328
358
|
/** Seam for the takeover's summarize call (pi's own compact()); tests replace `.run` — mutable object stands in for ESM mocking. */
|
|
329
359
|
export const compactionTakeover: { run: typeof compact } = { run: compact };
|
|
@@ -390,6 +420,8 @@ const writeClaim = (root: string, slug: string, key: string) =>
|
|
|
390
420
|
function releaseSession(root: string, key: string): void {
|
|
391
421
|
bindings.delete(key);
|
|
392
422
|
compacting.delete(key);
|
|
423
|
+
coreInjected.delete(key);
|
|
424
|
+
coreStale.delete(key);
|
|
393
425
|
if (!existsSync(dfDir(root))) return;
|
|
394
426
|
for (const d of readdirSync(dfDir(root), { withFileTypes: true })) {
|
|
395
427
|
if (!d.isDirectory()) continue;
|
|
@@ -1492,7 +1524,7 @@ ${mdDigest(draftRefresh)}`))
|
|
|
1492
1524
|
roadmapNote = ` roadmap: ${r.count} item(s) marked done.`;
|
|
1493
1525
|
}
|
|
1494
1526
|
}
|
|
1495
|
-
return { text: `feature ${state!.slug} done — ${closeNote}${remoteNote}; .dev-flow/${state!.slug}/ removed.${roadmapNote}${forgeSkipNote}${syncNote}
|
|
1527
|
+
return { text: `feature ${state!.slug} done — ${closeNote}${remoteNote}; .dev-flow/${state!.slug}/ removed.${roadmapNote}${forgeSkipNote}${syncNote} Re-read flow status before reporting open flows — a sibling feature may have finished while this session ran.` };
|
|
1496
1528
|
}
|
|
1497
1529
|
|
|
1498
1530
|
case "use": {
|
|
@@ -1611,19 +1643,46 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1611
1643
|
/** Restore this session's binding from its branch history (survives resume/fork). */
|
|
1612
1644
|
const rebuildSession = (ctx: ExtensionContext) => {
|
|
1613
1645
|
let slug: string | null = null;
|
|
1646
|
+
let sawCore = false;
|
|
1647
|
+
let coreStaleHere = false;
|
|
1614
1648
|
for (const e of ctx.sessionManager?.getBranch() ?? []) {
|
|
1615
1649
|
// SAFETY: narrow structural view of the SessionEntry union; we only read entries whose type/customType match our own appendEntry writes.
|
|
1616
|
-
const ce = e as unknown as { type: string; customType?: string; data?: { slug?: string | null } };
|
|
1650
|
+
const ce = e as unknown as { type: string; customType?: string; data?: { slug?: string | null; stale?: boolean } };
|
|
1617
1651
|
if (ce.type === "custom" && ce.customType === "dev-flow-bind") slug = ce.data?.slug ?? null;
|
|
1652
|
+
if (ce.type === "custom" && ce.customType === "dev-flow-skill") {
|
|
1653
|
+
sawCore = true;
|
|
1654
|
+
coreStaleHere = ce.data?.stale === true; // the newest skill entry decides: a stale one follows a compaction
|
|
1655
|
+
}
|
|
1618
1656
|
}
|
|
1619
1657
|
const key = sessionKey(ctx);
|
|
1620
1658
|
bindings.set(key, slug);
|
|
1659
|
+
// The branch is the truth about what the restored context holds: a marker means the core is in it
|
|
1660
|
+
// (do not pay twice), no marker means the branch was rewound or forked past the injection (give it
|
|
1661
|
+
// back), and a stale marker means a compaction summarized it away before the reload (give it back).
|
|
1662
|
+
if (sawCore) coreInjected.add(key);
|
|
1663
|
+
else coreInjected.delete(key);
|
|
1664
|
+
if (coreStaleHere) coreStale.add(key);
|
|
1665
|
+
else coreStale.delete(key);
|
|
1621
1666
|
// A reload ends the old session, which released its claim; the restored one must reclaim what its own
|
|
1622
1667
|
// branch says it holds, or the repo answers "claimed by another live session" to the session that
|
|
1623
1668
|
// holds it. A foreign live claim wins — restoring is not a takeover.
|
|
1624
1669
|
if (slug && readState(ctx.cwd, slug) && !claimBlocks(readClaim(ctx.cwd, slug), key)) writeClaim(ctx.cwd, slug, key);
|
|
1625
1670
|
};
|
|
1626
1671
|
|
|
1672
|
+
/** The run's playbook preamble: the skill's always-on core, once per session. Later runs come back
|
|
1673
|
+
* empty because the transcript already holds it. The one exception is a compaction that summarized
|
|
1674
|
+
* it away (see session_compact), which pays it once more — and every real injection records itself,
|
|
1675
|
+
* so the newest skill entry on the branch is always the truth a reload restores from. */
|
|
1676
|
+
const corePreamble = (key: string): string => {
|
|
1677
|
+
if (coreInjected.has(key) && !coreStale.has(key)) return "";
|
|
1678
|
+
const core = skillCore();
|
|
1679
|
+
if (!core) return "";
|
|
1680
|
+
coreStale.delete(key);
|
|
1681
|
+
coreInjected.add(key);
|
|
1682
|
+
pi.appendEntry("dev-flow-skill", { core: true });
|
|
1683
|
+
return `${core}\n\n`;
|
|
1684
|
+
};
|
|
1685
|
+
|
|
1627
1686
|
pi.registerCommand("flow", {
|
|
1628
1687
|
description: `dev-flow gates: ${GATE_HELP}`,
|
|
1629
1688
|
handler: async (args, ctx) => {
|
|
@@ -1703,7 +1762,15 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1703
1762
|
});
|
|
1704
1763
|
// pi forcing its own compaction while a flow is bound means the pacing was wrong — park a note for the operator.
|
|
1705
1764
|
pi.on("session_compact", async (event, ctx) => {
|
|
1706
|
-
if (!existsSync(dfDir(ctx.cwd))
|
|
1765
|
+
if (!existsSync(dfDir(ctx.cwd))) return;
|
|
1766
|
+
// Whatever the reason, the summary replaced the transcript — the core the first run injected is
|
|
1767
|
+
// gone from context, so the next run pays it once more (manual compactions included: our own
|
|
1768
|
+
// safe-point compaction is the common one).
|
|
1769
|
+
coreStale.add(sessionKey(ctx));
|
|
1770
|
+
// Durable too: a compaction the session survives a reload outlives the in-memory flag, and a
|
|
1771
|
+
// branch whose newest skill entry is stale tells the restored run to pay the core again.
|
|
1772
|
+
pi.appendEntry("dev-flow-skill", { core: true, stale: true });
|
|
1773
|
+
if (event.reason === "manual") return;
|
|
1707
1774
|
const st = boundFeature(ctx.cwd, sessionKey(ctx));
|
|
1708
1775
|
if (!st) return;
|
|
1709
1776
|
const f = path.join(dfDir(ctx.cwd), "reflections.md");
|
|
@@ -1852,12 +1919,15 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1852
1919
|
if (run[CONTEXT_EMITTED]) return undefined;
|
|
1853
1920
|
run[CONTEXT_EMITTED] = true;
|
|
1854
1921
|
if (!existsSync(dfDir(ctx.cwd))) return undefined;
|
|
1922
|
+
const key = sessionKey(ctx);
|
|
1923
|
+
// The playbook core rides along on the message this run writes anyway — once per session.
|
|
1924
|
+
const core = corePreamble(key);
|
|
1855
1925
|
const cfg = loadProject(dfDir(ctx.cwd)).cfg;
|
|
1856
|
-
const state = boundFeature(ctx.cwd,
|
|
1926
|
+
const state = boundFeature(ctx.cwd, key);
|
|
1857
1927
|
if (!state || state.stage === "done") {
|
|
1858
1928
|
// Default posture for an unbound session in a dev-flow repo (guards make it stick; this makes it understood).
|
|
1859
1929
|
let content = "[dev-flow] no flow bound. Every request goes through flow. New work: flow start <slug>; unfinished feature: flow use <slug>.";
|
|
1860
|
-
const cb = claimBlocker(ctx.cwd,
|
|
1930
|
+
const cb = claimBlocker(ctx.cwd, key);
|
|
1861
1931
|
if (cb) content += ` Also: ${cb.state.slug} is claimed by another live session (pid ${cb.claim.pid}) — flow use ${cb.state.slug} takes it over explicitly.`;
|
|
1862
1932
|
const curBr = await currentBranch(ctx.cwd);
|
|
1863
1933
|
if (curBr && curBr !== cfg.defaultBranch) content += ` Also: main checkout is on ${curBr}, not ${cfg.defaultBranch} — surface this to the operator before starting work.`;
|
|
@@ -1865,10 +1935,15 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1865
1935
|
if (refl0.length) content += ` Also: ${refl0.length} reflection(s) open — run flow doctor.`;
|
|
1866
1936
|
const rmap0 = roadmapOpenCount(readRoadmap(ctx.cwd));
|
|
1867
1937
|
if (rmap0) content += ` Also: ${rmap0} roadmap item(s) open — flow roadmap lists them, flow roadmap pick <n> <slug> hands one to flow start.`;
|
|
1868
|
-
|
|
1938
|
+
content += ` Also: the playbook map is ${path.join(SKILL_DIR, "SKILL.md")} — per-stage detail sits in references/ beside it (start: flow init, modes, ownership).`;
|
|
1939
|
+
return { message: { customType: "dev-flow-context", display: false, content: `${core}${content}` } };
|
|
1869
1940
|
}
|
|
1870
1941
|
const guidance: string[] = [];
|
|
1871
1942
|
if (state.yolo) guidance.push("YOLO mode: the operator pre-confirmed every gate question from here on (Verified?/Release?/Finish?) — run the remaining gates (verify → release → release-done → finish) back to back without stopping to ask; guidance the operator attached to the yolo word (e.g. patch bump, no tag) is a binding directive for the chain; checks and guardrails stay fully enforced.");
|
|
1943
|
+
// The one playbook file this stage needs, named outright: the model reads it instead of
|
|
1944
|
+
// guessing what a stage asks of it, and it pays for itself the first time a gate is refused.
|
|
1945
|
+
const ref = stageReference(state.stage);
|
|
1946
|
+
if (ref) guidance.push(`Stage playbook: read ${path.join(SKILL_DIR, ref)} before gate work in this stage.`);
|
|
1872
1947
|
const prose = stageGuidance(cfg, state.stage);
|
|
1873
1948
|
if (prose) guidance.push(`Stage guidance (${prose.source}): ${prose.text}`);
|
|
1874
1949
|
const pend = checklistPending(cfg, state, state.stage);
|
|
@@ -1881,7 +1956,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1881
1956
|
message: {
|
|
1882
1957
|
customType: "dev-flow-context",
|
|
1883
1958
|
display: false,
|
|
1884
|
-
content:
|
|
1959
|
+
content: `${core}[dev-flow] this session is bound to: ${state.slug}${state.patch ? " (patch)" : state.docs ? " (docs)" : ""} — stage: ${state.stage}${state.ui ? " (UI)" : ""}${state.worktree ? `, worktree: ${state.worktree} (branch ${state.branch})` : ""}.
|
|
1885
1960
|
Next: ${nextHint(state, cfg)}.
|
|
1886
1961
|
${guidance.length ? guidance.join("\n") + "\n" : ""}Rules: follow the dev-flow skill playbook; gates run through the flow tool only — \`flow\` is not a shell command, and the operator answers words in chat, never commands: you run the gate. \`/flow\` is the operator's manual override, not yours. Stage guards block out-of-stage edits and main-branch git ops — do not work around them.`,
|
|
1887
1962
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"description": "Enforced feature workflow for Pi: plan → implement → pre-release → release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
package/skills/dev-flow/SKILL.md
CHANGED
|
@@ -8,6 +8,8 @@ description: >
|
|
|
8
8
|
outside this flow fails at the guard.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
<!-- dev-flow:core:start -->
|
|
12
|
+
|
|
11
13
|
# dev-flow: the stage-by-stage playbook
|
|
12
14
|
|
|
13
15
|
Only the **flow tool** advances stages, and each gate refuses until its exit
|
|
@@ -19,391 +21,67 @@ Ground rules:
|
|
|
19
21
|
- **The flow tool is the only invocation.** `flow` is **not a shell command**: a
|
|
20
22
|
bash call named `flow` has no binary behind it (the guard refuses it and names
|
|
21
23
|
the tool call) — never reach for bash, `npx`, or a path to run a gate.
|
|
22
|
-
- **You run the gates; the operator says words.**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
- **You run the gates; the operator says words.** Ask the checkpoint word in
|
|
25
|
+
chat, then run the gate yourself. **Checkpoints are one verb: Approve? /
|
|
26
|
+
Verified? / Release? / Finish?** — ask exactly that word as a **plain chat
|
|
27
|
+
message**, mention that **yolo** is an available answer, and stop. The same
|
|
28
|
+
verb (or an explicit equivalent) in chat is the answer; then run that gate
|
|
29
|
+
with `--confirmed` — zero dialogs, **exactly one checkpoint per stage**. A
|
|
30
|
+
structured question tool is not chat and never
|
|
31
|
+
licenses `--confirmed`; never infer the answer. Never ask the operator to type
|
|
32
|
+
a `/flow ...` command: `/flow` is their **manual override** — surface it only
|
|
33
|
+
when the session is demonstrably wrong, stuck, or claiming a gate result it
|
|
34
|
+
never ran (and `/reload` when `flow version` says this session runs an older
|
|
35
|
+
build).
|
|
36
|
+
- **yolo** at any checkpoint → run that gate `--yolo --confirmed`; every later
|
|
37
|
+
checkpoint is pre-confirmed — run the remaining gates back to back without
|
|
38
|
+
asking, honoring guidance attached to the word ("yolo, create a patch
|
|
39
|
+
version release" → bump patch; "yolo, no tag" → `--no-version`). Checks and
|
|
40
|
+
guardrails stay fully enforced — a flow-guard `confirm` rule still asks the
|
|
41
|
+
operator.
|
|
42
|
+
- At Release?, choosing **no version/tag for this flow** →
|
|
43
|
+
`flow release --no-version --confirmed` — the merge still owes a changelog
|
|
44
|
+
entry under `Unreleased`, which the next versioned release folds under its
|
|
45
|
+
version heading (default is versioned: bump + tag).
|
|
29
46
|
- **One session = exactly one feature** (flow + branch + worktree); parallel
|
|
30
47
|
sessions, one feature each, are the model. A session binds **explicitly and
|
|
31
|
-
only**: `flow start <slug>`
|
|
32
|
-
default branch); `flow use <slug>` takes over
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
open-feature count, gates demand an explicit slug and main-checkout writes
|
|
36
|
-
stay blocked. There is no bypass — an unbound session cannot edit source.
|
|
48
|
+
only**: `flow start <slug>` binds its own feature (main checkout must be on
|
|
49
|
+
the default branch); `flow use <slug>` takes one over. Nothing auto-binds.
|
|
50
|
+
Unbound: gates demand an explicit slug and main-checkout writes stay
|
|
51
|
+
blocked — there is no bypass, an unbound session cannot edit source.
|
|
37
52
|
- **Project `flow-guard` rules** (`deny`/`confirm`/`protect`/`forbid` in
|
|
38
53
|
project.md `## global`) apply at **every** stage and are judged ahead of
|
|
39
54
|
dev-flow's verdicts — operator safety rules, not flow discipline. When one
|
|
40
55
|
fires, its reason is the answer: stop, show it, let the operator decide;
|
|
41
56
|
never route around it.
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
- **`.dev-flow/<slug>/state.json` is flow-owned** — never read or write it;
|
|
58
|
+
`flow status` is your view. **project.md is the operator-owned playbook**:
|
|
59
|
+
read freely, **never edit** — it changes through `flow init --write` on the
|
|
60
|
+
operator's word (`flow doctor` reviews what it lacks).
|
|
61
|
+
- **Every bash/shell call states its own `timeout`** or the guard refuses it.
|
|
62
|
+
- **A guard blocking you means you are skipping a stage or writing outside your
|
|
63
|
+
feature** — run the gate instead of working around it. The guard reads
|
|
64
|
+
**commands**: quoted text is an argument's prose (a PR body discussing a
|
|
65
|
+
commit is not a commit), and a wrapper that execs its argument
|
|
66
|
+
(`sh -c "git push origin main"`) is judged on its payload.
|
|
67
|
+
- Abandon a feature with `flow abort <slug>` — never unbind by hand. A gate
|
|
68
|
+
refusal lists exactly what is missing: fix that, rerun the gate.
|
|
53
69
|
- Also obey the repo's own AGENTS.md and project skills: dev-flow sequences
|
|
54
70
|
stages, the project defines its conventions.
|
|
55
|
-
- **A guard blocking you means you are skipping a stage or writing outside
|
|
56
|
-
your feature** — run the gate instead of working around it. The guard reads
|
|
57
|
-
**commands**: quoted text is an argument's prose (a PR body discussing a
|
|
58
|
-
commit is not a commit); a wrapper that execs its argument
|
|
59
|
-
(`sh -c "git push origin main"`) is judged on its payload — blocked commands
|
|
60
|
-
cannot ride through one.
|
|
61
|
-
- **Checkpoints are one verb: Approve? / Verified? / Release? / Finish?** —
|
|
62
|
-
ask exactly that word as a **plain chat message**, mention that **yolo** is
|
|
63
|
-
an available answer, and stop. Never ask the operator to run a flow command
|
|
64
|
-
at a checkpoint — you run the gate when they have answered. The same verb
|
|
65
|
-
(or an explicit equivalent) in chat is the answer; then run that gate with
|
|
66
|
-
`--confirmed` — zero dialogs, **exactly one checkpoint per stage**. A
|
|
67
|
-
structured question tool (AskUserQuestion-style) is not chat and never
|
|
68
|
-
licenses `--confirmed`; never infer the answer.
|
|
69
|
-
- **yolo** at any checkpoint → run that gate `--yolo --confirmed`; every
|
|
70
|
-
later checkpoint is pre-confirmed — run the remaining gates back to back
|
|
71
|
-
without asking, honoring guidance attached to the word ("yolo, create a
|
|
72
|
-
patch version release" → bump patch; "yolo, no tag" → `--no-version`).
|
|
73
|
-
Checks and guardrails stay fully enforced — a flow-guard `confirm` rule
|
|
74
|
-
still asks the operator.
|
|
75
|
-
- At Release?, choosing **no version/tag for this flow** →
|
|
76
|
-
`flow release --no-version --confirmed` — the merge still owes a changelog
|
|
77
|
-
entry under `Unreleased`, which the next versioned release folds under its
|
|
78
|
-
version heading (default is versioned: bump + tag).
|
|
79
|
-
- **Modes are proposed, never taken**: every `flow start` carries the mode and
|
|
80
|
-
a one-line why; the operator grants it in chat and the gate refuses
|
|
81
|
-
`--patch`/`--docs` until the grant is anchored with `--confirmed` — never
|
|
82
|
-
self-grant. `normal` (default): a written plan is enforced (`plan/plan.md`
|
|
83
|
-
before Approve?). `--patch`: a small change you intend to release
|
|
84
|
-
(one-file fix, version chore) — no plan file, one chat line is the plan,
|
|
85
|
-
everything else identical. `--docs`: docs-only — no plan file **and no
|
|
86
|
-
tier-1 checks** (build/lint/test); worktree discipline and the full release
|
|
87
|
-
stay. A change that grows past one line or touches behavior is a normal
|
|
88
|
-
feature, not patch/docs.
|
|
89
|
-
|
|
90
|
-
## Start
|
|
91
|
-
|
|
92
|
-
**No `.dev-flow/`?** `flow init` analyzes the repo and prints a **setup
|
|
93
|
-
brief**: what was detected plus one question per knob detection cannot decide
|
|
94
|
-
(forge github/gitlab/self, version manifest and tag convention, automatic
|
|
95
|
-
forge releases, registry artifacts like Docker Hub, the real
|
|
96
|
-
test/build/lint/health commands, tier-2 items, prose). Relay the questions
|
|
97
|
-
(one per knob, detected default shown, explain in a line when not obvious),
|
|
98
|
-
fill `flow init --draft` with the answers, present it, then apply
|
|
99
|
-
`flow init --write "<content>"` **only after the operator confirms** — never
|
|
100
|
-
hand-edit, never write project.md before the confirmation. The playbook
|
|
101
|
-
belongs in git; the chore is legal unbound:
|
|
102
|
-
`git add -f .dev-flow/project.md && DEV_FLOW_ALLOW_MAIN=1 git commit -m "track project.md"`
|
|
103
|
-
(force — a tracked file outranks a `.gitignore` of `.dev-flow/`; the env
|
|
104
|
-
prefix lets the installed hook accept a main commit that only touches the
|
|
105
|
-
playbook). **With existing config** `flow init` is a **doctor**: discuss
|
|
106
|
-
findings, fix via the same write path, never overwrite hand edits without
|
|
107
|
-
confirming; ghost feature dirs (a `plan/` whose `state.json` is gone) come
|
|
108
|
-
with a delete offer — surface the dialog, never delete on your own.
|
|
109
|
-
`flow doctor` runs the same probes **read-only** (prefer it when you only want
|
|
110
|
-
findings); `--force` re-detects from scratch, `--draft` prints without
|
|
111
|
-
writing.
|
|
112
|
-
|
|
113
|
-
`flow start <slug> [--ui]` — `--ui` whenever anything user-visible is touched;
|
|
114
|
-
slug lowercase words-dashed; check `flow status` for an active feature first.
|
|
115
|
-
|
|
116
|
-
`flow start` **preflights** before it creates anything: it warns when this session runs an older dev-flow
|
|
117
|
-
build than the checkout (`/reload` before trusting gate output), prints the playbook gaps `flow doctor`
|
|
118
|
-
would report, and **refuses while the playbook has no merge policy**. That refusal is a question: ask the
|
|
119
|
-
operator how a merged PR should land on the default branch — `squash`, `merge` (a merge commit), `rebase`,
|
|
120
|
-
or `any` (no policy) — with the suggestion the refusal read off their own history, then re-run
|
|
121
|
-
`flow start <slug> --merge=<style> --confirmed`. The gate writes the answer into `## release` (single-line
|
|
122
|
-
insert, validated, `.bak` kept) and never asks again. Never pick the style yourself and never write
|
|
123
|
-
`project.md` by hand to get rid of the question.
|
|
124
|
-
|
|
125
|
-
## Stage: plan
|
|
126
|
-
|
|
127
|
-
1. Research the code the plan needs (reads are always allowed).
|
|
128
|
-
2. **Clarify before drafting**: preliminary direction in chat (findings, shape
|
|
129
|
-
of the fix, open unknowns), mode proposal with its reason, your questions
|
|
130
|
-
and the operator's; draft only after the direction is confirmed.
|
|
131
|
-
3. Write `.dev-flow/<slug>/plan/plan.md` — problem, approach, files to touch,
|
|
132
|
-
test strategy, risks; reviewable, not exhaustive. First check
|
|
133
|
-
`git log origin/<default>..<default> --oneline`: local-only default-branch
|
|
134
|
-
commits fall out of the worktree's base (push them or re-plan).
|
|
135
|
-
4. **UI flag set?** Mockups live in `plan/mockups/`, one HTML per screen/state
|
|
136
|
-
(`<screen>.html`), linking the project's real stylesheet and class names
|
|
137
|
-
where they exist (relative links work from `.dev-flow/`). Every mockup
|
|
138
|
-
must be **rendered** — an unrendered mockup is not a mockup:
|
|
139
|
-
- Headless chromium: PATH `chromium`/`chromium-browser`/`google-chrome`,
|
|
140
|
-
else playwright's
|
|
141
|
-
`~/.cache/ms-playwright/*/chrome-headless-shell-linux64/chrome-headless-shell`.
|
|
142
|
-
Render at the project's widths (default phone 390, desktop 1280):
|
|
143
|
-
`<binary> --no-sandbox --disable-gpu --hide-scrollbars --virtual-time-budget=5000 --window-size=<width>,<height> --screenshot=plan/mockups/<screen>-<width>.png file://<absolute path to html>`
|
|
144
|
-
— height per screen, re-render if clipped.
|
|
145
|
-
- Embed every render in plan.md under its section —
|
|
146
|
-
``. Image syntax only (a
|
|
147
|
-
filename in prose is a broken link); before Approve? re-check that every
|
|
148
|
-
tag points at an existing file.
|
|
149
|
-
- No chromium anywhere → tell the operator and ask; `*.html`-only plans
|
|
150
|
-
only with their OK (knob: `mockupGlobs`); never fake or skip silently.
|
|
151
|
-
- Gotchas: for a component question prefer a **static strip** — standalone
|
|
152
|
-
HTML with the real stylesheet carrying only the markup in question, one
|
|
153
|
-
first-try render; a full-page render is for layout context only. Shots
|
|
154
|
-
start top-left and never scroll — hide what is above a below-the-fold
|
|
155
|
-
region (inline `<style>`) or use a strip. `--user-data-dir` profiles keep
|
|
156
|
-
localStorage between shots — fresh profile dir per intended UI state.
|
|
157
|
-
Planned behavior must be visibly patched into the shot and captioned as
|
|
158
|
-
such — never caption the current app's render with the behavior you plan
|
|
159
|
-
to add. The app's repaint can destroy a transient state (an inline
|
|
160
|
-
editor) — freeze it for the shot (e.g. stub the render entry point after
|
|
161
|
-
opening). If the harness fights the same shot twice, verify that state
|
|
162
|
-
via DOM/code and move on — screenshots are a spot-check, not a test loop.
|
|
163
|
-
5. Tell the user the plan is ready and **stop** — one word: **Approve?**
|
|
164
|
-
Answered → `flow approve --confirmed` (yolo → `flow approve --yolo
|
|
165
|
-
--confirmed`).
|
|
166
|
-
|
|
167
|
-
Approval creates the worktree and branch, running `commands.setup` inside when
|
|
168
|
-
configured — a failing setup fails the gate and the next `approve` **retries**
|
|
169
|
-
setup in the kept worktree (stamping `setupAt` on success) instead of silently
|
|
170
|
-
reusing it. A `--docs` feature runs no project command at all. No code edits
|
|
171
|
-
before approval. `(ui)` playbook items never apply to non-UI features or
|
|
172
|
-
appear in prompts.
|
|
173
|
-
|
|
174
|
-
## Stage: implement
|
|
175
|
-
|
|
176
|
-
Work happens **only in the worktree** the gate created (path in `flow status`
|
|
177
|
-
or the injection line) — writes elsewhere are blocked; other sessions'
|
|
178
|
-
worktrees are theirs (attribution guards judge every path by its owning
|
|
179
|
-
feature).
|
|
180
|
-
|
|
181
|
-
1. Implement per the approved plan with project conventions and the **stage
|
|
182
|
-
guidance injected at stage start** (tier-3 prose — your playbook's
|
|
183
|
-
`prose.implement`, or dev-flow's built-in senior-discipline guidance when
|
|
184
|
-
the playbook sets none). Commit in the worktree
|
|
185
|
-
**as you go** — small reviewable commits; a twelve-file monolith saved for
|
|
186
|
-
the end faces review blind and is not crash-safe. The gate enforces the
|
|
187
|
-
habit: `flow verify` refuses while the branch holds **no commit** (checks
|
|
188
|
-
describe the working tree, so nothing committed means nothing reviewed was
|
|
189
|
-
ever recorded) and every verify line reports
|
|
190
|
-
`commits: N ahead of <default>, M uncommitted path(s)` — uncommitted paths
|
|
191
|
-
never block verify, they are what the operator sees they are approving.
|
|
192
|
-
2. Write tests as you go (project framework: the `test` key / `flow-check`
|
|
193
|
-
blocks).
|
|
194
|
-
3. `flow check` runs every tier-1 check (test, health, named `flow-check`
|
|
195
|
-
blocks) and records each; any later worktree edit invalidates checks and
|
|
196
|
-
the tier-2 confirmation — rerun before verify.
|
|
197
|
-
4. UI flag set? An actual browser visual pass (screenshot or the project's
|
|
198
|
-
automated pass) — not just a typecheck.
|
|
199
|
-
5. Done means **running and healthy with pre-existing data**, not "compiles":
|
|
200
|
-
`commands.seedData` (if set) puts real data in place, the app starts with
|
|
201
|
-
the `run` command, and the health check passes — `flow check` covers it
|
|
202
|
-
(seedData runs before health) and `flow verify` probes **the deployed app
|
|
203
|
-
again**, because the deploy is what has to be proven. Probes retry every 2s
|
|
204
|
-
up to `healthWait` (default 30s) — a service needing a moment after its
|
|
205
|
-
container starts is not a failed deploy; say so rather than declaring a
|
|
206
|
-
healthy deploy broken. Walk the **tier-2 checklist** (`- [ ]`) with the
|
|
207
|
-
operator honestly — it cannot be scripted. Then ask **Verified?** →
|
|
208
|
-
`flow verify --confirmed`. Fixes = iterate and re-verify; that loop is
|
|
209
|
-
free.
|
|
210
|
-
|
|
211
|
-
`flow verify` re-runs build, runs the `dev` deploy when configured (the
|
|
212
|
-
operator reviews the running app; the gate **prints what it ran** —
|
|
213
|
-
`build ran (…)` / `dev ran (…)` / `dev: none configured`; the command must
|
|
214
|
-
**background and exit**, e.g. `docker compose up -d .` — verify waits and kills
|
|
215
|
-
runs past 15 min), re-runs the health probe **against what it just deployed**
|
|
216
|
-
(`seedData` first when configured; a failing probe retries every 2s up to
|
|
217
|
-
`healthWait`, then refuses the gate reporting its attempts — a pre-deploy PASS
|
|
218
|
-
describes a container that no longer exists; no probe prints
|
|
219
|
-
`health: none configured` and the doctor flags it), and demands all tier-1
|
|
220
|
-
checks green before the single question. The operator's confirm covers the
|
|
221
|
-
tier-2 list as a set (hashed; edits reset it). A `--docs` feature prints
|
|
222
|
-
`docs mode: project commands skipped` and asks only the verify question.
|
|
223
|
-
Verify lands the feature in **pre-release**.
|
|
224
|
-
|
|
225
|
-
Mid-stage additions — do not bounce the flow, do not grow it silently:
|
|
226
|
-
**this feature grew** → stay at implement, append a `**Added mid-stage:**` line
|
|
227
|
-
to `plan.md` (what was asked and how), implement, `flow check` again — edits
|
|
228
|
-
invalidate checks and the tier-2 confirmation, so verify re-covers the
|
|
229
|
-
addition. **Different problem** → finish this feature first, then a new flow
|
|
230
|
-
(`flow start <new-slug>` after this one ships); never fold two features into
|
|
231
|
-
one plan, PR and verify — the
|
|
232
|
-
audit trail is the point. **Heavily amended plan** → show it and have the
|
|
233
|
-
operator re-approve in chat; verify remains the checkpoint — no reopen command
|
|
234
|
-
exists by design.
|
|
235
|
-
|
|
236
|
-
## Stage: pre-release
|
|
237
|
-
|
|
238
|
-
Implemented, tested, running locally; prepare the release entirely in the
|
|
239
|
-
worktree — main-repo git state stays off-limits until this gate hands over.
|
|
240
|
-
**Versioning:** the `versioning.file` manifest is the single source of truth
|
|
241
|
-
and tags are `versioning.pattern` rendered from it — one number everywhere. If
|
|
242
|
-
`versioning.file` is unset, stop and clarify the scheme with the user; never
|
|
243
|
-
invent one mid-release. Sequence:
|
|
244
|
-
|
|
245
|
-
1. `/flow-review` the change; fix every **Must fix** and **Should fix**
|
|
246
|
-
finding; `flow test` again if code changed.
|
|
247
|
-
2. Update documentation to reflect the change.
|
|
248
|
-
3. Update the changelog and bump the manifest to the exact version you will
|
|
249
|
-
tag — manifest, changelog and tag must agree; commit the prep on the feature
|
|
250
|
-
branch. A versioned release **folds the `Unreleased` section** (entries
|
|
251
|
-
`--no-version` flows left there) under the new version heading: the gate
|
|
252
|
-
refuses while entries remain, refuses a fold that **drops or rewrites** one
|
|
253
|
-
(move the lines as they are and reword afterwards in a follow-up), and
|
|
254
|
-
refuses a changelog this branch never touched. `--no-fold-check` skips only
|
|
255
|
-
the line proofs, on the operator's word.
|
|
256
|
-
4. `flow check` — the prep edits invalidated the implement checks; the release
|
|
257
|
-
gate demands them green again.
|
|
258
|
-
5. State what the PR will contain, present version and changelog entry,
|
|
259
|
-
**stop** — **Release?** → `flow release --confirmed`. The gate re-checks
|
|
260
|
-
tier-1, requires the manifest **ahead of the last tag**, a changelog
|
|
261
|
-
**heading** naming that version (a mention in prose is not an entry) and that
|
|
262
|
-
this branch prepared the entry. Operator ships this flow **without
|
|
263
|
-
version/tag** → `flow release --no-version --confirmed` — no bump, but the
|
|
264
|
-
changelog entry under `Unreleased` is still required: the gate proves the
|
|
265
|
-
branch **added a line there**, not that it edited some older section.
|
|
266
|
-
|
|
267
|
-
## Stage: release
|
|
268
|
-
|
|
269
|
-
Cleared for main-repo git (merge/tag/push on the default branch is allowed only
|
|
270
|
-
here) — this stage publishes; the preparation happened in pre-release. Run in
|
|
271
|
-
the worktree unless noted:
|
|
272
|
-
|
|
273
|
-
1. Commit everything, push the feature branch, open the PR, wait for the merge
|
|
274
|
-
(`gh pr merge` or ask the user) — with the **playbook's merge style spelled out**
|
|
275
|
-
(`gh pr merge --squash` under `merge = squash`): the guard blocks a style that contradicts the
|
|
276
|
-
playbook and asks the operator about a merge with no style flag, so let the playbook decide rather
|
|
277
|
-
than the forge default. Merge without `--delete-branch`: it fails when
|
|
278
|
-
the default branch is checked out in the main worktree, and `flow finish`
|
|
279
|
-
deletes the branch on merge proof anyway.
|
|
280
|
-
2. `git fetch`, confirm the merge landed, create the **annotated** tag
|
|
281
|
-
(`git tag -a`) and push the ref explicitly (`git push origin v<ver>`) —
|
|
282
|
-
never `--follow-tags` (it silently skips lightweight tags: they never reach
|
|
283
|
-
the remote, CI never publishes). After the merge a tag points at what
|
|
284
|
-
actually shipped. If CI publishes from the tag, set `release.artifact` in
|
|
285
|
-
the playbook — `release-done` then verifies the published artifact and
|
|
286
|
-
refuses local-only tags outright. Unversioned flow (`--no-version` granted):
|
|
287
|
-
no bump, no tag — publish the merge only (your entry rides under
|
|
288
|
-
`Unreleased` until the next versioned release folds it), `release-done`
|
|
289
|
-
asks nothing version-side.
|
|
290
|
-
3. `flow release-done` — **no question** (the Release? answer covered the
|
|
291
|
-
publication). It re-verifies (tag on the default branch, on origin, artifact
|
|
292
|
-
when configured) against **the version the release gate stamped** — never a
|
|
293
|
-
re-read from a checkout that may be behind — and refuses anything older than
|
|
294
|
-
the newest matching tag on origin (lists come from `git ls-remote`, so an
|
|
295
|
-
unfetched clone never decides what is tagged). It creates the forge release
|
|
296
|
-
— `gh` for GitHub, `glab` for GitLab, nothing for `forge = self`, advisory
|
|
297
|
-
note if a CLI or remote is missing; body = the `release.changelog` entry for
|
|
298
|
-
that version — the changelog is what the release page must read like — else
|
|
299
|
-
the tag's annotation, else nothing with the reason printed (annotate with
|
|
300
|
-
`git tag -a`), and it reads the stored body back and refuses a mismatch
|
|
301
|
-
(#97) — and records the release;
|
|
302
|
-
`flow finish` closes the feature out. Skipping the forge release
|
|
303
|
-
(`--no-release-create`, once, or `release.releases = false`, always) and
|
|
304
|
-
the artifact check (`--no-artifact-check`, once) are operator calls only —
|
|
305
|
-
act when told, never on your own. If this session runs an older build than
|
|
306
|
-
the checkout, **the release gate asks instead of blocking**: it prints both
|
|
307
|
-
builds, lists what shipped between them (those proofs will not run), and
|
|
308
|
-
puts the choice to the operator — **update (`/reload` and re-run) or
|
|
309
|
-
proceed with the old release?** Publishing under an older gate is a
|
|
310
|
-
legitimate choice (hotfix, offline reload); the answer is recorded in the
|
|
311
|
-
release output and `release-done` repeats the acknowledgement as the
|
|
312
|
-
backstop for headless runs.
|
|
313
|
-
Release-stage checklist items have no gate of their own: `release-done`
|
|
314
|
-
lists the open ones and the Finish? answer closes them.
|
|
315
|
-
|
|
316
|
-
## Stage: finish
|
|
317
|
-
|
|
318
|
-
**Reflect before you finish** — `flow finish` deletes `.dev-flow/<slug>/` and
|
|
319
|
-
the session context goes with it. Run the end-of-session reflection (bare
|
|
320
|
-
`flow reflect` protocol under *Reflect*) now and park real issues with
|
|
321
|
-
`flow reflect`; then:
|
|
322
|
-
|
|
323
|
-
- issues parked → ask **Fold? Fix? Drop?** and stop: fold = write the items
|
|
324
|
-
into `.dev-flow/reflections.md` (your queue), fix = route them now via
|
|
325
|
-
`flow doctor`, drop = discard them. The answer replaces **Finish?** — act
|
|
326
|
-
on it, then run `flow finish --confirmed` without asking again;
|
|
327
|
-
- nothing parked → ask the operator **Finish?** → `flow finish --confirmed`.
|
|
328
|
-
|
|
329
|
-
The question covers the whole cleanup and mentions any commits that look
|
|
330
|
-
unmerged. `flow finish [slug]`:
|
|
331
|
-
|
|
332
|
-
- refuses until `release-done` recorded the release — abandoned features go
|
|
333
|
-
through `flow abort` instead;
|
|
334
|
-
- requires the main checkout **clean and pushed** — an uncommitted changelog or
|
|
335
|
-
a local-only release commit is exactly what it protects against;
|
|
336
|
-
- removes the worktree and branch, then deletes `.dev-flow/<slug>/` and
|
|
337
|
-
unbinds the session. A feature branch still on `origin` is deleted **only on
|
|
338
|
-
proof it was merged** — ancestor of `origin/<default>`, or a merged PR via gh
|
|
339
|
-
or glab (what a squash leaves behind); otherwise kept with a note. Uncommitted worktree edits block
|
|
340
|
-
finish; commits that never reached the default branch are read against the playbook's `merge` policy —
|
|
341
|
-
expected under `squash`/`rebase`, a **violation** under `merge` (which `yolo` cannot answer for), and
|
|
342
|
-
called out at Finish? without an operator answer → stop and show them.
|
|
343
|
-
|
|
344
|
-
Production deployment stays manual and out of scope: never ask the operator
|
|
345
|
-
whether a prod deploy happened.
|
|
346
|
-
|
|
347
|
-
## When things go sideways
|
|
348
|
-
|
|
349
|
-
- Abandon a feature: `flow abort <slug>` unbinds — at plan stage (nothing
|
|
350
|
-
approved) it removes the feature outright; once a worktree exists the state
|
|
351
|
-
stays for manual recovery and the exact removal commands are printed.
|
|
352
|
-
- A gate refuses: its reasons list exactly what is missing — fix that, rerun
|
|
353
|
-
the gate.
|
|
354
|
-
|
|
355
|
-
## Reflect (your suggestion queue)
|
|
356
|
-
|
|
357
|
-
Anything the playbook or plugin should improve (drifted commands, gate friction,
|
|
358
|
-
a plugin bug) gets parked, not complained about:
|
|
359
|
-
`flow reflect "<one-line note>"`; gate flags are ignored —
|
|
360
|
-
`flow reflect "<note>" --confirmed` queues the note alone. For a note to chase
|
|
361
|
-
**now**: `flow doctor "<observation>"` prints an investigation brief without
|
|
362
|
-
queueing. Notes land under `## playbook` or `## plugin` — the wording decides,
|
|
363
|
-
a note about both goes to both. The open count shows in status and stage
|
|
364
|
-
context; the operator decides:
|
|
365
71
|
|
|
366
|
-
-
|
|
367
|
-
- **`flow reflect tidy` drops the closed (`- [x]`) items** — the `— fixed:` note has
|
|
368
|
-
already recorded the outcome, so the check-off is history and the file stays
|
|
369
|
-
scannable. Queueing a note, bare `reflect` and `doctor` all print the closed
|
|
370
|
-
count with this verb when the pile grows; offer the tidy to the operator then.
|
|
371
|
-
- **Bare `flow reflect` is the end-of-session reflection** — it runs as part
|
|
372
|
-
of every finish (before the slug folder is deleted — see Stage: finish) and
|
|
373
|
-
whenever the operator asks. It prints the
|
|
374
|
-
protocol: review the full session log (messages, tool calls, results);
|
|
375
|
-
re-check each open item against the current playbook and newer dev-flow
|
|
376
|
-
versions (`npm view pi-dev-flow version` vs the running version, or
|
|
377
|
-
`git ls-remote` for a git-installed copy — a newer one that fixes an
|
|
378
|
-
item → recommend updating the plugin, check it off); queue deduplicated new
|
|
379
|
-
findings; report playbook vs plugin items structurally; ask whether to fix
|
|
380
|
-
now. The command writes nothing; you execute the protocol.
|
|
381
|
-
- Plain `flow doctor` reviews the open items and **routes** each to the flow
|
|
382
|
-
that implements it — playbook item → docs flow; plugin item → upstream issue
|
|
383
|
-
(or a patch/normal flow in the dev-flow repo). To fold items in on the
|
|
384
|
-
operator's word: investigate, propose the fix, get confirmation, open the
|
|
385
|
-
routed flow (playbook items: `flow start fold-<topic> --docs --confirmed`)
|
|
386
|
-
and apply it there — project.md is editable only in that worktree. Check
|
|
387
|
-
items off in `.dev-flow/reflections.md` (your queue, gitignored, yours to
|
|
388
|
-
edit; not `project.md`) with `- [x]` and a `— folded: <what>` or
|
|
389
|
-
`— fixed: <what>` note.
|
|
390
|
-
- `## plugin` items, on the operator's go: search upstream first —
|
|
391
|
-
`gh issue list --repo <dev-flow repo> --state all --search "<keywords>"` —
|
|
392
|
-
an issue the author already answered (fixed or won't-fix) is reported back,
|
|
393
|
-
never re-filed; no match → offer to file one (`gh issue create`; `glab issue
|
|
394
|
-
create` on GitLab) with a detailed description, session evidence and a
|
|
395
|
-
suggested fix; the operator confirms.
|
|
72
|
+
<!-- dev-flow:core:end -->
|
|
396
73
|
|
|
397
|
-
##
|
|
74
|
+
## Which stage you are in
|
|
398
75
|
|
|
399
|
-
|
|
400
|
-
|
|
76
|
+
Everything the stage demands lives beside this file, one file per stage: the
|
|
77
|
+
session's stage injection names the file to read now, and this is the map.
|
|
401
78
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
79
|
+
| Read | For |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `references/start.md` | `flow init` (no `.dev-flow/` yet), mode grants (`--patch`, `--docs`), playbook ownership |
|
|
82
|
+
| `references/plan.md` | plan stage — research, clarify, plan file, mockups, Approve? |
|
|
83
|
+
| `references/implement.md` | implement stage — worktree, commits, checks, tier-2 list, Verified? |
|
|
84
|
+
| `references/pre-release.md` | pre-release — `/flow-review`, docs, changelog + bump, Release? |
|
|
85
|
+
| `references/release.md` | release — PR and merge style, tag, forge release, release-done; hands over to finish |
|
|
86
|
+
| `references/finish.md` | the close-out after `release-done` — reflect first, Finish?, worktree and branch cleanup |
|
|
87
|
+
| `references/reflect.md` | reflections (the suggestion queue) and the roadmap backlog |
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
> Part of the **dev-flow** playbook. The always-on ground rules live in
|
|
2
|
+
> [../SKILL.md](../SKILL.md); this file is the detail for one stage — read it
|
|
3
|
+
> when the session reaches that stage.
|
|
4
|
+
|
|
5
|
+
## Stage: finish
|
|
6
|
+
|
|
7
|
+
**Reflect before you finish** — `flow finish` deletes `.dev-flow/<slug>/` and
|
|
8
|
+
the session context goes with it. Run the end-of-session reflection (bare
|
|
9
|
+
`flow reflect` protocol under *Reflect*) now and park real issues with
|
|
10
|
+
`flow reflect`; then:
|
|
11
|
+
|
|
12
|
+
- issues parked → ask **Fold? Fix? Drop?** and stop: fold = write the items
|
|
13
|
+
into `.dev-flow/reflections.md` (your queue), fix = route them now via
|
|
14
|
+
`flow doctor`, drop = discard them. The answer replaces **Finish?** — act
|
|
15
|
+
on it, then run `flow finish --confirmed` without asking again;
|
|
16
|
+
- nothing parked → ask the operator **Finish?** → `flow finish --confirmed`.
|
|
17
|
+
|
|
18
|
+
The question covers the whole cleanup and mentions any commits that look
|
|
19
|
+
unmerged. `flow finish [slug]`:
|
|
20
|
+
|
|
21
|
+
- refuses until `release-done` recorded the release — abandoned features go
|
|
22
|
+
through `flow abort` instead;
|
|
23
|
+
- requires the main checkout **clean and pushed** — an uncommitted changelog or
|
|
24
|
+
a local-only release commit is exactly what it protects against;
|
|
25
|
+
- removes the worktree and branch, then deletes `.dev-flow/<slug>/` and
|
|
26
|
+
unbinds the session. A feature branch still on `origin` is deleted **only on
|
|
27
|
+
proof it was merged** — ancestor of `origin/<default>`, or a merged PR via gh
|
|
28
|
+
or glab (what a squash leaves behind); otherwise kept with a note. Uncommitted worktree edits block
|
|
29
|
+
finish; commits that never reached the default branch are read against the playbook's `merge` policy —
|
|
30
|
+
expected under `squash`/`rebase`, a **violation** under `merge` (which `yolo` cannot answer for), and
|
|
31
|
+
called out at Finish? without an operator answer → stop and show them.
|
|
32
|
+
|
|
33
|
+
Production deployment stays manual and out of scope: never ask the operator
|
|
34
|
+
whether a prod deploy happened.
|
|
35
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
> Part of the **dev-flow** playbook. The always-on ground rules live in
|
|
2
|
+
> [../SKILL.md](../SKILL.md); this file is the detail for one stage — read it
|
|
3
|
+
> when the session reaches that stage.
|
|
4
|
+
|
|
5
|
+
## Stage: implement
|
|
6
|
+
|
|
7
|
+
Work happens **only in the worktree** the gate created (path in `flow status`
|
|
8
|
+
or the injection line) — writes elsewhere are blocked; other sessions'
|
|
9
|
+
worktrees are theirs (attribution guards judge every path by its owning
|
|
10
|
+
feature).
|
|
11
|
+
|
|
12
|
+
1. Implement per the approved plan with project conventions and the **stage
|
|
13
|
+
guidance injected at stage start** (tier-3 prose — your playbook's
|
|
14
|
+
`prose.implement`, or dev-flow's built-in senior-discipline guidance when
|
|
15
|
+
the playbook sets none). Commit in the worktree
|
|
16
|
+
**as you go** — small reviewable commits; a twelve-file monolith saved for
|
|
17
|
+
the end faces review blind and is not crash-safe. The gate enforces the
|
|
18
|
+
habit: `flow verify` refuses while the branch holds **no commit** (checks
|
|
19
|
+
describe the working tree, so nothing committed means nothing reviewed was
|
|
20
|
+
ever recorded) and every verify line reports
|
|
21
|
+
`commits: N ahead of <default>, M uncommitted path(s)` — uncommitted paths
|
|
22
|
+
never block verify, they are what the operator sees they are approving.
|
|
23
|
+
2. Write tests as you go (project framework: the `test` key / `flow-check`
|
|
24
|
+
blocks).
|
|
25
|
+
3. `flow check` runs every tier-1 check (test, health, named `flow-check`
|
|
26
|
+
blocks) and records each; any later worktree edit invalidates checks and
|
|
27
|
+
the tier-2 confirmation — rerun before verify.
|
|
28
|
+
4. UI flag set? An actual browser visual pass (screenshot or the project's
|
|
29
|
+
automated pass) — not just a typecheck.
|
|
30
|
+
5. Done means **running and healthy with pre-existing data**, not "compiles":
|
|
31
|
+
`commands.seedData` (if set) puts real data in place, the app starts with
|
|
32
|
+
the `run` command, and the health check passes — `flow check` covers it
|
|
33
|
+
(seedData runs before health) and `flow verify` probes **the deployed app
|
|
34
|
+
again**, because the deploy is what has to be proven. Probes retry every 2s
|
|
35
|
+
up to `healthWait` (default 30s) — a service needing a moment after its
|
|
36
|
+
container starts is not a failed deploy; say so rather than declaring a
|
|
37
|
+
healthy deploy broken. Walk the **tier-2 checklist** (`- [ ]`) with the
|
|
38
|
+
operator honestly — it cannot be scripted. Then ask **Verified?** →
|
|
39
|
+
`flow verify --confirmed`. Fixes = iterate and re-verify; that loop is
|
|
40
|
+
free.
|
|
41
|
+
|
|
42
|
+
`flow verify` re-runs build, runs the `dev` deploy when configured (the
|
|
43
|
+
operator reviews the running app; the gate **prints what it ran** —
|
|
44
|
+
`build ran (…)` / `dev ran (…)` / `dev: none configured`; the command must
|
|
45
|
+
**background and exit**, e.g. `docker compose up -d .` — verify waits and kills
|
|
46
|
+
runs past 15 min), re-runs the health probe **against what it just deployed**
|
|
47
|
+
(`seedData` first when configured; a failing probe retries every 2s up to
|
|
48
|
+
`healthWait`, then refuses the gate reporting its attempts — a pre-deploy PASS
|
|
49
|
+
describes a container that no longer exists; no probe prints
|
|
50
|
+
`health: none configured` and the doctor flags it), and demands all tier-1
|
|
51
|
+
checks green before the single question. The operator's confirm covers the
|
|
52
|
+
tier-2 list as a set (hashed; edits reset it). A `--docs` feature prints
|
|
53
|
+
`docs mode: project commands skipped` and asks only the verify question.
|
|
54
|
+
Verify lands the feature in **pre-release**.
|
|
55
|
+
|
|
56
|
+
Mid-stage additions — do not bounce the flow, do not grow it silently:
|
|
57
|
+
**this feature grew** → stay at implement, append a `**Added mid-stage:**` line
|
|
58
|
+
to `plan.md` (what was asked and how), implement, `flow check` again — edits
|
|
59
|
+
invalidate checks and the tier-2 confirmation, so verify re-covers the
|
|
60
|
+
addition. **Different problem** → finish this feature first, then a new flow
|
|
61
|
+
(`flow start <new-slug>` after this one ships); never fold two features into
|
|
62
|
+
one plan, PR and verify — the
|
|
63
|
+
audit trail is the point. **Heavily amended plan** → show it and have the
|
|
64
|
+
operator re-approve in chat; verify remains the checkpoint — no reopen command
|
|
65
|
+
exists by design.
|
|
66
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
> Part of the **dev-flow** playbook. The always-on ground rules live in
|
|
2
|
+
> [../SKILL.md](../SKILL.md); this file is the detail for one stage — read it
|
|
3
|
+
> when the session reaches that stage.
|
|
4
|
+
|
|
5
|
+
## Stage: plan
|
|
6
|
+
|
|
7
|
+
1. Research the code the plan needs (reads are always allowed).
|
|
8
|
+
2. **Clarify before drafting**: preliminary direction in chat (findings, shape
|
|
9
|
+
of the fix, open unknowns), mode proposal with its reason, your questions
|
|
10
|
+
and the operator's; draft only after the direction is confirmed.
|
|
11
|
+
3. Write `.dev-flow/<slug>/plan/plan.md` — problem, approach, files to touch,
|
|
12
|
+
test strategy, risks; reviewable, not exhaustive. First check
|
|
13
|
+
`git log origin/<default>..<default> --oneline`: local-only default-branch
|
|
14
|
+
commits fall out of the worktree's base (push them or re-plan).
|
|
15
|
+
4. **UI flag set?** Mockups live in `plan/mockups/`, one HTML per screen/state
|
|
16
|
+
(`<screen>.html`), linking the project's real stylesheet and class names
|
|
17
|
+
where they exist (relative links work from `.dev-flow/`). Every mockup
|
|
18
|
+
must be **rendered** — an unrendered mockup is not a mockup:
|
|
19
|
+
- Headless chromium: PATH `chromium`/`chromium-browser`/`google-chrome`,
|
|
20
|
+
else playwright's
|
|
21
|
+
`~/.cache/ms-playwright/*/chrome-headless-shell-linux64/chrome-headless-shell`.
|
|
22
|
+
Render at the project's widths (default phone 390, desktop 1280):
|
|
23
|
+
`<binary> --no-sandbox --disable-gpu --hide-scrollbars --virtual-time-budget=5000 --window-size=<width>,<height> --screenshot=plan/mockups/<screen>-<width>.png file://<absolute path to html>`
|
|
24
|
+
— height per screen, re-render if clipped.
|
|
25
|
+
- Embed every render in plan.md under its section —
|
|
26
|
+
``. Image syntax only (a
|
|
27
|
+
filename in prose is a broken link); before Approve? re-check that every
|
|
28
|
+
tag points at an existing file.
|
|
29
|
+
- No chromium anywhere → tell the operator and ask; `*.html`-only plans
|
|
30
|
+
only with their OK (knob: `mockupGlobs`); never fake or skip silently.
|
|
31
|
+
- Gotchas: for a component question prefer a **static strip** — standalone
|
|
32
|
+
HTML with the real stylesheet carrying only the markup in question, one
|
|
33
|
+
first-try render; a full-page render is for layout context only. Shots
|
|
34
|
+
start top-left and never scroll — hide what is above a below-the-fold
|
|
35
|
+
region (inline `<style>`) or use a strip. `--user-data-dir` profiles keep
|
|
36
|
+
localStorage between shots — fresh profile dir per intended UI state.
|
|
37
|
+
Planned behavior must be visibly patched into the shot and captioned as
|
|
38
|
+
such — never caption the current app's render with the behavior you plan
|
|
39
|
+
to add. The app's repaint can destroy a transient state (an inline
|
|
40
|
+
editor) — freeze it for the shot (e.g. stub the render entry point after
|
|
41
|
+
opening). If the harness fights the same shot twice, verify that state
|
|
42
|
+
via DOM/code and move on — screenshots are a spot-check, not a test loop.
|
|
43
|
+
5. Tell the user the plan is ready and **stop** — one word: **Approve?**
|
|
44
|
+
Answered → `flow approve --confirmed` (yolo → `flow approve --yolo
|
|
45
|
+
--confirmed`).
|
|
46
|
+
|
|
47
|
+
Approval creates the worktree and branch, running `commands.setup` inside when
|
|
48
|
+
configured — a failing setup fails the gate and the next `approve` **retries**
|
|
49
|
+
setup in the kept worktree (stamping `setupAt` on success) instead of silently
|
|
50
|
+
reusing it. A `--docs` feature runs no project command at all. No code edits
|
|
51
|
+
before approval. `(ui)` playbook items never apply to non-UI features or
|
|
52
|
+
appear in prompts.
|
|
53
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
> Part of the **dev-flow** playbook. The always-on ground rules live in
|
|
2
|
+
> [../SKILL.md](../SKILL.md); this file is the detail for one stage — read it
|
|
3
|
+
> when the session reaches that stage.
|
|
4
|
+
|
|
5
|
+
## Stage: pre-release
|
|
6
|
+
|
|
7
|
+
Implemented, tested, running locally; prepare the release entirely in the
|
|
8
|
+
worktree — main-repo git state stays off-limits until this gate hands over.
|
|
9
|
+
**Versioning:** the `versioning.file` manifest is the single source of truth
|
|
10
|
+
and tags are `versioning.pattern` rendered from it — one number everywhere. If
|
|
11
|
+
`versioning.file` is unset, stop and clarify the scheme with the user; never
|
|
12
|
+
invent one mid-release. Sequence:
|
|
13
|
+
|
|
14
|
+
1. `/flow-review` the change; fix every **Must fix** and **Should fix**
|
|
15
|
+
finding; `flow test` again if code changed.
|
|
16
|
+
2. Update documentation to reflect the change.
|
|
17
|
+
3. Update the changelog and bump the manifest to the exact version you will
|
|
18
|
+
tag — manifest, changelog and tag must agree; commit the prep on the feature
|
|
19
|
+
branch. A versioned release **folds the `Unreleased` section** (entries
|
|
20
|
+
`--no-version` flows left there) under the new version heading: the gate
|
|
21
|
+
refuses while entries remain, refuses a fold that **drops or rewrites** one
|
|
22
|
+
(move the lines as they are and reword afterwards in a follow-up), and
|
|
23
|
+
refuses a changelog this branch never touched. `--no-fold-check` skips only
|
|
24
|
+
the line proofs, on the operator's word.
|
|
25
|
+
4. `flow check` — the prep edits invalidated the implement checks; the release
|
|
26
|
+
gate demands them green again.
|
|
27
|
+
5. State what the PR will contain, present version and changelog entry,
|
|
28
|
+
**stop** — **Release?** → `flow release --confirmed`. The gate re-checks
|
|
29
|
+
tier-1, requires the manifest **ahead of the last tag**, a changelog
|
|
30
|
+
**heading** naming that version (a mention in prose is not an entry) and that
|
|
31
|
+
this branch prepared the entry. Operator ships this flow **without
|
|
32
|
+
version/tag** → `flow release --no-version --confirmed` — no bump, but the
|
|
33
|
+
changelog entry under `Unreleased` is still required: the gate proves the
|
|
34
|
+
branch **added a line there**, not that it edited some older section.
|
|
35
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
> Part of the **dev-flow** playbook. The always-on ground rules live in
|
|
2
|
+
> [../SKILL.md](../SKILL.md); this file is the detail for one stage — read it
|
|
3
|
+
> when the session reaches that stage.
|
|
4
|
+
|
|
5
|
+
## Reflect (your suggestion queue)
|
|
6
|
+
|
|
7
|
+
Anything the playbook or plugin should improve (drifted commands, gate friction,
|
|
8
|
+
a plugin bug) gets parked, not complained about:
|
|
9
|
+
`flow reflect "<one-line note>"`; gate flags are ignored —
|
|
10
|
+
`flow reflect "<note>" --confirmed` queues the note alone. For a note to chase
|
|
11
|
+
**now**: `flow doctor "<observation>"` prints an investigation brief without
|
|
12
|
+
queueing. Notes land under `## playbook` or `## plugin` — the wording decides,
|
|
13
|
+
a note about both goes to both. The open count shows in status and stage
|
|
14
|
+
context; the operator decides:
|
|
15
|
+
|
|
16
|
+
- Reflect real friction only, one line each, never the same issue twice.
|
|
17
|
+
- **`flow reflect tidy` drops the closed (`- [x]`) items** — the `— fixed:` note has
|
|
18
|
+
already recorded the outcome, so the check-off is history and the file stays
|
|
19
|
+
scannable. Queueing a note, bare `reflect` and `doctor` all print the closed
|
|
20
|
+
count with this verb when the pile grows; offer the tidy to the operator then.
|
|
21
|
+
- **Bare `flow reflect` is the end-of-session reflection** — it runs as part
|
|
22
|
+
of every finish (before the slug folder is deleted — see Stage: finish) and
|
|
23
|
+
whenever the operator asks. It prints the
|
|
24
|
+
protocol: review the full session log (messages, tool calls, results);
|
|
25
|
+
re-check each open item against the current playbook and newer dev-flow
|
|
26
|
+
versions (`npm view pi-dev-flow version` vs the running version, or
|
|
27
|
+
`git ls-remote` for a git-installed copy — a newer one that fixes an
|
|
28
|
+
item → recommend updating the plugin, check it off); queue deduplicated new
|
|
29
|
+
findings; report playbook vs plugin items structurally; ask whether to fix
|
|
30
|
+
now. The command writes nothing; you execute the protocol.
|
|
31
|
+
- Plain `flow doctor` reviews the open items and **routes** each to the flow
|
|
32
|
+
that implements it — playbook item → docs flow; plugin item → upstream issue
|
|
33
|
+
(or a patch/normal flow in the dev-flow repo). To fold items in on the
|
|
34
|
+
operator's word: investigate, propose the fix, get confirmation, open the
|
|
35
|
+
routed flow (playbook items: `flow start fold-<topic> --docs --confirmed`)
|
|
36
|
+
and apply it there — project.md is editable only in that worktree. Check
|
|
37
|
+
items off in `.dev-flow/reflections.md` (your queue, gitignored, yours to
|
|
38
|
+
edit; not `project.md`) with `- [x]` and a `— folded: <what>` or
|
|
39
|
+
`— fixed: <what>` note.
|
|
40
|
+
- `## plugin` items, on the operator's go: search upstream first —
|
|
41
|
+
`gh issue list --repo <dev-flow repo> --state all --search "<keywords>"` —
|
|
42
|
+
an issue the author already answered (fixed or won't-fix) is reported back,
|
|
43
|
+
never re-filed; no match → offer to file one (`gh issue create`; `glab issue
|
|
44
|
+
create` on GitLab) with a detailed description, session evidence and a
|
|
45
|
+
suggested fix; the operator confirms.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Roadmap (your backlog)
|
|
49
|
+
|
|
50
|
+
`.dev-flow/roadmap.md` — a gitignored `- [ ]` checklist; the operator owns the
|
|
51
|
+
content, you maintain and honor it. Advisory like reflections, never gating:
|
|
52
|
+
|
|
53
|
+
- `flow roadmap` lists the open items (the count is surfaced in status and
|
|
54
|
+
stage context). Update on the operator's request —
|
|
55
|
+
`flow roadmap add "<feature>"` or direct file edits are equally fine.
|
|
56
|
+
- Handed a feature: `flow roadmap pick <n> <slug>` stamps the item with the
|
|
57
|
+
slug (pick is one verb — it starts nothing), then `flow start <slug>` builds
|
|
58
|
+
it as a normal flow; its `flow finish` checks the item off automatically.
|
|
59
|
+
- Shipped outside a flow: `flow roadmap done <n>` (date-stamped by hand);
|
|
60
|
+
`flow roadmap tidy` drops checked lines when history clutters the list.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
> Part of the **dev-flow** playbook. The always-on ground rules live in
|
|
2
|
+
> [../SKILL.md](../SKILL.md); this file is the detail for one stage — read it
|
|
3
|
+
> when the session reaches that stage.
|
|
4
|
+
|
|
5
|
+
## Stage: release
|
|
6
|
+
|
|
7
|
+
Cleared for main-repo git (merge/tag/push on the default branch is allowed only
|
|
8
|
+
here) — this stage publishes; the preparation happened in pre-release. Run in
|
|
9
|
+
the worktree unless noted:
|
|
10
|
+
|
|
11
|
+
1. Commit everything, push the feature branch, open the PR, wait for the merge
|
|
12
|
+
(`gh pr merge` or ask the user) — with the **playbook's merge style spelled out**
|
|
13
|
+
(`gh pr merge --squash` under `merge = squash`): the guard blocks a style that contradicts the
|
|
14
|
+
playbook and asks the operator about a merge with no style flag, so let the playbook decide rather
|
|
15
|
+
than the forge default. Merge without `--delete-branch`: it fails when
|
|
16
|
+
the default branch is checked out in the main worktree, and `flow finish`
|
|
17
|
+
deletes the branch on merge proof anyway.
|
|
18
|
+
2. `git fetch`, confirm the merge landed, create the **annotated** tag
|
|
19
|
+
(`git tag -a`) and push the ref explicitly (`git push origin v<ver>`) —
|
|
20
|
+
never `--follow-tags` (it silently skips lightweight tags: they never reach
|
|
21
|
+
the remote, CI never publishes). After the merge a tag points at what
|
|
22
|
+
actually shipped. If CI publishes from the tag, set `release.artifact` in
|
|
23
|
+
the playbook — `release-done` then verifies the published artifact and
|
|
24
|
+
refuses local-only tags outright. Unversioned flow (`--no-version` granted):
|
|
25
|
+
no bump, no tag — publish the merge only (your entry rides under
|
|
26
|
+
`Unreleased` until the next versioned release folds it), `release-done`
|
|
27
|
+
asks nothing version-side.
|
|
28
|
+
3. `flow release-done` — **no question** (the Release? answer covered the
|
|
29
|
+
publication). It re-verifies (tag on the default branch, on origin, artifact
|
|
30
|
+
when configured) against **the version the release gate stamped** — never a
|
|
31
|
+
re-read from a checkout that may be behind — and refuses anything older than
|
|
32
|
+
the newest matching tag on origin (lists come from `git ls-remote`, so an
|
|
33
|
+
unfetched clone never decides what is tagged). It creates the forge release
|
|
34
|
+
— `gh` for GitHub, `glab` for GitLab, nothing for `forge = self`, advisory
|
|
35
|
+
note if a CLI or remote is missing; body = the `release.changelog` entry for
|
|
36
|
+
that version — the changelog is what the release page must read like — else
|
|
37
|
+
the tag's annotation, else nothing with the reason printed (annotate with
|
|
38
|
+
`git tag -a`), and it reads the stored body back and refuses a mismatch
|
|
39
|
+
(#97) — and records the release;
|
|
40
|
+
`flow finish` closes the feature out. Skipping the forge release
|
|
41
|
+
(`--no-release-create`, once, or `release.releases = false`, always) and
|
|
42
|
+
the artifact check (`--no-artifact-check`, once) are operator calls only —
|
|
43
|
+
act when told, never on your own. If this session runs an older build than
|
|
44
|
+
the checkout, **the release gate asks instead of blocking**: it prints both
|
|
45
|
+
builds, lists what shipped between them (those proofs will not run), and
|
|
46
|
+
puts the choice to the operator — **update (`/reload` and re-run) or
|
|
47
|
+
proceed with the old release?** Publishing under an older gate is a
|
|
48
|
+
legitimate choice (hotfix, offline reload); the answer is recorded in the
|
|
49
|
+
release output and `release-done` repeats the acknowledgement as the
|
|
50
|
+
backstop for headless runs.
|
|
51
|
+
Release-stage checklist items have no gate of their own: `release-done`
|
|
52
|
+
lists the open ones and the Finish? answer closes them.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
Once `flow release-done` has recorded the release, the playbook continues in
|
|
56
|
+
[finish.md](finish.md) — reflect first, then **Finish?**, then cleanup.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
> Part of the **dev-flow** playbook. The always-on ground rules live in
|
|
2
|
+
> [../SKILL.md](../SKILL.md); this file is the detail for one stage — read it
|
|
3
|
+
> when the session reaches that stage.
|
|
4
|
+
|
|
5
|
+
## Start
|
|
6
|
+
|
|
7
|
+
**No `.dev-flow/`?** `flow init` analyzes the repo and prints a **setup
|
|
8
|
+
brief**: what was detected plus one question per knob detection cannot decide
|
|
9
|
+
(forge github/gitlab/self, version manifest and tag convention, automatic
|
|
10
|
+
forge releases, registry artifacts like Docker Hub, the real
|
|
11
|
+
test/build/lint/health commands, tier-2 items, prose). Relay the questions
|
|
12
|
+
(one per knob, detected default shown, explain in a line when not obvious),
|
|
13
|
+
fill `flow init --draft` with the answers, present it, then apply
|
|
14
|
+
`flow init --write "<content>"` **only after the operator confirms** — never
|
|
15
|
+
hand-edit, never write project.md before the confirmation. The playbook
|
|
16
|
+
belongs in git; the chore is legal unbound:
|
|
17
|
+
`git add -f .dev-flow/project.md && DEV_FLOW_ALLOW_MAIN=1 git commit -m "track project.md"`
|
|
18
|
+
(force — a tracked file outranks a `.gitignore` of `.dev-flow/`; the env
|
|
19
|
+
prefix lets the installed hook accept a main commit that only touches the
|
|
20
|
+
playbook). **With existing config** `flow init` is a **doctor**: discuss
|
|
21
|
+
findings, fix via the same write path, never overwrite hand edits without
|
|
22
|
+
confirming; ghost feature dirs (a `plan/` whose `state.json` is gone) come
|
|
23
|
+
with a delete offer — surface the dialog, never delete on your own.
|
|
24
|
+
`flow doctor` runs the same probes **read-only** (prefer it when you only want
|
|
25
|
+
findings); `--force` re-detects from scratch, `--draft` prints without
|
|
26
|
+
writing.
|
|
27
|
+
|
|
28
|
+
`flow start <slug> [--ui]` — `--ui` whenever anything user-visible is touched;
|
|
29
|
+
slug lowercase words-dashed; check `flow status` for an active feature first.
|
|
30
|
+
|
|
31
|
+
`flow start` **preflights** before it creates anything: it warns when this session runs an older dev-flow
|
|
32
|
+
build than the checkout (`/reload` before trusting gate output), prints the playbook gaps `flow doctor`
|
|
33
|
+
would report, and **refuses while the playbook has no merge policy**. That refusal is a question: ask the
|
|
34
|
+
operator how a merged PR should land on the default branch — `squash`, `merge` (a merge commit), `rebase`,
|
|
35
|
+
or `any` (no policy) — with the suggestion the refusal read off their own history, then re-run
|
|
36
|
+
`flow start <slug> --merge=<style> --confirmed`. The gate writes the answer into `## release` (single-line
|
|
37
|
+
insert, validated, `.bak` kept) and never asks again. Never pick the style yourself and never write
|
|
38
|
+
`project.md` by hand to get rid of the question.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### Moved here from the ground rules
|
|
44
|
+
|
|
45
|
+
Modes are carried by `flow start` and belong to it:
|
|
46
|
+
|
|
47
|
+
- **Modes are proposed, never taken**: every `flow start` carries the mode and
|
|
48
|
+
a one-line why; the operator grants it in chat and the gate refuses
|
|
49
|
+
`--patch`/`--docs` until the grant is anchored with `--confirmed` — never
|
|
50
|
+
self-grant. `normal` (default): a written plan is enforced (`plan/plan.md`
|
|
51
|
+
before Approve?). `--patch`: a small change you intend to release
|
|
52
|
+
(one-file fix, version chore) — no plan file, one chat line is the plan,
|
|
53
|
+
everything else identical. `--docs`: docs-only — no plan file **and no
|
|
54
|
+
tier-1 checks** (build/lint/test); worktree discipline and the full release
|
|
55
|
+
stay. A change that grows past one line or touches behavior is a normal
|
|
56
|
+
feature, not patch/docs.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
Playbook ownership, in full:
|
|
60
|
+
|
|
61
|
+
- `.dev-flow/<slug>/state.json` is flow-owned — never read or write it;
|
|
62
|
+
`flow status` is your view. **project.md is the operator-owned playbook**
|
|
63
|
+
(test/build/run commands, default branch, forge, worktree path, safety
|
|
64
|
+
rules): read freely, **never edit** — changes go through `flow init --write`
|
|
65
|
+
on the operator's word. In-life playbook updates run as a docs flow:
|
|
66
|
+
project.md is editable only inside a docs/patch flow's worktree and is
|
|
67
|
+
committed to git like any file. A leftover `project.json` is never read; the
|
|
68
|
+
doctor flags it.
|
package/src/core.ts
CHANGED
|
@@ -141,6 +141,39 @@ export function stageGuidance(cfg: Config, stage: Stage): { text: string; source
|
|
|
141
141
|
return text ? { text, source: "dev-flow default" } : undefined;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/** Markers around the always-on core of `skills/dev-flow/SKILL.md`. Pi advertises a skill
|
|
145
|
+
* (name, description, path) and loads the body only when the model chooses to read it, so
|
|
146
|
+
* nothing in the file is guaranteed in front of the model. The extension injects what sits
|
|
147
|
+
* between these markers once per session; everything outside them (the stage map, and
|
|
148
|
+
* `references/` per stage) is read on demand. */
|
|
149
|
+
export const SKILL_CORE_START = "<!-- dev-flow:core:start -->";
|
|
150
|
+
export const SKILL_CORE_END = "<!-- dev-flow:core:end -->";
|
|
151
|
+
|
|
152
|
+
/** The always-on core of the dev-flow skill: the text between the markers, or null when the
|
|
153
|
+
* markers are missing, reversed or hold nothing. Null is a fallback, not an error — a checkout
|
|
154
|
+
* without `skills/`, or a botched edit, must leave the injection exactly as it was and must
|
|
155
|
+
* never throw inside a guard hook. */
|
|
156
|
+
export function extractSkillCore(md: string): string | null {
|
|
157
|
+
const a = md.indexOf(SKILL_CORE_START);
|
|
158
|
+
const b = md.indexOf(SKILL_CORE_END);
|
|
159
|
+
if (a < 0 || b < 0 || b < a) return null;
|
|
160
|
+
const core = md.slice(a + SKILL_CORE_START.length, b).trim();
|
|
161
|
+
return core || null;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** The playbook file carrying one stage's detail, relative to the skill directory. `done` has
|
|
165
|
+
* none (nothing left to read). The state machine has no finish stage — closing out happens inside
|
|
166
|
+
* `release`, and release.md hands over to finish.md there. The pre-flow brief is `start`. */
|
|
167
|
+
const STAGE_REFERENCE: Partial<Record<Stage, string>> = {
|
|
168
|
+
plan: "references/plan.md",
|
|
169
|
+
implement: "references/implement.md",
|
|
170
|
+
"pre-release": "references/pre-release.md",
|
|
171
|
+
release: "references/release.md",
|
|
172
|
+
};
|
|
173
|
+
export function stageReference(stage: Stage): string | null {
|
|
174
|
+
return STAGE_REFERENCE[stage] ?? null;
|
|
175
|
+
}
|
|
176
|
+
|
|
144
177
|
/** Build a Config from DEFAULTS + a partial overrides object (tests, drafts — the persisted
|
|
145
178
|
* source is project.md alone; the legacy project.json loader is gone). */
|
|
146
179
|
export function buildConfig(raw: unknown): Config {
|