@webpieces/rules-config 0.4.945 → 0.4.947

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.945",
3
+ "version": "0.4.947",
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.945",
23
- "@webpieces/repo-workflow-core": "0.4.945",
24
- "@webpieces/rules-sdk": "0.4.945"
22
+ "@webpieces/tooling-common": "0.4.947",
23
+ "@webpieces/repo-workflow-core": "0.4.947",
24
+ "@webpieces/rules-sdk": "0.4.947"
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.945"
37
+ "@webpieces/tooling-testkit": "0.4.947"
38
38
  },
39
39
  "types": "./src/index.d.ts",
40
40
  "bin": {
package/src/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';
2
2
  export { RuleFailError, renderRuleFailForAi, renderRuleFailForHuman } from './rule-fail-error';
3
3
  export { Option, formatFixOptions } from './fix-option';
4
+ export { TurnOffRuleCure, LAST_RESORT_TURN_OFF_SECONDS } from './turn-off-rule-cure';
4
5
  export { CliExitError } from './cli-exit-error';
5
6
  export { CliUsage, CliFlag, CliArgSet, CliArgsCheck, CliArgs } from './cli-args';
6
7
  export { runMain } from './run-main';
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RuleFileExclusions = exports.RuleFileScope = exports.globMatches = exports.matchesAnyGlob = exports.isPathExcluded = exports.isWebpiecesStateDir = exports.ExcludePaths = exports.DESIGN_METADATA_KEYS = exports.isDocumentDesign = exports.DocumentDesign = exports.RulesConfigDesign = exports.atRoot = exports.CLAUDE_PROJECT_DIR_UNSET = exports.CLAUDE_PROJECT_DIR_ENV = exports.claudeEnv = exports.ClaudeEnv = exports.RETENTION_DAYS = exports.SweepCount = exports.AgedTreeSweeper = exports.INSTRUCT_AI_LEAF = exports.INSTRUCT_AI_DIR = exports.RepoRootFinder = exports.RawConfigFile = exports.CONFIG_PARSE_RETRY_MILLIS = exports.CONFIG_PARSE_ATTEMPTS = exports.ConfigParseAttempt = exports.ConfigFile = exports.CONFIG_FILENAME = exports.findConfigFile = exports.RETIRED_TOP_LEVEL_MARKER = exports.RETIRED_KEY_MARKER = exports.CONFIG_POLICY_DOC = exports.formatConfigErrorsBanner = exports.ConfigLoader = exports.LoadedConfig = exports.loadAndValidate = exports.runMain = exports.CliArgs = exports.CliArgsCheck = exports.CliArgSet = exports.CliFlag = exports.CliUsage = exports.CliExitError = exports.formatFixOptions = exports.Option = exports.renderRuleFailForHuman = exports.renderRuleFailForAi = exports.RuleFailError = exports.ResolvedRuleConfig = exports.ResolvedConfig = void 0;
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
- 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
- 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.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;
3
+ exports.globMatches = exports.matchesAnyGlob = exports.isPathExcluded = exports.isWebpiecesStateDir = exports.ExcludePaths = exports.DESIGN_METADATA_KEYS = exports.isDocumentDesign = exports.DocumentDesign = exports.RulesConfigDesign = exports.atRoot = exports.CLAUDE_PROJECT_DIR_UNSET = exports.CLAUDE_PROJECT_DIR_ENV = exports.claudeEnv = exports.ClaudeEnv = exports.RETENTION_DAYS = exports.SweepCount = exports.AgedTreeSweeper = exports.INSTRUCT_AI_LEAF = exports.INSTRUCT_AI_DIR = exports.RepoRootFinder = exports.RawConfigFile = exports.CONFIG_PARSE_RETRY_MILLIS = exports.CONFIG_PARSE_ATTEMPTS = exports.ConfigParseAttempt = exports.ConfigFile = exports.CONFIG_FILENAME = exports.findConfigFile = exports.RETIRED_TOP_LEVEL_MARKER = exports.RETIRED_KEY_MARKER = exports.CONFIG_POLICY_DOC = exports.formatConfigErrorsBanner = exports.ConfigLoader = exports.LoadedConfig = exports.loadAndValidate = exports.runMain = exports.CliArgs = exports.CliArgsCheck = exports.CliArgSet = exports.CliFlag = exports.CliUsage = exports.CliExitError = exports.LAST_RESORT_TURN_OFF_SECONDS = exports.TurnOffRuleCure = exports.formatFixOptions = exports.Option = exports.renderRuleFailForHuman = exports.renderRuleFailForAi = exports.RuleFailError = exports.ResolvedRuleConfig = exports.ResolvedConfig = void 0;
4
+ 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 = exports.RuleFileExclusions = exports.RuleFileScope = void 0;
5
+ 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 = exports.HOME_EXPERIMENTAL_SECTION = exports.HOME_CONFIG_FILE = void 0;
6
+ 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 = exports.getFileDiff = exports.getChangedFiles = void 0;
7
+ 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 = exports.ChecklistValidator = exports.formatFileList = 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 = exports.RequiredChecklist = exports.VERDICT_STATUSES = 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; } });
@@ -19,6 +19,9 @@ Object.defineProperty(exports, "renderRuleFailForHuman", { enumerable: true, get
19
19
  var fix_option_1 = require("./fix-option");
20
20
  Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return fix_option_1.Option; } });
21
21
  Object.defineProperty(exports, "formatFixOptions", { enumerable: true, get: function () { return fix_option_1.formatFixOptions; } });
22
+ var turn_off_rule_cure_1 = require("./turn-off-rule-cure");
23
+ Object.defineProperty(exports, "TurnOffRuleCure", { enumerable: true, get: function () { return turn_off_rule_cure_1.TurnOffRuleCure; } });
24
+ Object.defineProperty(exports, "LAST_RESORT_TURN_OFF_SECONDS", { enumerable: true, get: function () { return turn_off_rule_cure_1.LAST_RESORT_TURN_OFF_SECONDS; } });
22
25
  var cli_exit_error_1 = require("./cli-exit-error");
23
26
  Object.defineProperty(exports, "CliExitError", { enumerable: true, get: function () { return cli_exit_error_1.CliExitError; } });
24
27
  var cli_args_1 = require("./cli-args");
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"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A,eAAe,OAAA;AAC1D,yDAAwE;AAA/D,oHAAA,eAAe,OAAA;AAAE,qHAAA,gBAAgB,OAAA;AAC1C,yDAI6B;AAHzB,sHAAA,iBAAiB,OAAA;AACjB,+HAAA,0BAA0B,OAAA;AAC1B,uHAAA,kBAAkB,OAAA;AAGtB,6DAAmC;AACnC,oEAA0C;AAC1C,2DAK8B;AAJ1B,sHAAA,gBAAgB,OAAA;AAChB,8HAAA,wBAAwB,OAAA;AACxB,uHAAA,iBAAiB,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"]}
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,2DAAqF;AAA5E,qHAAA,eAAe,OAAA;AAAE,kIAAA,4BAA4B,OAAA;AACtD,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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nB,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 { TurnOffRuleCure, LAST_RESORT_TURN_OFF_SECONDS } from './turn-off-rule-cure';\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"]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PolicyFieldConstraints = exports.MAX_TURN_OFF_EPOCH_DAYS = void 0;
4
+ const turn_off_rule_cure_1 = require("./turn-off-rule-cure");
4
5
  exports.MAX_TURN_OFF_EPOCH_DAYS = 7;
5
6
  /** Generic consumer-field constraints are shared by owner files and client-authored match rules. */
6
7
  class PolicyFieldConstraints {
@@ -10,12 +11,12 @@ class PolicyFieldConstraints {
10
11
  return null;
11
12
  const daysOut = Math.round((value - Date.now() / 1000) / (24 * 60 * 60));
12
13
  const maxDate = new Date(maxEpoch * 1000).toISOString().split('T')[0];
14
+ const cure = new turn_off_rule_cure_1.TurnOffRuleCure();
13
15
  return (`${label} "turnOffRuleUntilEpoch": ${value} is ${daysOut} days in the future — the maximum is ` +
14
16
  `${exports.MAX_TURN_OFF_EPOCH_DAYS} days. A rule switched off for longer than that is off for work nobody ` +
15
17
  `had in mind when it was written, because this hatch is REPO-WIDE while it lasts.\n` +
16
- ` CURE: set it to at most ${maxEpoch} (${maxDate}), then re-set it WEEKLY for as long as you ` +
17
- `still need it — that renewal is the intended workflow, not a workaround. If the rule is off for ` +
18
- `ONE branch's work, use "turnOffRuleWhileOnBranch": "<exact branch name>" instead; that one has no cap.`);
18
+ ` CURE: ${cure.byBranchText(`the ${label} entry`)} That hatch has no cap.\n` +
19
+ ` ${cure.byEpochText(`the ${label} entry`)} Never past ${maxEpoch} (${maxDate}).`);
19
20
  }
20
21
  renamedFields = {
21
22
  ignoreModifiedUntilEpoch: 'turnOffRuleUntilEpoch',
@@ -1 +1 @@
1
- {"version":3,"file":"policy-field-constraints.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/policy-field-constraints.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,CAAC,CAAC;AAEzC,oGAAoG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H_DAYS = 7;\n\n/** Generic consumer-field constraints are shared by owner files and client-authored match rules. */\nexport class PolicyFieldConstraints {\n epochError(label: string, value: number): string | null {\n const maxEpoch = Math.floor(Date.now() / 1000) + MAX_TURN_OFF_EPOCH_DAYS * 24 * 60 * 60;\n if (value <= maxEpoch) return null;\n const daysOut = Math.round((value - Date.now() / 1000) / (24 * 60 * 60));\n const maxDate = new Date(maxEpoch * 1000).toISOString().split('T')[0];\n return (\n `${label} \"turnOffRuleUntilEpoch\": ${value} is ${daysOut} days in the future — the maximum is ` +\n `${MAX_TURN_OFF_EPOCH_DAYS} days. A rule switched off for longer than that is off for work nobody ` +\n `had in mind when it was written, because this hatch is REPO-WIDE while it lasts.\\n` +\n ` CURE: set it to at most ${maxEpoch} (${maxDate}), then re-set it WEEKLY for as long as you ` +\n `still need it — that renewal is the intended workflow, not a workaround. If the rule is off for ` +\n `ONE branch's work, use \"turnOffRuleWhileOnBranch\": \"<exact branch name>\" instead; that one has no cap.`\n );\n }\n\n private readonly renamedFields: Readonly<Record<string, string>> = {\n ignoreModifiedUntilEpoch: 'turnOffRuleUntilEpoch',\n ignoreRuleWhileOnBranch: 'turnOffRuleWhileOnBranch',\n };\n\n retiredFields(): readonly string[] { return Object.keys(this.renamedFields); }\n\n renamedField(key: string): string | undefined { return this.renamedFields[key]; }\n\n isRationale(key: string): boolean {\n return key.length > 3 && key.endsWith('Why');\n }\n}\n"]}
1
+ {"version":3,"file":"policy-field-constraints.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/policy-field-constraints.ts"],"names":[],"mappings":";;;AAAA,6DAAuD;AAE1C,QAAA,uBAAuB,GAAG,CAAC,CAAC;AAEzC,oGAAoG;AACpG,MAAa,sBAAsB;IAC/B,UAAU,CAAC,KAAa,EAAE,KAAa;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,+BAAuB,GAAG,EAAE,GAAG,E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= 7;\n\n/** Generic consumer-field constraints are shared by owner files and client-authored match rules. */\nexport class PolicyFieldConstraints {\n epochError(label: string, value: number): string | null {\n const maxEpoch = Math.floor(Date.now() / 1000) + MAX_TURN_OFF_EPOCH_DAYS * 24 * 60 * 60;\n if (value <= maxEpoch) return null;\n const daysOut = Math.round((value - Date.now() / 1000) / (24 * 60 * 60));\n const maxDate = new Date(maxEpoch * 1000).toISOString().split('T')[0];\n const cure = new TurnOffRuleCure();\n return (\n `${label} \"turnOffRuleUntilEpoch\": ${value} is ${daysOut} days in the future — the maximum is ` +\n `${MAX_TURN_OFF_EPOCH_DAYS} days. A rule switched off for longer than that is off for work nobody ` +\n `had in mind when it was written, because this hatch is REPO-WIDE while it lasts.\\n` +\n ` CURE: ${cure.byBranchText(`the ${label} entry`)} That hatch has no cap.\\n` +\n ` ${cure.byEpochText(`the ${label} entry`)} Never past ${maxEpoch} (${maxDate}).`\n );\n }\n\n private readonly renamedFields: Readonly<Record<string, string>> = {\n ignoreModifiedUntilEpoch: 'turnOffRuleUntilEpoch',\n ignoreRuleWhileOnBranch: 'turnOffRuleWhileOnBranch',\n };\n\n retiredFields(): readonly string[] { return Object.keys(this.renamedFields); }\n\n renamedField(key: string): string | undefined { return this.renamedFields[key]; }\n\n isRationale(key: string): boolean {\n return key.length > 3 && key.endsWith('Why');\n }\n}\n"]}
package/src/skip-rule.js CHANGED
@@ -10,6 +10,7 @@ exports.HOTFIX_AUDIT_BANNER = '# ⚠️ HOT FIX ⚠️\n\n' +
10
10
  const fs = tslib_1.__importStar(require("fs"));
11
11
  const rule_fail_error_1 = require("./rule-fail-error");
12
12
  const fix_option_1 = require("./fix-option");
13
+ const turn_off_rule_cure_1 = require("./turn-off-rule-cure");
13
14
  const to_error_1 = require("@webpieces/tooling-common/to-error");
14
15
  // Universal "should this rule be skipped right now?" logic, shared by code-rules,
15
16
  // ai-hook-rules and the Nx executors so every rule honors the same two escape
