@webpieces/rules-config 0.4.927 → 0.4.928

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.
@@ -1 +1 @@
1
- {"version":3,"file":"rule-pack-sync.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-pack-sync.ts"],"names":[],"mappings":";;;;AAAA,oDAA8B;AAC9B,wDAAkC;AAClC,yCAA2D;AAC3D,oDAAyE;AACzE,8DAAwF;AACxF,+CAA4D;AAC5D,2DAA0E;AAC1E,6DAAwD;AACxD,yDAA0D;AAC1D,+EAAwE;AACxE,uDAAoF;AAEpF,MAAM,aAAa;IAEF;IACA;IAFb,YACa,QAAgB,EAChB,OAAqC;QADrC,aAAQ,GAAR,QAAQ,CAAQ;QAChB,YAAO,GAAP,OAAO,CAA8B;IAC/C,CAAC;CACP;AAED;;;;GAIG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEA;IACA;IACA;IAHrB,YACqB,UAAsB,EACtB,KAAsB,EACtB,MAAkB;QAFlB,eAAU,GAAV,UAAU,CAAY;QACtB,UAAK,GAAL,KAAK,CAAiB;QACtB,WAAM,GAAN,MAAM,CAAY;IACpC,CAAC;IAEJ,GAAG,CAAC,IAAY;QACZ,MAAM,aAAa,GAAG,IAAI,iCAAgB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,6BAAe,CAAC,CAAC;QAClD,wGAAwG;QACxG,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAA4B,CAAC;QACpF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QAC/F,MAAM,QAAQ,GAAG,I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,CAAC;IAC5C,CAAC;CACJ,CAAA;AAnGY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGJ,wBAAU;QACf,mCAAe;QACd,2BAAU;GAJ9B,YAAY,CAmGxB","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ConfigObject, OwnedRuleDefinition } from '@webpieces/rules-sdk';\nimport { AtomicFile, InformAiError, RepositoryLayout } from '@webpieces/tooling-common';\nimport { ConfigFile, CONFIG_FILENAME } from './config-file';\nimport { PackPolicyFiles, SelectedPolicyPack } from './pack-policy-files';\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { validateTopLevelKeys } from './config-key-rules';\nimport { validateCommandsSection } from './commands-section-validators';\nimport { validateExcludePaths, validateMatchRulesSection } from './validate-config';\n\nclass OwnerFilePlan {\n constructor(\n readonly filename: string,\n readonly entries: Record<string, ConfigObject>,\n ) {}\n}\n\n/**\n * Writes the owners' recommended seeds into the declared owner files, for review — the installer's and\n * `wp-migrate-dirs`' explicit file mutation. Normal configuration loading never calls this service: a\n * missing entry is a deny naming the file and the entry to paste, not something loading supplies.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class RulePackSync {\n constructor(\n private readonly configFile: ConfigFile,\n private readonly files: PackPolicyFiles,\n private readonly atomic: AtomicFile,\n ) {}\n\n run(root: string): readonly string[] {\n const layoutChanges = new RepositoryLayout().migrate(root);\n const filename = path.join(root, CONFIG_FILENAME);\n // webpieces-disable no-any-unknown -- the sync reads opaque JSON only at this explicit command boundary\n const document = this.configFile.readRawConfig(filename) as Record<string, unknown>;\n const selected = this.files.select(root, this.files.declarations(document['rulePacks'], root));\n const registry = new RulePackRegistry(\n selected.map((pack: SelectedPolicyPack) => pack.manifest),\n );\n for (const pack of selected)\n registry.recordModuleLocation(pack.manifest.packageName, pack.declaration.moduleName());\n this.validateRoot(document, root);\n const plans = this.prepare(root, selected, registry);\n const changed: string[] = [...layoutChanges];\n for (const plan of plans) {\n if (\n this.atomic.writeIfChanged(\n plan.filename,\n JSON.stringify(plan.entries, null, 2) + '\\n',\n )\n )\n changed.push(plan.filename);\n }\n return changed;\n }\n\n private prepare(\n root: string,\n selected: readonly SelectedPolicyPack[],\n registry: RulePackRegistry,\n ): readonly OwnerFilePlan[] {\n const plans: OwnerFilePlan[] = [];\n const errors: string[] = [];\n for (const pack of selected) {\n const filename = this.files.configPath(root, pack.declaration.config);\n const entries = fs.existsSync(filename) ? this.files.read(filename) : {};\n for (const id of Object.keys(entries)) {\n if (!registry.hasRule(id) || registry.ownerOf(id) !== pack.manifest.packageName) {\n errors.push(\n `${filename}: ${id} has another owner or is unknown. Move or remove it explicitly before sync.`,\n );\n }\n }\n for (const definition of pack.manifest.ownedRules) {\n const value = this.seedMissing(entries[definition.id], definition);\n errors.push(\n ...registry\n .validateRuleConfig(definition.id, value)\n .map((error: string) => `${filename}: ${error}`),\n );\n entries[definition.id] = value;\n }\n plans.push(new OwnerFilePlan(filename, entries));\n }\n if (errors.length) throw new InformAiError(`Sync made no changes:\\n${errors.join('\\n')}`);\n return plans;\n }\n\n private seedMissing(\n previous: ConfigObject | undefined,\n definition: OwnedRuleDefinition,\n ): ConfigObject {\n const value =\n previous === undefined\n ? structuredClone(definition.recommendedSeed)\n : Object.assign(new ConfigObject(), this.object(previous, definition.id));\n for (const field of Object.keys(definition.schema)) {\n if (!definition.schema[field].optional && !Object.hasOwn(value, field)) {\n value[field] = structuredClone(definition.recommendedSeed[field]);\n }\n }\n return value;\n }\n\n // webpieces-disable no-any-unknown -- the same generic-root validators run before any write\n private validateRoot(document: Record<string, unknown>, root: string): void {\n const errors = [\n ...validateTopLevelKeys(document),\n ...validateCommandsSection(document['commands'], document['pr-gate'], root),\n ...validateExcludePaths(document['excludePaths']),\n ...validateMatchRulesSection(document['match-rules']),\n ];\n if (errors.length) throw new InformAiError(`Sync made no changes:\\n${errors.join('\\n')}`);\n }\n\n // webpieces-disable no-any-unknown -- JSON object narrowing preserves explicit values for subsequent schema validation\n private object(value: unknown, label: string): Record<string, unknown> {\n if (!value || typeof value !== 'object' || Array.isArray(value))\n throw new InformAiError(`${label} must be a JSON object. Repair it before sync.`);\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n return value as Record<string, unknown>;\n }\n}\n"]}
1
+ {"version":3,"file":"rule-pack-sync.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-pack-sync.ts"],"names":[],"mappings":";;;;AAAA,oDAA8B;AAC9B,wDAAkC;AAClC,yCAA2D;AAC3D,oDAAmF;AACnF,8DAAwF;AACxF,+CAA4D;AAC5D,2DAA0E;AAC1E,6DAAwD;AACxD,yDAA0D;AAC1D,+EAAwE;AACxE,uDAAoF;AAEpF,MAAM,aAAa;IAEF;IACA;IAFb,YACa,QAAgB,EAChB,OAAqC;QADrC,aAAQ,GAAR,QAAQ,CAAQ;QAChB,YAAO,GAAP,OAAO,CAA8B;IAC/C,CAAC;CACP;AAED;;;;GAIG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEA;IACA;IACA;IAHrB,YACqB,UAAsB,EACtB,KAAsB,EACtB,MAAkB;QAFlB,eAAU,GAAV,UAAU,CAAY;QACtB,UAAK,GAAL,KAAK,CAAiB;QACtB,WAAM,GAAN,MAAM,CAAY;IACpC,CAAC;IAEJ,GAAG,CAAC,IAAY;QACZ,MAAM,aAAa,GAAG,IAAI,iCAAgB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,6BAAe,CAAC,CAAC;QAClD,wGAAwG;QACxG,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAA4B,CAAC;QACpF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,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I,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAC3D,MAAM,IAAI,8BAAa,CAAC,GAAG,KAAK,gDAAgD,CAAC,CAAC;QACtF,6GAA6G;QAC7G,OAAO,KAAgC,CAAC;IAC5C,CAAC;CACJ,CAAA;AArGY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGJ,wBAAU;QACf,mCAAe;QACd,2BAAU;GAJ9B,YAAY,CAqGxB","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ConfigObject, FieldDef, OwnedRuleDefinition } from '@webpieces/rules-sdk';\nimport { AtomicFile, InformAiError, RepositoryLayout } from '@webpieces/tooling-common';\nimport { ConfigFile, CONFIG_FILENAME } from './config-file';\nimport { PackPolicyFiles, SelectedPolicyPack } from './pack-policy-files';\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { validateTopLevelKeys } from './config-key-rules';\nimport { validateCommandsSection } from './commands-section-validators';\nimport { validateExcludePaths, validateMatchRulesSection } from './validate-config';\n\nclass OwnerFilePlan {\n constructor(\n readonly filename: string,\n readonly entries: Record<string, ConfigObject>,\n ) {}\n}\n\n/**\n * Writes the owners' recommended seeds into the declared owner files, for review — the installer's and\n * `wp-migrate-dirs`' explicit file mutation. Normal configuration loading never calls this service: a\n * missing entry is a deny naming the file and the entry to paste, not something loading supplies.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class RulePackSync {\n constructor(\n private readonly configFile: ConfigFile,\n private readonly files: PackPolicyFiles,\n private readonly atomic: AtomicFile,\n ) {}\n\n run(root: string): readonly string[] {\n const layoutChanges = new RepositoryLayout().migrate(root);\n const filename = path.join(root, CONFIG_FILENAME);\n // webpieces-disable no-any-unknown -- the sync reads opaque JSON only at this explicit command boundary\n const document = this.configFile.readRawConfig(filename) as Record<string, unknown>;\n const selected = this.files.select(root, this.files.declarations(document['rulePacks'], root));\n const registry = new RulePackRegistry(\n selected.map((pack: SelectedPolicyPack) => pack.manifest),\n );\n for (const pack of selected)\n registry.recordModuleLocation(pack.manifest.packageName, pack.declaration.moduleName());\n this.validateRoot(document, root);\n const plans = this.prepare(root, selected, registry);\n const changed: string[] = [...layoutChanges];\n for (const plan of plans) {\n if (\n this.atomic.writeIfChanged(\n plan.filename,\n JSON.stringify(plan.entries, null, 2) + '\\n',\n )\n )\n changed.push(plan.filename);\n }\n return changed;\n }\n\n private prepare(\n root: string,\n selected: readonly SelectedPolicyPack[],\n registry: RulePackRegistry,\n ): readonly OwnerFilePlan[] {\n const plans: OwnerFilePlan[] = [];\n const errors: string[] = [];\n for (const pack of selected) {\n const filename = this.files.configPath(root, pack.declaration.config);\n const entries = fs.existsSync(filename) ? this.files.read(filename) : {};\n for (const id of Object.keys(entries)) {\n if (!registry.hasRule(id) || registry.ownerOf(id) !== pack.manifest.packageName) {\n errors.push(\n `${filename}: ${id} has another owner or is unknown. Move or remove it explicitly before sync.`,\n );\n }\n }\n for (const definition of pack.manifest.ownedRules) {\n const value = this.seedMissing(entries[definition.id], definition, registry.schemaFor(definition.id));\n errors.push(\n ...registry\n .validateRuleConfig(definition.id, value)\n .map((error: string) => `${filename}: ${error}`),\n );\n entries[definition.id] = value;\n }\n plans.push(new OwnerFilePlan(filename, entries));\n }\n if (errors.length) throw new InformAiError(`Sync made no changes:\\n${errors.join('\\n')}`);\n return plans;\n }\n\n private seedMissing(\n previous: ConfigObject | undefined,\n definition: OwnedRuleDefinition,\n // The registry's MERGED schema (owner fields + framework-owned universal fields).\n schema: Readonly<Record<string, FieldDef>>,\n ): ConfigObject {\n const value =\n previous === undefined\n ? structuredClone(definition.recommendedSeed)\n : Object.assign(new ConfigObject(), this.object(previous, definition.id));\n for (const field of Object.keys(schema)) {\n if (!schema[field].optional && !Object.hasOwn(value, field)) {\n value[field] = structuredClone(definition.recommendedSeed[field]);\n }\n }\n return value;\n }\n\n // webpieces-disable no-any-unknown -- the same generic-root validators run before any write\n private validateRoot(document: Record<string, unknown>, root: string): void {\n const errors = [\n ...validateTopLevelKeys(document),\n ...validateCommandsSection(document['commands'], document['pr-gate'], root),\n ...validateExcludePaths(document['excludePaths']),\n ...validateMatchRulesSection(document['match-rules']),\n ];\n if (errors.length) throw new InformAiError(`Sync made no changes:\\n${errors.join('\\n')}`);\n }\n\n // webpieces-disable no-any-unknown -- JSON object narrowing preserves explicit values for subsequent schema validation\n private object(value: unknown, label: string): Record<string, unknown> {\n if (!value || typeof value !== 'object' || Array.isArray(value))\n throw new InformAiError(`${label} must be a JSON object. Repair it before sync.`);\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n return value as Record<string, unknown>;\n }\n}\n"]}
@@ -22,6 +22,6 @@ export declare class RuleRuntimeModules {
22
22
  runBuildDebug(exports: unknown, request: BuildDebugRequest): Promise<BuildPolicyResult>;
23
23
  groups(registry: RulePackRegistry, kind: ExecutionKind): readonly RuntimeContributionGroup[];
24
24
  load(group: RuntimeContributionGroup, providers: ReadonlyMap<string, string>, loader: RuleRuntimeModuleLoader): unknown;
25
- request(root: string, configs: Readonly<Record<string, ConfigObject>>, group: RuntimeContributionGroup): PolicyRuntimeRequest;
25
+ request(root: string, configs: Readonly<Record<string, ConfigObject>>, group: RuntimeContributionGroup, excludePaths: readonly string[]): PolicyRuntimeRequest;
26
26
  createBuildPolicies(exports: unknown, request: PolicyRuntimeRequest): Promise<readonly BuildPolicy[]>;
27
27
  }
