@webpieces/rules-config 0.4.847 → 0.4.849
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -7
- package/src/WebpiecesRulesConfig.d.ts +1 -2
- package/src/WebpiecesRulesConfig.js +0 -1
- package/src/WebpiecesRulesConfig.js.map +1 -1
- package/src/client-module-resolution.d.ts +9 -0
- package/src/client-module-resolution.js +102 -0
- package/src/client-module-resolution.js.map +1 -0
- package/src/config-error-banner.d.ts +0 -2
- package/src/config-error-banner.js +1 -3
- package/src/config-error-banner.js.map +1 -1
- package/src/config-file.d.ts +3 -6
- package/src/config-file.js +14 -1
- package/src/config-file.js.map +1 -1
- package/src/config-key-rules.js +16 -5
- package/src/config-key-rules.js.map +1 -1
- package/src/config-pruner.d.ts +5 -42
- package/src/config-pruner.js +31 -76
- package/src/config-pruner.js.map +1 -1
- package/src/config-repair-access.d.ts +4 -0
- package/src/config-repair-access.js +17 -0
- package/src/config-repair-access.js.map +1 -0
- package/src/config-repair-bootstrap-source.d.ts +2 -0
- package/src/config-repair-bootstrap-source.js +7 -0
- package/src/config-repair-bootstrap-source.js.map +1 -0
- package/src/config-repair-probe.d.ts +13 -0
- package/src/config-repair-probe.js +115 -0
- package/src/config-repair-probe.js.map +1 -0
- package/src/first-path-match.d.ts +14 -0
- package/src/first-path-match.js +35 -0
- package/src/first-path-match.js.map +1 -0
- package/src/index.d.ts +15 -8
- package/src/index.js +40 -10
- package/src/index.js.map +1 -1
- package/src/legacy-config-upgrade.d.ts +22 -0
- package/src/legacy-config-upgrade.js +328 -0
- package/src/legacy-config-upgrade.js.map +1 -0
- package/src/load-config.d.ts +11 -23
- package/src/load-config.js +50 -138
- package/src/load-config.js.map +1 -1
- package/src/pack-policy-files.d.ts +29 -0
- package/src/pack-policy-files.js +194 -0
- package/src/pack-policy-files.js.map +1 -0
- package/src/policy-field-constraints.d.ts +9 -0
- package/src/policy-field-constraints.js +31 -0
- package/src/policy-field-constraints.js.map +1 -0
- package/src/repository-path.d.ts +7 -0
- package/src/repository-path.js +50 -0
- package/src/repository-path.js.map +1 -0
- package/src/rule-pack-artifacts.d.ts +23 -0
- package/src/rule-pack-artifacts.js +180 -0
- package/src/rule-pack-artifacts.js.map +1 -0
- package/src/rule-pack-registry.d.ts +7 -0
- package/src/rule-pack-registry.js +149 -47
- package/src/rule-pack-registry.js.map +1 -1
- package/src/rule-pack-sync.d.ts +26 -0
- package/src/rule-pack-sync.js +236 -0
- package/src/rule-pack-sync.js.map +1 -0
- package/src/rule-runtime-modules.d.ts +27 -0
- package/src/rule-runtime-modules.js +135 -0
- package/src/rule-runtime-modules.js.map +1 -0
- package/src/rules-sync-cli.d.ts +7 -0
- package/src/rules-sync-cli.js +48 -0
- package/src/rules-sync-cli.js.map +1 -0
- package/src/seed-entry.js +1 -3
- package/src/seed-entry.js.map +1 -1
- package/src/types.d.ts +4 -6
- package/src/types.js +4 -7
- package/src/types.js.map +1 -1
- package/src/validate-config.d.ts +3 -29
- package/src/validate-config.js +99 -244
- package/src/validate-config.js.map +1 -1
- package/src/validate-pr-gate.d.ts +8 -0
- package/src/validate-pr-gate.js +161 -0
- package/src/validate-pr-gate.js.map +1 -0
- package/templates/webpieces.guard-matrix.md +5 -4
- package/src/rule-pack-selection.d.ts +0 -6
- package/src/rule-pack-selection.js +0 -50
- package/src/rule-pack-selection.js.map +0 -1
package/src/types.js
CHANGED
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ResolvedConfig = exports.ResolvedRuleConfig = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* One
|
|
5
|
+
* One validated owner entry, with only owner-declared optional tuning resolved.
|
|
6
6
|
*
|
|
7
7
|
* `options` contains the raw option bag (mode, limit, disableAllowed,
|
|
8
8
|
* turnOffRuleUntilEpoch, enforcePaths, etc). Consumers extract the
|
|
9
9
|
* fields they understand and ignore the rest.
|
|
10
10
|
*
|
|
11
11
|
* On/off is driven entirely by `mode`: a rule is OFF only when explicitly
|
|
12
|
-
* set to `mode: "OFF"`.
|
|
13
|
-
* ON. For code-rules, `mode` doubles as the scope selector
|
|
12
|
+
* set to `mode: "OFF"`. Every configured entry has a schema-required mode. For code-rules, `mode` doubles as the scope selector
|
|
14
13
|
* (e.g. "NEW_AND_MODIFIED_CODE", "NEW_AND_MODIFIED_METHODS"); for simple on/off
|
|
15
14
|
* rules it is just "ON"/"OFF". (The legacy `enabled` boolean has been
|
|
16
15
|
* removed in favor of this single, more flexible switch.)
|
|
@@ -25,7 +24,7 @@ class ResolvedRuleConfig {
|
|
|
25
24
|
const m = this.options['mode'];
|
|
26
25
|
return typeof m === 'string' ? m : undefined;
|
|
27
26
|
}
|
|
28
|
-
/** A rule is off only when explicitly `mode: "OFF"`.
|
|
27
|
+
/** A rule is off only when explicitly `mode: "OFF"`. The loader rejects an absent mode. */
|
|
29
28
|
get isOff() {
|
|
30
29
|
return this.mode === 'OFF';
|
|
31
30
|
}
|
|
@@ -42,12 +41,10 @@ exports.ResolvedRuleConfig = ResolvedRuleConfig;
|
|
|
42
41
|
class ResolvedConfig {
|
|
43
42
|
rules;
|
|
44
43
|
userConfiguredRuleNames;
|
|
45
|
-
rulesDir;
|
|
46
44
|
configPath;
|
|
47
|
-
constructor(rules, userConfiguredRuleNames,
|
|
45
|
+
constructor(rules, userConfiguredRuleNames, configPath) {
|
|
48
46
|
this.rules = rules;
|
|
49
47
|
this.userConfiguredRuleNames = userConfiguredRuleNames;
|
|
50
|
-
this.rulesDir = rulesDir;
|
|
51
48
|
this.configPath = configPath;
|
|
52
49
|
}
|
|
53
50
|
}
|
package/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/types.ts"],"names":[],"mappings":";;;AAGA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/types.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;GAYG;AACH,MAAa,kBAAkB;IAClB,OAAO,CAAc;IAE9B,YAAY,OAAoB;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,oFAAoF;IACpF,IAAI,IAAI;QACJ,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjD,CAAC;IAED,2FAA2F;IAC3F,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC;IAC/B,CAAC;CACJ;AAjBD,gDAiBC;AAED;;;;;;;GAOG;AACH,MAAa,cAAc;IACd,KAAK,CAAkC;IACvC,uBAAuB,CAAsB;IAC7C,UAAU,CAAgB;IAEnC,YACI,KAAsC,EACtC,uBAA4C,EAC5C,UAAyB;QAEzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;QACvD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;CACJ;AAdD,wCAcC","sourcesContent":["// webpieces-disable no-any-unknown -- rule options are opaque at framework level; each consumer casts internally\nexport type RuleOptions = Record<string, unknown>;\n\n/**\n * One validated owner entry, with only owner-declared optional tuning resolved.\n *\n * `options` contains the raw option bag (mode, limit, disableAllowed,\n * turnOffRuleUntilEpoch, enforcePaths, etc). Consumers extract the\n * fields they understand and ignore the rest.\n *\n * On/off is driven entirely by `mode`: a rule is OFF only when explicitly\n * set to `mode: \"OFF\"`. Every configured entry has a schema-required mode. For code-rules, `mode` doubles as the scope selector\n * (e.g. \"NEW_AND_MODIFIED_CODE\", \"NEW_AND_MODIFIED_METHODS\"); for simple on/off\n * rules it is just \"ON\"/\"OFF\". (The legacy `enabled` boolean has been\n * removed in favor of this single, more flexible switch.)\n */\nexport class ResolvedRuleConfig {\n readonly options: RuleOptions;\n\n constructor(options: RuleOptions) {\n this.options = options;\n }\n\n /** Raw mode string from the option bag (\"ON\" | \"OFF\" | scope value), if present. */\n get mode(): string | undefined {\n const m = this.options['mode'];\n return typeof m === 'string' ? m : undefined;\n }\n\n /** A rule is off only when explicitly `mode: \"OFF\"`. The loader rejects an absent mode. */\n get isOff(): boolean {\n return this.mode === 'OFF';\n }\n}\n\n/**\n * The fully-resolved workspace configuration: every rule known to the\n * workspace (built-in + consumer overrides) keyed by its canonical\n * kebab-case name.\n *\n * `configPath` is null when no webpieces.config.json was found (loaders\n * should treat that as \"no validation configured\").\n */\nexport class ResolvedConfig {\n readonly rules: Map<string, ResolvedRuleConfig>;\n readonly userConfiguredRuleNames: ReadonlySet<string>;\n readonly configPath: string | null;\n\n constructor(\n rules: Map<string, ResolvedRuleConfig>,\n userConfiguredRuleNames: ReadonlySet<string>,\n configPath: string | null,\n ) {\n this.rules = rules;\n this.userConfiguredRuleNames = userConfiguredRuleNames;\n this.configPath = configPath;\n }\n}\n"]}
|
package/src/validate-config.d.ts
CHANGED
|
@@ -1,29 +1,11 @@
|
|
|
1
|
+
export { MAX_TURN_OFF_EPOCH_DAYS } from './policy-field-constraints';
|
|
1
2
|
import { RulePackRegistry } from './rule-pack-registry';
|
|
2
3
|
import { validateChecklistsSection } from './pr-gate-section-validators';
|
|
3
4
|
export { validateChecklistsSection };
|
|
4
5
|
export { allRuleNames } from './rule-schemas';
|
|
5
6
|
export { recommendedSeedMode, recommendedSeedModeFor, seedEntryForRule } from './seed-entry';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* extend — that weekly re-set IS the intended workflow, not a workaround: it is what makes a rule that is
|
|
9
|
-
* off on purpose stay a decision somebody keeps making, instead of one nobody remembers.
|
|
10
|
-
*
|
|
11
|
-
* DELIBERATELY ASYMMETRIC with turnOffRuleWhileOnBranch, which has NO cap and must not get one. The epoch
|
|
12
|
-
* hatch is REPO-WIDE while it lasts, so a long window shelters every unrelated change that lands inside it
|
|
13
|
-
* (a fleet repo was found with max-file-lines/max-method-lines switched off until 2026-10-01 — 43 days
|
|
14
|
-
* out, six times this cap). The branch hatch fires only on ONE exact branch name — a big refactor
|
|
15
|
-
* legitimately runs 35+ days, and capping that would only interrupt the one branch that opted in.
|
|
16
|
-
*/
|
|
17
|
-
export declare const MAX_TURN_OFF_EPOCH_DAYS = 7;
|
|
18
|
-
export declare function validateWebpiecesConfig(rawRules: Record<string, Record<string, unknown>>, registry: RulePackRegistry, hasCustomRulesDir?: boolean): string[];
|
|
19
|
-
/**
|
|
20
|
-
* Validate the top-level `pr-gate` section. It is REQUIRED (a client that opts out sets mode "OFF").
|
|
21
|
-
* `buildCommand` is required unless mode is "OFF". Returns human-readable, copy-paste-friendly errors
|
|
22
|
-
* — never throws. The pr-gate block lives outside the FieldDef-driven `rules` schema because its
|
|
23
|
-
* nested `gates`/`checklists` arrays can't be expressed there, so they get structural validation here.
|
|
24
|
-
* `repoRoot` (when known) lets the `checklists[].docs` existence check run.
|
|
25
|
-
*/
|
|
26
|
-
export declare function validatePrGateSection(section: unknown, repoRoot?: string): string[];
|
|
7
|
+
export declare function validateWebpiecesConfig(rawRules: Record<string, Record<string, unknown>>, registry: RulePackRegistry): string[];
|
|
8
|
+
export { validatePrGateSection } from './validate-pr-gate';
|
|
27
9
|
/**
|
|
28
10
|
* Validate the REQUIRED top-level `excludePaths` block: ONE glob list suppressing hook enforcement per
|
|
29
11
|
* file path, for code-style rules and file-scoped guards alike. Required so every client upgrading is
|
|
@@ -44,11 +26,3 @@ export declare function validateExcludePaths(section: unknown): string[];
|
|
|
44
26
|
* uniqueness. Copy-paste-friendly errors; never throws — same contract as validatePrGateSection.
|
|
45
27
|
*/
|
|
46
28
|
export declare function validateMatchRulesSection(section: unknown): string[];
|
|
47
|
-
/**
|
|
48
|
-
* Enforce that each built-in lives in its correct section: code rules under `rules`, bash guards
|
|
49
|
-
* under `hookGuards`. A guard left in `rules` (or a rule placed in `hookGuards`) is reported with a
|
|
50
|
-
* "move it" message so the split stays clean. Unknown/custom names are ignored (they may be custom
|
|
51
|
-
* rules from rulesDir). Presence ("every built-in must be configured") is checked separately by
|
|
52
|
-
* validateWebpiecesConfig against the merged map.
|
|
53
|
-
*/
|
|
54
|
-
export declare function validateSectionPlacement(rulesSection: Record<string, Record<string, unknown>>, hookGuardsSection: Record<string, Record<string, unknown>>, registry: RulePackRegistry): string[];
|