@webpieces/code-rules 0.3.136 → 0.3.138

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/code-rules",
3
- "version": "0.3.136",
3
+ "version": "0.3.138",
4
4
  "description": "Standalone code validation rules extracted from architecture-validators, no Nx dependency required",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -20,7 +20,7 @@
20
20
  "directory": "packages/tooling/code-rules"
21
21
  },
22
22
  "dependencies": {
23
- "@webpieces/rules-config": "0.3.136"
23
+ "@webpieces/rules-config": "0.3.138"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public"
@@ -112,6 +112,12 @@ function toValidateCodeOptions(shared) {
112
112
  ignoreModifiedUntilEpoch: opt(r('no-direct-api-in-resolver'), 'ignoreModifiedUntilEpoch'),
113
113
  enforcePaths: opt(r('no-direct-api-in-resolver'), 'enforcePaths'),
114
114
  },
115
+ noSymbolDiTokens: {
116
+ mode: modeOrOff(r('no-symbol-di-tokens')),
117
+ disableAllowed: opt(r('no-symbol-di-tokens'), 'disableAllowed'),
118
+ ignoreModifiedUntilEpoch: opt(r('no-symbol-di-tokens'), 'ignoreModifiedUntilEpoch'),
119
+ allowedPaths: opt(r('no-symbol-di-tokens'), 'allowedPaths'),
120
+ },
115
121
  };
116
122
  }
117
123
  //# sourceMappingURL=from-shared-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"from-shared-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/from-shared-config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;AAmBH,sDAyEC;AAvFD,oFAAoF;AACpF,SAAS,GAAG,CAAI,IAAoC,EAAE,GAAW;IAC7D,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,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,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC;YAC/C,cAAc,EAAE,GAAG,CAAU,CAAC,CAAC,2BAA2B,CAAC,EAAE,gBAAgB,CAAC;YAC9E,wBAAwB,EAAE,GAAG,CAAS,CAAC,CAAC,2BAA2B,CAAC,EAAE,0BAA0B,CAAC;YACjG,YAAY,EAAE,GAAG,CAAW,CAAC,CAAC,2BAA2B,CAAC,EAAE,cAAc,CAAC;SAC9E;KACJ,CAAC;AACN,CAAC","sourcesContent":["/**\n * Adapter: map @webpieces/rules-config ResolvedConfig -> legacy ValidateCodeOptions.\n *\n * We don't want to rewrite the 11 sub-executors in this PR, so this file\n * takes the shared webpieces.config.json entries (kebab-case rule names)\n * and reconstructs the camelCase ValidateCodeOptions shape the executor\n * already understands.\n *\n * Mapping of canonical kebab-case rule name -> ValidateCodeOptions field:\n * max-method-lines -> methodMaxLimit\n * max-file-lines -> fileMaxLimit\n * require-return-type -> requireReturnType\n * no-inline-type-literals -> noInlineTypeLiterals\n * no-any-unknown -> noAnyUnknown\n * no-implicit-any -> noImplicitAny\n * validate-dtos -> validateDtos\n * prisma-converter -> prismaConverter\n * no-destructure -> noDestructure\n * catch-error-pattern -> catchErrorPattern\n * no-unmanaged-exceptions -> noUnmanagedExceptions\n * no-direct-api-in-resolver -> noDirectApiInResolver\n *\n * On/off is driven entirely by `mode`: a `mode:'OFF'` entry flows straight\n * through to the downstream executor, which short-circuits on it.\n */\n\nimport type { ResolvedConfig, ResolvedRuleConfig } from '@webpieces/rules-config';\nimport type { ValidateCodeOptions } from './validate-code-options';\n\n// webpieces-disable no-any-unknown -- coerces opaque option values pulled from JSON\nfunction opt<T>(rule: ResolvedRuleConfig | undefined, key: string): T | undefined {\n if (!rule) return undefined;\n const value = rule.options[key];\n if (value === undefined) return undefined;\n return value as T;\n}\n\nfunction modeOrOff<T extends string>(rule: ResolvedRuleConfig | undefined): T | undefined {\n if (!rule) return undefined;\n const mode = rule.options['mode'];\n return (mode as T) ?? undefined;\n}\n\nexport function toValidateCodeOptions(shared: ResolvedConfig): ValidateCodeOptions {\n const r = (name: string): ResolvedRuleConfig | undefined => shared.rules.get(name);\n\n return {\n methodMaxLimit: {\n limit: opt<number>(r('max-method-lines'), 'limit'),\n mode: modeOrOff(r('max-method-lines')),\n disableAllowed: opt<boolean>(r('max-method-lines'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('max-method-lines'), 'ignoreModifiedUntilEpoch'),\n },\n fileMaxLimit: {\n limit: opt<number>(r('max-file-lines'), 'limit'),\n mode: modeOrOff(r('max-file-lines')),\n disableAllowed: opt<boolean>(r('max-file-lines'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('max-file-lines'), 'ignoreModifiedUntilEpoch'),\n },\n requireReturnType: {\n mode: modeOrOff(r('require-return-type')),\n disableAllowed: opt<boolean>(r('require-return-type'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('require-return-type'), 'ignoreModifiedUntilEpoch'),\n },\n noInlineTypeLiterals: {\n mode: modeOrOff(r('no-inline-type-literals')),\n disableAllowed: opt<boolean>(r('no-inline-type-literals'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-inline-type-literals'), 'ignoreModifiedUntilEpoch'),\n },\n noAnyUnknown: {\n mode: modeOrOff(r('no-any-unknown')),\n disableAllowed: opt<boolean>(r('no-any-unknown'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-any-unknown'), 'ignoreModifiedUntilEpoch'),\n },\n noImplicitAny: {\n mode: modeOrOff(r('no-implicit-any')),\n disableAllowed: opt<boolean>(r('no-implicit-any'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-implicit-any'), 'ignoreModifiedUntilEpoch'),\n },\n validateDtos: {\n mode: modeOrOff(r('validate-dtos')),\n disableAllowed: opt<boolean>(r('validate-dtos'), 'disableAllowed'),\n prismaSchemaPath: opt<string>(r('validate-dtos'), 'prismaSchemaPath'),\n dtoSourcePaths: opt<string[]>(r('validate-dtos'), 'dtoSourcePaths'),\n ignoreModifiedUntilEpoch: opt<number>(r('validate-dtos'), 'ignoreModifiedUntilEpoch'),\n },\n prismaConverter: {\n mode: modeOrOff(r('prisma-converter')),\n disableAllowed: opt<boolean>(r('prisma-converter'), 'disableAllowed'),\n schemaPath: opt<string>(r('prisma-converter'), 'schemaPath'),\n convertersPaths: opt<string[]>(r('prisma-converter'), 'convertersPaths'),\n enforcePaths: opt<string[]>(r('prisma-converter'), 'enforcePaths'),\n ignoreModifiedUntilEpoch: opt<number>(r('prisma-converter'), 'ignoreModifiedUntilEpoch'),\n },\n noDestructure: {\n mode: modeOrOff(r('no-destructure')),\n disableAllowed: opt<boolean>(r('no-destructure'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-destructure'), 'ignoreModifiedUntilEpoch'),\n },\n catchErrorPattern: {\n mode: modeOrOff(r('catch-error-pattern')),\n disableAllowed: opt<boolean>(r('catch-error-pattern'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('catch-error-pattern'), 'ignoreModifiedUntilEpoch'),\n },\n noUnmanagedExceptions: {\n mode: modeOrOff(r('no-unmanaged-exceptions')),\n disableAllowed: opt<boolean>(r('no-unmanaged-exceptions'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-unmanaged-exceptions'), 'ignoreModifiedUntilEpoch'),\n },\n noDirectApiInResolver: {\n mode: modeOrOff(r('no-direct-api-in-resolver')),\n disableAllowed: opt<boolean>(r('no-direct-api-in-resolver'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-direct-api-in-resolver'), 'ignoreModifiedUntilEpoch'),\n enforcePaths: opt<string[]>(r('no-direct-api-in-resolver'), 'enforcePaths'),\n },\n };\n}\n"]}
1
+ {"version":3,"file":"from-shared-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/from-shared-config.ts"],"names":[],"mappings":";AAAA;;;;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AC7C,cAAc,EAAE,GAAG,CAAU,CAAC,CAAC,yBAAyB,CAAC,EAAE,gBAAgB,CAAC;YAC5E,wBAAwB,EAAE,GAAG,CAAS,CAAC,CAAC,yBAAyB,CAAC,EAAE,0BAA0B,CAAC;SAClG;QACD,qBAAqB,EAAE;YACnB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC;YAC/C,cAAc,EAAE,GAAG,CAAU,CAAC,CAAC,2BAA2B,CAAC,EAAE,gBAAgB,CAAC;YAC9E,wBAAwB,EAAE,GAAG,CAAS,CAAC,CAAC,2BAA2B,CAAC,EAAE,0BAA0B,CAAC;YACjG,YAAY,EAAE,GAAG,CAAW,CAAC,CAAC,2BAA2B,CAAC,EAAE,cAAc,CAAC;SAC9E;QACD,gBAAgB,EAAE;YACd,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC;YACzC,cAAc,EAAE,GAAG,CAAU,CAAC,CAAC,qBAAqB,CAAC,EAAE,gBAAgB,CAAC;YACxE,wBAAwB,EAAE,GAAG,CAAS,CAAC,CAAC,qBAAqB,CAAC,EAAE,0BAA0B,CAAC;YAC3F,YAAY,EAAE,GAAG,CAAW,CAAC,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC;SACxE;KACJ,CAAC;AACN,CAAC","sourcesContent":["/**\n * Adapter: map @webpieces/rules-config ResolvedConfig -> legacy ValidateCodeOptions.\n *\n * We don't want to rewrite the 11 sub-executors in this PR, so this file\n * takes the shared webpieces.config.json entries (kebab-case rule names)\n * and reconstructs the camelCase ValidateCodeOptions shape the executor\n * already understands.\n *\n * Mapping of canonical kebab-case rule name -> ValidateCodeOptions field:\n * max-method-lines -> methodMaxLimit\n * max-file-lines -> fileMaxLimit\n * require-return-type -> requireReturnType\n * no-inline-type-literals -> noInlineTypeLiterals\n * no-any-unknown -> noAnyUnknown\n * no-implicit-any -> noImplicitAny\n * validate-dtos -> validateDtos\n * prisma-converter -> prismaConverter\n * no-destructure -> noDestructure\n * catch-error-pattern -> catchErrorPattern\n * no-unmanaged-exceptions -> noUnmanagedExceptions\n * no-direct-api-in-resolver -> noDirectApiInResolver\n *\n * On/off is driven entirely by `mode`: a `mode:'OFF'` entry flows straight\n * through to the downstream executor, which short-circuits on it.\n */\n\nimport type { ResolvedConfig, ResolvedRuleConfig } from '@webpieces/rules-config';\nimport type { ValidateCodeOptions } from './validate-code-options';\n\n// webpieces-disable no-any-unknown -- coerces opaque option values pulled from JSON\nfunction opt<T>(rule: ResolvedRuleConfig | undefined, key: string): T | undefined {\n if (!rule) return undefined;\n const value = rule.options[key];\n if (value === undefined) return undefined;\n return value as T;\n}\n\nfunction modeOrOff<T extends string>(rule: ResolvedRuleConfig | undefined): T | undefined {\n if (!rule) return undefined;\n const mode = rule.options['mode'];\n return (mode as T) ?? undefined;\n}\n\nexport function toValidateCodeOptions(shared: ResolvedConfig): ValidateCodeOptions {\n const r = (name: string): ResolvedRuleConfig | undefined => shared.rules.get(name);\n\n return {\n methodMaxLimit: {\n limit: opt<number>(r('max-method-lines'), 'limit'),\n mode: modeOrOff(r('max-method-lines')),\n disableAllowed: opt<boolean>(r('max-method-lines'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('max-method-lines'), 'ignoreModifiedUntilEpoch'),\n },\n fileMaxLimit: {\n limit: opt<number>(r('max-file-lines'), 'limit'),\n mode: modeOrOff(r('max-file-lines')),\n disableAllowed: opt<boolean>(r('max-file-lines'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('max-file-lines'), 'ignoreModifiedUntilEpoch'),\n },\n requireReturnType: {\n mode: modeOrOff(r('require-return-type')),\n disableAllowed: opt<boolean>(r('require-return-type'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('require-return-type'), 'ignoreModifiedUntilEpoch'),\n },\n noInlineTypeLiterals: {\n mode: modeOrOff(r('no-inline-type-literals')),\n disableAllowed: opt<boolean>(r('no-inline-type-literals'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-inline-type-literals'), 'ignoreModifiedUntilEpoch'),\n },\n noAnyUnknown: {\n mode: modeOrOff(r('no-any-unknown')),\n disableAllowed: opt<boolean>(r('no-any-unknown'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-any-unknown'), 'ignoreModifiedUntilEpoch'),\n },\n noImplicitAny: {\n mode: modeOrOff(r('no-implicit-any')),\n disableAllowed: opt<boolean>(r('no-implicit-any'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-implicit-any'), 'ignoreModifiedUntilEpoch'),\n },\n validateDtos: {\n mode: modeOrOff(r('validate-dtos')),\n disableAllowed: opt<boolean>(r('validate-dtos'), 'disableAllowed'),\n prismaSchemaPath: opt<string>(r('validate-dtos'), 'prismaSchemaPath'),\n dtoSourcePaths: opt<string[]>(r('validate-dtos'), 'dtoSourcePaths'),\n ignoreModifiedUntilEpoch: opt<number>(r('validate-dtos'), 'ignoreModifiedUntilEpoch'),\n },\n prismaConverter: {\n mode: modeOrOff(r('prisma-converter')),\n disableAllowed: opt<boolean>(r('prisma-converter'), 'disableAllowed'),\n schemaPath: opt<string>(r('prisma-converter'), 'schemaPath'),\n convertersPaths: opt<string[]>(r('prisma-converter'), 'convertersPaths'),\n enforcePaths: opt<string[]>(r('prisma-converter'), 'enforcePaths'),\n ignoreModifiedUntilEpoch: opt<number>(r('prisma-converter'), 'ignoreModifiedUntilEpoch'),\n },\n noDestructure: {\n mode: modeOrOff(r('no-destructure')),\n disableAllowed: opt<boolean>(r('no-destructure'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-destructure'), 'ignoreModifiedUntilEpoch'),\n },\n catchErrorPattern: {\n mode: modeOrOff(r('catch-error-pattern')),\n disableAllowed: opt<boolean>(r('catch-error-pattern'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('catch-error-pattern'), 'ignoreModifiedUntilEpoch'),\n },\n noUnmanagedExceptions: {\n mode: modeOrOff(r('no-unmanaged-exceptions')),\n disableAllowed: opt<boolean>(r('no-unmanaged-exceptions'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-unmanaged-exceptions'), 'ignoreModifiedUntilEpoch'),\n },\n noDirectApiInResolver: {\n mode: modeOrOff(r('no-direct-api-in-resolver')),\n disableAllowed: opt<boolean>(r('no-direct-api-in-resolver'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-direct-api-in-resolver'), 'ignoreModifiedUntilEpoch'),\n enforcePaths: opt<string[]>(r('no-direct-api-in-resolver'), 'enforcePaths'),\n },\n noSymbolDiTokens: {\n mode: modeOrOff(r('no-symbol-di-tokens')),\n disableAllowed: opt<boolean>(r('no-symbol-di-tokens'), 'disableAllowed'),\n ignoreModifiedUntilEpoch: opt<number>(r('no-symbol-di-tokens'), 'ignoreModifiedUntilEpoch'),\n allowedPaths: opt<string[]>(r('no-symbol-di-tokens'), 'allowedPaths'),\n },\n };\n}\n"]}
@@ -19,7 +19,8 @@ import type { NoDestructureMode } from './validate-no-destructure';
19
19
  import type { CatchErrorPatternMode } from './validate-catch-error-pattern';
