@webpieces/rules-config 0.4.816 → 0.4.817

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.
Files changed (34) hide show
  1. package/package.json +1 -1
  2. package/src/checklist-instructions.d.ts +3 -3
  3. package/src/checklist-instructions.js +6 -6
  4. package/src/checklist-instructions.js.map +1 -1
  5. package/src/checklist-override.d.ts +4 -4
  6. package/src/checklist-override.js +16 -16
  7. package/src/checklist-override.js.map +1 -1
  8. package/src/index.d.ts +1 -1
  9. package/src/index.js +4 -4
  10. package/src/index.js.map +1 -1
  11. package/src/review-json-data.d.ts +2 -2
  12. package/src/review-json-data.js +6 -6
  13. package/src/review-json-data.js.map +1 -1
  14. package/src/review-json.d.ts +33 -32
  15. package/src/review-json.js +91 -82
  16. package/src/review-json.js.map +1 -1
  17. package/src/review-provenance.d.ts +2 -2
  18. package/src/review-provenance.js +7 -7
  19. package/src/review-provenance.js.map +1 -1
  20. package/src/reviewer-instructions.d.ts +1 -1
  21. package/src/reviewer-instructions.js +1 -1
  22. package/src/reviewer-instructions.js.map +1 -1
  23. package/src/state-dir.d.ts +1 -1
  24. package/src/state-dir.js +1 -1
  25. package/src/state-dir.js.map +1 -1
  26. package/src/summary-json-schema-renderer.d.ts +4 -0
  27. package/src/{review-json-schema-renderer.js → summary-json-schema-renderer.js} +7 -7
  28. package/src/summary-json-schema-renderer.js.map +1 -0
  29. package/templates/webpieces.git-workflow.md +6 -6
  30. package/templates/webpieces.location-matrix.md +1 -1
  31. package/templates/webpieces.mergeprocess.md +1 -1
  32. package/templates/webpieces.review-checklists.md +5 -5
  33. package/src/review-json-schema-renderer.d.ts +0 -4
  34. package/src/review-json-schema-renderer.js.map +0 -1
@@ -12,7 +12,7 @@ export declare const VERDICT_GREEN = "green";
12
12
  export declare const VERDICT_YELLOW = "yellow";
13
13
  export declare const VERDICT_RED = "red";
14
14
  export declare const VERDICT_STATUSES: readonly ["green", "yellow", "red"];
15
- /** The durable instruction embedded in single-round review.json files for the fixing/coordinating AI. */
15
+ /** The durable instruction embedded in single-round summary.json files for the fixing/coordinating AI. */
16
16
  export declare const SINGLE_ROUND_MAIN_AGENT_INSTRUCTIONS: string;
