@schemashift/core 0.8.0 → 0.9.0

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/dist/index.d.cts CHANGED
@@ -143,6 +143,120 @@ declare function transformMethodChain(chain: CallChainInfo, newBase: string, fac
143
143
  args: string[];
144
144
  }[] | null | undefined): string;
145
145
 
146
+ interface AuditEntry {
147
+ timestamp: string;
148
+ migrationId: string;
149
+ filePath: string;
150
+ action: 'transform' | 'rollback' | 'skip';
151
+ from: string;
152
+ to: string;
153
+ success: boolean;
154
+ beforeHash: string;
155
+ afterHash?: string;
156
+ warningCount: number;
157
+ errorCount: number;
158
+ riskScore?: number;
159
+ user?: string;
160
+ duration?: number;
161
+ }
162
+ interface AuditLog {
163
+ version: number;
164
+ entries: AuditEntry[];
165
+ }
166
+ declare class MigrationAuditLog {
167
+ private logDir;
168
+ private logPath;
169
+ constructor(projectPath: string);
170
+ /**
171
+ * Append a new entry to the audit log.
172
+ */
173
+ append(entry: AuditEntry): void;
174
+ /**
175
+ * Create an audit entry for a file transformation.
176
+ */
177
+ createEntry(params: {
178
+ migrationId: string;
179
+ filePath: string;
180
+ from: string;
181
+ to: string;
182
+ originalCode: string;
183
+ transformedCode?: string;
184
+ success: boolean;
185
+ warningCount: number;
186
+ errorCount: number;
187
+ riskScore?: number;
188
+ duration?: number;
189
+ }): AuditEntry;
190
+ /**
191
+ * Read the current audit log.
192
+ */
193
+ read(): AuditLog;
194
+ /**
195
+ * Get entries for a specific migration.
196
+ */
197
+ getByMigration(migrationId: string): AuditEntry[];
198
+ /**
199
+ * Get summary statistics for the audit log.
200
+ */
201
+ getSummary(): {
202
+ totalMigrations: number;
203
+ totalFiles: number;
204
+ successCount: number;
205
+ failureCount: number;
206
+ migrationPaths: string[];
207
+ };
208
+ /**
209
+ * Clear the audit log.
210
+ */
211
+ clear(): void;
212
+ private write;
213
+ private hashContent;
214
+ private getCurrentUser;
215
+ }
216
+
217
+ interface BehavioralWarning {
218
+ category: BehavioralCategory;
219
+ message: string;
220
+ detail: string;
221
+ filePath: string;
222
+ lineNumber?: number;
223
+ severity: 'info' | 'warning' | 'error';
224
+ migration: string;
225
+ }
226
+ type BehavioralCategory = 'type-coercion' | 'error-handling' | 'default-values' | 'error-format' | 'form-input' | 'validation-behavior' | 'null-handling';
227
+ interface BehavioralAnalysisResult {
228
+ warnings: BehavioralWarning[];
229
+ migrationPath: string;
230
+ summary: string;
231
+ }
232
+ declare class BehavioralWarningAnalyzer {
233
+ analyze(sourceFiles: SourceFile[], from: SchemaLibrary, to: SchemaLibrary): BehavioralAnalysisResult;
234
+ private fileUsesLibrary;
235
+ private generateSummary;
236
+ }
237
+
238
+ interface BundleSizeEstimate {
239
+ from: LibraryBundleInfo;
240
+ to: LibraryBundleInfo;
241
+ estimatedDelta: number;
242
+ deltaPercent: number;
243
+ summary: string;
244
+ caveats: string[];
245
+ }
246
+ interface LibraryBundleInfo {
247
+ library: string;
248
+ minifiedGzipKb: number;
249
+ treeShakable: boolean;
250
+ estimatedUsedKb: number;
251
+ }
252
+ declare class BundleEstimator {
253
+ estimate(sourceFiles: SourceFile[], from: SchemaLibrary, to: SchemaLibrary): BundleSizeEstimate;
254
+ private countUsedValidators;
255
+ private getLibraryInfo;
256
+ private generateCaveats;
257
+ private generateSummary;
258
+ }
259
+
146
260
  interface TransformHandler {
147
261
  transform(sourceFile: SourceFile, options: TransformOptions): TransformResult;
148
262
  }
