pi-dev-flow 0.90.1 → 0.91.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 +16 -0
- package/docs/concurrency.md +3 -1
- package/docs/gates.md +6 -4
- package/package.json +1 -1
- package/skills/dev-flow/references/implement.md +3 -1
- package/skills/dev-flow/references/plan.md +10 -0
- package/skills/dev-flow/references/release.md +10 -0
- package/skills/dev-flow/references/start.md +9 -4
- package/src/core.ts +2 -2
- package/src/present.ts +1 -1
- package/src/runtime/base.ts +2 -2
- package/src/runtime/checks.ts +5 -0
- package/src/runtime/gates.ts +28 -14
- package/src/runtime/grants.ts +3 -2
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.91.1] - 2026-11-11
|
|
8
|
+
|
|
9
|
+
**A revised plan reads as one clean plan, without the dropped options from earlier rounds.**
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- **A revised plan reads as one clean plan.** When you ask for changes at the plan stage, the agent now rewrites plan.md into the current plan instead of appending each round. Dropped options, requirements and mockups are removed, and nothing is marked "v2" or "previously". A changed screen is re-rendered over its old files, and a dropped one's html and screenshots are deleted. The mockup gate's errors now say a dropped render can be deleted. Before, they only said to embed it, which pushed old screenshots back into the plan.
|
|
13
|
+
|
|
14
|
+
## [0.91.0] - 2026-11-11
|
|
15
|
+
|
|
16
|
+
**Fewer needless questions: the agent turns `--ui` on itself, takes a dev port from a flow already past review, and waits for CI instead of ending its turn.**
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **`--ui` no longer needs your OK; turning it off does.** `--ui` only adds a check (rendered mockups at the plan gate), so the agent now passes it by itself whenever screens change, at start or later at plan. Before, a UI feature started without it had to stop and ask, and a "proceed" you had already given didn't count because it came before the question. Removing the mockup gate is now the step that needs you: `flow start <slug> --no-ui --confirmed` at plan, and aborting a ui feature at plan (which a restart without `--ui` would otherwise use to drop the gate) asks too.
|
|
20
|
+
- **A dev port held by a flow past its review is taken without asking.** `flow verify` asked *Dev port?* (replace or wait) even when the flow holding the port was at pre-release or release, so its deploy had already been verified and nobody was looking at it. It now replaces that deploy and says so in the result. It still asks when the holder is in implement or is re-asking Verified?.
|
|
21
|
+
- **The release stage waits for CI instead of ending the turn.** The release reference now says to keep watching CI inside the turn, never to end it with "I'll keep watching" (nothing wakes the agent after the turn ends), and to re-trigger runs stuck in `queued` for about 15 minutes instead of waiting on them.
|
|
22
|
+
|
|
7
23
|
## [0.90.1] - 2026-11-11
|
|
8
24
|
|
|
9
25
|
**Docs only: a shorter README and readable docs pages.**
|
package/docs/concurrency.md
CHANGED
|
@@ -35,7 +35,9 @@ while your feature is at plan or implement.
|
|
|
35
35
|
A dev deploy is machine state, not branch state, so `flow verify` keeps a small registry in
|
|
36
36
|
`.dev-flow/dev-ports.json` (port → slug, commit, time). `flow status` shows it.
|
|
37
37
|
|
|
38
|
-
If
|
|
38
|
+
If the flow holding your port is already past its **Verified?** (at pre-release or release, and not
|
|
39
|
+
re-asking it), nobody is reviewing that deploy, so verify replaces it and says so. If the holder is
|
|
40
|
+
still being reviewed or still in implement, verify doesn't deploy. Instead it asks
|
|
39
41
|
**Dev port?**, showing who holds the port and how much RAM and disk are free, and offers:
|
|
40
42
|
|
|
41
43
|
- **run alongside** on the next free port (`--port=<n>`). This needs `parallelDev` not set to `no`,
|
package/docs/gates.md
CHANGED
|
@@ -33,9 +33,10 @@ Tools that never gate: `test`, `check`, `health`, `status`, `abort`, `doctor`, `
|
|
|
33
33
|
|
|
34
34
|
Creates the feature, binds this session to it, and renames the session after the slug.
|
|
35
35
|
|
|
36
|
-
- `--ui` means the plan gate requires rendered mockups.
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
- `--ui` means the plan gate requires rendered mockups. The agent turns it on by itself when screens
|
|
37
|
+
change (it only adds a check); turning it off (`--no-ui` at plan, or aborting a ui feature) needs
|
|
38
|
+
your OK. `--patch` (a small fix, no written plan) and `--docs` (docs only, no build checks) are
|
|
39
|
+
lighter modes and need your OK in chat, after which the agent adds `--confirmed`.
|
|
39
40
|
- **The playbook needs a `merge` policy.** If it has none, start asks which style to use (squash,
|
|
40
41
|
merge, rebase or any), suggests one from your git history, and writes your answer into
|
|
41
42
|
`## release`.
|
|
@@ -78,7 +79,8 @@ Run without `--confirmed`, it deploys for your review:
|
|
|
78
79
|
|
|
79
80
|
1. Fetches, and rebases the branch if main moved ahead. Conflicts or uncommitted tracked edits
|
|
80
81
|
refuse, and the branch is left untouched.
|
|
81
|
-
2. Checks the dev port. If another
|
|
82
|
+
2. Checks the dev port. If another flow that is past its Verified? holds it, verify takes it over
|
|
83
|
+
and says so. If one still under review holds it, it asks **Dev port?**: run alongside on
|
|
82
84
|
another port, replace that deploy, or wait. See [concurrency](concurrency.md).
|
|
83
85
|
3. Runs the checks (re-running any that are stale or missing), the build, the `dev` deploy, and then
|
|
84
86
|
the health probe against what it just deployed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.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": [
|
|
@@ -27,7 +27,9 @@ note). Other sessions' worktrees are theirs.
|
|
|
27
27
|
behind (a conflict aborts and hands it to you), runs build, the `dev`
|
|
28
28
|
deploy and the health probe against what it deployed, and returns
|
|
29
29
|
`NEEDS-OPERATOR Verified?`. It never opens a dialog.
|
|
30
|
-
-
|
|
30
|
+
- A flow past its Verified? holding the dev port is replaced without a
|
|
31
|
+
question (the result says so). One still under review →
|
|
32
|
+
`NEEDS-OPERATOR Dev port?` with free
|
|
31
33
|
RAM/disk: ask, stop, then re-run with `--port=<n>` or `--replace` on
|
|
32
34
|
their answer. "wait" means wait; a later "proceed" about the feature is
|
|
33
35
|
not a yes to replacing another flow's stack.
|
|
@@ -15,6 +15,12 @@ No code edits before approval. Reads are always allowed.
|
|
|
15
15
|
is lost at compaction, the gate reads the file.
|
|
16
16
|
- The name is the proof: `plan.md`. A preliminary direction goes inside it
|
|
17
17
|
(marked draft) — never a separate file.
|
|
18
|
+
- **Every revision rewrites, never appends.** On feedback, edit plan.md
|
|
19
|
+
into the current plan: replace what changed, delete dropped options,
|
|
20
|
+
requirements and mockups outright, no round markers ("v2", "updated:",
|
|
21
|
+
"previously…", strikethrough). A settled choice reads as a plain
|
|
22
|
+
decision, no rejected alternatives beside it. Chat holds the history;
|
|
23
|
+
plan.md holds only the result.
|
|
18
24
|
- Part of the scope deferred? `flow roadmap add "<title>" --slug=<slug>
|
|
19
25
|
--brief=<notes>` — never a second `.dev-flow/<slug>/` by hand.
|
|
20
26
|
- Run `git log origin/<default>..<default> --oneline` first: local-only
|
|
@@ -31,6 +37,10 @@ No code edits before approval. Reads are always allowed.
|
|
|
31
37
|
- Embed every render in plan.md as an image:
|
|
32
38
|
``. The gate refuses any
|
|
33
39
|
render not embedded and any `.html` without a shot.
|
|
40
|
+
- Revisions: a dropped screen or variant → delete its `.html`, its
|
|
41
|
+
`<screen>-<w>.png` shots and its embed; a changed screen → edit the same
|
|
42
|
+
`<screen>.html` and re-render over the same filenames (no `-v2` copies).
|
|
43
|
+
At Approve?, `plan/mockups/` holds only what plan.md shows.
|
|
34
44
|
- No chromium anywhere → tell the operator and ask; HTML-only only with
|
|
35
45
|
their OK. Never fake or skip silently.
|
|
36
46
|
- Tips: prefer a static strip (just the component, real stylesheet) over a
|
|
@@ -11,6 +11,16 @@ each step with the gate's stage line, **🚀 release · `<slug>`**; no `Done:` /
|
|
|
11
11
|
1. **PR and merge.** Commit everything, push the feature branch, open the PR.
|
|
12
12
|
- **Merge only once CI is green**: `gh pr checks <n> --watch` (or your
|
|
13
13
|
forge's equivalent) first — CI runs jobs the host may not.
|
|
14
|
+
- **Waiting on CI is your job, inside the turn.** Nothing wakes you once
|
|
15
|
+
the turn ends, so never end it with "I'll keep watching" or a
|
|
16
|
+
*wait / hold* choice: keep re-running the watch until CI settles.
|
|
17
|
+
- **Runs stuck in `queued`** (no job started after ~15 min, while other
|
|
18
|
+
runs on the repo do start) are a stuck schedule, not a slow runner:
|
|
19
|
+
re-trigger them — `gh run cancel <id>` then `gh run rerun <id>`, or
|
|
20
|
+
push a merge of the default branch when it moved — and keep watching.
|
|
21
|
+
- Only a red CI you can't fix, or CI still stuck after a re-trigger, ends
|
|
22
|
+
the turn: report it plainly ("stopped: … — say *go* to resume") and
|
|
23
|
+
stop.
|
|
14
24
|
- Merge in the **playbook's style**, PR number before the flag:
|
|
15
25
|
`gh pr merge <n> --squash` under `merge = squash`, `--merge` under
|
|
16
26
|
`merge = merge`. (`gh pr merge --merge main` reads `main` as the PR.)
|
|
@@ -30,9 +30,14 @@ knobs · merge-policy state.
|
|
|
30
30
|
|
|
31
31
|
- Check `flow status` for an active feature first. Slug: lowercase words,
|
|
32
32
|
dashes.
|
|
33
|
+
- **`--ui` is your call, not a grant**: pass it whenever the feature changes
|
|
34
|
+
screens (or the project's skills require mockups for the change). It only
|
|
35
|
+
adds the mockup gate, so don't ask. Turning it **off** is the operator's:
|
|
36
|
+
`flow start <slug> --no-ui --confirmed` at plan, after they say so, and
|
|
37
|
+
aborting a ui feature at plan asks the same.
|
|
33
38
|
- **Ask every grant in one message**, then make one call with all of them:
|
|
34
|
-
the mode (`normal` default, or `--patch` / `--docs`)
|
|
35
|
-
|
|
39
|
+
the mode (`normal` default, or `--patch` / `--docs`) and the merge policy if
|
|
40
|
+
the playbook has none —
|
|
36
41
|
`flow start <slug> [--ui] [--patch|--docs] [--merge=<style>] --confirmed`.
|
|
37
42
|
Never grant any of them yourself. When the operator's own request already
|
|
38
43
|
grants one ("start a docs flow"), that is their word: pass `--confirmed` on
|
|
@@ -41,8 +46,8 @@ knobs · merge-policy state.
|
|
|
41
46
|
- No merge policy → the gate refuses with `NEEDS-OPERATOR Merge policy?` and a
|
|
42
47
|
suggestion read off the repo's history. Ask: squash, merge, rebase or any.
|
|
43
48
|
The answer is written into `## release` once.
|
|
44
|
-
- `--ui` after a plain start, still at plan: `flow start <slug> --ui
|
|
45
|
-
|
|
49
|
+
- `--ui` after a plain start, still at plan: `flow start <slug> --ui` from
|
|
50
|
+
the feature's own session — no abort, no question.
|
|
46
51
|
- Start warns when this session runs an older dev-flow build than the
|
|
47
52
|
checkout (`/reload` before trusting gate output) and lists playbook gaps.
|
|
48
53
|
|
package/src/core.ts
CHANGED
|
@@ -341,7 +341,7 @@ export function approveGate(state: FlowState, cfg: Config, planFiles: string[],
|
|
|
341
341
|
//  with an optional "title" tolerated; matching is case-insensitive
|
|
342
342
|
const embeds = [...planDoc.matchAll(/!\[[^\]]*\]\(\s*<?([^)\s>]+)>?(?:\s+"[^"]*")?\s*\)/g)].map((m) => m[1].toLowerCase());
|
|
343
343
|
const unembedded = planFiles.filter((f) => IMG_EXT.test(f) && !embeds.some((e) => e === f.toLowerCase() || e.endsWith("/" + f.toLowerCase())));
|
|
344
|
-
if (unembedded.length) errs.push(`plan.md must embed every render — missing embed: ${unembedded.join(", ")} (write  under the screen's section)`);
|
|
344
|
+
if (unembedded.length) errs.push(`plan.md must embed every render — missing embed: ${unembedded.join(", ")} (write  under the screen's section, or delete the file if that screen/variant was dropped)`);
|
|
345
345
|
// the naming plan.md prescribes (screen.html → screen-<width>.png): a mockups/*.html with no
|
|
346
346
|
// embedded shot of its own was never rendered
|
|
347
347
|
const unrendered = planFiles
|
|
@@ -350,7 +350,7 @@ export function approveGate(state: FlowState, cfg: Config, planFiles: string[],
|
|
|
350
350
|
const stem = f.toLowerCase().replace(/\.html$/, "").split("/").pop()!;
|
|
351
351
|
return !embeds.some((e) => (e.split("/").pop() ?? "").startsWith(stem) && IMG_EXT.test(e));
|
|
352
352
|
});
|
|
353
|
-
if (unrendered.length) errs.push(`mockups without an embedded render — ${unrendered.join(", ")} (render each screen and name the shot after it: <screen>-<width>.png)`);
|
|
353
|
+
if (unrendered.length) errs.push(`mockups without an embedded render — ${unrendered.join(", ")} (render each screen and name the shot after it: <screen>-<width>.png, or delete the html if that screen was dropped)`);
|
|
354
354
|
}
|
|
355
355
|
if (foreignLinks.length)
|
|
356
356
|
errs.push(`mockups link another feature's worktree — ${foreignLinks.join(", ")}: that branch drifts and is removed at its finish; at plan link the main checkout's stylesheet (this feature's worktree does not exist until approve) and re-render`);
|
package/src/present.ts
CHANGED
|
@@ -207,7 +207,7 @@ export function agentText(text: string, v: GateView): string {
|
|
|
207
207
|
|
|
208
208
|
/** Flags only dev-flow's gates take. A generic CLI flag (`docker compose up -d --no-deps`, `gh pr merge --merge`)
|
|
209
209
|
* in a report of what the agent ran is not a dev-flow command handed to the operator. */
|
|
210
|
-
const GATE_FLAGS = "version=|confirmed|ui|patch|docs|yolo|replace|port|no-version|no-fold-check|no-marker-check|no-artifact-check|no-release-create|no-reflect|check-upstream|answers|answers-file|write-file|brief|brief-file|playbook|note";
|
|
210
|
+
const GATE_FLAGS = "version=|confirmed|ui|no-ui|patch|docs|yolo|replace|port|no-version|no-fold-check|no-marker-check|no-artifact-check|no-release-create|no-reflect|check-upstream|answers|answers-file|write-file|brief|brief-file|playbook|note";
|
|
211
211
|
const ASK_COMMAND_RE = new RegExp(`(?:^|[\\s\`'"(*_])/?flow (?:${FLOW_VERBS})\\b|(?:^|[\\s\`])--(?:${GATE_FLAGS})\\b|\\bflow_stage\\b|(?:^|[\\s\`])/flow\\b`);
|
|
212
212
|
/** An imperative addressed to the operator: the verb opens a clause (or follows please/then/just), or a "you can" form. */
|
|
213
213
|
const ASK_VERB_RE = /(?:^|[:;,.!?(—–]\s*|\b(?:please|then|just|now|simply|and)\s+)(?:run|type|enter|use|try|send|invoke)\b|\byou (?:can|could|may|should|need to|might)\b|\bplease\b/i;
|
package/src/runtime/base.ts
CHANGED
|
@@ -236,7 +236,7 @@ export async function releaseTags(root: string): Promise<string[] | null> {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
export const GATE_HELP =
|
|
239
|
-
"help [--json] | init [--force|--draft|--write <text>|--write-file <path>|--answers key=value…|--answers-file <path>] [--confirmed] [--track] | reflect [<note>|list|tidy|move <n> --playbook|--code|done <n> [<what>]] | roadmap [add <text> [--slug=<slug>] [--brief=<notes>|--brief-file=<path>]|pick <n> <slug>|done <n>|drop <n>|tidy] | doctor [<issue note>] | status [slug] [--json] | start <slug> [--ui|--patch|--docs --confirmed] [--force] [--merge=squash|merge|rebase|any] [--check-upstream] | use <slug> | test | check | health | approve [--yolo] | verify [--yolo] [--port=<n>|--replace] [--version=<v>|--no-version] | release [--yolo|--version=<v>|--no-version|--no-fold-check|--no-marker-check] | release-done [--no-artifact-check|--no-release-create] | finish [--yolo] [--no-reflect] [--note=<text>] [slug] | abort [slug] | version [--check-upstream] — state gates take [slug] and --confirmed (the operator already answered in chat); without it the agent's call returns NEEDS-OPERATOR with the question to ask in chat (it never opens a dialog), and the /flow slash command asks in a dialog — verify without --confirmed rebases a branch that is behind the default branch and deploys for review; --port=<n> / --replace answer its Dev port? question when another flow holds the stack — --ui
|
|
239
|
+
"help [--json] | init [--force|--draft|--write <text>|--write-file <path>|--answers key=value…|--answers-file <path>] [--confirmed] [--track] | reflect [<note>|list|tidy|move <n> --playbook|--code|done <n> [<what>]] | roadmap [add <text> [--slug=<slug>] [--brief=<notes>|--brief-file=<path>]|pick <n> <slug>|done <n>|drop <n>|tidy] | doctor [<issue note>] | status [slug] [--json] | start <slug> [--ui] [--no-ui|--patch|--docs --confirmed] [--force] [--merge=squash|merge|rebase|any] [--check-upstream] | use <slug> | test | check | health | approve [--yolo] | verify [--yolo] [--port=<n>|--replace] [--version=<v>|--no-version] | release [--yolo|--version=<v>|--no-version|--no-fold-check|--no-marker-check] | release-done [--no-artifact-check|--no-release-create] | finish [--yolo] [--no-reflect] [--note=<text>] [slug] | abort [slug] | version [--check-upstream] — state gates take [slug] and --confirmed (the operator already answered in chat); without it the agent's call returns NEEDS-OPERATOR with the question to ask in chat (it never opens a dialog), and the /flow slash command asks in a dialog — verify without --confirmed rebases a branch that is behind the default branch and deploys for review; --port=<n> / --replace answer its Dev port? question when another flow holds the stack — --ui on start is the agent's call whenever screens change (it only adds the mockup gate); --patch/--docs, --no-ui (clearing ui on a plan-stage feature) and --merge=<style> are operator-granted (--confirmed); start refuses until the playbook has a merge policy and writes the answer into project.md — --yolo (with --confirmed) answers that checkpoint and pre-confirms every later one; checks and guardrails stay — verify --confirmed carries the operator's release call: --version=<v> (ship that version) or --no-version (merge unreleased), asked with Verified?; release takes the same flags when the call changed — release --no-version ships merge + changelog only (no bump, tag or forge release); --no-fold-check skips the changelog fold line proofs on the operator's word; --no-marker-check lets a branch add conflict-marker-shaped lines on purpose — finish runs the closing reflection worker first (before removing anything) and stops for the operator's fold/drop; the re-run with --confirmed cleans up; --no-reflect --confirmed skips it on the operator's explicit word (yolo never does), --note= hands the worker the operator's friction notes — release names a session running an older dev-flow build than the disk ships and asks update (/reload) or proceed — recorded, never a block — reflect <note> queues a project suggestion in reflections.md (--playbook = docs-flow fix, --code = patch-flow fix); --plugin never writes — dev-flow feedback goes upstream and it prints the GitHub issue recipe; bare reflect prints the session-reflection protocol (bound: run flow_stage op reflect); list numbers open items, move <n> re-files one, done <n> checks a fixed one off, tidy drops closed ones — roadmap manages .dev-flow/roadmap.md: pick <n> <slug> (or add --slug=) stamps an item for flow start, which seeds the new plan from its brief; finish checks it off; drop <n> removes an item nobody wants any more (done would record it as shipped) — a new feature asked for mid-flow is parked there, never as a hand-made .dev-flow/<slug>/; start <slug> --confirmed adopts such a ghost dir — doctor reviews structure, git consistency and open reflections (never writes); doctor <note> prints an investigation brief — version prints the build the disk ships and any other dev-flow copies in this process (--check-upstream asks the registry)";
|
|
240
240
|
export const featDir = (root: string, slug: string) => path.join(dfDir(root), slug);
|
|
241
241
|
export const stateFile = (root: string, slug: string) => path.join(featDir(root, slug), "state.json");
|
|
242
242
|
export const claimFile = (root: string, slug: string) => path.join(featDir(root, slug), "claim.json");
|
|
@@ -253,7 +253,7 @@ export function writeState(root: string, state: FlowState): void {
|
|
|
253
253
|
atomicWrite(stateFile(root, state.slug), `${JSON.stringify(state, null, "\t")}\n`);
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
/** Refusals a session hit before any feature was bound to it — a `flow start --
|
|
256
|
+
/** Refusals a session hit before any feature was bound to it — a `flow start --patch` refused as operator-granted,
|
|
257
257
|
* then retried — belong to the feature that start creates next. */
|
|
258
258
|
const unboundFriction = new Map<string, number>();
|
|
259
259
|
|
package/src/runtime/checks.ts
CHANGED
|
@@ -108,6 +108,11 @@ export async function devSlotCheck(o: GateCtx, state: FlowState): Promise<RunRes
|
|
|
108
108
|
if (!slot || slot.slug === state.slug) return { note: "" };
|
|
109
109
|
if (flag("replace")) return { note: `dev: replaced ${slot.slug}'s deploy on ${portLabel(port)} (operator's answer)` };
|
|
110
110
|
const other = readState(root, slot.slug);
|
|
111
|
+
// the holder's review is over — it is past Verified? (pre-release or release) and not re-asking it, or it is
|
|
112
|
+
// gone: nobody is looking at that deploy, so taking the port asks nobody (lettuce rail-avatar-size-28 asked
|
|
113
|
+
// replace-or-wait over a flow that had already merged)
|
|
114
|
+
if (!other || ((other.stage === "pre-release" || other.stage === "release") && other.pendingAsk !== "Verified?"))
|
|
115
|
+
return { note: `dev: replaced ${slot.slug}'s deploy on ${portLabel(port)} — ${other ? `it is at ${other.stage}, past its Verified?` : "that flow is gone"}, so nobody was reviewing it` };
|
|
111
116
|
const taken = new Set(Object.keys(reg).map(Number).filter(Number.isFinite));
|
|
112
117
|
const nextPort = port !== undefined ? await nextFreePort(port, taken) : null;
|
|
113
118
|
const mem = memAvailable();
|
package/src/runtime/gates.ts
CHANGED
|
@@ -281,7 +281,7 @@ export const GRANT_AFTER =
|
|
|
281
281
|
|
|
282
282
|
export async function gateStart(o: GateCtx): Promise<RunResult> {
|
|
283
283
|
const { root, sess, cfg, rest, flag, slugArg } = o;
|
|
284
|
-
if (!slugArg || !validSlug(slugArg)) return { text: "usage: flow start <slug> [--ui] [--patch|--docs] [--merge=squash|merge|rebase|any] (slug: lowercase, dashes); --
|
|
284
|
+
if (!slugArg || !validSlug(slugArg)) return { text: "usage: flow start <slug> [--ui] [--patch|--docs] [--merge=squash|merge|rebase|any] (slug: lowercase, dashes); --patch/--docs (and --no-ui on an existing plan-stage feature) are operator-granted — ask the operator in chat, then add --confirmed; --ui is yours to pass whenever screens change", isError: true };
|
|
285
285
|
// a ghost (plan/ but no state.json — typically a spin-off someone wrote by hand) is adopted, never a dead end:
|
|
286
286
|
// "already exists, flow use it" sent the agent to use, which found no state, and doctor offered to delete it
|
|
287
287
|
// gh#178: any feature dir without state.json is a ghost, not only one with a plan/ — a tmp/ or mockups
|
|
@@ -300,18 +300,25 @@ export async function gateStart(o: GateCtx): Promise<RunResult> {
|
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
302
|
if (existsSync(featDir(root, slugArg)) && !ghost) {
|
|
303
|
-
// --ui on the plan-stage feature this session drives: the
|
|
304
|
-
//
|
|
305
|
-
//
|
|
303
|
+
// --ui on the plan-stage feature this session drives: turn the mockup gate on — a UI feature left at
|
|
304
|
+
// ui=false skips the mockup proof at approve and every (ui) checklist item (lettuce rail-ui-fixes
|
|
305
|
+
// shipped 20 ungated mockups). Turning it ON only adds proof, so it is the agent's call; turning it
|
|
306
|
+
// OFF (--no-ui) removes a gate and stays operator-granted.
|
|
306
307
|
const existing = readState(root, slugArg);
|
|
307
|
-
if (flag("ui") && existing && sess.slug === slugArg) {
|
|
308
|
-
if (
|
|
309
|
-
|
|
310
|
-
if (
|
|
311
|
-
|
|
312
|
-
return { text: `
|
|
308
|
+
if ((flag("ui") || flag("no-ui")) && existing && sess.slug === slugArg) {
|
|
309
|
+
if (flag("ui") && flag("no-ui")) return { text: "--ui and --no-ui are exclusive", isError: true };
|
|
310
|
+
const on = flag("ui");
|
|
311
|
+
if (!on && !flag("confirmed")) return { text: `--no-ui is operator-granted — it removes the plan gate's mockup requirement; ${GRANT_AFTER}`, isError: true };
|
|
312
|
+
if (existing.ui === on) return { text: `feature ${slugArg} already has the ui flag ${on ? "on" : "off"}` };
|
|
313
|
+
if (existing.stage !== "plan") return { text: `feature ${slugArg} is at ${existing.stage} — the ui flag can be changed only at plan (the mockup gate is approve's)${on ? "; render the screens anyway and say so in the verify report" : ""}`, isError: true };
|
|
314
|
+
writeState(root, { ...existing, ui: on });
|
|
315
|
+
return {
|
|
316
|
+
text: on
|
|
317
|
+
? `ui flag set on existing feature ${slugArg} (plan stage): the approve gate now requires rendered mockups under plan/mockups/ (${cfg.mockupGlobs.join(", ")}), each embedded in plan.md, and the (ui) checklist items apply`
|
|
318
|
+
: `ui flag cleared on ${slugArg} (operator's word): approve no longer requires mockups`,
|
|
319
|
+
};
|
|
313
320
|
}
|
|
314
|
-
return { text: `feature ${slugArg} already exists — flow use ${slugArg} to resume it${existing?.stage === "plan" ? `; to add the mockup gate at plan, run flow start ${slugArg} --ui
|
|
321
|
+
return { text: `feature ${slugArg} already exists — flow use ${slugArg} to resume it${existing?.stage === "plan" ? `; to add the mockup gate at plan, run flow start ${slugArg} --ui from the session bound to it` : ""}`, isError: true };
|
|
315
322
|
}
|
|
316
323
|
// relaxed modes are operator-granted: --confirmed anchors a literal chat grant, same convention as the gate verbs
|
|
317
324
|
if (flag("patch") && flag("docs")) return { text: "--patch and --docs are exclusive — ask the operator which mode they grant", isError: true };
|
|
@@ -320,8 +327,9 @@ export async function gateStart(o: GateCtx): Promise<RunResult> {
|
|
|
320
327
|
// the operator answers mode, mockups and merge policy in a single message
|
|
321
328
|
const alsoMerge = !cfg.release.merge && flagValue(rest, "merge") === null ? `\n${AGENT_MARK}the playbook also has no merge policy — put it in the same question (squash | merge | rebase | any) and pass --merge=<style> on the same re-run` : "";
|
|
322
329
|
if (mode && !flag("confirmed")) return { text: `${mode} mode is operator-granted — ${GRANT_AFTER}${alsoMerge}`, isError: true };
|
|
323
|
-
// --ui adds the rendered-mockup gate to plan:
|
|
324
|
-
|
|
330
|
+
// --ui adds the rendered-mockup gate to plan: stricter, never looser, so the agent turns it on itself
|
|
331
|
+
// whenever screens change — no operator grant (only turning it off is theirs)
|
|
332
|
+
if (flag("no-ui")) return { text: "--no-ui applies to an existing plan-stage feature — a new start is ui-off unless you pass --ui", isError: true };
|
|
325
333
|
// branch discipline: features branch off the default branch — starting from a stale checkout poisons the base
|
|
326
334
|
const curBr = await currentBranch(root);
|
|
327
335
|
if (curBr !== cfg.defaultBranch && !flag("force")) return { text: `main checkout is on ${curBr}, not ${cfg.defaultBranch} — check out ${cfg.defaultBranch} first (git checkout ${cfg.defaultBranch} && git pull) or flow use an unfinished feature; --force to override`, isError: true };
|
|
@@ -350,7 +358,7 @@ export async function gateStart(o: GateCtx): Promise<RunResult> {
|
|
|
350
358
|
text: needsOperator(
|
|
351
359
|
`how should a merged PR land on ${cfg.defaultBranch}: squash, merge (a merge commit), rebase, or any (no policy)?${ev ? ` ${ev.note}${ev.recent ? ` Detected suggestion: ${ev.recent}.` : ""}` : ""} The answer is written into the playbook once.`,
|
|
352
360
|
"Merge policy?",
|
|
353
|
-
`ask the operator — in the same message as any mode
|
|
361
|
+
`ask the operator — in the same message as any mode grant you propose — then re-run once with everything: flow start ${slugArg} --merge=<style> [--ui] [--patch|--docs] --confirmed`,
|
|
354
362
|
),
|
|
355
363
|
isError: true,
|
|
356
364
|
};
|
|
@@ -733,6 +741,12 @@ export async function gateAbort(o: GateCtx): Promise<RunResult> {
|
|
|
733
741
|
// as a ghost the doctor flags (a plan/ whose state.json is gone). A written plan is the
|
|
734
742
|
// operator's work too — it is not dropped without their word.
|
|
735
743
|
const written = listFiles(path.join(featDir(root, target), "plan"));
|
|
744
|
+
// a ui feature aborted at plan and restarted plain sheds its mockup gate — turning ui off is the
|
|
745
|
+
// operator's call, so the abort is too
|
|
746
|
+
if (st.ui && !written.length && !flag("confirmed")) {
|
|
747
|
+
const ok = ui.hasUI && (await ui.confirm("Drop ui feature?", `Abort ${target}? It has the ui flag (mockup gate); a restart without --ui drops it.`));
|
|
748
|
+
if (!ok) return { text: needsOperator(`aborting ${target} drops its ui flag (the mockup gate) — turning ui off is the operator's call`, "Drop ui feature?", "ask the operator, then re-run with --confirmed"), isError: true };
|
|
749
|
+
}
|
|
736
750
|
if (written.length && !flag("confirmed")) {
|
|
737
751
|
const ok = ui.hasUI && (await ui.confirm("Drop plan?", `Abort ${target}? Its plan/ (${written.join(", ")}) is deleted for good.`));
|
|
738
752
|
if (!ok) return { text: needsOperator(`aborting ${target} deletes its written plan (${written.join(", ")})`, "Drop plan?", "ask the operator, then re-run with --confirmed"), isError: true };
|
package/src/runtime/grants.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* A. a gate asked for the operator's word (NEEDS-OPERATOR, or an "operator-granted" refusal) and the same
|
|
7
7
|
* gate is re-run with --confirmed before any operator message arrived;
|
|
8
|
-
* B. a feature started in this session gets a mode flag (--
|
|
8
|
+
* B. a feature started in this session gets a loosening mode flag (--patch/--docs/--no-ui) granted with --confirmed
|
|
9
9
|
* before any operator message arrived after the start.
|
|
10
10
|
*
|
|
11
11
|
* --confirmed is not the only answer a gate takes: `Dev port?` is answered with --replace or --port=<n>
|
|
@@ -38,7 +38,8 @@ export interface GrantLedger {
|
|
|
38
38
|
export const newGrantLedger = (): GrantLedger => ({ asked: new Map(), started: new Map() });
|
|
39
39
|
|
|
40
40
|
const ASKS_FOR_WORD = /operator-granted|operator's (?:explicit )?word|the operator must grant/;
|
|
41
|
-
|
|
41
|
+
/** Mode flags that loosen a gate — --ui only tightens one, so it is not here; --no-ui (dropping it) is. */
|
|
42
|
+
const MODE_FLAGS = ["--no-ui", "--patch", "--docs"];
|
|
42
43
|
/** Flags that carry the operator's answer to the question a gate asked — `--confirmed`, and the
|
|
43
44
|
* `Dev port?` answers (gh#203). */
|
|
44
45
|
export function answerFlags(args: readonly string[]): string[] {
|