@claude-flow/plugin-code-intelligence 3.0.0-alpha.1

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.
@@ -0,0 +1,838 @@
1
+ /**
2
+ * Code Intelligence Plugin - Type Definitions
3
+ *
4
+ * Core types for advanced code analysis including semantic search,
5
+ * architecture analysis, refactoring impact prediction, module splitting,
6
+ * and pattern learning.
7
+ *
8
+ * Based on ADR-035: Advanced Code Intelligence Plugin
9
+ *
10
+ * @module v3/plugins/code-intelligence/types
11
+ */
12
+ import { z } from 'zod';
13
+ /**
14
+ * Supported programming languages
15
+ */
16
+ export declare const Language: z.ZodEnum<["typescript", "javascript", "python", "java", "go", "rust", "cpp", "csharp", "ruby", "php", "swift", "kotlin", "scala"]>;
17
+ export type Language = z.infer<typeof Language>;
18
+ /**
19
+ * Language tiers for support level
20
+ */
21
+ export declare const LanguageTier: Record<Language, 'tier1' | 'tier2' | 'tier3'>;
22
+ /**
23
+ * Search type for semantic code search
24
+ */
25
+ export declare const SearchType: z.ZodEnum<["semantic", "structural", "clone", "api_usage"]>;
26
+ export type SearchType = z.infer<typeof SearchType>;
27
+ /**
28
+ * Code search result
29
+ */
30
+ export interface CodeSearchResult {
31
+ /** File path */
32
+ readonly filePath: string;
33
+ /** Line number */
34
+ readonly lineNumber: number;
35
+ /** Code snippet */
36
+ readonly snippet: string;
37
+ /** Match type */
38
+ readonly matchType: SearchType;
39
+ /** Relevance score (0-1) */
40
+ readonly score: number;
41
+ /** Context (surrounding lines) */
42
+ readonly context: string;
43
+ /** Symbol name if applicable */
44
+ readonly symbol?: string;
45
+ /** Language of the file */
46
+ readonly language: Language;
47
+ /** Explanation of why this matched */
48
+ readonly explanation: string;
49
+ }
50
+ /**
51
+ * Semantic search result
52
+ */
53
+ export interface SemanticSearchResult {
54
+ /** Success status */
55
+ readonly success: boolean;
56
+ /** Search query */
57
+ readonly query: string;
58
+ /** Search type used */
59
+ readonly searchType: SearchType;
60
+ /** Results */
61
+ readonly results: CodeSearchResult[];
62
+ /** Total matches (before limit) */
63
+ readonly totalMatches: number;
64
+ /** Search scope used */
65
+ readonly scope: SearchScope;
66
+ /** Execution time in ms */
67
+ readonly durationMs: number;
68
+ }
69
+ /**
70
+ * Search scope configuration
71
+ */
72
+ export interface SearchScope {
73
+ /** Paths to include */
74
+ readonly paths?: string[];
75
+ /** Languages to search */
76
+ readonly languages?: Language[];
77
+ /** Exclude test files */
78
+ readonly excludeTests?: boolean;
79
+ /** Exclude node_modules and similar */
80
+ readonly excludeVendor?: boolean;
81
+ /** File patterns to exclude */
82
+ readonly excludePatterns?: string[];
83
+ }
84
+ /**
85
+ * Analysis types for architecture
86
+ */
87
+ export declare const AnalysisType: z.ZodEnum<["dependency_graph", "layer_violations", "circular_deps", "component_coupling", "module_cohesion", "dead_code", "api_surface", "architectural_drift"]>;
88
+ export type AnalysisType = z.infer<typeof AnalysisType>;
89
+ /**
90
+ * Output format for architecture analysis
91
+ */
92
+ export declare const OutputFormat: z.ZodEnum<["json", "graphviz", "mermaid"]>;
93
+ export type OutputFormat = z.infer<typeof OutputFormat>;
94
+ /**
95
+ * Dependency node
96
+ */
97
+ export interface DependencyNode {
98
+ /** Node ID (file path or module name) */
99
+ readonly id: string;
100
+ /** Node label */
101
+ readonly label: string;
102
+ /** Node type */
103
+ readonly type: 'file' | 'module' | 'package' | 'class' | 'function';
104
+ /** Language */
105
+ readonly language?: Language;
106
+ /** Lines of code */
107
+ readonly loc?: number;
108
+ /** Complexity score */
109
+ readonly complexity?: number;
110
+ /** Layer (if applicable) */
111
+ readonly layer?: string;
112
+ }
113
+ /**
114
+ * Dependency edge
115
+ */
116
+ export interface DependencyEdge {
117
+ /** Source node ID */
118
+ readonly from: string;
119
+ /** Target node ID */
120
+ readonly to: string;
121
+ /** Edge type */
122
+ readonly type: 'import' | 'extends' | 'implements' | 'uses' | 'calls';
123
+ /** Weight (import count or call frequency) */
124
+ readonly weight: number;
125
+ /** Is dynamic import */
126
+ readonly dynamic?: boolean;
127
+ }
128
+ /**
129
+ * Dependency graph
130
+ */
131
+ export interface DependencyGraph {
132
+ /** All nodes */
133
+ readonly nodes: DependencyNode[];
134
+ /** All edges */
135
+ readonly edges: DependencyEdge[];
136
+ /** Graph metadata */
137
+ readonly metadata: {
138
+ totalNodes: number;
139
+ totalEdges: number;
140
+ avgDegree: number;
141
+ maxDepth: number;
142
+ };
143
+ }
144
+ /**
145
+ * Layer violation
146
+ */
147
+ export interface LayerViolation {
148
+ /** Source module */
149
+ readonly source: string;
150
+ /** Target module */
151
+ readonly target: string;
152
+ /** Source layer */
153
+ readonly sourceLayer: string;
154
+ /** Target layer */
155
+ readonly targetLayer: string;
156
+ /** Violation type */
157
+ readonly violationType: 'upward' | 'skip' | 'cross';
158
+ /** Severity */
159
+ readonly severity: 'low' | 'medium' | 'high';
160
+ /** Suggested fix */
161
+ readonly suggestedFix: string;
162
+ }
163
+ /**
164
+ * Circular dependency
165
+ */
166
+ export interface CircularDependency {
167
+ /** Cycle path (node IDs) */
168
+ readonly cycle: string[];
169
+ /** Cycle length */
170
+ readonly length: number;
171
+ /** Severity */
172
+ readonly severity: 'low' | 'medium' | 'high';
173
+ /** Suggested break point */
174
+ readonly suggestedBreakPoint: string;
175
+ }
176
+ /**
177
+ * Component coupling metrics
178
+ */
179
+ export interface CouplingMetrics {
180
+ /** Component ID */
181
+ readonly componentId: string;
182
+ /** Afferent coupling (incoming dependencies) */
183
+ readonly afferentCoupling: number;
184
+ /** Efferent coupling (outgoing dependencies) */
185
+ readonly efferentCoupling: number;
186
+ /** Instability (Ce / (Ca + Ce)) */
187
+ readonly instability: number;
188
+ /** Abstractness */
189
+ readonly abstractness: number;
190
+ /** Distance from main sequence */
191
+ readonly distanceFromMain: number;
192
+ /** Is in zone of pain (high stability, low abstractness) */
193
+ readonly inZoneOfPain: boolean;
194
+ /** Is in zone of uselessness (low stability, high abstractness) */
195
+ readonly inZoneOfUselessness: boolean;
196
+ }
197
+ /**
198
+ * Module cohesion metrics
199
+ */
200
+ export interface CohesionMetrics {
201
+ /** Module ID */
202
+ readonly moduleId: string;
203
+ /** Lack of Cohesion in Methods (LCOM) */
204
+ readonly lcom: number;
205
+ /** Tight Class Cohesion (TCC) */
206
+ readonly tcc: number;
207
+ /** Loose Class Cohesion (LCC) */
208
+ readonly lcc: number;
209
+ /** Cohesion level */
210
+ readonly level: 'high' | 'medium' | 'low';
211
+ /** Suggestions for improvement */
212
+ readonly suggestions: string[];
213
+ }
214
+ /**
215
+ * Dead code finding
216
+ */
217
+ export interface DeadCodeFinding {
218
+ /** File path */
219
+ readonly filePath: string;
220
+ /** Symbol name */
221
+ readonly symbol: string;
222
+ /** Symbol type */
223
+ readonly symbolType: 'function' | 'class' | 'variable' | 'import' | 'export';
224
+ /** Line number */
225
+ readonly lineNumber: number;
226
+ /** Confidence (0-1) */
227
+ readonly confidence: number;
228
+ /** Reason */
229
+ readonly reason: string;
230
+ /** Is exported */
231
+ readonly isExported: boolean;
232
+ }
233
+ /**
234
+ * API surface element
235
+ */
236
+ export interface APISurfaceElement {
237
+ /** Symbol name */
238
+ readonly name: string;
239
+ /** Symbol type */
240
+ readonly type: 'function' | 'class' | 'interface' | 'type' | 'constant';
241
+ /** File path */
242
+ readonly filePath: string;
243
+ /** Export type */
244
+ readonly exportType: 'named' | 'default' | 're-export';
245
+ /** Usage count */
246
+ readonly usageCount: number;
247
+ /** Is deprecated */
248
+ readonly deprecated: boolean;
249
+ /** Documentation coverage */
250
+ readonly documented: boolean;
251
+ }
252
+ /**
253
+ * Architectural drift
254
+ */
255
+ export interface ArchitecturalDrift {
256
+ /** Component */
257
+ readonly component: string;
258
+ /** Baseline hash */
259
+ readonly baselineRef: string;
260
+ /** Current hash */
261
+ readonly currentRef: string;
262
+ /** Drift type */
263
+ readonly driftType: 'dependency_added' | 'dependency_removed' | 'layer_change' | 'coupling_increase';
264
+ /** Description */
265
+ readonly description: string;
266
+ /** Severity */
267
+ readonly severity: 'low' | 'medium' | 'high';
268
+ }
269
+ /**
270
+ * Architecture analysis result
271
+ */
272
+ export interface ArchitectureAnalysisResult {
273
+ /** Success status */
274
+ readonly success: boolean;
275
+ /** Root path analyzed */
276
+ readonly rootPath: string;
277
+ /** Analyses performed */
278
+ readonly analyses: AnalysisType[];
279
+ /** Dependency graph */
280
+ readonly dependencyGraph?: DependencyGraph;
281
+ /** Layer violations */
282
+ readonly layerViolations?: LayerViolation[];
283
+ /** Circular dependencies */
284
+ readonly circularDeps?: CircularDependency[];
285
+ /** Coupling metrics */
286
+ readonly couplingMetrics?: CouplingMetrics[];
287
+ /** Cohesion metrics */
288
+ readonly cohesionMetrics?: CohesionMetrics[];
289
+ /** Dead code findings */
290
+ readonly deadCode?: DeadCodeFinding[];
291
+ /** API surface */
292
+ readonly apiSurface?: APISurfaceElement[];
293
+ /** Architectural drift */
294
+ readonly drift?: ArchitecturalDrift[];
295
+ /** Summary */
296
+ readonly summary: {
297
+ totalFiles: number;
298
+ totalModules: number;
299
+ healthScore: number;
300
+ issues: number;
301
+ warnings: number;
302
+ };
303
+ /** Execution time in ms */
304
+ readonly durationMs: number;
305
+ }
306
+ /**
307
+ * Change type for refactoring
308
+ */
309
+ export declare const ChangeType: z.ZodEnum<["rename", "move", "delete", "extract", "inline"]>;
310
+ export type ChangeType = z.infer<typeof ChangeType>;
311
+ /**
312
+ * Proposed change
313
+ */
314
+ export interface ProposedChange {
315
+ /** File to change */
316
+ readonly file: string;
317
+ /** Change type */
318
+ readonly type: ChangeType;
319
+ /** Change details */
320
+ readonly details: {
321
+ /** Original name (for rename) */
322
+ oldName?: string;
323
+ /** New name (for rename) */
324
+ newName?: string;
325
+ /** New location (for move) */
326
+ newPath?: string;
327
+ /** Symbol to extract (for extract) */
328
+ symbol?: string;
329
+ /** Target file (for extract) */
330
+ targetFile?: string;
331
+ };
332
+ }
333
+ /**
334
+ * Impact on a file
335
+ */
336
+ export interface FileImpact {
337
+ /** File path */
338
+ readonly filePath: string;
339
+ /** Impact type */
340
+ readonly impactType: 'direct' | 'indirect' | 'transitive';
341
+ /** Requires modification */
342
+ readonly requiresChange: boolean;
343
+ /** Changes needed */
344
+ readonly changesNeeded: string[];
345
+ /** Risk level */
346
+ readonly risk: 'low' | 'medium' | 'high';
347
+ /** Tests affected */
348
+ readonly testsAffected: string[];
349
+ }
350
+ /**
351
+ * Refactoring impact result
352
+ */
353
+ export interface RefactoringImpactResult {
354
+ /** Success status */
355
+ readonly success: boolean;
356
+ /** Proposed changes */
357
+ readonly changes: ProposedChange[];
358
+ /** Impacted files */
359
+ readonly impactedFiles: FileImpact[];
360
+ /** Impact summary */
361
+ readonly summary: {
362
+ directlyAffected: number;
363
+ indirectlyAffected: number;
364
+ testsAffected: number;
365
+ totalRisk: 'low' | 'medium' | 'high';
366
+ };
367
+ /** Suggested order of changes */
368
+ readonly suggestedOrder: string[];
369
+ /** Potential breaking changes */
370
+ readonly breakingChanges: string[];
371
+ /** Execution time in ms */
372
+ readonly durationMs: number;
373
+ }
374
+ /**
375
+ * Splitting strategy
376
+ */
377
+ export declare const SplitStrategy: z.ZodEnum<["minimize_coupling", "balance_size", "feature_isolation"]>;
378
+ export type SplitStrategy = z.infer<typeof SplitStrategy>;
379
+ /**
380
+ * Split constraints
381
+ */
382
+ export interface SplitConstraints {
383
+ /** Maximum module size (lines) */
384
+ readonly maxModuleSize?: number;
385
+ /** Minimum module size (lines) */
386
+ readonly minModuleSize?: number;
387
+ /** Boundaries to preserve */
388
+ readonly preserveBoundaries?: string[];
389
+ /** Files that must stay together */
390
+ readonly keepTogether?: string[][];
391
+ }
392
+ /**
393
+ * Suggested module
394
+ */
395
+ export interface SuggestedModule {
396
+ /** Module name */
397
+ readonly name: string;
398
+ /** Files included */
399
+ readonly files: string[];
400
+ /** Total lines of code */
401
+ readonly loc: number;
402
+ /** Internal cohesion score */
403
+ readonly cohesion: number;
404
+ /** External coupling score */
405
+ readonly coupling: number;
406
+ /** Public API */
407
+ readonly publicApi: string[];
408
+ /** Dependencies on other suggested modules */
409
+ readonly dependencies: string[];
410
+ }
411
+ /**
412
+ * Module split suggestion result
413
+ */
414
+ export interface ModuleSplitResult {
415
+ /** Success status */
416
+ readonly success: boolean;
417
+ /** Target path analyzed */
418
+ readonly targetPath: string;
419
+ /** Strategy used */
420
+ readonly strategy: SplitStrategy;
421
+ /** Suggested modules */
422
+ readonly modules: SuggestedModule[];
423
+ /** Cut edges (dependencies that cross module boundaries) */
424
+ readonly cutEdges: Array<{
425
+ from: string;
426
+ to: string;
427
+ weight: number;
428
+ }>;
429
+ /** Quality metrics */
430
+ readonly quality: {
431
+ totalCutWeight: number;
432
+ avgCohesion: number;
433
+ avgCoupling: number;
434
+ balanceScore: number;
435
+ };
436
+ /** Migration steps */
437
+ readonly migrationSteps: string[];
438
+ /** Execution time in ms */
439
+ readonly durationMs: number;
440
+ }
441
+ /**
442
+ * Pattern types to learn
443
+ */
444
+ export declare const PatternType: z.ZodEnum<["bug_patterns", "refactor_patterns", "api_patterns", "test_patterns"]>;
445
+ export type PatternType = z.infer<typeof PatternType>;
446
+ /**
447
+ * Learned pattern
448
+ */
449
+ export interface LearnedPattern {
450
+ /** Pattern ID */
451
+ readonly id: string;
452
+ /** Pattern type */
453
+ readonly type: PatternType;
454
+ /** Pattern description */
455
+ readonly description: string;
456
+ /** Code before (for refactoring patterns) */
457
+ readonly codeBefore?: string;
458
+ /** Code after (for refactoring patterns) */
459
+ readonly codeAfter?: string;
460
+ /** Occurrence count */
461
+ readonly occurrences: number;
462
+ /** Authors who used this pattern */
463
+ readonly authors: string[];
464
+ /** Files where pattern appears */
465
+ readonly files: string[];
466
+ /** Confidence score */
467
+ readonly confidence: number;
468
+ /** Impact (positive/negative/neutral) */
469
+ readonly impact: 'positive' | 'negative' | 'neutral';
470
+ /** Suggested action */
471
+ readonly suggestedAction?: string;
472
+ }
473
+ /**
474
+ * Pattern learning scope
475
+ */
476
+ export interface LearningScope {
477
+ /** Git range to analyze */
478
+ readonly gitRange?: string;
479
+ /** Authors to filter */
480
+ readonly authors?: string[];
481
+ /** Paths to include */
482
+ readonly paths?: string[];
483
+ /** Since date */
484
+ readonly since?: Date;
485
+ /** Until date */
486
+ readonly until?: Date;
487
+ }
488
+ /**
489
+ * Pattern learning result
490
+ */
491
+ export interface PatternLearningResult {
492
+ /** Success status */
493
+ readonly success: boolean;
494
+ /** Scope used */
495
+ readonly scope: LearningScope;
496
+ /** Pattern types analyzed */
497
+ readonly patternTypes: PatternType[];
498
+ /** Learned patterns */
499
+ readonly patterns: LearnedPattern[];
500
+ /** Summary */
501
+ readonly summary: {
502
+ commitsAnalyzed: number;
503
+ filesAnalyzed: number;
504
+ patternsFound: number;
505
+ byType: Record<PatternType, number>;
506
+ };
507
+ /** Recommendations based on patterns */
508
+ readonly recommendations: string[];
509
+ /** Execution time in ms */
510
+ readonly durationMs: number;
511
+ }
512
+ /**
513
+ * Input schema for code/semantic-search
514
+ */
515
+ export declare const SemanticSearchInputSchema: z.ZodObject<{
516
+ query: z.ZodString;
517
+ scope: z.ZodOptional<z.ZodObject<{
518
+ paths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
519
+ languages: z.ZodOptional<z.ZodArray<z.ZodEnum<["typescript", "javascript", "python", "java", "go", "rust", "cpp", "csharp", "ruby", "php", "swift", "kotlin", "scala"]>, "many">>;
520
+ excludeTests: z.ZodDefault<z.ZodBoolean>;
521
+ }, "strip", z.ZodTypeAny, {
522
+ excludeTests: boolean;
523
+ paths?: string[] | undefined;
524
+ languages?: ("typescript" | "javascript" | "python" | "java" | "go" | "rust" | "cpp" | "csharp" | "ruby" | "php" | "swift" | "kotlin" | "scala")[] | undefined;
525
+ }, {
526
+ paths?: string[] | undefined;
527
+ languages?: ("typescript" | "javascript" | "python" | "java" | "go" | "rust" | "cpp" | "csharp" | "ruby" | "php" | "swift" | "kotlin" | "scala")[] | undefined;
528
+ excludeTests?: boolean | undefined;
529
+ }>>;
530
+ searchType: z.ZodDefault<z.ZodEnum<["semantic", "structural", "clone", "api_usage"]>>;
531
+ topK: z.ZodDefault<z.ZodNumber>;
532
+ }, "strip", z.ZodTypeAny, {
533
+ query: string;
534
+ searchType: "semantic" | "structural" | "clone" | "api_usage";
535
+ topK: number;
536
+ scope?: {
537
+ excludeTests: boolean;
538
+ paths?: string[] | undefined;
539
+ languages?: ("typescript" | "javascript" | "python" | "java" | "go" | "rust" | "cpp" | "csharp" | "ruby" | "php" | "swift" | "kotlin" | "scala")[] | undefined;
540
+ } | undefined;
541
+ }, {
542
+ query: string;
543
+ scope?: {
544
+ paths?: string[] | undefined;
545
+ languages?: ("typescript" | "javascript" | "python" | "java" | "go" | "rust" | "cpp" | "csharp" | "ruby" | "php" | "swift" | "kotlin" | "scala")[] | undefined;
546
+ excludeTests?: boolean | undefined;
547
+ } | undefined;
548
+ searchType?: "semantic" | "structural" | "clone" | "api_usage" | undefined;
549
+ topK?: number | undefined;
550
+ }>;
551
+ export type SemanticSearchInput = z.infer<typeof SemanticSearchInputSchema>;
552
+ /**
553
+ * Input schema for code/architecture-analyze
554
+ */
555
+ export declare const ArchitectureAnalyzeInputSchema: z.ZodObject<{
556
+ rootPath: z.ZodDefault<z.ZodString>;
557
+ analysis: z.ZodOptional<z.ZodArray<z.ZodEnum<["dependency_graph", "layer_violations", "circular_deps", "component_coupling", "module_cohesion", "dead_code", "api_surface", "architectural_drift"]>, "many">>;
558
+ baseline: z.ZodOptional<z.ZodString>;
559
+ outputFormat: z.ZodOptional<z.ZodEnum<["json", "graphviz", "mermaid"]>>;
560
+ layers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
561
+ }, "strip", z.ZodTypeAny, {
562
+ rootPath: string;
563
+ analysis?: ("dependency_graph" | "layer_violations" | "circular_deps" | "component_coupling" | "module_cohesion" | "dead_code" | "api_surface" | "architectural_drift")[] | undefined;
564
+ baseline?: string | undefined;
565
+ outputFormat?: "json" | "graphviz" | "mermaid" | undefined;
566
+ layers?: Record<string, string[]> | undefined;
567
+ }, {
568
+ rootPath?: string | undefined;
569
+ analysis?: ("dependency_graph" | "layer_violations" | "circular_deps" | "component_coupling" | "module_cohesion" | "dead_code" | "api_surface" | "architectural_drift")[] | undefined;
570
+ baseline?: string | undefined;
571
+ outputFormat?: "json" | "graphviz" | "mermaid" | undefined;
572
+ layers?: Record<string, string[]> | undefined;
573
+ }>;
574
+ export type ArchitectureAnalyzeInput = z.infer<typeof ArchitectureAnalyzeInputSchema>;
575
+ /**
576
+ * Input schema for code/refactor-impact
577
+ */
578
+ export declare const RefactorImpactInputSchema: z.ZodObject<{
579
+ changes: z.ZodArray<z.ZodObject<{
580
+ file: z.ZodString;
581
+ type: z.ZodEnum<["rename", "move", "delete", "extract", "inline"]>;
582
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
583
+ }, "strip", z.ZodTypeAny, {
584
+ type: "rename" | "move" | "delete" | "extract" | "inline";
585
+ file: string;
586
+ details?: Record<string, unknown> | undefined;
587
+ }, {
588
+ type: "rename" | "move" | "delete" | "extract" | "inline";
589
+ file: string;
590
+ details?: Record<string, unknown> | undefined;
591
+ }>, "many">;
592
+ depth: z.ZodDefault<z.ZodNumber>;
593
+ includeTests: z.ZodDefault<z.ZodBoolean>;
594
+ }, "strip", z.ZodTypeAny, {
595
+ changes: {
596
+ type: "rename" | "move" | "delete" | "extract" | "inline";
597
+ file: string;
598
+ details?: Record<string, unknown> | undefined;
599
+ }[];
600
+ depth: number;
601
+ includeTests: boolean;
602
+ }, {
603
+ changes: {
604
+ type: "rename" | "move" | "delete" | "extract" | "inline";
605
+ file: string;
606
+ details?: Record<string, unknown> | undefined;
607
+ }[];
608
+ depth?: number | undefined;
609
+ includeTests?: boolean | undefined;
610
+ }>;
611
+ export type RefactorImpactInput = z.infer<typeof RefactorImpactInputSchema>;
612
+ /**
613
+ * Input schema for code/split-suggest
614
+ */
615
+ export declare const SplitSuggestInputSchema: z.ZodObject<{
616
+ targetPath: z.ZodString;
617
+ strategy: z.ZodDefault<z.ZodEnum<["minimize_coupling", "balance_size", "feature_isolation"]>>;
618
+ constraints: z.ZodOptional<z.ZodObject<{
619
+ maxModuleSize: z.ZodOptional<z.ZodNumber>;
620
+ minModuleSize: z.ZodOptional<z.ZodNumber>;
621
+ preserveBoundaries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
622
+ }, "strip", z.ZodTypeAny, {
623
+ maxModuleSize?: number | undefined;
624
+ minModuleSize?: number | undefined;
625
+ preserveBoundaries?: string[] | undefined;
626
+ }, {
627
+ maxModuleSize?: number | undefined;
628
+ minModuleSize?: number | undefined;
629
+ preserveBoundaries?: string[] | undefined;
630
+ }>>;
631
+ targetModules: z.ZodOptional<z.ZodNumber>;
632
+ }, "strip", z.ZodTypeAny, {
633
+ targetPath: string;
634
+ strategy: "minimize_coupling" | "balance_size" | "feature_isolation";
635
+ constraints?: {
636
+ maxModuleSize?: number | undefined;
637
+ minModuleSize?: number | undefined;
638
+ preserveBoundaries?: string[] | undefined;
639
+ } | undefined;
640
+ targetModules?: number | undefined;
641
+ }, {
642
+ targetPath: string;
643
+ strategy?: "minimize_coupling" | "balance_size" | "feature_isolation" | undefined;
644
+ constraints?: {
645
+ maxModuleSize?: number | undefined;
646
+ minModuleSize?: number | undefined;
647
+ preserveBoundaries?: string[] | undefined;
648
+ } | undefined;
649
+ targetModules?: number | undefined;
650
+ }>;
651
+ export type SplitSuggestInput = z.infer<typeof SplitSuggestInputSchema>;
652
+ /**
653
+ * Input schema for code/learn-patterns
654
+ */
655
+ export declare const LearnPatternsInputSchema: z.ZodObject<{
656
+ scope: z.ZodOptional<z.ZodObject<{
657
+ gitRange: z.ZodDefault<z.ZodString>;
658
+ authors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
659
+ paths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
660
+ }, "strip", z.ZodTypeAny, {
661
+ gitRange: string;
662
+ paths?: string[] | undefined;
663
+ authors?: string[] | undefined;
664
+ }, {
665
+ paths?: string[] | undefined;
666
+ gitRange?: string | undefined;
667
+ authors?: string[] | undefined;
668
+ }>>;
669
+ patternTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["bug_patterns", "refactor_patterns", "api_patterns", "test_patterns"]>, "many">>;
670
+ minOccurrences: z.ZodDefault<z.ZodNumber>;
671
+ }, "strip", z.ZodTypeAny, {
672
+ minOccurrences: number;
673
+ scope?: {
674
+ gitRange: string;
675
+ paths?: string[] | undefined;
676
+ authors?: string[] | undefined;
677
+ } | undefined;
678
+ patternTypes?: ("bug_patterns" | "refactor_patterns" | "api_patterns" | "test_patterns")[] | undefined;
679
+ }, {
680
+ scope?: {
681
+ paths?: string[] | undefined;
682
+ gitRange?: string | undefined;
683
+ authors?: string[] | undefined;
684
+ } | undefined;
685
+ patternTypes?: ("bug_patterns" | "refactor_patterns" | "api_patterns" | "test_patterns")[] | undefined;
686
+ minOccurrences?: number | undefined;
687
+ }>;
688
+ export type LearnPatternsInput = z.infer<typeof LearnPatternsInputSchema>;
689
+ /**
690
+ * GNN Bridge for code graph analysis
691
+ */
692
+ export interface IGNNBridge {
693
+ /**
694
+ * Build code graph from files
695
+ */
696
+ buildCodeGraph(files: string[], includeCallGraph: boolean): Promise<DependencyGraph>;
697
+ /**
698
+ * Compute node embeddings using GNN
699
+ */
700
+ computeNodeEmbeddings(graph: DependencyGraph, embeddingDim: number): Promise<Map<string, Float32Array>>;
701
+ /**
702
+ * Predict impact of changes using GNN
703
+ */
704
+ predictImpact(graph: DependencyGraph, changedNodes: string[], depth: number): Promise<Map<string, number>>;
705
+ /**
706
+ * Detect communities in code graph
707
+ */
708
+ detectCommunities(graph: DependencyGraph): Promise<Map<string, number>>;
709
+ /**
710
+ * Find similar code patterns
711
+ */
712
+ findSimilarPatterns(graph: DependencyGraph, patternGraph: DependencyGraph, threshold: number): Promise<Array<{
713
+ matchId: string;
714
+ score: number;
715
+ }>>;
716
+ /**
717
+ * Initialize the WASM module
718
+ */
719
+ initialize(): Promise<void>;
720
+ /**
721
+ * Check if initialized
722
+ */
723
+ isInitialized(): boolean;
724
+ }
725
+ /**
726
+ * MinCut Bridge for module splitting
727
+ */
728
+ export interface IMinCutBridge {
729
+ /**
730
+ * Find optimal module boundaries using MinCut
731
+ */
732
+ findOptimalCuts(graph: DependencyGraph, numModules: number, constraints: SplitConstraints): Promise<Map<string, number>>;
733
+ /**
734
+ * Calculate cut weight for a given partition
735
+ */
736
+ calculateCutWeight(graph: DependencyGraph, partition: Map<string, number>): Promise<number>;
737
+ /**
738
+ * Find minimum s-t cut
739
+ */
740
+ minSTCut(graph: DependencyGraph, source: string, sink: string): Promise<{
741
+ cutValue: number;
742
+ cutEdges: Array<{
743
+ from: string;
744
+ to: string;
745
+ }>;
746
+ sourceSet: string[];
747
+ sinkSet: string[];
748
+ }>;
749
+ /**
750
+ * Multi-way cut for module splitting
751
+ */
752
+ multiWayCut(graph: DependencyGraph, terminals: string[], weights: Map<string, number>): Promise<{
753
+ cutValue: number;
754
+ partitions: Map<string, number>;
755
+ }>;
756
+ /**
757
+ * Initialize the WASM module
758
+ */
759
+ initialize(): Promise<void>;
760
+ /**
761
+ * Check if initialized
762
+ */
763
+ isInitialized(): boolean;
764
+ }
765
+ /**
766
+ * Plugin configuration
767
+ */
768
+ export interface CodeIntelligenceConfig {
769
+ /** Semantic search settings */
770
+ search: {
771
+ /** Embedding dimension */
772
+ embeddingDimension: number;
773
+ /** Default top-K results */
774
+ defaultTopK: number;
775
+ /** Similarity threshold */
776
+ similarityThreshold: number;
777
+ };
778
+ /** Architecture analysis settings */
779
+ architecture: {
780
+ /** Layer definitions */
781
+ layers?: Record<string, string[]>;
782
+ /** Maximum graph depth */
783
+ maxGraphDepth: number;
784
+ /** Include vendor/node_modules */
785
+ includeVendor: boolean;
786
+ };
787
+ /** Refactoring settings */
788
+ refactoring: {
789
+ /** Default impact depth */
790
+ defaultDepth: number;
791
+ /** Include test files */
792
+ includeTests: boolean;
793
+ };
794
+ /** Security settings */
795
+ security: {
796
+ /** Allowed root paths */
797
+ allowedRoots: string[];
798
+ /** Block sensitive file patterns */
799
+ blockedPatterns: string[];
800
+ /** Mask secrets in output */
801
+ maskSecrets: boolean;
802
+ };
803
+ }
804
+ /**
805
+ * Default configuration
806
+ */
807
+ export declare const DEFAULT_CONFIG: CodeIntelligenceConfig;
808
+ /**
809
+ * Code intelligence plugin error codes
810
+ */
811
+ export declare const CodeIntelligenceErrorCodes: {
812
+ readonly PATH_TRAVERSAL: "CODE_PATH_TRAVERSAL";
813
+ readonly SENSITIVE_FILE: "CODE_SENSITIVE_FILE";
814
+ readonly GRAPH_TOO_LARGE: "CODE_GRAPH_TOO_LARGE";
815
+ readonly ANALYSIS_FAILED: "CODE_ANALYSIS_FAILED";
816
+ readonly PARSER_ERROR: "CODE_PARSER_ERROR";
817
+ readonly WASM_NOT_INITIALIZED: "CODE_WASM_NOT_INITIALIZED";
818
+ readonly LANGUAGE_NOT_SUPPORTED: "CODE_LANGUAGE_NOT_SUPPORTED";
819
+ readonly GIT_ERROR: "CODE_GIT_ERROR";
820
+ };
821
+ export type CodeIntelligenceErrorCode = (typeof CodeIntelligenceErrorCodes)[keyof typeof CodeIntelligenceErrorCodes];
822
+ /**
823
+ * Code intelligence plugin error
824
+ */
825
+ export declare class CodeIntelligenceError extends Error {
826
+ readonly code: CodeIntelligenceErrorCode;
827
+ readonly details?: Record<string, unknown>;
828
+ constructor(code: CodeIntelligenceErrorCode, message: string, details?: Record<string, unknown>);
829
+ }
830
+ /**
831
+ * Secret patterns for masking
832
+ */
833
+ export declare const SECRET_PATTERNS: RegExp[];
834
+ /**
835
+ * Mask secrets in code snippet
836
+ */
837
+ export declare function maskSecrets(code: string): string;
838
+ //# sourceMappingURL=types.d.ts.map