@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/config-pruner.js
CHANGED
|
@@ -8,47 +8,15 @@ const tooling_common_1 = require("@webpieces/tooling-common");
|
|
|
8
8
|
const config_file_1 = require("./config-file");
|
|
9
9
|
const constants_1 = require("./constants");
|
|
10
10
|
const path = tslib_1.__importStar(require("node:path"));
|
|
11
|
-
const
|
|
11
|
+
const rule_pack_registry_1 = require("./rule-pack-registry");
|
|
12
|
+
const pack_policy_files_1 = require("./pack-policy-files");
|
|
12
13
|
const retired_config_keys_1 = require("./retired-config-keys");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* ## Why a command and not just advice
|
|
17
|
-
*
|
|
18
|
-
* An unknown key controls nothing, so deleting it is the fix, and the validator now says so. But the
|
|
19
|
-
* moment that advice is read is the worst possible moment to act on it by hand: the hook guard denies
|
|
20
|
-
* every Bash call while the config is invalid, so the reader is editing JSON blind, with no way to
|
|
21
|
-
* re-run the validator between edits. Making the cleanup one command means cleanliness is the default
|
|
22
|
-
* path rather than a judgement call taken under a total block — and it makes "the file validates" mean
|
|
23
|
-
* "every key in it is real", which is the property that keeps dead config from reading as live config.
|
|
24
|
-
*
|
|
25
|
-
* ## What it removes, and what it deliberately does NOT
|
|
26
|
-
*
|
|
27
|
-
* Removed, from the `rules` and `hookGuards` sections only:
|
|
28
|
-
* - a name with no entry in RULE_SCHEMAS and no entry in RETIRED_CONFIG_KEYS (a typo, or a rule some
|
|
29
|
-
* release deleted). Nothing reads it, by construction.
|
|
30
|
-
* - a name in RETIRED_CONFIG_KEYS whose entry is `prunable` — the retirement's own instruction is
|
|
31
|
-
* "delete this entry", because the setting left webpieces.config.json entirely.
|
|
32
|
-
*
|
|
33
|
-
* NOT removed:
|
|
34
|
-
* - a RENAME or an in-file move (`prunable: false`). Deleting those discards a value the new key still
|
|
35
|
-
* needs, so they keep their migration instruction and a human/agent applies it.
|
|
36
|
-
* - anything at all when `rulesDir` is configured. A custom rule legitimately has no built-in schema,
|
|
37
|
-
* and this command must never eat one.
|
|
38
|
-
* - top-level keys, `commands`, `excludePaths`, `match-rules`. Those are validated by shape, not by a
|
|
39
|
-
* name table, so "unknown" is not defined for them and a pruner would be guessing.
|
|
40
|
-
*
|
|
41
|
-
* ## The one destructive case, and why the drift guard already covers it
|
|
42
|
-
*
|
|
43
|
-
* A key CAN be valid-but-unlearned when package.json pins an @webpieces older than the config. Pruning
|
|
44
|
-
* then would delete live config. That case cannot reach here: the shim's version-drift guard compares
|
|
45
|
-
* the pin against the installed version and denies every tool call — including this one — before the
|
|
46
|
-
* validator or this command ever runs. It is also why `PruneResult` names every key it removed rather
|
|
47
|
-
* than reporting a count: a silent sweep is the thing that would make the rare case unrecoverable.
|
|
48
|
-
*/
|
|
14
|
+
const config_key_rules_1 = require("./config-key-rules");
|
|
15
|
+
const tooling_common_2 = require("@webpieces/tooling-common");
|
|
16
|
+
/** Prune only owner-file entries that no selected schema reads, retaining renames and wrong-owner entries for explicit repair. */
|
|
49
17
|
/** One key this run removed, and the reason it was safe to remove. Data-only (per CLAUDE.md). */
|
|
50
18
|
class PrunedKey {
|
|
51
|
-
/**
|
|
19
|
+
/** The declared owner config path containing the key. */
|
|
52
20
|
section;
|
|
53
21
|
/** The rule/guard name exactly as it appeared in the file. */
|
|
54
22
|
key;
|
|
@@ -80,21 +48,19 @@ class PruneResult {
|
|
|
80
48
|
return `[${constants_1.PRUNE_UNKNOWN_COMMAND}] No unknown keys in ${this.configPath} — nothing to remove.`;
|
|
81
49
|
}
|
|
82
50
|
const lines = this.removed.map((r) => ` • ${r.section}.${r.key} — ${r.reason}`);
|
|
83
|
-
return `[${constants_1.PRUNE_UNKNOWN_COMMAND}] Removed ${this.removed.length} unknown key(s) from ` +
|
|
84
|
-
`${this.configPath}:\n${lines.join('\n')}
|
|
51
|
+
return (`[${constants_1.PRUNE_UNKNOWN_COMMAND}] Removed ${this.removed.length} unknown key(s) from ` +
|
|
52
|
+
`${this.configPath}:\n${lines.join('\n')}`);
|
|
85
53
|
}
|
|
86
54
|
}
|
|
87
55
|
exports.PruneResult = PruneResult;
|
|
88
|
-
/** The sections a rule/guard name may legally sit in — the only two this command touches. */
|
|
89
|
-
const PRUNABLE_SECTIONS = ['rules', 'hookGuards'];
|
|
90
56
|
let ConfigPruner = class ConfigPruner {
|
|
91
57
|
configFile;
|
|
92
58
|
atomicFile;
|
|
93
|
-
|
|
94
|
-
constructor(configFile, atomicFile,
|
|
59
|
+
files;
|
|
60
|
+
constructor(configFile, atomicFile, files) {
|
|
95
61
|
this.configFile = configFile;
|
|
96
62
|
this.atomicFile = atomicFile;
|
|
97
|
-
this.
|
|
63
|
+
this.files = files;
|
|
98
64
|
}
|
|
99
65
|
/**
|
|
100
66
|
* Strip every unknown key from the webpieces.config.json above `cwd` and rewrite it. Throws when no
|
|
@@ -113,49 +79,38 @@ let ConfigPruner = class ConfigPruner {
|
|
|
113
79
|
* file that fails validation.
|
|
114
80
|
*/
|
|
115
81
|
prune(configPath) {
|
|
116
|
-
const
|
|
117
|
-
// webpieces-disable no-any-unknown --
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
throw new
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const document = parsed;
|
|
124
|
-
const removed = this.removeUnknown(document, this.rulePacks.loadFrom(path.dirname(configPath)));
|
|
125
|
-
if (removed.length > 0) {
|
|
126
|
-
this.atomicFile.writeAtomic(configPath, JSON.stringify(document, null, this.indentOf(text)) + '\n');
|
|
127
|
-
}
|
|
128
|
-
return new PruneResult(configPath, removed);
|
|
129
|
-
}
|
|
130
|
-
/** Mutates `document`, deleting every prunable name from the two rule sections. */
|
|
131
|
-
// webpieces-disable no-any-unknown -- opaque parsed config document
|
|
132
|
-
removeUnknown(document, registry) {
|
|
133
|
-
// A custom rules directory means a name with no built-in schema may be entirely legitimate.
|
|
134
|
-
const rulesDir = document['rulesDir'];
|
|
135
|
-
if (Array.isArray(rulesDir) && rulesDir.length > 0)
|
|
136
|
-
return [];
|
|
82
|
+
const root = path.dirname(configPath), document = this.configFile.readRawConfig(configPath);
|
|
83
|
+
// webpieces-disable no-any-unknown -- pruning may inspect invalid policy values, but never accepts a retired root selection surface
|
|
84
|
+
const rootErrors = (0, config_key_rules_1.validateTopLevelKeys)(document);
|
|
85
|
+
if (rootErrors.length)
|
|
86
|
+
throw new tooling_common_2.InformAiError(rootErrors.join('\n'));
|
|
87
|
+
const selected = this.files.select(root, this.files.declarations(document.rulePacks, root));
|
|
88
|
+
const registry = new rule_pack_registry_1.RulePackRegistry(selected.map((pack) => pack.manifest));
|
|
137
89
|
const removed = [];
|
|
138
|
-
for (const
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
// webpieces-disable no-any-unknown -- narrowed to a non-null, non-array object one line above
|
|
143
|
-
const entries = section;
|
|
90
|
+
for (const pack of selected) {
|
|
91
|
+
const filename = this.files.configPath(root, pack.declaration.config);
|
|
92
|
+
const text = fs.readFileSync(filename, 'utf8'), entries = this.files.read(filename);
|
|
93
|
+
const pruned = [];
|
|
144
94
|
for (const key of Object.keys(entries)) {
|
|
145
95
|
const reason = this.reasonToRemove(key, registry);
|
|
146
96
|
if (reason === null)
|
|
147
97
|
continue;
|
|
148
98
|
delete entries[key];
|
|
149
|
-
|
|
99
|
+
pruned.push(new PrunedKey(pack.declaration.config, key, reason));
|
|
150
100
|
}
|
|
101
|
+
if (pruned.length)
|
|
102
|
+
this.atomicFile.writeAtomic(filename, JSON.stringify(entries, null, this.indentOf(text)) + '\n');
|
|
103
|
+
removed.push(...pruned);
|
|
151
104
|
}
|
|
152
|
-
return removed;
|
|
105
|
+
return new PruneResult(configPath, removed);
|
|
153
106
|
}
|
|
154
107
|
/** Why `key` is safe to delete, or null when it must be kept. */
|
|
155
108
|
reasonToRemove(key, registry) {
|
|
156
109
|
if (registry.hasRule(key))
|
|
157
110
|
return null;
|
|
158
|
-
const retired = registry
|
|
111
|
+
const retired = registry
|
|
112
|
+
.migrations()
|
|
113
|
+
.find((e) => e.scope === retired_config_keys_1.RETIRED_SCOPE_RULE && e.key === key);
|
|
159
114
|
if (retired) {
|
|
160
115
|
if (!retired.prunable)
|
|
161
116
|
return null;
|
|
@@ -181,6 +136,6 @@ exports.ConfigPruner = ConfigPruner = tslib_1.__decorate([
|
|
|
181
136
|
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
182
137
|
tslib_1.__metadata("design:paramtypes", [config_file_1.ConfigFile,
|
|
183
138
|
tooling_common_1.AtomicFile,
|
|
184
|
-
|
|
139
|
+
pack_policy_files_1.PackPolicyFiles])
|
|
185
140
|
], ConfigPruner);
|
|
186
141
|
//# sourceMappingURL=config-pruner.js.map
|
package/src/config-pruner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-pruner.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/config-pruner.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,yCAA2D;AAE3D,8DAAuD;AACvD,+CAA2C;AAC3C,2CAAoD;AACpD,wDAAkC;AAElC,+DAA0D;AAC1D,+DAA2D;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,iGAAiG;AACjG,MAAa,SAAS;IAClB,4DAA4D;IAC5D,OAAO,CAAS;IAChB,8DAA8D;IAC9D,GAAG,CAAS;IACZ,6EAA6E;IAC7E,MAAM,CAAS;IAEf,YAAY,OAAe,EAAE,GAAW,EAAE,MAAc;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAbD,8BAaC;AAED,2CAA2C;AAC3C,MAAa,WAAW;IACpB,oDAAoD;IACpD,UAAU,CAAS;IACnB,OAAO,CAAc;IAErB,YAAY,UAAkB,EAAE,OAAoB;QAChD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,wCAAwC;IACxC,OAAO;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,yFAAyF;IACzF,YAAY;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAClB,OAAO,IAAI,iCAAqB,wBAAwB,IAAI,CAAC,UAAU,uBAAuB,CAAC;QACnG,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAY,EAAU,EAAE,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iB;GAJxC,YAAY,CAsFxB","sourcesContent":["import * as fs from 'fs';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { AtomicFile } from '@webpieces/tooling-common';\nimport { ConfigFile } from './config-file';\nimport { PRUNE_UNKNOWN_COMMAND } from './constants';\nimport * as path from 'node:path';\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { RulePackSelection } from './rule-pack-selection';\nimport { RETIRED_SCOPE_RULE } from './retired-config-keys';\n\n/**\n * `wp-prune-unknown-config` — the MECHANICAL cure for \"[x] Unknown rule\".\n *\n * ## Why a command and not just advice\n *\n * An unknown key controls nothing, so deleting it is the fix, and the validator now says so. But the\n * moment that advice is read is the worst possible moment to act on it by hand: the hook guard denies\n * every Bash call while the config is invalid, so the reader is editing JSON blind, with no way to\n * re-run the validator between edits. Making the cleanup one command means cleanliness is the default\n * path rather than a judgement call taken under a total block — and it makes \"the file validates\" mean\n * \"every key in it is real\", which is the property that keeps dead config from reading as live config.\n *\n * ## What it removes, and what it deliberately does NOT\n *\n * Removed, from the `rules` and `hookGuards` sections only:\n * - a name with no entry in RULE_SCHEMAS and no entry in RETIRED_CONFIG_KEYS (a typo, or a rule some\n * release deleted). Nothing reads it, by construction.\n * - a name in RETIRED_CONFIG_KEYS whose entry is `prunable` — the retirement's own instruction is\n * \"delete this entry\", because the setting left webpieces.config.json entirely.\n *\n * NOT removed:\n * - a RENAME or an in-file move (`prunable: false`). Deleting those discards a value the new key still\n * needs, so they keep their migration instruction and a human/agent applies it.\n * - anything at all when `rulesDir` is configured. A custom rule legitimately has no built-in schema,\n * and this command must never eat one.\n * - top-level keys, `commands`, `excludePaths`, `match-rules`. Those are validated by shape, not by a\n * name table, so \"unknown\" is not defined for them and a pruner would be guessing.\n *\n * ## The one destructive case, and why the drift guard already covers it\n *\n * A key CAN be valid-but-unlearned when package.json pins an @webpieces older than the config. Pruning\n * then would delete live config. That case cannot reach here: the shim's version-drift guard compares\n * the pin against the installed version and denies every tool call — including this one — before the\n * validator or this command ever runs. It is also why `PruneResult` names every key it removed rather\n * than reporting a count: a silent sweep is the thing that would make the rare case unrecoverable.\n */\n\n/** One key this run removed, and the reason it was safe to remove. Data-only (per CLAUDE.md). */\nexport class PrunedKey {\n /** `rules` or `hookGuards` — the section the key sat in. */\n section: string;\n /** The rule/guard name exactly as it appeared in the file. */\n key: string;\n /** Human-readable justification, printed per key so no removal is silent. */\n reason: string;\n\n constructor(section: string, key: string, reason: string) {\n this.section = section;\n this.key = key;\n this.reason = reason;\n }\n}\n\n/** The outcome of one prune. Data-only. */\nexport class PruneResult {\n /** The webpieces.config.json that was inspected. */\n configPath: string;\n removed: PrunedKey[];\n\n constructor(configPath: string, removed: PrunedKey[]) {\n this.configPath = configPath;\n this.removed = removed;\n }\n\n /** True when the file was rewritten. */\n changed(): boolean {\n return this.removed.length > 0;\n }\n\n /** The report the CLI prints. Every removed key is named; nothing is summarised away. */\n describeSelf(): string {\n if (!this.changed()) {\n return `[${PRUNE_UNKNOWN_COMMAND}] No unknown keys in ${this.configPath} — nothing to remove.`;\n }\n const lines = this.removed.map((r: PrunedKey): string => ` • ${r.section}.${r.key} — ${r.reason}`);\n return `[${PRUNE_UNKNOWN_COMMAND}] Removed ${this.removed.length} unknown key(s) from ` +\n `${this.configPath}:\\n${lines.join('\\n')}`;\n }\n}\n\n/** The sections a rule/guard name may legally sit in — the only two this command touches. */\nconst PRUNABLE_SECTIONS: readonly string[] = ['rules', 'hookGuards'];\n\n@injectable(bindingScopeValues.Singleton)\nexport class ConfigPruner {\n constructor(\n private readonly configFile: ConfigFile,\n private readonly atomicFile: AtomicFile,\n private readonly rulePacks: RulePackSelection,\n ) {}\n\n /**\n * Strip every unknown key from the webpieces.config.json above `cwd` and rewrite it. Throws when no\n * config file is found — a prune with no target is a mistake, not a no-op.\n */\n pruneFrom(cwd: string): PruneResult {\n const configPath = this.configFile.findConfigFile(cwd);\n if (configPath === null) {\n throw new Error(`[${PRUNE_UNKNOWN_COMMAND}] No webpieces.config.json found above ${cwd}.`);\n }\n return this.prune(configPath);\n }\n\n /**\n * Strip every unknown key from `configPath` and rewrite it in place. Reads the file directly rather\n * than through the loader: the loader VALIDATES, and this command's whole purpose is to run on a\n * file that fails validation.\n */\n prune(configPath: string): PruneResult {\n const text = fs.readFileSync(configPath, 'utf8');\n // webpieces-disable no-any-unknown -- the raw config document is opaque JSON until narrowed below\n const parsed: unknown = JSON.parse(text);\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {\n throw new Error(`[${PRUNE_UNKNOWN_COMMAND}] ${configPath} is not a JSON object.`);\n }\n // webpieces-disable no-any-unknown -- narrowed to a non-null, non-array object one line above\n const document = parsed as Record<string, unknown>;\n const removed = this.removeUnknown(document, this.rulePacks.loadFrom(path.dirname(configPath)));\n if (removed.length > 0) {\n this.atomicFile.writeAtomic(configPath, JSON.stringify(document, null, this.indentOf(text)) + '\\n');\n }\n return new PruneResult(configPath, removed);\n }\n\n /** Mutates `document`, deleting every prunable name from the two rule sections. */\n // webpieces-disable no-any-unknown -- opaque parsed config document\n private removeUnknown(document: Record<string, unknown>, registry: RulePackRegistry): PrunedKey[] {\n // A custom rules directory means a name with no built-in schema may be entirely legitimate.\n const rulesDir = document['rulesDir'];\n if (Array.isArray(rulesDir) && rulesDir.length > 0) return [];\n\n const removed: PrunedKey[] = [];\n for (const sectionName of PRUNABLE_SECTIONS) {\n const section = document[sectionName];\n if (typeof section !== 'object' || section === null || Array.isArray(section)) continue;\n // webpieces-disable no-any-unknown -- narrowed to a non-null, non-array object one line above\n const entries = section as Record<string, unknown>;\n for (const key of Object.keys(entries)) {\n const reason = this.reasonToRemove(key, registry);\n if (reason === null) continue;\n delete entries[key];\n removed.push(new PrunedKey(sectionName, key, reason));\n }\n }\n return removed;\n }\n\n /** Why `key` is safe to delete, or null when it must be kept. */\n private reasonToRemove(key: string, registry: RulePackRegistry): string | null {\n if (registry.hasRule(key)) return null;\n const retired = registry.migrations().find(\n e => e.scope === RETIRED_SCOPE_RULE && e.key === key);\n if (retired) {\n if (!retired.prunable) return null;\n return retired.movedTo === ''\n ? 'RETIRED and removed with no replacement'\n : `RETIRED — the setting now lives at ${retired.movedTo}`;\n }\n return 'no running validator has a schema for it, so nothing reads it';\n }\n\n /**\n * The file's own indentation, so a prune does not reformat every line it did not touch. Falls back to\n * 4 (the shape every webpieces.config.json in the wild uses) when the document is single-line.\n */\n private indentOf(text: string): number {\n const match = /\\n( +)\"/.exec(text);\n if (match === null) return 4;\n return match[1].length;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config-pruner.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/config-pruner.ts"],"names":[],"mappings":";;;;AACA,+CAAyB;AACzB,yCAA2D;AAE3D,8DAAuD;AACvD,+CAA2C;AAC3C,2CAAoD;AACpD,wDAAkC;AAClC,6DAAwD;AACxD,2DAA0E;AAC1E,+DAA2D;AAC3D,yDAA0D;AAC1D,8DAA0D;AAE1D,kIAAkI;AAClI,iGAAiG;AACjG,MAAa,SAAS;IAClB,yDAAyD;IACzD,OAAO,CAAS;IAChB,8DAA8D;IAC9D,GAAG,CAAS;IACZ,6EAA6E;IAC7E,MAAM,CAAS;IAEf,YAAY,OAAe,EAAE,GAAW,EAAE,MAAc;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAbD,8BAaC;AAED,2CAA2C;AAC3C,MAAa,WAAW;IACpB,oDAAoD;IACpD,UAAU,CAAS;IACnB,OAAO,CAAc;IAErB,YAAY,UAAkB,EAAE,OAAoB;QAChD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,wCAAwC;IACxC,OAAO;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACnC,CA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AkB,CAAC,SAAS,CAAC;6CAGJ,wBAAU;QACV,2BAAU;QACf,mCAAe;GAJlC,YAAY,CAkFxB","sourcesContent":["import { RetiredConfigKey } from '@webpieces/rules-sdk';\nimport * as fs from 'fs';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { AtomicFile } from '@webpieces/tooling-common';\nimport { ConfigFile } from './config-file';\nimport { PRUNE_UNKNOWN_COMMAND } from './constants';\nimport * as path from 'node:path';\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { PackPolicyFiles, SelectedPolicyPack } from './pack-policy-files';\nimport { RETIRED_SCOPE_RULE } from './retired-config-keys';\nimport { validateTopLevelKeys } from './config-key-rules';\nimport { InformAiError } from '@webpieces/tooling-common';\n\n/** Prune only owner-file entries that no selected schema reads, retaining renames and wrong-owner entries for explicit repair. */\n/** One key this run removed, and the reason it was safe to remove. Data-only (per CLAUDE.md). */\nexport class PrunedKey {\n /** The declared owner config path containing the key. */\n section: string;\n /** The rule/guard name exactly as it appeared in the file. */\n key: string;\n /** Human-readable justification, printed per key so no removal is silent. */\n reason: string;\n\n constructor(section: string, key: string, reason: string) {\n this.section = section;\n this.key = key;\n this.reason = reason;\n }\n}\n\n/** The outcome of one prune. Data-only. */\nexport class PruneResult {\n /** The webpieces.config.json that was inspected. */\n configPath: string;\n removed: PrunedKey[];\n\n constructor(configPath: string, removed: PrunedKey[]) {\n this.configPath = configPath;\n this.removed = removed;\n }\n\n /** True when the file was rewritten. */\n changed(): boolean {\n return this.removed.length > 0;\n }\n\n /** The report the CLI prints. Every removed key is named; nothing is summarised away. */\n describeSelf(): string {\n if (!this.changed()) {\n return `[${PRUNE_UNKNOWN_COMMAND}] No unknown keys in ${this.configPath} — nothing to remove.`;\n }\n const lines = this.removed.map(\n (r: PrunedKey): string => ` • ${r.section}.${r.key} — ${r.reason}`,\n );\n return (\n `[${PRUNE_UNKNOWN_COMMAND}] Removed ${this.removed.length} unknown key(s) from ` +\n `${this.configPath}:\\n${lines.join('\\n')}`\n );\n }\n}\n\n@injectable(bindingScopeValues.Singleton)\nexport class ConfigPruner {\n constructor(\n private readonly configFile: ConfigFile,\n private readonly atomicFile: AtomicFile,\n private readonly files: PackPolicyFiles,\n ) {}\n\n /**\n * Strip every unknown key from the webpieces.config.json above `cwd` and rewrite it. Throws when no\n * config file is found — a prune with no target is a mistake, not a no-op.\n */\n pruneFrom(cwd: string): PruneResult {\n const configPath = this.configFile.findConfigFile(cwd);\n if (configPath === null) {\n throw new Error(\n `[${PRUNE_UNKNOWN_COMMAND}] No webpieces.config.json found above ${cwd}.`,\n );\n }\n return this.prune(configPath);\n }\n\n /**\n * Strip every unknown key from `configPath` and rewrite it in place. Reads the file directly rather\n * than through the loader: the loader VALIDATES, and this command's whole purpose is to run on a\n * file that fails validation.\n */\n prune(configPath: string): PruneResult {\n const root = path.dirname(configPath),\n document = this.configFile.readRawConfig(configPath);\n // webpieces-disable no-any-unknown -- pruning may inspect invalid policy values, but never accepts a retired root selection surface\n const rootErrors = validateTopLevelKeys(document as Record<string, unknown>);\n if (rootErrors.length) throw new InformAiError(rootErrors.join('\\n'));\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 const removed: PrunedKey[] = [];\n for (const pack of selected) {\n const filename = this.files.configPath(root, pack.declaration.config);\n const text = fs.readFileSync(filename, 'utf8'),\n entries = this.files.read(filename);\n const pruned: PrunedKey[] = [];\n for (const key of Object.keys(entries)) {\n const reason = this.reasonToRemove(key, registry);\n if (reason === null) continue;\n delete entries[key];\n pruned.push(new PrunedKey(pack.declaration.config, key, reason));\n }\n if (pruned.length)\n this.atomicFile.writeAtomic(\n filename,\n JSON.stringify(entries, null, this.indentOf(text)) + '\\n',\n );\n removed.push(...pruned);\n }\n return new PruneResult(configPath, removed);\n }\n\n /** Why `key` is safe to delete, or null when it must be kept. */\n private reasonToRemove(key: string, registry: RulePackRegistry): string | null {\n if (registry.hasRule(key)) return null;\n const retired = registry\n .migrations()\n .find((e: RetiredConfigKey) => e.scope === RETIRED_SCOPE_RULE && e.key === key);\n if (retired) {\n if (!retired.prunable) return null;\n return retired.movedTo === ''\n ? 'RETIRED and removed with no replacement'\n : `RETIRED — the setting now lives at ${retired.movedTo}`;\n }\n return 'no running validator has a schema for it, so nothing reads it';\n }\n\n /**\n * The file's own indentation, so a prune does not reformat every line it did not touch. Falls back to\n * 4 (the shape every webpieces.config.json in the wild uses) when the document is single-line.\n */\n private indentOf(text: string): number {\n const match = /\\n( +)\"/.exec(text);\n if (match === null) return 4;\n return match[1].length;\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigRepairAccess = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const inversify_1 = require("inversify");
|
|
6
|
+
const config_repair_probe_1 = require("./config-repair-probe");
|
|
7
|
+
/** Repair access has one canonical probe shared with the bootstrap shim. */
|
|
8
|
+
let ConfigRepairAccess = class ConfigRepairAccess {
|
|
9
|
+
isRepairFile(root, filename) {
|
|
10
|
+
return new config_repair_probe_1.ConfigRepairProbe().isRepairFile(root, filename);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.ConfigRepairAccess = ConfigRepairAccess;
|
|
14
|
+
exports.ConfigRepairAccess = ConfigRepairAccess = tslib_1.__decorate([
|
|
15
|
+
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton)
|
|
16
|
+
], ConfigRepairAccess);
|
|
17
|
+
//# sourceMappingURL=config-repair-access.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-repair-access.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/config-repair-access.ts"],"names":[],"mappings":";;;;AAAA,yCAA2D;AAC3D,+DAA0D;AAE1D,4EAA4E;AAErE,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC3B,YAAY,CAAC,IAAY,EAAE,QAAgB;QACvC,OAAO,IAAI,uCAAiB,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC;CACJ,CAAA;AAJY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,kBAAkB,CAI9B","sourcesContent":["import { injectable, bindingScopeValues } from 'inversify';\nimport { ConfigRepairProbe } from './config-repair-probe';\n\n/** Repair access has one canonical probe shared with the bootstrap shim. */\n@injectable(bindingScopeValues.Singleton)\nexport class ConfigRepairAccess {\n isRepairFile(root: string, filename: string): boolean {\n return new ConfigRepairProbe().isRepairFile(root, filename);\n }\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Generated from ConfigRepairProbe by pnpm guards:generate; never edit this artifact. */
|
|
2
|
+
export declare const CONFIG_REPAIR_BOOTSTRAP_SOURCE = "/** Self-contained Node probe: serialized into the POSIX shim so repairs work with missing packages. */\nclass ConfigRepairProbe {\n rootFor(cwd) {\n const fs = require('node:fs'), path = require('node:path');\n let directory = path.resolve(cwd);\n while (!fs.existsSync(path.join(directory, 'webpieces.config.json'))) {\n const parent = path.dirname(directory);\n if (parent === directory)\n return cwd;\n directory = parent;\n }\n return directory;\n }\n isRepairPatch(root, patch) {\n const lines = patch.trim().split('\\n');\n if (lines[0] !== '*** Begin Patch' || lines.at(-1) !== '*** End Patch')\n return false;\n let targets = 0;\n for (const line of lines.slice(1, -1)) {\n if (!line.startsWith('*** '))\n continue;\n const match = /^\\*\\*\\* (?:Add|Update) File: (.+)$/.exec(line);\n if (!match || !this.isRepairFile(root, match[1]))\n return false;\n targets += 1;\n }\n return targets > 0;\n }\n isRepairFile(root, filename) {\n const toError = this.error;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- bootstrap cannot trust package imports or malformed declarations\n try {\n const fs = require('node:fs'), path = require('node:path');\n const target = this.canonical(root, path.resolve(root, filename));\n const rootFile = this.canonical(root, path.join(root, 'webpieces.config.json'));\n if (target === rootFile)\n return true;\n // webpieces-disable no-any-unknown -- only validated declaration strings grant repair access\n const raw = JSON.parse(fs.readFileSync(rootFile, 'utf8'));\n if (!raw ||\n typeof raw !== 'object' ||\n !('rulePacks' in raw) ||\n !Array.isArray(raw.rulePacks) ||\n !raw.rulePacks.length)\n return false;\n const files = new Set(), packages = new Set();\n const lock = this.canonical(root, path.join(root, '.webpieces/rules.lock.json'));\n for (const declaration of raw.rulePacks) {\n if (!declaration ||\n typeof declaration !== 'object' ||\n Array.isArray(declaration) ||\n typeof declaration.package !== 'string' ||\n !declaration.package ||\n typeof declaration.config !== 'string' ||\n !declaration.config.endsWith('.json') ||\n path.isAbsolute(declaration.config) ||\n Object.keys(declaration).some((key) => !['package', 'config'].includes(key)))\n return false;\n const file = this.canonical(root, path.join(root, declaration.config));\n if (file === rootFile ||\n file === lock ||\n files.has(file) ||\n packages.has(declaration.package))\n return false;\n files.add(file);\n packages.add(declaration.package);\n }\n files.add(lock);\n files.add(this.canonical(root, path.join(root, '.webpieces/instruct-ai/rules-catalog.md')));\n return files.has(target);\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n }\n catch (err) {\n const error = toError(err);\n void error;\n return false;\n }\n }\n canonical(root, filename) {\n const fs = require('node:fs'), path = require('node:path');\n const pending = [];\n let ancestor = filename;\n while (!fs.lstatSync(ancestor, { throwIfNoEntry: false })) {\n pending.unshift(path.basename(ancestor));\n const parent = path.dirname(ancestor);\n if (parent === ancestor)\n throw new Error('Cannot resolve config repair path.');\n ancestor = parent;\n }\n const canonical = path.resolve(fs.realpathSync(ancestor), ...pending), relative = path.relative(fs.realpathSync(root), canonical);\n if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))\n throw new Error('Config repair path escapes the repository.');\n return canonical;\n }\n // webpieces-disable no-any-unknown -- the bootstrap adapter must remain self-contained when node_modules is corrupt\n error(err) {\n return err instanceof Error ? err : new Error(String(err));\n }\n}\n";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONFIG_REPAIR_BOOTSTRAP_SOURCE = void 0;
|
|
4
|
+
/** Generated from ConfigRepairProbe by pnpm guards:generate; never edit this artifact. */
|
|
5
|
+
// webpieces-disable no-unmanaged-exceptions -- serialized bootstrap catches malformed external declarations without package imports
|
|
6
|
+
exports.CONFIG_REPAIR_BOOTSTRAP_SOURCE = "/** Self-contained Node probe: serialized into the POSIX shim so repairs work with missing packages. */\nclass ConfigRepairProbe {\n rootFor(cwd) {\n const fs = require('node:fs'), path = require('node:path');\n let directory = path.resolve(cwd);\n while (!fs.existsSync(path.join(directory, 'webpieces.config.json'))) {\n const parent = path.dirname(directory);\n if (parent === directory)\n return cwd;\n directory = parent;\n }\n return directory;\n }\n isRepairPatch(root, patch) {\n const lines = patch.trim().split('\\n');\n if (lines[0] !== '*** Begin Patch' || lines.at(-1) !== '*** End Patch')\n return false;\n let targets = 0;\n for (const line of lines.slice(1, -1)) {\n if (!line.startsWith('*** '))\n continue;\n const match = /^\\*\\*\\* (?:Add|Update) File: (.+)$/.exec(line);\n if (!match || !this.isRepairFile(root, match[1]))\n return false;\n targets += 1;\n }\n return targets > 0;\n }\n isRepairFile(root, filename) {\n const toError = this.error;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- bootstrap cannot trust package imports or malformed declarations\n try {\n const fs = require('node:fs'), path = require('node:path');\n const target = this.canonical(root, path.resolve(root, filename));\n const rootFile = this.canonical(root, path.join(root, 'webpieces.config.json'));\n if (target === rootFile)\n return true;\n // webpieces-disable no-any-unknown -- only validated declaration strings grant repair access\n const raw = JSON.parse(fs.readFileSync(rootFile, 'utf8'));\n if (!raw ||\n typeof raw !== 'object' ||\n !('rulePacks' in raw) ||\n !Array.isArray(raw.rulePacks) ||\n !raw.rulePacks.length)\n return false;\n const files = new Set(), packages = new Set();\n const lock = this.canonical(root, path.join(root, '.webpieces/rules.lock.json'));\n for (const declaration of raw.rulePacks) {\n if (!declaration ||\n typeof declaration !== 'object' ||\n Array.isArray(declaration) ||\n typeof declaration.package !== 'string' ||\n !declaration.package ||\n typeof declaration.config !== 'string' ||\n !declaration.config.endsWith('.json') ||\n path.isAbsolute(declaration.config) ||\n Object.keys(declaration).some((key) => !['package', 'config'].includes(key)))\n return false;\n const file = this.canonical(root, path.join(root, declaration.config));\n if (file === rootFile ||\n file === lock ||\n files.has(file) ||\n packages.has(declaration.package))\n return false;\n files.add(file);\n packages.add(declaration.package);\n }\n files.add(lock);\n files.add(this.canonical(root, path.join(root, '.webpieces/instruct-ai/rules-catalog.md')));\n return files.has(target);\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n }\n catch (err) {\n const error = toError(err);\n void error;\n return false;\n }\n }\n canonical(root, filename) {\n const fs = require('node:fs'), path = require('node:path');\n const pending = [];\n let ancestor = filename;\n while (!fs.lstatSync(ancestor, { throwIfNoEntry: false })) {\n pending.unshift(path.basename(ancestor));\n const parent = path.dirname(ancestor);\n if (parent === ancestor)\n throw new Error('Cannot resolve config repair path.');\n ancestor = parent;\n }\n const canonical = path.resolve(fs.realpathSync(ancestor), ...pending), relative = path.relative(fs.realpathSync(root), canonical);\n if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))\n throw new Error('Config repair path escapes the repository.');\n return canonical;\n }\n // webpieces-disable no-any-unknown -- the bootstrap adapter must remain self-contained when node_modules is corrupt\n error(err) {\n return err instanceof Error ? err : new Error(String(err));\n }\n}\n";
|
|
7
|
+
//# sourceMappingURL=config-repair-bootstrap-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-repair-bootstrap-source.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/config-repair-bootstrap-source.ts"],"names":[],"mappings":";;;AAAA,0FAA0F;AAC1F,oIAAoI;AACvH,QAAA,8BAA8B,GAAG,0qJAA0qJ,CAAC","sourcesContent":["/** Generated from ConfigRepairProbe by pnpm guards:generate; never edit this artifact. */\n// webpieces-disable no-unmanaged-exceptions -- serialized bootstrap catches malformed external declarations without package imports\nexport const CONFIG_REPAIR_BOOTSTRAP_SOURCE = \"/** Self-contained Node probe: serialized into the POSIX shim so repairs work with missing packages. */\\nclass ConfigRepairProbe {\\n rootFor(cwd) {\\n const fs = require('node:fs'), path = require('node:path');\\n let directory = path.resolve(cwd);\\n while (!fs.existsSync(path.join(directory, 'webpieces.config.json'))) {\\n const parent = path.dirname(directory);\\n if (parent === directory)\\n return cwd;\\n directory = parent;\\n }\\n return directory;\\n }\\n isRepairPatch(root, patch) {\\n const lines = patch.trim().split('\\\\n');\\n if (lines[0] !== '*** Begin Patch' || lines.at(-1) !== '*** End Patch')\\n return false;\\n let targets = 0;\\n for (const line of lines.slice(1, -1)) {\\n if (!line.startsWith('*** '))\\n continue;\\n const match = /^\\\\*\\\\*\\\\* (?:Add|Update) File: (.+)$/.exec(line);\\n if (!match || !this.isRepairFile(root, match[1]))\\n return false;\\n targets += 1;\\n }\\n return targets > 0;\\n }\\n isRepairFile(root, filename) {\\n const toError = this.error;\\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- bootstrap cannot trust package imports or malformed declarations\\n try {\\n const fs = require('node:fs'), path = require('node:path');\\n const target = this.canonical(root, path.resolve(root, filename));\\n const rootFile = this.canonical(root, path.join(root, 'webpieces.config.json'));\\n if (target === rootFile)\\n return true;\\n // webpieces-disable no-any-unknown -- only validated declaration strings grant repair access\\n const raw = JSON.parse(fs.readFileSync(rootFile, 'utf8'));\\n if (!raw ||\\n typeof raw !== 'object' ||\\n !('rulePacks' in raw) ||\\n !Array.isArray(raw.rulePacks) ||\\n !raw.rulePacks.length)\\n return false;\\n const files = new Set(), packages = new Set();\\n const lock = this.canonical(root, path.join(root, '.webpieces/rules.lock.json'));\\n for (const declaration of raw.rulePacks) {\\n if (!declaration ||\\n typeof declaration !== 'object' ||\\n Array.isArray(declaration) ||\\n typeof declaration.package !== 'string' ||\\n !declaration.package ||\\n typeof declaration.config !== 'string' ||\\n !declaration.config.endsWith('.json') ||\\n path.isAbsolute(declaration.config) ||\\n Object.keys(declaration).some((key) => !['package', 'config'].includes(key)))\\n return false;\\n const file = this.canonical(root, path.join(root, declaration.config));\\n if (file === rootFile ||\\n file === lock ||\\n files.has(file) ||\\n packages.has(declaration.package))\\n return false;\\n files.add(file);\\n packages.add(declaration.package);\\n }\\n files.add(lock);\\n files.add(this.canonical(root, path.join(root, '.webpieces/instruct-ai/rules-catalog.md')));\\n return files.has(target);\\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\\n }\\n catch (err) {\\n const error = toError(err);\\n void error;\\n return false;\\n }\\n }\\n canonical(root, filename) {\\n const fs = require('node:fs'), path = require('node:path');\\n const pending = [];\\n let ancestor = filename;\\n while (!fs.lstatSync(ancestor, { throwIfNoEntry: false })) {\\n pending.unshift(path.basename(ancestor));\\n const parent = path.dirname(ancestor);\\n if (parent === ancestor)\\n throw new Error('Cannot resolve config repair path.');\\n ancestor = parent;\\n }\\n const canonical = path.resolve(fs.realpathSync(ancestor), ...pending), relative = path.relative(fs.realpathSync(root), canonical);\\n if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))\\n throw new Error('Config repair path escapes the repository.');\\n return canonical;\\n }\\n // webpieces-disable no-any-unknown -- the bootstrap adapter must remain self-contained when node_modules is corrupt\\n error(err) {\\n return err instanceof Error ? err : new Error(String(err));\\n }\\n}\\n\";\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Self-contained Node probe: serialized into the POSIX shim so repairs work with missing packages. */
|
|
2
|
+
export declare class ConfigRepairProbe {
|
|
3
|
+
rootFor(cwd: string): string;
|
|
4
|
+
isRepairPatch(root: string, patch: string): boolean;
|
|
5
|
+
isRepairFile(root: string, filename: string): boolean;
|
|
6
|
+
private canonical;
|
|
7
|
+
private error;
|
|
8
|
+
}
|
|
9
|
+
/** Emits the same compiled probe class; the shell has no separate declaration/path algorithm. */
|
|
10
|
+
export declare class ConfigRepairBootstrap {
|
|
11
|
+
script(): string;
|
|
12
|
+
callScript(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigRepairBootstrap = exports.ConfigRepairProbe = void 0;
|
|
4
|
+
const config_repair_bootstrap_source_1 = require("./config-repair-bootstrap-source");
|
|
5
|
+
/** Self-contained Node probe: serialized into the POSIX shim so repairs work with missing packages. */
|
|
6
|
+
class ConfigRepairProbe {
|
|
7
|
+
rootFor(cwd) {
|
|
8
|
+
const fs = require('node:fs'), path = require('node:path');
|
|
9
|
+
let directory = path.resolve(cwd);
|
|
10
|
+
while (!fs.existsSync(path.join(directory, 'webpieces.config.json'))) {
|
|
11
|
+
const parent = path.dirname(directory);
|
|
12
|
+
if (parent === directory)
|
|
13
|
+
return cwd;
|
|
14
|
+
directory = parent;
|
|
15
|
+
}
|
|
16
|
+
return directory;
|
|
17
|
+
}
|
|
18
|
+
isRepairPatch(root, patch) {
|
|
19
|
+
const lines = patch.trim().split('\n');
|
|
20
|
+
if (lines[0] !== '*** Begin Patch' || lines.at(-1) !== '*** End Patch')
|
|
21
|
+
return false;
|
|
22
|
+
let targets = 0;
|
|
23
|
+
for (const line of lines.slice(1, -1)) {
|
|
24
|
+
if (!line.startsWith('*** '))
|
|
25
|
+
continue;
|
|
26
|
+
const match = /^\*\*\* (?:Add|Update) File: (.+)$/.exec(line);
|
|
27
|
+
if (!match || !this.isRepairFile(root, match[1]))
|
|
28
|
+
return false;
|
|
29
|
+
targets += 1;
|
|
30
|
+
}
|
|
31
|
+
return targets > 0;
|
|
32
|
+
}
|
|
33
|
+
isRepairFile(root, filename) {
|
|
34
|
+
const toError = this.error;
|
|
35
|
+
// eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- bootstrap cannot trust package imports or malformed declarations
|
|
36
|
+
try {
|
|
37
|
+
const fs = require('node:fs'), path = require('node:path');
|
|
38
|
+
const target = this.canonical(root, path.resolve(root, filename));
|
|
39
|
+
const rootFile = this.canonical(root, path.join(root, 'webpieces.config.json'));
|
|
40
|
+
if (target === rootFile)
|
|
41
|
+
return true;
|
|
42
|
+
// webpieces-disable no-any-unknown -- only validated declaration strings grant repair access
|
|
43
|
+
const raw = JSON.parse(fs.readFileSync(rootFile, 'utf8'));
|
|
44
|
+
if (!raw ||
|
|
45
|
+
typeof raw !== 'object' ||
|
|
46
|
+
!('rulePacks' in raw) ||
|
|
47
|
+
!Array.isArray(raw.rulePacks) ||
|
|
48
|
+
!raw.rulePacks.length)
|
|
49
|
+
return false;
|
|
50
|
+
const files = new Set(), packages = new Set();
|
|
51
|
+
const lock = this.canonical(root, path.join(root, '.webpieces/rules.lock.json'));
|
|
52
|
+
for (const declaration of raw.rulePacks) {
|
|
53
|
+
if (!declaration ||
|
|
54
|
+
typeof declaration !== 'object' ||
|
|
55
|
+
Array.isArray(declaration) ||
|
|
56
|
+
typeof declaration.package !== 'string' ||
|
|
57
|
+
!declaration.package ||
|
|
58
|
+
typeof declaration.config !== 'string' ||
|
|
59
|
+
!declaration.config.endsWith('.json') ||
|
|
60
|
+
path.isAbsolute(declaration.config) ||
|
|
61
|
+
Object.keys(declaration).some((key) => !['package', 'config'].includes(key)))
|
|
62
|
+
return false;
|
|
63
|
+
const file = this.canonical(root, path.join(root, declaration.config));
|
|
64
|
+
if (file === rootFile ||
|
|
65
|
+
file === lock ||
|
|
66
|
+
files.has(file) ||
|
|
67
|
+
packages.has(declaration.package))
|
|
68
|
+
return false;
|
|
69
|
+
files.add(file);
|
|
70
|
+
packages.add(declaration.package);
|
|
71
|
+
}
|
|
72
|
+
files.add(lock);
|
|
73
|
+
files.add(this.canonical(root, path.join(root, '.webpieces/instruct-ai/rules-catalog.md')));
|
|
74
|
+
return files.has(target);
|
|
75
|
+
// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
const error = toError(err);
|
|
79
|
+
void error;
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
canonical(root, filename) {
|
|
84
|
+
const fs = require('node:fs'), path = require('node:path');
|
|
85
|
+
const pending = [];
|
|
86
|
+
let ancestor = filename;
|
|
87
|
+
while (!fs.lstatSync(ancestor, { throwIfNoEntry: false })) {
|
|
88
|
+
pending.unshift(path.basename(ancestor));
|
|
89
|
+
const parent = path.dirname(ancestor);
|
|
90
|
+
if (parent === ancestor)
|
|
91
|
+
throw new Error('Cannot resolve config repair path.');
|
|
92
|
+
ancestor = parent;
|
|
93
|
+
}
|
|
94
|
+
const canonical = path.resolve(fs.realpathSync(ancestor), ...pending), relative = path.relative(fs.realpathSync(root), canonical);
|
|
95
|
+
if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
|
|
96
|
+
throw new Error('Config repair path escapes the repository.');
|
|
97
|
+
return canonical;
|
|
98
|
+
}
|
|
99
|
+
// webpieces-disable no-any-unknown -- the bootstrap adapter must remain self-contained when node_modules is corrupt
|
|
100
|
+
error(err) {
|
|
101
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.ConfigRepairProbe = ConfigRepairProbe;
|
|
105
|
+
/** Emits the same compiled probe class; the shell has no separate declaration/path algorithm. */
|
|
106
|
+
class ConfigRepairBootstrap {
|
|
107
|
+
script() {
|
|
108
|
+
return `${config_repair_bootstrap_source_1.CONFIG_REPAIR_BOOTSTRAP_SOURCE} if (!new ConfigRepairProbe().isRepairFile(process.argv[1], process.argv[2])) process.exitCode = 1;`;
|
|
109
|
+
}
|
|
110
|
+
callScript() {
|
|
111
|
+
return `${config_repair_bootstrap_source_1.CONFIG_REPAIR_BOOTSTRAP_SOURCE} const probe = new ConfigRepairProbe(); const root = probe.rootFor(process.argv[1]); const payload = JSON.parse(require('node:fs').readFileSync(0, 'utf8')); const input = payload.tool_input; const tool = payload.tool_name; const allowed = ['Write','Edit','MultiEdit'].includes(tool) && input && typeof input.file_path === 'string' ? probe.isRepairFile(root, input.file_path) : tool === 'apply_patch' && input && typeof input.command === 'string' && probe.isRepairPatch(root, input.command); if (!allowed) process.exitCode = 1;`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.ConfigRepairBootstrap = ConfigRepairBootstrap;
|
|
115
|
+
//# sourceMappingURL=config-repair-probe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-repair-probe.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/config-repair-probe.ts"],"names":[],"mappings":";;;AAAA,qFAAkF;AAElF,uGAAuG;AACvG,MAAa,iBAAiB;IAC1B,OAAO,CAAC,GAAW;QACf,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAA6B,EACrD,IAAI,GAAG,OAAO,CAAC,WAAW,CAA+B,CAAC;QAC9D,IAAI,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC;YACnE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACvC,IAAI,MAAM,KAAK,SAAS;gBAAE,OAAO,GAAG,CAAC;YACrC,SAAS,GAAG,MAAM,CAAC;QACvB,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,aAAa,CAAC,IAAY,EAAE,KAAa;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,KAAK,CAAC,C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AAM,CAAC;QACtB,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,GAAG,OAAO,CAAC,EACjE,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;QAC/D,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YACtF,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAClE,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,oHAAoH;IAC5G,KAAK,CAAC,GAAY;QACtB,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;CACJ;AA7GD,8CA6GC;AAED,iGAAiG;AACjG,MAAa,qBAAqB;IAC9B,MAAM;QACF,OAAO,GAAG,+DAA8B,qGAAqG,CAAC;IAClJ,CAAC;IAED,UAAU;QACN,OAAO,GAAG,+DAA8B,ghBAAghB,CAAC;IAC7jB,CAAC;CACJ;AARD,sDAQC","sourcesContent":["import { CONFIG_REPAIR_BOOTSTRAP_SOURCE } from './config-repair-bootstrap-source';\n\n/** Self-contained Node probe: serialized into the POSIX shim so repairs work with missing packages. */\nexport class ConfigRepairProbe {\n rootFor(cwd: string): string {\n const fs = require('node:fs') as typeof import('node:fs'),\n path = require('node:path') as typeof import('node:path');\n let directory = path.resolve(cwd);\n while (!fs.existsSync(path.join(directory, 'webpieces.config.json'))) {\n const parent = path.dirname(directory);\n if (parent === directory) return cwd;\n directory = parent;\n }\n return directory;\n }\n\n isRepairPatch(root: string, patch: string): boolean {\n const lines = patch.trim().split('\\n');\n if (lines[0] !== '*** Begin Patch' || lines.at(-1) !== '*** End Patch') return false;\n let targets = 0;\n for (const line of lines.slice(1, -1)) {\n if (!line.startsWith('*** ')) continue;\n const match = /^\\*\\*\\* (?:Add|Update) File: (.+)$/.exec(line);\n if (!match || !this.isRepairFile(root, match[1])) return false;\n targets += 1;\n }\n return targets > 0;\n }\n\n isRepairFile(root: string, filename: string): boolean {\n const toError = this.error;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- bootstrap cannot trust package imports or malformed declarations\n try {\n const fs = require('node:fs') as typeof import('node:fs'),\n path = require('node:path') as typeof import('node:path');\n const target = this.canonical(root, path.resolve(root, filename));\n const rootFile = this.canonical(root, path.join(root, 'webpieces.config.json'));\n if (target === rootFile) return true;\n // webpieces-disable no-any-unknown -- only validated declaration strings grant repair access\n const raw: unknown = JSON.parse(fs.readFileSync(rootFile, 'utf8'));\n if (\n !raw ||\n typeof raw !== 'object' ||\n !('rulePacks' in raw) ||\n !Array.isArray(raw.rulePacks) ||\n !raw.rulePacks.length\n )\n return false;\n const files = new Set<string>(),\n packages = new Set<string>();\n const lock = this.canonical(root, path.join(root, '.webpieces/rules.lock.json'));\n for (const declaration of raw.rulePacks) {\n if (\n !declaration ||\n typeof declaration !== 'object' ||\n Array.isArray(declaration) ||\n typeof declaration.package !== 'string' ||\n !declaration.package ||\n typeof declaration.config !== 'string' ||\n !declaration.config.endsWith('.json') ||\n path.isAbsolute(declaration.config) ||\n Object.keys(declaration).some(\n (key: string) => !['package', 'config'].includes(key),\n )\n )\n return false;\n const file = this.canonical(root, path.join(root, declaration.config));\n if (\n file === rootFile ||\n file === lock ||\n files.has(file) ||\n packages.has(declaration.package)\n )\n return false;\n files.add(file);\n packages.add(declaration.package);\n }\n files.add(lock);\n files.add(\n this.canonical(root, path.join(root, '.webpieces/instruct-ai/rules-catalog.md')),\n );\n return files.has(target);\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 void error;\n return false;\n }\n }\n\n private canonical(root: string, filename: string): string {\n const fs = require('node:fs') as typeof import('node:fs'),\n path = require('node:path') as typeof import('node:path');\n const pending: string[] = [];\n let ancestor = filename;\n while (!fs.lstatSync(ancestor, { throwIfNoEntry: false })) {\n pending.unshift(path.basename(ancestor));\n const parent = path.dirname(ancestor);\n if (parent === ancestor) throw new Error('Cannot resolve config repair path.');\n ancestor = parent;\n }\n const canonical = path.resolve(fs.realpathSync(ancestor), ...pending),\n relative = path.relative(fs.realpathSync(root), canonical);\n if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))\n throw new Error('Config repair path escapes the repository.');\n return canonical;\n }\n\n // webpieces-disable no-any-unknown -- the bootstrap adapter must remain self-contained when node_modules is corrupt\n private error(err: unknown): Error {\n return err instanceof Error ? err : new Error(String(err));\n }\n}\n\n/** Emits the same compiled probe class; the shell has no separate declaration/path algorithm. */\nexport class ConfigRepairBootstrap {\n script(): string {\n return `${CONFIG_REPAIR_BOOTSTRAP_SOURCE} if (!new ConfigRepairProbe().isRepairFile(process.argv[1], process.argv[2])) process.exitCode = 1;`;\n }\n\n callScript(): string {\n return `${CONFIG_REPAIR_BOOTSTRAP_SOURCE} const probe = new ConfigRepairProbe(); const root = probe.rootFor(process.argv[1]); const payload = JSON.parse(require('node:fs').readFileSync(0, 'utf8')); const input = payload.tool_input; const tool = payload.tool_name; const allowed = ['Write','Edit','MultiEdit'].includes(tool) && input && typeof input.file_path === 'string' ? probe.isRepairFile(root, input.file_path) : tool === 'apply_patch' && input && typeof input.command === 'string' && probe.isRepairPatch(root, input.command); if (!allowed) process.exitCode = 1;`;\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class PathMatchCandidate<T> {
|
|
2
|
+
readonly paths: readonly string[];
|
|
3
|
+
readonly value: T;
|
|
4
|
+
constructor(paths: readonly string[], value: T);
|
|
5
|
+
}
|
|
6
|
+
export declare class FirstPathMatchResult<T> {
|
|
7
|
+
readonly entry: T;
|
|
8
|
+
readonly glob: string;
|
|
9
|
+
constructor(entry: T, glob: string);
|
|
10
|
+
}
|
|
11
|
+
/** Ordered glob selection is generic; callers own their payload and overlap policy. */
|
|
12
|
+
export declare class FirstPathMatch {
|
|
13
|
+
winner<T>(relativePath: string, candidates: readonly PathMatchCandidate<T>[]): FirstPathMatchResult<T> | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FirstPathMatch = exports.FirstPathMatchResult = exports.PathMatchCandidate = void 0;
|
|
4
|
+
const exclude_paths_1 = require("./exclude-paths");
|
|
5
|
+
class PathMatchCandidate {
|
|
6
|
+
paths;
|
|
7
|
+
value;
|
|
8
|
+
constructor(paths, value) {
|
|
9
|
+
this.paths = paths;
|
|
10
|
+
this.value = value;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.PathMatchCandidate = PathMatchCandidate;
|
|
14
|
+
class FirstPathMatchResult {
|
|
15
|
+
entry;
|
|
16
|
+
glob;
|
|
17
|
+
constructor(entry, glob) {
|
|
18
|
+
this.entry = entry;
|
|
19
|
+
this.glob = glob;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.FirstPathMatchResult = FirstPathMatchResult;
|
|
23
|
+
/** Ordered glob selection is generic; callers own their payload and overlap policy. */
|
|
24
|
+
class FirstPathMatch {
|
|
25
|
+
winner(relativePath, candidates) {
|
|
26
|
+
for (const candidate of candidates) {
|
|
27
|
+
const glob = candidate.paths.find((pattern) => (0, exclude_paths_1.matchesAnyGlob)(relativePath, [pattern]));
|
|
28
|
+
if (glob !== undefined)
|
|
29
|
+
return new FirstPathMatchResult(candidate.value, glob);
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.FirstPathMatch = FirstPathMatch;
|
|
35
|
+
//# sourceMappingURL=first-path-match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-path-match.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/first-path-match.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAEjD,MAAa,kBAAkB;IAEd;IACA;IAFb,YACa,KAAwB,EACxB,KAAQ;QADR,UAAK,GAAL,KAAK,CAAmB;QACxB,UAAK,GAAL,KAAK,CAAG;IAClB,CAAC;CACP;AALD,gDAKC;AAED,MAAa,oBAAoB;IAEhB;IACA;IAFb,YACa,KAAQ,EACR,IAAY;QADZ,UAAK,GAAL,KAAK,CAAG;QACR,SAAI,GAAJ,IAAI,CAAQ;IACtB,CAAC;CACP;AALD,oDAKC;AAED,uFAAuF;AACvF,MAAa,cAAc;IACvB,MAAM,CACF,YAAoB,EACpB,UAA4C;QAE5C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACjC,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAe,EAAE,EAAE,CAClD,IAAA,8BAAc,EAAC,YAAY,EAAE,CAAC,OAAO,CAAC,CAAC,CAC1C,CAAC;YACF,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO,IAAI,oBAAoB,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACnF,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAbD,wCAaC","sourcesContent":["import { matchesAnyGlob } from './exclude-paths';\n\nexport class PathMatchCandidate<T> {\n constructor(\n readonly paths: readonly string[],\n readonly value: T,\n ) {}\n}\n\nexport class FirstPathMatchResult<T> {\n constructor(\n readonly entry: T,\n readonly glob: string,\n ) {}\n}\n\n/** Ordered glob selection is generic; callers own their payload and overlap policy. */\nexport class FirstPathMatch {\n winner<T>(\n relativePath: string,\n candidates: readonly PathMatchCandidate<T>[],\n ): FirstPathMatchResult<T> | undefined {\n for (const candidate of candidates) {\n const glob = candidate.paths.find((pattern: string) =>\n matchesAnyGlob(relativePath, [pattern]),\n );\n if (glob !== undefined) return new FirstPathMatchResult(candidate.value, glob);\n }\n return undefined;\n }\n}\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export { CliExitError } from './cli-exit-error';
|
|
|
5
5
|
export { CliUsage, CliFlag, CliArgSet, CliArgsCheck, CliArgs } from './cli-args';
|
|
6
6
|
export { runMain } from './run-main';
|
|
7
7
|
export { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';
|
|
8
|
-
export { formatConfigErrorsBanner, CONFIG_POLICY_DOC, RETIRED_KEY_MARKER, RETIRED_TOP_LEVEL_MARKER,
|
|
8
|
+
export { formatConfigErrorsBanner, CONFIG_POLICY_DOC, RETIRED_KEY_MARKER, RETIRED_TOP_LEVEL_MARKER, } from './config-error-banner';
|
|
9
9
|
export { findConfigFile, CONFIG_FILENAME, ConfigFile, ConfigParseAttempt, CONFIG_PARSE_ATTEMPTS, CONFIG_PARSE_RETRY_MILLIS, } from './config-file';
|
|
10
|
-
export
|
|
10
|
+
export { RawConfigFile } from './config-file';
|
|
11
11
|
export { RepoRootFinder, INSTRUCT_AI_DIR, INSTRUCT_AI_LEAF } from './repo-root';
|
|
12
12
|
export { AgedTreeSweeper, SweepCount, RETENTION_DAYS } from './aged-tree-sweep';
|
|
13
13
|
export { ClaudeEnv, claudeEnv, CLAUDE_PROJECT_DIR_ENV, CLAUDE_PROJECT_DIR_UNSET, } from './claude-env';
|
|
@@ -22,7 +22,7 @@ export { loadTemplate, writeTemplateIfMissing, writeTemplate, TemplateWriter, }
|
|
|
22
22
|
export { GIT_WORKFLOW_DOC, GitWorkflowDoc, InstructAiDoc, InstructAiDocSet, MergeProcessDoc, } from './instruct-ai-docs';
|
|
23
23
|
export { MERGE_PROCESS_DOC, MergeProcessText, MergeRun, ReferenceMergeRun, } from './merge-process-doc';
|
|
24
24
|
export { BUILD_LOG_DOC } from './build-log-doc';
|
|
25
|
-
export { validateWebpiecesConfig, validatePrGateSection, validateChecklistsSection,
|
|
25
|
+
export { validateWebpiecesConfig, validatePrGateSection, validateChecklistsSection, validateExcludePaths, validateMatchRulesSection, allRuleNames, recommendedSeedMode, recommendedSeedModeFor, seedEntryForRule, } from './validate-config';
|
|
26
26
|
export { validateCommandsSection } from './commands-section-validators';
|
|
27
27
|
export { unknownKeyErrors, isCommentKey, validateTopLevelKeys, COMMENT_KEY_SUFFIX, } from './config-key-rules';
|
|
28
28
|
export { RETIRED_CONFIG_KEYS, RETIRED_SCOPE_KEY, RETIRED_SCOPE_RULE, isRetiredKey, retiredEntry, retiredKeyError, retiredKeyErrorsIn, retiredRuleFor, } from './retired-config-keys';
|
|
@@ -36,12 +36,12 @@ export { OrphanDirSweeper, OrphanSweepReport } from './orphan-dir-sweep';
|
|
|
36
36
|
export { MatchRuleConfig, MatchRuleViolation, findMatchRuleViolations, isMatchRuleAllowedPath, compileMatchRulePatterns, renderMatchRuleMessage, DEFAULT_MATCH_RULES, } from './match-rules-config';
|
|
37
37
|
export type { ConfigSection } from './sections';
|
|
38
38
|
export { schemaFieldNames } from './rule-schemas';
|
|
39
|
-
export { isHookGuard, sectionForRule
|
|
39
|
+
export { isHookGuard, sectionForRule } from './sections';
|
|
40
40
|
export { shouldSkipRule, HOTFIX_BUILD_COMMAND, HOTFIX_AUDIT_BANNER } from './skip-rule';
|
|
41
41
|
export { SkipRuleResult } from './skip-rule';
|
|
42
42
|
export { detectBase, resolveBase, getChangedFiles, getFileDiff, getChangedLineNumbers, findNewMethodSignaturesInDiff, hasChangesInRange, isNewOrModified, DiffScope, DiffRange, ChangedFilesOptions, } from './diff-scope';
|
|
43
43
|
export { AbstractRule } from './abstract-rule';
|
|
44
|
-
export { WEBPIECES_DISABLE, hasDisable, MERGE_INFO_DIR, MERGE_IN_PROGRESS_FILE, MERGE_EXPLANATION_FILE, PUSH_DEV_STATE_FILE, PRUNE_UNKNOWN_COMMAND, UPGRADE_SHIM_COMMAND } from './constants';
|
|
44
|
+
export { WEBPIECES_DISABLE, hasDisable, MERGE_INFO_DIR, MERGE_IN_PROGRESS_FILE, MERGE_EXPLANATION_FILE, PUSH_DEV_STATE_FILE, PRUNE_UNKNOWN_COMMAND, UPGRADE_SHIM_COMMAND, } from './constants';
|
|
45
45
|
export { WebpiecesRulesConfig } from './WebpiecesRulesConfig';
|
|
46
46
|
export { SyncFlowGuidance, WP_START_UPDATE, WP_FINISH_UPDATE, WP_START_UPSERT_PR, WP_FINISH_UPSERT_PR, WP_PUSH_DEV, WP_FINISH_PUSH_DEV, } from './sync-flow-guidance';
|
|
47
47
|
export { GateDefinition, PrGateConfig, DEFAULT_BUILD_COMMAND, LandPrConfig, DevDeployConfig, DEFAULT_DEV_BRANCH_NAMESPACE, DEFAULT_DEV_BRANCH, ReviewContextEntry, defaultGates, defaultPrGateConfig, defaultLandPrConfig, defaultDevDeployConfig, buildPrGateConfig, buildLandPrConfig, buildDevDeployConfig, MERGE_MODE_AUTO, MERGE_MODE_NONE, MERGE_MODES, } from './pr-gate-config';
|
|
@@ -57,8 +57,15 @@ export { PrSummary, PrContext, ChecklistResult, ChecklistVerdict, ChecklistOverr
|
|
|
57
57
|
export { CommandsConfig, buildCommandsConfig, DEFAULT_UPSERT_PR_COMMAND, DEFAULT_MERGE_COMPLETE_COMMAND, } from './commands-config';
|
|
58
58
|
export { StaleBinRemoval, StaleBinSweeper, staleBinSweeper } from './stale-bin-sweep';
|
|
59
59
|
export { RepoScratchDirs, SCRATCH_DIR_NAME } from './repo-scratch-dirs';
|
|
60
|
-
export { TmpScratchSweeper, TMP_SCRATCH_RETENTION_DAYS, TMP_SCRATCH_PREFIX } from './tmp-scratch-sweep';
|
|
60
|
+
export { TmpScratchSweeper, TMP_SCRATCH_RETENTION_DAYS, TMP_SCRATCH_PREFIX, } from './tmp-scratch-sweep';
|
|
61
61
|
export * from './hook-fault-codes';
|
|
62
62
|
export * from './hook-config-diagnostics';
|
|
63
|
-
export { RulePackRegistry, NodeRulePackModuleLoader, RulePackDiscovery, RulePackModuleLoader } from './rule-pack-registry';
|
|
64
|
-
export {
|
|
63
|
+
export { RulePackRegistry, NodeRulePackModuleLoader, RulePackDiscovery, RulePackModuleLoader, } from './rule-pack-registry';
|
|
64
|
+
export { prepareLegacyUpgrade, LegacyConfigDocument, LegacyUpgradeResult, } from './legacy-config-upgrade';
|
|
65
|
+
export { PackPolicyDeclaration, SelectedPolicyPack, PackPolicyFilesResult, PackPolicyFiles, } from './pack-policy-files';
|
|
66
|
+
export { RulePackSync, RulePackSyncOptions } from './rule-pack-sync';
|
|
67
|
+
export { ConfigRepairAccess } from './config-repair-access';
|
|
68
|
+
export { ConfigRepairBootstrap } from './config-repair-probe';
|
|
69
|
+
export { RulePackArtifacts, RuleArtifactContents, RULE_LOCK_FILE, RULE_CATALOG_FILE, } from './rule-pack-artifacts';
|
|
70
|
+
export { RuleRuntimeModules, RuleRuntimeModuleLoader, NodeRuleRuntimeModuleLoader, RuntimeContributionGroup, } from './rule-runtime-modules';
|
|
71
|
+
export { FirstPathMatch, FirstPathMatchResult, PathMatchCandidate } from './first-path-match';
|