@webpieces/rules-config 0.4.941 → 0.4.942

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/rules-config",
3
- "version": "0.4.941",
3
+ "version": "0.4.942",
4
4
  "description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -19,9 +19,9 @@
19
19
  "inversify": "7.10.4",
20
20
  "reflect-metadata": "0.2.2",
21
21
  "minimatch": "10.0.1",
22
- "@webpieces/tooling-common": "0.4.941",
23
- "@webpieces/repo-workflow-core": "0.4.941",
24
- "@webpieces/rules-sdk": "0.4.941"
22
+ "@webpieces/tooling-common": "0.4.942",
23
+ "@webpieces/repo-workflow-core": "0.4.942",
24
+ "@webpieces/rules-sdk": "0.4.942"
25
25
  },
26
26
  "author": "Dean Hiller",
27
27
  "license": "Apache-2.0",
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "devDependencies": {
37
- "@webpieces/tooling-testkit": "0.4.941"
37
+ "@webpieces/tooling-testkit": "0.4.942"
38
38
  },
39
39
  "types": "./src/index.d.ts",
40
40
  "bin": {
@@ -0,0 +1,17 @@
1
+ import { AddressedIssue } from './review-json-data';
2
+ /**
3
+ * Validates summary.json's REQUIRED `addressesIssues` array (issue #1310) and narrows it to
4
+ * {@link AddressedIssue}s. Every problem is APPENDED to the caller's error list rather than thrown, so the
5
+ * author gets every summary.json error in one message, the way loadSummaryJson reports all its fields.
6
+ *
7
+ * Required, not optional-but-validated: an omitted array is a refusal, and `[]` is how an author states
8
+ * "this PR addresses no tracked issue". The same no-default reasoning as each entry's `closesIssue` — an
9
+ * absent field would otherwise mean "no ticket", a decision nobody was asked to make
10
+ * (.claude/rules/no-rule-defaults.md).
11
+ */
12
+ export declare class AddressedIssuesParser {
13
+ parse(value: unknown, errors: string[]): AddressedIssue[];
14
+ private parseEntry;
15
+ private urlError;
16
+ private reportDuplicates;
17
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddressedIssuesParser = void 0;
4
+ const review_json_data_1 = require("./review-json-data");
5
+ /**
6
+ * Validates summary.json's REQUIRED `addressesIssues` array (issue #1310) and narrows it to
7
+ * {@link AddressedIssue}s. Every problem is APPENDED to the caller's error list rather than thrown, so the
8
+ * author gets every summary.json error in one message, the way loadSummaryJson reports all its fields.
9
+ *
10
+ * Required, not optional-but-validated: an omitted array is a refusal, and `[]` is how an author states
11
+ * "this PR addresses no tracked issue". The same no-default reasoning as each entry's `closesIssue` — an
12
+ * absent field would otherwise mean "no ticket", a decision nobody was asked to make
13
+ * (.claude/rules/no-rule-defaults.md).
14
+ */
15
+ class AddressedIssuesParser {
16
+ // webpieces-disable no-any-unknown -- the opaque parsed summary.json value, narrowed field by field here
17
+ parse(value, errors) {
18
+ if (value === undefined) {
19
+ errors.push('"addressesIssues" is REQUIRED: an array of {"url": "https://…", "closesIssue": true|false}, one per ticket ' +
20
+ 'this PR addresses. Write [] when it addresses no tracked issue.');
21
+ return [];
22
+ }
23
+ if (!Array.isArray(value)) {
24
+ errors.push(`"addressesIssues" must be an array of {"url", "closesIssue"} entries, got ${JSON.stringify(value)}.`);
25
+ return [];
26
+ }
27
+ const issues = [];
28
+ // webpieces-disable no-any-unknown -- element of an opaque JSON array, narrowed by parseEntry
29
+ value.forEach((entry, index) => {
30
+ const issue = this.parseEntry(entry, index, errors);
31
+ if (issue !== null)
32
+ issues.push(issue);
33
+ });
34
+ this.reportDuplicates(issues, errors);
35
+ return issues;
36
+ }
37
+ // webpieces-disable no-any-unknown -- one opaque JSON array element
38
+ parseEntry(entry, index, errors) {
39
+ const label = `addressesIssues[${index}] ${JSON.stringify(entry)}`;
40
+ if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) {
41
+ errors.push(`${label} must be an object {"url": "https://…", "closesIssue": true|false}.`);
42
+ return null;
43
+ }
44
+ // webpieces-disable no-any-unknown -- opaque JSON object; each key is narrowed below
45
+ const record = entry;
46
+ const url = record['url'];
47
+ const closes = record['closesIssue'];
48
+ const urlError = this.urlError(url);
49
+ if (urlError !== '')
50
+ errors.push(`${label}: ${urlError}`);
51
+ if (typeof closes !== 'boolean') {
52
+ errors.push(`${label}: "closesIssue" must be true or false, and there is no default. true renders "Fixes <url>" and ` +
53
+ 'CLOSES the issue when this PR merges; false renders "Part of <url>" and leaves it open (use false when ' +
54
+ 'more PRs are still owed on that ticket).');
55
+ }
56
+ if (urlError !== '' || typeof closes !== 'boolean')
57
+ return null;
58
+ return new review_json_data_1.AddressedIssue(url.trim(), closes);
59
+ }
60
+ // webpieces-disable no-any-unknown -- the opaque `url` JSON value
61
+ urlError(url) {
62
+ if (typeof url !== 'string' || url.trim() === '') {
63
+ return '"url" must be the issue\'s absolute https:// URL (GitHub, Linear, Jira — any tracker), e.g. "https://github.com/<owner>/<repo>/issues/<n>".';
64
+ }
65
+ const trimmed = url.trim();
66
+ if (!URL.canParse(trimmed) || new URL(trimmed).protocol !== 'https:' || new URL(trimmed).host === '') {
67
+ return `"url" must be an absolute https:// URL, got ${JSON.stringify(url)}. A bare "#123" is not accepted — write the issue's full URL.`;
68
+ }
69
+ return '';
70
+ }
71
+ reportDuplicates(issues, errors) {
72
+ const seen = new Set();
73
+ for (const issue of issues) {
74
+ if (seen.has(issue.url))
75
+ errors.push(`addressesIssues lists ${issue.url} more than once — keep exactly one entry per issue.`);
76
+ seen.add(issue.url);
77
+ }
78
+ }
79
+ }
80
+ exports.AddressedIssuesParser = AddressedIssuesParser;
81
+ //# sourceMappingURL=addressed-issues-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addressed-issues-parser.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/addressed-issues-parser.ts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AAiC,EAAE,MAAgB;QACxE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;gBAAE,MAAM,CAAC,IAAI,CAAC,yBAAyB,KAAK,CAAC,GAAG,qDAAqD,CAAC,CAAC;YAC9H,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACL,CAAC;CACJ;AAnED,sDAmEC","sourcesContent":["import { AddressedIssue } from './review-json-data';\n\n/**\n * Validates summary.json's REQUIRED `addressesIssues` array (issue #1310) and narrows it to\n * {@link AddressedIssue}s. Every problem is APPENDED to the caller's error list rather than thrown, so the\n * author gets every summary.json error in one message, the way loadSummaryJson reports all its fields.\n *\n * Required, not optional-but-validated: an omitted array is a refusal, and `[]` is how an author states\n * \"this PR addresses no tracked issue\". The same no-default reasoning as each entry's `closesIssue` — an\n * absent field would otherwise mean \"no ticket\", a decision nobody was asked to make\n * (.claude/rules/no-rule-defaults.md).\n */\nexport class AddressedIssuesParser {\n // webpieces-disable no-any-unknown -- the opaque parsed summary.json value, narrowed field by field here\n parse(value: unknown, errors: string[]): AddressedIssue[] {\n if (value === undefined) {\n errors.push(\n '\"addressesIssues\" is REQUIRED: an array of {\"url\": \"https://…\", \"closesIssue\": true|false}, one per ticket ' +\n 'this PR addresses. Write [] when it addresses no tracked issue.',\n );\n return [];\n }\n if (!Array.isArray(value)) {\n errors.push(`\"addressesIssues\" must be an array of {\"url\", \"closesIssue\"} entries, got ${JSON.stringify(value)}.`);\n return [];\n }\n const issues: AddressedIssue[] = [];\n // webpieces-disable no-any-unknown -- element of an opaque JSON array, narrowed by parseEntry\n value.forEach((entry: unknown, index: number): void => {\n const issue = this.parseEntry(entry, index, errors);\n if (issue !== null) issues.push(issue);\n });\n this.reportDuplicates(issues, errors);\n return issues;\n }\n\n // webpieces-disable no-any-unknown -- one opaque JSON array element\n private parseEntry(entry: unknown, index: number, errors: string[]): AddressedIssue | null {\n const label = `addressesIssues[${index}] ${JSON.stringify(entry)}`;\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) {\n errors.push(`${label} must be an object {\"url\": \"https://…\", \"closesIssue\": true|false}.`);\n return null;\n }\n // webpieces-disable no-any-unknown -- opaque JSON object; each key is narrowed below\n const record = entry as Record<string, unknown>;\n const url = record['url'];\n const closes = record['closesIssue'];\n const urlError = this.urlError(url);\n if (urlError !== '') errors.push(`${label}: ${urlError}`);\n if (typeof closes !== 'boolean') {\n errors.push(\n `${label}: \"closesIssue\" must be true or false, and there is no default. true renders \"Fixes <url>\" and ` +\n 'CLOSES the issue when this PR merges; false renders \"Part of <url>\" and leaves it open (use false when ' +\n 'more PRs are still owed on that ticket).',\n );\n }\n if (urlError !== '' || typeof closes !== 'boolean') return null;\n return new AddressedIssue((url as string).trim(), closes);\n }\n\n // webpieces-disable no-any-unknown -- the opaque `url` JSON value\n private urlError(url: unknown): string {\n if (typeof url !== 'string' || url.trim() === '') {\n return '\"url\" must be the issue\\'s absolute https:// URL (GitHub, Linear, Jira — any tracker), e.g. \"https://github.com/<owner>/<repo>/issues/<n>\".';\n }\n const trimmed = url.trim();\n if (!URL.canParse(trimmed) || new URL(trimmed).protocol !== 'https:' || new URL(trimmed).host === '') {\n return `\"url\" must be an absolute https:// URL, got ${JSON.stringify(url)}. A bare \"#123\" is not accepted — write the issue's full URL.`;\n }\n return '';\n }\n\n private reportDuplicates(issues: readonly AddressedIssue[], errors: string[]): void {\n const seen = new Set<string>();\n for (const issue of issues) {\n if (seen.has(issue.url)) errors.push(`addressesIssues lists ${issue.url} more than once — keep exactly one entry per issue.`);\n seen.add(issue.url);\n }\n }\n}\n"]}
package/src/index.d.ts CHANGED
@@ -55,7 +55,7 @@ export { ReviewerInstructionsService, ReviewerBriefing, BriefedFile, ContextEntr
55
55
  export { GateTokenService, computeGateToken, gateTokenMarker, extractGateToken, verifyGateToken, } from './gate-token';
56
56
  export { SubagentProvenanceService, ReviewerEvidence, ReviewerContext, ExpectedReviewer, TranscriptScan, ProvenanceResult, PROVENANCE_OK, PROVENANCE_MISSING, PROVENANCE_SKIPPED, } from './subagent-provenance';
57
57
  export { ReviewProvenanceService, ReviewProvenance, ReviewerTranscript, ReviewerPaths, OfferedContext, ProvenanceWriteRequest, DEFAULT_RETENTION_DAYS, } from './review-provenance';
58
- export { PrSummary, PrContext, ChecklistResult, ChecklistVerdict, ChecklistOverride, ChecklistOverrideService, checklistOverrideService, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_ORANGE_FIXED, CK_ORANGE, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, VERDICT_GREEN, VERDICT_YELLOW, VERDICT_ORANGE, VERDICT_RED, VERDICT_STATUSES, RequiredChecklist, ChecklistReviewContext, ReviewJsonService, prDirFor, summaryJsonPath, summaryJsonSchemaHint, } from './review-json';
58
+ export { PrSummary, AddressedIssue, PrContext, ChecklistResult, ChecklistVerdict, ChecklistOverride, ChecklistOverrideService, checklistOverrideService, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_ORANGE_FIXED, CK_ORANGE, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, VERDICT_GREEN, VERDICT_YELLOW, VERDICT_ORANGE, VERDICT_RED, VERDICT_STATUSES, RequiredChecklist, ChecklistReviewContext, ReviewJsonService, prDirFor, summaryJsonPath, summaryJsonSchemaHint, } from './review-json';
59
59
  export { CommandsConfig, buildCommandsConfig, DEFAULT_UPSERT_PR_COMMAND, DEFAULT_MERGE_COMPLETE_COMMAND, } from './commands-config';
60
60
  export { StaleBinRemoval, StaleBinSweeper, staleBinSweeper } from './stale-bin-sweep';
61
61
  export { RepoScratchDirs, SCRATCH_DIR_NAME } from './repo-scratch-dirs';
package/src/index.js CHANGED
@@ -4,8 +4,8 @@ exports.RuleFileExclusions = exports.RuleFileScope = exports.globMatches = expor
4
4
  exports.HOME_EXPERIMENTAL_SECTION = exports.HOME_CONFIG_FILE = exports.HOME_CONFIG_DIR = exports.RETIRED_HOME_CONFIG_KEYS = exports.RetiredHomeConfigKey = exports.HomeConfigService = exports.HomeConfig = exports.validateChecklistDocs = exports.PrunedKey = exports.PruneResult = exports.ConfigPruner = exports.retiredRuleFor = exports.retiredKeyErrorsIn = exports.retiredKeyError = exports.retiredEntry = exports.isRetiredKey = exports.RETIRED_SCOPE_RULE = exports.RETIRED_SCOPE_KEY = exports.RETIRED_CONFIG_KEYS = exports.COMMENT_KEY_SUFFIX = exports.validateTopLevelKeys = exports.isCommentKey = exports.unknownKeyErrors = exports.validateCommandsSection = exports.seedEntryForRule = exports.recommendedSeedModeFor = exports.recommendedSeedMode = exports.allRuleNames = exports.validateMatchRulesSection = exports.validateExcludePaths = exports.validateChecklistsSection = exports.validatePrGateSection = exports.validateWebpiecesConfig = exports.BUILD_LOG_DOC = exports.ReferenceMergeRun = exports.MergeRun = exports.MergeProcessText = exports.MERGE_PROCESS_DOC = exports.MergeProcessDoc = exports.InstructAiDocSet = exports.InstructAiDoc = exports.GitWorkflowDoc = exports.GIT_WORKFLOW_DOC = exports.TemplateWriter = exports.writeTemplate = exports.writeTemplateIfMissing = exports.loadTemplate = exports.PathScopeConfig = exports.NoCustomCssScope = exports.GENERATED_CODE_PATHS = void 0;
5
5
  exports.getFileDiff = exports.getChangedFiles = exports.resolveBase = exports.detectBase = exports.SkipRuleResult = exports.HOTFIX_AUDIT_BANNER = exports.HOTFIX_BUILD_COMMAND = exports.shouldSkipRule = exports.sectionForRule = exports.isHookGuard = exports.schemaFieldNames = exports.DEFAULT_MATCH_RULES = exports.renderMatchRuleMessage = exports.compileMatchRulePatterns = exports.isMatchRuleAllowedPath = exports.findMatchRuleViolations = exports.MatchRuleViolation = exports.MatchRuleConfig = exports.OrphanSweepReport = exports.OrphanDirSweeper = exports.TRASH_RETENTION_DAYS = exports.TRASH_MANIFEST_FILE = exports.TRASH_STATE_DIR = exports.OrphanSweepManifest = exports.OrphanSweepResult = exports.FailedOrphan = exports.ArchivedOrphan = exports.OrphanDirArchiver = exports.OrphanCandidate = exports.OrphanDirScanner = exports.MAX_ROW_BYTES = exports.BUILDS_LOG_GENERATIONS = exports.MAX_BUILDS_LOG_BYTES = exports.BUILD_DONE_FAIL = exports.BUILD_DONE_SUCCESS = exports.BUILD_START = exports.BUILDS_LOCK_FILE = exports.BUILDS_LOG_FILE = exports.RunningBuild = exports.BuildTermination = exports.BuildTicket = exports.BuildsLog = exports.DOCUMENTATION_KEYS = exports.HOME_KEY_AI_DOC = exports.HOME_KEY_DOC = exports.DEFAULT_MAX_CONCURRENT_BUILDS = exports.HOME_KEY_TURN_OFF_ALL_REVIEWERS = exports.HOME_KEY_MAX_CONCURRENT_BUILDS = exports.HOME_KEY_WHOLE_REPO_BUILD_GUARD = exports.HOME_KEY_ORPHAN_DIR_SWEEP = void 0;
6
6
  exports.ChecklistValidator = exports.formatFileList = exports.normalizeChecklistDoc = exports.toChecklist = exports.DEFAULT_REVIEWER_AGENT_NAME = exports.REVIEWER_AGENTS_PLACEHOLDER = exports.ReviewerAgentPolicy = exports.ChecklistDefinition = exports.MERGE_MODES = exports.MERGE_MODE_NONE = exports.MERGE_MODE_AUTO = exports.buildDevDeployConfig = exports.buildLandPrConfig = exports.buildPrGateConfig = exports.defaultDevDeployConfig = exports.defaultLandPrConfig = exports.defaultPrGateConfig = exports.defaultGates = exports.ReviewContextEntry = exports.DEFAULT_DEV_BRANCH = exports.DEFAULT_DEV_BRANCH_NAMESPACE = exports.DevDeployConfig = exports.LandPrConfig = exports.DEFAULT_BUILD_COMMAND = exports.PrGateConfig = exports.GateDefinition = exports.WP_FINISH_PUSH_DEV = exports.WP_PUSH_DEV = exports.WP_FINISH_UPSERT_PR = exports.WP_START_UPSERT_PR = exports.WP_FINISH_UPDATE = exports.WP_START_UPDATE = exports.SyncFlowGuidance = exports.WebpiecesRulesConfig = exports.UPGRADE_SHIM_COMMAND = exports.PRUNE_UNKNOWN_COMMAND = exports.PUSH_DEV_STATE_FILE = exports.MERGE_EXPLANATION_FILE = exports.MERGE_IN_PROGRESS_FILE = exports.MERGE_INFO_DIR = exports.hasDisable = exports.WEBPIECES_DISABLE = exports.AbstractRule = exports.ChangedFilesOptions = exports.DiffRange = exports.DiffScope = exports.isNewOrModified = exports.hasChangesInRange = exports.findNewMethodSignaturesInDiff = exports.getChangedLineNumbers = void 0;
7
- exports.ChecklistReviewContext = exports.RequiredChecklist = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_ORANGE = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_ORANGE = exports.CK_ORANGE_FIXED = exports.CK_OVERRIDDEN = exports.CK_WARN = exports.CK_PASS = exports.checklistOverrideService = exports.ChecklistOverrideService = exports.ChecklistOverride = exports.ChecklistVerdict = exports.ChecklistResult = exports.PrContext = exports.PrSummary = exports.DEFAULT_RETENTION_DAYS = exports.ProvenanceWriteRequest = exports.OfferedContext = exports.ReviewerPaths = exports.ReviewerTranscript = exports.ReviewProvenance = exports.ReviewProvenanceService = exports.PROVENANCE_SKIPPED = exports.PROVENANCE_MISSING = exports.PROVENANCE_OK = exports.ProvenanceResult = exports.TranscriptScan = exports.ExpectedReviewer = exports.ReviewerContext = exports.ReviewerEvidence = exports.SubagentProvenanceService = exports.verifyGateToken = exports.extractGateToken = exports.gateTokenMarker = exports.computeGateToken = exports.GateTokenService = exports.ALL_DIFF_ONE_READ_LINES = exports.READ_TRUNCATION_LINES = exports.ContextEntry = exports.BriefedFile = exports.ReviewerBriefing = exports.ReviewerInstructionsService = exports.ChecklistInstructionsService = void 0;
8
- exports.PathMatchCandidate = exports.FirstPathMatchResult = exports.FirstPathMatch = exports.RuntimeContributionGroup = exports.NodeRuleRuntimeModuleLoader = exports.RuleRuntimeModuleLoader = exports.RuleRuntimeModules = exports.RepositoryLayoutRepair = exports.RunCommandCure = exports.EditFileCure = exports.ConfigRepairError = exports.ConfigRepairCure = exports.ConfigRepairBootstrap = exports.ConfigRepairAccess = exports.RulePackSync = exports.PackPolicyFiles = exports.PackPolicyFilesResult = exports.SelectedPolicyPack = exports.PackPolicyDeclaration = exports.LegacyUpgradeResult = exports.LegacyConfigDocument = exports.prepareLegacyUpgrade = exports.RulePackModuleLoader = exports.RulePackDiscovery = exports.NodeRulePackModuleLoader = exports.RulePackRegistry = exports.TMP_SCRATCH_PREFIX = exports.TMP_SCRATCH_RETENTION_DAYS = exports.TmpScratchSweeper = exports.SCRATCH_DIR_NAME = exports.RepoScratchDirs = exports.staleBinSweeper = exports.StaleBinSweeper = exports.StaleBinRemoval = exports.DEFAULT_MERGE_COMPLETE_COMMAND = exports.DEFAULT_UPSERT_PR_COMMAND = exports.buildCommandsConfig = exports.CommandsConfig = exports.summaryJsonSchemaHint = exports.summaryJsonPath = exports.prDirFor = exports.ReviewJsonService = void 0;
7
+ exports.RequiredChecklist = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_ORANGE = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_ORANGE = exports.CK_ORANGE_FIXED = exports.CK_OVERRIDDEN = exports.CK_WARN = exports.CK_PASS = exports.checklistOverrideService = exports.ChecklistOverrideService = exports.ChecklistOverride = exports.ChecklistVerdict = exports.ChecklistResult = exports.PrContext = exports.AddressedIssue = exports.PrSummary = exports.DEFAULT_RETENTION_DAYS = exports.ProvenanceWriteRequest = exports.OfferedContext = exports.ReviewerPaths = exports.ReviewerTranscript = exports.ReviewProvenance = exports.ReviewProvenanceService = exports.PROVENANCE_SKIPPED = exports.PROVENANCE_MISSING = exports.PROVENANCE_OK = exports.ProvenanceResult = exports.TranscriptScan = exports.ExpectedReviewer = exports.ReviewerContext = exports.ReviewerEvidence = exports.SubagentProvenanceService = exports.verifyGateToken = exports.extractGateToken = exports.gateTokenMarker = exports.computeGateToken = exports.GateTokenService = exports.ALL_DIFF_ONE_READ_LINES = exports.READ_TRUNCATION_LINES = exports.ContextEntry = exports.BriefedFile = exports.ReviewerBriefing = exports.ReviewerInstructionsService = exports.ChecklistInstructionsService = void 0;
8
+ exports.PathMatchCandidate = exports.FirstPathMatchResult = exports.FirstPathMatch = exports.RuntimeContributionGroup = exports.NodeRuleRuntimeModuleLoader = exports.RuleRuntimeModuleLoader = exports.RuleRuntimeModules = exports.RepositoryLayoutRepair = exports.RunCommandCure = exports.EditFileCure = exports.ConfigRepairError = exports.ConfigRepairCure = exports.ConfigRepairBootstrap = exports.ConfigRepairAccess = exports.RulePackSync = exports.PackPolicyFiles = exports.PackPolicyFilesResult = exports.SelectedPolicyPack = exports.PackPolicyDeclaration = exports.LegacyUpgradeResult = exports.LegacyConfigDocument = exports.prepareLegacyUpgrade = exports.RulePackModuleLoader = exports.RulePackDiscovery = exports.NodeRulePackModuleLoader = exports.RulePackRegistry = exports.TMP_SCRATCH_PREFIX = exports.TMP_SCRATCH_RETENTION_DAYS = exports.TmpScratchSweeper = exports.SCRATCH_DIR_NAME = exports.RepoScratchDirs = exports.staleBinSweeper = exports.StaleBinSweeper = exports.StaleBinRemoval = exports.DEFAULT_MERGE_COMPLETE_COMMAND = exports.DEFAULT_UPSERT_PR_COMMAND = exports.buildCommandsConfig = exports.CommandsConfig = exports.summaryJsonSchemaHint = exports.summaryJsonPath = exports.prDirFor = exports.ReviewJsonService = exports.ChecklistReviewContext = void 0;
9
9
  const tslib_1 = require("tslib");
10
10
  var types_1 = require("./types");
11
11
  Object.defineProperty(exports, "ResolvedConfig", { enumerable: true, get: function () { return types_1.ResolvedConfig; } });
@@ -341,6 +341,7 @@ Object.defineProperty(exports, "ProvenanceWriteRequest", { enumerable: true, get
341
341
  Object.defineProperty(exports, "DEFAULT_RETENTION_DAYS", { enumerable: true, get: function () { return review_provenance_1.DEFAULT_RETENTION_DAYS; } });
342
342
  var review_json_1 = require("./review-json");
343
343
  Object.defineProperty(exports, "PrSummary", { enumerable: true, get: function () { return review_json_1.PrSummary; } });
344
+ Object.defineProperty(exports, "AddressedIssue", { enumerable: true, get: function () { return review_json_1.AddressedIssue; } });
344
345
  Object.defineProperty(exports, "PrContext", { enumerable: true, get: function () { return review_json_1.PrContext; } });
345
346
  Object.defineProperty(exports, "ChecklistResult", { enumerable: true, get: function () { return review_json_1.ChecklistResult; } });
346
347
  Object.defineProperty(exports, "ChecklistVerdict", { enumerable: true, get: function () { return review_json_1.ChecklistVerdict; } });
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iCAA0E;AAAjE,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAE3C,qDAA+F;AAAtF,gHAAA,aAAa,OAAA;AAAE,sHAAA,mBAAmB,OAAA;AAAE,yHAAA,sBAAsB,OAAA;AACnE,uGAAuG;AACvG,sFAAsF;AACtF,2CAAwD;AAA/C,oGAAA,MAAM,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AACjC,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,uCAAiF;AAAxE,oGAAA,QAAQ,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,mGAAA,OAAO,OAAA;AAC5D,uCAAqC;AAA5B,mGAAA,OAAO,OAAA;AAEhB,6CAA4E;AAAnE,8GAAA,eAAe,OAAA;AAAE,2GAAA,YAAY,OAAA;AAAE,2GAAA,YAAY,OAAA;AACpD,iGAAiG;AACjG,sCAAsC;AACtC,6DAK+B;AAJ3B,+HAAA,wBAAwB,OAAA;AACxB,wHAAA,iBAAiB,OAAA;AACjB,yHAAA,kBAAkB,OAAA;AAClB,+HAAA,wBAAwB,OAAA;AAE5B,6CAOuB;AANnB,6GAAA,cAAc,OAAA;AACd,8GA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AA;AAClB,+HAAA,uBAAuB,OAAA;AACvB,mIAAA,2BAA2B,OAAA;AAC3B,gIAAA,wBAAwB,OAAA;AAG5B,uDAA8F;AAArF,kHAAA,cAAc,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\n\nexport { RuleFailError, renderRuleFailForAi, renderRuleFailForHuman } from './rule-fail-error';\n// THE one representation of a cure, shared by RuleFailError (build-time) and FixHint (edit-time), plus\n// the one renderer that owns the \"Fix Option N:\" numbering and the \"(preferred)\" tag.\nexport { Option, formatFixOptions } from './fix-option';\nexport { CliExitError } from './cli-exit-error';\nexport { CliUsage, CliFlag, CliArgSet, CliArgsCheck, CliArgs } from './cli-args';\nexport { runMain } from './run-main';\n\nexport { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';\n// The validation-failure banner: ONE cure (edit the file), plus the marker phrases the validator\n// messages embed rather than re-type.\nexport {\n formatConfigErrorsBanner,\n CONFIG_POLICY_DOC,\n RETIRED_KEY_MARKER,\n RETIRED_TOP_LEVEL_MARKER,\n} from './config-error-banner';\nexport {\n findConfigFile,\n CONFIG_FILENAME,\n ConfigFile,\n ConfigParseAttempt,\n CONFIG_PARSE_ATTEMPTS,\n CONFIG_PARSE_RETRY_MILLIS,\n} from './config-file';\n// The PARSED-BUT-UNVALIDATED config shape. Exported for readers that walk the file generically rather\n// than through the typed config (the pr-gate active-hatch dashboard section reads every rule's hatches).\nexport { RawConfigFile } from './config-file';\nexport { RepoRootFinder, INSTRUCT_AI_DIR, INSTRUCT_AI_LEAF } from './repo-root';\n// The scoped `.webpieces` resolver. EVERY reader/writer of `.webpieces/...` goes through one of its two\n// named methods so the call site declares whether the state is repo-wide or worktree-private.\n\n// There is NO machine-global state root. `MachineStateHome`/`StateHome`/`WEBPIECES_STATE_HOME` and the\n// `PrBodyStore` that used them are DELETED: the one artifact that needed a scope above the clone was the\n// gated squash body, and GitHub holds it now (it IS the PR description). Every `.webpieces` path a\n// webpieces tool writes is `{repo}/.webpieces`, resolved through `DotWebpieces` above. See\n// `decisions/0005-the-pr-description-is-the-merge-body.md`.\nexport { AgedTreeSweeper, SweepCount, RETENTION_DAYS } from './aged-tree-sweep';\nexport {\n ClaudeEnv,\n claudeEnv,\n CLAUDE_PROJECT_DIR_ENV,\n CLAUDE_PROJECT_DIR_UNSET,\n} from './claude-env';\n\n// The ONE formatter for a remedy that must run in a named directory: `cd '<root>' && <command>`.\n// Single-quoted so a repo path containing a space is still runnable (and still un-smuggleable).\nexport { atRoot } from './at-root';\nexport { RulesConfigDesign } from './rules-config-design';\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './di';\nexport { ExcludePaths, isWebpiecesStateDir } from './exclude-hook-paths';\nexport { isPathExcluded, matchesAnyGlob } from './exclude-paths';\nexport { globMatches } from './glob-matches';\n// Framework-applied path exclusions for a rule run (#1253): the dispatcher enters the scope, DiffScope's\n// file listings honour it, so no rule filters its own files.\nexport { RuleFileScope, RuleFileExclusions } from './rule-file-scope';\n// The machine-generated trees a line-count rule never fires on. A FLOOR, not a default value:\n// `max-file-lines.excludePaths` adds to it, so configuring your own tree cannot lose it.\nexport { GENERATED_CODE_PATHS } from './generated-code-paths';\n// THE one `no-custom-css` path exemption. Both engines that enforce the rule (the edit-time hook and the\n// CI validator) consult this class, so `allowGlobs` cannot be honoured by one half and ignored by the other.\nexport { NoCustomCssScope, PathScopeConfig } from './no-custom-css-scope';\nexport {\n loadTemplate,\n writeTemplateIfMissing,\n writeTemplate,\n TemplateWriter,\n} from './load-template';\n// The instruct-ai docs are delivered as a SET: writing one writes the transitive closure of the docs it\n// links to, so a doc and everything it points at always land together. See instruct-ai-docs.ts.\nexport {\n GIT_WORKFLOW_DOC,\n GitWorkflowDoc,\n InstructAiDoc,\n InstructAiDocSet,\n MergeProcessDoc,\n} from './instruct-ai-docs';\nexport {\n MERGE_PROCESS_DOC,\n MergeProcessText,\n MergeRun,\n ReferenceMergeRun,\n} from './merge-process-doc';\nexport { BUILD_LOG_DOC } from './build-log-doc';\nexport {\n validateWebpiecesConfig,\n validatePrGateSection,\n validateChecklistsSection,\n validateExcludePaths,\n validateMatchRulesSection,\n allRuleNames,\n recommendedSeedMode,\n recommendedSeedModeFor,\n seedEntryForRule,\n} from './validate-config';\nexport { validateCommandsSection } from './commands-section-validators';\nexport {\n unknownKeyErrors,\n isCommentKey,\n validateTopLevelKeys,\n COMMENT_KEY_SUFFIX,\n} from './config-key-rules';\n// The retired-key table + the no-back-compat policy it enforces. Exported so the installer can migrate\n// what the errors instruct, and so consumers can enumerate retirements.\nexport {\n RETIRED_CONFIG_KEYS,\n RETIRED_SCOPE_KEY,\n RETIRED_SCOPE_RULE,\n isRetiredKey,\n retiredEntry,\n retiredKeyError,\n retiredKeyErrorsIn,\n retiredRuleFor,\n} from './retired-config-keys';\n// The MECHANICAL cure the unknown-rule error and the banner both name: strip every key no validator has a\n// schema for, so cleanliness is one command rather than a judgement call made while every Bash call is\n// blocked. `PRUNE_UNKNOWN_COMMAND` (constants.ts) is the single spelling of that command.\nexport { ConfigPruner, PruneResult, PrunedKey } from './config-pruner';\nexport { validateChecklistDocs } from './checklist-docs-validator';\n// The OPTIONAL machine-local `~/.webpieces/config.json`: absent (the normal state for every consumer) means\n// each key's declared default, silently; present means STRICT about what it understands and FORWARD-COMPATIBLE\n// about what it does not. A retired key (its own retirement table), a known key of the wrong TYPE and an\n// unparseable document all REJECT; a key this release simply does not recognise is IGNORED with a warning,\n// because the file is machine-global and the repos reading it pin different releases — rejecting a newer\n// release's key would hard-block every repo on the machine that is not yet on it. See home-config.ts.\n// `isHomeConfigPath` is what grants the file its unconditional Write/Edit PASS in the hook guards, which is\n// what keeps a rejection repairable. Every `experimental.*` key is an OPT-IN that defaults OFF, including\n// `whole-repo-build-guard`: ON requires an explicit `true`, and there is no per-key default to export.\nexport {\n HomeConfig,\n HomeConfigService,\n RetiredHomeConfigKey,\n RETIRED_HOME_CONFIG_KEYS,\n HOME_CONFIG_DIR,\n HOME_CONFIG_FILE,\n HOME_EXPERIMENTAL_SECTION,\n HOME_KEY_ORPHAN_DIR_SWEEP,\n HOME_KEY_WHOLE_REPO_BUILD_GUARD,\n HOME_KEY_MAX_CONCURRENT_BUILDS,\n HOME_KEY_TURN_OFF_ALL_REVIEWERS,\n DEFAULT_MAX_CONCURRENT_BUILDS,\n HOME_KEY_DOC,\n HOME_KEY_AI_DOC,\n DOCUMENTATION_KEYS,\n} from './home-config';\n// The MACHINE-WIDE build ledger, `~/.webpieces/builds.log`. THE one carve-out from\n// `no-machine-global-state.spec.ts`'s rule that webpieces writes only under `{repo}/.webpieces` — the\n// argument is in `decisions/0006-the-build-ledger-is-machine-global.md`, and the short form is that \"how\n// many builds are burning this box's CPU\" is a fact about the MACHINE, is not a cache of anything a\n// remote owns, and cannot be answered from a per-repo file because every linked worktree has its own\n// `.webpieces/` and would be blind to the sibling it is contending with. See builds-log.ts.\nexport {\n BuildsLog,\n BuildTicket,\n BuildTermination,\n RunningBuild,\n BUILDS_LOG_FILE,\n BUILDS_LOCK_FILE,\n BUILD_START,\n BUILD_DONE_SUCCESS,\n BUILD_DONE_FAIL,\n MAX_BUILDS_LOG_BYTES,\n BUILDS_LOG_GENERATIONS,\n MAX_ROW_BYTES,\n} from './builds-log';\n// The orphan-directory sweep: the corpse an `nx g move` leaves on every clone, which git cannot remove\n// because an ignored dist/ or node_modules/ outlives every tracked file under it. See orphan-dir-scan.ts\n// for why the predicate is git's own `clean -Xdn` answer rather than a hand-rolled ignore walk.\nexport { OrphanDirScanner, OrphanCandidate } from './orphan-dir-scan';\nexport {\n OrphanDirArchiver,\n ArchivedOrphan,\n FailedOrphan,\n OrphanSweepResult,\n OrphanSweepManifest,\n TRASH_STATE_DIR,\n TRASH_MANIFEST_FILE,\n TRASH_RETENTION_DAYS,\n} from './orphan-dir-archive';\nexport { OrphanDirSweeper, OrphanSweepReport } from './orphan-dir-sweep';\nexport {\n MatchRuleConfig,\n MatchRuleViolation,\n findMatchRuleViolations,\n isMatchRuleAllowedPath,\n compileMatchRulePatterns,\n renderMatchRuleMessage,\n DEFAULT_MATCH_RULES,\n} from './match-rules-config';\nexport type { ConfigSection } from './sections';\nexport { schemaFieldNames } from './rule-schemas';\nexport { isHookGuard, sectionForRule } from './sections';\nexport { shouldSkipRule, HOTFIX_BUILD_COMMAND, HOTFIX_AUDIT_BANNER } from './skip-rule';\nexport { SkipRuleResult } from './skip-rule';\nexport {\n detectBase,\n resolveBase,\n getChangedFiles,\n getFileDiff,\n getChangedLineNumbers,\n findNewMethodSignaturesInDiff,\n hasChangesInRange,\n isNewOrModified,\n DiffScope,\n DiffRange,\n ChangedFilesOptions,\n} from './diff-scope';\nexport { AbstractRule } from './abstract-rule';\nexport {\n WEBPIECES_DISABLE,\n hasDisable,\n MERGE_INFO_DIR,\n MERGE_IN_PROGRESS_FILE,\n MERGE_EXPLANATION_FILE,\n PUSH_DEV_STATE_FILE,\n PRUNE_UNKNOWN_COMMAND,\n UPGRADE_SHIM_COMMAND,\n} from './constants';\nexport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nexport {\n SyncFlowGuidance,\n WP_START_UPDATE,\n WP_FINISH_UPDATE,\n WP_START_UPSERT_PR,\n WP_FINISH_UPSERT_PR,\n WP_PUSH_DEV,\n WP_FINISH_PUSH_DEV,\n} from './sync-flow-guidance';\n\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\n\n// The `no-state-paths-in-templates` config, in its own module for the same reason no-client-creation is:\n// rule-configs.ts is at its file-size cap and a rule that carries real defaults belongs beside them.\n\nexport {\n GateDefinition,\n PrGateConfig,\n DEFAULT_BUILD_COMMAND,\n LandPrConfig,\n DevDeployConfig,\n DEFAULT_DEV_BRANCH_NAMESPACE,\n DEFAULT_DEV_BRANCH,\n ReviewContextEntry,\n defaultGates,\n defaultPrGateConfig,\n defaultLandPrConfig,\n defaultDevDeployConfig,\n buildPrGateConfig,\n buildLandPrConfig,\n buildDevDeployConfig,\n MERGE_MODE_AUTO,\n MERGE_MODE_NONE,\n MERGE_MODES,\n} from './pr-gate-config';\nexport {\n ChecklistDefinition,\n ReviewerAgentPolicy,\n REVIEWER_AGENTS_PLACEHOLDER,\n DEFAULT_REVIEWER_AGENT_NAME,\n toChecklist,\n normalizeChecklistDoc,\n formatFileList,\n} from './checklist-config';\nexport type { RawChecklistItem } from './checklist-config';\nexport { ChecklistValidator } from './checklist-validator';\nexport { ChecklistInstructionsService } from './checklist-instructions';\nexport {\n ReviewerInstructionsService,\n ReviewerBriefing,\n BriefedFile,\n ContextEntry,\n READ_TRUNCATION_LINES,\n ALL_DIFF_ONE_READ_LINES,\n} from './reviewer-instructions';\nexport {\n GateTokenService,\n computeGateToken,\n gateTokenMarker,\n extractGateToken,\n verifyGateToken,\n} from './gate-token';\nexport {\n SubagentProvenanceService,\n ReviewerEvidence,\n ReviewerContext,\n ExpectedReviewer,\n TranscriptScan,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-provenance';\n\nexport {\n ReviewProvenanceService,\n ReviewProvenance,\n ReviewerTranscript,\n ReviewerPaths,\n OfferedContext,\n ProvenanceWriteRequest,\n DEFAULT_RETENTION_DAYS,\n} from './review-provenance';\nexport {\n PrSummary,\n PrContext,\n ChecklistResult,\n ChecklistVerdict,\n ChecklistOverride,\n ChecklistOverrideService,\n checklistOverrideService,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_ORANGE_FIXED,\n CK_ORANGE,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_ORANGE,\n VERDICT_RED,\n VERDICT_STATUSES,\n RequiredChecklist,\n ChecklistReviewContext,\n ReviewJsonService,\n prDirFor,\n summaryJsonPath,\n summaryJsonSchemaHint,\n} from './review-json';\n\nexport {\n CommandsConfig,\n buildCommandsConfig,\n DEFAULT_UPSERT_PR_COMMAND,\n DEFAULT_MERGE_COMPLETE_COMMAND,\n} from './commands-config';\nexport { StaleBinRemoval, StaleBinSweeper, staleBinSweeper } from './stale-bin-sweep';\nexport { RepoScratchDirs, SCRATCH_DIR_NAME } from './repo-scratch-dirs';\nexport {\n TmpScratchSweeper,\n TMP_SCRATCH_RETENTION_DAYS,\n TMP_SCRATCH_PREFIX,\n} from './tmp-scratch-sweep';\n\nexport * from './hook-fault-codes';\nexport * from './hook-config-diagnostics';\nexport {\n RulePackRegistry,\n NodeRulePackModuleLoader,\n RulePackDiscovery,\n RulePackModuleLoader,\n} from './rule-pack-registry';\n\nexport {\n prepareLegacyUpgrade,\n LegacyConfigDocument,\n LegacyUpgradeResult,\n} from './legacy-config-upgrade';\nexport {\n PackPolicyDeclaration,\n SelectedPolicyPack,\n PackPolicyFilesResult,\n PackPolicyFiles,\n} from './pack-policy-files';\nexport { RulePackSync } from './rule-pack-sync';\nexport { ConfigRepairAccess } from './config-repair-access';\nexport { ConfigRepairBootstrap } from './config-repair-probe';\nexport {\n ConfigRepairCure,\n ConfigRepairError,\n EditFileCure,\n RunCommandCure,\n RepositoryLayoutRepair,\n} from './config-repair-error';\nexport {\n RuleRuntimeModules,\n RuleRuntimeModuleLoader,\n NodeRuleRuntimeModuleLoader,\n RuntimeContributionGroup,\n} from './rule-runtime-modules';\n\nexport { FirstPathMatch, FirstPathMatchResult, PathMatchCandidate } from './first-path-match';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iCAA0E;AAAjE,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAE3C,qDAA+F;AAAtF,gHAAA,aAAa,OAAA;AAAE,sHAAA,mBAAmB,OAAA;AAAE,yHAAA,sBAAsB,OAAA;AACnE,uGAAuG;AACvG,sFAAsF;AACtF,2CAAwD;AAA/C,oGAAA,MAAM,OAA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OAAA;AACjB,0HAAA,oBAAoB,OAAA;AAGxB,iEAIiC;AAH7B,6HAAA,oBAAoB,OAAA;AACpB,6HAAA,oBAAoB,OAAA;AACpB,4HAAA,mBAAmB,OAAA;AAEvB,yDAK6B;AAJzB,0HAAA,qBAAqB,OAAA;AACrB,uHAAA,kBAAkB,OAAA;AAClB,0HAAA,qBAAqB,OAAA;AACrB,oHAAA,eAAe,OAAA;AAEnB,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA;AAC9B,6DAM+B;AAL3B,uHAAA,gBAAgB,OAAA;AAChB,wHAAA,iBAAiB,OAAA;AACjB,mHAAA,YAAY,OAAA;AACZ,qHAAA,cAAc,OAAA;AACd,6HAAA,sBAAsB,OAAA;AAE1B,+DAKgC;AAJ5B,0HAAA,kBAAkB,OAAA;AAClB,+HAAA,uBAAuB,OAAA;AACvB,mIAAA,2BAA2B,OAAA;AAC3B,gIAAA,wBAAwB,OAAA;AAG5B,uDAA8F;AAArF,kHAAA,cAAc,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\n\nexport { RuleFailError, renderRuleFailForAi, renderRuleFailForHuman } from './rule-fail-error';\n// THE one representation of a cure, shared by RuleFailError (build-time) and FixHint (edit-time), plus\n// the one renderer that owns the \"Fix Option N:\" numbering and the \"(preferred)\" tag.\nexport { Option, formatFixOptions } from './fix-option';\nexport { CliExitError } from './cli-exit-error';\nexport { CliUsage, CliFlag, CliArgSet, CliArgsCheck, CliArgs } from './cli-args';\nexport { runMain } from './run-main';\n\nexport { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';\n// The validation-failure banner: ONE cure (edit the file), plus the marker phrases the validator\n// messages embed rather than re-type.\nexport {\n formatConfigErrorsBanner,\n CONFIG_POLICY_DOC,\n RETIRED_KEY_MARKER,\n RETIRED_TOP_LEVEL_MARKER,\n} from './config-error-banner';\nexport {\n findConfigFile,\n CONFIG_FILENAME,\n ConfigFile,\n ConfigParseAttempt,\n CONFIG_PARSE_ATTEMPTS,\n CONFIG_PARSE_RETRY_MILLIS,\n} from './config-file';\n// The PARSED-BUT-UNVALIDATED config shape. Exported for readers that walk the file generically rather\n// than through the typed config (the pr-gate active-hatch dashboard section reads every rule's hatches).\nexport { RawConfigFile } from './config-file';\nexport { RepoRootFinder, INSTRUCT_AI_DIR, INSTRUCT_AI_LEAF } from './repo-root';\n// The scoped `.webpieces` resolver. EVERY reader/writer of `.webpieces/...` goes through one of its two\n// named methods so the call site declares whether the state is repo-wide or worktree-private.\n\n// There is NO machine-global state root. `MachineStateHome`/`StateHome`/`WEBPIECES_STATE_HOME` and the\n// `PrBodyStore` that used them are DELETED: the one artifact that needed a scope above the clone was the\n// gated squash body, and GitHub holds it now (it IS the PR description). Every `.webpieces` path a\n// webpieces tool writes is `{repo}/.webpieces`, resolved through `DotWebpieces` above. See\n// `decisions/0005-the-pr-description-is-the-merge-body.md`.\nexport { AgedTreeSweeper, SweepCount, RETENTION_DAYS } from './aged-tree-sweep';\nexport {\n ClaudeEnv,\n claudeEnv,\n CLAUDE_PROJECT_DIR_ENV,\n CLAUDE_PROJECT_DIR_UNSET,\n} from './claude-env';\n\n// The ONE formatter for a remedy that must run in a named directory: `cd '<root>' && <command>`.\n// Single-quoted so a repo path containing a space is still runnable (and still un-smuggleable).\nexport { atRoot } from './at-root';\nexport { RulesConfigDesign } from './rules-config-design';\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './di';\nexport { ExcludePaths, isWebpiecesStateDir } from './exclude-hook-paths';\nexport { isPathExcluded, matchesAnyGlob } from './exclude-paths';\nexport { globMatches } from './glob-matches';\n// Framework-applied path exclusions for a rule run (#1253): the dispatcher enters the scope, DiffScope's\n// file listings honour it, so no rule filters its own files.\nexport { RuleFileScope, RuleFileExclusions } from './rule-file-scope';\n// The machine-generated trees a line-count rule never fires on. A FLOOR, not a default value:\n// `max-file-lines.excludePaths` adds to it, so configuring your own tree cannot lose it.\nexport { GENERATED_CODE_PATHS } from './generated-code-paths';\n// THE one `no-custom-css` path exemption. Both engines that enforce the rule (the edit-time hook and the\n// CI validator) consult this class, so `allowGlobs` cannot be honoured by one half and ignored by the other.\nexport { NoCustomCssScope, PathScopeConfig } from './no-custom-css-scope';\nexport {\n loadTemplate,\n writeTemplateIfMissing,\n writeTemplate,\n TemplateWriter,\n} from './load-template';\n// The instruct-ai docs are delivered as a SET: writing one writes the transitive closure of the docs it\n// links to, so a doc and everything it points at always land together. See instruct-ai-docs.ts.\nexport {\n GIT_WORKFLOW_DOC,\n GitWorkflowDoc,\n InstructAiDoc,\n InstructAiDocSet,\n MergeProcessDoc,\n} from './instruct-ai-docs';\nexport {\n MERGE_PROCESS_DOC,\n MergeProcessText,\n MergeRun,\n ReferenceMergeRun,\n} from './merge-process-doc';\nexport { BUILD_LOG_DOC } from './build-log-doc';\nexport {\n validateWebpiecesConfig,\n validatePrGateSection,\n validateChecklistsSection,\n validateExcludePaths,\n validateMatchRulesSection,\n allRuleNames,\n recommendedSeedMode,\n recommendedSeedModeFor,\n seedEntryForRule,\n} from './validate-config';\nexport { validateCommandsSection } from './commands-section-validators';\nexport {\n unknownKeyErrors,\n isCommentKey,\n validateTopLevelKeys,\n COMMENT_KEY_SUFFIX,\n} from './config-key-rules';\n// The retired-key table + the no-back-compat policy it enforces. Exported so the installer can migrate\n// what the errors instruct, and so consumers can enumerate retirements.\nexport {\n RETIRED_CONFIG_KEYS,\n RETIRED_SCOPE_KEY,\n RETIRED_SCOPE_RULE,\n isRetiredKey,\n retiredEntry,\n retiredKeyError,\n retiredKeyErrorsIn,\n retiredRuleFor,\n} from './retired-config-keys';\n// The MECHANICAL cure the unknown-rule error and the banner both name: strip every key no validator has a\n// schema for, so cleanliness is one command rather than a judgement call made while every Bash call is\n// blocked. `PRUNE_UNKNOWN_COMMAND` (constants.ts) is the single spelling of that command.\nexport { ConfigPruner, PruneResult, PrunedKey } from './config-pruner';\nexport { validateChecklistDocs } from './checklist-docs-validator';\n// The OPTIONAL machine-local `~/.webpieces/config.json`: absent (the normal state for every consumer) means\n// each key's declared default, silently; present means STRICT about what it understands and FORWARD-COMPATIBLE\n// about what it does not. A retired key (its own retirement table), a known key of the wrong TYPE and an\n// unparseable document all REJECT; a key this release simply does not recognise is IGNORED with a warning,\n// because the file is machine-global and the repos reading it pin different releases — rejecting a newer\n// release's key would hard-block every repo on the machine that is not yet on it. See home-config.ts.\n// `isHomeConfigPath` is what grants the file its unconditional Write/Edit PASS in the hook guards, which is\n// what keeps a rejection repairable. Every `experimental.*` key is an OPT-IN that defaults OFF, including\n// `whole-repo-build-guard`: ON requires an explicit `true`, and there is no per-key default to export.\nexport {\n HomeConfig,\n HomeConfigService,\n RetiredHomeConfigKey,\n RETIRED_HOME_CONFIG_KEYS,\n HOME_CONFIG_DIR,\n HOME_CONFIG_FILE,\n HOME_EXPERIMENTAL_SECTION,\n HOME_KEY_ORPHAN_DIR_SWEEP,\n HOME_KEY_WHOLE_REPO_BUILD_GUARD,\n HOME_KEY_MAX_CONCURRENT_BUILDS,\n HOME_KEY_TURN_OFF_ALL_REVIEWERS,\n DEFAULT_MAX_CONCURRENT_BUILDS,\n HOME_KEY_DOC,\n HOME_KEY_AI_DOC,\n DOCUMENTATION_KEYS,\n} from './home-config';\n// The MACHINE-WIDE build ledger, `~/.webpieces/builds.log`. THE one carve-out from\n// `no-machine-global-state.spec.ts`'s rule that webpieces writes only under `{repo}/.webpieces` — the\n// argument is in `decisions/0006-the-build-ledger-is-machine-global.md`, and the short form is that \"how\n// many builds are burning this box's CPU\" is a fact about the MACHINE, is not a cache of anything a\n// remote owns, and cannot be answered from a per-repo file because every linked worktree has its own\n// `.webpieces/` and would be blind to the sibling it is contending with. See builds-log.ts.\nexport {\n BuildsLog,\n BuildTicket,\n BuildTermination,\n RunningBuild,\n BUILDS_LOG_FILE,\n BUILDS_LOCK_FILE,\n BUILD_START,\n BUILD_DONE_SUCCESS,\n BUILD_DONE_FAIL,\n MAX_BUILDS_LOG_BYTES,\n BUILDS_LOG_GENERATIONS,\n MAX_ROW_BYTES,\n} from './builds-log';\n// The orphan-directory sweep: the corpse an `nx g move` leaves on every clone, which git cannot remove\n// because an ignored dist/ or node_modules/ outlives every tracked file under it. See orphan-dir-scan.ts\n// for why the predicate is git's own `clean -Xdn` answer rather than a hand-rolled ignore walk.\nexport { OrphanDirScanner, OrphanCandidate } from './orphan-dir-scan';\nexport {\n OrphanDirArchiver,\n ArchivedOrphan,\n FailedOrphan,\n OrphanSweepResult,\n OrphanSweepManifest,\n TRASH_STATE_DIR,\n TRASH_MANIFEST_FILE,\n TRASH_RETENTION_DAYS,\n} from './orphan-dir-archive';\nexport { OrphanDirSweeper, OrphanSweepReport } from './orphan-dir-sweep';\nexport {\n MatchRuleConfig,\n MatchRuleViolation,\n findMatchRuleViolations,\n isMatchRuleAllowedPath,\n compileMatchRulePatterns,\n renderMatchRuleMessage,\n DEFAULT_MATCH_RULES,\n} from './match-rules-config';\nexport type { ConfigSection } from './sections';\nexport { schemaFieldNames } from './rule-schemas';\nexport { isHookGuard, sectionForRule } from './sections';\nexport { shouldSkipRule, HOTFIX_BUILD_COMMAND, HOTFIX_AUDIT_BANNER } from './skip-rule';\nexport { SkipRuleResult } from './skip-rule';\nexport {\n detectBase,\n resolveBase,\n getChangedFiles,\n getFileDiff,\n getChangedLineNumbers,\n findNewMethodSignaturesInDiff,\n hasChangesInRange,\n isNewOrModified,\n DiffScope,\n DiffRange,\n ChangedFilesOptions,\n} from './diff-scope';\nexport { AbstractRule } from './abstract-rule';\nexport {\n WEBPIECES_DISABLE,\n hasDisable,\n MERGE_INFO_DIR,\n MERGE_IN_PROGRESS_FILE,\n MERGE_EXPLANATION_FILE,\n PUSH_DEV_STATE_FILE,\n PRUNE_UNKNOWN_COMMAND,\n UPGRADE_SHIM_COMMAND,\n} from './constants';\nexport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nexport {\n SyncFlowGuidance,\n WP_START_UPDATE,\n WP_FINISH_UPDATE,\n WP_START_UPSERT_PR,\n WP_FINISH_UPSERT_PR,\n WP_PUSH_DEV,\n WP_FINISH_PUSH_DEV,\n} from './sync-flow-guidance';\n\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\n\n// The `no-state-paths-in-templates` config, in its own module for the same reason no-client-creation is:\n// rule-configs.ts is at its file-size cap and a rule that carries real defaults belongs beside them.\n\nexport {\n GateDefinition,\n PrGateConfig,\n DEFAULT_BUILD_COMMAND,\n LandPrConfig,\n DevDeployConfig,\n DEFAULT_DEV_BRANCH_NAMESPACE,\n DEFAULT_DEV_BRANCH,\n ReviewContextEntry,\n defaultGates,\n defaultPrGateConfig,\n defaultLandPrConfig,\n defaultDevDeployConfig,\n buildPrGateConfig,\n buildLandPrConfig,\n buildDevDeployConfig,\n MERGE_MODE_AUTO,\n MERGE_MODE_NONE,\n MERGE_MODES,\n} from './pr-gate-config';\nexport {\n ChecklistDefinition,\n ReviewerAgentPolicy,\n REVIEWER_AGENTS_PLACEHOLDER,\n DEFAULT_REVIEWER_AGENT_NAME,\n toChecklist,\n normalizeChecklistDoc,\n formatFileList,\n} from './checklist-config';\nexport type { RawChecklistItem } from './checklist-config';\nexport { ChecklistValidator } from './checklist-validator';\nexport { ChecklistInstructionsService } from './checklist-instructions';\nexport {\n ReviewerInstructionsService,\n ReviewerBriefing,\n BriefedFile,\n ContextEntry,\n READ_TRUNCATION_LINES,\n ALL_DIFF_ONE_READ_LINES,\n} from './reviewer-instructions';\nexport {\n GateTokenService,\n computeGateToken,\n gateTokenMarker,\n extractGateToken,\n verifyGateToken,\n} from './gate-token';\nexport {\n SubagentProvenanceService,\n ReviewerEvidence,\n ReviewerContext,\n ExpectedReviewer,\n TranscriptScan,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-provenance';\n\nexport {\n ReviewProvenanceService,\n ReviewProvenance,\n ReviewerTranscript,\n ReviewerPaths,\n OfferedContext,\n ProvenanceWriteRequest,\n DEFAULT_RETENTION_DAYS,\n} from './review-provenance';\nexport {\n PrSummary,\n AddressedIssue,\n PrContext,\n ChecklistResult,\n ChecklistVerdict,\n ChecklistOverride,\n ChecklistOverrideService,\n checklistOverrideService,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_ORANGE_FIXED,\n CK_ORANGE,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_ORANGE,\n VERDICT_RED,\n VERDICT_STATUSES,\n RequiredChecklist,\n ChecklistReviewContext,\n ReviewJsonService,\n prDirFor,\n summaryJsonPath,\n summaryJsonSchemaHint,\n} from './review-json';\n\nexport {\n CommandsConfig,\n buildCommandsConfig,\n DEFAULT_UPSERT_PR_COMMAND,\n DEFAULT_MERGE_COMPLETE_COMMAND,\n} from './commands-config';\nexport { StaleBinRemoval, StaleBinSweeper, staleBinSweeper } from './stale-bin-sweep';\nexport { RepoScratchDirs, SCRATCH_DIR_NAME } from './repo-scratch-dirs';\nexport {\n TmpScratchSweeper,\n TMP_SCRATCH_RETENTION_DAYS,\n TMP_SCRATCH_PREFIX,\n} from './tmp-scratch-sweep';\n\nexport * from './hook-fault-codes';\nexport * from './hook-config-diagnostics';\nexport {\n RulePackRegistry,\n NodeRulePackModuleLoader,\n RulePackDiscovery,\n RulePackModuleLoader,\n} from './rule-pack-registry';\n\nexport {\n prepareLegacyUpgrade,\n LegacyConfigDocument,\n LegacyUpgradeResult,\n} from './legacy-config-upgrade';\nexport {\n PackPolicyDeclaration,\n SelectedPolicyPack,\n PackPolicyFilesResult,\n PackPolicyFiles,\n} from './pack-policy-files';\nexport { RulePackSync } from './rule-pack-sync';\nexport { ConfigRepairAccess } from './config-repair-access';\nexport { ConfigRepairBootstrap } from './config-repair-probe';\nexport {\n ConfigRepairCure,\n ConfigRepairError,\n EditFileCure,\n RunCommandCure,\n RepositoryLayoutRepair,\n} from './config-repair-error';\nexport {\n RuleRuntimeModules,\n RuleRuntimeModuleLoader,\n NodeRuleRuntimeModuleLoader,\n RuntimeContributionGroup,\n} from './rule-runtime-modules';\n\nexport { FirstPathMatch, FirstPathMatchResult, PathMatchCandidate } from './first-path-match';\n"]}
@@ -68,6 +68,23 @@ export declare class ChecklistReviewContext {
68
68
  dirty: boolean;
69
69
  constructor(baseSha?: string, prContextPath?: string, fileDiffCommand?: string, diffDir?: string, dirty?: boolean);
70
70
  }
71
+ /**
72
+ * One entry of summary.json's REQUIRED `addressesIssues` array (issue #1310): a ticket this PR addresses,
73
+ * and whether merging it should CLOSE that ticket. Data-only.
74
+ *
75
+ * Both fields are required, with no default, because either default is wrong for somebody: `true` closes a
76
+ * multi-PR ticket on its FIRST PR (ctoteachings/monorepo#955 needed four), and `false` silently leaves every
77
+ * single-PR ticket open forever. `url` is tracker-agnostic — a GitHub, Linear or Jira issue — and is only
78
+ * checked to be an absolute `https://` URL; webpieces renders the line and never needs to understand it.
79
+ *
80
+ * closesIssue: true → `Fixes <url>` (a closing keyword: GitHub and Linear close it on merge)
81
+ * closesIssue: false → `Part of <url>` (no closing keyword: links the ticket, leaves it open)
82
+ */
83
+ export declare class AddressedIssue {
84
+ url: string;
85
+ closesIssue: boolean;
86
+ constructor(url: string, closesIssue: boolean);
87
+ }
71
88
  export declare class PrSummary {
72
89
  agent: string;
73
90
  model: string;
@@ -79,9 +96,10 @@ export declare class PrSummary {
79
96
  violations: string[];
80
97
  risks: string[];
81
98
  filesToReview: string[];
99
+ addressesIssues: AddressedIssue[];
82
100
  results: ChecklistResult[];
83
101
  mainAgentInstructions: string;
84
- constructor(agent: string, model: string, title: string, riskScore: number, riskLevel: string, riskEmoji: string, summary: string, violations: string[], risks: string[], filesToReview: string[], results?: ChecklistResult[], mainAgentInstructions?: string);
102
+ constructor(agent: string, model: string, title: string, riskScore: number, riskLevel: string, riskEmoji: string, summary: string, violations: string[], risks: string[], filesToReview: string[], addressesIssues: AddressedIssue[], results?: ChecklistResult[], mainAgentInstructions?: string);
85
103
  }
86
104
  export declare const CK_PASS = "pass";
87
105
  export declare const CK_WARN = "warn";
@@ -8,7 +8,7 @@
8
8
  * `from '@webpieces/rules-config'` keep resolving exactly as before and no consumer changes.
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.PrContext = exports.ChecklistVerdict = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_OVERRIDDEN = exports.CK_ORANGE = exports.CK_ORANGE_FIXED = exports.CK_WARN = exports.CK_PASS = exports.PrSummary = exports.ChecklistReviewContext = exports.RequiredChecklist = exports.ChecklistResult = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_ORANGE = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = void 0;
11
+ exports.PrContext = exports.ChecklistVerdict = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_OVERRIDDEN = exports.CK_ORANGE = exports.CK_ORANGE_FIXED = exports.CK_WARN = exports.CK_PASS = exports.PrSummary = exports.AddressedIssue = exports.ChecklistReviewContext = exports.RequiredChecklist = exports.ChecklistResult = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_ORANGE = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = void 0;
12
12
  // The colors a reviewer subagent may report in `review-round<N>-<id>.json`. Not a boolean, because the
13
13
  // boolean it replaced gave a reviewer no way to say "this passes, but a human should look at X" — the only
14
14
  // way to raise a concern was to FAIL the PR and then override your own failure, which reads on the
@@ -143,6 +143,27 @@ class ChecklistReviewContext {
143
143
  }
144
144
  }
145
145
  exports.ChecklistReviewContext = ChecklistReviewContext;
146
+ /**
147
+ * One entry of summary.json's REQUIRED `addressesIssues` array (issue #1310): a ticket this PR addresses,
148
+ * and whether merging it should CLOSE that ticket. Data-only.
149
+ *
150
+ * Both fields are required, with no default, because either default is wrong for somebody: `true` closes a
151
+ * multi-PR ticket on its FIRST PR (ctoteachings/monorepo#955 needed four), and `false` silently leaves every
152
+ * single-PR ticket open forever. `url` is tracker-agnostic — a GitHub, Linear or Jira issue — and is only
153
+ * checked to be an absolute `https://` URL; webpieces renders the line and never needs to understand it.
154
+ *
155
+ * closesIssue: true → `Fixes <url>` (a closing keyword: GitHub and Linear close it on merge)
156
+ * closesIssue: false → `Part of <url>` (no closing keyword: links the ticket, leaves it open)
157
+ */
158
+ class AddressedIssue {
159
+ url;
160
+ closesIssue;
161
+ constructor(url, closesIssue) {
162
+ this.url = url;
163
+ this.closesIssue = closesIssue;
164
+ }
165
+ }
166
+ exports.AddressedIssue = AddressedIssue;
146
167
  // The AI-authored PR summary (title, risk, summary). Normally the AI writes summary.json between
147
168
  // `wp-start-upsert-pr` (which prints the schema) and `wp-finish-upsert-pr` (which reads it), while reviewer
148
169
  // subagents write review-round<N>-<id>.json. The human-only `wp-human-post-pr` escape hatch also requires and reads
@@ -158,10 +179,13 @@ class PrSummary {
158
179
  violations; // pattern/architecture violations; length = the Pattern Violations count
159
180
  risks;
160
181
  filesToReview;
182
+ // The tickets this PR addresses, rendered by the gate as `Fixes <url>` / `Part of <url>` lines in the PR
183
+ // body (= the squash commit). REQUIRED in summary.json; [] states "no tracked issue". See AddressedIssue.
184
+ addressesIssues;
161
185
  results; // resolved per-checklist verdicts (from review-round<N>-<id>.json); [] when none
162
186
  mainAgentInstructions; // non-empty only for the opt-in single-round experiment
163
187
  // eslint-disable-next-line @typescript-eslint/max-params
164
- constructor(agent, model, title, riskScore, riskLevel, riskEmoji, summary, violations, risks, filesToReview, results = [], mainAgentInstructions = '') {
188
+ constructor(agent, model, title, riskScore, riskLevel, riskEmoji, summary, violations, risks, filesToReview, addressesIssues, results = [], mainAgentInstructions = '') {
165
189
  this.agent = agent;
166
190
  this.model = model;
167
191
  this.title = title;
@@ -172,6 +196,7 @@ class PrSummary {
172
196
  this.violations = violations;
173
197
  this.risks = risks;
174
198
  this.filesToReview = filesToReview;
199
+ this.addressesIssues = addressesIssues;
175
200
  this.results = results;
176
201
  this.mainAgentInstructions = mainAgentInstructions;
177
202
  }
@@ -1 +1 @@
1
- {"version":3,"file":"review-json-data.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/review-json-data.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAKH,uGAAuG;AACvG,2GAA2G;AAC3G,mGAAmG;AACnG,qEAAqE;AACrE,EAAE;AACF,uGAAuG;AACvG,0GAA0G;AAC1G,0GAA0G;AAC1G,2GAA2G;AAC3G,4GAA4G;AAC5G,0GAA0G;AAC7F,QAAA,aAAa,GAAG,OAAO,CAAC;AACxB,QAAA,cAAc,GAAG,QAAQ,CAAC;AAC1B,QAAA,cAAc,GAAG,QAAQ,CAAC;AAC1B,QAAA,WAAW,GAAG,KAAK,CAAC;AACpB,QAAA,gBAAgB,GAAG,CAAC,qBAAa,EAAE,sBAAc,EAAE,sBAAc,EAAE,mBAAW,CAAU,CAAC;AAEtG,+GAA+G;AAC/G,4GAA4G;AAC5G,2GAA2G;AAC3G,yGAAyG;AACzG,uBAAuB;AACvB,gDAAgD;AAChD,iHAAiH;AACjH,yGAAyG;AACzG,0FAA0F;AAC1F,uGAAuG;AACvG,uFAAuF;AACvF,EAAE;AACF,mGAAmG;AACnG,yGAAyG;AACzG,0GAA0G;AAC1G,gGAAgG;AAChG,4GAA4G;AAC5G,2FAA2F;AAC3F,MAAa,eAAe;IACxB,KAAK,CAAS;IACd,KAAK,CAAS;IACd,EAAE,CAAS;IACX,MAAM,CAAS,CAAC,mEAAmE;IACnF,MAAM,CAAS,CAAC,qEAAqE;IACrF,wGAAwG;IACxG,wGAAwG;IACxG,iDAAiD;IACjD,QAAQ,CAA2B;IACnC,oGAAoG;IACpG,qGAAqG;IACrG,2FAA2F;IAC3F,6GAA6G;IAC7G,OAAO,CAAS;IAChB;;;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C,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAVD,4CAUC;AAED,iHAAiH;AACjH,yGAAyG;AACzG,0GAA0G;AAC1G,yGAAyG;AACzG,MAAa,SAAS;IAClB,IAAI,CAAS,CAAC,oDAAoD;IAClE;;;;OAIG;IACH,IAAI,CAAS;IACb,YAAY,CAAW,CAAC,iFAAiF;IACzG,KAAK,CAAU,CAAC,4DAA4D;IAC5E,UAAU,CAAW,CAAC,sEAAsE;IAC5F,WAAW,CAAS,CAAC,iFAAiF;IACtG,OAAO,CAAS,CAAC,mFAAmF;IACpG,WAAW,CAAS,CAAC,+EAA+E;IACpG;;;;;;;;OAQG;IACH,YAAY,CAAS;IAErB,yDAAyD;IACzD,YACI,IAAY,EACZ,IAAY,EACZ,YAAsB,EACtB,KAAK,GAAG,KAAK,EACb,aAAuB,EAAE,EACzB,WAAW,GAAG,EAAE,EAChB,OAAO,GAAG,EAAE,EACZ,WAAW,GAAG,EAAE,EAChB,YAAY,GAAG,EAAE;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ;AA/CD,8BA+CC","sourcesContent":["/**\n * The DATA-ONLY classes and status constants of the PR review system — the verdict a reviewer writes, the\n * checklist that demanded it, the resolved outcome, and the diff context handed to reviewers.\n *\n * Split out of review-json.ts, which holds the SERVICE that reads and writes them. The split is purely by\n * kind (data vs behaviour): review-json.ts re-exports every name below, so `from './review-json'` and\n * `from '@webpieces/rules-config'` keep resolving exactly as before and no consumer changes.\n */\n\nimport { ReviewerAgentPolicy } from './checklist-config';\nimport { ChecklistOverride } from './checklist-override';\n\n// The colors a reviewer subagent may report in `review-round<N>-<id>.json`. Not a boolean, because the\n// boolean it replaced gave a reviewer no way to say \"this passes, but a human should look at X\" — the only\n// way to raise a concern was to FAIL the PR and then override your own failure, which reads on the\n// dashboard as a deliberately-accepted defect rather than as a note.\n//\n// RED and ORANGE are the two blocking colors, and WHICH one a reviewer may use is decided by the round\n// (issue #1053). `commands.pr-gate.maxReviewerRounds` is a hard ceiling: red means \"fix it and it will be\n// reviewed again\", which is only true while a round remains. On the FINAL round `wp-write-review` refuses\n// red and the reviewer marks the finding ORANGE instead — \"must fix, and nobody re-reviews it\". The author\n// fixes it best effort, records the fix with `wp-write-review-fixes`, and the PR ships with the finding and\n// its claimed fix stamped on the dashboard. Before the final round orange is refused the other way round.\nexport const VERDICT_GREEN = 'green';\nexport const VERDICT_YELLOW = 'yellow';\nexport const VERDICT_ORANGE = 'orange';\nexport const VERDICT_RED = 'red';\nexport const VERDICT_STATUSES = [VERDICT_GREEN, VERDICT_YELLOW, VERDICT_ORANGE, VERDICT_RED] as const;\n\n// The verdict a reviewer SUBAGENT submits into `.webpieces/pr-review/<featureSlug>/review-round<N>-<id>.json`,\n// one per briefed checklist per round. One file per checklist per ROUND, so N concurrent reviewer subagents\n// never clobber a shared file and no round's verdict is ever overwritten by a later one (issue #1053): the\n// gate reads the HIGHEST round per checklist, and the earlier rounds stay on disk as the audit trail. It\n// records the OUTCOME:\n// status:'green' → PASS\n// status:'yellow' → WARN (passes; the concern is published on the PR, nothing is blocked)\n// status:'orange' + a recorded fix → ORANGE_FIXED (ships, stamped \"author-fixed, not re-reviewed\")\n// status:'orange' + no recorded fix → ORANGE (refuse until the author records a fix)\n// status:'red' + an override-<id>.json → OVERRIDDEN (pass; the human's stated reason reaches the PR)\n// status:'red' + no override file → FAIL (refuse; `output` is printed verbatim)\n//\n// THE `override` FIELD IS GONE FROM THIS FILE, and there is no compatibility mode. The ship-anyway\n// justification used to live here as free text, which made the ONE participant who hears the human — the\n// coordinating agent — the one participant that could not record it, because editing a reviewer's verdict\n// file is (correctly) refused by the harness. It now lives in its own `override-<id>.json`; see\n// ChecklistOverride. A verdict file still carrying an `override` key is reported through `problem` with the\n// destination named, exactly as the removed `success` field is. Data-only (per CLAUDE.md).\nexport class ChecklistResult {\n agent: string;\n model: string;\n id: string;\n status: string; // one of VERDICT_STATUSES; anything else is reported via `problem`\n output: string; // what the reviewer found; printed verbatim when the checklist fails\n // The HUMAN's authorization loaded from `override-<id>.json` beside this verdict, or null when there is\n // none. Loaded alongside the verdict so `resolveVerdict` needs no second read of disk and every command\n // resolves the same outcome from the same bytes.\n override: ChecklistOverride | null;\n // '' = a well-formed verdict. Non-empty = the file exists and parses but its verdict cannot be READ\n // (most often: it still uses the removed `success` field, or the moved `override` field). Carried as\n // data rather than thrown so the complaint can be reported by BOTH wp-review-upsert-pr and\n // wp-finish-upsert-pr in identical words, and so a legacy file is never silently mistaken for a missing one.\n problem: string;\n /**\n * Non-empty only for an ORANGE whose final-round fix the author recorded with `wp-write-review-fixes`:\n * the dashboard line \"orange at <fromHead>, author-fixed in <toHead>, not re-reviewed: <resolution>\".\n */\n remediation: string;\n /** The review round this verdict was submitted in — the N of `review-round<N>-<id>.json`. */\n round: number;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n agent: string,\n model: string,\n id: string,\n status: string,\n output: string,\n override: ChecklistOverride | null,\n problem = '',\n ) {\n this.agent = agent;\n this.model = model;\n this.id = id;\n this.status = status;\n this.output = output;\n this.override = override;\n this.problem = problem;\n this.remediation = '';\n this.round = 0;\n }\n}\n\n/**\n * What the pr-gate command computed from the diff: a checklist this branch MATCHED (its patterns hit the\n * diff, so its reviewer subagent is in scope). Drives review-round<N>-<id>.json enforcement, provenance, the schema\n * hint, and the dashboard. Data-only.\n *\n * NAME NOTE: \"Required\" here means MATCHED, not mandatory — it predates `required` by a long way and is\n * the shared shape across review-json, the detector, the briefing builder, provenance and the dashboard.\n * Whether the reviewer must actually run is the {@link RequiredChecklist.required} field below.\n */\nexport class RequiredChecklist {\n id: string; // the checklist's name; keys review-round<N>-<id>.json and its instructions file\n reviewer: ReviewerAgentPolicy; // the agent type to spawn (agentType the harness stamps) + the round cap\n doc: string; // REPO-RELATIVE guidance doc the reviewer reads ('' → it just reads the diff)\n matchedFiles: string[]; // the changed files that matched it (for the dashboard + hint)\n // Which of the checklist's OWN globs actually fired. Printed so a reviewer can judge how coarse the\n // match was — a precise `db/migrations/**` hit means something different from a blanket `**` — and the\n // template tells reviewers that matching IS deliberately coarse. [] = no patterns (matches every PR).\n matchedPatterns: string[];\n // Straight from the checklist's config `required`. true = blocking; false = the human is offered it and\n // may decline. Carried on the MATCH rather than looked up from config downstream so the set that gates\n // and the set that is reported cannot disagree about which of the two a checklist is.\n required: boolean;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n id: string,\n reviewer: ReviewerAgentPolicy,\n doc: string,\n matchedFiles: string[],\n matchedPatterns: string[] = [],\n // Defaulted to the BLOCKING value so any construction that forgets it fails closed — a test or a\n // future call site that silently produced an optional checklist would be a hole in the gate.\n required = true,\n ) {\n this.id = id;\n this.reviewer = reviewer;\n this.doc = doc;\n this.matchedFiles = matchedFiles;\n this.matchedPatterns = matchedPatterns;\n this.required = required;\n }\n}\n\n/**\n * The per-PR facts every reviewer subagent needs GIVEN to it, alongside its own checklist: the exact base\n * sha the gate diffs against and the file holding the complete changed-file set. Both used to live only in\n * a doc the printed instruction told the AI to go read, one indirection away from the instruction to hand\n * them over — so the printed block could not stand on its own. Data-only; empty = omit those lines.\n */\nexport class ChecklistReviewContext {\n baseSha: string; // the 3-point merge-base sha\n prContextPath: string; // path of pr-context.json — the AUTHORITATIVE full changed-file set\n /**\n * The exact command that reproduces ONE file's diff, with a `-- <file>` tail — NOT assembled by the\n * caller. This used to be hardcoded as `git diff <baseSha> HEAD -- <file>`, which returns NOTHING on a\n * dirty tree because the changed-file set is computed base→working-tree. See DiffBasis, which derives\n * this string from the same range the file set came from.\n */\n fileDiffCommand: string;\n diffDir: string; // dir of the MATERIALIZED diff (diff/ALL.diff + diff/files/…); '' when not written\n dirty: boolean; // true ⇒ the range includes uncommitted + untracked work, and must be said out loud\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n baseSha = '',\n prContextPath = '',\n fileDiffCommand = '',\n diffDir = '',\n dirty = false,\n ) {\n this.baseSha = baseSha;\n this.prContextPath = prContextPath;\n this.fileDiffCommand = fileDiffCommand;\n this.diffDir = diffDir;\n this.dirty = dirty;\n }\n}\n\n// The AI-authored PR summary (title, risk, summary). Normally the AI writes summary.json between\n// `wp-start-upsert-pr` (which prints the schema) and `wp-finish-upsert-pr` (which reads it), while reviewer\n// subagents write review-round<N>-<id>.json. The human-only `wp-human-post-pr` escape hatch also requires and reads\n// this same summary shape, but deliberately skips reviewer verdicts. Data-only (per CLAUDE.md).\nexport class PrSummary {\n agent: string;\n model: string;\n title: string; // human PR title describing the change; used as the `gh pr` title (empty → caller falls back)\n riskScore: number; // 0–100, drives the risk bar\n riskLevel: string; // 'green' | 'yellow' | 'red'\n riskEmoji: string; // '🟢' | '🟡' | '🔴' — derived from riskLevel when omitted\n summary: string; // rendered in the dashboard Summary section\n violations: string[]; // pattern/architecture violations; length = the Pattern Violations count\n risks: string[];\n filesToReview: string[];\n results: ChecklistResult[]; // resolved per-checklist verdicts (from review-round<N>-<id>.json); [] when none\n mainAgentInstructions: string; // non-empty only for the opt-in single-round experiment\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n agent: string,\n model: string,\n title: string,\n riskScore: number,\n riskLevel: string,\n riskEmoji: string,\n summary: string,\n violations: string[],\n risks: string[],\n filesToReview: string[],\n results: ChecklistResult[] = [],\n mainAgentInstructions = '',\n ) {\n this.agent = agent;\n this.model = model;\n this.title = title;\n this.riskScore = riskScore;\n this.riskLevel = riskLevel;\n this.riskEmoji = riskEmoji;\n this.summary = summary;\n this.violations = violations;\n this.risks = risks;\n this.filesToReview = filesToReview;\n this.results = results;\n this.mainAgentInstructions = mainAgentInstructions;\n }\n}\n\n// A checklist's resolved outcome, shared by summary.json enforcement and the dashboard so both agree.\n// PASS, WARN, ORANGE_FIXED and OVERRIDDEN all ship; ORANGE, FAIL, MISSING and BAD_FORMAT all refuse the PR.\nexport const CK_PASS = 'pass'; // latest verdict status:'green'\nexport const CK_WARN = 'warn'; // latest verdict status:'yellow' → 🟡 passes WITH concerns\nexport const CK_ORANGE_FIXED = 'orange-fixed'; // status:'orange' + a recorded author fix → 🟠 ships, NOT re-reviewed\nexport const CK_ORANGE = 'orange'; // status:'orange' + no recorded fix → refuse until one is recorded\nexport const CK_OVERRIDDEN = 'overridden'; // status:'red' + a human's override-<id>.json → 🟠\nexport const CK_FAIL = 'fail'; // latest verdict status:'red' + no override → refuse\nexport const CK_MISSING = 'missing'; // no verdict submitted → refuse\nexport const CK_BAD_FORMAT = 'bad-format'; // written, but its verdict is unreadable (e.g. legacy `success`)\n\nexport class ChecklistVerdict {\n id: string;\n status: string; // one of CK_PASS | CK_WARN | CK_ORANGE_FIXED | CK_ORANGE | CK_OVERRIDDEN | CK_FAIL | CK_MISSING | CK_BAD_FORMAT\n detail: string; // reviewer output / override justification / format complaint (dashboard + errors)\n\n constructor(id: string, status: string, detail: string) {\n this.id = id;\n this.status = status;\n this.detail = detail;\n }\n}\n\n// The PR's diff context, written by wp-start-upsert-pr into `.webpieces/pr-review/<featureSlug>/pr-context.json`\n// so a reviewer subagent knows the exact 3-point base the gate used and the full changed-file set — then\n// reads any file's actual diff with `git diff <base> HEAD -- <file>`. This is what lets a checklist match\n// coarsely by path (in the config) while the subagent makes the fine, content-level judgment. Data-only.\nexport class PrContext {\n base: string; // the 3-point merge-base sha the gate diffs against\n /**\n * The real HEAD sha. This was once the literal string 'HEAD', which is not a fact — it cannot be\n * compared later to detect that the tree moved under a review, and it reads as a range that was never\n * actually diffed. Its only reader (reviewContextFor) takes `base`, so recording the sha is free.\n */\n head: string;\n changedFiles: string[]; // every file changed in the range (NOT tsOnly — includes .sql/.gql/Dockerfile/…)\n dirty: boolean; // true ⇒ changedFiles includes uncommitted + untracked work\n dirtyFiles: string[]; // exactly which paths are uncommitted/untracked — why `dirty` is true\n diffCommand: string; // the command that reproduces the WHOLE diff (see DiffBasis; correct when dirty)\n diffDir: string; // dir holding the materialized per-file diffs + ALL.diff; '' when not materialized\n generatedAt: string; // ISO timestamp, so a stale context is detectable rather than silently trusted\n /**\n * Main's head as this clone last saw it — the THIRD hash point, matching the trio the 3-point merge\n * records in `merge-info/<branch>/updatemain-hashes.json`. `base`/`head` above are points A and B\n * under the review side's older names.\n *\n * The review side used to record only A and B, so nothing could answer \"did main move while this was\n * under review?\" — the question you most want answered when a review looks stale. '' when origin/main\n * is unresolvable. Purely informational; nothing gates on it.\n */\n hashMainHead: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n base: string,\n head: string,\n changedFiles: string[],\n dirty = false,\n dirtyFiles: string[] = [],\n diffCommand = '',\n diffDir = '',\n generatedAt = '',\n hashMainHead = '',\n ) {\n this.hashMainHead = hashMainHead;\n this.base = base;\n this.head = head;\n this.changedFiles = changedFiles;\n this.dirty = dirty;\n this.dirtyFiles = dirtyFiles;\n this.diffCommand = diffCommand;\n this.diffDir = diffDir;\n this.generatedAt = generatedAt;\n }\n}\n"]}
1
+ {"version":3,"file":"review-json-data.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/review-json-data.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAKH,uGAAuG;AACvG,2GAA2G;AAC3G,mGAAmG;AACnG,qEAAqE;AACrE,EAAE;AACF,uGAAuG;AACvG,0GAA0G;AAC1G,0GAA0G;AAC1G,2GAA2G;AAC3G,4GAA4G;AAC5G,0GAA0G;AAC7F,QAAA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AACzG,0GAA0G;AAC1G,yGAAyG;AACzG,MAAa,SAAS;IAClB,IAAI,CAAS,CAAC,oDAAoD;IAClE;;;;OAIG;IACH,IAAI,CAAS;IACb,YAAY,CAAW,CAAC,iFAAiF;IACzG,KAAK,CAAU,CAAC,4DAA4D;IAC5E,UAAU,CAAW,CAAC,sEAAsE;IAC5F,WAAW,CAAS,CAAC,iFAAiF;IACtG,OAAO,CAAS,CAAC,mFAAmF;IACpG,WAAW,CAAS,CAAC,+EAA+E;IACpG;;;;;;;;OAQG;IACH,YAAY,CAAS;IAErB,yDAAyD;IACzD,YACI,IAAY,EACZ,IAAY,EACZ,YAAsB,EACtB,KAAK,GAAG,KAAK,EACb,aAAuB,EAAE,EACzB,WAAW,GAAG,EAAE,EAChB,OAAO,GAAG,EAAE,EACZ,WAAW,GAAG,EAAE,EAChB,YAAY,GAAG,EAAE;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ;AA/CD,8BA+CC","sourcesContent":["/**\n * The DATA-ONLY classes and status constants of the PR review system — the verdict a reviewer writes, the\n * checklist that demanded it, the resolved outcome, and the diff context handed to reviewers.\n *\n * Split out of review-json.ts, which holds the SERVICE that reads and writes them. The split is purely by\n * kind (data vs behaviour): review-json.ts re-exports every name below, so `from './review-json'` and\n * `from '@webpieces/rules-config'` keep resolving exactly as before and no consumer changes.\n */\n\nimport { ReviewerAgentPolicy } from './checklist-config';\nimport { ChecklistOverride } from './checklist-override';\n\n// The colors a reviewer subagent may report in `review-round<N>-<id>.json`. Not a boolean, because the\n// boolean it replaced gave a reviewer no way to say \"this passes, but a human should look at X\" — the only\n// way to raise a concern was to FAIL the PR and then override your own failure, which reads on the\n// dashboard as a deliberately-accepted defect rather than as a note.\n//\n// RED and ORANGE are the two blocking colors, and WHICH one a reviewer may use is decided by the round\n// (issue #1053). `commands.pr-gate.maxReviewerRounds` is a hard ceiling: red means \"fix it and it will be\n// reviewed again\", which is only true while a round remains. On the FINAL round `wp-write-review` refuses\n// red and the reviewer marks the finding ORANGE instead — \"must fix, and nobody re-reviews it\". The author\n// fixes it best effort, records the fix with `wp-write-review-fixes`, and the PR ships with the finding and\n// its claimed fix stamped on the dashboard. Before the final round orange is refused the other way round.\nexport const VERDICT_GREEN = 'green';\nexport const VERDICT_YELLOW = 'yellow';\nexport const VERDICT_ORANGE = 'orange';\nexport const VERDICT_RED = 'red';\nexport const VERDICT_STATUSES = [VERDICT_GREEN, VERDICT_YELLOW, VERDICT_ORANGE, VERDICT_RED] as const;\n\n// The verdict a reviewer SUBAGENT submits into `.webpieces/pr-review/<featureSlug>/review-round<N>-<id>.json`,\n// one per briefed checklist per round. One file per checklist per ROUND, so N concurrent reviewer subagents\n// never clobber a shared file and no round's verdict is ever overwritten by a later one (issue #1053): the\n// gate reads the HIGHEST round per checklist, and the earlier rounds stay on disk as the audit trail. It\n// records the OUTCOME:\n// status:'green' → PASS\n// status:'yellow' → WARN (passes; the concern is published on the PR, nothing is blocked)\n// status:'orange' + a recorded fix → ORANGE_FIXED (ships, stamped \"author-fixed, not re-reviewed\")\n// status:'orange' + no recorded fix → ORANGE (refuse until the author records a fix)\n// status:'red' + an override-<id>.json → OVERRIDDEN (pass; the human's stated reason reaches the PR)\n// status:'red' + no override file → FAIL (refuse; `output` is printed verbatim)\n//\n// THE `override` FIELD IS GONE FROM THIS FILE, and there is no compatibility mode. The ship-anyway\n// justification used to live here as free text, which made the ONE participant who hears the human — the\n// coordinating agent — the one participant that could not record it, because editing a reviewer's verdict\n// file is (correctly) refused by the harness. It now lives in its own `override-<id>.json`; see\n// ChecklistOverride. A verdict file still carrying an `override` key is reported through `problem` with the\n// destination named, exactly as the removed `success` field is. Data-only (per CLAUDE.md).\nexport class ChecklistResult {\n agent: string;\n model: string;\n id: string;\n status: string; // one of VERDICT_STATUSES; anything else is reported via `problem`\n output: string; // what the reviewer found; printed verbatim when the checklist fails\n // The HUMAN's authorization loaded from `override-<id>.json` beside this verdict, or null when there is\n // none. Loaded alongside the verdict so `resolveVerdict` needs no second read of disk and every command\n // resolves the same outcome from the same bytes.\n override: ChecklistOverride | null;\n // '' = a well-formed verdict. Non-empty = the file exists and parses but its verdict cannot be READ\n // (most often: it still uses the removed `success` field, or the moved `override` field). Carried as\n // data rather than thrown so the complaint can be reported by BOTH wp-review-upsert-pr and\n // wp-finish-upsert-pr in identical words, and so a legacy file is never silently mistaken for a missing one.\n problem: string;\n /**\n * Non-empty only for an ORANGE whose final-round fix the author recorded with `wp-write-review-fixes`:\n * the dashboard line \"orange at <fromHead>, author-fixed in <toHead>, not re-reviewed: <resolution>\".\n */\n remediation: string;\n /** The review round this verdict was submitted in — the N of `review-round<N>-<id>.json`. */\n round: number;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n agent: string,\n model: string,\n id: string,\n status: string,\n output: string,\n override: ChecklistOverride | null,\n problem = '',\n ) {\n this.agent = agent;\n this.model = model;\n this.id = id;\n this.status = status;\n this.output = output;\n this.override = override;\n this.problem = problem;\n this.remediation = '';\n this.round = 0;\n }\n}\n\n/**\n * What the pr-gate command computed from the diff: a checklist this branch MATCHED (its patterns hit the\n * diff, so its reviewer subagent is in scope). Drives review-round<N>-<id>.json enforcement, provenance, the schema\n * hint, and the dashboard. Data-only.\n *\n * NAME NOTE: \"Required\" here means MATCHED, not mandatory — it predates `required` by a long way and is\n * the shared shape across review-json, the detector, the briefing builder, provenance and the dashboard.\n * Whether the reviewer must actually run is the {@link RequiredChecklist.required} field below.\n */\nexport class RequiredChecklist {\n id: string; // the checklist's name; keys review-round<N>-<id>.json and its instructions file\n reviewer: ReviewerAgentPolicy; // the agent type to spawn (agentType the harness stamps) + the round cap\n doc: string; // REPO-RELATIVE guidance doc the reviewer reads ('' → it just reads the diff)\n matchedFiles: string[]; // the changed files that matched it (for the dashboard + hint)\n // Which of the checklist's OWN globs actually fired. Printed so a reviewer can judge how coarse the\n // match was — a precise `db/migrations/**` hit means something different from a blanket `**` — and the\n // template tells reviewers that matching IS deliberately coarse. [] = no patterns (matches every PR).\n matchedPatterns: string[];\n // Straight from the checklist's config `required`. true = blocking; false = the human is offered it and\n // may decline. Carried on the MATCH rather than looked up from config downstream so the set that gates\n // and the set that is reported cannot disagree about which of the two a checklist is.\n required: boolean;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n id: string,\n reviewer: ReviewerAgentPolicy,\n doc: string,\n matchedFiles: string[],\n matchedPatterns: string[] = [],\n // Defaulted to the BLOCKING value so any construction that forgets it fails closed — a test or a\n // future call site that silently produced an optional checklist would be a hole in the gate.\n required = true,\n ) {\n this.id = id;\n this.reviewer = reviewer;\n this.doc = doc;\n this.matchedFiles = matchedFiles;\n this.matchedPatterns = matchedPatterns;\n this.required = required;\n }\n}\n\n/**\n * The per-PR facts every reviewer subagent needs GIVEN to it, alongside its own checklist: the exact base\n * sha the gate diffs against and the file holding the complete changed-file set. Both used to live only in\n * a doc the printed instruction told the AI to go read, one indirection away from the instruction to hand\n * them over — so the printed block could not stand on its own. Data-only; empty = omit those lines.\n */\nexport class ChecklistReviewContext {\n baseSha: string; // the 3-point merge-base sha\n prContextPath: string; // path of pr-context.json — the AUTHORITATIVE full changed-file set\n /**\n * The exact command that reproduces ONE file's diff, with a `-- <file>` tail — NOT assembled by the\n * caller. This used to be hardcoded as `git diff <baseSha> HEAD -- <file>`, which returns NOTHING on a\n * dirty tree because the changed-file set is computed base→working-tree. See DiffBasis, which derives\n * this string from the same range the file set came from.\n */\n fileDiffCommand: string;\n diffDir: string; // dir of the MATERIALIZED diff (diff/ALL.diff + diff/files/…); '' when not written\n dirty: boolean; // true ⇒ the range includes uncommitted + untracked work, and must be said out loud\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n baseSha = '',\n prContextPath = '',\n fileDiffCommand = '',\n diffDir = '',\n dirty = false,\n ) {\n this.baseSha = baseSha;\n this.prContextPath = prContextPath;\n this.fileDiffCommand = fileDiffCommand;\n this.diffDir = diffDir;\n this.dirty = dirty;\n }\n}\n\n/**\n * One entry of summary.json's REQUIRED `addressesIssues` array (issue #1310): a ticket this PR addresses,\n * and whether merging it should CLOSE that ticket. Data-only.\n *\n * Both fields are required, with no default, because either default is wrong for somebody: `true` closes a\n * multi-PR ticket on its FIRST PR (ctoteachings/monorepo#955 needed four), and `false` silently leaves every\n * single-PR ticket open forever. `url` is tracker-agnostic — a GitHub, Linear or Jira issue — and is only\n * checked to be an absolute `https://` URL; webpieces renders the line and never needs to understand it.\n *\n * closesIssue: true → `Fixes <url>` (a closing keyword: GitHub and Linear close it on merge)\n * closesIssue: false → `Part of <url>` (no closing keyword: links the ticket, leaves it open)\n */\nexport class AddressedIssue {\n url: string;\n closesIssue: boolean;\n\n constructor(url: string, closesIssue: boolean) {\n this.url = url;\n this.closesIssue = closesIssue;\n }\n}\n\n// The AI-authored PR summary (title, risk, summary). Normally the AI writes summary.json between\n// `wp-start-upsert-pr` (which prints the schema) and `wp-finish-upsert-pr` (which reads it), while reviewer\n// subagents write review-round<N>-<id>.json. The human-only `wp-human-post-pr` escape hatch also requires and reads\n// this same summary shape, but deliberately skips reviewer verdicts. Data-only (per CLAUDE.md).\nexport class PrSummary {\n agent: string;\n model: string;\n title: string; // human PR title describing the change; used as the `gh pr` title (empty → caller falls back)\n riskScore: number; // 0–100, drives the risk bar\n riskLevel: string; // 'green' | 'yellow' | 'red'\n riskEmoji: string; // '🟢' | '🟡' | '🔴' — derived from riskLevel when omitted\n summary: string; // rendered in the dashboard Summary section\n violations: string[]; // pattern/architecture violations; length = the Pattern Violations count\n risks: string[];\n filesToReview: string[];\n // The tickets this PR addresses, rendered by the gate as `Fixes <url>` / `Part of <url>` lines in the PR\n // body (= the squash commit). REQUIRED in summary.json; [] states \"no tracked issue\". See AddressedIssue.\n addressesIssues: AddressedIssue[];\n results: ChecklistResult[]; // resolved per-checklist verdicts (from review-round<N>-<id>.json); [] when none\n mainAgentInstructions: string; // non-empty only for the opt-in single-round experiment\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n agent: string,\n model: string,\n title: string,\n riskScore: number,\n riskLevel: string,\n riskEmoji: string,\n summary: string,\n violations: string[],\n risks: string[],\n filesToReview: string[],\n addressesIssues: AddressedIssue[],\n results: ChecklistResult[] = [],\n mainAgentInstructions = '',\n ) {\n this.agent = agent;\n this.model = model;\n this.title = title;\n this.riskScore = riskScore;\n this.riskLevel = riskLevel;\n this.riskEmoji = riskEmoji;\n this.summary = summary;\n this.violations = violations;\n this.risks = risks;\n this.filesToReview = filesToReview;\n this.addressesIssues = addressesIssues;\n this.results = results;\n this.mainAgentInstructions = mainAgentInstructions;\n }\n}\n\n// A checklist's resolved outcome, shared by summary.json enforcement and the dashboard so both agree.\n// PASS, WARN, ORANGE_FIXED and OVERRIDDEN all ship; ORANGE, FAIL, MISSING and BAD_FORMAT all refuse the PR.\nexport const CK_PASS = 'pass'; // latest verdict status:'green'\nexport const CK_WARN = 'warn'; // latest verdict status:'yellow' → 🟡 passes WITH concerns\nexport const CK_ORANGE_FIXED = 'orange-fixed'; // status:'orange' + a recorded author fix → 🟠 ships, NOT re-reviewed\nexport const CK_ORANGE = 'orange'; // status:'orange' + no recorded fix → refuse until one is recorded\nexport const CK_OVERRIDDEN = 'overridden'; // status:'red' + a human's override-<id>.json → 🟠\nexport const CK_FAIL = 'fail'; // latest verdict status:'red' + no override → refuse\nexport const CK_MISSING = 'missing'; // no verdict submitted → refuse\nexport const CK_BAD_FORMAT = 'bad-format'; // written, but its verdict is unreadable (e.g. legacy `success`)\n\nexport class ChecklistVerdict {\n id: string;\n status: string; // one of CK_PASS | CK_WARN | CK_ORANGE_FIXED | CK_ORANGE | CK_OVERRIDDEN | CK_FAIL | CK_MISSING | CK_BAD_FORMAT\n detail: string; // reviewer output / override justification / format complaint (dashboard + errors)\n\n constructor(id: string, status: string, detail: string) {\n this.id = id;\n this.status = status;\n this.detail = detail;\n }\n}\n\n// The PR's diff context, written by wp-start-upsert-pr into `.webpieces/pr-review/<featureSlug>/pr-context.json`\n// so a reviewer subagent knows the exact 3-point base the gate used and the full changed-file set — then\n// reads any file's actual diff with `git diff <base> HEAD -- <file>`. This is what lets a checklist match\n// coarsely by path (in the config) while the subagent makes the fine, content-level judgment. Data-only.\nexport class PrContext {\n base: string; // the 3-point merge-base sha the gate diffs against\n /**\n * The real HEAD sha. This was once the literal string 'HEAD', which is not a fact — it cannot be\n * compared later to detect that the tree moved under a review, and it reads as a range that was never\n * actually diffed. Its only reader (reviewContextFor) takes `base`, so recording the sha is free.\n */\n head: string;\n changedFiles: string[]; // every file changed in the range (NOT tsOnly — includes .sql/.gql/Dockerfile/…)\n dirty: boolean; // true ⇒ changedFiles includes uncommitted + untracked work\n dirtyFiles: string[]; // exactly which paths are uncommitted/untracked — why `dirty` is true\n diffCommand: string; // the command that reproduces the WHOLE diff (see DiffBasis; correct when dirty)\n diffDir: string; // dir holding the materialized per-file diffs + ALL.diff; '' when not materialized\n generatedAt: string; // ISO timestamp, so a stale context is detectable rather than silently trusted\n /**\n * Main's head as this clone last saw it — the THIRD hash point, matching the trio the 3-point merge\n * records in `merge-info/<branch>/updatemain-hashes.json`. `base`/`head` above are points A and B\n * under the review side's older names.\n *\n * The review side used to record only A and B, so nothing could answer \"did main move while this was\n * under review?\" — the question you most want answered when a review looks stale. '' when origin/main\n * is unresolvable. Purely informational; nothing gates on it.\n */\n hashMainHead: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n base: string,\n head: string,\n changedFiles: string[],\n dirty = false,\n dirtyFiles: string[] = [],\n diffCommand = '',\n diffDir = '',\n generatedAt = '',\n hashMainHead = '',\n ) {\n this.hashMainHead = hashMainHead;\n this.base = base;\n this.head = head;\n this.changedFiles = changedFiles;\n this.dirty = dirty;\n this.dirtyFiles = dirtyFiles;\n this.diffCommand = diffCommand;\n this.diffDir = diffDir;\n this.generatedAt = generatedAt;\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { DotWebpieces } from '@webpieces/tooling-common';
2
2
  import { ChecklistOverride, ChecklistOverrideService, checklistOverrideService } from './checklist-override';
3
- import { VERDICT_GREEN, VERDICT_YELLOW, VERDICT_ORANGE, VERDICT_RED, VERDICT_STATUSES, ChecklistResult, RequiredChecklist, ChecklistReviewContext, PrSummary, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_ORANGE_FIXED, CK_ORANGE, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, ChecklistVerdict, PrContext } from './review-json-data';
3
+ import { VERDICT_GREEN, VERDICT_YELLOW, VERDICT_ORANGE, VERDICT_RED, VERDICT_STATUSES, ChecklistResult, RequiredChecklist, ChecklistReviewContext, PrSummary, AddressedIssue, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_ORANGE_FIXED, CK_ORANGE, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, ChecklistVerdict, PrContext } from './review-json-data';
4
4
  export { ChecklistOverride, ChecklistOverrideService, checklistOverrideService };
5
- export { VERDICT_GREEN, VERDICT_YELLOW, VERDICT_ORANGE, VERDICT_RED, VERDICT_STATUSES, ChecklistResult, RequiredChecklist, ChecklistReviewContext, PrSummary, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_ORANGE_FIXED, CK_ORANGE, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, ChecklistVerdict, PrContext, };
5
+ export { VERDICT_GREEN, VERDICT_YELLOW, VERDICT_ORANGE, VERDICT_RED, VERDICT_STATUSES, ChecklistResult, RequiredChecklist, ChecklistReviewContext, PrSummary, AddressedIssue, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_ORANGE_FIXED, CK_ORANGE, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, ChecklistVerdict, PrContext, };
6
6
  /** Locates + loads/validates the AI-authored summary.json. `@injectable(bindingScopeValues.Singleton)` so it's drawn in the design. */
7
7
  export declare class ReviewJsonService {
8
8
  private readonly dotDir;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReviewJsonService = exports.PrContext = exports.ChecklistVerdict = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_ORANGE = exports.CK_ORANGE_FIXED = exports.CK_OVERRIDDEN = exports.CK_WARN = exports.CK_PASS = exports.PrSummary = exports.ChecklistReviewContext = exports.RequiredChecklist = exports.ChecklistResult = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_ORANGE = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = exports.checklistOverrideService = exports.ChecklistOverrideService = exports.ChecklistOverride = void 0;
3
+ exports.ReviewJsonService = exports.PrContext = exports.ChecklistVerdict = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_ORANGE = exports.CK_ORANGE_FIXED = exports.CK_OVERRIDDEN = exports.CK_WARN = exports.CK_PASS = exports.AddressedIssue = exports.PrSummary = exports.ChecklistReviewContext = exports.RequiredChecklist = exports.ChecklistResult = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_ORANGE = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = exports.checklistOverrideService = exports.ChecklistOverrideService = exports.ChecklistOverride = void 0;
4
4
  exports.prDirFor = prDirFor;
5
5
  exports.summaryJsonPath = summaryJsonPath;
6
6
  exports.summaryJsonSchemaHint = summaryJsonSchemaHint;
@@ -14,6 +14,7 @@ const tooling_common_2 = require("@webpieces/tooling-common");
14
14
  const tooling_common_3 = require("@webpieces/tooling-common");
15
15
  const to_error_1 = require("@webpieces/tooling-common/to-error");
16
16
  const summary_json_schema_renderer_1 = require("./summary-json-schema-renderer");
17
+ const addressed_issues_parser_1 = require("./addressed-issues-parser");
17
18
  const verdict_schema_renderer_1 = require("./verdict-schema-renderer");
18
19
  const checklist_override_1 = require("./checklist-override");
19
20
  Object.defineProperty(exports, "ChecklistOverride", { enumerable: true, get: function () { return checklist_override_1.ChecklistOverride; } });
@@ -29,6 +30,7 @@ Object.defineProperty(exports, "ChecklistResult", { enumerable: true, get: funct
29
30
  Object.defineProperty(exports, "RequiredChecklist", { enumerable: true, get: function () { return review_json_data_1.RequiredChecklist; } });
30
31
  Object.defineProperty(exports, "ChecklistReviewContext", { enumerable: true, get: function () { return review_json_data_1.ChecklistReviewContext; } });
31
32
  Object.defineProperty(exports, "PrSummary", { enumerable: true, get: function () { return review_json_data_1.PrSummary; } });
33
+ Object.defineProperty(exports, "AddressedIssue", { enumerable: true, get: function () { return review_json_data_1.AddressedIssue; } });
32
34
  Object.defineProperty(exports, "CK_PASS", { enumerable: true, get: function () { return review_json_data_1.CK_PASS; } });
33
35
  Object.defineProperty(exports, "CK_WARN", { enumerable: true, get: function () { return review_json_data_1.CK_WARN; } });
34
36
  Object.defineProperty(exports, "CK_OVERRIDDEN", { enumerable: true, get: function () { return review_json_data_1.CK_OVERRIDDEN; } });
@@ -298,6 +300,7 @@ let ReviewJsonService = class ReviewJsonService {
298
300
  errors.push('"title" must be a non-empty, imperative PR title describing the change (no branch names).');
299
301
  }
300
302
  const mainAgentInstructions = this.validateMainAgentInstructions(raw, expectedMainAgentInstructions, errors);
303
+ const addressesIssues = new addressed_issues_parser_1.AddressedIssuesParser().parse(raw['addressesIssues'], errors);
301
304
  const results = this.loadChecklistResults(filePath, required);
302
305
  for (const result of results)
303
306
  result.remediation = orangeFixes[result.id] ?? '';
@@ -307,7 +310,7 @@ let ReviewJsonService = class ReviewJsonService {
307
310
  const level = riskLevel;
308
311
  const emoji = typeof raw['riskEmoji'] === 'string' && raw['riskEmoji'] !== '' ? raw['riskEmoji'] : (EMOJI_FOR_LEVEL[level] ?? '🟡');
309
312
  const summary = typeof raw['summary'] === 'string' ? raw['summary'] : '';
310
- return new review_json_data_1.PrSummary(raw['agent'].trim(), raw['model'].trim(), title, riskScore, level, emoji, summary, this.asStringArray(raw['violations']), this.asStringArray(raw['risks']), this.asStringArray(raw['filesToReview']), results, mainAgentInstructions);
313
+ return new review_json_data_1.PrSummary(raw['agent'].trim(), raw['model'].trim(), title, riskScore, level, emoji, summary, this.asStringArray(raw['violations']), this.asStringArray(raw['risks']), this.asStringArray(raw['filesToReview']), addressesIssues, results, mainAgentInstructions);
311
314
  }
312
315
  assertValidSummary(errors, filePath, expectedMainAgentInstructions, retryCommand) {
313
316
  if (errors.length === 0)
@@ -1 +1 @@
1
- {"version":3,"file":"review-json.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/review-json.ts"],"names":[],"mappings":";;;AAirBA,4BAEC;AAGD,0CAEC;AAGD,sDAEC;;AA7rBD,+CAAyB;AACzB,mDAA6B;AAC7B,mCAAoC;AACpC,yCAA2D;AAC3D,8DAA0D;AAC1D,8DAAuE;AACvE,8DAA0D;AAC1D,iEAA6D;AAC7D,iFAA2E;AAC3E,uEAAkE;AAClE,6DAA6G;AAwBpG,kGAxBA,sCAAiB,OAwBA;AAAE,yGAxBA,6CAAwB,OAwBA;AAAE,yGAxBA,6CAAwB,OAwBA;AAvB9E,yDAoB4B;AAKxB,8FAxBA,gCAAa,OAwBA;AACb,+FAxBA,iCAAc,OAwBA;AACd,+FAxBA,iCAAc,OAwBA;AACd,4FAxBA,8BAAW,OAwBA;AACX,iGAxBA,mCAAgB,OAwBA;AAChB,gGAxBA,kCAAe,OAwBA;AACf,kGAxBA,oCAAiB,OAwBA;AACjB,uGAxBA,yCAAsB,OAwBA;AACtB,0FAxBA,4BAAS,OAwBA;AACT,wFAxBA,0BAAO,OAwBA;AACP,wFAxBA,0BAAO,OAwBA;AAC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AA0B;QACjI,yHAAyH;QACzH,8DAA8D;QAC9D,IAAI,CAAC;YACD,yFAAyF;YACzF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAA4B,CAAC;QACtD,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,MAAM,IAAI,8BAAa,CAAC,mCAAmC,KAAK,CAAC,OAAO,QAAQ,GAAG,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,6BAA6B,CAAC,MAAM,GAAG,gBAAgB,YAAY,EAAE,CAAC,CAAC;QACtM,CAAC;IACL,CAAC;CACJ,CAAA;AA5lBY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGR,6BAAY;QACT,6CAAwB;GAH/C,iBAAiB,CA4lB7B;AAED,0FAA0F;AAC1F,MAAM,aAAa,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAE9C,wIAAwI;AACxI,SAAgB,QAAQ,CAAC,QAAgB,EAAE,WAAmB;IAC1D,OAAO,aAAa,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AACzD,CAAC;AAED,wIAAwI;AACxI,SAAgB,eAAe,CAAC,QAAgB,EAAE,WAAmB;IACjE,OAAO,aAAa,CAAC,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAChE,CAAC;AAED,wIAAwI;AACxI,SAAgB,qBAAqB,CAAC,QAAgB,EAAE,qBAAqB,GAAG,EAAE;IAC9E,OAAO,aAAa,CAAC,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { randomUUID } from 'crypto';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { PR_REVIEW_DIR } from '@webpieces/tooling-common';\nimport { DotWebpieces, dotWebpieces } from '@webpieces/tooling-common';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { toError } from '@webpieces/tooling-common/to-error';\nimport { SummaryJsonSchemaRenderer } from './summary-json-schema-renderer';\nimport { VerdictSchemaRenderer } from './verdict-schema-renderer';\nimport { ChecklistOverride, ChecklistOverrideService, checklistOverrideService } from './checklist-override';\nimport {\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_ORANGE,\n VERDICT_RED,\n VERDICT_STATUSES,\n ChecklistResult,\n RequiredChecklist,\n ChecklistReviewContext,\n PrSummary,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_ORANGE_FIXED,\n CK_ORANGE,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n ChecklistVerdict,\n PrContext,\n} from './review-json-data';\n\n// Re-exported so review-json.ts stays the single import site for the review vocabulary.\nexport { ChecklistOverride, ChecklistOverrideService, checklistOverrideService };\nexport {\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_ORANGE,\n VERDICT_RED,\n VERDICT_STATUSES,\n ChecklistResult,\n RequiredChecklist,\n ChecklistReviewContext,\n PrSummary,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_ORANGE_FIXED,\n CK_ORANGE,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n ChecklistVerdict,\n PrContext,\n};\n\nconst RISK_LEVELS = ['green', 'yellow', 'red'] as const;\nconst EMOJI_FOR_LEVEL: Record<string, string> = { green: '🟢', yellow: '🟡', red: '🔴' };\n\n// Where `wp-finish-upsert-pr` retires the summary.json it just consumed, and the note it stamps on the way.\n// The key sorts first in the written JSON because it is written first — an AI that opens the file to see\n// whether it can reuse the summary reads what the file IS before it reads a title it might be tempted to keep.\nconst OLD_SUMMARY_FILE = 'old-summary.json';\nconst ARCHIVE_NOTE_KEY = '_ARCHIVED_AUDIT_ONLY';\nconst ARCHIVE_NOTE =\n 'ARCHIVE — this is the PR summary from the PREVIOUS wp-finish-upsert-pr run on this branch, kept for audit ' +\n 'purposes only. It is NOT the summary for a new round: it describes the code as of the last PR ' +\n 'update, which has since moved. If you are updating the PR again, write a FRESH summary.json at the path ' +\n \"pnpm wp-review-upsert-pr prints; do not copy this file's title, summary or risk level forward without \" +\n 're-deciding each one. Overwritten by every finish, so only the most recent summary is ever here.';\n\n// A verdict file is named by its ROUND (issue #1053): `review-round<N>-<id>.json`, one per round, never\n// overwritten. The id is matched EXACTLY (escaped), so `review-round2-fixes.json` (the author's recorded\n// fixes for round 2) and a provenance file beside a verdict can never be read as a verdict.\nconst VERDICT_FILE_PREFIX = 'review-round';\n\n/** Locates + loads/validates the AI-authored summary.json. `@injectable(bindingScopeValues.Singleton)` so it's drawn in the design. */\n@injectable(bindingScopeValues.Singleton)\nexport class ReviewJsonService {\n constructor(\n private readonly dotDir: DotWebpieces = dotWebpieces,\n private readonly overrides: ChecklistOverrideService = checklistOverrideService,\n ) {}\n\n // The per-feature PR working dir: `<worktree>/.webpieces/pr-review/<feature>`. AI-WRITABLE scope,\n // not local() — an agent AUTHORS summary.json here, and each reviewer subagent authors its own\n // review-round<N>-<id>.json beside it. A worktree-isolated agent's Write is refused for any path under the\n // shared checkout, which is where local() puts this, so local() made both files unwritable by the\n // very agents the flow instructs to write them. See DotWebpieces.aiWritable() for the full account.\n prDirFor(repoRoot: string, featureName: string): string {\n return this.dotDir.aiWritableFile(repoRoot, PR_REVIEW_DIR, featureName);\n }\n\n // Absolute path of the summary.json for a feature — beside pr-body.md, keyed by branch name.\n summaryJsonPath(repoRoot: string, featureName: string): string {\n return path.join(this.prDirFor(repoRoot, featureName), 'summary.json');\n }\n\n // Absolute path of the pr-context.json for a feature (the diff base/head + changed files).\n prContextPath(repoRoot: string, featureName: string): string {\n return path.join(this.prDirFor(repoRoot, featureName), 'pr-context.json');\n }\n\n // Where a consumed summary.json is archived to, beside it. Always the SAME path — it holds the last\n // summary and only the last one, so it can never be mistaken for a series that means something.\n oldSummaryJsonPath(summaryJsonFilePath: string): string {\n return path.join(path.dirname(summaryJsonFilePath), OLD_SUMMARY_FILE);\n }\n\n /** Keep the active PR intent available for updates; each publication gets an immutable audit copy. */\n snapshotSummaryJson(summaryJsonFilePath: string): string {\n const dir = path.join(path.dirname(summaryJsonFilePath), 'published-summaries');\n fs.mkdirSync(dir, { recursive: true });\n const snapshot = path.join(dir, `${randomUUID()}.json`);\n const raw = fs.readFileSync(summaryJsonFilePath, 'utf8');\n const note =\n 'AUDIT ONLY — the summary used by this publication. The active PR intent is in ' +\n 'summary.json beside published-summaries. Refresh the active file when intent, issue, title or risk changes.';\n fs.writeFileSync(snapshot, this.archivedBody(raw, note), { flag: 'wx' });\n return snapshot;\n }\n\n /**\n * Retire the PR summary `wp-finish-upsert-pr` just used: move summary.json to old-summary.json, stamped\n * with a note saying what it is. Returns the archive path, or '' when there was nothing to archive.\n *\n * The point is the MOVE, not the copy. summary.json left in place after a PR is posted is a live-looking\n * file describing a PR update that already happened, and the next run of stage ② on this branch finds it\n * sitting there — so a reviewer subagent that judges the PR's stated intent (its title, summary or risk\n * level) can read the previous run's summary and return GREEN against a title that no longer exists.\n * Nothing in the verdict distinguishes that from a real pass. Moving it means the only way to reach\n * finish again is to write a fresh one, and {@link loadSummaryJson} points at the archive when it is\n * missing so the archive reads as an audit trail rather than as a lost file.\n *\n * Called only after the PR is actually up: a finish that failed before publishing must stay re-runnable.\n */\n archiveSummaryJson(summaryJsonFilePath: string): string {\n if (!fs.existsSync(summaryJsonFilePath)) return '';\n const archivePath = this.oldSummaryJsonPath(summaryJsonFilePath);\n const raw = fs.readFileSync(summaryJsonFilePath, 'utf8');\n fs.writeFileSync(archivePath, this.archivedBody(raw, ARCHIVE_NOTE));\n fs.rmSync(summaryJsonFilePath);\n return archivePath;\n }\n\n /**\n * The archived bytes: the original JSON with an AUDIT-ONLY note as its FIRST key, so anything that opens\n * the file — human or AI — reads what it is before it reads any of its content.\n *\n * Falls back to the raw bytes when they do not parse. `loadSummaryJson` has already accepted the file, so\n * that is close to impossible, but preserving the original always beats losing it to a stamping failure,\n * since the archive exists precisely to be the record.\n */\n private archivedBody(raw: string, note: string): string {\n const parsed = this.tryParseObject(raw);\n if (parsed === null) return raw;\n // webpieces-disable no-any-unknown -- re-serializing opaque review fields verbatim; only the key ORDER is ours\n const stamped: Record<string, unknown> = {};\n stamped[ARCHIVE_NOTE_KEY] = note;\n for (const key of Object.keys(parsed)) stamped[key] = parsed[key];\n return JSON.stringify(stamped, null, 2) + '\\n';\n }\n\n // webpieces-disable no-any-unknown -- opaque parsed JSON; the caller only re-serializes it\n private tryParseObject(raw: string): Record<string, unknown> | null {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: unparseable bytes are archived verbatim, never fatal\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- parsed JSON is opaque; only its key order is used\n const parsed = JSON.parse(raw) as Record<string, unknown>;\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return null;\n return parsed;\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n return null;\n }\n }\n\n /**\n * Persist the PR's diff context so reviewer subagents can read the changed-file set + the exact base\n * sha. Returns the file path written.\n *\n * ALSO writes an immutable per-stage snapshot under `stages/<stage>.json` when `stage` is given.\n * `pr-context.json` is overwritten by each stage, so by the time anything goes wrong the earlier\n * states are gone — and \"what did the tooling think the diff was at stage ①, vs ②, vs ③?\" is exactly\n * the question you need answered when debugging a review that went sideways. The snapshots make the\n * review system auditable by an AI reviewing IT, which the single mutable file never could.\n */\n writePrContext(repoRoot: string, featureName: string, context: PrContext, stage = ''): string {\n const dir = this.prDirFor(repoRoot, featureName);\n fs.mkdirSync(dir, { recursive: true });\n const body = JSON.stringify(context, null, 2) + '\\n';\n const p = this.prContextPath(repoRoot, featureName);\n fs.writeFileSync(p, body);\n if (stage !== '') {\n const stagesDir = path.join(dir, 'stages');\n fs.mkdirSync(stagesDir, { recursive: true });\n fs.writeFileSync(path.join(stagesDir, `${stage}.json`), body);\n }\n return p;\n }\n\n /**\n * The review context for a feature, recovered from the pr-context.json wp-start-upsert-pr already wrote.\n * Lets wp-finish-upsert-pr's \"you still owe me review-round<N>-<id>.json\" message inline the SAME self-sufficient\n * per-reviewer block start printed, instead of a checklist name and an indirection. Empty when the file\n * is absent or unreadable — the block then just omits those lines.\n */\n reviewContextFor(repoRoot: string, featureName: string): ChecklistReviewContext {\n const p = this.prContextPath(repoRoot, featureName);\n if (!fs.existsSync(p)) return new ChecklistReviewContext();\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: an unreadable context file degrades to fewer printed lines, never a crash\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- parsed JSON is opaque until narrowed on the next line\n const raw = JSON.parse(fs.readFileSync(p, 'utf8')) as Record<string, unknown>;\n const base = typeof raw['base'] === 'string' ? (raw['base'] as string) : '';\n // Recover the REPRODUCE command rather than re-deriving it: a context written by an older\n // pr-gate has no diffCommand, and guessing `<base> HEAD` there would resurrect the exact\n // empty-on-a-dirty-tree bug this field exists to kill. Absent ⇒ omit the line entirely.\n const cmd = typeof raw['diffCommand'] === 'string' ? (raw['diffCommand'] as string) : '';\n const diffDir = typeof raw['diffDir'] === 'string' ? (raw['diffDir'] as string) : '';\n const dirty = raw['dirty'] === true;\n return new ChecklistReviewContext(base, p, cmd === '' ? '' : `${cmd} -- <file>`, diffDir, dirty);\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n return new ChecklistReviewContext('', p);\n }\n }\n\n // Copy-paste summary.json schema shared by every command that asks the coordinating AI to write it.\n summaryJsonSchemaHint(filePath: string, mainAgentInstructions = ''): string {\n return new SummaryJsonSchemaRenderer().render(filePath, mainAgentInstructions);\n }\n\n /**\n * The extra line the \"no summary.json\" complaint carries when a PREVIOUS summary was archived here. It\n * turns a bare \"not found\" — which reads as data loss, and invites hunting for the file — into the fact:\n * the last finish consumed it, and the archive is audit material, not a summary to reuse.\n */\n private archivedSummaryHint(filePath: string, retryCommand: string): string {\n const archive = this.oldSummaryJsonPath(filePath);\n if (!fs.existsSync(archive)) return '';\n return `\\nA PREVIOUS PR summary was archived to ${archive} when the last ${retryCommand} consumed it.\\n` + `That file is for AUDIT ONLY — it describes code this branch has since moved past. Write a fresh one:`;\n }\n\n // Names summary.json when the author wrote its OLD name (review.json until #1033 — refused by Claude\n // auto-mode as Self-Approval beside the review-round<N>-<id>.json verdicts). HARD CUT: the stale file is never read.\n private renamedFileHint(filePath: string): string {\n const stale = path.join(path.dirname(filePath), 'review.json');\n if (!fs.existsSync(stale)) return '';\n return `\\n${stale} is IGNORED — the author's file was renamed to summary.json. ` + `Write the same JSON to ${filePath} instead.`;\n }\n\n /**\n * The per-checklist verdict file for ONE round, beside summary.json: `review-round<N>-<id>.json`.\n *\n * Round-numbered (issue #1053) so no round ever overwrites another. The top-level `review-<id>.json` this\n * replaced was overwritten by every submission, and a separate `rounds/<N>/` copy had to be kept in step\n * with it to recover the history: two records of one fact, and the copy was the one an agent could lose.\n */\n checklistResultPath(summaryJsonFilePath: string, checklistId: string, round: number): string {\n return path.join(path.dirname(summaryJsonFilePath), `${VERDICT_FILE_PREFIX}${round}-${checklistId}.json`);\n }\n\n /**\n * The HIGHEST round a verdict was submitted in for one checklist, or 0 when it has none. The live verdict\n * is always that one; every lower round is history. Derived from the files present, so there is no\n * counter to drift from them.\n */\n latestVerdictRound(summaryJsonFilePath: string, checklistId: string): number {\n const dir = path.dirname(summaryJsonFilePath);\n if (!fs.existsSync(dir)) return 0;\n const pattern = new RegExp(`^${VERDICT_FILE_PREFIX}(\\\\d+)-${this.escapeRegExp(checklistId)}\\\\.json$`);\n let latest = 0;\n for (const name of fs.readdirSync(dir)) {\n const match = pattern.exec(name);\n if (match !== null) latest = Math.max(latest, Number(match[1]));\n }\n return latest;\n }\n\n /** The verdict file name with the round left as `<N>`, for messages that name it before a round is known. */\n checklistResultPathTemplate(summaryJsonFilePath: string, checklistId: string): string {\n return path.join(path.dirname(summaryJsonFilePath), this.checklistFileName(checklistId));\n }\n\n /** The live (highest-round) verdict file for one checklist, or '' when none was ever submitted. */\n latestChecklistResultPath(summaryJsonFilePath: string, checklistId: string): string {\n const round = this.latestVerdictRound(summaryJsonFilePath, checklistId);\n return round === 0 ? '' : this.checklistResultPath(summaryJsonFilePath, checklistId, round);\n }\n\n private escapeRegExp(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n }\n\n /**\n * Load + validate the AI-authored summary.json. Throws InformAiError (with the schema) when missing,\n * unparseable, or structurally wrong. `required` is the set of checklists the diff matched: every one\n * must have a well-formed, passing (or overridden) review-round<N>-<id>.json or a validation error is raised\n * alongside the usual ones so the AI gets ONE message.\n */\n // webpieces-disable max-lines-new-methods -- one cohesive load+validate pass over the review fields\n loadSummaryJson(\n filePath: string, required: readonly RequiredChecklist[] = [], expectedMainAgentInstructions = '',\n orangeFixes: Record<string, string> = {},\n retryCommand = 'pnpm wp-finish-upsert-pr',\n ): PrSummary {\n const raw = this.readSummaryObject(filePath, expectedMainAgentInstructions, retryCommand);\n const errors: string[] = [];\n for (const field of ['agent', 'model']) {\n if (typeof raw[field] !== 'string' || raw[field].trim() === '') {\n errors.push(`\"${field}\" must be a non-empty string; use \"unknown\" when unavailable.`);\n }\n }\n const riskScore = raw['riskScore'];\n if (typeof riskScore !== 'number' || !Number.isFinite(riskScore) || riskScore < 0 || riskScore > 100) {\n errors.push(`\"riskScore\" must be a number 0–100, got ${JSON.stringify(riskScore)}.`);\n }\n const riskLevel = raw['riskLevel'];\n if (typeof riskLevel !== 'string' || !RISK_LEVELS.includes(riskLevel as (typeof RISK_LEVELS)[number])) {\n errors.push(`\"riskLevel\" must be one of: ${RISK_LEVELS.join(', ')}.`);\n }\n const title = typeof raw['title'] === 'string' ? (raw['title'] as string).trim() : '';\n if (title === '') {\n errors.push('\"title\" must be a non-empty, imperative PR title describing the change (no branch names).');\n }\n const mainAgentInstructions = this.validateMainAgentInstructions(raw, expectedMainAgentInstructions, errors);\n\n const results = this.loadChecklistResults(filePath, required);\n for (const result of results) result.remediation = orangeFixes[result.id] ?? '';\n for (const err of this.requiredChecklistErrors(required, results, filePath)) errors.push(err);\n\n this.assertValidSummary(errors, filePath, expectedMainAgentInstructions, retryCommand);\n\n const level = riskLevel as string;\n const emoji = typeof raw['riskEmoji'] === 'string' && raw['riskEmoji'] !== '' ? (raw['riskEmoji'] as string) : (EMOJI_FOR_LEVEL[level] ?? '🟡');\n const summary = typeof raw['summary'] === 'string' ? (raw['summary'] as string) : '';\n\n return new PrSummary((raw['agent'] as string).trim(), (raw['model'] as string).trim(), title, riskScore as number, level, emoji, summary, this.asStringArray(raw['violations']), this.asStringArray(raw['risks']), this.asStringArray(raw['filesToReview']), results, mainAgentInstructions);\n }\n\n private assertValidSummary(errors: string[], filePath: string, expectedMainAgentInstructions: string, retryCommand: string): void {\n if (errors.length === 0) return;\n throw new InformAiError(`summary.json has ${errors.length} error(s) — fix ALL, then re-run ${retryCommand}:\\n\\n` + errors.map((e: string): string => ` • ${e}`).join('\\n') + `\\n\\n${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}`);\n }\n\n /** Load the raw object and render every parse/shape error for the command that called us. */\n private readSummaryObject(\n filePath: string,\n expectedMainAgentInstructions: string,\n retryCommand: string,\n // webpieces-disable-next-line no-any-unknown -- opaque JSON is narrowed field-by-field by loadSummaryJson\n ): Record<string, unknown> {\n if (!fs.existsSync(filePath)) {\n throw new InformAiError(`Required summary.json not found.${this.renamedFileHint(filePath)}${this.archivedSummaryHint(filePath, retryCommand)}\\n\\n` + `${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}\\n\\n` + `Then re-run: ${retryCommand}`);\n }\n const raw = this.parseSummaryJson(fs.readFileSync(filePath, 'utf8'), filePath, expectedMainAgentInstructions, retryCommand);\n if (typeof raw === 'object' && raw !== null && !Array.isArray(raw)) return raw;\n throw new InformAiError(`summary.json must be a JSON object.\\n\\n${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}` + `\\n\\nThen re-run: ${retryCommand}`);\n }\n\n // webpieces-disable no-any-unknown -- AI-authored JSON boundary is validated before use\n private validateMainAgentInstructions(\n // webpieces-disable no-any-unknown -- opaque parsed JSON; only tested for key presence below\n raw: Record<string, unknown>,\n expected: string,\n errors: string[],\n ): string {\n const actual = typeof raw['main_agent_instructions'] === 'string' ? (raw['main_agent_instructions'] as string).trim() : '';\n if (expected !== '' && actual !== expected) errors.push('\"main_agent_instructions\" must exactly preserve the single-round instructions printed by stage ②.');\n return actual;\n }\n\n /**\n * The checklists that still OWE a verdict: no review-round<N>-<id>.json at all, a malformed one, or one whose\n * verdict is an un-overridden FAIL. This is the set every message lists — a checklist already PASSed or\n * OVERRIDDEN on this branch is deliberately NOT re-listed, because re-instructing it invites a redundant\n * second run and reads as though the earlier verdict did not count.\n */\n pendingChecklists(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): RequiredChecklist[] {\n return required.filter((req: RequiredChecklist): boolean => {\n const status = this.resolveVerdict(req, results).status;\n // CK_WARN must be listed here beside PASS/OVERRIDDEN. A yellow verdict SHIPS — leaving it out\n // would mark the checklist owed forever, so `outstanding` never empties and the PR is refused\n // permanently no matter how many times the reviewer runs.\n return status !== CK_PASS && status !== CK_WARN && status !== CK_OVERRIDDEN && status !== CK_ORANGE_FIXED;\n });\n }\n\n /**\n * The checklists whose latest verdict is ORANGE with no recorded author fix (issue #1053): a final-round\n * must-fix. A strict subset of {@link pendingChecklists}, split out because its cure is neither a\n * reviewer nor an override: the author fixes the code and records it with `wp-write-review-fixes`.\n */\n orangeChecklists(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): RequiredChecklist[] {\n return required.filter((req: RequiredChecklist): boolean => this.resolveVerdict(req, results).status === CK_ORANGE);\n }\n\n /**\n * THE renderer for \"this final-round reviewer marked ORANGE\": the finding verbatim, then the ONE way past\n * it. There is no re-review to ask for: the round cap is spent, and an orange is the reviewer saying so.\n */\n orangeError(req: RequiredChecklist, verdict: ChecklistVerdict): string {\n const finding = `${verdict.detail.split('\\n').join('\\n ')}\\n`;\n return `Checklist \"${req.id}\" is ORANGE — a final-round MUST-FIX that is never re-reviewed. The reviewer (${req.reviewer.agentName}) wrote:\\n `\n + finding\n + ' Fix it in the code, best effort, and commit the fix. Then record it with pnpm wp-write-review-fixes\\n'\n + ` (one response {checklistId: \"${req.id}\", resolution, files}) and re-run. Do NOT spawn a reviewer for it:\\n`\n + ' that was the last review round, and no further verdict can be recorded.\\n';\n }\n\n /**\n * The OPTIONAL checklists (`required: false`) that matched the diff but have no verdict file at all.\n *\n * This is the ONE set that separates \"nobody ran it\" from \"it failed\", and the distinction is the whole\n * feature: an optional checklist with no verdict was legitimately not run — the human declined it — so\n * it must NOT block. An optional checklist with a RED verdict is not in\n * here (it resolves to CK_FAIL) and blocks exactly like a required one: choosing to run a reviewer and\n * then ignoring its answer would make the whole thing theater.\n *\n * A strict subset of {@link pendingChecklists}, computed here rather than at each call site so the\n * command that gates and the dashboard that reports cannot disagree about which checklists were skipped.\n */\n optionalWithoutVerdict(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): RequiredChecklist[] {\n return required.filter((req: RequiredChecklist): boolean => !req.required && this.resolveVerdict(req, results).status === CK_MISSING);\n }\n\n /**\n * The checklists that REFUSED: a reviewer ran, judged the change, and said no (CK_FAIL — status red with\n * no override). A strict subset of {@link pendingChecklists}, split out because it demands a completely\n * different action from the reader.\n *\n * Public so every command agrees on the set. When \"refused\" was computed ad hoc, a refusal and a\n * never-ran reviewer landed in one bucket and produced one message — \"you MUST run these N reviewer\n * subagent(s)\" — handed to an AI, which obediently re-spawned a reviewer that had already answered. It\n * refused again for the same reason, and the loop cost a full subagent run per pass while the reviewer's\n * actual finding was never shown to anyone. A refusal is a RESULT, not a missing step.\n */\n refusedChecklists(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): RequiredChecklist[] {\n return required.filter((req: RequiredChecklist): boolean => this.resolveVerdict(req, results).status === CK_FAIL);\n }\n\n /**\n * THE renderer for \"this reviewer refused\" — one wording, wherever the refusal surfaces. It exists as a\n * method because the text was previously inlined in {@link requiredChecklistErrors}, reachable only\n * through summary.json validation, while the command layer refused earlier with its own generic message.\n * Two messages for one event is how the useful one became unreachable; there is now exactly one.\n *\n * It always quotes the reviewer's own `output` verbatim: the finding is the whole point, and an error\n * that names a checklist without saying what it objected to gives the reader nothing to fix.\n *\n * IT NAMES THE WRITER, which is the half that was missing. The old text said WHAT to write (\"set a\n * non-empty override\") and WHERE, but never WHO MAY — so the only reachable move was an agent editing a\n * reviewer's verdict file in place, which the harness denies, which is how a human ended up hand-editing\n * JSON. The ship-anyway route is now a SEPARATE file the coordinating agent may write, and the command\n * that writes it is printed ready to run. See {@link ChecklistOverrideService.writerRule}.\n *\n * A red verdict is never moved or deleted (issue #1053): the next round's verdict is a NEW file,\n * `review-round<N+1>-<id>.json`, and the gate reads the highest round, so the refusal stays on disk as the\n * record of what was found.\n */\n refusalError(req: RequiredChecklist, verdict: ChecklistVerdict, summaryJsonFilePath: string): string {\n const finding = `${verdict.detail.split('\\n').join('\\n ')}\\n`;\n const head = `Checklist \"${req.id}\" FAILED review (status:\"${VERDICT_RED}\"). The reviewer (${req.reviewer.agentName}) wrote:\\n ` + finding;\n return head + ' Fix it, commit the fix, record it with pnpm wp-write-review-fixes, then re-run pnpm wp-review-upsert-pr.\\n'\n + this.overrideRoute(req, summaryJsonFilePath);\n }\n\n /**\n * The ship-anyway paragraph: who may authorize, and the exact command that records it.\n *\n * Its own method because every refusal surface must say the identical thing about who may write an\n * override. A second copy of this paragraph is precisely how the previous one drifted into naming a\n * command that had since been deleted.\n */\n private overrideRoute(req: RequiredChecklist, summaryJsonFilePath: string): string {\n return (\n ` To SHIP ANYWAY a human must decide it, and the decision is recorded in its own file — ` +\n `${this.overrides.overrideFileName(req.id)}, never inside the reviewer's verdict.\\n` +\n ` ${this.overrides.writerRule()}\\n` +\n ' Run exactly this, replacing only the \"reason\" with what the human actually said:\\n\\n' +\n `${this.overrides.writeCommand(summaryJsonFilePath, req.id)}\\n`\n );\n }\n\n // Read the LIVE verdict per required checklist: its highest-round `review-round<N>-<id>.json` beside\n // summary.json (issue #1053). A checklist with no verdict file is simply absent from the result (→ MISSING);\n // a malformed one is skipped. The id is matched exactly (see latestVerdictRound), so neither the author's\n // `review-round<N>-fixes.json` nor a provenance file can ever resolve as a verdict.\n loadChecklistResults(summaryJsonFilePath: string, required: readonly RequiredChecklist[]): ChecklistResult[] {\n const results: ChecklistResult[] = [];\n for (const req of required) {\n const round = this.latestVerdictRound(summaryJsonFilePath, req.id);\n if (round === 0) continue;\n const p = this.checklistResultPath(summaryJsonFilePath, req.id, round);\n // The human's authorization is read from its OWN file beside the verdict, in the same pass, so\n // resolveVerdict never touches disk and every command resolves one outcome from one read.\n const parsed = this.parseChecklistResult(p, req.id, this.overrides.load(summaryJsonFilePath, req.id));\n if (parsed === null) continue;\n parsed.round = round;\n results.push(parsed);\n }\n return results;\n }\n\n // Resolve ONE checklist's verdict from its review-round<N>-<id>.json. Central so summary.json enforcement AND the\n // finish-command dashboard agree on the outcome. `problem` is checked FIRST: a file whose verdict cannot\n // be read must not fall through to any shipping outcome.\n resolveVerdict(req: RequiredChecklist, results: readonly ChecklistResult[]): ChecklistVerdict {\n const result = results.find((r: ChecklistResult): boolean => r.id === req.id);\n if (!result) return new ChecklistVerdict(req.id, CK_MISSING, '');\n if (result.problem !== '') return new ChecklistVerdict(req.id, CK_BAD_FORMAT, result.problem);\n if (result.status === VERDICT_GREEN) return new ChecklistVerdict(req.id, CK_PASS, result.output);\n if (result.status === VERDICT_YELLOW) return new ChecklistVerdict(req.id, CK_WARN, result.output);\n // An ORANGE ships once the author has recorded a fix for it, and ONLY that way: it is the final\n // round's must-fix, so there is no re-review to wait for and no override to hunt (issue #1053).\n if (result.status === VERDICT_ORANGE) {\n return result.remediation !== ''\n ? new ChecklistVerdict(req.id, CK_ORANGE_FIXED, result.remediation)\n : new ChecklistVerdict(req.id, CK_ORANGE, result.output);\n }\n const override = result.override;\n // A malformed authorization is reported as a FORMAT problem, never treated as one: an override with\n // no stated reason authorizes nothing, and silently ignoring it would tell the reader their decision\n // was not recorded without ever saying why.\n if (override !== null && override.problem !== '') return new ChecklistVerdict(req.id, CK_BAD_FORMAT, override.problem);\n if (override !== null) return new ChecklistVerdict(req.id, CK_OVERRIDDEN, this.overrides.detail(override));\n return new ChecklistVerdict(req.id, CK_FAIL, result.output);\n }\n\n /**\n * One loud complaint per checklist whose verdict file EXISTS but cannot be read as a verdict — almost\n * always one still using the removed `success` field. Public and separate from\n * {@link requiredChecklistErrors} because `wp-finish-upsert-pr` refuses on missing reviewers BEFORE it\n * parses summary.json: without this, a legacy file would surface as the generic \"no verdict yet\" block\n * and the AI would re-run a reviewer that already ran instead of fixing four characters of JSON.\n */\n checklistFormatErrors(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): string[] {\n const errors: string[] = [];\n for (const req of required) {\n const verdict = this.resolveVerdict(req, results);\n if (verdict.status === CK_BAD_FORMAT) errors.push(verdict.detail);\n }\n return errors;\n }\n\n // Every matched checklist whose verdict is FAIL (reviewed, found a problem, no override) or MISSING (no\n // review-round<N>-<id>.json written) → one error each, printing the reviewer's `output` verbatim.\n private requiredChecklistErrors(required: readonly RequiredChecklist[], results: readonly ChecklistResult[], filePath: string): string[] {\n // Format complaints come from the ONE renderer, so wp-review-upsert-pr and wp-finish word them identically.\n const errors: string[] = this.checklistFormatErrors(required, results);\n for (const req of required) {\n const verdict = this.resolveVerdict(req, results);\n // CK_WARN ('yellow' — passed with concerns) is deliberately absent from this chain: it SHIPS.\n // The concern still reaches the PR, published in the checklist comment. Do not \"fix\" this.\n if (verdict.status === CK_FAIL) {\n // Through the ONE renderer, so this path and the command layer's refusal say the same thing.\n errors.push(this.refusalError(req, verdict, filePath));\n } else if (verdict.status === CK_ORANGE) {\n errors.push(this.orangeError(req, verdict));\n } else if (verdict.status === CK_MISSING) {\n // An OPTIONAL checklist with no verdict was legitimately not run — the human was offered it\n // and declined. Demanding it here would make\n // `required: false` mean nothing. Note the CK_FAIL branch above deliberately has no such\n // exemption: once an optional reviewer RUNS, its refusal counts.\n if (!req.required) continue;\n const doc = req.doc.trim() !== '' ? ` Read: ${req.doc}.` : '';\n errors.push(`Checklist \"${req.id}\" MATCHED this diff but has no verdict. Spawn the \"${req.reviewer.agentName}\" subagent to review it; ` + `IT submits the verdict with ${this.submitCommand(req.id)} — nobody writes ${this.checklistFileName(req.id)} by hand.${doc}`);\n }\n }\n return errors;\n }\n\n private checklistFileName(checklistId: string): string {\n return `${VERDICT_FILE_PREFIX}<N>-${checklistId}.json`;\n }\n\n /**\n * THE renderer for a reviewer's verdict schema — with the reviewer's own `id` already filled in.\n *\n * There is one because a verdict schema that lives anywhere a human maintains it goes stale, and a\n * reviewer follows the stale copy. That is not a hypothetical: when `success` was replaced by the\n * tri-state `status`, hand-written `.claude/agents/*.md` files kept documenting `success`, and a real\n * PR had to carry \"the verdict format in your own agent .md file is OUT OF DATE\" in the spawn prompt to\n * work around it. Every printed copy — the stage-② roster, the generated per-reviewer instructions\n * file, and the complaint raised against a malformed verdict — now comes from here. It ends with the\n * ONE way a verdict is submitted (`wp-write-review`, issue #863), never a file path to write.\n */\n renderVerdictSchema(id: string, indent = ' '): string {\n return new VerdictSchemaRenderer().render(id, indent);\n }\n\n /** THE command that submits one checklist's verdict (issue #863) — see VerdictSchemaRenderer. */\n submitCommand(id: string): string {\n return new VerdictSchemaRenderer().submitCommand(id);\n }\n\n // Unreadable objects retain their format complaint; absent/unparseable verdicts return null.\n // webpieces-disable no-any-unknown -- opaque parsed JSON, narrowed field-by-field\n private parseChecklistResult(filePath: string, id: string, override: ChecklistOverride | null): ChecklistResult | null {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: an unparseable per-checklist file is skipped, not fatal\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- parsed JSON is opaque until narrowed below\n const raw = JSON.parse(fs.readFileSync(filePath, 'utf8')) as Record<string, unknown>;\n if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) return null;\n const output = typeof raw['output'] === 'string' ? (raw['output'] as string) : '';\n const status = typeof raw['status'] === 'string' ? (raw['status'] as string).trim().toLowerCase() : '';\n const agent = typeof raw['agent'] === 'string' ? raw['agent'].trim() : '';\n const model = typeof raw['model'] === 'string' ? raw['model'].trim() : '';\n const identityProblem = agent === '' || model === '' ? 'Both \"agent\" and \"model\" must be non-empty strings; use \"unknown\" when unavailable.' : '';\n return new ChecklistResult(agent, model, id, status, output, override, this.verdictProblem(filePath, id, status, raw) || identityProblem);\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n return null;\n }\n }\n\n /**\n * '' when the verdict can be READ. Otherwise the complaint to show the AI verbatim.\n *\n * The MOVED `override` field is checked FIRST, ahead of `status`, because it is the more specific fact: a\n * file carrying it was written against a schema that no longer exists, and a reader told only \"status\n * must be green|yellow|red\" would fix the wrong thing. It is rejected even when EMPTY — an accepted shape\n * is never migrated, and `\"override\": \"\"` sitting in a reviewer's file is the copy that teaches the next\n * reviewer the field still exists.\n *\n * The legacy-`success` case keeps its OWN message for the same reason: `success` was removed outright\n * (no compatibility mode), and a reviewer cannot tell a wrong value from a field that no longer exists.\n */\n private verdictProblem(\n filePath: string,\n id: string,\n status: string,\n // webpieces-disable-next-line no-any-unknown -- opaque parsed JSON; only tested for key presence here\n raw: Record<string, unknown>,\n ): string {\n // The ONE renderer — see renderVerdictSchema. A second copy here is what let the old `success` shape\n // survive in print after it was removed from the parser.\n const shape = this.renderVerdictSchema(id);\n if ('override' in raw) {\n return (\n `Checklist \"${id}\" wrote its verdict with the MOVED \"override\" field. A ship-anyway ` +\n \"authorization is no longer part of a reviewer's verdict: it MOVED to its own file, \" +\n `${this.overrides.overrideFileName(id)}, which only the coordinating agent writes and only on a ` +\n 'human\\'s in-session instruction. There is no compatibility mode — DELETE the \"override\" key from ' +\n `${filePath} by resubmitting it:\\n${shape}`\n );\n }\n // webpieces-disable no-any-unknown -- comparing against the readonly literal tuple of valid colors\n if ((VERDICT_STATUSES as readonly string[]).includes(status)) return '';\n if ('success' in raw) {\n return `Checklist \"${id}\" wrote its verdict with the REMOVED \"success\" field. It is now a color ` + `\"status\" — there is no compatibility mode. Resubmit it as:\\n${shape}`;\n }\n return `Checklist \"${id}\" wrote a verdict with no valid \"status\" (got ${JSON.stringify(status)}). ` + `It must be exactly one of ${VERDICT_STATUSES.join(', ')}:\\n${shape}`;\n }\n\n // webpieces-disable no-any-unknown -- opaque parsed JSON value, narrowed to string[] here\n private asStringArray(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n // webpieces-disable no-any-unknown -- element of an opaque JSON array, narrowed by the type guard\n return value.filter((v: unknown): v is string => typeof v === 'string');\n }\n\n // Parse opaque AI-authored JSON, converting a SyntaxError into a readable InformAiError.\n // webpieces-disable no-any-unknown -- returns the opaque parsed object; loadSummaryJson narrows each field\n private parseSummaryJson(raw: string, filePath: string, expectedMainAgentInstructions = '', retryCommand = 'pnpm wp-finish-upsert-pr'): Record<string, unknown> {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: convert JSON.parse SyntaxError to an InformAiError for the AI\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- parsed JSON is opaque until narrowed by the caller\n return JSON.parse(raw) as Record<string, unknown>;\n } catch (err: unknown) {\n const error = toError(err);\n throw new InformAiError(`summary.json is not valid JSON (${error.message}).\\n\\n` + `${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}\\n\\n` + `Then re-run: ${retryCommand}`);\n }\n }\n}\n\n// Temporary migration delegators to ReviewJsonService — removed once consumers inject it.\nconst reviewJsonSvc = new ReviewJsonService();\n\n// webpieces-disable no-function-outside-class -- temporary back-compat delegator to ReviewJsonService; removed once consumers inject it\nexport function prDirFor(repoRoot: string, featureName: string): string {\n return reviewJsonSvc.prDirFor(repoRoot, featureName);\n}\n\n// webpieces-disable no-function-outside-class -- temporary back-compat delegator to ReviewJsonService; removed once consumers inject it\nexport function summaryJsonPath(repoRoot: string, featureName: string): string {\n return reviewJsonSvc.summaryJsonPath(repoRoot, featureName);\n}\n\n// webpieces-disable no-function-outside-class -- temporary back-compat delegator to ReviewJsonService; removed once consumers inject it\nexport function summaryJsonSchemaHint(filePath: string, mainAgentInstructions = ''): string {\n return reviewJsonSvc.summaryJsonSchemaHint(filePath, mainAgentInstructions);\n}\n"]}
1
+ {"version":3,"file":"review-json.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/review-json.ts"],"names":[],"mappings":";;;AAqrBA,4BAEC;AAGD,0CAEC;AAGD,sDAEC;;AAjsBD,+CAAyB;AACzB,mDAA6B;AAC7B,mCAAoC;AACpC,yCAA2D;AAC3D,8DAA0D;AAC1D,8DAAuE;AACvE,8DAA0D;AAC1D,iEAA6D;AAC7D,iFAA2E;AAC3E,uEAAkE;AAClE,uEAAkE;AAClE,6DAA6G;AAyBpG,kGAzBA,sCAAiB,OAyBA;AAAE,yGAzBA,6CAAwB,OAyBA;AAAE,yGAzBA,6CAAwB,OAyBA;AAxB9E,yDAqB4B;AAKxB,8FAzBA,gCAAa,OAyBA;AACb,+FAzBA,iCAAc,OAyBA;AACd,+FAzBA,iCAAc,OAyBA;AACd,4FAzBA,8BAAW,OAyBA;AACX,iGAzBA,mCAAgB,OAyBA;AAChB,gGAzBA,kCAAe,OAyBA;AACf,kGAzBA,oCAAiB,OAyBA;AACjB,uGAzBA,yCAAsB,OAyBA;AACtB,0FAzBA,4BAAS,OAyBA;AACT,+FAzBA,iCAAc,OAyBA;AACd,wFAzBA,0BAAO,OAyBA;AACP,wFAzBA,0BAAO,OAyBA;AACP,8FAzBA,gCAAa,OAyBA;AACb,gGAzBA,kCAAe,OAyBA;AACf,0FAzBA,4BAAS,OAyBA;AACT,wFAzBA,0BAAO,OAyBA;AACP,2FAzBA,6BAAU,OAyBA;AACV,8FAzBA,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zH,8DAA8D;QAC9D,IAAI,CAAC;YACD,yFAAyF;YACzF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAA4B,CAAC;QACtD,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,MAAM,IAAI,8BAAa,CAAC,mCAAmC,KAAK,CAAC,OAAO,QAAQ,GAAG,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,6BAA6B,CAAC,MAAM,GAAG,gBAAgB,YAAY,EAAE,CAAC,CAAC;QACtM,CAAC;IACL,CAAC;CACJ,CAAA;AA7lBY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGR,6BAAY;QACT,6CAAwB;GAH/C,iBAAiB,CA6lB7B;AAED,0FAA0F;AAC1F,MAAM,aAAa,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAE9C,wIAAwI;AACxI,SAAgB,QAAQ,CAAC,QAAgB,EAAE,WAAmB;IAC1D,OAAO,aAAa,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AACzD,CAAC;AAED,wIAAwI;AACxI,SAAgB,eAAe,CAAC,QAAgB,EAAE,WAAmB;IACjE,OAAO,aAAa,CAAC,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAChE,CAAC;AAED,wIAAwI;AACxI,SAAgB,qBAAqB,CAAC,QAAgB,EAAE,qBAAqB,GAAG,EAAE;IAC9E,OAAO,aAAa,CAAC,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { randomUUID } from 'crypto';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { PR_REVIEW_DIR } from '@webpieces/tooling-common';\nimport { DotWebpieces, dotWebpieces } from '@webpieces/tooling-common';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { toError } from '@webpieces/tooling-common/to-error';\nimport { SummaryJsonSchemaRenderer } from './summary-json-schema-renderer';\nimport { AddressedIssuesParser } from './addressed-issues-parser';\nimport { VerdictSchemaRenderer } from './verdict-schema-renderer';\nimport { ChecklistOverride, ChecklistOverrideService, checklistOverrideService } from './checklist-override';\nimport {\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_ORANGE,\n VERDICT_RED,\n VERDICT_STATUSES,\n ChecklistResult,\n RequiredChecklist,\n ChecklistReviewContext,\n PrSummary,\n AddressedIssue,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_ORANGE_FIXED,\n CK_ORANGE,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n ChecklistVerdict,\n PrContext,\n} from './review-json-data';\n\n// Re-exported so review-json.ts stays the single import site for the review vocabulary.\nexport { ChecklistOverride, ChecklistOverrideService, checklistOverrideService };\nexport {\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_ORANGE,\n VERDICT_RED,\n VERDICT_STATUSES,\n ChecklistResult,\n RequiredChecklist,\n ChecklistReviewContext,\n PrSummary,\n AddressedIssue,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_ORANGE_FIXED,\n CK_ORANGE,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n ChecklistVerdict,\n PrContext,\n};\n\nconst RISK_LEVELS = ['green', 'yellow', 'red'] as const;\nconst EMOJI_FOR_LEVEL: Record<string, string> = { green: '🟢', yellow: '🟡', red: '🔴' };\n\n// Where `wp-finish-upsert-pr` retires the summary.json it just consumed, and the note it stamps on the way.\n// The key sorts first in the written JSON because it is written first — an AI that opens the file to see\n// whether it can reuse the summary reads what the file IS before it reads a title it might be tempted to keep.\nconst OLD_SUMMARY_FILE = 'old-summary.json';\nconst ARCHIVE_NOTE_KEY = '_ARCHIVED_AUDIT_ONLY';\nconst ARCHIVE_NOTE =\n 'ARCHIVE — this is the PR summary from the PREVIOUS wp-finish-upsert-pr run on this branch, kept for audit ' +\n 'purposes only. It is NOT the summary for a new round: it describes the code as of the last PR ' +\n 'update, which has since moved. If you are updating the PR again, write a FRESH summary.json at the path ' +\n \"pnpm wp-review-upsert-pr prints; do not copy this file's title, summary or risk level forward without \" +\n 're-deciding each one. Overwritten by every finish, so only the most recent summary is ever here.';\n\n// A verdict file is named by its ROUND (issue #1053): `review-round<N>-<id>.json`, one per round, never\n// overwritten. The id is matched EXACTLY (escaped), so `review-round2-fixes.json` (the author's recorded\n// fixes for round 2) and a provenance file beside a verdict can never be read as a verdict.\nconst VERDICT_FILE_PREFIX = 'review-round';\n\n/** Locates + loads/validates the AI-authored summary.json. `@injectable(bindingScopeValues.Singleton)` so it's drawn in the design. */\n@injectable(bindingScopeValues.Singleton)\nexport class ReviewJsonService {\n constructor(\n private readonly dotDir: DotWebpieces = dotWebpieces,\n private readonly overrides: ChecklistOverrideService = checklistOverrideService,\n ) {}\n\n // The per-feature PR working dir: `<worktree>/.webpieces/pr-review/<feature>`. AI-WRITABLE scope,\n // not local() — an agent AUTHORS summary.json here, and each reviewer subagent authors its own\n // review-round<N>-<id>.json beside it. A worktree-isolated agent's Write is refused for any path under the\n // shared checkout, which is where local() puts this, so local() made both files unwritable by the\n // very agents the flow instructs to write them. See DotWebpieces.aiWritable() for the full account.\n prDirFor(repoRoot: string, featureName: string): string {\n return this.dotDir.aiWritableFile(repoRoot, PR_REVIEW_DIR, featureName);\n }\n\n // Absolute path of the summary.json for a feature — beside pr-body.md, keyed by branch name.\n summaryJsonPath(repoRoot: string, featureName: string): string {\n return path.join(this.prDirFor(repoRoot, featureName), 'summary.json');\n }\n\n // Absolute path of the pr-context.json for a feature (the diff base/head + changed files).\n prContextPath(repoRoot: string, featureName: string): string {\n return path.join(this.prDirFor(repoRoot, featureName), 'pr-context.json');\n }\n\n // Where a consumed summary.json is archived to, beside it. Always the SAME path — it holds the last\n // summary and only the last one, so it can never be mistaken for a series that means something.\n oldSummaryJsonPath(summaryJsonFilePath: string): string {\n return path.join(path.dirname(summaryJsonFilePath), OLD_SUMMARY_FILE);\n }\n\n /** Keep the active PR intent available for updates; each publication gets an immutable audit copy. */\n snapshotSummaryJson(summaryJsonFilePath: string): string {\n const dir = path.join(path.dirname(summaryJsonFilePath), 'published-summaries');\n fs.mkdirSync(dir, { recursive: true });\n const snapshot = path.join(dir, `${randomUUID()}.json`);\n const raw = fs.readFileSync(summaryJsonFilePath, 'utf8');\n const note =\n 'AUDIT ONLY — the summary used by this publication. The active PR intent is in ' +\n 'summary.json beside published-summaries. Refresh the active file when intent, issue, title or risk changes.';\n fs.writeFileSync(snapshot, this.archivedBody(raw, note), { flag: 'wx' });\n return snapshot;\n }\n\n /**\n * Retire the PR summary `wp-finish-upsert-pr` just used: move summary.json to old-summary.json, stamped\n * with a note saying what it is. Returns the archive path, or '' when there was nothing to archive.\n *\n * The point is the MOVE, not the copy. summary.json left in place after a PR is posted is a live-looking\n * file describing a PR update that already happened, and the next run of stage ② on this branch finds it\n * sitting there — so a reviewer subagent that judges the PR's stated intent (its title, summary or risk\n * level) can read the previous run's summary and return GREEN against a title that no longer exists.\n * Nothing in the verdict distinguishes that from a real pass. Moving it means the only way to reach\n * finish again is to write a fresh one, and {@link loadSummaryJson} points at the archive when it is\n * missing so the archive reads as an audit trail rather than as a lost file.\n *\n * Called only after the PR is actually up: a finish that failed before publishing must stay re-runnable.\n */\n archiveSummaryJson(summaryJsonFilePath: string): string {\n if (!fs.existsSync(summaryJsonFilePath)) return '';\n const archivePath = this.oldSummaryJsonPath(summaryJsonFilePath);\n const raw = fs.readFileSync(summaryJsonFilePath, 'utf8');\n fs.writeFileSync(archivePath, this.archivedBody(raw, ARCHIVE_NOTE));\n fs.rmSync(summaryJsonFilePath);\n return archivePath;\n }\n\n /**\n * The archived bytes: the original JSON with an AUDIT-ONLY note as its FIRST key, so anything that opens\n * the file — human or AI — reads what it is before it reads any of its content.\n *\n * Falls back to the raw bytes when they do not parse. `loadSummaryJson` has already accepted the file, so\n * that is close to impossible, but preserving the original always beats losing it to a stamping failure,\n * since the archive exists precisely to be the record.\n */\n private archivedBody(raw: string, note: string): string {\n const parsed = this.tryParseObject(raw);\n if (parsed === null) return raw;\n // webpieces-disable no-any-unknown -- re-serializing opaque review fields verbatim; only the key ORDER is ours\n const stamped: Record<string, unknown> = {};\n stamped[ARCHIVE_NOTE_KEY] = note;\n for (const key of Object.keys(parsed)) stamped[key] = parsed[key];\n return JSON.stringify(stamped, null, 2) + '\\n';\n }\n\n // webpieces-disable no-any-unknown -- opaque parsed JSON; the caller only re-serializes it\n private tryParseObject(raw: string): Record<string, unknown> | null {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: unparseable bytes are archived verbatim, never fatal\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- parsed JSON is opaque; only its key order is used\n const parsed = JSON.parse(raw) as Record<string, unknown>;\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return null;\n return parsed;\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n return null;\n }\n }\n\n /**\n * Persist the PR's diff context so reviewer subagents can read the changed-file set + the exact base\n * sha. Returns the file path written.\n *\n * ALSO writes an immutable per-stage snapshot under `stages/<stage>.json` when `stage` is given.\n * `pr-context.json` is overwritten by each stage, so by the time anything goes wrong the earlier\n * states are gone — and \"what did the tooling think the diff was at stage ①, vs ②, vs ③?\" is exactly\n * the question you need answered when debugging a review that went sideways. The snapshots make the\n * review system auditable by an AI reviewing IT, which the single mutable file never could.\n */\n writePrContext(repoRoot: string, featureName: string, context: PrContext, stage = ''): string {\n const dir = this.prDirFor(repoRoot, featureName);\n fs.mkdirSync(dir, { recursive: true });\n const body = JSON.stringify(context, null, 2) + '\\n';\n const p = this.prContextPath(repoRoot, featureName);\n fs.writeFileSync(p, body);\n if (stage !== '') {\n const stagesDir = path.join(dir, 'stages');\n fs.mkdirSync(stagesDir, { recursive: true });\n fs.writeFileSync(path.join(stagesDir, `${stage}.json`), body);\n }\n return p;\n }\n\n /**\n * The review context for a feature, recovered from the pr-context.json wp-start-upsert-pr already wrote.\n * Lets wp-finish-upsert-pr's \"you still owe me review-round<N>-<id>.json\" message inline the SAME self-sufficient\n * per-reviewer block start printed, instead of a checklist name and an indirection. Empty when the file\n * is absent or unreadable — the block then just omits those lines.\n */\n reviewContextFor(repoRoot: string, featureName: string): ChecklistReviewContext {\n const p = this.prContextPath(repoRoot, featureName);\n if (!fs.existsSync(p)) return new ChecklistReviewContext();\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: an unreadable context file degrades to fewer printed lines, never a crash\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- parsed JSON is opaque until narrowed on the next line\n const raw = JSON.parse(fs.readFileSync(p, 'utf8')) as Record<string, unknown>;\n const base = typeof raw['base'] === 'string' ? (raw['base'] as string) : '';\n // Recover the REPRODUCE command rather than re-deriving it: a context written by an older\n // pr-gate has no diffCommand, and guessing `<base> HEAD` there would resurrect the exact\n // empty-on-a-dirty-tree bug this field exists to kill. Absent ⇒ omit the line entirely.\n const cmd = typeof raw['diffCommand'] === 'string' ? (raw['diffCommand'] as string) : '';\n const diffDir = typeof raw['diffDir'] === 'string' ? (raw['diffDir'] as string) : '';\n const dirty = raw['dirty'] === true;\n return new ChecklistReviewContext(base, p, cmd === '' ? '' : `${cmd} -- <file>`, diffDir, dirty);\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n return new ChecklistReviewContext('', p);\n }\n }\n\n // Copy-paste summary.json schema shared by every command that asks the coordinating AI to write it.\n summaryJsonSchemaHint(filePath: string, mainAgentInstructions = ''): string {\n return new SummaryJsonSchemaRenderer().render(filePath, mainAgentInstructions);\n }\n\n /**\n * The extra line the \"no summary.json\" complaint carries when a PREVIOUS summary was archived here. It\n * turns a bare \"not found\" — which reads as data loss, and invites hunting for the file — into the fact:\n * the last finish consumed it, and the archive is audit material, not a summary to reuse.\n */\n private archivedSummaryHint(filePath: string, retryCommand: string): string {\n const archive = this.oldSummaryJsonPath(filePath);\n if (!fs.existsSync(archive)) return '';\n return `\\nA PREVIOUS PR summary was archived to ${archive} when the last ${retryCommand} consumed it.\\n` + `That file is for AUDIT ONLY — it describes code this branch has since moved past. Write a fresh one:`;\n }\n\n // Names summary.json when the author wrote its OLD name (review.json until #1033 — refused by Claude\n // auto-mode as Self-Approval beside the review-round<N>-<id>.json verdicts). HARD CUT: the stale file is never read.\n private renamedFileHint(filePath: string): string {\n const stale = path.join(path.dirname(filePath), 'review.json');\n if (!fs.existsSync(stale)) return '';\n return `\\n${stale} is IGNORED — the author's file was renamed to summary.json. ` + `Write the same JSON to ${filePath} instead.`;\n }\n\n /**\n * The per-checklist verdict file for ONE round, beside summary.json: `review-round<N>-<id>.json`.\n *\n * Round-numbered (issue #1053) so no round ever overwrites another. The top-level `review-<id>.json` this\n * replaced was overwritten by every submission, and a separate `rounds/<N>/` copy had to be kept in step\n * with it to recover the history: two records of one fact, and the copy was the one an agent could lose.\n */\n checklistResultPath(summaryJsonFilePath: string, checklistId: string, round: number): string {\n return path.join(path.dirname(summaryJsonFilePath), `${VERDICT_FILE_PREFIX}${round}-${checklistId}.json`);\n }\n\n /**\n * The HIGHEST round a verdict was submitted in for one checklist, or 0 when it has none. The live verdict\n * is always that one; every lower round is history. Derived from the files present, so there is no\n * counter to drift from them.\n */\n latestVerdictRound(summaryJsonFilePath: string, checklistId: string): number {\n const dir = path.dirname(summaryJsonFilePath);\n if (!fs.existsSync(dir)) return 0;\n const pattern = new RegExp(`^${VERDICT_FILE_PREFIX}(\\\\d+)-${this.escapeRegExp(checklistId)}\\\\.json$`);\n let latest = 0;\n for (const name of fs.readdirSync(dir)) {\n const match = pattern.exec(name);\n if (match !== null) latest = Math.max(latest, Number(match[1]));\n }\n return latest;\n }\n\n /** The verdict file name with the round left as `<N>`, for messages that name it before a round is known. */\n checklistResultPathTemplate(summaryJsonFilePath: string, checklistId: string): string {\n return path.join(path.dirname(summaryJsonFilePath), this.checklistFileName(checklistId));\n }\n\n /** The live (highest-round) verdict file for one checklist, or '' when none was ever submitted. */\n latestChecklistResultPath(summaryJsonFilePath: string, checklistId: string): string {\n const round = this.latestVerdictRound(summaryJsonFilePath, checklistId);\n return round === 0 ? '' : this.checklistResultPath(summaryJsonFilePath, checklistId, round);\n }\n\n private escapeRegExp(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n }\n\n /**\n * Load + validate the AI-authored summary.json. Throws InformAiError (with the schema) when missing,\n * unparseable, or structurally wrong. `required` is the set of checklists the diff matched: every one\n * must have a well-formed, passing (or overridden) review-round<N>-<id>.json or a validation error is raised\n * alongside the usual ones so the AI gets ONE message.\n */\n // webpieces-disable max-lines-new-methods -- one cohesive load+validate pass over the review fields\n loadSummaryJson(\n filePath: string, required: readonly RequiredChecklist[] = [], expectedMainAgentInstructions = '',\n orangeFixes: Record<string, string> = {},\n retryCommand = 'pnpm wp-finish-upsert-pr',\n ): PrSummary {\n const raw = this.readSummaryObject(filePath, expectedMainAgentInstructions, retryCommand);\n const errors: string[] = [];\n for (const field of ['agent', 'model']) {\n if (typeof raw[field] !== 'string' || raw[field].trim() === '') {\n errors.push(`\"${field}\" must be a non-empty string; use \"unknown\" when unavailable.`);\n }\n }\n const riskScore = raw['riskScore'];\n if (typeof riskScore !== 'number' || !Number.isFinite(riskScore) || riskScore < 0 || riskScore > 100) {\n errors.push(`\"riskScore\" must be a number 0–100, got ${JSON.stringify(riskScore)}.`);\n }\n const riskLevel = raw['riskLevel'];\n if (typeof riskLevel !== 'string' || !RISK_LEVELS.includes(riskLevel as (typeof RISK_LEVELS)[number])) {\n errors.push(`\"riskLevel\" must be one of: ${RISK_LEVELS.join(', ')}.`);\n }\n const title = typeof raw['title'] === 'string' ? (raw['title'] as string).trim() : '';\n if (title === '') {\n errors.push('\"title\" must be a non-empty, imperative PR title describing the change (no branch names).');\n }\n const mainAgentInstructions = this.validateMainAgentInstructions(raw, expectedMainAgentInstructions, errors);\n const addressesIssues = new AddressedIssuesParser().parse(raw['addressesIssues'], errors);\n\n const results = this.loadChecklistResults(filePath, required);\n for (const result of results) result.remediation = orangeFixes[result.id] ?? '';\n for (const err of this.requiredChecklistErrors(required, results, filePath)) errors.push(err);\n\n this.assertValidSummary(errors, filePath, expectedMainAgentInstructions, retryCommand);\n\n const level = riskLevel as string;\n const emoji = typeof raw['riskEmoji'] === 'string' && raw['riskEmoji'] !== '' ? (raw['riskEmoji'] as string) : (EMOJI_FOR_LEVEL[level] ?? '🟡');\n const summary = typeof raw['summary'] === 'string' ? (raw['summary'] as string) : '';\n\n return new PrSummary((raw['agent'] as string).trim(), (raw['model'] as string).trim(), title, riskScore as number, level, emoji, summary, this.asStringArray(raw['violations']), this.asStringArray(raw['risks']), this.asStringArray(raw['filesToReview']), addressesIssues, results, mainAgentInstructions);\n }\n\n private assertValidSummary(errors: string[], filePath: string, expectedMainAgentInstructions: string, retryCommand: string): void {\n if (errors.length === 0) return;\n throw new InformAiError(`summary.json has ${errors.length} error(s) — fix ALL, then re-run ${retryCommand}:\\n\\n` + errors.map((e: string): string => ` • ${e}`).join('\\n') + `\\n\\n${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}`);\n }\n\n /** Load the raw object and render every parse/shape error for the command that called us. */\n private readSummaryObject(\n filePath: string,\n expectedMainAgentInstructions: string,\n retryCommand: string,\n // webpieces-disable-next-line no-any-unknown -- opaque JSON is narrowed field-by-field by loadSummaryJson\n ): Record<string, unknown> {\n if (!fs.existsSync(filePath)) {\n throw new InformAiError(`Required summary.json not found.${this.renamedFileHint(filePath)}${this.archivedSummaryHint(filePath, retryCommand)}\\n\\n` + `${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}\\n\\n` + `Then re-run: ${retryCommand}`);\n }\n const raw = this.parseSummaryJson(fs.readFileSync(filePath, 'utf8'), filePath, expectedMainAgentInstructions, retryCommand);\n if (typeof raw === 'object' && raw !== null && !Array.isArray(raw)) return raw;\n throw new InformAiError(`summary.json must be a JSON object.\\n\\n${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}` + `\\n\\nThen re-run: ${retryCommand}`);\n }\n\n // webpieces-disable no-any-unknown -- AI-authored JSON boundary is validated before use\n private validateMainAgentInstructions(\n // webpieces-disable no-any-unknown -- opaque parsed JSON; only tested for key presence below\n raw: Record<string, unknown>,\n expected: string,\n errors: string[],\n ): string {\n const actual = typeof raw['main_agent_instructions'] === 'string' ? (raw['main_agent_instructions'] as string).trim() : '';\n if (expected !== '' && actual !== expected) errors.push('\"main_agent_instructions\" must exactly preserve the single-round instructions printed by stage ②.');\n return actual;\n }\n\n /**\n * The checklists that still OWE a verdict: no review-round<N>-<id>.json at all, a malformed one, or one whose\n * verdict is an un-overridden FAIL. This is the set every message lists — a checklist already PASSed or\n * OVERRIDDEN on this branch is deliberately NOT re-listed, because re-instructing it invites a redundant\n * second run and reads as though the earlier verdict did not count.\n */\n pendingChecklists(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): RequiredChecklist[] {\n return required.filter((req: RequiredChecklist): boolean => {\n const status = this.resolveVerdict(req, results).status;\n // CK_WARN must be listed here beside PASS/OVERRIDDEN. A yellow verdict SHIPS — leaving it out\n // would mark the checklist owed forever, so `outstanding` never empties and the PR is refused\n // permanently no matter how many times the reviewer runs.\n return status !== CK_PASS && status !== CK_WARN && status !== CK_OVERRIDDEN && status !== CK_ORANGE_FIXED;\n });\n }\n\n /**\n * The checklists whose latest verdict is ORANGE with no recorded author fix (issue #1053): a final-round\n * must-fix. A strict subset of {@link pendingChecklists}, split out because its cure is neither a\n * reviewer nor an override: the author fixes the code and records it with `wp-write-review-fixes`.\n */\n orangeChecklists(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): RequiredChecklist[] {\n return required.filter((req: RequiredChecklist): boolean => this.resolveVerdict(req, results).status === CK_ORANGE);\n }\n\n /**\n * THE renderer for \"this final-round reviewer marked ORANGE\": the finding verbatim, then the ONE way past\n * it. There is no re-review to ask for: the round cap is spent, and an orange is the reviewer saying so.\n */\n orangeError(req: RequiredChecklist, verdict: ChecklistVerdict): string {\n const finding = `${verdict.detail.split('\\n').join('\\n ')}\\n`;\n return `Checklist \"${req.id}\" is ORANGE — a final-round MUST-FIX that is never re-reviewed. The reviewer (${req.reviewer.agentName}) wrote:\\n `\n + finding\n + ' Fix it in the code, best effort, and commit the fix. Then record it with pnpm wp-write-review-fixes\\n'\n + ` (one response {checklistId: \"${req.id}\", resolution, files}) and re-run. Do NOT spawn a reviewer for it:\\n`\n + ' that was the last review round, and no further verdict can be recorded.\\n';\n }\n\n /**\n * The OPTIONAL checklists (`required: false`) that matched the diff but have no verdict file at all.\n *\n * This is the ONE set that separates \"nobody ran it\" from \"it failed\", and the distinction is the whole\n * feature: an optional checklist with no verdict was legitimately not run — the human declined it — so\n * it must NOT block. An optional checklist with a RED verdict is not in\n * here (it resolves to CK_FAIL) and blocks exactly like a required one: choosing to run a reviewer and\n * then ignoring its answer would make the whole thing theater.\n *\n * A strict subset of {@link pendingChecklists}, computed here rather than at each call site so the\n * command that gates and the dashboard that reports cannot disagree about which checklists were skipped.\n */\n optionalWithoutVerdict(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): RequiredChecklist[] {\n return required.filter((req: RequiredChecklist): boolean => !req.required && this.resolveVerdict(req, results).status === CK_MISSING);\n }\n\n /**\n * The checklists that REFUSED: a reviewer ran, judged the change, and said no (CK_FAIL — status red with\n * no override). A strict subset of {@link pendingChecklists}, split out because it demands a completely\n * different action from the reader.\n *\n * Public so every command agrees on the set. When \"refused\" was computed ad hoc, a refusal and a\n * never-ran reviewer landed in one bucket and produced one message — \"you MUST run these N reviewer\n * subagent(s)\" — handed to an AI, which obediently re-spawned a reviewer that had already answered. It\n * refused again for the same reason, and the loop cost a full subagent run per pass while the reviewer's\n * actual finding was never shown to anyone. A refusal is a RESULT, not a missing step.\n */\n refusedChecklists(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): RequiredChecklist[] {\n return required.filter((req: RequiredChecklist): boolean => this.resolveVerdict(req, results).status === CK_FAIL);\n }\n\n /**\n * THE renderer for \"this reviewer refused\" — one wording, wherever the refusal surfaces. It exists as a\n * method because the text was previously inlined in {@link requiredChecklistErrors}, reachable only\n * through summary.json validation, while the command layer refused earlier with its own generic message.\n * Two messages for one event is how the useful one became unreachable; there is now exactly one.\n *\n * It always quotes the reviewer's own `output` verbatim: the finding is the whole point, and an error\n * that names a checklist without saying what it objected to gives the reader nothing to fix.\n *\n * IT NAMES THE WRITER, which is the half that was missing. The old text said WHAT to write (\"set a\n * non-empty override\") and WHERE, but never WHO MAY — so the only reachable move was an agent editing a\n * reviewer's verdict file in place, which the harness denies, which is how a human ended up hand-editing\n * JSON. The ship-anyway route is now a SEPARATE file the coordinating agent may write, and the command\n * that writes it is printed ready to run. See {@link ChecklistOverrideService.writerRule}.\n *\n * A red verdict is never moved or deleted (issue #1053): the next round's verdict is a NEW file,\n * `review-round<N+1>-<id>.json`, and the gate reads the highest round, so the refusal stays on disk as the\n * record of what was found.\n */\n refusalError(req: RequiredChecklist, verdict: ChecklistVerdict, summaryJsonFilePath: string): string {\n const finding = `${verdict.detail.split('\\n').join('\\n ')}\\n`;\n const head = `Checklist \"${req.id}\" FAILED review (status:\"${VERDICT_RED}\"). The reviewer (${req.reviewer.agentName}) wrote:\\n ` + finding;\n return head + ' Fix it, commit the fix, record it with pnpm wp-write-review-fixes, then re-run pnpm wp-review-upsert-pr.\\n'\n + this.overrideRoute(req, summaryJsonFilePath);\n }\n\n /**\n * The ship-anyway paragraph: who may authorize, and the exact command that records it.\n *\n * Its own method because every refusal surface must say the identical thing about who may write an\n * override. A second copy of this paragraph is precisely how the previous one drifted into naming a\n * command that had since been deleted.\n */\n private overrideRoute(req: RequiredChecklist, summaryJsonFilePath: string): string {\n return (\n ` To SHIP ANYWAY a human must decide it, and the decision is recorded in its own file — ` +\n `${this.overrides.overrideFileName(req.id)}, never inside the reviewer's verdict.\\n` +\n ` ${this.overrides.writerRule()}\\n` +\n ' Run exactly this, replacing only the \"reason\" with what the human actually said:\\n\\n' +\n `${this.overrides.writeCommand(summaryJsonFilePath, req.id)}\\n`\n );\n }\n\n // Read the LIVE verdict per required checklist: its highest-round `review-round<N>-<id>.json` beside\n // summary.json (issue #1053). A checklist with no verdict file is simply absent from the result (→ MISSING);\n // a malformed one is skipped. The id is matched exactly (see latestVerdictRound), so neither the author's\n // `review-round<N>-fixes.json` nor a provenance file can ever resolve as a verdict.\n loadChecklistResults(summaryJsonFilePath: string, required: readonly RequiredChecklist[]): ChecklistResult[] {\n const results: ChecklistResult[] = [];\n for (const req of required) {\n const round = this.latestVerdictRound(summaryJsonFilePath, req.id);\n if (round === 0) continue;\n const p = this.checklistResultPath(summaryJsonFilePath, req.id, round);\n // The human's authorization is read from its OWN file beside the verdict, in the same pass, so\n // resolveVerdict never touches disk and every command resolves one outcome from one read.\n const parsed = this.parseChecklistResult(p, req.id, this.overrides.load(summaryJsonFilePath, req.id));\n if (parsed === null) continue;\n parsed.round = round;\n results.push(parsed);\n }\n return results;\n }\n\n // Resolve ONE checklist's verdict from its review-round<N>-<id>.json. Central so summary.json enforcement AND the\n // finish-command dashboard agree on the outcome. `problem` is checked FIRST: a file whose verdict cannot\n // be read must not fall through to any shipping outcome.\n resolveVerdict(req: RequiredChecklist, results: readonly ChecklistResult[]): ChecklistVerdict {\n const result = results.find((r: ChecklistResult): boolean => r.id === req.id);\n if (!result) return new ChecklistVerdict(req.id, CK_MISSING, '');\n if (result.problem !== '') return new ChecklistVerdict(req.id, CK_BAD_FORMAT, result.problem);\n if (result.status === VERDICT_GREEN) return new ChecklistVerdict(req.id, CK_PASS, result.output);\n if (result.status === VERDICT_YELLOW) return new ChecklistVerdict(req.id, CK_WARN, result.output);\n // An ORANGE ships once the author has recorded a fix for it, and ONLY that way: it is the final\n // round's must-fix, so there is no re-review to wait for and no override to hunt (issue #1053).\n if (result.status === VERDICT_ORANGE) {\n return result.remediation !== ''\n ? new ChecklistVerdict(req.id, CK_ORANGE_FIXED, result.remediation)\n : new ChecklistVerdict(req.id, CK_ORANGE, result.output);\n }\n const override = result.override;\n // A malformed authorization is reported as a FORMAT problem, never treated as one: an override with\n // no stated reason authorizes nothing, and silently ignoring it would tell the reader their decision\n // was not recorded without ever saying why.\n if (override !== null && override.problem !== '') return new ChecklistVerdict(req.id, CK_BAD_FORMAT, override.problem);\n if (override !== null) return new ChecklistVerdict(req.id, CK_OVERRIDDEN, this.overrides.detail(override));\n return new ChecklistVerdict(req.id, CK_FAIL, result.output);\n }\n\n /**\n * One loud complaint per checklist whose verdict file EXISTS but cannot be read as a verdict — almost\n * always one still using the removed `success` field. Public and separate from\n * {@link requiredChecklistErrors} because `wp-finish-upsert-pr` refuses on missing reviewers BEFORE it\n * parses summary.json: without this, a legacy file would surface as the generic \"no verdict yet\" block\n * and the AI would re-run a reviewer that already ran instead of fixing four characters of JSON.\n */\n checklistFormatErrors(required: readonly RequiredChecklist[], results: readonly ChecklistResult[]): string[] {\n const errors: string[] = [];\n for (const req of required) {\n const verdict = this.resolveVerdict(req, results);\n if (verdict.status === CK_BAD_FORMAT) errors.push(verdict.detail);\n }\n return errors;\n }\n\n // Every matched checklist whose verdict is FAIL (reviewed, found a problem, no override) or MISSING (no\n // review-round<N>-<id>.json written) → one error each, printing the reviewer's `output` verbatim.\n private requiredChecklistErrors(required: readonly RequiredChecklist[], results: readonly ChecklistResult[], filePath: string): string[] {\n // Format complaints come from the ONE renderer, so wp-review-upsert-pr and wp-finish word them identically.\n const errors: string[] = this.checklistFormatErrors(required, results);\n for (const req of required) {\n const verdict = this.resolveVerdict(req, results);\n // CK_WARN ('yellow' — passed with concerns) is deliberately absent from this chain: it SHIPS.\n // The concern still reaches the PR, published in the checklist comment. Do not \"fix\" this.\n if (verdict.status === CK_FAIL) {\n // Through the ONE renderer, so this path and the command layer's refusal say the same thing.\n errors.push(this.refusalError(req, verdict, filePath));\n } else if (verdict.status === CK_ORANGE) {\n errors.push(this.orangeError(req, verdict));\n } else if (verdict.status === CK_MISSING) {\n // An OPTIONAL checklist with no verdict was legitimately not run — the human was offered it\n // and declined. Demanding it here would make\n // `required: false` mean nothing. Note the CK_FAIL branch above deliberately has no such\n // exemption: once an optional reviewer RUNS, its refusal counts.\n if (!req.required) continue;\n const doc = req.doc.trim() !== '' ? ` Read: ${req.doc}.` : '';\n errors.push(`Checklist \"${req.id}\" MATCHED this diff but has no verdict. Spawn the \"${req.reviewer.agentName}\" subagent to review it; ` + `IT submits the verdict with ${this.submitCommand(req.id)} — nobody writes ${this.checklistFileName(req.id)} by hand.${doc}`);\n }\n }\n return errors;\n }\n\n private checklistFileName(checklistId: string): string {\n return `${VERDICT_FILE_PREFIX}<N>-${checklistId}.json`;\n }\n\n /**\n * THE renderer for a reviewer's verdict schema — with the reviewer's own `id` already filled in.\n *\n * There is one because a verdict schema that lives anywhere a human maintains it goes stale, and a\n * reviewer follows the stale copy. That is not a hypothetical: when `success` was replaced by the\n * tri-state `status`, hand-written `.claude/agents/*.md` files kept documenting `success`, and a real\n * PR had to carry \"the verdict format in your own agent .md file is OUT OF DATE\" in the spawn prompt to\n * work around it. Every printed copy — the stage-② roster, the generated per-reviewer instructions\n * file, and the complaint raised against a malformed verdict — now comes from here. It ends with the\n * ONE way a verdict is submitted (`wp-write-review`, issue #863), never a file path to write.\n */\n renderVerdictSchema(id: string, indent = ' '): string {\n return new VerdictSchemaRenderer().render(id, indent);\n }\n\n /** THE command that submits one checklist's verdict (issue #863) — see VerdictSchemaRenderer. */\n submitCommand(id: string): string {\n return new VerdictSchemaRenderer().submitCommand(id);\n }\n\n // Unreadable objects retain their format complaint; absent/unparseable verdicts return null.\n // webpieces-disable no-any-unknown -- opaque parsed JSON, narrowed field-by-field\n private parseChecklistResult(filePath: string, id: string, override: ChecklistOverride | null): ChecklistResult | null {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: an unparseable per-checklist file is skipped, not fatal\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- parsed JSON is opaque until narrowed below\n const raw = JSON.parse(fs.readFileSync(filePath, 'utf8')) as Record<string, unknown>;\n if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) return null;\n const output = typeof raw['output'] === 'string' ? (raw['output'] as string) : '';\n const status = typeof raw['status'] === 'string' ? (raw['status'] as string).trim().toLowerCase() : '';\n const agent = typeof raw['agent'] === 'string' ? raw['agent'].trim() : '';\n const model = typeof raw['model'] === 'string' ? raw['model'].trim() : '';\n const identityProblem = agent === '' || model === '' ? 'Both \"agent\" and \"model\" must be non-empty strings; use \"unknown\" when unavailable.' : '';\n return new ChecklistResult(agent, model, id, status, output, override, this.verdictProblem(filePath, id, status, raw) || identityProblem);\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n return null;\n }\n }\n\n /**\n * '' when the verdict can be READ. Otherwise the complaint to show the AI verbatim.\n *\n * The MOVED `override` field is checked FIRST, ahead of `status`, because it is the more specific fact: a\n * file carrying it was written against a schema that no longer exists, and a reader told only \"status\n * must be green|yellow|red\" would fix the wrong thing. It is rejected even when EMPTY — an accepted shape\n * is never migrated, and `\"override\": \"\"` sitting in a reviewer's file is the copy that teaches the next\n * reviewer the field still exists.\n *\n * The legacy-`success` case keeps its OWN message for the same reason: `success` was removed outright\n * (no compatibility mode), and a reviewer cannot tell a wrong value from a field that no longer exists.\n */\n private verdictProblem(\n filePath: string,\n id: string,\n status: string,\n // webpieces-disable-next-line no-any-unknown -- opaque parsed JSON; only tested for key presence here\n raw: Record<string, unknown>,\n ): string {\n // The ONE renderer — see renderVerdictSchema. A second copy here is what let the old `success` shape\n // survive in print after it was removed from the parser.\n const shape = this.renderVerdictSchema(id);\n if ('override' in raw) {\n return (\n `Checklist \"${id}\" wrote its verdict with the MOVED \"override\" field. A ship-anyway ` +\n \"authorization is no longer part of a reviewer's verdict: it MOVED to its own file, \" +\n `${this.overrides.overrideFileName(id)}, which only the coordinating agent writes and only on a ` +\n 'human\\'s in-session instruction. There is no compatibility mode — DELETE the \"override\" key from ' +\n `${filePath} by resubmitting it:\\n${shape}`\n );\n }\n // webpieces-disable no-any-unknown -- comparing against the readonly literal tuple of valid colors\n if ((VERDICT_STATUSES as readonly string[]).includes(status)) return '';\n if ('success' in raw) {\n return `Checklist \"${id}\" wrote its verdict with the REMOVED \"success\" field. It is now a color ` + `\"status\" — there is no compatibility mode. Resubmit it as:\\n${shape}`;\n }\n return `Checklist \"${id}\" wrote a verdict with no valid \"status\" (got ${JSON.stringify(status)}). ` + `It must be exactly one of ${VERDICT_STATUSES.join(', ')}:\\n${shape}`;\n }\n\n // webpieces-disable no-any-unknown -- opaque parsed JSON value, narrowed to string[] here\n private asStringArray(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n // webpieces-disable no-any-unknown -- element of an opaque JSON array, narrowed by the type guard\n return value.filter((v: unknown): v is string => typeof v === 'string');\n }\n\n // Parse opaque AI-authored JSON, converting a SyntaxError into a readable InformAiError.\n // webpieces-disable no-any-unknown -- returns the opaque parsed object; loadSummaryJson narrows each field\n private parseSummaryJson(raw: string, filePath: string, expectedMainAgentInstructions = '', retryCommand = 'pnpm wp-finish-upsert-pr'): Record<string, unknown> {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: convert JSON.parse SyntaxError to an InformAiError for the AI\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- parsed JSON is opaque until narrowed by the caller\n return JSON.parse(raw) as Record<string, unknown>;\n } catch (err: unknown) {\n const error = toError(err);\n throw new InformAiError(`summary.json is not valid JSON (${error.message}).\\n\\n` + `${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}\\n\\n` + `Then re-run: ${retryCommand}`);\n }\n }\n}\n\n// Temporary migration delegators to ReviewJsonService — removed once consumers inject it.\nconst reviewJsonSvc = new ReviewJsonService();\n\n// webpieces-disable no-function-outside-class -- temporary back-compat delegator to ReviewJsonService; removed once consumers inject it\nexport function prDirFor(repoRoot: string, featureName: string): string {\n return reviewJsonSvc.prDirFor(repoRoot, featureName);\n}\n\n// webpieces-disable no-function-outside-class -- temporary back-compat delegator to ReviewJsonService; removed once consumers inject it\nexport function summaryJsonPath(repoRoot: string, featureName: string): string {\n return reviewJsonSvc.summaryJsonPath(repoRoot, featureName);\n}\n\n// webpieces-disable no-function-outside-class -- temporary back-compat delegator to ReviewJsonService; removed once consumers inject it\nexport function summaryJsonSchemaHint(filePath: string, mainAgentInstructions = ''): string {\n return reviewJsonSvc.summaryJsonSchemaHint(filePath, mainAgentInstructions);\n}\n"]}
@@ -14,7 +14,11 @@ class SummaryJsonSchemaRenderer {
14
14
  ' "model": "opus | sonnet | actual readable model name | unknown",\n' +
15
15
  ' "riskScore": 0, // integer 0–100 (higher = riskier)\n' +
16
16
  ' "riskLevel": "green | yellow | red",\n' +
17
- ' "summary": "5–10 sentence PR summary — what changed and why",\n' +
17
+ ' "summary": "5–10 sentence PR summary — what changed and why (no Fixes/Closes/Resolves #N here: tickets go in addressesIssues)",\n' +
18
+ ' "addressesIssues": [ // REQUIRED; [] when the PR addresses no tracked issue\n' +
19
+ ' { "url": "https://github.com/<owner>/<repo>/issues/<n>", "closesIssue": true }\n' +
20
+ ' ], // url: any tracker, absolute https://. closesIssue (required, no default):\n' +
21
+ ' // true → "Fixes <url>" — merging CLOSES it; false → "Part of <url>" — stays open\n' +
18
22
  ' "violations": ["pattern/architecture violations you found (empty array if none)"],\n' +
19
23
  ' "risks": ["notable risks (empty array if none)"],\n' +
20
24
  ` "filesToReview": ["paths a human should look at (empty array if none)"]${instructions}\n` +
@@ -1 +1 @@
1
- {"version":3,"file":"summary-json-schema-renderer.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/summary-json-schema-renderer.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACnF,MAAa,yBAAyB;IAClC,MAAM,CAAC,QAAgB,EAAE,qBAAqB,GAAG,EAAE;QAC/C,MAAM,YAAY,GAAG,qBAAqB,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE;YAClD,CAAC,CAAC,mCAAmC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC;QACnF,OAAO,CACH,+BAA+B,QAAQ,MAAM;YAC7C,+EAA+E;YAC/E,KAAK;YACL,sFAAsF;YACtF,0CAA0C;YAC1C,sEAAsE;YACtE,+EAA+E;YAC/E,0CAA0C;YAC1C,mEAAmE;YACnE,wFAAwF;YACxF,uDAAuD;YACvD,4EAA4E,YAAY,IAAI;YAC5F,GAAG,CACN,CAAC;IACN,CAAC;CACJ;AApBD,8DAoBC","sourcesContent":["/** Pure renderer for the AI-authored summary.json shape printed by the PR gate. */\nexport class SummaryJsonSchemaRenderer {\n render(filePath: string, mainAgentInstructions = ''): string {\n const instructions = mainAgentInstructions === '' ? ''\n : `,\\n \"main_agent_instructions\": ${JSON.stringify(mainAgentInstructions)}\\n`;\n return (\n `Write the PR summary to:\\n ${filePath}\\n\\n` +\n 'with this exact JSON shape (riskEmoji optional — derived from riskLevel):\\n\\n' +\n '{\\n' +\n ' \"title\": \"concise PR title describing the change (imperative, no branch names)\",\\n' +\n ' \"agent\": \"claude | codex | unknown\",\\n' +\n ' \"model\": \"opus | sonnet | actual readable model name | unknown\",\\n' +\n ' \"riskScore\": 0, // integer 0–100 (higher = riskier)\\n' +\n ' \"riskLevel\": \"green | yellow | red\",\\n' +\n ' \"summary\": \"5–10 sentence PR summary — what changed and why\",\\n' +\n ' \"violations\": [\"pattern/architecture violations you found (empty array if none)\"],\\n' +\n ' \"risks\": [\"notable risks (empty array if none)\"],\\n' +\n ` \"filesToReview\": [\"paths a human should look at (empty array if none)\"]${instructions}\\n` +\n '}'\n );\n }\n}\n"]}
1
+ {"version":3,"file":"summary-json-schema-renderer.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/summary-json-schema-renderer.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACnF,MAAa,yBAAyB;IAClC,MAAM,CAAC,QAAgB,EAAE,qBAAqB,GAAG,EAAE;QAC/C,MAAM,YAAY,GAAG,qBAAqB,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE;YAClD,CAAC,CAAC,mCAAmC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC;QACnF,OAAO,CACH,+BAA+B,QAAQ,MAAM;YAC7C,+EAA+E;YAC/E,KAAK;YACL,sFAAsF;YACtF,0CAA0C;YAC1C,sEAAsE;YACtE,+EAA+E;YAC/E,0CAA0C;YAC1C,qIAAqI;YACrI,kGAAkG;YAClG,sFAAsF;YACtF,uHAAuH;YACvH,+HAA+H;YAC/H,wFAAwF;YACxF,uDAAuD;YACvD,4EAA4E,YAAY,IAAI;YAC5F,GAAG,CACN,CAAC;IACN,CAAC;CACJ;AAxBD,8DAwBC","sourcesContent":["/** Pure renderer for the AI-authored summary.json shape printed by the PR gate. */\nexport class SummaryJsonSchemaRenderer {\n render(filePath: string, mainAgentInstructions = ''): string {\n const instructions = mainAgentInstructions === '' ? ''\n : `,\\n \"main_agent_instructions\": ${JSON.stringify(mainAgentInstructions)}\\n`;\n return (\n `Write the PR summary to:\\n ${filePath}\\n\\n` +\n 'with this exact JSON shape (riskEmoji optional — derived from riskLevel):\\n\\n' +\n '{\\n' +\n ' \"title\": \"concise PR title describing the change (imperative, no branch names)\",\\n' +\n ' \"agent\": \"claude | codex | unknown\",\\n' +\n ' \"model\": \"opus | sonnet | actual readable model name | unknown\",\\n' +\n ' \"riskScore\": 0, // integer 0–100 (higher = riskier)\\n' +\n ' \"riskLevel\": \"green | yellow | red\",\\n' +\n ' \"summary\": \"5–10 sentence PR summary — what changed and why (no Fixes/Closes/Resolves #N here: tickets go in addressesIssues)\",\\n' +\n ' \"addressesIssues\": [ // REQUIRED; [] when the PR addresses no tracked issue\\n' +\n ' { \"url\": \"https://github.com/<owner>/<repo>/issues/<n>\", \"closesIssue\": true }\\n' +\n ' ], // url: any tracker, absolute https://. closesIssue (required, no default):\\n' +\n ' // true → \"Fixes <url>\" — merging CLOSES it; false → \"Part of <url>\" — stays open\\n' +\n ' \"violations\": [\"pattern/architecture violations you found (empty array if none)\"],\\n' +\n ' \"risks\": [\"notable risks (empty array if none)\"],\\n' +\n ` \"filesToReview\": [\"paths a human should look at (empty array if none)\"]${instructions}\\n` +\n '}'\n );\n }\n}\n"]}
@@ -259,7 +259,8 @@ snapshots are never loaded as active summaries; a new PR requires its own author
259
259
  still happens and the archive/reap half is skipped out loud rather than tagging the wrong objects.
260
260
 
261
261
  **The commit body is the PR DESCRIPTION**, which stage ③ writes as one compact string (PR link, risk,
262
- non-green flags, short summary, build-command footer) and reuses verbatim as its `--body-file`. The
262
+ non-green flags, short summary, the `Fixes <url>` / `Part of <url>` lines from summary.json's
263
+ `addressesIssues`, build-command footer) and reuses verbatim as its `--body-file`. The
263
264
  full dashboard and the reviewer output live in the PR's 1st and 2nd comments so they stay out of
264
265
  `git log`. This command, a bare `gh pr merge`, and the GitHub Merge button therefore all produce
265
266
  identical history — prefer this one for the archiving and worktree cleanup, not because the others are
@@ -293,12 +293,30 @@ review must not read as a fully-reviewed one.
293
293
  "riskScore": 0,
294
294
  "riskLevel": "green | yellow | red",
295
295
  "summary": "5–10 sentence PR summary — what changed and why",
296
+ "addressesIssues": [
297
+ { "url": "https://github.com/<owner>/<repo>/issues/<n>", "closesIssue": true }
298
+ ],
296
299
  "violations": ["pattern/architecture violations (empty array if none)"],
297
300
  "risks": ["notable risks (empty array if none)"],
298
301
  "filesToReview": ["paths a human should look at (empty array if none)"]
299
302
  }
300
303
  ```
301
304
 
305
+ `addressesIssues` is REQUIRED — `[]` when the PR addresses no tracked issue. Each entry needs both
306
+ fields, with no default: `url` is the issue's absolute `https://` URL in any tracker (GitHub, Linear,
307
+ Jira), and `closesIssue` says whether merging should close it. The gate renders each entry into the PR
308
+ body, which is also the squash-commit body:
309
+
310
+ | `closesIssue` | rendered line | on merge |
311
+ |---|---|---|
312
+ | `true` | `Fixes <url>` | the issue is CLOSED; finish prints `⚠ Merging this PR will CLOSE <url> (closesIssue: true)` |
313
+ | `false` | `Part of <url>` | linked, left open — for a ticket more PRs are still owed on |
314
+
315
+ Keep closing keywords out of `summary`. Any `close/closes/closed`, `fix/fixes/fixed` or
316
+ `resolve/resolves/resolved` followed by `#N`, `owner/repo#N` or a URL that no `closesIssue: true` entry
317
+ backs REFUSES finish — "Partially fixes #N" still closes #N on GitHub, which is how a four-PR ticket got
318
+ closed by its first PR. Re-running finish re-renders the one block; it never appends a second.
319
+
302
320
  Then run `pnpm wp-finish-upsert-pr`. It re-computes the matched checklists, requires a well-formed,
303
321
  passing (or overridden, or author-fixed orange) verdict for each briefed checklist — its highest
304
322
  `review-round<N>-<id>.json`, submitted through `wp-write-review` and unedited — verifies a reviewer subagent