pi-dev-flow 0.58.1 → 0.59.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 +17 -0
- package/README.md +11 -0
- package/docs/development.md +21 -0
- package/docs/guardrails.md +2 -1
- package/extensions/dev-flow.ts +119 -26
- 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 +57 -2
|
@@ -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
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { existsSync, readdirSync, readFileSync, realpathSync } from "node:fs";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
|
+
import os from "node:os";
|
|
9
10
|
import path from "node:path";
|
|
10
11
|
|
|
11
12
|
export type Stage = "plan" | "implement" | "pre-release" | "release" | "done";
|
|
@@ -141,6 +142,39 @@ export function stageGuidance(cfg: Config, stage: Stage): { text: string; source
|
|
|
141
142
|
return text ? { text, source: "dev-flow default" } : undefined;
|
|
142
143
|
}
|
|
143
144
|
|
|
145
|
+
/** Markers around the always-on core of `skills/dev-flow/SKILL.md`. Pi advertises a skill
|
|
146
|
+
* (name, description, path) and loads the body only when the model chooses to read it, so
|
|
147
|
+
* nothing in the file is guaranteed in front of the model. The extension injects what sits
|
|
148
|
+
* between these markers once per session; everything outside them (the stage map, and
|
|
149
|
+
* `references/` per stage) is read on demand. */
|
|
150
|
+
export const SKILL_CORE_START = "<!-- dev-flow:core:start -->";
|
|
151
|
+
export const SKILL_CORE_END = "<!-- dev-flow:core:end -->";
|
|
152
|
+
|
|
153
|
+
/** The always-on core of the dev-flow skill: the text between the markers, or null when the
|
|
154
|
+
* markers are missing, reversed or hold nothing. Null is a fallback, not an error — a checkout
|
|
155
|
+
* without `skills/`, or a botched edit, must leave the injection exactly as it was and must
|
|
156
|
+
* never throw inside a guard hook. */
|
|
157
|
+
export function extractSkillCore(md: string): string | null {
|
|
158
|
+
const a = md.indexOf(SKILL_CORE_START);
|
|
159
|
+
const b = md.indexOf(SKILL_CORE_END);
|
|
160
|
+
if (a < 0 || b < 0 || b < a) return null;
|
|
161
|
+
const core = md.slice(a + SKILL_CORE_START.length, b).trim();
|
|
162
|
+
return core || null;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The playbook file carrying one stage's detail, relative to the skill directory. `done` has
|
|
166
|
+
* none (nothing left to read). The state machine has no finish stage — closing out happens inside
|
|
167
|
+
* `release`, and release.md hands over to finish.md there. The pre-flow brief is `start`. */
|
|
168
|
+
const STAGE_REFERENCE: Partial<Record<Stage, string>> = {
|
|
169
|
+
plan: "references/plan.md",
|
|
170
|
+
implement: "references/implement.md",
|
|
171
|
+
"pre-release": "references/pre-release.md",
|
|
172
|
+
release: "references/release.md",
|
|
173
|
+
};
|
|
174
|
+
export function stageReference(stage: Stage): string | null {
|
|
175
|
+
return STAGE_REFERENCE[stage] ?? null;
|
|
176
|
+
}
|
|
177
|
+
|
|
144
178
|
/** Build a Config from DEFAULTS + a partial overrides object (tests, drafts — the persisted
|
|
145
179
|
* source is project.md alone; the legacy project.json loader is gone). */
|
|
146
180
|
export function buildConfig(raw: unknown): Config {
|
|
@@ -1143,6 +1177,23 @@ export interface FeatureRef {
|
|
|
1143
1177
|
|
|
1144
1178
|
const within = (abs: string, dir: string | null) => !!dir && (abs === dir || abs.startsWith(dir + path.sep));
|
|
1145
1179
|
|
|
1180
|
+
/**
|
|
1181
|
+
* A throwaway outside the repository, which is not a repo write at all: a mechanical multi-file rewrite
|
|
1182
|
+
* needs somewhere to keep a scratch script, and refusing `/tmp/split_skill.py` only taught agents to park
|
|
1183
|
+
* junk inside the checkout. Both sides are realpath'd, so a symlink in the temp dir cannot reach back into
|
|
1184
|
+
* the guarded checkout, and `repoRoot` keeps a repository that merely lives under the temp dir (every
|
|
1185
|
+
* smoke-test repo) under the normal stage rules.
|
|
1186
|
+
*/
|
|
1187
|
+
export function inScratchDir(abs: string, repoRoot?: string | null): boolean {
|
|
1188
|
+
const real = realAbs(abs);
|
|
1189
|
+
if (repoRoot) {
|
|
1190
|
+
const root = realAbs(path.resolve(repoRoot));
|
|
1191
|
+
if (real === root || real.startsWith(root + path.sep)) return false;
|
|
1192
|
+
}
|
|
1193
|
+
const tmp = realAbs(path.resolve(os.tmpdir()));
|
|
1194
|
+
return real === tmp || real.startsWith(tmp + path.sep);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1146
1197
|
/**
|
|
1147
1198
|
* Write guard with per-path attribution: writes inside a worktree are judged by that
|
|
1148
1199
|
* worktree's own feature; main-checkout writes are judged by the session's bound feature
|
|
@@ -1151,7 +1202,7 @@ const within = (abs: string, dir: string | null) => !!dir && (abs === dir || abs
|
|
|
1151
1202
|
* touch the checkout at all — a bound feature is the only way in.
|
|
1152
1203
|
* Returns a reason or null (allowed).
|
|
1153
1204
|
*/
|
|
1154
|
-
export function writeGuard(o: { abs: string; dfDir: string; features: FeatureRef[]; boundSlug: string | null }): string | null {
|
|
1205
|
+
export function writeGuard(o: { abs: string; dfDir: string; features: FeatureRef[]; boundSlug: string | null; repoRoot?: string | null }): string | null {
|
|
1155
1206
|
if (o.abs === path.join(o.dfDir, "project.json")) return ".dev-flow/project.json is legacy — it is no longer read; fold its values into project.md and delete it";
|
|
1156
1207
|
if (o.abs === path.join(o.dfDir, "project.md")) return "project.md is the operator playbook — change it with flow init --write (setup) or inside a docs/patch flow's worktree";
|
|
1157
1208
|
if (o.abs.endsWith("state.json") && o.abs.includes(o.dfDir + path.sep)) return "state.json is dev-flow-owned — advance stages with the flow tool only";
|
|
@@ -1166,6 +1217,10 @@ export function writeGuard(o: { abs: string; dfDir: string; features: FeatureRef
|
|
|
1166
1217
|
return `project.md changes belong to a docs or patch flow — ${owner.state.slug} is a normal feature (flow start <slug> --docs --confirmed)`;
|
|
1167
1218
|
return null; // implement/pre-release/release: own worktree is the working area
|
|
1168
1219
|
}
|
|
1220
|
+
// Scratch outside the checkout is not a repo write: every stage (and an unbound session) may use it. It
|
|
1221
|
+
// sits after the dev-flow-owned refusals and after owner attribution, so no path shape — a symlink, or a
|
|
1222
|
+
// worktreeDir an operator parked in the temp dir — reaches those rules through the temp dir.
|
|
1223
|
+
if (inScratchDir(o.abs, o.repoRoot)) return null;
|
|
1169
1224
|
const bound = o.boundSlug ? o.features.find((f) => f.state.slug === o.boundSlug) : undefined;
|
|
1170
1225
|
// A plan-stage session may only write its own feature directory: otherwise one session edits another
|
|
1171
1226
|
// feature's plan and that feature's approval gate then rubber-stamps text it never wrote.
|
|
@@ -1174,7 +1229,7 @@ export function writeGuard(o: { abs: string; dfDir: string; features: FeatureRef
|
|
|
1174
1229
|
if (within(o.abs, o.dfDir)) return null;
|
|
1175
1230
|
if (bound) {
|
|
1176
1231
|
if (bound.state.stage === "implement" || bound.state.stage === "pre-release")
|
|
1177
|
-
return `bound feature ${o.boundSlug} is at ${bound.state.stage} — edit its worktree (${bound.state.worktree}), not the main checkout`;
|
|
1232
|
+
return `bound feature ${o.boundSlug} is at ${bound.state.stage} — edit its worktree (${bound.state.worktree}), not the main checkout; a throwaway script goes outside the repo (under $TMPDIR)`;
|
|
1178
1233
|
return null; // release: release chores may touch the main checkout
|
|
1179
1234
|
}
|
|
1180
1235
|
if (!o.features.length) return "no active flow — every request goes through flow: flow start <slug> for new work, flow use <slug> for an unfinished feature";
|