20
20
  import type { NoUnmanagedExceptionsMode } from './validate-no-unmanaged-exceptions';
21
21
  import type { NoDirectApiResolverMode } from './validate-no-direct-api-resolver';
22
- export type { ReturnTypeMode, NoInlineTypesMode, NoAnyUnknownMode, NoImplicitAnyMode, ValidateDtosMode, PrismaConverterMode, NoDestructureMode, CatchErrorPatternMode, NoUnmanagedExceptionsMode, NoDirectApiResolverMode, };
22
+ import type { NoSymbolDiTokensMode } from './validate-no-symbol-di-tokens';
23
+ export type { ReturnTypeMode, NoInlineTypesMode, NoAnyUnknownMode, NoImplicitAnyMode, ValidateDtosMode, PrismaConverterMode, NoDestructureMode, CatchErrorPatternMode, NoUnmanagedExceptionsMode, NoDirectApiResolverMode, NoSymbolDiTokensMode, };
23
24
  export type MethodMaxLimitMode = 'OFF' | 'NEW_METHODS' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';
24
25
  export type FileMaxLimitMode = 'OFF' | 'MODIFIED_FILES';
25
26
  export interface MethodMaxLimitConfig {
@@ -90,6 +91,12 @@ export interface NoDirectApiResolverConfig {
90
91
  ignoreModifiedUntilEpoch?: number;
91
92
  enforcePaths?: string[];
92
93
  }
94
+ export interface NoSymbolDiTokensConfig {
95
+ mode?: NoSymbolDiTokensMode;
96
+ disableAllowed?: boolean;
97
+ ignoreModifiedUntilEpoch?: number;
98
+ allowedPaths?: string[];
99
+ }
93
100
  export interface ValidateCodeOptions {
94
101
  methodMaxLimit?: MethodMaxLimitConfig;
95
102
  fileMaxLimit?: FileMaxLimitConfig;
@@ -103,4 +110,5 @@ export interface ValidateCodeOptions {
103
110
  catchErrorPattern?: CatchErrorPatternConfig;
104
111
  noUnmanagedExceptions?: NoUnmanagedExceptionsConfig;
105
112
  noDirectApiInResolver?: NoDirectApiResolverConfig;
113
+ noSymbolDiTokens?: NoSymbolDiTokensConfig;
106
114
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validate-code-options.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-code-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG","sourcesContent":["/**\n * ValidateCodeOptions and its sub-config types.\n *\n * This is a leaf module: it owns the option/config shape shared by `validate-code.ts`\n * (which consumes the options) and `from-shared-config.ts` (which produces them). Keeping\n * the type here breaks the otherwise-circular import between those two files — a type that\n * two modules share must not live inside one of them.\n *\n * It imports only the per-rule `*Mode` unions from the individual rule executors (leaves),\n * and re-exports them so consumers have a single import site.\n */\n\nimport type { ReturnTypeMode } from './validate-return-types';\nimport type { NoInlineTypesMode } from './validate-no-inline-types';\nimport type { NoAnyUnknownMode } from './validate-no-any-unknown';\nimport type { NoImplicitAnyMode } from './validate-no-implicit-any';\nimport type { ValidateDtosMode } from './validate-dtos';\nimport type { PrismaConverterMode } from './validate-prisma-converters';\nimport type { NoDestructureMode } from './validate-no-destructure';\nimport type { CatchErrorPatternMode } from './validate-catch-error-pattern';\nimport type { NoUnmanagedExceptionsMode } from './validate-no-unmanaged-exceptions';\nimport type { NoDirectApiResolverMode } from './validate-no-direct-api-resolver';\n\nexport type {\n ReturnTypeMode,\n NoInlineTypesMode,\n NoAnyUnknownMode,\n NoImplicitAnyMode,\n ValidateDtosMode,\n PrismaConverterMode,\n NoDestructureMode,\n CatchErrorPatternMode,\n NoUnmanagedExceptionsMode,\n NoDirectApiResolverMode,\n};\n\nexport type MethodMaxLimitMode = 'OFF' | 'NEW_METHODS' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';\nexport type FileMaxLimitMode = 'OFF' | 'MODIFIED_FILES';\n\nexport interface MethodMaxLimitConfig {\n limit?: number;\n mode?: MethodMaxLimitMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface FileMaxLimitConfig {\n limit?: number;\n mode?: FileMaxLimitMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface RequireReturnTypeConfig {\n mode?: ReturnTypeMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoInlineTypeLiteralsConfig {\n mode?: NoInlineTypesMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoAnyUnknownConfig {\n mode?: NoAnyUnknownMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoImplicitAnyConfig {\n mode?: NoImplicitAnyMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface ValidateDtosConfig {\n mode?: ValidateDtosMode;\n disableAllowed?: boolean;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface PrismaConverterConfig {\n mode?: PrismaConverterMode;\n disableAllowed?: boolean;\n schemaPath?: string;\n convertersPaths?: string[];\n enforcePaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoDestructureConfig {\n mode?: NoDestructureMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface CatchErrorPatternConfig {\n mode?: CatchErrorPatternMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoUnmanagedExceptionsConfig {\n mode?: NoUnmanagedExceptionsMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoDirectApiResolverConfig {\n mode?: NoDirectApiResolverMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n enforcePaths?: string[];\n}\n\nexport interface ValidateCodeOptions {\n methodMaxLimit?: MethodMaxLimitConfig;\n fileMaxLimit?: FileMaxLimitConfig;\n requireReturnType?: RequireReturnTypeConfig;\n noInlineTypeLiterals?: NoInlineTypeLiteralsConfig;\n noAnyUnknown?: NoAnyUnknownConfig;\n noImplicitAny?: NoImplicitAnyConfig;\n validateDtos?: ValidateDtosConfig;\n prismaConverter?: PrismaConverterConfig;\n noDestructure?: NoDestructureConfig;\n catchErrorPattern?: CatchErrorPatternConfig;\n noUnmanagedExceptions?: NoUnmanagedExceptionsConfig;\n noDirectApiInResolver?: NoDirectApiResolverConfig;\n}\n"]}
1
+ {"version":3,"file":"validate-code-options.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-code-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG","sourcesContent":["/**\n * ValidateCodeOptions and its sub-config types.\n *\n * This is a leaf module: it owns the option/config shape shared by `validate-code.ts`\n * (which consumes the options) and `from-shared-config.ts` (which produces them). Keeping\n * the type here breaks the otherwise-circular import between those two files — a type that\n * two modules share must not live inside one of them.\n *\n * It imports only the per-rule `*Mode` unions from the individual rule executors (leaves),\n * and re-exports them so consumers have a single import site.\n */\n\nimport type { ReturnTypeMode } from './validate-return-types';\nimport type { NoInlineTypesMode } from './validate-no-inline-types';\nimport type { NoAnyUnknownMode } from './validate-no-any-unknown';\nimport type { NoImplicitAnyMode } from './validate-no-implicit-any';\nimport type { ValidateDtosMode } from './validate-dtos';\nimport type { PrismaConverterMode } from './validate-prisma-converters';\nimport type { NoDestructureMode } from './validate-no-destructure';\nimport type { CatchErrorPatternMode } from './validate-catch-error-pattern';\nimport type { NoUnmanagedExceptionsMode } from './validate-no-unmanaged-exceptions';\nimport type { NoDirectApiResolverMode } from './validate-no-direct-api-resolver';\nimport type { NoSymbolDiTokensMode } from './validate-no-symbol-di-tokens';\n\nexport type {\n ReturnTypeMode,\n NoInlineTypesMode,\n NoAnyUnknownMode,\n NoImplicitAnyMode,\n ValidateDtosMode,\n PrismaConverterMode,\n NoDestructureMode,\n CatchErrorPatternMode,\n NoUnmanagedExceptionsMode,\n NoDirectApiResolverMode,\n NoSymbolDiTokensMode,\n};\n\nexport type MethodMaxLimitMode = 'OFF' | 'NEW_METHODS' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';\nexport type FileMaxLimitMode = 'OFF' | 'MODIFIED_FILES';\n\nexport interface MethodMaxLimitConfig {\n limit?: number;\n mode?: MethodMaxLimitMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface FileMaxLimitConfig {\n limit?: number;\n mode?: FileMaxLimitMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface RequireReturnTypeConfig {\n mode?: ReturnTypeMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoInlineTypeLiteralsConfig {\n mode?: NoInlineTypesMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoAnyUnknownConfig {\n mode?: NoAnyUnknownMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoImplicitAnyConfig {\n mode?: NoImplicitAnyMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface ValidateDtosConfig {\n mode?: ValidateDtosMode;\n disableAllowed?: boolean;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface PrismaConverterConfig {\n mode?: PrismaConverterMode;\n disableAllowed?: boolean;\n schemaPath?: string;\n convertersPaths?: string[];\n enforcePaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoDestructureConfig {\n mode?: NoDestructureMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface CatchErrorPatternConfig {\n mode?: CatchErrorPatternMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoUnmanagedExceptionsConfig {\n mode?: NoUnmanagedExceptionsMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoDirectApiResolverConfig {\n mode?: NoDirectApiResolverMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n enforcePaths?: string[];\n}\n\nexport interface NoSymbolDiTokensConfig {\n mode?: NoSymbolDiTokensMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n allowedPaths?: string[];\n}\n\nexport interface ValidateCodeOptions {\n methodMaxLimit?: MethodMaxLimitConfig;\n fileMaxLimit?: FileMaxLimitConfig;\n requireReturnType?: RequireReturnTypeConfig;\n noInlineTypeLiterals?: NoInlineTypeLiteralsConfig;\n noAnyUnknown?: NoAnyUnknownConfig;\n noImplicitAny?: NoImplicitAnyConfig;\n validateDtos?: ValidateDtosConfig;\n prismaConverter?: PrismaConverterConfig;\n noDestructure?: NoDestructureConfig;\n catchErrorPattern?: CatchErrorPatternConfig;\n noUnmanagedExceptions?: NoUnmanagedExceptionsConfig;\n noDirectApiInResolver?: NoDirectApiResolverConfig;\n noSymbolDiTokens?: NoSymbolDiTokensConfig;\n}\n"]}
@@ -17,6 +17,7 @@ const validate_no_destructure_1 = tslib_1.__importDefault(require("./validate-no
17
17
  const validate_catch_error_pattern_1 = tslib_1.__importDefault(require("./validate-catch-error-pattern"));
18
18
  const validate_no_unmanaged_exceptions_1 = tslib_1.__importDefault(require("./validate-no-unmanaged-exceptions"));
19
19
  const validate_no_direct_api_resolver_1 = tslib_1.__importDefault(require("./validate-no-direct-api-resolver"));
20
+ const validate_no_symbol_di_tokens_1 = tslib_1.__importDefault(require("./validate-no-symbol-di-tokens"));
20
21
  const VALID_MODES = {
21
22
  methodMaxLimit: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],
22
23
  fileMaxLimit: ['OFF', 'MODIFIED_FILES'],
@@ -30,6 +31,7 @@ const VALID_MODES = {
30
31
  catchErrorPattern: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],
31
32
  noUnmanagedExceptions: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],
32
33
  noDirectApiInResolver: ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],
34
+ noSymbolDiTokens: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],
33
35
  };
34
36
  /**
35
37
  * Validate that all configured modes are valid. Produces clear error messages naming the rule.
@@ -49,6 +51,7 @@ function validateModes(options) {
49
51
  ['catchErrorPattern', options.catchErrorPattern?.mode],
50
52
  ['noUnmanagedExceptions', options.noUnmanagedExceptions?.mode],
51
53
  ['noDirectApiInResolver', options.noDirectApiInResolver?.mode],
54
+ ['noSymbolDiTokens', options.noSymbolDiTokens?.mode],
52
55
  ];
53
56
  for (const entry of modeEntries) {
54
57
  const ruleName = entry[0];
@@ -148,6 +151,10 @@ function parseConfig(options) {
148
151
  noDirectApiResolverDisableAllowed: options.noDirectApiInResolver?.disableAllowed ?? true,
149
152
  noDirectApiResolverIgnoreEpoch: options.noDirectApiInResolver?.ignoreModifiedUntilEpoch,
150
153
  noDirectApiResolverEnforcePaths: options.noDirectApiInResolver?.enforcePaths ?? [],
154
+ noSymbolDiTokensMode: options.noSymbolDiTokens?.mode ?? 'OFF',
155
+ noSymbolDiTokensDisableAllowed: options.noSymbolDiTokens?.disableAllowed ?? true,
156
+ noSymbolDiTokensIgnoreEpoch: options.noSymbolDiTokens?.ignoreModifiedUntilEpoch,
157
+ noSymbolDiTokensAllowedPaths: options.noSymbolDiTokens?.allowedPaths ?? [],
151
158
  };
152
159
  }
153
160
  function formatOverride(override) {
@@ -170,6 +177,7 @@ function logConfig(config) {
170
177
  console.log(` Catch error pattern: mode=${config.catchErrorPatternMode}, disableAllowed=${config.catchErrorPatternDisableAllowed}`);
171
178
  console.log(` No unmanaged exceptions: mode=${config.noUnmanagedExceptionsMode}, disableAllowed=${config.noUnmanagedExceptionsDisableAllowed}`);
172
179
  console.log(` No direct API in resolver: mode=${config.noDirectApiResolverMode}, disableAllowed=${config.noDirectApiResolverDisableAllowed}`);
180
+ console.log(` No Symbol DI tokens: mode=${config.noSymbolDiTokensMode}, disableAllowed=${config.noSymbolDiTokensDisableAllowed}`);
173
181
  console.log('');
174
182
  }
175
183
  function isAllOff(config) {
@@ -179,7 +187,7 @@ function isAllOff(config) {
179
187
  config.validateDtosMode === 'OFF' &&
180
188
  config.prismaConverterMode === 'OFF' && config.noDestructureMode === 'OFF' &&
181
189
  config.catchErrorPatternMode === 'OFF' && config.noUnmanagedExceptionsMode === 'OFF' &&
182
- config.noDirectApiResolverMode === 'OFF';
190
+ config.noDirectApiResolverMode === 'OFF' && config.noSymbolDiTokensMode === 'OFF';
183
191
  }
184
192
  async function runMethodValidators(config, workspaceRoot) {
185
193
  const results = [];
@@ -261,6 +269,12 @@ async function runAllValidators(config, workspaceRoot) {
261
269
  ignoreModifiedUntilEpoch: config.noDirectApiResolverIgnoreEpoch,
262
270
  enforcePaths: config.noDirectApiResolverEnforcePaths,
263
271
  }, workspaceRoot));
272
+ results.push(await (0, validate_no_symbol_di_tokens_1.default)({
273
+ mode: config.noSymbolDiTokensMode,
274
+ disableAllowed: config.noSymbolDiTokensDisableAllowed,
275
+ ignoreModifiedUntilEpoch: config.noSymbolDiTokensIgnoreEpoch,
276
+ allowedPaths: config.noSymbolDiTokensAllowedPaths,
277
+ }, workspaceRoot));
264
278
  return results;
265
279
  }
266
280
  async function runValidator(_nxOptions, workspaceRoot) {
@@ -1 +1 @@
1
- {"version":3,"file":"validate-code.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-code.ts"],"names":[],"mappings":";;AAiXA,+BAwCC;;AAzZD,0DAAqD;AACrD,6DAA6D;AAC7D,0FAA2D;AAC3D,oGAAqE;AACrE,gGAAiE;AACjE,4FAA6D;AAC7D,kGAAkE;AAClE,gGAAgE;AAChE,kGAAkE;AAClE,4EAAsD;AACtD,sGAAuE;AACvE,gGAAiE;AACjE,0GAA0E;AAC1E,kHAAkF;AAClF,gHAA+E;AAsF/E,MAAM,WAAW,GAA6B;IAC1C,cAAc,EAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAC;IAC1F,YAAY,EAAU,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAC/C,iBAAiB,EAAK,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAC;IAC1F,oBAAoB,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAC;IAC1F,YAAY,EAAU,CAAC,KAAK,EAAE,eAAe,EAAE,gBAAgB,CAAC;IAChE,aAAa,EAAS,CAAC,KAAK,EAAE,eAAe,EAAE,gBAAgB,CAAC;IAChE,YAAY,EAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,CAAC;IACjE,eAAe,EAAO,CAAC,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,CAAC;IAC3E,aAAa,EAAS,CAAC,KAAK,EAAE,eAAe,EAAE,gBAAgB,CAAC;IAChE,iBAAiB,EAAK,CA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AG,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAExD,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAEpC,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,kEAAkE,CAAC,CAAC;QAChF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,MAAM,CAAC,CAAC;IAElB,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,yCAAyC,CAAC,CAAC;IAC/G,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import { loadConfig } from '@webpieces/rules-config';\nimport { toValidateCodeOptions } from './from-shared-config';\nimport runNewMethodsExecutor from './validate-new-methods';\nimport runModifiedMethodsExecutor from './validate-modified-methods';\nimport runModifiedFilesExecutor from './validate-modified-files';\nimport runReturnTypesExecutor from './validate-return-types';\nimport runNoInlineTypesExecutor from './validate-no-inline-types';\nimport runNoAnyUnknownExecutor from './validate-no-any-unknown';\nimport runNoImplicitAnyExecutor from './validate-no-implicit-any';\nimport runValidateDtosExecutor from './validate-dtos';\nimport runPrismaConvertersExecutor from './validate-prisma-converters';\nimport runNoDestructureExecutor from './validate-no-destructure';\nimport runCatchErrorPatternExecutor from './validate-catch-error-pattern';\nimport runNoUnmanagedExceptionsExecutor from './validate-no-unmanaged-exceptions';\nimport runNoDirectApiResolverExecutor from './validate-no-direct-api-resolver';\nimport type {\n MethodMaxLimitMode,\n FileMaxLimitMode,\n ReturnTypeMode,\n NoInlineTypesMode,\n NoAnyUnknownMode,\n NoImplicitAnyMode,\n ValidateDtosMode,\n PrismaConverterMode,\n NoDestructureMode,\n CatchErrorPatternMode,\n NoUnmanagedExceptionsMode,\n NoDirectApiResolverMode,\n MethodMaxLimitConfig,\n FileMaxLimitConfig,\n ValidateCodeOptions,\n} from './validate-code-options';\n\nexport interface ExecutorResult {\n success: boolean;\n}\n\ninterface OverrideInfo {\n active: boolean;\n normalMode: string;\n expiresDate: string;\n}\n\ninterface ParsedConfig {\n methodLimit: number;\n methodMode: MethodMaxLimitMode;\n methodDisableAllowed: boolean;\n methodOverride: OverrideInfo | undefined;\n fileLimit: number;\n fileMode: FileMaxLimitMode;\n fileDisableAllowed: boolean;\n fileOverride: OverrideInfo | undefined;\n returnTypeMode: ReturnTypeMode;\n returnTypeDisableAllowed: boolean;\n returnTypeIgnoreEpoch: number | undefined;\n noInlineTypesMode: NoInlineTypesMode;\n noInlineTypesDisableAllowed: boolean;\n noInlineTypesIgnoreEpoch: number | undefined;\n noAnyUnknownMode: NoAnyUnknownMode;\n noAnyUnknownDisableAllowed: boolean;\n noAnyUnknownIgnoreEpoch: number | undefined;\n noImplicitAnyMode: NoImplicitAnyMode;\n noImplicitAnyDisableAllowed: boolean;\n noImplicitAnyIgnoreEpoch: number | undefined;\n validateDtosMode: ValidateDtosMode;\n validateDtosDisableAllowed: boolean;\n validateDtosPrismaPath: string | undefined;\n validateDtosSrcPaths: string[];\n validateDtosIgnoreEpoch: number | undefined;\n prismaConverterMode: PrismaConverterMode;\n prismaConverterDisableAllowed: boolean;\n prismaConverterSchemaPath: string | undefined;\n prismaConverterConvertersPaths: string[];\n prismaConverterEnforcePaths: string[];\n prismaConverterIgnoreEpoch: number | undefined;\n noDestructureMode: NoDestructureMode;\n noDestructureDisableAllowed: boolean;\n noDestructureIgnoreEpoch: number | undefined;\n catchErrorPatternMode: CatchErrorPatternMode;\n catchErrorPatternDisableAllowed: boolean;\n catchErrorPatternIgnoreEpoch: number | undefined;\n noUnmanagedExceptionsMode: NoUnmanagedExceptionsMode;\n noUnmanagedExceptionsDisableAllowed: boolean;\n noUnmanagedExceptionsIgnoreEpoch: number | undefined;\n noDirectApiResolverMode: NoDirectApiResolverMode;\n noDirectApiResolverDisableAllowed: boolean;\n noDirectApiResolverIgnoreEpoch: number | undefined;\n noDirectApiResolverEnforcePaths: string[];\n}\n\ninterface ResolvedMethodMode {\n mode: MethodMaxLimitMode;\n override: OverrideInfo | undefined;\n}\n\ninterface ResolvedFileMode {\n mode: FileMaxLimitMode;\n override: OverrideInfo | undefined;\n}\n\nconst VALID_MODES: Record<string, string[]> = {\n methodMaxLimit: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n fileMaxLimit: ['OFF', 'MODIFIED_FILES'],\n requireReturnType: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noInlineTypeLiterals: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noAnyUnknown: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n noImplicitAny: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n validateDtos: ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'],\n prismaConverter: ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noDestructure: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n catchErrorPattern: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n noUnmanagedExceptions: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n noDirectApiInResolver: ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n};\n\n/**\n * Validate that all configured modes are valid. Produces clear error messages naming the rule.\n */\nfunction validateModes(options: ValidateCodeOptions): string[] {\n const errors: string[] = [];\n\n type ModeEntry = [string, string | undefined];\n const modeEntries: ModeEntry[] = [\n ['methodMaxLimit', options.methodMaxLimit?.mode],\n ['fileMaxLimit', options.fileMaxLimit?.mode],\n ['requireReturnType', options.requireReturnType?.mode],\n ['noInlineTypeLiterals', options.noInlineTypeLiterals?.mode],\n ['noAnyUnknown', options.noAnyUnknown?.mode],\n ['noImplicitAny', options.noImplicitAny?.mode],\n ['validateDtos', options.validateDtos?.mode],\n ['prismaConverter', options.prismaConverter?.mode],\n ['noDestructure', options.noDestructure?.mode],\n ['catchErrorPattern', options.catchErrorPattern?.mode],\n ['noUnmanagedExceptions', options.noUnmanagedExceptions?.mode],\n ['noDirectApiInResolver', options.noDirectApiInResolver?.mode],\n ];\n\n for (const entry of modeEntries) {\n const ruleName = entry[0];\n const modeValue = entry[1];\n if (modeValue === undefined) continue;\n const validModes = VALID_MODES[ruleName];\n if (!validModes.includes(modeValue)) {\n errors.push(`${ruleName}.mode = '${modeValue}' is invalid. Valid modes: ${validModes.join(', ')}`);\n }\n }\n\n return errors;\n}\n\nfunction formatEpochDate(epoch: number): string {\n return new Date(epoch * 1000).toISOString().split('T')[0];\n}\n\nfunction resolveMethodMode(\n normalMode: MethodMaxLimitMode, epoch: number | undefined\n): ResolvedMethodMode {\n if (epoch === undefined) {\n return { mode: normalMode, override: undefined };\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n // Active: downgrade to skip modified checking\n const downgraded: MethodMaxLimitMode =\n normalMode === 'OFF' ? 'OFF' : 'NEW_METHODS';\n return {\n mode: downgraded,\n override: { active: true, normalMode, expiresDate: formatEpochDate(epoch) },\n };\n }\n // Expired\n return { mode: normalMode, override: undefined };\n}\n\nfunction resolveFileMode(\n normalMode: FileMaxLimitMode, epoch: number | undefined\n): ResolvedFileMode {\n if (epoch === undefined) {\n return { mode: normalMode, override: undefined };\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n // Active: file checking is inherently about modified files, so skip entirely\n return {\n mode: 'OFF',\n override: { active: true, normalMode, expiresDate: formatEpochDate(epoch) },\n };\n }\n // Expired\n return { mode: normalMode, override: undefined };\n}\n\nfunction parseConfig(options: ValidateCodeOptions): ParsedConfig {\n const methodConfig: MethodMaxLimitConfig = options.methodMaxLimit ?? {};\n const fileConfig: FileMaxLimitConfig = options.fileMaxLimit ?? {};\n\n const normalMethodMode = methodConfig.mode ?? 'NEW_AND_MODIFIED_METHODS';\n const normalFileMode = fileConfig.mode ?? 'MODIFIED_FILES';\n\n const methodResolved = resolveMethodMode(normalMethodMode, methodConfig.ignoreModifiedUntilEpoch);\n const fileResolved = resolveFileMode(normalFileMode, fileConfig.ignoreModifiedUntilEpoch);\n\n return {\n methodLimit: methodConfig.limit ?? 80,\n methodMode: methodResolved.mode,\n methodDisableAllowed: methodConfig.disableAllowed ?? true,\n methodOverride: methodResolved.override,\n fileLimit: fileConfig.limit ?? 900,\n fileMode: fileResolved.mode,\n fileDisableAllowed: fileConfig.disableAllowed ?? true,\n fileOverride: fileResolved.override,\n returnTypeMode: options.requireReturnType?.mode ?? 'OFF',\n returnTypeDisableAllowed: options.requireReturnType?.disableAllowed ?? true,\n returnTypeIgnoreEpoch: options.requireReturnType?.ignoreModifiedUntilEpoch,\n noInlineTypesMode: options.noInlineTypeLiterals?.mode ?? 'OFF',\n noInlineTypesDisableAllowed: options.noInlineTypeLiterals?.disableAllowed ?? true,\n noInlineTypesIgnoreEpoch: options.noInlineTypeLiterals?.ignoreModifiedUntilEpoch,\n noAnyUnknownMode: options.noAnyUnknown?.mode ?? 'OFF',\n noAnyUnknownDisableAllowed: options.noAnyUnknown?.disableAllowed ?? true,\n noAnyUnknownIgnoreEpoch: options.noAnyUnknown?.ignoreModifiedUntilEpoch,\n noImplicitAnyMode: options.noImplicitAny?.mode ?? 'OFF',\n noImplicitAnyDisableAllowed: options.noImplicitAny?.disableAllowed ?? true,\n noImplicitAnyIgnoreEpoch: options.noImplicitAny?.ignoreModifiedUntilEpoch,\n validateDtosMode: options.validateDtos?.mode ?? 'OFF',\n validateDtosDisableAllowed: options.validateDtos?.disableAllowed ?? true,\n validateDtosPrismaPath: options.validateDtos?.prismaSchemaPath,\n validateDtosSrcPaths: options.validateDtos?.dtoSourcePaths ?? [],\n validateDtosIgnoreEpoch: options.validateDtos?.ignoreModifiedUntilEpoch,\n prismaConverterMode: options.prismaConverter?.mode ?? 'OFF',\n prismaConverterDisableAllowed: options.prismaConverter?.disableAllowed ?? true,\n prismaConverterSchemaPath: options.prismaConverter?.schemaPath,\n prismaConverterConvertersPaths: options.prismaConverter?.convertersPaths ?? [],\n prismaConverterEnforcePaths: options.prismaConverter?.enforcePaths ?? [],\n prismaConverterIgnoreEpoch: options.prismaConverter?.ignoreModifiedUntilEpoch,\n noDestructureMode: options.noDestructure?.mode ?? 'OFF',\n noDestructureDisableAllowed: options.noDestructure?.disableAllowed ?? true,\n noDestructureIgnoreEpoch: options.noDestructure?.ignoreModifiedUntilEpoch,\n catchErrorPatternMode: options.catchErrorPattern?.mode ?? 'OFF',\n catchErrorPatternDisableAllowed: options.catchErrorPattern?.disableAllowed ?? true,\n catchErrorPatternIgnoreEpoch: options.catchErrorPattern?.ignoreModifiedUntilEpoch,\n noUnmanagedExceptionsMode: options.noUnmanagedExceptions?.mode ?? 'OFF',\n noUnmanagedExceptionsDisableAllowed: options.noUnmanagedExceptions?.disableAllowed ?? true,\n noUnmanagedExceptionsIgnoreEpoch: options.noUnmanagedExceptions?.ignoreModifiedUntilEpoch,\n noDirectApiResolverMode: options.noDirectApiInResolver?.mode ?? 'OFF',\n noDirectApiResolverDisableAllowed: options.noDirectApiInResolver?.disableAllowed ?? true,\n noDirectApiResolverIgnoreEpoch: options.noDirectApiInResolver?.ignoreModifiedUntilEpoch,\n noDirectApiResolverEnforcePaths: options.noDirectApiInResolver?.enforcePaths ?? [],\n };\n}\n\nfunction formatOverride(override: OverrideInfo | undefined): string {\n if (!override) {\n return '';\n }\n return ` (override active, normal: ${override.normalMode}, expires: ${override.expiresDate})`;\n}\n\nfunction logConfig(config: ParsedConfig): void {\n console.log('\\n\\ud83d\\udccf Running Code Validations\\n');\n console.log(` Method limits: mode=${config.methodMode}${formatOverride(config.methodOverride)}, limit=${config.methodLimit}, disableAllowed=${config.methodDisableAllowed}`);\n console.log(` File limits: mode=${config.fileMode}${formatOverride(config.fileOverride)}, limit=${config.fileLimit}, disableAllowed=${config.fileDisableAllowed}`);\n console.log(` Require return types: mode=${config.returnTypeMode}, disableAllowed=${config.returnTypeDisableAllowed}`);\n console.log(` No inline type literals: mode=${config.noInlineTypesMode}, disableAllowed=${config.noInlineTypesDisableAllowed}`);\n console.log(` No any/unknown: mode=${config.noAnyUnknownMode}, disableAllowed=${config.noAnyUnknownDisableAllowed}`);\n console.log(` No implicit any: mode=${config.noImplicitAnyMode}, disableAllowed=${config.noImplicitAnyDisableAllowed}`);\n console.log(` Validate DTOs: mode=${config.validateDtosMode}, disableAllowed=${config.validateDtosDisableAllowed}`);\n console.log(` Prisma converters: mode=${config.prismaConverterMode}, disableAllowed=${config.prismaConverterDisableAllowed}`);\n console.log(` No destructure: mode=${config.noDestructureMode}, disableAllowed=${config.noDestructureDisableAllowed}`);\n console.log(` Catch error pattern: mode=${config.catchErrorPatternMode}, disableAllowed=${config.catchErrorPatternDisableAllowed}`);\n console.log(` No unmanaged exceptions: mode=${config.noUnmanagedExceptionsMode}, disableAllowed=${config.noUnmanagedExceptionsDisableAllowed}`);\n console.log(` No direct API in resolver: mode=${config.noDirectApiResolverMode}, disableAllowed=${config.noDirectApiResolverDisableAllowed}`);\n console.log('');\n}\n\nfunction isAllOff(config: ParsedConfig): boolean {\n return config.methodMode === 'OFF' && config.fileMode === 'OFF' &&\n config.returnTypeMode === 'OFF' && config.noInlineTypesMode === 'OFF' &&\n config.noAnyUnknownMode === 'OFF' && config.noImplicitAnyMode === 'OFF' &&\n config.validateDtosMode === 'OFF' &&\n config.prismaConverterMode === 'OFF' && config.noDestructureMode === 'OFF' &&\n config.catchErrorPatternMode === 'OFF' && config.noUnmanagedExceptionsMode === 'OFF' &&\n config.noDirectApiResolverMode === 'OFF';\n}\n\nasync function runMethodValidators(config: ParsedConfig, workspaceRoot: string): Promise<ExecutorResult[]> {\n const results: ExecutorResult[] = [];\n const runNew = config.methodMode === 'NEW_METHODS' || config.methodMode === 'NEW_AND_MODIFIED_METHODS';\n const runModified = config.methodMode === 'NEW_AND_MODIFIED_METHODS' || config.methodMode === 'MODIFIED_FILES';\n\n if (runNew) {\n results.push(await runNewMethodsExecutor({\n limit: config.methodLimit,\n mode: config.methodMode, disableAllowed: config.methodDisableAllowed,\n }, workspaceRoot));\n }\n if (runModified) {\n results.push(await runModifiedMethodsExecutor({\n limit: config.methodLimit, mode: config.methodMode, disableAllowed: config.methodDisableAllowed,\n }, workspaceRoot));\n }\n return results;\n}\n\nasync function runAllValidators(config: ParsedConfig, workspaceRoot: string): Promise<ExecutorResult[]> {\n const results: ExecutorResult[] = [];\n const methodResults = await runMethodValidators(config, workspaceRoot);\n results.push(...methodResults);\n results.push(await runModifiedFilesExecutor({\n limit: config.fileLimit, mode: config.fileMode, disableAllowed: config.fileDisableAllowed,\n }, workspaceRoot));\n results.push(await runReturnTypesExecutor({\n mode: config.returnTypeMode,\n disableAllowed: config.returnTypeDisableAllowed,\n ignoreModifiedUntilEpoch: config.returnTypeIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoInlineTypesExecutor({\n mode: config.noInlineTypesMode,\n disableAllowed: config.noInlineTypesDisableAllowed,\n ignoreModifiedUntilEpoch: config.noInlineTypesIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoAnyUnknownExecutor({\n mode: config.noAnyUnknownMode,\n disableAllowed: config.noAnyUnknownDisableAllowed,\n ignoreModifiedUntilEpoch: config.noAnyUnknownIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoImplicitAnyExecutor({\n mode: config.noImplicitAnyMode,\n disableAllowed: config.noImplicitAnyDisableAllowed,\n ignoreModifiedUntilEpoch: config.noImplicitAnyIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runValidateDtosExecutor({\n mode: config.validateDtosMode,\n disableAllowed: config.validateDtosDisableAllowed,\n prismaSchemaPath: config.validateDtosPrismaPath,\n dtoSourcePaths: config.validateDtosSrcPaths,\n ignoreModifiedUntilEpoch: config.validateDtosIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runPrismaConvertersExecutor({\n mode: config.prismaConverterMode,\n disableAllowed: config.prismaConverterDisableAllowed,\n schemaPath: config.prismaConverterSchemaPath,\n convertersPaths: config.prismaConverterConvertersPaths,\n enforcePaths: config.prismaConverterEnforcePaths,\n ignoreModifiedUntilEpoch: config.prismaConverterIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoDestructureExecutor({\n mode: config.noDestructureMode,\n disableAllowed: config.noDestructureDisableAllowed,\n ignoreModifiedUntilEpoch: config.noDestructureIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runCatchErrorPatternExecutor({\n mode: config.catchErrorPatternMode,\n disableAllowed: config.catchErrorPatternDisableAllowed,\n ignoreModifiedUntilEpoch: config.catchErrorPatternIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoUnmanagedExceptionsExecutor({\n mode: config.noUnmanagedExceptionsMode,\n disableAllowed: config.noUnmanagedExceptionsDisableAllowed,\n ignoreModifiedUntilEpoch: config.noUnmanagedExceptionsIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoDirectApiResolverExecutor({\n mode: config.noDirectApiResolverMode,\n disableAllowed: config.noDirectApiResolverDisableAllowed,\n ignoreModifiedUntilEpoch: config.noDirectApiResolverIgnoreEpoch,\n enforcePaths: config.noDirectApiResolverEnforcePaths,\n }, workspaceRoot));\n return results;\n}\n\nexport default async function runValidator(\n _nxOptions: ValidateCodeOptions,\n workspaceRoot: string\n): Promise<ExecutorResult> {\n // Config comes from webpieces.config.json at the workspace root,\n // loaded via the shared @webpieces/rules-config loader so ai-hooks and\n // this executor agree on every rule's enabled/mode/options.\n const shared = loadConfig(workspaceRoot);\n if (!shared.configPath) {\n console.error('\\n❌ No webpieces.config.json found at workspace root (or any ancestor).\\n');\n return { success: false };\n }\n const options = toValidateCodeOptions(shared);\n\n const modeErrors = validateModes(options);\n if (modeErrors.length > 0) {\n console.error('');\n for (const err of modeErrors) {\n console.error(`❌ ${err}`);\n }\n console.error('');\n return { success: false };\n }\n\n console.log(`\\n📄 Loaded config: ${shared.configPath}`);\n\n const config = parseConfig(options);\n\n if (isAllOff(config)) {\n console.log('\\n\\u23ed\\ufe0f Skipping all code validations (all modes: OFF)\\n');\n return { success: true };\n }\n\n logConfig(config);\n\n const results = await runAllValidators(config, workspaceRoot);\n const allSuccess = results.every((r) => r.success);\n\n console.log(allSuccess ? '\\n\\u2705 All code validations passed\\n' : '\\n\\u274c Some code validations failed\\n');\n return { success: allSuccess };\n}\n"]}
1
+ {"version":3,"file":"validate-code.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-code.ts"],"names":[],"mappings":";;AAoYA,+BAwCC;;AA5aD,0DAAqD;AACrD,6DAA6D;AAC7D,0FAA2D;AAC3D,oGAAqE;AACrE,gGAAiE;AACjE,4FAA6D;AAC7D,kGAAkE;AAClE,gGAAgE;AAChE,kGAAkE;AAClE,4EAAsD;AACtD,sGAAuE;AACvE,gGAAiE;AACjE,0GAA0E;AAC1E,kHAAkF;AAClF,gHAA+E;AAC/E,0GAAyE;AA2FzE,MAAM,WAAW,GAA6B;IAC1C,cAAc,EAAQ,CAAC,KAAK,EAAE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IACD,MAAM,OAAO,GAAG,IAAA,0CAAqB,EAAC,MAAM,CAAC,CAAC;IAE9C,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAExD,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAEpC,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,kEAAkE,CAAC,CAAC;QAChF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,MAAM,CAAC,CAAC;IAElB,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,yCAAyC,CAAC,CAAC;IAC/G,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import { loadConfig } from '@webpieces/rules-config';\nimport { toValidateCodeOptions } from './from-shared-config';\nimport runNewMethodsExecutor from './validate-new-methods';\nimport runModifiedMethodsExecutor from './validate-modified-methods';\nimport runModifiedFilesExecutor from './validate-modified-files';\nimport runReturnTypesExecutor from './validate-return-types';\nimport runNoInlineTypesExecutor from './validate-no-inline-types';\nimport runNoAnyUnknownExecutor from './validate-no-any-unknown';\nimport runNoImplicitAnyExecutor from './validate-no-implicit-any';\nimport runValidateDtosExecutor from './validate-dtos';\nimport runPrismaConvertersExecutor from './validate-prisma-converters';\nimport runNoDestructureExecutor from './validate-no-destructure';\nimport runCatchErrorPatternExecutor from './validate-catch-error-pattern';\nimport runNoUnmanagedExceptionsExecutor from './validate-no-unmanaged-exceptions';\nimport runNoDirectApiResolverExecutor from './validate-no-direct-api-resolver';\nimport runNoSymbolDiTokensExecutor from './validate-no-symbol-di-tokens';\nimport type {\n MethodMaxLimitMode,\n FileMaxLimitMode,\n ReturnTypeMode,\n NoInlineTypesMode,\n NoAnyUnknownMode,\n NoImplicitAnyMode,\n ValidateDtosMode,\n PrismaConverterMode,\n NoDestructureMode,\n CatchErrorPatternMode,\n NoUnmanagedExceptionsMode,\n NoDirectApiResolverMode,\n NoSymbolDiTokensMode,\n MethodMaxLimitConfig,\n FileMaxLimitConfig,\n ValidateCodeOptions,\n} from './validate-code-options';\n\nexport interface ExecutorResult {\n success: boolean;\n}\n\ninterface OverrideInfo {\n active: boolean;\n normalMode: string;\n expiresDate: string;\n}\n\ninterface ParsedConfig {\n methodLimit: number;\n methodMode: MethodMaxLimitMode;\n methodDisableAllowed: boolean;\n methodOverride: OverrideInfo | undefined;\n fileLimit: number;\n fileMode: FileMaxLimitMode;\n fileDisableAllowed: boolean;\n fileOverride: OverrideInfo | undefined;\n returnTypeMode: ReturnTypeMode;\n returnTypeDisableAllowed: boolean;\n returnTypeIgnoreEpoch: number | undefined;\n noInlineTypesMode: NoInlineTypesMode;\n noInlineTypesDisableAllowed: boolean;\n noInlineTypesIgnoreEpoch: number | undefined;\n noAnyUnknownMode: NoAnyUnknownMode;\n noAnyUnknownDisableAllowed: boolean;\n noAnyUnknownIgnoreEpoch: number | undefined;\n noImplicitAnyMode: NoImplicitAnyMode;\n noImplicitAnyDisableAllowed: boolean;\n noImplicitAnyIgnoreEpoch: number | undefined;\n validateDtosMode: ValidateDtosMode;\n validateDtosDisableAllowed: boolean;\n validateDtosPrismaPath: string | undefined;\n validateDtosSrcPaths: string[];\n validateDtosIgnoreEpoch: number | undefined;\n prismaConverterMode: PrismaConverterMode;\n prismaConverterDisableAllowed: boolean;\n prismaConverterSchemaPath: string | undefined;\n prismaConverterConvertersPaths: string[];\n prismaConverterEnforcePaths: string[];\n prismaConverterIgnoreEpoch: number | undefined;\n noDestructureMode: NoDestructureMode;\n noDestructureDisableAllowed: boolean;\n noDestructureIgnoreEpoch: number | undefined;\n catchErrorPatternMode: CatchErrorPatternMode;\n catchErrorPatternDisableAllowed: boolean;\n catchErrorPatternIgnoreEpoch: number | undefined;\n noUnmanagedExceptionsMode: NoUnmanagedExceptionsMode;\n noUnmanagedExceptionsDisableAllowed: boolean;\n noUnmanagedExceptionsIgnoreEpoch: number | undefined;\n noDirectApiResolverMode: NoDirectApiResolverMode;\n noDirectApiResolverDisableAllowed: boolean;\n noDirectApiResolverIgnoreEpoch: number | undefined;\n noDirectApiResolverEnforcePaths: string[];\n noSymbolDiTokensMode: NoSymbolDiTokensMode;\n noSymbolDiTokensDisableAllowed: boolean;\n noSymbolDiTokensIgnoreEpoch: number | undefined;\n noSymbolDiTokensAllowedPaths: string[];\n}\n\ninterface ResolvedMethodMode {\n mode: MethodMaxLimitMode;\n override: OverrideInfo | undefined;\n}\n\ninterface ResolvedFileMode {\n mode: FileMaxLimitMode;\n override: OverrideInfo | undefined;\n}\n\nconst VALID_MODES: Record<string, string[]> = {\n methodMaxLimit: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n fileMaxLimit: ['OFF', 'MODIFIED_FILES'],\n requireReturnType: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noInlineTypeLiterals: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noAnyUnknown: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n noImplicitAny: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n validateDtos: ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'],\n prismaConverter: ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noDestructure: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n catchErrorPattern: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n noUnmanagedExceptions: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n noDirectApiInResolver: ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noSymbolDiTokens: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n};\n\n/**\n * Validate that all configured modes are valid. Produces clear error messages naming the rule.\n */\nfunction validateModes(options: ValidateCodeOptions): string[] {\n const errors: string[] = [];\n\n type ModeEntry = [string, string | undefined];\n const modeEntries: ModeEntry[] = [\n ['methodMaxLimit', options.methodMaxLimit?.mode],\n ['fileMaxLimit', options.fileMaxLimit?.mode],\n ['requireReturnType', options.requireReturnType?.mode],\n ['noInlineTypeLiterals', options.noInlineTypeLiterals?.mode],\n ['noAnyUnknown', options.noAnyUnknown?.mode],\n ['noImplicitAny', options.noImplicitAny?.mode],\n ['validateDtos', options.validateDtos?.mode],\n ['prismaConverter', options.prismaConverter?.mode],\n ['noDestructure', options.noDestructure?.mode],\n ['catchErrorPattern', options.catchErrorPattern?.mode],\n ['noUnmanagedExceptions', options.noUnmanagedExceptions?.mode],\n ['noDirectApiInResolver', options.noDirectApiInResolver?.mode],\n ['noSymbolDiTokens', options.noSymbolDiTokens?.mode],\n ];\n\n for (const entry of modeEntries) {\n const ruleName = entry[0];\n const modeValue = entry[1];\n if (modeValue === undefined) continue;\n const validModes = VALID_MODES[ruleName];\n if (!validModes.includes(modeValue)) {\n errors.push(`${ruleName}.mode = '${modeValue}' is invalid. Valid modes: ${validModes.join(', ')}`);\n }\n }\n\n return errors;\n}\n\nfunction formatEpochDate(epoch: number): string {\n return new Date(epoch * 1000).toISOString().split('T')[0];\n}\n\nfunction resolveMethodMode(\n normalMode: MethodMaxLimitMode, epoch: number | undefined\n): ResolvedMethodMode {\n if (epoch === undefined) {\n return { mode: normalMode, override: undefined };\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n // Active: downgrade to skip modified checking\n const downgraded: MethodMaxLimitMode =\n normalMode === 'OFF' ? 'OFF' : 'NEW_METHODS';\n return {\n mode: downgraded,\n override: { active: true, normalMode, expiresDate: formatEpochDate(epoch) },\n };\n }\n // Expired\n return { mode: normalMode, override: undefined };\n}\n\nfunction resolveFileMode(\n normalMode: FileMaxLimitMode, epoch: number | undefined\n): ResolvedFileMode {\n if (epoch === undefined) {\n return { mode: normalMode, override: undefined };\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n // Active: file checking is inherently about modified files, so skip entirely\n return {\n mode: 'OFF',\n override: { active: true, normalMode, expiresDate: formatEpochDate(epoch) },\n };\n }\n // Expired\n return { mode: normalMode, override: undefined };\n}\n\nfunction parseConfig(options: ValidateCodeOptions): ParsedConfig {\n const methodConfig: MethodMaxLimitConfig = options.methodMaxLimit ?? {};\n const fileConfig: FileMaxLimitConfig = options.fileMaxLimit ?? {};\n\n const normalMethodMode = methodConfig.mode ?? 'NEW_AND_MODIFIED_METHODS';\n const normalFileMode = fileConfig.mode ?? 'MODIFIED_FILES';\n\n const methodResolved = resolveMethodMode(normalMethodMode, methodConfig.ignoreModifiedUntilEpoch);\n const fileResolved = resolveFileMode(normalFileMode, fileConfig.ignoreModifiedUntilEpoch);\n\n return {\n methodLimit: methodConfig.limit ?? 80,\n methodMode: methodResolved.mode,\n methodDisableAllowed: methodConfig.disableAllowed ?? true,\n methodOverride: methodResolved.override,\n fileLimit: fileConfig.limit ?? 900,\n fileMode: fileResolved.mode,\n fileDisableAllowed: fileConfig.disableAllowed ?? true,\n fileOverride: fileResolved.override,\n returnTypeMode: options.requireReturnType?.mode ?? 'OFF',\n returnTypeDisableAllowed: options.requireReturnType?.disableAllowed ?? true,\n returnTypeIgnoreEpoch: options.requireReturnType?.ignoreModifiedUntilEpoch,\n noInlineTypesMode: options.noInlineTypeLiterals?.mode ?? 'OFF',\n noInlineTypesDisableAllowed: options.noInlineTypeLiterals?.disableAllowed ?? true,\n noInlineTypesIgnoreEpoch: options.noInlineTypeLiterals?.ignoreModifiedUntilEpoch,\n noAnyUnknownMode: options.noAnyUnknown?.mode ?? 'OFF',\n noAnyUnknownDisableAllowed: options.noAnyUnknown?.disableAllowed ?? true,\n noAnyUnknownIgnoreEpoch: options.noAnyUnknown?.ignoreModifiedUntilEpoch,\n noImplicitAnyMode: options.noImplicitAny?.mode ?? 'OFF',\n noImplicitAnyDisableAllowed: options.noImplicitAny?.disableAllowed ?? true,\n noImplicitAnyIgnoreEpoch: options.noImplicitAny?.ignoreModifiedUntilEpoch,\n validateDtosMode: options.validateDtos?.mode ?? 'OFF',\n validateDtosDisableAllowed: options.validateDtos?.disableAllowed ?? true,\n validateDtosPrismaPath: options.validateDtos?.prismaSchemaPath,\n validateDtosSrcPaths: options.validateDtos?.dtoSourcePaths ?? [],\n validateDtosIgnoreEpoch: options.validateDtos?.ignoreModifiedUntilEpoch,\n prismaConverterMode: options.prismaConverter?.mode ?? 'OFF',\n prismaConverterDisableAllowed: options.prismaConverter?.disableAllowed ?? true,\n prismaConverterSchemaPath: options.prismaConverter?.schemaPath,\n prismaConverterConvertersPaths: options.prismaConverter?.convertersPaths ?? [],\n prismaConverterEnforcePaths: options.prismaConverter?.enforcePaths ?? [],\n prismaConverterIgnoreEpoch: options.prismaConverter?.ignoreModifiedUntilEpoch,\n noDestructureMode: options.noDestructure?.mode ?? 'OFF',\n noDestructureDisableAllowed: options.noDestructure?.disableAllowed ?? true,\n noDestructureIgnoreEpoch: options.noDestructure?.ignoreModifiedUntilEpoch,\n catchErrorPatternMode: options.catchErrorPattern?.mode ?? 'OFF',\n catchErrorPatternDisableAllowed: options.catchErrorPattern?.disableAllowed ?? true,\n catchErrorPatternIgnoreEpoch: options.catchErrorPattern?.ignoreModifiedUntilEpoch,\n noUnmanagedExceptionsMode: options.noUnmanagedExceptions?.mode ?? 'OFF',\n noUnmanagedExceptionsDisableAllowed: options.noUnmanagedExceptions?.disableAllowed ?? true,\n noUnmanagedExceptionsIgnoreEpoch: options.noUnmanagedExceptions?.ignoreModifiedUntilEpoch,\n noDirectApiResolverMode: options.noDirectApiInResolver?.mode ?? 'OFF',\n noDirectApiResolverDisableAllowed: options.noDirectApiInResolver?.disableAllowed ?? true,\n noDirectApiResolverIgnoreEpoch: options.noDirectApiInResolver?.ignoreModifiedUntilEpoch,\n noDirectApiResolverEnforcePaths: options.noDirectApiInResolver?.enforcePaths ?? [],\n noSymbolDiTokensMode: options.noSymbolDiTokens?.mode ?? 'OFF',\n noSymbolDiTokensDisableAllowed: options.noSymbolDiTokens?.disableAllowed ?? true,\n noSymbolDiTokensIgnoreEpoch: options.noSymbolDiTokens?.ignoreModifiedUntilEpoch,\n noSymbolDiTokensAllowedPaths: options.noSymbolDiTokens?.allowedPaths ?? [],\n };\n}\n\nfunction formatOverride(override: OverrideInfo | undefined): string {\n if (!override) {\n return '';\n }\n return ` (override active, normal: ${override.normalMode}, expires: ${override.expiresDate})`;\n}\n\nfunction logConfig(config: ParsedConfig): void {\n console.log('\\n\\ud83d\\udccf Running Code Validations\\n');\n console.log(` Method limits: mode=${config.methodMode}${formatOverride(config.methodOverride)}, limit=${config.methodLimit}, disableAllowed=${config.methodDisableAllowed}`);\n console.log(` File limits: mode=${config.fileMode}${formatOverride(config.fileOverride)}, limit=${config.fileLimit}, disableAllowed=${config.fileDisableAllowed}`);\n console.log(` Require return types: mode=${config.returnTypeMode}, disableAllowed=${config.returnTypeDisableAllowed}`);\n console.log(` No inline type literals: mode=${config.noInlineTypesMode}, disableAllowed=${config.noInlineTypesDisableAllowed}`);\n console.log(` No any/unknown: mode=${config.noAnyUnknownMode}, disableAllowed=${config.noAnyUnknownDisableAllowed}`);\n console.log(` No implicit any: mode=${config.noImplicitAnyMode}, disableAllowed=${config.noImplicitAnyDisableAllowed}`);\n console.log(` Validate DTOs: mode=${config.validateDtosMode}, disableAllowed=${config.validateDtosDisableAllowed}`);\n console.log(` Prisma converters: mode=${config.prismaConverterMode}, disableAllowed=${config.prismaConverterDisableAllowed}`);\n console.log(` No destructure: mode=${config.noDestructureMode}, disableAllowed=${config.noDestructureDisableAllowed}`);\n console.log(` Catch error pattern: mode=${config.catchErrorPatternMode}, disableAllowed=${config.catchErrorPatternDisableAllowed}`);\n console.log(` No unmanaged exceptions: mode=${config.noUnmanagedExceptionsMode}, disableAllowed=${config.noUnmanagedExceptionsDisableAllowed}`);\n console.log(` No direct API in resolver: mode=${config.noDirectApiResolverMode}, disableAllowed=${config.noDirectApiResolverDisableAllowed}`);\n console.log(` No Symbol DI tokens: mode=${config.noSymbolDiTokensMode}, disableAllowed=${config.noSymbolDiTokensDisableAllowed}`);\n console.log('');\n}\n\nfunction isAllOff(config: ParsedConfig): boolean {\n return config.methodMode === 'OFF' && config.fileMode === 'OFF' &&\n config.returnTypeMode === 'OFF' && config.noInlineTypesMode === 'OFF' &&\n config.noAnyUnknownMode === 'OFF' && config.noImplicitAnyMode === 'OFF' &&\n config.validateDtosMode === 'OFF' &&\n config.prismaConverterMode === 'OFF' && config.noDestructureMode === 'OFF' &&\n config.catchErrorPatternMode === 'OFF' && config.noUnmanagedExceptionsMode === 'OFF' &&\n config.noDirectApiResolverMode === 'OFF' && config.noSymbolDiTokensMode === 'OFF';\n}\n\nasync function runMethodValidators(config: ParsedConfig, workspaceRoot: string): Promise<ExecutorResult[]> {\n const results: ExecutorResult[] = [];\n const runNew = config.methodMode === 'NEW_METHODS' || config.methodMode === 'NEW_AND_MODIFIED_METHODS';\n const runModified = config.methodMode === 'NEW_AND_MODIFIED_METHODS' || config.methodMode === 'MODIFIED_FILES';\n\n if (runNew) {\n results.push(await runNewMethodsExecutor({\n limit: config.methodLimit,\n mode: config.methodMode, disableAllowed: config.methodDisableAllowed,\n }, workspaceRoot));\n }\n if (runModified) {\n results.push(await runModifiedMethodsExecutor({\n limit: config.methodLimit, mode: config.methodMode, disableAllowed: config.methodDisableAllowed,\n }, workspaceRoot));\n }\n return results;\n}\n\nasync function runAllValidators(config: ParsedConfig, workspaceRoot: string): Promise<ExecutorResult[]> {\n const results: ExecutorResult[] = [];\n const methodResults = await runMethodValidators(config, workspaceRoot);\n results.push(...methodResults);\n results.push(await runModifiedFilesExecutor({\n limit: config.fileLimit, mode: config.fileMode, disableAllowed: config.fileDisableAllowed,\n }, workspaceRoot));\n results.push(await runReturnTypesExecutor({\n mode: config.returnTypeMode,\n disableAllowed: config.returnTypeDisableAllowed,\n ignoreModifiedUntilEpoch: config.returnTypeIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoInlineTypesExecutor({\n mode: config.noInlineTypesMode,\n disableAllowed: config.noInlineTypesDisableAllowed,\n ignoreModifiedUntilEpoch: config.noInlineTypesIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoAnyUnknownExecutor({\n mode: config.noAnyUnknownMode,\n disableAllowed: config.noAnyUnknownDisableAllowed,\n ignoreModifiedUntilEpoch: config.noAnyUnknownIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoImplicitAnyExecutor({\n mode: config.noImplicitAnyMode,\n disableAllowed: config.noImplicitAnyDisableAllowed,\n ignoreModifiedUntilEpoch: config.noImplicitAnyIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runValidateDtosExecutor({\n mode: config.validateDtosMode,\n disableAllowed: config.validateDtosDisableAllowed,\n prismaSchemaPath: config.validateDtosPrismaPath,\n dtoSourcePaths: config.validateDtosSrcPaths,\n ignoreModifiedUntilEpoch: config.validateDtosIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runPrismaConvertersExecutor({\n mode: config.prismaConverterMode,\n disableAllowed: config.prismaConverterDisableAllowed,\n schemaPath: config.prismaConverterSchemaPath,\n convertersPaths: config.prismaConverterConvertersPaths,\n enforcePaths: config.prismaConverterEnforcePaths,\n ignoreModifiedUntilEpoch: config.prismaConverterIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoDestructureExecutor({\n mode: config.noDestructureMode,\n disableAllowed: config.noDestructureDisableAllowed,\n ignoreModifiedUntilEpoch: config.noDestructureIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runCatchErrorPatternExecutor({\n mode: config.catchErrorPatternMode,\n disableAllowed: config.catchErrorPatternDisableAllowed,\n ignoreModifiedUntilEpoch: config.catchErrorPatternIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoUnmanagedExceptionsExecutor({\n mode: config.noUnmanagedExceptionsMode,\n disableAllowed: config.noUnmanagedExceptionsDisableAllowed,\n ignoreModifiedUntilEpoch: config.noUnmanagedExceptionsIgnoreEpoch,\n }, workspaceRoot));\n results.push(await runNoDirectApiResolverExecutor({\n mode: config.noDirectApiResolverMode,\n disableAllowed: config.noDirectApiResolverDisableAllowed,\n ignoreModifiedUntilEpoch: config.noDirectApiResolverIgnoreEpoch,\n enforcePaths: config.noDirectApiResolverEnforcePaths,\n }, workspaceRoot));\n results.push(await runNoSymbolDiTokensExecutor({\n mode: config.noSymbolDiTokensMode,\n disableAllowed: config.noSymbolDiTokensDisableAllowed,\n ignoreModifiedUntilEpoch: config.noSymbolDiTokensIgnoreEpoch,\n allowedPaths: config.noSymbolDiTokensAllowedPaths,\n }, workspaceRoot));\n return results;\n}\n\nexport default async function runValidator(\n _nxOptions: ValidateCodeOptions,\n workspaceRoot: string\n): Promise<ExecutorResult> {\n // Config comes from webpieces.config.json at the workspace root,\n // loaded via the shared @webpieces/rules-config loader so ai-hooks and\n // this executor agree on every rule's enabled/mode/options.\n const shared = loadConfig(workspaceRoot);\n if (!shared.configPath) {\n console.error('\\n❌ No webpieces.config.json found at workspace root (or any ancestor).\\n');\n return { success: false };\n }\n const options = toValidateCodeOptions(shared);\n\n const modeErrors = validateModes(options);\n if (modeErrors.length > 0) {\n console.error('');\n for (const err of modeErrors) {\n console.error(`❌ ${err}`);\n }\n console.error('');\n return { success: false };\n }\n\n console.log(`\\n📄 Loaded config: ${shared.configPath}`);\n\n const config = parseConfig(options);\n\n if (isAllOff(config)) {\n console.log('\\n\\u23ed\\ufe0f Skipping all code validations (all modes: OFF)\\n');\n return { success: true };\n }\n\n logConfig(config);\n\n const results = await runAllValidators(config, workspaceRoot);\n const allSuccess = results.every((r) => r.success);\n\n console.log(allSuccess ? '\\n\\u2705 All code validations passed\\n' : '\\n\\u274c Some code validations failed\\n');\n return { success: allSuccess };\n}\n"]}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Validate No Symbol DI Tokens Executor
3
+ *
4
+ * Validates that Symbol() / Symbol.for() are not used to create DI tokens
5
+ * outside of the designated API-binding packages.
6
+ *
7
+ * ============================================================================
8
+ * VIOLATIONS (BAD) - These patterns are flagged:
9
+ * ============================================================================
10
+ *
11
+ * - export const MY_TOKEN = Symbol('MY_TOKEN')
12
+ * - export const MY_TOKEN = Symbol.for('MY_TOKEN')
13
+ * - const TOKEN: symbol = Symbol('TOKEN')
14
+ *
15
+ * ============================================================================
16
+ * ALLOWED
17
+ * ============================================================================
18
+ *
19
+ * - Files under allowedPaths (e.g. libraries/apis/**, libraries/apis-external/**)
20
+ * - Test files (*.test.ts, *.spec.ts, __tests__/**)
21
+ * - Lines with // webpieces-disable no-symbol-di-tokens -- <reason> (when disableAllowed: true)
22
+ *
23
+ * ============================================================================
24
+ * MODES (LINE-BASED)
25
+ * ============================================================================
26
+ * - OFF: Skip validation entirely
27
+ * - MODIFIED_CODE: Flag Symbol DI tokens on changed lines (lines in diff hunks)
28
+ * - MODIFIED_FILES: Flag ALL Symbol DI tokens in files that were modified
29
+ *
30
+ * ============================================================================
31
+ * ESCAPE HATCH
32
+ * ============================================================================
33
+ * Add comment on the same line or line above the violation:
34
+ * // webpieces-disable no-symbol-di-tokens -- [your justification]
35
+ * export const MY_TOKEN = Symbol('MY_TOKEN');
36
+ */
37
+ export type NoSymbolDiTokensMode = 'OFF' | 'MODIFIED_CODE' | 'MODIFIED_FILES';
38
+ export interface ValidateNoSymbolDiTokensOptions {
39
+ mode?: NoSymbolDiTokensMode;
40
+ disableAllowed?: boolean;
41
+ ignoreModifiedUntilEpoch?: number;
42
+ allowedPaths?: string[];
43
+ }
44
+ export interface ExecutorResult {
45
+ success: boolean;
46
+ }
47
+ interface SymbolViolationInfo {
48
+ line: number;
49
+ context: string;
50
+ hasDisableComment: boolean;
51
+ }
52
+ export declare function findSymbolViolationsInFile(filePath: string, workspaceRoot: string, disableAllowed: boolean, allowedPaths: string[]): SymbolViolationInfo[];
53
+ export default function runNoSymbolDiTokensExecutor(options: ValidateNoSymbolDiTokensOptions, workspaceRoot: string): Promise<ExecutorResult>;
54
+ export {};
@@ -0,0 +1,378 @@
1
+ "use strict";
2
+ /**
3
+ * Validate No Symbol DI Tokens Executor
4
+ *
5
+ * Validates that Symbol() / Symbol.for() are not used to create DI tokens
6
+ * outside of the designated API-binding packages.
7
+ *
8
+ * ============================================================================
9
+ * VIOLATIONS (BAD) - These patterns are flagged:
10
+ * ============================================================================
11
+ *
12
+ * - export const MY_TOKEN = Symbol('MY_TOKEN')
13
+ * - export const MY_TOKEN = Symbol.for('MY_TOKEN')
14
+ * - const TOKEN: symbol = Symbol('TOKEN')
15
+ *
16
+ * ============================================================================
17
+ * ALLOWED
18
+ * ============================================================================
19
+ *
20
+ * - Files under allowedPaths (e.g. libraries/apis/**, libraries/apis-external/**)
21
+ * - Test files (*.test.ts, *.spec.ts, __tests__/**)
22
+ * - Lines with // webpieces-disable no-symbol-di-tokens -- <reason> (when disableAllowed: true)
23
+ *
24
+ * ============================================================================
25
+ * MODES (LINE-BASED)
26
+ * ============================================================================
27
+ * - OFF: Skip validation entirely
28
+ * - MODIFIED_CODE: Flag Symbol DI tokens on changed lines (lines in diff hunks)
29
+ * - MODIFIED_FILES: Flag ALL Symbol DI tokens in files that were modified
30
+ *
31
+ * ============================================================================
32
+ * ESCAPE HATCH
33
+ * ============================================================================
34
+ * Add comment on the same line or line above the violation:
35
+ * // webpieces-disable no-symbol-di-tokens -- [your justification]
36
+ * export const MY_TOKEN = Symbol('MY_TOKEN');
37
+ */
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.findSymbolViolationsInFile = findSymbolViolationsInFile;
40
+ exports.default = runNoSymbolDiTokensExecutor;
41
+ const tslib_1 = require("tslib");
42
+ const child_process_1 = require("child_process");
43
+ const fs = tslib_1.__importStar(require("fs"));
44
+ const path = tslib_1.__importStar(require("path"));
45
+ const SYMBOL_DI_REGEX = /=\s*Symbol(?:\.for)?\(/;
46
+ const SHARED_MESSAGE = `Do not create a dependency-injection token with Symbol(). Symbol() for DI is allowed in ONLY two places:
47
+ 1. INTERNAL apis (libraries/apis/**) — bind the generated client to its API.
48
+ 2. EXTERNAL apis (libraries/apis-external/**) — bind the impl to its API (impl wraps the external SDK).
49
+ EVERYWHERE ELSE, do NOT define a Symbol token and do NOT use @inject(TOKEN).
50
+ Instead: annotate the implementation class with @provideSingleton() and inject it by its concrete class TYPE,
51
+ e.g. constructor(private readonly identityResolver: IdentityResolver) {} // no Symbol, no @inject.
52
+ For a swappable default-impl-behind-an-interface, use @provideSingletonAs(TOKEN) — only inside libraries/apis(-external).
53
+ If this specific line is a legitimate binding or framework primitive, append: // webpieces-disable no-symbol-di-tokens -- <reason>`;
54
+ function isTestFile(filePath) {
55
+ return filePath.includes('.spec.ts') ||
56
+ filePath.includes('.test.ts') ||
57
+ filePath.includes('__tests__/');
58
+ }
59
+ function globToRegex(pattern) {
60
+ let re = '';
61
+ let i = 0;
62
+ while (i < pattern.length) {
63
+ const ch = pattern[i];
64
+ if (ch === '*') {
65
+ if (pattern[i + 1] === '*') {
66
+ re += '.*';
67
+ i += 2;
68
+ if (pattern[i] === '/')
69
+ i += 1;
70
+ continue;
71
+ }
72
+ re += '[^/]*';
73
+ i += 1;
74
+ continue;
75
+ }
76
+ if (ch === '?') {
77
+ re += '[^/]';
78
+ i += 1;
79
+ continue;
80
+ }
81
+ if ('.+^$(){}|[]\\'.includes(ch)) {
82
+ re += '\\' + ch;
83
+ i += 1;
84
+ continue;
85
+ }
86
+ re += ch;
87
+ i += 1;
88
+ }
89
+ return new RegExp('^' + re + '$');
90
+ }
91
+ function isAllowedPath(filePath, allowedPaths) {
92
+ for (const pattern of allowedPaths) {
93
+ if (globToRegex(pattern).test(filePath)) {
94
+ return true;
95
+ }
96
+ }
97
+ return false;
98
+ }
99
+ function stripLineComments(line) {
100
+ const idx = line.indexOf('//');
101
+ if (idx === -1)
102
+ return line;
103
+ return line.substring(0, idx);
104
+ }
105
+ function hasDisableOnLine(line) {
106
+ return line.includes('webpieces-disable') && line.includes('no-symbol-di-tokens');
107
+ }
108
+ function resolveDisable(disabled, disableAllowed) {
109
+ if (!disableAllowed && disabled) {
110
+ return false;
111
+ }
112
+ return disabled;
113
+ }
114
+ function findSymbolViolationsInFile(filePath, workspaceRoot, disableAllowed, allowedPaths) {
115
+ if (isTestFile(filePath))
116
+ return [];
117
+ if (isAllowedPath(filePath, allowedPaths))
118
+ return [];
119
+ const fullPath = path.join(workspaceRoot, filePath);
120
+ if (!fs.existsSync(fullPath))
121
+ return [];
122
+ const content = fs.readFileSync(fullPath, 'utf-8');
123
+ const lines = content.split('\n');
124
+ const violations = [];
125
+ for (let i = 0; i < lines.length; i++) {
126
+ const line = lines[i] ?? '';
127
+ const stripped = stripLineComments(line);
128
+ if (!SYMBOL_DI_REGEX.test(stripped))
129
+ continue;
130
+ const lineNum = i + 1;
131
+ const prevLine = i > 0 ? (lines[i - 1] ?? '') : '';
132
+ const disabled = hasDisableOnLine(line) || hasDisableOnLine(prevLine);
133
+ violations.push({
134
+ line: lineNum,
135
+ context: line.trim(),
136
+ hasDisableComment: resolveDisable(disabled, disableAllowed),
137
+ });
138
+ }
139
+ return violations;
140
+ }
141
+ // webpieces-disable max-lines-new-methods -- Git command handling with untracked files requires multiple code paths
142
+ function getChangedTypeScriptFiles(workspaceRoot, base, head) {
143
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
144
+ try {
145
+ const diffTarget = head ? `${base} ${head}` : base;
146
+ const output = (0, child_process_1.execSync)(`git diff --name-only ${diffTarget} -- '*.ts' '*.tsx'`, {
147
+ cwd: workspaceRoot,
148
+ encoding: 'utf-8',
149
+ });
150
+ const changedFiles = output
151
+ .trim()
152
+ .split('\n')
153
+ .filter((f) => f && !isTestFile(f));
154
+ if (!head) {
155
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
156
+ try {
157
+ const untrackedOutput = (0, child_process_1.execSync)(`git ls-files --others --exclude-standard '*.ts' '*.tsx'`, {
158
+ cwd: workspaceRoot,
159
+ encoding: 'utf-8',
160
+ });
161
+ const untrackedFiles = untrackedOutput
162
+ .trim()
163
+ .split('\n')
164
+ .filter((f) => f && !isTestFile(f));
165
+ const allFiles = new Set([...changedFiles, ...untrackedFiles]);
166
+ return Array.from(allFiles);
167
+ // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
168
+ }
169
+ catch {
170
+ return changedFiles;
171
+ }
172
+ }
173
+ return changedFiles;
174
+ // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
175
+ }
176
+ catch {
177
+ return [];
178
+ }
179
+ }
180
+ function getFileDiff(workspaceRoot, file, base, head) {
181
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
182
+ try {
183
+ const diffTarget = head ? `${base} ${head}` : base;
184
+ const diff = (0, child_process_1.execSync)(`git diff ${diffTarget} -- "${file}"`, {
185
+ cwd: workspaceRoot,
186
+ encoding: 'utf-8',
187
+ });
188
+ if (!diff && !head) {
189
+ const fullPath = path.join(workspaceRoot, file);
190
+ if (fs.existsSync(fullPath)) {
191
+ const isUntracked = (0, child_process_1.execSync)(`git ls-files --others --exclude-standard "${file}"`, {
192
+ cwd: workspaceRoot,
193
+ encoding: 'utf-8',
194
+ }).trim();
195
+ if (isUntracked) {
196
+ const content = fs.readFileSync(fullPath, 'utf-8');
197
+ const fileLines = content.split('\n');
198
+ return fileLines.map((line) => `+${line}`).join('\n');
199
+ }
200
+ }
201
+ }
202
+ return diff;
203
+ // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
204
+ }
205
+ catch {
206
+ return '';
207
+ }
208
+ }
209
+ function getChangedLineNumbers(diffContent) {
210
+ const changedLines = new Set();
211
+ const lines = diffContent.split('\n');
212
+ let currentLine = 0;
213
+ for (const line of lines) {
214
+ const hunkMatch = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/);
215
+ if (hunkMatch) {
216
+ currentLine = parseInt(hunkMatch[1], 10);
217
+ continue;
218
+ }
219
+ if (line.startsWith('+') && !line.startsWith('+++')) {
220
+ changedLines.add(currentLine);
221
+ currentLine++;
222
+ }
223
+ else if (line.startsWith('-') && !line.startsWith('---')) {
224
+ // Deletions don't increment line number
225
+ }
226
+ else {
227
+ currentLine++;
228
+ }
229
+ }
230
+ return changedLines;
231
+ }
232
+ function findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed, allowedPaths) {
233
+ const violations = [];
234
+ for (const file of changedFiles) {
235
+ const diff = getFileDiff(workspaceRoot, file, base, head);
236
+ const changedLines = getChangedLineNumbers(diff);
237
+ if (changedLines.size === 0)
238
+ continue;
239
+ const allViolations = findSymbolViolationsInFile(file, workspaceRoot, disableAllowed, allowedPaths);
240
+ for (const v of allViolations) {
241
+ if (disableAllowed && v.hasDisableComment)
242
+ continue;
243
+ if (!changedLines.has(v.line))
244
+ continue;
245
+ violations.push({ file, line: v.line, context: v.context });
246
+ }
247
+ }
248
+ return violations;
249
+ }
250
+ function findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed, allowedPaths) {
251
+ const violations = [];
252
+ for (const file of changedFiles) {
253
+ const allViolations = findSymbolViolationsInFile(file, workspaceRoot, disableAllowed, allowedPaths);
254
+ for (const v of allViolations) {
255
+ if (disableAllowed && v.hasDisableComment)
256
+ continue;
257
+ violations.push({ file, line: v.line, context: v.context });
258
+ }
259
+ }
260
+ return violations;
261
+ }
262
+ function detectBase(workspaceRoot) {
263
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
264
+ try {
265
+ const mergeBase = (0, child_process_1.execSync)('git merge-base HEAD origin/main', {
266
+ cwd: workspaceRoot,
267
+ encoding: 'utf-8',
268
+ stdio: ['pipe', 'pipe', 'pipe'],
269
+ }).trim();
270
+ if (mergeBase) {
271
+ return mergeBase;
272
+ }
273
+ // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
274
+ }
275
+ catch {
276
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
277
+ try {
278
+ const mergeBase = (0, child_process_1.execSync)('git merge-base HEAD main', {
279
+ cwd: workspaceRoot,
280
+ encoding: 'utf-8',
281
+ stdio: ['pipe', 'pipe', 'pipe'],
282
+ }).trim();
283
+ if (mergeBase) {
284
+ return mergeBase;
285
+ }
286
+ // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
287
+ }
288
+ catch {
289
+ // Ignore
290
+ }
291
+ }
292
+ return null;
293
+ }
294
+ // webpieces-disable max-lines-new-methods -- Console output with guidance message and violation list
295
+ function reportViolations(violations, mode, disableAllowed) {
296
+ console.error('');
297
+ console.error('❌ Symbol() DI tokens are not allowed outside api(-external) packages!');
298
+ console.error('');
299
+ console.error(SHARED_MESSAGE);
300
+ console.error('');
301
+ for (const v of violations) {
302
+ console.error(` ❌ ${v.file}:${v.line}`);
303
+ console.error(` ${v.context}`);
304
+ }
305
+ console.error('');
306
+ if (disableAllowed) {
307
+ console.error(' Escape hatch (use sparingly):');
308
+ console.error(' // webpieces-disable no-symbol-di-tokens -- <reason>');
309
+ }
310
+ else {
311
+ console.error(' Escape hatch: DISABLED (disableAllowed: false)');
312
+ }
313
+ console.error('');
314
+ console.error(` Current mode: ${mode}`);
315
+ console.error('');
316
+ }
317
+ function resolveMode(normalMode, epoch) {
318
+ if (epoch === undefined || normalMode === 'OFF') {
319
+ return normalMode;
320
+ }
321
+ const nowSeconds = Date.now() / 1000;
322
+ if (nowSeconds < epoch) {
323
+ const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];
324
+ console.log(`\n⏭️ Skipping no-symbol-di-tokens validation (ignoreModifiedUntilEpoch active, expires: ${expiresDate})`);
325
+ console.log('');
326
+ return 'OFF';
327
+ }
328
+ return normalMode;
329
+ }
330
+ async function runNoSymbolDiTokensExecutor(options, workspaceRoot) {
331
+ const mode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);
332
+ const disableAllowed = options.disableAllowed ?? true;
333
+ const allowedPaths = options.allowedPaths ?? [
334
+ 'libraries/apis/**',
335
+ 'libraries/apis-external/**',
336
+ 'packages/http/http-api/**',
337
+ ];
338
+ if (mode === 'OFF') {
339
+ console.log('\n⏭️ Skipping no-symbol-di-tokens validation (mode: OFF)');
340
+ console.log('');
341
+ return { success: true };
342
+ }
343
+ console.log('\n📏 Validating No Symbol DI Tokens\n');
344
+ console.log(` Mode: ${mode}`);
345
+ let base = process.env['NX_BASE'];
346
+ const head = process.env['NX_HEAD'];
347
+ if (!base) {
348
+ base = detectBase(workspaceRoot) ?? undefined;
349
+ if (!base) {
350
+ console.log('\n⏭️ Skipping no-symbol-di-tokens validation (could not detect base branch)');
351
+ console.log('');
352
+ return { success: true };
353
+ }
354
+ }
355
+ console.log(` Base: ${base}`);
356
+ console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);
357
+ console.log('');
358
+ const changedFiles = getChangedTypeScriptFiles(workspaceRoot, base, head);
359
+ if (changedFiles.length === 0) {
360
+ console.log('✅ No TypeScript files changed');
361
+ return { success: true };
362
+ }
363
+ console.log(`📂 Checking ${changedFiles.length} changed file(s)...`);
364
+ let violations = [];
365
+ if (mode === 'MODIFIED_CODE') {
366
+ violations = findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed, allowedPaths);
367
+ }
368
+ else if (mode === 'MODIFIED_FILES') {
369
+ violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed, allowedPaths);
370
+ }
371
+ if (violations.length === 0) {
372
+ console.log('✅ No Symbol DI token violations found');
373
+ return { success: true };
374
+ }
375
+ reportViolations(violations, mode, disableAllowed);
376
+ return { success: false };
377
+ }
378
+ //# sourceMappingURL=validate-no-symbol-di-tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-no-symbol-di-tokens.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-no-symbol-di-tokens.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;;AA0GH,gEAkCC;AA4ND,8CA+DC;;AAraD,iDAAyC;AACzC,+CAAyB;AACzB,mDAA6B;AAe7B,MAAM,eAAe,GAAG,wBAAwB,CAAC;AAEjD,MAAM,cAAc,GAAG;;;;;;;oIAO6G,CAAC;AAcrI,SAAS,UAAU,CAAC,QAAgB;IAChC,OAAO,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAChC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC7B,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,WAAW,CAAC,OAAe;IAChC,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QACxB,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YACb,IAAI,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CA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,6CAA6C,EAAE,CAAC,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,MAAM,YAAY,GAAG,yBAAyB,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAE1E,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC7C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,eAAe,YAAY,CAAC,MAAM,qBAAqB,CAAC,CAAC;IAErE,IAAI,UAAU,GAAsB,EAAE,CAAC;IAEvC,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;QAC3B,UAAU,GAAG,6BAA6B,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IACtH,CAAC;SAAM,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACnC,UAAU,GAAG,8BAA8B,CAAC,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAC3G,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;QACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,gBAAgB,CAAC,UAAU,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAEnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/**\n * Validate No Symbol DI Tokens Executor\n *\n * Validates that Symbol() / Symbol.for() are not used to create DI tokens\n * outside of the designated API-binding packages.\n *\n * ============================================================================\n * VIOLATIONS (BAD) - These patterns are flagged:\n * ============================================================================\n *\n * - export const MY_TOKEN = Symbol('MY_TOKEN')\n * - export const MY_TOKEN = Symbol.for('MY_TOKEN')\n * - const TOKEN: symbol = Symbol('TOKEN')\n *\n * ============================================================================\n * ALLOWED\n * ============================================================================\n *\n * - Files under allowedPaths (e.g. libraries/apis/**, libraries/apis-external/**)\n * - Test files (*.test.ts, *.spec.ts, __tests__/**)\n * - Lines with // webpieces-disable no-symbol-di-tokens -- <reason> (when disableAllowed: true)\n *\n * ============================================================================\n * MODES (LINE-BASED)\n * ============================================================================\n * - OFF: Skip validation entirely\n * - MODIFIED_CODE: Flag Symbol DI tokens on changed lines (lines in diff hunks)\n * - MODIFIED_FILES: Flag ALL Symbol DI tokens in files that were modified\n *\n * ============================================================================\n * ESCAPE HATCH\n * ============================================================================\n * Add comment on the same line or line above the violation:\n * // webpieces-disable no-symbol-di-tokens -- [your justification]\n * export const MY_TOKEN = Symbol('MY_TOKEN');\n */\n\nimport { execSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nexport type NoSymbolDiTokensMode = 'OFF' | 'MODIFIED_CODE' | 'MODIFIED_FILES';\n\nexport interface ValidateNoSymbolDiTokensOptions {\n mode?: NoSymbolDiTokensMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n allowedPaths?: string[];\n}\n\nexport interface ExecutorResult {\n success: boolean;\n}\n\nconst SYMBOL_DI_REGEX = /=\\s*Symbol(?:\\.for)?\\(/;\n\nconst SHARED_MESSAGE = `Do not create a dependency-injection token with Symbol(). Symbol() for DI is allowed in ONLY two places:\n 1. INTERNAL apis (libraries/apis/**) — bind the generated client to its API.\n 2. EXTERNAL apis (libraries/apis-external/**) — bind the impl to its API (impl wraps the external SDK).\nEVERYWHERE ELSE, do NOT define a Symbol token and do NOT use @inject(TOKEN).\nInstead: annotate the implementation class with @provideSingleton() and inject it by its concrete class TYPE,\ne.g. constructor(private readonly identityResolver: IdentityResolver) {} // no Symbol, no @inject.\nFor a swappable default-impl-behind-an-interface, use @provideSingletonAs(TOKEN) — only inside libraries/apis(-external).\nIf this specific line is a legitimate binding or framework primitive, append: // webpieces-disable no-symbol-di-tokens -- <reason>`;\n\ninterface SymbolViolation {\n file: string;\n line: number;\n context: string;\n}\n\ninterface SymbolViolationInfo {\n line: number;\n context: string;\n hasDisableComment: boolean;\n}\n\nfunction isTestFile(filePath: string): boolean {\n return filePath.includes('.spec.ts') ||\n filePath.includes('.test.ts') ||\n filePath.includes('__tests__/');\n}\n\nfunction globToRegex(pattern: string): RegExp {\n let re = '';\n let i = 0;\n while (i < pattern.length) {\n const ch = pattern[i];\n if (ch === '*') {\n if (pattern[i + 1] === '*') {\n re += '.*';\n i += 2;\n if (pattern[i] === '/') i += 1;\n continue;\n }\n re += '[^/]*';\n i += 1;\n continue;\n }\n if (ch === '?') {\n re += '[^/]';\n i += 1;\n continue;\n }\n if ('.+^$(){}|[]\\\\'.includes(ch)) {\n re += '\\\\' + ch;\n i += 1;\n continue;\n }\n re += ch;\n i += 1;\n }\n return new RegExp('^' + re + '$');\n}\n\nfunction isAllowedPath(filePath: string, allowedPaths: string[]): boolean {\n for (const pattern of allowedPaths) {\n if (globToRegex(pattern).test(filePath)) {\n return true;\n }\n }\n return false;\n}\n\nfunction stripLineComments(line: string): string {\n const idx = line.indexOf('//');\n if (idx === -1) return line;\n return line.substring(0, idx);\n}\n\nfunction hasDisableOnLine(line: string): boolean {\n return line.includes('webpieces-disable') && line.includes('no-symbol-di-tokens');\n}\n\nfunction resolveDisable(disabled: boolean, disableAllowed: boolean): boolean {\n if (!disableAllowed && disabled) {\n return false;\n }\n return disabled;\n}\n\nexport function findSymbolViolationsInFile(\n filePath: string,\n workspaceRoot: string,\n disableAllowed: boolean,\n allowedPaths: string[],\n): SymbolViolationInfo[] {\n if (isTestFile(filePath)) return [];\n if (isAllowedPath(filePath, allowedPaths)) return [];\n\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const lines = content.split('\\n');\n const violations: SymbolViolationInfo[] = [];\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? '';\n const stripped = stripLineComments(line);\n\n if (!SYMBOL_DI_REGEX.test(stripped)) continue;\n\n const lineNum = i + 1;\n const prevLine = i > 0 ? (lines[i - 1] ?? '') : '';\n const disabled = hasDisableOnLine(line) || hasDisableOnLine(prevLine);\n\n violations.push({\n line: lineNum,\n context: line.trim(),\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n });\n }\n\n return violations;\n}\n\n// webpieces-disable max-lines-new-methods -- Git command handling with untracked files requires multiple code paths\nfunction getChangedTypeScriptFiles(workspaceRoot: string, base: string, head?: string): string[] {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const diffTarget = head ? `${base} ${head}` : base;\n const output = execSync(`git diff --name-only ${diffTarget} -- '*.ts' '*.tsx'`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const changedFiles = output\n .trim()\n .split('\\n')\n .filter((f: string) => f && !isTestFile(f));\n\n if (!head) {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const untrackedOutput = execSync(`git ls-files --others --exclude-standard '*.ts' '*.tsx'`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const untrackedFiles = untrackedOutput\n .trim()\n .split('\\n')\n .filter((f: string) => f && !isTestFile(f));\n const allFiles = new Set([...changedFiles, ...untrackedFiles]);\n return Array.from(allFiles);\n // webpieces-disable catch-error-pattern -- intentional swallow of git command failure\n } catch {\n return changedFiles;\n }\n }\n\n return changedFiles;\n // webpieces-disable catch-error-pattern -- intentional swallow of git command failure\n } catch {\n return [];\n }\n}\n\nfunction getFileDiff(workspaceRoot: string, file: string, base: string, head?: string): string {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const diffTarget = head ? `${base} ${head}` : base;\n const diff = execSync(`git diff ${diffTarget} -- \"${file}\"`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n\n if (!diff && !head) {\n const fullPath = path.join(workspaceRoot, file);\n if (fs.existsSync(fullPath)) {\n const isUntracked = execSync(`git ls-files --others --exclude-standard \"${file}\"`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n }).trim();\n\n if (isUntracked) {\n const content = fs.readFileSync(fullPath, 'utf-8');\n const fileLines = content.split('\\n');\n return fileLines.map((line: string) => `+${line}`).join('\\n');\n }\n }\n }\n\n return diff;\n // webpieces-disable catch-error-pattern -- intentional swallow of git command failure\n } catch {\n return '';\n }\n}\n\nfunction getChangedLineNumbers(diffContent: string): Set<number> {\n const changedLines = new Set<number>();\n const lines = diffContent.split('\\n');\n let currentLine = 0;\n\n for (const line of lines) {\n const hunkMatch = line.match(/^@@ -\\d+(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/);\n if (hunkMatch) {\n currentLine = parseInt(hunkMatch[1], 10);\n continue;\n }\n\n if (line.startsWith('+') && !line.startsWith('+++')) {\n changedLines.add(currentLine);\n currentLine++;\n } else if (line.startsWith('-') && !line.startsWith('---')) {\n // Deletions don't increment line number\n } else {\n currentLine++;\n }\n }\n\n return changedLines;\n}\n\nfunction findViolationsForModifiedCode(\n workspaceRoot: string,\n changedFiles: string[],\n base: string,\n head: string | undefined,\n disableAllowed: boolean,\n allowedPaths: string[],\n): SymbolViolation[] {\n const violations: SymbolViolation[] = [];\n\n for (const file of changedFiles) {\n const diff = getFileDiff(workspaceRoot, file, base, head);\n const changedLines = getChangedLineNumbers(diff);\n\n if (changedLines.size === 0) continue;\n\n const allViolations = findSymbolViolationsInFile(file, workspaceRoot, disableAllowed, allowedPaths);\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n if (!changedLines.has(v.line)) continue;\n\n violations.push({ file, line: v.line, context: v.context });\n }\n }\n\n return violations;\n}\n\nfunction findViolationsForModifiedFiles(\n workspaceRoot: string,\n changedFiles: string[],\n disableAllowed: boolean,\n allowedPaths: string[],\n): SymbolViolation[] {\n const violations: SymbolViolation[] = [];\n\n for (const file of changedFiles) {\n const allViolations = findSymbolViolationsInFile(file, workspaceRoot, disableAllowed, allowedPaths);\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n violations.push({ file, line: v.line, context: v.context });\n }\n }\n\n return violations;\n}\n\nfunction detectBase(workspaceRoot: string): string | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const mergeBase = execSync('git merge-base HEAD origin/main', {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n }).trim();\n\n if (mergeBase) {\n return mergeBase;\n }\n // webpieces-disable catch-error-pattern -- intentional swallow of git command failure\n } catch {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const mergeBase = execSync('git merge-base HEAD main', {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n }).trim();\n\n if (mergeBase) {\n return mergeBase;\n }\n // webpieces-disable catch-error-pattern -- intentional swallow of git command failure\n } catch {\n // Ignore\n }\n }\n return null;\n}\n\n// webpieces-disable max-lines-new-methods -- Console output with guidance message and violation list\nfunction reportViolations(violations: SymbolViolation[], mode: NoSymbolDiTokensMode, disableAllowed: boolean): void {\n console.error('');\n console.error('❌ Symbol() DI tokens are not allowed outside api(-external) packages!');\n console.error('');\n console.error(SHARED_MESSAGE);\n console.error('');\n\n for (const v of violations) {\n console.error(` ❌ ${v.file}:${v.line}`);\n console.error(` ${v.context}`);\n }\n console.error('');\n\n if (disableAllowed) {\n console.error(' Escape hatch (use sparingly):');\n console.error(' // webpieces-disable no-symbol-di-tokens -- <reason>');\n } else {\n console.error(' Escape hatch: DISABLED (disableAllowed: false)');\n }\n console.error('');\n console.error(` Current mode: ${mode}`);\n console.error('');\n}\n\nfunction resolveMode(normalMode: NoSymbolDiTokensMode, epoch: number | undefined): NoSymbolDiTokensMode {\n if (epoch === undefined || normalMode === 'OFF') {\n return normalMode;\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];\n console.log(`\\n⏭️ Skipping no-symbol-di-tokens validation (ignoreModifiedUntilEpoch active, expires: ${expiresDate})`);\n console.log('');\n return 'OFF';\n }\n return normalMode;\n}\n\nexport default async function runNoSymbolDiTokensExecutor(\n options: ValidateNoSymbolDiTokensOptions,\n workspaceRoot: string,\n): Promise<ExecutorResult> {\n const mode: NoSymbolDiTokensMode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);\n const disableAllowed = options.disableAllowed ?? true;\n const allowedPaths = options.allowedPaths ?? [\n 'libraries/apis/**',\n 'libraries/apis-external/**',\n 'packages/http/http-api/**',\n ];\n\n if (mode === 'OFF') {\n console.log('\\n⏭️ Skipping no-symbol-di-tokens validation (mode: OFF)');\n console.log('');\n return { success: true };\n }\n\n console.log('\\n📏 Validating No Symbol DI Tokens\\n');\n console.log(` Mode: ${mode}`);\n\n let base = process.env['NX_BASE'];\n const head = process.env['NX_HEAD'];\n\n if (!base) {\n base = detectBase(workspaceRoot) ?? undefined;\n\n if (!base) {\n console.log('\\n⏭️ Skipping no-symbol-di-tokens validation (could not detect base branch)');\n console.log('');\n return { success: true };\n }\n }\n\n console.log(` Base: ${base}`);\n console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);\n console.log('');\n\n const changedFiles = getChangedTypeScriptFiles(workspaceRoot, base, head);\n\n if (changedFiles.length === 0) {\n console.log('✅ No TypeScript files changed');\n return { success: true };\n }\n\n console.log(`📂 Checking ${changedFiles.length} changed file(s)...`);\n\n let violations: SymbolViolation[] = [];\n\n if (mode === 'MODIFIED_CODE') {\n violations = findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed, allowedPaths);\n } else if (mode === 'MODIFIED_FILES') {\n violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed, allowedPaths);\n }\n\n if (violations.length === 0) {\n console.log('✅ No Symbol DI token violations found');\n return { success: true };\n }\n\n reportViolations(violations, mode, disableAllowed);\n\n return { success: false };\n}\n"]}