@@ -90,14 +90,16 @@ class RuleRuntimeModules {
90
90
  throw new tooling_common_1.InformAiError(`Missing declared manifest module for ${group.providerPack}. Repair rulePacks.`);
91
91
  return loader.load(group.implementationModule, provider);
92
92
  }
93
- request(root, configs, group) {
93
+ request(root, configs, group,
94
+ // The repo's top-level `excludePaths` — handed to the runtime so it applies them (#1253).
95
+ excludePaths) {
94
96
  const selected = {};
95
97
  for (const id of group.ruleIds) {
96
98
  if (!Object.hasOwn(configs, id))
97
99
  throw new tooling_common_1.InformAiError(`Missing explicit config for ${id}. Repair its declared owner file.`);
98
100
  selected[id] = configs[id];
99
101
  }
100
- return new rules_sdk_1.PolicyRuntimeRequest(root, selected, group.ruleIds);
102
+ return new rules_sdk_1.PolicyRuntimeRequest(root, selected, group.ruleIds, excludePaths);
101
103
  }
102
104
  // webpieces-disable no-any-unknown -- public exports are validated before use; no concrete execution package is imported
103
105
  async createBuildPolicies(
@@ -1 +1 @@
1
- {"version":3,"file":"rule-runtime-modules.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-runtime-modules.ts"],"names":[],"mappings":";;;;AAAA,wDAAkC;AAClC,6CAA4C;AAC5C,oDAS8B;AAC9B,8DAA0D;AAE1D,yEAAoE;AACpE,iEAA6D;AAE7D,0FAA0F;AAC1F,MAAa,wBAAwB;IAEpB;IACA;IACA;IACA;IAJb,YACa,YAAoB,EACpB,oBAA4B,EAC5B,aAA4B,EAC5B,OAA0B;QAH1B,iBAAY,GAAZ,YAAY,CAAQ;QACpB,yBAAoB,GAApB,oBAAoB,CAAQ;QAC5B,kBAAa,GAAb,aAAa,CAAe;QAC5B,YAAO,GAAP,OAAO,CAAmB;IACpC,CAAC;CACP;AAPD,4DAOC;AAED,MAAsB,uBAAuB;CAG5C;AAHD,0DAGC;AAED,MAAa,2BAA4B,SAAQ,uBAAuB;IACnD,UAAU,CAAyB;IACnC,aAAa,CAAc;IAE5C,YAAY,UAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,IAAI,iDAAsB,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,aAAa,GAAG,IAAA,2BAAa,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED,gFAAgF;IACvE,IAAI,CAAC,UAAkB,EAAE,cAAsB;QACpD,6IAA6I;QAC7I,IAAI,CAAC;YACD,MAAM,QAAQ,GACV,UA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QAClC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACzB,IACI,CAAC,KAAK;gBACN,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;gBAC9B,CAAC,KAAK,CAAC,IAAI;gBACX,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;gBAC1C,OAAO,KAAK,CAAC,SAAS,KAAK,UAAU;gBACrC,OAAO,KAAK,CAAC,GAAG,KAAK,UAAU,EACjC,CAAC;gBACC,MAAM,IAAI,8BAAa,CACnB,mFAAmF,CACtF,CAAC;YACN,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;QACD,KAAK,MAAM,EAAE,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChB,MAAM,IAAI,8BAAa,CACnB,yCAAyC,EAAE,qCAAqC,CACnF,CAAC;QACV,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAjHD,gDAiHC","sourcesContent":["import * as path from 'node:path';\nimport { createRequire } from 'node:module';\nimport {\n BuildPolicy,\n BuildRuleRuntime,\n BuildDebugRequest,\n BuildDebugRuntime,\n BuildPolicyResult,\n ConfigObject,\n ExecutionKind,\n PolicyRuntimeRequest,\n} from '@webpieces/rules-sdk';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { ClientModuleResolution } from './client-module-resolution';\nimport { toError } from '@webpieces/tooling-common/to-error';\n\n/** Describes an implementation without evaluating its module during config validation. */\nexport class RuntimeContributionGroup {\n constructor(\n readonly providerPack: string,\n readonly implementationModule: string,\n readonly executionKind: ExecutionKind,\n readonly ruleIds: readonly string[],\n ) {}\n}\n\nexport abstract class RuleRuntimeModuleLoader {\n // webpieces-disable no-any-unknown -- execution-family consumers validate external module contracts\n abstract load(moduleName: string, providerModule: string): unknown;\n}\n\nexport class NodeRuleRuntimeModuleLoader extends RuleRuntimeModuleLoader {\n private readonly resolution: ClientModuleResolution;\n private readonly requireModule: NodeRequire;\n\n constructor(clientRoot: string) {\n super();\n this.resolution = new ClientModuleResolution(clientRoot);\n this.requireModule = createRequire(path.join(clientRoot, 'package.json'));\n }\n\n // webpieces-disable no-any-unknown -- narrowed by its execution-family consumer\n override load(moduleName: string, providerModule: string): unknown {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- a declared module fault names the runtime and declaration needed for repair\n try {\n const resolved =\n moduleName.startsWith('.') || path.isAbsolute(moduleName)\n ? path.resolve(\n path.dirname(this.resolution.resolve(providerModule)),\n moduleName,\n )\n : this.resolution.resolve(moduleName);\n return this.requireModule(resolved);\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 throw new InformAiError(\n `Cannot load declared policy runtime ${moduleName} from ${providerModule}: ${error.message}. Repair its public implementation module or root declaration.`,\n { cause: error },\n );\n }\n }\n}\n\n/** Grouped module loading has no built-in package list or policy IDs. */\nexport class RuleRuntimeModules {\n // webpieces-disable no-any-unknown -- a selected provider explicitly advertises its debug capability\n async runBuildDebug(exports: unknown, request: BuildDebugRequest): Promise<BuildPolicyResult> {\n if (!exports || typeof exports !== 'object' || !('buildDebugRuntime' in exports)) {\n throw new InformAiError(\n `The build provider for ${request.selection.rule} does not support debug runs. Use its declared policy settings and normal validation.`,\n );\n }\n const runtime = exports.buildDebugRuntime as BuildDebugRuntime;\n if (!runtime || typeof runtime.run !== 'function')\n throw new InformAiError(\n 'Invalid buildDebugRuntime.run(request). Repair the provider export.',\n );\n const result = await runtime.run(request);\n if (!result || typeof result.success !== 'boolean')\n throw new InformAiError('Debug runtime must return an explicit success boolean.');\n return result;\n }\n\n groups(registry: RulePackRegistry, kind: ExecutionKind): readonly RuntimeContributionGroup[] {\n const groups: RuntimeContributionGroup[] = [];\n for (const manifest of registry.manifests) {\n const modules = new Map<string, string[]>();\n for (const contribution of manifest.contributions) {\n if (contribution.executionKind !== kind) continue;\n const ids = modules.get(contribution.implementationModule) ?? [];\n ids.push(contribution.ruleId);\n modules.set(contribution.implementationModule, ids);\n }\n for (const entry of modules) {\n const moduleName = entry[0], ids = entry[1];\n groups.push(\n new RuntimeContributionGroup(manifest.packageName, moduleName, kind, ids),\n );\n }\n }\n return groups;\n }\n\n // webpieces-disable no-any-unknown -- transport boundary for execution-family adapters\n load(\n group: RuntimeContributionGroup,\n providers: ReadonlyMap<string, string>,\n loader: RuleRuntimeModuleLoader,\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n ): unknown {\n const provider = providers.get(group.providerPack);\n if (!provider)\n throw new InformAiError(\n `Missing declared manifest module for ${group.providerPack}. Repair rulePacks.`,\n );\n return loader.load(group.implementationModule, provider);\n }\n\n request(\n root: string,\n configs: Readonly<Record<string, ConfigObject>>,\n group: RuntimeContributionGroup,\n ): PolicyRuntimeRequest {\n const selected: Record<string, ConfigObject> = {};\n for (const id of group.ruleIds) {\n if (!Object.hasOwn(configs, id))\n throw new InformAiError(\n `Missing explicit config for ${id}. Repair its declared owner file.`,\n );\n selected[id] = configs[id];\n }\n return new PolicyRuntimeRequest(root, selected, group.ruleIds);\n }\n\n // webpieces-disable no-any-unknown -- public exports are validated before use; no concrete execution package is imported\n async createBuildPolicies(\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n exports: unknown,\n request: PolicyRuntimeRequest,\n ): Promise<readonly BuildPolicy[]> {\n if (!exports || typeof exports !== 'object' || !('buildRuleRuntime' in exports)) {\n throw new InformAiError(\n 'Build contribution must export buildRuleRuntime.create(request). Repair its public runtime export.',\n );\n }\n const runtime = exports.buildRuleRuntime as BuildRuleRuntime;\n if (!runtime || typeof runtime.create !== 'function')\n throw new InformAiError(\n 'Invalid buildRuleRuntime.create. Supply a build runtime factory.',\n );\n const checks = await runtime.create(request);\n if (!Array.isArray(checks))\n throw new InformAiError('Build runtime must return an array of configured checks.');\n const covered = new Set<string>();\n for (const check of checks) {\n if (\n !check ||\n typeof check.name !== 'string' ||\n !check.name ||\n !request.ruleIds.includes(check.configKey) ||\n typeof check.shouldRun !== 'function' ||\n typeof check.run !== 'function'\n ) {\n throw new InformAiError(\n 'Invalid build check. Supply name, declared configKey, shouldRun(), and run(root).',\n );\n }\n covered.add(check.configKey);\n }\n for (const id of request.ruleIds) {\n if (!covered.has(id))\n throw new InformAiError(\n `Build runtime omitted declared policy ${id}. Supply its actual implementation.`,\n );\n }\n return checks;\n }\n}\n"]}
1
+ {"version":3,"file":"rule-runtime-modules.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-runtime-modules.ts"],"names":[],"mappings":";;;;AAAA,wDAAkC;AAClC,6CAA4C;AAC5C,oDAS8B;AAC9B,8DAA0D;AAE1D,yEAAoE;AACpE,iEAA6D;AAE7D,0FAA0F;AAC1F,MAAa,wBAAwB;IAEpB;IACA;IACA;IACA;IAJb,YACa,YAAoB,EACpB,oBAA4B,EAC5B,aAA4B,EAC5B,OAA0B;QAH1B,iBAAY,GAAZ,YAAY,CAAQ;QACpB,yBAAoB,GAApB,oBAAoB,CAAQ;QAC5B,kBAAa,GAAb,aAAa,CAAe;QAC5B,YAAO,GAAP,OAAO,CAAmB;IACpC,CAAC;CACP;AAPD,4DAOC;AAED,MAAsB,uBAAuB;CAG5C;AAHD,0DAGC;AAED,MAAa,2BAA4B,SAAQ,uBAAuB;IACnD,UAAU,CAAyB;IACnC,aAAa,CAAc;IAE5C,YAAY,UAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,IAAI,iDAAsB,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,aAAa,GAAG,IAAA,2BAAa,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED,gFAAgF;IACvE,IAAI,CAAC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AAO,CAAC,MAAM,CAAC;YACtB,MAAM,IAAI,8BAAa,CAAC,0DAA0D,CAAC,CAAC;QACxF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QAClC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACzB,IACI,CAAC,KAAK;gBACN,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;gBAC9B,CAAC,KAAK,CAAC,IAAI;gBACX,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;gBAC1C,OAAO,KAAK,CAAC,SAAS,KAAK,UAAU;gBACrC,OAAO,KAAK,CAAC,GAAG,KAAK,UAAU,EACjC,CAAC;gBACC,MAAM,IAAI,8BAAa,CACnB,mFAAmF,CACtF,CAAC;YACN,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;QACD,KAAK,MAAM,EAAE,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChB,MAAM,IAAI,8BAAa,CACnB,yCAAyC,EAAE,qCAAqC,CACnF,CAAC;QACV,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAnHD,gDAmHC","sourcesContent":["import * as path from 'node:path';\nimport { createRequire } from 'node:module';\nimport {\n BuildPolicy,\n BuildRuleRuntime,\n BuildDebugRequest,\n BuildDebugRuntime,\n BuildPolicyResult,\n ConfigObject,\n ExecutionKind,\n PolicyRuntimeRequest,\n} from '@webpieces/rules-sdk';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { ClientModuleResolution } from './client-module-resolution';\nimport { toError } from '@webpieces/tooling-common/to-error';\n\n/** Describes an implementation without evaluating its module during config validation. */\nexport class RuntimeContributionGroup {\n constructor(\n readonly providerPack: string,\n readonly implementationModule: string,\n readonly executionKind: ExecutionKind,\n readonly ruleIds: readonly string[],\n ) {}\n}\n\nexport abstract class RuleRuntimeModuleLoader {\n // webpieces-disable no-any-unknown -- execution-family consumers validate external module contracts\n abstract load(moduleName: string, providerModule: string): unknown;\n}\n\nexport class NodeRuleRuntimeModuleLoader extends RuleRuntimeModuleLoader {\n private readonly resolution: ClientModuleResolution;\n private readonly requireModule: NodeRequire;\n\n constructor(clientRoot: string) {\n super();\n this.resolution = new ClientModuleResolution(clientRoot);\n this.requireModule = createRequire(path.join(clientRoot, 'package.json'));\n }\n\n // webpieces-disable no-any-unknown -- narrowed by its execution-family consumer\n override load(moduleName: string, providerModule: string): unknown {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- a declared module fault names the runtime and declaration needed for repair\n try {\n const resolved =\n moduleName.startsWith('.') || path.isAbsolute(moduleName)\n ? path.resolve(\n path.dirname(this.resolution.resolve(providerModule)),\n moduleName,\n )\n : this.resolution.resolve(moduleName);\n return this.requireModule(resolved);\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 throw new InformAiError(\n `Cannot load declared policy runtime ${moduleName} from ${providerModule}: ${error.message}. Repair its public implementation module or root declaration.`,\n { cause: error },\n );\n }\n }\n}\n\n/** Grouped module loading has no built-in package list or policy IDs. */\nexport class RuleRuntimeModules {\n // webpieces-disable no-any-unknown -- a selected provider explicitly advertises its debug capability\n async runBuildDebug(exports: unknown, request: BuildDebugRequest): Promise<BuildPolicyResult> {\n if (!exports || typeof exports !== 'object' || !('buildDebugRuntime' in exports)) {\n throw new InformAiError(\n `The build provider for ${request.selection.rule} does not support debug runs. Use its declared policy settings and normal validation.`,\n );\n }\n const runtime = exports.buildDebugRuntime as BuildDebugRuntime;\n if (!runtime || typeof runtime.run !== 'function')\n throw new InformAiError(\n 'Invalid buildDebugRuntime.run(request). Repair the provider export.',\n );\n const result = await runtime.run(request);\n if (!result || typeof result.success !== 'boolean')\n throw new InformAiError('Debug runtime must return an explicit success boolean.');\n return result;\n }\n\n groups(registry: RulePackRegistry, kind: ExecutionKind): readonly RuntimeContributionGroup[] {\n const groups: RuntimeContributionGroup[] = [];\n for (const manifest of registry.manifests) {\n const modules = new Map<string, string[]>();\n for (const contribution of manifest.contributions) {\n if (contribution.executionKind !== kind) continue;\n const ids = modules.get(contribution.implementationModule) ?? [];\n ids.push(contribution.ruleId);\n modules.set(contribution.implementationModule, ids);\n }\n for (const entry of modules) {\n const moduleName = entry[0], ids = entry[1];\n groups.push(\n new RuntimeContributionGroup(manifest.packageName, moduleName, kind, ids),\n );\n }\n }\n return groups;\n }\n\n // webpieces-disable no-any-unknown -- transport boundary for execution-family adapters\n load(\n group: RuntimeContributionGroup,\n providers: ReadonlyMap<string, string>,\n loader: RuleRuntimeModuleLoader,\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n ): unknown {\n const provider = providers.get(group.providerPack);\n if (!provider)\n throw new InformAiError(\n `Missing declared manifest module for ${group.providerPack}. Repair rulePacks.`,\n );\n return loader.load(group.implementationModule, provider);\n }\n\n request(\n root: string,\n configs: Readonly<Record<string, ConfigObject>>,\n group: RuntimeContributionGroup,\n // The repo's top-level `excludePaths` — handed to the runtime so it applies them (#1253).\n excludePaths: readonly string[],\n ): PolicyRuntimeRequest {\n const selected: Record<string, ConfigObject> = {};\n for (const id of group.ruleIds) {\n if (!Object.hasOwn(configs, id))\n throw new InformAiError(\n `Missing explicit config for ${id}. Repair its declared owner file.`,\n );\n selected[id] = configs[id];\n }\n return new PolicyRuntimeRequest(root, selected, group.ruleIds, excludePaths);\n }\n\n // webpieces-disable no-any-unknown -- public exports are validated before use; no concrete execution package is imported\n async createBuildPolicies(\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n exports: unknown,\n request: PolicyRuntimeRequest,\n ): Promise<readonly BuildPolicy[]> {\n if (!exports || typeof exports !== 'object' || !('buildRuleRuntime' in exports)) {\n throw new InformAiError(\n 'Build contribution must export buildRuleRuntime.create(request). Repair its public runtime export.',\n );\n }\n const runtime = exports.buildRuleRuntime as BuildRuleRuntime;\n if (!runtime || typeof runtime.create !== 'function')\n throw new InformAiError(\n 'Invalid buildRuleRuntime.create. Supply a build runtime factory.',\n );\n const checks = await runtime.create(request);\n if (!Array.isArray(checks))\n throw new InformAiError('Build runtime must return an array of configured checks.');\n const covered = new Set<string>();\n for (const check of checks) {\n if (\n !check ||\n typeof check.name !== 'string' ||\n !check.name ||\n !request.ruleIds.includes(check.configKey) ||\n typeof check.shouldRun !== 'function' ||\n typeof check.run !== 'function'\n ) {\n throw new InformAiError(\n 'Invalid build check. Supply name, declared configKey, shouldRun(), and run(root).',\n );\n }\n covered.add(check.configKey);\n }\n for (const id of request.ruleIds) {\n if (!covered.has(id))\n throw new InformAiError(\n `Build runtime omitted declared policy ${id}. Supply its actual implementation.`,\n );\n }\n return checks;\n }\n}\n"]}
@@ -7,8 +7,9 @@ export { recommendedSeedMode, recommendedSeedModeFor, seedEntryForRule } from '.
7
7
  export declare function validateWebpiecesConfig(rawRules: Record<string, Record<string, unknown>>, registry: RulePackRegistry): string[];
