@webpieces/rules-config 0.4.538 → 0.4.539
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/package.json +1 -1
- package/src/checklist-instructions.js +9 -4
- package/src/checklist-instructions.js.map +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +5 -3
- package/src/index.js.map +1 -1
- package/src/reviewer-instructions.d.ts +87 -4
- package/src/reviewer-instructions.js +201 -29
- package/src/reviewer-instructions.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/rules-config",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.539",
|
|
4
4
|
"description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -107,11 +107,16 @@ let ChecklistInstructionsService = class ChecklistInstructionsService {
|
|
|
107
107
|
];
|
|
108
108
|
}
|
|
109
109
|
const lines = ['Also give EACH one the real diff — path matching is COARSE, so judge the change, not the path:'];
|
|
110
|
-
// The MATERIALIZED diff
|
|
111
|
-
//
|
|
110
|
+
// The MATERIALIZED diff when it exists: it cannot go empty the way a hand-assembled range can. The
|
|
111
|
+
// MANIFEST leads, and ALL.diff follows it, for the same reason the per-reviewer instructions were
|
|
112
|
+
// reordered: whichever one is printed first and framed as "everything" is the only one that gets
|
|
113
|
+
// opened — measured 4/4 — and ALL.diff is the one that can be silently incomplete.
|
|
112
114
|
if (context.diffDir.trim() !== '') {
|
|
113
|
-
lines.push(`
|
|
114
|
-
lines.push(
|
|
115
|
+
lines.push(` path map, AUTHORITATIVE: ${context.diffDir}/manifest.json`);
|
|
116
|
+
lines.push(' per file: status, bytes, absolute source + diff paths,');
|
|
117
|
+
lines.push(' plus what was truncated or excluded');
|
|
118
|
+
lines.push(` per-file diffs: ${context.diffDir}/files/`);
|
|
119
|
+
lines.push(` combined view (may be capped): ${context.diffDir}/ALL.diff`);
|
|
115
120
|
}
|
|
116
121
|
// NEVER hand-assemble `<baseSha> HEAD` here. On a dirty tree the changed-file set is base→working
|
|
117
122
|
// tree, so that range is empty and the reviewer is handed a command that shows it nothing — the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checklist-instructions.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/checklist-instructions.ts"],"names":[],"mappings":";;;;AAAA,yCAA2D;AAC3D,yDAAoD;AACpD,+CAEuB;AAEvB;;;;;;;;;;;;;;GAcG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAKR;IAJ7B,oGAAoG;IACpG,2FAA2F;IAC3F,uGAAuG;IACvG,kDAAkD;IAClD,YAA6B,iBAAoC;QAApC,sBAAiB,GAAjB,iBAAiB,CAAmB;IAAG,CAAC;IAErE;;;OAGG;IACH,MAAM,CAAC,OAAqC,EAAE,UAAkB,EAAE,OAA+B;QAC7F,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QACpC,MAAM,KAAK,GAAa;YACpB,sBAAsB,OAAO,CAAC,MAAM,qEAAqE;YACzG,+EAA+E;YAC/E,EAAE;SACL,CAAC;QACF,KAAK,MAAM,GAAG,IAAI,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;QAC5E,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,mGAAmG;I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CAAC,IAAI,CAAC,4FAA4F,CAAC,CAAC;QAC7G,CAAC;QACD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,KAAK,CAAC,IAAI,CAAC,6FAA6F,CAAC,CAAC;YAC1G,KAAK,CAAC,IAAI,CAAC,qFAAqF,CAAC,CAAC;QACtG,CAAC;QACD,IAAI,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACtC,KAAK,CAAC,IAAI,CAAC,6CAA6C,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CAEJ,CAAA;AAhHY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAMW,+BAAiB;GALxD,4BAA4B,CAgHxC","sourcesContent":["import { injectable, bindingScopeValues } from 'inversify';\nimport { formatFileList } from './checklist-config';\nimport {\n ChecklistReviewContext, RequiredChecklist, ReviewJsonService,\n} from './review-json';\n\n/**\n * Renders the ONE block that tells the coding agent which reviewer subagents it must run and exactly what\n * to tell them. There is a single renderer because three callers need the identical text and any drift\n * between them is a correctness bug, not a cosmetic one:\n *\n * - `wp-review-upsert-pr` — the AI asks \"what review do I owe on this diff?\"\n * - `wp-finish-upsert-pr` — fails fast, listing ONLY the reviewers that still have not run\n * - `ReviewJsonService` — the same list appended to a review.json validation failure\n *\n * Callers pass ONLY the checklists still needing a verdict. A checklist already reviewed on this branch is\n * never re-listed — re-instructing it invites a redundant second run, and (worse) reads as though the\n * earlier verdict did not count.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ChecklistInstructionsService {\n // Injected so the verdict path comes from the ONE place that knows it. This class used to hand-roll\n // dirname with a regex and a hardcoded '/', a second implementation of ReviewJsonService's\n // checklistResultPath that agreed on POSIX and disagreed on Windows — the same duplicate-logic trap as\n // the two different matched-file truncation caps.\n constructor(private readonly reviewJsonService: ReviewJsonService) {}\n\n /**\n * The full instruction block, or '' when nothing is pending (so a caller can concatenate it blindly).\n * `reviewPath` is the branch's review.json — each verdict file sits beside it as review-<id>.json.\n */\n render(pending: readonly RequiredChecklist[], reviewPath: string, context: ChecklistReviewContext): string {\n if (pending.length === 0) return '';\n const lines: string[] = [\n `You MUST run these ${pending.length} reviewer subagent(s) — a SEPARATE one for each. You may NOT review`,\n `your own work, and you may NOT write a reviewer's verdict file on its behalf.`,\n '',\n ];\n for (const req of pending) lines.push(...this.oneReviewer(req, reviewPath));\n lines.push('', ...this.verdictFormat());\n lines.push('', ...this.diffLines(context));\n return lines.join('\\n');\n }\n\n // Just the reviewer NAMES, for a caller that wants a one-line summary rather than the whole block.\n names(pending: readonly RequiredChecklist[]): string {\n return pending.map((r: RequiredChecklist): string => r.subagent).join(', ');\n }\n\n // What ONE subagent must be given: its doc, why it is running + over what, and the file it must write.\n private oneReviewer(req: RequiredChecklist, reviewPath: string): string[] {\n const lines = [` • ${req.subagent}`];\n // The doc is REPO-relative by the time it reaches here (see ChecklistDefinition.doc), so a subagent\n // handed this string can actually open it. Printing the raw config value would not resolve.\n if (req.doc.trim() !== '') lines.push(` doc to read: ${req.doc}`);\n for (const scopeLine of this.scope(req)) lines.push(` ${scopeLine}`);\n lines.push(` must write: ${this.reviewJsonService.checklistResultPath(reviewPath, req.id)}`);\n return lines;\n }\n\n /**\n * WHY this reviewer is running, and over what. NOT every checklist is pattern-matched: one with no\n * `patterns` runs on EVERY PR, and calling its file list \"matched\" implies the list is a narrow,\n * pre-filtered slice of the diff when it is in fact the whole thing. When patterns DID fire, they are\n * named — the reviewer cannot otherwise tell a precise migrations-only glob from a blanket match-all one.\n */\n private scope(req: RequiredChecklist): string[] {\n if (req.matchedPatterns.length === 0) {\n return [\n `in scope: ALWAYS RUNS — this checklist has no patterns, so the WHOLE diff is in scope`,\n ` all ${req.matchedFiles.length} changed file(s): ${formatFileList(req.matchedFiles)}`,\n ];\n }\n const globs = req.matchedPatterns.map((p: string): string => `\"${p}\"`).join(', ');\n return [\n `in scope: ${req.matchedFiles.length} file(s) matched ${globs}`,\n ` ${formatFileList(req.matchedFiles)}`,\n ];\n }\n\n // ONE shared format block for every reviewer, rather than repeating the schema under each name — and\n // the schema itself comes from ReviewJsonService, the single renderer, so a change to the verdict shape\n // cannot leave a stale copy in print. (It did once: `success` outlived its own removal in every\n // hand-written agent .md.)\n private verdictFormat(): string[] {\n return [\n 'TELL EACH subagent to write that file with EXACTLY this format (there is NO \"success\" field —',\n 'it was removed; \"status\" is a tri-state so a reviewer can pass a change AND still raise a concern):',\n ...this.reviewJsonService.verdictSchemaFor('<its own subagent name>', '', ' ').split('\\n'),\n ];\n }\n\n // The diff every reviewer judges. Stated once, here, because path matching is deliberately coarse and a\n // reviewer that only sees filenames cannot make the content-level call the checklist is asking for.\n private diffLines(context: ChecklistReviewContext): string[] {\n // NEVER omit these lines quietly. A reviewer given filenames but no way to read the change cannot make\n // the content-level judgment the checklist asks for, and a silently shorter instruction block is\n // indistinguishable from a complete one — so an unresolvable base is stated as the problem it is.\n if (context.baseSha.trim() === '') {\n return [\n '⚠️ No diff base resolved for this branch, so the exact `git diff` command could not be given.',\n ' Tell each reviewer to diff against main itself (`git diff $(git merge-base origin/main HEAD) HEAD -- <file>`)',\n ' and note that path matching is COARSE — judge the real change, not the path.',\n ];\n }\n const lines = ['Also give EACH one the real diff — path matching is COARSE, so judge the change, not the path:'];\n // The MATERIALIZED diff first when it exists: it is one Read instead of a shell-out per file, and it\n // cannot go empty the way a hand-assembled range can.\n if (context.diffDir.trim() !== '') {\n lines.push(` everything, already extracted: ${context.diffDir}/ALL.diff`);\n lines.push(` per-file diffs + path map: ${context.diffDir}/files/ (see manifest.json)`);\n }\n // NEVER hand-assemble `<baseSha> HEAD` here. On a dirty tree the changed-file set is base→working\n // tree, so that range is empty and the reviewer is handed a command that shows it nothing — the\n // failure this whole class of field exists to prevent. The command is derived from the same basis\n // the file set was; when it is absent (an older pr-gate wrote the context), say so instead.\n if (context.fileDiffCommand.trim() !== '') {\n lines.push(` reproduce one file: ${context.fileDiffCommand}`);\n } else {\n lines.push(` ⚠️ no reproduce command recorded — derive it yourself from base ${context.baseSha},`);\n lines.push(' and check `git status` first: uncommitted work needs `git diff <base>` with NO head.');\n }\n if (context.dirty) {\n lines.push(' ⚠️ this diff INCLUDES uncommitted + untracked work, so it is not what a commit-to-commit');\n lines.push(' range would show. Judge it anyway — it is what the checklist matched against.');\n }\n if (context.prContextPath.trim() !== '') {\n lines.push(` full changed-file set + base/head sha: ${context.prContextPath}`);\n }\n return lines;\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"checklist-instructions.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/checklist-instructions.ts"],"names":[],"mappings":";;;;AAAA,yCAA2D;AAC3D,yDAAoD;AACpD,+CAEuB;AAEvB;;;;;;;;;;;;;;GAcG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAKR;IAJ7B,oGAAoG;IACpG,2FAA2F;IAC3F,uGAAuG;IACvG,kDAAkD;IAClD,YAA6B,iBAAoC;QAApC,sBAAiB,GAAjB,iBAAiB,CAAmB;IAAG,CAAC;IAErE;;;OAGG;IACH,MAAM,CAAC,OAAqC,EAAE,UAAkB,EAAE,OAA+B;QAC7F,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QACpC,MAAM,KAAK,GAAa;YACpB,sBAAsB,OAAO,CAAC,MAAM,qEAAqE;YACzG,+EAA+E;YAC/E,EAAE;SACL,CAAC;QACF,KAAK,MAAM,GAAG,IAAI,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;QAC5E,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,CAA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,IAAI,CAAC,qCAAqC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC;QAChF,CAAC;QACD,kGAAkG;QAClG,gGAAgG;QAChG,kGAAkG;QAClG,4FAA4F;QAC5F,IAAI,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC,qCAAqC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;QAC/E,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,IAAI,CAAC,sEAAsE,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC;YACrG,KAAK,CAAC,IAAI,CAAC,4FAA4F,CAAC,CAAC;QAC7G,CAAC;QACD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,KAAK,CAAC,IAAI,CAAC,6FAA6F,CAAC,CAAC;YAC1G,KAAK,CAAC,IAAI,CAAC,qFAAqF,CAAC,CAAC;QACtG,CAAC;QACD,IAAI,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACtC,KAAK,CAAC,IAAI,CAAC,6CAA6C,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CAEJ,CAAA;AArHY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAMW,+BAAiB;GALxD,4BAA4B,CAqHxC","sourcesContent":["import { injectable, bindingScopeValues } from 'inversify';\nimport { formatFileList } from './checklist-config';\nimport {\n ChecklistReviewContext, RequiredChecklist, ReviewJsonService,\n} from './review-json';\n\n/**\n * Renders the ONE block that tells the coding agent which reviewer subagents it must run and exactly what\n * to tell them. There is a single renderer because three callers need the identical text and any drift\n * between them is a correctness bug, not a cosmetic one:\n *\n * - `wp-review-upsert-pr` — the AI asks \"what review do I owe on this diff?\"\n * - `wp-finish-upsert-pr` — fails fast, listing ONLY the reviewers that still have not run\n * - `ReviewJsonService` — the same list appended to a review.json validation failure\n *\n * Callers pass ONLY the checklists still needing a verdict. A checklist already reviewed on this branch is\n * never re-listed — re-instructing it invites a redundant second run, and (worse) reads as though the\n * earlier verdict did not count.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ChecklistInstructionsService {\n // Injected so the verdict path comes from the ONE place that knows it. This class used to hand-roll\n // dirname with a regex and a hardcoded '/', a second implementation of ReviewJsonService's\n // checklistResultPath that agreed on POSIX and disagreed on Windows — the same duplicate-logic trap as\n // the two different matched-file truncation caps.\n constructor(private readonly reviewJsonService: ReviewJsonService) {}\n\n /**\n * The full instruction block, or '' when nothing is pending (so a caller can concatenate it blindly).\n * `reviewPath` is the branch's review.json — each verdict file sits beside it as review-<id>.json.\n */\n render(pending: readonly RequiredChecklist[], reviewPath: string, context: ChecklistReviewContext): string {\n if (pending.length === 0) return '';\n const lines: string[] = [\n `You MUST run these ${pending.length} reviewer subagent(s) — a SEPARATE one for each. You may NOT review`,\n `your own work, and you may NOT write a reviewer's verdict file on its behalf.`,\n '',\n ];\n for (const req of pending) lines.push(...this.oneReviewer(req, reviewPath));\n lines.push('', ...this.verdictFormat());\n lines.push('', ...this.diffLines(context));\n return lines.join('\\n');\n }\n\n // Just the reviewer NAMES, for a caller that wants a one-line summary rather than the whole block.\n names(pending: readonly RequiredChecklist[]): string {\n return pending.map((r: RequiredChecklist): string => r.subagent).join(', ');\n }\n\n // What ONE subagent must be given: its doc, why it is running + over what, and the file it must write.\n private oneReviewer(req: RequiredChecklist, reviewPath: string): string[] {\n const lines = [` • ${req.subagent}`];\n // The doc is REPO-relative by the time it reaches here (see ChecklistDefinition.doc), so a subagent\n // handed this string can actually open it. Printing the raw config value would not resolve.\n if (req.doc.trim() !== '') lines.push(` doc to read: ${req.doc}`);\n for (const scopeLine of this.scope(req)) lines.push(` ${scopeLine}`);\n lines.push(` must write: ${this.reviewJsonService.checklistResultPath(reviewPath, req.id)}`);\n return lines;\n }\n\n /**\n * WHY this reviewer is running, and over what. NOT every checklist is pattern-matched: one with no\n * `patterns` runs on EVERY PR, and calling its file list \"matched\" implies the list is a narrow,\n * pre-filtered slice of the diff when it is in fact the whole thing. When patterns DID fire, they are\n * named — the reviewer cannot otherwise tell a precise migrations-only glob from a blanket match-all one.\n */\n private scope(req: RequiredChecklist): string[] {\n if (req.matchedPatterns.length === 0) {\n return [\n `in scope: ALWAYS RUNS — this checklist has no patterns, so the WHOLE diff is in scope`,\n ` all ${req.matchedFiles.length} changed file(s): ${formatFileList(req.matchedFiles)}`,\n ];\n }\n const globs = req.matchedPatterns.map((p: string): string => `\"${p}\"`).join(', ');\n return [\n `in scope: ${req.matchedFiles.length} file(s) matched ${globs}`,\n ` ${formatFileList(req.matchedFiles)}`,\n ];\n }\n\n // ONE shared format block for every reviewer, rather than repeating the schema under each name — and\n // the schema itself comes from ReviewJsonService, the single renderer, so a change to the verdict shape\n // cannot leave a stale copy in print. (It did once: `success` outlived its own removal in every\n // hand-written agent .md.)\n private verdictFormat(): string[] {\n return [\n 'TELL EACH subagent to write that file with EXACTLY this format (there is NO \"success\" field —',\n 'it was removed; \"status\" is a tri-state so a reviewer can pass a change AND still raise a concern):',\n ...this.reviewJsonService.verdictSchemaFor('<its own subagent name>', '', ' ').split('\\n'),\n ];\n }\n\n // The diff every reviewer judges. Stated once, here, because path matching is deliberately coarse and a\n // reviewer that only sees filenames cannot make the content-level call the checklist is asking for.\n private diffLines(context: ChecklistReviewContext): string[] {\n // NEVER omit these lines quietly. A reviewer given filenames but no way to read the change cannot make\n // the content-level judgment the checklist asks for, and a silently shorter instruction block is\n // indistinguishable from a complete one — so an unresolvable base is stated as the problem it is.\n if (context.baseSha.trim() === '') {\n return [\n '⚠️ No diff base resolved for this branch, so the exact `git diff` command could not be given.',\n ' Tell each reviewer to diff against main itself (`git diff $(git merge-base origin/main HEAD) HEAD -- <file>`)',\n ' and note that path matching is COARSE — judge the real change, not the path.',\n ];\n }\n const lines = ['Also give EACH one the real diff — path matching is COARSE, so judge the change, not the path:'];\n // The MATERIALIZED diff when it exists: it cannot go empty the way a hand-assembled range can. The\n // MANIFEST leads, and ALL.diff follows it, for the same reason the per-reviewer instructions were\n // reordered: whichever one is printed first and framed as \"everything\" is the only one that gets\n // opened — measured 4/4 — and ALL.diff is the one that can be silently incomplete.\n if (context.diffDir.trim() !== '') {\n lines.push(` path map, AUTHORITATIVE: ${context.diffDir}/manifest.json`);\n lines.push(' per file: status, bytes, absolute source + diff paths,');\n lines.push(' plus what was truncated or excluded');\n lines.push(` per-file diffs: ${context.diffDir}/files/`);\n lines.push(` combined view (may be capped): ${context.diffDir}/ALL.diff`);\n }\n // NEVER hand-assemble `<baseSha> HEAD` here. On a dirty tree the changed-file set is base→working\n // tree, so that range is empty and the reviewer is handed a command that shows it nothing — the\n // failure this whole class of field exists to prevent. The command is derived from the same basis\n // the file set was; when it is absent (an older pr-gate wrote the context), say so instead.\n if (context.fileDiffCommand.trim() !== '') {\n lines.push(` reproduce one file: ${context.fileDiffCommand}`);\n } else {\n lines.push(` ⚠️ no reproduce command recorded — derive it yourself from base ${context.baseSha},`);\n lines.push(' and check `git status` first: uncommitted work needs `git diff <base>` with NO head.');\n }\n if (context.dirty) {\n lines.push(' ⚠️ this diff INCLUDES uncommitted + untracked work, so it is not what a commit-to-commit');\n lines.push(' range would show. Judge it anyway — it is what the checklist matched against.');\n }\n if (context.prContextPath.trim() !== '') {\n lines.push(` full changed-file set + base/head sha: ${context.prContextPath}`);\n }\n return lines;\n }\n\n}\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export { ChecklistDefinition, toChecklist, normalizeChecklistDoc, formatFileList
|
|
|
42
42
|
export type { RawChecklistItem } from './checklist-config';
|
|
43
43
|
export { ChecklistValidator } from './checklist-validator';
|
|
44
44
|
export { ChecklistInstructionsService } from './checklist-instructions';
|
|
45
|
-
export { ReviewerInstructionsService, ReviewerBriefing, BriefedFile, ContextEntry, } from './reviewer-instructions';
|
|
45
|
+
export { ReviewerInstructionsService, ReviewerBriefing, BriefedFile, ContextEntry, READ_TRUNCATION_LINES, ALL_DIFF_ONE_READ_LINES, } from './reviewer-instructions';
|
|
46
46
|
export { GateTokenService, computeGateToken, gateTokenMarker, extractGateToken, verifyGateToken, } from './gate-token';
|
|
47
47
|
export { SubagentProvenanceService, ReviewerEvidence, EvidenceRequest, ProvenanceResult, PROVENANCE_OK, PROVENANCE_MISSING, PROVENANCE_SKIPPED, } from './subagent-provenance';
|
|
48
48
|
export { ReviewProvenanceService, ReviewProvenance, ReviewerTranscript, ReviewerPaths, OfferedContext, ProvenanceWriteRequest, DEFAULT_RETENTION_DAYS, } from './review-provenance';
|
package/src/index.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.allRuleNames = exports.validateMatchRulesSection = exports.validateExcludePaths = exports.validateCommandsSection = exports.validateSectionPlacement = exports.validateChecklistsSection = exports.validatePrGateSection = exports.validateWebpiecesConfig = exports.TemplateWriter = exports.writeTemplate = exports.writeTemplateIfMissing = exports.loadTemplate = exports.defaultRulesDir = exports.defaultRules = exports.matchesAnyGlob = exports.isPathExcluded = exports.ExcludePaths = exports.DESIGN_METADATA_KEYS = exports.isDocumentDesign = exports.DocumentDesign = exports.RulesConfigDesign = exports.AtomicFile = exports.StateMigrationReport = exports.StateDirMigrator = exports.WORKTREE_STATE_DIR = exports.GitDirs = exports.dotWebpieces = exports.DotWebpieces = exports.INSTRUCT_AI_LEAF = exports.INSTRUCT_AI_DIR = exports.RepoRootFinder = exports.CONFIG_PARSE_RETRY_MILLIS = exports.CONFIG_PARSE_ATTEMPTS = exports.ConfigParseAttempt = exports.ConfigFile = exports.CONFIG_FILENAME = exports.findConfigFile = exports.ConfigLoader = exports.LoadedConfig = exports.loadAndValidate = exports.toError = exports.runMain = exports.CliArgs = exports.CliArgsCheck = exports.CliUsage = exports.CliExitError = exports.RuleFailError = exports.InformAiError = exports.ResolvedRuleConfig = exports.ResolvedConfig = void 0;
|
|
4
4
|
exports.NoUnmanagedExceptionsConfig = exports.NoDestructureConfig = exports.PrismaConverterConfig = exports.PrismaValidateDtosConfig = exports.NoImplicitAnyConfig = exports.NoAnyUnknownConfig = exports.NoInlineTypeLiteralsConfig = exports.RequireReturnTypeConfig = exports.MaxFileLinesConfig = exports.MaxMethodLinesConfig = exports.WP_FINISH_UPSERT_PR = exports.WP_START_UPSERT_PR = exports.WP_FINISH_UPDATE = exports.WP_START_UPDATE = exports.SyncFlowGuidance = exports.WebpiecesRulesConfig = exports.MERGE_EXPLANATION_FILE = exports.MERGE_IN_PROGRESS_FILE = exports.PR_REVIEW_DIR = exports.MERGE_INFO_DIR = exports.WEBPIECES_TMP_DIR = exports.hasDisable = exports.RULE_NAMES = exports.WEBPIECES_DISABLE = exports.AbstractRule = exports.ChangedFilesOptions = exports.DiffRange = exports.DiffScope = exports.isNewOrModified = exports.hasChangesInRange = exports.findNewMethodSignaturesInDiff = exports.getChangedLineNumbers = exports.getFileDiff = exports.getChangedFiles = exports.resolveBase = exports.detectBase = exports.getCurrentBranch = exports.shouldSkipRule = exports.FieldDef = exports.sectionForRule = exports.isHookGuard = exports.HOOK_GUARD_NAMES = exports.DEFAULT_MATCH_RULES = exports.renderMatchRuleMessage = exports.compileMatchRulePatterns = exports.isMatchRuleAllowedPath = exports.findMatchRuleViolations = exports.MatchRuleViolation = exports.MatchRuleConfig = exports.validateChecklistDocs = void 0;
|
|
5
5
|
exports.ReviewContextEntry = exports.LandPrConfig = exports.PrGateConfig = exports.GateDefinition = exports.StaleMainBashGuardConfig = exports.MergedBranchBashGuardConfig = exports.ReadStaleGuardConfig = exports.FeatureBranchGuardConfig = exports.CLIENT_CREATION_SEVERITIES = exports.NoClientCreationOutsideServerOrClientConfig = exports.VALIDATE_TS_MODES = exports.STRUCTURAL_MODES = exports.ON_OFF_MODES = exports.THROW_CAUSE_MODES = exports.DIRECT_API_RESOLVER_MODES = exports.PRISMA_CONVERTER_MODES = exports.PRISMA_DTOS_MODES = exports.PROJECT_MODES = exports.MODIFIED_CODE_MODES = exports.INLINE_TYPE_MODES = exports.RETURN_TYPE_MODES = exports.FILE_LIMIT_MODES = exports.METHOD_LIMIT_MODES = exports.BaseRuleConfig = exports.ValidateEslintSyncConfig = exports.ValidateVersionsLockedConfig = exports.ValidatePackageJsonConfig = exports.ValidateNoArchitectureCyclesConfig = exports.ValidateArchitectureUnchangedConfig = exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.DiGraphConfig = exports.NxWiringConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.RedirectHowToMergeMainConfig = exports.PrMergeGuardConfig = exports.MergeInProgressGuardConfig = exports.PrCreationOrPushGuardConfig = exports.BranchCreationGuardConfig = exports.RoleTagConfig = exports.FrameworkTagConfig = exports.InjectAnnotationNotNeededForConcreteClassConfig = exports.NoFunctionOutsideClassConfig = exports.NoProcessExitOutsideMainConfig = exports.NoCustomCssConfig = exports.NoSymbolDiTokensConfig = exports.AngularNoDirectApiInResolverConfig = exports.ThrowCauseRequiredConfig = exports.CatchErrorPatternConfig = void 0;
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.DEFAULT_MERGE_COMPLETE_COMMAND = exports.DEFAULT_UPSERT_PR_COMMAND = exports.buildCommandsConfig = exports.CommandsConfig = exports.logBranchMutation = exports.branchMutationLogPath = exports.BranchMutationLog = exports.BranchMutationEvent = exports.WorktreeReaper = exports.WorktreeReapResult = exports.ReapedWorktree = exports.BranchReaper = exports.ReapResult = exports.ReapedBranch = exports.WorktreeService = exports.Worktree = exports.BRANCH_RETENTION_KEEP = exports.BRANCH_RETENTION_ARCHIVE_TAG = exports.BRANCH_RETENTION_DELETE = void 0;
|
|
6
|
+
exports.VERDICT_GREEN = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_OVERRIDDEN = exports.CK_WARN = exports.CK_PASS = exports.ChecklistVerdict = exports.ChecklistResult = exports.PrContext = exports.ReviewJson = exports.DEFAULT_RETENTION_DAYS = exports.ProvenanceWriteRequest = exports.OfferedContext = exports.ReviewerPaths = exports.ReviewerTranscript = exports.ReviewProvenance = exports.ReviewProvenanceService = exports.PROVENANCE_SKIPPED = exports.PROVENANCE_MISSING = exports.PROVENANCE_OK = exports.ProvenanceResult = exports.EvidenceRequest = exports.ReviewerEvidence = exports.SubagentProvenanceService = exports.verifyGateToken = exports.extractGateToken = exports.gateTokenMarker = exports.computeGateToken = exports.GateTokenService = exports.ALL_DIFF_ONE_READ_LINES = exports.READ_TRUNCATION_LINES = exports.ContextEntry = exports.BriefedFile = exports.ReviewerBriefing = exports.ReviewerInstructionsService = exports.ChecklistInstructionsService = exports.ChecklistValidator = exports.formatFileList = exports.normalizeChecklistDoc = exports.toChecklist = exports.ChecklistDefinition = exports.MERGE_MODES = exports.MERGE_MODE_NONE = exports.MERGE_MODE_AUTO = exports.buildLandPrConfig = exports.buildPrGateConfig = exports.defaultLandPrConfig = exports.defaultPrGateConfig = exports.defaultGates = void 0;
|
|
7
|
+
exports.ArchiveResult = exports.BranchArchiver = exports.PROMPTABLE_CLASSIFICATIONS = exports.CLASSIFICATION_DETACHED = exports.CLASSIFICATION_CURRENT = exports.CLASSIFICATION_LOCKED = exports.CLASSIFICATION_PRUNABLE = exports.CLASSIFICATION_IN_USE = exports.CLASSIFICATION_NEVER_PROPOSED = exports.CLASSIFICATION_CONTENT_IN_MAIN = exports.CLASSIFICATION_SUPERSEDED = exports.CLASSIFICATION_NO_COMMITS = exports.CLASSIFICATION_BACKUP_OF_LIVE = exports.CLASSIFICATION_BACKUP_OF_MERGED = exports.CLASSIFICATION_MERGED_PR = exports.CACHE_STALE_AFTER_MS = exports.CacheFreshness = exports.MergedBranchesService = exports.MergedBranchesCache = exports.DeletableWorktree = exports.DeletableBranch = exports.MergedBranch = exports.squashRecoverySteps = exports.stampCleanMainSyncStatus = exports.computeMainSyncStatus = exports.finishedLock = exports.inProcessLock = exports.tryAcquireMainSyncLock = exports.isRefreshInProgress = exports.isLockStale = exports.writeMainSyncLock = exports.readMainSyncLock = exports.writeMainSyncStatus = exports.readMainSyncStatus = exports.mainSyncLockPath = exports.mainSyncStatusPath = exports.DEFAULT_HANG_TIMEOUT_MINUTES = exports.MainSyncStatusService = exports.MainSyncLock = exports.MainSyncStatus = exports.reviewJsonSchemaHint = exports.reviewJsonPath = exports.prDirFor = exports.loadReviewJson = exports.ReviewJsonService = exports.ChecklistReviewContext = exports.RequiredChecklist = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_YELLOW = void 0;
|
|
8
|
+
exports.DEFAULT_MERGE_COMPLETE_COMMAND = exports.DEFAULT_UPSERT_PR_COMMAND = exports.buildCommandsConfig = exports.CommandsConfig = exports.logBranchMutation = exports.branchMutationLogPath = exports.BranchMutationLog = exports.BranchMutationEvent = exports.WorktreeReaper = exports.WorktreeReapResult = exports.ReapedWorktree = exports.BranchReaper = exports.ReapResult = exports.ReapedBranch = exports.WorktreeService = exports.Worktree = exports.BRANCH_RETENTION_KEEP = exports.BRANCH_RETENTION_ARCHIVE_TAG = exports.BRANCH_RETENTION_DELETE = exports.BRANCH_RETENTIONS = exports.ARCHIVE_TAG_PREFIX = void 0;
|
|
9
9
|
var types_1 = require("./types");
|
|
10
10
|
Object.defineProperty(exports, "ResolvedConfig", { enumerable: true, get: function () { return types_1.ResolvedConfig; } });
|
|
11
11
|
Object.defineProperty(exports, "ResolvedRuleConfig", { enumerable: true, get: function () { return types_1.ResolvedRuleConfig; } });
|
|
@@ -216,6 +216,8 @@ Object.defineProperty(exports, "ReviewerInstructionsService", { enumerable: true
|
|
|
216
216
|
Object.defineProperty(exports, "ReviewerBriefing", { enumerable: true, get: function () { return reviewer_instructions_1.ReviewerBriefing; } });
|
|
217
217
|
Object.defineProperty(exports, "BriefedFile", { enumerable: true, get: function () { return reviewer_instructions_1.BriefedFile; } });
|
|
218
218
|
Object.defineProperty(exports, "ContextEntry", { enumerable: true, get: function () { return reviewer_instructions_1.ContextEntry; } });
|
|
219
|
+
Object.defineProperty(exports, "READ_TRUNCATION_LINES", { enumerable: true, get: function () { return reviewer_instructions_1.READ_TRUNCATION_LINES; } });
|
|
220
|
+
Object.defineProperty(exports, "ALL_DIFF_ONE_READ_LINES", { enumerable: true, get: function () { return reviewer_instructions_1.ALL_DIFF_ONE_READ_LINES; } });
|
|
219
221
|
var gate_token_1 = require("./gate-token");
|
|
220
222
|
Object.defineProperty(exports, "GateTokenService", { enumerable: true, get: function () { return gate_token_1.GateTokenService; } });
|
|
221
223
|
Object.defineProperty(exports, "computeGateToken", { enumerable: true, get: function () { return gate_token_1.computeGateToken; } });
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,iCAA0E;AAAjE,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAC3C,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,uCAA6D;AAApD,oGAAA,QAAQ,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,mGAAA,OAAO,OAAA;AACxC,uCAAqC;AAA5B,mGAAA,OAAO,OAAA;AAChB,uCAAqC;AAA5B,mGAAA,OAAO,OAAA;AAChB,6CAA4E;AAAnE,8GAAA,eAAe,OAAA;AAAE,2GAAA,YAAY,OAAA;AAAE,2GAAA,YAAY,OAAA;AACpD,6CAAkJ;AAAzI,6GAAA,cAAc,OAAA;AAAE,8GAAA,eAAe,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,iHAAA,kBAAkB,OAAA;AAAE,oHAAA,qBAAqB,OAAA;AAAE,w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OAAA;AACzB,iIAAA,8BAA8B,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\nexport { InformAiError } from './inform-ai-error';\nexport { RuleFailError } from './rule-fail-error';\nexport { CliExitError } from './cli-exit-error';\nexport { CliUsage, CliArgsCheck, CliArgs } from './cli-args';\nexport { runMain } from './run-main';\nexport { toError } from './to-error';\nexport { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';\nexport { findConfigFile, CONFIG_FILENAME, ConfigFile, ConfigParseAttempt, CONFIG_PARSE_ATTEMPTS, CONFIG_PARSE_RETRY_MILLIS } from './config-file';\nexport { RepoRootFinder, INSTRUCT_AI_DIR, INSTRUCT_AI_LEAF } from './repo-root';\n// The scoped `.webpieces` resolver. EVERY reader/writer of `.webpieces/...` goes through one of its two\n// named methods so the call site declares whether the state is repo-wide or worktree-private.\nexport { DotWebpieces, dotWebpieces, GitDirs, WORKTREE_STATE_DIR } from './state-dir';\nexport { StateDirMigrator, StateMigrationReport } from './state-dir-migration';\nexport { AtomicFile } from './atomic-file';\nexport { RulesConfigDesign } from './rules-config-design';\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './di';\nexport { ExcludePaths } from './exclude-hook-paths';\nexport { isPathExcluded, matchesAnyGlob } from './exclude-paths';\nexport { defaultRules, defaultRulesDir } from './default-rules';\nexport { loadTemplate, writeTemplateIfMissing, writeTemplate, TemplateWriter } from './load-template';\nexport { validateWebpiecesConfig, validatePrGateSection, validateChecklistsSection, validateSectionPlacement, validateCommandsSection, validateExcludePaths, validateMatchRulesSection, allRuleNames } from './validate-config';\nexport { validateChecklistDocs } from './checklist-docs-validator';\nexport {\n MatchRuleConfig,\n MatchRuleViolation,\n findMatchRuleViolations,\n isMatchRuleAllowedPath,\n compileMatchRulePatterns,\n renderMatchRuleMessage,\n DEFAULT_MATCH_RULES,\n} from './match-rules-config';\nexport type { ConfigSection } from './sections';\nexport { HOOK_GUARD_NAMES, isHookGuard, sectionForRule } from './sections';\nexport { FieldDef } from './field-def';\nexport type { SchemaShape } from './field-def';\nexport { shouldSkipRule, getCurrentBranch } from './skip-rule';\nexport type { SkipRuleResult } from './skip-rule';\nexport {\n detectBase,\n resolveBase,\n getChangedFiles,\n getFileDiff,\n getChangedLineNumbers,\n findNewMethodSignaturesInDiff,\n hasChangesInRange,\n isNewOrModified,\n DiffScope,\n DiffRange,\n ChangedFilesOptions,\n} from './diff-scope';\nexport { AbstractRule } from './abstract-rule';\nexport {\n WEBPIECES_DISABLE,\n RULE_NAMES,\n hasDisable,\n WEBPIECES_TMP_DIR,\n MERGE_INFO_DIR,\n PR_REVIEW_DIR,\n MERGE_IN_PROGRESS_FILE,\n MERGE_EXPLANATION_FILE,\n} from './constants';\nexport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nexport {\n SyncFlowGuidance,\n WP_START_UPDATE,\n WP_FINISH_UPDATE,\n WP_START_UPSERT_PR,\n WP_FINISH_UPSERT_PR,\n} from './sync-flow-guidance';\nexport {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoCustomCssConfig,\n NoProcessExitOutsideMainConfig,\n NoFunctionOutsideClassConfig,\n InjectAnnotationNotNeededForConcreteClassConfig,\n FrameworkTagConfig,\n RoleTagConfig,\n BranchCreationGuardConfig,\n PrCreationOrPushGuardConfig,\n MergeInProgressGuardConfig,\n PrMergeGuardConfig,\n RedirectHowToMergeMainConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NxWiringConfig,\n DiGraphConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n ValidateArchitectureUnchangedConfig,\n ValidateNoArchitectureCyclesConfig,\n ValidatePackageJsonConfig,\n ValidateVersionsLockedConfig,\n ValidateEslintSyncConfig,\n BaseRuleConfig,\n} from './rule-configs';\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\nexport {\n METHOD_LIMIT_MODES,\n FILE_LIMIT_MODES,\n RETURN_TYPE_MODES,\n INLINE_TYPE_MODES,\n MODIFIED_CODE_MODES,\n PROJECT_MODES,\n PRISMA_DTOS_MODES,\n PRISMA_CONVERTER_MODES,\n DIRECT_API_RESOLVER_MODES,\n THROW_CAUSE_MODES,\n ON_OFF_MODES,\n STRUCTURAL_MODES,\n VALIDATE_TS_MODES,\n} from './rule-configs';\nexport {\n NoClientCreationOutsideServerOrClientConfig,\n CLIENT_CREATION_SEVERITIES,\n} from './no-client-creation-config';\nexport type { ClientCreationSeverity } from './no-client-creation-config';\nexport type {\n MethodLimitMode,\n FileLimitMode,\n ReturnTypeMode,\n InlineTypeMode,\n ModifiedCodeMode,\n ProjectMode,\n PrismaValidateDtosMode,\n PrismaConverterMode,\n DirectApiResolverMode,\n ThrowCauseMode,\n OnOffMode,\n StructuralMode,\n ValidateTsMode,\n} from './rule-configs';\nexport {\n FeatureBranchGuardConfig,\n ReadStaleGuardConfig,\n MergedBranchBashGuardConfig,\n StaleMainBashGuardConfig,\n} from './main-sync-guard-configs';\nexport {\n GateDefinition,\n PrGateConfig,\n LandPrConfig,\n ReviewContextEntry,\n defaultGates,\n defaultPrGateConfig,\n defaultLandPrConfig,\n buildPrGateConfig,\n buildLandPrConfig,\n MERGE_MODE_AUTO,\n MERGE_MODE_NONE,\n MERGE_MODES,\n} from './pr-gate-config';\nexport {\n ChecklistDefinition,\n toChecklist,\n normalizeChecklistDoc,\n formatFileList,\n} from './checklist-config';\nexport type { RawChecklistItem } from './checklist-config';\nexport { ChecklistValidator } from './checklist-validator';\nexport { ChecklistInstructionsService } from './checklist-instructions';\nexport {\n ReviewerInstructionsService,\n ReviewerBriefing,\n BriefedFile,\n ContextEntry,\n} from './reviewer-instructions';\nexport {\n GateTokenService,\n computeGateToken,\n gateTokenMarker,\n extractGateToken,\n verifyGateToken,\n} from './gate-token';\nexport {\n SubagentProvenanceService,\n ReviewerEvidence,\n EvidenceRequest,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-provenance';\nexport {\n ReviewProvenanceService,\n ReviewProvenance,\n ReviewerTranscript,\n ReviewerPaths,\n OfferedContext,\n ProvenanceWriteRequest,\n DEFAULT_RETENTION_DAYS,\n} from './review-provenance';\nexport {\n ReviewJson,\n PrContext,\n ChecklistResult,\n ChecklistVerdict,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_RED,\n VERDICT_STATUSES,\n RequiredChecklist,\n ChecklistReviewContext,\n ReviewJsonService,\n loadReviewJson,\n prDirFor,\n reviewJsonPath,\n reviewJsonSchemaHint,\n} from './review-json';\nexport {\n MainSyncStatus,\n MainSyncLock,\n MainSyncStatusService,\n DEFAULT_HANG_TIMEOUT_MINUTES,\n mainSyncStatusPath,\n mainSyncLockPath,\n readMainSyncStatus,\n writeMainSyncStatus,\n readMainSyncLock,\n writeMainSyncLock,\n isLockStale,\n isRefreshInProgress,\n tryAcquireMainSyncLock,\n inProcessLock,\n finishedLock,\n computeMainSyncStatus,\n stampCleanMainSyncStatus,\n squashRecoverySteps,\n} from './main-sync-status';\nexport {\n MergedBranch,\n DeletableBranch,\n DeletableWorktree,\n MergedBranchesCache,\n MergedBranchesService,\n CacheFreshness,\n CACHE_STALE_AFTER_MS,\n CLASSIFICATION_MERGED_PR,\n CLASSIFICATION_BACKUP_OF_MERGED,\n CLASSIFICATION_BACKUP_OF_LIVE,\n CLASSIFICATION_NO_COMMITS,\n CLASSIFICATION_SUPERSEDED,\n CLASSIFICATION_CONTENT_IN_MAIN,\n CLASSIFICATION_NEVER_PROPOSED,\n CLASSIFICATION_IN_USE,\n CLASSIFICATION_PRUNABLE,\n CLASSIFICATION_LOCKED,\n CLASSIFICATION_CURRENT,\n CLASSIFICATION_DETACHED,\n PROMPTABLE_CLASSIFICATIONS,\n} from './merged-branches';\nexport {\n BranchArchiver,\n ArchiveResult,\n ARCHIVE_TAG_PREFIX,\n BRANCH_RETENTIONS,\n BRANCH_RETENTION_DELETE,\n BRANCH_RETENTION_ARCHIVE_TAG,\n BRANCH_RETENTION_KEEP,\n} from './branch-archiver';\nexport {\n Worktree,\n WorktreeService,\n} from './worktrees';\nexport {\n ReapedBranch,\n ReapResult,\n BranchReaper,\n} from './branch-reaper';\nexport {\n ReapedWorktree,\n WorktreeReapResult,\n WorktreeReaper,\n} from './worktree-reaper';\nexport type { MutationVerb, MutationPhase } from './branch-mutation-log';\nexport {\n BranchMutationEvent,\n BranchMutationLog,\n branchMutationLogPath,\n logBranchMutation,\n} from './branch-mutation-log';\nexport {\n CommandsConfig,\n buildCommandsConfig,\n DEFAULT_UPSERT_PR_COMMAND,\n DEFAULT_MERGE_COMPLETE_COMMAND,\n} from './commands-config';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,iCAA0E;AAAjE,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAC3C,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,uCAA6D;AAApD,oGAAA,QAAQ,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,mGAAA,OAAO,OAAA;AACxC,uCAAqC;AAA5B,mGAAA,OAAO,OAAA;AAChB,uCAAqC;AAA5B,mGAAA,OAAO,OAAA;AAChB,6CAA4E;AAAnE,8GAAA,eAAe,OAAA;AAAE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AAkB,OAAA;AAClB,iHAAA,cAAc,OAAA;AAGlB,6DAK+B;AAJ3B,0HAAA,mBAAmB,OAAA;AACnB,wHAAA,iBAAiB,OAAA;AACjB,4HAAA,qBAAqB,OAAA;AACrB,wHAAA,iBAAiB,OAAA;AAErB,qDAK2B;AAJvB,iHAAA,cAAc,OAAA;AACd,sHAAA,mBAAmB,OAAA;AACnB,4HAAA,yBAAyB,OAAA;AACzB,iIAAA,8BAA8B,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\nexport { InformAiError } from './inform-ai-error';\nexport { RuleFailError } from './rule-fail-error';\nexport { CliExitError } from './cli-exit-error';\nexport { CliUsage, CliArgsCheck, CliArgs } from './cli-args';\nexport { runMain } from './run-main';\nexport { toError } from './to-error';\nexport { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';\nexport { findConfigFile, CONFIG_FILENAME, ConfigFile, ConfigParseAttempt, CONFIG_PARSE_ATTEMPTS, CONFIG_PARSE_RETRY_MILLIS } from './config-file';\nexport { RepoRootFinder, INSTRUCT_AI_DIR, INSTRUCT_AI_LEAF } from './repo-root';\n// The scoped `.webpieces` resolver. EVERY reader/writer of `.webpieces/...` goes through one of its two\n// named methods so the call site declares whether the state is repo-wide or worktree-private.\nexport { DotWebpieces, dotWebpieces, GitDirs, WORKTREE_STATE_DIR } from './state-dir';\nexport { StateDirMigrator, StateMigrationReport } from './state-dir-migration';\nexport { AtomicFile } from './atomic-file';\nexport { RulesConfigDesign } from './rules-config-design';\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './di';\nexport { ExcludePaths } from './exclude-hook-paths';\nexport { isPathExcluded, matchesAnyGlob } from './exclude-paths';\nexport { defaultRules, defaultRulesDir } from './default-rules';\nexport { loadTemplate, writeTemplateIfMissing, writeTemplate, TemplateWriter } from './load-template';\nexport { validateWebpiecesConfig, validatePrGateSection, validateChecklistsSection, validateSectionPlacement, validateCommandsSection, validateExcludePaths, validateMatchRulesSection, allRuleNames } from './validate-config';\nexport { validateChecklistDocs } from './checklist-docs-validator';\nexport {\n MatchRuleConfig,\n MatchRuleViolation,\n findMatchRuleViolations,\n isMatchRuleAllowedPath,\n compileMatchRulePatterns,\n renderMatchRuleMessage,\n DEFAULT_MATCH_RULES,\n} from './match-rules-config';\nexport type { ConfigSection } from './sections';\nexport { HOOK_GUARD_NAMES, isHookGuard, sectionForRule } from './sections';\nexport { FieldDef } from './field-def';\nexport type { SchemaShape } from './field-def';\nexport { shouldSkipRule, getCurrentBranch } from './skip-rule';\nexport type { SkipRuleResult } from './skip-rule';\nexport {\n detectBase,\n resolveBase,\n getChangedFiles,\n getFileDiff,\n getChangedLineNumbers,\n findNewMethodSignaturesInDiff,\n hasChangesInRange,\n isNewOrModified,\n DiffScope,\n DiffRange,\n ChangedFilesOptions,\n} from './diff-scope';\nexport { AbstractRule } from './abstract-rule';\nexport {\n WEBPIECES_DISABLE,\n RULE_NAMES,\n hasDisable,\n WEBPIECES_TMP_DIR,\n MERGE_INFO_DIR,\n PR_REVIEW_DIR,\n MERGE_IN_PROGRESS_FILE,\n MERGE_EXPLANATION_FILE,\n} from './constants';\nexport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nexport {\n SyncFlowGuidance,\n WP_START_UPDATE,\n WP_FINISH_UPDATE,\n WP_START_UPSERT_PR,\n WP_FINISH_UPSERT_PR,\n} from './sync-flow-guidance';\nexport {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoCustomCssConfig,\n NoProcessExitOutsideMainConfig,\n NoFunctionOutsideClassConfig,\n InjectAnnotationNotNeededForConcreteClassConfig,\n FrameworkTagConfig,\n RoleTagConfig,\n BranchCreationGuardConfig,\n PrCreationOrPushGuardConfig,\n MergeInProgressGuardConfig,\n PrMergeGuardConfig,\n RedirectHowToMergeMainConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NxWiringConfig,\n DiGraphConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n ValidateArchitectureUnchangedConfig,\n ValidateNoArchitectureCyclesConfig,\n ValidatePackageJsonConfig,\n ValidateVersionsLockedConfig,\n ValidateEslintSyncConfig,\n BaseRuleConfig,\n} from './rule-configs';\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\nexport {\n METHOD_LIMIT_MODES,\n FILE_LIMIT_MODES,\n RETURN_TYPE_MODES,\n INLINE_TYPE_MODES,\n MODIFIED_CODE_MODES,\n PROJECT_MODES,\n PRISMA_DTOS_MODES,\n PRISMA_CONVERTER_MODES,\n DIRECT_API_RESOLVER_MODES,\n THROW_CAUSE_MODES,\n ON_OFF_MODES,\n STRUCTURAL_MODES,\n VALIDATE_TS_MODES,\n} from './rule-configs';\nexport {\n NoClientCreationOutsideServerOrClientConfig,\n CLIENT_CREATION_SEVERITIES,\n} from './no-client-creation-config';\nexport type { ClientCreationSeverity } from './no-client-creation-config';\nexport type {\n MethodLimitMode,\n FileLimitMode,\n ReturnTypeMode,\n InlineTypeMode,\n ModifiedCodeMode,\n ProjectMode,\n PrismaValidateDtosMode,\n PrismaConverterMode,\n DirectApiResolverMode,\n ThrowCauseMode,\n OnOffMode,\n StructuralMode,\n ValidateTsMode,\n} from './rule-configs';\nexport {\n FeatureBranchGuardConfig,\n ReadStaleGuardConfig,\n MergedBranchBashGuardConfig,\n StaleMainBashGuardConfig,\n} from './main-sync-guard-configs';\nexport {\n GateDefinition,\n PrGateConfig,\n LandPrConfig,\n ReviewContextEntry,\n defaultGates,\n defaultPrGateConfig,\n defaultLandPrConfig,\n buildPrGateConfig,\n buildLandPrConfig,\n MERGE_MODE_AUTO,\n MERGE_MODE_NONE,\n MERGE_MODES,\n} from './pr-gate-config';\nexport {\n ChecklistDefinition,\n toChecklist,\n normalizeChecklistDoc,\n formatFileList,\n} from './checklist-config';\nexport type { RawChecklistItem } from './checklist-config';\nexport { ChecklistValidator } from './checklist-validator';\nexport { ChecklistInstructionsService } from './checklist-instructions';\nexport {\n ReviewerInstructionsService,\n ReviewerBriefing,\n BriefedFile,\n ContextEntry,\n READ_TRUNCATION_LINES,\n ALL_DIFF_ONE_READ_LINES,\n} from './reviewer-instructions';\nexport {\n GateTokenService,\n computeGateToken,\n gateTokenMarker,\n extractGateToken,\n verifyGateToken,\n} from './gate-token';\nexport {\n SubagentProvenanceService,\n ReviewerEvidence,\n EvidenceRequest,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-provenance';\nexport {\n ReviewProvenanceService,\n ReviewProvenance,\n ReviewerTranscript,\n ReviewerPaths,\n OfferedContext,\n ProvenanceWriteRequest,\n DEFAULT_RETENTION_DAYS,\n} from './review-provenance';\nexport {\n ReviewJson,\n PrContext,\n ChecklistResult,\n ChecklistVerdict,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_RED,\n VERDICT_STATUSES,\n RequiredChecklist,\n ChecklistReviewContext,\n ReviewJsonService,\n loadReviewJson,\n prDirFor,\n reviewJsonPath,\n reviewJsonSchemaHint,\n} from './review-json';\nexport {\n MainSyncStatus,\n MainSyncLock,\n MainSyncStatusService,\n DEFAULT_HANG_TIMEOUT_MINUTES,\n mainSyncStatusPath,\n mainSyncLockPath,\n readMainSyncStatus,\n writeMainSyncStatus,\n readMainSyncLock,\n writeMainSyncLock,\n isLockStale,\n isRefreshInProgress,\n tryAcquireMainSyncLock,\n inProcessLock,\n finishedLock,\n computeMainSyncStatus,\n stampCleanMainSyncStatus,\n squashRecoverySteps,\n} from './main-sync-status';\nexport {\n MergedBranch,\n DeletableBranch,\n DeletableWorktree,\n MergedBranchesCache,\n MergedBranchesService,\n CacheFreshness,\n CACHE_STALE_AFTER_MS,\n CLASSIFICATION_MERGED_PR,\n CLASSIFICATION_BACKUP_OF_MERGED,\n CLASSIFICATION_BACKUP_OF_LIVE,\n CLASSIFICATION_NO_COMMITS,\n CLASSIFICATION_SUPERSEDED,\n CLASSIFICATION_CONTENT_IN_MAIN,\n CLASSIFICATION_NEVER_PROPOSED,\n CLASSIFICATION_IN_USE,\n CLASSIFICATION_PRUNABLE,\n CLASSIFICATION_LOCKED,\n CLASSIFICATION_CURRENT,\n CLASSIFICATION_DETACHED,\n PROMPTABLE_CLASSIFICATIONS,\n} from './merged-branches';\nexport {\n BranchArchiver,\n ArchiveResult,\n ARCHIVE_TAG_PREFIX,\n BRANCH_RETENTIONS,\n BRANCH_RETENTION_DELETE,\n BRANCH_RETENTION_ARCHIVE_TAG,\n BRANCH_RETENTION_KEEP,\n} from './branch-archiver';\nexport {\n Worktree,\n WorktreeService,\n} from './worktrees';\nexport {\n ReapedBranch,\n ReapResult,\n BranchReaper,\n} from './branch-reaper';\nexport {\n ReapedWorktree,\n WorktreeReapResult,\n WorktreeReaper,\n} from './worktree-reaper';\nexport type { MutationVerb, MutationPhase } from './branch-mutation-log';\nexport {\n BranchMutationEvent,\n BranchMutationLog,\n branchMutationLogPath,\n logBranchMutation,\n} from './branch-mutation-log';\nexport {\n CommandsConfig,\n buildCommandsConfig,\n DEFAULT_UPSERT_PR_COMMAND,\n DEFAULT_MERGE_COMPLETE_COMMAND,\n} from './commands-config';\n"]}
|
|
@@ -6,11 +6,22 @@ export declare class ContextEntry {
|
|
|
6
6
|
note: string;
|
|
7
7
|
constructor(label: string, entryPath: string, note?: string);
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* One reviewer's matched file, the extracted diff for it, AND the absolute path of the file itself.
|
|
11
|
+
*
|
|
12
|
+
* `sourcePath` exists because of a measured 0/4: four reviewers on one PR read the diff and not one opened a
|
|
13
|
+
* single full source file. The instructions handed them an absolute path per diff and only a parent DIRECTORY
|
|
14
|
+
* per source, so reading the diff was a paste and reading the source was "join this dir to that filename
|
|
15
|
+
* yourself". Identical affordance, or the cheaper one wins every time. Data-only.
|
|
16
|
+
*/
|
|
10
17
|
export declare class BriefedFile {
|
|
11
18
|
file: string;
|
|
12
19
|
diffPath: string;
|
|
13
|
-
|
|
20
|
+
sourcePath: string;
|
|
21
|
+
status: string;
|
|
22
|
+
diffBytes: number;
|
|
23
|
+
truncated: boolean;
|
|
24
|
+
constructor(file: string, diffPath: string, sourcePath?: string, status?: string, diffBytes?: number, truncated?: boolean);
|
|
14
25
|
}
|
|
15
26
|
/**
|
|
16
27
|
* Everything ONE reviewer needs, with every path already resolved to an ABSOLUTE one.
|
|
@@ -34,8 +45,24 @@ export declare class ReviewerBriefing {
|
|
|
34
45
|
checklistId: string;
|
|
35
46
|
fileDiffCommand: string;
|
|
36
47
|
dirty: boolean;
|
|
48
|
+
changedFileCount: number;
|
|
49
|
+
truncatedCount: number;
|
|
50
|
+
excludedCount: number;
|
|
51
|
+
allDiffLines: number;
|
|
52
|
+
allDiffBytes: number;
|
|
53
|
+
hashForkPoint: string;
|
|
54
|
+
hashFeatureHead: string;
|
|
55
|
+
hashMainHead: string;
|
|
56
|
+
ownAgentFileInDiff: string;
|
|
37
57
|
constructor(subagent: string, checklistId: string, repoRoot: string);
|
|
38
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* The Read tool truncates at roughly this many lines, silently. Any path this file prints alongside a bigger
|
|
61
|
+
* line count has to say so, or a reviewer reviews a fraction of a change and reports on all of it.
|
|
62
|
+
*/
|
|
63
|
+
export declare const READ_TRUNCATION_LINES = 2000;
|
|
64
|
+
/** Comfortably under {@link READ_TRUNCATION_LINES} — the size at which ALL.diff really is one clean Read. */
|
|
65
|
+
export declare const ALL_DIFF_ONE_READ_LINES = 1500;
|
|
39
66
|
/**
|
|
40
67
|
* Renders the per-reviewer instructions file that `wp-review-upsert-pr` writes to
|
|
41
68
|
* `.webpieces/pr-review/<feature>/instructions/<subagent>.instructions.md`.
|
|
@@ -63,13 +90,61 @@ export declare class ReviewerInstructionsService {
|
|
|
63
90
|
pathFor(repoRoot: string, featureName: string, subagent: string): string;
|
|
64
91
|
render(briefing: ReviewerBriefing): string;
|
|
65
92
|
private identity;
|
|
93
|
+
/**
|
|
94
|
+
* Every PR that edits the review gate hits this: on the measured run, 5 of 8 changed files were the
|
|
95
|
+
* reviewer agent files themselves, two reviewers reviewed their OWN definition, and neither flagged it —
|
|
96
|
+
* neither had any guidance to. Detected by the tooling rather than left to the reviewer to notice.
|
|
97
|
+
*/
|
|
98
|
+
private selfEditWarning;
|
|
66
99
|
private checklistSection;
|
|
67
100
|
/**
|
|
68
|
-
* The change itself. The
|
|
69
|
-
*
|
|
101
|
+
* The change itself. The MANIFEST leads, and the per-file table with it; `ALL.diff` is demoted to one
|
|
102
|
+
* option among several, recommended only where it is actually the right read.
|
|
103
|
+
*
|
|
104
|
+
* That ordering is the fix for a measured 4/4 failure. `ALL.diff` used to be bolded, first, and framed as
|
|
105
|
+
* "everything", with the manifest one unbolded line below it called a "path map" — which reads like a
|
|
106
|
+
* lookup aid, not something to open. All four reviewers on that PR read `ALL.diff`, none opened the
|
|
107
|
+
* manifest, and none could therefore have established that the combined view was complete. Reviewers did
|
|
108
|
+
* exactly what the emphasis told them to; so the emphasis moved.
|
|
70
109
|
*/
|
|
71
110
|
private diffSection;
|
|
111
|
+
/**
|
|
112
|
+
* The manifest, named as the authority AND with its own headline facts inlined. Inlining them is the
|
|
113
|
+
* point: a reviewer that never opens the manifest still learns whether anything was truncated or
|
|
114
|
+
* excluded, which is the one thing it could not otherwise have known it was missing.
|
|
115
|
+
*/
|
|
116
|
+
private manifestLines;
|
|
117
|
+
/**
|
|
118
|
+
* What the diff is taken AGAINST. Two bare shas in a `git diff` command said nothing about this, so a
|
|
119
|
+
* reviewer could not tell a fork-point diff from a diff against main's current tip — and therefore could
|
|
120
|
+
* not tell that anything merged to main since the fork is simply absent from what it is judging.
|
|
121
|
+
* Rendering C beside A makes "main has moved" self-evident exactly when it has.
|
|
122
|
+
*/
|
|
123
|
+
private basisLines;
|
|
124
|
+
/**
|
|
125
|
+
* Source and diff get IDENTICAL affordance — an absolute path each, in adjacent columns. The previous
|
|
126
|
+
* table gave an absolute path for the diff and nothing for the source, and the source went unread 4/4.
|
|
127
|
+
*/
|
|
72
128
|
private myFilesTable;
|
|
129
|
+
/**
|
|
130
|
+
* One row. A truncated or excluded diff is flagged HERE, in the row, not left as a field inside a file the
|
|
131
|
+
* reviewer has to think to open — and an oversized diff states the line count that makes a single Read
|
|
132
|
+
* come back silently incomplete.
|
|
133
|
+
*/
|
|
134
|
+
private fileRow;
|
|
135
|
+
/**
|
|
136
|
+
* `ALL.diff`, recommended ONLY where it is the right read. It is kept — for a patternless reviewer on a
|
|
137
|
+
* small diff it is genuinely one Read instead of N, which is why all four used it — but the blanket
|
|
138
|
+
* "everything on this branch" line was wrong in two different ways at once: it invited a pattern-scoped
|
|
139
|
+
* reviewer to spend its budget on files it was explicitly not asked about, and it pointed a reviewer on a
|
|
140
|
+
* large PR at a file that cannot survive one Read.
|
|
141
|
+
*/
|
|
142
|
+
private allDiffLines;
|
|
143
|
+
/**
|
|
144
|
+
* The rule that used to say "when you need to", and lost 4/4 to the more emphatic budget section 40 lines
|
|
145
|
+
* later. "When you need to" delegates the judgment to a reviewer that, by construction, does not yet know
|
|
146
|
+
* what it is missing. It has no opt-out now.
|
|
147
|
+
*/
|
|
73
148
|
private sourceSection;
|
|
74
149
|
/**
|
|
75
150
|
* The section that deletes the `node_modules` greps. Entries come from config, because the tooling
|
|
@@ -82,5 +157,13 @@ export declare class ReviewerInstructionsService {
|
|
|
82
157
|
* reviewer's own checklist id so there is nothing to substitute and nothing to get wrong.
|
|
83
158
|
*/
|
|
84
159
|
private verdictSection;
|
|
160
|
+
/**
|
|
161
|
+
* The anti-hunting rule, with the changed files carved out explicitly.
|
|
162
|
+
*
|
|
163
|
+
* It used to read as "stay inside what you were given" and, being the LAST thing in the file, it beat
|
|
164
|
+
* the source-reading instruction 4 times out of 4. It never distinguished HUNTING — greps into
|
|
165
|
+
* `node_modules`, re-deriving the dependency graph — from OPENING A FILE IT WAS EXPLICITLY HANDED. The
|
|
166
|
+
* distinction is now stated, because where two instructions conflict the later and more emphatic one wins.
|
|
167
|
+
*/
|
|
85
168
|
private budgetSection;
|
|
86
169
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReviewerInstructionsService = exports.ReviewerBriefing = exports.BriefedFile = exports.ContextEntry = void 0;
|
|
3
|
+
exports.ReviewerInstructionsService = exports.ALL_DIFF_ONE_READ_LINES = exports.READ_TRUNCATION_LINES = exports.ReviewerBriefing = exports.BriefedFile = exports.ContextEntry = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path = tslib_1.__importStar(require("path"));
|
|
6
6
|
const inversify_1 = require("inversify");
|
|
@@ -17,13 +17,29 @@ class ContextEntry {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.ContextEntry = ContextEntry;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* One reviewer's matched file, the extracted diff for it, AND the absolute path of the file itself.
|
|
22
|
+
*
|
|
23
|
+
* `sourcePath` exists because of a measured 0/4: four reviewers on one PR read the diff and not one opened a
|
|
24
|
+
* single full source file. The instructions handed them an absolute path per diff and only a parent DIRECTORY
|
|
25
|
+
* per source, so reading the diff was a paste and reading the source was "join this dir to that filename
|
|
26
|
+
* yourself". Identical affordance, or the cheaper one wins every time. Data-only.
|
|
27
|
+
*/
|
|
21
28
|
class BriefedFile {
|
|
22
29
|
file; // repo-relative source path
|
|
23
30
|
diffPath; // ABSOLUTE path of the extracted .diff
|
|
24
|
-
|
|
31
|
+
sourcePath; // ABSOLUTE path of the file itself; '' for a deleted file, which has no after-state
|
|
32
|
+
status; // 'M' | 'A' | 'D' | 'U' (untracked) | 'X' (excluded by config)
|
|
33
|
+
diffBytes;
|
|
34
|
+
truncated;
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
36
|
+
constructor(file, diffPath, sourcePath = '', status = 'M', diffBytes = 0, truncated = false) {
|
|
25
37
|
this.file = file;
|
|
26
38
|
this.diffPath = diffPath;
|
|
39
|
+
this.sourcePath = sourcePath;
|
|
40
|
+
this.status = status;
|
|
41
|
+
this.diffBytes = diffBytes;
|
|
42
|
+
this.truncated = truncated;
|
|
27
43
|
}
|
|
28
44
|
}
|
|
29
45
|
exports.BriefedFile = BriefedFile;
|
|
@@ -49,6 +65,18 @@ class ReviewerBriefing {
|
|
|
49
65
|
checklistId;
|
|
50
66
|
fileDiffCommand;
|
|
51
67
|
dirty;
|
|
68
|
+
// Facts ABOUT the manifest, surfaced inline so a reviewer learns the diff is complete without opening it.
|
|
69
|
+
changedFileCount;
|
|
70
|
+
truncatedCount;
|
|
71
|
+
excludedCount;
|
|
72
|
+
allDiffLines;
|
|
73
|
+
allDiffBytes;
|
|
74
|
+
// The three shas, by the names DiffManifest already uses. Printing two bare shas told a reviewer nothing
|
|
75
|
+
// about WHAT the diff is taken against; C beside A makes "main has moved since the fork" self-evident.
|
|
76
|
+
hashForkPoint;
|
|
77
|
+
hashFeatureHead;
|
|
78
|
+
hashMainHead;
|
|
79
|
+
ownAgentFileInDiff; // ABSOLUTE path when this diff edits THIS reviewer's own agent file; '' otherwise
|
|
52
80
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
53
81
|
constructor(subagent, checklistId, repoRoot) {
|
|
54
82
|
this.subagent = subagent;
|
|
@@ -65,9 +93,25 @@ class ReviewerBriefing {
|
|
|
65
93
|
this.verdictPath = '';
|
|
66
94
|
this.fileDiffCommand = '';
|
|
67
95
|
this.dirty = false;
|
|
96
|
+
this.changedFileCount = 0;
|
|
97
|
+
this.truncatedCount = 0;
|
|
98
|
+
this.excludedCount = 0;
|
|
99
|
+
this.allDiffLines = 0;
|
|
100
|
+
this.allDiffBytes = 0;
|
|
101
|
+
this.hashForkPoint = '';
|
|
102
|
+
this.hashFeatureHead = '';
|
|
103
|
+
this.hashMainHead = '';
|
|
104
|
+
this.ownAgentFileInDiff = '';
|
|
68
105
|
}
|
|
69
106
|
}
|
|
70
107
|
exports.ReviewerBriefing = ReviewerBriefing;
|
|
108
|
+
/**
|
|
109
|
+
* The Read tool truncates at roughly this many lines, silently. Any path this file prints alongside a bigger
|
|
110
|
+
* line count has to say so, or a reviewer reviews a fraction of a change and reports on all of it.
|
|
111
|
+
*/
|
|
112
|
+
exports.READ_TRUNCATION_LINES = 2000;
|
|
113
|
+
/** Comfortably under {@link READ_TRUNCATION_LINES} — the size at which ALL.diff really is one clean Read. */
|
|
114
|
+
exports.ALL_DIFF_ONE_READ_LINES = 1500;
|
|
71
115
|
/**
|
|
72
116
|
* Renders the per-reviewer instructions file that `wp-review-upsert-pr` writes to
|
|
73
117
|
* `.webpieces/pr-review/<feature>/instructions/<subagent>.instructions.md`.
|
|
@@ -117,13 +161,32 @@ let ReviewerInstructionsService = class ReviewerInstructionsService {
|
|
|
117
161
|
`# You are \`${b.subagent}\``,
|
|
118
162
|
'',
|
|
119
163
|
'Review as YOURSELF, against your own checklist — not as a general code reviewer.',
|
|
120
|
-
'You may not
|
|
164
|
+
'You may not write another reviewer\'s verdict file.',
|
|
165
|
+
'',
|
|
166
|
+
'"You may not review your own authorship" means: you did not write this diff, so review it — but if',
|
|
167
|
+
'the diff CHANGES YOU, say so in `output` rather than pretending the conflict is not there.',
|
|
168
|
+
...this.selfEditWarning(b),
|
|
121
169
|
'',
|
|
122
170
|
'_Generated per run by `wp-review-upsert-pr`. Everything below is already resolved for you; the',
|
|
123
171
|
'paths are absolute because your working directory is not guaranteed to be the repo root._',
|
|
124
172
|
'',
|
|
125
173
|
];
|
|
126
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* Every PR that edits the review gate hits this: on the measured run, 5 of 8 changed files were the
|
|
177
|
+
* reviewer agent files themselves, two reviewers reviewed their OWN definition, and neither flagged it —
|
|
178
|
+
* neither had any guidance to. Detected by the tooling rather than left to the reviewer to notice.
|
|
179
|
+
*/
|
|
180
|
+
selfEditWarning(b) {
|
|
181
|
+
if (b.ownAgentFileInDiff === '')
|
|
182
|
+
return [];
|
|
183
|
+
return [
|
|
184
|
+
'',
|
|
185
|
+
`⚠️ THIS DIFF MODIFIES YOUR OWN AGENT FILE: \`${b.ownAgentFileInDiff}\``,
|
|
186
|
+
'You are reviewing a change to your own definition. Review it anyway — and state that fact in',
|
|
187
|
+
'`output`, so a human reading your verdict knows the reviewer and the reviewed were the same thing.',
|
|
188
|
+
];
|
|
189
|
+
}
|
|
127
190
|
checklistSection(b) {
|
|
128
191
|
if (b.docPath === '') {
|
|
129
192
|
return ['## Your checklist', '', 'This checklist has no guidance doc — judge the diff on your own standards.', ''];
|
|
@@ -131,8 +194,14 @@ let ReviewerInstructionsService = class ReviewerInstructionsService {
|
|
|
131
194
|
return ['## Your checklist', '', `Read this FIRST: \`${b.docPath}\``, ''];
|
|
132
195
|
}
|
|
133
196
|
/**
|
|
134
|
-
* The change itself. The
|
|
135
|
-
*
|
|
197
|
+
* The change itself. The MANIFEST leads, and the per-file table with it; `ALL.diff` is demoted to one
|
|
198
|
+
* option among several, recommended only where it is actually the right read.
|
|
199
|
+
*
|
|
200
|
+
* That ordering is the fix for a measured 4/4 failure. `ALL.diff` used to be bolded, first, and framed as
|
|
201
|
+
* "everything", with the manifest one unbolded line below it called a "path map" — which reads like a
|
|
202
|
+
* lookup aid, not something to open. All four reviewers on that PR read `ALL.diff`, none opened the
|
|
203
|
+
* manifest, and none could therefore have established that the combined view was complete. Reviewers did
|
|
204
|
+
* exactly what the emphasis told them to; so the emphasis moved.
|
|
136
205
|
*/
|
|
137
206
|
diffSection(b) {
|
|
138
207
|
const lines = ['## The change you are reviewing', ''];
|
|
@@ -141,15 +210,7 @@ let ReviewerInstructionsService = class ReviewerInstructionsService {
|
|
|
141
210
|
lines.push('> commit-to-commit range would show. Judge it anyway — it is what your checklist matched.');
|
|
142
211
|
lines.push('');
|
|
143
212
|
}
|
|
144
|
-
|
|
145
|
-
lines.push(`**Everything on this branch, already extracted:** \`${b.allDiffPath}\``);
|
|
146
|
-
lines.push('');
|
|
147
|
-
}
|
|
148
|
-
lines.push(...this.myFilesTable(b));
|
|
149
|
-
if (b.manifestPath !== '') {
|
|
150
|
-
lines.push(`Path map (authoritative; records truncated + excluded files): \`${b.manifestPath}\``);
|
|
151
|
-
lines.push('');
|
|
152
|
-
}
|
|
213
|
+
lines.push(...this.manifestLines(b), ...this.basisLines(b), ...this.myFilesTable(b), ...this.allDiffLines(b));
|
|
153
214
|
if (b.fileDiffCommand !== '') {
|
|
154
215
|
lines.push(`Reproduce any single file: \`${b.fileDiffCommand}\``);
|
|
155
216
|
lines.push('');
|
|
@@ -159,26 +220,119 @@ let ReviewerInstructionsService = class ReviewerInstructionsService {
|
|
|
159
220
|
lines.push('');
|
|
160
221
|
return lines;
|
|
161
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* The manifest, named as the authority AND with its own headline facts inlined. Inlining them is the
|
|
225
|
+
* point: a reviewer that never opens the manifest still learns whether anything was truncated or
|
|
226
|
+
* excluded, which is the one thing it could not otherwise have known it was missing.
|
|
227
|
+
*/
|
|
228
|
+
manifestLines(b) {
|
|
229
|
+
if (b.manifestPath === '')
|
|
230
|
+
return [];
|
|
231
|
+
const warn = b.truncatedCount + b.excludedCount > 0 ? ' ⚠️ NOT everything is materialized — see the table.' : '';
|
|
232
|
+
return [
|
|
233
|
+
`**Path map — AUTHORITATIVE. Read this first:** \`${b.manifestPath}\``,
|
|
234
|
+
` ${b.changedFileCount} file(s) · ${b.truncatedCount} truncated · ${b.excludedCount} excluded${warn}`,
|
|
235
|
+
' Per file it carries: `status` (M/A/D/U/X), `bytes`, `file`/`fileAbs`, `diffFile`/`diffAbs`, and the',
|
|
236
|
+
' three shas below. It is the only place that records what was truncated or left out.',
|
|
237
|
+
'',
|
|
238
|
+
];
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* What the diff is taken AGAINST. Two bare shas in a `git diff` command said nothing about this, so a
|
|
242
|
+
* reviewer could not tell a fork-point diff from a diff against main's current tip — and therefore could
|
|
243
|
+
* not tell that anything merged to main since the fork is simply absent from what it is judging.
|
|
244
|
+
* Rendering C beside A makes "main has moved" self-evident exactly when it has.
|
|
245
|
+
*/
|
|
246
|
+
basisLines(b) {
|
|
247
|
+
if (b.hashForkPoint === '')
|
|
248
|
+
return [];
|
|
249
|
+
const sameAsFork = b.hashMainHead === b.hashForkPoint;
|
|
250
|
+
const cNote = b.hashMainHead === '' ? '(unresolved)'
|
|
251
|
+
: sameAsFork ? `${b.hashMainHead} ← same as A, so main has not moved since the fork`
|
|
252
|
+
: `${b.hashMainHead} ← main HAS MOVED since the fork`;
|
|
253
|
+
return [
|
|
254
|
+
'This diff is **fork-point → feature-head**, NOT a diff against main\'s current tip:',
|
|
255
|
+
'```',
|
|
256
|
+
`fork point (A) ${b.hashForkPoint}`,
|
|
257
|
+
`feature head (B) ${b.hashFeatureHead}`,
|
|
258
|
+
`main head (C) ${cNote}`,
|
|
259
|
+
'```',
|
|
260
|
+
'Anything merged to main after A is NOT in this diff.',
|
|
261
|
+
'',
|
|
262
|
+
];
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Source and diff get IDENTICAL affordance — an absolute path each, in adjacent columns. The previous
|
|
266
|
+
* table gave an absolute path for the diff and nothing for the source, and the source went unread 4/4.
|
|
267
|
+
*/
|
|
162
268
|
myFilesTable(b) {
|
|
163
269
|
if (b.myFiles.length === 0)
|
|
164
270
|
return ['_No files matched your patterns._', ''];
|
|
165
271
|
const why = b.matchedPatterns.length === 0
|
|
166
272
|
? `**In scope: ALL ${b.myFiles.length} changed file(s)** — your checklist has no \`patterns\`, so the whole diff is yours.`
|
|
167
273
|
: `**In scope: ${b.myFiles.length} file(s)** matching ${b.matchedPatterns.map((p) => `\`${p}\``).join(', ')}:`;
|
|
168
|
-
const rows = b.myFiles.map((f) =>
|
|
169
|
-
return [why, '', '| file | its diff |', '
|
|
274
|
+
const rows = b.myFiles.map((f) => this.fileRow(f));
|
|
275
|
+
return [why, '', '| file | status | its diff | full source |', '|---|---|---|---|', ...rows, ''];
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* One row. A truncated or excluded diff is flagged HERE, in the row, not left as a field inside a file the
|
|
279
|
+
* reviewer has to think to open — and an oversized diff states the line count that makes a single Read
|
|
280
|
+
* come back silently incomplete.
|
|
281
|
+
*/
|
|
282
|
+
fileRow(f) {
|
|
283
|
+
const flags = [];
|
|
284
|
+
if (f.truncated)
|
|
285
|
+
flags.push('⚠️ diff TRUNCATED — read the source');
|
|
286
|
+
if (f.status === 'X')
|
|
287
|
+
flags.push('⚠️ EXCLUDED, not materialized — read the source');
|
|
288
|
+
const status = [`\`${f.status}\``, ...flags].join(' ');
|
|
289
|
+
const source = f.sourcePath === '' ? '_deleted — no file on disk_' : `\`${f.sourcePath}\``;
|
|
290
|
+
return `| \`${f.file}\` | ${status} | \`${f.diffPath}\` (${f.diffBytes} bytes) | ${source} |`;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* `ALL.diff`, recommended ONLY where it is the right read. It is kept — for a patternless reviewer on a
|
|
294
|
+
* small diff it is genuinely one Read instead of N, which is why all four used it — but the blanket
|
|
295
|
+
* "everything on this branch" line was wrong in two different ways at once: it invited a pattern-scoped
|
|
296
|
+
* reviewer to spend its budget on files it was explicitly not asked about, and it pointed a reviewer on a
|
|
297
|
+
* large PR at a file that cannot survive one Read.
|
|
298
|
+
*/
|
|
299
|
+
allDiffLines(b) {
|
|
300
|
+
if (b.allDiffPath === '')
|
|
301
|
+
return [];
|
|
302
|
+
const size = b.allDiffLines === 0 ? '' : ` — ${b.allDiffLines} lines / ${b.allDiffBytes} bytes`;
|
|
303
|
+
if (b.matchedPatterns.length > 0) {
|
|
304
|
+
return [`The whole branch${size}, for CROSS-FILE CONTEXT if you need it: \`${b.allDiffPath}\``,
|
|
305
|
+
'Your own files above are what you are reviewing; the rest of the branch is someone else\'s checklist.', ''];
|
|
306
|
+
}
|
|
307
|
+
if (b.allDiffLines > exports.ALL_DIFF_ONE_READ_LINES) {
|
|
308
|
+
return [`⚠️ The combined diff is ${b.allDiffLines} lines and will NOT survive a single Read (the Read tool`,
|
|
309
|
+
`truncates at ~${exports.READ_TRUNCATION_LINES} lines, silently). Read the per-file diffs above instead, or page it:`,
|
|
310
|
+
`\`${b.allDiffPath}\``, ''];
|
|
311
|
+
}
|
|
312
|
+
return [`Whole-branch diff${size} — convenient at this size, but the per-file table above is authoritative:`,
|
|
313
|
+
`\`${b.allDiffPath}\``, ''];
|
|
170
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* The rule that used to say "when you need to", and lost 4/4 to the more emphatic budget section 40 lines
|
|
317
|
+
* later. "When you need to" delegates the judgment to a reviewer that, by construction, does not yet know
|
|
318
|
+
* what it is missing. It has no opt-out now.
|
|
319
|
+
*/
|
|
171
320
|
sourceSection(b) {
|
|
172
|
-
const lines = ['##
|
|
321
|
+
const lines = ['## Read the full source — every file, every time', '', `Repo root: \`${b.repoRoot}\``, ''];
|
|
322
|
+
lines.push('**READ THE FULL SOURCE OF EVERY FILE IN YOUR TABLE.** Not "if you need to" — every time.');
|
|
323
|
+
lines.push('A hunk shows what changed; only the whole file shows what it changed INTO, and a change that');
|
|
324
|
+
lines.push('looks fine in isolation can still be wrong in place.');
|
|
325
|
+
lines.push('');
|
|
326
|
+
lines.push('The `full source` column above is the path. For files marked `A` (added) you have already done');
|
|
327
|
+
lines.push('this: an add-diff IS the complete file, byte for byte, so its diff and its source are the same');
|
|
328
|
+
lines.push('text. For `M` (modified) and `D` (deleted) files the diff is a fragment — open the file.');
|
|
329
|
+
lines.push('');
|
|
173
330
|
if (b.sourceDirs.length > 0) {
|
|
174
|
-
lines.push('
|
|
331
|
+
lines.push('The neighbouring code lives under:');
|
|
175
332
|
for (const dir of b.sourceDirs)
|
|
176
333
|
lines.push(`- \`${dir}\``);
|
|
177
334
|
lines.push('');
|
|
178
335
|
}
|
|
179
|
-
lines.push('Read whole files around the diff when you need to. The diff is the SUBJECT; the surrounding');
|
|
180
|
-
lines.push('code is the CONTEXT — a change that looks fine in isolation can still be wrong in place.');
|
|
181
|
-
lines.push('');
|
|
182
336
|
return lines;
|
|
183
337
|
}
|
|
184
338
|
/**
|
|
@@ -187,8 +341,14 @@ let ReviewerInstructionsService = class ReviewerInstructionsService {
|
|
|
187
341
|
* installed to, and it must never drop an entry silently: a missing path is stated as missing.
|
|
188
342
|
*/
|
|
189
343
|
contextSection(b) {
|
|
190
|
-
|
|
191
|
-
|
|
344
|
+
// Emitting NOTHING made the section this class exists for look like a feature that does not exist.
|
|
345
|
+
// One line naming the config keys costs nothing and is the only hint a repo will ever get.
|
|
346
|
+
if (b.contextEntries.length === 0) {
|
|
347
|
+
return ['## Pre-resolved context', '',
|
|
348
|
+
'_None configured for this repo. If you find yourself hunting for the same path on every review,',
|
|
349
|
+
'it belongs in `pr-gate.reviewContext` / `pr-gate.reviewContextPackages` in `webpieces.config.json`._',
|
|
350
|
+
''];
|
|
351
|
+
}
|
|
192
352
|
const lines = ['## Pre-resolved context (do not go hunting for these)', ''];
|
|
193
353
|
for (const entry of b.contextEntries) {
|
|
194
354
|
const suffix = entry.note === '' ? '' : ` ${entry.note}`;
|
|
@@ -213,15 +373,27 @@ let ReviewerInstructionsService = class ReviewerInstructionsService {
|
|
|
213
373
|
'',
|
|
214
374
|
];
|
|
215
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* The anti-hunting rule, with the changed files carved out explicitly.
|
|
378
|
+
*
|
|
379
|
+
* It used to read as "stay inside what you were given" and, being the LAST thing in the file, it beat
|
|
380
|
+
* the source-reading instruction 4 times out of 4. It never distinguished HUNTING — greps into
|
|
381
|
+
* `node_modules`, re-deriving the dependency graph — from OPENING A FILE IT WAS EXPLICITLY HANDED. The
|
|
382
|
+
* distinction is now stated, because where two instructions conflict the later and more emphatic one wins.
|
|
383
|
+
*/
|
|
216
384
|
budgetSection() {
|
|
217
385
|
return [
|
|
218
386
|
'## Budget',
|
|
219
387
|
'',
|
|
220
|
-
'
|
|
221
|
-
'
|
|
222
|
-
'were not configured.
|
|
223
|
-
'
|
|
224
|
-
'
|
|
388
|
+
'Do NOT search `node_modules`, do NOT re-derive the dependency graph, and do NOT hunt the repo for',
|
|
389
|
+
'infrastructure config. That is hunting, and it is what wastes a review budget — those paths are',
|
|
390
|
+
'either given above or were not configured.',
|
|
391
|
+
'',
|
|
392
|
+
'Reading the full text of a file that is IN your table is NOT hunting — it is the review. Budget for',
|
|
393
|
+
'it: read the diff to see what changed, and the source to judge whether it is right in place.',
|
|
394
|
+
'',
|
|
395
|
+
'If something you genuinely need is missing, name it in `output` and give your verdict on what you',
|
|
396
|
+
'could actually see.',
|
|
225
397
|
'',
|
|
226
398
|
'Open your diff files before writing a verdict. `wp-finish-upsert-pr` reads your own transcript and',
|
|
227
399
|
'reports a verdict written without opening the diff. It also records the path of that transcript,',
|
|
@@ -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,GA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AC,CAAC;QACf,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;OAGG;IACK,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;IAEO,aAAa;QACjB,OAAO;YACH,WAAW;YACX,EAAE;YACF,oGAAoG;YACpG,mGAAmG;YACnG,oGAAoG;YACpG,gGAAgG;YAChG,iDAAiD;YACjD,EAAE;YACF,oGAAoG;YACpG,kGAAkG;YAClG,kGAAkG;YAClG,0FAA0F;SAC7F,CAAC;IACN,CAAC;CACJ,CAAA;AAvJY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEW,+BAAiB;GADxD,2BAA2B,CAuJvC","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/** One reviewer's matched file and the extracted diff for it. Data-only. */\nexport class BriefedFile {\n file: string; // repo-relative source path\n diffPath: string; // ABSOLUTE path of the extracted .diff\n\n constructor(file: string, diffPath: string) {\n this.file = file;\n this.diffPath = diffPath;\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\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 }\n}\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 review your own authorship, and you may not write another reviewer\\'s verdict file.',\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 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 materialized diff leads because it is ONE Read instead of a shell-out per file,\n * and because a hand-assembled range can come back empty (it did — see DiffBasis).\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 if (b.allDiffPath !== '') {\n lines.push(`**Everything on this branch, already extracted:** \\`${b.allDiffPath}\\``);\n lines.push('');\n }\n lines.push(...this.myFilesTable(b));\n if (b.manifestPath !== '') {\n lines.push(`Path map (authoritative; records truncated + excluded files): \\`${b.manifestPath}\\``);\n lines.push('');\n }\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 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 => `| \\`${f.file}\\` | \\`${f.diffPath}\\` |`);\n return [why, '', '| file | its diff |', '|---|---|', ...rows, ''];\n }\n\n private sourceSection(b: ReviewerBriefing): string[] {\n const lines = ['## Where the source lives', '', `Repo root: \\`${b.repoRoot}\\``, ''];\n if (b.sourceDirs.length > 0) {\n lines.push('Your matched files live under:');\n for (const dir of b.sourceDirs) lines.push(`- \\`${dir}\\``);\n lines.push('');\n }\n lines.push('Read whole files around the diff when you need to. The diff is the SUBJECT; the surrounding');\n lines.push('code is the CONTEXT — a change that looks fine in isolation can still be wrong in place.');\n lines.push('');\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 if (b.contextEntries.length === 0) return [];\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 private budgetSection(): string[] {\n return [\n '## Budget',\n '',\n 'Everything you need is listed above. Do NOT search `node_modules`, do NOT re-derive the dependency',\n 'graph, and do NOT hunt the repo for infrastructure config — those paths are either given above or',\n 'were not configured. If something you genuinely need is missing, name it in `output` and give your',\n 'verdict on what you could actually see. A reviewer that spends its budget searching produces a',\n 'thinner review than one that spends it reading.',\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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KAAK,UAAU,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9H,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;OAGG;IACK,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\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"]}
|