pi-dev-flow 0.59.1 → 0.60.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 +6 -0
- package/README.md +4 -0
- package/docs/guardrails.md +2 -2
- package/extensions/dev-flow.ts +27 -17
- package/package.json +1 -1
- package/skills/dev-flow/SKILL.md +1 -1
- package/src/core.ts +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.60.0] - 2026-10-23
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **dev-flow is fully dormant until the playbook exists — and fully present after.** *Initiated* now means exactly one thing: `.dev-flow/project.md` (written by `flow init`) exists. Until then a folder hears nothing at all: no context injection, no footer, and no guards — the stage discipline, main-branch git rules and the bash-timeout refusal and its silent arming included (`flow init` is the opt-in; a stray `.dev-flow/` without the playbook keeps the folder asleep), and every gate verb but `flow init`/`flow version` says so plainly instead of half-running. Once initiated, the footer never goes silent: bound sessions see the stage glyph + slug as before, unbound ones the `⧖ N flow(s) open` count, and a repo with nothing in flight now shows `⧖ no flows` instead of nothing — you can see dev-flow is watching. The footer also repaints at the **start** of every agent run, not just at session start and turn end: `setStatus` is a fire-and-forget push in pi-web, and run start is the earliest moment a late-attaching web client is certainly listening (a push the browser missed before attaching could leave the bar blank until the next gate).
|
|
12
|
+
|
|
7
13
|
## [0.59.1] - 2026-10-23
|
|
8
14
|
|
|
9
15
|
### Fixed
|
package/README.md
CHANGED
|
@@ -56,6 +56,10 @@ package — so keep the one you actually update from: `flow version` lists every
|
|
|
56
56
|
registered in the process, and the on-disk session claim keeps the guard of a copy that never served
|
|
57
57
|
a flow call attributing your commands correctly.
|
|
58
58
|
|
|
59
|
+
Until `flow init` writes the playbook (`.dev-flow/project.md`), dev-flow says nothing in a repo — no
|
|
60
|
+
injections, no guards, no footer: the playbook is the opt-in. A stray `.dev-flow/` without it keeps
|
|
61
|
+
the folder dormant.
|
|
62
|
+
|
|
59
63
|
Then, once per project repo, `/flow init`. It reads the repo (default branch and forge from git,
|
|
60
64
|
package manager, test/build/run conventions, version manifest) and writes **`.dev-flow/project.md`
|
|
61
65
|
— your playbook**: the commands that count as checks, the manual checklist, the version and tag
|
package/docs/guardrails.md
CHANGED
|
@@ -12,10 +12,10 @@ While a feature is active, the extension intercepts every tool call:
|
|
|
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
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.
|
|
14
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.
|
|
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.
|
|
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. In an initiated repo (`.dev-flow/project.md` exists) the call is therefore by default **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. Uninitiated folders hear nothing at all: without the playbook dev-flow enforces no rules.
|
|
16
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`.
|
|
17
17
|
- The active stage is injected into the model's context every turn; the bundled `dev-flow` skill is the agent's playbook, including the recommended sequences: pre-release — review (`/flow-review`) → fixes → docs → changelog/version bump; release — PR → merge → tag → `release-done`. The package also bundles the review skills themselves — `/flow-review` (a change, read against its `plan/plan.md`) and `/flow-audit` (the whole repo) — and injects a built-in senior-discipline guidance at implement stage unless the playbook sets its own `prose.implement`.
|
|
18
|
-
- **Status bar**: while the session **is bound** to a feature
|
|
18
|
+
- **Status bar**: an initiated repo (`.dev-flow/project.md` exists) always carries the dev-flow footer; while the session **is bound** to a feature it shows `<stage glyph> <slug>` plus mode markers — stages 📝 plan, 🔨 implement, 🔍 pre-release, 🚀 release; markers ⚡ patch, 📚 docs, 🎱 yolo, and `⚠️` while a check of the bound feature fails (emoji render in their own color, so the footer carries no theme coloring). An **unbound** session never sees a slug — it shows `⧖ N flow(s) open` (unfinished-feature count only, no warning marker) or `⧖ no flows` when nothing is in flight; a session binds only via `flow start`/`flow use`, never by opening. The footer repaints at session start, at the start of every agent run (the earliest a late-attaching web client is listening) and after every gate; an uninitiated folder gets no footer at all. `flow status` is the spelled-out surface: `stage=implement`, the per-feature mode tags (`[ui]`, `[yolo]`, `[no-version]`) and the `flow=<ver>` stamp of the build that started the feature.
|
|
19
19
|
|
|
20
20
|
## Limitations (deliberate, v1)
|
|
21
21
|
|
package/extensions/dev-flow.ts
CHANGED
|
@@ -197,6 +197,10 @@ async function sh(command: string, cwd: string): Promise<{ ok: boolean; out: str
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
const dfDir = (root: string) => path.join(root, ".dev-flow");
|
|
200
|
+
/** dev-flow is initiated once the operator playbook exists: before flow init writes project.md the
|
|
201
|
+
* extension is silent in that folder — no injections, no guards (not even the no-playbook bash-timeout
|
|
202
|
+
* default), no footer. The flow tool itself stays registered so flow init remains callable. */
|
|
203
|
+
const initiated = (root: string): boolean => existsSync(path.join(dfDir(root), "project.md"));
|
|
200
204
|
|
|
201
205
|
/** A `--merge=squash` style flag, or null when absent. Returned as the raw string: the caller validates it
|
|
202
206
|
* with parseMergeStyle so a typo is reported instead of ignored. */
|
|
@@ -459,7 +463,7 @@ const flowCompactInstructions = (st: FlowState) =>
|
|
|
459
463
|
* never while chat-only state is pending (open dialog, undigested plan) — see shouldSelfCompact.
|
|
460
464
|
*/
|
|
461
465
|
function maybeCompactNow(ctx: ExtensionContext): void {
|
|
462
|
-
if (!
|
|
466
|
+
if (!initiated(ctx.cwd)) return;
|
|
463
467
|
const u = ctx.getContextUsage?.(); // minimal/fake contexts may lack usage info — treat as unknown
|
|
464
468
|
if (!u || u.tokens === null) return;
|
|
465
469
|
const key = sessionKey(ctx);
|
|
@@ -668,7 +672,8 @@ async function runFlow(args: string[], root: string, ui: Ui, sess: Session): Pro
|
|
|
668
672
|
const [sub = "status", ...rest] = args;
|
|
669
673
|
// help and version are questions about the plugin, not the repo: answerable with no .dev-flow/ at all
|
|
670
674
|
if (sub === "help" || sub === "--help" || sub === "-h") return { text: rest.includes("--json") ? gateHelpJson(GATE_HELP, loadedVersion()) : `usage: flow <sub> — ${GATE_HELP}` };
|
|
671
|
-
|
|
675
|
+
// an uninitiated folder is dormant: every gate verb but init and version needs the operator playbook (project.md)
|
|
676
|
+
if (!initiated(root) && sub !== "init" && sub !== "version") return { text: "dev-flow is not initiated here — no .dev-flow/project.md — run flow init first", isError: true };
|
|
672
677
|
const cfg = loadProject(dfDir(root)).cfg;
|
|
673
678
|
const flag = (name: string) => rest.includes(`--${name}`);
|
|
674
679
|
const slugArg = rest.find((a) => !a.startsWith("--"));
|
|
@@ -1612,12 +1617,16 @@ function tail(out: string, n = 15): string {
|
|
|
1612
1617
|
// ------------------------------------------------------------------ extension
|
|
1613
1618
|
|
|
1614
1619
|
/** Compact footer: bound flow = stage glyph, slug, mode markers, ⚠️ on its failing checks; unbound = the
|
|
1615
|
-
*
|
|
1620
|
+
* unfinished-flow count, or `⧖ no flows` — an initiated repo always carries the footer. An uninitiated
|
|
1621
|
+
* folder gets nothing: the status is cleared. Pure read — rendering never binds or claims anything. */
|
|
1616
1622
|
function refreshStatus(ctx: ExtensionContext): void {
|
|
1617
1623
|
if (!ctx.hasUI) return;
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1624
|
+
if (!initiated(ctx.cwd)) {
|
|
1625
|
+
ctx.ui.setStatus("dev-flow", undefined);
|
|
1626
|
+
return;
|
|
1627
|
+
}
|
|
1628
|
+
const s = statusFor(boundFeature(ctx.cwd, sessionKey(ctx)), unfinishedStates(ctx.cwd).length);
|
|
1629
|
+
ctx.ui.setStatus("dev-flow", s.text);
|
|
1621
1630
|
}
|
|
1622
1631
|
|
|
1623
1632
|
|
|
@@ -1757,7 +1766,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1757
1766
|
// reaches the provider). If our summary fails we return undefined and pi's own compaction proceeds.
|
|
1758
1767
|
// overflow is never taken over (cancelling it would drop pi's compact-and-retry); manual is the operator's or ours.
|
|
1759
1768
|
pi.on("session_before_compact", async (event, ctx) => {
|
|
1760
|
-
if (!
|
|
1769
|
+
if (!initiated(ctx.cwd)) return undefined;
|
|
1761
1770
|
const key = sessionKey(ctx);
|
|
1762
1771
|
const st = boundFeature(ctx.cwd, key);
|
|
1763
1772
|
if (!shouldTakeOverCompaction({ reason: event.reason, bound: !!st, inFlight: compacting.has(key) })) return undefined;
|
|
@@ -1780,7 +1789,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1780
1789
|
});
|
|
1781
1790
|
// pi forcing its own compaction while a flow is bound means the pacing was wrong — park a note for the operator.
|
|
1782
1791
|
pi.on("session_compact", async (event, ctx) => {
|
|
1783
|
-
if (!
|
|
1792
|
+
if (!initiated(ctx.cwd)) return;
|
|
1784
1793
|
// Whatever the reason, the summary replaced the transcript — the core the first run injected is
|
|
1785
1794
|
// gone from context, so the next run pays it once more (manual compactions included: our own
|
|
1786
1795
|
// safe-point compaction is the common one).
|
|
@@ -1804,14 +1813,12 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1804
1813
|
const shellInput = isToolCallEventType("bash", event) || isToolCallEventType("powershell", event) ? (event.input as { command?: unknown; timeout?: unknown }) : undefined;
|
|
1805
1814
|
const shellCmd = shellInput ? String(shellInput.command ?? "") : "";
|
|
1806
1815
|
const explicitTimeout = typeof shellInput?.timeout === "number" ? shellInput.timeout : undefined;
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
if (why) return { block: true, reason: why };
|
|
1814
|
-
}
|
|
1816
|
+
const noDf = !initiated(ctx.cwd);
|
|
1817
|
+
// in an initiated repo the silent default stays armed either way: it is the safety net for an
|
|
1818
|
+
// `inject` project and the number the refusal quotes; an uninitiated folder is not touched at all
|
|
1819
|
+
if (shellCmd && shellInput && !noDf) shellInput.timeout = bashTimeout(shellCmd, explicitTimeout);
|
|
1820
|
+
// an uninitiated folder hears nothing from dev-flow at all — flow init is the opt-in that arms
|
|
1821
|
+
// the guards, the no-playbook bash-timeout default included
|
|
1815
1822
|
if (noDf) return undefined;
|
|
1816
1823
|
const cfg = loadProject(dfDir(ctx.cwd)).cfg;
|
|
1817
1824
|
const mustStateTimeout = shellCmd !== "" && explicitTimeout === undefined && cfg.bashTimeout === "require";
|
|
@@ -1936,7 +1943,10 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1936
1943
|
const run = ctx as unknown as Record<symbol, boolean | undefined>;
|
|
1937
1944
|
if (run[CONTEXT_EMITTED]) return undefined;
|
|
1938
1945
|
run[CONTEXT_EMITTED] = true;
|
|
1939
|
-
|
|
1946
|
+
// repaint the footer at the start of every run: the session_start push can land before a web
|
|
1947
|
+
// client attaches, and this is the earliest point the client is certainly listening
|
|
1948
|
+
refreshStatus(ctx);
|
|
1949
|
+
if (!initiated(ctx.cwd)) return undefined;
|
|
1940
1950
|
const key = sessionKey(ctx);
|
|
1941
1951
|
// The playbook core rides along on the message this run writes anyway — once per session.
|
|
1942
1952
|
const core = corePreamble(key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.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
|
@@ -3,7 +3,7 @@ name: dev-flow
|
|
|
3
3
|
description: >
|
|
4
4
|
The repo's enforced feature workflow: plan → implement → pre-release →
|
|
5
5
|
release → done, one feature at a time, driven through the flow tool. Read before
|
|
6
|
-
starting ANY feature work in a repo
|
|
6
|
+
starting ANY feature work in a repo whose .dev-flow/project.md playbook exists — the
|
|
7
7
|
stage guards block out-of-stage edits and main-branch git ops, so working
|
|
8
8
|
outside this flow fails at the guard.
|
|
9
9
|
---
|
package/src/core.ts
CHANGED
|
@@ -1277,15 +1277,16 @@ export function statusCompact(state: FlowState): { text: string; failed: boolean
|
|
|
1277
1277
|
return { text: `${STAGE_EMOJI[state.stage]} ${state.slug}${state.patch ? " ⚡" : state.docs ? " 📚" : ""}${state.yolo ? " 🎱" : ""}`, failed };
|
|
1278
1278
|
}
|
|
1279
1279
|
|
|
1280
|
-
/** Footer decision for any session: a bound feature renders as statusCompact, its ⚠️
|
|
1281
|
-
* checks only; an unbound session shows the count of unfinished features — never a
|
|
1282
|
-
* session is never shown (or made to feel bound to) a feature it did not take with flow
|
|
1283
|
-
|
|
1280
|
+
/** Footer decision for any session in an initiated repo: a bound feature renders as statusCompact, its ⚠️
|
|
1281
|
+
* from its own failing checks only; an unbound session shows the count of unfinished features — never a
|
|
1282
|
+
* slug, so a fresh session is never shown (or made to feel bound to) a feature it did not take with flow
|
|
1283
|
+
* use — and `⧖ no flows` when nothing is in flight: dev-flow initiated means a footer always present. */
|
|
1284
|
+
export function statusFor(bound: FlowState | null, openCount: number): { text: string } {
|
|
1284
1285
|
if (bound && bound.stage !== "done") {
|
|
1285
1286
|
const { text, failed } = statusCompact(bound);
|
|
1286
1287
|
return { text: failed ? `${text} ⚠️` : text };
|
|
1287
1288
|
}
|
|
1288
|
-
if (openCount < 1) return
|
|
1289
|
+
if (openCount < 1) return { text: "⧖ no flows" };
|
|
1289
1290
|
return { text: `⧖ ${openCount} flow${openCount === 1 ? "" : "s"} open` };
|
|
1290
1291
|
}
|
|
1291
1292
|
|