@webpieces/pr-gate 0.4.486 → 0.4.488

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/pr-gate",
3
- "version": "0.4.486",
3
+ "version": "0.4.488",
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",
@@ -25,7 +25,7 @@
25
25
  "directory": "packages/tooling/pr-gate"
26
26
  },
27
27
  "dependencies": {
28
- "@webpieces/rules-config": "0.4.486",
28
+ "@webpieces/rules-config": "0.4.488",
29
29
  "@inversifyjs/binding-decorators": "1.1.5",
30
30
  "inversify": "7.10.4",
31
31
  "reflect-metadata": "0.2.2"
@@ -1,34 +1,26 @@
1
- import { RepoRootFinder, ChecklistInstructionsService, ReviewJsonService } from '@webpieces/rules-config';
2
- import { AiBranchName } from '../workflow/git-readAiBranchName';
3
- import { ChecklistDetector } from '../workflow/checklist-detector';
1
+ import { RepoRootFinder, ChecklistInstructionsService } from '@webpieces/rules-config';
4
2
  import { ChecklistNotice } from '../workflow/checklist-notice';
3
+ import { ChecklistScanner } from '../workflow/checklist-scanner';
5
4
  /**
6
- * `wp-checklist` — READ-ONLY. Answers the one question the coding agent has at review time: *which reviewer
7
- * subagents do I owe on THIS diff, and what exactly do I tell them?*
5
+ * `wp-checklist` — ALWAYS SUCCEEDS, always just lists. It answers the one question the coding agent has at
6
+ * review time: *which reviewer subagents do I owe on this branch, and what exactly do I tell them?*
8
7
  *
9
- * It exists because that answer used to be smeared across `wp-start-upsert-pr`'s output in two partly
10
- * duplicated blocks, which made the instruction long, drift-prone, and easy to skim past. Now `wp-start`
11
- * points here, `wp-finish` fails fast against the same computation, and this command is the single place
12
- * that renders it via {@link ChecklistInstructionsService}, shared with both.
13
- *
14
- * It NEVER mutates the repo beyond refreshing the AI-facing template, and never blocks: a diff owing no
15
- * review says so and exits 0. Safe to run any number of times.
8
+ * Safe to run at any time, including mid-work with a dirty tree uncommitted and untracked files are part
9
+ * of the diff it matches against (see {@link ChecklistScanner}). It exits 0 in every case: zero checklists
10
+ * configured, zero matched, or several still outstanding. Reporting is not gating; `wp-finish-upsert-pr` is
11
+ * the only command that refuses, and it re-uses this exact scan with `filterAlreadyReviewed: true`, so the
12
+ * two can never disagree about what is owed.
16
13
  */
17
14
  export declare class ChecklistCommand {
18
15
  private readonly repoRootFinder;
19
- private readonly aiBranchName;
20
- private readonly checklistDetector;
21
- private readonly reviewJsonService;
16
+ private readonly checklistScanner;
22
17
  private readonly instructions;
23
18
  private readonly checklistNotice;
24
- constructor(repoRootFinder: RepoRootFinder, aiBranchName: AiBranchName, checklistDetector: ChecklistDetector, reviewJsonService: ReviewJsonService, instructions: ChecklistInstructionsService, checklistNotice: ChecklistNotice);
19
+ constructor(repoRootFinder: RepoRootFinder, checklistScanner: ChecklistScanner, instructions: ChecklistInstructionsService, checklistNotice: ChecklistNotice);
25
20
  run(): Promise<void>;
26
- /**
27
- * The whole report. Computed in the same order wp-finish-upsert-pr computes it, from the same services,
28
- * so "wp-checklist said I was done" and "wp-finish let me through" can never disagree.
29
- */
30
21
  private report;
31
- private plan;
32
- private doneLines;
22
+ private header;
23
+ private rosterLines;
24
+ private why;
33
25
  private allDone;
34
26
  }
@@ -4,34 +4,27 @@ exports.ChecklistCommand = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const rules_config_1 = require("@webpieces/rules-config");
6
6
  const inversify_1 = require("inversify");
7
- const git_readAiBranchName_1 = require("../workflow/git-readAiBranchName");
8
- const checklist_detector_1 = require("../workflow/checklist-detector");
9
7
  const checklist_notice_1 = require("../workflow/checklist-notice");
8
+ const checklist_scanner_1 = require("../workflow/checklist-scanner");
10
9
  const SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n';
11
10
  /**
12
- * `wp-checklist` — READ-ONLY. Answers the one question the coding agent has at review time: *which reviewer
13
- * subagents do I owe on THIS diff, and what exactly do I tell them?*
11
+ * `wp-checklist` — ALWAYS SUCCEEDS, always just lists. It answers the one question the coding agent has at
12
+ * review time: *which reviewer subagents do I owe on this branch, and what exactly do I tell them?*
14
13
  *
15
- * It exists because that answer used to be smeared across `wp-start-upsert-pr`'s output in two partly
16
- * duplicated blocks, which made the instruction long, drift-prone, and easy to skim past. Now `wp-start`
17
- * points here, `wp-finish` fails fast against the same computation, and this command is the single place
18
- * that renders it via {@link ChecklistInstructionsService}, shared with both.
19
- *
20
- * It NEVER mutates the repo beyond refreshing the AI-facing template, and never blocks: a diff owing no
21
- * review says so and exits 0. Safe to run any number of times.
14
+ * Safe to run at any time, including mid-work with a dirty tree uncommitted and untracked files are part
15
+ * of the diff it matches against (see {@link ChecklistScanner}). It exits 0 in every case: zero checklists
16
+ * configured, zero matched, or several still outstanding. Reporting is not gating; `wp-finish-upsert-pr` is
17
+ * the only command that refuses, and it re-uses this exact scan with `filterAlreadyReviewed: true`, so the
18
+ * two can never disagree about what is owed.
22
19
  */
23
20
  let ChecklistCommand = class ChecklistCommand {
24
21
  repoRootFinder;
25
- aiBranchName;
26
- checklistDetector;
27
- reviewJsonService;
22
+ checklistScanner;
28
23
  instructions;
29
24
  checklistNotice;
30
- constructor(repoRootFinder, aiBranchName, checklistDetector, reviewJsonService, instructions, checklistNotice) {
25
+ constructor(repoRootFinder, checklistScanner, instructions, checklistNotice) {
31
26
  this.repoRootFinder = repoRootFinder;
32
- this.aiBranchName = aiBranchName;
33
- this.checklistDetector = checklistDetector;
34
- this.reviewJsonService = reviewJsonService;
27
+ this.checklistScanner = checklistScanner;
35
28
  this.instructions = instructions;
36
29
  this.checklistNotice = checklistNotice;
37
30
  }
@@ -39,56 +32,56 @@ let ChecklistCommand = class ChecklistCommand {
39
32
  const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());
40
33
  // Refresh the long-form doc so the block below can cite a file that is present and current.
41
34
  (0, rules_config_1.writeTemplate)(repoRoot, 'webpieces.review-checklists.md');
42
- process.stdout.write('\n' + SEP + '📋 Review checklists for this diff\n' + SEP + '\n');
43
- process.stdout.write(this.report(repoRoot));
35
+ process.stdout.write('\n' + SEP + '📋 Review checklists for this branch\n' + SEP + '\n');
36
+ // filterAlreadyReviewed:false — LIST everything that applies, marking what is already done. Hiding the
37
+ // done ones would make a second run look like it found fewer checklists than the first.
38
+ const defined = (0, rules_config_1.loadAndValidate)(repoRoot).prGate.checklists;
39
+ process.stdout.write(this.report(this.checklistScanner.scan(repoRoot, defined, new checklist_scanner_1.ChecklistScanOptions(false))));
44
40
  return Promise.resolve();
45
41
  }
46
- /**
47
- * The whole report. Computed in the same order wp-finish-upsert-pr computes it, from the same services,
48
- * so "wp-checklist said I was done" and "wp-finish let me through" can never disagree.
49
- */
50
- report(repoRoot) {
51
- // loadAndValidate is the ONE gate: it rejects a structurally bad `checklists` (including the removed
52
- // { doc } manifest shape) AND checks that every guidance doc + reviewer agent file exists. So reaching
53
- // here means the set is valid — there is no "configured but silently broken" state left to report.
54
- const defs = (0, rules_config_1.loadAndValidate)(repoRoot).prGate.checklists;
55
- const triggered = this.checklistDetector.detectForRepo(repoRoot, defs);
56
- if (triggered.length === 0) {
42
+ report(scan) {
43
+ if (scan.applicable.length === 0) {
57
44
  // Zero is a SUPPORTED state, never a blocker (see ChecklistNotice).
58
- return this.checklistNotice.build(defs.length, 'wp-finish-upsert-pr');
45
+ return this.checklistNotice.build(scan.defined.length, 'wp-finish-upsert-pr');
59
46
  }
60
- return this.plan(repoRoot, defs, triggered);
47
+ const reviewedIds = new Set(scan.reviewed.map((r) => r.id));
48
+ const owed = scan.applicable.filter((r) => !reviewedIds.has(r.id));
49
+ return (this.header(scan) +
50
+ this.rosterLines(scan, owed) +
51
+ (owed.length === 0 ? this.allDone() : `\n${this.instructions.render(owed, scan.reviewPath, scan.context)}\n`));
52
+ }
53
+ // State the base out loud: a reader (and a reviewer) needs to know the diff was taken from the fork point
54
+ // of main and that uncommitted work counted, because both change which checklists fired.
55
+ header(scan) {
56
+ const base = scan.forkPoint === '' ? 'no fork point resolved' : `fork point ${scan.forkPoint.slice(0, 8)}`;
57
+ return `${scan.defined.length} checklist(s) configured, ${scan.applicable.length} apply to this branch\n` +
58
+ `(${base}, including uncommitted + untracked work).\n\n`;
61
59
  }
62
- // The triggered set split into "already reviewed on this branch" (reused, not re-run) and "still owed".
63
- plan(repoRoot, defs, triggered) {
64
- const featureName = this.aiBranchName.getFeatureName();
65
- const reviewPath = (0, rules_config_1.reviewJsonPath)(repoRoot, featureName);
66
- const required = this.checklistDetector.toRequired(triggered);
67
- const results = this.reviewJsonService.loadChecklistResults(reviewPath, required);
68
- const pending = this.reviewJsonService.pendingChecklists(required, results);
69
- const done = required.filter((r) => !pending.includes(r));
70
- const context = this.reviewJsonService.reviewContextFor(repoRoot, featureName);
71
- return (`${defs.length} checklist(s) configured, ${required.length} apply to this diff.\n` +
72
- this.doneLines(done) +
73
- (pending.length === 0 ? this.allDone() : `\n${this.instructions.render(pending, reviewPath, context)}\n`));
60
+ // REVIEW ONCE, PER SUBAGENT: a checklist with a passing verdict is reused, not re-run. 2 of 4 done means
61
+ // the other 2 still need running, so both groups are shown and only the owed ones become instructions.
62
+ rosterLines(scan, owed) {
63
+ const lines = scan.reviewed.map((r) => ` ✓ ${r.subagent} — already reviewed on this branch (reusing its review-${r.id}.json)\n`);
64
+ for (const r of owed)
65
+ lines.push(` ▶ ${r.subagent} ${this.why(r)}\n`);
66
+ return lines.join('');
74
67
  }
75
- // REVIEW ONCE PER BRANCH: verdict files persist in .webpieces, so a second cycle re-instructs nothing.
76
- doneLines(done) {
77
- if (done.length === 0)
78
- return '';
79
- return done.map((r) => `${r.subagent} — already reviewed on this branch (reusing its review-${r.id}.json)\n`).join('');
68
+ // Why this one is in scope. A patternless checklist is NOT "matched" it always runs, over the whole diff.
69
+ why(req) {
70
+ if (req.matchedPatterns.length === 0)
71
+ return 'ALWAYS RUNS (no patterns), whole diff in scope';
72
+ const globs = req.matchedPatterns.map((p) => `"${p}"`).join(', ');
73
+ return `${req.matchedFiles.length} file(s) matched ${globs}`;
80
74
  }
81
75
  allDone() {
82
- return '\n✅ Every checklist that applies is already reviewed — nothing to run.\n Write review.json and run: pnpm wp-finish-upsert-pr\n';
76
+ return '\n✅ Every checklist that applies is already reviewed — nothing to run.\n' +
77
+ ' Write review.json and run: pnpm wp-finish-upsert-pr\n';
83
78
  }
84
79
  };
85
80
  exports.ChecklistCommand = ChecklistCommand;
86
81
  exports.ChecklistCommand = ChecklistCommand = tslib_1.__decorate([
87
82
  (0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
88
83
  tslib_1.__metadata("design:paramtypes", [rules_config_1.RepoRootFinder,
89
- git_readAiBranchName_1.AiBranchName,
90
- checklist_detector_1.ChecklistDetector,
91
- rules_config_1.ReviewJsonService,
84
+ checklist_scanner_1.ChecklistScanner,
92
85
  rules_config_1.ChecklistInstructionsService,
93
86
  checklist_notice_1.ChecklistNotice])
94
87
  ], ChecklistCommand);
@@ -1 +1 @@
1
- {"version":3,"file":"checklist-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/checklist-command.ts"],"names":[],"mappings":";;;;AAAA,0DAGiC;AACjC,yCAA2D;AAC3D,2EAAgE;AAChE,uEAAuF;AACvF,mEAA+D;AAE/D,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE;;;;;;;;;;;GAWG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEJ;IACA;IACA;IACA;IACA;IACA;IANrB,YACqB,cAA8B,EAC9B,YAA0B,EAC1B,iBAAoC,EACpC,iBAAoC,EACpC,YAA0C,EAC1C,eAAgC;QALhC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,sBAAiB,GAAjB,iBAAiB,CAAmB;QAC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C/I,CAAC;CACJ,CAAA;AA9DY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGA,6BAAc;QAChB,mCAAY;QACP,sCAAiB;QACjB,gCAAiB;QACtB,2CAA4B;QACzB,kCAAe;GAP5C,gBAAgB,CA8D5B","sourcesContent":["import {\n loadAndValidate, reviewJsonPath, writeTemplate, RepoRootFinder,\n ChecklistDefinition, ChecklistInstructionsService, ReviewJsonService, RequiredChecklist,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { ChecklistDetector, TriggeredChecklist } from '../workflow/checklist-detector';\nimport { ChecklistNotice } from '../workflow/checklist-notice';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * `wp-checklist` — READ-ONLY. Answers the one question the coding agent has at review time: *which reviewer\n * subagents do I owe on THIS diff, and what exactly do I tell them?*\n *\n * It exists because that answer used to be smeared across `wp-start-upsert-pr`'s output in two partly\n * duplicated blocks, which made the instruction long, drift-prone, and easy to skim past. Now `wp-start`\n * points here, `wp-finish` fails fast against the same computation, and this command is the single place\n * that renders it via {@link ChecklistInstructionsService}, shared with both.\n *\n * It NEVER mutates the repo beyond refreshing the AI-facing template, and never blocks: a diff owing no\n * review says so and exits 0. Safe to run any number of times.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ChecklistCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly aiBranchName: AiBranchName,\n private readonly checklistDetector: ChecklistDetector,\n private readonly reviewJsonService: ReviewJsonService,\n private readonly instructions: ChecklistInstructionsService,\n private readonly checklistNotice: ChecklistNotice,\n ) {}\n\n run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n // Refresh the long-form doc so the block below can cite a file that is present and current.\n writeTemplate(repoRoot, 'webpieces.review-checklists.md');\n process.stdout.write('\\n' + SEP + '📋 Review checklists for this diff\\n' + SEP + '\\n');\n process.stdout.write(this.report(repoRoot));\n return Promise.resolve();\n }\n\n /**\n * The whole report. Computed in the same order wp-finish-upsert-pr computes it, from the same services,\n * so \"wp-checklist said I was done\" and \"wp-finish let me through\" can never disagree.\n */\n private report(repoRoot: string): string {\n // loadAndValidate is the ONE gate: it rejects a structurally bad `checklists` (including the removed\n // { doc } manifest shape) AND checks that every guidance doc + reviewer agent file exists. So reaching\n // here means the set is valid — there is no \"configured but silently broken\" state left to report.\n const defs = loadAndValidate(repoRoot).prGate.checklists;\n const triggered = this.checklistDetector.detectForRepo(repoRoot, defs);\n if (triggered.length === 0) {\n // Zero is a SUPPORTED state, never a blocker (see ChecklistNotice).\n return this.checklistNotice.build(defs.length, 'wp-finish-upsert-pr');\n }\n return this.plan(repoRoot, defs, triggered);\n }\n\n // The triggered set split into \"already reviewed on this branch\" (reused, not re-run) and \"still owed\".\n private plan(repoRoot: string, defs: readonly ChecklistDefinition[], triggered: readonly TriggeredChecklist[]): string {\n const featureName = this.aiBranchName.getFeatureName();\n const reviewPath = reviewJsonPath(repoRoot, featureName);\n const required = this.checklistDetector.toRequired(triggered);\n const results = this.reviewJsonService.loadChecklistResults(reviewPath, required);\n const pending = this.reviewJsonService.pendingChecklists(required, results);\n const done = required.filter((r: RequiredChecklist): boolean => !pending.includes(r));\n const context = this.reviewJsonService.reviewContextFor(repoRoot, featureName);\n return (\n `${defs.length} checklist(s) configured, ${required.length} apply to this diff.\\n` +\n this.doneLines(done) +\n (pending.length === 0 ? this.allDone() : `\\n${this.instructions.render(pending, reviewPath, context)}\\n`)\n );\n }\n\n // REVIEW ONCE PER BRANCH: verdict files persist in .webpieces, so a second cycle re-instructs nothing.\n private doneLines(done: readonly RequiredChecklist[]): string {\n if (done.length === 0) return '';\n return done.map((r: RequiredChecklist): string =>\n ` ✓ ${r.subagent} — already reviewed on this branch (reusing its review-${r.id}.json)\\n`).join('');\n }\n\n private allDone(): string {\n return '\\n✅ Every checklist that applies is already reviewed — nothing to run.\\n Write review.json and run: pnpm wp-finish-upsert-pr\\n';\n }\n}\n"]}
1
+ {"version":3,"file":"checklist-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/checklist-command.ts"],"names":[],"mappings":";;;;AAAA,0DAA0I;AAC1I,yCAA2D;AAC3D,mEAA+D;AAC/D,qEAAsG;AAEtG,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE;;;;;;;;;GASG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEJ;IACA;IACA;IACA;IAJrB,YACqB,cAA8B,EAC9B,gBAAkC,EAClC,YAA0C,EAC1C,eAAgC;QAHhC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,iBAAY,GAAZ,YAAY,CAA8B;QAC1C,oBAAe,GAAf,eAAe,CAAiB;IAClD,CAAC;IAEJ,GAAG;QACC,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpE,4FAA4F;QAC5F,IAAA,4BAAa,EAAC,QAAQ,EAAE,gCAAgC,CAAC,CAAC;QAC1D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,GAAG,wCAAwC,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;QACzF,uGAAuG;QACvG,wFAAwF;QACxF,MAAM,OAAO,GAAG,IAAA,8BAAe,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,wCAAoB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAClH,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U,CAAC,MAAM,yBAAyB;YACrG,IAAI,IAAI,gDAAgD,CAAC;IACjE,CAAC;IAED,yGAAyG;IACzG,uGAAuG;IAC/F,WAAW,CAAC,IAAmB,EAAE,IAAkC;QACvE,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAoB,EAAU,EAAE,CAC7D,OAAO,CAAC,CAAC,QAAQ,0DAA0D,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QAC/F,KAAK,MAAM,CAAC,IAAI,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACzE,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED,4GAA4G;IACpG,GAAG,CAAC,GAAsB;QAC9B,IAAI,GAAG,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,gDAAgD,CAAC;QAC9F,MAAM,KAAK,GAAG,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAS,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClF,OAAO,GAAG,GAAG,CAAC,YAAY,CAAC,MAAM,oBAAoB,KAAK,EAAE,CAAC;IACjE,CAAC;IAEO,OAAO;QACX,OAAO,0EAA0E;YAC7E,2DAA2D,CAAC;IACpE,CAAC;CACJ,CAAA;AA9DY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGA,6BAAc;QACZ,oCAAgB;QACpB,2CAA4B;QACzB,kCAAe;GAL5C,gBAAgB,CA8D5B","sourcesContent":["import { loadAndValidate, writeTemplate, RepoRootFinder, ChecklistInstructionsService, RequiredChecklist } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ChecklistNotice } from '../workflow/checklist-notice';\nimport { ChecklistScan, ChecklistScanOptions, ChecklistScanner } from '../workflow/checklist-scanner';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * `wp-checklist` — ALWAYS SUCCEEDS, always just lists. It answers the one question the coding agent has at\n * review time: *which reviewer subagents do I owe on this branch, and what exactly do I tell them?*\n *\n * Safe to run at any time, including mid-work with a dirty tree uncommitted and untracked files are part\n * of the diff it matches against (see {@link ChecklistScanner}). It exits 0 in every case: zero checklists\n * configured, zero matched, or several still outstanding. Reporting is not gating; `wp-finish-upsert-pr` is\n * the only command that refuses, and it re-uses this exact scan with `filterAlreadyReviewed: true`, so the\n * two can never disagree about what is owed.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ChecklistCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly checklistScanner: ChecklistScanner,\n private readonly instructions: ChecklistInstructionsService,\n private readonly checklistNotice: ChecklistNotice,\n ) {}\n\n run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n // Refresh the long-form doc so the block below can cite a file that is present and current.\n writeTemplate(repoRoot, 'webpieces.review-checklists.md');\n process.stdout.write('\\n' + SEP + '📋 Review checklists for this branch\\n' + SEP + '\\n');\n // filterAlreadyReviewed:false LIST everything that applies, marking what is already done. Hiding the\n // done ones would make a second run look like it found fewer checklists than the first.\n const defined = loadAndValidate(repoRoot).prGate.checklists;\n process.stdout.write(this.report(this.checklistScanner.scan(repoRoot, defined, new ChecklistScanOptions(false))));\n return Promise.resolve();\n }\n\n private report(scan: ChecklistScan): string {\n if (scan.applicable.length === 0) {\n // Zero is a SUPPORTED state, never a blocker (see ChecklistNotice).\n return this.checklistNotice.build(scan.defined.length, 'wp-finish-upsert-pr');\n }\n const reviewedIds = new Set(scan.reviewed.map((r: RequiredChecklist): string => r.id));\n const owed = scan.applicable.filter((r: RequiredChecklist): boolean => !reviewedIds.has(r.id));\n return (\n this.header(scan) +\n this.rosterLines(scan, owed) +\n (owed.length === 0 ? this.allDone() : `\\n${this.instructions.render(owed, scan.reviewPath, scan.context)}\\n`)\n );\n }\n\n // State the base out loud: a reader (and a reviewer) needs to know the diff was taken from the fork point\n // of main and that uncommitted work counted, because both change which checklists fired.\n private header(scan: ChecklistScan): string {\n const base = scan.forkPoint === '' ? 'no fork point resolved' : `fork point ${scan.forkPoint.slice(0, 8)}`;\n return `${scan.defined.length} checklist(s) configured, ${scan.applicable.length} apply to this branch\\n` +\n `(${base}, including uncommitted + untracked work).\\n\\n`;\n }\n\n // REVIEW ONCE, PER SUBAGENT: a checklist with a passing verdict is reused, not re-run. 2 of 4 done means\n // the other 2 still need running, so both groups are shown and only the owed ones become instructions.\n private rosterLines(scan: ChecklistScan, owed: readonly RequiredChecklist[]): string {\n const lines = scan.reviewed.map((r: RequiredChecklist): string =>\n ` ✓ ${r.subagent} — already reviewed on this branch (reusing its review-${r.id}.json)\\n`);\n for (const r of owed) lines.push(` ▶ ${r.subagent} — ${this.why(r)}\\n`);\n return lines.join('');\n }\n\n // Why this one is in scope. A patternless checklist is NOT \"matched\" — it always runs, over the whole diff.\n private why(req: RequiredChecklist): string {\n if (req.matchedPatterns.length === 0) return 'ALWAYS RUNS (no patterns), whole diff in scope';\n const globs = req.matchedPatterns.map((p: string): string => `\"${p}\"`).join(', ');\n return `${req.matchedFiles.length} file(s) matched ${globs}`;\n }\n\n private allDone(): string {\n return '\\n✅ Every checklist that applies is already reviewed — nothing to run.\\n' +\n ' Write review.json and run: pnpm wp-finish-upsert-pr\\n';\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { RepoRootFinder, ReviewJsonService, GateTokenService, SubagentProvenanceService, ChecklistInstructionsService } from '@webpieces/rules-config';
2
2
  import { AiBranchName } from '../workflow/git-readAiBranchName';
3
3
  import { BranchNaming } from '../workflow/branch-naming';
4
- import { ChecklistDetector } from '../workflow/checklist-detector';
4
+ import { ChecklistScanner } from '../workflow/checklist-scanner';
5
5
  import { GitExec } from '../workflow/git-exec';
6
6
  import { BuildAffected } from '../workflow/build-affected';
7
7
  import { MergeState } from '../workflow/merge-state';
@@ -20,19 +20,21 @@ export declare class FinishUpsertPrCommand {
20
20
  private readonly prMerger;
21
21
  private readonly publisher;
22
22
  private readonly dashboard;
23
- private readonly checklistDetector;
23
+ private readonly checklistScanner;
24
24
  private readonly reviewJsonService;
25
25
  private readonly gateTokenService;
26
26
  private readonly provenance;
27
27
  private readonly instructions;
28
- constructor(repoRootFinder: RepoRootFinder, aiBranchName: AiBranchName, branchNaming: BranchNaming, gitExec: GitExec, buildAffected: BuildAffected, mergeState: MergeState, mergeEnd: MergeEnd, prMerger: PrMerger, publisher: GatedPrPublisher, dashboard: Dashboard, checklistDetector: ChecklistDetector, reviewJsonService: ReviewJsonService, gateTokenService: GateTokenService, provenance: SubagentProvenanceService, instructions: ChecklistInstructionsService);
28
+ constructor(repoRootFinder: RepoRootFinder, aiBranchName: AiBranchName, branchNaming: BranchNaming, gitExec: GitExec, buildAffected: BuildAffected, mergeState: MergeState, mergeEnd: MergeEnd, prMerger: PrMerger, publisher: GatedPrPublisher, dashboard: Dashboard, checklistScanner: ChecklistScanner, reviewJsonService: ReviewJsonService, gateTokenService: GateTokenService, provenance: SubagentProvenanceService, instructions: ChecklistInstructionsService);
29
29
  run(): Promise<void>;
30
30
  private emitClickableLinkDirective;
31
31
  private finalizeAnyInProgressMerge;
32
32
  /**
33
33
  * Refuse the PR while ANY applicable checklist still owes a verdict, naming exactly those reviewers and
34
- * exactly what to tell them. Throws InformAiError so the AI gets one actionable message; passes silently
35
- * when nothing is pending, and is a no-op for a repo with no checklists.
34
+ * exactly what to tell them via the same renderer `wp-checklist` uses, so the AI sees the identical
35
+ * block it would have seen there. Lists ONLY the outstanding ones: re-instructing an already-reviewed
36
+ * checklist invites a redundant second run and reads as though the earlier verdict did not count.
37
+ * No-op for a repo with no applicable checklists.
36
38
  */
37
39
  private assertEveryReviewerRan;
38
40
  private gitOut;
@@ -9,7 +9,7 @@ const rules_config_1 = require("@webpieces/rules-config");
9
9
  const inversify_1 = require("inversify");
10
10
  const git_readAiBranchName_1 = require("../workflow/git-readAiBranchName");
11
11
  const branch_naming_1 = require("../workflow/branch-naming");
12
- const checklist_detector_1 = require("../workflow/checklist-detector");
12
+ const checklist_scanner_1 = require("../workflow/checklist-scanner");
13
13
  const git_exec_1 = require("../workflow/git-exec");
14
14
  const build_affected_1 = require("../workflow/build-affected");
15
15
  const merge_state_1 = require("../workflow/merge-state");
@@ -56,12 +56,12 @@ let FinishUpsertPrCommand = class FinishUpsertPrCommand {
56
56
  prMerger;
57
57
  publisher;
58
58
  dashboard;
59
- checklistDetector;
59
+ checklistScanner;
60
60
  reviewJsonService;
61
61
  gateTokenService;
62
62
  provenance;
63
63
  instructions;
64
- constructor(repoRootFinder, aiBranchName, branchNaming, gitExec, buildAffected, mergeState, mergeEnd, prMerger, publisher, dashboard, checklistDetector, reviewJsonService, gateTokenService, provenance, instructions) {
64
+ constructor(repoRootFinder, aiBranchName, branchNaming, gitExec, buildAffected, mergeState, mergeEnd, prMerger, publisher, dashboard, checklistScanner, reviewJsonService, gateTokenService, provenance, instructions) {
65
65
  this.repoRootFinder = repoRootFinder;
66
66
  this.aiBranchName = aiBranchName;
67
67
  this.branchNaming = branchNaming;
@@ -72,7 +72,7 @@ let FinishUpsertPrCommand = class FinishUpsertPrCommand {
72
72
  this.prMerger = prMerger;
73
73
  this.publisher = publisher;
74
74
  this.dashboard = dashboard;
75
- this.checklistDetector = checklistDetector;
75
+ this.checklistScanner = checklistScanner;
76
76
  this.reviewJsonService = reviewJsonService;
77
77
  this.gateTokenService = gateTokenService;
78
78
  this.provenance = provenance;
@@ -87,18 +87,19 @@ let FinishUpsertPrCommand = class FinishUpsertPrCommand {
87
87
  // 2. REQUIRE the AI-authored review.json (throws InformAiError with the schema if missing/invalid).
88
88
  // Compute the consumer checklists this diff triggered FIRST so an unacknowledged BLOCK throws
89
89
  // here — BEFORE any `gh pr create` — matching the guarantee buildCommand already provides.
90
- const defs = (0, rules_config_1.loadAndValidate)(repoRoot).prGate.checklists;
91
- const required = this.checklistDetector.toRequired(this.checklistDetector.detectForRepo(repoRoot, defs));
92
- // review-<id>.json files persist locally between runs, so a re-run after a push re-validates the
93
- // EXISTING verdicts against the (possibly changed) triggered set for free: an unchanged checklist
94
- // needs no re-review, a newly-triggered one refuses until its file is written. That is the
95
- // "full review only when the checklist surface changes" behavior — no special-casing here.
96
- // FAIL FAST on missing reviewers, BEFORE review.json is even parsed. A missing reviewer is not a
97
- // review.json defect and folding it into that error made the AI fix the wrong thing; and the message
98
- // lists ONLY the subagents that still owe a verdict, so an already-reviewed checklist is never
99
- // re-instructed. Same computation + same renderer as `wp-checklist`, so the two cannot disagree.
90
+ // The SAME scan wp-checklist runs, with filterAlreadyReviewed:true so `outstanding` is exactly what
91
+ // still owes a verdict (Z of N of X). Sharing the computation is the point: the command that REPORTS
92
+ // and the command that GATES must not be able to disagree about what is owed. review-<id>.json files
93
+ // persist locally, so a re-run re-validates the EXISTING verdicts against the (possibly changed)
94
+ // applicable set for free — an unchanged checklist needs no re-review, a newly-applicable one refuses
95
+ // until its file is written.
100
96
  const featureName = this.aiBranchName.getFeatureName();
101
- this.assertEveryReviewerRan(repoRoot, featureName, required);
97
+ const scan = this.checklistScanner.scan(repoRoot, (0, rules_config_1.loadAndValidate)(repoRoot).prGate.checklists, new checklist_scanner_1.ChecklistScanOptions(true));
98
+ const required = scan.applicable;
99
+ // FAIL FAST on missing reviewers, BEFORE review.json is parsed and before the build gate runs. A
100
+ // missing reviewer is not a review.json defect (folding it in made the AI fix the wrong thing), and
101
+ // nobody should wait on a build to be told a reviewer never ran.
102
+ this.assertEveryReviewerRan(scan);
102
103
  const review = this.reviewJsonService.loadReviewJson((0, rules_config_1.reviewJsonPath)(repoRoot, featureName), required);
103
104
  // 2c. For any BLOCK checklist that names a reviewer `subagent`, VERIFY (from the harness's own
104
105
  // artifacts) that such a subagent actually ran on this branch — the coding agent may not
@@ -159,21 +160,17 @@ let FinishUpsertPrCommand = class FinishUpsertPrCommand {
159
160
  }
160
161
  /**
161
162
  * Refuse the PR while ANY applicable checklist still owes a verdict, naming exactly those reviewers and
162
- * exactly what to tell them. Throws InformAiError so the AI gets one actionable message; passes silently
163
- * when nothing is pending, and is a no-op for a repo with no checklists.
163
+ * exactly what to tell them via the same renderer `wp-checklist` uses, so the AI sees the identical
164
+ * block it would have seen there. Lists ONLY the outstanding ones: re-instructing an already-reviewed
165
+ * checklist invites a redundant second run and reads as though the earlier verdict did not count.
166
+ * No-op for a repo with no applicable checklists.
164
167
  */
165
- assertEveryReviewerRan(repoRoot, featureName, required) {
166
- if (required.length === 0)
168
+ assertEveryReviewerRan(scan) {
169
+ if (scan.outstanding.length === 0)
167
170
  return;
168
- const reviewPath = (0, rules_config_1.reviewJsonPath)(repoRoot, featureName);
169
- const results = this.reviewJsonService.loadChecklistResults(reviewPath, required);
170
- const pending = this.reviewJsonService.pendingChecklists(required, results);
171
- if (pending.length === 0)
172
- return;
173
- const context = this.reviewJsonService.reviewContextFor(repoRoot, featureName);
174
- throw new rules_config_1.InformAiError(`⛔ NO PR — ${pending.length} of ${required.length} review checklist(s) that apply to this diff have ` +
175
- `no passing verdict yet: ${this.instructions.names(pending)}\n\n` +
176
- `${this.instructions.render(pending, reviewPath, context)}\n\n` +
171
+ throw new rules_config_1.InformAiError(`⛔ NO PR — ${scan.outstanding.length} of ${scan.applicable.length} review checklist(s) that apply to this ` +
172
+ `branch have no passing verdict yet: ${this.instructions.names(scan.outstanding)}\n\n` +
173
+ `${this.instructions.render(scan.outstanding, scan.reviewPath, scan.context)}\n\n` +
177
174
  `Then re-run: pnpm wp-finish-upsert-pr (or check anytime with: pnpm wp-checklist)`);
178
175
  }
179
176
  gitOut(args) {
@@ -329,7 +326,7 @@ exports.FinishUpsertPrCommand = FinishUpsertPrCommand = tslib_1.__decorate([
329
326
  pr_merger_1.PrMerger,
330
327
  gated_pr_publisher_1.GatedPrPublisher,
331
328
  dashboard_1.Dashboard,
332
- checklist_detector_1.ChecklistDetector,
329
+ checklist_scanner_1.ChecklistScanner,
333
330
  rules_config_1.ReviewJsonService,
334
331
  rules_config_1.GateTokenService,
335
332
  rules_config_1.SubagentProvenanceService,
@@ -1 +1 @@
1
- {"version":3,"file":"finish-upsert-pr-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/finish-upsert-pr-command.ts"],"names":[],"mappings":";;;;AAAA,iDAAoD;AACpD,+CAAyB;AACzB,mDAA6B;AAC7B,0DAKiC;AACjC,yCAA2D;AAC3D,2EAAgE;AAChE,6DAAyD;AACzD,uEAAmE;AACnE,mDAA+C;AAC/C,+DAA6E;AAC7E,yDAAqD;AACrD,qDAAkE;AAClE,yDAAuD;AACvD,qDAA+D;AAC/D,uEAAkE;AAClE,yDAA8G;AAE9G,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE,gGAAgG;AAChG,MAAM,KAAK;IACP,MAAM,CAAS;IACf,GAAG,CAAS;IAEZ,YAAY,MAAc,EAAE,GAAW;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ;AAED,wGAAwG;AACxG,wGAAwG;AACxG,sGAAsG;AACtG,MAAM,YAAY;IACd,QAAQ,CAAS;IACjB,KAAK,CAAS;IACd,KAAK,CAAe;IAEpB,YAAY,QAAgB,EAAE,KAAa,EAAE,KAAmB;QAC5D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;CACJ;AAED,wGAAwG;AACxG,oGAAoG;AACpG,kGAAkG;AAClG,0BAA0B;AAEnB,IAAM,qBAAqB,GAA3B,MAAM,q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C,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvD,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;CACJ,CAAA;AA9RY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGA,6BAAc;QAChB,mCAAY;QACZ,4BAAY;QACjB,kBAAO;QACD,8BAAa;QAChB,wBAAU;QACZ,oBAAQ;QACR,oBAAQ;QACP,qCAAgB;QAChB,qBAAS;QACD,sCAAiB;QACjB,gCAAiB;QAClB,+BAAgB;QACtB,wCAAyB;QACvB,2CAA4B;GAhBtD,qBAAqB,CA8RjC","sourcesContent":["import { execSync, spawnSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport {\n loadAndValidate, prDirFor, reviewJsonPath, ReviewJson, RequiredChecklist,\n writeTemplate, RepoRootFinder, ReviewJsonService,\n GateTokenService, SubagentProvenanceService, PROVENANCE_OK, PROVENANCE_MISSING, PROVENANCE_SKIPPED,\n ChecklistInstructionsService, InformAiError,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { BranchNaming } from '../workflow/branch-naming';\nimport { ChecklistDetector } from '../workflow/checklist-detector';\nimport { GitExec } from '../workflow/git-exec';\nimport { BuildAffected, BuildGateOptions } from '../workflow/build-affected';\nimport { MergeState } from '../workflow/merge-state';\nimport { MergeEnd, MergeEndOptions } from '../workflow/merge-end';\nimport { MergeContext } from '../workflow/merge-start';\nimport { PrMerger, MergeOutcome } from '../workflow/pr-merger';\nimport { GatedPrPublisher } from '../workflow/gated-pr-publisher';\nimport { Dashboard, DashboardInput, ChecklistRow, CHECKLIST_COMMENT_MARKER } from '../../dashboard/dashboard';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n// A resolved PR's number + web URL. Both '' when the PR can't be resolved (e.g. create failed).\nclass PrRef {\n number: string;\n url: string;\n\n constructor(number: string, url: string) {\n this.number = number;\n this.url = url;\n }\n}\n\n// The outcome of the whole upsert: the PR number + web URL ('' each when unresolved) plus what actually\n// happened to the merge, so the final summary reports the REAL result rather than assuming success. The\n// URL is carried so the closing block can hand the AI a clickable link to relay to the user verbatim.\nclass UpsertResult {\n prNumber: string;\n prUrl: string;\n merge: MergeOutcome;\n\n constructor(prNumber: string, prUrl: string, merge: MergeOutcome) {\n this.prNumber = prNumber;\n this.prUrl = prUrl;\n this.merge = merge;\n }\n}\n\n// FINISH of the AI-first PR flow. Runs after the AI wrote review.json. In order: (1) if a 3-point merge\n// was in progress, validate + commit + FINALIZE via merge-END; (2) REQUIRE review.json; (3) run the\n// authoritative build gate; (4) render the dashboard; (5) create/update the PR via `gh`. The ONLY\n// command that posts PRs.\n@injectable(bindingScopeValues.Singleton)\nexport class FinishUpsertPrCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly aiBranchName: AiBranchName,\n private readonly branchNaming: BranchNaming,\n private readonly gitExec: GitExec,\n private readonly buildAffected: BuildAffected,\n private readonly mergeState: MergeState,\n private readonly mergeEnd: MergeEnd,\n private readonly prMerger: PrMerger,\n private readonly publisher: GatedPrPublisher,\n private readonly dashboard: Dashboard,\n private readonly checklistDetector: ChecklistDetector,\n private readonly reviewJsonService: ReviewJsonService,\n private readonly gateTokenService: GateTokenService,\n private readonly provenance: SubagentProvenanceService,\n private readonly instructions: ChecklistInstructionsService,\n ) {}\n\n async run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n // Refresh the AI-facing workflow doc so it's present + current for any failure message to cite.\n writeTemplate(repoRoot, 'webpieces.git-workflow.md');\n // 1. Finish any in-progress conflict resolution: validate + commit + finalize the branch swap.\n await this.finalizeAnyInProgressMerge(repoRoot);\n\n // 2. REQUIRE the AI-authored review.json (throws InformAiError with the schema if missing/invalid).\n // Compute the consumer checklists this diff triggered FIRST so an unacknowledged BLOCK throws\n // here — BEFORE any `gh pr create` — matching the guarantee buildCommand already provides.\n const defs = loadAndValidate(repoRoot).prGate.checklists;\n const required = this.checklistDetector.toRequired(this.checklistDetector.detectForRepo(repoRoot, defs));\n // review-<id>.json files persist locally between runs, so a re-run after a push re-validates the\n // EXISTING verdicts against the (possibly changed) triggered set for free: an unchanged checklist\n // needs no re-review, a newly-triggered one refuses until its file is written. That is the\n // \"full review only when the checklist surface changes\" behavior — no special-casing here.\n // FAIL FAST on missing reviewers, BEFORE review.json is even parsed. A missing reviewer is not a\n // review.json defect and folding it into that error made the AI fix the wrong thing; and the message\n // lists ONLY the subagents that still owe a verdict, so an already-reviewed checklist is never\n // re-instructed. Same computation + same renderer as `wp-checklist`, so the two cannot disagree.\n const featureName = this.aiBranchName.getFeatureName();\n this.assertEveryReviewerRan(repoRoot, featureName, required);\n const review = this.reviewJsonService.loadReviewJson(reviewJsonPath(repoRoot, featureName), required);\n\n // 2c. For any BLOCK checklist that names a reviewer `subagent`, VERIFY (from the harness's own\n // artifacts) that such a subagent actually ran on this branch — the coding agent may not\n // self-certify. Absent CLAUDE_CODE_SESSION_ID this skips with a warning (CI / plain terminal).\n const currentBranch = execSync('git branch --show-current', { encoding: 'utf8' }).trim();\n const provenanceVerified = this.enforceProvenance(required, currentBranch);\n\n // 2b. The build gate validates the WORKING TREE but we push HEAD — so they MUST be identical.\n this.gitExec.assertCleanTree(repoRoot);\n\n // 3. Authoritative build gate, then post the gated body, then push (that ORDER — see GatedPrPublisher).\n this.buildAffected.runBuildGate(repoRoot, new BuildGateOptions(\n '🛠️ Build gate (authoritative)', 'pnpm wp-finish-upsert-pr', 'Build failed — no PR created/updated.',\n ));\n const base = this.branchNaming.baseBranchName(execSync('git branch --show-current', { encoding: 'utf8' }).trim());\n\n process.stdout.write('\\n' + SEP + '📋 Dashboard + PR\\n' + SEP + '\\n');\n const title = this.prTitleFrom(review);\n const input = this.computeDashboardInput(repoRoot, true, review, title, required);\n // Append the hidden HMAC gate token bound to the LOCAL HEAD sha — computed BEFORE the push, because\n // GatedPrPublisher writes the body first so CI's `synchronize` read can never see a stale token. A\n // valid token in the PR body is proof this gated flow ran + passed on this exact commit, which CI\n // (`wp-check-pr`) recomputes. We reach here only after the build gate + every BLOCK checklist\n // passed, so minting is legitimate. Nothing about HMAC(salt, HEAD) needs the remote to have it.\n const gateSalt = loadAndValidate(repoRoot).prGate.gateSalt;\n const headSha = this.gitOut(['rev-parse', 'HEAD']);\n const body = this.dashboard.renderDashboard(input) + this.gateTokenBody(gateSalt, headSha);\n const result = this.upsertPr(repoRoot, base, body, title, input);\n // Publish each reviewer's full output as ONE combined PR comment (idempotent, opt-out-aware). Never\n // fatal — the PR is already up by now, so a comment failure only warns.\n this.postChecklistComment(repoRoot, result.prNumber, input.checklists, provenanceVerified);\n const prNum = result.prNumber;\n\n process.stdout.write(\n '\\n' + SEP + '✅ PR finished — here is exactly what I did\\n' + SEP + '\\n' +\n ` 1. validated the build gate (authoritative)\\n` +\n ` 2. ${prNum ? `wrote the gated body to PR #${prNum}` : 'composed the gated PR body'} titled: \"${title}\"\\n` +\n ` 3. force-pushed your work to origin/${base} (after the body, so CI reads the right token)\\n` +\n ` 4. ${result.merge.message}\\n` +\n ` You are on ${base} — same name as the remote branch and the PR head.\\n\\n`,\n );\n // Close by handing the AI a clickable link + directive to end its summary with it (see helper).\n this.emitClickableLinkDirective(prNum, result.prUrl, title);\n }\n\n // Print the closing AI directive: the resolved PR's number/title/URL and an instruction to end the\n // user-facing summary with EXACTLY `[#N title](url)` as the final line, nothing after it. No-op when\n // the PR could not be resolved — better to say nothing than to point the user at a link that isn't real.\n private emitClickableLinkDirective(prNum: string, prUrl: string, title: string): void {\n if (prNum === '' || prUrl === '') return;\n process.stdout.write(\n SEP + `🔗 PR #${prNum}: ${title}\\n ${prUrl}\\n\\n` + SEP +\n `AI — the LAST line of your summary to the user MUST be EXACTLY this clickable link, with\\n` +\n `NOTHING printed after it (no sign-off, no next steps, no blank commentary):\\n\\n` +\n ` [#${prNum} ${title}](${prUrl})\\n\\n`,\n );\n }\n\n // Validate + commit + finalize a 3-point merge the AI resolved, if one is in progress. Finalizing here\n // does NOT push (pushRemote=false): this command pushes exactly ONCE, from GatedPrPublisher, and only\n // after review.json + every BLOCK checklist + the build gate pass and the gated PR body is written.\n private async finalizeAnyInProgressMerge(repoRoot: string): Promise<void> {\n const home = this.mergeState.mergeDirFor(repoRoot, this.aiBranchName.getFeatureName());\n const activeDir = this.mergeState.findActiveMergeRunDir(home);\n const marker = activeDir ? this.mergeState.readMergeMarker(activeDir) : null;\n if (!activeDir || !marker || marker.validated) return;\n await this.mergeEnd.mergeEnd(\n repoRoot, 'wp-finish-upsert-pr', activeDir,\n new MergeContext(marker.currentBranch, marker.squashBranch, marker.backupBranch, marker.prNumber),\n new MergeEndOptions(marker.conflictedFiles, false),\n );\n }\n\n /**\n * Refuse the PR while ANY applicable checklist still owes a verdict, naming exactly those reviewers and\n * exactly what to tell them. Throws InformAiError so the AI gets one actionable message; passes silently\n * when nothing is pending, and is a no-op for a repo with no checklists.\n */\n private assertEveryReviewerRan(repoRoot: string, featureName: string, required: readonly RequiredChecklist[]): void {\n if (required.length === 0) return;\n const reviewPath = reviewJsonPath(repoRoot, featureName);\n const results = this.reviewJsonService.loadChecklistResults(reviewPath, required);\n const pending = this.reviewJsonService.pendingChecklists(required, results);\n if (pending.length === 0) return;\n const context = this.reviewJsonService.reviewContextFor(repoRoot, featureName);\n throw new InformAiError(\n `⛔ NO PR — ${pending.length} of ${required.length} review checklist(s) that apply to this diff have ` +\n `no passing verdict yet: ${this.instructions.names(pending)}\\n\\n` +\n `${this.instructions.render(pending, reviewPath, context)}\\n\\n` +\n `Then re-run: pnpm wp-finish-upsert-pr (or check anytime with: pnpm wp-checklist)`,\n );\n }\n\n private gitOut(args: string[]): string {\n const result = spawnSync('git', args, { encoding: 'utf8' });\n return result.status === 0 ? (result.stdout ?? '').trim() : '';\n }\n\n // The user-facing PR title: the AI-authored review.title, or — if omitted — a readable fallback\n // derived from the stable feature name (NEVER the internal `Squash merge of <branch>` commit subject).\n private prTitleFrom(review: ReviewJson): string {\n if (review.title !== '') return review.title;\n return this.aiBranchName.getFeatureName().replace(/[-/]+/g, ' ').trim();\n }\n\n // eslint-disable-next-line @typescript-eslint/max-params\n private computeDashboardInput(repoRoot: string, buildPassed: boolean, review: ReviewJson, title: string, required: readonly RequiredChecklist[]): DashboardInput {\n const config = loadAndValidate(repoRoot).prGate;\n const forkPoint = this.gitOut(['merge-base', 'origin/main', 'HEAD']);\n const featureHead = this.gitOut(['rev-parse', 'HEAD']);\n const mainHead = this.gitOut(['rev-parse', 'origin/main']);\n const range = `${forkPoint}..${featureHead}`;\n const changedFiles = this.gitOut(['diff', range, '--name-only']).split('\\n').filter((f: string): boolean => f.trim() !== '');\n const patch = this.gitOut(['diff', range]);\n\n const gateResults = this.dashboard.computeGateResults(config.gates, changedFiles);\n const disables = this.dashboard.countAddedDisables(patch);\n const rows = this.checklistRows(required, review);\n return new DashboardInput(title, gateResults, disables, buildPassed, forkPoint, featureHead, mainHead, review, rows);\n }\n\n // Pair each matched checklist with its resolved verdict for the dashboard. (A checklist reaching this\n // point is always PASS/OVERRIDDEN — loadReviewJson already threw on FAIL/MISSING.)\n private checklistRows(required: readonly RequiredChecklist[], review: ReviewJson): ChecklistRow[] {\n return required.map((req: RequiredChecklist): ChecklistRow => {\n const verdict = this.reviewJsonService.resolveVerdict(req, review.results);\n return new ChecklistRow(req.id, verdict.status, verdict.detail);\n });\n }\n\n // Hidden HMAC gate-token marker (with a leading blank line) to append to the PR body, or '' when the\n // repo sets no gateSalt (byte-identical body to before this feature). Bound to the pushed HEAD sha.\n private gateTokenBody(gateSalt: string, headSha: string): string {\n const marker = this.gateTokenService.gateTokenMarker(gateSalt, headSha);\n return marker === '' ? '' : `\\n\\n${marker}\\n`;\n }\n\n // Enforce that EACH matched checklist was reviewed by its OWN named subagent, as a DISTINCT run —\n // the coding agent may not self-certify, and one reviewer may not stand in for several. A verified set\n // passes silently; no session id warns but passes; any missing reviewer throws so the PR does not open.\n private enforceProvenance(required: readonly RequiredChecklist[], branch: string): boolean {\n const errors: string[] = [];\n let verified = true; // no reviewers to verify ⇒ vacuously true\n const subagents = required.map((r: RequiredChecklist): string => r.subagent.trim()).filter((s: string): boolean => s !== '');\n if (subagents.length > 0) {\n const result = this.provenance.verifyDistinct(subagents, branch);\n verified = result.status === PROVENANCE_OK;\n if (result.status === PROVENANCE_MISSING) {\n errors.push(result.detail);\n } else if (result.status === PROVENANCE_SKIPPED) {\n process.stderr.write(`⚠️ ${result.detail}\\n`);\n }\n }\n if (errors.length > 0) {\n throw new InformAiError(\n `${errors.length} checklist(s) require an independent reviewer subagent that did not run — fix, then re-run pnpm wp-finish-upsert-pr:\\n\\n` +\n errors.map((e: string): string => ` • ${e}`).join('\\n') +\n `\\n\\nSpawn the named reviewer subagent to review the checklist on THIS branch, then re-run.`,\n );\n }\n return verified;\n }\n\n // Publish every reviewer's full `output` as ONE combined PR comment, idempotently (find the marker\n // comment → PATCH it, else POST). No-op when there is no PR number or no matched checklists. Never\n // fatal: by here the PR is already created/updated, so a `gh` failure only warns.\n private postChecklistComment(repoRoot: string, prNumber: string, rows: readonly ChecklistRow[], provenanceVerified: boolean): void {\n if (prNumber === '' || rows.length === 0) return;\n if (!loadAndValidate(repoRoot).prGate.checklistComments) return;\n const body = this.dashboard.renderChecklistComment(rows, provenanceVerified);\n const prDir = prDirFor(repoRoot, this.aiBranchName.getFeatureName());\n fs.mkdirSync(prDir, { recursive: true });\n const payload = path.join(prDir, 'checklist-comment.json');\n fs.writeFileSync(payload, JSON.stringify({ body }));\n const commentId = this.findChecklistCommentId(prNumber);\n const args = commentId !== ''\n ? ['api', '--method', 'PATCH', `repos/{owner}/{repo}/issues/comments/${commentId}`, '--input', payload]\n : ['api', '--method', 'POST', `repos/{owner}/{repo}/issues/${prNumber}/comments`, '--input', payload];\n const res = spawnSync('gh', args, { encoding: 'utf8' });\n if (res.status !== 0) {\n process.stderr.write('⚠️ Could not post the checklist review comment (non-fatal — the PR is already up).\\n');\n } else {\n process.stdout.write(` ${commentId !== '' ? 'updated' : 'posted'} the checklist review comment ✓\\n`);\n }\n }\n\n // The id of THIS tool's existing checklist comment on the PR (by the hidden marker), or '' if none.\n private findChecklistCommentId(prNumber: string): string {\n const res = spawnSync('gh', [\n 'api', '--paginate', `repos/{owner}/{repo}/issues/${prNumber}/comments`,\n '--jq', `.[] | select(.body | contains(\"${CHECKLIST_COMMENT_MARKER}\")) | .id`,\n ], { encoding: 'utf8' });\n if (res.status !== 0) return '';\n return (res.stdout ?? '').trim().split('\\n')[0] ?? '';\n }\n\n // The PR, the remote branch, and the local branch all share the one stable feature name. Look up /\n // create / merge against `baseBranch` (baseBranchName tolerates a leftover `…wpN` mid-transition).\n // GatedPrPublisher owns the edit/push/create half and its ORDERING — the gated body goes up before\n // the push, so CI's `synchronize` read cannot see the previous run's token.\n private upsertPr(repoRoot: string, baseBranch: string, body: string, title: string, input: DashboardInput): UpsertResult {\n const prDir = prDirFor(repoRoot, this.aiBranchName.getFeatureName());\n fs.mkdirSync(prDir, { recursive: true });\n const bodyFile = path.join(prDir, 'pr-body.md');\n fs.writeFileSync(bodyFile, body + '\\n');\n\n const published = this.publisher.publish(baseBranch, title, bodyFile);\n if (published.createFailed) {\n process.stderr.write('⚠️ gh pr create failed — create the PR manually with the body in:\\n ' + bodyFile + '\\n');\n return new UpsertResult('', '', new MergeOutcome(false, false,\n '⚠️ did NOT merge — there is no PR to merge (gh pr create failed above)'));\n }\n const num = published.number;\n\n // Set the squash-merge SUBJECT to the PR title (+ the `(#N)` GitHub normally appends, which an\n // explicit --subject would otherwise drop) and the BODY to the compact commit summary, so main's\n // history carries the PR title + risk/flags/link — NOT the internal `Squash merge of <branch>`\n // subject GitHub would inherit from the single squash commit on the branch.\n const ref = this.prRef(baseBranch);\n const subject = ref.number !== '' ? `${title} (#${ref.number})` : title;\n const mergeBodyFile = path.join(prDir, 'merge-commit-body.md');\n fs.writeFileSync(mergeBodyFile, this.dashboard.renderCommitBody(input, ref.url) + '\\n');\n // PrMerger owns the direct-merge / auto-merge-fallback decision AND checks every gh status, so a\n // merge that did not happen is reported as such instead of being swallowed (see pr-merger.ts).\n // REQUIRED config — no default here on purpose. A missing value (an older published\n // rules-config that has no such field) reaches PrMerger as '' and is treated as \"do not merge\".\n const mergeMode = loadAndValidate(repoRoot).prGate.mergeMode ?? '';\n const outcome = this.prMerger.merge(baseBranch, subject, mergeBodyFile, mergeMode);\n return new UpsertResult(ref.number !== '' ? ref.number : num, ref.url, outcome);\n }\n\n // The PR's number + web URL (for the merge subject `(#N)` and the commit-body back-link). Both ''\n // if it can't be resolved. Rendered via jq into one tab-separated line so no JSON parsing is needed.\n private prRef(baseBranch: string): PrRef {\n const result = spawnSync(\n 'gh', ['pr', 'view', baseBranch, '--json', 'number,url', '--jq', '\"\\\\(.number)\\\\t\\\\(.url)\"'],\n { encoding: 'utf8' },\n );\n if (result.status !== 0) {\n return new PrRef('', '');\n }\n const parts = (result.stdout ?? '').trim().split('\\t');\n return new PrRef(parts[0] ?? '', parts[1] ?? '');\n }\n}\n"]}
1
+ {"version":3,"file":"finish-upsert-pr-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/finish-upsert-pr-command.ts"],"names":[],"mappings":";;;;AAAA,iDAAoD;AACpD,+CAAyB;AACzB,mDAA6B;AAC7B,0DAKiC;AACjC,yCAA2D;AAC3D,2EAAgE;AAChE,6DAAyD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AAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;IAED,kGAAkG;IAClG,qGAAqG;IAC7F,KAAK,CAAC,UAAkB;QAC5B,MAAM,MAAM,GAAG,IAAA,yBAAS,EACpB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,0BAA0B,CAAC,EAC5F,EAAE,QAAQ,EAAE,MAAM,EAAE,CACvB,CAAC;QACF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvD,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;CACJ,CAAA;AA5RY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGA,6BAAc;QAChB,mCAAY;QACZ,4BAAY;QACjB,kBAAO;QACD,8BAAa;QAChB,wBAAU;QACZ,oBAAQ;QACR,oBAAQ;QACP,qCAAgB;QAChB,qBAAS;QACF,oCAAgB;QACf,gCAAiB;QAClB,+BAAgB;QACtB,wCAAyB;QACvB,2CAA4B;GAhBtD,qBAAqB,CA4RjC","sourcesContent":["import { execSync, spawnSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport {\n loadAndValidate, prDirFor, reviewJsonPath, ReviewJson, RequiredChecklist,\n writeTemplate, RepoRootFinder, ReviewJsonService,\n GateTokenService, SubagentProvenanceService, PROVENANCE_OK, PROVENANCE_MISSING, PROVENANCE_SKIPPED,\n ChecklistInstructionsService, InformAiError,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { BranchNaming } from '../workflow/branch-naming';\nimport { ChecklistScan, ChecklistScanOptions, ChecklistScanner } from '../workflow/checklist-scanner';\nimport { GitExec } from '../workflow/git-exec';\nimport { BuildAffected, BuildGateOptions } from '../workflow/build-affected';\nimport { MergeState } from '../workflow/merge-state';\nimport { MergeEnd, MergeEndOptions } from '../workflow/merge-end';\nimport { MergeContext } from '../workflow/merge-start';\nimport { PrMerger, MergeOutcome } from '../workflow/pr-merger';\nimport { GatedPrPublisher } from '../workflow/gated-pr-publisher';\nimport { Dashboard, DashboardInput, ChecklistRow, CHECKLIST_COMMENT_MARKER } from '../../dashboard/dashboard';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n// A resolved PR's number + web URL. Both '' when the PR can't be resolved (e.g. create failed).\nclass PrRef {\n number: string;\n url: string;\n\n constructor(number: string, url: string) {\n this.number = number;\n this.url = url;\n }\n}\n\n// The outcome of the whole upsert: the PR number + web URL ('' each when unresolved) plus what actually\n// happened to the merge, so the final summary reports the REAL result rather than assuming success. The\n// URL is carried so the closing block can hand the AI a clickable link to relay to the user verbatim.\nclass UpsertResult {\n prNumber: string;\n prUrl: string;\n merge: MergeOutcome;\n\n constructor(prNumber: string, prUrl: string, merge: MergeOutcome) {\n this.prNumber = prNumber;\n this.prUrl = prUrl;\n this.merge = merge;\n }\n}\n\n// FINISH of the AI-first PR flow. Runs after the AI wrote review.json. In order: (1) if a 3-point merge\n// was in progress, validate + commit + FINALIZE via merge-END; (2) REQUIRE review.json; (3) run the\n// authoritative build gate; (4) render the dashboard; (5) create/update the PR via `gh`. The ONLY\n// command that posts PRs.\n@injectable(bindingScopeValues.Singleton)\nexport class FinishUpsertPrCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly aiBranchName: AiBranchName,\n private readonly branchNaming: BranchNaming,\n private readonly gitExec: GitExec,\n private readonly buildAffected: BuildAffected,\n private readonly mergeState: MergeState,\n private readonly mergeEnd: MergeEnd,\n private readonly prMerger: PrMerger,\n private readonly publisher: GatedPrPublisher,\n private readonly dashboard: Dashboard,\n private readonly checklistScanner: ChecklistScanner,\n private readonly reviewJsonService: ReviewJsonService,\n private readonly gateTokenService: GateTokenService,\n private readonly provenance: SubagentProvenanceService,\n private readonly instructions: ChecklistInstructionsService,\n ) {}\n\n async run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n // Refresh the AI-facing workflow doc so it's present + current for any failure message to cite.\n writeTemplate(repoRoot, 'webpieces.git-workflow.md');\n // 1. Finish any in-progress conflict resolution: validate + commit + finalize the branch swap.\n await this.finalizeAnyInProgressMerge(repoRoot);\n\n // 2. REQUIRE the AI-authored review.json (throws InformAiError with the schema if missing/invalid).\n // Compute the consumer checklists this diff triggered FIRST so an unacknowledged BLOCK throws\n // here — BEFORE any `gh pr create` — matching the guarantee buildCommand already provides.\n // The SAME scan wp-checklist runs, with filterAlreadyReviewed:true so `outstanding` is exactly what\n // still owes a verdict (Z of N of X). Sharing the computation is the point: the command that REPORTS\n // and the command that GATES must not be able to disagree about what is owed. review-<id>.json files\n // persist locally, so a re-run re-validates the EXISTING verdicts against the (possibly changed)\n // applicable set for free — an unchanged checklist needs no re-review, a newly-applicable one refuses\n // until its file is written.\n const featureName = this.aiBranchName.getFeatureName();\n const scan = this.checklistScanner.scan(repoRoot, loadAndValidate(repoRoot).prGate.checklists, new ChecklistScanOptions(true));\n const required = scan.applicable;\n // FAIL FAST on missing reviewers, BEFORE review.json is parsed and before the build gate runs. A\n // missing reviewer is not a review.json defect (folding it in made the AI fix the wrong thing), and\n // nobody should wait on a build to be told a reviewer never ran.\n this.assertEveryReviewerRan(scan);\n const review = this.reviewJsonService.loadReviewJson(reviewJsonPath(repoRoot, featureName), required);\n\n // 2c. For any BLOCK checklist that names a reviewer `subagent`, VERIFY (from the harness's own\n // artifacts) that such a subagent actually ran on this branch — the coding agent may not\n // self-certify. Absent CLAUDE_CODE_SESSION_ID this skips with a warning (CI / plain terminal).\n const currentBranch = execSync('git branch --show-current', { encoding: 'utf8' }).trim();\n const provenanceVerified = this.enforceProvenance(required, currentBranch);\n\n // 2b. The build gate validates the WORKING TREE but we push HEAD — so they MUST be identical.\n this.gitExec.assertCleanTree(repoRoot);\n\n // 3. Authoritative build gate, then post the gated body, then push (that ORDER — see GatedPrPublisher).\n this.buildAffected.runBuildGate(repoRoot, new BuildGateOptions(\n '🛠️ Build gate (authoritative)', 'pnpm wp-finish-upsert-pr', 'Build failed — no PR created/updated.',\n ));\n const base = this.branchNaming.baseBranchName(execSync('git branch --show-current', { encoding: 'utf8' }).trim());\n\n process.stdout.write('\\n' + SEP + '📋 Dashboard + PR\\n' + SEP + '\\n');\n const title = this.prTitleFrom(review);\n const input = this.computeDashboardInput(repoRoot, true, review, title, required);\n // Append the hidden HMAC gate token bound to the LOCAL HEAD sha — computed BEFORE the push, because\n // GatedPrPublisher writes the body first so CI's `synchronize` read can never see a stale token. A\n // valid token in the PR body is proof this gated flow ran + passed on this exact commit, which CI\n // (`wp-check-pr`) recomputes. We reach here only after the build gate + every BLOCK checklist\n // passed, so minting is legitimate. Nothing about HMAC(salt, HEAD) needs the remote to have it.\n const gateSalt = loadAndValidate(repoRoot).prGate.gateSalt;\n const headSha = this.gitOut(['rev-parse', 'HEAD']);\n const body = this.dashboard.renderDashboard(input) + this.gateTokenBody(gateSalt, headSha);\n const result = this.upsertPr(repoRoot, base, body, title, input);\n // Publish each reviewer's full output as ONE combined PR comment (idempotent, opt-out-aware). Never\n // fatal — the PR is already up by now, so a comment failure only warns.\n this.postChecklistComment(repoRoot, result.prNumber, input.checklists, provenanceVerified);\n const prNum = result.prNumber;\n\n process.stdout.write(\n '\\n' + SEP + '✅ PR finished — here is exactly what I did\\n' + SEP + '\\n' +\n ` 1. validated the build gate (authoritative)\\n` +\n ` 2. ${prNum ? `wrote the gated body to PR #${prNum}` : 'composed the gated PR body'} titled: \"${title}\"\\n` +\n ` 3. force-pushed your work to origin/${base} (after the body, so CI reads the right token)\\n` +\n ` 4. ${result.merge.message}\\n` +\n ` You are on ${base} — same name as the remote branch and the PR head.\\n\\n`,\n );\n // Close by handing the AI a clickable link + directive to end its summary with it (see helper).\n this.emitClickableLinkDirective(prNum, result.prUrl, title);\n }\n\n // Print the closing AI directive: the resolved PR's number/title/URL and an instruction to end the\n // user-facing summary with EXACTLY `[#N title](url)` as the final line, nothing after it. No-op when\n // the PR could not be resolved — better to say nothing than to point the user at a link that isn't real.\n private emitClickableLinkDirective(prNum: string, prUrl: string, title: string): void {\n if (prNum === '' || prUrl === '') return;\n process.stdout.write(\n SEP + `🔗 PR #${prNum}: ${title}\\n ${prUrl}\\n\\n` + SEP +\n `AI — the LAST line of your summary to the user MUST be EXACTLY this clickable link, with\\n` +\n `NOTHING printed after it (no sign-off, no next steps, no blank commentary):\\n\\n` +\n ` [#${prNum} ${title}](${prUrl})\\n\\n`,\n );\n }\n\n // Validate + commit + finalize a 3-point merge the AI resolved, if one is in progress. Finalizing here\n // does NOT push (pushRemote=false): this command pushes exactly ONCE, from GatedPrPublisher, and only\n // after review.json + every BLOCK checklist + the build gate pass and the gated PR body is written.\n private async finalizeAnyInProgressMerge(repoRoot: string): Promise<void> {\n const home = this.mergeState.mergeDirFor(repoRoot, this.aiBranchName.getFeatureName());\n const activeDir = this.mergeState.findActiveMergeRunDir(home);\n const marker = activeDir ? this.mergeState.readMergeMarker(activeDir) : null;\n if (!activeDir || !marker || marker.validated) return;\n await this.mergeEnd.mergeEnd(\n repoRoot, 'wp-finish-upsert-pr', activeDir,\n new MergeContext(marker.currentBranch, marker.squashBranch, marker.backupBranch, marker.prNumber),\n new MergeEndOptions(marker.conflictedFiles, false),\n );\n }\n\n /**\n * Refuse the PR while ANY applicable checklist still owes a verdict, naming exactly those reviewers and\n * exactly what to tell them — via the same renderer `wp-checklist` uses, so the AI sees the identical\n * block it would have seen there. Lists ONLY the outstanding ones: re-instructing an already-reviewed\n * checklist invites a redundant second run and reads as though the earlier verdict did not count.\n * No-op for a repo with no applicable checklists.\n */\n private assertEveryReviewerRan(scan: ChecklistScan): void {\n if (scan.outstanding.length === 0) return;\n throw new InformAiError(\n `⛔ NO PR — ${scan.outstanding.length} of ${scan.applicable.length} review checklist(s) that apply to this ` +\n `branch have no passing verdict yet: ${this.instructions.names(scan.outstanding)}\\n\\n` +\n `${this.instructions.render(scan.outstanding, scan.reviewPath, scan.context)}\\n\\n` +\n `Then re-run: pnpm wp-finish-upsert-pr (or check anytime with: pnpm wp-checklist)`,\n );\n }\n\n private gitOut(args: string[]): string {\n const result = spawnSync('git', args, { encoding: 'utf8' });\n return result.status === 0 ? (result.stdout ?? '').trim() : '';\n }\n\n // The user-facing PR title: the AI-authored review.title, or — if omitted — a readable fallback\n // derived from the stable feature name (NEVER the internal `Squash merge of <branch>` commit subject).\n private prTitleFrom(review: ReviewJson): string {\n if (review.title !== '') return review.title;\n return this.aiBranchName.getFeatureName().replace(/[-/]+/g, ' ').trim();\n }\n\n // eslint-disable-next-line @typescript-eslint/max-params\n private computeDashboardInput(repoRoot: string, buildPassed: boolean, review: ReviewJson, title: string, required: readonly RequiredChecklist[]): DashboardInput {\n const config = loadAndValidate(repoRoot).prGate;\n const forkPoint = this.gitOut(['merge-base', 'origin/main', 'HEAD']);\n const featureHead = this.gitOut(['rev-parse', 'HEAD']);\n const mainHead = this.gitOut(['rev-parse', 'origin/main']);\n const range = `${forkPoint}..${featureHead}`;\n const changedFiles = this.gitOut(['diff', range, '--name-only']).split('\\n').filter((f: string): boolean => f.trim() !== '');\n const patch = this.gitOut(['diff', range]);\n\n const gateResults = this.dashboard.computeGateResults(config.gates, changedFiles);\n const disables = this.dashboard.countAddedDisables(patch);\n const rows = this.checklistRows(required, review);\n return new DashboardInput(title, gateResults, disables, buildPassed, forkPoint, featureHead, mainHead, review, rows);\n }\n\n // Pair each matched checklist with its resolved verdict for the dashboard. (A checklist reaching this\n // point is always PASS/OVERRIDDEN — loadReviewJson already threw on FAIL/MISSING.)\n private checklistRows(required: readonly RequiredChecklist[], review: ReviewJson): ChecklistRow[] {\n return required.map((req: RequiredChecklist): ChecklistRow => {\n const verdict = this.reviewJsonService.resolveVerdict(req, review.results);\n return new ChecklistRow(req.id, verdict.status, verdict.detail);\n });\n }\n\n // Hidden HMAC gate-token marker (with a leading blank line) to append to the PR body, or '' when the\n // repo sets no gateSalt (byte-identical body to before this feature). Bound to the pushed HEAD sha.\n private gateTokenBody(gateSalt: string, headSha: string): string {\n const marker = this.gateTokenService.gateTokenMarker(gateSalt, headSha);\n return marker === '' ? '' : `\\n\\n${marker}\\n`;\n }\n\n // Enforce that EACH matched checklist was reviewed by its OWN named subagent, as a DISTINCT run —\n // the coding agent may not self-certify, and one reviewer may not stand in for several. A verified set\n // passes silently; no session id warns but passes; any missing reviewer throws so the PR does not open.\n private enforceProvenance(required: readonly RequiredChecklist[], branch: string): boolean {\n const errors: string[] = [];\n let verified = true; // no reviewers to verify ⇒ vacuously true\n const subagents = required.map((r: RequiredChecklist): string => r.subagent.trim()).filter((s: string): boolean => s !== '');\n if (subagents.length > 0) {\n const result = this.provenance.verifyDistinct(subagents, branch);\n verified = result.status === PROVENANCE_OK;\n if (result.status === PROVENANCE_MISSING) {\n errors.push(result.detail);\n } else if (result.status === PROVENANCE_SKIPPED) {\n process.stderr.write(`⚠️ ${result.detail}\\n`);\n }\n }\n if (errors.length > 0) {\n throw new InformAiError(\n `${errors.length} checklist(s) require an independent reviewer subagent that did not run — fix, then re-run pnpm wp-finish-upsert-pr:\\n\\n` +\n errors.map((e: string): string => ` • ${e}`).join('\\n') +\n `\\n\\nSpawn the named reviewer subagent to review the checklist on THIS branch, then re-run.`,\n );\n }\n return verified;\n }\n\n // Publish every reviewer's full `output` as ONE combined PR comment, idempotently (find the marker\n // comment → PATCH it, else POST). No-op when there is no PR number or no matched checklists. Never\n // fatal: by here the PR is already created/updated, so a `gh` failure only warns.\n private postChecklistComment(repoRoot: string, prNumber: string, rows: readonly ChecklistRow[], provenanceVerified: boolean): void {\n if (prNumber === '' || rows.length === 0) return;\n if (!loadAndValidate(repoRoot).prGate.checklistComments) return;\n const body = this.dashboard.renderChecklistComment(rows, provenanceVerified);\n const prDir = prDirFor(repoRoot, this.aiBranchName.getFeatureName());\n fs.mkdirSync(prDir, { recursive: true });\n const payload = path.join(prDir, 'checklist-comment.json');\n fs.writeFileSync(payload, JSON.stringify({ body }));\n const commentId = this.findChecklistCommentId(prNumber);\n const args = commentId !== ''\n ? ['api', '--method', 'PATCH', `repos/{owner}/{repo}/issues/comments/${commentId}`, '--input', payload]\n : ['api', '--method', 'POST', `repos/{owner}/{repo}/issues/${prNumber}/comments`, '--input', payload];\n const res = spawnSync('gh', args, { encoding: 'utf8' });\n if (res.status !== 0) {\n process.stderr.write('⚠️ Could not post the checklist review comment (non-fatal — the PR is already up).\\n');\n } else {\n process.stdout.write(` ${commentId !== '' ? 'updated' : 'posted'} the checklist review comment ✓\\n`);\n }\n }\n\n // The id of THIS tool's existing checklist comment on the PR (by the hidden marker), or '' if none.\n private findChecklistCommentId(prNumber: string): string {\n const res = spawnSync('gh', [\n 'api', '--paginate', `repos/{owner}/{repo}/issues/${prNumber}/comments`,\n '--jq', `.[] | select(.body | contains(\"${CHECKLIST_COMMENT_MARKER}\")) | .id`,\n ], { encoding: 'utf8' });\n if (res.status !== 0) return '';\n return (res.stdout ?? '').trim().split('\\n')[0] ?? '';\n }\n\n // The PR, the remote branch, and the local branch all share the one stable feature name. Look up /\n // create / merge against `baseBranch` (baseBranchName tolerates a leftover `…wpN` mid-transition).\n // GatedPrPublisher owns the edit/push/create half and its ORDERING — the gated body goes up before\n // the push, so CI's `synchronize` read cannot see the previous run's token.\n private upsertPr(repoRoot: string, baseBranch: string, body: string, title: string, input: DashboardInput): UpsertResult {\n const prDir = prDirFor(repoRoot, this.aiBranchName.getFeatureName());\n fs.mkdirSync(prDir, { recursive: true });\n const bodyFile = path.join(prDir, 'pr-body.md');\n fs.writeFileSync(bodyFile, body + '\\n');\n\n const published = this.publisher.publish(baseBranch, title, bodyFile);\n if (published.createFailed) {\n process.stderr.write('⚠️ gh pr create failed — create the PR manually with the body in:\\n ' + bodyFile + '\\n');\n return new UpsertResult('', '', new MergeOutcome(false, false,\n '⚠️ did NOT merge — there is no PR to merge (gh pr create failed above)'));\n }\n const num = published.number;\n\n // Set the squash-merge SUBJECT to the PR title (+ the `(#N)` GitHub normally appends, which an\n // explicit --subject would otherwise drop) and the BODY to the compact commit summary, so main's\n // history carries the PR title + risk/flags/link — NOT the internal `Squash merge of <branch>`\n // subject GitHub would inherit from the single squash commit on the branch.\n const ref = this.prRef(baseBranch);\n const subject = ref.number !== '' ? `${title} (#${ref.number})` : title;\n const mergeBodyFile = path.join(prDir, 'merge-commit-body.md');\n fs.writeFileSync(mergeBodyFile, this.dashboard.renderCommitBody(input, ref.url) + '\\n');\n // PrMerger owns the direct-merge / auto-merge-fallback decision AND checks every gh status, so a\n // merge that did not happen is reported as such instead of being swallowed (see pr-merger.ts).\n // REQUIRED config — no default here on purpose. A missing value (an older published\n // rules-config that has no such field) reaches PrMerger as '' and is treated as \"do not merge\".\n const mergeMode = loadAndValidate(repoRoot).prGate.mergeMode ?? '';\n const outcome = this.prMerger.merge(baseBranch, subject, mergeBodyFile, mergeMode);\n return new UpsertResult(ref.number !== '' ? ref.number : num, ref.url, outcome);\n }\n\n // The PR's number + web URL (for the merge subject `(#N)` and the commit-body back-link). Both ''\n // if it can't be resolved. Rendered via jq into one tab-separated line so no JSON parsing is needed.\n private prRef(baseBranch: string): PrRef {\n const result = spawnSync(\n 'gh', ['pr', 'view', baseBranch, '--json', 'number,url', '--jq', '\"\\\\(.number)\\\\t\\\\(.url)\"'],\n { encoding: 'utf8' },\n );\n if (result.status !== 0) {\n return new PrRef('', '');\n }\n const parts = (result.stdout ?? '').trim().split('\\t');\n return new PrRef(parts[0] ?? '', parts[1] ?? '');\n }\n}\n"]}