flow-workflows 0.108.0 → 0.110.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/adapters/codex/CORE.md +4 -3
- package/adapters/codex/skills/flow-bug-investigate/SKILL.md +2 -1
- package/adapters/codex/skills/flow-bug-review/SKILL.md +4 -4
- package/adapters/codex/skills/flow-feat-review/SKILL.md +5 -5
- package/adapters/codex/skills/flow-work-README/SKILL.md +3 -2
- package/adapters/gemini/CORE.md +4 -3
- package/adapters/gemini/commands/flow/bug/investigate.toml +2 -1
- package/adapters/gemini/commands/flow/bug/review.toml +4 -4
- package/adapters/gemini/commands/flow/feat/review.toml +5 -5
- package/adapters/gemini/commands/flow/work/README.toml +3 -2
- package/adapters/hermes/CORE.md +4 -3
- package/adapters/hermes/skills/flow-bug-investigate/SKILL.md +2 -1
- package/adapters/hermes/skills/flow-bug-review/SKILL.md +4 -4
- package/adapters/hermes/skills/flow-feat-review/SKILL.md +5 -5
- package/adapters/hermes/skills/flow-work-README/SKILL.md +3 -2
- package/adapters/opencode/CORE.md +4 -3
- package/adapters/opencode/commands/flow-bug-investigate.md +2 -1
- package/adapters/opencode/commands/flow-bug-review.md +4 -4
- package/adapters/opencode/commands/flow-feat-review.md +5 -5
- package/adapters/opencode/commands/flow-work-README.md +3 -2
- package/bin/cli.mjs +301 -50
- package/package.json +1 -1
- package/plugins/flow/.claude-plugin/plugin.json +1 -1
- package/plugins/flow/CHANGELOG.md +32 -0
|
@@ -180,7 +180,7 @@ Cost line: count every subagent this command launched — reviewers = §2.1 buil
|
|
|
180
180
|
- Review tier: <light | full | proportional — which reviewers ran, at what built-in effort (medium/high/xhigh/max), and why, per §2.0>
|
|
181
181
|
- Agents launched: <ran vs defined — `N/M` of the `review_skill`/`reviewers` roster, naming any that did not run (with the reason) and any substitution; "built-in only" if §2.0 selected no panel>
|
|
182
182
|
- Cost: <n>/<budget_max> subagents launched (<k> reviewers · <m> reinforcements · <s> skeptics), tier <light|proportional|full>
|
|
183
|
-
- Measured cost: <what the harness reported for this round, when it reported anything —
|
|
183
|
+
- Measured cost: <what the harness reported for this round, when it reported anything — recorded as the round's `usd` in `meta.json.cost[]` (`/flow-feat-review §9`), and `/flow-work-daily` and `flow cost` read it back. A harness that reports no figure is recorded as "not reported": the subagent count above is a headcount, not a cost, and a guess is worse than a gap.>
|
|
184
184
|
- Effective size: <diff size (N changed lines) vs `meta.json.size`, which the tier used, and — when the diff landed within 10% under a tier threshold — that fact (§2.0)>
|
|
185
185
|
- Review path: <the two paths this round actually took: `flow bundle` or git for the material, `flow review` or the agentic panel for the reviewers — each with the reason when it was the fallback (no CLI, non-zero exit, `agents.exec_cmd` empty, every role empty). Without this line a round that skipped the CLI reads exactly like one that used it. When the pack ran, quote its `Config read:` line verbatim: it is the only place that says whether the overlay reached the material, and “no `--harness` was given” there means every key set only in the overlay was missing from this round.>
|
|
186
186
|
- Agent models: <the value of `models.workers`/`models.agents` **with the file each came from** (flow-core §0) when set; otherwise "inherited from this thread", naming the config files you listed; agents named in `agents.<role>` keep their own definition's model>
|
|
@@ -223,10 +223,10 @@ Cost line: count every subagent this command launched — reviewers = §2.1 buil
|
|
|
223
223
|
<only if §5 was run; refuted findings with their reason, or "not applicable">
|
|
224
224
|
|
|
225
225
|
## Blockers
|
|
226
|
-
1. [file:line] · <origin> · …
|
|
226
|
+
1. [file:line] · <origin(s), from `/flow-feat-review §2.1`'s list> · …
|
|
227
227
|
|
|
228
228
|
## Suggestions
|
|
229
|
-
1. [file:line] · <origin> · …
|
|
229
|
+
1. [file:line] · <origin(s), from `/flow-feat-review §2.1`'s list> · …
|
|
230
230
|
```
|
|
231
231
|
|
|
232
232
|
## 8. Close
|
|
@@ -234,7 +234,7 @@ Cost line: count every subagent this command launched — reviewers = §2.1 buil
|
|
|
234
234
|
- With blockers: `phase` stays where it was (`validate` for size ≥ S, `fix` on XS, where validate never ran). Iterate.
|
|
235
235
|
- Without blockers: `phase = "review"`, add to `phases_done`. Suggest `/flow-bug-postmortem` (M/L) or `/flow-bug-ship` (XS/S).
|
|
236
236
|
- **Record *what* you reviewed, and separately what you changed after reading it** — `/flow-feat-review` §9, unchanged: `reviewed_sha` = the **candidate** of §1.5 (the revision the reviewers read, never `git rev-parse HEAD`, which by now holds this round's own fixes), and `fixed_sha` = `git rev-parse HEAD` after those fixes, empty when the round applied none. `phases_done` says a review happened; these two say on which tree and what moved afterwards, and `/flow-bug-ship §0` reads both against what is being pushed. Only when the phase advances: a review that ended in blockers reviewed nothing that stands.
|
|
237
|
-
- **Record which pass found what** — `/flow-feat-review §9`, unchanged: one `meta.json.review_findings[]`
|
|
237
|
+
- **Record which pass found what** — `/flow-feat-review §9`, unchanged: one `meta.json.review_findings[]` row per finding with every origin that raised it and its outcome, plus what the round launched, written once per round through `npx flow-workflows@<version> record-review --file`, the CLI panel's roles included as sources — never by hand, and never also by `flow review --record`. `flow yield` reads them back across works and repos, and the retirement rule is the same: a pass with no unique accepted finding across twenty rounds at a size comes out of the command at that size.
|
|
238
238
|
- **Record what the agents missed** — `/flow-feat-review §9`, unchanged: surviving findings in a category a panel member or named `agents.<role>` owns and did not report → `meta.json.agent_lessons[]` rows (flow-core §6.7), asking nothing. A fix is where this pays most: the defect already reached production once, and the reviewer that owns its category let it.
|
|
239
239
|
- **Stage what the review taught** (`knowledge.stage` set; silence by default). Review is where a project teaches the most, and this is the only moment its findings are in context. Candidates are findings about the **domain or the codebase's real behaviour**, not about this diff: a library that does other than its name says, a test disguise that kept the suite green over a live defect, a module rule the reviewers had to cite from its own prose, a measurement. A blocker fixed here is not knowledge; *why it was written wrong* may be. Same evidence rule as `/flow-feat-design` §8 — one line of evidence per finding or it is not staged. One call per finding, one line to the user («Staged N finding(s) for `postmortem`/`ship`»). Never `knowledge.save` here.
|
|
240
240
|
- Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
|
|
@@ -156,7 +156,7 @@ Launch the reviewers selected in §2.0 and **consolidate their findings into a s
|
|
|
156
156
|
|
|
157
157
|
When both run, deduplicate overlapping correctness/simplification findings (count each once). The `review_skill` specialists (offensive/defensive security, silent failures, architecture) are not repeated in later phases.
|
|
158
158
|
|
|
159
|
-
**Dedup keeps every source, not the first one.** A finding carries its **origin** from here to §8 — `built-in
|
|
159
|
+
**Dedup keeps every source, not the first one.** A finding carries its **origin** from here to §8, spelled from a closed list — `built-in` · `panel:<role>` (`<role>` = the part of a `quality.reviewers` entry before its `:`, or the `review_skill` agent's name — lower-case, every run of other characters turned into `-`) · `reinforcement:<area>` (§3) · `sweep` (§3.5) · `query-duel` (§3.6) · `yagni` (§4) · `contract` (§5) · `idiom` (§5.5) — and a finding more than one source raised lists all of them. §9 records them through a command that refuses any other spelling. Counted once, credited to each: a finding only one pass saw and a finding three sources raised say opposite things about that pass, and §9 records the difference.
|
|
160
160
|
|
|
161
161
|
### 2.2 Design truth vs design rationale (do not inherit rationalizations)
|
|
162
162
|
`03-design.md` goes to reviewers as context, with unequal authority:
|
|
@@ -323,7 +323,7 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
|
|
|
323
323
|
- Review path: <the two paths this round actually took: `flow bundle` or git for the material, `flow review` or the agentic panel for the reviewers — each with the reason when it was the fallback (no CLI, non-zero exit, `agents.exec_cmd` empty, every role empty). Without this line a round that skipped the CLI reads exactly like one that used it. When the pack ran, quote its `Config read:` line verbatim: it is the only place that says whether the overlay reached the material, and “no `--harness` was given” there means every key set only in the overlay was missing from this round.>
|
|
324
324
|
- Agent models: <the value of `models.workers`/`models.agents` **with the file each came from** (flow-core §0) when set; otherwise "inherited from this thread", naming the config files you listed — "unset" without them reads the same whether the overlay was empty or never opened — plus, when the panel ran, that agents named in `agents.<role>` kept the model their own definition sets. The values as they are, no judgement on them>
|
|
325
325
|
- Cost: <n>/<budget_max> subagents launched (<k> reviewers · <m> reinforcements · <s> skeptics), tier <light|proportional|full>, effort <medium|high|xhigh|max>
|
|
326
|
-
- Measured cost: <what the harness reported for this round, when it reported anything —
|
|
326
|
+
- Measured cost: <what the harness reported for this round, when it reported anything — §9 records it as the round's `usd` in `meta.json.cost[]`, and `/flow-work-daily` and `flow cost` read it back. A harness that reports no figure is recorded as "not reported": the subagent count above is a headcount, not a cost, and a guess is worse than a gap.>
|
|
327
327
|
- Agents launched: <ran vs defined — `N/M` of the `review_skill`/`reviewers` roster, naming any that did not run (with the reason) and any substitution; "built-in only" if §2.0 selected no panel>
|
|
328
328
|
- Completeness rounds (M/L): N
|
|
329
329
|
- Critical findings (block ship): N
|
|
@@ -363,10 +363,10 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
|
|
|
363
363
|
<if §6 did not run, one line saying which condition did not hold — size, diff size, count, or budget>
|
|
364
364
|
|
|
365
365
|
## Blockers (must-fix)
|
|
366
|
-
1. [file:line] · <origin> · description + concrete proposal
|
|
366
|
+
1. [file:line] · <origin(s), from §2.1's list> · description + concrete proposal
|
|
367
367
|
|
|
368
368
|
## Suggestions (nice-to-have)
|
|
369
|
-
1. [file:line] · <origin> · description
|
|
369
|
+
1. [file:line] · <origin(s), from §2.1's list> · description
|
|
370
370
|
|
|
371
371
|
## Quality gates
|
|
372
372
|
- style_fix: ✅ / ❌
|
|
@@ -386,7 +386,7 @@ Write `.claude/work/<TICKET>/06-review.md`. The `Cost:` line of `## Summary` is
|
|
|
386
386
|
- `reviewed_sha` = **the candidate of §1.5**, the revision the reviewers actually read. Not `git rev-parse HEAD`, which by then holds this round's own fixes — code no reviewer saw, recorded as reviewed, and `ship` finding it equal to `HEAD` every time.
|
|
387
387
|
- `fixed_sha` = `git rev-parse HEAD` after this round's fixes, or **empty** when the round applied none. Two fields because they are two facts.
|
|
388
388
|
- `phases_done` says a review *happened*; these say which tree, and `/flow-feat-ship §1` reads both before pushing. Written whenever the phase advances, never when it does not: a review that ended in blockers reviewed nothing that stands.
|
|
389
|
-
- **Record which pass found what**, in the same write
|
|
389
|
+
- **Record which pass found what**, in the same write, through the CLI — never by editing `meta.json`: write the round to `.claude/work/<TICKET>/review/round-<k>.json` and run `npx flow-workflows@<version> record-review --file <that path>` from the work's checkout. The file is `{ "round": { "mr": <n, in a multi-MR/PR work>, "tier": "light|proportional|full", "effective_size": "XS|S|M|L", "agents": { "<origin>": <agents it launched> }, "usd": <what the harness reported, when it did> }, "findings": [ { "sources": ["<origin>", …], "severity": "blocker|major|minor|nit|unrated", "file": "<path>", "outcome": "<outcome>" } ] }` — one entry per finding after §2.1's dedup, every origin that raised it in `sources`, no finding text (it stays in the artifact). `round` and its `agents` are required: every pass that ran this round, findings or not — a pass that ran and found nothing is the case the count exists for — and every source of a finding must be one of them. **Outcome**, as the round ends: `fixed` (applied in this round) · `open` (a blocker left to the user) · `rejected` (judged wrong — the reason is in this artifact) · `discarded` (refuted by §6) · `deferred` (became a `followups[]` entry). Exit 1 names each value outside the lists with the valid ones and writes nothing: correct them and run it once more. The CLI unavailable (the fallback rule of §1) → say so in `06-review.md` and leave the rows unrecorded rather than hand-written — a round with no rows is visible as such, a misspelt one is counted wrong. **One round, one record**: when the CLI ran the panel (§1), it ran without `--record`, and its roles go into this same file as `panel:<role>` sources with their real outcomes — recording both would split one review into two rounds and count every finding as unique to its half. `flow review --record` is for running the panel outside a review phase. `flow yield` reads them back across every work and repo, per origin and per size: rounds run, findings, how many only that pass raised, how many of those were acted on (`fixed` · `open` · `deferred`), and the agents it took. That unique-accepted number is the only evidence a pass is still earning its words, and `yield` marks a pass that ran twenty rounds at a size without one.
|
|
390
390
|
- **Stage what the review taught** (`knowledge.stage` set; silence by default). Review is where a project teaches the most, and this is the only moment its findings are in context. Candidates are findings about the **domain or the codebase's real behaviour**, not about this diff: a library that does other than its name says, a test disguise that kept the suite green over a live defect, a module rule the reviewers had to cite from its own prose, a measurement. A blocker fixed here is not knowledge; *why it was written wrong* may be. Same evidence rule as `/flow-feat-design` §8 — one line of evidence per finding or it is not staged. One call per finding, one line to the user («Staged N finding(s) for `ship`»). Never `knowledge.save` here.
|
|
391
391
|
- Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
|
|
392
392
|
- **Record what the agents missed** (flow-core §6.7, `agents.learn` not `off`; asking nothing): for each finding that survived, the panel member or named `agents.<role>` whose category it falls in and who did not report it, and the delegated `build` agent whose code it sits in → one `meta.json.agent_lessons[]` row each, only when the lesson passes the §6.7 test. The origins §2.1 carried are what make this possible — a finding with no origin teaches nobody.
|
|
@@ -92,7 +92,7 @@ This system **orchestrates** the project's existing sub-agents and skills (it do
|
|
|
92
92
|
"fixed_sha": "40-char sha after that review's own fixes, or '' when it applied none",
|
|
93
93
|
"validated_sha": "40-char sha the suite last went green on, or ''",
|
|
94
94
|
"respond_rounds": 0,
|
|
95
|
-
"review_findings": [{"round": 1, "
|
|
95
|
+
"review_findings": [{"round": 1, "sources": ["built-in", "panel:security"], "severity": "blocker", "file": "src/X.php", "outcome": "fixed"}],
|
|
96
96
|
"mrs": [
|
|
97
97
|
{
|
|
98
98
|
"n": 1,
|
|
@@ -161,7 +161,8 @@ This system **orchestrates** the project's existing sub-agents and skills (it do
|
|
|
161
161
|
```
|
|
162
162
|
|
|
163
163
|
- **`candidate_sha` / `reviewed_sha` / `fixed_sha` / `validated_sha`**: which code each verdict is about. `candidate_sha` is written by `review` in its **pre-flight** (§1.5) — the revision it froze before reading anything, `git rev-parse HEAD` over a clean tree and `git stash create` over a dirty one, anchored at `refs/flow/candidate/<TICKET>` so nothing collects it. The other three are written at `## Close`, **only when the phase actually advances**, work-level and in the current `mrs[]` entry: `reviewed_sha` is the candidate that was actually read, `fixed_sha` is `HEAD` after that round's own fixes (empty when it applied none), `validated_sha` is where the suite went green.
|
|
164
|
-
- **`review_findings[]`**: one
|
|
164
|
+
- **`review_findings[]`**: one row per finding, after the review's dedup — `{ round, mr?, sources, severity, file, outcome }`, no finding text (that stays in `06-review.md`). `sources` lists every origin that raised it, from a closed list (`built-in` · `panel:<role>` · `reinforcement:<area>` · `sweep` · `query-duel` · `yagni` · `contract` · `idiom`); `outcome` is `fixed` · `open` · `rejected` · `discarded` · `deferred`. The same round writes one `cost[]` entry with `round`, `tier`, `effective_size` and `agents` — every pass it launched, findings or not. Only `flow record-review --file` writes them — once per round, the CLI panel's roles included — and it refuses any value outside those lists, or a source that is not among the round's `agents`: six weeks of hand-written origins had produced ~65 spellings. Rows from before that, `{ round, origin, severity, file, discarded_by_skeptic }` one per source, stay as they are. It exists so a pass can be retired on evidence: `flow yield [<repo-path>…]` reads every work those repos hold — live and `_archive/`, here and in the main checkout — and reports per origin and per size how many rounds each ran, how many findings it contributed, how many **only** it raised, and how many of those were acted on (for the older rows: not refuted by a skeptic) — and a finding three sources raised says nothing about any of them, which is why dedup keeps every source rather than the first. The rule was written down before the data arrived: no unique accepted finding across twenty rounds at a size (XS and S pooled) and the pass comes out of the command at that size.
|
|
165
|
+
- **`escape`** (bug works only): `{ work, ticket, commit, file, size }` — the reviewed work the root-cause commit belongs to, written by `flow escape` at `bug:investigate`'s Close, and only when the commit sits inside exactly one work's reviewed range (merge history) or carries the number of exactly one reviewed MR/PR (squash). `flow yield` prints `escapes: <n>` under the table of that work's size: what a lighter review at that size has already let through.
|
|
165
166
|
Two fields for the review because they are two facts. `reviewed_sha` used to be `git rev-parse HEAD` at the end of the phase, which by then held the round's own fixes — so `ship` compared a sha against itself and reported a match over code no reviewer had read. Read by `ship` at pre-flight against `HEAD`: a delta of test files and this work's own folder passes with a note in `06-review.md`; anything else stops and asks in every autonomy mode. Empty is not a mismatch; `fixed_sha` set with `reviewed_sha == HEAD` is one. `review` also reads `reviewed_sha` back as **its own base** on a re-review, so the second round reads the delta instead of the whole branch.
|
|
166
167
|
- **`respond_rounds`**: rounds of `/flow-work-respond` on an MR/PR. `/flow-work-respond §1` reads it against `quality.respond_max_rounds` (empty = 3) and refuses the round that would exceed it, handing the open threads back to the user.
|
|
167
168
|
- **`roadmap`**: the roadmap item this work delivers (flow-core §10). Linked at `/flow-feat-start §3.7`, marked in progress / done by `/flow-feat-ship` inside the MR/PR, shown by `next`/`daily`/`resume` — which also flag an item the code delivered but the file still does not mark. `null` with no roadmap, no link, or a bug.
|
package/bin/cli.mjs
CHANGED
|
@@ -436,8 +436,8 @@ function flowConfig(repo, harness, rev = null) {
|
|
|
436
436
|
|
|
437
437
|
// `.claude/work` is git-ignored like the FLOW files, so a worktree does not carry it either — and
|
|
438
438
|
// the two things that read it fail silently when it is missing: the pack drops its `## Work`
|
|
439
|
-
// section, which it advertises and no reviewer knows to miss, and `--record`
|
|
440
|
-
// nowhere and
|
|
439
|
+
// section, which it advertises and no reviewer knows to miss, and `--record` used to write the
|
|
440
|
+
// figure nowhere and exit 0. Same resolution as the config: here first, the main checkout otherwise.
|
|
441
441
|
function workFolder(repo, branch) {
|
|
442
442
|
const root = join(rootHolding(repo, join('.claude', 'work')), '.claude', 'work')
|
|
443
443
|
if (!existsSync(root)) return null
|
|
@@ -1054,27 +1054,175 @@ async function review(argv) {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
|
|
1056
1056
|
const text = out.join('\n')
|
|
1057
|
+
const outFile = argv.includes('--out') ? argv[argv.indexOf('--out') + 1] : null
|
|
1058
|
+
if (outFile) { writeFileSync(outFile, `${text}\n`); console.log(`wrote ${outFile}`) } else console.log(text)
|
|
1059
|
+
|
|
1057
1060
|
if (argv.includes('--record')) {
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1061
|
+
// The review above is already printed: a recording that fails must never cost the panel's
|
|
1062
|
+
// output. Harness answers are not schema-checked, so what the writer refuses — a severity
|
|
1063
|
+
// outside the four, a finding with no file — is normalised here rather than lost.
|
|
1064
|
+
const slugs = roles.map((r, i) => {
|
|
1065
|
+
const slug = r.split(':')[0].trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')
|
|
1066
|
+
return slug ? `panel:${slug}` : `panel:role-${i + 1}`
|
|
1064
1067
|
})
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1068
|
+
const role = (r) => slugs[roles.indexOf(r)]
|
|
1069
|
+
const agents = {}
|
|
1070
|
+
for (const r of results.filter((x) => !x.error)) agents[role(r.role)] = (agents[role(r.role)] ?? 0) + 1
|
|
1071
|
+
if (!Object.keys(agents).length) {
|
|
1072
|
+
console.error('flow review --record: no reviewer answered, so there is no round to record.')
|
|
1073
|
+
process.exitCode = 1
|
|
1074
|
+
return
|
|
1075
|
+
}
|
|
1076
|
+
const doc = {
|
|
1077
|
+
round: { agents, ...(costs.length ? { usd: Number(costs.reduce((a, b) => a + b, 0).toFixed(6)) } : {}) },
|
|
1078
|
+
findings: findings.map((f) => ({
|
|
1079
|
+
sources: [...new Set(f.roles.map(role))],
|
|
1080
|
+
severity: SEVERITIES.includes(f.severity) ? f.severity : 'unrated',
|
|
1081
|
+
file: typeof f.file === 'string' && f.file ? f.file : '?',
|
|
1082
|
+
outcome: 'open',
|
|
1083
|
+
})),
|
|
1084
|
+
}
|
|
1085
|
+
const bad = validateReview(doc)
|
|
1086
|
+
// `exitCode`, never `exit()`: the review was just printed, and on a pipe stdout is
|
|
1087
|
+
// asynchronous — exiting now can cut off the output this ordering exists to keep.
|
|
1088
|
+
if (bad.length) { console.error(`flow review --record: nothing recorded.\n${bad.join('\n')}`); process.exitCode = 1; return }
|
|
1089
|
+
if (!writeReview(built.work, doc)) {
|
|
1090
|
+
console.error(`flow review --record: no work on \`${built.branch}\`, or its meta.json is missing or not JSON — the review above stands, unrecorded.`)
|
|
1091
|
+
process.exitCode = 1
|
|
1092
|
+
return
|
|
1093
|
+
}
|
|
1075
1094
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
// --- escape ----------------------------------------------------------------------------
|
|
1098
|
+
// A bug whose cause is a commit a flow review read is the one number that says what trimming
|
|
1099
|
+
// the review would cost. It is charged only on evidence: the commit inside exactly one
|
|
1100
|
+
// reviewed range, or carrying the number of exactly one reviewed MR/PR. "An ancestor of what
|
|
1101
|
+
// was reviewed" is not evidence — the whole history of the base is an ancestor of every
|
|
1102
|
+
// reviewed sha — and a ticket number is not either, since one ticket spans several MRs/PRs.
|
|
1103
|
+
|
|
1104
|
+
function escapeOf(argv) {
|
|
1105
|
+
let file = null
|
|
1106
|
+
const rest = []
|
|
1107
|
+
for (let i = 0; i < argv.length; i++) {
|
|
1108
|
+
if (argv[i] === '--file') file = argv[++i] ?? null
|
|
1109
|
+
else if (argv[i].startsWith('--file=')) file = argv[i].slice('--file='.length)
|
|
1110
|
+
else if (argv[i].startsWith('--')) { console.error(`flow escape: unknown option \`${argv[i]}\``); process.exit(1) }
|
|
1111
|
+
else rest.push(argv[i])
|
|
1112
|
+
}
|
|
1113
|
+
const commitArg = rest[0]
|
|
1114
|
+
if (!commitArg) { console.error('flow escape: <commit> is required'); process.exit(1) }
|
|
1115
|
+
const repo = git(['rev-parse', '--show-toplevel']).trim()
|
|
1116
|
+
if (!repo) { console.error('flow escape: not a git checkout'); process.exit(1) }
|
|
1117
|
+
const commit = git(['rev-parse', '--verify', '--quiet', `${commitArg}^{commit}`], repo).trim()
|
|
1118
|
+
if (!commit) { console.error(`flow escape: \`${commitArg}\` is not a commit in this checkout`); process.exit(1) }
|
|
1119
|
+
const branch = git(['rev-parse', '--abbrev-ref', 'HEAD'], repo).trim()
|
|
1120
|
+
const here = workFolder(repo, branch)
|
|
1121
|
+
if (!here) { console.error(`flow escape: no work on \`${branch}\` to record the escape in`); process.exit(1) }
|
|
1122
|
+
|
|
1123
|
+
const cfg = flowConfig(repo, null, null)
|
|
1124
|
+
// The MR/PR a squash commit came from, and nothing else: GitHub appends `(#N)` to the end of
|
|
1125
|
+
// the subject, GitLab writes `See merge request <path>!N` in the body. A `(#7)` quoted
|
|
1126
|
+
// mid-subject — a revert, a cherry-pick — names another MR/PR and charges nobody.
|
|
1127
|
+
const subject = git(['log', '-1', '--format=%s', commit], repo).trim()
|
|
1128
|
+
const body = git(['log', '-1', '--format=%b', commit], repo)
|
|
1129
|
+
// A GitLab reference carries its project path, and an MR of another project with the same
|
|
1130
|
+
// number is not this one: the unit's url has to name that path too.
|
|
1131
|
+
const refs = [
|
|
1132
|
+
...(subject.match(/\(#(\d+)\)\s*$/) ? [{ n: subject.match(/\(#(\d+)\)\s*$/)[1], path: null }] : []),
|
|
1133
|
+
...[...body.matchAll(/See merge request (\S*)!(\d+)/g)].map((m) => ({ n: m[2], path: m[1] || null })),
|
|
1134
|
+
]
|
|
1135
|
+
// `(#N)` is a GitHub pull request; on GitLab `#N` is an issue, and only `!N` is an MR.
|
|
1136
|
+
const namedBy = (url) => {
|
|
1137
|
+
const u = String(url ?? '')
|
|
1138
|
+
const pull = u.match(/\/pull\/(\d+)/)?.[1]
|
|
1139
|
+
const mr = u.match(/\/merge_requests\/(\d+)/)?.[1]
|
|
1140
|
+
return refs.some((r) => (r.path === null && r.n === pull)
|
|
1141
|
+
|| (r.path !== null && r.n === mr && u.includes(`/${r.path}/-/merge_requests/${mr}`)))
|
|
1142
|
+
}
|
|
1143
|
+
const isAncestor = (a, b) => {
|
|
1144
|
+
try { execFileSync('git', ['merge-base', '--is-ancestor', a, b], { cwd: repo, stdio: 'ignore' }); return true } catch { return false }
|
|
1145
|
+
}
|
|
1146
|
+
const resolves = (ref) => Boolean(ref) && Boolean(git(['rev-parse', '--verify', '--quiet', `${ref}^{commit}`], repo).trim())
|
|
1147
|
+
|
|
1148
|
+
// Where the reviewed branch left the base. Once merged, the base contains the reviewed sha
|
|
1149
|
+
// and their merge-base is that sha itself, so the fork is read off the merge that brought it
|
|
1150
|
+
// in: the side it was merged into, at that point. A fast-forward leaves no merge to read,
|
|
1151
|
+
// and then there is no range — the MR/PR number is the only evidence left.
|
|
1152
|
+
// The reviewed branch's own commits: what `reviewed` reaches and the far side of every merge
|
|
1153
|
+
// that carried it across does not — the base's tip when it is not merged yet, otherwise the
|
|
1154
|
+
// first parent of each merge whose second side holds it (into the base, or into another
|
|
1155
|
+
// branch on the way). A commit the base already had, brought in by a back-merge, sits behind
|
|
1156
|
+
// one of those first parents and is never the branch's; a branch cut from another branch
|
|
1157
|
+
// owns only its own commits. A fast-forward leaves no merge, and then there is no range.
|
|
1158
|
+
// Two `rev-list` calls per unit, the rest in process: an archive of hundreds of works must
|
|
1159
|
+
// not cost a process per merge per work.
|
|
1160
|
+
const ranges = new Map()
|
|
1161
|
+
const rangeOf = (base, reviewed) => {
|
|
1162
|
+
const key = `${base} ${reviewed}`
|
|
1163
|
+
if (ranges.has(key)) return ranges.get(key)
|
|
1164
|
+
let set = null
|
|
1165
|
+
if (resolves(base)) {
|
|
1166
|
+
let stops = []
|
|
1167
|
+
if (!isAncestor(reviewed, base)) stops = [base]
|
|
1168
|
+
else {
|
|
1169
|
+
const lines = git(['rev-list', '--ancestry-path', '--parents', `${reviewed}..${base}`], repo).trim().split('\n').filter(Boolean)
|
|
1170
|
+
const after = new Set(lines.map((l) => l.split(' ')[0]))
|
|
1171
|
+
const holds = (c) => c === reviewed || after.has(c)
|
|
1172
|
+
stops = lines.map((l) => l.split(' ')).filter((p) => p.length > 2 && !holds(p[1]) && p.slice(2).some(holds)).map((p) => p[1])
|
|
1173
|
+
}
|
|
1174
|
+
if (stops.length) set = new Set(git(['rev-list', reviewed, ...stops.map((x) => `^${x}`)], repo).trim().split('\n').filter(Boolean))
|
|
1175
|
+
}
|
|
1176
|
+
ranges.set(key, set)
|
|
1177
|
+
return set
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
const matches = []
|
|
1181
|
+
const hereReal = realpathSync(here)
|
|
1182
|
+
for (const { path, meta } of worksOf(repo, new Set())) {
|
|
1183
|
+
if (realpathSync(path) === hereReal) continue
|
|
1184
|
+
const units = Array.isArray(meta.mrs) && meta.mrs.length ? meta.mrs : [meta]
|
|
1185
|
+
for (const u of units) {
|
|
1186
|
+
const reviewed = u?.reviewed_sha
|
|
1187
|
+
let how = null
|
|
1188
|
+
if (resolves(reviewed) && isAncestor(commit, reviewed)) {
|
|
1189
|
+
const own = rangeOf(meta.base || cfg.git?.default_base || 'origin/main', git(['rev-parse', reviewed], repo).trim())
|
|
1190
|
+
if (own?.has(commit)) how = `one of the ${own.size} commit(s) its review read, up to ${reviewed.slice(0, 7)}`
|
|
1191
|
+
}
|
|
1192
|
+
if (!how && reviewed && namedBy(u?.url)) how = `the commit names its MR/PR, ${String(u.url).split('/').pop()}`
|
|
1193
|
+
if (how) matches.push({ path, meta, unit: u, how })
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
const works = [...new Set(matches.map((m) => m.path))]
|
|
1198
|
+
if (works.length !== 1) {
|
|
1199
|
+
// A blame that changed takes the old escape with it: counted, it would charge a review for
|
|
1200
|
+
// a commit the investigation no longer names.
|
|
1201
|
+
// Kept only for the same commit matching nothing at all: its evidence did not resolve this
|
|
1202
|
+
// time (a ref not fetched, a branch gone). Another commit, or now two candidate works, and
|
|
1203
|
+
// the old blame no longer stands.
|
|
1204
|
+
let dropped = false, kept = false
|
|
1205
|
+
editMeta(here, (meta) => {
|
|
1206
|
+
if (!meta.escape) return
|
|
1207
|
+
if (meta.escape.commit === commit && !works.length) kept = true
|
|
1208
|
+
else { dropped = true; delete meta.escape }
|
|
1209
|
+
})
|
|
1210
|
+
if (dropped) console.log('The escape recorded earlier for this bug was removed: the evidence below no longer names one review.')
|
|
1211
|
+
if (kept) console.log('The escape recorded earlier for this same commit is kept: its evidence did not resolve this time.')
|
|
1212
|
+
console.log(works.length
|
|
1213
|
+
? `No escape recorded: ${commit.slice(0, 7)} matches ${works.length} reviewed works (${works.map((w) => w.split('/').pop()).join(', ')}), and a guess is not evidence.`
|
|
1214
|
+
: `No escape recorded: ${commit.slice(0, 7)} is not inside any reviewed range or reviewed MR/PR of this repo's works.`)
|
|
1215
|
+
return
|
|
1216
|
+
}
|
|
1217
|
+
const m = matches[0]
|
|
1218
|
+
const escape = {
|
|
1219
|
+
work: m.path.split('/').pop(), ticket: m.meta.ticket ?? null, commit,
|
|
1220
|
+
file: file ?? null, size: m.unit.size ?? m.meta.size ?? null,
|
|
1221
|
+
}
|
|
1222
|
+
if (!editMeta(here, (meta) => { meta.escape = escape })) {
|
|
1223
|
+
console.error(`flow escape: \`${join(here, 'meta.json')}\` is missing or not JSON — nothing recorded`); process.exit(1)
|
|
1224
|
+
}
|
|
1225
|
+
console.log(`Escape recorded: ${commit.slice(0, 7)} went through the review of ${escape.work} (${m.how}).`)
|
|
1078
1226
|
}
|
|
1079
1227
|
|
|
1080
1228
|
// --- cost ------------------------------------------------------------------------------
|
|
@@ -1090,39 +1238,117 @@ async function review(argv) {
|
|
|
1090
1238
|
// Read-modify-write against meta.json, the flow's own state, so both writers go through a
|
|
1091
1239
|
// temporary file: a half-written meta.json loses the work, not just the figure.
|
|
1092
1240
|
function editMeta(work, fn) {
|
|
1093
|
-
if (!work) return
|
|
1241
|
+
if (!work) return false
|
|
1094
1242
|
const p = join(work, 'meta.json')
|
|
1095
|
-
if (!existsSync(p)) return
|
|
1243
|
+
if (!existsSync(p)) return false
|
|
1096
1244
|
let meta
|
|
1097
|
-
try { meta = JSON.parse(readFileSync(p, 'utf8')) } catch { return }
|
|
1245
|
+
try { meta = JSON.parse(readFileSync(p, 'utf8')) } catch { return false }
|
|
1098
1246
|
fn(meta)
|
|
1099
1247
|
const tmp = `${p}.tmp`
|
|
1100
1248
|
writeFileSync(tmp, `${JSON.stringify(meta, null, 2)}\n`)
|
|
1101
1249
|
renameSync(tmp, p)
|
|
1250
|
+
return true
|
|
1102
1251
|
}
|
|
1103
1252
|
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1253
|
+
// --- record-review -----------------------------------------------------------------------
|
|
1254
|
+
// The only writer of a review round's rows. The origins used to be written by hand from the
|
|
1255
|
+
// prose, and six weeks of that produced ~65 spellings for ~12 passes and outcomes written
|
|
1256
|
+
// into the severity field. So the lists are closed here, a value outside them is refused
|
|
1257
|
+
// with the ones that are valid, and nothing is written until every value is.
|
|
1258
|
+
|
|
1259
|
+
const ORIGIN_RE = /^(built-in|sweep|query-duel|yagni|contract|idiom|(panel|reinforcement):[a-z0-9][a-z0-9-]*)$/
|
|
1260
|
+
const SEVERITIES = ['blocker', 'major', 'minor', 'nit', 'unrated']
|
|
1261
|
+
const OUTCOMES = ['fixed', 'open', 'rejected', 'discarded', 'deferred']
|
|
1262
|
+
const TIERS = ['light', 'proportional', 'full']
|
|
1263
|
+
const SIZE_NAMES = SIZES.map(([n]) => n)
|
|
1264
|
+
const ORIGINS_HELP = 'built-in · sweep · query-duel · yagni · contract · idiom · panel:<role> · reinforcement:<area>'
|
|
1265
|
+
+ ' (<role>/<area>: lower-case letters, digits and -)'
|
|
1266
|
+
|
|
1267
|
+
function validateReview(doc) {
|
|
1268
|
+
const bad = []
|
|
1269
|
+
if (!doc || typeof doc !== 'object') return ['the file is not a JSON object']
|
|
1270
|
+
const round = doc.round
|
|
1271
|
+
if (!round || typeof round !== 'object' || Array.isArray(round)) return ['`round` is required: an object with at least `agents`']
|
|
1272
|
+
if (round.mr != null && !(Number.isInteger(round.mr) && round.mr > 0)) bad.push(`round.mr \`${round.mr}\`: a positive integer`)
|
|
1273
|
+
if (round.tier != null && !TIERS.includes(round.tier)) bad.push(`round.tier \`${round.tier}\`: one of ${TIERS.join(' · ')}`)
|
|
1274
|
+
if (round.effective_size != null && !SIZE_NAMES.includes(round.effective_size)) {
|
|
1275
|
+
bad.push(`round.effective_size \`${round.effective_size}\`: one of ${SIZE_NAMES.join(' · ')}`)
|
|
1276
|
+
}
|
|
1277
|
+
if (round.usd != null && typeof round.usd !== 'number') bad.push(`round.usd \`${round.usd}\`: a number, or leave it out`)
|
|
1278
|
+
const agents = round.agents
|
|
1279
|
+
if (!agents || typeof agents !== 'object' || Array.isArray(agents) || !Object.keys(agents).length) {
|
|
1280
|
+
bad.push('round.agents: every pass this round launched, as {origin: agents}, findings or not')
|
|
1281
|
+
}
|
|
1282
|
+
else {
|
|
1283
|
+
for (const [o, n] of Object.entries(agents)) {
|
|
1284
|
+
if (!ORIGIN_RE.test(o)) bad.push(`round.agents origin \`${o}\`: one of ${ORIGINS_HELP}`)
|
|
1285
|
+
if (!(Number.isInteger(n) && n > 0)) bad.push(`round.agents[${o}] \`${n}\`: a positive integer`)
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
if (!Array.isArray(doc.findings)) bad.push('`findings` must be an array (empty when the round found nothing)')
|
|
1289
|
+
else {
|
|
1290
|
+
doc.findings.forEach((f, i) => {
|
|
1291
|
+
const at = `findings[${i}]`
|
|
1292
|
+
if (!f || typeof f !== 'object') { bad.push(`${at}: not an object`); return }
|
|
1293
|
+
if (!Array.isArray(f.sources) || !f.sources.length) bad.push(`${at}.sources: a non-empty list of origins`)
|
|
1294
|
+
else f.sources.forEach((o) => {
|
|
1295
|
+
if (!ORIGIN_RE.test(o)) bad.push(`${at}.sources \`${o}\`: one of ${ORIGINS_HELP}`)
|
|
1296
|
+
else if (agents && typeof agents === 'object' && !(o in agents)) bad.push(`${at}.sources \`${o}\`: not in round.agents — a source is a pass that ran`)
|
|
1297
|
+
})
|
|
1298
|
+
if (!SEVERITIES.includes(f.severity)) bad.push(`${at}.severity \`${f.severity}\`: one of ${SEVERITIES.join(' · ')}`)
|
|
1299
|
+
if (!OUTCOMES.includes(f.outcome)) bad.push(`${at}.outcome \`${f.outcome}\`: one of ${OUTCOMES.join(' · ')}`)
|
|
1300
|
+
if (typeof f.file !== 'string' || !f.file) bad.push(`${at}.file: the path the finding is about`)
|
|
1301
|
+
})
|
|
1302
|
+
}
|
|
1303
|
+
return bad
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
// One round: its findings, each once with every source, and one `cost[]` review entry saying
|
|
1307
|
+
// what the round launched. The round number continues this work's own count, across both.
|
|
1308
|
+
function writeReview(work, doc) {
|
|
1309
|
+
return editMeta(work, (meta) => {
|
|
1310
|
+
const rows = Array.isArray(meta.review_findings) ? meta.review_findings : []
|
|
1311
|
+
const costs = Array.isArray(meta.cost) ? meta.cost : []
|
|
1312
|
+
const last = [...rows, ...costs.filter((e) => e?.phase === 'review')]
|
|
1313
|
+
.reduce((n, r) => Math.max(n, Number(r.round) || 0), 0)
|
|
1314
|
+
const r = doc.round ?? {}
|
|
1315
|
+
const round = last + 1
|
|
1316
|
+
const mr = r.mr != null ? { mr: r.mr } : {}
|
|
1317
|
+
meta.review_findings = [...rows, ...doc.findings.map((f) => ({
|
|
1318
|
+
round, ...mr, sources: f.sources, severity: f.severity, file: f.file, outcome: f.outcome,
|
|
1319
|
+
}))]
|
|
1320
|
+
const agents = r.agents ?? {}
|
|
1321
|
+
meta.cost = [...costs, {
|
|
1322
|
+
phase: 'review', at: new Date().toISOString(), round, ...mr,
|
|
1323
|
+
...(r.tier ? { tier: r.tier } : {}), ...(r.effective_size ? { effective_size: r.effective_size } : {}),
|
|
1324
|
+
agents, reviewers: Object.values(agents).reduce((a, b) => a + b, 0),
|
|
1325
|
+
usd: typeof r.usd === 'number' ? r.usd : null,
|
|
1326
|
+
source: typeof r.usd === 'number' ? 'harness' : 'not reported',
|
|
1327
|
+
}]
|
|
1112
1328
|
})
|
|
1113
1329
|
}
|
|
1114
1330
|
|
|
1115
|
-
function
|
|
1116
|
-
|
|
1117
|
-
const
|
|
1118
|
-
if (!
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1331
|
+
function recordReview(argv) {
|
|
1332
|
+
const at = argv.indexOf('--file')
|
|
1333
|
+
const file = at === -1 ? null : argv[at + 1]
|
|
1334
|
+
if (!file) { console.error('flow record-review: --file <rows.json> is required'); process.exit(1) }
|
|
1335
|
+
const repo = git(['rev-parse', '--show-toplevel']).trim()
|
|
1336
|
+
if (!repo) { console.error('flow record-review: not a git checkout'); process.exit(1) }
|
|
1337
|
+
const branch = git(['rev-parse', '--abbrev-ref', 'HEAD'], repo).trim()
|
|
1338
|
+
const work = workFolder(repo, branch)
|
|
1339
|
+
if (!work) { console.error(`flow record-review: no work on \`${branch}\` — nothing to record against`); process.exit(1) }
|
|
1340
|
+
let doc
|
|
1341
|
+
try { doc = JSON.parse(readFileSync(file, 'utf8')) } catch (e) {
|
|
1342
|
+
console.error(`flow record-review: \`${file}\` is not readable JSON (${e.message})`); process.exit(1)
|
|
1343
|
+
}
|
|
1344
|
+
const bad = validateReview(doc)
|
|
1345
|
+
if (bad.length) {
|
|
1346
|
+
console.error(`flow record-review: nothing recorded — ${bad.length} value(s) outside the lists:`)
|
|
1347
|
+
bad.forEach((b) => console.error(` - ${b}`))
|
|
1348
|
+
process.exit(1)
|
|
1349
|
+
}
|
|
1350
|
+
if (!writeReview(work, doc)) { console.error(`flow record-review: \`${join(work, 'meta.json')}\` is missing or not JSON — nothing recorded`); process.exit(1) }
|
|
1351
|
+
console.log(`recorded ${doc.findings.length} finding(s) and the round's agents in ${join(work, 'meta.json')}`)
|
|
1126
1352
|
}
|
|
1127
1353
|
|
|
1128
1354
|
function cost(argv) {
|
|
@@ -1142,7 +1368,7 @@ function cost(argv) {
|
|
|
1142
1368
|
console.log()
|
|
1143
1369
|
if (!entries.length) {
|
|
1144
1370
|
console.log('Nothing recorded yet. A phase records here when it can measure what it spent:')
|
|
1145
|
-
console.log('`flow review
|
|
1371
|
+
console.log('`flow record-review` writes what the harness reported for a review round, and a')
|
|
1146
1372
|
console.log('harness that reports no figure is recorded as "not reported" rather than guessed.')
|
|
1147
1373
|
return
|
|
1148
1374
|
}
|
|
@@ -1255,6 +1481,7 @@ function yieldOf(argv) {
|
|
|
1255
1481
|
const spellings = new Map()
|
|
1256
1482
|
let rounds = 0, rows = 0, works = 0
|
|
1257
1483
|
const seen = new Set()
|
|
1484
|
+
const escapes = new Map()
|
|
1258
1485
|
const cell = (bucket, origin) => {
|
|
1259
1486
|
if (!table.has(bucket)) table.set(bucket, new Map())
|
|
1260
1487
|
const t = table.get(bucket)
|
|
@@ -1272,6 +1499,11 @@ function yieldOf(argv) {
|
|
|
1272
1499
|
|
|
1273
1500
|
for (const repo of repos) {
|
|
1274
1501
|
for (const { path, meta } of worksOf(repo, seen)) {
|
|
1502
|
+
if (meta.escape?.work) {
|
|
1503
|
+
const b = sizeBucket(meta.escape.size)
|
|
1504
|
+
if (!escapes.has(b)) escapes.set(b, [])
|
|
1505
|
+
escapes.get(b).push(meta.escape.work)
|
|
1506
|
+
}
|
|
1275
1507
|
const found = Array.isArray(meta.review_findings) ? meta.review_findings : []
|
|
1276
1508
|
const costs = (Array.isArray(meta.cost) ? meta.cost : []).filter((e) => e?.phase === 'review' && e.round != null)
|
|
1277
1509
|
if (!found.length && !costs.length) continue
|
|
@@ -1346,20 +1578,23 @@ function yieldOf(argv) {
|
|
|
1346
1578
|
|
|
1347
1579
|
console.log(`# Review yield — ${repos.join(' · ')}`)
|
|
1348
1580
|
console.log()
|
|
1349
|
-
if (!table.size) {
|
|
1581
|
+
if (!table.size && !escapes.size) {
|
|
1350
1582
|
console.log('No review rounds recorded in the works these checkouts hold')
|
|
1351
1583
|
console.log(`(${repos.map((r) => join(r, '.claude', 'work')).join(', ')}, archive included).`)
|
|
1352
1584
|
return
|
|
1353
1585
|
}
|
|
1354
1586
|
console.log(`${works} work(s), ${rounds} review round(s), ${rows} finding row(s).`)
|
|
1355
1587
|
for (const bucket of ['XS+S', 'M', 'L', 'unknown size']) {
|
|
1356
|
-
const t = table.get(bucket)
|
|
1357
|
-
|
|
1588
|
+
const t = table.get(bucket) ?? new Map()
|
|
1589
|
+
const esc = escapes.get(bucket) ?? []
|
|
1590
|
+
if (!t.size && !esc.length) continue
|
|
1358
1591
|
console.log()
|
|
1359
1592
|
console.log(`## ${bucket}`)
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1593
|
+
if (t.size) {
|
|
1594
|
+
console.log()
|
|
1595
|
+
console.log('| origin | rounds | findings | unique | unique accepted | agents | verdict |')
|
|
1596
|
+
console.log('|---|---|---|---|---|---|---|')
|
|
1597
|
+
}
|
|
1363
1598
|
const sorted = [...t.entries()].sort((a, b) => b[1].accepted - a[1].accepted || b[1].findings - a[1].findings)
|
|
1364
1599
|
for (const [origin, c] of sorted) {
|
|
1365
1600
|
const n = c.rounds.size
|
|
@@ -1367,6 +1602,8 @@ function yieldOf(argv) {
|
|
|
1367
1602
|
: c.accepted === 0 ? `retire at ${bucket}` : 'keep'
|
|
1368
1603
|
console.log(`| ${origin} | ${n} | ${c.findings} | ${c.unique} | ${c.accepted} | ${c.agents ?? '—'} | ${verdict} |`)
|
|
1369
1604
|
}
|
|
1605
|
+
console.log()
|
|
1606
|
+
console.log(`escapes: ${esc.length}${esc.length ? ` (${[...new Set(esc)].sort().join(', ')})` : ''}`)
|
|
1370
1607
|
}
|
|
1371
1608
|
console.log()
|
|
1372
1609
|
console.log('"unique accepted" decides: a finding only this origin raised and that was acted on.')
|
|
@@ -1394,7 +1631,9 @@ function usage() {
|
|
|
1394
1631
|
npx flow-workflows tier [--base <ref>] [--rev <ref>] [--harness <name>]
|
|
1395
1632
|
npx flow-workflows review [--out <file>] [--record] [same options as bundle]
|
|
1396
1633
|
npx flow-workflows cost
|
|
1634
|
+
npx flow-workflows record-review --file <rows.json>
|
|
1397
1635
|
npx flow-workflows yield [<repo-path>…]
|
|
1636
|
+
npx flow-workflows escape <commit> [--file <path>]
|
|
1398
1637
|
|
|
1399
1638
|
Harnesses: ${Object.keys(HARNESSES).join(' · ')}
|
|
1400
1639
|
"project" installs into the current repo instead of your user folder.
|
|
@@ -1442,9 +1681,19 @@ Claude Code, Codex CLI and zcode have their own marketplaces:
|
|
|
1442
1681
|
as it always has.
|
|
1443
1682
|
|
|
1444
1683
|
"cost" prints what each phase of this branch's work actually reported spending, from
|
|
1445
|
-
what --record wrote into meta.json. A harness that reports no figure is recorded as
|
|
1684
|
+
what record-review (a review's Close) or review --record wrote into meta.json. A harness that reports no figure is recorded as
|
|
1446
1685
|
"not reported": a headcount of subagents is not a cost, and neither is a guess.
|
|
1447
1686
|
|
|
1687
|
+
"record-review" writes one review round into this branch's work: each finding once, with
|
|
1688
|
+
every origin that raised it and its outcome, and what the round launched. Origins,
|
|
1689
|
+
severities and outcomes come from closed lists; one value outside them and nothing is
|
|
1690
|
+
written, and the error names the values that are valid.
|
|
1691
|
+
|
|
1692
|
+
"escape" tells whether the commit a bug investigation blamed went through a flow review:
|
|
1693
|
+
it must sit inside exactly one work's reviewed range (merge history), or carry the number
|
|
1694
|
+
of exactly one reviewed MR/PR in its subject (squash). Then it is recorded in this branch's
|
|
1695
|
+
work and "yield" counts it; anything less is said and recorded nowhere.
|
|
1696
|
+
|
|
1448
1697
|
"yield" reads every work of the repos named (default: this one) — live and archived,
|
|
1449
1698
|
here and in the main checkout — and prints, per reviewer or pass and per size, the
|
|
1450
1699
|
rounds it ran, the findings it raised, how many only it raised, how many of those were
|
|
@@ -1462,6 +1711,8 @@ if (cmd === 'bundle') bundle(process.argv.slice(3))
|
|
|
1462
1711
|
else if (cmd === 'tier') tier(process.argv.slice(3))
|
|
1463
1712
|
else if (cmd === 'cost') cost(process.argv.slice(3))
|
|
1464
1713
|
else if (cmd === 'yield') yieldOf(process.argv.slice(3))
|
|
1714
|
+
else if (cmd === 'record-review') recordReview(process.argv.slice(3))
|
|
1715
|
+
else if (cmd === 'escape') escapeOf(process.argv.slice(3))
|
|
1465
1716
|
else if (cmd === 'review') review(process.argv.slice(3)).catch((e) => { console.error(`flow review: ${e.message}`); process.exit(1) })
|
|
1466
1717
|
else if (cmd === 'check') check()
|
|
1467
1718
|
else if (cmd === 'install' && tool === 'claude') claude()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flow-workflows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.110.0",
|
|
4
4
|
"description": "Guided feat/bug workflows (start→ship), post-deploy monitoring and multi-agent code review, stack-agnostic. Each repo uses a shared FLOW.md plus optional harness overlay.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "flow",
|
|
4
4
|
"displayName": "Flow — guided dev workflows",
|
|
5
5
|
"description": "Guided feat/bug workflows (start→ship), post-deploy monitoring and multi-agent code review, stack-agnostic. Each repo uses a shared FLOW.md plus optional harness overlay.",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.110.0",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Alberto Vioque",
|
|
9
9
|
"email": "mashware@gmail.com"
|