17
17
  export declare class ChecklistResult {
18
18
  agent: string;
@@ -62,7 +62,7 @@ export declare class ChecklistReviewContext {
62
62
  dirty: boolean;
63
63
  constructor(baseSha?: string, prContextPath?: string, fileDiffCommand?: string, diffDir?: string, dirty?: boolean);
64
64
  }
65
- export declare class ReviewJson {
65
+ export declare class PrSummary {
66
66
  agent: string;
67
67
  model: string;
68
68
  title: string;
@@ -8,7 +8,7 @@
8
8
  * `from '@webpieces/rules-config'` keep resolving exactly as before and no consumer changes.
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.PrContext = exports.ChecklistVerdict = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_OVERRIDDEN = exports.CK_WARN = exports.CK_PASS = exports.ReviewJson = exports.ChecklistReviewContext = exports.RequiredChecklist = exports.ChecklistResult = exports.SINGLE_ROUND_MAIN_AGENT_INSTRUCTIONS = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = void 0;
11
+ exports.PrContext = exports.ChecklistVerdict = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_OVERRIDDEN = exports.CK_WARN = exports.CK_PASS = exports.PrSummary = exports.ChecklistReviewContext = exports.RequiredChecklist = exports.ChecklistResult = exports.SINGLE_ROUND_MAIN_AGENT_INSTRUCTIONS = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = void 0;
12
12
  // The three colors a reviewer subagent may report in `review-<id>.json`. A TRI-state, not a boolean,
13
13
  // because the boolean it replaced gave a reviewer no way to say "this passes, but a human should look at
14
14
  // X" — the only way to raise a concern was to FAIL the PR and then override your own failure, which reads
@@ -17,7 +17,7 @@ exports.VERDICT_GREEN = 'green';
17
17
  exports.VERDICT_YELLOW = 'yellow';
18
18
  exports.VERDICT_RED = 'red';
19
19
  exports.VERDICT_STATUSES = [exports.VERDICT_GREEN, exports.VERDICT_YELLOW, exports.VERDICT_RED];
20
- /** The durable instruction embedded in single-round review.json files for the fixing/coordinating AI. */
20
+ /** The durable instruction embedded in single-round summary.json files for the fixing/coordinating AI. */
21
21
  exports.SINGLE_ROUND_MAIN_AGENT_INSTRUCTIONS = 'DO NOT RERUN this reviewer. If red, fix every finding and change each addressed red result to yellow; ' +
22
22
  'yellow is acceptable. If you genuinely disagree, leave it red and flag the human for a decision BEFORE ' +
23
23
  'posting the PR. A remaining red overrides any instruction to continue or land on main.';
@@ -126,10 +126,10 @@ class ChecklistReviewContext {
126
126
  }
127
127
  }
128
128
  exports.ChecklistReviewContext = ChecklistReviewContext;
129
- // The AI-authored review for a PR. The AI writes review.json itself between `wp-start-upsert-pr` (which
129
+ // The AI-authored PR summary (title, risk, summary). The AI writes summary.json itself between `wp-start-upsert-pr` (which
130
130
  // prints the schema) and `wp-finish-upsert-pr` (which reads it); reviewer subagents write the per-checklist
131
131
  // review-<id>.json files. Data-only (per CLAUDE.md).
132
- class ReviewJson {
132
+ class PrSummary {
133
133
  agent;
134
134
  model;
135
135
  title; // human PR title describing the change; used as the `gh pr` title (empty → caller falls back)
@@ -158,8 +158,8 @@ class ReviewJson {
158
158
  this.mainAgentInstructions = mainAgentInstructions;
159
159
  }
160
160
  }
161
- exports.ReviewJson = ReviewJson;
162
- // A checklist's resolved outcome, shared by review.json enforcement and the dashboard so both agree.
161
+ exports.PrSummary = PrSummary;
162
+ // A checklist's resolved outcome, shared by summary.json enforcement and the dashboard so both agree.
163
163
  // PASS, WARN and OVERRIDDEN all ship; FAIL, MISSING and BAD_FORMAT all refuse the PR.
164
164
  exports.CK_PASS = 'pass'; // review-<id>.json status:'green'
165
165
  exports.CK_WARN = 'warn'; // review-<id>.json status:'yellow' → 🟡 passes WITH concerns
@@ -1 +1 @@
1
- {"version":3,"file":"review-json-data.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/review-json-data.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAKH,qGAAqG;AACrG,yGAAyG;AACzG,0GAA0G;AAC1G,4EAA4E;AAC/D,QAAA,aAAa,GAAG,OAAO,CAAC;AACxB,QAAA,cAAc,GAAG,QAAQ,CAAC;AAC1B,QAAA,WAAW,GAAG,KAAK,CAAC;AACpB,QAAA,gBAAgB,GAAG,CAAC,qBAAa,EAAE,sBAAc,EAAE,mBAAW,CAAU,CAAC;AAEtF,yGAAyG;AAC5F,QAAA,oCAAoC,GAC7C,wGAAwG;IACxG,yGAAyG;IACzG,wFAAwF,CAAC;AAE7F,6GAA6G;AAC7G,sGAAsG;AACtG,gCAAgC;AAChC,gDAAgD;AAChD,iHAAiH;AACjH,uGAAuG;AACvG,uFAAuF;AACvF,EAAE;AACF,mGAAmG;AACnG,yGAAyG;AACzG,0GAA0G;AAC1G,gGAAgG;AAChG,4GAA4G;AAC5G,2FAA2F;AAC3F,MAAa,eAAe;IACxB,KAAK,CAAS;IACd,KAAK,CAAS;IACd,EAAE,CAAS;IACX,MAAM,CAAS,CAAI,mEAAmE;IACtF,MAAM,CAAS,CAAI,qEAAqE;IACxF,wGAAwG;IACxG,wGAAwG;IACxG,iDAAiD;IACjD,QAAQ,CAA2B;IACnC,oGAAoG;IACpG,qGAAqG;IACrG,2FAA2F;IAC3F,6GAA6G;IAC7G,OAAO,CAAS;IAEhB,yDAAyD;IACzD,YAAY,KAAa,EAAE,KAAa,EAAE,EAAU,EAAE,MAAc,EAAE,MAAc,EAAE,QAAkC,EAAE,OAAO,GAAG,EAAE;QAClI,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IA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AAK,GAAG,KAAK,EAAE,aAAuB,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAC1F,YAAY,GAAG,EAAE;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ;AAzCD,8BAyCC","sourcesContent":["/**\n * The DATA-ONLY classes and status constants of the PR review system — the verdict a reviewer writes, the\n * checklist that demanded it, the resolved outcome, and the diff context handed to reviewers.\n *\n * Split out of review-json.ts, which holds the SERVICE that reads and writes them. The split is purely by\n * kind (data vs behaviour): review-json.ts re-exports every name below, so `from './review-json'` and\n * `from '@webpieces/rules-config'` keep resolving exactly as before and no consumer changes.\n */\n\nimport { ReviewerAgentPolicy } from './checklist-config';\nimport { ChecklistOverride } from './checklist-override';\n\n// The three colors a reviewer subagent may report in `review-<id>.json`. A TRI-state, not a boolean,\n// because the boolean it replaced gave a reviewer no way to say \"this passes, but a human should look at\n// X\" — the only way to raise a concern was to FAIL the PR and then override your own failure, which reads\n// on the dashboard as a deliberately-accepted defect rather than as a note.\nexport const VERDICT_GREEN = 'green';\nexport const VERDICT_YELLOW = 'yellow';\nexport const VERDICT_RED = 'red';\nexport const VERDICT_STATUSES = [VERDICT_GREEN, VERDICT_YELLOW, VERDICT_RED] as const;\n\n/** The durable instruction embedded in single-round review.json files for the fixing/coordinating AI. */\nexport const SINGLE_ROUND_MAIN_AGENT_INSTRUCTIONS =\n 'DO NOT RERUN this reviewer. If red, fix every finding and change each addressed red result to yellow; ' +\n 'yellow is acceptable. If you genuinely disagree, leave it red and flag the human for a decision BEFORE ' +\n 'posting the PR. A remaining red overrides any instruction to continue or land on main.';\n\n// The verdict a reviewer SUBAGENT writes into `.webpieces/pr-review/<featureSlug>/review-<id>.json`, one per\n// matched checklist. One file per checklist so N concurrent reviewer subagents never clobber a shared\n// file. It records the OUTCOME:\n// status:'green' → PASS\n// status:'yellow' → WARN (passes; the concern is published on the PR, nothing is blocked)\n// status:'red' + an override-<id>.json → OVERRIDDEN (pass; the human's stated reason reaches the PR)\n// status:'red' + no override file → FAIL (refuse; `output` is printed verbatim)\n//\n// THE `override` FIELD IS GONE FROM THIS FILE, and there is no compatibility mode. The ship-anyway\n// justification used to live here as free text, which made the ONE participant who hears the human — the\n// coordinating agent — the one participant that could not record it, because editing a reviewer's verdict\n// file is (correctly) refused by the harness. It now lives in its own `override-<id>.json`; see\n// ChecklistOverride. A verdict file still carrying an `override` key is reported through `problem` with the\n// destination named, exactly as the removed `success` field is. Data-only (per CLAUDE.md).\nexport class ChecklistResult {\n agent: string;\n model: string;\n id: string;\n status: string; // one of VERDICT_STATUSES; anything else is reported via `problem`\n output: string; // what the reviewer found; printed verbatim when the checklist fails\n // The HUMAN's authorization loaded from `override-<id>.json` beside this verdict, or null when there is\n // none. Loaded alongside the verdict so `resolveVerdict` needs no second read of disk and every command\n // resolves the same outcome from the same bytes.\n override: ChecklistOverride | null;\n // '' = a well-formed verdict. Non-empty = the file exists and parses but its verdict cannot be READ\n // (most often: it still uses the removed `success` field, or the moved `override` field). Carried as\n // data rather than thrown so the complaint can be reported by BOTH wp-review-upsert-pr and\n // wp-finish-upsert-pr in identical words, and so a legacy file is never silently mistaken for a missing one.\n problem: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(agent: string, model: string, id: string, status: string, output: string, override: ChecklistOverride | null, problem = '') {\n this.agent = agent;\n this.model = model;\n this.id = id;\n this.status = status;\n this.output = output;\n this.override = override;\n this.problem = problem;\n }\n}\n\n/**\n * What the pr-gate command computed from the diff: a checklist this branch MATCHED (its patterns hit the\n * diff, so its reviewer subagent is in scope). Drives review-<id>.json enforcement, provenance, the schema\n * hint, and the dashboard. Data-only.\n *\n * NAME NOTE: \"Required\" here means MATCHED, not mandatory — it predates `required` by a long way and is\n * the shared shape across review-json, the detector, the briefing builder, provenance and the dashboard.\n * Whether the reviewer must actually run is the {@link RequiredChecklist.required} field below.\n */\nexport class RequiredChecklist {\n id: string; // the checklist's name; keys review-<id>.json and its instructions file\n reviewer: ReviewerAgentPolicy; // the agent type to spawn (agentType the harness stamps) + the round cap\n doc: string; // REPO-RELATIVE guidance doc the reviewer reads ('' → it just reads the diff)\n matchedFiles: string[]; // the changed files that matched it (for the dashboard + hint)\n // Which of the checklist's OWN globs actually fired. Printed so a reviewer can judge how coarse the\n // match was — a precise `db/migrations/**` hit means something different from a blanket `**` — and the\n // template tells reviewers that matching IS deliberately coarse. [] = no patterns (matches every PR).\n matchedPatterns: string[];\n // Straight from the checklist's config `required`. true = blocking; false = the human is offered it and\n // may decline. Carried on the MATCH rather than looked up from config downstream so the set that gates\n // and the set that is reported cannot disagree about which of the two a checklist is.\n required: boolean;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n id: string, reviewer: ReviewerAgentPolicy, doc: string, matchedFiles: string[], matchedPatterns: string[] = [],\n // Defaulted to the BLOCKING value so any construction that forgets it fails closed — a test or a\n // future call site that silently produced an optional checklist would be a hole in the gate.\n required = true,\n ) {\n this.id = id;\n this.reviewer = reviewer;\n this.doc = doc;\n this.matchedFiles = matchedFiles;\n this.matchedPatterns = matchedPatterns;\n this.required = required;\n }\n}\n\n/**\n * The per-PR facts every reviewer subagent needs GIVEN to it, alongside its own checklist: the exact base\n * sha the gate diffs against and the file holding the complete changed-file set. Both used to live only in\n * a doc the printed instruction told the AI to go read, one indirection away from the instruction to hand\n * them over — so the printed block could not stand on its own. Data-only; empty = omit those lines.\n */\nexport class ChecklistReviewContext {\n baseSha: string; // the 3-point merge-base sha\n prContextPath: string; // path of pr-context.json — the AUTHORITATIVE full changed-file set\n /**\n * The exact command that reproduces ONE file's diff, with a `-- <file>` tail — NOT assembled by the\n * caller. This used to be hardcoded as `git diff <baseSha> HEAD -- <file>`, which returns NOTHING on a\n * dirty tree because the changed-file set is computed base→working-tree. See DiffBasis, which derives\n * this string from the same range the file set came from.\n */\n fileDiffCommand: string;\n diffDir: string; // dir of the MATERIALIZED diff (diff/ALL.diff + diff/files/…); '' when not written\n dirty: boolean; // true ⇒ the range includes uncommitted + untracked work, and must be said out loud\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(baseSha = '', prContextPath = '', fileDiffCommand = '', diffDir = '', dirty = false) {\n this.baseSha = baseSha;\n this.prContextPath = prContextPath;\n this.fileDiffCommand = fileDiffCommand;\n this.diffDir = diffDir;\n this.dirty = dirty;\n }\n}\n\n// The AI-authored review for a PR. The AI writes review.json itself between `wp-start-upsert-pr` (which\n// prints the schema) and `wp-finish-upsert-pr` (which reads it); reviewer subagents write the per-checklist\n// review-<id>.json files. Data-only (per CLAUDE.md).\nexport class ReviewJson {\n agent: string;\n model: string;\n title: string; // human PR title describing the change; used as the `gh pr` title (empty → caller falls back)\n riskScore: number; // 0–100, drives the risk bar\n riskLevel: string; // 'green' | 'yellow' | 'red'\n riskEmoji: string; // '🟢' | '🟡' | '🔴' — derived from riskLevel when omitted\n summary: string; // rendered in the dashboard Summary section\n violations: string[]; // pattern/architecture violations; length = the Pattern Violations count\n risks: string[];\n filesToReview: string[];\n results: ChecklistResult[]; // resolved per-checklist verdicts (from review-<id>.json); [] when none\n mainAgentInstructions: string; // non-empty only for the opt-in single-round experiment\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(agent: string, model: string,\n title: string,\n riskScore: number,\n riskLevel: string,\n riskEmoji: string,\n summary: string,\n violations: string[],\n risks: string[],\n filesToReview: string[],\n results: ChecklistResult[] = [],\n mainAgentInstructions = '',\n ) {\n this.agent = agent;\n this.model = model;\n this.title = title;\n this.riskScore = riskScore;\n this.riskLevel = riskLevel;\n this.riskEmoji = riskEmoji;\n this.summary = summary;\n this.violations = violations;\n this.risks = risks;\n this.filesToReview = filesToReview;\n this.results = results;\n this.mainAgentInstructions = mainAgentInstructions;\n }\n}\n\n// A checklist's resolved outcome, shared by review.json enforcement and the dashboard so both agree.\n// PASS, WARN and OVERRIDDEN all ship; FAIL, MISSING and BAD_FORMAT all refuse the PR.\nexport const CK_PASS = 'pass'; // review-<id>.json status:'green'\nexport const CK_WARN = 'warn'; // review-<id>.json status:'yellow' → 🟡 passes WITH concerns\nexport const CK_OVERRIDDEN = 'overridden'; // status:'red' + a human's override-<id>.json → 🟠\nexport const CK_FAIL = 'fail'; // review-<id>.json status:'red' + no override → refuse\nexport const CK_MISSING = 'missing'; // no review-<id>.json written → refuse\nexport const CK_BAD_FORMAT = 'bad-format'; // written, but its verdict is unreadable (e.g. legacy `success`)\n\nexport class ChecklistVerdict {\n id: string;\n status: string; // one of CK_PASS | CK_WARN | CK_OVERRIDDEN | CK_FAIL | CK_MISSING | CK_BAD_FORMAT\n detail: string; // reviewer output / override justification / format complaint (dashboard + errors)\n\n constructor(id: string, status: string, detail: string) {\n this.id = id;\n this.status = status;\n this.detail = detail;\n }\n}\n\n// The PR's diff context, written by wp-start-upsert-pr into `.webpieces/pr-review/<featureSlug>/pr-context.json`\n// so a reviewer subagent knows the exact 3-point base the gate used and the full changed-file set — then\n// reads any file's actual diff with `git diff <base> HEAD -- <file>`. This is what lets a checklist match\n// coarsely by path (in the config) while the subagent makes the fine, content-level judgment. Data-only.\nexport class PrContext {\n base: string; // the 3-point merge-base sha the gate diffs against\n /**\n * The real HEAD sha. This was once the literal string 'HEAD', which is not a fact — it cannot be\n * compared later to detect that the tree moved under a review, and it reads as a range that was never\n * actually diffed. Its only reader (reviewContextFor) takes `base`, so recording the sha is free.\n */\n head: string;\n changedFiles: string[]; // every file changed in the range (NOT tsOnly — includes .sql/.gql/Dockerfile/…)\n dirty: boolean; // true ⇒ changedFiles includes uncommitted + untracked work\n dirtyFiles: string[]; // exactly which paths are uncommitted/untracked — why `dirty` is true\n diffCommand: string; // the command that reproduces the WHOLE diff (see DiffBasis; correct when dirty)\n diffDir: string; // dir holding the materialized per-file diffs + ALL.diff; '' when not materialized\n generatedAt: string; // ISO timestamp, so a stale context is detectable rather than silently trusted\n /**\n * Main's head as this clone last saw it — the THIRD hash point, matching the trio the 3-point merge\n * records in `merge-info/<branch>/updatemain-hashes.json`. `base`/`head` above are points A and B\n * under the review side's older names.\n *\n * The review side used to record only A and B, so nothing could answer \"did main move while this was\n * under review?\" — the question you most want answered when a review looks stale. '' when origin/main\n * is unresolvable. Purely informational; nothing gates on it.\n */\n hashMainHead: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n base: string, head: string, changedFiles: string[],\n dirty = false, dirtyFiles: string[] = [], diffCommand = '', diffDir = '', generatedAt = '',\n hashMainHead = '',\n ) {\n this.hashMainHead = hashMainHead;\n this.base = base;\n this.head = head;\n this.changedFiles = changedFiles;\n this.dirty = dirty;\n this.dirtyFiles = dirtyFiles;\n this.diffCommand = diffCommand;\n this.diffDir = diffDir;\n this.generatedAt = generatedAt;\n }\n}\n"]}
1
+ {"version":3,"file":"review-json-data.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/review-json-data.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAKH,qGAAqG;AACrG,yGAAyG;AACzG,0GAA0G;AAC1G,4EAA4E;AAC/D,QAAA,aAAa,GAAG,OAAO,CAAC;AACxB,QAAA,cAAc,GAAG,QAAQ,CAAC;AAC1B,QAAA,WAAW,GAAG,KAAK,CAAC;AACpB,QAAA,gBAAgB,GAAG,CAAC,qBAAa,EAAE,sBAAc,EAAE,mBAAW,CAAU,CAAC;AAEtF,0GAA0G;AAC7F,QAAA,oCAAoC,GAC7C,wGAAwG;IACx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CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ;AAzCD,8BAyCC","sourcesContent":["/**\n * The DATA-ONLY classes and status constants of the PR review system — the verdict a reviewer writes, the\n * checklist that demanded it, the resolved outcome, and the diff context handed to reviewers.\n *\n * Split out of review-json.ts, which holds the SERVICE that reads and writes them. The split is purely by\n * kind (data vs behaviour): review-json.ts re-exports every name below, so `from './review-json'` and\n * `from '@webpieces/rules-config'` keep resolving exactly as before and no consumer changes.\n */\n\nimport { ReviewerAgentPolicy } from './checklist-config';\nimport { ChecklistOverride } from './checklist-override';\n\n// The three colors a reviewer subagent may report in `review-<id>.json`. A TRI-state, not a boolean,\n// because the boolean it replaced gave a reviewer no way to say \"this passes, but a human should look at\n// X\" — the only way to raise a concern was to FAIL the PR and then override your own failure, which reads\n// on the dashboard as a deliberately-accepted defect rather than as a note.\nexport const VERDICT_GREEN = 'green';\nexport const VERDICT_YELLOW = 'yellow';\nexport const VERDICT_RED = 'red';\nexport const VERDICT_STATUSES = [VERDICT_GREEN, VERDICT_YELLOW, VERDICT_RED] as const;\n\n/** The durable instruction embedded in single-round summary.json files for the fixing/coordinating AI. */\nexport const SINGLE_ROUND_MAIN_AGENT_INSTRUCTIONS =\n 'DO NOT RERUN this reviewer. If red, fix every finding and change each addressed red result to yellow; ' +\n 'yellow is acceptable. If you genuinely disagree, leave it red and flag the human for a decision BEFORE ' +\n 'posting the PR. A remaining red overrides any instruction to continue or land on main.';\n\n// The verdict a reviewer SUBAGENT writes into `.webpieces/pr-review/<featureSlug>/review-<id>.json`, one per\n// matched checklist. One file per checklist so N concurrent reviewer subagents never clobber a shared\n// file. It records the OUTCOME:\n// status:'green' → PASS\n// status:'yellow' → WARN (passes; the concern is published on the PR, nothing is blocked)\n// status:'red' + an override-<id>.json → OVERRIDDEN (pass; the human's stated reason reaches the PR)\n// status:'red' + no override file → FAIL (refuse; `output` is printed verbatim)\n//\n// THE `override` FIELD IS GONE FROM THIS FILE, and there is no compatibility mode. The ship-anyway\n// justification used to live here as free text, which made the ONE participant who hears the human — the\n// coordinating agent — the one participant that could not record it, because editing a reviewer's verdict\n// file is (correctly) refused by the harness. It now lives in its own `override-<id>.json`; see\n// ChecklistOverride. A verdict file still carrying an `override` key is reported through `problem` with the\n// destination named, exactly as the removed `success` field is. Data-only (per CLAUDE.md).\nexport class ChecklistResult {\n agent: string;\n model: string;\n id: string;\n status: string; // one of VERDICT_STATUSES; anything else is reported via `problem`\n output: string; // what the reviewer found; printed verbatim when the checklist fails\n // The HUMAN's authorization loaded from `override-<id>.json` beside this verdict, or null when there is\n // none. Loaded alongside the verdict so `resolveVerdict` needs no second read of disk and every command\n // resolves the same outcome from the same bytes.\n override: ChecklistOverride | null;\n // '' = a well-formed verdict. Non-empty = the file exists and parses but its verdict cannot be READ\n // (most often: it still uses the removed `success` field, or the moved `override` field). Carried as\n // data rather than thrown so the complaint can be reported by BOTH wp-review-upsert-pr and\n // wp-finish-upsert-pr in identical words, and so a legacy file is never silently mistaken for a missing one.\n problem: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(agent: string, model: string, id: string, status: string, output: string, override: ChecklistOverride | null, problem = '') {\n this.agent = agent;\n this.model = model;\n this.id = id;\n this.status = status;\n this.output = output;\n this.override = override;\n this.problem = problem;\n }\n}\n\n/**\n * What the pr-gate command computed from the diff: a checklist this branch MATCHED (its patterns hit the\n * diff, so its reviewer subagent is in scope). Drives review-<id>.json enforcement, provenance, the schema\n * hint, and the dashboard. Data-only.\n *\n * NAME NOTE: \"Required\" here means MATCHED, not mandatory — it predates `required` by a long way and is\n * the shared shape across review-json, the detector, the briefing builder, provenance and the dashboard.\n * Whether the reviewer must actually run is the {@link RequiredChecklist.required} field below.\n */\nexport class RequiredChecklist {\n id: string; // the checklist's name; keys review-<id>.json and its instructions file\n reviewer: ReviewerAgentPolicy; // the agent type to spawn (agentType the harness stamps) + the round cap\n doc: string; // REPO-RELATIVE guidance doc the reviewer reads ('' → it just reads the diff)\n matchedFiles: string[]; // the changed files that matched it (for the dashboard + hint)\n // Which of the checklist's OWN globs actually fired. Printed so a reviewer can judge how coarse the\n // match was — a precise `db/migrations/**` hit means something different from a blanket `**` — and the\n // template tells reviewers that matching IS deliberately coarse. [] = no patterns (matches every PR).\n matchedPatterns: string[];\n // Straight from the checklist's config `required`. true = blocking; false = the human is offered it and\n // may decline. Carried on the MATCH rather than looked up from config downstream so the set that gates\n // and the set that is reported cannot disagree about which of the two a checklist is.\n required: boolean;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n id: string, reviewer: ReviewerAgentPolicy, doc: string, matchedFiles: string[], matchedPatterns: string[] = [],\n // Defaulted to the BLOCKING value so any construction that forgets it fails closed — a test or a\n // future call site that silently produced an optional checklist would be a hole in the gate.\n required = true,\n ) {\n this.id = id;\n this.reviewer = reviewer;\n this.doc = doc;\n this.matchedFiles = matchedFiles;\n this.matchedPatterns = matchedPatterns;\n this.required = required;\n }\n}\n\n/**\n * The per-PR facts every reviewer subagent needs GIVEN to it, alongside its own checklist: the exact base\n * sha the gate diffs against and the file holding the complete changed-file set. Both used to live only in\n * a doc the printed instruction told the AI to go read, one indirection away from the instruction to hand\n * them over — so the printed block could not stand on its own. Data-only; empty = omit those lines.\n */\nexport class ChecklistReviewContext {\n baseSha: string; // the 3-point merge-base sha\n prContextPath: string; // path of pr-context.json — the AUTHORITATIVE full changed-file set\n /**\n * The exact command that reproduces ONE file's diff, with a `-- <file>` tail — NOT assembled by the\n * caller. This used to be hardcoded as `git diff <baseSha> HEAD -- <file>`, which returns NOTHING on a\n * dirty tree because the changed-file set is computed base→working-tree. See DiffBasis, which derives\n * this string from the same range the file set came from.\n */\n fileDiffCommand: string;\n diffDir: string; // dir of the MATERIALIZED diff (diff/ALL.diff + diff/files/…); '' when not written\n dirty: boolean; // true ⇒ the range includes uncommitted + untracked work, and must be said out loud\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(baseSha = '', prContextPath = '', fileDiffCommand = '', diffDir = '', dirty = false) {\n this.baseSha = baseSha;\n this.prContextPath = prContextPath;\n this.fileDiffCommand = fileDiffCommand;\n this.diffDir = diffDir;\n this.dirty = dirty;\n }\n}\n\n// The AI-authored PR summary (title, risk, summary). The AI writes summary.json itself between `wp-start-upsert-pr` (which\n// prints the schema) and `wp-finish-upsert-pr` (which reads it); reviewer subagents write the per-checklist\n// review-<id>.json files. Data-only (per CLAUDE.md).\nexport class PrSummary {\n agent: string;\n model: string;\n title: string; // human PR title describing the change; used as the `gh pr` title (empty → caller falls back)\n riskScore: number; // 0–100, drives the risk bar\n riskLevel: string; // 'green' | 'yellow' | 'red'\n riskEmoji: string; // '🟢' | '🟡' | '🔴' — derived from riskLevel when omitted\n summary: string; // rendered in the dashboard Summary section\n violations: string[]; // pattern/architecture violations; length = the Pattern Violations count\n risks: string[];\n filesToReview: string[];\n results: ChecklistResult[]; // resolved per-checklist verdicts (from review-<id>.json); [] when none\n mainAgentInstructions: string; // non-empty only for the opt-in single-round experiment\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(agent: string, model: string,\n title: string,\n riskScore: number,\n riskLevel: string,\n riskEmoji: string,\n summary: string,\n violations: string[],\n risks: string[],\n filesToReview: string[],\n results: ChecklistResult[] = [],\n mainAgentInstructions = '',\n ) {\n this.agent = agent;\n this.model = model;\n this.title = title;\n this.riskScore = riskScore;\n this.riskLevel = riskLevel;\n this.riskEmoji = riskEmoji;\n this.summary = summary;\n this.violations = violations;\n this.risks = risks;\n this.filesToReview = filesToReview;\n this.results = results;\n this.mainAgentInstructions = mainAgentInstructions;\n }\n}\n\n// A checklist's resolved outcome, shared by summary.json enforcement and the dashboard so both agree.\n// PASS, WARN and OVERRIDDEN all ship; FAIL, MISSING and BAD_FORMAT all refuse the PR.\nexport const CK_PASS = 'pass'; // review-<id>.json status:'green'\nexport const CK_WARN = 'warn'; // review-<id>.json status:'yellow' → 🟡 passes WITH concerns\nexport const CK_OVERRIDDEN = 'overridden'; // status:'red' + a human's override-<id>.json → 🟠\nexport const CK_FAIL = 'fail'; // review-<id>.json status:'red' + no override → refuse\nexport const CK_MISSING = 'missing'; // no review-<id>.json written → refuse\nexport const CK_BAD_FORMAT = 'bad-format'; // written, but its verdict is unreadable (e.g. legacy `success`)\n\nexport class ChecklistVerdict {\n id: string;\n status: string; // one of CK_PASS | CK_WARN | CK_OVERRIDDEN | CK_FAIL | CK_MISSING | CK_BAD_FORMAT\n detail: string; // reviewer output / override justification / format complaint (dashboard + errors)\n\n constructor(id: string, status: string, detail: string) {\n this.id = id;\n this.status = status;\n this.detail = detail;\n }\n}\n\n// The PR's diff context, written by wp-start-upsert-pr into `.webpieces/pr-review/<featureSlug>/pr-context.json`\n// so a reviewer subagent knows the exact 3-point base the gate used and the full changed-file set — then\n// reads any file's actual diff with `git diff <base> HEAD -- <file>`. This is what lets a checklist match\n// coarsely by path (in the config) while the subagent makes the fine, content-level judgment. Data-only.\nexport class PrContext {\n base: string; // the 3-point merge-base sha the gate diffs against\n /**\n * The real HEAD sha. This was once the literal string 'HEAD', which is not a fact — it cannot be\n * compared later to detect that the tree moved under a review, and it reads as a range that was never\n * actually diffed. Its only reader (reviewContextFor) takes `base`, so recording the sha is free.\n */\n head: string;\n changedFiles: string[]; // every file changed in the range (NOT tsOnly — includes .sql/.gql/Dockerfile/…)\n dirty: boolean; // true ⇒ changedFiles includes uncommitted + untracked work\n dirtyFiles: string[]; // exactly which paths are uncommitted/untracked — why `dirty` is true\n diffCommand: string; // the command that reproduces the WHOLE diff (see DiffBasis; correct when dirty)\n diffDir: string; // dir holding the materialized per-file diffs + ALL.diff; '' when not materialized\n generatedAt: string; // ISO timestamp, so a stale context is detectable rather than silently trusted\n /**\n * Main's head as this clone last saw it — the THIRD hash point, matching the trio the 3-point merge\n * records in `merge-info/<branch>/updatemain-hashes.json`. `base`/`head` above are points A and B\n * under the review side's older names.\n *\n * The review side used to record only A and B, so nothing could answer \"did main move while this was\n * under review?\" — the question you most want answered when a review looks stale. '' when origin/main\n * is unresolvable. Purely informational; nothing gates on it.\n */\n hashMainHead: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n base: string, head: string, changedFiles: string[],\n dirty = false, dirtyFiles: string[] = [], diffCommand = '', diffDir = '', generatedAt = '',\n hashMainHead = '',\n ) {\n this.hashMainHead = hashMainHead;\n this.base = base;\n this.head = head;\n this.changedFiles = changedFiles;\n this.dirty = dirty;\n this.dirtyFiles = dirtyFiles;\n this.diffCommand = diffCommand;\n this.diffDir = diffDir;\n this.generatedAt = generatedAt;\n }\n}\n"]}
@@ -1,42 +1,42 @@
1
1
  import { DotWebpieces } from './state-dir';
2
2
  import { ChecklistOverride, ChecklistOverrideService, checklistOverrideService } from './checklist-override';
3
- import { VERDICT_GREEN, VERDICT_YELLOW, VERDICT_RED, VERDICT_STATUSES, SINGLE_ROUND_MAIN_AGENT_INSTRUCTIONS, ChecklistResult, RequiredChecklist, ChecklistReviewContext, ReviewJson, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, ChecklistVerdict, PrContext } from './review-json-data';
3
+ import { VERDICT_GREEN, VERDICT_YELLOW, VERDICT_RED, VERDICT_STATUSES, SINGLE_ROUND_MAIN_AGENT_INSTRUCTIONS, ChecklistResult, RequiredChecklist, ChecklistReviewContext, PrSummary, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, ChecklistVerdict, PrContext } from './review-json-data';
4
4
  export { ChecklistOverride, ChecklistOverrideService, checklistOverrideService };
5
- export { VERDICT_GREEN, VERDICT_YELLOW, VERDICT_RED, VERDICT_STATUSES, SINGLE_ROUND_MAIN_AGENT_INSTRUCTIONS, ChecklistResult, RequiredChecklist, ChecklistReviewContext, ReviewJson, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, ChecklistVerdict, PrContext, };
6
- /** Locates + loads/validates the AI-authored review.json. `@injectable(bindingScopeValues.Singleton)` so it's drawn in the design. */
5
+ export { VERDICT_GREEN, VERDICT_YELLOW, VERDICT_RED, VERDICT_STATUSES, SINGLE_ROUND_MAIN_AGENT_INSTRUCTIONS, ChecklistResult, RequiredChecklist, ChecklistReviewContext, PrSummary, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, ChecklistVerdict, PrContext, };
6
+ /** Locates + loads/validates the AI-authored summary.json. `@injectable(bindingScopeValues.Singleton)` so it's drawn in the design. */
7
7
  export declare class ReviewJsonService {
8
8
  private readonly dotDir;
9
9
  private readonly overrides;
10
10
  constructor(dotDir?: DotWebpieces, overrides?: ChecklistOverrideService);
11
11
  prDirFor(repoRoot: string, featureName: string): string;
12
- reviewJsonPath(repoRoot: string, featureName: string): string;
12
+ summaryJsonPath(repoRoot: string, featureName: string): string;
13
13
  prContextPath(repoRoot: string, featureName: string): string;
14
- oldReviewJsonPath(reviewJsonFilePath: string): string;
14
+ oldSummaryJsonPath(summaryJsonFilePath: string): string;
15
15
  /**
16
- * Retire the review `wp-finish-upsert-pr` just used: move review.json to old-review.json, stamped with a
17
- * note saying what it is. Returns the archive path, or '' when there was nothing to archive.
16
+ * Retire the PR summary `wp-finish-upsert-pr` just used: move summary.json to old-summary.json, stamped
17
+ * with a note saying what it is. Returns the archive path, or '' when there was nothing to archive.
18
18
  *
19
- * The point is the MOVE, not the copy. review.json left in place after a PR is posted is a live-looking
20
- * file describing a review that already happened, and the next run of stage ② on this branch finds it
19
+ * The point is the MOVE, not the copy. summary.json left in place after a PR is posted is a live-looking
20
+ * file describing a PR update that already happened, and the next run of stage ② on this branch finds it
21
21
  * sitting there — so a reviewer subagent that judges the PR's stated intent (its title, summary or risk
22
- * level) can read the previous run's review and return GREEN against a title that no longer exists.
22
+ * level) can read the previous run's summary and return GREEN against a title that no longer exists.
23
23
  * Nothing in the verdict distinguishes that from a real pass. Moving it means the only way to reach
24
- * finish again is to write a fresh one, and {@link loadReviewJson} points at the archive when it is
24
+ * finish again is to write a fresh one, and {@link loadSummaryJson} points at the archive when it is
25
25
  * missing so the archive reads as an audit trail rather than as a lost file.
26
26
  *
27
27
  * Called only after the PR is actually up: a finish that failed before publishing must stay re-runnable.
28
28
  */
29
- archiveReviewJson(reviewJsonFilePath: string): string;
29
+ archiveSummaryJson(summaryJsonFilePath: string): string;
30
30
  /**
31
31
  * The archived bytes: the original JSON with an AUDIT-ONLY note as its FIRST key, so anything that opens
32
32
  * the file — human or AI — reads what it is before it reads any of its content.
33
33
  *
34
- * `note` is a parameter rather than a constant because two different files are archived here (review.json
34
+ * `note` is a parameter rather than a constant because two different files are archived here (summary.json
35
35
  * and review-<id>.json) and they need to say different things, while the stamping MECHANICS — parse,
36
36
  * note first, original keys in order, fall back to raw — are identical. One implementation, two texts;
37
37
  * a second copy of this method would be the thing that drifts.
38
38
  *
39
- * Falls back to the raw bytes when they do not parse. For review.json `loadReviewJson` has already
39
+ * Falls back to the raw bytes when they do not parse. For summary.json `loadSummaryJson` has already
40
40
  * accepted the file so that is close to impossible, but a verdict file is written by a subagent and may
41
41
  * be half-written or not an object at all — and preserving the original always beats losing it to a
42
42
  * stamping failure, since the archive exists precisely to be the record.
@@ -61,28 +61,29 @@ export declare class ReviewJsonService {
61
61
  * is absent or unreadable — the block then just omits those lines.
62
62
  */
63
63
  reviewContextFor(repoRoot: string, featureName: string): ChecklistReviewContext;
64
- reviewJsonSchemaHint(filePath: string, mainAgentInstructions?: string): string;
64
+ summaryJsonSchemaHint(filePath: string, mainAgentInstructions?: string): string;
65
65
  /**
66
- * The extra line the "no review.json" complaint carries when a PREVIOUS review was archived here. It
66
+ * The extra line the "no summary.json" complaint carries when a PREVIOUS summary was archived here. It
67
67
  * turns a bare "not found" — which reads as data loss, and invites hunting for the file — into the fact:
68
- * the last finish consumed it, and the archive is audit material, not a review to reuse.
68
+ * the last finish consumed it, and the archive is audit material, not a summary to reuse.
69
69
  */
70
- private archivedReviewHint;
71
- checklistResultPath(reviewJsonFilePath: string, checklistId: string): string;
70
+ private archivedSummaryHint;
71
+ private renamedFileHint;
72
+ checklistResultPath(summaryJsonFilePath: string, checklistId: string): string;
72
73
  /**
73
74
  * Where a RETIRED verdict for one checklist goes: `review-<id>.json.old`, beside the live path.
74
75
  *
75
- * Mirrors {@link oldReviewJsonPath} deliberately, including its single-slot rule: ALWAYS the same path,
76
+ * Mirrors {@link oldSummaryJsonPath} deliberately, including its single-slot rule: ALWAYS the same path,
76
77
  * so it holds the last retired verdict and only the last one. A series (`.old.old`, `.old.1`) would read
77
78
  * as though the number of retirements meant something, and nothing downstream can interpret that — the
78
79
  * one fact worth keeping is "this checklist refused before, here is what it said".
79
80
  */
80
- oldChecklistResultPath(reviewJsonFilePath: string, checklistId: string): string;
81
+ oldChecklistResultPath(summaryJsonFilePath: string, checklistId: string): string;
81
82
  /**
82
83
  * Retire one checklist's verdict: MOVE review-<id>.json to review-<id>.json.old, stamped with a note
83
84
  * saying what it is. Returns the archive path, or '' when there was nothing to archive.
84
85
  *
85
- * The point is the MOVE, exactly as in {@link archiveReviewJson}. A red verdict left on the live path is
86
+ * The point is the MOVE, exactly as in {@link archiveSummaryJson}. A red verdict left on the live path is
86
87
  * re-read by the next run and re-reported as the CURRENT state of the branch, so the branch keeps being
87
88
  * refused for a finding that may already be fixed — and the fix, when it comes, silently overwrites the
88
89
  * only record that the gate ever refused anything. Moving it makes the refusal durable and makes a fresh
@@ -94,14 +95,14 @@ export declare class ReviewJsonService {
94
95
  * verdicts ARE deliberately reused across finish attempts, and retiring one would force a needless (and
95
96
  * expensive) subagent re-run.
96
97
  */
97
- archiveChecklistResult(reviewJsonFilePath: string, checklistId: string): string;
98
+ archiveChecklistResult(summaryJsonFilePath: string, checklistId: string): string;
98
99
  /**
99
- * Load + validate the AI-authored review.json. Throws InformAiError (with the schema) when missing,
100
+ * Load + validate the AI-authored summary.json. Throws InformAiError (with the schema) when missing,
100
101
  * unparseable, or structurally wrong. `required` is the set of checklists the diff matched: every one
101
102
  * must have a well-formed, passing (or overridden) review-<id>.json or a validation error is raised
102
103
  * alongside the usual ones so the AI gets ONE message.
103
104
  */
104
- loadReviewJson(filePath: string, required?: readonly RequiredChecklist[], expectedMainAgentInstructions?: string): ReviewJson;
105
+ loadSummaryJson(filePath: string, required?: readonly RequiredChecklist[], expectedMainAgentInstructions?: string): PrSummary;
105
106
  private validateMainAgentInstructions;
106
107
  /**
107
108
  * The checklists that still OWE a verdict: no review-<id>.json at all, a malformed one, or one whose
@@ -138,7 +139,7 @@ export declare class ReviewJsonService {
138
139
  /**
139
140
  * THE renderer for "this reviewer refused" — one wording, wherever the refusal surfaces. It exists as a
140
141
  * method because the text was previously inlined in {@link requiredChecklistErrors}, reachable only
141
- * through review.json validation, while the command layer refused earlier with its own generic message.
142
+ * through summary.json validation, while the command layer refused earlier with its own generic message.
142
143
  * Two messages for one event is how the useful one became unreachable; there is now exactly one.
143
144
  *
144
145
  * It always quotes the reviewer's own `output` verbatim: the finding is the whole point, and an error
@@ -155,7 +156,7 @@ export declare class ReviewJsonService {
155
156
  * The AUTHORIZATION is unaffected by that move: `override-<id>.json` is a different file, it survives the
156
157
  * retirement, and a human who already decided to accept this checklist is never asked again.
157
158
  */
158
- refusalError(req: RequiredChecklist, verdict: ChecklistVerdict, reviewJsonFilePath: string, archivedPath?: string): string;
159
+ refusalError(req: RequiredChecklist, verdict: ChecklistVerdict, summaryJsonFilePath: string, archivedPath?: string): string;
159
160
  /**
160
161
  * The ship-anyway paragraph: who may authorize, and the exact command that records it.
161
162
  *
@@ -164,13 +165,13 @@ export declare class ReviewJsonService {
164
165
  * command that had since been deleted.
165
166
  */
166
167
  private overrideRoute;
167
- loadChecklistResults(reviewJsonFilePath: string, required: readonly RequiredChecklist[]): ChecklistResult[];
168
+ loadChecklistResults(summaryJsonFilePath: string, required: readonly RequiredChecklist[]): ChecklistResult[];
168
169
  resolveVerdict(req: RequiredChecklist, results: readonly ChecklistResult[]): ChecklistVerdict;
169
170
  /**
170
171
  * One loud complaint per checklist whose verdict file EXISTS but cannot be read as a verdict — almost
171
172
  * always one still using the removed `success` field. Public and separate from
172
173
  * {@link requiredChecklistErrors} because `wp-finish-upsert-pr` refuses on missing reviewers BEFORE it
173
- * parses review.json: without this, a legacy file would surface as the generic "no verdict yet" block
174
+ * parses summary.json: without this, a legacy file would surface as the generic "no verdict yet" block
174
175
  * and the AI would re-run a reviewer that already ran instead of fixing four characters of JSON.
175
176
  */
176
177
  checklistFormatErrors(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): string[];
@@ -205,8 +206,8 @@ export declare class ReviewJsonService {
205
206
  */
206
207
  private verdictProblem;
207
208
  private asStringArray;
208
- private parseReviewJson;
209
+ private parseSummaryJson;
209
210
  }
210
211
  export declare function prDirFor(repoRoot: string, featureName: string): string;
211
- export declare function reviewJsonPath(repoRoot: string, featureName: string): string;
212
- export declare function reviewJsonSchemaHint(filePath: string, mainAgentInstructions?: string): string;
212
+ export declare function summaryJsonPath(repoRoot: string, featureName: string): string;
213
+ export declare function summaryJsonSchemaHint(filePath: string, mainAgentInstructions?: string): string;