@webpieces/pr-gate 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 (69) hide show
  1. package/package.json +3 -3
  2. package/src/dashboard/author-identity.d.ts +2 -2
  3. package/src/dashboard/author-identity.js +2 -2
  4. package/src/dashboard/author-identity.js.map +1 -1
  5. package/src/dashboard/dashboard.d.ts +5 -5
  6. package/src/dashboard/dashboard.js +4 -4
  7. package/src/dashboard/dashboard.js.map +1 -1
  8. package/src/dashboard/review-identity-renderer.d.ts +1 -1
  9. package/src/dashboard/review-identity-renderer.js +1 -1
  10. package/src/dashboard/review-identity-renderer.js.map +1 -1
  11. package/src/scripts/commands/await-reviews-command.d.ts +2 -2
  12. package/src/scripts/commands/await-reviews-command.js +6 -6
  13. package/src/scripts/commands/await-reviews-command.js.map +1 -1
  14. package/src/scripts/commands/check-pr-command.js +1 -1
  15. package/src/scripts/commands/check-pr-command.js.map +1 -1
  16. package/src/scripts/commands/finish-upsert-pr-command.d.ts +4 -4
  17. package/src/scripts/commands/finish-upsert-pr-command.js +18 -18
  18. package/src/scripts/commands/finish-upsert-pr-command.js.map +1 -1
  19. package/src/scripts/commands/land-pr-command.d.ts +3 -3
  20. package/src/scripts/commands/land-pr-command.js +6 -6
  21. package/src/scripts/commands/land-pr-command.js.map +1 -1
  22. package/src/scripts/commands/review-upsert-pr-command.d.ts +2 -2
  23. package/src/scripts/commands/review-upsert-pr-command.js +5 -5
  24. package/src/scripts/commands/review-upsert-pr-command.js.map +1 -1
  25. package/src/scripts/commands/start-update-command.js +1 -1
  26. package/src/scripts/commands/start-update-command.js.map +1 -1
  27. package/src/scripts/commands/start-upsert-pr-command.d.ts +3 -3
  28. package/src/scripts/commands/start-upsert-pr-command.js +7 -7
  29. package/src/scripts/commands/start-upsert-pr-command.js.map +1 -1
  30. package/src/scripts/commands/write-review-command.js +1 -1
  31. package/src/scripts/commands/write-review-command.js.map +1 -1
  32. package/src/scripts/pr-gate-app.d.ts +1 -1
  33. package/src/scripts/pr-gate-app.js +1 -1
  34. package/src/scripts/pr-gate-app.js.map +1 -1
  35. package/src/scripts/workflow/checklist-detector.js +1 -1
  36. package/src/scripts/workflow/checklist-detector.js.map +1 -1
  37. package/src/scripts/workflow/checklist-notice.d.ts +1 -1
  38. package/src/scripts/workflow/checklist-notice.js +1 -1
  39. package/src/scripts/workflow/checklist-notice.js.map +1 -1
  40. package/src/scripts/workflow/checklist-scanner.d.ts +2 -2
  41. package/src/scripts/workflow/checklist-scanner.js +11 -11
  42. package/src/scripts/workflow/checklist-scanner.js.map +1 -1
  43. package/src/scripts/workflow/gated-pr-publisher.d.ts +1 -1
  44. package/src/scripts/workflow/gated-pr-publisher.js +1 -1
  45. package/src/scripts/workflow/gated-pr-publisher.js.map +1 -1
  46. package/src/scripts/workflow/merge-end.d.ts +1 -1
  47. package/src/scripts/workflow/merge-end.js +2 -2
  48. package/src/scripts/workflow/merge-end.js.map +1 -1
  49. package/src/scripts/workflow/open-pr-check.js +1 -1
  50. package/src/scripts/workflow/open-pr-check.js.map +1 -1
  51. package/src/scripts/workflow/provenance-enforcer.d.ts +2 -2
  52. package/src/scripts/workflow/provenance-enforcer.js +6 -6
  53. package/src/scripts/workflow/provenance-enforcer.js.map +1 -1
  54. package/src/scripts/workflow/review-report.d.ts +9 -9
  55. package/src/scripts/workflow/review-report.js +19 -19
  56. package/src/scripts/workflow/review-report.js.map +1 -1
  57. package/src/scripts/workflow/review-stage-receipt.d.ts +3 -3
  58. package/src/scripts/workflow/review-stage-receipt.js +3 -3
  59. package/src/scripts/workflow/review-stage-receipt.js.map +1 -1
  60. package/src/scripts/workflow/reviewer-briefing-builder.js +1 -1
  61. package/src/scripts/workflow/reviewer-briefing-builder.js.map +1 -1
  62. package/src/scripts/workflow/reviewer-verdict-gate.d.ts +1 -1
  63. package/src/scripts/workflow/reviewer-verdict-gate.js +6 -6
  64. package/src/scripts/workflow/reviewer-verdict-gate.js.map +1 -1
  65. package/src/scripts/workflow/verdict-provenance.d.ts +4 -4
  66. package/src/scripts/workflow/verdict-provenance.js +10 -10
  67. package/src/scripts/workflow/verdict-provenance.js.map +1 -1
  68. package/src/scripts/wp-start-upsert-pr.js +1 -1
  69. package/src/scripts/wp-start-upsert-pr.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/pr-gate",
3
- "version": "0.4.816",
3
+ "version": "0.4.817",
4
4
  "description": "Gated PR system: 3-point squash-merge, merge validation gate, and red/yellow/green PR dashboard. Standalone scripts, no Nx dependency required.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@inversifyjs/binding-decorators": "1.1.5",
19
- "@webpieces/ai-hook-rules": "0.4.816",
20
- "@webpieces/rules-config": "0.4.816",
19
+ "@webpieces/ai-hook-rules": "0.4.817",
20
+ "@webpieces/rules-config": "0.4.817",
21
21
  "inversify": "7.10.4",
22
22
  "reflect-metadata": "0.2.2"
23
23
  },
@@ -1,5 +1,5 @@
1
1
  import { AI_TYPE_UNKNOWN, AiType } from '@webpieces/ai-hook-rules';
