@webpieces/rules-config 0.4.564 → 0.4.565

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.
@@ -1 +1 @@
1
- {"version":3,"file":"reviewer-instructions.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/reviewer-instructions.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAC7B,yCAA2D;AAC3D,+CAAkD;AAElD,2GAA2G;AAC3G,MAAa,YAAY;IACrB,KAAK,CAAS;IACd,IAAI,CAAS,CAAK,gDAAgD;IAClE,IAAI,CAAS,CAAK,0EAA0E;IAE5F,YAAY,KAAa,EAAE,SAAiB,EAAE,IAAI,GAAG,EAAE;QACnD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ;AAVD,oCAUC;AAED;;;;;;;GAOG;AACH,MAAa,WAAW;IACpB,IAAI,CAAS,CAAQ,4BAA4B;IACjD,QAAQ,CAAS,CAAI,uCAAuC;IAC5D,UAAU,CAAS,CAAE,oFAAoF;IACzG,MAAM,CAAS,CAAM,+DAA+D;IACpF,SAAS,CAAS;IAClB,SAAS,CAAU;IAEnB,yDAAyD;IACzD,YAAY,IAAY,EAAE,QAAgB,EAAE,UAAU,GAAG,EAAE,EAAE,MAAM,GAAG,GAAG,EAAE,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,KAAK;QACvG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;CACJ;AAjB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YACX,EAAE;YACF,mGAAmG;YACnG,iGAAiG;YACjG,4CAA4C;YAC5C,EAAE;YACF,qGAAqG;YACrG,8FAA8F;YAC9F,EAAE;YACF,mGAAmG;YACnG,qBAAqB;YACrB,EAAE;YACF,oGAAoG;YACpG,kGAAkG;YAClG,kGAAkG;YAClG,0FAA0F;SAC7F,CAAC;IACN,CAAC;CACJ,CAAA;AAvRY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEW,+BAAiB;GADxD,2BAA2B,CAuRvC","sourcesContent":["import * as path from 'path';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ReviewJsonService } from './review-json';\n\n/** One pre-resolved place a reviewer would otherwise have to go hunting for. Data-only (per CLAUDE.md). */\nexport class ContextEntry {\n label: string;\n path: string; // ABSOLUTE, or '' when it could not be resolved\n note: string; // '(not installed)' / '(configured but missing)' — never silently dropped\n\n constructor(label: string, entryPath: string, note = '') {\n this.label = label;\n this.path = entryPath;\n this.note = note;\n }\n}\n\n/**\n * One reviewer's matched file, the extracted diff for it, AND the absolute path of the file itself.\n *\n * `sourcePath` exists because of a measured 0/4: four reviewers on one PR read the diff and not one opened a\n * single full source file. The instructions handed them an absolute path per diff and only a parent DIRECTORY\n * per source, so reading the diff was a paste and reading the source was \"join this dir to that filename\n * yourself\". Identical affordance, or the cheaper one wins every time. Data-only.\n */\nexport class BriefedFile {\n file: string; // repo-relative source path\n diffPath: string; // ABSOLUTE path of the extracted .diff\n sourcePath: string; // ABSOLUTE path of the file itself; '' for a deleted file, which has no after-state\n status: string; // 'M' | 'A' | 'D' | 'U' (untracked) | 'X' (excluded by config)\n diffBytes: number;\n truncated: boolean;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(file: string, diffPath: string, sourcePath = '', status = 'M', diffBytes = 0, truncated = false) {\n this.file = file;\n this.diffPath = diffPath;\n this.sourcePath = sourcePath;\n this.status = status;\n this.diffBytes = diffBytes;\n this.truncated = truncated;\n }\n}\n\n/**\n * Everything ONE reviewer needs, with every path already resolved to an ABSOLUTE one.\n *\n * Absolute is not fussiness: a subagent's working directory is not guaranteed to be the repo root, and a\n * relative path that fails to resolve turns into a search, which is the cost this whole class exists to\n * remove. Data-only.\n */\nexport class ReviewerBriefing {\n subagent: string;\n docPath: string; // the checklist's guidance doc ('' when the checklist has none)\n repoRoot: string;\n diffDir: string; // '' when nothing was materialized\n allDiffPath: string;\n manifestPath: string;\n myFiles: BriefedFile[]; // ONLY this reviewer's matched files\n matchedPatterns: string[]; // [] ⇒ patternless: the whole diff is in scope\n sourceDirs: string[]; // deduped ABSOLUTE parent dirs of myFiles\n contextEntries: ContextEntry[];\n verdictPath: string; // ABSOLUTE review-<id>.json\n checklistId: string;\n fileDiffCommand: string;\n dirty: boolean;\n // Facts ABOUT the manifest, surfaced inline so a reviewer learns the diff is complete without opening it.\n changedFileCount: number;\n truncatedCount: number;\n excludedCount: number;\n allDiffLines: number;\n allDiffBytes: number;\n // The three shas, by the names DiffManifest already uses. Printing two bare shas told a reviewer nothing\n // about WHAT the diff is taken against; C beside A makes \"main has moved since the fork\" self-evident.\n hashForkPoint: string;\n hashFeatureHead: string;\n hashMainHead: string;\n ownAgentFileInDiff: string; // ABSOLUTE path when this diff edits THIS reviewer's own agent file; '' otherwise\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(subagent: string, checklistId: string, repoRoot: string) {\n this.subagent = subagent;\n this.checklistId = checklistId;\n this.repoRoot = repoRoot;\n this.docPath = '';\n this.diffDir = '';\n this.allDiffPath = '';\n this.manifestPath = '';\n this.myFiles = [];\n this.matchedPatterns = [];\n this.sourceDirs = [];\n this.contextEntries = [];\n this.verdictPath = '';\n this.fileDiffCommand = '';\n this.dirty = false;\n this.changedFileCount = 0;\n this.truncatedCount = 0;\n this.excludedCount = 0;\n this.allDiffLines = 0;\n this.allDiffBytes = 0;\n this.hashForkPoint = '';\n this.hashFeatureHead = '';\n this.hashMainHead = '';\n this.ownAgentFileInDiff = '';\n }\n}\n\n/**\n * The Read tool truncates at roughly this many lines, silently. Any path this file prints alongside a bigger\n * line count has to say so, or a reviewer reviews a fraction of a change and reports on all of it.\n */\nexport const READ_TRUNCATION_LINES = 2000;\n\n/** Comfortably under {@link READ_TRUNCATION_LINES} — the size at which ALL.diff really is one clean Read. */\nexport const ALL_DIFF_ONE_READ_LINES = 1500;\n\n/**\n * Renders the per-reviewer instructions file that `wp-review-upsert-pr` writes to\n * `.webpieces/pr-review/<feature>/instructions/<subagent>.instructions.md`.\n *\n * WHY this file exists, measured rather than assumed: a reviewer subagent on monorepo-nx2 spent **14 of its\n * 26 tool calls** rediscovering context the tooling already had — three separate greps into\n * `node_modules/@webpieces` to locate a scanner, a hunt through terraform for queue names, and a\n * re-derivation of the dependency graph. It did not over-review; it was under-supplied. Everything below is\n * chosen to delete a specific one of those calls.\n *\n * It is GENERATED per run, and the registered `.claude/agents/<subagent>.md` is a thin stub that points\n * here, because content a human maintains goes stale and a reviewer follows the stale copy. The verdict\n * schema in particular comes from {@link ReviewJsonService.verdictSchemaFor}.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ReviewerInstructionsService {\n constructor(private readonly reviewJsonService: ReviewJsonService) {}\n\n /** The dir holding this branch's generated instructions, beside its review.json. */\n instructionsDirFor(repoRoot: string, featureName: string): string {\n return path.join(this.reviewJsonService.prDirFor(repoRoot, featureName), 'instructions');\n }\n\n /** The file name for a reviewer's generated instructions. */\n fileNameFor(subagent: string): string {\n return `${subagent}.instructions.md`;\n }\n\n /** Absolute path of one reviewer's generated instructions file. */\n pathFor(repoRoot: string, featureName: string, subagent: string): string {\n return path.join(this.instructionsDirFor(repoRoot, featureName), this.fileNameFor(subagent));\n }\n\n render(briefing: ReviewerBriefing): string {\n return [\n ...this.identity(briefing),\n ...this.checklistSection(briefing),\n ...this.diffSection(briefing),\n ...this.sourceSection(briefing),\n ...this.contextSection(briefing),\n ...this.verdictSection(briefing),\n ...this.budgetSection(),\n ].join('\\n') + '\\n';\n }\n\n private identity(b: ReviewerBriefing): string[] {\n return [\n `# You are \\`${b.subagent}\\``,\n '',\n 'Review as YOURSELF, against your own checklist — not as a general code reviewer.',\n 'You may not write another reviewer\\'s verdict file.',\n '',\n '\"You may not review your own authorship\" means: you did not write this diff, so review it — but if',\n 'the diff CHANGES YOU, say so in `output` rather than pretending the conflict is not there.',\n ...this.selfEditWarning(b),\n '',\n '_Generated per run by `wp-review-upsert-pr`. Everything below is already resolved for you; the',\n 'paths are absolute because your working directory is not guaranteed to be the repo root._',\n '',\n ];\n }\n\n /**\n * Every PR that edits the review gate hits this: on the measured run, 5 of 8 changed files were the\n * reviewer agent files themselves, two reviewers reviewed their OWN definition, and neither flagged it —\n * neither had any guidance to. Detected by the tooling rather than left to the reviewer to notice.\n */\n private selfEditWarning(b: ReviewerBriefing): string[] {\n if (b.ownAgentFileInDiff === '') return [];\n return [\n '',\n `⚠️ THIS DIFF MODIFIES YOUR OWN AGENT FILE: \\`${b.ownAgentFileInDiff}\\``,\n 'You are reviewing a change to your own definition. Review it anyway — and state that fact in',\n '`output`, so a human reading your verdict knows the reviewer and the reviewed were the same thing.',\n ];\n }\n\n private checklistSection(b: ReviewerBriefing): string[] {\n if (b.docPath === '') {\n return ['## Your checklist', '', 'This checklist has no guidance doc — judge the diff on your own standards.', ''];\n }\n return ['## Your checklist', '', `Read this FIRST: \\`${b.docPath}\\``, ''];\n }\n\n /**\n * The change itself. The MANIFEST leads, and the per-file table with it; `ALL.diff` is demoted to one\n * option among several, recommended only where it is actually the right read.\n *\n * That ordering is the fix for a measured 4/4 failure. `ALL.diff` used to be bolded, first, and framed as\n * \"everything\", with the manifest one unbolded line below it called a \"path map\" — which reads like a\n * lookup aid, not something to open. All four reviewers on that PR read `ALL.diff`, none opened the\n * manifest, and none could therefore have established that the combined view was complete. Reviewers did\n * exactly what the emphasis told them to; so the emphasis moved.\n */\n private diffSection(b: ReviewerBriefing): string[] {\n const lines = ['## The change you are reviewing', ''];\n if (b.dirty) {\n lines.push('> ⚠️ This diff INCLUDES uncommitted and untracked work, so it is not what a');\n lines.push('> commit-to-commit range would show. Judge it anyway — it is what your checklist matched.');\n lines.push('');\n }\n lines.push(...this.manifestLines(b), ...this.basisLines(b), ...this.myFilesTable(b), ...this.allDiffLines(b));\n if (b.fileDiffCommand !== '') {\n lines.push(`Reproduce any single file: \\`${b.fileDiffCommand}\\``);\n lines.push('');\n }\n lines.push('Path matching is COARSE. Judge the change, not the path — if a matched file turns out to be');\n lines.push('irrelevant to your checklist, say so in one sentence and move on.');\n lines.push('');\n return lines;\n }\n\n /**\n * The manifest, named as the authority AND with its own headline facts inlined. Inlining them is the\n * point: a reviewer that never opens the manifest still learns whether anything was truncated or\n * excluded, which is the one thing it could not otherwise have known it was missing.\n */\n private manifestLines(b: ReviewerBriefing): string[] {\n if (b.manifestPath === '') return [];\n const warn = b.truncatedCount + b.excludedCount > 0 ? ' ⚠️ NOT everything is materialized — see the table.' : '';\n return [\n `**Path map — AUTHORITATIVE. Read this first:** \\`${b.manifestPath}\\``,\n ` ${b.changedFileCount} file(s) · ${b.truncatedCount} truncated · ${b.excludedCount} excluded${warn}`,\n ' Per file it carries: `status` (M/A/D/U/X), `bytes`, `file`/`fileAbs`, `diffFile`/`diffAbs`, and the',\n ' three shas below. It is the only place that records what was truncated or left out.',\n '',\n ];\n }\n\n /**\n * What the diff is taken AGAINST. Two bare shas in a `git diff` command said nothing about this, so a\n * reviewer could not tell a fork-point diff from a diff against main's current tip — and therefore could\n * not tell that anything merged to main since the fork is simply absent from what it is judging.\n * Rendering C beside A makes \"main has moved\" self-evident exactly when it has.\n */\n private basisLines(b: ReviewerBriefing): string[] {\n if (b.hashForkPoint === '') return [];\n const sameAsFork = b.hashMainHead === b.hashForkPoint;\n const cNote = b.hashMainHead === '' ? '(unresolved)'\n : sameAsFork ? `${b.hashMainHead} ← same as A, so main has not moved since the fork`\n : `${b.hashMainHead} ← main HAS MOVED since the fork`;\n return [\n 'This diff is **fork-point → feature-head**, NOT a diff against main\\'s current tip:',\n '```',\n `fork point (A) ${b.hashForkPoint}`,\n `feature head (B) ${b.hashFeatureHead}`,\n `main head (C) ${cNote}`,\n '```',\n 'Anything merged to main after A is NOT in this diff.',\n '',\n ];\n }\n\n /**\n * Source and diff get IDENTICAL affordance — an absolute path each, in adjacent columns. The previous\n * table gave an absolute path for the diff and nothing for the source, and the source went unread 4/4.\n */\n private myFilesTable(b: ReviewerBriefing): string[] {\n if (b.myFiles.length === 0) return ['_No files matched your patterns._', ''];\n const why = b.matchedPatterns.length === 0\n ? `**In scope: ALL ${b.myFiles.length} changed file(s)** — your checklist has no \\`patterns\\`, so the whole diff is yours.`\n : `**In scope: ${b.myFiles.length} file(s)** matching ${b.matchedPatterns.map((p: string): string => `\\`${p}\\``).join(', ')}:`;\n const rows = b.myFiles.map((f: BriefedFile): string => this.fileRow(f));\n return [why, '', '| file | status | its diff | full source |', '|---|---|---|---|', ...rows, ''];\n }\n\n /**\n * One row. A truncated or excluded diff is flagged HERE, in the row, not left as a field inside a file the\n * reviewer has to think to open — and an oversized diff states the line count that makes a single Read\n * come back silently incomplete.\n */\n private fileRow(f: BriefedFile): string {\n const flags: string[] = [];\n if (f.truncated) flags.push('⚠️ diff TRUNCATED — read the source');\n if (f.status === 'X') flags.push('⚠️ EXCLUDED, not materialized — read the source');\n const status = [`\\`${f.status}\\``, ...flags].join(' ');\n const source = f.sourcePath === '' ? '_deleted — no file on disk_' : `\\`${f.sourcePath}\\``;\n return `| \\`${f.file}\\` | ${status} | \\`${f.diffPath}\\` (${f.diffBytes} bytes) | ${source} |`;\n }\n\n /**\n * `ALL.diff`, recommended ONLY where it is the right read. It is kept — for a patternless reviewer on a\n * small diff it is genuinely one Read instead of N, which is why all four used it — but the blanket\n * \"everything on this branch\" line was wrong in two different ways at once: it invited a pattern-scoped\n * reviewer to spend its budget on files it was explicitly not asked about, and it pointed a reviewer on a\n * large PR at a file that cannot survive one Read.\n */\n private allDiffLines(b: ReviewerBriefing): string[] {\n if (b.allDiffPath === '') return [];\n const size = b.allDiffLines === 0 ? '' : ` — ${b.allDiffLines} lines / ${b.allDiffBytes} bytes`;\n if (b.matchedPatterns.length > 0) {\n return [`The whole branch${size}, for CROSS-FILE CONTEXT if you need it: \\`${b.allDiffPath}\\``,\n 'Your own files above are what you are reviewing; the rest of the branch is someone else\\'s checklist.', ''];\n }\n if (b.allDiffLines > ALL_DIFF_ONE_READ_LINES) {\n return [`⚠️ The combined diff is ${b.allDiffLines} lines and will NOT survive a single Read (the Read tool`,\n `truncates at ~${READ_TRUNCATION_LINES} lines, silently). Read the per-file diffs above instead, or page it:`,\n `\\`${b.allDiffPath}\\``, ''];\n }\n return [`Whole-branch diff${size} — convenient at this size, but the per-file table above is authoritative:`,\n `\\`${b.allDiffPath}\\``, ''];\n }\n\n /**\n * The rule that used to say \"when you need to\", and lost 4/4 to the more emphatic budget section 40 lines\n * later. \"When you need to\" delegates the judgment to a reviewer that, by construction, does not yet know\n * what it is missing. It has no opt-out now.\n */\n private sourceSection(b: ReviewerBriefing): string[] {\n const lines = ['## Read the full source — every file, every time', '', `Repo root: \\`${b.repoRoot}\\``, ''];\n lines.push('**READ THE FULL SOURCE OF EVERY FILE IN YOUR TABLE.** Not \"if you need to\" — every time.');\n lines.push('A hunk shows what changed; only the whole file shows what it changed INTO, and a change that');\n lines.push('looks fine in isolation can still be wrong in place.');\n lines.push('');\n lines.push('The `full source` column above is the path. For files marked `A` (added) you have already done');\n lines.push('this: an add-diff IS the complete file, byte for byte, so its diff and its source are the same');\n lines.push('text. For `M` (modified) and `D` (deleted) files the diff is a fragment — open the file.');\n lines.push('');\n if (b.sourceDirs.length > 0) {\n lines.push('The neighbouring code lives under:');\n for (const dir of b.sourceDirs) lines.push(`- \\`${dir}\\``);\n lines.push('');\n }\n return lines;\n }\n\n /**\n * The section that deletes the `node_modules` greps. Entries come from config, because the tooling\n * cannot guess that a repo keeps its queue names in terraform — but it CAN resolve where a package\n * installed to, and it must never drop an entry silently: a missing path is stated as missing.\n */\n private contextSection(b: ReviewerBriefing): string[] {\n // Emitting NOTHING made the section this class exists for look like a feature that does not exist.\n // One line naming the config keys costs nothing and is the only hint a repo will ever get.\n if (b.contextEntries.length === 0) {\n return ['## Pre-resolved context', '',\n '_None configured for this repo. If you find yourself hunting for the same path on every review,',\n 'it belongs in `pr-gate.reviewContext` / `pr-gate.reviewContextPackages` in `webpieces.config.json`._',\n ''];\n }\n const lines = ['## Pre-resolved context (do not go hunting for these)', ''];\n for (const entry of b.contextEntries) {\n const suffix = entry.note === '' ? '' : ` ${entry.note}`;\n lines.push(`- **${entry.label}** — \\`${entry.path === '' ? entry.note : entry.path}\\`${entry.path === '' ? '' : suffix}`);\n }\n lines.push('');\n return lines;\n }\n\n /**\n * The verdict shape, GENERATED — never restated in a hand-maintained file. `id` is pre-filled with this\n * reviewer's own checklist id so there is nothing to substitute and nothing to get wrong.\n */\n private verdictSection(b: ReviewerBriefing): string[] {\n return [\n '## Write your verdict',\n '',\n `Write EXACTLY this shape, to EXACTLY this file: \\`${b.verdictPath}\\``,\n '',\n '```',\n this.reviewJsonService.verdictSchemaFor(b.checklistId, '', ''),\n '```',\n '',\n ];\n }\n\n /**\n * The anti-hunting rule, with the changed files carved out explicitly.\n *\n * It used to read as \"stay inside what you were given\" and, being the LAST thing in the file, it beat\n * the source-reading instruction 4 times out of 4. It never distinguished HUNTING — greps into\n * `node_modules`, re-deriving the dependency graph — from OPENING A FILE IT WAS EXPLICITLY HANDED. The\n * distinction is now stated, because where two instructions conflict the later and more emphatic one wins.\n */\n private budgetSection(): string[] {\n return [\n '## Budget',\n '',\n 'Do NOT search `node_modules`, do NOT re-derive the dependency graph, and do NOT hunt the repo for',\n 'infrastructure config. That is hunting, and it is what wastes a review budget — those paths are',\n 'either given above or were not configured.',\n '',\n 'Reading the full text of a file that is IN your table is NOT hunting — it is the review. Budget for',\n 'it: read the diff to see what changed, and the source to judge whether it is right in place.',\n '',\n 'If something you genuinely need is missing, name it in `output` and give your verdict on what you',\n 'could actually see.',\n '',\n 'Open your diff files before writing a verdict. `wp-finish-upsert-pr` reads your own transcript and',\n 'reports a verdict written without opening the diff. It also records the path of that transcript,',\n 'beside what you were offered and what you read, in `provenance.json` next to your verdict file —',\n 'so the review is auditable after the fact. You do not write that file; the tooling does.',\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"reviewer-instructions.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/reviewer-instructions.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAC7B,yCAA2D;AAC3D,+CAAkD;AAElD,2GAA2G;AAC3G,MAAa,YAAY;IACrB,KAAK,CAAS;IACd,IAAI,CAAS,CAAK,gDAAgD;IAClE,IAAI,CAAS,CAAK,0EAA0E;IAE5F,YAAY,KAAa,EAAE,SAAiB,EAAE,IAAI,GAAG,EAAE;QACnD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ;AAVD,oCAUC;AAED;;;;;;;GAOG;AACH,MAAa,WAAW;IACpB,IAAI,CAAS,CAAQ,4BAA4B;IACjD,QAAQ,CAAS,CAAI,uCAAuC;IAC5D,UAAU,CAAS,CAAE,oFAAoF;IACzG,MAAM,CAAS,CAAM,+DAA+D;IACpF,SAAS,CAAS;IAClB,SAAS,CAAU;IAEnB,yDAAyD;IACzD,YAAY,IAAY,EAAE,QAAgB,EAAE,UAAU,GAAG,EAAE,EAAE,MAAM,GAAG,GAAG,EAAE,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,KAAK;QACvG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B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ACK,cAAc,CAAC,CAAmB;QACtC,OAAO;YACH,uBAAuB;YACvB,EAAE;YACF,qDAAqD,CAAC,CAAC,WAAW,IAAI;YACtE,EAAE;YACF,KAAK;YACL,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,CAAC;YAC9D,KAAK;YACL,EAAE;SACL,CAAC;IACN,CAAC;IAED;;;;;;;OAOG;IACK,aAAa;QACjB,OAAO;YACH,WAAW;YACX,EAAE;YACF,mGAAmG;YACnG,iGAAiG;YACjG,4CAA4C;YAC5C,EAAE;YACF,qGAAqG;YACrG,8FAA8F;YAC9F,EAAE;YACF,mGAAmG;YACnG,qBAAqB;YACrB,EAAE;YACF,oGAAoG;YACpG,kGAAkG;YAClG,kGAAkG;YAClG,0FAA0F;SAC7F,CAAC;IACN,CAAC;CACJ,CAAA;AAvRY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEW,+BAAiB;GADxD,2BAA2B,CAuRvC","sourcesContent":["import * as path from 'path';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ReviewJsonService } from './review-json';\n\n/** One pre-resolved place a reviewer would otherwise have to go hunting for. Data-only (per CLAUDE.md). */\nexport class ContextEntry {\n label: string;\n path: string; // ABSOLUTE, or '' when it could not be resolved\n note: string; // '(not installed)' / '(configured but missing)' — never silently dropped\n\n constructor(label: string, entryPath: string, note = '') {\n this.label = label;\n this.path = entryPath;\n this.note = note;\n }\n}\n\n/**\n * One reviewer's matched file, the extracted diff for it, AND the absolute path of the file itself.\n *\n * `sourcePath` exists because of a measured 0/4: four reviewers on one PR read the diff and not one opened a\n * single full source file. The instructions handed them an absolute path per diff and only a parent DIRECTORY\n * per source, so reading the diff was a paste and reading the source was \"join this dir to that filename\n * yourself\". Identical affordance, or the cheaper one wins every time. Data-only.\n */\nexport class BriefedFile {\n file: string; // repo-relative source path\n diffPath: string; // ABSOLUTE path of the extracted .diff\n sourcePath: string; // ABSOLUTE path of the file itself; '' for a deleted file, which has no after-state\n status: string; // 'M' | 'A' | 'D' | 'U' (untracked) | 'X' (excluded by config)\n diffBytes: number;\n truncated: boolean;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(file: string, diffPath: string, sourcePath = '', status = 'M', diffBytes = 0, truncated = false) {\n this.file = file;\n this.diffPath = diffPath;\n this.sourcePath = sourcePath;\n this.status = status;\n this.diffBytes = diffBytes;\n this.truncated = truncated;\n }\n}\n\n/**\n * Everything ONE reviewer needs, with every path already resolved to an ABSOLUTE one.\n *\n * Absolute is not fussiness: a subagent's working directory is not guaranteed to be the repo root, and a\n * relative path that fails to resolve turns into a search, which is the cost this whole class exists to\n * remove. Data-only.\n */\nexport class ReviewerBriefing {\n subagent: string;\n docPath: string; // the checklist's guidance doc ('' when the checklist has none)\n repoRoot: string;\n diffDir: string; // '' when nothing was materialized\n allDiffPath: string;\n manifestPath: string;\n myFiles: BriefedFile[]; // ONLY this reviewer's matched files\n matchedPatterns: string[]; // [] ⇒ patternless: the whole diff is in scope\n sourceDirs: string[]; // deduped ABSOLUTE parent dirs of myFiles\n contextEntries: ContextEntry[];\n verdictPath: string; // ABSOLUTE review-<id>.json\n checklistId: string;\n fileDiffCommand: string;\n dirty: boolean;\n // Facts ABOUT the manifest, surfaced inline so a reviewer learns the diff is complete without opening it.\n changedFileCount: number;\n truncatedCount: number;\n excludedCount: number;\n allDiffLines: number;\n allDiffBytes: number;\n // The three shas, by the names DiffManifest already uses. Printing two bare shas told a reviewer nothing\n // about WHAT the diff is taken against; C beside A makes \"main has moved since the fork\" self-evident.\n hashForkPoint: string;\n hashFeatureHead: string;\n hashMainHead: string;\n ownAgentFileInDiff: string; // ABSOLUTE path when this diff edits THIS reviewer's own agent file; '' otherwise\n // From the checklist's config `required`. Carried so the stage-② report can group the spawn blocks\n // (must run) apart from the ones the human is merely OFFERED, without a second lookup that could\n // disagree with the scan. The reviewer's OWN instructions do not mention it: a reviewer that has been\n // spawned reviews the same way either way, and telling an optional one it was optional invites it to\n // grade itself softer.\n required: boolean;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(subagent: string, checklistId: string, repoRoot: string) {\n this.subagent = subagent;\n this.checklistId = checklistId;\n this.repoRoot = repoRoot;\n this.docPath = '';\n this.diffDir = '';\n this.allDiffPath = '';\n this.manifestPath = '';\n this.myFiles = [];\n this.matchedPatterns = [];\n this.sourceDirs = [];\n this.contextEntries = [];\n this.verdictPath = '';\n this.fileDiffCommand = '';\n this.dirty = false;\n this.changedFileCount = 0;\n this.truncatedCount = 0;\n this.excludedCount = 0;\n this.allDiffLines = 0;\n this.allDiffBytes = 0;\n this.hashForkPoint = '';\n this.hashFeatureHead = '';\n this.hashMainHead = '';\n this.ownAgentFileInDiff = '';\n // Fails CLOSED, like RequiredChecklist.required: a briefing built without the flag being copied is\n // treated as a blocking reviewer, never as a skippable one.\n this.required = true;\n }\n}\n\n/**\n * The Read tool truncates at roughly this many lines, silently. Any path this file prints alongside a bigger\n * line count has to say so, or a reviewer reviews a fraction of a change and reports on all of it.\n */\nexport const READ_TRUNCATION_LINES = 2000;\n\n/** Comfortably under {@link READ_TRUNCATION_LINES} — the size at which ALL.diff really is one clean Read. */\nexport const ALL_DIFF_ONE_READ_LINES = 1500;\n\n/**\n * Renders the per-reviewer instructions file that `wp-review-upsert-pr` writes to\n * `.webpieces/pr-review/<feature>/instructions/<subagent>.instructions.md`.\n *\n * WHY this file exists, measured rather than assumed: a reviewer subagent on monorepo-nx2 spent **14 of its\n * 26 tool calls** rediscovering context the tooling already had — three separate greps into\n * `node_modules/@webpieces` to locate a scanner, a hunt through terraform for queue names, and a\n * re-derivation of the dependency graph. It did not over-review; it was under-supplied. Everything below is\n * chosen to delete a specific one of those calls.\n *\n * It is GENERATED per run, and the registered `.claude/agents/<subagent>.md` is a thin stub that points\n * here, because content a human maintains goes stale and a reviewer follows the stale copy. The verdict\n * schema in particular comes from {@link ReviewJsonService.verdictSchemaFor}.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ReviewerInstructionsService {\n constructor(private readonly reviewJsonService: ReviewJsonService) {}\n\n /** The dir holding this branch's generated instructions, beside its review.json. */\n instructionsDirFor(repoRoot: string, featureName: string): string {\n return path.join(this.reviewJsonService.prDirFor(repoRoot, featureName), 'instructions');\n }\n\n /** The file name for a reviewer's generated instructions. */\n fileNameFor(subagent: string): string {\n return `${subagent}.instructions.md`;\n }\n\n /** Absolute path of one reviewer's generated instructions file. */\n pathFor(repoRoot: string, featureName: string, subagent: string): string {\n return path.join(this.instructionsDirFor(repoRoot, featureName), this.fileNameFor(subagent));\n }\n\n render(briefing: ReviewerBriefing): string {\n return [\n ...this.identity(briefing),\n ...this.checklistSection(briefing),\n ...this.diffSection(briefing),\n ...this.sourceSection(briefing),\n ...this.contextSection(briefing),\n ...this.verdictSection(briefing),\n ...this.budgetSection(),\n ].join('\\n') + '\\n';\n }\n\n private identity(b: ReviewerBriefing): string[] {\n return [\n `# You are \\`${b.subagent}\\``,\n '',\n 'Review as YOURSELF, against your own checklist — not as a general code reviewer.',\n 'You may not write another reviewer\\'s verdict file.',\n '',\n '\"You may not review your own authorship\" means: you did not write this diff, so review it — but if',\n 'the diff CHANGES YOU, say so in `output` rather than pretending the conflict is not there.',\n ...this.selfEditWarning(b),\n '',\n '_Generated per run by `wp-review-upsert-pr`. Everything below is already resolved for you; the',\n 'paths are absolute because your working directory is not guaranteed to be the repo root._',\n '',\n ];\n }\n\n /**\n * Every PR that edits the review gate hits this: on the measured run, 5 of 8 changed files were the\n * reviewer agent files themselves, two reviewers reviewed their OWN definition, and neither flagged it —\n * neither had any guidance to. Detected by the tooling rather than left to the reviewer to notice.\n */\n private selfEditWarning(b: ReviewerBriefing): string[] {\n if (b.ownAgentFileInDiff === '') return [];\n return [\n '',\n `⚠️ THIS DIFF MODIFIES YOUR OWN AGENT FILE: \\`${b.ownAgentFileInDiff}\\``,\n 'You are reviewing a change to your own definition. Review it anyway — and state that fact in',\n '`output`, so a human reading your verdict knows the reviewer and the reviewed were the same thing.',\n ];\n }\n\n private checklistSection(b: ReviewerBriefing): string[] {\n if (b.docPath === '') {\n return ['## Your checklist', '', 'This checklist has no guidance doc — judge the diff on your own standards.', ''];\n }\n return ['## Your checklist', '', `Read this FIRST: \\`${b.docPath}\\``, ''];\n }\n\n /**\n * The change itself. The MANIFEST leads, and the per-file table with it; `ALL.diff` is demoted to one\n * option among several, recommended only where it is actually the right read.\n *\n * That ordering is the fix for a measured 4/4 failure. `ALL.diff` used to be bolded, first, and framed as\n * \"everything\", with the manifest one unbolded line below it called a \"path map\" — which reads like a\n * lookup aid, not something to open. All four reviewers on that PR read `ALL.diff`, none opened the\n * manifest, and none could therefore have established that the combined view was complete. Reviewers did\n * exactly what the emphasis told them to; so the emphasis moved.\n */\n private diffSection(b: ReviewerBriefing): string[] {\n const lines = ['## The change you are reviewing', ''];\n if (b.dirty) {\n lines.push('> ⚠️ This diff INCLUDES uncommitted and untracked work, so it is not what a');\n lines.push('> commit-to-commit range would show. Judge it anyway — it is what your checklist matched.');\n lines.push('');\n }\n lines.push(...this.manifestLines(b), ...this.basisLines(b), ...this.myFilesTable(b), ...this.allDiffLines(b));\n if (b.fileDiffCommand !== '') {\n lines.push(`Reproduce any single file: \\`${b.fileDiffCommand}\\``);\n lines.push('');\n }\n lines.push('Path matching is COARSE. Judge the change, not the path — if a matched file turns out to be');\n lines.push('irrelevant to your checklist, say so in one sentence and move on.');\n lines.push('');\n return lines;\n }\n\n /**\n * The manifest, named as the authority AND with its own headline facts inlined. Inlining them is the\n * point: a reviewer that never opens the manifest still learns whether anything was truncated or\n * excluded, which is the one thing it could not otherwise have known it was missing.\n */\n private manifestLines(b: ReviewerBriefing): string[] {\n if (b.manifestPath === '') return [];\n const warn = b.truncatedCount + b.excludedCount > 0 ? ' ⚠️ NOT everything is materialized — see the table.' : '';\n return [\n `**Path map — AUTHORITATIVE. Read this first:** \\`${b.manifestPath}\\``,\n ` ${b.changedFileCount} file(s) · ${b.truncatedCount} truncated · ${b.excludedCount} excluded${warn}`,\n ' Per file it carries: `status` (M/A/D/U/X), `bytes`, `file`/`fileAbs`, `diffFile`/`diffAbs`, and the',\n ' three shas below. It is the only place that records what was truncated or left out.',\n '',\n ];\n }\n\n /**\n * What the diff is taken AGAINST. Two bare shas in a `git diff` command said nothing about this, so a\n * reviewer could not tell a fork-point diff from a diff against main's current tip — and therefore could\n * not tell that anything merged to main since the fork is simply absent from what it is judging.\n * Rendering C beside A makes \"main has moved\" self-evident exactly when it has.\n */\n private basisLines(b: ReviewerBriefing): string[] {\n if (b.hashForkPoint === '') return [];\n const sameAsFork = b.hashMainHead === b.hashForkPoint;\n const cNote = b.hashMainHead === '' ? '(unresolved)'\n : sameAsFork ? `${b.hashMainHead} ← same as A, so main has not moved since the fork`\n : `${b.hashMainHead} ← main HAS MOVED since the fork`;\n return [\n 'This diff is **fork-point → feature-head**, NOT a diff against main\\'s current tip:',\n '```',\n `fork point (A) ${b.hashForkPoint}`,\n `feature head (B) ${b.hashFeatureHead}`,\n `main head (C) ${cNote}`,\n '```',\n 'Anything merged to main after A is NOT in this diff.',\n '',\n ];\n }\n\n /**\n * Source and diff get IDENTICAL affordance — an absolute path each, in adjacent columns. The previous\n * table gave an absolute path for the diff and nothing for the source, and the source went unread 4/4.\n */\n private myFilesTable(b: ReviewerBriefing): string[] {\n if (b.myFiles.length === 0) return ['_No files matched your patterns._', ''];\n const why = b.matchedPatterns.length === 0\n ? `**In scope: ALL ${b.myFiles.length} changed file(s)** — your checklist has no \\`patterns\\`, so the whole diff is yours.`\n : `**In scope: ${b.myFiles.length} file(s)** matching ${b.matchedPatterns.map((p: string): string => `\\`${p}\\``).join(', ')}:`;\n const rows = b.myFiles.map((f: BriefedFile): string => this.fileRow(f));\n return [why, '', '| file | status | its diff | full source |', '|---|---|---|---|', ...rows, ''];\n }\n\n /**\n * One row. A truncated or excluded diff is flagged HERE, in the row, not left as a field inside a file the\n * reviewer has to think to open — and an oversized diff states the line count that makes a single Read\n * come back silently incomplete.\n */\n private fileRow(f: BriefedFile): string {\n const flags: string[] = [];\n if (f.truncated) flags.push('⚠️ diff TRUNCATED — read the source');\n if (f.status === 'X') flags.push('⚠️ EXCLUDED, not materialized — read the source');\n const status = [`\\`${f.status}\\``, ...flags].join(' ');\n const source = f.sourcePath === '' ? '_deleted — no file on disk_' : `\\`${f.sourcePath}\\``;\n return `| \\`${f.file}\\` | ${status} | \\`${f.diffPath}\\` (${f.diffBytes} bytes) | ${source} |`;\n }\n\n /**\n * `ALL.diff`, recommended ONLY where it is the right read. It is kept — for a patternless reviewer on a\n * small diff it is genuinely one Read instead of N, which is why all four used it — but the blanket\n * \"everything on this branch\" line was wrong in two different ways at once: it invited a pattern-scoped\n * reviewer to spend its budget on files it was explicitly not asked about, and it pointed a reviewer on a\n * large PR at a file that cannot survive one Read.\n */\n private allDiffLines(b: ReviewerBriefing): string[] {\n if (b.allDiffPath === '') return [];\n const size = b.allDiffLines === 0 ? '' : ` — ${b.allDiffLines} lines / ${b.allDiffBytes} bytes`;\n if (b.matchedPatterns.length > 0) {\n return [`The whole branch${size}, for CROSS-FILE CONTEXT if you need it: \\`${b.allDiffPath}\\``,\n 'Your own files above are what you are reviewing; the rest of the branch is someone else\\'s checklist.', ''];\n }\n if (b.allDiffLines > ALL_DIFF_ONE_READ_LINES) {\n return [`⚠️ The combined diff is ${b.allDiffLines} lines and will NOT survive a single Read (the Read tool`,\n `truncates at ~${READ_TRUNCATION_LINES} lines, silently). Read the per-file diffs above instead, or page it:`,\n `\\`${b.allDiffPath}\\``, ''];\n }\n return [`Whole-branch diff${size} — convenient at this size, but the per-file table above is authoritative:`,\n `\\`${b.allDiffPath}\\``, ''];\n }\n\n /**\n * The rule that used to say \"when you need to\", and lost 4/4 to the more emphatic budget section 40 lines\n * later. \"When you need to\" delegates the judgment to a reviewer that, by construction, does not yet know\n * what it is missing. It has no opt-out now.\n */\n private sourceSection(b: ReviewerBriefing): string[] {\n const lines = ['## Read the full source — every file, every time', '', `Repo root: \\`${b.repoRoot}\\``, ''];\n lines.push('**READ THE FULL SOURCE OF EVERY FILE IN YOUR TABLE.** Not \"if you need to\" — every time.');\n lines.push('A hunk shows what changed; only the whole file shows what it changed INTO, and a change that');\n lines.push('looks fine in isolation can still be wrong in place.');\n lines.push('');\n lines.push('The `full source` column above is the path. For files marked `A` (added) you have already done');\n lines.push('this: an add-diff IS the complete file, byte for byte, so its diff and its source are the same');\n lines.push('text. For `M` (modified) and `D` (deleted) files the diff is a fragment — open the file.');\n lines.push('');\n if (b.sourceDirs.length > 0) {\n lines.push('The neighbouring code lives under:');\n for (const dir of b.sourceDirs) lines.push(`- \\`${dir}\\``);\n lines.push('');\n }\n return lines;\n }\n\n /**\n * The section that deletes the `node_modules` greps. Entries come from config, because the tooling\n * cannot guess that a repo keeps its queue names in terraform — but it CAN resolve where a package\n * installed to, and it must never drop an entry silently: a missing path is stated as missing.\n */\n private contextSection(b: ReviewerBriefing): string[] {\n // Emitting NOTHING made the section this class exists for look like a feature that does not exist.\n // One line naming the config keys costs nothing and is the only hint a repo will ever get.\n if (b.contextEntries.length === 0) {\n return ['## Pre-resolved context', '',\n '_None configured for this repo. If you find yourself hunting for the same path on every review,',\n 'it belongs in `pr-gate.reviewContext` / `pr-gate.reviewContextPackages` in `webpieces.config.json`._',\n ''];\n }\n const lines = ['## Pre-resolved context (do not go hunting for these)', ''];\n for (const entry of b.contextEntries) {\n const suffix = entry.note === '' ? '' : ` ${entry.note}`;\n lines.push(`- **${entry.label}** — \\`${entry.path === '' ? entry.note : entry.path}\\`${entry.path === '' ? '' : suffix}`);\n }\n lines.push('');\n return lines;\n }\n\n /**\n * The verdict shape, GENERATED — never restated in a hand-maintained file. `id` is pre-filled with this\n * reviewer's own checklist id so there is nothing to substitute and nothing to get wrong.\n */\n private verdictSection(b: ReviewerBriefing): string[] {\n return [\n '## Write your verdict',\n '',\n `Write EXACTLY this shape, to EXACTLY this file: \\`${b.verdictPath}\\``,\n '',\n '```',\n this.reviewJsonService.verdictSchemaFor(b.checklistId, '', ''),\n '```',\n '',\n ];\n }\n\n /**\n * The anti-hunting rule, with the changed files carved out explicitly.\n *\n * It used to read as \"stay inside what you were given\" and, being the LAST thing in the file, it beat\n * the source-reading instruction 4 times out of 4. It never distinguished HUNTING — greps into\n * `node_modules`, re-deriving the dependency graph — from OPENING A FILE IT WAS EXPLICITLY HANDED. The\n * distinction is now stated, because where two instructions conflict the later and more emphatic one wins.\n */\n private budgetSection(): string[] {\n return [\n '## Budget',\n '',\n 'Do NOT search `node_modules`, do NOT re-derive the dependency graph, and do NOT hunt the repo for',\n 'infrastructure config. That is hunting, and it is what wastes a review budget — those paths are',\n 'either given above or were not configured.',\n '',\n 'Reading the full text of a file that is IN your table is NOT hunting — it is the review. Budget for',\n 'it: read the diff to see what changed, and the source to judge whether it is right in place.',\n '',\n 'If something you genuinely need is missing, name it in `output` and give your verdict on what you',\n 'could actually see.',\n '',\n 'Open your diff files before writing a verdict. `wp-finish-upsert-pr` reads your own transcript and',\n 'reports a verdict written without opening the diff. It also records the path of that transcript,',\n 'beside what you were offered and what you read, in `provenance.json` next to your verdict file —',\n 'so the review is auditable after the fact. You do not write that file; the tooling does.',\n ];\n }\n}\n"]}
@@ -1,18 +1,57 @@
1
1
  # Webpieces review checklists — how to satisfy them
2
2
 
3
3
  Your repo defines company review checklists in `pr-gate.checklists` in `webpieces.config.json` — an
4
- array of `{ subagent, doc?, patterns? }`, and that is the **only** accepted shape. Each names a reviewer
5
- **subagent** (a `.claude/agents/<subagent>.md`, which webpieces verifies exists) and, optionally, a
6
- **repo-relative** detail doc and path `patterns`:
4
+ array of `{ subagent, required, doc?, patterns? }`, and that is the **only** accepted shape. Each names a
5
+ reviewer **subagent** (a `.claude/agents/<subagent>.md`, which webpieces verifies exists), says whether it
6
+ **blocks**, and optionally carries a **repo-relative** detail doc and path `patterns`:
7
7
 
8
8
  ```jsonc
9
9
  "commands": { "pr-gate": { "checklists": [
10
10
  { "subagent": "db-migration-reviewer",
11
11
  "doc": ".claude/review/db-migrations.md",
12
- "patterns": ["**/migrations/**", "**/*.sql"] }
12
+ "patterns": ["**/migrations/**", "**/*.sql"],
13
+ "required": true },
14
+ { "subagent": "frontend-reviewer",
15
+ "doc": ".claude/review/frontend.md",
16
+ "patterns": ["**/portal/**"],
17
+ "required": false }
13
18
  ] } }
14
19
  ```
15
20
 
21
+ ## `required` — which reviews block, and which are offered
22
+
23
+ `required` is **mandatory on every entry**; there is no default in either direction, and config validation
24
+ fails naming the edit if it is missing.
25
+
26
+ | | `required: true` | `required: false` |
27
+ | --- | --- | --- |
28
+ | when it matches the diff | the reviewer **must** run | the human is **offered** it and may decline |
29
+ | the AI's move | spawn it, without asking | **ask**, then spawn only what was picked |
30
+ | no verdict at finish | ⛔ PR refused | ✅ fine — it was declined |
31
+ | **red** verdict at finish | ⛔ PR refused | ⛔ **PR refused, identically** |
32
+
33
+ That last row is the part worth reading twice: `required` governs whether a reviewer has to **run**, not
34
+ whether its answer counts. Once an optional reviewer has been spawned it is an ordinary reviewer — running
35
+ one and then waving off its finding would make the whole exercise theater.
36
+
37
+ **Why optional checklists exist.** A repo whose checklists key on globs as broad as "every TypeScript
38
+ file" charges a one-line bug fix the same dozen subagent reviews as a schema migration. That is the right
39
+ answer for the migration and an absurd one for the typo, and the only party who can tell the two apart is
40
+ the human looking at the diff. `required: false` is how they get asked.
41
+
42
+ ### Skipping the offer entirely
43
+
44
+ If the human has **already** said to submit without the optional reviews:
45
+
46
+ ```bash
47
+ pnpm wp-review-upsert-pr --no-optional
48
+ ```
49
+
50
+ The offer block disappears and the skipped checklists are named in the output and on the PR. Pass this
51
+ **only** on their instruction — never on your own judgement, and never to save a round-trip. Required
52
+ checklists are unaffected, and an optional checklist that already carries a red verdict on this branch
53
+ still blocks the PR.
54
+
16
55
  > **The old `checklists: { "doc": "..." }` shape is REMOVED.** It hid this array in a
17
56
  > `<!-- webpieces:checklists [...] -->` HTML comment inside a markdown doc, where no schema, editor, or `jq`
18
57
  > could reach it. If your config still has it, **config validation fails** and prints the exact edit: move
@@ -44,7 +83,8 @@ Checklists already reviewed on this branch are **not** re-listed — verdict fil
44
83
  start/review/finish cycle re-instructs nothing.
45
84
 
46
85
  `wp-finish-upsert-pr` recomputes the same set and **refuses to open the PR** while any reviewer still owes
47
- a passing verdict, naming only the ones still missing.
86
+ a passing verdict, naming only the ones still missing. An optional checklist that was offered and declined
87
+ owes nothing — it is reported as not run, never as passed.
48
88
 
49
89
  Note that **not every checklist is pattern-matched**: one with no `patterns` runs on EVERY PR, and the
50
90
  whole diff is in its scope. `wp-review-upsert-pr` says `ALWAYS RUNS` for those rather than calling the
@@ -61,7 +101,7 @@ The changed files + the exact base sha the gate uses are in
61
101
  { "base": "<merge-base sha>", "head": "<HEAD sha>", "changedFiles": ["path/a.ts", "db/003.sql", ...] }
62
102
  ```
63
103
 
64
- For EACH matched checklist you must:
104
+ For each matched **required** checklist — and each **optional** one the human picked — you must:
65
105
 
66
106
  1. **Spawn its named subagent as a SEPARATE subagent** — a *different* one per checklist. The coding
67
107
  agent may **not** review its own work, and one reviewer may **not** stand in for several. `wp-finish`
@@ -73,6 +113,13 @@ For EACH matched checklist you must:
73
113
  3. Have it **write its verdict** to `.webpieces/pr-review/<branch>/review-<id>.json` (one file per
74
114
  checklist, so concurrent reviewers never clobber each other). `<id>` is the subagent name.
75
115
 
116
+ **How to ask about the optional ones.** `wp-review-upsert-pr` prints them as their own step, listing each
117
+ with the files it matched and the doc it reviews against. Put them to the human in **ONE multi-select
118
+ question** with an explicit *"None — required only"* choice. Not one question per reviewer: a human
119
+ answering "no" nine times in a row is being worn down rather than consulted, and by the third question the
120
+ cheap answer is yes to everything — which is exactly the state `required: false` exists to fix. If they
121
+ pick none, that is a complete answer; go straight to finish.
122
+
76
123
  **You may never write a reviewer's `review-<id>.json` yourself.** If a named subagent cannot be spawned,
77
124
  that is a config bug, not your cue to self-certify — say so and stop. (webpieces now rejects a checklist
78
125
  whose `subagent` has no `.claude/agents/<subagent>.md`, so this should surface as a config error instead.)
@@ -112,6 +159,11 @@ sub-bullet naming the globs that matched, the files they matched, or how many ch
112
159
  tell "evaluated and not applicable" from "never wired up", and so nobody has to guess why a given reviewer
113
160
  was involved. Below the roster, each reviewer that ran gets its full `output` verbatim.
114
161
 
162
+ Optional checklists are tagged `(optional)` on the roster, and one that **applied but was not run** gets
163
+ its own unchecked row — counted separately from the skipped ones and never with a ✅. "Nothing here
164
+ applied" and "someone decided not to look" are different claims, and a PR that declined every optional
165
+ review must not read as a fully-reviewed one.
166
+
115
167
  ## `review.json` (you, the main agent, write this once)
116
168
 
117
169
  ```json