@@ -200,6 +314,10 @@ interface EcosystemReport {
200
314
  }
201
315
  declare class EcosystemAnalyzer {
202
316
  analyze(projectPath: string, from: string, to: string): EcosystemReport;
317
+ /**
318
+ * Returns a list of npm install commands needed to resolve ecosystem issues.
319
+ */
320
+ getUpgradeCommands(report: EcosystemReport): string[];
203
321
  }
204
322
 
205
323
  interface VersionIssue {
@@ -340,10 +458,47 @@ interface MonorepoInfo {
340
458
  packages: MonorepoPackage[];
341
459
  suggestedOrder: string[];
342
460
  }
461
+ /**
462
+ * Groups monorepo packages into parallelizable batches.
463
+ * Packages within the same batch have no dependencies on each other.
464
+ * Batches must be executed in order (batch 0 first, then batch 1, etc.).
465
+ */
466
+ interface ParallelBatch {
467
+ /** Batch index (0-based, execute in order) */
468
+ index: number;
469
+ /** Package names that can be processed in parallel */
470
+ packages: string[];
471
+ }
472
+ /**
473
+ * Computes parallel execution batches from a topological ordering.
474
+ * Packages are grouped by their "depth" in the dependency graph — packages
475
+ * at the same depth have no mutual dependencies and can run concurrently.
476
+ */
477
+ declare function computeParallelBatches(packages: MonorepoPackage[], suggestedOrder: string[]): ParallelBatch[];
478
+ type WorkspaceManager = 'npm' | 'pnpm' | 'yarn';
343
479
  declare class MonorepoResolver {
344
480
  detect(projectPath: string): boolean;
481
+ /**
482
+ * Detect which workspace manager is being used.
483
+ */
484
+ detectManager(projectPath: string): WorkspaceManager;
345
485
  analyze(projectPath: string): MonorepoInfo;
346
486
  private suggestOrder;
487
+ /**
488
+ * Resolve workspace glob patterns from any supported format.
489
+ * Supports: npm/yarn workspaces (package.json), pnpm-workspace.yaml
490
+ */
491
+ private resolveWorkspaceGlobs;
492
+ /**
493
+ * Parse pnpm-workspace.yaml to extract workspace package globs.
494
+ * Simple YAML parsing for the common format:
495
+ * ```
496
+ * packages:
497
+ * - 'packages/*'
498
+ * - 'apps/*'
499
+ * ```
500
+ */
501
+ private parsePnpmWorkspace;
347
502
  private resolveWorkspaceDirs;
348
503
  }
349
504
 
@@ -428,11 +583,26 @@ interface GovernanceResult {
428
583
  schemasChecked: number;
429
584
  passed: boolean;
430
585
  }
586
+ /**
587
+ * Custom governance rule function interface.
588
+ * Plugins can define rules as functions that receive a source file and config,
589
+ * and return violations found.
590
+ */
591
+ type GovernanceRuleFunction = (sourceFile: SourceFile, config: GovernanceRuleConfig) => GovernanceViolation[];
431
592
  declare class GovernanceEngine {
432
593
  private rules;
594
+ private customRuleFunctions;
433
595
  configure(rules: Record<string, GovernanceRuleConfig>): void;
596
+ /**
597
+ * Register a custom governance rule function.
598
+ * Custom rules are executed per-file alongside built-in rules.
599
+ */
600
+ registerRule(name: string, fn: GovernanceRuleFunction): void;
434
601
  analyze(project: Project): GovernanceResult;
435
602
  private detectFileLibrary;
603
+ private measureNestingDepth;
604
+ private detectDynamicSchemas;
605
+ private getSchemaPrefix;
436
606
  private isSchemaExpression;
437
607
  }
438
608
 
@@ -476,6 +646,39 @@ declare class PackageUpdater {
476
646
  apply(projectPath: string, plan: PackageUpdatePlan): void;
477
647
  }
478
648
 
649
+ interface PerformanceWarning {
650
+ category: PerformanceCategory;
651
+ message: string;
652
+ detail: string;
653
+ filePath: string;
654
+ lineNumber?: number;
655
+ severity: 'info' | 'warning' | 'error';
656
+ }
657
+ type PerformanceCategory = 'jit-overhead' | 'cold-start' | 'repeated-parsing' | 'schema-creation' | 'dynamic-schemas';
658
+ interface PerformanceAnalysisResult {
659
+ warnings: PerformanceWarning[];
660
+ parseCallSites: number;
661
+ dynamicSchemaCount: number;
662
+ recommendation: string;
663
+ summary: string;
664
+ }
665
+ /**
666
+ * Analyzes performance implications of schema library migration.
667
+ *
668
+ * Key considerations:
669
+ * - Zod v4 uses JIT compilation: 17x slower schema creation, 8x faster repeated parsing
670
+ * - Valibot is ~2x faster than Zod v3, similar to v4 for runtime
671
+ * - Serverless/edge: Zod v4 JIT penalizes cold starts
672
+ * - Long-lived servers: Zod v4 JIT amortizes well over repeated parses
673
+ */
674
+ declare class PerformanceAnalyzer {
675
+ analyze(sourceFiles: SourceFile[], from: SchemaLibrary, to: SchemaLibrary): PerformanceAnalysisResult;
676
+ private detectDynamicSchemas;
677
+ private addMigrationWarnings;
678
+ private getRecommendation;
679
+ private generateSummary;
680
+ }
681
+
479
682
  interface SchemaShiftPlugin {
480
683
  name: string;
481
684
  version: string;
@@ -485,6 +688,10 @@ interface SchemaShiftPlugin {
485
688
  handler: TransformHandler;
486
689
  }>;
487
690
  rules?: CustomRule[];
691
+ governanceRules?: Array<{
692
+ name: string;
693
+ fn: GovernanceRuleFunction;
694
+ }>;
488
695
  }
489
696
  interface PluginLoadResult {
490
697
  loaded: SchemaShiftPlugin[];
@@ -502,7 +709,69 @@ interface StandardSchemaInfo {
502
709
  version: string;
503
710
  }>;
504
711
  recommendation: string;
712
+ adoptionPath?: string;
713
+ interopTools: string[];
505
714
  }
506
715
  declare function detectStandardSchema(projectPath: string): StandardSchemaInfo;
507
716
 
508
- export { type AnalysisResult, type CallChainInfo, type ChainResult, type ChainStep, type ChainStepResult, type ChainValidation, CompatibilityAnalyzer, type CompatibilityResult, type ComplexityEstimate, ComplexityEstimator, type ComplexityWarning, type CustomRule, type DependencyGraphResult, type DetailedAnalysisResult, DetailedAnalyzer, EcosystemAnalyzer, type EcosystemIssue, type EcosystemReport, type EffortLevel, type FileComplexity, type FormLibraryDetection, FormResolverMigrator, type FormResolverResult, GovernanceEngine, type GovernanceResult, type GovernanceRuleConfig, type GovernanceViolation, type IncrementalState, IncrementalTracker, type LibraryVersionInfo, type MethodCallInfo, MigrationChain, type MigrationReadiness, type MonorepoInfo, type MonorepoPackage, MonorepoResolver, type PackageUpdatePlan, PackageUpdater, type PluginLoadResult, PluginLoader, SchemaAnalyzer, type SchemaComplexity, SchemaDependencyResolver, type SchemaInfo, type SchemaLibrary, type SchemaShiftConfig, type SchemaShiftPlugin, type StandardSchemaInfo, TransformEngine, type TransformError, type TransformHandler, type TransformOptions, type TransformResult, type VersionIssue, type WarningSuppressionRule, buildCallChain, detectFormLibraries, detectSchemaLibrary, detectStandardSchema, isInsideComment, isInsideStringLiteral, loadConfig, parseCallChain, shouldSuppressWarning, startsWithBase, transformMethodChain, validateConfig };
717
+ interface ScaffoldedTest {
718
+ filePath: string;
719
+ testCode: string;
720
+ schemaCount: number;
721
+ }
722
+ interface TestScaffoldResult {
723
+ tests: ScaffoldedTest[];
724
+ totalSchemas: number;
725
+ summary: string;
726
+ }
727
+ /**
728
+ * Generates test files that validate pre/post migration behavior equivalence.
729
+ *
730
+ * For each schema file, generates a test that:
731
+ * 1. Imports the schema
732
+ * 2. Tests validation of sample data (valid + invalid)
733
+ * 3. Verifies error behavior is consistent
734
+ */
735
+ declare class TestScaffolder {
736
+ scaffold(sourceFiles: SourceFile[], from: SchemaLibrary, to: SchemaLibrary): TestScaffoldResult;
737
+ private extractSchemaNames;
738
+ private getLibraryPrefixes;
739
+ private generateTestFile;
740
+ private getParseMethod;
741
+ private getErrorClass;
742
+ private generateSchemaTests;
743
+ }
744
+
745
+ interface DuplicateTypeCandidate {
746
+ typeName: string;
747
+ typeFilePath: string;
748
+ typeLineNumber: number;
749
+ schemaName: string;
750
+ schemaFilePath: string;
751
+ schemaLineNumber: number;
752
+ matchedFields: string[];
753
+ confidence: 'high' | 'medium' | 'low';
754
+ suggestion: string;
755
+ }
756
+ interface TypeDedupResult {
757
+ candidates: DuplicateTypeCandidate[];
758
+ summary: string;
759
+ }
760
+ /**
761
+ * Detects TypeScript interfaces/types that mirror schema shapes.
762
+ *
763
+ * In Joi and Yup codebases, developers often maintain duplicate type definitions
764
+ * alongside schemas because those libraries don't infer TypeScript types.
765
+ * After migrating to Zod, these duplicates can be replaced with z.infer<typeof schema>.
766
+ */
767
+ declare class TypeDedupDetector {
768
+ detect(sourceFiles: SourceFile[]): TypeDedupResult;
769
+ private collectTypeDefinitions;
770
+ private collectSchemaDefinitions;
771
+ private extractSchemaFields;
772
+ private findMatches;
773
+ private getMatchedFields;
774
+ private namesRelated;
775
+ }
776
+
777
+ export { type AnalysisResult, type AuditEntry, type AuditLog, type BehavioralAnalysisResult, type BehavioralCategory, type BehavioralWarning, BehavioralWarningAnalyzer, BundleEstimator, type BundleSizeEstimate, type CallChainInfo, type ChainResult, type ChainStep, type ChainStepResult, type ChainValidation, CompatibilityAnalyzer, type CompatibilityResult, type ComplexityEstimate, ComplexityEstimator, type ComplexityWarning, type CustomRule, type DependencyGraphResult, type DetailedAnalysisResult, DetailedAnalyzer, type DuplicateTypeCandidate, EcosystemAnalyzer, type EcosystemIssue, type EcosystemReport, type EffortLevel, type FileComplexity, type FormLibraryDetection, FormResolverMigrator, type FormResolverResult, GovernanceEngine, type GovernanceResult, type GovernanceRuleConfig, type GovernanceRuleFunction, type GovernanceViolation, type IncrementalState, IncrementalTracker, type LibraryBundleInfo, type LibraryVersionInfo, type MethodCallInfo, MigrationAuditLog, MigrationChain, type MigrationReadiness, type MonorepoInfo, type MonorepoPackage, MonorepoResolver, type PackageUpdatePlan, PackageUpdater, type ParallelBatch, type PerformanceAnalysisResult, PerformanceAnalyzer, type PerformanceCategory, type PerformanceWarning, type PluginLoadResult, PluginLoader, type ScaffoldedTest, SchemaAnalyzer, type SchemaComplexity, SchemaDependencyResolver, type SchemaInfo, type SchemaLibrary, type SchemaShiftConfig, type SchemaShiftPlugin, type StandardSchemaInfo, type TestScaffoldResult, TestScaffolder, TransformEngine, type TransformError, type TransformHandler, type TransformOptions, type TransformResult, TypeDedupDetector, type TypeDedupResult, type VersionIssue, type WarningSuppressionRule, type WorkspaceManager, buildCallChain, computeParallelBatches, detectFormLibraries, detectSchemaLibrary, detectStandardSchema, isInsideComment, isInsideStringLiteral, loadConfig, parseCallChain, shouldSuppressWarning, startsWithBase, transformMethodChain, validateConfig };
package/dist/index.d.ts CHANGED
@@ -143,6 +143,120 @@ declare function transformMethodChain(chain: CallChainInfo, newBase: string, fac
143
143
  args: string[];
144
144
  }[] | null | undefined): string;
