@webpieces/dev-config 0.2.81 → 0.2.83

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.
@@ -3,6 +3,7 @@ import { ReturnTypeMode } from '../validate-return-types/executor';
3
3
  import { NoInlineTypesMode } from '../validate-no-inline-types/executor';
4
4
  import { NoAnyUnknownMode } from '../validate-no-any-unknown/executor';
5
5
  import { ValidateDtosMode } from '../validate-dtos/executor';
6
+ import { PrismaConverterMode } from '../validate-prisma-converters/executor';
6
7
  export type MethodMaxLimitMode = 'OFF' | 'NEW_METHODS' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';
7
8
  export type FileMaxLimitMode = 'OFF' | 'MODIFIED_FILES';
8
9
  export interface MethodMaxLimitConfig {
@@ -21,6 +22,13 @@ export interface ValidateDtosConfig {
21
22
  mode?: ValidateDtosMode;
22
23
  prismaSchemaPath?: string;
23
24
  dtoSourcePaths?: string[];
25
+ ignoreModifiedUntilEpoch?: number;
26
+ }
27
+ export interface PrismaConverterConfig {
28
+ mode?: PrismaConverterMode;
29
+ schemaPath?: string;
30
+ convertersPaths?: string[];
31
+ ignoreModifiedUntilEpoch?: number;
24
32
  }
25
33
  export interface ValidateCodeOptions {
26
34
  methodMaxLimit?: MethodMaxLimitConfig;
@@ -29,6 +37,7 @@ export interface ValidateCodeOptions {
29
37
  noInlineTypeLiteralsMode?: NoInlineTypesMode;
30
38
  noAnyUnknownMode?: NoAnyUnknownMode;
31
39
  validateDtos?: ValidateDtosConfig;
40
+ prismaConverter?: PrismaConverterConfig;
32
41
  }
33
42
  export interface ExecutorResult {
34
43
  success: boolean;
@@ -9,6 +9,7 @@ const executor_4 = tslib_1.__importDefault(require("../validate-return-types/exe
9
9
  const executor_5 = tslib_1.__importDefault(require("../validate-no-inline-types/executor"));
10
10
  const executor_6 = tslib_1.__importDefault(require("../validate-no-any-unknown/executor"));
11
11
  const executor_7 = tslib_1.__importDefault(require("../validate-dtos/executor"));
12
+ const executor_8 = tslib_1.__importDefault(require("../validate-prisma-converters/executor"));
12
13
  function formatEpochDate(epoch) {
13
14
  return new Date(epoch * 1000).toISOString().split('T')[0];
14
15
  }
@@ -67,6 +68,11 @@ function parseConfig(options) {
67
68
  validateDtosMode: options.validateDtos?.mode ?? 'OFF',
68
69
  validateDtosPrismaPath: options.validateDtos?.prismaSchemaPath,
69
70
  validateDtosSrcPaths: options.validateDtos?.dtoSourcePaths ?? [],
71
+ validateDtosIgnoreEpoch: options.validateDtos?.ignoreModifiedUntilEpoch,
72
+ prismaConverterMode: options.prismaConverter?.mode ?? 'OFF',
73
+ prismaConverterSchemaPath: options.prismaConverter?.schemaPath,
74
+ prismaConverterConvertersPaths: options.prismaConverter?.convertersPaths ?? [],
75
+ prismaConverterIgnoreEpoch: options.prismaConverter?.ignoreModifiedUntilEpoch,
70
76
  };
71
77
  }
72
78
  function formatOverride(override) {
@@ -83,12 +89,14 @@ function logConfig(config) {
83
89
  console.log(` No inline type literals: ${config.noInlineTypesMode}`);
84
90
  console.log(` No any/unknown: ${config.noAnyUnknownMode}`);
85
91
  console.log(` Validate DTOs: ${config.validateDtosMode}`);
92
+ console.log(` Prisma converters: ${config.prismaConverterMode}`);
86
93
  console.log('');
87
94
  }
88
95
  function isAllOff(config) {
89
96
  return config.methodMode === 'OFF' && config.fileMode === 'OFF' &&
90
97
  config.returnTypeMode === 'OFF' && config.noInlineTypesMode === 'OFF' &&
91
- config.noAnyUnknownMode === 'OFF' && config.validateDtosMode === 'OFF';
98
+ config.noAnyUnknownMode === 'OFF' && config.validateDtosMode === 'OFF' &&
99
+ config.prismaConverterMode === 'OFF';
92
100
  }
93
101
  async function runMethodValidators(config, context) {
94
102
  const results = [];
@@ -125,11 +133,18 @@ async function runExecutor(options, context) {
125
133
  mode: config.validateDtosMode,
126
134
  prismaSchemaPath: config.validateDtosPrismaPath,
127
135
  dtoSourcePaths: config.validateDtosSrcPaths,
136
+ ignoreModifiedUntilEpoch: config.validateDtosIgnoreEpoch,
137
+ }, context);
138
+ const prismaConverterResult = await (0, executor_8.default)({
139
+ mode: config.prismaConverterMode,
140
+ schemaPath: config.prismaConverterSchemaPath,
141
+ convertersPaths: config.prismaConverterConvertersPaths,
142
+ ignoreModifiedUntilEpoch: config.prismaConverterIgnoreEpoch,
128
143
  }, context);
129
144
  const allSuccess = methodResults.every((r) => r.success) &&
130
145
  fileResult.success && returnTypesResult.success &&
131
146
  noInlineTypesResult.success && noAnyUnknownResult.success &&
132
- validateDtosResult.success;
147
+ validateDtosResult.success && prismaConverterResult.success;
133
148
  console.log(allSuccess ? '\n\u2705 All code validations passed\n' : '\n\u274c Some code validations failed\n');
134
149
  return { success: allSuccess };
135
150
  }
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/dev-config/architecture/executors/validate-code/executor.ts"],"names":[],"mappings":";;AAiMA,8BAiCC;;AAjOD,wFAAqE;AACrE,6FAA+E;AAC/E,2FAA2E;AAC3E,yFAA2F;AAC3F,4FAAmG;AACnG,2FAAgG;AAChG,iFAAsF;AAuEtF,SAAS,eAAe,CAAC,KAAa;IAClC,OAAO,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,iBAAiB,CACtB,UAA8B,EAAE,KAAyB;IAEzD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACrD,CAAC;IACD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IACrC,IAAI,UAAU,GAAG,KAAK,EAAE,CAAC;QACrB,8CAA8C;QAC9C,MAAM,UAAU,GACZ,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,a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MAAM,CAAC,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;IACjG,MAAM,mBAAmB,GAAG,MAAM,IAAA,kBAAwB,EAAC,EAAE,IAAI,EAAE,MAAM,CAAC,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAC;IACxG,MAAM,kBAAkB,GAAG,MAAM,IAAA,kBAAuB,EAAC,EAAE,IAAI,EAAE,MAAM,CAAC,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;IACrG,MAAM,kBAAkB,GAAG,MAAM,IAAA,kBAAuB,EAAC;QACrD,IAAI,EAAE,MAAM,CAAC,gBAAgB;QAC7B,gBAAgB,EAAE,MAAM,CAAC,sBAAsB;QAC/C,cAAc,EAAE,MAAM,CAAC,oBAAoB;KAC9C,EAAE,OAAO,CAAC,CAAC;IAEZ,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QACpD,UAAU,CAAC,OAAO,IAAI,iBAAiB,CAAC,OAAO;QAC/C,mBAAmB,CAAC,OAAO,IAAI,kBAAkB,CAAC,OAAO;QACzD,kBAAkB,CAAC,OAAO,CAAC;IAE/B,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 { ExecutorContext } from '@nx/devkit';\nimport runNewMethodsExecutor from '../validate-new-methods/executor';\nimport runModifiedMethodsExecutor from '../validate-modified-methods/executor';\nimport runModifiedFilesExecutor from '../validate-modified-files/executor';\nimport runReturnTypesExecutor, { ReturnTypeMode } from '../validate-return-types/executor';\nimport runNoInlineTypesExecutor, { NoInlineTypesMode } from '../validate-no-inline-types/executor';\nimport runNoAnyUnknownExecutor, { NoAnyUnknownMode } from '../validate-no-any-unknown/executor';\nimport runValidateDtosExecutor, { ValidateDtosMode } from '../validate-dtos/executor';\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 ValidateDtosConfig {\n mode?: ValidateDtosMode;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n}\n\nexport interface ValidateCodeOptions {\n methodMaxLimit?: MethodMaxLimitConfig;\n fileMaxLimit?: FileMaxLimitConfig;\n requireReturnTypeMode?: ReturnTypeMode;\n noInlineTypeLiteralsMode?: NoInlineTypesMode;\n noAnyUnknownMode?: NoAnyUnknownMode;\n validateDtos?: ValidateDtosConfig;\n}\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 noInlineTypesMode: NoInlineTypesMode;\n noAnyUnknownMode: NoAnyUnknownMode;\n validateDtosMode: ValidateDtosMode;\n validateDtosPrismaPath: string | undefined;\n validateDtosSrcPaths: 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\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 console.log(`\\n\\u26a0\\ufe0f methodMaxLimit.ignoreModifiedUntilEpoch (${epoch}) has expired (${formatEpochDate(epoch)}). Remove it from nx.json. Using normal mode: ${normalMode}\\n`);\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 console.log(`\\n\\u26a0\\ufe0f fileMaxLimit.ignoreModifiedUntilEpoch (${epoch}) has expired (${formatEpochDate(epoch)}). Remove it from nx.json. Using normal mode: ${normalMode}\\n`);\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.requireReturnTypeMode ?? 'OFF',\n noInlineTypesMode: options.noInlineTypeLiteralsMode ?? 'OFF',\n noAnyUnknownMode: options.noAnyUnknownMode ?? 'OFF',\n validateDtosMode: options.validateDtos?.mode ?? 'OFF',\n validateDtosPrismaPath: options.validateDtos?.prismaSchemaPath,\n validateDtosSrcPaths: options.validateDtos?.dtoSourcePaths ?? [],\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: ${config.returnTypeMode}`);\n console.log(` No inline type literals: ${config.noInlineTypesMode}`);\n console.log(` No any/unknown: ${config.noAnyUnknownMode}`);\n console.log(` Validate DTOs: ${config.validateDtosMode}`);\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.validateDtosMode === 'OFF';\n}\n\nasync function runMethodValidators(config: ParsedConfig, context: ExecutorContext): 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 }, context));\n }\n if (runModified) {\n results.push(await runModifiedMethodsExecutor({\n limit: config.methodLimit, mode: config.methodMode, disableAllowed: config.methodDisableAllowed,\n }, context));\n }\n return results;\n}\n\nexport default async function runExecutor(\n options: ValidateCodeOptions,\n context: ExecutorContext\n): Promise<ExecutorResult> {\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 methodResults = await runMethodValidators(config, context);\n const fileResult = await runModifiedFilesExecutor({\n limit: config.fileLimit, mode: config.fileMode, disableAllowed: config.fileDisableAllowed,\n }, context);\n const returnTypesResult = await runReturnTypesExecutor({ mode: config.returnTypeMode }, context);\n const noInlineTypesResult = await runNoInlineTypesExecutor({ mode: config.noInlineTypesMode }, context);\n const noAnyUnknownResult = await runNoAnyUnknownExecutor({ mode: config.noAnyUnknownMode }, context);\n const validateDtosResult = await runValidateDtosExecutor({\n mode: config.validateDtosMode,\n prismaSchemaPath: config.validateDtosPrismaPath,\n dtoSourcePaths: config.validateDtosSrcPaths,\n }, context);\n\n const allSuccess = methodResults.every((r) => r.success) &&\n fileResult.success && returnTypesResult.success &&\n noInlineTypesResult.success && noAnyUnknownResult.success &&\n validateDtosResult.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":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/dev-config/architecture/executors/validate-code/executor.ts"],"names":[],"mappings":";;AAuNA,8BAwCC;;AA9PD,wFAAqE;AACrE,6FAA+E;AAC/E,2FAA2E;AAC3E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kBAAuB,EAAC,EAAE,IAAI,EAAE,MAAM,CAAC,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;IACrG,MAAM,kBAAkB,GAAG,MAAM,IAAA,kBAAuB,EAAC;QACrD,IAAI,EAAE,MAAM,CAAC,gBAAgB;QAC7B,gBAAgB,EAAE,MAAM,CAAC,sBAAsB;QAC/C,cAAc,EAAE,MAAM,CAAC,oBAAoB;QAC3C,wBAAwB,EAAE,MAAM,CAAC,uBAAuB;KAC3D,EAAE,OAAO,CAAC,CAAC;IACZ,MAAM,qBAAqB,GAAG,MAAM,IAAA,kBAA2B,EAAC;QAC5D,IAAI,EAAE,MAAM,CAAC,mBAAmB;QAChC,UAAU,EAAE,MAAM,CAAC,yBAAyB;QAC5C,eAAe,EAAE,MAAM,CAAC,8BAA8B;QACtD,wBAAwB,EAAE,MAAM,CAAC,0BAA0B;KAC9D,EAAE,OAAO,CAAC,CAAC;IAEZ,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QACpD,UAAU,CAAC,OAAO,IAAI,iBAAiB,CAAC,OAAO;QAC/C,mBAAmB,CAAC,OAAO,IAAI,kBAAkB,CAAC,OAAO;QACzD,kBAAkB,CAAC,OAAO,IAAI,qBAAqB,CAAC,OAAO,CAAC;IAEhE,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 { ExecutorContext } from '@nx/devkit';\nimport runNewMethodsExecutor from '../validate-new-methods/executor';\nimport runModifiedMethodsExecutor from '../validate-modified-methods/executor';\nimport runModifiedFilesExecutor from '../validate-modified-files/executor';\nimport runReturnTypesExecutor, { ReturnTypeMode } from '../validate-return-types/executor';\nimport runNoInlineTypesExecutor, { NoInlineTypesMode } from '../validate-no-inline-types/executor';\nimport runNoAnyUnknownExecutor, { NoAnyUnknownMode } from '../validate-no-any-unknown/executor';\nimport runValidateDtosExecutor, { ValidateDtosMode } from '../validate-dtos/executor';\nimport runPrismaConvertersExecutor, { PrismaConverterMode } from '../validate-prisma-converters/executor';\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 ValidateDtosConfig {\n mode?: ValidateDtosMode;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface PrismaConverterConfig {\n mode?: PrismaConverterMode;\n schemaPath?: string;\n convertersPaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface ValidateCodeOptions {\n methodMaxLimit?: MethodMaxLimitConfig;\n fileMaxLimit?: FileMaxLimitConfig;\n requireReturnTypeMode?: ReturnTypeMode;\n noInlineTypeLiteralsMode?: NoInlineTypesMode;\n noAnyUnknownMode?: NoAnyUnknownMode;\n validateDtos?: ValidateDtosConfig;\n prismaConverter?: PrismaConverterConfig;\n}\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 noInlineTypesMode: NoInlineTypesMode;\n noAnyUnknownMode: NoAnyUnknownMode;\n validateDtosMode: ValidateDtosMode;\n validateDtosPrismaPath: string | undefined;\n validateDtosSrcPaths: string[];\n validateDtosIgnoreEpoch: number | undefined;\n prismaConverterMode: PrismaConverterMode;\n prismaConverterSchemaPath: string | undefined;\n prismaConverterConvertersPaths: string[];\n prismaConverterIgnoreEpoch: number | undefined;\n}\n\ninterface ResolvedMethodMode {\n mode: MethodMaxLimitMode;\n override: OverrideInfo | undefined;\n}\n\ninterface ResolvedFileMode {\n mode: FileMaxLimitMode;\n override: OverrideInfo | undefined;\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 console.log(`\\n\\u26a0\\ufe0f methodMaxLimit.ignoreModifiedUntilEpoch (${epoch}) has expired (${formatEpochDate(epoch)}). Remove it from nx.json. Using normal mode: ${normalMode}\\n`);\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 console.log(`\\n\\u26a0\\ufe0f fileMaxLimit.ignoreModifiedUntilEpoch (${epoch}) has expired (${formatEpochDate(epoch)}). Remove it from nx.json. Using normal mode: ${normalMode}\\n`);\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.requireReturnTypeMode ?? 'OFF',\n noInlineTypesMode: options.noInlineTypeLiteralsMode ?? 'OFF',\n noAnyUnknownMode: options.noAnyUnknownMode ?? 'OFF',\n validateDtosMode: options.validateDtos?.mode ?? 'OFF',\n validateDtosPrismaPath: options.validateDtos?.prismaSchemaPath,\n validateDtosSrcPaths: options.validateDtos?.dtoSourcePaths ?? [],\n validateDtosIgnoreEpoch: options.validateDtos?.ignoreModifiedUntilEpoch,\n prismaConverterMode: options.prismaConverter?.mode ?? 'OFF',\n prismaConverterSchemaPath: options.prismaConverter?.schemaPath,\n prismaConverterConvertersPaths: options.prismaConverter?.convertersPaths ?? [],\n prismaConverterIgnoreEpoch: options.prismaConverter?.ignoreModifiedUntilEpoch,\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: ${config.returnTypeMode}`);\n console.log(` No inline type literals: ${config.noInlineTypesMode}`);\n console.log(` No any/unknown: ${config.noAnyUnknownMode}`);\n console.log(` Validate DTOs: ${config.validateDtosMode}`);\n console.log(` Prisma converters: ${config.prismaConverterMode}`);\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.validateDtosMode === 'OFF' &&\n config.prismaConverterMode === 'OFF';\n}\n\nasync function runMethodValidators(config: ParsedConfig, context: ExecutorContext): 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 }, context));\n }\n if (runModified) {\n results.push(await runModifiedMethodsExecutor({\n limit: config.methodLimit, mode: config.methodMode, disableAllowed: config.methodDisableAllowed,\n }, context));\n }\n return results;\n}\n\nexport default async function runExecutor(\n options: ValidateCodeOptions,\n context: ExecutorContext\n): Promise<ExecutorResult> {\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 methodResults = await runMethodValidators(config, context);\n const fileResult = await runModifiedFilesExecutor({\n limit: config.fileLimit, mode: config.fileMode, disableAllowed: config.fileDisableAllowed,\n }, context);\n const returnTypesResult = await runReturnTypesExecutor({ mode: config.returnTypeMode }, context);\n const noInlineTypesResult = await runNoInlineTypesExecutor({ mode: config.noInlineTypesMode }, context);\n const noAnyUnknownResult = await runNoAnyUnknownExecutor({ mode: config.noAnyUnknownMode }, context);\n const validateDtosResult = await runValidateDtosExecutor({\n mode: config.validateDtosMode,\n prismaSchemaPath: config.validateDtosPrismaPath,\n dtoSourcePaths: config.validateDtosSrcPaths,\n ignoreModifiedUntilEpoch: config.validateDtosIgnoreEpoch,\n }, context);\n const prismaConverterResult = await runPrismaConvertersExecutor({\n mode: config.prismaConverterMode,\n schemaPath: config.prismaConverterSchemaPath,\n convertersPaths: config.prismaConverterConvertersPaths,\n ignoreModifiedUntilEpoch: config.prismaConverterIgnoreEpoch,\n }, context);\n\n const allSuccess = methodResults.every((r) => r.success) &&\n fileResult.success && returnTypesResult.success &&\n noInlineTypesResult.success && noAnyUnknownResult.success &&\n validateDtosResult.success && prismaConverterResult.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"]}
@@ -6,6 +6,7 @@ import runReturnTypesExecutor, { ReturnTypeMode } from '../validate-return-types
6
6
  import runNoInlineTypesExecutor, { NoInlineTypesMode } from '../validate-no-inline-types/executor';
7
7
  import runNoAnyUnknownExecutor, { NoAnyUnknownMode } from '../validate-no-any-unknown/executor';
8
8
  import runValidateDtosExecutor, { ValidateDtosMode } from '../validate-dtos/executor';
9
+ import runPrismaConvertersExecutor, { PrismaConverterMode } from '../validate-prisma-converters/executor';
9
10
 
10
11
  export type MethodMaxLimitMode = 'OFF' | 'NEW_METHODS' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';
11
12
  export type FileMaxLimitMode = 'OFF' | 'MODIFIED_FILES';
@@ -28,6 +29,14 @@ export interface ValidateDtosConfig {
28
29
  mode?: ValidateDtosMode;
29
30
  prismaSchemaPath?: string;
30
31
  dtoSourcePaths?: string[];
32
+ ignoreModifiedUntilEpoch?: number;
33
+ }
34
+
35
+ export interface PrismaConverterConfig {
36
+ mode?: PrismaConverterMode;
37
+ schemaPath?: string;
38
+ convertersPaths?: string[];
39
+ ignoreModifiedUntilEpoch?: number;
31
40
  }
32
41
 
33
42
  export interface ValidateCodeOptions {
@@ -37,6 +46,7 @@ export interface ValidateCodeOptions {
37
46
  noInlineTypeLiteralsMode?: NoInlineTypesMode;
38
47
  noAnyUnknownMode?: NoAnyUnknownMode;
39
48
  validateDtos?: ValidateDtosConfig;
49
+ prismaConverter?: PrismaConverterConfig;
40
50
  }
41
51
 
42
52
  export interface ExecutorResult {
@@ -64,6 +74,11 @@ interface ParsedConfig {
64
74
  validateDtosMode: ValidateDtosMode;
65
75
  validateDtosPrismaPath: string | undefined;
66
76
  validateDtosSrcPaths: string[];
77
+ validateDtosIgnoreEpoch: number | undefined;
78
+ prismaConverterMode: PrismaConverterMode;
79
+ prismaConverterSchemaPath: string | undefined;
80
+ prismaConverterConvertersPaths: string[];
81
+ prismaConverterIgnoreEpoch: number | undefined;
67
82
  }
68
83
 
69
84
  interface ResolvedMethodMode {
@@ -145,6 +160,11 @@ function parseConfig(options: ValidateCodeOptions): ParsedConfig {
145
160
  validateDtosMode: options.validateDtos?.mode ?? 'OFF',
146
161
  validateDtosPrismaPath: options.validateDtos?.prismaSchemaPath,
147
162
  validateDtosSrcPaths: options.validateDtos?.dtoSourcePaths ?? [],
163
+ validateDtosIgnoreEpoch: options.validateDtos?.ignoreModifiedUntilEpoch,
164
+ prismaConverterMode: options.prismaConverter?.mode ?? 'OFF',
165
+ prismaConverterSchemaPath: options.prismaConverter?.schemaPath,
166
+ prismaConverterConvertersPaths: options.prismaConverter?.convertersPaths ?? [],
167
+ prismaConverterIgnoreEpoch: options.prismaConverter?.ignoreModifiedUntilEpoch,
148
168
  };
149
169
  }
150
170
 
@@ -163,13 +183,15 @@ function logConfig(config: ParsedConfig): void {
163
183
  console.log(` No inline type literals: ${config.noInlineTypesMode}`);
164
184
  console.log(` No any/unknown: ${config.noAnyUnknownMode}`);
165
185
  console.log(` Validate DTOs: ${config.validateDtosMode}`);
186
+ console.log(` Prisma converters: ${config.prismaConverterMode}`);
166
187
  console.log('');
167
188
  }
168
189
 
169
190
  function isAllOff(config: ParsedConfig): boolean {
170
191
  return config.methodMode === 'OFF' && config.fileMode === 'OFF' &&
171
192
  config.returnTypeMode === 'OFF' && config.noInlineTypesMode === 'OFF' &&
172
- config.noAnyUnknownMode === 'OFF' && config.validateDtosMode === 'OFF';
193
+ config.noAnyUnknownMode === 'OFF' && config.validateDtosMode === 'OFF' &&
194
+ config.prismaConverterMode === 'OFF';
173
195
  }
174
196
 
175
197
  async function runMethodValidators(config: ParsedConfig, context: ExecutorContext): Promise<ExecutorResult[]> {
@@ -215,12 +237,19 @@ export default async function runExecutor(
215
237
  mode: config.validateDtosMode,
216
238
  prismaSchemaPath: config.validateDtosPrismaPath,
217
239
  dtoSourcePaths: config.validateDtosSrcPaths,
240
+ ignoreModifiedUntilEpoch: config.validateDtosIgnoreEpoch,
241
+ }, context);
242
+ const prismaConverterResult = await runPrismaConvertersExecutor({
243
+ mode: config.prismaConverterMode,
244
+ schemaPath: config.prismaConverterSchemaPath,
245
+ convertersPaths: config.prismaConverterConvertersPaths,
246
+ ignoreModifiedUntilEpoch: config.prismaConverterIgnoreEpoch,
218
247
  }, context);
219
248
 
220
249
  const allSuccess = methodResults.every((r) => r.success) &&
221
250
  fileResult.success && returnTypesResult.success &&
222
251
  noInlineTypesResult.success && noAnyUnknownResult.success &&
223
- validateDtosResult.success;
252
+ validateDtosResult.success && prismaConverterResult.success;
224
253
 
225
254
  console.log(allSuccess ? '\n\u2705 All code validations passed\n' : '\n\u274c Some code validations failed\n');
226
255
  return { success: allSuccess };
@@ -92,6 +92,35 @@
92
92
  "type": "array",
93
93
  "items": { "type": "string" },
94
94
  "description": "Array of directories (relative to workspace root) containing Dto files"
95
+ },
96
+ "ignoreModifiedUntilEpoch": {
97
+ "type": "number",
98
+ "description": "Epoch seconds. Until this time, skip DTO validation entirely. When expired, normal mode resumes. Omit when not needed."
99
+ }
100
+ }
101
+ },
102
+ "prismaConverter": {
103
+ "type": "object",
104
+ "description": "Validate Prisma converter methods follow scalable patterns: correct Dbo parameter, no async, no standalone functions, Dto creation only in converter directories.",
105
+ "properties": {
106
+ "mode": {
107
+ "type": "string",
108
+ "enum": ["OFF", "MODIFIED_FILES"],
109
+ "description": "OFF: skip validation. MODIFIED_FILES: validate converter and non-converter files modified in the diff.",
110
+ "default": "OFF"
111
+ },
112
+ "schemaPath": {
113
+ "type": "string",
114
+ "description": "Relative path from workspace root to schema.prisma"
115
+ },
116
+ "convertersPaths": {
117
+ "type": "array",
118
+ "items": { "type": "string" },
119
+ "description": "Array of directories (relative to workspace root) containing converter files"
120
+ },
121
+ "ignoreModifiedUntilEpoch": {
122
+ "type": "number",
123
+ "description": "Epoch seconds. Until this time, skip prisma-converter validation entirely. When expired, normal mode resumes. Omit when not needed."
95
124
  }
96
125
  }
97
126
  }