8
8
  export { validatePrGateSection } from './validate-pr-gate';
9
9
  /**
10
- * Validate the REQUIRED top-level `excludePaths` block: ONE glob list suppressing hook enforcement per
11
- * file path, for code-style rules and file-scoped guards alike. Required so every client upgrading is
10
+ * Validate the REQUIRED top-level `excludePaths` block: ONE glob list of paths NO rule judges — hook
11
+ * rules, file-scoped guards and the build's code rules alike (#1253: the code-rules runtime applies it
12
+ * too, through RuleFileScope). Required so every client upgrading is
12
13
  * forced to declare it (as [] to keep today's behavior, or with real paths). Returns copy-paste
13
14
  * friendly errors and never throws — same contract as validatePrGateSection.
14
15
  *
@@ -326,8 +326,9 @@ function validateExcludeList(value, key) {
326
326
  return [];
327
327
  }
328
328
  /**
329
- * Validate the REQUIRED top-level `excludePaths` block: ONE glob list suppressing hook enforcement per
330
- * file path, for code-style rules and file-scoped guards alike. Required so every client upgrading is
329
+ * Validate the REQUIRED top-level `excludePaths` block: ONE glob list of paths NO rule judges — hook
330
+ * rules, file-scoped guards and the build's code rules alike (#1253: the code-rules runtime applies it
331
+ * too, through RuleFileScope). Required so every client upgrading is
331
332
  * forced to declare it (as [] to keep today's behavior, or with real paths). Returns copy-paste
332
333
  * friendly errors and never throws — same contract as validatePrGateSection.
333
334
  *
@@ -1 +1 @@
1
- {"version":3,"file":"validate-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/validate-config.ts"],"names":[],"mappings":";;;AAwSA,0DA8DC;AA8BD,oDAuBC;AA+FD,8DA4BC;AAthBD,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,GA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B,CAAC,CAAC,CAAC;QACrF,IAAI,QAAQ;YAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IACD,IACI,CAAC,CACG,CAAC,CAAC,0BAA0B,CAAC,KAAK,IAAI;QACtC,OAAO,CAAC,CAAC,0BAA0B,CAAC,KAAK,QAAQ,CACpD;QAED,MAAM,CAAC,IAAI,CACP,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 suppressing hook enforcement per\n * file path, for code-style rules and file-scoped guards alike. 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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,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"]}
@@ -164,19 +164,20 @@ These trees are exempt with **no configuration at all**:
164
164
  **/__generated__/** **/generated/** **/*.generated.ts **/*.generated.tsx dist
165
165
  ```
166
166
 
167
- For any other tree the repo does not author, add it to `allowedPaths` — which ADDS to the list above
168
- rather than replacing it:
167
+ For any other tree the repo does not author, add it to the rule's `excludePaths` — a framework field
168
+ every rule accepts (#1253) — which ADDS to the list above rather than replacing it. A tree no rule at all
169
+ should judge (codegen output, vendored code) belongs in the TOP-LEVEL `excludePaths` instead:
169
170
 
170
171
  ```jsonc
171
172
  "max-file-lines": {
172
173
  "limit": 900,
173
174
  "mode": "NEW_AND_MODIFIED_FILES",
174
175
  "disableAllowed": false,
175
- "allowedPaths": ["**/__generated__/**", "libraries/vendor-sdk/**"]
176
+ "excludePaths": ["**/__generated__/**", "libraries/vendor-sdk/**"]
176
177
  }
177
178
  ```
178
179
 
179
- **Never list hand-written code in `allowedPaths`.** It is for files whose size is not yours to
180
+ **Never list hand-written code in `excludePaths`.** It is for files whose size is not yours to
180
181
  control; a long file you wrote gets refactored, per the rest of this doc.
181
182
 
182
183
  ## Escape Hatch