145
145
 
146
+ interface AuditEntry {
147
+ timestamp: string;
148
+ migrationId: string;
149
+ filePath: string;
150
+ action: 'transform' | 'rollback' | 'skip';
151
+ from: string;
152
+ to: string;
153
+ success: boolean;
154
+ beforeHash: string;
155
+ afterHash?: string;
156
+ warningCount: number;
157
+ errorCount: number;
158
+ riskScore?: number;
159
+ user?: string;
160
+ duration?: number;
161
+ }
162
+ interface AuditLog {
163
+ version: number;
164
+ entries: AuditEntry[];
165
+ }
166
+ declare class MigrationAuditLog {
167
+ private logDir;
168
+ private logPath;
169
+ constructor(projectPath: string);
170
+ /**
171
+ * Append a new entry to the audit log.
172
+ */
173
+ append(entry: AuditEntry): void;
174
+ /**
175
+ * Create an audit entry for a file transformation.
176
+ */
177
+ createEntry(params: {
178
+ migrationId: string;
179
+ filePath: string;
180
+ from: string;
181
+ to: string;
182
+ originalCode: string;
183
+ transformedCode?: string;
184
+ success: boolean;
185
+ warningCount: number;
186
+ errorCount: number;
187
+ riskScore?: number;
188
+ duration?: number;
189
+ }): AuditEntry;
190
+ /**
191
+ * Read the current audit log.
192
+ */
193
+ read(): AuditLog;
194
+ /**
195
+ * Get entries for a specific migration.
196
+ */
197
+ getByMigration(migrationId: string): AuditEntry[];
198
+ /**
199
+ * Get summary statistics for the audit log.
200
+ */
201
+ getSummary(): {
202
+ totalMigrations: number;
203
+ totalFiles: number;
204
+ successCount: number;
205
+ failureCount: number;
206
+ migrationPaths: string[];
207
+ };
208
+ /**
209
+ * Clear the audit log.
210
+ */
211
+ clear(): void;
212
+ private write;
213
+ private hashContent;
214
+ private getCurrentUser;
215
+ }
216
+
217
+ interface BehavioralWarning {
218
+ category: BehavioralCategory;
219
+ message: string;
220
+ detail: string;
221
+ filePath: string;
222
+ lineNumber?: number;
223
+ severity: 'info' | 'warning' | 'error';
224
+ migration: string;
225
+ }
226
+ type BehavioralCategory = 'type-coercion' | 'error-handling' | 'default-values' | 'error-format' | 'form-input' | 'validation-behavior' | 'null-handling';
227
+ interface BehavioralAnalysisResult {
228
+ warnings: BehavioralWarning[];
229
+ migrationPath: string;
230
+ summary: string;
231
+ }
232
+ declare class BehavioralWarningAnalyzer {
233
+ analyze(sourceFiles: SourceFile[], from: SchemaLibrary, to: SchemaLibrary): BehavioralAnalysisResult;
234
+ private fileUsesLibrary;
235
+ private generateSummary;
236
+ }
237
+
238
+ interface BundleSizeEstimate {
239
+ from: LibraryBundleInfo;
240
+ to: LibraryBundleInfo;
241
+ estimatedDelta: number;
242
+ deltaPercent: number;
243
+ summary: string;
244
+ caveats: string[];
245
+ }
246
+ interface LibraryBundleInfo {
247
+ library: string;
248
+ minifiedGzipKb: number;
249
+ treeShakable: boolean;
250
+ estimatedUsedKb: number;
251
+ }
252
+ declare class BundleEstimator {
253
+ estimate(sourceFiles: SourceFile[], from: SchemaLibrary, to: SchemaLibrary): BundleSizeEstimate;
254
+ private countUsedValidators;
255
+ private getLibraryInfo;
256
+ private generateCaveats;
257
+ private generateSummary;
258
+ }
259
+
146
260
  interface TransformHandler {
147
261
  transform(sourceFile: SourceFile, options: TransformOptions): TransformResult;
148
262
  }