2
- /** The coding harness observed by the gate, plus the model the author reported in review.json. */
2
+ /** The coding harness observed by the gate, plus the model the author reported in summary.json. */
3
3
  export declare class AuthorIdentity {
4
4
  harness: AiType | typeof AI_TYPE_UNKNOWN;
5
5
  model: string;
@@ -8,7 +8,7 @@ export declare class AuthorIdentity {
8
8
  /**
9
9
  * Resolves the authoring harness from session identifiers supplied by the harness itself.
10
10
  *
11
- * This deliberately does not trust review.json's `agent` field: that file is AI-authored, while the
11
+ * This deliberately does not trust summary.json's `agent` field: that file is AI-authored, while the
12
12
  * session variables are supplied by Claude Code / Codex before the model runs. Both-or-neither is
13
13
  * `unknown`; silently picking one in an ambiguous process would turn telemetry into a false claim.
14
14
  */
@@ -4,7 +4,7 @@ exports.AuthorIdentityResolver = exports.AuthorIdentity = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ai_hook_rules_1 = require("@webpieces/ai-hook-rules");
6
6
  const inversify_1 = require("inversify");
7
- /** The coding harness observed by the gate, plus the model the author reported in review.json. */
7
+ /** The coding harness observed by the gate, plus the model the author reported in summary.json. */
8
8
  class AuthorIdentity {
9
9
  harness;
10
10
  model;
@@ -17,7 +17,7 @@ exports.AuthorIdentity = AuthorIdentity;
17
17
  /**
18
18
  * Resolves the authoring harness from session identifiers supplied by the harness itself.
19
19
  *
20
- * This deliberately does not trust review.json's `agent` field: that file is AI-authored, while the
20
+ * This deliberately does not trust summary.json's `agent` field: that file is AI-authored, while the
21
21
  * session variables are supplied by Claude Code / Codex before the model runs. Both-or-neither is
22
22
  * `unknown`; silently picking one in an ambiguous process would turn telemetry into a false claim.
23
23
  */
@@ -1 +1 @@
1
- {"version":3,"file":"author-identity.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/dashboard/author-identity.ts"],"names":[],"mappings":";;;;AAAA,4DAA6E;AAC7E,yCAA2D;AAE3D,kGAAkG;AAClG,MAAa,cAAc;IACvB,OAAO,CAAkC;IACzC,KAAK,CAAS;IAEd,YAAY,OAAwC,EAAE,KAAa;QAC/D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;CACJ;AARD,wCAQC;AAED;;;;;;GAMG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAC/B,OAAO,CAAC,iBAAyB;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAClF,IAAI,OAAO,GAAoC,+BAAe,CAAC;QAC/D,IAAI,MAAM,KAAK,KAAK;YAAE,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC;QACjE,+FAA+F;QAC/F,IAAI,OAAO,KAAK,+BAAe,IAAI,CAAC,wBAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,OAAO,GAAG,+BAAe,CAAC;QAC1F,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QACrF,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAEO,OAAO,CAAC,IAAY;QACxB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;IACnD,CAAC;CACJ,CAAA;AAfY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,sBAAsB,CAelC","sourcesContent":["import { AI_TYPES, AI_TYPE_UNKNOWN, AiType } from '@webpieces/ai-hook-rules';\nimport { injectable, bindingScopeValues } from 'inversify';\n\n/** The coding harness observed by the gate, plus the model the author reported in review.json. */\nexport class AuthorIdentity {\n harness: AiType | typeof AI_TYPE_UNKNOWN;\n model: string;\n\n constructor(harness: AiType | typeof AI_TYPE_UNKNOWN, model: string) {\n this.harness = harness;\n this.model = model;\n }\n}\n\n/**\n * Resolves the authoring harness from session identifiers supplied by the harness itself.\n *\n * This deliberately does not trust review.json's `agent` field: that file is AI-authored, while the\n * session variables are supplied by Claude Code / Codex before the model runs. Both-or-neither is\n * `unknown`; silently picking one in an ambiguous process would turn telemetry into a false claim.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class AuthorIdentityResolver {\n resolve(selfReportedModel: string): AuthorIdentity {\n const claude = this.present('CLAUDE_CODE_SESSION_ID');\n const codex = this.present('CODEX_SESSION_ID') || this.present('CODEX_THREAD_ID');\n let harness: AiType | typeof AI_TYPE_UNKNOWN = AI_TYPE_UNKNOWN;\n if (claude !== codex) harness = claude ? 'claude-code' : 'codex';\n // Keep this tied to ai-hook-rules' canonical vocabulary rather than growing a second spelling.\n if (harness !== AI_TYPE_UNKNOWN && !AI_TYPES.includes(harness)) harness = AI_TYPE_UNKNOWN;\n const model = selfReportedModel.trim() === '' ? 'unknown' : selfReportedModel.trim();\n return new AuthorIdentity(harness, model);\n }\n\n private present(name: string): boolean {\n return (process.env[name] ?? '').trim() !== '';\n }\n}\n"]}
1
+ {"version":3,"file":"author-identity.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/dashboard/author-identity.ts"],"names":[],"mappings":";;;;AAAA,4DAA6E;AAC7E,yCAA2D;AAE3D,mGAAmG;AACnG,MAAa,cAAc;IACvB,OAAO,CAAkC;IACzC,KAAK,CAAS;IAEd,YAAY,OAAwC,EAAE,KAAa;QAC/D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;CACJ;AARD,wCAQC;AAED;;;;;;GAMG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAC/B,OAAO,CAAC,iBAAyB;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAClF,IAAI,OAAO,GAAoC,+BAAe,CAAC;QAC/D,IAAI,MAAM,KAAK,KAAK;YAAE,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC;QACjE,+FAA+F;QAC/F,IAAI,OAAO,KAAK,+BAAe,IAAI,CAAC,wBAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,OAAO,GAAG,+BAAe,CAAC;QAC1F,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QACrF,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAEO,OAAO,CAAC,IAAY;QACxB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;IACnD,CAAC;CACJ,CAAA;AAfY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,sBAAsB,CAelC","sourcesContent":["import { AI_TYPES, AI_TYPE_UNKNOWN, AiType } from '@webpieces/ai-hook-rules';\nimport { injectable, bindingScopeValues } from 'inversify';\n\n/** The coding harness observed by the gate, plus the model the author reported in summary.json. */\nexport class AuthorIdentity {\n harness: AiType | typeof AI_TYPE_UNKNOWN;\n model: string;\n\n constructor(harness: AiType | typeof AI_TYPE_UNKNOWN, model: string) {\n this.harness = harness;\n this.model = model;\n }\n}\n\n/**\n * Resolves the authoring harness from session identifiers supplied by the harness itself.\n *\n * This deliberately does not trust summary.json's `agent` field: that file is AI-authored, while the\n * session variables are supplied by Claude Code / Codex before the model runs. Both-or-neither is\n * `unknown`; silently picking one in an ambiguous process would turn telemetry into a false claim.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class AuthorIdentityResolver {\n resolve(selfReportedModel: string): AuthorIdentity {\n const claude = this.present('CLAUDE_CODE_SESSION_ID');\n const codex = this.present('CODEX_SESSION_ID') || this.present('CODEX_THREAD_ID');\n let harness: AiType | typeof AI_TYPE_UNKNOWN = AI_TYPE_UNKNOWN;\n if (claude !== codex) harness = claude ? 'claude-code' : 'codex';\n // Keep this tied to ai-hook-rules' canonical vocabulary rather than growing a second spelling.\n if (harness !== AI_TYPE_UNKNOWN && !AI_TYPES.includes(harness)) harness = AI_TYPE_UNKNOWN;\n const model = selfReportedModel.trim() === '' ? 'unknown' : selfReportedModel.trim();\n return new AuthorIdentity(harness, model);\n }\n\n private present(name: string): boolean {\n return (process.env[name] ?? '').trim() !== '';\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { GateDefinition, ReviewJson } from '@webpieces/rules-config';
1
+ import { GateDefinition, PrSummary } from '@webpieces/rules-config';
2
2
  import { AuthorIdentity } from './author-identity';
3
3
  /**
4
4
  * Hidden marker on the FULL-DASHBOARD comment — the "1st comment" the PR description points at — so
@@ -35,7 +35,7 @@ export declare class DashboardInput {
35
35
  forkPoint: string;
36
36
  featureHead: string;
37
37
  mainHead: string;
38
- review: ReviewJson;
38
+ review: PrSummary;
39
39
  checklists: ChecklistRow[];
40
40
  /**
41
41
  * `commands.pr-gate.buildCommand` VERBATIM, named in the PR-body footer so `git log` records WHICH
@@ -64,7 +64,7 @@ export declare class DashboardInput {
64
64
  */
65
65
  suppressedChecklistCount: number;
66
66
  author: AuthorIdentity;
67
- constructor(title: string, gateResults: GateResult[], disables: DisableCounts, buildPassed: boolean, forkPoint: string, featureHead: string, mainHead: string, review: ReviewJson, checklists: ChecklistRow[], buildCommand: string, suppressedChecklistCount: number, author: AuthorIdentity);
67
+ constructor(title: string, gateResults: GateResult[], disables: DisableCounts, buildPassed: boolean, forkPoint: string, featureHead: string, mainHead: string, review: PrSummary, checklists: ChecklistRow[], buildCommand: string, suppressedChecklistCount: number, author: AuthorIdentity);
68
68
  }
69
69
  /** Renders the PR-gate dashboard markdown (gates × changed files, disables, risk, 3-point hashes). */
70
70
  export declare class Dashboard {
@@ -133,7 +133,7 @@ export declare class Dashboard {
133
133
  * Before this, `wp-finish-upsert-pr` would happily POST such a body and report success, and then
134
134
  * `wp-land-pr` refused those exact bytes — two commands in one flow disagreeing about what the
135
135
  * renderer produces, with a refusal that blamed an old release and prescribed re-running finish,
136
- * which re-rendered the identical pipe from the unchanged `review.json`. An infinite loop costing a
136
+ * which re-rendered the identical pipe from the unchanged `summary.json`. An infinite loop costing a
137
137
  * CI cycle per turn.
138
138
  *
139
139
  * `¦` (BROKEN BAR) rather than `\|`: this string's home is `git log` in a terminal, where a
@@ -170,7 +170,7 @@ export declare class Dashboard {
170
170
  * OVERRIDDEN is deliberately NOT folded into passed: an override is a human knowingly accepting a red
171
171
  * verdict, and a dashboard that painted that green would hide the single most review-worthy thing on
172
172
  * the PR. The blocking bucket is the FALLTHROUGH — CK_FAIL, CK_MISSING, CK_BAD_FORMAT and any verdict
173
- * added later all land there, matching review.json's own "not pass|warn|overridden ⇒ refuse" rule
173
+ * added later all land there, matching summary.json's own "not pass|warn|overridden ⇒ refuse" rule
174
174
  * rather than a second list that could silently drift green.
175
175
  */
176
176
  /**
@@ -98,7 +98,7 @@ class DashboardInput {
98
98
  forkPoint;
99
99
  featureHead;
100
100
  mainHead;
101
- review; // AI-authored risk/violations/summary (from review.json)
101
+ review; // AI-authored risk/violations/summary (from summary.json)
102
102
  checklists; // consumer checklists this branch triggered; [] for non-adopting repos
103
103
  /**
104
104
  * `commands.pr-gate.buildCommand` VERBATIM, named in the PR-body footer so `git log` records WHICH
@@ -301,7 +301,7 @@ let Dashboard = class Dashboard {
301
301
  * Before this, `wp-finish-upsert-pr` would happily POST such a body and report success, and then
302
302
  * `wp-land-pr` refused those exact bytes — two commands in one flow disagreeing about what the
303
303
  * renderer produces, with a refusal that blamed an old release and prescribed re-running finish,
304
- * which re-rendered the identical pipe from the unchanged `review.json`. An infinite loop costing a
304
+ * which re-rendered the identical pipe from the unchanged `summary.json`. An infinite loop costing a
305
305
  * CI cycle per turn.
306
306
  *
307
307
  * `¦` (BROKEN BAR) rather than `\|`: this string's home is `git log` in a terminal, where a
@@ -487,7 +487,7 @@ let Dashboard = class Dashboard {
487
487
  * OVERRIDDEN is deliberately NOT folded into passed: an override is a human knowingly accepting a red
488
488
  * verdict, and a dashboard that painted that green would hide the single most review-worthy thing on
489
489
  * the PR. The blocking bucket is the FALLTHROUGH — CK_FAIL, CK_MISSING, CK_BAD_FORMAT and any verdict
490
- * added later all land there, matching review.json's own "not pass|warn|overridden ⇒ refuse" rule
490
+ * added later all land there, matching summary.json's own "not pass|warn|overridden ⇒ refuse" rule
491
491
  * rather than a second list that could silently drift green.
492
492
  */
493
493
  /**
@@ -558,7 +558,7 @@ let Dashboard = class Dashboard {
558
558
  const violationLine = violations === 0 ? '🟢 No' : `🟡 Yes (${violations} violation(s))`;
559
559
  return [
560
560
  `**Risk Score:** ${this.riskBar(review.riskScore)} **${review.riskScore}/100** ${review.riskEmoji}`,
561
- new review_identity_renderer_1.ReviewIdentityRenderer().render(review.agent, review.model, 'Review agent'),
561
+ new review_identity_renderer_1.ReviewIdentityRenderer().render(review.agent, review.model, 'Summary agent'),
562
562
  `**Risk Level:** ${review.riskEmoji} **${review.riskLevel}**`,
563
563
  `**Pattern Violations:** ${violationLine}`,
564
564
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/dashboard/dashboard.ts"],"names":[],"mappings":";;;;AAAA,yEAAoE;AACpE,0DAaiC;AACjC,yCAA2D;AAG3D;;;;;;;GAOG;AACU,QAAA,qBAAqB,GAAG,iCAAiC,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,qBAAqB,GAAG,8EAA8E,CAAC;AAE7G;;;;;;;GAOG;AACH,MAAM,cAAc,GAAG,kFAAkF,CAAC;AAE1G,MAAa,UAAU;IACnB,IAAI,CAAS;IACb,YAAY,CAAS,CAAC,4EAA4E;IAClG,YAAY,CAAW;IAEvB,YAAY,IAAY,EAAE,YAAoB,EAAE,YAAsB;QAClE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;CACJ;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AAa,EAAE;SAC7C,CAAC;IACN,CAAC;IAEO,WAAW,CAAC,QAAuB;QACvC,IAAI,QAAQ,CAAC,cAAc,KAAK,CAAC;YAAE,OAAO,qCAAqC,CAAC;QAChF,MAAM,KAAK,GACP,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzF,OAAO,oCAAoC,QAAQ,CAAC,cAAc,WAAW,KAAK,EAAE,CAAC;IACzF,CAAC;CACJ,CAAA;AA/aY,8BAAS;oBAAT,SAAS;IADrB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,SAAS,CA+arB","sourcesContent":["import { ReviewIdentityRenderer } from './review-identity-renderer';\nimport {\n GateDefinition,\n WEBPIECES_DISABLE,\n RULE_NAMES,\n ReviewJson,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_FAIL,\n CK_MISSING,\n HOME_CONFIG_DIR,\n HOME_CONFIG_FILE,\n HOME_KEY_TURN_OFF_ALL_REVIEWERS,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AuthorIdentity } from './author-identity';\n\n/**\n * Hidden marker on the FULL-DASHBOARD comment — the \"1st comment\" the PR description points at — so\n * finish PATCHes its own comment on every push instead of appending a new one, exactly like the checklist\n * comment (see ChecklistCommentRenderer, which owns the 2nd).\n *\n * This comment did not exist before the PR description became the git-log body: the dashboard WAS the\n * description. Moving it here is what keeps a risk table out of every squash commit on main.\n */\nexport const DETAIL_COMMENT_MARKER = '<!-- webpieces-pr-detail v1 -->';\n\n/**\n * Footer on the full-dashboard comment. Names the tooling by REPO URL so a reader landing on a\n * generated comment in any consumer repo can find what generated it.\n *\n * It deliberately no longer asserts \"build ran via nx affected — not self-attested\": that sentence was\n * hard-coded and therefore wrong on every repo whose `buildCommand` is not nx. The build command is now\n * named for real, from config, in the PR-body footer — see {@link Dashboard.renderPrBody}.\n */\nconst DETAIL_COMMENT_FOOTER = 'Generated by https://github.com/deanhiller/webpieces-ts wp-finish-upsert-pr';\n\n/**\n * The last bullet of the PR description, and therefore of every squash commit body.\n *\n * Positional (\"1st\"/\"2nd\") on purpose — it is what a reader of `git log` can actually act on, far more\n * useful than naming an HTML marker they cannot see. On a PR opened by an OLDER release the checklist\n * comment already exists, so the dashboard comment lands second and this reads one off for that PR's\n * remaining life; it is cosmetic and self-corrects on the next PR.\n */\nconst DETAIL_POINTER = '(Full dashboard in 1st comment, reviewer checklist in 2nd — kept out of git log)';\n\nexport class GateResult {\n name: string;\n warningColor: string; // 'yellow' | 'red' — the color shown WHEN files matched (green is implicit)\n matchedFiles: string[];\n\n constructor(name: string, warningColor: string, matchedFiles: string[]) {\n this.name = name;\n this.warningColor = warningColor;\n this.matchedFiles = matchedFiles;\n }\n}\n\n// One row for a consumer review checklist the branch triggered. `status` is the resolved verdict (one of\n// CK_PASS | CK_WARN | CK_OVERRIDDEN | CK_FAIL | CK_MISSING | CK_BAD_FORMAT); `detail` is the reviewer\n// output / override justification. A row is always PASS/WARN/OVERRIDDEN by the time it renders — a failed,\n// missing or unreadable verdict throws before the dashboard is built. Rendered into the PR body so the\n// verdict reaches the server — the PR body is the artifact of the local flow that leaves the checkout\n// (alongside the HMAC gate token that proves the flow ran).\nexport class ChecklistRow {\n title: string; // the checklist id (= reviewer subagent name)\n status: string; // CK_* verdict\n detail: string; // reviewer output / override justification (surfaced for OVERRIDDEN)\n\n constructor(title: string, status: string, detail = '') {\n this.title = title;\n this.status = status;\n this.detail = detail;\n }\n}\n\n/**\n * One severity bucket of the rolled-up **Checklists** dashboard row: its emoji, the words that describe it,\n * and which checklists landed in it. Data-only.\n *\n * A bucket knows whether it should NAME its members: the non-green ones do (a reader has to know WHICH\n * reviewer to go read), the passed bucket does not (a list of what went fine is noise on a one-line row).\n */\nclass RollupBucket {\n label: string; // 'blocking' | 'overridden' | 'with concerns' | 'passed'\n emoji: string;\n named: boolean; // list the checklist ids on the row, or report a bare count\n titles: string[];\n\n constructor(label: string, emoji: string, named: boolean) {\n this.label = label;\n this.emoji = emoji;\n this.named = named;\n this.titles = [];\n }\n}\n\nexport class DisableCounts {\n webpiecesCount: number;\n eslintCount: number;\n webpiecesRules: string[];\n\n constructor(webpiecesCount: number, eslintCount: number, webpiecesRules: string[]) {\n this.webpiecesCount = webpiecesCount;\n this.eslintCount = eslintCount;\n this.webpiecesRules = webpiecesRules;\n }\n}\n\nexport class DashboardInput {\n title: string;\n gateResults: GateResult[];\n disables: DisableCounts;\n buildPassed: boolean;\n forkPoint: string;\n featureHead: string;\n mainHead: string;\n review: ReviewJson; // AI-authored risk/violations/summary (from review.json)\n checklists: ChecklistRow[]; // consumer checklists this branch triggered; [] for non-adopting repos\n /**\n * `commands.pr-gate.buildCommand` VERBATIM, named in the PR-body footer so `git log` records WHICH\n * command vouched for the commit. Read from config rather than hard-coded because the footer used to\n * assert \"build ran via nx affected\" on every repo, including those whose buildCommand is not nx.\n *\n * REQUIRED, with no default, and `checklists` lost its `= []` for the same reason. A defaulted\n * `buildCommand: string = ''` let every pre-existing 9-argument construction keep compiling while\n * silently rendering a footer that claims nothing — an absence that quietly means \"no build was\n * named\", which is the widening-by-omission the compatibility policy calls out. Making it required\n * means every caller states what vouched for the commit, and the empty string stays available for a\n * repo that genuinely has no build command, but only when someone writes it down.\n */\n buildCommand: string;\n /**\n * How many checklists WOULD have run but were disabled by either the project policy\n * (`reviewerAgents: 0`) or the machine kill switch — required ones included. `0` means no matching\n * checklist was suppressed; it is NOT a way of saying \"no checklist matched\", which\n * `checklists.length === 0` already says.\n *\n * The two states are byte-identical in `checklists` (both empty) and that is precisely the defect this\n * field closes: without it, a PR whose four REQUIRED reviewers were switched off is indistinguishable\n * in `main`'s history from a docs-only typo fix that legitimately matched nothing. REQUIRED with no\n * default, for the reason `buildCommand` is: a defaulted `0` would let every existing construction\n * keep compiling while asserting, silently, that nothing was suppressed.\n */\n suppressedChecklistCount: number;\n author: AuthorIdentity;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n title: string,\n gateResults: GateResult[],\n disables: DisableCounts,\n buildPassed: boolean,\n forkPoint: string,\n featureHead: string,\n mainHead: string,\n review: ReviewJson,\n checklists: ChecklistRow[],\n buildCommand: string,\n suppressedChecklistCount: number,\n author: AuthorIdentity,\n ) {\n this.title = title;\n this.gateResults = gateResults;\n this.disables = disables;\n this.buildPassed = buildPassed;\n this.forkPoint = forkPoint;\n this.featureHead = featureHead;\n this.mainHead = mainHead;\n this.review = review;\n this.checklists = checklists;\n this.buildCommand = buildCommand;\n this.suppressedChecklistCount = suppressedChecklistCount;\n this.author = author;\n }\n}\n\n/** Renders the PR-gate dashboard markdown (gates × changed files, disables, risk, 3-point hashes). */\n@injectable(bindingScopeValues.Singleton)\nexport class Dashboard {\n // Disabled gates are in-file examples (JSON has no comments) — skip them entirely.\n computeGateResults(gates: GateDefinition[], changedFiles: string[]): GateResult[] {\n return gates\n .filter((gate: GateDefinition): boolean => !gate.disabled)\n .map((gate: GateDefinition): GateResult => {\n const matched = changedFiles.filter((file: string): boolean =>\n this.matchesAny(gate.patterns, file),\n );\n return new GateResult(gate.name, gate.warningColor, matched);\n });\n }\n\n // Count disables ADDED in this PR by scanning added (`+`) lines of the diff patch. Rule-aware:\n // reports which webpieces rules were disabled, using the canonical RULE_NAMES vocabulary.\n countAddedDisables(patch: string): DisableCounts {\n let webpiecesCount = 0;\n let eslintCount = 0;\n const rules = new Set<string>();\n const allRuleTokens = Object.keys(RULE_NAMES).map(\n (key: string): string => (RULE_NAMES as Record<string, string>)[key],\n );\n\n for (const line of patch.split('\\n')) {\n if (!line.startsWith('+') || line.startsWith('+++')) continue;\n if (line.includes(WEBPIECES_DISABLE)) {\n webpiecesCount += 1;\n for (const token of allRuleTokens) {\n if (line.includes(token)) rules.add(token);\n }\n }\n if (line.includes('eslint-disable')) eslintCount += 1;\n }\n return new DisableCounts(webpiecesCount, eslintCount, Array.from(rules).sort());\n }\n\n /**\n * The FULL dashboard — every row (green included), the whole summary, the 3-point hash points.\n *\n * This is the **1st PR comment**, not the PR description. It used to be the description, and that is\n * exactly what put it into main's history: GitHub's `squash_merge_commit_message: PR_BODY` copies the\n * description verbatim into the squash commit, so every `git log` entry carried the risk table, the\n * hash points and the gate token. The description now holds {@link renderPrBody}'s compact form, and\n * everything long-form lives here where a reader can open it and `git log` never sees it.\n *\n * Machine-facing content belongs HERE too — this comment carries the HMAC gate token. That is the\n * whole rule that keeps the description clean: an HTML comment is invisible in rendered markdown but\n * perfectly visible in `git log`, so nothing hidden may live in the description.\n */\n renderDetailComment(input: DashboardInput): string {\n const lines: string[] = [];\n lines.push('## 🚦 PR Gate Dashboard');\n lines.push('');\n for (const line of this.riskLines(input.review)) lines.push(line);\n lines.push(new ReviewIdentityRenderer().renderAuthor(input.author.harness, input.author.model));\n lines.push(`**Build (nx affected):** ${input.buildPassed ? '🟢 Passed' : '🔴 Failed'}`);\n for (const result of input.gateResults) lines.push(this.gateLine(result));\n lines.push(this.disableLine(input.disables));\n const eslintEmoji =\n input.disables.eslintCount === 0 ? '🟢 No' : `🟡 ${input.disables.eslintCount} line(s)`;\n lines.push(`**ESLint Disables Added:** ${eslintEmoji}`);\n // ONE rolled-up row for ALL triggered consumer checklists — a worst-of colour and a count, sitting\n // with the other status rows. It used to be one row PER checklist, each inlining that checklist's\n // whole verdict/override paragraph: on a six-checklist PR that was the same ~90-word override\n // repeated six times, burying the signal rows above it — and every word of it was already in the\n // checklist COMMENT, per reviewer, in full. ALWAYS emitted, including the zero case: \"no reviewer\n // looked at this PR\" is a fact a reader must be told, and an absent row silently reads as a green\n // all-clear (see checklistRollupLine).\n lines.push(this.checklistRollupLine(input.checklists, input.suppressedChecklistCount));\n lines.push('');\n if (input.review.summary.trim() !== '') {\n lines.push('### Summary');\n lines.push(input.review.summary.trim());\n lines.push('');\n }\n lines.push('### 🔍 3-Point Hash Points');\n lines.push(`- Fork point (A): \\`${input.forkPoint.slice(0, 12)}\\``);\n lines.push(`- Feature HEAD (B): \\`${input.featureHead.slice(0, 12)}\\``);\n lines.push(`- Main HEAD (C): \\`${input.mainHead.slice(0, 12)}\\``);\n lines.push('');\n lines.push(`<sub>🤖 ${DETAIL_COMMENT_FOOTER}</sub>`);\n return lines.join('\\n');\n }\n\n /**\n * The PR DESCRIPTION — which is also, byte for byte, the squash-commit body that lands in main.\n *\n * ─── Why one string serves both ─────────────────────────────────────────────────────────────────\n * There used to be two: a long dashboard in the description and this compact form passed to\n * `gh pr merge --body-file`. That made the good `git log` reachable ONLY through an explicit\n * `--body-file` merge, because every other route (the GitHub Merge button, a bare `gh pr merge`)\n * takes its body from the repo's `squash_merge_commit_message`, and on `PR_BODY` that copied the\n * whole dashboard into history. Two repos ran that way for months.\n *\n * Making the DESCRIPTION the compact form inverts it: `PR_BODY` now yields exactly the right commit,\n * so the UI button, a bare `gh pr merge`, `wp-land-pr` and finish's own auto-merge all converge on\n * identical bytes. It rests on two GitHub repo settings — `squash_merge_commit_title: PR_TITLE` and\n * `squash_merge_commit_message: PR_BODY` — which are NOT a consumer's job: they are server-side, so no\n * config key can express them, and SquashSettingsEnforcer pins them on every run. That convergence is\n * the point, and `pr-body-is-merge-body.spec.ts` pins it.\n *\n * ─── The shape, and why each part earns its line ────────────────────────────────────────────────\n * The URL leads, BARE — no caption. It used to carry `(for git log)`, which was aimed at a reader on\n * the PR page (where the link is redundant, being the page you are already on) and was meant to stop\n * them deleting it. But this string is also the squash-commit body, so that caption landed verbatim in\n * `main`'s history on every commit, forever, to serve one transient reading. In `git log` a bare URL\n * is self-evidently the way back and needs no explanation. The permanent surface wins.\n * Then the risk score (always). Then ONLY the non-green flags, under a heading that SAYS the full list\n * is in the 1st comment — a `git log` reader has no page to glance at, so the heading has to carry\n * that itself rather than leaving \"why is this list short?\" to the pointer bullet alone. Then the\n * summary capped at 4 sentences, then the footer naming the build command that vouched for it.\n *\n * The hidden gate-token marker is appended AFTER this by the caller, so it is the very last line of\n * the description and therefore of the commit. It stays an HTML comment — invisible on the PR page,\n * visible in `git log` — which is a deliberate accepted trade: the alternative was reshaping a live\n * CI-critical surface that two consumer repos verify on every PR, to save one line of history.\n */\n renderPrBody(input: DashboardInput, prUrl: string): string {\n const lines: string[] = [];\n if (prUrl !== '') {\n lines.push(prUrl);\n lines.push('');\n }\n lines.push(\n `Risk: ${this.riskBar(input.review.riskScore)} ${input.review.riskScore}/100 ${input.review.riskEmoji} (${input.review.riskLevel})`,\n );\n lines.push(new ReviewIdentityRenderer().renderAuthor(input.author.harness, input.author.model, false));\n lines.push('');\n const flags = this.nonGreenFlags(input);\n lines.push(flags.length === 0\n ? 'Flags: 🟢 all green'\n : 'Non-green Flags (full list in first comment to avoid large git logs)');\n for (const flag of flags) lines.push(`- ${flag}`);\n // ALWAYS the last bullet, green case included. Without it the compact body reads as the whole\n // record, and the reader never learns that every green row, the full summary and each reviewer's\n // output are one click away.\n lines.push(`- ${DETAIL_POINTER}`);\n const summary = this.firstSentences(input.review.summary.trim(), 4);\n if (summary !== '') {\n lines.push('');\n lines.push(summary);\n }\n lines.push('');\n lines.push(this.prBodyFooter(input.buildCommand));\n return this.gitLogSafe(lines.join('\\n'));\n }\n\n /**\n * Makes THIS renderer own the invariant `wp-land-pr` checks: the compact body carries no markdown\n * heading and no table pipe.\n *\n * It is applied to the WHOLE joined string rather than to each author-supplied field, on purpose.\n * Every field this body interpolates — the review summary, an override justification, a checklist\n * title, a disabled rule name, `commands.pr-gate.buildCommand` — is text this package did not write,\n * and a `|` reaches all of them for entirely ordinary non-markdown reasons: a TypeScript union\n * (`'open' | 'paused'`), a regex alternation, a quoted shell pipeline, an OR in prose. Sanitizing at\n * the single exit point means a field added later is covered without anyone remembering to wrap it,\n * and none of this renderer's own literals contain either marker, so nothing of ours changes.\n *\n * Before this, `wp-finish-upsert-pr` would happily POST such a body and report success, and then\n * `wp-land-pr` refused those exact bytes — two commands in one flow disagreeing about what the\n * renderer produces, with a refusal that blamed an old release and prescribed re-running finish,\n * which re-rendered the identical pipe from the unchanged `review.json`. An infinite loop costing a\n * CI cycle per turn.\n *\n * `¦` (BROKEN BAR) rather than `\\|`: this string's home is `git log` in a terminal, where a\n * backslash is literal punctuation and a markdown escape means nothing. The substitution is visible\n * and reads correctly; the full, unaltered text is one click away in the 1st comment, which this\n * body's last bullet always points at. `##` collapses to `#` for the same reason — a heading in a\n * summary is markdown a plain-text history cannot carry either.\n */\n private gitLogSafe(body: string): string {\n return body.replace(/\\|/g, '\\u00a6').replace(/#{2,}/g, '#');\n }\n\n /**\n * The footer, naming the build command from `commands.pr-gate.buildCommand` VERBATIM.\n *\n * No backticks: this string's primary home is `git log` in a terminal, where markdown ticks are\n * literal punctuation. \"run locally\" is the honest claim — this is the LOCAL gate's receipt, and the\n * server-side proof is the gate token in the 1st comment, not this sentence.\n */\n private prBodyFooter(buildCommand: string): string {\n const cmd = buildCommand.trim();\n const ran = cmd === '' ? '' : ` (${cmd} run locally)`;\n return `Generated by webpieces-ts wp-finish-upsert-pr${ran}`;\n }\n\n // Every dashboard row that is NOT green, as a flat bullet list for the commit body. Green rows\n // (build passed, gate did not match, zero disables/violations) are intentionally omitted.\n private nonGreenFlags(input: DashboardInput): string[] {\n const flags: string[] = [];\n if (!input.buildPassed) flags.push('Build (nx affected): 🔴 Failed');\n if (input.review.violations.length > 0)\n flags.push(`Pattern Violations: 🟡 ${input.review.violations.length} violation(s)`);\n for (const result of input.gateResults) {\n if (result.matchedFiles.length === 0) continue;\n const emoji = result.warningColor === 'red' ? '🔴' : '🟡';\n flags.push(`${result.name}: ${emoji} ${result.matchedFiles.length} file(s)`);\n }\n if (input.disables.webpiecesCount > 0) {\n const which =\n input.disables.webpiecesRules.length > 0\n ? ` — ${input.disables.webpiecesRules.join(', ')}`\n : '';\n flags.push(\n `Webpieces Disables Added: 🟡 ${input.disables.webpiecesCount} line(s)${which}`,\n );\n }\n if (input.disables.eslintCount > 0)\n flags.push(`ESLint Disables Added: 🟡 ${input.disables.eslintCount} line(s)`);\n // A triggered checklist is noteworthy in main's history — carry each into the commit body.\n //\n // SUPPRESSED replaces those N bullets with exactly ONE, whatever N is. Not because the per-reviewer\n // bullets would lie — `checklistStatusText` was already hardened against a false \"passed\" — but\n // because with the kill switch on there are NO rows at all, and a body with no `Checklist — `\n // bullets is byte-identical to a PR that legitimately matched zero checklists (a docs-only typo\n // fix). Without this line, \"four REQUIRED reviewers were killed by a flag\" and \"nothing applied\n // here\" are indistinguishable in main's history forever. One compact bullet, in the existing\n // style — the loud version belongs in stage ②'s output and the 1st comment, not in `git log`.\n if (input.suppressedChecklistCount > 0) {\n flags.push(`Checklists — ${this.suppressedTail(input.suppressedChecklistCount)}`);\n }\n for (const row of input.checklists) {\n flags.push(`Checklist — ${row.title}: ${this.checklistStatusText(row)}`);\n }\n return flags;\n }\n\n // Emoji + words for a checklist verdict, shared by the dashboard row and the commit-body flag.\n // Every state is matched EXPLICITLY and the fallthrough names the status it did not recognize. The\n // previous `return '🟢 passed'` fallthrough meant any newly-added verdict rendered as a clean pass on\n // both the PR body and main's commit history until someone noticed — exactly the wrong default.\n private checklistStatusText(row: ChecklistRow): string {\n if (row.status === CK_OVERRIDDEN) {\n const why = row.detail.trim() !== '' ? ` — override: ${row.detail.trim()}` : '';\n return `🟠 OVERRIDDEN${why}`;\n }\n if (row.status === CK_WARN) return '🟡 passed with concerns';\n if (row.status === CK_FAIL) return '🔴 FAILED review';\n if (row.status === CK_MISSING) return '⚪ not reviewed';\n if (row.status === CK_PASS) return '🟢 passed';\n return `⚪ unknown verdict (${row.status})`;\n }\n\n // First `max` sentences of `text`. A sentence ends at `. ! ?` ONLY when followed by whitespace or\n // end-of-string, so interior dots in filenames/paths/versions (dependencies.json, runtime-graph.ts,\n // 0.4.447) do NOT split — and, unlike a greedy `[^.!?]+` regex, no text is ever dropped when such a\n // dot appears (that footgun silently deleted the run of prose up to the next real boundary). Keeps\n // the commit body scannable; the full summary still lives in the PR-body dashboard.\n private firstSentences(text: string, max: number): string {\n if (text === '') return '';\n const sentences: string[] = [];\n let start = 0;\n for (let i = 0; i < text.length && sentences.length < max; i++) {\n const ch = text[i];\n const isTerminator = ch === '.' || ch === '!' || ch === '?';\n const next = text[i + 1];\n if (isTerminator && (next === undefined || /\\s/.test(next))) {\n sentences.push(text.slice(start, i + 1).trim());\n start = i + 1;\n }\n }\n // Trailing text with no terminator still counts as a sentence (up to the cap).\n if (sentences.length < max && start < text.length) {\n const tail = text.slice(start).trim();\n if (tail !== '') sentences.push(tail);\n }\n return sentences.join(' ').trim();\n }\n\n // Self-contained glob matcher (** , * , ?) so pr-gate needs no extra runtime dependency.\n private globToRegex(pattern: string): RegExp {\n let re = '';\n let i = 0;\n while (i < pattern.length) {\n const ch = pattern[i];\n if (ch === '*' && pattern[i + 1] === '*') {\n re += '.*';\n i += 2;\n if (pattern[i] === '/') i += 1;\n continue;\n }\n if (ch === '*') {\n re += '[^/]*';\n i += 1;\n continue;\n }\n if (ch === '?') {\n re += '[^/]';\n i += 1;\n continue;\n }\n if ('.+^$(){}|[]\\\\'.includes(ch)) {\n re += '\\\\' + ch;\n i += 1;\n continue;\n }\n re += ch;\n i += 1;\n }\n return new RegExp('^' + re + '$');\n }\n\n private matchesAny(patterns: string[], file: string): boolean {\n for (const pattern of patterns) {\n if (this.globToRegex(pattern).test(file)) return true;\n }\n return false;\n }\n\n private gateLine(result: GateResult): string {\n if (result.matchedFiles.length === 0) return `**${result.name}:** 🟢 No`;\n const emoji = result.warningColor === 'red' ? '🔴' : '🟡';\n return `**${result.name}:** ${emoji} Yes (${result.matchedFiles.length} file(s))`;\n }\n\n /**\n * The ONE rolled-up **Checklists:** row, coloured worst-of across every checklist that ran, in the same\n * shape as its neighbours (`**Build (nx affected):** 🟢 Passed`). Counts and names only — never a line\n * of reviewer output or override justification, which is the whole reason this row exists.\n */\n private checklistRollupLine(rows: readonly ChecklistRow[], suppressedCount: number): string {\n // FIRST, and ahead of the zero-ran case below, which would say \"no review checklist matched this\n // PR\" — false here, and the one sentence that would turn a kill switch into an all-clear. ⚫ is a\n // colour no verdict uses, so it cannot be mistaken for a pass, a warning or a refusal.\n if (suppressedCount > 0) return this.suppressedChecklistLine(suppressedCount);\n const buckets = this.rollupBuckets(rows);\n const filled = buckets.filter((b: RollupBucket): boolean => b.titles.length > 0);\n // NO reviewer ran ⇒ the SKIPPED icon, never green. Green claims something was checked and came back\n // clean; ⚪ says nobody looked, which is what a reader has to be able to tell apart at a glance.\n if (filled.length === 0) {\n return '**Checklists:** ⚪ 0 ran — no review checklist matched this PR · see the checklist comment';\n }\n const allPassed = filled.length === 1 && !filled[0].named;\n const detail = allPassed\n ? 'all passed'\n : filled.map((b: RollupBucket): string => this.bucketPhrase(b)).join(', ');\n return `**Checklists:** ${filled[0].emoji} ${rows.length} ran — ${detail} · per-checklist detail in the checklist comment`;\n }\n\n /**\n * The four severity buckets, WORST FIRST, so `filled[0]` is the roll-up colour: red beats orange beats\n * yellow beats green. The colours are the same vocabulary the comment already uses (see verdictEmoji).\n *\n * OVERRIDDEN is deliberately NOT folded into passed: an override is a human knowingly accepting a red\n * verdict, and a dashboard that painted that green would hide the single most review-worthy thing on\n * the PR. The blocking bucket is the FALLTHROUGH — CK_FAIL, CK_MISSING, CK_BAD_FORMAT and any verdict\n * added later all land there, matching review.json's own \"not pass|warn|overridden ⇒ refuse\" rule\n * rather than a second list that could silently drift green.\n */\n /**\n * The full-dashboard row for a suppressed PR. Verbose is FINE here — this lands in the PR's 1st\n * comment, not in `git log`.\n */\n private suppressedChecklistLine(suppressedCount: number): string {\n return `**Checklists:** ${this.suppressedTail(suppressedCount)}`\n + ' · NO reviewer subagent ran on this PR — use a positive reviewerAgents value and disable the machine kill switch to get them back';\n }\n\n /**\n * The ONE sentence both the dashboard row and the commit-body bullet are built from, so the two can\n * never disagree about what was switched off or by what.\n *\n * Every part of it earns its place in `main`'s permanent history:\n * • the COUNT, because \"suppressed 4\" and \"0 applicable\" are different facts and both must be\n * tellable apart forever — an absent bullet says the second while meaning the first;\n * • \"required included\", because otherwise it reads as an optional-only skip, which it is not;\n * • both supported controls, because this compact input carries the count but not the source.\n * ⚫ is deliberately outside the verdict palette (🟢🟡🔴🟠⚪ are all taken by checklistStatusText), so\n * nothing here can be mistaken for a verdict a reviewer actually returned.\n */\n private suppressedTail(suppressedCount: number): string {\n return `⚫ ALL ${suppressedCount} SUPPRESSED (required included) by `\n + `reviewer policy (reviewerAgents: 0 or ${HOME_KEY_TURN_OFF_ALL_REVIEWERS} in `\n + `~/${HOME_CONFIG_DIR}/${HOME_CONFIG_FILE})`;\n }\n\n private rollupBuckets(rows: readonly ChecklistRow[]): RollupBucket[] {\n const blocking = new RollupBucket('blocking', '🔴', true);\n const overridden = new RollupBucket('overridden', '🟠', true);\n const warned = new RollupBucket('with concerns', '🟡', true);\n const passed = new RollupBucket('passed', '🟢', false);\n for (const row of rows) {\n if (row.status === CK_PASS) passed.titles.push(row.title);\n else if (row.status === CK_WARN) warned.titles.push(row.title);\n else if (row.status === CK_OVERRIDDEN) overridden.titles.push(row.title);\n else blocking.titles.push(row.title);\n }\n return [blocking, overridden, warned, passed];\n }\n\n // `2 overridden (a, b)` for the buckets a reviewer must act on; a bare `3 passed` for the one they need\n // no list of. Names are capped so a many-checklist repo still gets a ONE-LINE row.\n private bucketPhrase(bucket: RollupBucket): string {\n if (!bucket.named) return `${bucket.titles.length} ${bucket.label}`;\n return `${bucket.titles.length} ${bucket.label} (${this.compactNames(bucket.titles)})`;\n }\n\n private compactNames(titles: readonly string[]): string {\n const max = 4;\n if (titles.length <= max) return titles.join(', ');\n return `${titles.slice(0, max).join(', ')} +${titles.length - max} more`;\n }\n\n // 10-cell risk bar colored by band (🟩 ≤25, 🟨 ≤50, 🟧 ≤75, 🟥 >75), at least one filled cell.\n private riskBar(score: number): string {\n const clamped = Math.max(0, Math.min(100, score));\n const cell = clamped <= 25 ? '🟩' : clamped <= 50 ? '🟨' : clamped <= 75 ? '🟧' : '🟥';\n const filled = Math.max(1, Math.min(10, Math.round(clamped / 10)));\n return cell.repeat(filled) + '⬜'.repeat(10 - filled);\n }\n\n // RISK section (the AI half): Risk Score bar, Risk Level, Pattern Violations.\n private riskLines(review: ReviewJson): string[] {\n const violations = review.violations.length;\n const violationLine = violations === 0 ? '🟢 No' : `🟡 Yes (${violations} violation(s))`;\n return [\n `**Risk Score:** ${this.riskBar(review.riskScore)} **${review.riskScore}/100** ${review.riskEmoji}`,\n new ReviewIdentityRenderer().render(review.agent, review.model, 'Review agent'),\n `**Risk Level:** ${review.riskEmoji} **${review.riskLevel}**`,\n `**Pattern Violations:** ${violationLine}`,\n ];\n }\n\n private disableLine(disables: DisableCounts): string {\n if (disables.webpiecesCount === 0) return '**Webpieces Disables Added:** 🟢 No';\n const which =\n disables.webpiecesRules.length > 0 ? ` — ${disables.webpiecesRules.join(', ')}` : '';\n return `**Webpieces Disables Added:** 🟡 ${disables.webpiecesCount} line(s)${which}`;\n }\n}\n"]}
1
+ {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/dashboard/dashboard.ts"],"names":[],"mappings":";;;;AAAA,yEAAoE;AACpE,0DAaiC;AACjC,yCAA2D;AAG3D;;;;;;;GAOG;AACU,QAAA,qBAAqB,GAAG,iCAAiC,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,qBAAqB,GAAG,8EAA8E,CAAC;AAE7G;;;;;;;GAOG;AACH,MAAM,cAAc,GAAG,kFAAkF,CAAC;AAE1G,MAAa,UAAU;IACnB,IAAI,CAAS;IACb,YAAY,CAAS,CAAC,4EAA4E;IAClG,YAAY,CAAW;IAEvB,YAAY,IAAY,EAAE,YAAoB,EAAE,YAAsB;QAClE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;CACJ;AA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a,EAAE;SAC7C,CAAC;IACN,CAAC;IAEO,WAAW,CAAC,QAAuB;QACvC,IAAI,QAAQ,CAAC,cAAc,KAAK,CAAC;YAAE,OAAO,qCAAqC,CAAC;QAChF,MAAM,KAAK,GACP,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzF,OAAO,oCAAoC,QAAQ,CAAC,cAAc,WAAW,KAAK,EAAE,CAAC;IACzF,CAAC;CACJ,CAAA;AA/aY,8BAAS;oBAAT,SAAS;IADrB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,SAAS,CA+arB","sourcesContent":["import { ReviewIdentityRenderer } from './review-identity-renderer';\nimport {\n GateDefinition,\n WEBPIECES_DISABLE,\n RULE_NAMES,\n PrSummary,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_FAIL,\n CK_MISSING,\n HOME_CONFIG_DIR,\n HOME_CONFIG_FILE,\n HOME_KEY_TURN_OFF_ALL_REVIEWERS,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AuthorIdentity } from './author-identity';\n\n/**\n * Hidden marker on the FULL-DASHBOARD comment — the \"1st comment\" the PR description points at — so\n * finish PATCHes its own comment on every push instead of appending a new one, exactly like the checklist\n * comment (see ChecklistCommentRenderer, which owns the 2nd).\n *\n * This comment did not exist before the PR description became the git-log body: the dashboard WAS the\n * description. Moving it here is what keeps a risk table out of every squash commit on main.\n */\nexport const DETAIL_COMMENT_MARKER = '<!-- webpieces-pr-detail v1 -->';\n\n/**\n * Footer on the full-dashboard comment. Names the tooling by REPO URL so a reader landing on a\n * generated comment in any consumer repo can find what generated it.\n *\n * It deliberately no longer asserts \"build ran via nx affected — not self-attested\": that sentence was\n * hard-coded and therefore wrong on every repo whose `buildCommand` is not nx. The build command is now\n * named for real, from config, in the PR-body footer — see {@link Dashboard.renderPrBody}.\n */\nconst DETAIL_COMMENT_FOOTER = 'Generated by https://github.com/deanhiller/webpieces-ts wp-finish-upsert-pr';\n\n/**\n * The last bullet of the PR description, and therefore of every squash commit body.\n *\n * Positional (\"1st\"/\"2nd\") on purpose — it is what a reader of `git log` can actually act on, far more\n * useful than naming an HTML marker they cannot see. On a PR opened by an OLDER release the checklist\n * comment already exists, so the dashboard comment lands second and this reads one off for that PR's\n * remaining life; it is cosmetic and self-corrects on the next PR.\n */\nconst DETAIL_POINTER = '(Full dashboard in 1st comment, reviewer checklist in 2nd — kept out of git log)';\n\nexport class GateResult {\n name: string;\n warningColor: string; // 'yellow' | 'red' — the color shown WHEN files matched (green is implicit)\n matchedFiles: string[];\n\n constructor(name: string, warningColor: string, matchedFiles: string[]) {\n this.name = name;\n this.warningColor = warningColor;\n this.matchedFiles = matchedFiles;\n }\n}\n\n// One row for a consumer review checklist the branch triggered. `status` is the resolved verdict (one of\n// CK_PASS | CK_WARN | CK_OVERRIDDEN | CK_FAIL | CK_MISSING | CK_BAD_FORMAT); `detail` is the reviewer\n// output / override justification. A row is always PASS/WARN/OVERRIDDEN by the time it renders — a failed,\n// missing or unreadable verdict throws before the dashboard is built. Rendered into the PR body so the\n// verdict reaches the server — the PR body is the artifact of the local flow that leaves the checkout\n// (alongside the HMAC gate token that proves the flow ran).\nexport class ChecklistRow {\n title: string; // the checklist id (= reviewer subagent name)\n status: string; // CK_* verdict\n detail: string; // reviewer output / override justification (surfaced for OVERRIDDEN)\n\n constructor(title: string, status: string, detail = '') {\n this.title = title;\n this.status = status;\n this.detail = detail;\n }\n}\n\n/**\n * One severity bucket of the rolled-up **Checklists** dashboard row: its emoji, the words that describe it,\n * and which checklists landed in it. Data-only.\n *\n * A bucket knows whether it should NAME its members: the non-green ones do (a reader has to know WHICH\n * reviewer to go read), the passed bucket does not (a list of what went fine is noise on a one-line row).\n */\nclass RollupBucket {\n label: string; // 'blocking' | 'overridden' | 'with concerns' | 'passed'\n emoji: string;\n named: boolean; // list the checklist ids on the row, or report a bare count\n titles: string[];\n\n constructor(label: string, emoji: string, named: boolean) {\n this.label = label;\n this.emoji = emoji;\n this.named = named;\n this.titles = [];\n }\n}\n\nexport class DisableCounts {\n webpiecesCount: number;\n eslintCount: number;\n webpiecesRules: string[];\n\n constructor(webpiecesCount: number, eslintCount: number, webpiecesRules: string[]) {\n this.webpiecesCount = webpiecesCount;\n this.eslintCount = eslintCount;\n this.webpiecesRules = webpiecesRules;\n }\n}\n\nexport class DashboardInput {\n title: string;\n gateResults: GateResult[];\n disables: DisableCounts;\n buildPassed: boolean;\n forkPoint: string;\n featureHead: string;\n mainHead: string;\n review: PrSummary; // AI-authored risk/violations/summary (from summary.json)\n checklists: ChecklistRow[]; // consumer checklists this branch triggered; [] for non-adopting repos\n /**\n * `commands.pr-gate.buildCommand` VERBATIM, named in the PR-body footer so `git log` records WHICH\n * command vouched for the commit. Read from config rather than hard-coded because the footer used to\n * assert \"build ran via nx affected\" on every repo, including those whose buildCommand is not nx.\n *\n * REQUIRED, with no default, and `checklists` lost its `= []` for the same reason. A defaulted\n * `buildCommand: string = ''` let every pre-existing 9-argument construction keep compiling while\n * silently rendering a footer that claims nothing — an absence that quietly means \"no build was\n * named\", which is the widening-by-omission the compatibility policy calls out. Making it required\n * means every caller states what vouched for the commit, and the empty string stays available for a\n * repo that genuinely has no build command, but only when someone writes it down.\n */\n buildCommand: string;\n /**\n * How many checklists WOULD have run but were disabled by either the project policy\n * (`reviewerAgents: 0`) or the machine kill switch — required ones included. `0` means no matching\n * checklist was suppressed; it is NOT a way of saying \"no checklist matched\", which\n * `checklists.length === 0` already says.\n *\n * The two states are byte-identical in `checklists` (both empty) and that is precisely the defect this\n * field closes: without it, a PR whose four REQUIRED reviewers were switched off is indistinguishable\n * in `main`'s history from a docs-only typo fix that legitimately matched nothing. REQUIRED with no\n * default, for the reason `buildCommand` is: a defaulted `0` would let every existing construction\n * keep compiling while asserting, silently, that nothing was suppressed.\n */\n suppressedChecklistCount: number;\n author: AuthorIdentity;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n title: string,\n gateResults: GateResult[],\n disables: DisableCounts,\n buildPassed: boolean,\n forkPoint: string,\n featureHead: string,\n mainHead: string,\n review: PrSummary,\n checklists: ChecklistRow[],\n buildCommand: string,\n suppressedChecklistCount: number,\n author: AuthorIdentity,\n ) {\n this.title = title;\n this.gateResults = gateResults;\n this.disables = disables;\n this.buildPassed = buildPassed;\n this.forkPoint = forkPoint;\n this.featureHead = featureHead;\n this.mainHead = mainHead;\n this.review = review;\n this.checklists = checklists;\n this.buildCommand = buildCommand;\n this.suppressedChecklistCount = suppressedChecklistCount;\n this.author = author;\n }\n}\n\n/** Renders the PR-gate dashboard markdown (gates × changed files, disables, risk, 3-point hashes). */\n@injectable(bindingScopeValues.Singleton)\nexport class Dashboard {\n // Disabled gates are in-file examples (JSON has no comments) — skip them entirely.\n computeGateResults(gates: GateDefinition[], changedFiles: string[]): GateResult[] {\n return gates\n .filter((gate: GateDefinition): boolean => !gate.disabled)\n .map((gate: GateDefinition): GateResult => {\n const matched = changedFiles.filter((file: string): boolean =>\n this.matchesAny(gate.patterns, file),\n );\n return new GateResult(gate.name, gate.warningColor, matched);\n });\n }\n\n // Count disables ADDED in this PR by scanning added (`+`) lines of the diff patch. Rule-aware:\n // reports which webpieces rules were disabled, using the canonical RULE_NAMES vocabulary.\n countAddedDisables(patch: string): DisableCounts {\n let webpiecesCount = 0;\n let eslintCount = 0;\n const rules = new Set<string>();\n const allRuleTokens = Object.keys(RULE_NAMES).map(\n (key: string): string => (RULE_NAMES as Record<string, string>)[key],\n );\n\n for (const line of patch.split('\\n')) {\n if (!line.startsWith('+') || line.startsWith('+++')) continue;\n if (line.includes(WEBPIECES_DISABLE)) {\n webpiecesCount += 1;\n for (const token of allRuleTokens) {\n if (line.includes(token)) rules.add(token);\n }\n }\n if (line.includes('eslint-disable')) eslintCount += 1;\n }\n return new DisableCounts(webpiecesCount, eslintCount, Array.from(rules).sort());\n }\n\n /**\n * The FULL dashboard — every row (green included), the whole summary, the 3-point hash points.\n *\n * This is the **1st PR comment**, not the PR description. It used to be the description, and that is\n * exactly what put it into main's history: GitHub's `squash_merge_commit_message: PR_BODY` copies the\n * description verbatim into the squash commit, so every `git log` entry carried the risk table, the\n * hash points and the gate token. The description now holds {@link renderPrBody}'s compact form, and\n * everything long-form lives here where a reader can open it and `git log` never sees it.\n *\n * Machine-facing content belongs HERE too — this comment carries the HMAC gate token. That is the\n * whole rule that keeps the description clean: an HTML comment is invisible in rendered markdown but\n * perfectly visible in `git log`, so nothing hidden may live in the description.\n */\n renderDetailComment(input: DashboardInput): string {\n const lines: string[] = [];\n lines.push('## 🚦 PR Gate Dashboard');\n lines.push('');\n for (const line of this.riskLines(input.review)) lines.push(line);\n lines.push(new ReviewIdentityRenderer().renderAuthor(input.author.harness, input.author.model));\n lines.push(`**Build (nx affected):** ${input.buildPassed ? '🟢 Passed' : '🔴 Failed'}`);\n for (const result of input.gateResults) lines.push(this.gateLine(result));\n lines.push(this.disableLine(input.disables));\n const eslintEmoji =\n input.disables.eslintCount === 0 ? '🟢 No' : `🟡 ${input.disables.eslintCount} line(s)`;\n lines.push(`**ESLint Disables Added:** ${eslintEmoji}`);\n // ONE rolled-up row for ALL triggered consumer checklists — a worst-of colour and a count, sitting\n // with the other status rows. It used to be one row PER checklist, each inlining that checklist's\n // whole verdict/override paragraph: on a six-checklist PR that was the same ~90-word override\n // repeated six times, burying the signal rows above it — and every word of it was already in the\n // checklist COMMENT, per reviewer, in full. ALWAYS emitted, including the zero case: \"no reviewer\n // looked at this PR\" is a fact a reader must be told, and an absent row silently reads as a green\n // all-clear (see checklistRollupLine).\n lines.push(this.checklistRollupLine(input.checklists, input.suppressedChecklistCount));\n lines.push('');\n if (input.review.summary.trim() !== '') {\n lines.push('### Summary');\n lines.push(input.review.summary.trim());\n lines.push('');\n }\n lines.push('### 🔍 3-Point Hash Points');\n lines.push(`- Fork point (A): \\`${input.forkPoint.slice(0, 12)}\\``);\n lines.push(`- Feature HEAD (B): \\`${input.featureHead.slice(0, 12)}\\``);\n lines.push(`- Main HEAD (C): \\`${input.mainHead.slice(0, 12)}\\``);\n lines.push('');\n lines.push(`<sub>🤖 ${DETAIL_COMMENT_FOOTER}</sub>`);\n return lines.join('\\n');\n }\n\n /**\n * The PR DESCRIPTION — which is also, byte for byte, the squash-commit body that lands in main.\n *\n * ─── Why one string serves both ─────────────────────────────────────────────────────────────────\n * There used to be two: a long dashboard in the description and this compact form passed to\n * `gh pr merge --body-file`. That made the good `git log` reachable ONLY through an explicit\n * `--body-file` merge, because every other route (the GitHub Merge button, a bare `gh pr merge`)\n * takes its body from the repo's `squash_merge_commit_message`, and on `PR_BODY` that copied the\n * whole dashboard into history. Two repos ran that way for months.\n *\n * Making the DESCRIPTION the compact form inverts it: `PR_BODY` now yields exactly the right commit,\n * so the UI button, a bare `gh pr merge`, `wp-land-pr` and finish's own auto-merge all converge on\n * identical bytes. It rests on two GitHub repo settings — `squash_merge_commit_title: PR_TITLE` and\n * `squash_merge_commit_message: PR_BODY` — which are NOT a consumer's job: they are server-side, so no\n * config key can express them, and SquashSettingsEnforcer pins them on every run. That convergence is\n * the point, and `pr-body-is-merge-body.spec.ts` pins it.\n *\n * ─── The shape, and why each part earns its line ────────────────────────────────────────────────\n * The URL leads, BARE — no caption. It used to carry `(for git log)`, which was aimed at a reader on\n * the PR page (where the link is redundant, being the page you are already on) and was meant to stop\n * them deleting it. But this string is also the squash-commit body, so that caption landed verbatim in\n * `main`'s history on every commit, forever, to serve one transient reading. In `git log` a bare URL\n * is self-evidently the way back and needs no explanation. The permanent surface wins.\n * Then the risk score (always). Then ONLY the non-green flags, under a heading that SAYS the full list\n * is in the 1st comment — a `git log` reader has no page to glance at, so the heading has to carry\n * that itself rather than leaving \"why is this list short?\" to the pointer bullet alone. Then the\n * summary capped at 4 sentences, then the footer naming the build command that vouched for it.\n *\n * The hidden gate-token marker is appended AFTER this by the caller, so it is the very last line of\n * the description and therefore of the commit. It stays an HTML comment — invisible on the PR page,\n * visible in `git log` — which is a deliberate accepted trade: the alternative was reshaping a live\n * CI-critical surface that two consumer repos verify on every PR, to save one line of history.\n */\n renderPrBody(input: DashboardInput, prUrl: string): string {\n const lines: string[] = [];\n if (prUrl !== '') {\n lines.push(prUrl);\n lines.push('');\n }\n lines.push(\n `Risk: ${this.riskBar(input.review.riskScore)} ${input.review.riskScore}/100 ${input.review.riskEmoji} (${input.review.riskLevel})`,\n );\n lines.push(new ReviewIdentityRenderer().renderAuthor(input.author.harness, input.author.model, false));\n lines.push('');\n const flags = this.nonGreenFlags(input);\n lines.push(flags.length === 0\n ? 'Flags: 🟢 all green'\n : 'Non-green Flags (full list in first comment to avoid large git logs)');\n for (const flag of flags) lines.push(`- ${flag}`);\n // ALWAYS the last bullet, green case included. Without it the compact body reads as the whole\n // record, and the reader never learns that every green row, the full summary and each reviewer's\n // output are one click away.\n lines.push(`- ${DETAIL_POINTER}`);\n const summary = this.firstSentences(input.review.summary.trim(), 4);\n if (summary !== '') {\n lines.push('');\n lines.push(summary);\n }\n lines.push('');\n lines.push(this.prBodyFooter(input.buildCommand));\n return this.gitLogSafe(lines.join('\\n'));\n }\n\n /**\n * Makes THIS renderer own the invariant `wp-land-pr` checks: the compact body carries no markdown\n * heading and no table pipe.\n *\n * It is applied to the WHOLE joined string rather than to each author-supplied field, on purpose.\n * Every field this body interpolates — the review summary, an override justification, a checklist\n * title, a disabled rule name, `commands.pr-gate.buildCommand` — is text this package did not write,\n * and a `|` reaches all of them for entirely ordinary non-markdown reasons: a TypeScript union\n * (`'open' | 'paused'`), a regex alternation, a quoted shell pipeline, an OR in prose. Sanitizing at\n * the single exit point means a field added later is covered without anyone remembering to wrap it,\n * and none of this renderer's own literals contain either marker, so nothing of ours changes.\n *\n * Before this, `wp-finish-upsert-pr` would happily POST such a body and report success, and then\n * `wp-land-pr` refused those exact bytes — two commands in one flow disagreeing about what the\n * renderer produces, with a refusal that blamed an old release and prescribed re-running finish,\n * which re-rendered the identical pipe from the unchanged `summary.json`. An infinite loop costing a\n * CI cycle per turn.\n *\n * `¦` (BROKEN BAR) rather than `\\|`: this string's home is `git log` in a terminal, where a\n * backslash is literal punctuation and a markdown escape means nothing. The substitution is visible\n * and reads correctly; the full, unaltered text is one click away in the 1st comment, which this\n * body's last bullet always points at. `##` collapses to `#` for the same reason — a heading in a\n * summary is markdown a plain-text history cannot carry either.\n */\n private gitLogSafe(body: string): string {\n return body.replace(/\\|/g, '\\u00a6').replace(/#{2,}/g, '#');\n }\n\n /**\n * The footer, naming the build command from `commands.pr-gate.buildCommand` VERBATIM.\n *\n * No backticks: this string's primary home is `git log` in a terminal, where markdown ticks are\n * literal punctuation. \"run locally\" is the honest claim — this is the LOCAL gate's receipt, and the\n * server-side proof is the gate token in the 1st comment, not this sentence.\n */\n private prBodyFooter(buildCommand: string): string {\n const cmd = buildCommand.trim();\n const ran = cmd === '' ? '' : ` (${cmd} run locally)`;\n return `Generated by webpieces-ts wp-finish-upsert-pr${ran}`;\n }\n\n // Every dashboard row that is NOT green, as a flat bullet list for the commit body. Green rows\n // (build passed, gate did not match, zero disables/violations) are intentionally omitted.\n private nonGreenFlags(input: DashboardInput): string[] {\n const flags: string[] = [];\n if (!input.buildPassed) flags.push('Build (nx affected): 🔴 Failed');\n if (input.review.violations.length > 0)\n flags.push(`Pattern Violations: 🟡 ${input.review.violations.length} violation(s)`);\n for (const result of input.gateResults) {\n if (result.matchedFiles.length === 0) continue;\n const emoji = result.warningColor === 'red' ? '🔴' : '🟡';\n flags.push(`${result.name}: ${emoji} ${result.matchedFiles.length} file(s)`);\n }\n if (input.disables.webpiecesCount > 0) {\n const which =\n input.disables.webpiecesRules.length > 0\n ? ` — ${input.disables.webpiecesRules.join(', ')}`\n : '';\n flags.push(\n `Webpieces Disables Added: 🟡 ${input.disables.webpiecesCount} line(s)${which}`,\n );\n }\n if (input.disables.eslintCount > 0)\n flags.push(`ESLint Disables Added: 🟡 ${input.disables.eslintCount} line(s)`);\n // A triggered checklist is noteworthy in main's history — carry each into the commit body.\n //\n // SUPPRESSED replaces those N bullets with exactly ONE, whatever N is. Not because the per-reviewer\n // bullets would lie — `checklistStatusText` was already hardened against a false \"passed\" — but\n // because with the kill switch on there are NO rows at all, and a body with no `Checklist — `\n // bullets is byte-identical to a PR that legitimately matched zero checklists (a docs-only typo\n // fix). Without this line, \"four REQUIRED reviewers were killed by a flag\" and \"nothing applied\n // here\" are indistinguishable in main's history forever. One compact bullet, in the existing\n // style — the loud version belongs in stage ②'s output and the 1st comment, not in `git log`.\n if (input.suppressedChecklistCount > 0) {\n flags.push(`Checklists — ${this.suppressedTail(input.suppressedChecklistCount)}`);\n }\n for (const row of input.checklists) {\n flags.push(`Checklist — ${row.title}: ${this.checklistStatusText(row)}`);\n }\n return flags;\n }\n\n // Emoji + words for a checklist verdict, shared by the dashboard row and the commit-body flag.\n // Every state is matched EXPLICITLY and the fallthrough names the status it did not recognize. The\n // previous `return '🟢 passed'` fallthrough meant any newly-added verdict rendered as a clean pass on\n // both the PR body and main's commit history until someone noticed — exactly the wrong default.\n private checklistStatusText(row: ChecklistRow): string {\n if (row.status === CK_OVERRIDDEN) {\n const why = row.detail.trim() !== '' ? ` — override: ${row.detail.trim()}` : '';\n return `🟠 OVERRIDDEN${why}`;\n }\n if (row.status === CK_WARN) return '🟡 passed with concerns';\n if (row.status === CK_FAIL) return '🔴 FAILED review';\n if (row.status === CK_MISSING) return '⚪ not reviewed';\n if (row.status === CK_PASS) return '🟢 passed';\n return `⚪ unknown verdict (${row.status})`;\n }\n\n // First `max` sentences of `text`. A sentence ends at `. ! ?` ONLY when followed by whitespace or\n // end-of-string, so interior dots in filenames/paths/versions (dependencies.json, runtime-graph.ts,\n // 0.4.447) do NOT split — and, unlike a greedy `[^.!?]+` regex, no text is ever dropped when such a\n // dot appears (that footgun silently deleted the run of prose up to the next real boundary). Keeps\n // the commit body scannable; the full summary still lives in the PR-body dashboard.\n private firstSentences(text: string, max: number): string {\n if (text === '') return '';\n const sentences: string[] = [];\n let start = 0;\n for (let i = 0; i < text.length && sentences.length < max; i++) {\n const ch = text[i];\n const isTerminator = ch === '.' || ch === '!' || ch === '?';\n const next = text[i + 1];\n if (isTerminator && (next === undefined || /\\s/.test(next))) {\n sentences.push(text.slice(start, i + 1).trim());\n start = i + 1;\n }\n }\n // Trailing text with no terminator still counts as a sentence (up to the cap).\n if (sentences.length < max && start < text.length) {\n const tail = text.slice(start).trim();\n if (tail !== '') sentences.push(tail);\n }\n return sentences.join(' ').trim();\n }\n\n // Self-contained glob matcher (** , * , ?) so pr-gate needs no extra runtime dependency.\n private globToRegex(pattern: string): RegExp {\n let re = '';\n let i = 0;\n while (i < pattern.length) {\n const ch = pattern[i];\n if (ch === '*' && pattern[i + 1] === '*') {\n re += '.*';\n i += 2;\n if (pattern[i] === '/') i += 1;\n continue;\n }\n if (ch === '*') {\n re += '[^/]*';\n i += 1;\n continue;\n }\n if (ch === '?') {\n re += '[^/]';\n i += 1;\n continue;\n }\n if ('.+^$(){}|[]\\\\'.includes(ch)) {\n re += '\\\\' + ch;\n i += 1;\n continue;\n }\n re += ch;\n i += 1;\n }\n return new RegExp('^' + re + '$');\n }\n\n private matchesAny(patterns: string[], file: string): boolean {\n for (const pattern of patterns) {\n if (this.globToRegex(pattern).test(file)) return true;\n }\n return false;\n }\n\n private gateLine(result: GateResult): string {\n if (result.matchedFiles.length === 0) return `**${result.name}:** 🟢 No`;\n const emoji = result.warningColor === 'red' ? '🔴' : '🟡';\n return `**${result.name}:** ${emoji} Yes (${result.matchedFiles.length} file(s))`;\n }\n\n /**\n * The ONE rolled-up **Checklists:** row, coloured worst-of across every checklist that ran, in the same\n * shape as its neighbours (`**Build (nx affected):** 🟢 Passed`). Counts and names only — never a line\n * of reviewer output or override justification, which is the whole reason this row exists.\n */\n private checklistRollupLine(rows: readonly ChecklistRow[], suppressedCount: number): string {\n // FIRST, and ahead of the zero-ran case below, which would say \"no review checklist matched this\n // PR\" — false here, and the one sentence that would turn a kill switch into an all-clear. ⚫ is a\n // colour no verdict uses, so it cannot be mistaken for a pass, a warning or a refusal.\n if (suppressedCount > 0) return this.suppressedChecklistLine(suppressedCount);\n const buckets = this.rollupBuckets(rows);\n const filled = buckets.filter((b: RollupBucket): boolean => b.titles.length > 0);\n // NO reviewer ran ⇒ the SKIPPED icon, never green. Green claims something was checked and came back\n // clean; ⚪ says nobody looked, which is what a reader has to be able to tell apart at a glance.\n if (filled.length === 0) {\n return '**Checklists:** ⚪ 0 ran — no review checklist matched this PR · see the checklist comment';\n }\n const allPassed = filled.length === 1 && !filled[0].named;\n const detail = allPassed\n ? 'all passed'\n : filled.map((b: RollupBucket): string => this.bucketPhrase(b)).join(', ');\n return `**Checklists:** ${filled[0].emoji} ${rows.length} ran — ${detail} · per-checklist detail in the checklist comment`;\n }\n\n /**\n * The four severity buckets, WORST FIRST, so `filled[0]` is the roll-up colour: red beats orange beats\n * yellow beats green. The colours are the same vocabulary the comment already uses (see verdictEmoji).\n *\n * OVERRIDDEN is deliberately NOT folded into passed: an override is a human knowingly accepting a red\n * verdict, and a dashboard that painted that green would hide the single most review-worthy thing on\n * the PR. The blocking bucket is the FALLTHROUGH — CK_FAIL, CK_MISSING, CK_BAD_FORMAT and any verdict\n * added later all land there, matching summary.json's own \"not pass|warn|overridden ⇒ refuse\" rule\n * rather than a second list that could silently drift green.\n */\n /**\n * The full-dashboard row for a suppressed PR. Verbose is FINE here — this lands in the PR's 1st\n * comment, not in `git log`.\n */\n private suppressedChecklistLine(suppressedCount: number): string {\n return `**Checklists:** ${this.suppressedTail(suppressedCount)}`\n + ' · NO reviewer subagent ran on this PR — use a positive reviewerAgents value and disable the machine kill switch to get them back';\n }\n\n /**\n * The ONE sentence both the dashboard row and the commit-body bullet are built from, so the two can\n * never disagree about what was switched off or by what.\n *\n * Every part of it earns its place in `main`'s permanent history:\n * • the COUNT, because \"suppressed 4\" and \"0 applicable\" are different facts and both must be\n * tellable apart forever — an absent bullet says the second while meaning the first;\n * • \"required included\", because otherwise it reads as an optional-only skip, which it is not;\n * • both supported controls, because this compact input carries the count but not the source.\n * ⚫ is deliberately outside the verdict palette (🟢🟡🔴🟠⚪ are all taken by checklistStatusText), so\n * nothing here can be mistaken for a verdict a reviewer actually returned.\n */\n private suppressedTail(suppressedCount: number): string {\n return `⚫ ALL ${suppressedCount} SUPPRESSED (required included) by `\n + `reviewer policy (reviewerAgents: 0 or ${HOME_KEY_TURN_OFF_ALL_REVIEWERS} in `\n + `~/${HOME_CONFIG_DIR}/${HOME_CONFIG_FILE})`;\n }\n\n private rollupBuckets(rows: readonly ChecklistRow[]): RollupBucket[] {\n const blocking = new RollupBucket('blocking', '🔴', true);\n const overridden = new RollupBucket('overridden', '🟠', true);\n const warned = new RollupBucket('with concerns', '🟡', true);\n const passed = new RollupBucket('passed', '🟢', false);\n for (const row of rows) {\n if (row.status === CK_PASS) passed.titles.push(row.title);\n else if (row.status === CK_WARN) warned.titles.push(row.title);\n else if (row.status === CK_OVERRIDDEN) overridden.titles.push(row.title);\n else blocking.titles.push(row.title);\n }\n return [blocking, overridden, warned, passed];\n }\n\n // `2 overridden (a, b)` for the buckets a reviewer must act on; a bare `3 passed` for the one they need\n // no list of. Names are capped so a many-checklist repo still gets a ONE-LINE row.\n private bucketPhrase(bucket: RollupBucket): string {\n if (!bucket.named) return `${bucket.titles.length} ${bucket.label}`;\n return `${bucket.titles.length} ${bucket.label} (${this.compactNames(bucket.titles)})`;\n }\n\n private compactNames(titles: readonly string[]): string {\n const max = 4;\n if (titles.length <= max) return titles.join(', ');\n return `${titles.slice(0, max).join(', ')} +${titles.length - max} more`;\n }\n\n // 10-cell risk bar colored by band (🟩 ≤25, 🟨 ≤50, 🟧 ≤75, 🟥 >75), at least one filled cell.\n private riskBar(score: number): string {\n const clamped = Math.max(0, Math.min(100, score));\n const cell = clamped <= 25 ? '🟩' : clamped <= 50 ? '🟨' : clamped <= 75 ? '🟧' : '🟥';\n const filled = Math.max(1, Math.min(10, Math.round(clamped / 10)));\n return cell.repeat(filled) + '⬜'.repeat(10 - filled);\n }\n\n // RISK section (the AI half): Risk Score bar, Risk Level, Pattern Violations.\n private riskLines(review: PrSummary): string[] {\n const violations = review.violations.length;\n const violationLine = violations === 0 ? '🟢 No' : `🟡 Yes (${violations} violation(s))`;\n return [\n `**Risk Score:** ${this.riskBar(review.riskScore)} **${review.riskScore}/100** ${review.riskEmoji}`,\n new ReviewIdentityRenderer().render(review.agent, review.model, 'Summary agent'),\n `**Risk Level:** ${review.riskEmoji} **${review.riskLevel}**`,\n `**Pattern Violations:** ${violationLine}`,\n ];\n }\n\n private disableLine(disables: DisableCounts): string {\n if (disables.webpiecesCount === 0) return '**Webpieces Disables Added:** 🟢 No';\n const which =\n disables.webpiecesRules.length > 0 ? ` — ${disables.webpiecesRules.join(', ')}` : '';\n return `**Webpieces Disables Added:** 🟡 ${disables.webpiecesCount} line(s)${which}`;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /** Reviewer-supplied identity is plain text, never Markdown or an HTML comment marker. */
2
2
  export declare class ReviewIdentityRenderer {
3
3
  render(agent: string, model: string, label?: string): string;
4
- /** Author harness is observed by the gate; only the model comes from the author's review.json. */
4
+ /** Author harness is observed by the gate; only the model comes from the author's summary.json. */
5
5
  renderAuthor(agent: string, model: string, markdown?: boolean): string;
6
6
  private text;
7
7
  }
@@ -6,7 +6,7 @@ class ReviewIdentityRenderer {
6
6
  render(agent, model, label = 'Agent') {
7
7
  return `**${label}:** ${this.text(agent)} · **Model:** ${this.text(model)} (self-reported)`;
8
8
  }
9
- /** Author harness is observed by the gate; only the model comes from the author's review.json. */
9
+ /** Author harness is observed by the gate; only the model comes from the author's summary.json. */
10
10
  renderAuthor(agent, model, markdown = true) {
11
11
  const label = markdown ? '**Author agent:**' : 'Author agent:';
12
12
  const modelLabel = markdown ? '**Model:**' : 'Model:';
@@ -1 +1 @@
1
- {"version":3,"file":"review-identity-renderer.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/dashboard/review-identity-renderer.ts"],"names":[],"mappings":";;;AAAA,0FAA0F;AAC1F,MAAa,sBAAsB;IAC/B,MAAM,CAAC,KAAa,EAAE,KAAa,EAAE,KAAK,GAAG,OAAO;QAChD,OAAO,KAAK,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;IAChG,CAAC;IAED,kGAAkG;IAClG,YAAY,CAAC,KAAa,EAAE,KAAa,EAAE,QAAQ,GAAG,IAAI;QACtD,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,eAAe,CAAC;QAC/D,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;QACtD,OAAO,GAAG,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;IACzG,CAAC;IAEO,IAAI,CAAC,KAAa;QACtB,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,yBAAyB,EAC/D,CAAC,SAAiB,EAAU,EAAE,CAAC,KAAK,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACxE,CAAC;CACJ;AAhBD,wDAgBC","sourcesContent":["/** Reviewer-supplied identity is plain text, never Markdown or an HTML comment marker. */\nexport class ReviewIdentityRenderer {\n render(agent: string, model: string, label = 'Agent'): string {\n return `**${label}:** ${this.text(agent)} · **Model:** ${this.text(model)} (self-reported)`;\n }\n\n /** Author harness is observed by the gate; only the model comes from the author's review.json. */\n renderAuthor(agent: string, model: string, markdown = true): string {\n const label = markdown ? '**Author agent:**' : 'Author agent:';\n const modelLabel = markdown ? '**Model:**' : 'Model:';\n return `${label} ${this.text(agent)} (detected) · ${modelLabel} ${this.text(model)} (self-reported)`;\n }\n\n private text(value: string): string {\n return value.replace(/\\s+/g, ' ').replace(/[&<>\\\\`*_{}\\[\\]()#!|~]/g,\n (character: string): string => `&#${character.charCodeAt(0)};`);\n }\n}\n"]}
1
+ {"version":3,"file":"review-identity-renderer.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/dashboard/review-identity-renderer.ts"],"names":[],"mappings":";;;AAAA,0FAA0F;AAC1F,MAAa,sBAAsB;IAC/B,MAAM,CAAC,KAAa,EAAE,KAAa,EAAE,KAAK,GAAG,OAAO;QAChD,OAAO,KAAK,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;IAChG,CAAC;IAED,mGAAmG;IACnG,YAAY,CAAC,KAAa,EAAE,KAAa,EAAE,QAAQ,GAAG,IAAI;QACtD,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,eAAe,CAAC;QAC/D,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;QACtD,OAAO,GAAG,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;IACzG,CAAC;IAEO,IAAI,CAAC,KAAa;QACtB,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,yBAAyB,EAC/D,CAAC,SAAiB,EAAU,EAAE,CAAC,KAAK,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACxE,CAAC;CACJ;AAhBD,wDAgBC","sourcesContent":["/** Reviewer-supplied identity is plain text, never Markdown or an HTML comment marker. */\nexport class ReviewIdentityRenderer {\n render(agent: string, model: string, label = 'Agent'): string {\n return `**${label}:** ${this.text(agent)} · **Model:** ${this.text(model)} (self-reported)`;\n }\n\n /** Author harness is observed by the gate; only the model comes from the author's summary.json. */\n renderAuthor(agent: string, model: string, markdown = true): string {\n const label = markdown ? '**Author agent:**' : 'Author agent:';\n const modelLabel = markdown ? '**Model:**' : 'Model:';\n return `${label} ${this.text(agent)} (detected) · ${modelLabel} ${this.text(model)} (self-reported)`;\n }\n\n private text(value: string): string {\n return value.replace(/\\s+/g, ' ').replace(/[&<>\\\\`*_{}\\[\\]()#!|~]/g,\n (character: string): string => `&#${character.charCodeAt(0)};`);\n }\n}\n"]}
@@ -51,14 +51,14 @@ export declare class AwaitReviewsCommand {
51
51
  */
52
52
  export declare class ReviewerWaitProbe implements WaitProbe {
53
53
  private readonly reviewJsonService;
54
- private readonly reviewPath;
54
+ private readonly summaryPath;
55
55
  private readonly waitedOn;
56
56
  private readonly applicable;
57
57
  private readonly sinceMs;
58
58
  readonly label = "reviewers";
59
59
  readonly pollMs = 3000;
60
60
  private results;
61
- constructor(reviewJsonService: ReviewJsonService, reviewPath: string, waitedOn: readonly RequiredChecklist[], applicable: readonly RequiredChecklist[], sinceMs: number);
61
+ constructor(reviewJsonService: ReviewJsonService, summaryPath: string, waitedOn: readonly RequiredChecklist[], applicable: readonly RequiredChecklist[], sinceMs: number);
62
62
  /**
63
63
  * Done when every awaited reviewer has ANSWERED — not when every answer is a pass.
64
64
  *
@@ -72,7 +72,7 @@ let AwaitReviewsCommand = class AwaitReviewsCommand {
72
72
  // A verdict file older than the last stage ② is NOT an arrival: it is the stale green or rejected
73
73
  // file that stage just re-briefed (issue #863), and counting it would end the wait on the spot.
74
74
  const since = this.receipts.writtenAtMs(repoRoot, this.aiBranchName.getFeatureName());
75
- const probe = new ReviewerWaitProbe(this.reviewJsonService, scan.reviewPath, scan.outstanding, scan.applicable, since);
75
+ const probe = new ReviewerWaitProbe(this.reviewJsonService, scan.summaryPath, scan.outstanding, scan.applicable, since);
76
76
  const outcome = await this.awaitLoop.run(probe);
77
77
  this.report(probe, outcome);
78
78
  }
@@ -108,7 +108,7 @@ exports.AwaitReviewsCommand = AwaitReviewsCommand = tslib_1.__decorate([
108
108
  */
109
109
  class ReviewerWaitProbe {
110
110
  reviewJsonService;
111
- reviewPath;
111
+ summaryPath;
112
112
  waitedOn;
113
113
  applicable;
114
114
  sinceMs;
@@ -117,11 +117,11 @@ class ReviewerWaitProbe {
117
117
  // that the command returns within seconds of the last reviewer finishing, which is the point.
118
118
  pollMs = 3_000;
119
119
  results = [];
120
- constructor(reviewJsonService, reviewPath, waitedOn, applicable,
120
+ constructor(reviewJsonService, summaryPath, waitedOn, applicable,
121
121
  // Epoch ms of the last stage ② (0 = none): a verdict file last written before it is not an answer.
122
122
  sinceMs) {
123
123
  this.reviewJsonService = reviewJsonService;
124
- this.reviewPath = reviewPath;
124
+ this.summaryPath = summaryPath;
125
125
  this.waitedOn = waitedOn;
126
126
  this.applicable = applicable;
127
127
  this.sinceMs = sinceMs;
@@ -210,11 +210,11 @@ class ReviewerWaitProbe {
210
210
  predates(req) {
211
211
  if (this.sinceMs === 0)
212
212
  return false;
213
- const file = this.reviewJsonService.checklistResultPath(this.reviewPath, req.id);
213
+ const file = this.reviewJsonService.checklistResultPath(this.summaryPath, req.id);
214
214
  return fs.existsSync(file) && fs.statSync(file).mtimeMs < this.sinceMs;
215
215
  }
216
216
  reload() {
217
- this.results = this.reviewJsonService.loadChecklistResults(this.reviewPath, this.applicable);
217
+ this.results = this.reviewJsonService.loadChecklistResults(this.summaryPath, this.applicable);
218
218
  }
219
219
  }
220
220
  exports.ReviewerWaitProbe = ReviewerWaitProbe;
@@ -1 +1 @@
1
- {"version":3,"file":"await-reviews-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/await-reviews-command.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,0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,iBAAiB,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACjG,CAAC;CACJ;AAnHD,8CAmHC","sourcesContent":["import * as fs from 'fs';\nimport {\n ChecklistResult, ChecklistVerdict, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, loadAndValidate,\n RepoRootFinder, RequiredChecklist, ReviewJsonService,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { AwaitLoop, WaitOutcome, WaitProbe } from '../workflow/await-loop';\nimport { ChecklistScanOptions, ChecklistScanner } from '../workflow/checklist-scanner';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { ReviewStageReceiptService } from '../workflow/review-stage-receipt';\nimport { StageOutputLog } from '../workflow/stage-output-log';\n\n/**\n * `wp-await-reviews` — BLOCK until every reviewer stage ② requested for this branch has written its\n * verdict, then print what each one said.\n *\n * ─── Why a command and not an instruction ──────────────────────────────────────────────────────────\n * An agent that has just spawned four reviewer subagents has nothing to do until they answer, and a\n * worktree-isolated subagent cannot simply wait: ending its turn ends its run. See {@link AwaitLoop}\n * for the full chain and the measurement (18.3% of all fleet tokens in one day spent on `echo .`).\n * A blocking Bash call is the only wait primitive it has, so webpieces provides one.\n *\n * ─── It INVENTS NO STATE ───────────────────────────────────────────────────────────────────────────\n * The set of reviewers a branch owes is `ChecklistScanner`'s answer — the SAME one `wp-review-upsert-pr`\n * lists and `wp-finish-upsert-pr` blocks on — and the verdicts are the `review-<id>.json` files those\n * two already read. Nothing here writes anything, and there is no third opinion about who is owed: a\n * waiter that computed its own set could finish while finish still refused, which is the one outcome\n * that would make waiting worse than not waiting.\n *\n * The scan runs ONCE. Its `applicable` set is a function of the diff, which does not change while the\n * agent sits still, so re-scanning per poll would re-run `git diff` every few seconds to re-derive an\n * unchanged answer. Only the verdict FILES are re-read, which is the only thing a reviewer changes.\n *\n * ─── What it does NOT do ───────────────────────────────────────────────────────────────────────────\n * It does not judge. A red verdict is a completed review, so this command RETURNS on it and prints it;\n * refusing the PR over it is `wp-finish-upsert-pr`'s job and stays there. It exits non-zero only when it\n * cannot do its own job at all.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class AwaitReviewsCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly checklistScanner: ChecklistScanner,\n private readonly reviewJsonService: ReviewJsonService,\n private readonly awaitLoop: AwaitLoop,\n private readonly stageConsole: StageOutputLog,\n private readonly receipts: ReviewStageReceiptService,\n private readonly aiBranchName: AiBranchName,\n ) {}\n\n async run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n const config = loadAndValidate(repoRoot).prGate;\n // contextStage '' — a WAIT must not write pr-context.json. That file records the diff a review\n // was briefed against, and rewriting it mid-review would restate the briefing under the\n // reviewers currently reading it.\n const scan = this.checklistScanner.scan(repoRoot, config.checklists, new ChecklistScanOptions(true, ''));\n if (scan.reviewersDisabled) return this.reportDisabled(scan.suppressed);\n if (scan.applicable.length === 0) return this.reportNothingOwed();\n // WAIT on the set finish blocks on (`outstanding`), REPORT on everything that applies. The two\n // sets differ by exactly the optional checklists nobody ran — `required: false` means the PR does\n // not wait for them, and a wait that did would never end, because nothing is ever going to write\n // a verdict for a reviewer that was deliberately never spawned. (The SET is shared with finish;\n // the PREDICATE is not — see `done()` for why a wait ends on arrival and finish does not.)\n // A verdict file older than the last stage ② is NOT an arrival: it is the stale green or rejected\n // file that stage just re-briefed (issue #863), and counting it would end the wait on the spot.\n const since = this.receipts.writtenAtMs(repoRoot, this.aiBranchName.getFeatureName());\n const probe = new ReviewerWaitProbe(\n this.reviewJsonService, scan.reviewPath, scan.outstanding, scan.applicable, since);\n const outcome = await this.awaitLoop.run(probe);\n this.report(probe, outcome);\n }\n\n // Nothing to wait for, and saying so is the whole value: an agent that got no answer here would\n // otherwise assume the wait is still owed and start spinning again.\n private reportNothingOwed(): void {\n this.stageConsole.say('\\n✅ No reviewer was requested for this branch — nothing to wait for.\\n');\n }\n\n private reportDisabled(suppressed: readonly RequiredChecklist[]): void {\n this.stageConsole.say(\n `\\n⚫ Every reviewer is switched off on this machine (experimental.turnOffAllReviewers), so `\n + `${String(suppressed.length)} checklist(s) that would have run are not running. There is `\n + 'nothing to wait for.\\n');\n }\n\n private report(probe: ReviewerWaitProbe, outcome: WaitOutcome): void {\n this.stageConsole.say(outcome.done ? probe.verdictReport(outcome) : probe.stillWaitingReport(outcome));\n }\n}\n\n/**\n * The reviewer wait itself: which checklists are owed, and what the files on disk say about them right\n * now. It owns the reporting too, because every line it prints is derived from the same verdict read —\n * a report that re-read the files could disagree with the answer that ended the wait.\n */\nexport class ReviewerWaitProbe implements WaitProbe {\n readonly label = 'reviewers';\n // Verdict files are local reads, so polling them costs nothing worth economizing on. Fast enough\n // that the command returns within seconds of the last reviewer finishing, which is the point.\n readonly pollMs = 3_000;\n\n private results: ChecklistResult[] = [];\n\n constructor(\n private readonly reviewJsonService: ReviewJsonService,\n private readonly reviewPath: string,\n private readonly waitedOn: readonly RequiredChecklist[],\n private readonly applicable: readonly RequiredChecklist[],\n // Epoch ms of the last stage ② (0 = none): a verdict file last written before it is not an answer.\n private readonly sinceMs: number,\n ) {\n this.reload();\n }\n\n /**\n * Done when every awaited reviewer has ANSWERED — not when every answer is a pass.\n *\n * That distinction is the whole contract of a wait, and getting it wrong makes the command useless\n * in the case it matters most. `ReviewJsonService.pendingChecklists` is finish's GATE predicate and\n * counts a RED verdict as still owed, correctly: the PR is refused until the finding is fixed. But\n * a red reviewer has finished; it will never write a different answer on its own, so waiting for it\n * to stop being red is waiting forever. The wait therefore ends on ARRIVAL — a verdict file that\n * exists, whatever it says — and `wp-finish-upsert-pr` keeps sole ownership of the gate.\n *\n * `CK_BAD_FORMAT` counts as arrived too: the file is there and unreadable, which is a thing to FIX\n * (four characters of JSON), not a thing to wait longer for.\n */\n done(): boolean {\n this.reload();\n return this.pending().length === 0;\n }\n\n describe(): string {\n const owed = this.pending().length;\n const total = this.waitedOn.length;\n return `${String(total - owed)} of ${String(total)} verdicts in`;\n }\n\n /** Every reviewer's answer, printed once the wait is over — the reason to wait rather than sleep. */\n verdictReport(outcome: WaitOutcome): string {\n // The headline counts what was WAITED ON; the list below covers everything that APPLIES, so an\n // optional checklist nobody ran shows as ❓ rather than being quietly dropped. Reporting only the\n // waited-on set would let a shorter list imply the others passed.\n const lines = [\n `\\n✅ All ${String(this.waitedOn.length)} awaited reviewer verdict(s) are in after `\n + `${String(outcome.waitedSeconds)}s:\\n`,\n ];\n for (const req of this.applicable) lines.push(this.oneVerdict(req));\n lines.push(this.nextStep());\n return lines.join('\\n') + '\\n';\n }\n\n /**\n * The timeout report. It is a NORMAL exit and says so, because an agent that reads this as a failure\n * goes hunting for a broken reviewer instead of running one more plain command.\n */\n stillWaitingReport(outcome: WaitOutcome): string {\n const owed = this.pending();\n return `\\n⏳ Still waiting after ${String(outcome.waitedSeconds)}s — run me again: pnpm wp-await-reviews\\n`\n + ' (This is not a failure. The wait returns before the harness kills a quiet command, so a\\n'\n + ' long review costs a handful of calls instead of hundreds of keep-alive turns.)\\n\\n'\n + ` ${String(owed.length)} of ${String(this.waitedOn.length)} still owe a verdict: `\n + `${owed.map((r: RequiredChecklist): string => r.id).join(', ')}\\n`;\n }\n\n private oneVerdict(req: RequiredChecklist): string {\n const verdict = this.reviewJsonService.resolveVerdict(req, this.results);\n return ` ${this.icon(verdict)} ${verdict.id} — ${verdict.status}${this.detail(verdict)}`;\n }\n\n // Only a NON-passing verdict's detail is printed. A green reviewer's output is already on the PR,\n // and reprinting four of them here would bury the one line that needs acting on.\n private detail(verdict: ChecklistVerdict): string {\n if (verdict.status !== CK_FAIL || verdict.detail === '') return '';\n return `\\n ${verdict.detail.split('\\n').join('\\n ')}`;\n }\n\n private icon(verdict: ChecklistVerdict): string {\n if (verdict.status === CK_FAIL) return '🔴';\n if (verdict.status === CK_MISSING || verdict.status === CK_BAD_FORMAT) return '❓';\n return '🟢';\n }\n\n // Named because a wait that ends without saying what it unblocked leaves the agent to guess, and\n // guessing here means spinning again. A red verdict changes the next move, so it is called out.\n private nextStep(): string {\n const anyRed = this.applicable.some((req: RequiredChecklist): boolean =>\n this.reviewJsonService.resolveVerdict(req, this.results).status === CK_FAIL);\n return anyRed\n ? '\\n A reviewer REFUSED. Fix what it found — re-spawning it against unchanged code buys the\\n'\n + ' same answer — then re-run the review stage.\\n'\n : '\\n Nothing is owed on the review front.\\n';\n }\n\n // The awaited checklists whose verdict file has not appeared yet — see `done()` for why this is\n // arrival and not the gate's own \"still owed\".\n private pending(): RequiredChecklist[] {\n return this.waitedOn.filter((req: RequiredChecklist): boolean =>\n this.reviewJsonService.resolveVerdict(req, this.results).status === CK_MISSING || this.predates(req));\n }\n\n private predates(req: RequiredChecklist): boolean {\n if (this.sinceMs === 0) return false;\n const file = this.reviewJsonService.checklistResultPath(this.reviewPath, req.id);\n return fs.existsSync(file) && fs.statSync(file).mtimeMs < this.sinceMs;\n }\n\n private reload(): void {\n this.results = this.reviewJsonService.loadChecklistResults(this.reviewPath, this.applicable);\n }\n}\n"]}
1
+ {"version":3,"file":"await-reviews-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/await-reviews-command.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,0DAGiC;AACjC,yCAA2D;AAE3D,uDAA2E;AAC3E,qEAAuF;AACvF,2EAAgE;AAChE,2EAA6E;AAC7E,mEAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAEP;IACA;IACA;IACA;IACA;IACA;IACA;IAPrB,YACqB,cAA8B,EAC9B,gBAAkC,EAClC,iBAAoC,EACpC,SAAoB,EACpB,YAA4B,EAC5B,QAAmC,EACnC,YAA0B;QAN1B,mBAAc,GAAd,cAAc,CAAgB;QAC9B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,sBAAiB,GAAjB,iBAA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C,CAAC;QACjF,OAAO,MAAM;YACT,CAAC,CAAC,+FAA+F;kBAC3F,kDAAkD;YACxD,CAAC,CAAC,6CAA6C,CAAC;IACxD,CAAC;IAED,gGAAgG;IAChG,+CAA+C;IACvC,OAAO;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAsB,EAAW,EAAE,CAC5D,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,yBAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9G,CAAC;IAEO,QAAQ,CAAC,GAAsB;QACnC,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAClF,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC3E,CAAC;IAEO,MAAM;QACV,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAClG,CAAC;CACJ;AAnHD,8CAmHC","sourcesContent":["import * as fs from 'fs';\nimport {\n ChecklistResult, ChecklistVerdict, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, loadAndValidate,\n RepoRootFinder, RequiredChecklist, ReviewJsonService,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { AwaitLoop, WaitOutcome, WaitProbe } from '../workflow/await-loop';\nimport { ChecklistScanOptions, ChecklistScanner } from '../workflow/checklist-scanner';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { ReviewStageReceiptService } from '../workflow/review-stage-receipt';\nimport { StageOutputLog } from '../workflow/stage-output-log';\n\n/**\n * `wp-await-reviews` — BLOCK until every reviewer stage ② requested for this branch has written its\n * verdict, then print what each one said.\n *\n * ─── Why a command and not an instruction ──────────────────────────────────────────────────────────\n * An agent that has just spawned four reviewer subagents has nothing to do until they answer, and a\n * worktree-isolated subagent cannot simply wait: ending its turn ends its run. See {@link AwaitLoop}\n * for the full chain and the measurement (18.3% of all fleet tokens in one day spent on `echo .`).\n * A blocking Bash call is the only wait primitive it has, so webpieces provides one.\n *\n * ─── It INVENTS NO STATE ───────────────────────────────────────────────────────────────────────────\n * The set of reviewers a branch owes is `ChecklistScanner`'s answer — the SAME one `wp-review-upsert-pr`\n * lists and `wp-finish-upsert-pr` blocks on — and the verdicts are the `review-<id>.json` files those\n * two already read. Nothing here writes anything, and there is no third opinion about who is owed: a\n * waiter that computed its own set could finish while finish still refused, which is the one outcome\n * that would make waiting worse than not waiting.\n *\n * The scan runs ONCE. Its `applicable` set is a function of the diff, which does not change while the\n * agent sits still, so re-scanning per poll would re-run `git diff` every few seconds to re-derive an\n * unchanged answer. Only the verdict FILES are re-read, which is the only thing a reviewer changes.\n *\n * ─── What it does NOT do ───────────────────────────────────────────────────────────────────────────\n * It does not judge. A red verdict is a completed review, so this command RETURNS on it and prints it;\n * refusing the PR over it is `wp-finish-upsert-pr`'s job and stays there. It exits non-zero only when it\n * cannot do its own job at all.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class AwaitReviewsCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly checklistScanner: ChecklistScanner,\n private readonly reviewJsonService: ReviewJsonService,\n private readonly awaitLoop: AwaitLoop,\n private readonly stageConsole: StageOutputLog,\n private readonly receipts: ReviewStageReceiptService,\n private readonly aiBranchName: AiBranchName,\n ) {}\n\n async run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n const config = loadAndValidate(repoRoot).prGate;\n // contextStage '' — a WAIT must not write pr-context.json. That file records the diff a review\n // was briefed against, and rewriting it mid-review would restate the briefing under the\n // reviewers currently reading it.\n const scan = this.checklistScanner.scan(repoRoot, config.checklists, new ChecklistScanOptions(true, ''));\n if (scan.reviewersDisabled) return this.reportDisabled(scan.suppressed);\n if (scan.applicable.length === 0) return this.reportNothingOwed();\n // WAIT on the set finish blocks on (`outstanding`), REPORT on everything that applies. The two\n // sets differ by exactly the optional checklists nobody ran — `required: false` means the PR does\n // not wait for them, and a wait that did would never end, because nothing is ever going to write\n // a verdict for a reviewer that was deliberately never spawned. (The SET is shared with finish;\n // the PREDICATE is not — see `done()` for why a wait ends on arrival and finish does not.)\n // A verdict file older than the last stage ② is NOT an arrival: it is the stale green or rejected\n // file that stage just re-briefed (issue #863), and counting it would end the wait on the spot.\n const since = this.receipts.writtenAtMs(repoRoot, this.aiBranchName.getFeatureName());\n const probe = new ReviewerWaitProbe(\n this.reviewJsonService, scan.summaryPath, scan.outstanding, scan.applicable, since);\n const outcome = await this.awaitLoop.run(probe);\n this.report(probe, outcome);\n }\n\n // Nothing to wait for, and saying so is the whole value: an agent that got no answer here would\n // otherwise assume the wait is still owed and start spinning again.\n private reportNothingOwed(): void {\n this.stageConsole.say('\\n✅ No reviewer was requested for this branch — nothing to wait for.\\n');\n }\n\n private reportDisabled(suppressed: readonly RequiredChecklist[]): void {\n this.stageConsole.say(\n `\\n⚫ Every reviewer is switched off on this machine (experimental.turnOffAllReviewers), so `\n + `${String(suppressed.length)} checklist(s) that would have run are not running. There is `\n + 'nothing to wait for.\\n');\n }\n\n private report(probe: ReviewerWaitProbe, outcome: WaitOutcome): void {\n this.stageConsole.say(outcome.done ? probe.verdictReport(outcome) : probe.stillWaitingReport(outcome));\n }\n}\n\n/**\n * The reviewer wait itself: which checklists are owed, and what the files on disk say about them right\n * now. It owns the reporting too, because every line it prints is derived from the same verdict read —\n * a report that re-read the files could disagree with the answer that ended the wait.\n */\nexport class ReviewerWaitProbe implements WaitProbe {\n readonly label = 'reviewers';\n // Verdict files are local reads, so polling them costs nothing worth economizing on. Fast enough\n // that the command returns within seconds of the last reviewer finishing, which is the point.\n readonly pollMs = 3_000;\n\n private results: ChecklistResult[] = [];\n\n constructor(\n private readonly reviewJsonService: ReviewJsonService,\n private readonly summaryPath: string,\n private readonly waitedOn: readonly RequiredChecklist[],\n private readonly applicable: readonly RequiredChecklist[],\n // Epoch ms of the last stage ② (0 = none): a verdict file last written before it is not an answer.\n private readonly sinceMs: number,\n ) {\n this.reload();\n }\n\n /**\n * Done when every awaited reviewer has ANSWERED — not when every answer is a pass.\n *\n * That distinction is the whole contract of a wait, and getting it wrong makes the command useless\n * in the case it matters most. `ReviewJsonService.pendingChecklists` is finish's GATE predicate and\n * counts a RED verdict as still owed, correctly: the PR is refused until the finding is fixed. But\n * a red reviewer has finished; it will never write a different answer on its own, so waiting for it\n * to stop being red is waiting forever. The wait therefore ends on ARRIVAL — a verdict file that\n * exists, whatever it says — and `wp-finish-upsert-pr` keeps sole ownership of the gate.\n *\n * `CK_BAD_FORMAT` counts as arrived too: the file is there and unreadable, which is a thing to FIX\n * (four characters of JSON), not a thing to wait longer for.\n */\n done(): boolean {\n this.reload();\n return this.pending().length === 0;\n }\n\n describe(): string {\n const owed = this.pending().length;\n const total = this.waitedOn.length;\n return `${String(total - owed)} of ${String(total)} verdicts in`;\n }\n\n /** Every reviewer's answer, printed once the wait is over — the reason to wait rather than sleep. */\n verdictReport(outcome: WaitOutcome): string {\n // The headline counts what was WAITED ON; the list below covers everything that APPLIES, so an\n // optional checklist nobody ran shows as ❓ rather than being quietly dropped. Reporting only the\n // waited-on set would let a shorter list imply the others passed.\n const lines = [\n `\\n✅ All ${String(this.waitedOn.length)} awaited reviewer verdict(s) are in after `\n + `${String(outcome.waitedSeconds)}s:\\n`,\n ];\n for (const req of this.applicable) lines.push(this.oneVerdict(req));\n lines.push(this.nextStep());\n return lines.join('\\n') + '\\n';\n }\n\n /**\n * The timeout report. It is a NORMAL exit and says so, because an agent that reads this as a failure\n * goes hunting for a broken reviewer instead of running one more plain command.\n */\n stillWaitingReport(outcome: WaitOutcome): string {\n const owed = this.pending();\n return `\\n⏳ Still waiting after ${String(outcome.waitedSeconds)}s — run me again: pnpm wp-await-reviews\\n`\n + ' (This is not a failure. The wait returns before the harness kills a quiet command, so a\\n'\n + ' long review costs a handful of calls instead of hundreds of keep-alive turns.)\\n\\n'\n + ` ${String(owed.length)} of ${String(this.waitedOn.length)} still owe a verdict: `\n + `${owed.map((r: RequiredChecklist): string => r.id).join(', ')}\\n`;\n }\n\n private oneVerdict(req: RequiredChecklist): string {\n const verdict = this.reviewJsonService.resolveVerdict(req, this.results);\n return ` ${this.icon(verdict)} ${verdict.id} — ${verdict.status}${this.detail(verdict)}`;\n }\n\n // Only a NON-passing verdict's detail is printed. A green reviewer's output is already on the PR,\n // and reprinting four of them here would bury the one line that needs acting on.\n private detail(verdict: ChecklistVerdict): string {\n if (verdict.status !== CK_FAIL || verdict.detail === '') return '';\n return `\\n ${verdict.detail.split('\\n').join('\\n ')}`;\n }\n\n private icon(verdict: ChecklistVerdict): string {\n if (verdict.status === CK_FAIL) return '🔴';\n if (verdict.status === CK_MISSING || verdict.status === CK_BAD_FORMAT) return '❓';\n return '🟢';\n }\n\n // Named because a wait that ends without saying what it unblocked leaves the agent to guess, and\n // guessing here means spinning again. A red verdict changes the next move, so it is called out.\n private nextStep(): string {\n const anyRed = this.applicable.some((req: RequiredChecklist): boolean =>\n this.reviewJsonService.resolveVerdict(req, this.results).status === CK_FAIL);\n return anyRed\n ? '\\n A reviewer REFUSED. Fix what it found — re-spawning it against unchanged code buys the\\n'\n + ' same answer — then re-run the review stage.\\n'\n : '\\n Nothing is owed on the review front.\\n';\n }\n\n // The awaited checklists whose verdict file has not appeared yet — see `done()` for why this is\n // arrival and not the gate's own \"still owed\".\n private pending(): RequiredChecklist[] {\n return this.waitedOn.filter((req: RequiredChecklist): boolean =>\n this.reviewJsonService.resolveVerdict(req, this.results).status === CK_MISSING || this.predates(req));\n }\n\n private predates(req: RequiredChecklist): boolean {\n if (this.sinceMs === 0) return false;\n const file = this.reviewJsonService.checklistResultPath(this.summaryPath, req.id);\n return fs.existsSync(file) && fs.statSync(file).mtimeMs < this.sinceMs;\n }\n\n private reload(): void {\n this.results = this.reviewJsonService.loadChecklistResults(this.summaryPath, this.applicable);\n }\n}\n"]}
@@ -89,7 +89,7 @@ let CheckPrCommand = class CheckPrCommand {
89
89
  `Every commit that lands here must go through it, so:\n\n` +
90
90
  ` 1. Install the webpieces hooks if you don't have them.\n` +
91
91
  ` 2. Recreate/update this PR by running the full gated flow, in order:\n` +
92
- ` pnpm wp-start-upsert-pr → pnpm wp-review-upsert-pr → write review.json → pnpm wp-finish-upsert-pr\n\n` +
92
+ ` pnpm wp-start-upsert-pr → pnpm wp-review-upsert-pr → write summary.json → pnpm wp-finish-upsert-pr\n\n` +
93
93
  `That re-stamps the PR title, body, and the gate token for the current head commit, and this check goes green.`);
94
94
  }
95
95
  // Resolve the PR (number, head sha, body) from `gh`. Prefers an explicit WP_PR_NUMBER, then the