@webpieces/rules-config 0.4.846 → 0.4.848
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
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackPolicyFiles = exports.PackPolicyFilesResult = exports.SelectedPolicyPack = exports.PackPolicyDeclaration = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const inversify_1 = require("inversify");
|
|
6
|
+
const fs = tslib_1.__importStar(require("node:fs"));
|
|
7
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
8
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
9
|
+
const to_error_1 = require("@webpieces/tooling-common/to-error");
|
|
10
|
+
const rule_pack_registry_1 = require("./rule-pack-registry");
|
|
11
|
+
const repository_path_1 = require("./repository-path");
|
|
12
|
+
const retired_config_keys_1 = require("./retired-config-keys");
|
|
13
|
+
const config_error_banner_1 = require("./config-error-banner");
|
|
14
|
+
/** The root declaration identifies an exact package/module and its owner-specific config file. */
|
|
15
|
+
class PackPolicyDeclaration {
|
|
16
|
+
config;
|
|
17
|
+
package;
|
|
18
|
+
constructor(packageName, config) {
|
|
19
|
+
this.config = config;
|
|
20
|
+
this.package = packageName;
|
|
21
|
+
}
|
|
22
|
+
moduleName() {
|
|
23
|
+
return /\.(?:cjs|mjs|js)$/.test(this.package) ? this.package : `${this.package}/rule-pack`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.PackPolicyDeclaration = PackPolicyDeclaration;
|
|
27
|
+
class SelectedPolicyPack {
|
|
28
|
+
declaration;
|
|
29
|
+
manifest;
|
|
30
|
+
constructor(declaration, manifest) {
|
|
31
|
+
this.declaration = declaration;
|
|
32
|
+
this.manifest = manifest;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.SelectedPolicyPack = SelectedPolicyPack;
|
|
36
|
+
class PackPolicyFilesResult {
|
|
37
|
+
registry;
|
|
38
|
+
selected;
|
|
39
|
+
values;
|
|
40
|
+
targetFiles;
|
|
41
|
+
constructor(registry, selected, values, targetFiles) {
|
|
42
|
+
this.registry = registry;
|
|
43
|
+
this.selected = selected;
|
|
44
|
+
this.values = values;
|
|
45
|
+
this.targetFiles = targetFiles;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.PackPolicyFilesResult = PackPolicyFilesResult;
|
|
49
|
+
/** Configuration belongs to explicitly selected owners; loading never supplies recommended seeds. */
|
|
50
|
+
let PackPolicyFiles = class PackPolicyFiles {
|
|
51
|
+
// webpieces-disable no-any-unknown -- root JSON is narrowed before resolving modules or files.
|
|
52
|
+
declarations(raw, root) {
|
|
53
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
54
|
+
throw new tooling_common_1.InformAiError('webpieces.config.json.rulePacks is required. Run pnpm wp-rules-sync --upgrade to split the existing explicit config, or add exact {"package":"<pack>","config":".webpieces/rules/<pack>.json"} declarations.');
|
|
55
|
+
}
|
|
56
|
+
const packages = new Set(), files = new Set();
|
|
57
|
+
// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution
|
|
58
|
+
return raw.map((entry) => {
|
|
59
|
+
if (!entry ||
|
|
60
|
+
typeof entry !== 'object' ||
|
|
61
|
+
Array.isArray(entry) ||
|
|
62
|
+
!('package' in entry) ||
|
|
63
|
+
!('config' in entry) ||
|
|
64
|
+
typeof entry.package !== 'string' ||
|
|
65
|
+
!entry.package ||
|
|
66
|
+
typeof entry.config !== 'string' ||
|
|
67
|
+
!entry.config ||
|
|
68
|
+
Object.keys(entry).some((key) => !['package', 'config'].includes(key))) {
|
|
69
|
+
throw new tooling_common_1.InformAiError('Invalid rulePacks entry in webpieces.config.json. Supply exactly package and config strings.');
|
|
70
|
+
}
|
|
71
|
+
const filename = this.configPath(root, entry.config);
|
|
72
|
+
if (packages.has(entry.package) || files.has(filename)) {
|
|
73
|
+
throw new tooling_common_1.InformAiError(`Duplicate rule-pack declaration or config path: ${entry.package}, ${entry.config}. Declare each pack and config once.`);
|
|
74
|
+
}
|
|
75
|
+
packages.add(entry.package);
|
|
76
|
+
files.add(filename);
|
|
77
|
+
return new PackPolicyDeclaration(entry.package, entry.config);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
select(root, declarations) {
|
|
81
|
+
const loader = new rule_pack_registry_1.NodeRulePackModuleLoader(root);
|
|
82
|
+
// eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- module failures identify the declaration's actual repair file.
|
|
83
|
+
try {
|
|
84
|
+
return declarations.map((declaration) => {
|
|
85
|
+
const manifest = loader.load(declaration.moduleName());
|
|
86
|
+
if (declaration.moduleName() === `${declaration.package}/rule-pack` &&
|
|
87
|
+
manifest.packageName !== declaration.package) {
|
|
88
|
+
throw new tooling_common_1.InformAiError(`Declared package ${declaration.package} exports owner ${manifest.packageName}. Declare the actual owning package or an explicit client manifest module.`);
|
|
89
|
+
}
|
|
90
|
+
return new SelectedPolicyPack(declaration, manifest);
|
|
91
|
+
});
|
|
92
|
+
// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
const error = (0, to_error_1.toError)(err);
|
|
96
|
+
throw new tooling_common_1.InformAiError(`Rule-pack selection in ${path.join(root, 'webpieces.config.json')} needs repair: ${error.message}`, { cause: error });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
resolve(root, selected) {
|
|
100
|
+
const registry = new rule_pack_registry_1.RulePackRegistry(selected.map((pack) => pack.manifest));
|
|
101
|
+
for (const pack of selected)
|
|
102
|
+
registry.recordModuleLocation(pack.manifest.packageName, pack.declaration.moduleName());
|
|
103
|
+
const values = {}, targetFiles = new Map();
|
|
104
|
+
const errors = [];
|
|
105
|
+
for (const pack of selected) {
|
|
106
|
+
const filename = this.configPath(root, pack.declaration.config);
|
|
107
|
+
for (const definition of pack.manifest.ownedRules)
|
|
108
|
+
targetFiles.set(definition.id, filename);
|
|
109
|
+
}
|
|
110
|
+
for (const pack of selected) {
|
|
111
|
+
const filename = this.configPath(root, pack.declaration.config);
|
|
112
|
+
const entries = this.read(filename);
|
|
113
|
+
for (const id of Object.keys(entries)) {
|
|
114
|
+
if (!registry.hasRule(id)) {
|
|
115
|
+
const retired = registry
|
|
116
|
+
.migrations()
|
|
117
|
+
.find((entry) => entry.scope === retired_config_keys_1.RETIRED_SCOPE_RULE && entry.key === id);
|
|
118
|
+
errors.push(`${filename}: ${retired ? (0, retired_config_keys_1.retiredKeyError)(retired) : `${id} has no declared configurable owner. Remove this entry.`}`);
|
|
119
|
+
}
|
|
120
|
+
else if (registry.ownerOf(id) !== pack.manifest.packageName) {
|
|
121
|
+
errors.push(`${filename}: ${id} belongs to ${registry.ownerOf(id)}. Move it to ${targetFiles.get(id)}.`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
for (const definition of pack.manifest.ownedRules) {
|
|
125
|
+
if (!Object.hasOwn(entries, definition.id)) {
|
|
126
|
+
errors.push(`${filename}: missing required entry ${definition.id}. Run pnpm wp-rules-sync to write its owner seed and review it, or configure it explicitly; OFF still requires every required field.`);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const value = entries[definition.id];
|
|
130
|
+
errors.push(...registry
|
|
131
|
+
.validateRuleConfig(definition.id, value)
|
|
132
|
+
.map((error) => `${filename}: ${error}`));
|
|
133
|
+
values[definition.id] = value;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (errors.length) {
|
|
137
|
+
throw new tooling_common_1.InformAiError((0, config_error_banner_1.formatConfigErrorsBanner)(errors).replace('THE FIX: edit webpieces.config.json', 'THE FIX: edit declared owner config files') +
|
|
138
|
+
'\nEditing webpieces.config.json and the named owner files is ALWAYS allowed. Missing required settings can be written explicitly with pnpm wp-rules-sync; review and commit the diff. Required settings are never supplied during loading.');
|
|
139
|
+
}
|
|
140
|
+
return new PackPolicyFilesResult(registry, selected, values, targetFiles);
|
|
141
|
+
}
|
|
142
|
+
configPath(root, relative) {
|
|
143
|
+
if (path.isAbsolute(relative) || !relative.endsWith('.json')) {
|
|
144
|
+
throw new tooling_common_1.InformAiError(`Invalid pack config path ${relative}. Use a distinct repository-relative JSON file.`);
|
|
145
|
+
}
|
|
146
|
+
let target;
|
|
147
|
+
// eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- path faults name the declaration that needs repair
|
|
148
|
+
try {
|
|
149
|
+
target = new repository_path_1.RepositoryPath(root).resolve(relative);
|
|
150
|
+
// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
const error = (0, to_error_1.toError)(err);
|
|
154
|
+
throw new tooling_common_1.InformAiError(`Invalid pack config path ${relative}: ${error.message}`, {
|
|
155
|
+
cause: error,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
const normalized = path.relative(fs.realpathSync(root), target);
|
|
159
|
+
if (path.isAbsolute(relative) ||
|
|
160
|
+
normalized.startsWith('..') ||
|
|
161
|
+
!normalized.endsWith('.json') ||
|
|
162
|
+
normalized === 'webpieces.config.json' ||
|
|
163
|
+
normalized === '.webpieces/rules.lock.json') {
|
|
164
|
+
throw new tooling_common_1.InformAiError(`Invalid pack config path ${relative}. Use a distinct repository-relative JSON path such as .webpieces/rules/code.json.`);
|
|
165
|
+
}
|
|
166
|
+
return target;
|
|
167
|
+
}
|
|
168
|
+
read(filename) {
|
|
169
|
+
// eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- malformed or absent pack files name their exact repair path.
|
|
170
|
+
try {
|
|
171
|
+
if (!fs.existsSync(filename)) {
|
|
172
|
+
throw new tooling_common_1.InformAiError(`Missing rule-pack config ${filename}. Run pnpm wp-rules-sync to create explicit owner seeds, then review the diff.`);
|
|
173
|
+
}
|
|
174
|
+
// webpieces-disable no-any-unknown -- registry validation narrows the parsed option bags.
|
|
175
|
+
const entries = JSON.parse(fs.readFileSync(filename, 'utf8'));
|
|
176
|
+
if (!entries || typeof entries !== 'object' || Array.isArray(entries)) {
|
|
177
|
+
throw new tooling_common_1.InformAiError(`${filename} must be an object mapping owned rule IDs to explicit config objects.`);
|
|
178
|
+
}
|
|
179
|
+
return entries;
|
|
180
|
+
// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
const error = (0, to_error_1.toError)(err);
|
|
184
|
+
if (error instanceof tooling_common_1.InformAiError)
|
|
185
|
+
throw error;
|
|
186
|
+
throw new tooling_common_1.InformAiError(`Cannot parse rule-pack config ${filename}: ${error.message}. Edit this file to restore valid JSON.`, { cause: error });
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
exports.PackPolicyFiles = PackPolicyFiles;
|
|
191
|
+
exports.PackPolicyFiles = PackPolicyFiles = tslib_1.__decorate([
|
|
192
|
+
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton)
|
|
193
|
+
], PackPolicyFiles);
|
|
194
|
+
//# sourceMappingURL=pack-policy-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-policy-files.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/pack-policy-files.ts"],"names":[],"mappings":";;;;AAAA,yCAA2D;AAC3D,oDAA8B;AAC9B,wDAAkC;AAElC,8DAA0D;AAC1D,iEAA6D;AAC7D,6DAAkF;AAClF,uDAAmD;AACnD,+DAA4E;AAC5E,+DAAiE;AAEjE,kGAAkG;AAClG,MAAa,qBAAqB;IAKjB;IAJJ,OAAO,CAAS;IAEzB,YACI,WAAmB,EACV,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAEvB,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;IAC/B,CAAC;IAED,UAAU;QACN,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,YAAY,CAAC;IAC/F,CAAC;CACJ;AAbD,sDAaC;AAED,MAAa,kBAAkB;IAEd;IACA;IAFb,YACa,WAAkC,EAClC,QAA0B;QAD1B,gBAAW,GAAX,WAAW,CAAuB;QAClC,aAAQ,GAAR,QAAQ,CAAkB;IACpC,CAAC;CACP;AALD,gDAKC;AAED,MAAa,qBAAqB;IAEjB;IACA;IACA;IACA;IAJb,YACa,QAA0B,EAC1B,QAAuC,EACvC,MAAoC,EACpC,WAAwC;QAHxC,aAAQ,GAAR,QAAQ,CAAkB;QAC1B,aAAQ,GAAR,QAAQ,CAA+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AAK,uBAAuB;YACtC,UAAU,KAAK,4BAA4B,EAC7C,CAAC;YACC,MAAM,IAAI,8BAAa,CACnB,4BAA4B,QAAQ,oFAAoF,CAC3H,CAAC;QACN,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,QAAgB;QACjB,8HAA8H;QAC9H,IAAI,CAAC;YACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,8BAAa,CACnB,4BAA4B,QAAQ,gFAAgF,CACvH,CAAC;YACN,CAAC;YACD,0FAA0F;YAC1F,MAAM,OAAO,GAAY,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;YACvE,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBACpE,MAAM,IAAI,8BAAa,CACnB,GAAG,QAAQ,uEAAuE,CACrF,CAAC;YACN,CAAC;YACD,OAAO,OAAuC,CAAC;YACnD,6GAA6G;QAC7G,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,KAAK,YAAY,8BAAa;gBAAE,MAAM,KAAK,CAAC;YAChD,MAAM,IAAI,8BAAa,CACnB,iCAAiC,QAAQ,KAAK,KAAK,CAAC,OAAO,yCAAyC,EACpG,EAAE,KAAK,EAAE,KAAK,EAAE,CACnB,CAAC;QACN,CAAC;IACL,CAAC;CACJ,CAAA;AA1LY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,eAAe,CA0L3B","sourcesContent":["import { injectable, bindingScopeValues } from 'inversify';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { RulePackManifest, ConfigObject, RetiredConfigKey } from '@webpieces/rules-sdk';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { toError } from '@webpieces/tooling-common/to-error';\nimport { NodeRulePackModuleLoader, RulePackRegistry } from './rule-pack-registry';\nimport { RepositoryPath } from './repository-path';\nimport { retiredKeyError, RETIRED_SCOPE_RULE } from './retired-config-keys';\nimport { formatConfigErrorsBanner } from './config-error-banner';\n\n/** The root declaration identifies an exact package/module and its owner-specific config file. */\nexport class PackPolicyDeclaration {\n readonly package: string;\n\n constructor(\n packageName: string,\n readonly config: string,\n ) {\n this.package = packageName;\n }\n\n moduleName(): string {\n return /\\.(?:cjs|mjs|js)$/.test(this.package) ? this.package : `${this.package}/rule-pack`;\n }\n}\n\nexport class SelectedPolicyPack {\n constructor(\n readonly declaration: PackPolicyDeclaration,\n readonly manifest: RulePackManifest,\n ) {}\n}\n\nexport class PackPolicyFilesResult {\n constructor(\n readonly registry: RulePackRegistry,\n readonly selected: readonly SelectedPolicyPack[],\n readonly values: Record<string, ConfigObject>,\n readonly targetFiles: ReadonlyMap<string, string>,\n ) {}\n}\n\n/** Configuration belongs to explicitly selected owners; loading never supplies recommended seeds. */\n@injectable(bindingScopeValues.Singleton)\nexport class PackPolicyFiles {\n // webpieces-disable no-any-unknown -- root JSON is narrowed before resolving modules or files.\n declarations(raw: unknown, root: string): PackPolicyDeclaration[] {\n if (!Array.isArray(raw) || raw.length === 0) {\n throw new InformAiError(\n 'webpieces.config.json.rulePacks is required. Run pnpm wp-rules-sync --upgrade to split the existing explicit config, or add exact {\"package\":\"<pack>\",\"config\":\".webpieces/rules/<pack>.json\"} declarations.',\n );\n }\n const packages = new Set<string>(),\n files = new Set<string>();\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n return raw.map((entry: unknown) => {\n if (\n !entry ||\n typeof entry !== 'object' ||\n Array.isArray(entry) ||\n !('package' in entry) ||\n !('config' in entry) ||\n typeof entry.package !== 'string' ||\n !entry.package ||\n typeof entry.config !== 'string' ||\n !entry.config ||\n Object.keys(entry).some((key: string) => !['package', 'config'].includes(key))\n ) {\n throw new InformAiError(\n 'Invalid rulePacks entry in webpieces.config.json. Supply exactly package and config strings.',\n );\n }\n const filename = this.configPath(root, entry.config);\n if (packages.has(entry.package) || files.has(filename)) {\n throw new InformAiError(\n `Duplicate rule-pack declaration or config path: ${entry.package}, ${entry.config}. Declare each pack and config once.`,\n );\n }\n packages.add(entry.package);\n files.add(filename);\n return new PackPolicyDeclaration(entry.package, entry.config);\n });\n }\n\n select(root: string, declarations: readonly PackPolicyDeclaration[]): SelectedPolicyPack[] {\n const loader = new NodeRulePackModuleLoader(root);\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- module failures identify the declaration's actual repair file.\n try {\n return declarations.map((declaration: PackPolicyDeclaration) => {\n const manifest = loader.load(declaration.moduleName());\n if (\n declaration.moduleName() === `${declaration.package}/rule-pack` &&\n manifest.packageName !== declaration.package\n ) {\n throw new InformAiError(\n `Declared package ${declaration.package} exports owner ${manifest.packageName}. Declare the actual owning package or an explicit client manifest module.`,\n );\n }\n return new SelectedPolicyPack(declaration, manifest);\n });\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 `Rule-pack selection in ${path.join(root, 'webpieces.config.json')} needs repair: ${error.message}`,\n { cause: error },\n );\n }\n }\n\n resolve(root: string, selected: readonly SelectedPolicyPack[]): PackPolicyFilesResult {\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 const values: Record<string, ConfigObject> = {},\n targetFiles = new Map<string, string>();\n const errors: string[] = [];\n for (const pack of selected) {\n const filename = this.configPath(root, pack.declaration.config);\n for (const definition of pack.manifest.ownedRules)\n targetFiles.set(definition.id, filename);\n }\n for (const pack of selected) {\n const filename = this.configPath(root, pack.declaration.config);\n const entries = this.read(filename);\n for (const id of Object.keys(entries)) {\n if (!registry.hasRule(id)) {\n const retired = registry\n .migrations()\n .find(\n (entry: RetiredConfigKey) =>\n entry.scope === RETIRED_SCOPE_RULE && entry.key === id,\n );\n errors.push(\n `${filename}: ${retired ? retiredKeyError(retired) : `${id} has no declared configurable owner. Remove this entry.`}`,\n );\n } else if (registry.ownerOf(id) !== pack.manifest.packageName) {\n errors.push(\n `${filename}: ${id} belongs to ${registry.ownerOf(id)}. Move it to ${targetFiles.get(id)}.`,\n );\n }\n }\n for (const definition of pack.manifest.ownedRules) {\n if (!Object.hasOwn(entries, definition.id)) {\n errors.push(\n `${filename}: missing required entry ${definition.id}. Run pnpm wp-rules-sync to write its owner seed and review it, or configure it explicitly; OFF still requires every required field.`,\n );\n continue;\n }\n const value = entries[definition.id];\n errors.push(\n ...registry\n .validateRuleConfig(definition.id, value)\n .map((error: string) => `${filename}: ${error}`),\n );\n values[definition.id] = value;\n }\n }\n if (errors.length) {\n throw new InformAiError(\n formatConfigErrorsBanner(errors).replace(\n 'THE FIX: edit webpieces.config.json',\n 'THE FIX: edit declared owner config files',\n ) +\n '\\nEditing webpieces.config.json and the named owner files is ALWAYS allowed. Missing required settings can be written explicitly with pnpm wp-rules-sync; review and commit the diff. Required settings are never supplied during loading.',\n );\n }\n return new PackPolicyFilesResult(registry, selected, values, targetFiles);\n }\n\n configPath(root: string, relative: string): string {\n if (path.isAbsolute(relative) || !relative.endsWith('.json')) {\n throw new InformAiError(\n `Invalid pack config path ${relative}. Use a distinct repository-relative JSON file.`,\n );\n }\n let target: string;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- path faults name the declaration that needs repair\n try {\n target = new RepositoryPath(root).resolve(relative);\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(`Invalid pack config path ${relative}: ${error.message}`, {\n cause: error,\n });\n }\n const normalized = path.relative(fs.realpathSync(root), target);\n if (\n path.isAbsolute(relative) ||\n normalized.startsWith('..') ||\n !normalized.endsWith('.json') ||\n normalized === 'webpieces.config.json' ||\n normalized === '.webpieces/rules.lock.json'\n ) {\n throw new InformAiError(\n `Invalid pack config path ${relative}. Use a distinct repository-relative JSON path such as .webpieces/rules/code.json.`,\n );\n }\n return target;\n }\n\n read(filename: string): Record<string, ConfigObject> {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- malformed or absent pack files name their exact repair path.\n try {\n if (!fs.existsSync(filename)) {\n throw new InformAiError(\n `Missing rule-pack config ${filename}. Run pnpm wp-rules-sync to create explicit owner seeds, then review the diff.`,\n );\n }\n // webpieces-disable no-any-unknown -- registry validation narrows the parsed option bags.\n const entries: unknown = JSON.parse(fs.readFileSync(filename, 'utf8'));\n if (!entries || typeof entries !== 'object' || Array.isArray(entries)) {\n throw new InformAiError(\n `${filename} must be an object mapping owned rule IDs to explicit config objects.`,\n );\n }\n return entries as Record<string, ConfigObject>;\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 if (error instanceof InformAiError) throw error;\n throw new InformAiError(\n `Cannot parse rule-pack config ${filename}: ${error.message}. Edit this file to restore valid JSON.`,\n { cause: error },\n );\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const MAX_TURN_OFF_EPOCH_DAYS = 7;
|
|
2
|
+
/** Generic consumer-field constraints are shared by owner files and client-authored match rules. */
|
|
3
|
+
export declare class PolicyFieldConstraints {
|
|
4
|
+
epochError(label: string, value: number): string | null;
|
|
5
|
+
private readonly renamedFields;
|
|
6
|
+
retiredFields(): readonly string[];
|
|
7
|
+
renamedField(key: string): string | undefined;
|
|
8
|
+
isRationale(key: string): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicyFieldConstraints = exports.MAX_TURN_OFF_EPOCH_DAYS = void 0;
|
|
4
|
+
exports.MAX_TURN_OFF_EPOCH_DAYS = 7;
|
|
5
|
+
/** Generic consumer-field constraints are shared by owner files and client-authored match rules. */
|
|
6
|
+
class PolicyFieldConstraints {
|
|
7
|
+
epochError(label, value) {
|
|
8
|
+
const maxEpoch = Math.floor(Date.now() / 1000) + exports.MAX_TURN_OFF_EPOCH_DAYS * 24 * 60 * 60;
|
|
9
|
+
if (value <= maxEpoch)
|
|
10
|
+
return null;
|
|
11
|
+
const daysOut = Math.round((value - Date.now() / 1000) / (24 * 60 * 60));
|
|
12
|
+
const maxDate = new Date(maxEpoch * 1000).toISOString().split('T')[0];
|
|
13
|
+
return (`${label} "turnOffRuleUntilEpoch": ${value} is ${daysOut} days in the future — the maximum is ` +
|
|
14
|
+
`${exports.MAX_TURN_OFF_EPOCH_DAYS} days. A rule switched off for longer than that is off for work nobody ` +
|
|
15
|
+
`had in mind when it was written, because this hatch is REPO-WIDE while it lasts.\n` +
|
|
16
|
+
` CURE: set it to at most ${maxEpoch} (${maxDate}), then re-set it WEEKLY for as long as you ` +
|
|
17
|
+
`still need it — that renewal is the intended workflow, not a workaround. If the rule is off for ` +
|
|
18
|
+
`ONE branch's work, use "turnOffRuleWhileOnBranch": "<exact branch name>" instead; that one has no cap.`);
|
|
19
|
+
}
|
|
20
|
+
renamedFields = {
|
|
21
|
+
ignoreModifiedUntilEpoch: 'turnOffRuleUntilEpoch',
|
|
22
|
+
ignoreRuleWhileOnBranch: 'turnOffRuleWhileOnBranch',
|
|
23
|
+
};
|
|
24
|
+
retiredFields() { return Object.keys(this.renamedFields); }
|
|
25
|
+
renamedField(key) { return this.renamedFields[key]; }
|
|
26
|
+
isRationale(key) {
|
|
27
|
+
return key.length > 3 && key.endsWith('Why');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.PolicyFieldConstraints = PolicyFieldConstraints;
|
|
31
|
+
//# sourceMappingURL=policy-field-constraints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-field-constraints.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/policy-field-constraints.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,CAAC,CAAC;AAEzC,oGAAoG;AACpG,MAAa,sBAAsB;IAC/B,UAAU,CAAC,KAAa,EAAE,KAAa;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,+BAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;QACxF,IAAI,KAAK,IAAI,QAAQ;YAAE,OAAO,IAAI,CAAC;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACzE,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACtE,OAAO,CACH,GAAG,KAAK,6BAA6B,KAAK,OAAO,OAAO,uCAAuC;YAC/F,GAAG,+BAAuB,yEAAyE;YACnG,oFAAoF;YACpF,6BAA6B,QAAQ,KAAK,OAAO,8CAA8C;YAC/F,kGAAkG;YAClG,wGAAwG,CAC3G,CAAC;IACN,CAAC;IAEgB,aAAa,GAAqC;QAC/D,wBAAwB,EAAE,uBAAuB;QACjD,uBAAuB,EAAE,0BAA0B;KACtD,CAAC;IAEF,aAAa,KAAwB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAE9E,YAAY,CAAC,GAAW,IAAwB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEjF,WAAW,CAAC,GAAW;QACnB,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACJ;AA5BD,wDA4BC","sourcesContent":["export const MAX_TURN_OFF_EPOCH_DAYS = 7;\n\n/** Generic consumer-field constraints are shared by owner files and client-authored match rules. */\nexport class PolicyFieldConstraints {\n epochError(label: string, value: number): string | null {\n const maxEpoch = Math.floor(Date.now() / 1000) + MAX_TURN_OFF_EPOCH_DAYS * 24 * 60 * 60;\n if (value <= maxEpoch) return null;\n const daysOut = Math.round((value - Date.now() / 1000) / (24 * 60 * 60));\n const maxDate = new Date(maxEpoch * 1000).toISOString().split('T')[0];\n return (\n `${label} \"turnOffRuleUntilEpoch\": ${value} is ${daysOut} days in the future — the maximum is ` +\n `${MAX_TURN_OFF_EPOCH_DAYS} days. A rule switched off for longer than that is off for work nobody ` +\n `had in mind when it was written, because this hatch is REPO-WIDE while it lasts.\\n` +\n ` CURE: set it to at most ${maxEpoch} (${maxDate}), then re-set it WEEKLY for as long as you ` +\n `still need it — that renewal is the intended workflow, not a workaround. If the rule is off for ` +\n `ONE branch's work, use \"turnOffRuleWhileOnBranch\": \"<exact branch name>\" instead; that one has no cap.`\n );\n }\n\n private readonly renamedFields: Readonly<Record<string, string>> = {\n ignoreModifiedUntilEpoch: 'turnOffRuleUntilEpoch',\n ignoreRuleWhileOnBranch: 'turnOffRuleWhileOnBranch',\n };\n\n retiredFields(): readonly string[] { return Object.keys(this.renamedFields); }\n\n renamedField(key: string): string | undefined { return this.renamedFields[key]; }\n\n isRationale(key: string): boolean {\n return key.length > 3 && key.endsWith('Why');\n }\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RepositoryPath = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("node:fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
7
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
8
|
+
const to_error_1 = require("@webpieces/tooling-common/to-error");
|
|
9
|
+
/** Resolve an existing or future repository path through its nearest existing ancestor. */
|
|
10
|
+
class RepositoryPath {
|
|
11
|
+
root;
|
|
12
|
+
constructor(root) {
|
|
13
|
+
this.root = root;
|
|
14
|
+
}
|
|
15
|
+
resolve(relative) {
|
|
16
|
+
// eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- filesystem faults are actionable path repairs at this boundary
|
|
17
|
+
try {
|
|
18
|
+
return this.resolvePath(relative);
|
|
19
|
+
// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
const error = (0, to_error_1.toError)(err);
|
|
23
|
+
if (error instanceof tooling_common_1.InformAiError)
|
|
24
|
+
throw error;
|
|
25
|
+
throw new tooling_common_1.InformAiError(`Cannot resolve repository path ${relative}: ${error.message}. Repair its parent directory or dangling symlink.`, { cause: error });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
resolvePath(relative) {
|
|
29
|
+
if (path.isAbsolute(relative))
|
|
30
|
+
throw new tooling_common_1.InformAiError(`Use a repository-relative path: ${relative}.`);
|
|
31
|
+
const canonicalRoot = fs.realpathSync(this.root);
|
|
32
|
+
const pending = [];
|
|
33
|
+
let ancestor = path.resolve(this.root, relative);
|
|
34
|
+
while (!fs.lstatSync(ancestor, { throwIfNoEntry: false })) {
|
|
35
|
+
pending.unshift(path.basename(ancestor));
|
|
36
|
+
const parent = path.dirname(ancestor);
|
|
37
|
+
if (parent === ancestor)
|
|
38
|
+
throw new tooling_common_1.InformAiError(`Cannot resolve repository path ${relative}. Repair its parent directory.`);
|
|
39
|
+
ancestor = parent;
|
|
40
|
+
}
|
|
41
|
+
const resolved = path.resolve(fs.realpathSync(ancestor), ...pending);
|
|
42
|
+
const within = path.relative(canonicalRoot, resolved);
|
|
43
|
+
if (within === '..' || within.startsWith(`..${path.sep}`) || path.isAbsolute(within)) {
|
|
44
|
+
throw new tooling_common_1.InformAiError(`Path ${relative} resolves outside ${this.root}. Use a file inside this repository and repair any escaping symlink.`);
|
|
45
|
+
}
|
|
46
|
+
return resolved;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.RepositoryPath = RepositoryPath;
|
|
50
|
+
//# sourceMappingURL=repository-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-path.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/repository-path.ts"],"names":[],"mappings":";;;;AAAA,oDAA8B;AAC9B,wDAAkC;AAClC,8DAA0D;AAC1D,iEAA6D;AAE7D,2FAA2F;AAC3F,MAAa,cAAc;IACM;IAA7B,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAE7C,OAAO,CAAC,QAAgB;QACpB,gIAAgI;QAChI,IAAI,CAAC;YACD,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACtC,6GAA6G;QAC7G,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,KAAK,YAAY,8BAAa;gBAAE,MAAM,KAAK,CAAC;YAChD,MAAM,IAAI,8BAAa,CACnB,kCAAkC,QAAQ,KAAK,KAAK,CAAC,OAAO,oDAAoD,EAChH,EAAE,KAAK,EAAE,KAAK,EAAE,CACnB,CAAC;QACN,CAAC;IACL,CAAC;IAEO,WAAW,CAAC,QAAgB;QAChC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YACzB,MAAM,IAAI,8BAAa,CAAC,mCAAmC,QAAQ,GAAG,CAAC,CAAC;QAC5E,MAAM,aAAa,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YACxD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;YACzC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACtC,IAAI,MAAM,KAAK,QAAQ;gBACnB,MAAM,IAAI,8BAAa,CACnB,kCAAkC,QAAQ,gCAAgC,CAC7E,CAAC;YACN,QAAQ,GAAG,MAAM,CAAC;QACtB,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;QACtD,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACnF,MAAM,IAAI,8BAAa,CACnB,QAAQ,QAAQ,qBAAqB,IAAI,CAAC,IAAI,sEAAsE,CACvH,CAAC;QACN,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AA1CD,wCA0CC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { toError } from '@webpieces/tooling-common/to-error';\n\n/** Resolve an existing or future repository path through its nearest existing ancestor. */\nexport class RepositoryPath {\n constructor(private readonly root: string) {}\n\n resolve(relative: string): string {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- filesystem faults are actionable path repairs at this boundary\n try {\n return this.resolvePath(relative);\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 if (error instanceof InformAiError) throw error;\n throw new InformAiError(\n `Cannot resolve repository path ${relative}: ${error.message}. Repair its parent directory or dangling symlink.`,\n { cause: error },\n );\n }\n }\n\n private resolvePath(relative: string): string {\n if (path.isAbsolute(relative))\n throw new InformAiError(`Use a repository-relative path: ${relative}.`);\n const canonicalRoot = fs.realpathSync(this.root);\n const pending: string[] = [];\n let ancestor = path.resolve(this.root, relative);\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 InformAiError(\n `Cannot resolve repository path ${relative}. Repair its parent directory.`,\n );\n ancestor = parent;\n }\n const resolved = path.resolve(fs.realpathSync(ancestor), ...pending);\n const within = path.relative(canonicalRoot, resolved);\n if (within === '..' || within.startsWith(`..${path.sep}`) || path.isAbsolute(within)) {\n throw new InformAiError(\n `Path ${relative} resolves outside ${this.root}. Use a file inside this repository and repair any escaping symlink.`,\n );\n }\n return resolved;\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AtomicFile } from '@webpieces/tooling-common';
|
|
2
|
+
import { PackPolicyFilesResult } from './pack-policy-files';
|
|
3
|
+
export declare const RULE_LOCK_FILE = ".webpieces/rules.lock.json";
|
|
4
|
+
export declare const RULE_CATALOG_FILE = ".webpieces/instruct-ai/rules-catalog.md";
|
|
5
|
+
export declare class RuleArtifactContents {
|
|
6
|
+
readonly lock: string;
|
|
7
|
+
readonly catalog: string;
|
|
8
|
+
constructor(lock: string, catalog: string);
|
|
9
|
+
}
|
|
10
|
+
/** One resolved owner/contributor registry produces both deterministic committed artifacts. */
|
|
11
|
+
export declare class RulePackArtifacts {
|
|
12
|
+
private readonly atomic;
|
|
13
|
+
constructor(atomic: AtomicFile);
|
|
14
|
+
paths(root: string): readonly string[];
|
|
15
|
+
render(resolved: PackPolicyFilesResult): RuleArtifactContents;
|
|
16
|
+
check(root: string, resolved: PackPolicyFilesResult): void;
|
|
17
|
+
write(root: string, resolved: PackPolicyFilesResult): readonly string[];
|
|
18
|
+
private policyRow;
|
|
19
|
+
private cell;
|
|
20
|
+
private digest;
|
|
21
|
+
private stable;
|
|
22
|
+
private canonical;
|
|
23
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RulePackArtifacts = exports.RuleArtifactContents = exports.RULE_CATALOG_FILE = exports.RULE_LOCK_FILE = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const inversify_1 = require("inversify");
|
|
6
|
+
const fs = tslib_1.__importStar(require("node:fs"));
|
|
7
|
+
const repository_path_1 = require("./repository-path");
|
|
8
|
+
const node_crypto_1 = require("node:crypto");
|
|
9
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
10
|
+
exports.RULE_LOCK_FILE = '.webpieces/rules.lock.json';
|
|
11
|
+
exports.RULE_CATALOG_FILE = '.webpieces/instruct-ai/rules-catalog.md';
|
|
12
|
+
class LockedOwnedRule {
|
|
13
|
+
id;
|
|
14
|
+
schemaApiVersion;
|
|
15
|
+
constructor(id, schemaApiVersion) {
|
|
16
|
+
this.id = id;
|
|
17
|
+
this.schemaApiVersion = schemaApiVersion;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
class LockedRulePack {
|
|
21
|
+
manifestDigest;
|
|
22
|
+
package;
|
|
23
|
+
config;
|
|
24
|
+
packageName;
|
|
25
|
+
packageVersion;
|
|
26
|
+
manifestApiVersion;
|
|
27
|
+
ownedRules;
|
|
28
|
+
contributions;
|
|
29
|
+
safeguards;
|
|
30
|
+
constructor(pack, manifestDigest) {
|
|
31
|
+
this.manifestDigest = manifestDigest;
|
|
32
|
+
this.package = pack.declaration.package;
|
|
33
|
+
this.config = pack.declaration.config;
|
|
34
|
+
this.packageName = pack.manifest.packageName;
|
|
35
|
+
this.packageVersion = pack.manifest.packageVersion;
|
|
36
|
+
this.manifestApiVersion = pack.manifest.apiVersion;
|
|
37
|
+
this.ownedRules = pack.manifest.ownedRules.map((definition) => new LockedOwnedRule(definition.id, definition.schemaApiVersion));
|
|
38
|
+
this.contributions = pack.manifest.contributions;
|
|
39
|
+
this.safeguards = pack.manifest.safeguards;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
class RuleLock {
|
|
43
|
+
packs;
|
|
44
|
+
schemaVersion = 1;
|
|
45
|
+
constructor(packs) {
|
|
46
|
+
this.packs = packs;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class RuleArtifactContents {
|
|
50
|
+
lock;
|
|
51
|
+
catalog;
|
|
52
|
+
constructor(lock, catalog) {
|
|
53
|
+
this.lock = lock;
|
|
54
|
+
this.catalog = catalog;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.RuleArtifactContents = RuleArtifactContents;
|
|
58
|
+
/** One resolved owner/contributor registry produces both deterministic committed artifacts. */
|
|
59
|
+
let RulePackArtifacts = class RulePackArtifacts {
|
|
60
|
+
atomic;
|
|
61
|
+
constructor(atomic) {
|
|
62
|
+
this.atomic = atomic;
|
|
63
|
+
}
|
|
64
|
+
paths(root) {
|
|
65
|
+
const repository = new repository_path_1.RepositoryPath(root);
|
|
66
|
+
return [repository.resolve(exports.RULE_LOCK_FILE), repository.resolve(exports.RULE_CATALOG_FILE)];
|
|
67
|
+
}
|
|
68
|
+
render(resolved) {
|
|
69
|
+
const selected = [...resolved.selected].sort((a, b) => a.manifest.packageName < b.manifest.packageName
|
|
70
|
+
? -1
|
|
71
|
+
: a.manifest.packageName > b.manifest.packageName
|
|
72
|
+
? 1
|
|
73
|
+
: 0);
|
|
74
|
+
const locks = selected.map((pack) => new LockedRulePack(pack, this.digest(pack.manifest)));
|
|
75
|
+
const rows = [];
|
|
76
|
+
for (const pack of selected) {
|
|
77
|
+
for (const definition of pack.manifest.ownedRules) {
|
|
78
|
+
rows.push(this.policyRow(pack, definition, resolved.values[definition.id], selected));
|
|
79
|
+
}
|
|
80
|
+
for (const safeguard of pack.manifest.safeguards) {
|
|
81
|
+
rows.push(`| ${this.cell(safeguard.id)} | ${this.cell(pack.manifest.packageName)} | ${safeguard.activation} safeguard | — | ${this.cell(safeguard.description)} | Owner safety invariant |`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const catalog = [
|
|
85
|
+
'# Declared rule catalog',
|
|
86
|
+
'',
|
|
87
|
+
'Generated by `pnpm wp-rules-sync` from the selected installed manifests and explicit owner config files.',
|
|
88
|
+
'Configurable policies require every required setting even when mode is `OFF`. Fixed safeguards have no config switch.',
|
|
89
|
+
'',
|
|
90
|
+
'| Policy | Owner | Status / contributors | Config file | Description | Remediation |',
|
|
91
|
+
'| --- | --- | --- | --- | --- | --- |',
|
|
92
|
+
...rows,
|
|
93
|
+
'',
|
|
94
|
+
].join('\n');
|
|
95
|
+
return new RuleArtifactContents(this.stable(new RuleLock(locks)), catalog);
|
|
96
|
+
}
|
|
97
|
+
check(root, resolved) {
|
|
98
|
+
const contents = this.render(resolved);
|
|
99
|
+
const errors = [];
|
|
100
|
+
for (const artifact of [
|
|
101
|
+
[exports.RULE_LOCK_FILE, contents.lock],
|
|
102
|
+
[exports.RULE_CATALOG_FILE, contents.catalog],
|
|
103
|
+
]) {
|
|
104
|
+
const filename = new repository_path_1.RepositoryPath(root).resolve(artifact[0]);
|
|
105
|
+
if (!fs.existsSync(filename))
|
|
106
|
+
errors.push(`Missing ${filename}.`);
|
|
107
|
+
else if (fs.readFileSync(filename, 'utf8') !== artifact[1]) {
|
|
108
|
+
errors.push(`${filename} disagrees with the root declaration, installed manifests, or explicit owner config.`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (errors.length) {
|
|
112
|
+
throw new tooling_common_1.InformAiError(`Rule artifacts need repair:\n${errors.map((error) => `• ${error}`).join('\n')}\nRun pnpm wp-rules-sync, review the generated diff, and commit the lock and catalog.`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
write(root, resolved) {
|
|
116
|
+
const contents = this.render(resolved), changed = [];
|
|
117
|
+
for (const artifact of [
|
|
118
|
+
[exports.RULE_LOCK_FILE, contents.lock],
|
|
119
|
+
[exports.RULE_CATALOG_FILE, contents.catalog],
|
|
120
|
+
]) {
|
|
121
|
+
const filename = new repository_path_1.RepositoryPath(root).resolve(artifact[0]);
|
|
122
|
+
if (this.atomic.writeIfChanged(filename, artifact[1]))
|
|
123
|
+
changed.push(filename);
|
|
124
|
+
}
|
|
125
|
+
return changed;
|
|
126
|
+
}
|
|
127
|
+
policyRow(pack, definition, config, selected) {
|
|
128
|
+
const contributors = selected.flatMap((provider) => provider.manifest.contributions
|
|
129
|
+
.filter((contribution) => contribution.ruleId === definition.id)
|
|
130
|
+
.map((contribution) => `${provider.manifest.packageName}:${contribution.executionKind}`));
|
|
131
|
+
const status = `${String(config['mode'])}; ${contributors.join(', ')}`;
|
|
132
|
+
const remediation = definition.help.remediation.replaceAll('{configFile}', pack.declaration.config);
|
|
133
|
+
return [
|
|
134
|
+
definition.id,
|
|
135
|
+
pack.manifest.packageName,
|
|
136
|
+
status,
|
|
137
|
+
pack.declaration.config,
|
|
138
|
+
definition.help.description,
|
|
139
|
+
remediation,
|
|
140
|
+
]
|
|
141
|
+
.map((text) => this.cell(text))
|
|
142
|
+
.join(' | ')
|
|
143
|
+
.replace(/^/, '| ')
|
|
144
|
+
.concat(' |');
|
|
145
|
+
}
|
|
146
|
+
cell(value) {
|
|
147
|
+
return value.replaceAll('|', '\\|').replaceAll('\n', ' ');
|
|
148
|
+
}
|
|
149
|
+
// webpieces-disable no-any-unknown -- canonical serialization accepts only the manifest's data boundary.
|
|
150
|
+
digest(value) {
|
|
151
|
+
return (0, node_crypto_1.createHash)('sha256').update(this.stable(value)).digest('hex');
|
|
152
|
+
}
|
|
153
|
+
// webpieces-disable no-any-unknown -- JSON keys are sorted recursively; functions must stay in runtime modules.
|
|
154
|
+
stable(value) {
|
|
155
|
+
return JSON.stringify(this.canonical(value), null, 2) + '\n';
|
|
156
|
+
}
|
|
157
|
+
// webpieces-disable no-any-unknown -- recursively narrow arbitrary manifest data before serialization.
|
|
158
|
+
canonical(value) {
|
|
159
|
+
if (value === null || ['string', 'boolean', 'number'].includes(typeof value))
|
|
160
|
+
return value;
|
|
161
|
+
// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution
|
|
162
|
+
if (Array.isArray(value))
|
|
163
|
+
return value.map((entry) => this.canonical(entry));
|
|
164
|
+
if (typeof value !== 'object') {
|
|
165
|
+
throw new tooling_common_1.InformAiError('Rule manifests must contain only serializable data. Keep executable functions in the declared implementation modules.');
|
|
166
|
+
}
|
|
167
|
+
// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution
|
|
168
|
+
const record = value;
|
|
169
|
+
return Object.fromEntries(Object.keys(record)
|
|
170
|
+
.sort()
|
|
171
|
+
.filter((key) => record[key] !== undefined)
|
|
172
|
+
.map((key) => [key, this.canonical(record[key])]));
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
exports.RulePackArtifacts = RulePackArtifacts;
|
|
176
|
+
exports.RulePackArtifacts = RulePackArtifacts = tslib_1.__decorate([
|
|
177
|
+
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
178
|
+
tslib_1.__metadata("design:paramtypes", [tooling_common_1.AtomicFile])
|
|
179
|
+
], RulePackArtifacts);
|
|
180
|
+
//# sourceMappingURL=rule-pack-artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-pack-artifacts.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-pack-artifacts.ts"],"names":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8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEA,2BAAU;GADtC,iBAAiB,CAoJ7B","sourcesContent":["import { injectable, bindingScopeValues } from 'inversify';\nimport * as fs from 'node:fs';\nimport { RepositoryPath } from './repository-path';\nimport { createHash } from 'node:crypto';\nimport {\n ConfigObject,\n OwnedRuleDefinition,\n RuleContribution,\n SafeguardDefinition,\n} from '@webpieces/rules-sdk';\nimport { AtomicFile, InformAiError } from '@webpieces/tooling-common';\nimport { PackPolicyFilesResult, SelectedPolicyPack } from './pack-policy-files';\n\nexport const RULE_LOCK_FILE = '.webpieces/rules.lock.json';\nexport const RULE_CATALOG_FILE = '.webpieces/instruct-ai/rules-catalog.md';\n\nclass LockedOwnedRule {\n constructor(\n readonly id: string,\n readonly schemaApiVersion: number,\n ) {}\n}\n\nclass LockedRulePack {\n readonly package: string;\n readonly config: string;\n readonly packageName: string;\n readonly packageVersion: string;\n readonly manifestApiVersion: number;\n readonly ownedRules: readonly LockedOwnedRule[];\n readonly contributions: readonly RuleContribution[];\n readonly safeguards: readonly SafeguardDefinition[];\n\n constructor(\n pack: SelectedPolicyPack,\n readonly manifestDigest: string,\n ) {\n this.package = pack.declaration.package;\n this.config = pack.declaration.config;\n this.packageName = pack.manifest.packageName;\n this.packageVersion = pack.manifest.packageVersion;\n this.manifestApiVersion = pack.manifest.apiVersion;\n this.ownedRules = pack.manifest.ownedRules.map(\n (definition: OwnedRuleDefinition) =>\n new LockedOwnedRule(definition.id, definition.schemaApiVersion),\n );\n this.contributions = pack.manifest.contributions;\n this.safeguards = pack.manifest.safeguards;\n }\n}\n\nclass RuleLock {\n readonly schemaVersion = 1;\n constructor(readonly packs: readonly LockedRulePack[]) {}\n}\n\nexport class RuleArtifactContents {\n constructor(\n readonly lock: string,\n readonly catalog: string,\n ) {}\n}\n\n/** One resolved owner/contributor registry produces both deterministic committed artifacts. */\n@injectable(bindingScopeValues.Singleton)\nexport class RulePackArtifacts {\n constructor(private readonly atomic: AtomicFile) {}\n\n paths(root: string): readonly string[] {\n const repository = new RepositoryPath(root);\n return [repository.resolve(RULE_LOCK_FILE), repository.resolve(RULE_CATALOG_FILE)];\n }\n\n render(resolved: PackPolicyFilesResult): RuleArtifactContents {\n const selected = [...resolved.selected].sort(\n (a: SelectedPolicyPack, b: SelectedPolicyPack) =>\n a.manifest.packageName < b.manifest.packageName\n ? -1\n : a.manifest.packageName > b.manifest.packageName\n ? 1\n : 0,\n );\n const locks = selected.map(\n (pack: SelectedPolicyPack) => new LockedRulePack(pack, this.digest(pack.manifest)),\n );\n const rows: string[] = [];\n for (const pack of selected) {\n for (const definition of pack.manifest.ownedRules) {\n rows.push(\n this.policyRow(pack, definition, resolved.values[definition.id], selected),\n );\n }\n for (const safeguard of pack.manifest.safeguards) {\n rows.push(\n `| ${this.cell(safeguard.id)} | ${this.cell(pack.manifest.packageName)} | ${safeguard.activation} safeguard | — | ${this.cell(safeguard.description)} | Owner safety invariant |`,\n );\n }\n }\n const catalog = [\n '# Declared rule catalog',\n '',\n 'Generated by `pnpm wp-rules-sync` from the selected installed manifests and explicit owner config files.',\n 'Configurable policies require every required setting even when mode is `OFF`. Fixed safeguards have no config switch.',\n '',\n '| Policy | Owner | Status / contributors | Config file | Description | Remediation |',\n '| --- | --- | --- | --- | --- | --- |',\n ...rows,\n '',\n ].join('\\n');\n return new RuleArtifactContents(this.stable(new RuleLock(locks)), catalog);\n }\n\n check(root: string, resolved: PackPolicyFilesResult): void {\n const contents = this.render(resolved);\n const errors: string[] = [];\n for (const artifact of [\n [RULE_LOCK_FILE, contents.lock],\n [RULE_CATALOG_FILE, contents.catalog],\n ]) {\n const filename = new RepositoryPath(root).resolve(artifact[0]);\n if (!fs.existsSync(filename)) errors.push(`Missing ${filename}.`);\n else if (fs.readFileSync(filename, 'utf8') !== artifact[1]) {\n errors.push(\n `${filename} disagrees with the root declaration, installed manifests, or explicit owner config.`,\n );\n }\n }\n if (errors.length) {\n throw new InformAiError(\n `Rule artifacts need repair:\\n${errors.map((error: string) => `• ${error}`).join('\\n')}\\nRun pnpm wp-rules-sync, review the generated diff, and commit the lock and catalog.`,\n );\n }\n }\n\n write(root: string, resolved: PackPolicyFilesResult): readonly string[] {\n const contents = this.render(resolved),\n changed: string[] = [];\n for (const artifact of [\n [RULE_LOCK_FILE, contents.lock],\n [RULE_CATALOG_FILE, contents.catalog],\n ]) {\n const filename = new RepositoryPath(root).resolve(artifact[0]);\n if (this.atomic.writeIfChanged(filename, artifact[1])) changed.push(filename);\n }\n return changed;\n }\n\n private policyRow(\n pack: SelectedPolicyPack,\n definition: OwnedRuleDefinition,\n config: ConfigObject,\n selected: readonly SelectedPolicyPack[],\n ): string {\n const contributors = selected.flatMap((provider: SelectedPolicyPack) =>\n provider.manifest.contributions\n .filter((contribution: RuleContribution) => contribution.ruleId === definition.id)\n .map(\n (contribution: RuleContribution) =>\n `${provider.manifest.packageName}:${contribution.executionKind}`,\n ),\n );\n const status = `${String(config['mode'])}; ${contributors.join(', ')}`;\n const remediation = definition.help.remediation.replaceAll(\n '{configFile}',\n pack.declaration.config,\n );\n return [\n definition.id,\n pack.manifest.packageName,\n status,\n pack.declaration.config,\n definition.help.description,\n remediation,\n ]\n .map((text: string) => this.cell(text))\n .join(' | ')\n .replace(/^/, '| ')\n .concat(' |');\n }\n\n private cell(value: string): string {\n return value.replaceAll('|', '\\\\|').replaceAll('\\n', ' ');\n }\n\n // webpieces-disable no-any-unknown -- canonical serialization accepts only the manifest's data boundary.\n private digest(value: unknown): string {\n return createHash('sha256').update(this.stable(value)).digest('hex');\n }\n\n // webpieces-disable no-any-unknown -- JSON keys are sorted recursively; functions must stay in runtime modules.\n private stable(value: unknown): string {\n return JSON.stringify(this.canonical(value), null, 2) + '\\n';\n }\n\n // webpieces-disable no-any-unknown -- recursively narrow arbitrary manifest data before serialization.\n private canonical(value: unknown): unknown {\n if (value === null || ['string', 'boolean', 'number'].includes(typeof value)) return value;\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n if (Array.isArray(value)) return value.map((entry: unknown) => this.canonical(entry));\n if (typeof value !== 'object') {\n throw new InformAiError(\n 'Rule manifests must contain only serializable data. Keep executable functions in the declared implementation modules.',\n );\n }\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n const record = value as Record<string, unknown>;\n return Object.fromEntries(\n Object.keys(record)\n .sort()\n .filter((key: string) => record[key] !== undefined)\n .map((key: string) => [key, this.canonical(record[key])]),\n );\n }\n}\n"]}
|
|
@@ -5,18 +5,24 @@ export declare abstract class RulePackModuleLoader {
|
|
|
5
5
|
}
|
|
6
6
|
export declare class NodeRulePackModuleLoader extends RulePackModuleLoader {
|
|
7
7
|
private readonly requireModule;
|
|
8
|
+
private readonly resolution;
|
|
8
9
|
constructor(clientRoot: string);
|
|
9
10
|
load(moduleName: string): RulePackManifest;
|
|
10
11
|
}
|
|
11
12
|
/** A registry depends only on declarations and the SDK, never on concrete execution packages. */
|
|
12
13
|
export declare class RulePackRegistry {
|
|
13
14
|
readonly manifests: readonly RulePackManifest[];
|
|
15
|
+
private readonly modules;
|
|
14
16
|
private readonly owners;
|
|
15
17
|
private readonly definitions;
|
|
16
18
|
private readonly safeguards;
|
|
17
19
|
constructor(manifests: readonly RulePackManifest[]);
|
|
20
|
+
private registerContributions;
|
|
18
21
|
ownerOf(ruleId: string): string;
|
|
19
22
|
schemaFor(ruleId: string): Readonly<Record<string, FieldDef>>;
|
|
23
|
+
/** The transport records the exact client declaration, including local manifest modules. */
|
|
24
|
+
recordModuleLocation(packName: string, moduleName: string): void;
|
|
25
|
+
get manifestModules(): ReadonlyMap<string, string>;
|
|
20
26
|
ruleIds(): readonly string[];
|
|
21
27
|
hasRule(ruleId: string): boolean;
|
|
22
28
|
isSafeguard(ruleId: string): boolean;
|
|
@@ -28,6 +34,7 @@ export declare class RulePackRegistry {
|
|
|
28
34
|
private definitionFor;
|
|
29
35
|
/** Validates explicit config values with the owner's schema; supplies no rule defaults. */
|
|
30
36
|
validateRuleConfig(ruleId: string, value: ConfigObject): readonly string[];
|
|
37
|
+
private validateManifestHeader;
|
|
31
38
|
private validateManifest;
|
|
32
39
|
private validateOwnerSettings;
|
|
33
40
|
private validateSchema;
|