@@ -200,6 +314,10 @@ interface EcosystemReport {
200
314
  }
201
315
  declare class EcosystemAnalyzer {
202
316
  analyze(projectPath: string, from: string, to: string): EcosystemReport;
317
+ /**
318
+ * Returns a list of npm install commands needed to resolve ecosystem issues.
319
+ */
320
+ getUpgradeCommands(report: EcosystemReport): string[];
203
321
  }
204
322
 
205
323
  interface VersionIssue {
@@ -340,10 +458,47 @@ interface MonorepoInfo {
340
458
  packages: MonorepoPackage[];
341
459
  suggestedOrder: string[];
342
460
  }
461
+ /**
462
+ * Groups monorepo packages into parallelizable batches.
463
+ * Packages within the same batch have no dependencies on each other.
464
+ * Batches must be executed in order (batch 0 first, then batch 1, etc.).
465
+ */
466
+ interface ParallelBatch {
467
+ /** Batch index (0-based, execute in order) */
468
+ index: number;
469
+ /** Package names that can be processed in parallel */
470
+ packages: string[];
471
+ }
472
+ /**
473
+ * Computes parallel execution batches from a topological ordering.
474
+ * Packages are grouped by their "depth" in the dependency graph — packages
475
+ * at the same depth have no mutual dependencies and can run concurrently.
476
+ */
477
+ declare function computeParallelBatches(packages: MonorepoPackage[], suggestedOrder: string[]): ParallelBatch[];
478
+ type WorkspaceManager = 'npm' | 'pnpm' | 'yarn';
343
479
  declare class MonorepoResolver {
344
480
  detect(projectPath: string): boolean;
481
+ /**
482
+ * Detect which workspace manager is being used.
483
+ */
484
+ detectManager(projectPath: string): WorkspaceManager;
345
485
  analyze(projectPath: string): MonorepoInfo;
346
486
  private suggestOrder;
487
+ /**
488
+ * Resolve workspace glob patterns from any supported format.
489
+ * Supports: npm/yarn workspaces (package.json), pnpm-workspace.yaml
490
+ */
491
+ private resolveWorkspaceGlobs;
492
+ /**
493
+ * Parse pnpm-workspace.yaml to extract workspace package globs.
494
+ * Simple YAML parsing for the common format:
495
+ * ```
496
+ * packages:
497
+ * - 'packages/*'
498
+ * - 'apps/*'
499
+ * ```
500
+ */
501
+ private parsePnpmWorkspace;
347
502
  private resolveWorkspaceDirs;
348
503
  }
349
504
 
@@ -428,11 +583,26 @@ interface GovernanceResult {
428
583
  schemasChecked: number;
429
584
  passed: boolean;
430
585
  }
586
+ /**
587
+ * Custom governance rule function interface.
588
+ * Plugins can define rules as functions that receive a source file and config,
589
+ * and return violations found.
590
+ */
591
+ type GovernanceRuleFunction = (sourceFile: SourceFile, config: GovernanceRuleConfig) => GovernanceViolation[];
431
592
  declare class GovernanceEngine {
432
593
  private rules;
594
+ private customRuleFunctions;
433
595
  configure(rules: Record<string, GovernanceRuleConfig>): void;
596
+ /**
597
+ * Register a custom governance rule function.
598
+ * Custom rules are executed per-file alongside built-in rules.
599
+ */
600
+ registerRule(name: string, fn: GovernanceRuleFunction): void;
434
601
  analyze(project: Project): GovernanceResult;
435
602
  private detectFileLibrary;
603
+ private measureNestingDepth;
604
+ private detectDynamicSchemas;
605
+ private getSchemaPrefix;
436
606
  private isSchemaExpression;
437
607
  }
438
608
 
@@ -476,6 +646,39 @@ declare class PackageUpdater {
476
646
  apply(projectPath: string, plan: PackageUpdatePlan): void;
477
647
  }
478
648
 
649
+ interface PerformanceWarning {
650
+ category: PerformanceCategory;
651
+ message: string;
652
+ detail: string;
653
+ filePath: string;
654
+ lineNumber?: number;
655
+ severity: 'info' | 'warning' | 'error';
656
+ }
657
+ type PerformanceCategory = 'jit-overhead' | 'cold-start' | 'repeated-parsing' | 'schema-creation' | 'dynamic-schemas';
658
+ interface PerformanceAnalysisResult {
659
+ warnings: PerformanceWarning[];
660
+ parseCallSites: number;
661
+ dynamicSchemaCount: number;
662
+ recommendation: string;
663
+ summary: string;
664
+ }
665
+ /**
666
+ * Analyzes performance implications of schema library migration.
667
+ *
668
+ * Key considerations:
669
+ * - Zod v4 uses JIT compilation: 17x slower schema creation, 8x faster repeated parsing
670
+ * - Valibot is ~2x faster than Zod v3, similar to v4 for runtime
671
+ * - Serverless/edge: Zod v4 JIT penalizes cold starts
672
+ * - Long-lived servers: Zod v4 JIT amortizes well over repeated parses
673
+ */
674
+ declare class PerformanceAnalyzer {
675
+ analyze(sourceFiles: SourceFile[], from: SchemaLibrary, to: SchemaLibrary): PerformanceAnalysisResult;
676
+ private detectDynamicSchemas;
677
+ private addMigrationWarnings;
678
+ private getRecommendation;
679
+ private generateSummary;
680
+ }
681
+
479
682
  interface SchemaShiftPlugin {
480
683
  name: string;
481
684
  version: string;
@@ -485,6 +688,10 @@ interface SchemaShiftPlugin {
485
688
  handler: TransformHandler;
486
689
  }>;
487
690
  rules?: CustomRule[];
691
+ governanceRules?: Array<{
692
+ name: string;
693
+ fn: GovernanceRuleFunction;
694
+ }>;
488
695
  }
489
696
  interface PluginLoadResult {
490
697
  loaded: SchemaShiftPlugin[];
@@ -502,7 +709,69 @@ interface StandardSchemaInfo {
502
709
  version: string;
503
710
  }>;
504
711
  recommendation: string;
712
+ adoptionPath?: string;
713
+ interopTools: string[];
505
714
  }
506
715
  declare function detectStandardSchema(projectPath: string): StandardSchemaInfo;
507
716
 
508
- export { type AnalysisResult, type CallChainInfo, type ChainResult, type ChainStep, type ChainStepResult, type ChainValidation, CompatibilityAnalyzer, type CompatibilityResult, type ComplexityEstimate, ComplexityEstimator, type ComplexityWarning, type CustomRule, type DependencyGraphResult, type DetailedAnalysisResult, DetailedAnalyzer, EcosystemAnalyzer, type EcosystemIssue, type EcosystemReport, type EffortLevel, type FileComplexity, type FormLibraryDetection, FormResolverMigrator, type FormResolverResult, GovernanceEngine, type GovernanceResult, type GovernanceRuleConfig, type GovernanceViolation, type IncrementalState, IncrementalTracker, type LibraryVersionInfo, type MethodCallInfo, MigrationChain, type MigrationReadiness, type MonorepoInfo, type MonorepoPackage, MonorepoResolver, type PackageUpdatePlan, PackageUpdater, type PluginLoadResult, PluginLoader, SchemaAnalyzer, type SchemaComplexity, SchemaDependencyResolver, type SchemaInfo, type SchemaLibrary, type SchemaShiftConfig, type SchemaShiftPlugin, type StandardSchemaInfo, TransformEngine, type TransformError, type TransformHandler, type TransformOptions, type TransformResult, type VersionIssue, type WarningSuppressionRule, buildCallChain, detectFormLibraries, detectSchemaLibrary, detectStandardSchema, isInsideComment, isInsideStringLiteral, loadConfig, parseCallChain, shouldSuppressWarning, startsWithBase, transformMethodChain, validateConfig };
717
+ interface ScaffoldedTest {
718
+ filePath: string;
719
+ testCode: string;
720
+ schemaCount: number;
721
+ }
722
+ interface TestScaffoldResult {
723
+ tests: ScaffoldedTest[];
724
+ totalSchemas: number;
725
+ summary: string;
726
+ }
727
+ /**
728
+ * Generates test files that validate pre/post migration behavior equivalence.
729
+ *
730
+ * For each schema file, generates a test that:
731
+ * 1. Imports the schema
732
+ * 2. Tests validation of sample data (valid + invalid)
733
+ * 3. Verifies error behavior is consistent
734
+ */
735
+ declare class TestScaffolder {
736
+ scaffold(sourceFiles: SourceFile[], from: SchemaLibrary, to: SchemaLibrary): TestScaffoldResult;
737
+ private extractSchemaNames;
738
+ private getLibraryPrefixes;
739
+ private generateTestFile;
740
+ private getParseMethod;
741
+ private getErrorClass;
742
+ private generateSchemaTests;
743
+ }
744
+
745
+ interface DuplicateTypeCandidate {
746
+ typeName: string;
747
+ typeFilePath: string;
748
+ typeLineNumber: number;
749
+ schemaName: string;
750
+ schemaFilePath: string;
751
+ schemaLineNumber: number;
752
+ matchedFields: string[];
753
+ confidence: 'high' | 'medium' | 'low';
754
+ suggestion: string;
755
+ }
756
+ interface TypeDedupResult {
757
+ candidates: DuplicateTypeCandidate[];
758
+ summary: string;
759
+ }
760
+ /**
761
+ * Detects TypeScript interfaces/types that mirror schema shapes.
762
+ *
763
+ * In Joi and Yup codebases, developers often maintain duplicate type definitions
764
+ * alongside schemas because those libraries don't infer TypeScript types.
765
+ * After migrating to Zod, these duplicates can be replaced with z.infer<typeof schema>.
766
+ */
767
+ declare class TypeDedupDetector {
768
+ detect(sourceFiles: SourceFile[]): TypeDedupResult;
769
+ private collectTypeDefinitions;
770
+ private collectSchemaDefinitions;
771
+ private extractSchemaFields;
772
+ private findMatches;
773
+ private getMatchedFields;
774
+ private namesRelated;
775
+ }
776
+
777
+ export { type AnalysisResult, type AuditEntry, type AuditLog, type BehavioralAnalysisResult, type BehavioralCategory, type BehavioralWarning, BehavioralWarningAnalyzer, BundleEstimator, type BundleSizeEstimate, type CallChainInfo, type ChainResult, type ChainStep, type ChainStepResult, type ChainValidation, CompatibilityAnalyzer, type CompatibilityResult, type ComplexityEstimate, ComplexityEstimator, type ComplexityWarning, type CustomRule, type DependencyGraphResult, type DetailedAnalysisResult, DetailedAnalyzer, type DuplicateTypeCandidate, EcosystemAnalyzer, type EcosystemIssue, type EcosystemReport, type EffortLevel, type FileComplexity, type FormLibraryDetection, FormResolverMigrator, type FormResolverResult, GovernanceEngine, type GovernanceResult, type GovernanceRuleConfig, type GovernanceRuleFunction, type GovernanceViolation, type IncrementalState, IncrementalTracker, type LibraryBundleInfo, type LibraryVersionInfo, type MethodCallInfo, MigrationAuditLog, MigrationChain, type MigrationReadiness, type MonorepoInfo, type MonorepoPackage, MonorepoResolver, type PackageUpdatePlan, PackageUpdater, type ParallelBatch, type PerformanceAnalysisResult, PerformanceAnalyzer, type PerformanceCategory, type PerformanceWarning, type PluginLoadResult, PluginLoader, type ScaffoldedTest, SchemaAnalyzer, type SchemaComplexity, SchemaDependencyResolver, type SchemaInfo, type SchemaLibrary, type SchemaShiftConfig, type SchemaShiftPlugin, type StandardSchemaInfo, type TestScaffoldResult, TestScaffolder, TransformEngine, type TransformError, type TransformHandler, type TransformOptions, type TransformResult, TypeDedupDetector, type TypeDedupResult, type VersionIssue, type WarningSuppressionRule, type WorkspaceManager, buildCallChain, computeParallelBatches, detectFormLibraries, detectSchemaLibrary, detectStandardSchema, isInsideComment, isInsideStringLiteral, loadConfig, parseCallChain, shouldSuppressWarning, startsWithBase, transformMethodChain, validateConfig };