pi-dev-flow 0.56.0 → 0.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/docs/concurrency.md +4 -4
- package/docs/development.md +6 -6
- package/docs/guardrails.md +1 -1
- package/docs/headless.md +2 -2
- package/extensions/dev-flow.ts +22 -32
- package/package.json +1 -1
- package/skills/dev-flow/SKILL.md +6 -5
- package/src/core.ts +13 -1
- package/src/projectmd.ts +1 -7
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.57.1] - 2026-10-23
|
|
8
|
+
|
|
9
|
+
### Removed
|
|
10
|
+
|
|
11
|
+
- **The dogfood shim is gone — one global dev-flow copy is the only source.** `.pi/extensions/dev-flow.ts`, the committed one-line re-export that made every session in this checkout load the working tree, was itself a second registered extension beside the global npm install — the exact two-sources hazard the README warns about (pi dedupes extensions by path, not by package), and the copy `flow version` had started naming in this very repo. Sessions here now load the single global install (`pi update --extensions` reconciles it after a release, `/reload` carries it into a running session); `pi -e .` stays the explicit way to dogfood the working tree. The `flow doctor` probe that demanded the shim, its test, and the `development.md` dogfood paragraph were removed with it.
|
|
12
|
+
|
|
13
|
+
## [0.57.0] - 2026-10-23
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **The footer now tells the truth about bindings: a slug only when bound, a count when not — and nothing binds itself anymore.** The status bar rendered only for a session's bound feature, so an unbound session saw a blank footer however much work was in flight — and `boundFeature` made that blank worse than it looked: with exactly one unfinished feature it silently auto-bound *and claimed* it, so merely opening a new session steered the lone feature nobody handed it. Sessions now bind **explicitly and only** — `flow start` binds its own feature, `flow use <slug>` takes one over; `boundFeature` lost its lone-feature fallback and its claim-writing side effect, and slugless gates answer `nothing bound — flow use <slug> or pass an explicit slug (unfinished: …)` instead of quietly picking the one left. The unbound footer reads `⧖ N flow(s) open` — the count of unfinished features, never a slug, no `⚠️` (the failing-check marker stays the bound flow's own signal); with nothing unfinished the footer stays clear, and rendering stays a pure read that can never claim anything. `flow status --json`'s `current` follows the same rule — only a bound session has a current feature — and the guardrails, concurrency and headless docs plus the skill teach the explicit-bind model (`flow use <slug>` is now the *only* way onto a feature, not the takeover of an auto-bind).
|
|
18
|
+
|
|
7
19
|
## [0.56.0] - 2026-10-22
|
|
8
20
|
|
|
9
21
|
### Added
|
package/docs/concurrency.md
CHANGED
|
@@ -5,10 +5,10 @@ How several agents work one repo at the same time without stepping on each other
|
|
|
5
5
|
**One pi session = one feature** (flow + branch + worktree). A repo can host any number of
|
|
6
6
|
features, worked by separate sessions in parallel — that is the supported shape, not an edge
|
|
7
7
|
case. The binding lives with the session (persisted via session entries, restored on
|
|
8
|
-
resume/fork), so nothing is repo-global.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
resume/fork), so nothing is repo-global. A session binds **explicitly, never automatically**:
|
|
9
|
+
`flow start` binds its own feature, `flow use <slug>` takes one over — even the lone unfinished
|
|
10
|
+
feature waits to be claimed. Every bind leaves a claim (`claim.json`, session + pid),
|
|
11
|
+
and the gates honor the claim too:
|
|
12
12
|
passing another session's slug to `flow approve`/`verify`/`finish` is refused until you take over,
|
|
13
13
|
or two sessions quietly overwrite one state file. `flow use <slug>` switches, and ambiguous sessions must
|
|
14
14
|
bind or pass explicit slugs. With nothing unfinished and no binding, the session must start a
|
package/docs/development.md
CHANGED
|
@@ -7,12 +7,12 @@ npm i && npm test # unit tests + wiring smoke test (node --test)
|
|
|
7
7
|
pi -e . run /flow status # try it against any repo
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
Sessions in this checkout load the **single global dev-flow install** (`pi update --extensions`
|
|
11
|
+
reconciles it after a release, `/reload` brings it into a running session) — there is deliberately no
|
|
12
|
+
`.pi/extensions/` pointer here: a committed shim beside the global package loads two copies of the
|
|
13
|
+
extension in one process (pi dedupes by path, not by package — see the README's two-sources
|
|
14
|
+
warning), which is what the shim used to cause. To dogfood the working tree instead of the
|
|
15
|
+
installed copy, point pi at it explicitly for that run: `pi -e .`.
|
|
16
16
|
|
|
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.
|
package/docs/guardrails.md
CHANGED
|
@@ -14,7 +14,7 @@ While a feature is active, the extension intercepts every tool call:
|
|
|
14
14
|
- **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
15
|
- **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`.
|
|
16
16
|
- 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 (`/ponytail-review`) → fixes → docs → changelog/version bump; release — PR → merge → tag → `release-done`.
|
|
17
|
-
- **Status bar**: while
|
|
17
|
+
- **Status bar**: while the session **is bound** to a feature the pi footer 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 nothing when nothing is in flight; a session binds only via `flow start`/`flow use`, never by opening. `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.
|
|
18
18
|
|
|
19
19
|
## Limitations (deliberate, v1)
|
|
20
20
|
|
package/docs/headless.md
CHANGED
|
@@ -29,8 +29,8 @@ The contract a headless driver (a session with no UI) relies on:
|
|
|
29
29
|
`.dev-flow/`: `status`, `help`, `version`, `doctor`, `roadmap` (list).
|
|
30
30
|
- **One session = one feature.** Bindings are per-session and survive resume/fork; a
|
|
31
31
|
reconnecting driver either rejoins the same session or rebinds with `flow use <slug>`.
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
Nothing auto-binds — always bind explicitly or pass the slug explicitly.
|
|
33
|
+
Parallel features = parallel sessions.
|
|
34
34
|
- **Budget for long gates.** `approve` runs `commands.setup`; `verify` runs build and the
|
|
35
35
|
`dev` deploy (runs are killed past 15 min) and re-probes health with `healthWait` retries.
|
|
36
36
|
A remote timeout must be minutes, not seconds — the gate prints progress lines while it
|
package/extensions/dev-flow.ts
CHANGED
|
@@ -94,7 +94,7 @@ import {
|
|
|
94
94
|
shouldSelfCompact,
|
|
95
95
|
shouldTakeOverCompaction,
|
|
96
96
|
stateTamper,
|
|
97
|
-
|
|
97
|
+
statusFor,
|
|
98
98
|
statusJson,
|
|
99
99
|
subst,
|
|
100
100
|
sq,
|
|
@@ -356,26 +356,19 @@ const readRoadmap = (root: string): string => {
|
|
|
356
356
|
return existsSync(f) ? readFileSync(f, "utf8") : "";
|
|
357
357
|
};
|
|
358
358
|
|
|
359
|
-
/** The session's feature
|
|
359
|
+
/** The session's feature — explicit bindings only: flow start/flow use bind, resume restores from session
|
|
360
|
+
* history. Never binds on its own: an unbound session stays unbound however few features are unfinished,
|
|
361
|
+
* and reading it must never claim anything. The claim on disk IS the persisted binding — bind() stamps the
|
|
362
|
+
* session key into claim.json — so trust the disk after the in-memory map: a second registered dev-flow
|
|
363
|
+
* copy (both copies evaluate the guard hooks) or a re-instantiated module then attributes the session's
|
|
364
|
+
* own feature from disk instead of misjudging with stage null. */
|
|
360
365
|
function boundFeature(root: string, key: string): FlowState | null {
|
|
361
366
|
const bound = bindings.get(key);
|
|
362
367
|
if (bound) {
|
|
363
368
|
const s = readState(root, bound);
|
|
364
369
|
if (s && s.stage !== "done") return s;
|
|
365
370
|
}
|
|
366
|
-
|
|
367
|
-
// the claim is the persisted binding: bind() already stamps the session key into claim.json, so
|
|
368
|
-
// trust the disk after the in-memory map — a second registered dev-flow copy (both copies
|
|
369
|
-
// evaluate the guard hooks) or a re-instantiated module then attributes the session's own
|
|
370
|
-
// feature from disk instead of misjudging with stage null
|
|
371
|
-
const mine = un.find((s) => readClaim(root, s.slug)?.key === key);
|
|
372
|
-
if (mine) return mine;
|
|
373
|
-
if (un.length !== 1) return null;
|
|
374
|
-
const claim = readClaim(root, un[0].slug);
|
|
375
|
-
// shortcut: liveness is pid-only — pid reuse can read "live" and force an explicit flow use; friction only, never a wrong commit.
|
|
376
|
-
if (claimBlocks(claim, key)) return null;
|
|
377
|
-
if (claim?.key !== key) writeClaim(root, un[0].slug, key);
|
|
378
|
-
return un[0];
|
|
371
|
+
return unfinishedStates(root).find((s) => readClaim(root, s.slug)?.key === key) ?? null;
|
|
379
372
|
}
|
|
380
373
|
|
|
381
374
|
function readClaim(root: string, slug: string): SessionClaim | null {
|
|
@@ -403,7 +396,7 @@ function releaseSession(root: string, key: string): void {
|
|
|
403
396
|
}
|
|
404
397
|
}
|
|
405
398
|
|
|
406
|
-
/**
|
|
399
|
+
/** A lone unfinished feature another live session holds — lets the unbound-context message name it and offer the explicit takeover. */
|
|
407
400
|
function claimBlocker(root: string, key: string): { state: FlowState; claim: SessionClaim } | null {
|
|
408
401
|
const un = unfinishedStates(root);
|
|
409
402
|
if (un.length !== 1) return null;
|
|
@@ -841,8 +834,7 @@ ${mdDigest(draftRefresh)}`))
|
|
|
841
834
|
const rmap = roadmapOpenCount(readRoadmap(root));
|
|
842
835
|
const rmapLine = rmap ? [`◇ ${rmap} roadmap item(s) open — flow roadmap`] : [];
|
|
843
836
|
const slugs = slugArg ? [slugArg] : existsSync(df) ? (await listDirs(df)).filter((s) => readState(root, s)) : [];
|
|
844
|
-
const
|
|
845
|
-
const cur = sess.slug ?? (un0.length === 1 ? un0[0].slug : null);
|
|
837
|
+
const cur = sess.slug; // only a bound session has a current feature — the lone-unfinished hint would pose unbound sessions as owning it
|
|
846
838
|
if (flag("json")) {
|
|
847
839
|
const sts = slugs.map((s) => readState(root, s)).filter((s): s is FlowState => s !== null);
|
|
848
840
|
return { text: statusJson(sts, cur, cfg) }; // before the prose "no features" answer — an orchestrator must be able to parse the empty case too
|
|
@@ -1519,8 +1511,8 @@ ${mdDigest(draftRefresh)}`))
|
|
|
1519
1511
|
const st = readState(root, target);
|
|
1520
1512
|
if (sess.slug === target) sess.bind(null);
|
|
1521
1513
|
if (st && !st.worktree) {
|
|
1522
|
-
// plan-stage abort = drop: no worktree/branch exists, so the state dir
|
|
1523
|
-
// the
|
|
1514
|
+
// plan-stage abort = drop: no worktree/branch exists, so the state dir would linger
|
|
1515
|
+
// as a ghost the doctor flags (a plan/ whose state.json is gone)
|
|
1524
1516
|
rmSync(featDir(root, target), { recursive: true, force: true });
|
|
1525
1517
|
return { text: `aborted ${target} — feature removed (nothing approved, nothing to recover)` };
|
|
1526
1518
|
}
|
|
@@ -1538,12 +1530,13 @@ async function currentBranch(root: string): Promise<string> {
|
|
|
1538
1530
|
}
|
|
1539
1531
|
|
|
1540
1532
|
function needState(root: string, sess: Session, slugArg?: string): { state: FlowState | null; err?: RunResult } {
|
|
1541
|
-
|
|
1533
|
+
// no implicit feature: gates run on this session's binding or an explicit slug — never on "the one
|
|
1534
|
+
// feature left", which is how an unbound session would end up steering a flow it never took
|
|
1535
|
+
const slug = slugArg ?? sess.slug;
|
|
1542
1536
|
if (!slug) {
|
|
1543
1537
|
const un = unfinishedStates(root);
|
|
1544
|
-
if (un.length
|
|
1545
|
-
|
|
1546
|
-
else return { state: null, err: { text: `multiple unfinished features (${un.map((s) => s.slug).join(", ")}) — flow use <slug> or pass an explicit slug`, isError: true } };
|
|
1538
|
+
if (!un.length) return { state: null, err: { text: "no unfinished features — flow start <slug> [--ui]", isError: true } };
|
|
1539
|
+
return { state: null, err: { text: `nothing bound — flow use <slug> or pass an explicit slug (unfinished: ${un.map((s) => s.slug).join(", ")})`, isError: true } };
|
|
1547
1540
|
}
|
|
1548
1541
|
const state = readState(root, slug);
|
|
1549
1542
|
if (!state) return { state: null, err: { text: `no state for feature ${slug}`, isError: true } };
|
|
@@ -1567,16 +1560,13 @@ function tail(out: string, n = 15): string {
|
|
|
1567
1560
|
|
|
1568
1561
|
// ------------------------------------------------------------------ extension
|
|
1569
1562
|
|
|
1570
|
-
/** Compact footer
|
|
1563
|
+
/** Compact footer: bound flow = stage glyph, slug, mode markers, ⚠️ on its failing checks; unbound = the
|
|
1564
|
+
* count of unfinished flows only (statusFor). Pure read — rendering never binds or claims anything. */
|
|
1571
1565
|
function refreshStatus(ctx: ExtensionContext): void {
|
|
1572
1566
|
if (!ctx.hasUI) return;
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
return;
|
|
1577
|
-
}
|
|
1578
|
-
const { text, failed } = statusCompact(st);
|
|
1579
|
-
ctx.ui.setStatus("dev-flow", failed ? `${text} ⚠️` : text);
|
|
1567
|
+
const open = existsSync(dfDir(ctx.cwd)) ? unfinishedStates(ctx.cwd).length : 0;
|
|
1568
|
+
const s = statusFor(boundFeature(ctx.cwd, sessionKey(ctx)), open);
|
|
1569
|
+
ctx.ui.setStatus("dev-flow", s ? s.text : undefined);
|
|
1580
1570
|
}
|
|
1581
1571
|
|
|
1582
1572
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.1",
|
|
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
|
@@ -27,11 +27,12 @@ Ground rules:
|
|
|
27
27
|
`/reload` when `flow version` says this session runs an older build).
|
|
28
28
|
|
|
29
29
|
- **One session = exactly one feature** (flow + branch + worktree); parallel
|
|
30
|
-
sessions, one feature each, are the model.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
sessions, one feature each, are the model. A session binds **explicitly and
|
|
31
|
+
only**: `flow start <slug>` sets the bind (main checkout must be on the
|
|
32
|
+
default branch); `flow use <slug>` takes over an open or foreign-held
|
|
33
|
+
feature. Nothing auto-binds — a new session with unfinished features stays
|
|
34
|
+
unbound until someone says `flow use`. Unbound: the footer shows only the
|
|
35
|
+
open-feature count, gates demand an explicit slug and main-checkout writes
|
|
35
36
|
stay blocked. There is no bypass — an unbound session cannot edit source.
|
|
36
37
|
- **Project `flow-guard` rules** (`deny`/`confirm`/`protect`/`forbid` in
|
|
37
38
|
project.md `## global`) apply at **every** stage and are judged ahead of
|
package/src/core.ts
CHANGED
|
@@ -1189,7 +1189,7 @@ export function pidAlive(pid: number): boolean {
|
|
|
1189
1189
|
}
|
|
1190
1190
|
}
|
|
1191
1191
|
|
|
1192
|
-
/** True only when another live session holds the claim —
|
|
1192
|
+
/** True only when another live session holds the claim — its feature can only be taken by an explicit `flow use`, never quietly. */
|
|
1193
1193
|
export function claimBlocks(claim: SessionClaim | null, myKey: string, alive: (pid: number) => boolean = pidAlive): boolean {
|
|
1194
1194
|
return !!claim && claim.key !== myKey && alive(claim.pid);
|
|
1195
1195
|
}
|
|
@@ -1202,6 +1202,18 @@ export function statusCompact(state: FlowState): { text: string; failed: boolean
|
|
|
1202
1202
|
return { text: `${STAGE_EMOJI[state.stage]} ${state.slug}${state.patch ? " ⚡" : state.docs ? " 📚" : ""}${state.yolo ? " 🎱" : ""}`, failed };
|
|
1203
1203
|
}
|
|
1204
1204
|
|
|
1205
|
+
/** Footer decision for any session: a bound feature renders as statusCompact, its ⚠️ from its own failing
|
|
1206
|
+
* checks only; an unbound session shows the count of unfinished features — never a slug, so a fresh
|
|
1207
|
+
* session is never shown (or made to feel bound to) a feature it did not take with flow use. null clears. */
|
|
1208
|
+
export function statusFor(bound: FlowState | null, openCount: number): { text: string } | null {
|
|
1209
|
+
if (bound && bound.stage !== "done") {
|
|
1210
|
+
const { text, failed } = statusCompact(bound);
|
|
1211
|
+
return { text: failed ? `${text} ⚠️` : text };
|
|
1212
|
+
}
|
|
1213
|
+
if (openCount < 1) return null;
|
|
1214
|
+
return { text: `⧖ ${openCount} flow${openCount === 1 ? "" : "s"} open` };
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1205
1217
|
/** `- [ ]` checklist items of a markdown document (reflections.md and roadmap.md share the format). */
|
|
1206
1218
|
export function openChecklistItems(text: string): string[] {
|
|
1207
1219
|
return text.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("- [ ] "));
|
package/src/projectmd.ts
CHANGED
|
@@ -312,7 +312,7 @@ const safeJson = (s: string): unknown => {
|
|
|
312
312
|
|
|
313
313
|
/** `.dev-flow/<slug>/` directories holding a plan/ with no state.json — a closed or aborted feature
|
|
314
314
|
* whose directory outlived its flow state (a hand-close from before auto-close, an interrupted
|
|
315
|
-
* start). Nothing reads them: `flow status`, the guards and
|
|
315
|
+
* start). Nothing reads them: `flow status`, the guards and the footer all key off state.json.
|
|
316
316
|
* Root-relative paths, for the doctor report and the operator-confirmed remover. */
|
|
317
317
|
export function ghostFeatureDirs(root: string): string[] {
|
|
318
318
|
const df = path.join(root, ".dev-flow");
|
|
@@ -362,12 +362,6 @@ export function doctorFindings(root: string, cfg: Config, md: ParsedMd | null):
|
|
|
362
362
|
if (cfg.commands.dev && !healthProbe(cfg)) f.push("dev deploy configured but no health check — flow verify cannot prove the deploy came back serving this build: add commands.health or a flow-check health block");
|
|
363
363
|
if (!cfg.checkList.length) f.push("implement tier-1 gates nothing — no test, no health, no flow-check block: 'flow check' would pass vacuously");
|
|
364
364
|
for (const g of ghostFeatureDirs(root)) f.push(`${g} has a plan/ but no state.json — ghost of a closed or aborted feature (flow init offers to remove it)`);
|
|
365
|
-
// dev-flow must load its own working code in its own checkout: the committed .pi shim is the only thing that guarantees it
|
|
366
|
-
if (pkgRaw && (pkgRaw as { name?: unknown }).name === "pi-dev-flow") {
|
|
367
|
-
const shim = path.join(root, ".pi", "extensions", "dev-flow.ts");
|
|
368
|
-
if (!existsSync(shim) || !readFileSync(shim, "utf8").includes("../../extensions/dev-flow.ts"))
|
|
369
|
-
f.push("dogfood shim .pi/extensions/dev-flow.ts is missing or does not re-export ../../extensions/dev-flow.ts — sessions in this checkout will not load the current code");
|
|
370
|
-
}
|
|
371
365
|
return f;
|
|
372
366
|
}
|
|
373
367
|
|