flow-workflows 0.107.0 → 0.109.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-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 +2 -2
- package/adapters/gemini/CORE.md +4 -3
- 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 +2 -2
- package/adapters/hermes/CORE.md +4 -3
- 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 +2 -2
- package/adapters/opencode/CORE.md +4 -3
- 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 +2 -2
- package/bin/cli.mjs +369 -85
- package/package.json +1 -1
- package/plugins/flow/.claude-plugin/plugin.json +1 -1
- package/plugins/flow/CHANGELOG.md +36 -0
|
@@ -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,7 @@ 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
165
|
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
166
|
- **`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
167
|
- **`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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
|
3
3
|
import { homedir } from 'node:os'
|
|
4
|
-
import { dirname, join } from 'node:path'
|
|
4
|
+
import { dirname, join, resolve } from 'node:path'
|
|
5
5
|
import { fileURLToPath } from 'node:url'
|
|
6
6
|
import { execFileSync, spawn } from 'node:child_process'
|
|
7
7
|
|
|
@@ -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,44 @@ 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
|
-
const outFile = argv.includes('--out') ? argv[argv.indexOf('--out') + 1] : null
|
|
1077
|
-
if (outFile) { writeFileSync(outFile, `${text}\n`); console.log(`wrote ${outFile}`) } else console.log(text)
|
|
1078
1095
|
}
|
|
1079
1096
|
|
|
1080
1097
|
// --- cost ------------------------------------------------------------------------------
|
|
@@ -1090,39 +1107,117 @@ async function review(argv) {
|
|
|
1090
1107
|
// Read-modify-write against meta.json, the flow's own state, so both writers go through a
|
|
1091
1108
|
// temporary file: a half-written meta.json loses the work, not just the figure.
|
|
1092
1109
|
function editMeta(work, fn) {
|
|
1093
|
-
if (!work) return
|
|
1110
|
+
if (!work) return false
|
|
1094
1111
|
const p = join(work, 'meta.json')
|
|
1095
|
-
if (!existsSync(p)) return
|
|
1112
|
+
if (!existsSync(p)) return false
|
|
1096
1113
|
let meta
|
|
1097
|
-
try { meta = JSON.parse(readFileSync(p, 'utf8')) } catch { return }
|
|
1114
|
+
try { meta = JSON.parse(readFileSync(p, 'utf8')) } catch { return false }
|
|
1098
1115
|
fn(meta)
|
|
1099
1116
|
const tmp = `${p}.tmp`
|
|
1100
1117
|
writeFileSync(tmp, `${JSON.stringify(meta, null, 2)}\n`)
|
|
1101
1118
|
renameSync(tmp, p)
|
|
1119
|
+
return true
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
// --- record-review -----------------------------------------------------------------------
|
|
1123
|
+
// The only writer of a review round's rows. The origins used to be written by hand from the
|
|
1124
|
+
// prose, and six weeks of that produced ~65 spellings for ~12 passes and outcomes written
|
|
1125
|
+
// into the severity field. So the lists are closed here, a value outside them is refused
|
|
1126
|
+
// with the ones that are valid, and nothing is written until every value is.
|
|
1127
|
+
|
|
1128
|
+
const ORIGIN_RE = /^(built-in|sweep|query-duel|yagni|contract|idiom|(panel|reinforcement):[a-z0-9][a-z0-9-]*)$/
|
|
1129
|
+
const SEVERITIES = ['blocker', 'major', 'minor', 'nit', 'unrated']
|
|
1130
|
+
const OUTCOMES = ['fixed', 'open', 'rejected', 'discarded', 'deferred']
|
|
1131
|
+
const TIERS = ['light', 'proportional', 'full']
|
|
1132
|
+
const SIZE_NAMES = SIZES.map(([n]) => n)
|
|
1133
|
+
const ORIGINS_HELP = 'built-in · sweep · query-duel · yagni · contract · idiom · panel:<role> · reinforcement:<area>'
|
|
1134
|
+
+ ' (<role>/<area>: lower-case letters, digits and -)'
|
|
1135
|
+
|
|
1136
|
+
function validateReview(doc) {
|
|
1137
|
+
const bad = []
|
|
1138
|
+
if (!doc || typeof doc !== 'object') return ['the file is not a JSON object']
|
|
1139
|
+
const round = doc.round
|
|
1140
|
+
if (!round || typeof round !== 'object' || Array.isArray(round)) return ['`round` is required: an object with at least `agents`']
|
|
1141
|
+
if (round.mr != null && !(Number.isInteger(round.mr) && round.mr > 0)) bad.push(`round.mr \`${round.mr}\`: a positive integer`)
|
|
1142
|
+
if (round.tier != null && !TIERS.includes(round.tier)) bad.push(`round.tier \`${round.tier}\`: one of ${TIERS.join(' · ')}`)
|
|
1143
|
+
if (round.effective_size != null && !SIZE_NAMES.includes(round.effective_size)) {
|
|
1144
|
+
bad.push(`round.effective_size \`${round.effective_size}\`: one of ${SIZE_NAMES.join(' · ')}`)
|
|
1145
|
+
}
|
|
1146
|
+
if (round.usd != null && typeof round.usd !== 'number') bad.push(`round.usd \`${round.usd}\`: a number, or leave it out`)
|
|
1147
|
+
const agents = round.agents
|
|
1148
|
+
if (!agents || typeof agents !== 'object' || Array.isArray(agents) || !Object.keys(agents).length) {
|
|
1149
|
+
bad.push('round.agents: every pass this round launched, as {origin: agents}, findings or not')
|
|
1150
|
+
}
|
|
1151
|
+
else {
|
|
1152
|
+
for (const [o, n] of Object.entries(agents)) {
|
|
1153
|
+
if (!ORIGIN_RE.test(o)) bad.push(`round.agents origin \`${o}\`: one of ${ORIGINS_HELP}`)
|
|
1154
|
+
if (!(Number.isInteger(n) && n > 0)) bad.push(`round.agents[${o}] \`${n}\`: a positive integer`)
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
if (!Array.isArray(doc.findings)) bad.push('`findings` must be an array (empty when the round found nothing)')
|
|
1158
|
+
else {
|
|
1159
|
+
doc.findings.forEach((f, i) => {
|
|
1160
|
+
const at = `findings[${i}]`
|
|
1161
|
+
if (!f || typeof f !== 'object') { bad.push(`${at}: not an object`); return }
|
|
1162
|
+
if (!Array.isArray(f.sources) || !f.sources.length) bad.push(`${at}.sources: a non-empty list of origins`)
|
|
1163
|
+
else f.sources.forEach((o) => {
|
|
1164
|
+
if (!ORIGIN_RE.test(o)) bad.push(`${at}.sources \`${o}\`: one of ${ORIGINS_HELP}`)
|
|
1165
|
+
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`)
|
|
1166
|
+
})
|
|
1167
|
+
if (!SEVERITIES.includes(f.severity)) bad.push(`${at}.severity \`${f.severity}\`: one of ${SEVERITIES.join(' · ')}`)
|
|
1168
|
+
if (!OUTCOMES.includes(f.outcome)) bad.push(`${at}.outcome \`${f.outcome}\`: one of ${OUTCOMES.join(' · ')}`)
|
|
1169
|
+
if (typeof f.file !== 'string' || !f.file) bad.push(`${at}.file: the path the finding is about`)
|
|
1170
|
+
})
|
|
1171
|
+
}
|
|
1172
|
+
return bad
|
|
1102
1173
|
}
|
|
1103
1174
|
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1175
|
+
// One round: its findings, each once with every source, and one `cost[]` review entry saying
|
|
1176
|
+
// what the round launched. The round number continues this work's own count, across both.
|
|
1177
|
+
function writeReview(work, doc) {
|
|
1178
|
+
return editMeta(work, (meta) => {
|
|
1179
|
+
const rows = Array.isArray(meta.review_findings) ? meta.review_findings : []
|
|
1180
|
+
const costs = Array.isArray(meta.cost) ? meta.cost : []
|
|
1181
|
+
const last = [...rows, ...costs.filter((e) => e?.phase === 'review')]
|
|
1182
|
+
.reduce((n, r) => Math.max(n, Number(r.round) || 0), 0)
|
|
1183
|
+
const r = doc.round ?? {}
|
|
1184
|
+
const round = last + 1
|
|
1185
|
+
const mr = r.mr != null ? { mr: r.mr } : {}
|
|
1186
|
+
meta.review_findings = [...rows, ...doc.findings.map((f) => ({
|
|
1187
|
+
round, ...mr, sources: f.sources, severity: f.severity, file: f.file, outcome: f.outcome,
|
|
1188
|
+
}))]
|
|
1189
|
+
const agents = r.agents ?? {}
|
|
1190
|
+
meta.cost = [...costs, {
|
|
1191
|
+
phase: 'review', at: new Date().toISOString(), round, ...mr,
|
|
1192
|
+
...(r.tier ? { tier: r.tier } : {}), ...(r.effective_size ? { effective_size: r.effective_size } : {}),
|
|
1193
|
+
agents, reviewers: Object.values(agents).reduce((a, b) => a + b, 0),
|
|
1194
|
+
usd: typeof r.usd === 'number' ? r.usd : null,
|
|
1195
|
+
source: typeof r.usd === 'number' ? 'harness' : 'not reported',
|
|
1196
|
+
}]
|
|
1112
1197
|
})
|
|
1113
1198
|
}
|
|
1114
1199
|
|
|
1115
|
-
function
|
|
1116
|
-
|
|
1117
|
-
const
|
|
1118
|
-
if (!
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1200
|
+
function recordReview(argv) {
|
|
1201
|
+
const at = argv.indexOf('--file')
|
|
1202
|
+
const file = at === -1 ? null : argv[at + 1]
|
|
1203
|
+
if (!file) { console.error('flow record-review: --file <rows.json> is required'); process.exit(1) }
|
|
1204
|
+
const repo = git(['rev-parse', '--show-toplevel']).trim()
|
|
1205
|
+
if (!repo) { console.error('flow record-review: not a git checkout'); process.exit(1) }
|
|
1206
|
+
const branch = git(['rev-parse', '--abbrev-ref', 'HEAD'], repo).trim()
|
|
1207
|
+
const work = workFolder(repo, branch)
|
|
1208
|
+
if (!work) { console.error(`flow record-review: no work on \`${branch}\` — nothing to record against`); process.exit(1) }
|
|
1209
|
+
let doc
|
|
1210
|
+
try { doc = JSON.parse(readFileSync(file, 'utf8')) } catch (e) {
|
|
1211
|
+
console.error(`flow record-review: \`${file}\` is not readable JSON (${e.message})`); process.exit(1)
|
|
1212
|
+
}
|
|
1213
|
+
const bad = validateReview(doc)
|
|
1214
|
+
if (bad.length) {
|
|
1215
|
+
console.error(`flow record-review: nothing recorded — ${bad.length} value(s) outside the lists:`)
|
|
1216
|
+
bad.forEach((b) => console.error(` - ${b}`))
|
|
1217
|
+
process.exit(1)
|
|
1218
|
+
}
|
|
1219
|
+
if (!writeReview(work, doc)) { console.error(`flow record-review: \`${join(work, 'meta.json')}\` is missing or not JSON — nothing recorded`); process.exit(1) }
|
|
1220
|
+
console.log(`recorded ${doc.findings.length} finding(s) and the round's agents in ${join(work, 'meta.json')}`)
|
|
1126
1221
|
}
|
|
1127
1222
|
|
|
1128
1223
|
function cost(argv) {
|
|
@@ -1142,7 +1237,7 @@ function cost(argv) {
|
|
|
1142
1237
|
console.log()
|
|
1143
1238
|
if (!entries.length) {
|
|
1144
1239
|
console.log('Nothing recorded yet. A phase records here when it can measure what it spent:')
|
|
1145
|
-
console.log('`flow review
|
|
1240
|
+
console.log('`flow record-review` writes what the harness reported for a review round, and a')
|
|
1146
1241
|
console.log('harness that reports no figure is recorded as "not reported" rather than guessed.')
|
|
1147
1242
|
return
|
|
1148
1243
|
}
|
|
@@ -1160,52 +1255,228 @@ function cost(argv) {
|
|
|
1160
1255
|
console.log()
|
|
1161
1256
|
console.log('These are the harness\'s own client-side estimates and can differ from a bill.')
|
|
1162
1257
|
console.log('Phases with no row did not measure anything — absence here is not zero.')
|
|
1258
|
+
console.log('Which reviewer found what, across every work: `flow yield`.')
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
// --- yield -----------------------------------------------------------------------------
|
|
1262
|
+
// Whether each review pass still earns what it costs, across every work a repo has kept —
|
|
1263
|
+
// live and archived, in this checkout and in the main one, over as many repos as are named.
|
|
1264
|
+
// `meta.json.review_findings[]` has carried an origin per source since the rows were added;
|
|
1265
|
+
// what it never had is a reader that counts across works, so the twenty-review rule had
|
|
1266
|
+
// nothing to count. The origins were written by hand and drifted (`builtin`, `code-review`,
|
|
1267
|
+
// `cli:tests`, `§5.5`…): they are mapped here, on read, and every spelling that was not
|
|
1268
|
+
// already canonical is printed with what it was read as, so a wrong mapping is visible.
|
|
1269
|
+
|
|
1270
|
+
const RETIRE_AFTER = 20
|
|
1271
|
+
const ACCEPTED = new Set(['fixed', 'open', 'deferred'])
|
|
1272
|
+
const SECTION_ORIGINS = {
|
|
1273
|
+
'§3.5': 'sweep', sweep: 'sweep',
|
|
1274
|
+
'§3.6': 'query-duel', 'query-duel': 'query-duel',
|
|
1275
|
+
'§4': 'yagni', yagni: 'yagni',
|
|
1276
|
+
'§5': 'contract', contract: 'contract', 'contract-verifier': 'contract',
|
|
1277
|
+
'§5.5': 'idiom', idiom: 'idiom', 'idiom-audit': 'idiom',
|
|
1278
|
+
}
|
|
1279
|
+
const BUILT_IN = new Set(['built-in', 'builtin', 'builtin-code-review', 'code-review'])
|
|
1280
|
+
const LEGACY_SEVERITY = {
|
|
1281
|
+
blocker: 'blocker', high: 'blocker',
|
|
1282
|
+
major: 'major', medium: 'major',
|
|
1283
|
+
minor: 'minor', low: 'minor', suggestion: 'minor',
|
|
1284
|
+
nit: 'nit',
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
// A panel role is whatever the repo named it; only the spelling noise is folded: a prefix
|
|
1288
|
+
// saying which path ran it, case and spaces, and the suffixes an agent's file name adds.
|
|
1289
|
+
function panelRole(raw) {
|
|
1290
|
+
let r = raw.toLowerCase().trim().replace(/\s+/g, '-')
|
|
1291
|
+
r = r.replace(/-(reviewer|hunter|verifier|audit)$/, '').replace(/-round\d+$/, '')
|
|
1292
|
+
if (r === 'testing') r = 'tests'
|
|
1293
|
+
if (r === 'redteam') r = 'red-team'
|
|
1294
|
+
if (/^silent(-failures?)?$/.test(r)) r = 'silent-failure'
|
|
1295
|
+
if (r === 'code-simplifier') r = 'simplify'
|
|
1296
|
+
return `panel:${r}`
|
|
1297
|
+
}
|
|
1163
1298
|
|
|
1164
|
-
|
|
1299
|
+
function canonicalOrigin(raw) {
|
|
1300
|
+
const o = String(raw ?? '').trim()
|
|
1301
|
+
if (!o) return 'unknown'
|
|
1302
|
+
if (o.startsWith('reinforcement:')) return o.toLowerCase()
|
|
1303
|
+
const bare = o.replace(/^(§panel:|cli-panel:|cli:|panel:)/, '')
|
|
1304
|
+
if (BUILT_IN.has(bare)) return 'built-in'
|
|
1305
|
+
if (SECTION_ORIGINS[bare]) return SECTION_ORIGINS[bare]
|
|
1306
|
+
return panelRole(bare)
|
|
1165
1307
|
}
|
|
1166
1308
|
|
|
1167
|
-
//
|
|
1168
|
-
//
|
|
1169
|
-
//
|
|
1170
|
-
//
|
|
1171
|
-
function
|
|
1172
|
-
const
|
|
1309
|
+
// Every work folder a repo holds: its `.claude/work` here and in the main checkout, live and
|
|
1310
|
+
// `_archive/`, each meta.json read once however many of those paths lead to it.
|
|
1311
|
+
// `seen` is shared across every repo of one call: a worktree and its main checkout, or the
|
|
1312
|
+
// same path named twice, lead to the same folders and must count them once.
|
|
1313
|
+
function worksOf(repo, seen) {
|
|
1314
|
+
const roots = new Set([join(repo, '.claude', 'work'), join(mainCheckout(repo), '.claude', 'work')])
|
|
1315
|
+
const works = []
|
|
1316
|
+
for (const root of roots) {
|
|
1317
|
+
for (const dir of [root, join(root, '_archive')]) {
|
|
1318
|
+
let entries = []
|
|
1319
|
+
try { entries = readdirSync(dir, { withFileTypes: true }) } catch { continue }
|
|
1320
|
+
for (const e of entries) {
|
|
1321
|
+
if (!e.isDirectory() || (dir === root && e.name === '_archive')) continue
|
|
1322
|
+
const p = join(dir, e.name, 'meta.json')
|
|
1323
|
+
let real
|
|
1324
|
+
try { real = realpathSync(p) } catch { continue }
|
|
1325
|
+
if (seen.has(real)) continue
|
|
1326
|
+
seen.add(real)
|
|
1327
|
+
try { works.push({ path: join(dir, e.name), meta: JSON.parse(readFileSync(p, 'utf8')) }) } catch {}
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
return works
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
// The rule is judged per size because the review itself is: the panel rarely runs below M,
|
|
1335
|
+
// so XS and S are pooled or neither would ever reach twenty rounds.
|
|
1336
|
+
function sizeBucket(size) {
|
|
1337
|
+
const s = String(size ?? '').toUpperCase()
|
|
1338
|
+
return s === 'XS' || s === 'S' ? 'XS+S' : s === 'M' || s === 'L' ? s : 'unknown size'
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
function yieldOf(argv) {
|
|
1342
|
+
const repos = (argv.length ? argv : ['.']).map((a) => {
|
|
1343
|
+
const top = git(['rev-parse', '--show-toplevel'], resolve(a)).trim()
|
|
1344
|
+
if (!top) { console.error(`flow yield: \`${a}\` is not a git checkout`); process.exit(1) }
|
|
1345
|
+
return top
|
|
1346
|
+
})
|
|
1347
|
+
|
|
1348
|
+
// bucket → origin → counters; rounds are (work, round) keys so a round counts once.
|
|
1349
|
+
const table = new Map()
|
|
1350
|
+
const spellings = new Map()
|
|
1351
|
+
let rounds = 0, rows = 0, works = 0
|
|
1352
|
+
const seen = new Set()
|
|
1353
|
+
const cell = (bucket, origin) => {
|
|
1354
|
+
if (!table.has(bucket)) table.set(bucket, new Map())
|
|
1355
|
+
const t = table.get(bucket)
|
|
1356
|
+
if (!t.has(origin)) t.set(origin, { rounds: new Set(), findings: 0, unique: 0, accepted: 0, agents: null })
|
|
1357
|
+
return t.get(origin)
|
|
1358
|
+
}
|
|
1359
|
+
const read = (raw) => {
|
|
1360
|
+
const c = canonicalOrigin(raw)
|
|
1361
|
+
if (raw !== c) {
|
|
1362
|
+
if (!spellings.has(c)) spellings.set(c, new Set())
|
|
1363
|
+
spellings.get(c).add(String(raw))
|
|
1364
|
+
}
|
|
1365
|
+
return c
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
for (const repo of repos) {
|
|
1369
|
+
for (const { path, meta } of worksOf(repo, seen)) {
|
|
1370
|
+
const found = Array.isArray(meta.review_findings) ? meta.review_findings : []
|
|
1371
|
+
const costs = (Array.isArray(meta.cost) ? meta.cost : []).filter((e) => e?.phase === 'review' && e.round != null)
|
|
1372
|
+
if (!found.length && !costs.length) continue
|
|
1373
|
+
works += 1
|
|
1374
|
+
const sizeFor = (mr, round) => {
|
|
1375
|
+
const entry = costs.find((e) => e.round === round && e.effective_size && (e.mr ?? null) === (mr ?? null))
|
|
1376
|
+
if (entry) return entry.effective_size
|
|
1377
|
+
const part = Array.isArray(meta.mrs) && mr != null ? meta.mrs.find((m) => m?.n === mr) : null
|
|
1378
|
+
return part?.size ?? meta.size
|
|
1379
|
+
}
|
|
1380
|
+
const roundsHere = new Set()
|
|
1381
|
+
|
|
1382
|
+
// A round that recorded what it launched says which passes ran, findings or not.
|
|
1383
|
+
for (const e of costs) {
|
|
1384
|
+
roundsHere.add(e.round)
|
|
1385
|
+
for (const [raw, n] of Object.entries(e.agents ?? {})) {
|
|
1386
|
+
if (!(Number(n) > 0)) continue
|
|
1387
|
+
const c = cell(sizeBucket(e.effective_size ?? sizeFor(e.mr, e.round)), read(raw))
|
|
1388
|
+
c.rounds.add(`${path}#${e.round}`)
|
|
1389
|
+
c.agents = (c.agents ?? 0) + Number(n)
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
// Legacy rows are one per source; the same finding is the same (round, severity, file).
|
|
1394
|
+
const legacy = found.filter((r) => !Array.isArray(r.sources))
|
|
1395
|
+
const keyOf = (r) => `${r.round}::${LEGACY_SEVERITY[r.severity] ?? 'unrated'}::${r.file ?? ''}`
|
|
1396
|
+
const sourcesOf = new Map()
|
|
1397
|
+
for (const r of legacy) {
|
|
1398
|
+
if (r.count != null) continue
|
|
1399
|
+
const k = keyOf(r)
|
|
1400
|
+
if (!sourcesOf.has(k)) sourcesOf.set(k, new Set())
|
|
1401
|
+
String(r.origin ?? '').split('+').forEach((o) => sourcesOf.get(k).add(canonicalOrigin(o)))
|
|
1402
|
+
}
|
|
1403
|
+
for (const r of legacy) {
|
|
1404
|
+
rows += 1
|
|
1405
|
+
roundsHere.add(r.round)
|
|
1406
|
+
const bucket = sizeBucket(sizeFor(r.mr, r.round))
|
|
1407
|
+
const accepted = !r.discarded_by_skeptic && !['declined', 'discarded'].includes(r.severity)
|
|
1408
|
+
for (const origin of new Set(String(r.origin ?? '').split('+').map(read))) {
|
|
1409
|
+
const c = cell(bucket, origin)
|
|
1410
|
+
// A row that only carries a count says how many, never which: they are findings,
|
|
1411
|
+
// and nothing can say whether another source had them too — so the round they sit in
|
|
1412
|
+
// is not one this origin can be judged on either.
|
|
1413
|
+
if (r.count != null) { c.findings += Number(r.count) || 0; continue }
|
|
1414
|
+
c.rounds.add(`${path}#${r.round}`)
|
|
1415
|
+
c.findings += 1
|
|
1416
|
+
if (sourcesOf.get(keyOf(r)).size === 1) {
|
|
1417
|
+
c.unique += 1
|
|
1418
|
+
if (accepted) c.accepted += 1
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
for (const r of found.filter((x) => Array.isArray(x.sources))) {
|
|
1424
|
+
rows += 1
|
|
1425
|
+
roundsHere.add(r.round)
|
|
1426
|
+
const bucket = sizeBucket(sizeFor(r.mr, r.round))
|
|
1427
|
+
const sources = new Set(r.sources.map(read))
|
|
1428
|
+
for (const o of sources) {
|
|
1429
|
+
const c = cell(bucket, o)
|
|
1430
|
+
c.rounds.add(`${path}#${r.round}`)
|
|
1431
|
+
c.findings += 1
|
|
1432
|
+
if (sources.size === 1) {
|
|
1433
|
+
c.unique += 1
|
|
1434
|
+
if (ACCEPTED.has(r.outcome)) c.accepted += 1
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
rounds += roundsHere.size
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
console.log(`# Review yield — ${repos.join(' · ')}`)
|
|
1173
1443
|
console.log()
|
|
1174
|
-
if (!
|
|
1175
|
-
console.log('No
|
|
1176
|
-
console.log(
|
|
1444
|
+
if (!table.size) {
|
|
1445
|
+
console.log('No review rounds recorded in the works these checkouts hold')
|
|
1446
|
+
console.log(`(${repos.map((r) => join(r, '.claude', 'work')).join(', ')}, archive included).`)
|
|
1177
1447
|
return
|
|
1178
1448
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
const
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1449
|
+
console.log(`${works} work(s), ${rounds} review round(s), ${rows} finding row(s).`)
|
|
1450
|
+
for (const bucket of ['XS+S', 'M', 'L', 'unknown size']) {
|
|
1451
|
+
const t = table.get(bucket)
|
|
1452
|
+
if (!t) continue
|
|
1453
|
+
console.log()
|
|
1454
|
+
console.log(`## ${bucket}`)
|
|
1455
|
+
console.log()
|
|
1456
|
+
console.log('| origin | rounds | findings | unique | unique accepted | agents | verdict |')
|
|
1457
|
+
console.log('|---|---|---|---|---|---|---|')
|
|
1458
|
+
const sorted = [...t.entries()].sort((a, b) => b[1].accepted - a[1].accepted || b[1].findings - a[1].findings)
|
|
1459
|
+
for (const [origin, c] of sorted) {
|
|
1460
|
+
const n = c.rounds.size
|
|
1461
|
+
const verdict = n < RETIRE_AFTER ? `too few rounds (${n}/${RETIRE_AFTER})`
|
|
1462
|
+
: c.accepted === 0 ? `retire at ${bucket}` : 'keep'
|
|
1463
|
+
console.log(`| ${origin} | ${n} | ${c.findings} | ${c.unique} | ${c.accepted} | ${c.agents ?? '—'} | ${verdict} |`)
|
|
1194
1464
|
}
|
|
1195
|
-
per.set(r.origin, e)
|
|
1196
1465
|
}
|
|
1197
|
-
console.log(`## Findings by origin — ${rows.length} row(s) over ${rounds} round(s)`)
|
|
1198
1466
|
console.log()
|
|
1199
|
-
console.log('
|
|
1200
|
-
console.log(
|
|
1201
|
-
|
|
1202
|
-
|
|
1467
|
+
console.log('"unique accepted" decides: a finding only this origin raised and that was acted on.')
|
|
1468
|
+
console.log(`An origin that ran ${RETIRE_AFTER}+ rounds at a size with none is retired at that size.`)
|
|
1469
|
+
console.log('Re-run it when the model changes — a pass that stopped paying may pay again, and back.')
|
|
1470
|
+
console.log('Rows written before findings carried an outcome count "accepted" as "not refuted by a')
|
|
1471
|
+
console.log('skeptic", and a round they record counts only for the origins with a row in it, so')
|
|
1472
|
+
console.log('"rounds" is a lower bound there and "agents" is unknown (—). Those rows carry no MR/PR')
|
|
1473
|
+
console.log('number either, so a split work\'s legacy rows count at the size of the whole work.')
|
|
1474
|
+
if (spellings.size) {
|
|
1475
|
+
console.log()
|
|
1476
|
+
console.log('## Spellings read as')
|
|
1477
|
+
console.log()
|
|
1478
|
+
for (const [c, raws] of [...spellings.entries()].sort()) console.log(`- ${c} ← ${[...raws].sort().join(', ')}`)
|
|
1203
1479
|
}
|
|
1204
|
-
console.log()
|
|
1205
|
-
console.log('"only this one" is the column that decides anything: a finding three sources')
|
|
1206
|
-
console.log('raised says nothing about any of them. A pass contributing no exclusive surviving')
|
|
1207
|
-
console.log('finding across twenty reviews is removed from the command — the rule is written')
|
|
1208
|
-
console.log('down before the data arrives so it cannot be argued backwards later.')
|
|
1209
1480
|
}
|
|
1210
1481
|
|
|
1211
1482
|
function usage() {
|
|
@@ -1218,6 +1489,8 @@ function usage() {
|
|
|
1218
1489
|
npx flow-workflows tier [--base <ref>] [--rev <ref>] [--harness <name>]
|
|
1219
1490
|
npx flow-workflows review [--out <file>] [--record] [same options as bundle]
|
|
1220
1491
|
npx flow-workflows cost
|
|
1492
|
+
npx flow-workflows record-review --file <rows.json>
|
|
1493
|
+
npx flow-workflows yield [<repo-path>…]
|
|
1221
1494
|
|
|
1222
1495
|
Harnesses: ${Object.keys(HARNESSES).join(' · ')}
|
|
1223
1496
|
"project" installs into the current repo instead of your user folder.
|
|
@@ -1265,11 +1538,20 @@ Claude Code, Codex CLI and zcode have their own marketplaces:
|
|
|
1265
1538
|
as it always has.
|
|
1266
1539
|
|
|
1267
1540
|
"cost" prints what each phase of this branch's work actually reported spending, from
|
|
1268
|
-
what --record wrote into meta.json. A harness that reports no figure is recorded as
|
|
1541
|
+
what record-review (a review's Close) or review --record wrote into meta.json. A harness that reports no figure is recorded as
|
|
1269
1542
|
"not reported": a headcount of subagents is not a cost, and neither is a guess.
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1543
|
+
|
|
1544
|
+
"record-review" writes one review round into this branch's work: each finding once, with
|
|
1545
|
+
every origin that raised it and its outcome, and what the round launched. Origins,
|
|
1546
|
+
severities and outcomes come from closed lists; one value outside them and nothing is
|
|
1547
|
+
written, and the error names the values that are valid.
|
|
1548
|
+
|
|
1549
|
+
"yield" reads every work of the repos named (default: this one) — live and archived,
|
|
1550
|
+
here and in the main checkout — and prints, per reviewer or pass and per size, the
|
|
1551
|
+
rounds it ran, the findings it raised, how many only it raised, how many of those were
|
|
1552
|
+
acted on, and the agents it took. One that ran 20+ rounds at a size with no unique
|
|
1553
|
+
accepted finding is marked "retire" there; XS and S are pooled, since the panel rarely
|
|
1554
|
+
runs below M. Old spellings of an origin are mapped and listed with what they became.
|
|
1273
1555
|
|
|
1274
1556
|
Updating: re-run the install command — it sweeps the previous version first.
|
|
1275
1557
|
Docs: https://github.com/mashware/flow-workflows`)
|
|
@@ -1280,6 +1562,8 @@ const [cmd, tool, scope] = process.argv.slice(2)
|
|
|
1280
1562
|
if (cmd === 'bundle') bundle(process.argv.slice(3))
|
|
1281
1563
|
else if (cmd === 'tier') tier(process.argv.slice(3))
|
|
1282
1564
|
else if (cmd === 'cost') cost(process.argv.slice(3))
|
|
1565
|
+
else if (cmd === 'yield') yieldOf(process.argv.slice(3))
|
|
1566
|
+
else if (cmd === 'record-review') recordReview(process.argv.slice(3))
|
|
1283
1567
|
else if (cmd === 'review') review(process.argv.slice(3)).catch((e) => { console.error(`flow review: ${e.message}`); process.exit(1) })
|
|
1284
1568
|
else if (cmd === 'check') check()
|
|
1285
1569
|
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.109.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.109.0",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Alberto Vioque",
|
|
9
9
|
"email": "mashware@gmail.com"
|
|
@@ -5,6 +5,42 @@ plugin and is what `/flow:news` reads to show you what changed since your previo
|
|
|
5
5
|
|
|
6
6
|
The canonical, richest notes live in the [GitHub Releases](https://github.com/mashware/flow-workflows/releases).
|
|
7
7
|
|
|
8
|
+
## v0.109.0 — A review round records each finding once, and refuses names it does not know · 2026-11-04
|
|
9
|
+
|
|
10
|
+
**In short**
|
|
11
|
+
- **One row per finding, with every pass that raised it and what happened to it.** The outcomes are `fixed`, `open`,
|
|
12
|
+
`rejected`, `discarded` and `deferred`. "Only this pass saw it" is now read straight off the row, and "acted on"
|
|
13
|
+
means an outcome, not "no skeptic refuted it".
|
|
14
|
+
- **Each round records the passes it launched and how many agents each took, findings or not**, together with its
|
|
15
|
+
tier and effective size. `flow yield` fills its agents column and counts the rounds a pass ran and found nothing.
|
|
16
|
+
- **`npx flow-workflows record-review --file <round.json>` is the only writer.** A pass name, severity or outcome
|
|
17
|
+
outside its list is refused. The error names every bad value with the valid ones, and nothing is written. The
|
|
18
|
+
review's Close calls it instead of editing `meta.json`, and `flow review --record` goes through the same check.
|
|
19
|
+
- **Rows recorded before this stay as they are.** `yield` reads both kinds.
|
|
20
|
+
|
|
21
|
+
Hand-written origins had drifted into about 65 spellings for 12 passes in six weeks, even though the review already
|
|
22
|
+
listed them, and some outcomes ended up in the severity field (#234).
|
|
23
|
+
|
|
24
|
+
## v0.108.0 — You can see which review passes still find what nothing else finds · 2026-11-04
|
|
25
|
+
|
|
26
|
+
**In short**
|
|
27
|
+
- **`npx flow-workflows yield [<repo>…]` counts every review your repos kept.** It reads live and archived works,
|
|
28
|
+
in the checkout you run it from and in the main one, across as many repos as you name.
|
|
29
|
+
- **Per reviewer or pass, and per change size**, it shows the rounds it ran, the findings it raised, how many only
|
|
30
|
+
it raised, how many of those were acted on, and the agents it took.
|
|
31
|
+
Rows recorded so far carry no outcome and no agent count: for them "acted on" means "not refuted by a skeptic",
|
|
32
|
+
the agents column shows `—`, and `yield` says so under its tables.
|
|
33
|
+
- **A verdict per row.** A pass that ran 20 rounds at a size without one finding of its own that was acted on is
|
|
34
|
+
marked `retire at <size>`. Under 20 rounds, it says how many it has. XS and S count together, because the panel
|
|
35
|
+
rarely runs below M.
|
|
36
|
+
- **Old spellings count as the pass they are.** `builtin`, `code-review`, `cli:tests` and `§5.5` were all written by
|
|
37
|
+
hand. They are folded on read, and the output lists each spelling with what it was read as.
|
|
38
|
+
- **`flow cost` is back to spend only.** Its per-origin table moved to `yield`, where it spans works.
|
|
39
|
+
|
|
40
|
+
Every review has recorded which pass raised each finding since v0.66.0, but only one work at a time could be read.
|
|
41
|
+
So the rule "no finding of its own across twenty reviews, and the pass comes out" had nothing to count. On the
|
|
42
|
+
three repos using flow today that is 131 rounds and about 1 100 rows (#234).
|
|
43
|
+
|
|
8
44
|
## v0.107.0 — A red test outside the change gets fixed when flow can see why · 2026-11-03
|
|
9
45
|
|
|
10
46
|
**In short**
|