@webpieces/ai-hook-rules 0.4.942 → 0.4.944
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 +6 -6
- package/src/core/rules/catch-must-propagate.d.ts +21 -0
- package/src/core/rules/catch-must-propagate.js +46 -0
- package/src/core/rules/catch-must-propagate.js.map +1 -0
- package/src/core/rules/index.d.ts +1 -0
- package/src/core/rules/index.js +3 -1
- package/src/core/rules/index.js.map +1 -1
- package/src/core/source-analysis.d.ts +20 -0
- package/src/core/source-analysis.js +43 -0
- package/src/core/source-analysis.js.map +1 -0
- package/src/core/source-contribution-config.d.ts +2 -0
- package/src/core/source-contribution-config.js +2 -0
- package/src/core/source-contribution-config.js.map +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +3 -1
- package/src/index.js.map +1 -1
- package/src/source-policy-registry.js +1 -0
- package/src/source-policy-registry.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/ai-hook-rules",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.944",
|
|
4
4
|
"description": "Independent source edit rules and source hook for AI coding agents.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"directory": "packages/tooling/ai-hook-rules"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@webpieces/hook-runtime": "0.4.
|
|
27
|
-
"@webpieces/rules-config": "0.4.
|
|
26
|
+
"@webpieces/hook-runtime": "0.4.944",
|
|
27
|
+
"@webpieces/rules-config": "0.4.944",
|
|
28
28
|
"inversify": "7.10.4",
|
|
29
29
|
"reflect-metadata": "0.2.2",
|
|
30
|
-
"@webpieces/tooling-common": "0.4.
|
|
31
|
-
"@webpieces/rules-sdk": "0.4.
|
|
30
|
+
"@webpieces/tooling-common": "0.4.944",
|
|
31
|
+
"@webpieces/rules-sdk": "0.4.944"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@webpieces/tooling-testkit": "0.4.
|
|
37
|
+
"@webpieces/tooling-testkit": "0.4.944"
|
|
38
38
|
},
|
|
39
39
|
"types": "./src/index.d.ts",
|
|
40
40
|
"bin": {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FileContext } from '@webpieces/hook-runtime';
|
|
2
|
+
import { FileRuleBase, FixHint, Violation } from '@webpieces/hook-runtime';
|
|
3
|
+
import { SourceContributionConfig } from '../source-contribution-config';
|
|
4
|
+
/**
|
|
5
|
+
* `catch-must-propagate` at Write/Edit time (#1313) — the FIRST rule on the shared AST (#1111).
|
|
6
|
+
*
|
|
7
|
+
* It judges the PROPOSED file (the whole post-edit text, projected in memory by ProposedFile and parsed
|
|
8
|
+
* once by SourceAnalysis), with the same `CatchPropagationAnalyzer` the build gate's validator calls, so
|
|
9
|
+
* the guard and `wp-build` reach the same verdict at the same line. Under NEW_AND_MODIFIED_CODE only a
|
|
10
|
+
* catch whose clause spans a line this edit changed is judged; every other non-OFF mode judges the whole
|
|
11
|
+
* proposed file. Test files are not judged (see `CatchPropagationAnalyzer.judges`).
|
|
12
|
+
*/
|
|
13
|
+
export declare class CatchMustPropagateRule extends FileRuleBase<SourceContributionConfig> {
|
|
14
|
+
constructor(config: SourceContributionConfig);
|
|
15
|
+
readonly description = "A caught error must propagate whole: rethrown, thrown as a cause, forwarded, returned or stored \u2014 never replaced by its message.";
|
|
16
|
+
readonly files: string[];
|
|
17
|
+
get fixHint(): FixHint;
|
|
18
|
+
check(ctx: FileContext): readonly Violation[];
|
|
19
|
+
/** Required by the owner schema; the loader refuses a config without it, so its absence is plumbing. */
|
|
20
|
+
private forwards;
|
|
21
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CatchMustPropagateRule = void 0;
|
|
4
|
+
const rules_config_1 = require("@webpieces/rules-config");
|
|
5
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
6
|
+
const catch_propagation_1 = require("@webpieces/tooling-common/catch-propagation");
|
|
7
|
+
const hook_runtime_1 = require("@webpieces/hook-runtime");
|
|
8
|
+
const source_analysis_1 = require("../source-analysis");
|
|
9
|
+
/**
|
|
10
|
+
* `catch-must-propagate` at Write/Edit time (#1313) — the FIRST rule on the shared AST (#1111).
|
|
11
|
+
*
|
|
12
|
+
* It judges the PROPOSED file (the whole post-edit text, projected in memory by ProposedFile and parsed
|
|
13
|
+
* once by SourceAnalysis), with the same `CatchPropagationAnalyzer` the build gate's validator calls, so
|
|
14
|
+
* the guard and `wp-build` reach the same verdict at the same line. Under NEW_AND_MODIFIED_CODE only a
|
|
15
|
+
* catch whose clause spans a line this edit changed is judged; every other non-OFF mode judges the whole
|
|
16
|
+
* proposed file. Test files are not judged (see `CatchPropagationAnalyzer.judges`).
|
|
17
|
+
*/
|
|
18
|
+
class CatchMustPropagateRule extends hook_runtime_1.FileRuleBase {
|
|
19
|
+
constructor(config) { super(config, catch_propagation_1.CATCH_MUST_PROPAGATE, catch_propagation_1.CATCH_MUST_PROPAGATE); }
|
|
20
|
+
description = 'A caught error must propagate whole: rethrown, thrown as a cause, forwarded, returned or stored — never replaced by its message.';
|
|
21
|
+
files = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
|
|
22
|
+
get fixHint() {
|
|
23
|
+
return new hook_runtime_1.FixHint('This catch lets the caught error go, so its stack, type and cause chain are lost for good.', 'Carry the error itself out of the catch — pick one:', catch_propagation_1.CATCH_MUST_PROPAGATE_CURES.map((cure) => new rules_config_1.Option(cure.text, cure.preferred)), new hook_runtime_1.DisableEscape(true, catch_propagation_1.CATCH_MUST_PROPAGATE_DISABLE));
|
|
24
|
+
}
|
|
25
|
+
check(ctx) {
|
|
26
|
+
const analyzer = new catch_propagation_1.CatchPropagationAnalyzer(this.forwards());
|
|
27
|
+
if (!analyzer.judges(ctx.relativePath))
|
|
28
|
+
return [];
|
|
29
|
+
const syntax = source_analysis_1.sourceAnalysis.forFile(ctx);
|
|
30
|
+
const changed = this.config.mode === 'NEW_AND_MODIFIED_CODE' ? syntax.content.changedLines() : undefined;
|
|
31
|
+
const findings = analyzer.analyze(syntax.proposed.source, changed);
|
|
32
|
+
if (findings.length > 0)
|
|
33
|
+
(0, rules_config_1.writeTemplateIfMissing)(ctx.workspaceRoot, 'webpieces.exceptions.md');
|
|
34
|
+
return findings.map((finding) => new hook_runtime_1.Violation(finding.line, finding.snippet, finding.message));
|
|
35
|
+
}
|
|
36
|
+
/** Required by the owner schema; the loader refuses a config without it, so its absence is plumbing. */
|
|
37
|
+
forwards() {
|
|
38
|
+
const forwards = this.config.forwards;
|
|
39
|
+
if (forwards === undefined) {
|
|
40
|
+
throw new tooling_common_1.InformAiError(`${catch_propagation_1.CATCH_MUST_PROPAGATE} has no "forwards" list. Add the required "forwards" array to its config entry.`);
|
|
41
|
+
}
|
|
42
|
+
return forwards;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.CatchMustPropagateRule = CatchMustPropagateRule;
|
|
46
|
+
//# sourceMappingURL=catch-must-propagate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catch-must-propagate.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/ai-hook-rules/src/core/rules/catch-must-propagate.ts"],"names":[],"mappings":";;;AAAA,0DAAyE;AACzE,8DAA0D;AAC1D,mFAOqD;AAErD,0DAA0F;AAE1F,wDAAoD;AAEpD;;;;;;;;GAQG;AACH,MAAa,sBAAuB,SAAQ,2BAAsC;IAC9E,YAAY,MAAgC,IAAI,KAAK,CAAC,MAAM,EAAE,wCAAoB,EAAE,wCAAoB,CAAC,CAAC,CAAC,CAAC;IAEnG,WAAW,GAAG,kIAAkI,CAAC;IACxI,KAAK,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAE1E,IAAI,OAAO;QACP,OAAO,IAAI,sBAAO,CACd,4FAA4F,EAC5F,qDAAqD,EACrD,8CAA0B,CAAC,GAAG,CAAC,CAAC,IAAe,EAAE,EAAE,CAAC,IAAI,qBAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAC1F,IAAI,4BAAa,CAAC,IAAI,EAAE,gDAA4B,CAAC,CACxD,CAAC;IACN,CAAC;IAED,KAAK,CAAC,GAAgB;QAClB,MAAM,QAAQ,GAAG,IAAI,4CAAwB,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC;YAAE,OAAO,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,gCAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,uBAAuB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACzG,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,IAAA,qCAAsB,EAAC,GAAG,CAAC,aAAa,EAAE,yBAAyB,CAAC,CAAC;QAC9F,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAqB,EAAE,EAAE,CAAC,IAAI,wBAAS,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,wGAAwG;IAChG,QAAQ;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACtC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,8BAAa,CAAC,GAAG,wCAAoB,iFAAiF,CAAC,CAAC;QACtI,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAjCD,wDAiCC","sourcesContent":["import { Option, writeTemplateIfMissing } from '@webpieces/rules-config';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport {\n CATCH_MUST_PROPAGATE,\n CATCH_MUST_PROPAGATE_CURES,\n CATCH_MUST_PROPAGATE_DISABLE,\n CatchCure,\n CatchFinding,\n CatchPropagationAnalyzer,\n} from '@webpieces/tooling-common/catch-propagation';\nimport type { FileContext } from '@webpieces/hook-runtime';\nimport { DisableEscape, FileRuleBase, FixHint, Violation } from '@webpieces/hook-runtime';\nimport { SourceContributionConfig } from '../source-contribution-config';\nimport { sourceAnalysis } from '../source-analysis';\n\n/**\n * `catch-must-propagate` at Write/Edit time (#1313) — the FIRST rule on the shared AST (#1111).\n *\n * It judges the PROPOSED file (the whole post-edit text, projected in memory by ProposedFile and parsed\n * once by SourceAnalysis), with the same `CatchPropagationAnalyzer` the build gate's validator calls, so\n * the guard and `wp-build` reach the same verdict at the same line. Under NEW_AND_MODIFIED_CODE only a\n * catch whose clause spans a line this edit changed is judged; every other non-OFF mode judges the whole\n * proposed file. Test files are not judged (see `CatchPropagationAnalyzer.judges`).\n */\nexport class CatchMustPropagateRule extends FileRuleBase<SourceContributionConfig> {\n constructor(config: SourceContributionConfig) { super(config, CATCH_MUST_PROPAGATE, CATCH_MUST_PROPAGATE); }\n\n readonly description = 'A caught error must propagate whole: rethrown, thrown as a cause, forwarded, returned or stored — never replaced by its message.';\n override readonly files = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];\n\n get fixHint(): FixHint {\n return new FixHint(\n 'This catch lets the caught error go, so its stack, type and cause chain are lost for good.',\n 'Carry the error itself out of the catch — pick one:',\n CATCH_MUST_PROPAGATE_CURES.map((cure: CatchCure) => new Option(cure.text, cure.preferred)),\n new DisableEscape(true, CATCH_MUST_PROPAGATE_DISABLE),\n );\n }\n\n check(ctx: FileContext): readonly Violation[] {\n const analyzer = new CatchPropagationAnalyzer(this.forwards());\n if (!analyzer.judges(ctx.relativePath)) return [];\n const syntax = sourceAnalysis.forFile(ctx);\n const changed = this.config.mode === 'NEW_AND_MODIFIED_CODE' ? syntax.content.changedLines() : undefined;\n const findings = analyzer.analyze(syntax.proposed.source, changed);\n if (findings.length > 0) writeTemplateIfMissing(ctx.workspaceRoot, 'webpieces.exceptions.md');\n return findings.map((finding: CatchFinding) => new Violation(finding.line, finding.snippet, finding.message));\n }\n\n /** Required by the owner schema; the loader refuses a config without it, so its absence is plumbing. */\n private forwards(): readonly string[] {\n const forwards = this.config.forwards;\n if (forwards === undefined) {\n throw new InformAiError(`${CATCH_MUST_PROPAGATE} has no \"forwards\" list. Add the required \"forwards\" array to its config entry.`);\n }\n return forwards;\n }\n}\n"]}
|
|
@@ -11,3 +11,4 @@ export { NoSymbolDiTokensRule } from './no-symbol-di-tokens';
|
|
|
11
11
|
export { NoCustomCssRule } from './no-custom-css';
|
|
12
12
|
export { NoProcessExitOutsideMainRule } from './no-process-exit-outside-main';
|
|
13
13
|
export { NoJsFilesRule } from './no-js-files';
|
|
14
|
+
export { CatchMustPropagateRule } from './catch-must-propagate';
|
package/src/core/rules/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoJsFilesRule = exports.NoProcessExitOutsideMainRule = exports.NoCustomCssRule = exports.NoSymbolDiTokensRule = exports.ThrowCauseRequiredRule = exports.CatchErrorPatternRule = exports.NoUnmanagedExceptionsRule = exports.RequireReturnTypeRule = exports.NoDestructureRule = exports.ValidateTsInSrcRule = exports.MaxFileLinesRule = exports.NoImplicitAnyRule = exports.NoAnyUnknownRule = void 0;
|
|
3
|
+
exports.CatchMustPropagateRule = exports.NoJsFilesRule = exports.NoProcessExitOutsideMainRule = exports.NoCustomCssRule = exports.NoSymbolDiTokensRule = exports.ThrowCauseRequiredRule = exports.CatchErrorPatternRule = exports.NoUnmanagedExceptionsRule = exports.RequireReturnTypeRule = exports.NoDestructureRule = exports.ValidateTsInSrcRule = exports.MaxFileLinesRule = exports.NoImplicitAnyRule = exports.NoAnyUnknownRule = void 0;
|
|
4
4
|
var no_any_unknown_1 = require("./no-any-unknown");
|
|
5
5
|
Object.defineProperty(exports, "NoAnyUnknownRule", { enumerable: true, get: function () { return no_any_unknown_1.NoAnyUnknownRule; } });
|
|
6
6
|
var no_implicit_any_1 = require("./no-implicit-any");
|
|
@@ -27,4 +27,6 @@ var no_process_exit_outside_main_1 = require("./no-process-exit-outside-main");
|
|
|
27
27
|
Object.defineProperty(exports, "NoProcessExitOutsideMainRule", { enumerable: true, get: function () { return no_process_exit_outside_main_1.NoProcessExitOutsideMainRule; } });
|
|
28
28
|
var no_js_files_1 = require("./no-js-files");
|
|
29
29
|
Object.defineProperty(exports, "NoJsFilesRule", { enumerable: true, get: function () { return no_js_files_1.NoJsFilesRule; } });
|
|
30
|
+
var catch_must_propagate_1 = require("./catch-must-propagate");
|
|
31
|
+
Object.defineProperty(exports, "CatchMustPropagateRule", { enumerable: true, get: function () { return catch_must_propagate_1.CatchMustPropagateRule; } });
|
|
30
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/ai-hook-rules/src/core/rules/index.ts"],"names":[],"mappings":";;;AAAA,mDAAoD;AAA3C,kHAAA,gBAAgB,OAAA;AACzB,qDAAsD;AAA7C,oHAAA,iBAAiB,OAAA;AAC1B,mDAAoD;AAA3C,kHAAA,gBAAgB,OAAA;AACzB,2DAA2D;AAAlD,yHAAA,mBAAmB,OAAA;AAC5B,mDAAqD;AAA5C,mHAAA,iBAAiB,OAAA;AAC1B,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA;AAC9B,qEAAsE;AAA7D,oIAAA,yBAAyB,OAAA;AAClC,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA;AAC9B,+DAAgE;AAAvD,8HAAA,sBAAsB,OAAA;AAC/B,6DAA6D;AAApD,2HAAA,oBAAoB,OAAA;AAC7B,iDAAkD;AAAzC,gHAAA,eAAe,OAAA;AACxB,+EAA8E;AAArE,4IAAA,4BAA4B,OAAA;AACrC,6CAA8C;AAArC,4GAAA,aAAa,OAAA","sourcesContent":["export { NoAnyUnknownRule } from './no-any-unknown';\nexport { NoImplicitAnyRule } from './no-implicit-any';\nexport { MaxFileLinesRule } from './max-file-lines';\nexport { ValidateTsInSrcRule } from './validate-ts-in-src';\nexport { NoDestructureRule } from './no-destructure';\nexport { RequireReturnTypeRule } from './require-return-type';\nexport { NoUnmanagedExceptionsRule } from './no-unmanaged-exceptions';\nexport { CatchErrorPatternRule } from './catch-error-pattern';\nexport { ThrowCauseRequiredRule } from './throw-cause-required';\nexport { NoSymbolDiTokensRule } from './no-symbol-di-tokens';\nexport { NoCustomCssRule } from './no-custom-css';\nexport { NoProcessExitOutsideMainRule } from './no-process-exit-outside-main';\nexport { NoJsFilesRule } from './no-js-files';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/ai-hook-rules/src/core/rules/index.ts"],"names":[],"mappings":";;;AAAA,mDAAoD;AAA3C,kHAAA,gBAAgB,OAAA;AACzB,qDAAsD;AAA7C,oHAAA,iBAAiB,OAAA;AAC1B,mDAAoD;AAA3C,kHAAA,gBAAgB,OAAA;AACzB,2DAA2D;AAAlD,yHAAA,mBAAmB,OAAA;AAC5B,mDAAqD;AAA5C,mHAAA,iBAAiB,OAAA;AAC1B,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA;AAC9B,qEAAsE;AAA7D,oIAAA,yBAAyB,OAAA;AAClC,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA;AAC9B,+DAAgE;AAAvD,8HAAA,sBAAsB,OAAA;AAC/B,6DAA6D;AAApD,2HAAA,oBAAoB,OAAA;AAC7B,iDAAkD;AAAzC,gHAAA,eAAe,OAAA;AACxB,+EAA8E;AAArE,4IAAA,4BAA4B,OAAA;AACrC,6CAA8C;AAArC,4GAAA,aAAa,OAAA;AACtB,+DAAgE;AAAvD,8HAAA,sBAAsB,OAAA","sourcesContent":["export { NoAnyUnknownRule } from './no-any-unknown';\nexport { NoImplicitAnyRule } from './no-implicit-any';\nexport { MaxFileLinesRule } from './max-file-lines';\nexport { ValidateTsInSrcRule } from './validate-ts-in-src';\nexport { NoDestructureRule } from './no-destructure';\nexport { RequireReturnTypeRule } from './require-return-type';\nexport { NoUnmanagedExceptionsRule } from './no-unmanaged-exceptions';\nexport { CatchErrorPatternRule } from './catch-error-pattern';\nexport { ThrowCauseRequiredRule } from './throw-cause-required';\nexport { NoSymbolDiTokensRule } from './no-symbol-di-tokens';\nexport { NoCustomCssRule } from './no-custom-css';\nexport { NoProcessExitOutsideMainRule } from './no-process-exit-outside-main';\nexport { NoJsFilesRule } from './no-js-files';\nexport { CatchMustPropagateRule } from './catch-must-propagate';\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SourceSyntax } from '@webpieces/tooling-common/source-syntax';
|
|
2
|
+
import { FileContext, ProposedContent } from '@webpieces/hook-runtime';
|
|
3
|
+
/** The proposed file's parse, plus the original's on demand (for rules that grandfather unchanged code). */
|
|
4
|
+
export declare class FileSyntax {
|
|
5
|
+
private readonly fileName;
|
|
6
|
+
readonly content: ProposedContent;
|
|
7
|
+
readonly proposed: SourceSyntax;
|
|
8
|
+
private originalSource;
|
|
9
|
+
constructor(fileName: string, content: ProposedContent);
|
|
10
|
+
original(): SourceSyntax;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The shared AST entry point for Write/Edit-time syntax rules. Every rule judging one invocation's file
|
|
14
|
+
* gets the SAME parse: weak keys expire with the invocation's projected file, so nothing outlives it.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SourceAnalysis {
|
|
17
|
+
private readonly cache;
|
|
18
|
+
forFile(ctx: FileContext): FileSyntax;
|
|
19
|
+
}
|
|
20
|
+
export declare const sourceAnalysis: SourceAnalysis;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sourceAnalysis = exports.SourceAnalysis = exports.FileSyntax = void 0;
|
|
4
|
+
const source_syntax_1 = require("@webpieces/tooling-common/source-syntax");
|
|
5
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
6
|
+
/** The proposed file's parse, plus the original's on demand (for rules that grandfather unchanged code). */
|
|
7
|
+
class FileSyntax {
|
|
8
|
+
fileName;
|
|
9
|
+
content;
|
|
10
|
+
proposed;
|
|
11
|
+
originalSource = null;
|
|
12
|
+
constructor(fileName, content) {
|
|
13
|
+
this.fileName = fileName;
|
|
14
|
+
this.content = content;
|
|
15
|
+
this.proposed = new source_syntax_1.SourceSyntax(fileName, content.text);
|
|
16
|
+
}
|
|
17
|
+
original() {
|
|
18
|
+
if (!this.originalSource)
|
|
19
|
+
this.originalSource = new source_syntax_1.SourceSyntax(this.fileName, this.content.original);
|
|
20
|
+
return this.originalSource;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.FileSyntax = FileSyntax;
|
|
24
|
+
/**
|
|
25
|
+
* The shared AST entry point for Write/Edit-time syntax rules. Every rule judging one invocation's file
|
|
26
|
+
* gets the SAME parse: weak keys expire with the invocation's projected file, so nothing outlives it.
|
|
27
|
+
*/
|
|
28
|
+
class SourceAnalysis {
|
|
29
|
+
cache = new WeakMap();
|
|
30
|
+
forFile(ctx) {
|
|
31
|
+
if (!ctx.proposedFile)
|
|
32
|
+
throw new tooling_common_1.InformAiError('Source syntax rules require the proposed file for a write/edit.');
|
|
33
|
+
const cached = this.cache.get(ctx.proposedFile);
|
|
34
|
+
if (cached)
|
|
35
|
+
return cached;
|
|
36
|
+
const syntax = new FileSyntax(ctx.filePath, ctx.proposedFile.read());
|
|
37
|
+
this.cache.set(ctx.proposedFile, syntax);
|
|
38
|
+
return syntax;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.SourceAnalysis = SourceAnalysis;
|
|
42
|
+
exports.sourceAnalysis = new SourceAnalysis();
|
|
43
|
+
//# sourceMappingURL=source-analysis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-analysis.js","sourceRoot":"","sources":["../../../../../../packages/tooling/ai-hook-rules/src/core/source-analysis.ts"],"names":[],"mappings":";;;AAAA,2EAAuE;AAEvE,8DAA0D;AAE1D,4GAA4G;AAC5G,MAAa,UAAU;IAIU;IAA2B;IAH/C,QAAQ,CAAe;IACxB,cAAc,GAAwB,IAAI,CAAC;IAEnD,YAA6B,QAAgB,EAAW,OAAwB;QAAnD,aAAQ,GAAR,QAAQ,CAAQ;QAAW,YAAO,GAAP,OAAO,CAAiB;QAC5E,IAAI,CAAC,QAAQ,GAAG,IAAI,4BAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED,QAAQ;QACJ,IAAI,CAAC,IAAI,CAAC,cAAc;YAAE,IAAI,CAAC,cAAc,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvG,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;CACJ;AAZD,gCAYC;AAED;;;GAGG;AACH,MAAa,cAAc;IACN,KAAK,GAAG,IAAI,OAAO,EAA4B,CAAC;IAEjE,OAAO,CAAC,GAAgB;QACpB,IAAI,CAAC,GAAG,CAAC,YAAY;YAAE,MAAM,IAAI,8BAAa,CAAC,iEAAiE,CAAC,CAAC;QAClH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAC1B,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACzC,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAXD,wCAWC;AAEY,QAAA,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC","sourcesContent":["import { SourceSyntax } from '@webpieces/tooling-common/source-syntax';\nimport { FileContext, ProposedContent, ProposedFile } from '@webpieces/hook-runtime';\nimport { InformAiError } from '@webpieces/tooling-common';\n\n/** The proposed file's parse, plus the original's on demand (for rules that grandfather unchanged code). */\nexport class FileSyntax {\n readonly proposed: SourceSyntax;\n private originalSource: SourceSyntax | null = null;\n\n constructor(private readonly fileName: string, readonly content: ProposedContent) {\n this.proposed = new SourceSyntax(fileName, content.text);\n }\n\n original(): SourceSyntax {\n if (!this.originalSource) this.originalSource = new SourceSyntax(this.fileName, this.content.original);\n return this.originalSource;\n }\n}\n\n/**\n * The shared AST entry point for Write/Edit-time syntax rules. Every rule judging one invocation's file\n * gets the SAME parse: weak keys expire with the invocation's projected file, so nothing outlives it.\n */\nexport class SourceAnalysis {\n private readonly cache = new WeakMap<ProposedFile, FileSyntax>();\n\n forFile(ctx: FileContext): FileSyntax {\n if (!ctx.proposedFile) throw new InformAiError('Source syntax rules require the proposed file for a write/edit.');\n const cached = this.cache.get(ctx.proposedFile);\n if (cached) return cached;\n const syntax = new FileSyntax(ctx.filePath, ctx.proposedFile.read());\n this.cache.set(ctx.proposedFile, syntax);\n return syntax;\n }\n}\n\nexport const sourceAnalysis = new SourceAnalysis();\n"]}
|
|
@@ -5,4 +5,6 @@ export declare class SourceContributionConfig extends BaseRuleConfig {
|
|
|
5
5
|
disableAllowed?: boolean;
|
|
6
6
|
allowTopLevel?: boolean;
|
|
7
7
|
allowGlobs?: string[];
|
|
8
|
+
/** catch-must-propagate: forwarder / logger callee names a caught error may be handed to whole. */
|
|
9
|
+
forwards?: string[];
|
|
8
10
|
}
|
|
@@ -8,6 +8,8 @@ class SourceContributionConfig extends rules_sdk_1.BaseRuleConfig {
|
|
|
8
8
|
disableAllowed;
|
|
9
9
|
allowTopLevel;
|
|
10
10
|
allowGlobs;
|
|
11
|
+
/** catch-must-propagate: forwarder / logger callee names a caught error may be handed to whole. */
|
|
12
|
+
forwards;
|
|
11
13
|
}
|
|
12
14
|
exports.SourceContributionConfig = SourceContributionConfig;
|
|
13
15
|
//# sourceMappingURL=source-contribution-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-contribution-config.js","sourceRoot":"","sources":["../../../../../../packages/tooling/ai-hook-rules/src/core/source-contribution-config.ts"],"names":[],"mappings":";;;AAAA,oDAAsD;AAEtD,sGAAsG;AACtG,MAAa,wBAAyB,SAAQ,0BAAc;IACxD,KAAK,CAAU;IACf,cAAc,CAAW;IACzB,aAAa,CAAW;IACxB,UAAU,CAAY;
|
|
1
|
+
{"version":3,"file":"source-contribution-config.js","sourceRoot":"","sources":["../../../../../../packages/tooling/ai-hook-rules/src/core/source-contribution-config.ts"],"names":[],"mappings":";;;AAAA,oDAAsD;AAEtD,sGAAsG;AACtG,MAAa,wBAAyB,SAAQ,0BAAc;IACxD,KAAK,CAAU;IACf,cAAc,CAAW;IACzB,aAAa,CAAW;IACxB,UAAU,CAAY;IACtB,mGAAmG;IACnG,QAAQ,CAAY;CACvB;AAPD,4DAOC","sourcesContent":["import { BaseRuleConfig } from '@webpieces/rules-sdk';\n\n/** Resolved settings consumed by source contributions; the canonical owner validates their schema. */\nexport class SourceContributionConfig extends BaseRuleConfig {\n limit?: number;\n disableAllowed?: boolean;\n allowTopLevel?: boolean;\n allowGlobs?: string[];\n /** catch-must-propagate: forwarder / logger callee names a caught error may be handed to whole. */\n forwards?: string[];\n}\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { NoDestructureRule } from './core/rules/no-destructure';
|
|
|
6
6
|
export { RequireReturnTypeRule } from './core/rules/require-return-type';
|
|
7
7
|
export { NoUnmanagedExceptionsRule } from './core/rules/no-unmanaged-exceptions';
|
|
8
8
|
export { CatchErrorPatternRule } from './core/rules/catch-error-pattern';
|
|
9
|
+
export { CatchMustPropagateRule } from './core/rules/catch-must-propagate';
|
|
9
10
|
export { ThrowCauseRequiredRule } from './core/rules/throw-cause-required';
|
|
10
11
|
export { NoSymbolDiTokensRule } from './core/rules/no-symbol-di-tokens';
|
|
11
12
|
export { NoProcessExitOutsideMainRule } from './core/rules/no-process-exit-outside-main';
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.ThrowCauseRequiredConfig = exports.VALIDATE_TS_MODES = exports.THROW_CAUSE_MODES = exports.SourceHookRules = exports.NoJsFilesRule = exports.NoCustomCssRule = exports.NoProcessExitOutsideMainRule = exports.NoSymbolDiTokensRule = exports.ThrowCauseRequiredRule = exports.CatchErrorPatternRule = exports.NoUnmanagedExceptionsRule = exports.RequireReturnTypeRule = exports.NoDestructureRule = exports.ValidateTsInSrcRule = exports.MaxFileLinesRule = exports.NoImplicitAnyRule = exports.NoAnyUnknownRule = void 0;
|
|
3
|
+
exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.ThrowCauseRequiredConfig = exports.VALIDATE_TS_MODES = exports.THROW_CAUSE_MODES = exports.SourceHookRules = exports.NoJsFilesRule = exports.NoCustomCssRule = exports.NoProcessExitOutsideMainRule = exports.NoSymbolDiTokensRule = exports.ThrowCauseRequiredRule = exports.CatchMustPropagateRule = exports.CatchErrorPatternRule = exports.NoUnmanagedExceptionsRule = exports.RequireReturnTypeRule = exports.NoDestructureRule = exports.ValidateTsInSrcRule = exports.MaxFileLinesRule = exports.NoImplicitAnyRule = exports.NoAnyUnknownRule = void 0;
|
|
4
4
|
// Source-owned configs are exported below; contributed source rules use the internal
|
|
5
5
|
// SourceContributionConfig, and shared scope contracts come from @webpieces/rules-sdk.
|
|
6
6
|
var no_any_unknown_1 = require("./core/rules/no-any-unknown");
|
|
@@ -19,6 +19,8 @@ var no_unmanaged_exceptions_1 = require("./core/rules/no-unmanaged-exceptions");
|
|
|
19
19
|
Object.defineProperty(exports, "NoUnmanagedExceptionsRule", { enumerable: true, get: function () { return no_unmanaged_exceptions_1.NoUnmanagedExceptionsRule; } });
|
|
20
20
|
var catch_error_pattern_1 = require("./core/rules/catch-error-pattern");
|
|
21
21
|
Object.defineProperty(exports, "CatchErrorPatternRule", { enumerable: true, get: function () { return catch_error_pattern_1.CatchErrorPatternRule; } });
|
|
22
|
+
var catch_must_propagate_1 = require("./core/rules/catch-must-propagate");
|
|
23
|
+
Object.defineProperty(exports, "CatchMustPropagateRule", { enumerable: true, get: function () { return catch_must_propagate_1.CatchMustPropagateRule; } });
|
|
22
24
|
var throw_cause_required_1 = require("./core/rules/throw-cause-required");
|
|
23
25
|
Object.defineProperty(exports, "ThrowCauseRequiredRule", { enumerable: true, get: function () { return throw_cause_required_1.ThrowCauseRequiredRule; } });
|
|
24
26
|
var no_symbol_di_tokens_1 = require("./core/rules/no-symbol-di-tokens");
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/ai-hook-rules/src/index.ts"],"names":[],"mappings":";;;AAAA,qFAAqF;AACrF,uFAAuF;AACvF,8DAA+D;AAAtD,kHAAA,gBAAgB,OAAA;AACzB,gEAAiE;AAAxD,oHAAA,iBAAiB,OAAA;AAC1B,8DAA+D;AAAtD,kHAAA,gBAAgB,OAAA;AACzB,sEAAsE;AAA7D,yHAAA,mBAAmB,OAAA;AAC5B,8DAAgE;AAAvD,mHAAA,iBAAiB,OAAA;AAC1B,wEAAyE;AAAhE,4HAAA,qBAAqB,OAAA;AAC9B,gFAAiF;AAAxE,oIAAA,yBAAyB,OAAA;AAClC,wEAAyE;AAAhE,4HAAA,qBAAqB,OAAA;AAC9B,0EAA2E;AAAlE,8HAAA,sBAAsB,OAAA;AAC/B,wEAAwE;AAA/D,2HAAA,oBAAoB,OAAA;AAC7B,0FAAyF;AAAhF,4IAAA,4BAA4B,OAAA;AACrC,4DAA6D;AAApD,gHAAA,eAAe,OAAA;AACxB,wDAAyD;AAAhD,4GAAA,aAAa,OAAA;AAEtB,wCAAgD;AAAvC,yGAAA,eAAe,OAAA;AAExB,uDAAgJ;AAAvI,iHAAA,iBAAiB,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AAAE,wHAAA,wBAAwB,OAAA;AAAE,+GAAA,eAAe,OAAA;AAAE,qHAAA,qBAAqB,OAAA","sourcesContent":["// Source-owned configs are exported below; contributed source rules use the internal\n// SourceContributionConfig, and shared scope contracts come from @webpieces/rules-sdk.\nexport { NoAnyUnknownRule } from './core/rules/no-any-unknown';\nexport { NoImplicitAnyRule } from './core/rules/no-implicit-any';\nexport { MaxFileLinesRule } from './core/rules/max-file-lines';\nexport { ValidateTsInSrcRule } from './core/rules/validate-ts-in-src';\nexport { NoDestructureRule } from './core/rules/no-destructure';\nexport { RequireReturnTypeRule } from './core/rules/require-return-type';\nexport { NoUnmanagedExceptionsRule } from './core/rules/no-unmanaged-exceptions';\nexport { CatchErrorPatternRule } from './core/rules/catch-error-pattern';\nexport { ThrowCauseRequiredRule } from './core/rules/throw-cause-required';\nexport { NoSymbolDiTokensRule } from './core/rules/no-symbol-di-tokens';\nexport { NoProcessExitOutsideMainRule } from './core/rules/no-process-exit-outside-main';\nexport { NoCustomCssRule } from './core/rules/no-custom-css';\nexport { NoJsFilesRule } from './core/rules/no-js-files';\n\nexport { SourceHookRules } from './core/runner';\n\nexport { THROW_CAUSE_MODES, VALIDATE_TS_MODES, ThrowCauseRequiredConfig, NoJsFilesConfig, ValidateTsInSrcConfig } from './configs/rule-configs';\nexport type { ThrowCauseMode, ValidateTsMode } from './configs/rule-configs';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/ai-hook-rules/src/index.ts"],"names":[],"mappings":";;;AAAA,qFAAqF;AACrF,uFAAuF;AACvF,8DAA+D;AAAtD,kHAAA,gBAAgB,OAAA;AACzB,gEAAiE;AAAxD,oHAAA,iBAAiB,OAAA;AAC1B,8DAA+D;AAAtD,kHAAA,gBAAgB,OAAA;AACzB,sEAAsE;AAA7D,yHAAA,mBAAmB,OAAA;AAC5B,8DAAgE;AAAvD,mHAAA,iBAAiB,OAAA;AAC1B,wEAAyE;AAAhE,4HAAA,qBAAqB,OAAA;AAC9B,gFAAiF;AAAxE,oIAAA,yBAAyB,OAAA;AAClC,wEAAyE;AAAhE,4HAAA,qBAAqB,OAAA;AAC9B,0EAA2E;AAAlE,8HAAA,sBAAsB,OAAA;AAC/B,0EAA2E;AAAlE,8HAAA,sBAAsB,OAAA;AAC/B,wEAAwE;AAA/D,2HAAA,oBAAoB,OAAA;AAC7B,0FAAyF;AAAhF,4IAAA,4BAA4B,OAAA;AACrC,4DAA6D;AAApD,gHAAA,eAAe,OAAA;AACxB,wDAAyD;AAAhD,4GAAA,aAAa,OAAA;AAEtB,wCAAgD;AAAvC,yGAAA,eAAe,OAAA;AAExB,uDAAgJ;AAAvI,iHAAA,iBAAiB,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AAAE,wHAAA,wBAAwB,OAAA;AAAE,+GAAA,eAAe,OAAA;AAAE,qHAAA,qBAAqB,OAAA","sourcesContent":["// Source-owned configs are exported below; contributed source rules use the internal\n// SourceContributionConfig, and shared scope contracts come from @webpieces/rules-sdk.\nexport { NoAnyUnknownRule } from './core/rules/no-any-unknown';\nexport { NoImplicitAnyRule } from './core/rules/no-implicit-any';\nexport { MaxFileLinesRule } from './core/rules/max-file-lines';\nexport { ValidateTsInSrcRule } from './core/rules/validate-ts-in-src';\nexport { NoDestructureRule } from './core/rules/no-destructure';\nexport { RequireReturnTypeRule } from './core/rules/require-return-type';\nexport { NoUnmanagedExceptionsRule } from './core/rules/no-unmanaged-exceptions';\nexport { CatchErrorPatternRule } from './core/rules/catch-error-pattern';\nexport { CatchMustPropagateRule } from './core/rules/catch-must-propagate';\nexport { ThrowCauseRequiredRule } from './core/rules/throw-cause-required';\nexport { NoSymbolDiTokensRule } from './core/rules/no-symbol-di-tokens';\nexport { NoProcessExitOutsideMainRule } from './core/rules/no-process-exit-outside-main';\nexport { NoCustomCssRule } from './core/rules/no-custom-css';\nexport { NoJsFilesRule } from './core/rules/no-js-files';\n\nexport { SourceHookRules } from './core/runner';\n\nexport { THROW_CAUSE_MODES, VALIDATE_TS_MODES, ThrowCauseRequiredConfig, NoJsFilesConfig, ValidateTsInSrcConfig } from './configs/rule-configs';\nexport type { ThrowCauseMode, ValidateTsMode } from './configs/rule-configs';\n"]}
|
|
@@ -31,6 +31,7 @@ exports.SOURCE_POLICIES = [
|
|
|
31
31
|
new SourcePolicy('require-return-type', '@webpieces/code-rules', 'RequireReturnTypeRule'),
|
|
32
32
|
new SourcePolicy('no-unmanaged-exceptions', '@webpieces/code-rules', 'NoUnmanagedExceptionsRule'),
|
|
33
33
|
new SourcePolicy('catch-error-pattern', '@webpieces/code-rules', 'CatchErrorPatternRule'),
|
|
34
|
+
new SourcePolicy('catch-must-propagate', '@webpieces/code-rules', 'CatchMustPropagateRule'),
|
|
34
35
|
new SourcePolicy('throw-cause-required', '@webpieces/ai-hook-rules', 'ThrowCauseRequiredRule'),
|
|
35
36
|
new SourcePolicy('no-symbol-di-tokens', '@webpieces/code-rules', 'NoSymbolDiTokensRule'),
|
|
36
37
|
new SourcePolicy('no-custom-css', '@webpieces/code-rules', 'NoCustomCssRule'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-policy-registry.js","sourceRoot":"","sources":["../../../../../packages/tooling/ai-hook-rules/src/source-policy-registry.ts"],"names":[],"mappings":";;;AAAA,oDAAoF;AACpF,yDAIgC;AAChC,mDAAmE;AACnE,2CAAuC;AAE1B,QAAA,UAAU,GAAG;IACtB,IAAI,+BAAmB,CACnB,sBAAsB,EACtB,uCAAwB,CAAC,MAAM,EAC/B,mCAAuB,EACvB,8BAAc,CAAC,sBAAsB,CAAC,EACtC,gCAAgB,CAAC,sBAAsB,CAAC,EACxC,OAAO,EACP,oBAAQ,CAAC,sBAAsB,CAAC,CACnC;IACD,IAAI,+BAAmB,CACnB,aAAa,EACb,8BAAe,CAAC,MAAM,EACtB,mCAAuB,EACvB,8BAAc,CAAC,aAAa,CAAC,EAC7B,gCAAgB,CAAC,aAAa,CAAC,EAC/B,OAAO,EACP,oBAAQ,CAAC,aAAa,CAAC,CAC1B;IACD,IAAI,+BAAmB,CACnB,oBAAoB,EACpB,oCAAqB,CAAC,MAAM,EAC5B,mCAAuB,EACvB,8BAAc,CAAC,oBAAoB,CAAC,EACpC,gCAAgB,CAAC,oBAAoB,CAAC,EACtC,OAAO,EACP,oBAAQ,CAAC,oBAAoB,CAAC,CACjC;CACJ,CAAC;AAEF,MAAa,YAAY;IAER;IACA;IACA;IAHb,YACa,EAAU,EACV,SAAiB,EACjB,oBAA4B;QAF5B,OAAE,GAAF,EAAE,CAAQ;QACV,cAAS,GAAT,SAAS,CAAQ;QACjB,yBAAoB,GAApB,oBAAoB,CAAQ;IACtC,CAAC;CACP;AAND,oCAMC;AAED,mFAAmF;AACtE,QAAA,eAAe,GAA4B;IACpD,IAAI,YAAY,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,kBAAkB,CAAC;IAC/E,IAAI,YAAY,CAAC,iBAAiB,EAAE,uBAAuB,EAAE,mBAAmB,CAAC;IACjF,IAAI,YAAY,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,kBAAkB,CAAC;IAC/E,IAAI,YAAY,CAAC,oBAAoB,EAAE,0BAA0B,EAAE,qBAAqB,CAAC;IACzF,IAAI,YAAY,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,mBAAmB,CAAC;IAChF,IAAI,YAAY,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;IACzF,IAAI,YAAY,CACZ,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,CAC9B;IACD,IAAI,YAAY,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;IACzF,IAAI,YAAY,CAAC,sBAAsB,EAAE,0BAA0B,EAAE,wBAAwB,CAAC;IAC9F,IAAI,YAAY,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,sBAAsB,CAAC;IACxF,IAAI,YAAY,CAAC,eAAe,EAAE,uBAAuB,EAAE,iBAAiB,CAAC;IAC7E,IAAI,YAAY,CACZ,8BAA8B,EAC9B,uBAAuB,EACvB,8BAA8B,CACjC;IACD,IAAI,YAAY,CAAC,aAAa,EAAE,0BAA0B,EAAE,eAAe,CAAC;CAC/E,CAAC","sourcesContent":["import { OwnedRuleDefinition, RULE_SCHEMA_API_VERSION } from '@webpieces/rules-sdk';\nimport {\n ThrowCauseRequiredConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n} from './configs/rule-configs';\nimport { optionalTuning, recommendedSeeds } from './rule-settings';\nimport { ruleHelp } from './rule-help';\n\nexport const ownedRules = [\n new OwnedRuleDefinition(\n 'throw-cause-required',\n ThrowCauseRequiredConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['throw-cause-required'],\n recommendedSeeds['throw-cause-required'],\n 'rules',\n ruleHelp['throw-cause-required'],\n ),\n new OwnedRuleDefinition(\n 'no-js-files',\n NoJsFilesConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['no-js-files'],\n recommendedSeeds['no-js-files'],\n 'rules',\n ruleHelp['no-js-files'],\n ),\n new OwnedRuleDefinition(\n 'validate-ts-in-src',\n ValidateTsInSrcConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['validate-ts-in-src'],\n recommendedSeeds['validate-ts-in-src'],\n 'rules',\n ruleHelp['validate-ts-in-src'],\n ),\n];\n\nexport class SourcePolicy {\n constructor(\n readonly id: string,\n readonly ownerPack: string,\n readonly implementationExport: string,\n ) {}\n}\n\n/** Source implementations and their canonical owners are declared exactly once. */\nexport const SOURCE_POLICIES: readonly SourcePolicy[] = [\n new SourcePolicy('no-any-unknown', '@webpieces/code-rules', 'NoAnyUnknownRule'),\n new SourcePolicy('no-implicit-any', '@webpieces/code-rules', 'NoImplicitAnyRule'),\n new SourcePolicy('max-file-lines', '@webpieces/code-rules', 'MaxFileLinesRule'),\n new SourcePolicy('validate-ts-in-src', '@webpieces/ai-hook-rules', 'ValidateTsInSrcRule'),\n new SourcePolicy('no-destructure', '@webpieces/code-rules', 'NoDestructureRule'),\n new SourcePolicy('require-return-type', '@webpieces/code-rules', 'RequireReturnTypeRule'),\n new SourcePolicy(\n 'no-unmanaged-exceptions',\n '@webpieces/code-rules',\n 'NoUnmanagedExceptionsRule',\n ),\n new SourcePolicy('catch-error-pattern', '@webpieces/code-rules', 'CatchErrorPatternRule'),\n new SourcePolicy('throw-cause-required', '@webpieces/ai-hook-rules', 'ThrowCauseRequiredRule'),\n new SourcePolicy('no-symbol-di-tokens', '@webpieces/code-rules', 'NoSymbolDiTokensRule'),\n new SourcePolicy('no-custom-css', '@webpieces/code-rules', 'NoCustomCssRule'),\n new SourcePolicy(\n 'no-process-exit-outside-main',\n '@webpieces/code-rules',\n 'NoProcessExitOutsideMainRule',\n ),\n new SourcePolicy('no-js-files', '@webpieces/ai-hook-rules', 'NoJsFilesRule'),\n];\n"]}
|
|
1
|
+
{"version":3,"file":"source-policy-registry.js","sourceRoot":"","sources":["../../../../../packages/tooling/ai-hook-rules/src/source-policy-registry.ts"],"names":[],"mappings":";;;AAAA,oDAAoF;AACpF,yDAIgC;AAChC,mDAAmE;AACnE,2CAAuC;AAE1B,QAAA,UAAU,GAAG;IACtB,IAAI,+BAAmB,CACnB,sBAAsB,EACtB,uCAAwB,CAAC,MAAM,EAC/B,mCAAuB,EACvB,8BAAc,CAAC,sBAAsB,CAAC,EACtC,gCAAgB,CAAC,sBAAsB,CAAC,EACxC,OAAO,EACP,oBAAQ,CAAC,sBAAsB,CAAC,CACnC;IACD,IAAI,+BAAmB,CACnB,aAAa,EACb,8BAAe,CAAC,MAAM,EACtB,mCAAuB,EACvB,8BAAc,CAAC,aAAa,CAAC,EAC7B,gCAAgB,CAAC,aAAa,CAAC,EAC/B,OAAO,EACP,oBAAQ,CAAC,aAAa,CAAC,CAC1B;IACD,IAAI,+BAAmB,CACnB,oBAAoB,EACpB,oCAAqB,CAAC,MAAM,EAC5B,mCAAuB,EACvB,8BAAc,CAAC,oBAAoB,CAAC,EACpC,gCAAgB,CAAC,oBAAoB,CAAC,EACtC,OAAO,EACP,oBAAQ,CAAC,oBAAoB,CAAC,CACjC;CACJ,CAAC;AAEF,MAAa,YAAY;IAER;IACA;IACA;IAHb,YACa,EAAU,EACV,SAAiB,EACjB,oBAA4B;QAF5B,OAAE,GAAF,EAAE,CAAQ;QACV,cAAS,GAAT,SAAS,CAAQ;QACjB,yBAAoB,GAApB,oBAAoB,CAAQ;IACtC,CAAC;CACP;AAND,oCAMC;AAED,mFAAmF;AACtE,QAAA,eAAe,GAA4B;IACpD,IAAI,YAAY,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,kBAAkB,CAAC;IAC/E,IAAI,YAAY,CAAC,iBAAiB,EAAE,uBAAuB,EAAE,mBAAmB,CAAC;IACjF,IAAI,YAAY,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,kBAAkB,CAAC;IAC/E,IAAI,YAAY,CAAC,oBAAoB,EAAE,0BAA0B,EAAE,qBAAqB,CAAC;IACzF,IAAI,YAAY,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,mBAAmB,CAAC;IAChF,IAAI,YAAY,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;IACzF,IAAI,YAAY,CACZ,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,CAC9B;IACD,IAAI,YAAY,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;IACzF,IAAI,YAAY,CAAC,sBAAsB,EAAE,uBAAuB,EAAE,wBAAwB,CAAC;IAC3F,IAAI,YAAY,CAAC,sBAAsB,EAAE,0BAA0B,EAAE,wBAAwB,CAAC;IAC9F,IAAI,YAAY,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,sBAAsB,CAAC;IACxF,IAAI,YAAY,CAAC,eAAe,EAAE,uBAAuB,EAAE,iBAAiB,CAAC;IAC7E,IAAI,YAAY,CACZ,8BAA8B,EAC9B,uBAAuB,EACvB,8BAA8B,CACjC;IACD,IAAI,YAAY,CAAC,aAAa,EAAE,0BAA0B,EAAE,eAAe,CAAC;CAC/E,CAAC","sourcesContent":["import { OwnedRuleDefinition, RULE_SCHEMA_API_VERSION } from '@webpieces/rules-sdk';\nimport {\n ThrowCauseRequiredConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n} from './configs/rule-configs';\nimport { optionalTuning, recommendedSeeds } from './rule-settings';\nimport { ruleHelp } from './rule-help';\n\nexport const ownedRules = [\n new OwnedRuleDefinition(\n 'throw-cause-required',\n ThrowCauseRequiredConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['throw-cause-required'],\n recommendedSeeds['throw-cause-required'],\n 'rules',\n ruleHelp['throw-cause-required'],\n ),\n new OwnedRuleDefinition(\n 'no-js-files',\n NoJsFilesConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['no-js-files'],\n recommendedSeeds['no-js-files'],\n 'rules',\n ruleHelp['no-js-files'],\n ),\n new OwnedRuleDefinition(\n 'validate-ts-in-src',\n ValidateTsInSrcConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['validate-ts-in-src'],\n recommendedSeeds['validate-ts-in-src'],\n 'rules',\n ruleHelp['validate-ts-in-src'],\n ),\n];\n\nexport class SourcePolicy {\n constructor(\n readonly id: string,\n readonly ownerPack: string,\n readonly implementationExport: string,\n ) {}\n}\n\n/** Source implementations and their canonical owners are declared exactly once. */\nexport const SOURCE_POLICIES: readonly SourcePolicy[] = [\n new SourcePolicy('no-any-unknown', '@webpieces/code-rules', 'NoAnyUnknownRule'),\n new SourcePolicy('no-implicit-any', '@webpieces/code-rules', 'NoImplicitAnyRule'),\n new SourcePolicy('max-file-lines', '@webpieces/code-rules', 'MaxFileLinesRule'),\n new SourcePolicy('validate-ts-in-src', '@webpieces/ai-hook-rules', 'ValidateTsInSrcRule'),\n new SourcePolicy('no-destructure', '@webpieces/code-rules', 'NoDestructureRule'),\n new SourcePolicy('require-return-type', '@webpieces/code-rules', 'RequireReturnTypeRule'),\n new SourcePolicy(\n 'no-unmanaged-exceptions',\n '@webpieces/code-rules',\n 'NoUnmanagedExceptionsRule',\n ),\n new SourcePolicy('catch-error-pattern', '@webpieces/code-rules', 'CatchErrorPatternRule'),\n new SourcePolicy('catch-must-propagate', '@webpieces/code-rules', 'CatchMustPropagateRule'),\n new SourcePolicy('throw-cause-required', '@webpieces/ai-hook-rules', 'ThrowCauseRequiredRule'),\n new SourcePolicy('no-symbol-di-tokens', '@webpieces/code-rules', 'NoSymbolDiTokensRule'),\n new SourcePolicy('no-custom-css', '@webpieces/code-rules', 'NoCustomCssRule'),\n new SourcePolicy(\n 'no-process-exit-outside-main',\n '@webpieces/code-rules',\n 'NoProcessExitOutsideMainRule',\n ),\n new SourcePolicy('no-js-files', '@webpieces/ai-hook-rules', 'NoJsFilesRule'),\n];\n"]}
|