@@ -104,7 +105,8 @@ function readHeadRepoFullName(branchName) {
104
105
  throw new rule_fail_error_1.RuleFailError('turnOffRuleWhileOnBranch', `turnOffRuleWhileOnBranch: "${branchName}" is configured and this is a pull_request run, so the ` +
105
106
  `head repository must be checked before the hatch may fire — but the runner's event file ` +
106
107
  `${eventPath} could not be read: ${error.message}`, undefined, undefined, [
107
- new fix_option_1.Option('Use turnOffRuleUntilEpoch instead — it is TIME based and needs no event file.', true),
108
+ new fix_option_1.Option('Use turnOffRuleUntilEpoch instead — it is TIME based and needs no event file. ' +
109
+ new turn_off_rule_cure_1.TurnOffRuleCure().byEpochText("the same rule's entry"), true),
108
110
  new fix_option_1.Option('Or clear turnOffRuleWhileOnBranch (set it to null) so no trust check is needed at all.'),
109
111
  ], undefined, error);
110
112
  }
@@ -130,8 +132,9 @@ function forkRefusal(branchName, what) {
130
132
  `by naming their branch after it. The rule is NOT skipped, and this fails loudly rather than ` +
131
133
  `quietly enforcing a rule the config says is off.`, undefined, undefined, [
132
134
  new fix_option_1.Option('If the rule must be off for outside contributions too, use turnOffRuleUntilEpoch — it is TIME ' +
133
- 'based, so it cannot be self-granted by naming a branch. Keep the date short: it is repo-wide ' +
134
- 'while it lasts, so it also shelters unrelated work landing in the same window.', true),
135
+ 'based, so it cannot be self-granted by naming a branch. It also shelters unrelated work ' +
136
+ 'landing in the same window, so keep it to one hour. ' +
137
+ new turn_off_rule_cure_1.TurnOffRuleCure().byEpochText("the same rule's entry"), true),
135
138
  new fix_option_1.Option('Otherwise clear turnOffRuleWhileOnBranch (set it to null) and fix the findings on the ' +
136
139
  'contributed branch like any other.'),
137
140
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"skip-rule.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/skip-rule.ts"],"names":[],"mappings":";;;AAuLA,wCAgDC;;AAvOY,QAAA,oBAAoB,GAC7B,+EAA+E,CAAC;AACvE,QAAA,mBAAmB,GAC5B,qBAAqB;IACrB,gGAAgG;IAChG,oDAAoD,CAAC;AAGzD,+CAAyB;AAGzB,u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","sourcesContent":["export const HOTFIX_BUILD_COMMAND =\n 'pnpm nx affected --target=hotfix-ci --base=$(git merge-base origin/main HEAD)';\nexport const HOTFIX_AUDIT_BANNER =\n '# ⚠️ HOT FIX ⚠️\\n\\n' +\n 'This emergency PR bypassed required reviews, ticket enforcement, Webpieces rules, ESLint, and ' +\n 'Prettier/format checks. Compilation and tests ran.';\n\n\nimport * as fs from 'fs';\n\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { RuleFailError } from './rule-fail-error';\nimport { Option } from './fix-option';\nimport { toError } from '@webpieces/tooling-common/to-error';\n\n// Universal \"should this rule be skipped right now?\" logic, shared by code-rules,\n// ai-hook-rules and the Nx executors so every rule honors the same two escape\n// hatches: turnOffRuleWhileOnBranch (skip while on a named branch) and\n// turnOffRuleUntilEpoch (skip until an epoch passes).\n\n/**\n * The skip decision. A CLASS, not an interface (CLAUDE.md rule 1), because it carries a THIRD fact\n * beyond yes/no that a caller has to be able to read rather than read about in a log line.\n *\n * `hatchNotApplied` is that fact: a branch hatch WAS configured, and it could NOT apply — today only\n * because HEAD is detached (a tag checkout, a `git bisect` step, a CI checkout of a merge ref). The rule\n * is ENFORCED in that case, so there is nothing to report unless the rule then FAILS; when it does, its\n * own RuleFailError is where this belongs, as context on why the hatch the config shows did not save it.\n *\n * It is deliberately NOT printed here. Everything in this framework throws to ONE place that renders per\n * audience; a console write from a library function cannot be caught, re-rendered or asserted on.\n */\nexport class SkipRuleResult {\n skip: boolean;\n /** Why the rule IS being skipped. '' whenever `skip` is false. */\n reason: string;\n /** Why a CONFIGURED branch hatch did not apply, or '' when there is nothing to say. */\n hatchNotApplied: string;\n\n constructor(skip: boolean, reason: string = '', hatchNotApplied: string = '') {\n this.skip = skip;\n this.reason = reason;\n this.hatchNotApplied = hatchNotApplied;\n }\n}\n\nimport { BranchIdentity } from '@webpieces/repo-workflow-core';\n\nconst branchIdentity = new BranchIdentity();\n\n// The slice of the GitHub `pull_request` event payload that says WHO OWNS the head branch. Only the\n// one field below is read; everything else in that file is ignored.\ninterface RawPullRequestEvent {\n pull_request?: {\n head?: {\n repo?: {\n full_name?: string;\n };\n };\n };\n}\n\n/**\n * Refuse the branch hatch on a pull request whose head branch this repo does not own.\n *\n * The hole it closes: hatch names live in `webpieces.config.json`, which is COMMITTED and public. On a\n * `pull_request` from a FORK the runner sets GITHUB_HEAD_REF to the FORK AUTHOR's branch name, so an\n * outside contributor who names their branch after one of your hatches silently disables that rule on\n * their PR — the one place you least want a rule off.\n *\n * It is answered with no network and no token, from `$GITHUB_EVENT_PATH` — a JSON file the runner writes\n * before the job starts:\n * - `pull_request_target` runs with the BASE repo's secrets against contributor-authored code, so it is\n * untrusted unconditionally; there is nothing to compare.\n * - `pull_request` is trusted only when the head repo's `full_name` EQUALS `GITHUB_REPOSITORY`.\n *\n * \"Cannot tell\" counts as untrusted — a `pull_request` run with no readable event file cannot make the\n * comparison, and a hatch that cannot be proven to be yours must not fire.\n *\n * This is the ONE hard failure left in this module, and it is not the \"no branch here\" case (see\n * shouldSkipRule, which enforces quietly when HEAD is detached). It is a hatch name that DOES resolve but\n * is attacker-chosen — a security property, not a checkout that happens not to be editing.\n *\n * Called ONLY from inside `if (branchName)`. With turnOffRuleWhileOnBranch null — the overwhelmingly\n * common value — nothing here runs and no fork PR is affected in any way.\n */\n// webpieces-disable no-function-outside-class -- module-scope helper of the module-scope shouldSkipRule it serves; this whole module is functional by design (imported as free functions by code-rules, ai-hook-rules and the nx executors)\nfunction assertBranchIsTrustworthy(branchName: string): void {\n const eventName = process.env['GITHUB_EVENT_NAME'];\n if (eventName !== 'pull_request' && eventName !== 'pull_request_target') return;\n if (eventName === 'pull_request_target')\n throw forkRefusal(branchName, 'pull_request_target run');\n\n const headRepo = readHeadRepoFullName(branchName);\n const thisRepo = process.env['GITHUB_REPOSITORY'] ?? '';\n if (headRepo !== null && thisRepo !== '' && headRepo === thisRepo) return;\n throw forkRefusal(\n branchName,\n headRepo === null\n ? 'pull_request run with no readable $GITHUB_EVENT_PATH, so the head branch cannot be proven to belong to this repo'\n : `pull_request run whose head branch lives in \"${headRepo}\", not in \"${thisRepo}\"`,\n );\n}\n\n/**\n * The head repo's `owner/name` from the runner's event file, or null when there is no such file.\n *\n * A file that exists but cannot be parsed is a different thing from one that is absent, and it throws:\n * it means the runner wrote something this code does not understand, and silently downgrading that to\n * \"untrusted\" would hide a real incompatibility behind a message about forks.\n */\n// webpieces-disable no-function-outside-class -- module-scope helper, see assertBranchIsTrustworthy\nfunction readHeadRepoFullName(branchName: string): string | null {\n const eventPath = process.env['GITHUB_EVENT_PATH'];\n if (!eventPath || !fs.existsSync(eventPath)) return null;\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: a raw SyntaxError from the runner's event file would say nothing about hatches; this names the hatch, the file and the rule that stayed ON\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- see above\n try {\n const parsed = JSON.parse(fs.readFileSync(eventPath, 'utf8')) as RawPullRequestEvent;\n return parsed.pull_request?.head?.repo?.full_name ?? null;\n } catch (err: unknown) {\n const error = toError(err);\n throw new RuleFailError(\n 'turnOffRuleWhileOnBranch',\n `turnOffRuleWhileOnBranch: \"${branchName}\" is configured and this is a pull_request run, so the ` +\n `head repository must be checked before the hatch may fire — but the runner's event file ` +\n `${eventPath} could not be read: ${error.message}`,\n undefined,\n undefined,\n [\n new Option(\n 'Use turnOffRuleUntilEpoch instead — it is TIME based and needs no event file.',\n true,\n ),\n new Option(\n 'Or clear turnOffRuleWhileOnBranch (set it to null) so no trust check is needed at all.',\n ),\n ],\n undefined,\n error,\n );\n }\n}\n\n/**\n * The fork refusal, as a `RuleFailError`.\n *\n * The cures are `fixOptions` — a LIST of `Option` — because the framework owns how they are labelled\n * and numbered (`formatFixOptions` renders \"Fix Option N:\" and the \"(preferred)\" tag for BOTH engines).\n * A hand-numbered \"WORKAROUNDS: 1. … 2. …\" string literal, which is what this used to be, is exactly\n * the shape `Option` exists to prevent. `Option` lives HERE in `rules-config`, so the same class serves\n * this build-time throw and `FixHint` in `ai-hook-rules` — one cure shape, one definition.\n *\n * `ruleName` is the HATCH, not the rule being evaluated: `shouldSkipRule` is handed only the two hatch\n * values and does not know whose rule it is deciding for — and the thing that failed genuinely is the\n * hatch, which cannot be honored here.\n */\n// webpieces-disable no-function-outside-class -- module-scope helper, see assertBranchIsTrustworthy\nfunction forkRefusal(branchName: string, what: string): RuleFailError {\n return new RuleFailError(\n 'turnOffRuleWhileOnBranch',\n `turnOffRuleWhileOnBranch: \"${branchName}\" is configured, but this is a ${what}. The branch name ` +\n `there is chosen by the PULL REQUEST AUTHOR, and hatch names are public (webpieces.config.json ` +\n `is committed), so honoring the hatch would let anyone turn this rule off on their own PR just ` +\n `by naming their branch after it. The rule is NOT skipped, and this fails loudly rather than ` +\n `quietly enforcing a rule the config says is off.`,\n undefined,\n undefined,\n [\n new Option(\n 'If the rule must be off for outside contributions too, use turnOffRuleUntilEpoch — it is TIME ' +\n 'based, so it cannot be self-granted by naming a branch. Keep the date short: it is repo-wide ' +\n 'while it lasts, so it also shelters unrelated work landing in the same window.',\n true,\n ),\n new Option(\n 'Otherwise clear turnOffRuleWhileOnBranch (set it to null) and fix the findings on the ' +\n 'contributed branch like any other.',\n ),\n ],\n );\n}\n\nexport function shouldSkipRule(\n epoch: number | undefined,\n // The branch hatch is an EXACT branch name — compared with `===`, never a glob, regex or prefix.\n // That is deliberate and is not to be \"improved\": the hatch turns a rule OFF, and a pattern lets one\n // config line switch rules off on branches nobody enumerated when it was written. If two branches\n // need the same rule off, that is two branches renamed to one hatch name, not one wildcard.\n //\n // null (the \"no branch / always on\" value of turnOffRuleWhileOnBranch) is treated exactly like\n // undefined — no branch scoping. Only a non-empty branch name activates the branch hatch.\n branchName: string | undefined | null,\n): SkipRuleResult {\n if (branchName) {\n // The fork gate fires ONLY inside `if (branchName)`. With turnOffRuleWhileOnBranch=null — the\n // overwhelmingly common value — nothing below runs, so an outside contribution to a repo that\n // configured no hatch is an ordinary run.\n //\n // A DETACHED HEAD is NOT an error here. The branch hatch exists to relax a rule while you EDIT on\n // a branch; a tag checkout or a `git bisect` step is not editing (you cannot commit to a tag, and\n // to edit you branch off it first). So when no branch can be resolved the hatch simply does not\n // apply and THE RULE IS ENFORCED — whoever hits a violation then gets that rule's own message and\n // cure, which is the useful output. WHY the hatch did not fire rides back on the result\n // (SkipRuleResult.hatchNotApplied) rather than being printed, so a caller that does fail can fold\n // it into its own error instead of a library writing to a console nobody can catch.\n assertBranchIsTrustworthy(branchName);\n const current = branchIdentity.current();\n if (current === 'HEAD' || current === '') {\n return new SkipRuleResult(\n false,\n '',\n `turnOffRuleWhileOnBranch: \"${branchName}\" did not apply — HEAD is detached, so there is no ` +\n `branch to match (a tag checkout, a git bisect step, or a CI checkout of a merge ref).`,\n );\n }\n if (current === branchName) {\n return new SkipRuleResult(true, `on branch \"${branchName}\"`);\n }\n }\n if (epoch !== undefined) {\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];\n return new SkipRuleResult(\n true,\n `turnOffRuleUntilEpoch active, expires: ${expiresDate}`,\n );\n }\n }\n return new SkipRuleResult(false);\n}\n"]}
1
+ {"version":3,"file":"skip-rule.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/skip-rule.ts"],"names":[],"mappings":";;;AA0LA,wCAgDC;;AA1OY,QAAA,oBAAoB,GAC7B,+EAA+E,CAAC;AACvE,QAAA,mBAAmB,GAC5B,qBAAqB;IACrB,gGAAgG;IAChG,oDAAoD,CAAC;AAGzD,+CAAyB;AAGzB,uDAAkD;AAClD,6CAAsC;AACtC,6DAAuD;AACvD,iEAA6D;AAE7D,kFAAkF;AAClF,8EAA8E;AAC9E,uEAAuE;AACvE,sDAAsD;AAEtD;;;;;;;;;;;GAWG;AACH,MAAa,cAAc;IACvB,IAAI,CAAU;IACd,kEAAkE;IAClE,MAAM,CAAS;IACf,uFAAuF;IACvF,eAAe,CAAS;IAExB,YAAY,IAAa,E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G;AAClG,4FAA4F;AAC5F,EAAE;AACF,+FAA+F;AAC/F,0FAA0F;AAC1F,UAAqC;IAErC,IAAI,UAAU,EAAE,CAAC;QACb,8FAA8F;QAC9F,8FAA8F;QAC9F,0CAA0C;QAC1C,EAAE;QACF,kGAAkG;QAClG,kGAAkG;QAClG,gGAAgG;QAChG,kGAAkG;QAClG,wFAAwF;QACxF,kGAAkG;QAClG,oFAAoF;QACpF,yBAAyB,CAAC,UAAU,CAAC,CAAC;QACtC,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;QACzC,IAAI,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;YACvC,OAAO,IAAI,cAAc,CACrB,KAAK,EACL,EAAE,EACF,8BAA8B,UAAU,qDAAqD;gBACzF,uFAAuF,CAC9F,CAAC;QACN,CAAC;QACD,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;YACzB,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,cAAc,UAAU,GAAG,CAAC,CAAC;QACjE,CAAC;IACL,CAAC;IACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QACrC,IAAI,UAAU,GAAG,KAAK,EAAE,CAAC;YACrB,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACvE,OAAO,IAAI,cAAc,CACrB,IAAI,EACJ,0CAA0C,WAAW,EAAE,CAC1D,CAAC;QACN,CAAC;IACL,CAAC;IACD,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC","sourcesContent":["export const HOTFIX_BUILD_COMMAND =\n 'pnpm nx affected --target=hotfix-ci --base=$(git merge-base origin/main HEAD)';\nexport const HOTFIX_AUDIT_BANNER =\n '# ⚠️ HOT FIX ⚠️\\n\\n' +\n 'This emergency PR bypassed required reviews, ticket enforcement, Webpieces rules, ESLint, and ' +\n 'Prettier/format checks. Compilation and tests ran.';\n\n\nimport * as fs from 'fs';\n\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { RuleFailError } from './rule-fail-error';\nimport { Option } from './fix-option';\nimport { TurnOffRuleCure } from './turn-off-rule-cure';\nimport { toError } from '@webpieces/tooling-common/to-error';\n\n// Universal \"should this rule be skipped right now?\" logic, shared by code-rules,\n// ai-hook-rules and the Nx executors so every rule honors the same two escape\n// hatches: turnOffRuleWhileOnBranch (skip while on a named branch) and\n// turnOffRuleUntilEpoch (skip until an epoch passes).\n\n/**\n * The skip decision. A CLASS, not an interface (CLAUDE.md rule 1), because it carries a THIRD fact\n * beyond yes/no that a caller has to be able to read rather than read about in a log line.\n *\n * `hatchNotApplied` is that fact: a branch hatch WAS configured, and it could NOT apply — today only\n * because HEAD is detached (a tag checkout, a `git bisect` step, a CI checkout of a merge ref). The rule\n * is ENFORCED in that case, so there is nothing to report unless the rule then FAILS; when it does, its\n * own RuleFailError is where this belongs, as context on why the hatch the config shows did not save it.\n *\n * It is deliberately NOT printed here. Everything in this framework throws to ONE place that renders per\n * audience; a console write from a library function cannot be caught, re-rendered or asserted on.\n */\nexport class SkipRuleResult {\n skip: boolean;\n /** Why the rule IS being skipped. '' whenever `skip` is false. */\n reason: string;\n /** Why a CONFIGURED branch hatch did not apply, or '' when there is nothing to say. */\n hatchNotApplied: string;\n\n constructor(skip: boolean, reason: string = '', hatchNotApplied: string = '') {\n this.skip = skip;\n this.reason = reason;\n this.hatchNotApplied = hatchNotApplied;\n }\n}\n\nimport { BranchIdentity } from '@webpieces/repo-workflow-core';\n\nconst branchIdentity = new BranchIdentity();\n\n// The slice of the GitHub `pull_request` event payload that says WHO OWNS the head branch. Only the\n// one field below is read; everything else in that file is ignored.\ninterface RawPullRequestEvent {\n pull_request?: {\n head?: {\n repo?: {\n full_name?: string;\n };\n };\n };\n}\n\n/**\n * Refuse the branch hatch on a pull request whose head branch this repo does not own.\n *\n * The hole it closes: hatch names live in `webpieces.config.json`, which is COMMITTED and public. On a\n * `pull_request` from a FORK the runner sets GITHUB_HEAD_REF to the FORK AUTHOR's branch name, so an\n * outside contributor who names their branch after one of your hatches silently disables that rule on\n * their PR — the one place you least want a rule off.\n *\n * It is answered with no network and no token, from `$GITHUB_EVENT_PATH` — a JSON file the runner writes\n * before the job starts:\n * - `pull_request_target` runs with the BASE repo's secrets against contributor-authored code, so it is\n * untrusted unconditionally; there is nothing to compare.\n * - `pull_request` is trusted only when the head repo's `full_name` EQUALS `GITHUB_REPOSITORY`.\n *\n * \"Cannot tell\" counts as untrusted — a `pull_request` run with no readable event file cannot make the\n * comparison, and a hatch that cannot be proven to be yours must not fire.\n *\n * This is the ONE hard failure left in this module, and it is not the \"no branch here\" case (see\n * shouldSkipRule, which enforces quietly when HEAD is detached). It is a hatch name that DOES resolve but\n * is attacker-chosen — a security property, not a checkout that happens not to be editing.\n *\n * Called ONLY from inside `if (branchName)`. With turnOffRuleWhileOnBranch null — the overwhelmingly\n * common value — nothing here runs and no fork PR is affected in any way.\n */\n// webpieces-disable no-function-outside-class -- module-scope helper of the module-scope shouldSkipRule it serves; this whole module is functional by design (imported as free functions by code-rules, ai-hook-rules and the nx executors)\nfunction assertBranchIsTrustworthy(branchName: string): void {\n const eventName = process.env['GITHUB_EVENT_NAME'];\n if (eventName !== 'pull_request' && eventName !== 'pull_request_target') return;\n if (eventName === 'pull_request_target')\n throw forkRefusal(branchName, 'pull_request_target run');\n\n const headRepo = readHeadRepoFullName(branchName);\n const thisRepo = process.env['GITHUB_REPOSITORY'] ?? '';\n if (headRepo !== null && thisRepo !== '' && headRepo === thisRepo) return;\n throw forkRefusal(\n branchName,\n headRepo === null\n ? 'pull_request run with no readable $GITHUB_EVENT_PATH, so the head branch cannot be proven to belong to this repo'\n : `pull_request run whose head branch lives in \"${headRepo}\", not in \"${thisRepo}\"`,\n );\n}\n\n/**\n * The head repo's `owner/name` from the runner's event file, or null when there is no such file.\n *\n * A file that exists but cannot be parsed is a different thing from one that is absent, and it throws:\n * it means the runner wrote something this code does not understand, and silently downgrading that to\n * \"untrusted\" would hide a real incompatibility behind a message about forks.\n */\n// webpieces-disable no-function-outside-class -- module-scope helper, see assertBranchIsTrustworthy\nfunction readHeadRepoFullName(branchName: string): string | null {\n const eventPath = process.env['GITHUB_EVENT_PATH'];\n if (!eventPath || !fs.existsSync(eventPath)) return null;\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: a raw SyntaxError from the runner's event file would say nothing about hatches; this names the hatch, the file and the rule that stayed ON\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- see above\n try {\n const parsed = JSON.parse(fs.readFileSync(eventPath, 'utf8')) as RawPullRequestEvent;\n return parsed.pull_request?.head?.repo?.full_name ?? null;\n } catch (err: unknown) {\n const error = toError(err);\n throw new RuleFailError(\n 'turnOffRuleWhileOnBranch',\n `turnOffRuleWhileOnBranch: \"${branchName}\" is configured and this is a pull_request run, so the ` +\n `head repository must be checked before the hatch may fire — but the runner's event file ` +\n `${eventPath} could not be read: ${error.message}`,\n undefined,\n undefined,\n [\n new Option(\n 'Use turnOffRuleUntilEpoch instead — it is TIME based and needs no event file. ' +\n new TurnOffRuleCure().byEpochText(\"the same rule's entry\"),\n true,\n ),\n new Option(\n 'Or clear turnOffRuleWhileOnBranch (set it to null) so no trust check is needed at all.',\n ),\n ],\n undefined,\n error,\n );\n }\n}\n\n/**\n * The fork refusal, as a `RuleFailError`.\n *\n * The cures are `fixOptions` — a LIST of `Option` — because the framework owns how they are labelled\n * and numbered (`formatFixOptions` renders \"Fix Option N:\" and the \"(preferred)\" tag for BOTH engines).\n * A hand-numbered \"WORKAROUNDS: 1. … 2. …\" string literal, which is what this used to be, is exactly\n * the shape `Option` exists to prevent. `Option` lives HERE in `rules-config`, so the same class serves\n * this build-time throw and `FixHint` in `ai-hook-rules` — one cure shape, one definition.\n *\n * `ruleName` is the HATCH, not the rule being evaluated: `shouldSkipRule` is handed only the two hatch\n * values and does not know whose rule it is deciding for — and the thing that failed genuinely is the\n * hatch, which cannot be honored here.\n */\n// webpieces-disable no-function-outside-class -- module-scope helper, see assertBranchIsTrustworthy\nfunction forkRefusal(branchName: string, what: string): RuleFailError {\n return new RuleFailError(\n 'turnOffRuleWhileOnBranch',\n `turnOffRuleWhileOnBranch: \"${branchName}\" is configured, but this is a ${what}. The branch name ` +\n `there is chosen by the PULL REQUEST AUTHOR, and hatch names are public (webpieces.config.json ` +\n `is committed), so honoring the hatch would let anyone turn this rule off on their own PR just ` +\n `by naming their branch after it. The rule is NOT skipped, and this fails loudly rather than ` +\n `quietly enforcing a rule the config says is off.`,\n undefined,\n undefined,\n [\n new Option(\n 'If the rule must be off for outside contributions too, use turnOffRuleUntilEpoch — it is TIME ' +\n 'based, so it cannot be self-granted by naming a branch. It also shelters unrelated work ' +\n 'landing in the same window, so keep it to one hour. ' +\n new TurnOffRuleCure().byEpochText(\"the same rule's entry\"),\n true,\n ),\n new Option(\n 'Otherwise clear turnOffRuleWhileOnBranch (set it to null) and fix the findings on the ' +\n 'contributed branch like any other.',\n ),\n ],\n );\n}\n\nexport function shouldSkipRule(\n epoch: number | undefined,\n // The branch hatch is an EXACT branch name — compared with `===`, never a glob, regex or prefix.\n // That is deliberate and is not to be \"improved\": the hatch turns a rule OFF, and a pattern lets one\n // config line switch rules off on branches nobody enumerated when it was written. If two branches\n // need the same rule off, that is two branches renamed to one hatch name, not one wildcard.\n //\n // null (the \"no branch / always on\" value of turnOffRuleWhileOnBranch) is treated exactly like\n // undefined — no branch scoping. Only a non-empty branch name activates the branch hatch.\n branchName: string | undefined | null,\n): SkipRuleResult {\n if (branchName) {\n // The fork gate fires ONLY inside `if (branchName)`. With turnOffRuleWhileOnBranch=null — the\n // overwhelmingly common value — nothing below runs, so an outside contribution to a repo that\n // configured no hatch is an ordinary run.\n //\n // A DETACHED HEAD is NOT an error here. The branch hatch exists to relax a rule while you EDIT on\n // a branch; a tag checkout or a `git bisect` step is not editing (you cannot commit to a tag, and\n // to edit you branch off it first). So when no branch can be resolved the hatch simply does not\n // apply and THE RULE IS ENFORCED — whoever hits a violation then gets that rule's own message and\n // cure, which is the useful output. WHY the hatch did not fire rides back on the result\n // (SkipRuleResult.hatchNotApplied) rather than being printed, so a caller that does fail can fold\n // it into its own error instead of a library writing to a console nobody can catch.\n assertBranchIsTrustworthy(branchName);\n const current = branchIdentity.current();\n if (current === 'HEAD' || current === '') {\n return new SkipRuleResult(\n false,\n '',\n `turnOffRuleWhileOnBranch: \"${branchName}\" did not apply — HEAD is detached, so there is no ` +\n `branch to match (a tag checkout, a git bisect step, or a CI checkout of a merge ref).`,\n );\n }\n if (current === branchName) {\n return new SkipRuleResult(true, `on branch \"${branchName}\"`);\n }\n }\n if (epoch !== undefined) {\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];\n return new SkipRuleResult(\n true,\n `turnOffRuleUntilEpoch active, expires: ${expiresDate}`,\n );\n }\n }\n return new SkipRuleResult(false);\n}\n"]}
@@ -0,0 +1,33 @@
1
+ import { Option } from './fix-option';
2
+ /**
3
+ * How far into the future the LAST-RESORT `turnOffRuleUntilEpoch` cure tells a reader to reach: one hour.
4
+ *
5
+ * Short on purpose (issue #1318). `shouldSkipRule` ORs the two hatches, so a future epoch turns the rule
6
+ * off for the WHOLE REPO, on every branch, until it passes — naming a branch beside it does not narrow
7
+ * that. A ~6-week epoch meant for one legacy-port branch kept max-file-lines and max-method-lines off
8
+ * repo-wide for the whole window in a consumer repo, and nobody noticed. An hour is enough to land one
9
+ * change from a CI that cannot see the branch name, and the rule is back on before anyone forgets it.
10
+ */
11
+ export declare const LAST_RESORT_TURN_OFF_SECONDS: number;
12
+ /**
13
+ * The ONE wording of "how to turn this rule off", shared by every cure that offers it, so the BRANCH
14
+ * hatch always leads and the EPOCH hatch is always the short, explicitly repo-wide last resort.
15
+ *
16
+ * A class rather than two string constants because the epoch cure carries a COMPUTED value (now + 1 hour,
17
+ * in epoch SECONDS): a reader handed "a future epoch" picks a date, and a date is how the six-week window
18
+ * above happened. The clock is injectable so a spec can pin the printed number.
19
+ */
20
+ export declare class TurnOffRuleCure {
21
+ private readonly nowSeconds;
22
+ constructor(nowSeconds?: () => number);
23
+ /**
24
+ * The preferred cure: turn the rule off on ONE branch. `entry` names where the setting lives (e.g.
25
+ * `the "max-file-lines" entry in .webpieces-config/rules/code-rules.json`). `branchName` fills in the
26
+ * exact branch when the caller knows it; otherwise the reader gets a `<exact branch name>` placeholder.
27
+ */
28
+ byBranchText(entry: string, branchName?: string | null): string;
29
+ /** The last-resort cure, for a CI that cannot see the branch name. Always states that it is repo-wide. */
30
+ byEpochText(entry: string): string;
31
+ /** Both cures as `Option`s, branch first and preferred. */
32
+ options(entry: string, branchName?: string | null): Option[];
33
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TurnOffRuleCure = exports.LAST_RESORT_TURN_OFF_SECONDS = void 0;
4
+ const fix_option_1 = require("./fix-option");
5
+ /**
6
+ * How far into the future the LAST-RESORT `turnOffRuleUntilEpoch` cure tells a reader to reach: one hour.
7
+ *
8
+ * Short on purpose (issue #1318). `shouldSkipRule` ORs the two hatches, so a future epoch turns the rule
9
+ * off for the WHOLE REPO, on every branch, until it passes — naming a branch beside it does not narrow
10
+ * that. A ~6-week epoch meant for one legacy-port branch kept max-file-lines and max-method-lines off
11
+ * repo-wide for the whole window in a consumer repo, and nobody noticed. An hour is enough to land one
12
+ * change from a CI that cannot see the branch name, and the rule is back on before anyone forgets it.
13
+ */
14
+ exports.LAST_RESORT_TURN_OFF_SECONDS = 60 * 60;
15
+ /**
16
+ * The ONE wording of "how to turn this rule off", shared by every cure that offers it, so the BRANCH
17
+ * hatch always leads and the EPOCH hatch is always the short, explicitly repo-wide last resort.
18
+ *
19
+ * A class rather than two string constants because the epoch cure carries a COMPUTED value (now + 1 hour,
20
+ * in epoch SECONDS): a reader handed "a future epoch" picks a date, and a date is how the six-week window
21
+ * above happened. The clock is injectable so a spec can pin the printed number.
22
+ */
23
+ class TurnOffRuleCure {
24
+ nowSeconds;
25
+ constructor(nowSeconds = () => Math.floor(Date.now() / 1000)) {
26
+ this.nowSeconds = nowSeconds;
27
+ }
28
+ /**
29
+ * The preferred cure: turn the rule off on ONE branch. `entry` names where the setting lives (e.g.
30
+ * `the "max-file-lines" entry in .webpieces-config/rules/code-rules.json`). `branchName` fills in the
31
+ * exact branch when the caller knows it; otherwise the reader gets a `<exact branch name>` placeholder.
32
+ */
33
+ byBranchText(entry, branchName) {
34
+ const branch = branchName && branchName !== 'HEAD' ? branchName : '<exact branch name>';
35
+ return (`Turn the rule off for THIS BRANCH ONLY: on ${entry} set "turnOffRuleWhileOnBranch": "${branch}" ` +
36
+ `and keep "turnOffRuleUntilEpoch": 0. The rule is then off only on that branch — including its own ` +
37
+ `PR's CI run (GITHUB_HEAD_REF) — stays on everywhere else, and is back on for good once the branch ` +
38
+ `lands.`);
39
+ }
40
+ /** The last-resort cure, for a CI that cannot see the branch name. Always states that it is repo-wide. */
41
+ byEpochText(entry) {
42
+ const until = this.nowSeconds() + exports.LAST_RESORT_TURN_OFF_SECONDS;
43
+ const untilIso = new Date(until * 1000).toISOString();
44
+ return (`LAST RESORT, only when the branch name does not work (a detached-HEAD checkout, a fork or ` +
45
+ `pull_request_target run, a CI provider that does not expose the branch): on ${entry} set ` +
46
+ `"turnOffRuleUntilEpoch" to now + 1 hour, in epoch SECONDS (right now that is ${String(until)}, ` +
47
+ `${untilIso}). This turns the rule off REPO-WIDE, on every branch, for that hour — keep it to the ` +
48
+ `hour so the rule turns back on quickly.`);
49
+ }
50
+ /** Both cures as `Option`s, branch first and preferred. */
51
+ options(entry, branchName) {
52
+ return [new fix_option_1.Option(this.byBranchText(entry, branchName), true), new fix_option_1.Option(this.byEpochText(entry))];
53
+ }
54
+ }
55
+ exports.TurnOffRuleCure = TurnOffRuleCure;
56
+ //# sourceMappingURL=turn-off-rule-cure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-off-rule-cure.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/turn-off-rule-cure.ts"],"names":[],"mappings":";;;AAAA,6CAAsC;AAEtC;;;;;;;;GAQG;AACU,QAAA,4BAA4B,GAAG,EAAE,GAAG,EAAE,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAa,eAAe;IACP,UAAU,CAAe;IAE1C,YAAY,aAA2B,GAAW,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QAC9E,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,KAAa,EAAE,UAA0B;QAClD,MAAM,MAAM,GAAG,UAAU,IAAI,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC;QACxF,OAAO,CACH,8CAA8C,KAAK,qCAAqC,MAAM,IAAI;YAClG,oGAAoG;YACpG,oGAAoG;YACpG,QAAQ,CACX,CAAC;IACN,CAAC;IAED,0GAA0G;IAC1G,WAAW,CAAC,KAAa;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,oCAA4B,CAAC;QAC/D,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QACtD,OAAO,CACH,4FAA4F;YAC5F,+EAA+E,KAAK,OAAO;YAC3F,gFAAgF,MAAM,CAAC,KAAK,CAAC,IAAI;YACjG,GAAG,QAAQ,wFAAwF;YACnG,yCAAyC,CAC5C,CAAC;IACN,CAAC;IAED,2DAA2D;IAC3D,OAAO,CAAC,KAAa,EAAE,UAA0B;QAC7C,OAAO,CAAC,IAAI,mBAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,mBAAM,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzG,CAAC;CACJ;AAvCD,0CAuCC","sourcesContent":["import { Option } from './fix-option';\n\n/**\n * How far into the future the LAST-RESORT `turnOffRuleUntilEpoch` cure tells a reader to reach: one hour.\n *\n * Short on purpose (issue #1318). `shouldSkipRule` ORs the two hatches, so a future epoch turns the rule\n * off for the WHOLE REPO, on every branch, until it passes — naming a branch beside it does not narrow\n * that. A ~6-week epoch meant for one legacy-port branch kept max-file-lines and max-method-lines off\n * repo-wide for the whole window in a consumer repo, and nobody noticed. An hour is enough to land one\n * change from a CI that cannot see the branch name, and the rule is back on before anyone forgets it.\n */\nexport const LAST_RESORT_TURN_OFF_SECONDS = 60 * 60;\n\n/**\n * The ONE wording of \"how to turn this rule off\", shared by every cure that offers it, so the BRANCH\n * hatch always leads and the EPOCH hatch is always the short, explicitly repo-wide last resort.\n *\n * A class rather than two string constants because the epoch cure carries a COMPUTED value (now + 1 hour,\n * in epoch SECONDS): a reader handed \"a future epoch\" picks a date, and a date is how the six-week window\n * above happened. The clock is injectable so a spec can pin the printed number.\n */\nexport class TurnOffRuleCure {\n private readonly nowSeconds: () => number;\n\n constructor(nowSeconds: () => number = (): number => Math.floor(Date.now() / 1000)) {\n this.nowSeconds = nowSeconds;\n }\n\n /**\n * The preferred cure: turn the rule off on ONE branch. `entry` names where the setting lives (e.g.\n * `the \"max-file-lines\" entry in .webpieces-config/rules/code-rules.json`). `branchName` fills in the\n * exact branch when the caller knows it; otherwise the reader gets a `<exact branch name>` placeholder.\n */\n byBranchText(entry: string, branchName?: string | null): string {\n const branch = branchName && branchName !== 'HEAD' ? branchName : '<exact branch name>';\n return (\n `Turn the rule off for THIS BRANCH ONLY: on ${entry} set \"turnOffRuleWhileOnBranch\": \"${branch}\" ` +\n `and keep \"turnOffRuleUntilEpoch\": 0. The rule is then off only on that branch — including its own ` +\n `PR's CI run (GITHUB_HEAD_REF) — stays on everywhere else, and is back on for good once the branch ` +\n `lands.`\n );\n }\n\n /** The last-resort cure, for a CI that cannot see the branch name. Always states that it is repo-wide. */\n byEpochText(entry: string): string {\n const until = this.nowSeconds() + LAST_RESORT_TURN_OFF_SECONDS;\n const untilIso = new Date(until * 1000).toISOString();\n return (\n `LAST RESORT, only when the branch name does not work (a detached-HEAD checkout, a fork or ` +\n `pull_request_target run, a CI provider that does not expose the branch): on ${entry} set ` +\n `\"turnOffRuleUntilEpoch\" to now + 1 hour, in epoch SECONDS (right now that is ${String(until)}, ` +\n `${untilIso}). This turns the rule off REPO-WIDE, on every branch, for that hour — keep it to the ` +\n `hour so the rule turns back on quickly.`\n );\n }\n\n /** Both cures as `Option`s, branch first and preferred. */\n options(entry: string, branchName?: string | null): Option[] {\n return [new Option(this.byBranchText(entry, branchName), true), new Option(this.byEpochText(entry))];\n }\n}\n"]}
@@ -23,9 +23,9 @@ Object.defineProperty(exports, "seedEntryForRule", { enumerable: true, get: func
23
23
  const match_rules_config_1 = require("./match-rules-config");
24
24
  const to_error_1 = require("@webpieces/tooling-common/to-error");
25
25
  /**
26
- * The longest a `turnOffRuleUntilEpoch` may reach into the future: ONE WEEK. Poke it again next week to
27
- * extend — that weekly re-set IS the intended workflow, not a workaround: it is what makes a rule that is
28
- * off on purpose stay a decision somebody keeps making, instead of one nobody remembers.
26
+ * The longest a `turnOffRuleUntilEpoch` may reach into the future: ONE WEEK — a hard ceiling, not the
27
+ * advice. The advice every cure gives (#1318) is the BRANCH hatch first, and the epoch only as a last
28
+ * resort set to now + 1 hour, because it is REPO-WIDE while it lasts (see TurnOffRuleCure).
29
29
  *
30
30
  * DELIBERATELY ASYMMETRIC with turnOffRuleWhileOnBranch, which has NO cap and must not get one. The epoch
31
31
  * hatch is REPO-WIDE while it lasts, so a long window shelters every unrelated change that lands inside it
@@ -1 +1 @@
1
- {"version":3,"file":"validate-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/validate-config.ts"],"names":[],"mappings":";;;AAwSA,0DA8DC;AA+BD,oDAuBC;AA+FD,8DA4BC;AAvhBD,yEAAoE;AACpE,uEAAqE;AAA5D,mIAAA,uBAAuB,OAAA;AAOhC,6CAAqE;AACrE,oDAA2D;AAC3D,6EAMsC;AAK7B,0GAVL,sDAAyB,OAUK;AAJlC,+DAAsF;AACtF,2CAAoD;AAIpD,yFAAyF;AACzF,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,2CAA6F;AAApF,iHAAA,mBAAmB,OAAA;AAAE,oHAAA,sBAAsB,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AACtE,6DAA2D;AAC3D,iEAA6D;AAE7D;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,wHAAwH;AACxH,SAAS,aAAa,CAAC,KAAa,EAAE,KAAa;IAC/C,OAAO,IAAI,iDAAsB,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,SAAS,CAAC,GAAa,EAAE,GAAY;IAC1C,oGAAoG;IACpG,oGAAoG;IACpG,IAAI,GAAG,KAAK,uBAAuB;QAC/B,OAAO,8DAA8D,CAAC;IAC1E,IAAI,GAAG,KAAK,0BAA0B;QAClC,OAAO,gHAAgH,CAAC;IAC5H,OAAO,GAAG,CAAC,UAAU;QACjB,CAAC,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG;QACnC,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU;YACvB,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU;gBACvB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC;gBACrB,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,QAAQ;oBACrB,CAAC,CAAC,UAAU;oBACZ,CAAC,CAAC,GAA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P,iBAAiB,KAAK,+IAA+I,CACxK,CAAC;IAEN,iEAAiE;IACjE,KAAK,MAAM,MAAM,IAAI,IAAI,iDAAsB,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC;QAChE,IAAI,MAAM,IAAI,CAAC;YACX,MAAM,CAAC,IAAI,CACP,iBAAiB,CAAC,iBAAiB,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,iDAAsB,EAAE,CAAC,YAAY,CAAC,MAAM,CAAE,CAAC,CAC1G,CAAC;IACV,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { PolicyFieldConstraints } from './policy-field-constraints';\nexport { MAX_TURN_OFF_EPOCH_DAYS } from './policy-field-constraints';\nimport { FieldDef, RetiredConfigKey } from '@webpieces/rules-sdk';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { allRuleNames } from './rule-schemas';\nimport { recommendedSeedModeFor, isGradualMode } from './seed-entry';\nimport { MODIFIED_CODE_MODES } from '@webpieces/rules-sdk';\nimport {\n validateChecklistsSection,\n validateDevDeploySection,\n validateLandPrSection,\n validateNoGateSaltRationale,\n validateReviewerAgentKeys,\n} from './pr-gate-section-validators';\nimport { retiredEntry, retiredKeyError, retiredRuleFor } from './retired-config-keys';\nimport { PRUNE_UNKNOWN_COMMAND } from './constants';\n\n// Re-exported so the isolated validate-checklist-docs target keeps importing it from here.\nexport { validateChecklistsSection };\n// Re-exported from their new homes: this module was the historical entry point for both.\nexport { allRuleNames } from './rule-schemas';\nexport { recommendedSeedMode, recommendedSeedModeFor, seedEntryForRule } from './seed-entry';\nimport { DEFAULT_MATCH_RULES } from './match-rules-config';\nimport { toError } from '@webpieces/tooling-common/to-error';\n\n/**\n * The longest a `turnOffRuleUntilEpoch` may reach into the future: ONE WEEK. Poke it again next week to\n * extend — that weekly re-set IS the intended workflow, not a workaround: it is what makes a rule that is\n * off on purpose stay a decision somebody keeps making, instead of one nobody remembers.\n *\n * DELIBERATELY ASYMMETRIC with turnOffRuleWhileOnBranch, which has NO cap and must not get one. The epoch\n * hatch is REPO-WIDE while it lasts, so a long window shelters every unrelated change that lands inside it\n * (a fleet repo was found with max-file-lines/max-method-lines switched off until 2026-10-01 — 43 days\n * out, six times this cap). The branch hatch fires only on ONE exact branch name — a big refactor\n * legitimately runs 35+ days, and capping that would only interrupt the one branch that opted in.\n */\n\n/**\n * Reject a `turnOffRuleUntilEpoch` more than MAX_TURN_OFF_EPOCH_DAYS into the future.\n *\n * A PAST epoch is always valid: it is inert (it skips nothing), and every existing config is full of them.\n * The BOUNDARY is inclusive — exactly MAX_TURN_OFF_EPOCH_DAYS out is accepted, only strictly beyond it is\n * refused — so a config written as \"now + 7 days\" is never rejected by the second it took to save.\n */\n// webpieces-disable no-function-outside-class -- module-scope validator helper, matching every other check in this file\nfunction epochCapError(label: string, value: number): string | null {\n return new PolicyFieldConstraints().epochError(label, value);\n}\n\nfunction valueHint(def: FieldDef, key?: string): string {\n // The two universal escape hatches, REQUIRED on every rule so they're always visible. Spell out the\n // \"off\" value so a fresh config seeds them in the active/no-op state (0 / null), not a placeholder.\n if (key === 'turnOffRuleUntilEpoch')\n return '0 (0 = active; future unix-epoch seconds = temporarily off)';\n if (key === 'turnOffRuleWhileOnBranch')\n return 'null (null = always on; an EXACT branch name — no globs — disables the rule while that branch is checked out)';\n return def.enumValues\n ? `\"${def.enumValues.join(' | ')}\"`\n : def.type === 'string[]'\n ? '[\"<string>\", ...]'\n : def.type === 'object[]'\n ? objectListHint(def)\n : def.type === 'number'\n ? '<number>'\n : def.type === 'boolean'\n ? '<boolean>'\n : '\"<string>\"';\n}\n\n/** `[{ \"paths\": [\"<string>\", ...], \"suffixes\": [\"<string>\", ...] }, ...]` — one element spelled out from its schema. */\n// webpieces-disable no-function-outside-class -- module-scope sibling of valueHint\nfunction objectListHint(def: FieldDef): string {\n const schema: Readonly<Record<string, FieldDef>> = def.elementSchema ?? {};\n const fields = Object.keys(schema)\n .filter((key: string) => !schema[key].optional)\n .map((key: string) => `\"${key}\": ${valueHint(schema[key], key)}`);\n return `[{ ${fields.join(', ')} }, ...]`;\n}\n\n/**\n * A config key whose schema is absent from every explicitly selected owner manifest. THE FALLBACK: it fires for any name the table in retired-config-keys.ts does not\n * know, which very much includes RETIRED names on a tree whose validator predates the retirement — the\n * ordinary linked-worktree layout, where the worktree is on one release and the parent checkout that\n * supplies the hook's resolution is on an older one. So this text has to be useful with NO table entry.\n *\n * DELETION LEADS, and it is not a hedge. A key the running validator has no schema for controls nothing:\n * every code path that would read it is keyed off the schema. Leaving it is dead config that reads as live\n * config, and for a retired key deleting it is the entire fix.\n *\n * This message used to lead with `pnpm install` instead, on the theory that the key might be valid and the\n * validator merely stale. Two things are wrong with that. First, it CONTRADICTED the banner this error is\n * printed inside, which states outright that `pnpm install` cannot help — one output, two opposite orders.\n * Second, the premise is already handled upstream: the shim's version-drift guard compares the pin against\n * the installed version and denies every tool call BEFORE exec'ing this validator, with its own message and\n * its own cure. If this text is on screen, that guard found no drift. The pin therefore appears here only as\n * a secondary note, so a valid-but-newer key is never dropped without the reader being told the case exists.\n */\nfunction unknownRuleError(ruleName: string): string {\n return (\n `[${ruleName}] Unknown rule — the running @webpieces validator has no selected owner schema for it. A key no validator knows controls NOTHING, so ` +\n `DELETE the \"${ruleName}\" key from the direct policy-ID map in its declared owner config file. ` +\n `Run \\`${PRUNE_UNKNOWN_COMMAND}\\` to remove unknown entries from declared owner files mechanically. ` +\n `It may be RETIRED: a newer release can move ` +\n `a setting out of this file entirely, in which case deleting the key here is the WHOLE fix. ` +\n `MACHINE-LOCAL settings in particular now live in ~/.webpieces/config.json under \"experimental\" — ` +\n `an optional file tracked by no repo, whose absence is the default behaviour — so if ` +\n `\"${ruleName}\" is one of those, delete it here and set it there. Secondary, and rare: a key is ` +\n `valid-but-unlearned when package.json pins an @webpieces OLDER than this config was written for, ` +\n `and the version-drift guard reports THAT separately with its own cure (bump the pin) before this ` +\n `validator ever runs — so it is not what you are looking at.`\n );\n}\n\n/** Schema advice names the selected owner rather than a retired root section. */\nclass RuleConfigAdvice {\n constructor(private readonly registry: RulePackRegistry) {}\n\n private rolloutTip(schema: Readonly<Record<string, FieldDef>>): string {\n const modes = schema['mode']?.enumValues ?? [];\n // Same source of truth as the seeder; only a GRADUAL recommendation gets the rollout prose, so a\n // rule whose recommendation falls through to ON/RUN_EVERY_TIME/OFF prints no tip (as before).\n const recommended = recommendedSeedModeFor(modes);\n if (!isGradualMode(recommended)) return '';\n const optOut = modes.includes('OFF') ? ' Set \"mode\": \"OFF\" to opt out entirely.' : '';\n return (\n `\\n\\n💡 Recommended: start with \"mode\": \"${recommended}\" — it enforces only on what you ` +\n `actually change, so the rule rolls out gradually (existing code stays grandfathered until ` +\n `you next touch that project/file/method).${optOut}`\n );\n }\n\n missingRuleSnippet(ruleName: string, schema: Readonly<Record<string, FieldDef>>): string {\n // Required fields go in the copy-paste entry. The two universal escape hatches\n // (turnOffRuleUntilEpoch / turnOffRuleWhileOnBranch) are now REQUIRED, so they land in that block —\n // which is the whole point: every seeded rule shows both hatches. Optional fields are listed separately.\n const fields = Object.keys(schema);\n const required = fields.filter((f: string) => !schema[f].optional);\n const optional = fields.filter((f: string) => schema[f].optional);\n\n const requiredLines = required.map((f: string) => ` \"${f}\": ${valueHint(schema[f], f)}`);\n const owner = this.registry.ownerOf(ruleName);\n let out =\n `[${ruleName}] Not configured in the declared owner config file for ${owner}. ` +\n `Add this entry directly to that file's policy-ID map\\n` +\n `(choose values appropriate for your project):\\n\\n` +\n ` \"${ruleName}\": {\\n${requiredLines.join(',\\n')}\\n }`;\n\n if (optional.length > 0) {\n const optionalLines = optional.map(\n (f: string) => ` \"${f}\": ${valueHint(schema[f], f)}`,\n );\n out +=\n `\\n\\nOptional fields you may add to this rule (omit if not needed):\\n` +\n `${optionalLines.join(',\\n')}`;\n }\n out += this.rolloutTip(schema);\n return out;\n }\n}\n\n// Fields we DELETED from a rule's schema, keyed by \"<rule>.<field>\". The generic unknown-field error\n// (\"Unknown field ... Valid fields: [...]\") is correct but doesn't say WHY the field vanished, so an AI\n// might re-add it. These hints explain the removal so the only action left is to delete the key.\n\n// Universal field renames (apply to EVERY rule/guard AND every match-rule, unlike the per-rule\n// RETIRED_FIELD_HINTS). When an entry still uses the old escape-hatch name, the generic unknown-field\n// error is replaced with a precise \"renamed to X — rename it\" instruction so the fix is mechanical.\n\n\n// The renamed-field message shared by keyed rules and match-rules.\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction renamedFieldError(scope: string, oldKey: string, newKey: string): string {\n return `${scope} Unknown field \"${oldKey}\" — it was renamed to \"${newKey}\". Rename it (the value carries over unchanged; for the branch hatch, use null when there is no branch).`;\n}\n\n/**\n * Field-level errors for ONE configured rule entry: unknown/renamed/retired keys, type and enum\n * mismatches, and the two-week cap on turnOffRuleUntilEpoch.\n *\n * Extracted out of validateWebpiecesConfig purely so that function stays inside max-method-lines; it is\n * the same checks in the same order.\n */\n// webpieces-disable no-any-unknown -- one config entry as opaque JSON; every field is typed-checked below\n// webpieces-disable no-function-outside-class -- module-scope validator helper, matching every other check in this file\nfunction fieldErrors(\n ruleName: string,\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n entry: Record<string, unknown>,\n schema: Readonly<Record<string, FieldDef>>,\n registry: RulePackRegistry,\n): string[] {\n const errors: string[] = [];\n for (const [key, value] of Object.entries(entry)) {\n const fieldDef = schema[key];\n if (!fieldDef) {\n const renamedTo = new PolicyFieldConstraints().renamedField(key);\n if (renamedTo) {\n errors.push(renamedFieldError(`[${ruleName}]`, key, renamedTo));\n continue;\n }\n const retiredHint = registry\n .migrations()\n .find(\n (entry: RetiredConfigKey) =>\n entry.scope === 'field' && entry.key === `${ruleName}.${key}`,\n )?.instruction;\n const suffix = retiredHint ? ` ${retiredHint}` : '';\n errors.push(\n `[${ruleName}] Unknown field \"${key}\". Valid fields: [${Object.keys(schema).join(', ')}].${suffix}`,\n );\n continue;\n }\n // A nullable field (e.g. turnOffRuleWhileOnBranch) accepts JSON null in addition to its type.\n if (value === null && fieldDef.nullable) continue;\n if (fieldDef.type === 'string[]' || fieldDef.type === 'object[]') {\n errors.push(...arrayFieldErrors(`[${ruleName}] \"${key}\"`, value, fieldDef));\n } else if (typeof value !== fieldDef.type) {\n errors.push(`[${ruleName}] \"${key}\" must be ${fieldDef.type}, got ${typeof value}.`);\n } else if (fieldDef.enumValues && !fieldDef.enumValues.includes(value as string)) {\n errors.push(\n `[${ruleName}] \"${key}\" = \"${value}\" is not valid. Must be one of: ${fieldDef.enumValues.join(', ')}.`,\n );\n } else if (key === 'turnOffRuleUntilEpoch') {\n const capError = epochCapError(`[${ruleName}]`, value as number);\n if (capError) errors.push(capError);\n } else if (\n ruleName === 'branch-state-guard' &&\n key === 'maxCommitsBehind' &&\n (!Number.isInteger(value) || (value as number) < 0)\n ) {\n errors.push('[branch-state-guard] \"maxCommitsBehind\" must be a non-negative integer.');\n }\n }\n return errors;\n}\n\n/**\n * Errors for one array-typed field (`string[]` / `object[]`): the element type, `nonEmpty`, and — for\n * `object[]` — every element against the field's `elementSchema` (unknown keys, missing required keys,\n * and each element field checked recursively). `label` is `[rule] \"field\"`, extended per element\n * (`[rule] \"entries\"[0].suffixes`) so an error names the exact spot to edit.\n */\n// webpieces-disable no-any-unknown -- a config field value is opaque JSON until this checks its shape\n// webpieces-disable no-function-outside-class -- module-scope validator helper, matching every other check in this file\n// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\nfunction arrayFieldErrors(label: string, value: unknown, def: FieldDef): string[] {\n const isObjects = def.type === 'object[]';\n // webpieces-disable no-any-unknown -- one list element as opaque JSON; this line is what checks its shape\n const elementOk = (v: unknown): boolean =>\n isObjects\n ? typeof v === 'object' && v !== null && !Array.isArray(v)\n : typeof v === 'string';\n if (!Array.isArray(value) || !value.every(elementOk)) {\n const shape = isObjects ? 'a list of objects' : 'string[]';\n return [\n `${label} must be ${shape}, got ${Array.isArray(value) ? 'a list holding something else' : typeof value}.`,\n ];\n }\n if (def.nonEmpty && value.length === 0) {\n return [\n `${label} must not be empty — an empty list judges nothing while reading as configured. Add ${valueHint(def)}.` +\n (def.emptyInstruction === undefined ? '' : ` ${def.emptyInstruction}`),\n ];\n }\n if (!isObjects || def.elementSchema === undefined) return [];\n const errors: string[] = [];\n const schema = def.elementSchema;\n // webpieces-disable no-any-unknown -- an element's fields are opaque JSON until checked against its schema below\n value.forEach((element: Record<string, unknown>, index: number) => {\n const at = `${label}[${index}]`;\n for (const key of Object.keys(element)) {\n if (!(key in schema))\n errors.push(\n `${at} Unknown field \"${key}\". Valid fields: [${Object.keys(schema).join(', ')}].`,\n );\n }\n for (const [key, fieldDef] of Object.entries(schema)) {\n if (!(key in element)) {\n if (!fieldDef.optional)\n errors.push(\n `${at} Missing required field \"${key}\". Add ${key}: ${valueHint(fieldDef, key)}.`,\n );\n } else if (fieldDef.type === 'string[]' || fieldDef.type === 'object[]') {\n errors.push(...arrayFieldErrors(`${at}.${key}`, element[key], fieldDef));\n } else if (typeof element[key] !== fieldDef.type) {\n errors.push(`${at}.${key} must be ${fieldDef.type}, got ${typeof element[key]}.`);\n }\n }\n });\n return errors;\n}\n\n// webpieces-disable no-any-unknown -- rawRules values are opaque JSON; each field is validated individually\nexport function validateWebpiecesConfig(\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n rawRules: Record<string, Record<string, unknown>>,\n registry: RulePackRegistry,\n): string[] {\n const errors: string[] = [];\n const advice = new RuleConfigAdvice(registry);\n\n // Check field-level correctness for rules that are present\n for (const [ruleName, entry] of Object.entries(rawRules)) {\n const schema = registry.hasRule(ruleName) ? registry.schemaFor(ruleName) : undefined;\n if (!schema) {\n if (\n registry.isSafeguard(ruleName) &&\n !registry\n .migrations()\n .some(\n (entry: RetiredConfigKey) =>\n entry.scope === 'rule' && entry.key === ruleName,\n )\n ) {\n errors.push(\n `[${ruleName}] is a cataloged safeguard, not a configurable policy. Delete its config entry; fixed safety cannot be disabled.`,\n );\n continue;\n }\n // A name we KNOW is retired beats the generic unknown-rule message, because only the table\n // knows WHERE the setting went — a rename carries its value over, and a bare \"delete it\"\n // would throw that value away. Client packs must not reuse a retired canonical ID.\n const retired = retiredRuleFor(ruleName, registry);\n if (retired) {\n errors.push(retiredKeyError(retired));\n continue;\n }\n // Client policies require a schema from an explicitly selected owner.\n errors.push(unknownRuleError(ruleName));\n continue;\n }\n errors.push(...fieldErrors(ruleName, entry, schema, registry));\n // Required fields must actually be present. Until now the loop above only checked\n // fields that WERE present, so an entry like `{}` (or one missing `mode` /\n // `turnOffRuleUntilEpoch`) slipped through. Every non-optional schema field is mandatory.\n for (const [key, fieldDef] of Object.entries(schema)) {\n if (!fieldDef.optional && !(key in entry)) {\n errors.push(\n `[${ruleName}] Missing required field \"${key}\". Add ${key}: ${valueHint(fieldDef, key)}.`,\n );\n }\n }\n }\n\n // Every built-in rule must be explicitly configured — no silent defaults.\n // When a new rule is added to the framework, this check surfaces it immediately\n // with a ready-to-copy snippet so AI can configure it in one pass.\n for (const ruleName of registry.ruleIds()) {\n const schema = registry.schemaFor(ruleName);\n if (!(ruleName in rawRules)) {\n errors.push(advice.missingRuleSnippet(ruleName, schema));\n }\n }\n\n return errors;\n}\n\nexport { validatePrGateSection } from './validate-pr-gate';\n\nfunction excludePathsExample(): string {\n return '\"excludePaths\": [\"repositories/**\"]';\n}\n\n// A glob list: must be a string[] (may be empty). `key` names it for the error.\n// webpieces-disable no-any-unknown -- `value` is opaque consumer JSON until narrowed here\nfunction validateExcludeList(value: unknown, key: string): string[] {\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n if (!(Array.isArray(value) && value.every((p: unknown) => typeof p === 'string'))) {\n return [`[excludePaths] \"${key}\" must be a string[] of glob paths (use [] for none).`];\n }\n return [];\n}\n\n/**\n * Validate the REQUIRED top-level `excludePaths` block: ONE glob list of paths NO rule judges — hook\n * rules, file-scoped guards and the build's code rules alike (#1253: the code-rules runtime applies it\n * too, through RuleFileScope). Required so every client upgrading is\n * forced to declare it (as [] to keep today's behavior, or with real paths). Returns copy-paste\n * friendly errors and never throws — same contract as validatePrGateSection.\n *\n * The two-list object form `{ \"rules\": [...], \"guards\": [...] }` is RETIRED, not tolerated. It used to be\n * accepted and silently unioned, which is why this repo's own config sat on the dead shape for releases: an\n * accepted shape is never migrated. Rejecting it cannot wedge a consumer — editing webpieces.config.json is\n * always permitted, even while it is invalid. See retired-config-keys.ts.\n */\n// webpieces-disable no-any-unknown -- `section` is opaque consumer JSON until narrowed below\nexport function validateExcludePaths(section: unknown): string[] {\n if (section === undefined || section === null) {\n return [\n `[excludePaths] Not configured in webpieces.config.json. Add this REQUIRED block ` +\n `(use an empty array to keep enforcing everywhere):\\n\\n ${excludePathsExample()}`,\n ];\n }\n if (Array.isArray(section)) return validateExcludeList(section, 'excludePaths');\n if (typeof section !== 'object') {\n return [\n `[excludePaths] Must be a string[] of glob paths. Example:\\n\\n ${excludePathsExample()}`,\n ];\n }\n // webpieces-disable no-any-unknown -- narrowing the opaque excludePaths section from consumer JSON\n const s = section as Record<string, unknown>;\n // The retired two-list object. One table row owns the message for either key present.\n const retired = retiredEntry('rules', '[excludePaths]');\n if (retired && (s['rules'] !== undefined || s['guards'] !== undefined)) {\n return [`${retiredKeyError(retired)}\\n\\n ${excludePathsExample()}`];\n }\n return [\n `[excludePaths] Must be a string[] of glob paths. Example:\\n\\n ${excludePathsExample()}`,\n ];\n}\n\n// ---------------------------------------------------------------------------\n// match-rules — a new top-level ARRAY section (parallel to pr-gate/excludePaths). Each entry is a\n// client-authored content guard (raw-regex patterns + message + scoping). Validated structurally here\n// the same way pr-gate's `gates` are, because an array of objects can't be expressed in FieldDef schema.\n// ---------------------------------------------------------------------------\n\nfunction matchRulesExample(): string {\n return `\"match-rules\": ${JSON.stringify(DEFAULT_MATCH_RULES, null, 4)}`;\n}\n\n// webpieces-disable no-any-unknown -- generic type guard over an opaque JSON value\nfunction isStringArray(value: unknown): value is string[] {\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n return Array.isArray(value) && value.every((v: unknown) => typeof v === 'string');\n}\n\n// Compile a pattern to validate it; returns the error message, or undefined when it compiles.\nfunction regexError(pattern: string): string | undefined {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // Constructed only to validate the syntax; the object is intentionally discarded.\n void new RegExp(pattern);\n return undefined;\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n } catch (err: unknown) {\n const error = toError(err);\n return error.message;\n }\n}\n\n// One entry of the match-rules array, validated field-by-field (see validateGate for the pattern).\n// webpieces-disable no-any-unknown -- one match-rule entry from opaque consumer JSON, validated field-by-field\nfunction validateMatchRule(entry: unknown, index: number): string[] {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) {\n return [\n `[match-rules] entry[${index}] must be an object { name, patterns, mainMessage, mode, turnOffRuleUntilEpoch, turnOffRuleWhileOnBranch, ... }.`,\n ];\n }\n // webpieces-disable no-any-unknown -- narrowing one opaque match-rule entry from consumer JSON\n const e = entry as Record<string, unknown>;\n const label = typeof e['name'] === 'string' ? `\"${e['name']}\"` : `entry[${index}]`;\n const errors: string[] = [];\n\n if (typeof e['name'] !== 'string' || e['name'].trim() === '')\n errors.push(\n `[match-rules] entry[${index}].name must be a non-empty string (it is the disable token and report label).`,\n );\n\n if (!isStringArray(e['patterns']) || e['patterns'].length === 0) {\n errors.push(`[match-rules] ${label}.patterns must be a non-empty string[] of regexes.`);\n } else {\n e['patterns'].forEach((p: string, pi: number) => {\n const rxErr = regexError(p);\n if (rxErr)\n errors.push(\n `[match-rules] ${label}.patterns[${pi}] is not a valid regex: ${rxErr}`,\n );\n });\n }\n\n if (typeof e['mainMessage'] !== 'string' || e['mainMessage'].trim() === '')\n errors.push(`[match-rules] ${label}.mainMessage must be a non-empty string.`);\n\n if (\n typeof e['mode'] !== 'string' ||\n !MODIFIED_CODE_MODES.includes(e['mode'] as (typeof MODIFIED_CODE_MODES)[number])\n )\n errors.push(\n `[match-rules] ${label}.mode must be one of: ${MODIFIED_CODE_MODES.join(', ')}.`,\n );\n\n errors.push(...validateMatchRuleHatches(e, label));\n\n if (e['options'] !== undefined && !isStringArray(e['options']))\n errors.push(`[match-rules] ${label}.options must be a string[] (omit if not needed).`);\n if (e['allowedPaths'] !== undefined && !isStringArray(e['allowedPaths']))\n errors.push(\n `[match-rules] ${label}.allowedPaths must be a string[] of globs (omit if not needed).`,\n );\n if (e['disableAllowed'] !== undefined && typeof e['disableAllowed'] !== 'boolean')\n errors.push(`[match-rules] ${label}.disableAllowed must be a boolean.`);\n\n return errors;\n}\n\n/**\n * Validate the REQUIRED top-level `match-rules` array (client-authored content guards). MISSING →\n * one error printing the ready-to-paste `no-fetch` example (add at least this; more can follow).\n * Present-but-`[]` → allowed (a conscious opt-out, matching pr-gate mode:OFF / excludePaths []).\n * Otherwise every entry is validated field-by-field (each regex compile-checked) plus name\n * uniqueness. Copy-paste-friendly errors; never throws — same contract as validatePrGateSection.\n */\n// webpieces-disable no-any-unknown -- `section` is opaque consumer JSON until narrowed below\nexport function validateMatchRulesSection(section: unknown): string[] {\n if (section === undefined || section === null) {\n return [\n `[match-rules] Not configured in webpieces.config.json. Add this REQUIRED top-level array — ` +\n `seed it with the no-fetch guard below (you can add more entries: no-moment, no-lodash-chain, …):\\n\\n${matchRulesExample()}`,\n ];\n }\n if (!Array.isArray(section)) {\n return [\n `[match-rules] Must be an array of content-guard objects. Example:\\n\\n${matchRulesExample()}`,\n ];\n }\n\n const errors: string[] = [];\n const seen = new Set<string>();\n for (let i = 0; i < section.length; i += 1) {\n errors.push(...validateMatchRule(section[i], i));\n // webpieces-disable no-any-unknown -- reading the name off an opaque entry only to dedupe\n const name = (section[i] as Record<string, unknown> | null)?.['name'];\n if (typeof name === 'string') {\n if (seen.has(name))\n errors.push(\n `[match-rules] duplicate entry name \"${name}\" — each match-rule name must be unique.`,\n );\n seen.add(name);\n }\n }\n return errors;\n}\n\n// webpieces-disable no-any-unknown -- explicit match-rule JSON is checked field by field\n// webpieces-disable no-function-outside-class -- pure validation helper\nfunction validateMatchRuleHatches(e: Record<string, unknown>, label: string): string[] {\n const errors: string[] = [];\n // Both escape hatches are REQUIRED on every match-rule too (same as keyed rules), so they are always\n // visible. turnOffRuleUntilEpoch: number (0 = active; a future unix-epoch in seconds = temporarily\n // off). turnOffRuleWhileOnBranch: string | null (null = always on; an EXACT branch name — matched\n // with ===, never as a glob — disables the rule while that branch is checked out).\n if (typeof e['turnOffRuleUntilEpoch'] !== 'number') {\n errors.push(\n `[match-rules] ${label}.turnOffRuleUntilEpoch must be a number (0 = active; future unix-epoch seconds = temporarily off).`,\n );\n } else {\n const capError = epochCapError(`[match-rules] ${label}`, e['turnOffRuleUntilEpoch']);\n if (capError) errors.push(capError);\n }\n if (\n !(\n e['turnOffRuleWhileOnBranch'] === null ||\n typeof e['turnOffRuleWhileOnBranch'] === 'string'\n )\n )\n errors.push(\n `[match-rules] ${label}.turnOffRuleWhileOnBranch must be a string or null (null = no branch / always on; a string is an EXACT branch name, globs are not supported).`,\n );\n\n // The old escape-hatch names were renamed — flag them precisely.\n for (const oldKey of new PolicyFieldConstraints().retiredFields()) {\n if (oldKey in e)\n errors.push(\n renamedFieldError(`[match-rules] ${label}`, oldKey, new PolicyFieldConstraints().renamedField(oldKey)!),\n );\n }\n\n return errors;\n}\n"]}
1
+ {"version":3,"file":"validate-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/validate-config.ts"],"names":[],"mappings":";;;AAwSA,0DA8DC;AA+BD,oDAuBC;AA+FD,8DA4BC;AAvhBD,yEAAoE;AACpE,uEAAqE;AAA5D,mIAAA,uBAAuB,OAAA;AAOhC,6CAAqE;AACrE,oDAA2D;AAC3D,6EAMsC;AAK7B,0GAVL,sDAAyB,OAUK;AAJlC,+DAAsF;AACtF,2CAAoD;AAIpD,yFAAyF;AACzF,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAC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B,CAAC","sourcesContent":["import { PolicyFieldConstraints } from './policy-field-constraints';\nexport { MAX_TURN_OFF_EPOCH_DAYS } from './policy-field-constraints';\nimport { FieldDef, RetiredConfigKey } from '@webpieces/rules-sdk';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { allRuleNames } from './rule-schemas';\nimport { recommendedSeedModeFor, isGradualMode } from './seed-entry';\nimport { MODIFIED_CODE_MODES } from '@webpieces/rules-sdk';\nimport {\n validateChecklistsSection,\n validateDevDeploySection,\n validateLandPrSection,\n validateNoGateSaltRationale,\n validateReviewerAgentKeys,\n} from './pr-gate-section-validators';\nimport { retiredEntry, retiredKeyError, retiredRuleFor } from './retired-config-keys';\nimport { PRUNE_UNKNOWN_COMMAND } from './constants';\n\n// Re-exported so the isolated validate-checklist-docs target keeps importing it from here.\nexport { validateChecklistsSection };\n// Re-exported from their new homes: this module was the historical entry point for both.\nexport { allRuleNames } from './rule-schemas';\nexport { recommendedSeedMode, recommendedSeedModeFor, seedEntryForRule } from './seed-entry';\nimport { DEFAULT_MATCH_RULES } from './match-rules-config';\nimport { toError } from '@webpieces/tooling-common/to-error';\n\n/**\n * The longest a `turnOffRuleUntilEpoch` may reach into the future: ONE WEEK — a hard ceiling, not the\n * advice. The advice every cure gives (#1318) is the BRANCH hatch first, and the epoch only as a last\n * resort set to now + 1 hour, because it is REPO-WIDE while it lasts (see TurnOffRuleCure).\n *\n * DELIBERATELY ASYMMETRIC with turnOffRuleWhileOnBranch, which has NO cap and must not get one. The epoch\n * hatch is REPO-WIDE while it lasts, so a long window shelters every unrelated change that lands inside it\n * (a fleet repo was found with max-file-lines/max-method-lines switched off until 2026-10-01 — 43 days\n * out, six times this cap). The branch hatch fires only on ONE exact branch name — a big refactor\n * legitimately runs 35+ days, and capping that would only interrupt the one branch that opted in.\n */\n\n/**\n * Reject a `turnOffRuleUntilEpoch` more than MAX_TURN_OFF_EPOCH_DAYS into the future.\n *\n * A PAST epoch is always valid: it is inert (it skips nothing), and every existing config is full of them.\n * The BOUNDARY is inclusive — exactly MAX_TURN_OFF_EPOCH_DAYS out is accepted, only strictly beyond it is\n * refused — so a config written as \"now + 7 days\" is never rejected by the second it took to save.\n */\n// webpieces-disable no-function-outside-class -- module-scope validator helper, matching every other check in this file\nfunction epochCapError(label: string, value: number): string | null {\n return new PolicyFieldConstraints().epochError(label, value);\n}\n\nfunction valueHint(def: FieldDef, key?: string): string {\n // The two universal escape hatches, REQUIRED on every rule so they're always visible. Spell out the\n // \"off\" value so a fresh config seeds them in the active/no-op state (0 / null), not a placeholder.\n if (key === 'turnOffRuleUntilEpoch')\n return '0 (0 = active; future unix-epoch seconds = temporarily off)';\n if (key === 'turnOffRuleWhileOnBranch')\n return 'null (null = always on; an EXACT branch name — no globs — disables the rule while that branch is checked out)';\n return def.enumValues\n ? `\"${def.enumValues.join(' | ')}\"`\n : def.type === 'string[]'\n ? '[\"<string>\", ...]'\n : def.type === 'object[]'\n ? objectListHint(def)\n : def.type === 'number'\n ? '<number>'\n : def.type === 'boolean'\n ? '<boolean>'\n : '\"<string>\"';\n}\n\n/** `[{ \"paths\": [\"<string>\", ...], \"suffixes\": [\"<string>\", ...] }, ...]` — one element spelled out from its schema. */\n// webpieces-disable no-function-outside-class -- module-scope sibling of valueHint\nfunction objectListHint(def: FieldDef): string {\n const schema: Readonly<Record<string, FieldDef>> = def.elementSchema ?? {};\n const fields = Object.keys(schema)\n .filter((key: string) => !schema[key].optional)\n .map((key: string) => `\"${key}\": ${valueHint(schema[key], key)}`);\n return `[{ ${fields.join(', ')} }, ...]`;\n}\n\n/**\n * A config key whose schema is absent from every explicitly selected owner manifest. THE FALLBACK: it fires for any name the table in retired-config-keys.ts does not\n * know, which very much includes RETIRED names on a tree whose validator predates the retirement — the\n * ordinary linked-worktree layout, where the worktree is on one release and the parent checkout that\n * supplies the hook's resolution is on an older one. So this text has to be useful with NO table entry.\n *\n * DELETION LEADS, and it is not a hedge. A key the running validator has no schema for controls nothing:\n * every code path that would read it is keyed off the schema. Leaving it is dead config that reads as live\n * config, and for a retired key deleting it is the entire fix.\n *\n * This message used to lead with `pnpm install` instead, on the theory that the key might be valid and the\n * validator merely stale. Two things are wrong with that. First, it CONTRADICTED the banner this error is\n * printed inside, which states outright that `pnpm install` cannot help — one output, two opposite orders.\n * Second, the premise is already handled upstream: the shim's version-drift guard compares the pin against\n * the installed version and denies every tool call BEFORE exec'ing this validator, with its own message and\n * its own cure. If this text is on screen, that guard found no drift. The pin therefore appears here only as\n * a secondary note, so a valid-but-newer key is never dropped without the reader being told the case exists.\n */\nfunction unknownRuleError(ruleName: string): string {\n return (\n `[${ruleName}] Unknown rule — the running @webpieces validator has no selected owner schema for it. A key no validator knows controls NOTHING, so ` +\n `DELETE the \"${ruleName}\" key from the direct policy-ID map in its declared owner config file. ` +\n `Run \\`${PRUNE_UNKNOWN_COMMAND}\\` to remove unknown entries from declared owner files mechanically. ` +\n `It may be RETIRED: a newer release can move ` +\n `a setting out of this file entirely, in which case deleting the key here is the WHOLE fix. ` +\n `MACHINE-LOCAL settings in particular now live in ~/.webpieces/config.json under \"experimental\" — ` +\n `an optional file tracked by no repo, whose absence is the default behaviour — so if ` +\n `\"${ruleName}\" is one of those, delete it here and set it there. Secondary, and rare: a key is ` +\n `valid-but-unlearned when package.json pins an @webpieces OLDER than this config was written for, ` +\n `and the version-drift guard reports THAT separately with its own cure (bump the pin) before this ` +\n `validator ever runs — so it is not what you are looking at.`\n );\n}\n\n/** Schema advice names the selected owner rather than a retired root section. */\nclass RuleConfigAdvice {\n constructor(private readonly registry: RulePackRegistry) {}\n\n private rolloutTip(schema: Readonly<Record<string, FieldDef>>): string {\n const modes = schema['mode']?.enumValues ?? [];\n // Same source of truth as the seeder; only a GRADUAL recommendation gets the rollout prose, so a\n // rule whose recommendation falls through to ON/RUN_EVERY_TIME/OFF prints no tip (as before).\n const recommended = recommendedSeedModeFor(modes);\n if (!isGradualMode(recommended)) return '';\n const optOut = modes.includes('OFF') ? ' Set \"mode\": \"OFF\" to opt out entirely.' : '';\n return (\n `\\n\\n💡 Recommended: start with \"mode\": \"${recommended}\" — it enforces only on what you ` +\n `actually change, so the rule rolls out gradually (existing code stays grandfathered until ` +\n `you next touch that project/file/method).${optOut}`\n );\n }\n\n missingRuleSnippet(ruleName: string, schema: Readonly<Record<string, FieldDef>>): string {\n // Required fields go in the copy-paste entry. The two universal escape hatches\n // (turnOffRuleUntilEpoch / turnOffRuleWhileOnBranch) are now REQUIRED, so they land in that block —\n // which is the whole point: every seeded rule shows both hatches. Optional fields are listed separately.\n const fields = Object.keys(schema);\n const required = fields.filter((f: string) => !schema[f].optional);\n const optional = fields.filter((f: string) => schema[f].optional);\n\n const requiredLines = required.map((f: string) => ` \"${f}\": ${valueHint(schema[f], f)}`);\n const owner = this.registry.ownerOf(ruleName);\n let out =\n `[${ruleName}] Not configured in the declared owner config file for ${owner}. ` +\n `Add this entry directly to that file's policy-ID map\\n` +\n `(choose values appropriate for your project):\\n\\n` +\n ` \"${ruleName}\": {\\n${requiredLines.join(',\\n')}\\n }`;\n\n if (optional.length > 0) {\n const optionalLines = optional.map(\n (f: string) => ` \"${f}\": ${valueHint(schema[f], f)}`,\n );\n out +=\n `\\n\\nOptional fields you may add to this rule (omit if not needed):\\n` +\n `${optionalLines.join(',\\n')}`;\n }\n out += this.rolloutTip(schema);\n return out;\n }\n}\n\n// Fields we DELETED from a rule's schema, keyed by \"<rule>.<field>\". The generic unknown-field error\n// (\"Unknown field ... Valid fields: [...]\") is correct but doesn't say WHY the field vanished, so an AI\n// might re-add it. These hints explain the removal so the only action left is to delete the key.\n\n// Universal field renames (apply to EVERY rule/guard AND every match-rule, unlike the per-rule\n// RETIRED_FIELD_HINTS). When an entry still uses the old escape-hatch name, the generic unknown-field\n// error is replaced with a precise \"renamed to X — rename it\" instruction so the fix is mechanical.\n\n\n// The renamed-field message shared by keyed rules and match-rules.\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction renamedFieldError(scope: string, oldKey: string, newKey: string): string {\n return `${scope} Unknown field \"${oldKey}\" — it was renamed to \"${newKey}\". Rename it (the value carries over unchanged; for the branch hatch, use null when there is no branch).`;\n}\n\n/**\n * Field-level errors for ONE configured rule entry: unknown/renamed/retired keys, type and enum\n * mismatches, and the two-week cap on turnOffRuleUntilEpoch.\n *\n * Extracted out of validateWebpiecesConfig purely so that function stays inside max-method-lines; it is\n * the same checks in the same order.\n */\n// webpieces-disable no-any-unknown -- one config entry as opaque JSON; every field is typed-checked below\n// webpieces-disable no-function-outside-class -- module-scope validator helper, matching every other check in this file\nfunction fieldErrors(\n ruleName: string,\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n entry: Record<string, unknown>,\n schema: Readonly<Record<string, FieldDef>>,\n registry: RulePackRegistry,\n): string[] {\n const errors: string[] = [];\n for (const [key, value] of Object.entries(entry)) {\n const fieldDef = schema[key];\n if (!fieldDef) {\n const renamedTo = new PolicyFieldConstraints().renamedField(key);\n if (renamedTo) {\n errors.push(renamedFieldError(`[${ruleName}]`, key, renamedTo));\n continue;\n }\n const retiredHint = registry\n .migrations()\n .find(\n (entry: RetiredConfigKey) =>\n entry.scope === 'field' && entry.key === `${ruleName}.${key}`,\n )?.instruction;\n const suffix = retiredHint ? ` ${retiredHint}` : '';\n errors.push(\n `[${ruleName}] Unknown field \"${key}\". Valid fields: [${Object.keys(schema).join(', ')}].${suffix}`,\n );\n continue;\n }\n // A nullable field (e.g. turnOffRuleWhileOnBranch) accepts JSON null in addition to its type.\n if (value === null && fieldDef.nullable) continue;\n if (fieldDef.type === 'string[]' || fieldDef.type === 'object[]') {\n errors.push(...arrayFieldErrors(`[${ruleName}] \"${key}\"`, value, fieldDef));\n } else if (typeof value !== fieldDef.type) {\n errors.push(`[${ruleName}] \"${key}\" must be ${fieldDef.type}, got ${typeof value}.`);\n } else if (fieldDef.enumValues && !fieldDef.enumValues.includes(value as string)) {\n errors.push(\n `[${ruleName}] \"${key}\" = \"${value}\" is not valid. Must be one of: ${fieldDef.enumValues.join(', ')}.`,\n );\n } else if (key === 'turnOffRuleUntilEpoch') {\n const capError = epochCapError(`[${ruleName}]`, value as number);\n if (capError) errors.push(capError);\n } else if (\n ruleName === 'branch-state-guard' &&\n key === 'maxCommitsBehind' &&\n (!Number.isInteger(value) || (value as number) < 0)\n ) {\n errors.push('[branch-state-guard] \"maxCommitsBehind\" must be a non-negative integer.');\n }\n }\n return errors;\n}\n\n/**\n * Errors for one array-typed field (`string[]` / `object[]`): the element type, `nonEmpty`, and — for\n * `object[]` — every element against the field's `elementSchema` (unknown keys, missing required keys,\n * and each element field checked recursively). `label` is `[rule] \"field\"`, extended per element\n * (`[rule] \"entries\"[0].suffixes`) so an error names the exact spot to edit.\n */\n// webpieces-disable no-any-unknown -- a config field value is opaque JSON until this checks its shape\n// webpieces-disable no-function-outside-class -- module-scope validator helper, matching every other check in this file\n// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\nfunction arrayFieldErrors(label: string, value: unknown, def: FieldDef): string[] {\n const isObjects = def.type === 'object[]';\n // webpieces-disable no-any-unknown -- one list element as opaque JSON; this line is what checks its shape\n const elementOk = (v: unknown): boolean =>\n isObjects\n ? typeof v === 'object' && v !== null && !Array.isArray(v)\n : typeof v === 'string';\n if (!Array.isArray(value) || !value.every(elementOk)) {\n const shape = isObjects ? 'a list of objects' : 'string[]';\n return [\n `${label} must be ${shape}, got ${Array.isArray(value) ? 'a list holding something else' : typeof value}.`,\n ];\n }\n if (def.nonEmpty && value.length === 0) {\n return [\n `${label} must not be empty — an empty list judges nothing while reading as configured. Add ${valueHint(def)}.` +\n (def.emptyInstruction === undefined ? '' : ` ${def.emptyInstruction}`),\n ];\n }\n if (!isObjects || def.elementSchema === undefined) return [];\n const errors: string[] = [];\n const schema = def.elementSchema;\n // webpieces-disable no-any-unknown -- an element's fields are opaque JSON until checked against its schema below\n value.forEach((element: Record<string, unknown>, index: number) => {\n const at = `${label}[${index}]`;\n for (const key of Object.keys(element)) {\n if (!(key in schema))\n errors.push(\n `${at} Unknown field \"${key}\". Valid fields: [${Object.keys(schema).join(', ')}].`,\n );\n }\n for (const [key, fieldDef] of Object.entries(schema)) {\n if (!(key in element)) {\n if (!fieldDef.optional)\n errors.push(\n `${at} Missing required field \"${key}\". Add ${key}: ${valueHint(fieldDef, key)}.`,\n );\n } else if (fieldDef.type === 'string[]' || fieldDef.type === 'object[]') {\n errors.push(...arrayFieldErrors(`${at}.${key}`, element[key], fieldDef));\n } else if (typeof element[key] !== fieldDef.type) {\n errors.push(`${at}.${key} must be ${fieldDef.type}, got ${typeof element[key]}.`);\n }\n }\n });\n return errors;\n}\n\n// webpieces-disable no-any-unknown -- rawRules values are opaque JSON; each field is validated individually\nexport function validateWebpiecesConfig(\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n rawRules: Record<string, Record<string, unknown>>,\n registry: RulePackRegistry,\n): string[] {\n const errors: string[] = [];\n const advice = new RuleConfigAdvice(registry);\n\n // Check field-level correctness for rules that are present\n for (const [ruleName, entry] of Object.entries(rawRules)) {\n const schema = registry.hasRule(ruleName) ? registry.schemaFor(ruleName) : undefined;\n if (!schema) {\n if (\n registry.isSafeguard(ruleName) &&\n !registry\n .migrations()\n .some(\n (entry: RetiredConfigKey) =>\n entry.scope === 'rule' && entry.key === ruleName,\n )\n ) {\n errors.push(\n `[${ruleName}] is a cataloged safeguard, not a configurable policy. Delete its config entry; fixed safety cannot be disabled.`,\n );\n continue;\n }\n // A name we KNOW is retired beats the generic unknown-rule message, because only the table\n // knows WHERE the setting went — a rename carries its value over, and a bare \"delete it\"\n // would throw that value away. Client packs must not reuse a retired canonical ID.\n const retired = retiredRuleFor(ruleName, registry);\n if (retired) {\n errors.push(retiredKeyError(retired));\n continue;\n }\n // Client policies require a schema from an explicitly selected owner.\n errors.push(unknownRuleError(ruleName));\n continue;\n }\n errors.push(...fieldErrors(ruleName, entry, schema, registry));\n // Required fields must actually be present. Until now the loop above only checked\n // fields that WERE present, so an entry like `{}` (or one missing `mode` /\n // `turnOffRuleUntilEpoch`) slipped through. Every non-optional schema field is mandatory.\n for (const [key, fieldDef] of Object.entries(schema)) {\n if (!fieldDef.optional && !(key in entry)) {\n errors.push(\n `[${ruleName}] Missing required field \"${key}\". Add ${key}: ${valueHint(fieldDef, key)}.`,\n );\n }\n }\n }\n\n // Every built-in rule must be explicitly configured — no silent defaults.\n // When a new rule is added to the framework, this check surfaces it immediately\n // with a ready-to-copy snippet so AI can configure it in one pass.\n for (const ruleName of registry.ruleIds()) {\n const schema = registry.schemaFor(ruleName);\n if (!(ruleName in rawRules)) {\n errors.push(advice.missingRuleSnippet(ruleName, schema));\n }\n }\n\n return errors;\n}\n\nexport { validatePrGateSection } from './validate-pr-gate';\n\nfunction excludePathsExample(): string {\n return '\"excludePaths\": [\"repositories/**\"]';\n}\n\n// A glob list: must be a string[] (may be empty). `key` names it for the error.\n// webpieces-disable no-any-unknown -- `value` is opaque consumer JSON until narrowed here\nfunction validateExcludeList(value: unknown, key: string): string[] {\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n if (!(Array.isArray(value) && value.every((p: unknown) => typeof p === 'string'))) {\n return [`[excludePaths] \"${key}\" must be a string[] of glob paths (use [] for none).`];\n }\n return [];\n}\n\n/**\n * Validate the REQUIRED top-level `excludePaths` block: ONE glob list of paths NO rule judges — hook\n * rules, file-scoped guards and the build's code rules alike (#1253: the code-rules runtime applies it\n * too, through RuleFileScope). Required so every client upgrading is\n * forced to declare it (as [] to keep today's behavior, or with real paths). Returns copy-paste\n * friendly errors and never throws — same contract as validatePrGateSection.\n *\n * The two-list object form `{ \"rules\": [...], \"guards\": [...] }` is RETIRED, not tolerated. It used to be\n * accepted and silently unioned, which is why this repo's own config sat on the dead shape for releases: an\n * accepted shape is never migrated. Rejecting it cannot wedge a consumer — editing webpieces.config.json is\n * always permitted, even while it is invalid. See retired-config-keys.ts.\n */\n// webpieces-disable no-any-unknown -- `section` is opaque consumer JSON until narrowed below\nexport function validateExcludePaths(section: unknown): string[] {\n if (section === undefined || section === null) {\n return [\n `[excludePaths] Not configured in webpieces.config.json. Add this REQUIRED block ` +\n `(use an empty array to keep enforcing everywhere):\\n\\n ${excludePathsExample()}`,\n ];\n }\n if (Array.isArray(section)) return validateExcludeList(section, 'excludePaths');\n if (typeof section !== 'object') {\n return [\n `[excludePaths] Must be a string[] of glob paths. Example:\\n\\n ${excludePathsExample()}`,\n ];\n }\n // webpieces-disable no-any-unknown -- narrowing the opaque excludePaths section from consumer JSON\n const s = section as Record<string, unknown>;\n // The retired two-list object. One table row owns the message for either key present.\n const retired = retiredEntry('rules', '[excludePaths]');\n if (retired && (s['rules'] !== undefined || s['guards'] !== undefined)) {\n return [`${retiredKeyError(retired)}\\n\\n ${excludePathsExample()}`];\n }\n return [\n `[excludePaths] Must be a string[] of glob paths. Example:\\n\\n ${excludePathsExample()}`,\n ];\n}\n\n// ---------------------------------------------------------------------------\n// match-rules — a new top-level ARRAY section (parallel to pr-gate/excludePaths). Each entry is a\n// client-authored content guard (raw-regex patterns + message + scoping). Validated structurally here\n// the same way pr-gate's `gates` are, because an array of objects can't be expressed in FieldDef schema.\n// ---------------------------------------------------------------------------\n\nfunction matchRulesExample(): string {\n return `\"match-rules\": ${JSON.stringify(DEFAULT_MATCH_RULES, null, 4)}`;\n}\n\n// webpieces-disable no-any-unknown -- generic type guard over an opaque JSON value\nfunction isStringArray(value: unknown): value is string[] {\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n return Array.isArray(value) && value.every((v: unknown) => typeof v === 'string');\n}\n\n// Compile a pattern to validate it; returns the error message, or undefined when it compiles.\nfunction regexError(pattern: string): string | undefined {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // Constructed only to validate the syntax; the object is intentionally discarded.\n void new RegExp(pattern);\n return undefined;\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n } catch (err: unknown) {\n const error = toError(err);\n return error.message;\n }\n}\n\n// One entry of the match-rules array, validated field-by-field (see validateGate for the pattern).\n// webpieces-disable no-any-unknown -- one match-rule entry from opaque consumer JSON, validated field-by-field\nfunction validateMatchRule(entry: unknown, index: number): string[] {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) {\n return [\n `[match-rules] entry[${index}] must be an object { name, patterns, mainMessage, mode, turnOffRuleUntilEpoch, turnOffRuleWhileOnBranch, ... }.`,\n ];\n }\n // webpieces-disable no-any-unknown -- narrowing one opaque match-rule entry from consumer JSON\n const e = entry as Record<string, unknown>;\n const label = typeof e['name'] === 'string' ? `\"${e['name']}\"` : `entry[${index}]`;\n const errors: string[] = [];\n\n if (typeof e['name'] !== 'string' || e['name'].trim() === '')\n errors.push(\n `[match-rules] entry[${index}].name must be a non-empty string (it is the disable token and report label).`,\n );\n\n if (!isStringArray(e['patterns']) || e['patterns'].length === 0) {\n errors.push(`[match-rules] ${label}.patterns must be a non-empty string[] of regexes.`);\n } else {\n e['patterns'].forEach((p: string, pi: number) => {\n const rxErr = regexError(p);\n if (rxErr)\n errors.push(\n `[match-rules] ${label}.patterns[${pi}] is not a valid regex: ${rxErr}`,\n );\n });\n }\n\n if (typeof e['mainMessage'] !== 'string' || e['mainMessage'].trim() === '')\n errors.push(`[match-rules] ${label}.mainMessage must be a non-empty string.`);\n\n if (\n typeof e['mode'] !== 'string' ||\n !MODIFIED_CODE_MODES.includes(e['mode'] as (typeof MODIFIED_CODE_MODES)[number])\n )\n errors.push(\n `[match-rules] ${label}.mode must be one of: ${MODIFIED_CODE_MODES.join(', ')}.`,\n );\n\n errors.push(...validateMatchRuleHatches(e, label));\n\n if (e['options'] !== undefined && !isStringArray(e['options']))\n errors.push(`[match-rules] ${label}.options must be a string[] (omit if not needed).`);\n if (e['allowedPaths'] !== undefined && !isStringArray(e['allowedPaths']))\n errors.push(\n `[match-rules] ${label}.allowedPaths must be a string[] of globs (omit if not needed).`,\n );\n if (e['disableAllowed'] !== undefined && typeof e['disableAllowed'] !== 'boolean')\n errors.push(`[match-rules] ${label}.disableAllowed must be a boolean.`);\n\n return errors;\n}\n\n/**\n * Validate the REQUIRED top-level `match-rules` array (client-authored content guards). MISSING →\n * one error printing the ready-to-paste `no-fetch` example (add at least this; more can follow).\n * Present-but-`[]` → allowed (a conscious opt-out, matching pr-gate mode:OFF / excludePaths []).\n * Otherwise every entry is validated field-by-field (each regex compile-checked) plus name\n * uniqueness. Copy-paste-friendly errors; never throws — same contract as validatePrGateSection.\n */\n// webpieces-disable no-any-unknown -- `section` is opaque consumer JSON until narrowed below\nexport function validateMatchRulesSection(section: unknown): string[] {\n if (section === undefined || section === null) {\n return [\n `[match-rules] Not configured in webpieces.config.json. Add this REQUIRED top-level array — ` +\n `seed it with the no-fetch guard below (you can add more entries: no-moment, no-lodash-chain, …):\\n\\n${matchRulesExample()}`,\n ];\n }\n if (!Array.isArray(section)) {\n return [\n `[match-rules] Must be an array of content-guard objects. Example:\\n\\n${matchRulesExample()}`,\n ];\n }\n\n const errors: string[] = [];\n const seen = new Set<string>();\n for (let i = 0; i < section.length; i += 1) {\n errors.push(...validateMatchRule(section[i], i));\n // webpieces-disable no-any-unknown -- reading the name off an opaque entry only to dedupe\n const name = (section[i] as Record<string, unknown> | null)?.['name'];\n if (typeof name === 'string') {\n if (seen.has(name))\n errors.push(\n `[match-rules] duplicate entry name \"${name}\" — each match-rule name must be unique.`,\n );\n seen.add(name);\n }\n }\n return errors;\n}\n\n// webpieces-disable no-any-unknown -- explicit match-rule JSON is checked field by field\n// webpieces-disable no-function-outside-class -- pure validation helper\nfunction validateMatchRuleHatches(e: Record<string, unknown>, label: string): string[] {\n const errors: string[] = [];\n // Both escape hatches are REQUIRED on every match-rule too (same as keyed rules), so they are always\n // visible. turnOffRuleUntilEpoch: number (0 = active; a future unix-epoch in seconds = temporarily\n // off). turnOffRuleWhileOnBranch: string | null (null = always on; an EXACT branch name — matched\n // with ===, never as a glob — disables the rule while that branch is checked out).\n if (typeof e['turnOffRuleUntilEpoch'] !== 'number') {\n errors.push(\n `[match-rules] ${label}.turnOffRuleUntilEpoch must be a number (0 = active; future unix-epoch seconds = temporarily off).`,\n );\n } else {\n const capError = epochCapError(`[match-rules] ${label}`, e['turnOffRuleUntilEpoch']);\n if (capError) errors.push(capError);\n }\n if (\n !(\n e['turnOffRuleWhileOnBranch'] === null ||\n typeof e['turnOffRuleWhileOnBranch'] === 'string'\n )\n )\n errors.push(\n `[match-rules] ${label}.turnOffRuleWhileOnBranch must be a string or null (null = no branch / always on; a string is an EXACT branch name, globs are not supported).`,\n );\n\n // The old escape-hatch names were renamed — flag them precisely.\n for (const oldKey of new PolicyFieldConstraints().retiredFields()) {\n if (oldKey in e)\n errors.push(\n renamedFieldError(`[match-rules] ${label}`, oldKey, new PolicyFieldConstraints().renamedField(oldKey)!),\n );\n }\n\n return errors;\n}\n"]}
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Requirement
4
4
 
5
- **~99% of the time**, you can stay under the `limit` from nx.json
5
+ **~99% of the time**, you can stay under the `limit` on the max-method-lines entry of your rule config
6
6
  by extracting logical units into well-named methods.
7
7
  Nearly all software can be written with methods under this size.
8
8
  Take the extra time to refactor - it's worth it for long-term maintainability.
@@ -26,8 +26,8 @@ Methods under reasonable limits are:
26
26
  ## Gradual Cleanup Strategy
27
27
 
28
28
  This codebase uses a gradual cleanup approach:
29
- - **New methods**: Must be under `limit` from nx.json
30
- - **Modified methods**: Must be under `limit` from nx.json
29
+ - **New methods**: Must be under `limit` (the max-method-lines entry of your rule config)
30
+ - **Modified methods**: Must be under `limit` (the max-method-lines entry of your rule config)
31
31
  - **Untouched methods**: No limit (legacy code is allowed until touched)
32
32
 
33
33
  ## How to Refactor