@webpieces/rules-config 0.3.183 → 0.3.185
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 +1 -1
- package/src/WebpiecesRulesConfig.d.ts +2 -1
- package/src/WebpiecesRulesConfig.js +1 -0
- package/src/WebpiecesRulesConfig.js.map +1 -1
- package/src/constants.d.ts +27 -0
- package/src/constants.js +48 -0
- package/src/constants.js.map +1 -0
- package/src/default-rules.js +2 -1
- package/src/default-rules.js.map +1 -1
- package/src/index.d.ts +3 -1
- package/src/index.js +16 -1
- package/src/index.js.map +1 -1
- package/src/pr-gate-config.d.ts +19 -0
- package/src/pr-gate-config.js +69 -0
- package/src/pr-gate-config.js.map +1 -0
- package/src/rule-configs.d.ts +4 -2
- package/src/rule-configs.js +9 -5
- package/src/rule-configs.js.map +1 -1
- package/src/validate-config.js +1 -0
- package/src/validate-config.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/rules-config",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.185",
|
|
4
4
|
"description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaxMethodLinesConfig, MaxFileLinesConfig, RequireReturnTypeConfig, NoInlineTypeLiteralsConfig, NoAnyUnknownConfig, NoImplicitAnyConfig, PrismaValidateDtosConfig, PrismaConverterConfig, NoDestructureConfig, NoUnmanagedExceptionsConfig, CatchErrorPatternConfig, ThrowCauseRequiredConfig, AngularNoDirectApiInResolverConfig, NoSymbolDiTokensConfig, NoShellSubstitutionConfig, BranchCreationGuardConfig, PrCreationGuardConfig, PrMergeCleanupConfig, NoDirectMainUpdateConfig, NoEditOnMainConfig, NoFileImportCyclesConfig, RuntimeArchitectureConfig, NoJsFilesConfig, ValidateTsInSrcConfig } from './rule-configs';
|
|
1
|
+
import { MaxMethodLinesConfig, MaxFileLinesConfig, RequireReturnTypeConfig, NoInlineTypeLiteralsConfig, NoAnyUnknownConfig, NoImplicitAnyConfig, PrismaValidateDtosConfig, PrismaConverterConfig, NoDestructureConfig, NoUnmanagedExceptionsConfig, CatchErrorPatternConfig, ThrowCauseRequiredConfig, AngularNoDirectApiInResolverConfig, NoSymbolDiTokensConfig, NoShellSubstitutionConfig, BranchCreationGuardConfig, PrCreationGuardConfig, MergeInProgressGuardConfig, PrMergeCleanupConfig, NoDirectMainUpdateConfig, NoEditOnMainConfig, NoFileImportCyclesConfig, RuntimeArchitectureConfig, NoJsFilesConfig, ValidateTsInSrcConfig } from './rule-configs';
|
|
2
2
|
export declare class WebpiecesRulesConfig {
|
|
3
3
|
'max-method-lines'?: MaxMethodLinesConfig;
|
|
4
4
|
'max-file-lines'?: MaxFileLinesConfig;
|
|
@@ -17,6 +17,7 @@ export declare class WebpiecesRulesConfig {
|
|
|
17
17
|
'no-shell-substitution'?: NoShellSubstitutionConfig;
|
|
18
18
|
'branch-creation-guard'?: BranchCreationGuardConfig;
|
|
19
19
|
'pr-creation-guard'?: PrCreationGuardConfig;
|
|
20
|
+
'merge-in-progress-guard'?: MergeInProgressGuardConfig;
|
|
20
21
|
'pr-merge-cleanup'?: PrMergeCleanupConfig;
|
|
21
22
|
'no-direct-main-update'?: NoDirectMainUpdateConfig;
|
|
22
23
|
'no-edit-on-main'?: NoEditOnMainConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebpiecesRulesConfig.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/WebpiecesRulesConfig.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"WebpiecesRulesConfig.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/WebpiecesRulesConfig.ts"],"names":[],"mappings":";;;AA4BA,MAAa,oBAAoB;IAC7B,kBAAkB,CAAwB;IAC1C,gBAAgB,CAAsB;IACtC,qBAAqB,CAA2B;IAChD,yBAAyB,CAA8B;IACvD,gBAAgB,CAAsB;IACtC,iBAAiB,CAAuB;IACxC,sBAAsB,CAA4B;IAClD,kBAAkB,CAAyB;IAC3C,gBAAgB,CAAuB;IACvC,yBAAyB,CAA+B;IACxD,qBAAqB,CAA2B;IAChD,sBAAsB,CAA4B;IAClD,mCAAmC,CAAsC;IACzE,qBAAqB,CAA0B;IAC/C,uBAAuB,CAA6B;IACpD,uBAAuB,CAA6B;IACpD,mBAAmB,CAAyB;IAC5C,yBAAyB,CAA8B;IACvD,kBAAkB,CAAwB;IAC1C,uBAAuB,CAA4B;IACnD,iBAAiB,CAAsB;IACvC,uBAAuB,CAA4B;IACnD,sBAAsB,CAA6B;IACnD,aAAa,CAAmB;IAChC,oBAAoB,CAAyB;IAC7C,QAAQ,CAAY;CACvB;AA3BD,oDA2BC","sourcesContent":["import {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoShellSubstitutionConfig,\n BranchCreationGuardConfig,\n PrCreationGuardConfig,\n MergeInProgressGuardConfig,\n PrMergeCleanupConfig,\n NoDirectMainUpdateConfig,\n NoEditOnMainConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n} from './rule-configs';\n\nexport class WebpiecesRulesConfig {\n 'max-method-lines'?: MaxMethodLinesConfig;\n 'max-file-lines'?: MaxFileLinesConfig;\n 'require-return-type'?: RequireReturnTypeConfig;\n 'no-inline-type-literals'?: NoInlineTypeLiteralsConfig;\n 'no-any-unknown'?: NoAnyUnknownConfig;\n 'no-implicit-any'?: NoImplicitAnyConfig;\n 'prisma-validate-dtos'?: PrismaValidateDtosConfig;\n 'prisma-converter'?: PrismaConverterConfig;\n 'no-destructure'?: NoDestructureConfig;\n 'no-unmanaged-exceptions'?: NoUnmanagedExceptionsConfig;\n 'catch-error-pattern'?: CatchErrorPatternConfig;\n 'throw-cause-required'?: ThrowCauseRequiredConfig;\n 'angular-no-direct-api-in-resolver'?: AngularNoDirectApiInResolverConfig;\n 'no-symbol-di-tokens'?: NoSymbolDiTokensConfig;\n 'no-shell-substitution'?: NoShellSubstitutionConfig;\n 'branch-creation-guard'?: BranchCreationGuardConfig;\n 'pr-creation-guard'?: PrCreationGuardConfig;\n 'merge-in-progress-guard'?: MergeInProgressGuardConfig;\n 'pr-merge-cleanup'?: PrMergeCleanupConfig;\n 'no-direct-main-update'?: NoDirectMainUpdateConfig;\n 'no-edit-on-main'?: NoEditOnMainConfig;\n 'no-file-import-cycles'?: NoFileImportCyclesConfig;\n 'runtime-architecture'?: RuntimeArchitectureConfig;\n 'no-js-files'?: NoJsFilesConfig;\n 'validate-ts-in-src'?: ValidateTsInSrcConfig;\n rulesDir?: string[];\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const WEBPIECES_DISABLE = "webpieces-disable";
|
|
2
|
+
export declare const RULE_NAMES: {
|
|
3
|
+
readonly NO_ANY_UNKNOWN: "no-any-unknown";
|
|
4
|
+
readonly NO_IMPLICIT_ANY: "no-implicit-any";
|
|
5
|
+
readonly NO_DESTRUCTURE: "no-destructure";
|
|
6
|
+
readonly NO_UNMANAGED_EXCEPTIONS: "no-unmanaged-exceptions";
|
|
7
|
+
readonly CATCH_ERROR_PATTERN: "catch-error-pattern";
|
|
8
|
+
readonly THROW_CAUSE_REQUIRED: "throw-cause-required";
|
|
9
|
+
readonly REQUIRE_RETURN_TYPE: "require-return-type";
|
|
10
|
+
readonly NO_SYMBOL_DI_TOKENS: "no-symbol-di-tokens";
|
|
11
|
+
readonly NO_INLINE_TYPES: "no-inline-types";
|
|
12
|
+
readonly NO_DIRECT_API_RESOLVER: "no-direct-api-resolver";
|
|
13
|
+
readonly PRISMA_CONVERTER: "prisma-converter";
|
|
14
|
+
readonly MAX_LINES_NEW_METHODS: "max-lines-new-methods";
|
|
15
|
+
readonly MAX_LINES_MODIFIED_FILES: "max-lines-modified-files";
|
|
16
|
+
readonly MAX_LINES_MODIFIED: "max-lines-modified";
|
|
17
|
+
};
|
|
18
|
+
export declare const WEBPIECES_TMP_DIR = "webpiecesTmp";
|
|
19
|
+
export declare const MERGE_DIR_PREFIX = "merge-";
|
|
20
|
+
export declare const MERGE_IN_PROGRESS_FILE = "merge-in-progress.json";
|
|
21
|
+
/**
|
|
22
|
+
* Fast predicate: does this text carry a webpieces-disable for the given rule?
|
|
23
|
+
* Line-agnostic — the caller decides which line(s) or block of text to feed it.
|
|
24
|
+
* This is the cheap substring form used by code-rules detection and pr-gate's
|
|
25
|
+
* dashboard grep/count. (ai-hook-rules uses a richer line-mapping parser.)
|
|
26
|
+
*/
|
|
27
|
+
export declare function hasDisable(text: string, ruleName: string): boolean;
|
package/src/constants.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Single source of truth for the disable-comment token and rule-name identifiers
|
|
3
|
+
// shared across rules-config, ai-hook-rules, code-rules, and pr-gate.
|
|
4
|
+
//
|
|
5
|
+
// There is exactly ONE disable form: `// webpieces-disable <rule>[, <rule2>] -- reason`.
|
|
6
|
+
// The legacy `ai-hook-disable` alias and the `-file`/`-next`/`-all` variants and the
|
|
7
|
+
// `*`/bare (no-rule) wildcard have been removed — every disable MUST name a rule.
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.MERGE_IN_PROGRESS_FILE = exports.MERGE_DIR_PREFIX = exports.WEBPIECES_TMP_DIR = exports.RULE_NAMES = exports.WEBPIECES_DISABLE = void 0;
|
|
10
|
+
exports.hasDisable = hasDisable;
|
|
11
|
+
exports.WEBPIECES_DISABLE = 'webpieces-disable';
|
|
12
|
+
// Rule-name tokens as they appear AFTER `webpieces-disable` in a disable comment.
|
|
13
|
+
// Values must match existing comments exactly — changing a value silently breaks every
|
|
14
|
+
// disable that names that rule. Note MAX_LINES_MODIFIED is a prefix of
|
|
15
|
+
// MAX_LINES_MODIFIED_FILES (a historical substring-match quirk preserved on purpose).
|
|
16
|
+
exports.RULE_NAMES = {
|
|
17
|
+
NO_ANY_UNKNOWN: 'no-any-unknown',
|
|
18
|
+
NO_IMPLICIT_ANY: 'no-implicit-any',
|
|
19
|
+
NO_DESTRUCTURE: 'no-destructure',
|
|
20
|
+
NO_UNMANAGED_EXCEPTIONS: 'no-unmanaged-exceptions',
|
|
21
|
+
CATCH_ERROR_PATTERN: 'catch-error-pattern',
|
|
22
|
+
THROW_CAUSE_REQUIRED: 'throw-cause-required',
|
|
23
|
+
REQUIRE_RETURN_TYPE: 'require-return-type',
|
|
24
|
+
NO_SYMBOL_DI_TOKENS: 'no-symbol-di-tokens',
|
|
25
|
+
NO_INLINE_TYPES: 'no-inline-types',
|
|
26
|
+
NO_DIRECT_API_RESOLVER: 'no-direct-api-resolver',
|
|
27
|
+
PRISMA_CONVERTER: 'prisma-converter',
|
|
28
|
+
MAX_LINES_NEW_METHODS: 'max-lines-new-methods',
|
|
29
|
+
MAX_LINES_MODIFIED_FILES: 'max-lines-modified-files',
|
|
30
|
+
MAX_LINES_MODIFIED: 'max-lines-modified',
|
|
31
|
+
};
|
|
32
|
+
// Merge-state convention shared by the pr-gate scripts (which WRITE the marker during a
|
|
33
|
+
// conflicted 3-point merge) and the ai-hook-rules merge-in-progress-guard (which READS it
|
|
34
|
+
// to block commit/push/PR until the merge is validated). Kept here so neither package
|
|
35
|
+
// depends on the other — they only share this vocabulary.
|
|
36
|
+
exports.WEBPIECES_TMP_DIR = 'webpiecesTmp';
|
|
37
|
+
exports.MERGE_DIR_PREFIX = 'merge-';
|
|
38
|
+
exports.MERGE_IN_PROGRESS_FILE = 'merge-in-progress.json';
|
|
39
|
+
/**
|
|
40
|
+
* Fast predicate: does this text carry a webpieces-disable for the given rule?
|
|
41
|
+
* Line-agnostic — the caller decides which line(s) or block of text to feed it.
|
|
42
|
+
* This is the cheap substring form used by code-rules detection and pr-gate's
|
|
43
|
+
* dashboard grep/count. (ai-hook-rules uses a richer line-mapping parser.)
|
|
44
|
+
*/
|
|
45
|
+
function hasDisable(text, ruleName) {
|
|
46
|
+
return text.includes(exports.WEBPIECES_DISABLE) && text.includes(ruleName);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/constants.ts"],"names":[],"mappings":";AAAA,iFAAiF;AACjF,sEAAsE;AACtE,EAAE;AACF,yFAAyF;AACzF,qFAAqF;AACrF,kFAAkF;;;AAuClF,gCAEC;AAvCY,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AAErD,kFAAkF;AAClF,uFAAuF;AACvF,uEAAuE;AACvE,sFAAsF;AACzE,QAAA,UAAU,GAAG;IACtB,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,cAAc,EAAE,gBAAgB;IAChC,uBAAuB,EAAE,yBAAyB;IAClD,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,mBAAmB,EAAE,qBAAqB;IAC1C,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,sBAAsB,EAAE,wBAAwB;IAChD,gBAAgB,EAAE,kBAAkB;IACpC,qBAAqB,EAAE,uBAAuB;IAC9C,wBAAwB,EAAE,0BAA0B;IACpD,kBAAkB,EAAE,oBAAoB;CAClC,CAAC;AAEX,wFAAwF;AACxF,0FAA0F;AAC1F,sFAAsF;AACtF,0DAA0D;AAC7C,QAAA,iBAAiB,GAAG,cAAc,CAAC;AACnC,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAC5B,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAE/D;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,QAAgB;IACrD,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAiB,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvE,CAAC","sourcesContent":["// Single source of truth for the disable-comment token and rule-name identifiers\n// shared across rules-config, ai-hook-rules, code-rules, and pr-gate.\n//\n// There is exactly ONE disable form: `// webpieces-disable <rule>[, <rule2>] -- reason`.\n// The legacy `ai-hook-disable` alias and the `-file`/`-next`/`-all` variants and the\n// `*`/bare (no-rule) wildcard have been removed — every disable MUST name a rule.\n\nexport const WEBPIECES_DISABLE = 'webpieces-disable';\n\n// Rule-name tokens as they appear AFTER `webpieces-disable` in a disable comment.\n// Values must match existing comments exactly — changing a value silently breaks every\n// disable that names that rule. Note MAX_LINES_MODIFIED is a prefix of\n// MAX_LINES_MODIFIED_FILES (a historical substring-match quirk preserved on purpose).\nexport const RULE_NAMES = {\n NO_ANY_UNKNOWN: 'no-any-unknown',\n NO_IMPLICIT_ANY: 'no-implicit-any',\n NO_DESTRUCTURE: 'no-destructure',\n NO_UNMANAGED_EXCEPTIONS: 'no-unmanaged-exceptions',\n CATCH_ERROR_PATTERN: 'catch-error-pattern',\n THROW_CAUSE_REQUIRED: 'throw-cause-required',\n REQUIRE_RETURN_TYPE: 'require-return-type',\n NO_SYMBOL_DI_TOKENS: 'no-symbol-di-tokens',\n NO_INLINE_TYPES: 'no-inline-types',\n NO_DIRECT_API_RESOLVER: 'no-direct-api-resolver',\n PRISMA_CONVERTER: 'prisma-converter',\n MAX_LINES_NEW_METHODS: 'max-lines-new-methods',\n MAX_LINES_MODIFIED_FILES: 'max-lines-modified-files',\n MAX_LINES_MODIFIED: 'max-lines-modified',\n} as const;\n\n// Merge-state convention shared by the pr-gate scripts (which WRITE the marker during a\n// conflicted 3-point merge) and the ai-hook-rules merge-in-progress-guard (which READS it\n// to block commit/push/PR until the merge is validated). Kept here so neither package\n// depends on the other — they only share this vocabulary.\nexport const WEBPIECES_TMP_DIR = 'webpiecesTmp';\nexport const MERGE_DIR_PREFIX = 'merge-';\nexport const MERGE_IN_PROGRESS_FILE = 'merge-in-progress.json';\n\n/**\n * Fast predicate: does this text carry a webpieces-disable for the given rule?\n * Line-agnostic — the caller decides which line(s) or block of text to feed it.\n * This is the cheap substring form used by code-rules detection and pr-gate's\n * dashboard grep/count. (ai-hook-rules uses a richer line-mapping parser.)\n */\nexport function hasDisable(text: string, ruleName: string): boolean {\n return text.includes(WEBPIECES_DISABLE) && text.includes(ruleName);\n}\n"]}
|
package/src/default-rules.js
CHANGED
|
@@ -38,7 +38,8 @@ exports.defaultRules = {
|
|
|
38
38
|
},
|
|
39
39
|
'no-js-files': { mode: 'OFF' },
|
|
40
40
|
'branch-creation-guard': { mode: 'ON', subBranchNaming: 'feature/<ticket>/<short-description>' },
|
|
41
|
-
'pr-creation-guard': { mode: 'ON'
|
|
41
|
+
'pr-creation-guard': { mode: 'ON' },
|
|
42
|
+
'merge-in-progress-guard': { mode: 'ON' },
|
|
42
43
|
'pr-merge-cleanup': { mode: 'ON' },
|
|
43
44
|
'no-direct-main-update': { mode: 'ON' },
|
|
44
45
|
};
|
package/src/default-rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-rules.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/default-rules.ts"],"names":[],"mappings":";;;AAAA,2DAA2D;AAC3D,4EAA4E;AAC5E,kEAAkE;AAClE,0EAA0E;AAC1E,MAAM,qBAAqB,GAAsB;IAC7C,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IACrC,WAAW,EAAE,mBAAmB;CACnC,CAAC;AAEF,2EAA2E;AAC3E,6EAA6E;AAC7E,8DAA8D;AAC9D,iFAAiF;AACpE,QAAA,YAAY,GAA4C;IACjE,gBAAgB,EAAE,EAAE;IACpB,iBAAiB,EAAE,EAAE;IACrB,gBAAgB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;IAChC,kBAAkB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACjC,qBAAqB,EAAE,EAAE;IACzB,yBAAyB,EAAE,EAAE;IAC7B,gBAAgB,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;IACzC,qBAAqB,EAAE,EAAE;IACzB,yBAAyB,EAAE,EAAE;IAC7B,uBAAuB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IACvC,uBAAuB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IACvC,sBAAsB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;IAChG,sBAAsB,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IACtB,mCAAmC,EAAE,EAAE;IACvC,qBAAqB,EAAE,EAAE;IACzB,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IAC3B,oBAAoB,EAAE;QAClB,IAAI,EAAE,IAAI;QACV,gBAAgB,EAAE,CAAC,eAAe,CAAC;QACnC,YAAY,EAAE,CAAC,GAAG,qBAAqB,CAAC;KAC3C;IACD,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;IAC9B,uBAAuB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,sCAAsC,EAAE;IAChG,mBAAmB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"default-rules.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/default-rules.ts"],"names":[],"mappings":";;;AAAA,2DAA2D;AAC3D,4EAA4E;AAC5E,kEA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BAAyB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IACzC,kBAAkB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IAClC,uBAAuB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;CAC1C,CAAC;AAEW,QAAA,eAAe,GAAsB,EAAE,CAAC","sourcesContent":["// Default holistic exclude list for the validate-ts-in-src\n// rules. Bare names match a directory segment at any depth; globs match the\n// workspace-relative path. `**/*.d.ts` (ambient declarations) and\n// `**/jest.config.ts` legitimately live outside src/ and are exempt here.\nconst DEFAULT_EXCLUDE_PATHS: readonly string[] = [\n 'node_modules', 'dist', '.nx', '.git',\n '**/*.d.ts', '**/jest.config.ts',\n];\n\n// On/off is driven by `mode` (\"OFF\" disables; an absent mode leaves a rule\n// on). Code-rules entries omit `mode` so each executor keeps its own default\n// scope; simple on/off rules declare `mode: 'ON'` explicitly.\n// webpieces-disable no-any-unknown -- rule options are opaque at framework level\nexport const defaultRules: Record<string, Record<string, unknown>> = {\n 'no-any-unknown': {},\n 'no-implicit-any': {},\n 'max-file-lines': { limit: 900 },\n 'max-method-lines': { limit: 80 },\n 'require-return-type': {},\n 'no-inline-type-literals': {},\n 'no-destructure': { allowTopLevel: true },\n 'catch-error-pattern': {},\n 'no-unmanaged-exceptions': {},\n 'no-shell-substitution': { mode: 'ON' },\n 'no-file-import-cycles': { mode: 'ON' },\n 'runtime-architecture': { mode: 'ON', servicePaths: [], apiProjectPaths: [], allowedCycles: [] },\n 'prisma-validate-dtos': {},\n 'prisma-converter': {},\n 'angular-no-direct-api-in-resolver': {},\n 'no-symbol-di-tokens': {},\n 'nx-wiring': { mode: 'ON' },\n 'validate-ts-in-src': {\n mode: 'ON',\n allowedRootFiles: ['jest.setup.ts'],\n excludePaths: [...DEFAULT_EXCLUDE_PATHS],\n },\n 'no-js-files': { mode: 'OFF' },\n 'branch-creation-guard': { mode: 'ON', subBranchNaming: 'feature/<ticket>/<short-description>' },\n 'pr-creation-guard': { mode: 'ON' },\n 'merge-in-progress-guard': { mode: 'ON' },\n 'pr-merge-cleanup': { mode: 'ON' },\n 'no-direct-main-update': { mode: 'ON' },\n};\n\nexport const defaultRulesDir: readonly string[] = [];\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -11,5 +11,7 @@ export { FieldDef } from './field-def';
|
|
|
11
11
|
export type { SchemaShape } from './field-def';
|
|
12
12
|
export { shouldSkipRule, getCurrentBranch } from './skip-rule';
|
|
13
13
|
export type { SkipRuleResult } from './skip-rule';
|
|
14
|
+
export { WEBPIECES_DISABLE, RULE_NAMES, hasDisable, WEBPIECES_TMP_DIR, MERGE_DIR_PREFIX, MERGE_IN_PROGRESS_FILE, } from './constants';
|
|
14
15
|
export { WebpiecesRulesConfig } from './WebpiecesRulesConfig';
|
|
15
|
-
export { MaxMethodLinesConfig, MaxFileLinesConfig, RequireReturnTypeConfig, NoInlineTypeLiteralsConfig, NoAnyUnknownConfig, NoImplicitAnyConfig, PrismaValidateDtosConfig, PrismaConverterConfig, NoDestructureConfig, NoUnmanagedExceptionsConfig, CatchErrorPatternConfig, ThrowCauseRequiredConfig, AngularNoDirectApiInResolverConfig, NoSymbolDiTokensConfig, NoShellSubstitutionConfig, BranchCreationGuardConfig, PrCreationGuardConfig, PrMergeCleanupConfig, NoDirectMainUpdateConfig, NoEditOnMainConfig, NoFileImportCyclesConfig, RuntimeArchitectureConfig, NoJsFilesConfig, ValidateTsInSrcConfig, } from './rule-configs';
|
|
16
|
+
export { MaxMethodLinesConfig, MaxFileLinesConfig, RequireReturnTypeConfig, NoInlineTypeLiteralsConfig, NoAnyUnknownConfig, NoImplicitAnyConfig, PrismaValidateDtosConfig, PrismaConverterConfig, NoDestructureConfig, NoUnmanagedExceptionsConfig, CatchErrorPatternConfig, ThrowCauseRequiredConfig, AngularNoDirectApiInResolverConfig, NoSymbolDiTokensConfig, NoShellSubstitutionConfig, BranchCreationGuardConfig, PrCreationGuardConfig, MergeInProgressGuardConfig, PrMergeCleanupConfig, NoDirectMainUpdateConfig, NoEditOnMainConfig, NoFileImportCyclesConfig, RuntimeArchitectureConfig, NoJsFilesConfig, ValidateTsInSrcConfig, } from './rule-configs';
|
|
17
|
+
export { GateDefinition, PrGateConfig, defaultGates, defaultPrGateConfig, loadPrGateConfig, } from './pr-gate-config';
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.NoEditOnMainConfig = exports.NoDirectMainUpdateConfig = exports.PrMergeCleanupConfig = exports.PrCreationGuardConfig = exports.BranchCreationGuardConfig = exports.NoShellSubstitutionConfig = exports.NoSymbolDiTokensConfig = exports.AngularNoDirectApiInResolverConfig = exports.ThrowCauseRequiredConfig = exports.CatchErrorPatternConfig = exports.NoUnmanagedExceptionsConfig = exports.NoDestructureConfig = exports.PrismaConverterConfig = exports.PrismaValidateDtosConfig = exports.NoImplicitAnyConfig = exports.NoAnyUnknownConfig = exports.NoInlineTypeLiteralsConfig = exports.RequireReturnTypeConfig = exports.MaxFileLinesConfig = exports.MaxMethodLinesConfig = exports.WebpiecesRulesConfig = exports.getCurrentBranch = exports.shouldSkipRule = exports.FieldDef = exports.validateWebpiecesConfig = exports.writeTemplate = exports.writeTemplateIfMissing = exports.loadTemplate = exports.defaultRulesDir = exports.defaultRules = exports.isPathExcluded = exports.loadWebpiecesRulesConfig = exports.CONFIG_FILENAME = exports.findConfigFile = exports.loadConfig = exports.toError = exports.InformAiError = exports.ResolvedRuleConfig = exports.ResolvedConfig = void 0;
|
|
3
|
+
exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.NoEditOnMainConfig = exports.NoDirectMainUpdateConfig = exports.PrMergeCleanupConfig = exports.MergeInProgressGuardConfig = exports.PrCreationGuardConfig = exports.BranchCreationGuardConfig = exports.NoShellSubstitutionConfig = exports.NoSymbolDiTokensConfig = exports.AngularNoDirectApiInResolverConfig = exports.ThrowCauseRequiredConfig = exports.CatchErrorPatternConfig = exports.NoUnmanagedExceptionsConfig = exports.NoDestructureConfig = exports.PrismaConverterConfig = exports.PrismaValidateDtosConfig = exports.NoImplicitAnyConfig = exports.NoAnyUnknownConfig = exports.NoInlineTypeLiteralsConfig = exports.RequireReturnTypeConfig = exports.MaxFileLinesConfig = exports.MaxMethodLinesConfig = exports.WebpiecesRulesConfig = exports.MERGE_IN_PROGRESS_FILE = exports.MERGE_DIR_PREFIX = exports.WEBPIECES_TMP_DIR = exports.hasDisable = exports.RULE_NAMES = exports.WEBPIECES_DISABLE = exports.getCurrentBranch = exports.shouldSkipRule = exports.FieldDef = exports.validateWebpiecesConfig = exports.writeTemplate = exports.writeTemplateIfMissing = exports.loadTemplate = exports.defaultRulesDir = exports.defaultRules = exports.isPathExcluded = exports.loadWebpiecesRulesConfig = exports.CONFIG_FILENAME = exports.findConfigFile = exports.loadConfig = exports.toError = exports.InformAiError = exports.ResolvedRuleConfig = exports.ResolvedConfig = void 0;
|
|
4
|
+
exports.loadPrGateConfig = exports.defaultPrGateConfig = exports.defaultGates = exports.PrGateConfig = exports.GateDefinition = void 0;
|
|
4
5
|
var types_1 = require("./types");
|
|
5
6
|
Object.defineProperty(exports, "ResolvedConfig", { enumerable: true, get: function () { return types_1.ResolvedConfig; } });
|
|
6
7
|
Object.defineProperty(exports, "ResolvedRuleConfig", { enumerable: true, get: function () { return types_1.ResolvedRuleConfig; } });
|
|
@@ -29,6 +30,13 @@ Object.defineProperty(exports, "FieldDef", { enumerable: true, get: function ()
|
|
|
29
30
|
var skip_rule_1 = require("./skip-rule");
|
|
30
31
|
Object.defineProperty(exports, "shouldSkipRule", { enumerable: true, get: function () { return skip_rule_1.shouldSkipRule; } });
|
|
31
32
|
Object.defineProperty(exports, "getCurrentBranch", { enumerable: true, get: function () { return skip_rule_1.getCurrentBranch; } });
|
|
33
|
+
var constants_1 = require("./constants");
|
|
34
|
+
Object.defineProperty(exports, "WEBPIECES_DISABLE", { enumerable: true, get: function () { return constants_1.WEBPIECES_DISABLE; } });
|
|
35
|
+
Object.defineProperty(exports, "RULE_NAMES", { enumerable: true, get: function () { return constants_1.RULE_NAMES; } });
|
|
36
|
+
Object.defineProperty(exports, "hasDisable", { enumerable: true, get: function () { return constants_1.hasDisable; } });
|
|
37
|
+
Object.defineProperty(exports, "WEBPIECES_TMP_DIR", { enumerable: true, get: function () { return constants_1.WEBPIECES_TMP_DIR; } });
|
|
38
|
+
Object.defineProperty(exports, "MERGE_DIR_PREFIX", { enumerable: true, get: function () { return constants_1.MERGE_DIR_PREFIX; } });
|
|
39
|
+
Object.defineProperty(exports, "MERGE_IN_PROGRESS_FILE", { enumerable: true, get: function () { return constants_1.MERGE_IN_PROGRESS_FILE; } });
|
|
32
40
|
var WebpiecesRulesConfig_1 = require("./WebpiecesRulesConfig");
|
|
33
41
|
Object.defineProperty(exports, "WebpiecesRulesConfig", { enumerable: true, get: function () { return WebpiecesRulesConfig_1.WebpiecesRulesConfig; } });
|
|
34
42
|
var rule_configs_1 = require("./rule-configs");
|
|
@@ -49,6 +57,7 @@ Object.defineProperty(exports, "NoSymbolDiTokensConfig", { enumerable: true, get
|
|
|
49
57
|
Object.defineProperty(exports, "NoShellSubstitutionConfig", { enumerable: true, get: function () { return rule_configs_1.NoShellSubstitutionConfig; } });
|
|
50
58
|
Object.defineProperty(exports, "BranchCreationGuardConfig", { enumerable: true, get: function () { return rule_configs_1.BranchCreationGuardConfig; } });
|
|
51
59
|
Object.defineProperty(exports, "PrCreationGuardConfig", { enumerable: true, get: function () { return rule_configs_1.PrCreationGuardConfig; } });
|
|
60
|
+
Object.defineProperty(exports, "MergeInProgressGuardConfig", { enumerable: true, get: function () { return rule_configs_1.MergeInProgressGuardConfig; } });
|
|
52
61
|
Object.defineProperty(exports, "PrMergeCleanupConfig", { enumerable: true, get: function () { return rule_configs_1.PrMergeCleanupConfig; } });
|
|
53
62
|
Object.defineProperty(exports, "NoDirectMainUpdateConfig", { enumerable: true, get: function () { return rule_configs_1.NoDirectMainUpdateConfig; } });
|
|
54
63
|
Object.defineProperty(exports, "NoEditOnMainConfig", { enumerable: true, get: function () { return rule_configs_1.NoEditOnMainConfig; } });
|
|
@@ -56,4 +65,10 @@ Object.defineProperty(exports, "NoFileImportCyclesConfig", { enumerable: true, g
|
|
|
56
65
|
Object.defineProperty(exports, "RuntimeArchitectureConfig", { enumerable: true, get: function () { return rule_configs_1.RuntimeArchitectureConfig; } });
|
|
57
66
|
Object.defineProperty(exports, "NoJsFilesConfig", { enumerable: true, get: function () { return rule_configs_1.NoJsFilesConfig; } });
|
|
58
67
|
Object.defineProperty(exports, "ValidateTsInSrcConfig", { enumerable: true, get: function () { return rule_configs_1.ValidateTsInSrcConfig; } });
|
|
68
|
+
var pr_gate_config_1 = require("./pr-gate-config");
|
|
69
|
+
Object.defineProperty(exports, "GateDefinition", { enumerable: true, get: function () { return pr_gate_config_1.GateDefinition; } });
|
|
70
|
+
Object.defineProperty(exports, "PrGateConfig", { enumerable: true, get: function () { return pr_gate_config_1.PrGateConfig; } });
|
|
71
|
+
Object.defineProperty(exports, "defaultGates", { enumerable: true, get: function () { return pr_gate_config_1.defaultGates; } });
|
|
72
|
+
Object.defineProperty(exports, "defaultPrGateConfig", { enumerable: true, get: function () { return pr_gate_config_1.defaultPrGateConfig; } });
|
|
73
|
+
Object.defineProperty(exports, "loadPrGateConfig", { enumerable: true, get: function () { return pr_gate_config_1.loadPrGateConfig; } });
|
|
59
74
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.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A,kCAAkC,OAAA;AAClC,sHAAA,sBAAsB,OAAA;AACtB,yHAAA,yBAAyB,OAAA;AACzB,yHAAA,yBAAyB,OAAA;AACzB,qHAAA,qBAAqB,OAAA;AACrB,0HAAA,0BAA0B,OAAA;AAC1B,oHAAA,oBAAoB,OAAA;AACpB,wHAAA,wBAAwB,OAAA;AACxB,kHAAA,kBAAkB,OAAA;AAClB,wHAAA,wBAAwB,OAAA;AACxB,yHAAA,yBAAyB,OAAA;AACzB,+GAAA,eAAe,OAAA;AACf,qHAAA,qBAAqB,OAAA;AAEzB,mDAM0B;AALtB,gHAAA,cAAc,OAAA;AACd,8GAAA,YAAY,OAAA;AACZ,8GAAA,YAAY,OAAA;AACZ,qHAAA,mBAAmB,OAAA;AACnB,kHAAA,gBAAgB,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\nexport { InformAiError } from './inform-ai-error';\nexport { toError } from './to-error';\nexport { loadConfig, findConfigFile, CONFIG_FILENAME, loadWebpiecesRulesConfig } from './load-config';\nexport type { LoadedWebpiecesConfig } from './load-config';\nexport { isPathExcluded } from './exclude-paths';\nexport { defaultRules, defaultRulesDir } from './default-rules';\nexport { loadTemplate, writeTemplateIfMissing, writeTemplate } from './load-template';\nexport { validateWebpiecesConfig } from './validate-config';\nexport { FieldDef } from './field-def';\nexport type { SchemaShape } from './field-def';\nexport { shouldSkipRule, getCurrentBranch } from './skip-rule';\nexport type { SkipRuleResult } from './skip-rule';\nexport {\n WEBPIECES_DISABLE,\n RULE_NAMES,\n hasDisable,\n WEBPIECES_TMP_DIR,\n MERGE_DIR_PREFIX,\n MERGE_IN_PROGRESS_FILE,\n} from './constants';\nexport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nexport {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoShellSubstitutionConfig,\n BranchCreationGuardConfig,\n PrCreationGuardConfig,\n MergeInProgressGuardConfig,\n PrMergeCleanupConfig,\n NoDirectMainUpdateConfig,\n NoEditOnMainConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n} from './rule-configs';\nexport {\n GateDefinition,\n PrGateConfig,\n defaultGates,\n defaultPrGateConfig,\n loadPrGateConfig,\n} from './pr-gate-config';\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class GateDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
patterns: string[];
|
|
4
|
+
severity: string;
|
|
5
|
+
constructor(name: string, patterns: string[], severity: string);
|
|
6
|
+
}
|
|
7
|
+
export declare class PrGateConfig {
|
|
8
|
+
mode: string;
|
|
9
|
+
buildCommand: string;
|
|
10
|
+
gates: GateDefinition[];
|
|
11
|
+
constructor(mode: string, buildCommand: string, gates: GateDefinition[]);
|
|
12
|
+
}
|
|
13
|
+
export declare function defaultGates(): GateDefinition[];
|
|
14
|
+
export declare function defaultPrGateConfig(): PrGateConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Load the `pr-gate` section from webpieces.config.json, falling back to defaults for any
|
|
17
|
+
* field the consumer omits. Returns defaults entirely if no config file is found.
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadPrGateConfig(cwd: string): PrGateConfig;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrGateConfig = exports.GateDefinition = void 0;
|
|
4
|
+
exports.defaultGates = defaultGates;
|
|
5
|
+
exports.defaultPrGateConfig = defaultPrGateConfig;
|
|
6
|
+
exports.loadPrGateConfig = loadPrGateConfig;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
9
|
+
const load_config_1 = require("./load-config");
|
|
10
|
+
// PrGateConfig is the "special section" for the pr-gate dashboard. It does NOT live in the
|
|
11
|
+
// validated `rules` map (the FieldDef schema can't express nested object arrays), but as a
|
|
12
|
+
// top-level `pr-gate` key in webpieces.config.json. Loaded by loadPrGateConfig with defaults.
|
|
13
|
+
class GateDefinition {
|
|
14
|
+
name;
|
|
15
|
+
patterns;
|
|
16
|
+
severity; // 'warn' (yellow) | 'block' (red, fails the gate)
|
|
17
|
+
constructor(name, patterns, severity) {
|
|
18
|
+
this.name = name;
|
|
19
|
+
this.patterns = patterns;
|
|
20
|
+
this.severity = severity;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.GateDefinition = GateDefinition;
|
|
24
|
+
class PrGateConfig {
|
|
25
|
+
mode;
|
|
26
|
+
buildCommand;
|
|
27
|
+
gates;
|
|
28
|
+
constructor(mode, buildCommand, gates) {
|
|
29
|
+
this.mode = mode;
|
|
30
|
+
this.buildCommand = buildCommand;
|
|
31
|
+
this.gates = gates;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.PrGateConfig = PrGateConfig;
|
|
35
|
+
// Default infra gates — path-pattern based, tuned for this monorepo. Clients override the
|
|
36
|
+
// whole list via the `pr-gate.gates` array in webpieces.config.json.
|
|
37
|
+
function defaultGates() {
|
|
38
|
+
return [
|
|
39
|
+
new GateDefinition('API Changed', ['libraries/apis/**', '**/*Api.ts'], 'warn'),
|
|
40
|
+
new GateDefinition('Config Files Changed', ['**/package.json', '**/tsconfig*.json', 'nx.json', '**/*.config.*'], 'warn'),
|
|
41
|
+
new GateDefinition('Dependency Graph Changed', ['architecture/dependencies.json'], 'warn'),
|
|
42
|
+
new GateDefinition('Claude / Rules Changed', ['**/CLAUDE.md', '**/claude.*.md', '.claude/**', 'webpieces.config.json'], 'warn'),
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
function defaultPrGateConfig() {
|
|
46
|
+
return new PrGateConfig('ON', '', defaultGates());
|
|
47
|
+
}
|
|
48
|
+
function toGate(raw) {
|
|
49
|
+
return new GateDefinition(raw.name ?? '', raw.patterns ?? [], raw.severity ?? 'warn');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Load the `pr-gate` section from webpieces.config.json, falling back to defaults for any
|
|
53
|
+
* field the consumer omits. Returns defaults entirely if no config file is found.
|
|
54
|
+
*/
|
|
55
|
+
function loadPrGateConfig(cwd) {
|
|
56
|
+
const defaults = defaultPrGateConfig();
|
|
57
|
+
const configPath = (0, load_config_1.findConfigFile)(cwd);
|
|
58
|
+
if (!configPath)
|
|
59
|
+
return defaults;
|
|
60
|
+
const parsed = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
61
|
+
const section = parsed['pr-gate'];
|
|
62
|
+
if (!section)
|
|
63
|
+
return defaults;
|
|
64
|
+
const mode = section.mode ?? defaults.mode;
|
|
65
|
+
const buildCommand = section.buildCommand ?? defaults.buildCommand;
|
|
66
|
+
const gates = section.gates !== undefined ? section.gates.map(toGate) : defaults.gates;
|
|
67
|
+
return new PrGateConfig(mode, buildCommand, gates);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=pr-gate-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-gate-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/pr-gate-config.ts"],"names":[],"mappings":";;;AAiCA,oCAOC;AAED,kDAEC;AA2BD,4CAaC;;AApFD,+CAAyB;AACzB,+CAA+C;AAE/C,2FAA2F;AAC3F,2FAA2F;AAC3F,8FAA8F;AAE9F,MAAa,cAAc;IACvB,IAAI,CAAS;IACb,QAAQ,CAAW;IACnB,QAAQ,CAAS,CAAC,kDAAkD;IAEpE,YAAY,IAAY,EAAE,QAAkB,EAAE,QAAgB;QAC1D,IAA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B,gBAAgB,CAAC,GAAW;IACxC,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IACvC,MAAM,UAAU,GAAG,IAAA,4BAAc,EAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,UAAU;QAAE,OAAO,QAAQ,CAAC;IAEjC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAwB,CAAC;IACtF,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,CAAC,OAAO;QAAE,OAAO,QAAQ,CAAC;IAE9B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC;IAC3C,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,QAAQ,CAAC,YAAY,CAAC;IACnE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;IACvF,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import * as fs from 'fs';\nimport { findConfigFile } from './load-config';\n\n// PrGateConfig is the \"special section\" for the pr-gate dashboard. It does NOT live in the\n// validated `rules` map (the FieldDef schema can't express nested object arrays), but as a\n// top-level `pr-gate` key in webpieces.config.json. Loaded by loadPrGateConfig with defaults.\n\nexport class GateDefinition {\n name: string;\n patterns: string[];\n severity: string; // 'warn' (yellow) | 'block' (red, fails the gate)\n\n constructor(name: string, patterns: string[], severity: string) {\n this.name = name;\n this.patterns = patterns;\n this.severity = severity;\n }\n}\n\nexport class PrGateConfig {\n mode: string;\n buildCommand: string;\n gates: GateDefinition[];\n\n constructor(mode: string, buildCommand: string, gates: GateDefinition[]) {\n this.mode = mode;\n this.buildCommand = buildCommand;\n this.gates = gates;\n }\n}\n\n// Default infra gates — path-pattern based, tuned for this monorepo. Clients override the\n// whole list via the `pr-gate.gates` array in webpieces.config.json.\nexport function defaultGates(): GateDefinition[] {\n return [\n new GateDefinition('API Changed', ['libraries/apis/**', '**/*Api.ts'], 'warn'),\n new GateDefinition('Config Files Changed', ['**/package.json', '**/tsconfig*.json', 'nx.json', '**/*.config.*'], 'warn'),\n new GateDefinition('Dependency Graph Changed', ['architecture/dependencies.json'], 'warn'),\n new GateDefinition('Claude / Rules Changed', ['**/CLAUDE.md', '**/claude.*.md', '.claude/**', 'webpieces.config.json'], 'warn'),\n ];\n}\n\nexport function defaultPrGateConfig(): PrGateConfig {\n return new PrGateConfig('ON', '', defaultGates());\n}\n\ninterface RawGate {\n name?: string;\n patterns?: string[];\n severity?: string;\n}\n\ninterface RawPrGateSection {\n mode?: string;\n buildCommand?: string;\n gates?: RawGate[];\n}\n\n// webpieces-disable no-any-unknown -- consumer JSON config has opaque shape until narrowed\ninterface RawConfigWithPrGate {\n 'pr-gate'?: RawPrGateSection;\n}\n\nfunction toGate(raw: RawGate): GateDefinition {\n return new GateDefinition(raw.name ?? '', raw.patterns ?? [], raw.severity ?? 'warn');\n}\n\n/**\n * Load the `pr-gate` section from webpieces.config.json, falling back to defaults for any\n * field the consumer omits. Returns defaults entirely if no config file is found.\n */\nexport function loadPrGateConfig(cwd: string): PrGateConfig {\n const defaults = defaultPrGateConfig();\n const configPath = findConfigFile(cwd);\n if (!configPath) return defaults;\n\n const parsed = JSON.parse(fs.readFileSync(configPath, 'utf8')) as RawConfigWithPrGate;\n const section = parsed['pr-gate'];\n if (!section) return defaults;\n\n const mode = section.mode ?? defaults.mode;\n const buildCommand = section.buildCommand ?? defaults.buildCommand;\n const gates = section.gates !== undefined ? section.gates.map(toGate) : defaults.gates;\n return new PrGateConfig(mode, buildCommand, gates);\n}\n"]}
|
package/src/rule-configs.d.ts
CHANGED
|
@@ -120,10 +120,12 @@ export declare class BranchCreationGuardConfig extends BaseRuleConfig {
|
|
|
120
120
|
}
|
|
121
121
|
export declare class PrCreationGuardConfig extends BaseRuleConfig {
|
|
122
122
|
mode?: OnOffMode;
|
|
123
|
-
buildCommand?: string;
|
|
124
|
-
requireTextInPr?: string;
|
|
125
123
|
static readonly SCHEMA: SchemaShape<PrCreationGuardConfig>;
|
|
126
124
|
}
|
|
125
|
+
export declare class MergeInProgressGuardConfig extends BaseRuleConfig {
|
|
126
|
+
mode?: OnOffMode;
|
|
127
|
+
static readonly SCHEMA: SchemaShape<MergeInProgressGuardConfig>;
|
|
128
|
+
}
|
|
127
129
|
export declare class PrMergeCleanupConfig extends BaseRuleConfig {
|
|
128
130
|
mode?: OnOffMode;
|
|
129
131
|
static readonly SCHEMA: SchemaShape<PrMergeCleanupConfig>;
|
package/src/rule-configs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.NoEditOnMainConfig = exports.NoDirectMainUpdateConfig = exports.PrMergeCleanupConfig = exports.PrCreationGuardConfig = exports.BranchCreationGuardConfig = exports.NoShellSubstitutionConfig = exports.NoSymbolDiTokensConfig = exports.AngularNoDirectApiInResolverConfig = exports.ThrowCauseRequiredConfig = exports.CatchErrorPatternConfig = exports.NoUnmanagedExceptionsConfig = exports.NoDestructureConfig = exports.PrismaConverterConfig = exports.PrismaValidateDtosConfig = exports.NoImplicitAnyConfig = exports.NoAnyUnknownConfig = exports.NoInlineTypeLiteralsConfig = exports.RequireReturnTypeConfig = exports.MaxFileLinesConfig = exports.MaxMethodLinesConfig = exports.BASE_RULE_SCHEMA = exports.BaseRuleConfig = void 0;
|
|
3
|
+
exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.NoEditOnMainConfig = exports.NoDirectMainUpdateConfig = exports.PrMergeCleanupConfig = exports.MergeInProgressGuardConfig = exports.PrCreationGuardConfig = exports.BranchCreationGuardConfig = exports.NoShellSubstitutionConfig = exports.NoSymbolDiTokensConfig = exports.AngularNoDirectApiInResolverConfig = exports.ThrowCauseRequiredConfig = exports.CatchErrorPatternConfig = exports.NoUnmanagedExceptionsConfig = exports.NoDestructureConfig = exports.PrismaConverterConfig = exports.PrismaValidateDtosConfig = exports.NoImplicitAnyConfig = exports.NoAnyUnknownConfig = exports.NoInlineTypeLiteralsConfig = exports.RequireReturnTypeConfig = exports.MaxFileLinesConfig = exports.MaxMethodLinesConfig = exports.BASE_RULE_SCHEMA = exports.BaseRuleConfig = void 0;
|
|
4
4
|
const field_def_1 = require("./field-def");
|
|
5
5
|
// Mode const arrays — TypeScript union types derived from them, and FieldDef enum
|
|
6
6
|
// values reference the same array. Impossible for the type and runtime check to diverge.
|
|
@@ -212,16 +212,20 @@ class BranchCreationGuardConfig extends BaseRuleConfig {
|
|
|
212
212
|
exports.BranchCreationGuardConfig = BranchCreationGuardConfig;
|
|
213
213
|
class PrCreationGuardConfig extends BaseRuleConfig {
|
|
214
214
|
mode;
|
|
215
|
-
buildCommand;
|
|
216
|
-
requireTextInPr;
|
|
217
215
|
static SCHEMA = {
|
|
218
216
|
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
219
|
-
buildCommand: field_def_1.FieldDef.optional('string'),
|
|
220
|
-
requireTextInPr: field_def_1.FieldDef.optional('string'),
|
|
221
217
|
...exports.BASE_RULE_SCHEMA,
|
|
222
218
|
};
|
|
223
219
|
}
|
|
224
220
|
exports.PrCreationGuardConfig = PrCreationGuardConfig;
|
|
221
|
+
class MergeInProgressGuardConfig extends BaseRuleConfig {
|
|
222
|
+
mode;
|
|
223
|
+
static SCHEMA = {
|
|
224
|
+
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
225
|
+
...exports.BASE_RULE_SCHEMA,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
exports.MergeInProgressGuardConfig = MergeInProgressGuardConfig;
|
|
225
229
|
class PrMergeCleanupConfig extends BaseRuleConfig {
|
|
226
230
|
mode;
|
|
227
231
|
static SCHEMA = {
|
package/src/rule-configs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-configs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-configs.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAEpD,kFAAkF;AAClF,yFAAyF;AAEzF,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGzG,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,gBAAgB,CAAU,CAAC;AAG5D,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGxG,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGxG,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAGhF,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,CAAU,CAAC;AAG/E,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAG9F,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGlH,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,eAAe,CAAU,CAAC;AAGlE,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,KAAK,CAAU,CAAC;AAG5C,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,gBA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Q,CAAC,QAAQ,EAAE,YAAY,CAAC;QAC1C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,wBAAgB;KACtB,CAAC;;AARN,0CASC;AAED,MAAa,qBAAsB,SAAQ,cAAc;IACrD,IAAI,CAAkB;IACtB,gBAAgB,CAAY;IAC5B,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAAuC;QACzD,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;QAC/C,gBAAgB,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,wBAAgB;KACtB,CAAC;;AAVN,sDAWC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\n\n// Mode const arrays — TypeScript union types derived from them, and FieldDef enum\n// values reference the same array. Impossible for the type and runtime check to diverge.\n\nconst METHOD_LIMIT_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype MethodLimitMode = typeof METHOD_LIMIT_MODES[number];\n\nconst FILE_LIMIT_MODES = ['OFF', 'MODIFIED_FILES'] as const;\ntype FileLimitMode = typeof FILE_LIMIT_MODES[number];\n\nconst RETURN_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype ReturnTypeModeLocal = typeof RETURN_TYPE_MODES[number];\n\nconst INLINE_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype InlineTypeModeLocal = typeof INLINE_TYPE_MODES[number];\n\nconst MODIFIED_CODE_MODES = ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'] as const;\ntype ModifiedCodeMode = typeof MODIFIED_CODE_MODES[number];\n\nconst PRISMA_DTOS_MODES = ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'] as const;\ntype PrismaValidateDtosMode = typeof PRISMA_DTOS_MODES[number];\n\nconst PRISMA_CONVERTER_MODES = ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype PrismaConverterModeLocal = typeof PRISMA_CONVERTER_MODES[number];\n\nconst DIRECT_API_RESOLVER_MODES = ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype DirectApiResolverMode = typeof DIRECT_API_RESOLVER_MODES[number];\n\nconst THROW_CAUSE_MODES = ['ON', 'OFF', 'MODIFIED_CODE'] as const;\ntype ThrowCauseModeLocal = typeof THROW_CAUSE_MODES[number];\n\nconst ON_OFF_MODES = ['ON', 'OFF'] as const;\ntype OnOffMode = typeof ON_OFF_MODES[number];\n\nconst VALIDATE_TS_MODES = ['ON', 'OFF', 'MODIFIED_FILES'] as const;\ntype ValidateTsMode = typeof VALIDATE_TS_MODES[number];\n\n// ---------------------------------------------------------------------------\n// Universal escape hatches — EVERY rule supports temporarily disabling itself\n// either while on a named git branch (ignoreRuleWhileOnBranch) or until an\n// epoch passes (ignoreModifiedUntilEpoch). Both are optional. They live on a\n// shared base class so the two fields (and their schema entries) are declared\n// once instead of repeated per rule. `mode` stays per-rule because its allowed\n// values vary (ON/OFF vs MODIFIED_CODE vs NEW_AND_MODIFIED_METHODS, etc).\n// ---------------------------------------------------------------------------\nexport abstract class BaseRuleConfig {\n ignoreModifiedUntilEpoch?: number;\n ignoreRuleWhileOnBranch?: string;\n}\n\nexport const BASE_RULE_SCHEMA = {\n ignoreModifiedUntilEpoch: FieldDef.optional('number'),\n ignoreRuleWhileOnBranch: FieldDef.optional('string'),\n};\n\nexport class MaxMethodLinesConfig extends BaseRuleConfig {\n mode?: MethodLimitMode;\n limit?: number;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<MaxMethodLinesConfig> = {\n mode: new FieldDef('string', METHOD_LIMIT_MODES),\n limit: FieldDef.optional('number'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class MaxFileLinesConfig extends BaseRuleConfig {\n mode?: FileLimitMode;\n limit?: number;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<MaxFileLinesConfig> = {\n mode: new FieldDef('string', FILE_LIMIT_MODES),\n limit: FieldDef.optional('number'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class RequireReturnTypeConfig extends BaseRuleConfig {\n mode?: ReturnTypeModeLocal;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<RequireReturnTypeConfig> = {\n mode: new FieldDef('string', RETURN_TYPE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoInlineTypeLiteralsConfig extends BaseRuleConfig {\n mode?: InlineTypeModeLocal;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoInlineTypeLiteralsConfig> = {\n mode: new FieldDef('string', INLINE_TYPE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoAnyUnknownConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoAnyUnknownConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoImplicitAnyConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoImplicitAnyConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrismaValidateDtosConfig extends BaseRuleConfig {\n mode?: PrismaValidateDtosMode;\n disableAllowed?: boolean;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<PrismaValidateDtosConfig> = {\n mode: new FieldDef('string', PRISMA_DTOS_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n prismaSchemaPath: FieldDef.optional('string'),\n dtoSourcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrismaConverterConfig extends BaseRuleConfig {\n mode?: PrismaConverterModeLocal;\n disableAllowed?: boolean;\n schemaPath?: string;\n convertersPaths?: string[];\n enforcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<PrismaConverterConfig> = {\n mode: new FieldDef('string', PRISMA_CONVERTER_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n schemaPath: FieldDef.optional('string'),\n convertersPaths: FieldDef.optional('string[]'),\n enforcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoDestructureConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n allowTopLevel?: boolean;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoDestructureConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n allowTopLevel: FieldDef.optional('boolean'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoUnmanagedExceptionsConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoUnmanagedExceptionsConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class CatchErrorPatternConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<CatchErrorPatternConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ThrowCauseRequiredConfig extends BaseRuleConfig {\n mode?: ThrowCauseModeLocal;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<ThrowCauseRequiredConfig> = {\n mode: new FieldDef('string', THROW_CAUSE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class AngularNoDirectApiInResolverConfig extends BaseRuleConfig {\n mode?: DirectApiResolverMode;\n disableAllowed?: boolean;\n enforcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<AngularNoDirectApiInResolverConfig> = {\n mode: new FieldDef('string', DIRECT_API_RESOLVER_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n enforcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoSymbolDiTokensConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoSymbolDiTokensConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoShellSubstitutionConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<NoShellSubstitutionConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class BranchCreationGuardConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n subBranchNaming?: string;\n\n static readonly SCHEMA: SchemaShape<BranchCreationGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n subBranchNaming: FieldDef.optional('string'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrCreationGuardConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n buildCommand?: string;\n requireTextInPr?: string;\n\n static readonly SCHEMA: SchemaShape<PrCreationGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n buildCommand: FieldDef.optional('string'),\n requireTextInPr: FieldDef.optional('string'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrMergeCleanupConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<PrMergeCleanupConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoDirectMainUpdateConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<NoDirectMainUpdateConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoEditOnMainConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n branchNamingConvention?: string;\n\n static readonly SCHEMA: SchemaShape<NoEditOnMainConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n branchNamingConvention: FieldDef.optional('string'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoFileImportCyclesConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n ignoreTypeOnly?: boolean;\n excludePackages?: string[];\n\n static readonly SCHEMA: SchemaShape<NoFileImportCyclesConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ignoreTypeOnly: FieldDef.optional('boolean'),\n excludePackages: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class RuntimeArchitectureConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n servicePaths?: string[];\n apiProjectPaths?: string[];\n allowedCycles?: string[];\n\n static readonly SCHEMA: SchemaShape<RuntimeArchitectureConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n servicePaths: FieldDef.optional('string[]'),\n apiProjectPaths: FieldDef.optional('string[]'),\n allowedCycles: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoJsFilesConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoJsFilesConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ValidateTsInSrcConfig extends BaseRuleConfig {\n mode?: ValidateTsMode;\n allowedRootFiles?: string[];\n excludePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<ValidateTsInSrcConfig> = {\n mode: new FieldDef('string', VALIDATE_TS_MODES),\n allowedRootFiles: FieldDef.optional('string[]'),\n excludePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rule-configs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-configs.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAEpD,kFAAkF;AAClF,yFAAyF;AAEzF,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGzG,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,gBAAgB,CAAU,CAAC;AAG5D,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGxG,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGxG,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAGhF,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,CAAU,CAAC;AAG/E,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAG9F,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,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Ae,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC9C,aAAa,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC5C,GAAG,wBAAgB;KACtB,CAAC;;AAZN,8DAaC;AAED,MAAa,eAAgB,SAAQ,cAAc;IAC/C,IAAI,CAAa;IACjB,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAAiC;QACnD,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;QAC1C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,wBAAgB;KACtB,CAAC;;AARN,0CASC;AAED,MAAa,qBAAsB,SAAQ,cAAc;IACrD,IAAI,CAAkB;IACtB,gBAAgB,CAAY;IAC5B,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAAuC;QACzD,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;QAC/C,gBAAgB,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,wBAAgB;KACtB,CAAC;;AAVN,sDAWC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\n\n// Mode const arrays — TypeScript union types derived from them, and FieldDef enum\n// values reference the same array. Impossible for the type and runtime check to diverge.\n\nconst METHOD_LIMIT_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype MethodLimitMode = typeof METHOD_LIMIT_MODES[number];\n\nconst FILE_LIMIT_MODES = ['OFF', 'MODIFIED_FILES'] as const;\ntype FileLimitMode = typeof FILE_LIMIT_MODES[number];\n\nconst RETURN_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype ReturnTypeModeLocal = typeof RETURN_TYPE_MODES[number];\n\nconst INLINE_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype InlineTypeModeLocal = typeof INLINE_TYPE_MODES[number];\n\nconst MODIFIED_CODE_MODES = ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'] as const;\ntype ModifiedCodeMode = typeof MODIFIED_CODE_MODES[number];\n\nconst PRISMA_DTOS_MODES = ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'] as const;\ntype PrismaValidateDtosMode = typeof PRISMA_DTOS_MODES[number];\n\nconst PRISMA_CONVERTER_MODES = ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype PrismaConverterModeLocal = typeof PRISMA_CONVERTER_MODES[number];\n\nconst DIRECT_API_RESOLVER_MODES = ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype DirectApiResolverMode = typeof DIRECT_API_RESOLVER_MODES[number];\n\nconst THROW_CAUSE_MODES = ['ON', 'OFF', 'MODIFIED_CODE'] as const;\ntype ThrowCauseModeLocal = typeof THROW_CAUSE_MODES[number];\n\nconst ON_OFF_MODES = ['ON', 'OFF'] as const;\ntype OnOffMode = typeof ON_OFF_MODES[number];\n\nconst VALIDATE_TS_MODES = ['ON', 'OFF', 'MODIFIED_FILES'] as const;\ntype ValidateTsMode = typeof VALIDATE_TS_MODES[number];\n\n// ---------------------------------------------------------------------------\n// Universal escape hatches — EVERY rule supports temporarily disabling itself\n// either while on a named git branch (ignoreRuleWhileOnBranch) or until an\n// epoch passes (ignoreModifiedUntilEpoch). Both are optional. They live on a\n// shared base class so the two fields (and their schema entries) are declared\n// once instead of repeated per rule. `mode` stays per-rule because its allowed\n// values vary (ON/OFF vs MODIFIED_CODE vs NEW_AND_MODIFIED_METHODS, etc).\n// ---------------------------------------------------------------------------\nexport abstract class BaseRuleConfig {\n ignoreModifiedUntilEpoch?: number;\n ignoreRuleWhileOnBranch?: string;\n}\n\nexport const BASE_RULE_SCHEMA = {\n ignoreModifiedUntilEpoch: FieldDef.optional('number'),\n ignoreRuleWhileOnBranch: FieldDef.optional('string'),\n};\n\nexport class MaxMethodLinesConfig extends BaseRuleConfig {\n mode?: MethodLimitMode;\n limit?: number;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<MaxMethodLinesConfig> = {\n mode: new FieldDef('string', METHOD_LIMIT_MODES),\n limit: FieldDef.optional('number'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class MaxFileLinesConfig extends BaseRuleConfig {\n mode?: FileLimitMode;\n limit?: number;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<MaxFileLinesConfig> = {\n mode: new FieldDef('string', FILE_LIMIT_MODES),\n limit: FieldDef.optional('number'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class RequireReturnTypeConfig extends BaseRuleConfig {\n mode?: ReturnTypeModeLocal;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<RequireReturnTypeConfig> = {\n mode: new FieldDef('string', RETURN_TYPE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoInlineTypeLiteralsConfig extends BaseRuleConfig {\n mode?: InlineTypeModeLocal;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoInlineTypeLiteralsConfig> = {\n mode: new FieldDef('string', INLINE_TYPE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoAnyUnknownConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoAnyUnknownConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoImplicitAnyConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoImplicitAnyConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrismaValidateDtosConfig extends BaseRuleConfig {\n mode?: PrismaValidateDtosMode;\n disableAllowed?: boolean;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<PrismaValidateDtosConfig> = {\n mode: new FieldDef('string', PRISMA_DTOS_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n prismaSchemaPath: FieldDef.optional('string'),\n dtoSourcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrismaConverterConfig extends BaseRuleConfig {\n mode?: PrismaConverterModeLocal;\n disableAllowed?: boolean;\n schemaPath?: string;\n convertersPaths?: string[];\n enforcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<PrismaConverterConfig> = {\n mode: new FieldDef('string', PRISMA_CONVERTER_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n schemaPath: FieldDef.optional('string'),\n convertersPaths: FieldDef.optional('string[]'),\n enforcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoDestructureConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n allowTopLevel?: boolean;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoDestructureConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n allowTopLevel: FieldDef.optional('boolean'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoUnmanagedExceptionsConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoUnmanagedExceptionsConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class CatchErrorPatternConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<CatchErrorPatternConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ThrowCauseRequiredConfig extends BaseRuleConfig {\n mode?: ThrowCauseModeLocal;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<ThrowCauseRequiredConfig> = {\n mode: new FieldDef('string', THROW_CAUSE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class AngularNoDirectApiInResolverConfig extends BaseRuleConfig {\n mode?: DirectApiResolverMode;\n disableAllowed?: boolean;\n enforcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<AngularNoDirectApiInResolverConfig> = {\n mode: new FieldDef('string', DIRECT_API_RESOLVER_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n enforcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoSymbolDiTokensConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoSymbolDiTokensConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoShellSubstitutionConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<NoShellSubstitutionConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class BranchCreationGuardConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n subBranchNaming?: string;\n\n static readonly SCHEMA: SchemaShape<BranchCreationGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n subBranchNaming: FieldDef.optional('string'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrCreationGuardConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<PrCreationGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class MergeInProgressGuardConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<MergeInProgressGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrMergeCleanupConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<PrMergeCleanupConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoDirectMainUpdateConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<NoDirectMainUpdateConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoEditOnMainConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n branchNamingConvention?: string;\n\n static readonly SCHEMA: SchemaShape<NoEditOnMainConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n branchNamingConvention: FieldDef.optional('string'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoFileImportCyclesConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n ignoreTypeOnly?: boolean;\n excludePackages?: string[];\n\n static readonly SCHEMA: SchemaShape<NoFileImportCyclesConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ignoreTypeOnly: FieldDef.optional('boolean'),\n excludePackages: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class RuntimeArchitectureConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n servicePaths?: string[];\n apiProjectPaths?: string[];\n allowedCycles?: string[];\n\n static readonly SCHEMA: SchemaShape<RuntimeArchitectureConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n servicePaths: FieldDef.optional('string[]'),\n apiProjectPaths: FieldDef.optional('string[]'),\n allowedCycles: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoJsFilesConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoJsFilesConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ValidateTsInSrcConfig extends BaseRuleConfig {\n mode?: ValidateTsMode;\n allowedRootFiles?: string[];\n excludePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<ValidateTsInSrcConfig> = {\n mode: new FieldDef('string', VALIDATE_TS_MODES),\n allowedRootFiles: FieldDef.optional('string[]'),\n excludePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|
package/src/validate-config.js
CHANGED
|
@@ -22,6 +22,7 @@ const RULE_SCHEMAS = {
|
|
|
22
22
|
'no-shell-substitution': rule_configs_1.NoShellSubstitutionConfig.SCHEMA,
|
|
23
23
|
'branch-creation-guard': rule_configs_1.BranchCreationGuardConfig.SCHEMA,
|
|
24
24
|
'pr-creation-guard': rule_configs_1.PrCreationGuardConfig.SCHEMA,
|
|
25
|
+
'merge-in-progress-guard': rule_configs_1.MergeInProgressGuardConfig.SCHEMA,
|
|
25
26
|
'pr-merge-cleanup': rule_configs_1.PrMergeCleanupConfig.SCHEMA,
|
|
26
27
|
'no-direct-main-update': rule_configs_1.NoDirectMainUpdateConfig.SCHEMA,
|
|
27
28
|
'no-edit-on-main': rule_configs_1.NoEditOnMainConfig.SCHEMA,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/validate-config.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"validate-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/validate-config.ts"],"names":[],"mappings":";;AA4FA,0DAoCC;AA/HD,iDA0BwB;AAExB,sEAAsE;AACtE,iEAAiE;AACjE,MAAM,YAAY,GAA6C;IAC3D,kBAAkB,EAAE,mCAAoB,CAAC,MAAM;IAC/C,gBAAgB,EAAE,iCAAkB,CAAC,MAAM;IAC3C,qBAAqB,EAAE,sCAAuB,CAAC,MAAM;IACrD,yBAAyB,EAAE,yCAA0B,CAAC,MAAM;IAC5D,gBAAgB,EAAE,iCAAkB,CAAC,MAAM;IAC3C,iBAAiB,EAAE,kCAAmB,CAAC,MAAM;IAC7C,sBAAsB,EAAE,uCAAwB,CAAC,MAAM;IACvD,kBAAkB,EAAE,oCAAqB,CAAC,MAAM;IAChD,gBAAgB,EAAE,kCAAmB,CAAC,MAAM;IAC5C,yBAAyB,EAAE,0CAA2B,CAAC,MAAM;IAC7D,qBAAqB,EAAE,sCAAuB,CAAC,MAAM;IACrD,sBAAsB,EAAE,uCAAwB,CAAC,MAAM;IACvD,mCAAmC,EAAE,iDAAkC,CAAC,MAAM;IAC9E,qBAAqB,EAAE,qCAAsB,CAAC,MAAM;IACpD,uBAAuB,EAAE,wCAAyB,CAAC,MAAM;IACzD,uBAAuB,EAAE,wCAAyB,CAAC,MAAM;IACzD,mBAAmB,EAAE,oCAAqB,CAAC,MAAM;IACjD,yBAAyB,EAAE,yCAA0B,CAAC,MAAM;IAC5D,kBAAkB,EAAE,mCAAoB,CAAC,MAAM;IAC/C,uBAAuB,EAAE,uCAAwB,CAAC,MAAM;IACxD,iBAAiB,EAAE,i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AK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;oBACjE,MAAM,CAAC,IAAI,CAAC,IAAI,QAAQ,MAAM,GAAG,2BAA2B,OAAO,KAAK,GAAG,CAAC,CAAC;YACrF,CAAC;iBAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACxC,MAAM,CAAC,IAAI,CAAC,IAAI,QAAQ,MAAM,GAAG,aAAa,QAAQ,CAAC,IAAI,SAAS,OAAO,KAAK,GAAG,CAAC,CAAC;YACzF,CAAC;iBAAM,IAAI,QAAQ,CAAC,UAAU,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAe,CAAC,EAAE,CAAC;gBAC/E,MAAM,CAAC,IAAI,CAAC,IAAI,QAAQ,MAAM,GAAG,QAAQ,KAAK,mCAAmC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACxH,CAAC;QACL,CAAC;IACL,CAAC;IAED,0EAA0E;IAC1E,gFAAgF;IAChF,mEAAmE;IACnE,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5D,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { FieldDef } from './field-def';\nimport {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoShellSubstitutionConfig,\n BranchCreationGuardConfig,\n PrCreationGuardConfig,\n MergeInProgressGuardConfig,\n PrMergeCleanupConfig,\n NoDirectMainUpdateConfig,\n NoEditOnMainConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n} from './rule-configs';\n\n// Thin lookup table — each entry delegates to the class's own SCHEMA.\n// No field lists here; all schemas live with their config class.\nconst RULE_SCHEMAS: Record<string, Record<string, FieldDef>> = {\n 'max-method-lines': MaxMethodLinesConfig.SCHEMA,\n 'max-file-lines': MaxFileLinesConfig.SCHEMA,\n 'require-return-type': RequireReturnTypeConfig.SCHEMA,\n 'no-inline-type-literals': NoInlineTypeLiteralsConfig.SCHEMA,\n 'no-any-unknown': NoAnyUnknownConfig.SCHEMA,\n 'no-implicit-any': NoImplicitAnyConfig.SCHEMA,\n 'prisma-validate-dtos': PrismaValidateDtosConfig.SCHEMA,\n 'prisma-converter': PrismaConverterConfig.SCHEMA,\n 'no-destructure': NoDestructureConfig.SCHEMA,\n 'no-unmanaged-exceptions': NoUnmanagedExceptionsConfig.SCHEMA,\n 'catch-error-pattern': CatchErrorPatternConfig.SCHEMA,\n 'throw-cause-required': ThrowCauseRequiredConfig.SCHEMA,\n 'angular-no-direct-api-in-resolver': AngularNoDirectApiInResolverConfig.SCHEMA,\n 'no-symbol-di-tokens': NoSymbolDiTokensConfig.SCHEMA,\n 'no-shell-substitution': NoShellSubstitutionConfig.SCHEMA,\n 'branch-creation-guard': BranchCreationGuardConfig.SCHEMA,\n 'pr-creation-guard': PrCreationGuardConfig.SCHEMA,\n 'merge-in-progress-guard': MergeInProgressGuardConfig.SCHEMA,\n 'pr-merge-cleanup': PrMergeCleanupConfig.SCHEMA,\n 'no-direct-main-update': NoDirectMainUpdateConfig.SCHEMA,\n 'no-edit-on-main': NoEditOnMainConfig.SCHEMA,\n 'no-file-import-cycles': NoFileImportCyclesConfig.SCHEMA,\n 'runtime-architecture': RuntimeArchitectureConfig.SCHEMA,\n 'no-js-files': NoJsFilesConfig.SCHEMA,\n 'validate-ts-in-src': ValidateTsInSrcConfig.SCHEMA,\n};\n\nfunction valueHint(def: FieldDef): string {\n return def.enumValues\n ? `\"${def.enumValues.join(' | ')}\"`\n : def.type === 'string[]' ? '[\"<string>\", ...]'\n : def.type === 'number' ? '<number>'\n : def.type === 'boolean' ? '<boolean>'\n : '\"<string>\"';\n}\n\nfunction missingRuleSnippet(ruleName: string, schema: Record<string, FieldDef>): string {\n // Only required fields go in the copy-paste entry. Optional fields (e.g. the\n // universal escape hatches ignoreRuleWhileOnBranch / ignoreModifiedUntilEpoch)\n // are listed separately so the snippet doesn't over-state what's mandatory.\n const fields = Object.keys(schema);\n const required = fields.filter(f => !schema[f].optional);\n const optional = fields.filter(f => schema[f].optional);\n\n const requiredLines = required.map(f => ` \"${f}\": ${valueHint(schema[f])}`);\n let out =\n `[${ruleName}] Not configured in webpieces.config.json. Add this entry to the \"rules\" section\\n` +\n `(choose values appropriate for your project):\\n\\n` +\n ` \"${ruleName}\": {\\n${requiredLines.join(',\\n')}\\n }`;\n\n if (optional.length > 0) {\n const optionalLines = optional.map(f => ` \"${f}\": ${valueHint(schema[f])}`);\n out +=\n `\\n\\nOptional fields you may add to this rule (omit if not needed):\\n` +\n `${optionalLines.join(',\\n')}`;\n }\n return out;\n}\n\n// webpieces-disable no-any-unknown -- rawRules values are opaque JSON; each field is validated individually\nexport function validateWebpiecesConfig(\n rawRules: Record<string, Record<string, unknown>>,\n): string[] {\n const errors: string[] = [];\n\n // Check field-level correctness for rules that are present\n for (const [ruleName, entry] of Object.entries(rawRules)) {\n const schema = RULE_SCHEMAS[ruleName];\n if (!schema) continue; // custom/unknown rule — no schema to validate against\n for (const [key, value] of Object.entries(entry)) {\n const fieldDef = schema[key];\n if (!fieldDef) {\n errors.push(`[${ruleName}] Unknown field \"${key}\". Valid fields: [${Object.keys(schema).join(', ')}]`);\n continue;\n }\n if (fieldDef.type === 'string[]') {\n if (!Array.isArray(value) || !value.every(v => typeof v === 'string'))\n errors.push(`[${ruleName}] \"${key}\" must be string[], got ${typeof value}.`);\n } else if (typeof value !== fieldDef.type) {\n errors.push(`[${ruleName}] \"${key}\" must be ${fieldDef.type}, got ${typeof value}.`);\n } else if (fieldDef.enumValues && !fieldDef.enumValues.includes(value as string)) {\n errors.push(`[${ruleName}] \"${key}\" = \"${value}\" is not valid. Must be one of: ${fieldDef.enumValues.join(', ')}.`);\n }\n }\n }\n\n // Every built-in rule must be explicitly configured — no silent defaults.\n // When a new rule is added to the framework, this check surfaces it immediately\n // with a ready-to-copy snippet so AI can configure it in one pass.\n for (const [ruleName, schema] of Object.entries(RULE_SCHEMAS)) {\n if (!(ruleName in rawRules)) {\n errors.push(missingRuleSnippet(ruleName, schema));\n }\n }\n\n return errors;\n}\n"]}
|