@@ -33,6 +33,7 @@ export interface ValidateDtosOptions {
33
33
  mode?: ValidateDtosMode;
34
34
  prismaSchemaPath?: string;
35
35
  dtoSourcePaths?: string[];
36
+ ignoreModifiedUntilEpoch?: number;
36
37
  }
37
38
  export interface ExecutorResult {
38
39
  success: boolean;
@@ -316,27 +316,85 @@ function findViolations(dtos, dboModels) {
316
316
  return violations;
317
317
  }
318
318
  /**
319
- * Report violations to console.
319
+ * Compute similarity between two strings using longest common subsequence ratio.
320
+ * Returns a value between 0 and 1, where 1 is an exact match.
321
+ */
322
+ function similarity(a, b) {
323
+ const al = a.toLowerCase();
324
+ const bl = b.toLowerCase();
325
+ if (al === bl)
326
+ return 1;
327
+ const m = al.length;
328
+ const n = bl.length;
329
+ const prev = new Array(n + 1).fill(0);
330
+ const curr = new Array(n + 1).fill(0);
331
+ for (let i = 1; i <= m; i++) {
332
+ for (let j = 1; j <= n; j++) {
333
+ if (al[i - 1] === bl[j - 1]) {
334
+ curr[j] = prev[j - 1] + 1;
335
+ }
336
+ else {
337
+ curr[j] = Math.max(prev[j], curr[j - 1]);
338
+ }
339
+ }
340
+ for (let j = 0; j <= n; j++) {
341
+ prev[j] = curr[j];
342
+ curr[j] = 0;
343
+ }
344
+ }
345
+ const lcsLen = prev[n];
346
+ return (2 * lcsLen) / (m + n);
347
+ }
348
+ /**
349
+ * Find the closest matching Dbo field for a given Dto field name.
350
+ * Returns the best match or null if nothing scores above the threshold.
351
+ */
352
+ function suggestClosestField(fieldName, availableFields) {
353
+ let bestMatch = null;
354
+ let bestScore = 0.4; // minimum threshold
355
+ for (const candidate of availableFields) {
356
+ const score = similarity(fieldName, candidate);
357
+ if (score > bestScore) {
358
+ bestScore = score;
359
+ bestMatch = candidate;
360
+ }
361
+ }
362
+ return bestMatch;
363
+ }
364
+ /**
365
+ * Report violations to console with prominent AI warning and rename suggestions.
320
366
  */
321
367
  function reportViolations(violations) {
322
368
  console.error('');
323
- console.error('āŒ DTO fields don\'t match Prisma Dbo models!');
369
+ console.error('āŒāŒāŒ DTO FIELD MISMATCH - AI AGENT: READ THIS CAREFULLY āŒāŒāŒ');
370
+ console.error('');
371
+ console.error('šŸ›‘ DO NOT attempt find/replace or manual renaming. Instead:');
372
+ console.error(' 1. IDE rename is 10x faster than AI renaming PLUS 100% correct vs. AI\'s 80%');
373
+ console.error(' 2. Based on errors below, suggest renames to the user');
374
+ console.error(' 3. Ask the human to use IDE rename-refactoring (F2 / right-click → Rename Symbol)');
324
375
  console.error('');
325
376
  console.error('šŸ“š Every non-deprecated field in a Dto must exist in the corresponding Dbo.');
326
- console.error(' This prevents AI from inventing field names that don\'t match the database schema.');
327
- console.error(' Dbo can have extra fields (e.g., password) - Dto cannot.');
377
+ console.error(' Dbo can have extra fields (e.g., password) — Dto fields cannot be invented.');
378
+ console.error('');
379
+ console.error(' When needing fields from multiple tables (e.g., a join), use a XxxJoinDto that');
380
+ console.error(' contains YYDto and ZZDto fields from the other tables instead of flattening.');
381
+ console.error(' Fields marked @deprecated in the Dto are exempt from this check.');
328
382
  console.error('');
329
383
  for (const v of violations) {
330
384
  console.error(` āŒ ${v.file}:${v.line}`);
331
385
  console.error(` ${v.dtoName}.${v.fieldName} does not exist in ${v.dboName}`);
332
- console.error(` Available Dbo fields: ${v.availableFields.join(', ')}`);
386
+ const suggestion = suggestClosestField(v.fieldName, v.availableFields);
387
+ if (suggestion) {
388
+ console.error(` šŸ’” Suggested rename: ${v.fieldName} → ${suggestion} (Use IDE rename on ${v.dtoName}.${v.fieldName})`);
389
+ }
390
+ else {
391
+ const preview = v.availableFields.slice(0, 8).join(', ');
392
+ const ellipsis = v.availableFields.length > 8 ? ', ...' : '';
393
+ console.error(` šŸ’” No close match found. Available: ${preview}${ellipsis}`);
394
+ }
333
395
  }
334
396
  console.error('');
335
- console.error(' Dto fields must be a subset of Dbo fields (matching camelCase field names).');
336
- console.error(' Fields marked @deprecated in the Dto are exempt from this check.');
337
- console.error('');
338
- console.error(' When needing fields from multiple tables (e.g., a join), use a XxxJoinDto that');
339
- console.error(' contains YYDto and ZZDto fields from the other tables instead of flattening.');
397
+ console.error('āŒāŒāŒ AI AGENT: Suggest to the human which are the most likely renames needed and list them āŒāŒāŒ');
340
398
  console.error('');
341
399
  }
342
400
  /**
@@ -450,9 +508,28 @@ function validateDtoFiles(workspaceRoot, prismaSchemaPath, changedFiles, dtoSour
450
508
  reportViolations(violations);
451
509
  return { success: false };
452
510
  }
511
+ /**
512
+ * Resolve mode considering ignoreModifiedUntilEpoch override.
513
+ * When active, downgrades to OFF. When expired, logs a warning.
514
+ */
515
+ function resolveMode(normalMode, epoch) {
516
+ if (epoch === undefined || normalMode === 'OFF') {
517
+ return normalMode;
518
+ }
519
+ const nowSeconds = Date.now() / 1000;
520
+ if (nowSeconds < epoch) {
521
+ const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];
522
+ console.log(`\nā­ļø Skipping validate-dtos (ignoreModifiedUntilEpoch active, expires: ${expiresDate})`);
523
+ console.log('');
524
+ return 'OFF';
525
+ }
526
+ const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];
527
+ console.log(`\nāš ļø validateDtos.ignoreModifiedUntilEpoch (${epoch}) has expired (${expiresDate}). Remove it from nx.json. Using normal mode: ${normalMode}\n`);
528
+ return normalMode;
529
+ }
453
530
  async function runExecutor(options, context) {
454
531
  const workspaceRoot = context.root;
455
- const mode = options.mode ?? 'OFF';
532
+ const mode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);
456
533
  if (mode === 'OFF') {
457
534
  console.log('\nā­ļø Skipping validate-dtos (mode: OFF)');
458
535
  console.log('');
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/dev-config/architecture/executors/validate-dtos/executor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAqhBH,8BA4CC;;AA9jBD,iDAAyC;AACzC,+CAAyB;AACzB,mDAA6B;AAC7B,uDAAiC;AA0CjC;;GAEG;AACH,SAAS,UAAU,CAAC,aAAqB;IACrC,IAAI,CAAC;QACD,MAAM,SAAS,GAAG,IAAA,wBAAQ,EAAC,iCAAiC,EAAE;YAC1D,GAAG,EAAE,aAAa;YAClB,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAClC,CAAC,CAAC,IAAI,EAAE,CAAC;QAEV,IAAI,SAAS,EAAE,CAAC;YACZ,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACL,IAAI,CAAC;YACD,MAAM,SAAS,GAAG,IAAA,wBAAQ,EAAC,0BAA0B,EAAE;gBACnD,GAAG,EAAE,aAAa;gBAClB,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE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C;QACR,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;QAC3E,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,6CAA6C,EAAE,CAAC,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,MAAM,YAAY,GAAG,eAAe,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAEhE,OAAO,gBAAgB,CAAC,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC7G,CAAC","sourcesContent":["/**\n * Validate DTOs Executor\n *\n * Validates that every non-deprecated field in a XxxDto class/interface exists\n * in the corresponding XxxDbo Prisma model. This catches AI agents inventing\n * field names that don't match the database schema.\n *\n * ============================================================================\n * MODES\n * ============================================================================\n * - OFF: Skip validation entirely\n * - MODIFIED_CLASS: Only validate Dto classes that have changed lines in the diff\n * - MODIFIED_FILES: Validate ALL Dto classes in files that were modified\n *\n * ============================================================================\n * SKIP CONDITIONS\n * ============================================================================\n * - If schema.prisma itself is modified, validation is skipped (schema in flux)\n * - Dto classes ending with \"JoinDto\" are skipped (they compose other Dtos)\n * - Fields marked @deprecated in a comment are exempt\n *\n * ============================================================================\n * MATCHING\n * ============================================================================\n * - UserDto matches UserDbo by case-insensitive prefix (\"user\")\n * - Dbo field names are converted from snake_case to camelCase for comparison\n * - Dto fields must be a subset of Dbo fields\n * - Extra Dbo fields are allowed (e.g., password)\n */\n\nimport type { ExecutorContext } from '@nx/devkit';\nimport { execSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as ts from 'typescript';\n\nexport type ValidateDtosMode = 'OFF' | 'MODIFIED_CLASS' | 'MODIFIED_FILES';\n\nexport interface ValidateDtosOptions {\n mode?: ValidateDtosMode;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n}\n\nexport interface ExecutorResult {\n success: boolean;\n}\n\ninterface DtoFieldInfo {\n name: string;\n line: number;\n deprecated: boolean;\n}\n\ninterface DtoInfo {\n name: string;\n file: string;\n startLine: number;\n endLine: number;\n fields: DtoFieldInfo[];\n}\n\ninterface DtoViolation {\n file: string;\n line: number;\n dtoName: string;\n fieldName: string;\n dboName: string;\n availableFields: string[];\n}\n\ninterface DboEntry {\n name: string;\n fields: Set<string>;\n}\n\n/**\n * Auto-detect the base branch by finding the merge-base with origin/main.\n */\nfunction detectBase(workspaceRoot: string): string | null {\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 } catch {\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 } catch {\n // Ignore\n }\n }\n return null;\n}\n\n/**\n * Get changed files between base and head (or working tree if head not specified).\n */\n// webpieces-disable max-lines-new-methods -- Git command handling with untracked files requires multiple code paths\nfunction getChangedFiles(workspaceRoot: string, base: string, head?: string): string[] {\n try {\n const diffTarget = head ? `${base} ${head}` : base;\n const output = execSync(`git diff --name-only ${diffTarget}`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const changedFiles = output\n .trim()\n .split('\\n')\n .filter((f) => f.length > 0);\n\n if (!head) {\n try {\n const untrackedOutput = execSync('git ls-files --others --exclude-standard', {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const untrackedFiles = untrackedOutput\n .trim()\n .split('\\n')\n .filter((f) => f.length > 0);\n const allFiles = new Set([...changedFiles, ...untrackedFiles]);\n return Array.from(allFiles);\n } catch {\n return changedFiles;\n }\n }\n\n return changedFiles;\n } catch {\n return [];\n }\n}\n\n/**\n * Get the diff content for a specific file.\n */\nfunction getFileDiff(workspaceRoot: string, file: string, base: string, head?: string): string {\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 lines = content.split('\\n');\n return lines.map((line) => `+${line}`).join('\\n');\n }\n }\n }\n\n return diff;\n } catch {\n return '';\n }\n}\n\n/**\n * Parse diff to extract changed line numbers (additions only - lines starting with +).\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\n/**\n * Convert a snake_case string to camelCase.\n * e.g., \"version_number\" -> \"versionNumber\", \"id\" -> \"id\"\n */\nfunction snakeToCamel(s: string): string {\n return s.replace(/_([a-z])/g, (_, letter: string) => letter.toUpperCase());\n}\n\n/**\n * Parse schema.prisma to build a map of Dbo model name -> set of field names (camelCase).\n * Only models whose name ends with \"Dbo\" are included.\n * Field names are converted from snake_case to camelCase since Dto fields use camelCase.\n */\nfunction parsePrismaSchema(schemaPath: string): Map<string, Set<string>> {\n const models = new Map<string, Set<string>>();\n\n if (!fs.existsSync(schemaPath)) {\n return models;\n }\n\n const content = fs.readFileSync(schemaPath, 'utf-8');\n const lines = content.split('\\n');\n\n let currentModel: string | null = null;\n let currentFields: Set<string> | null = null;\n\n for (const line of lines) {\n const trimmed = line.trim();\n\n // Match model declaration: model XxxDbo {\n const modelMatch = trimmed.match(/^model\\s+(\\w+Dbo)\\s*\\{/);\n if (modelMatch) {\n currentModel = modelMatch[1];\n currentFields = new Set<string>();\n continue;\n }\n\n // End of model block\n if (currentModel && trimmed === '}') {\n models.set(currentModel, currentFields!);\n currentModel = null;\n currentFields = null;\n continue;\n }\n\n // Inside a model block - extract field names\n if (currentModel && currentFields) {\n // Skip empty lines, comments, and model-level attributes (@@)\n if (!trimmed || trimmed.startsWith('//') || trimmed.startsWith('@@')) {\n continue;\n }\n\n // Field name is the first word on the line, converted to camelCase\n const fieldMatch = trimmed.match(/^(\\w+)\\s/);\n if (fieldMatch) {\n currentFields.add(snakeToCamel(fieldMatch[1]));\n }\n }\n }\n\n return models;\n}\n\n/**\n * Check if a field has @deprecated in a comment above it (within 3 lines).\n */\nfunction isFieldDeprecated(fileLines: string[], fieldLine: number): boolean {\n const start = Math.max(0, fieldLine - 4);\n for (let i = start; i <= fieldLine - 1; i++) {\n const line = fileLines[i]?.trim() ?? '';\n if (line.includes('@deprecated')) return true;\n }\n return false;\n}\n\n/**\n * Parse a TypeScript file to find Dto class/interface declarations and their fields.\n * Skips classes ending with \"JoinDto\" since they compose other Dtos.\n */\n// webpieces-disable max-lines-new-methods -- AST traversal for both class and interface Dto detection with field extraction\nfunction findDtosInFile(filePath: string, workspaceRoot: string): DtoInfo[] {\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const fileLines = content.split('\\n');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const dtos: DtoInfo[] = [];\n\n function visit(node: ts.Node): void {\n const isClass = ts.isClassDeclaration(node);\n const isInterface = ts.isInterfaceDeclaration(node);\n\n if ((isClass || isInterface) && node.name) {\n const name = node.name.text;\n\n // Must end with Dto but NOT with JoinDto\n if (name.endsWith('Dto') && !name.endsWith('JoinDto')) {\n const fields: DtoFieldInfo[] = [];\n const nodeStart = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));\n const nodeEnd = sourceFile.getLineAndCharacterOfPosition(node.getEnd());\n\n for (const member of node.members) {\n if (ts.isPropertyDeclaration(member) || ts.isPropertySignature(member)) {\n if (member.name && ts.isIdentifier(member.name)) {\n const fieldName = member.name.text;\n const startPos = member.getStart(sourceFile);\n const pos = sourceFile.getLineAndCharacterOfPosition(startPos);\n const line = pos.line + 1;\n const deprecated = isFieldDeprecated(fileLines, line);\n\n fields.push({ name: fieldName, line, deprecated });\n }\n }\n }\n\n dtos.push({\n name,\n file: filePath,\n startLine: nodeStart.line + 1,\n endLine: nodeEnd.line + 1,\n fields,\n });\n }\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return dtos;\n}\n\n/**\n * Extract the prefix from a Dto/Dbo name by removing the suffix.\n * e.g., \"UserDto\" -> \"user\", \"UserDbo\" -> \"user\"\n */\nfunction extractPrefix(name: string, suffix: string): string {\n return name.slice(0, -suffix.length).toLowerCase();\n}\n\n/**\n * Find violations: Dto fields that don't exist in the corresponding Dbo.\n */\nfunction findViolations(\n dtos: DtoInfo[],\n dboModels: Map<string, Set<string>>\n): DtoViolation[] {\n const violations: DtoViolation[] = [];\n\n // Build a lowercase prefix -> Dbo info map\n const dboByPrefix = new Map<string, DboEntry>();\n for (const [dboName, fields] of dboModels) {\n const prefix = extractPrefix(dboName, 'Dbo');\n dboByPrefix.set(prefix, { name: dboName, fields });\n }\n\n for (const dto of dtos) {\n const prefix = extractPrefix(dto.name, 'Dto');\n const dbo = dboByPrefix.get(prefix);\n\n if (!dbo) {\n // No matching Dbo found - skip (might be a Dto without a DB table)\n continue;\n }\n\n for (const field of dto.fields) {\n if (field.deprecated) continue;\n\n if (!dbo.fields.has(field.name)) {\n violations.push({\n file: dto.file,\n line: field.line,\n dtoName: dto.name,\n fieldName: field.name,\n dboName: dbo.name,\n availableFields: Array.from(dbo.fields).sort(),\n });\n }\n }\n }\n\n return violations;\n}\n\n/**\n * Report violations to console.\n */\nfunction reportViolations(violations: DtoViolation[]): void {\n console.error('');\n console.error('āŒ DTO fields don\\'t match Prisma Dbo models!');\n console.error('');\n console.error('šŸ“š Every non-deprecated field in a Dto must exist in the corresponding Dbo.');\n console.error(' This prevents AI from inventing field names that don\\'t match the database schema.');\n console.error(' Dbo can have extra fields (e.g., password) - Dto cannot.');\n console.error('');\n\n for (const v of violations) {\n console.error(` āŒ ${v.file}:${v.line}`);\n console.error(` ${v.dtoName}.${v.fieldName} does not exist in ${v.dboName}`);\n console.error(` Available Dbo fields: ${v.availableFields.join(', ')}`);\n }\n console.error('');\n\n console.error(' Dto fields must be a subset of Dbo fields (matching camelCase field names).');\n console.error(' Fields marked @deprecated in the Dto are exempt from this check.');\n console.error('');\n console.error(' When needing fields from multiple tables (e.g., a join), use a XxxJoinDto that');\n console.error(' contains YYDto and ZZDto fields from the other tables instead of flattening.');\n console.error('');\n}\n\n/**\n * Filter changed files to only TypeScript Dto source files within configured paths.\n */\nfunction filterDtoFiles(changedFiles: string[], dtoSourcePaths: string[]): string[] {\n return changedFiles.filter((f) => {\n if (!f.endsWith('.ts') && !f.endsWith('.tsx')) return false;\n if (f.includes('.spec.ts') || f.includes('.test.ts')) return false;\n return dtoSourcePaths.some((srcPath) => f.startsWith(srcPath));\n });\n}\n\n/**\n * Collect all Dto definitions from the given files.\n */\nfunction collectDtos(dtoFiles: string[], workspaceRoot: string): DtoInfo[] {\n const allDtos: DtoInfo[] = [];\n for (const file of dtoFiles) {\n const dtos = findDtosInFile(file, workspaceRoot);\n allDtos.push(...dtos);\n }\n return allDtos;\n}\n\n/**\n * Check if a Dto class overlaps with any changed lines in the diff.\n */\nfunction isDtoTouched(dto: DtoInfo, changedLines: Set<number>): boolean {\n for (let line = dto.startLine; line <= dto.endLine; line++) {\n if (changedLines.has(line)) return true;\n }\n return false;\n}\n\n/**\n * Filter Dtos to only those that have changed lines in the diff (MODIFIED_CLASS mode).\n */\nfunction filterTouchedDtos(\n dtos: DtoInfo[],\n workspaceRoot: string,\n base: string,\n head?: string\n): DtoInfo[] {\n // Group dtos by file to avoid re-fetching diffs\n const byFile = new Map<string, DtoInfo[]>();\n for (const dto of dtos) {\n const list = byFile.get(dto.file) ?? [];\n list.push(dto);\n byFile.set(dto.file, list);\n }\n\n const touched: DtoInfo[] = [];\n for (const [file, fileDtos] of byFile) {\n const diff = getFileDiff(workspaceRoot, file, base, head);\n const changedLines = getChangedLineNumbers(diff);\n for (const dto of fileDtos) {\n if (isDtoTouched(dto, changedLines)) {\n touched.push(dto);\n }\n }\n }\n return touched;\n}\n\n/**\n * Resolve git base ref from env vars or auto-detection.\n */\nfunction resolveBase(workspaceRoot: string): string | undefined {\n const envBase = process.env['NX_BASE'];\n if (envBase) return envBase;\n return detectBase(workspaceRoot) ?? undefined;\n}\n\n/**\n * Run the core validation after early-exit checks have passed.\n */\n// webpieces-disable max-lines-new-methods -- Core validation orchestration with multiple early-exit checks\nfunction validateDtoFiles(\n workspaceRoot: string,\n prismaSchemaPath: string,\n changedFiles: string[],\n dtoSourcePaths: string[],\n mode: ValidateDtosMode,\n base: string,\n head?: string\n): ExecutorResult {\n if (changedFiles.some((f) => f.endsWith(prismaSchemaPath))) {\n console.log('ā­ļø Skipping validate-dtos (schema.prisma is modified - schema in flux)');\n console.log('');\n return { success: true };\n }\n\n const dtoFiles = filterDtoFiles(changedFiles, dtoSourcePaths);\n\n if (dtoFiles.length === 0) {\n console.log('āœ… No Dto files changed');\n return { success: true };\n }\n\n console.log(`šŸ“‚ Checking ${dtoFiles.length} changed file(s) for Dto definitions...`);\n\n const fullSchemaPath = path.join(workspaceRoot, prismaSchemaPath);\n const dboModels = parsePrismaSchema(fullSchemaPath);\n\n if (dboModels.size === 0) {\n console.log('ā­ļø No Dbo models found in schema.prisma');\n console.log('');\n return { success: true };\n }\n\n console.log(` Found ${dboModels.size} Dbo model(s) in schema.prisma`);\n\n let allDtos = collectDtos(dtoFiles, workspaceRoot);\n\n if (allDtos.length === 0) {\n console.log('āœ… No Dto definitions found in changed files');\n return { success: true };\n }\n\n // In MODIFIED_CLASS mode, narrow to only Dtos with changed lines\n if (mode === 'MODIFIED_CLASS') {\n allDtos = filterTouchedDtos(allDtos, workspaceRoot, base, head);\n if (allDtos.length === 0) {\n console.log('āœ… No Dto classes were modified');\n return { success: true };\n }\n }\n\n console.log(` Validating ${allDtos.length} Dto definition(s)`);\n\n const violations = findViolations(allDtos, dboModels);\n\n if (violations.length === 0) {\n console.log('āœ… All Dto fields match their Dbo models');\n return { success: true };\n }\n\n reportViolations(violations);\n return { success: false };\n}\n\nexport default async function runExecutor(\n options: ValidateDtosOptions,\n context: ExecutorContext\n): Promise<ExecutorResult> {\n const workspaceRoot = context.root;\n const mode: ValidateDtosMode = options.mode ?? 'OFF';\n\n if (mode === 'OFF') {\n console.log('\\nā­ļø Skipping validate-dtos (mode: OFF)');\n console.log('');\n return { success: true };\n }\n\n const prismaSchemaPath = options.prismaSchemaPath;\n const dtoSourcePaths = options.dtoSourcePaths ?? [];\n\n if (!prismaSchemaPath || dtoSourcePaths.length === 0) {\n const reason = !prismaSchemaPath ? 'no prismaSchemaPath configured' : 'no dtoSourcePaths configured';\n console.log(`\\nā­ļø Skipping validate-dtos (${reason})`);\n console.log('');\n return { success: true };\n }\n\n console.log('\\nšŸ“ Validating DTOs match Prisma Dbo models\\n');\n console.log(` Mode: ${mode}`);\n console.log(` Schema: ${prismaSchemaPath}`);\n console.log(` Dto paths: ${dtoSourcePaths.join(', ')}`);\n\n const base = resolveBase(workspaceRoot);\n const head = process.env['NX_HEAD'];\n\n if (!base) {\n console.log('\\nā­ļø Skipping validate-dtos (could not detect base branch)');\n console.log('');\n return { success: true };\n }\n\n console.log(` Base: ${base}`);\n console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);\n console.log('');\n\n const changedFiles = getChangedFiles(workspaceRoot, base, head);\n\n return validateDtoFiles(workspaceRoot, prismaSchemaPath, changedFiles, dtoSourcePaths, mode, base, head);\n}\n"]}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/dev-config/architecture/executors/validate-dtos/executor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAymBH,8BA4CC;;AAlpBD,iDAAyC;AACzC,+CAAyB;AACzB,mDAA6B;AAC7B,uDAAiC;AA2CjC;;GAEG;AACH,SAAS,UAAU,CAAC,aAAqB;IACrC,IAAI,CAAC;QACD,MAAM,SAAS,GAAG,IAAA,wBAAQ,EAAC,iCAAiC,EAAE;YAC1D,GAAG,EAAE,aAAa;YAClB,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAClC,CAAC,CAAC,IAAI,EAAE,CAAC;QAEV,IAAI,SAAS,EAAE,CAAC;YACZ,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACL,IAAI,CAAC;YACD,MAAM,SAAS,GAAG,IAAA,wBAAQ,EAAC,0BAA0B,EAAE;gBACnD,GAAG,EAAE,aAAa;gBAClB,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;aAClC,CAAC,CAAC,IAAI,EAAE,CAAC;YAEV,IAAI,SAAS,EAAE,CAAC;gBACZ,OAAO,SAAS,CAAC;YACrB,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACL,SAAS;QACb,CAAC;IACL,CAAC;IACD,OAAO,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aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC7G,CAAC","sourcesContent":["/**\n * Validate DTOs Executor\n *\n * Validates that every non-deprecated field in a XxxDto class/interface exists\n * in the corresponding XxxDbo Prisma model. This catches AI agents inventing\n * field names that don't match the database schema.\n *\n * ============================================================================\n * MODES\n * ============================================================================\n * - OFF: Skip validation entirely\n * - MODIFIED_CLASS: Only validate Dto classes that have changed lines in the diff\n * - MODIFIED_FILES: Validate ALL Dto classes in files that were modified\n *\n * ============================================================================\n * SKIP CONDITIONS\n * ============================================================================\n * - If schema.prisma itself is modified, validation is skipped (schema in flux)\n * - Dto classes ending with \"JoinDto\" are skipped (they compose other Dtos)\n * - Fields marked @deprecated in a comment are exempt\n *\n * ============================================================================\n * MATCHING\n * ============================================================================\n * - UserDto matches UserDbo by case-insensitive prefix (\"user\")\n * - Dbo field names are converted from snake_case to camelCase for comparison\n * - Dto fields must be a subset of Dbo fields\n * - Extra Dbo fields are allowed (e.g., password)\n */\n\nimport type { ExecutorContext } from '@nx/devkit';\nimport { execSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as ts from 'typescript';\n\nexport type ValidateDtosMode = 'OFF' | 'MODIFIED_CLASS' | 'MODIFIED_FILES';\n\nexport interface ValidateDtosOptions {\n mode?: ValidateDtosMode;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface ExecutorResult {\n success: boolean;\n}\n\ninterface DtoFieldInfo {\n name: string;\n line: number;\n deprecated: boolean;\n}\n\ninterface DtoInfo {\n name: string;\n file: string;\n startLine: number;\n endLine: number;\n fields: DtoFieldInfo[];\n}\n\ninterface DtoViolation {\n file: string;\n line: number;\n dtoName: string;\n fieldName: string;\n dboName: string;\n availableFields: string[];\n}\n\ninterface DboEntry {\n name: string;\n fields: Set<string>;\n}\n\n/**\n * Auto-detect the base branch by finding the merge-base with origin/main.\n */\nfunction detectBase(workspaceRoot: string): string | null {\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 } catch {\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 } catch {\n // Ignore\n }\n }\n return null;\n}\n\n/**\n * Get changed files between base and head (or working tree if head not specified).\n */\n// webpieces-disable max-lines-new-methods -- Git command handling with untracked files requires multiple code paths\nfunction getChangedFiles(workspaceRoot: string, base: string, head?: string): string[] {\n try {\n const diffTarget = head ? `${base} ${head}` : base;\n const output = execSync(`git diff --name-only ${diffTarget}`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const changedFiles = output\n .trim()\n .split('\\n')\n .filter((f) => f.length > 0);\n\n if (!head) {\n try {\n const untrackedOutput = execSync('git ls-files --others --exclude-standard', {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const untrackedFiles = untrackedOutput\n .trim()\n .split('\\n')\n .filter((f) => f.length > 0);\n const allFiles = new Set([...changedFiles, ...untrackedFiles]);\n return Array.from(allFiles);\n } catch {\n return changedFiles;\n }\n }\n\n return changedFiles;\n } catch {\n return [];\n }\n}\n\n/**\n * Get the diff content for a specific file.\n */\nfunction getFileDiff(workspaceRoot: string, file: string, base: string, head?: string): string {\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 lines = content.split('\\n');\n return lines.map((line) => `+${line}`).join('\\n');\n }\n }\n }\n\n return diff;\n } catch {\n return '';\n }\n}\n\n/**\n * Parse diff to extract changed line numbers (additions only - lines starting with +).\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\n/**\n * Convert a snake_case string to camelCase.\n * e.g., \"version_number\" -> \"versionNumber\", \"id\" -> \"id\"\n */\nfunction snakeToCamel(s: string): string {\n return s.replace(/_([a-z])/g, (_, letter: string) => letter.toUpperCase());\n}\n\n/**\n * Parse schema.prisma to build a map of Dbo model name -> set of field names (camelCase).\n * Only models whose name ends with \"Dbo\" are included.\n * Field names are converted from snake_case to camelCase since Dto fields use camelCase.\n */\nfunction parsePrismaSchema(schemaPath: string): Map<string, Set<string>> {\n const models = new Map<string, Set<string>>();\n\n if (!fs.existsSync(schemaPath)) {\n return models;\n }\n\n const content = fs.readFileSync(schemaPath, 'utf-8');\n const lines = content.split('\\n');\n\n let currentModel: string | null = null;\n let currentFields: Set<string> | null = null;\n\n for (const line of lines) {\n const trimmed = line.trim();\n\n // Match model declaration: model XxxDbo {\n const modelMatch = trimmed.match(/^model\\s+(\\w+Dbo)\\s*\\{/);\n if (modelMatch) {\n currentModel = modelMatch[1];\n currentFields = new Set<string>();\n continue;\n }\n\n // End of model block\n if (currentModel && trimmed === '}') {\n models.set(currentModel, currentFields!);\n currentModel = null;\n currentFields = null;\n continue;\n }\n\n // Inside a model block - extract field names\n if (currentModel && currentFields) {\n // Skip empty lines, comments, and model-level attributes (@@)\n if (!trimmed || trimmed.startsWith('//') || trimmed.startsWith('@@')) {\n continue;\n }\n\n // Field name is the first word on the line, converted to camelCase\n const fieldMatch = trimmed.match(/^(\\w+)\\s/);\n if (fieldMatch) {\n currentFields.add(snakeToCamel(fieldMatch[1]));\n }\n }\n }\n\n return models;\n}\n\n/**\n * Check if a field has @deprecated in a comment above it (within 3 lines).\n */\nfunction isFieldDeprecated(fileLines: string[], fieldLine: number): boolean {\n const start = Math.max(0, fieldLine - 4);\n for (let i = start; i <= fieldLine - 1; i++) {\n const line = fileLines[i]?.trim() ?? '';\n if (line.includes('@deprecated')) return true;\n }\n return false;\n}\n\n/**\n * Parse a TypeScript file to find Dto class/interface declarations and their fields.\n * Skips classes ending with \"JoinDto\" since they compose other Dtos.\n */\n// webpieces-disable max-lines-new-methods -- AST traversal for both class and interface Dto detection with field extraction\nfunction findDtosInFile(filePath: string, workspaceRoot: string): DtoInfo[] {\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const fileLines = content.split('\\n');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const dtos: DtoInfo[] = [];\n\n function visit(node: ts.Node): void {\n const isClass = ts.isClassDeclaration(node);\n const isInterface = ts.isInterfaceDeclaration(node);\n\n if ((isClass || isInterface) && node.name) {\n const name = node.name.text;\n\n // Must end with Dto but NOT with JoinDto\n if (name.endsWith('Dto') && !name.endsWith('JoinDto')) {\n const fields: DtoFieldInfo[] = [];\n const nodeStart = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));\n const nodeEnd = sourceFile.getLineAndCharacterOfPosition(node.getEnd());\n\n for (const member of node.members) {\n if (ts.isPropertyDeclaration(member) || ts.isPropertySignature(member)) {\n if (member.name && ts.isIdentifier(member.name)) {\n const fieldName = member.name.text;\n const startPos = member.getStart(sourceFile);\n const pos = sourceFile.getLineAndCharacterOfPosition(startPos);\n const line = pos.line + 1;\n const deprecated = isFieldDeprecated(fileLines, line);\n\n fields.push({ name: fieldName, line, deprecated });\n }\n }\n }\n\n dtos.push({\n name,\n file: filePath,\n startLine: nodeStart.line + 1,\n endLine: nodeEnd.line + 1,\n fields,\n });\n }\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return dtos;\n}\n\n/**\n * Extract the prefix from a Dto/Dbo name by removing the suffix.\n * e.g., \"UserDto\" -> \"user\", \"UserDbo\" -> \"user\"\n */\nfunction extractPrefix(name: string, suffix: string): string {\n return name.slice(0, -suffix.length).toLowerCase();\n}\n\n/**\n * Find violations: Dto fields that don't exist in the corresponding Dbo.\n */\nfunction findViolations(\n dtos: DtoInfo[],\n dboModels: Map<string, Set<string>>\n): DtoViolation[] {\n const violations: DtoViolation[] = [];\n\n // Build a lowercase prefix -> Dbo info map\n const dboByPrefix = new Map<string, DboEntry>();\n for (const [dboName, fields] of dboModels) {\n const prefix = extractPrefix(dboName, 'Dbo');\n dboByPrefix.set(prefix, { name: dboName, fields });\n }\n\n for (const dto of dtos) {\n const prefix = extractPrefix(dto.name, 'Dto');\n const dbo = dboByPrefix.get(prefix);\n\n if (!dbo) {\n // No matching Dbo found - skip (might be a Dto without a DB table)\n continue;\n }\n\n for (const field of dto.fields) {\n if (field.deprecated) continue;\n\n if (!dbo.fields.has(field.name)) {\n violations.push({\n file: dto.file,\n line: field.line,\n dtoName: dto.name,\n fieldName: field.name,\n dboName: dbo.name,\n availableFields: Array.from(dbo.fields).sort(),\n });\n }\n }\n }\n\n return violations;\n}\n\n/**\n * Compute similarity between two strings using longest common subsequence ratio.\n * Returns a value between 0 and 1, where 1 is an exact match.\n */\nfunction similarity(a: string, b: string): number {\n const al = a.toLowerCase();\n const bl = b.toLowerCase();\n if (al === bl) return 1;\n\n const m = al.length;\n const n = bl.length;\n const prev = new Array<number>(n + 1).fill(0);\n const curr = new Array<number>(n + 1).fill(0);\n\n for (let i = 1; i <= m; i++) {\n for (let j = 1; j <= n; j++) {\n if (al[i - 1] === bl[j - 1]) {\n curr[j] = prev[j - 1] + 1;\n } else {\n curr[j] = Math.max(prev[j], curr[j - 1]);\n }\n }\n for (let j = 0; j <= n; j++) {\n prev[j] = curr[j];\n curr[j] = 0;\n }\n }\n\n const lcsLen = prev[n];\n return (2 * lcsLen) / (m + n);\n}\n\n/**\n * Find the closest matching Dbo field for a given Dto field name.\n * Returns the best match or null if nothing scores above the threshold.\n */\nfunction suggestClosestField(fieldName: string, availableFields: string[]): string | null {\n let bestMatch: string | null = null;\n let bestScore = 0.4; // minimum threshold\n\n for (const candidate of availableFields) {\n const score = similarity(fieldName, candidate);\n if (score > bestScore) {\n bestScore = score;\n bestMatch = candidate;\n }\n }\n\n return bestMatch;\n}\n\n/**\n * Report violations to console with prominent AI warning and rename suggestions.\n */\nfunction reportViolations(violations: DtoViolation[]): void {\n console.error('');\n console.error('āŒāŒāŒ DTO FIELD MISMATCH - AI AGENT: READ THIS CAREFULLY āŒāŒāŒ');\n console.error('');\n console.error('šŸ›‘ DO NOT attempt find/replace or manual renaming. Instead:');\n console.error(' 1. IDE rename is 10x faster than AI renaming PLUS 100% correct vs. AI\\'s 80%');\n console.error(' 2. Based on errors below, suggest renames to the user');\n console.error(' 3. Ask the human to use IDE rename-refactoring (F2 / right-click → Rename Symbol)');\n console.error('');\n console.error('šŸ“š Every non-deprecated field in a Dto must exist in the corresponding Dbo.');\n console.error(' Dbo can have extra fields (e.g., password) — Dto fields cannot be invented.');\n console.error('');\n console.error(' When needing fields from multiple tables (e.g., a join), use a XxxJoinDto that');\n console.error(' contains YYDto and ZZDto fields from the other tables instead of flattening.');\n console.error(' Fields marked @deprecated in the Dto are exempt from this check.');\n console.error('');\n\n for (const v of violations) {\n console.error(` āŒ ${v.file}:${v.line}`);\n console.error(` ${v.dtoName}.${v.fieldName} does not exist in ${v.dboName}`);\n\n const suggestion = suggestClosestField(v.fieldName, v.availableFields);\n if (suggestion) {\n console.error(` šŸ’” Suggested rename: ${v.fieldName} → ${suggestion} (Use IDE rename on ${v.dtoName}.${v.fieldName})`);\n } else {\n const preview = v.availableFields.slice(0, 8).join(', ');\n const ellipsis = v.availableFields.length > 8 ? ', ...' : '';\n console.error(` šŸ’” No close match found. Available: ${preview}${ellipsis}`);\n }\n }\n console.error('');\n\n console.error('āŒāŒāŒ AI AGENT: Suggest to the human which are the most likely renames needed and list them āŒāŒāŒ');\n console.error('');\n}\n\n/**\n * Filter changed files to only TypeScript Dto source files within configured paths.\n */\nfunction filterDtoFiles(changedFiles: string[], dtoSourcePaths: string[]): string[] {\n return changedFiles.filter((f) => {\n if (!f.endsWith('.ts') && !f.endsWith('.tsx')) return false;\n if (f.includes('.spec.ts') || f.includes('.test.ts')) return false;\n return dtoSourcePaths.some((srcPath) => f.startsWith(srcPath));\n });\n}\n\n/**\n * Collect all Dto definitions from the given files.\n */\nfunction collectDtos(dtoFiles: string[], workspaceRoot: string): DtoInfo[] {\n const allDtos: DtoInfo[] = [];\n for (const file of dtoFiles) {\n const dtos = findDtosInFile(file, workspaceRoot);\n allDtos.push(...dtos);\n }\n return allDtos;\n}\n\n/**\n * Check if a Dto class overlaps with any changed lines in the diff.\n */\nfunction isDtoTouched(dto: DtoInfo, changedLines: Set<number>): boolean {\n for (let line = dto.startLine; line <= dto.endLine; line++) {\n if (changedLines.has(line)) return true;\n }\n return false;\n}\n\n/**\n * Filter Dtos to only those that have changed lines in the diff (MODIFIED_CLASS mode).\n */\nfunction filterTouchedDtos(\n dtos: DtoInfo[],\n workspaceRoot: string,\n base: string,\n head?: string\n): DtoInfo[] {\n // Group dtos by file to avoid re-fetching diffs\n const byFile = new Map<string, DtoInfo[]>();\n for (const dto of dtos) {\n const list = byFile.get(dto.file) ?? [];\n list.push(dto);\n byFile.set(dto.file, list);\n }\n\n const touched: DtoInfo[] = [];\n for (const [file, fileDtos] of byFile) {\n const diff = getFileDiff(workspaceRoot, file, base, head);\n const changedLines = getChangedLineNumbers(diff);\n for (const dto of fileDtos) {\n if (isDtoTouched(dto, changedLines)) {\n touched.push(dto);\n }\n }\n }\n return touched;\n}\n\n/**\n * Resolve git base ref from env vars or auto-detection.\n */\nfunction resolveBase(workspaceRoot: string): string | undefined {\n const envBase = process.env['NX_BASE'];\n if (envBase) return envBase;\n return detectBase(workspaceRoot) ?? undefined;\n}\n\n/**\n * Run the core validation after early-exit checks have passed.\n */\n// webpieces-disable max-lines-new-methods -- Core validation orchestration with multiple early-exit checks\nfunction validateDtoFiles(\n workspaceRoot: string,\n prismaSchemaPath: string,\n changedFiles: string[],\n dtoSourcePaths: string[],\n mode: ValidateDtosMode,\n base: string,\n head?: string\n): ExecutorResult {\n if (changedFiles.some((f) => f.endsWith(prismaSchemaPath))) {\n console.log('ā­ļø Skipping validate-dtos (schema.prisma is modified - schema in flux)');\n console.log('');\n return { success: true };\n }\n\n const dtoFiles = filterDtoFiles(changedFiles, dtoSourcePaths);\n\n if (dtoFiles.length === 0) {\n console.log('āœ… No Dto files changed');\n return { success: true };\n }\n\n console.log(`šŸ“‚ Checking ${dtoFiles.length} changed file(s) for Dto definitions...`);\n\n const fullSchemaPath = path.join(workspaceRoot, prismaSchemaPath);\n const dboModels = parsePrismaSchema(fullSchemaPath);\n\n if (dboModels.size === 0) {\n console.log('ā­ļø No Dbo models found in schema.prisma');\n console.log('');\n return { success: true };\n }\n\n console.log(` Found ${dboModels.size} Dbo model(s) in schema.prisma`);\n\n let allDtos = collectDtos(dtoFiles, workspaceRoot);\n\n if (allDtos.length === 0) {\n console.log('āœ… No Dto definitions found in changed files');\n return { success: true };\n }\n\n // In MODIFIED_CLASS mode, narrow to only Dtos with changed lines\n if (mode === 'MODIFIED_CLASS') {\n allDtos = filterTouchedDtos(allDtos, workspaceRoot, base, head);\n if (allDtos.length === 0) {\n console.log('āœ… No Dto classes were modified');\n return { success: true };\n }\n }\n\n console.log(` Validating ${allDtos.length} Dto definition(s)`);\n\n const violations = findViolations(allDtos, dboModels);\n\n if (violations.length === 0) {\n console.log('āœ… All Dto fields match their Dbo models');\n return { success: true };\n }\n\n reportViolations(violations);\n return { success: false };\n}\n\n/**\n * Resolve mode considering ignoreModifiedUntilEpoch override.\n * When active, downgrades to OFF. When expired, logs a warning.\n */\nfunction resolveMode(normalMode: ValidateDtosMode, epoch: number | undefined): ValidateDtosMode {\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 validate-dtos (ignoreModifiedUntilEpoch active, expires: ${expiresDate})`);\n console.log('');\n return 'OFF';\n }\n const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];\n console.log(`\\nāš ļø validateDtos.ignoreModifiedUntilEpoch (${epoch}) has expired (${expiresDate}). Remove it from nx.json. Using normal mode: ${normalMode}\\n`);\n return normalMode;\n}\n\nexport default async function runExecutor(\n options: ValidateDtosOptions,\n context: ExecutorContext\n): Promise<ExecutorResult> {\n const workspaceRoot = context.root;\n const mode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);\n\n if (mode === 'OFF') {\n console.log('\\nā­ļø Skipping validate-dtos (mode: OFF)');\n console.log('');\n return { success: true };\n }\n\n const prismaSchemaPath = options.prismaSchemaPath;\n const dtoSourcePaths = options.dtoSourcePaths ?? [];\n\n if (!prismaSchemaPath || dtoSourcePaths.length === 0) {\n const reason = !prismaSchemaPath ? 'no prismaSchemaPath configured' : 'no dtoSourcePaths configured';\n console.log(`\\nā­ļø Skipping validate-dtos (${reason})`);\n console.log('');\n return { success: true };\n }\n\n console.log('\\nšŸ“ Validating DTOs match Prisma Dbo models\\n');\n console.log(` Mode: ${mode}`);\n console.log(` Schema: ${prismaSchemaPath}`);\n console.log(` Dto paths: ${dtoSourcePaths.join(', ')}`);\n\n const base = resolveBase(workspaceRoot);\n const head = process.env['NX_HEAD'];\n\n if (!base) {\n console.log('\\nā­ļø Skipping validate-dtos (could not detect base branch)');\n console.log('');\n return { success: true };\n }\n\n console.log(` Base: ${base}`);\n console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);\n console.log('');\n\n const changedFiles = getChangedFiles(workspaceRoot, base, head);\n\n return validateDtoFiles(workspaceRoot, prismaSchemaPath, changedFiles, dtoSourcePaths, mode, base, head);\n}\n"]}