@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.
- package/README.md +381 -0
- package/dist/bridges/gnn-bridge.d.ts +96 -0
- package/dist/bridges/gnn-bridge.d.ts.map +1 -0
- package/dist/bridges/gnn-bridge.js +527 -0
- package/dist/bridges/gnn-bridge.js.map +1 -0
- package/dist/bridges/index.d.ts +8 -0
- package/dist/bridges/index.d.ts.map +1 -0
- package/dist/bridges/index.js +8 -0
- package/dist/bridges/index.js.map +1 -0
- package/dist/bridges/mincut-bridge.d.ts +81 -0
- package/dist/bridges/mincut-bridge.d.ts.map +1 -0
- package/dist/bridges/mincut-bridge.js +481 -0
- package/dist/bridges/mincut-bridge.js.map +1 -0
- package/dist/index.d.ts +113 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +156 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-tools.d.ts +98 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +794 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/types.d.ts +838 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +268 -0
- package/dist/types.js.map +1 -0
- package/package.json +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
# @claude-flow/plugin-code-intelligence
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@claude-flow/plugin-code-intelligence)
|
|
4
|
+
[](https://www.npmjs.com/package/@claude-flow/plugin-code-intelligence)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
A comprehensive code intelligence plugin combining graph neural networks for code structure analysis with ultra-fast vector search for semantic code similarity. The plugin enables dead code detection, API surface analysis, refactoring impact prediction, and architectural drift monitoring while integrating seamlessly with existing IDE workflows.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Semantic Code Search**: Find semantically similar code across the codebase using natural language or code snippets
|
|
12
|
+
- **Architecture Analysis**: Analyze dependency graphs, detect layer violations, circular dependencies, and architectural drift
|
|
13
|
+
- **Refactoring Impact Prediction**: Predict the impact of proposed code changes using GNN analysis
|
|
14
|
+
- **Module Splitting**: Suggest optimal module boundaries using MinCut algorithms
|
|
15
|
+
- **Pattern Learning**: Learn recurring patterns from code changes using SONA (Self-Optimizing Neural Architecture)
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
### npm
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @claude-flow/plugin-code-intelligence
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### CLI
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx claude-flow plugins install --name @claude-flow/plugin-code-intelligence
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { CodeIntelligencePlugin } from '@claude-flow/plugin-code-intelligence';
|
|
35
|
+
|
|
36
|
+
// Initialize the plugin
|
|
37
|
+
const codeIntel = new CodeIntelligencePlugin({
|
|
38
|
+
indexPath: './data/code-index',
|
|
39
|
+
repoPath: './',
|
|
40
|
+
languages: ['typescript', 'javascript']
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Semantic code search
|
|
44
|
+
const results = await codeIntel.semanticSearch({
|
|
45
|
+
query: 'function that validates user email',
|
|
46
|
+
scope: { paths: ['src/'], excludeTests: true },
|
|
47
|
+
searchType: 'semantic',
|
|
48
|
+
topK: 10
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Analyze architecture
|
|
52
|
+
const architecture = await codeIntel.architectureAnalyze({
|
|
53
|
+
rootPath: './src',
|
|
54
|
+
analysis: ['dependency_graph', 'circular_deps', 'dead_code'],
|
|
55
|
+
outputFormat: 'mermaid'
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Predict refactoring impact
|
|
59
|
+
const impact = await codeIntel.refactorImpact({
|
|
60
|
+
changes: [
|
|
61
|
+
{ file: 'src/utils/auth.ts', type: 'rename', details: { newName: 'authentication.ts' } }
|
|
62
|
+
],
|
|
63
|
+
depth: 3,
|
|
64
|
+
includeTests: true
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## MCP Tools
|
|
69
|
+
|
|
70
|
+
### 1. `code/semantic-search`
|
|
71
|
+
|
|
72
|
+
Find semantically similar code across the codebase.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
const result = await mcp.invoke('code/semantic-search', {
|
|
76
|
+
query: 'handle authentication token refresh',
|
|
77
|
+
scope: {
|
|
78
|
+
paths: ['src/'],
|
|
79
|
+
languages: ['typescript'],
|
|
80
|
+
excludeTests: false
|
|
81
|
+
},
|
|
82
|
+
searchType: 'semantic',
|
|
83
|
+
topK: 10
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Returns:
|
|
87
|
+
// {
|
|
88
|
+
// results: [
|
|
89
|
+
// {
|
|
90
|
+
// file: 'src/auth/tokenManager.ts',
|
|
91
|
+
// function: 'refreshAccessToken',
|
|
92
|
+
// snippet: 'async function refreshAccessToken(refreshToken: string)...',
|
|
93
|
+
// similarity: 0.94,
|
|
94
|
+
// lineRange: [45, 72]
|
|
95
|
+
// },
|
|
96
|
+
// ...
|
|
97
|
+
// ]
|
|
98
|
+
// }
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 2. `code/architecture-analyze`
|
|
102
|
+
|
|
103
|
+
Analyze codebase architecture using graph algorithms.
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
const result = await mcp.invoke('code/architecture-analyze', {
|
|
107
|
+
rootPath: './src',
|
|
108
|
+
analysis: [
|
|
109
|
+
'dependency_graph',
|
|
110
|
+
'layer_violations',
|
|
111
|
+
'circular_deps',
|
|
112
|
+
'component_coupling',
|
|
113
|
+
'dead_code'
|
|
114
|
+
],
|
|
115
|
+
baseline: 'main', // Git ref for drift comparison
|
|
116
|
+
outputFormat: 'mermaid'
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Returns:
|
|
120
|
+
// {
|
|
121
|
+
// dependencyGraph: '...mermaid diagram...',
|
|
122
|
+
// layerViolations: [
|
|
123
|
+
// { from: 'presentation/UserForm', to: 'data/UserRepository', rule: 'no-direct-data-access' }
|
|
124
|
+
// ],
|
|
125
|
+
// circularDeps: [
|
|
126
|
+
// ['moduleA', 'moduleB', 'moduleC', 'moduleA']
|
|
127
|
+
// ],
|
|
128
|
+
// deadCode: [
|
|
129
|
+
// { file: 'src/utils/legacy.ts', reason: 'no-references', confidence: 0.95 }
|
|
130
|
+
// ],
|
|
131
|
+
// architecturalDrift: {
|
|
132
|
+
// newDependencies: 5,
|
|
133
|
+
// removedDependencies: 2,
|
|
134
|
+
// couplingChange: +0.03
|
|
135
|
+
// }
|
|
136
|
+
// }
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 3. `code/refactor-impact`
|
|
140
|
+
|
|
141
|
+
Predict impact of proposed refactoring.
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
const result = await mcp.invoke('code/refactor-impact', {
|
|
145
|
+
changes: [
|
|
146
|
+
{ file: 'src/services/UserService.ts', type: 'extract', details: { method: 'validateUser' } },
|
|
147
|
+
{ file: 'src/models/User.ts', type: 'rename', details: { property: 'name', to: 'fullName' } }
|
|
148
|
+
],
|
|
149
|
+
depth: 3,
|
|
150
|
+
includeTests: true
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Returns:
|
|
154
|
+
// {
|
|
155
|
+
// impactedFiles: [
|
|
156
|
+
// { file: 'src/controllers/AuthController.ts', changes: ['import path', 'method call'] },
|
|
157
|
+
// { file: 'src/services/AdminService.ts', changes: ['method call'] },
|
|
158
|
+
// { file: 'tests/UserService.test.ts', changes: ['test assertions'] }
|
|
159
|
+
// ],
|
|
160
|
+
// totalFilesAffected: 12,
|
|
161
|
+
// riskScore: 0.35,
|
|
162
|
+
// breakingChanges: [
|
|
163
|
+
// { type: 'property-rename', description: 'User.name -> User.fullName', usages: 45 }
|
|
164
|
+
// ],
|
|
165
|
+
// suggestedMigrationSteps: [...]
|
|
166
|
+
// }
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 4. `code/split-suggest`
|
|
170
|
+
|
|
171
|
+
Suggest optimal module boundaries using MinCut.
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
const result = await mcp.invoke('code/split-suggest', {
|
|
175
|
+
targetPath: './src/monolith',
|
|
176
|
+
strategy: 'minimize_coupling',
|
|
177
|
+
constraints: {
|
|
178
|
+
maxModuleSize: 5000, // LOC
|
|
179
|
+
minModuleSize: 500,
|
|
180
|
+
preserveBoundaries: ['src/monolith/core']
|
|
181
|
+
},
|
|
182
|
+
targetModules: 4
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// Returns:
|
|
186
|
+
// {
|
|
187
|
+
// suggestedModules: [
|
|
188
|
+
// {
|
|
189
|
+
// name: 'user-management',
|
|
190
|
+
// files: ['User.ts', 'UserService.ts', 'UserRepository.ts'],
|
|
191
|
+
// loc: 2340,
|
|
192
|
+
// externalDependencies: 3
|
|
193
|
+
// },
|
|
194
|
+
// {
|
|
195
|
+
// name: 'order-processing',
|
|
196
|
+
// files: ['Order.ts', 'OrderService.ts', 'PaymentHandler.ts'],
|
|
197
|
+
// loc: 3120,
|
|
198
|
+
// externalDependencies: 5
|
|
199
|
+
// },
|
|
200
|
+
// ...
|
|
201
|
+
// ],
|
|
202
|
+
// couplingReduction: '45%',
|
|
203
|
+
// migrationComplexity: 'medium'
|
|
204
|
+
// }
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 5. `code/learn-patterns`
|
|
208
|
+
|
|
209
|
+
Learn code patterns from repository history.
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
const result = await mcp.invoke('code/learn-patterns', {
|
|
213
|
+
scope: {
|
|
214
|
+
gitRange: 'HEAD~100..HEAD',
|
|
215
|
+
authors: [], // All authors
|
|
216
|
+
paths: ['src/']
|
|
217
|
+
},
|
|
218
|
+
patternTypes: ['bug_patterns', 'refactor_patterns'],
|
|
219
|
+
minOccurrences: 3
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// Returns:
|
|
223
|
+
// {
|
|
224
|
+
// patterns: [
|
|
225
|
+
// {
|
|
226
|
+
// type: 'bug_pattern',
|
|
227
|
+
// name: 'null-check-before-access',
|
|
228
|
+
// occurrences: 12,
|
|
229
|
+
// description: 'Adding null checks before property access',
|
|
230
|
+
// example: { before: 'user.name', after: 'user?.name' }
|
|
231
|
+
// },
|
|
232
|
+
// {
|
|
233
|
+
// type: 'refactor_pattern',
|
|
234
|
+
// name: 'async-await-migration',
|
|
235
|
+
// occurrences: 8,
|
|
236
|
+
// description: 'Converting Promise.then chains to async/await'
|
|
237
|
+
// }
|
|
238
|
+
// ]
|
|
239
|
+
// }
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Configuration Options
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
interface CodeIntelligenceConfig {
|
|
246
|
+
// Indexing
|
|
247
|
+
indexPath: string; // Path to code index storage
|
|
248
|
+
repoPath: string; // Repository root path
|
|
249
|
+
|
|
250
|
+
// Language support
|
|
251
|
+
languages: string[]; // Languages to index
|
|
252
|
+
excludePaths: string[]; // Paths to exclude
|
|
253
|
+
|
|
254
|
+
// Performance
|
|
255
|
+
maxMemoryMB: number; // WASM memory limit (default: 1024)
|
|
256
|
+
maxCpuTimeSeconds: number; // Operation timeout (default: 300)
|
|
257
|
+
incrementalIndexing: boolean; // Enable incremental updates (default: true)
|
|
258
|
+
|
|
259
|
+
// Security
|
|
260
|
+
blockSensitiveFiles: boolean; // Block .env, credentials, etc. (default: true)
|
|
261
|
+
maskSecrets: boolean; // Mask detected secrets in results (default: true)
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Supported Languages
|
|
266
|
+
|
|
267
|
+
| Tier | Languages | Support Level |
|
|
268
|
+
|------|-----------|---------------|
|
|
269
|
+
| Tier 1 (Full) | TypeScript, JavaScript, React, Vue, Angular | Complete AST analysis |
|
|
270
|
+
| Tier 2 (Partial) | Python, Java, Ruby, PHP | Core analysis features |
|
|
271
|
+
| Tier 3 (Basic) | Rust, Go, C++, Swift, Kotlin | Dependency and search |
|
|
272
|
+
|
|
273
|
+
## Security Considerations
|
|
274
|
+
|
|
275
|
+
### Path Traversal Prevention
|
|
276
|
+
|
|
277
|
+
All file paths are validated to prevent directory traversal:
|
|
278
|
+
- Paths normalized and resolved against allowed root
|
|
279
|
+
- Blocked patterns: `.env`, `.git/config`, credentials, secrets, private keys
|
|
280
|
+
|
|
281
|
+
### Secret Detection and Masking
|
|
282
|
+
|
|
283
|
+
Secrets are automatically detected and masked in search results:
|
|
284
|
+
- API keys and tokens
|
|
285
|
+
- Private keys and certificates
|
|
286
|
+
- Password strings
|
|
287
|
+
- Cloud provider credentials (AWS, GCP, Azure)
|
|
288
|
+
|
|
289
|
+
### WASM Security Constraints
|
|
290
|
+
|
|
291
|
+
| Constraint | Value | Rationale |
|
|
292
|
+
|------------|-------|-----------|
|
|
293
|
+
| Memory Limit | 1GB max | Handle large codebases |
|
|
294
|
+
| CPU Time Limit | 300 seconds | Allow full repo analysis |
|
|
295
|
+
| No Network Access | Enforced | Prevent code exfiltration |
|
|
296
|
+
| No Shell Execution | Enforced | Prevent command injection |
|
|
297
|
+
| Read-Only Mode | Enforced | Prevent code modification |
|
|
298
|
+
|
|
299
|
+
### Input Validation
|
|
300
|
+
|
|
301
|
+
All inputs are validated using Zod schemas:
|
|
302
|
+
```typescript
|
|
303
|
+
// All inputs validated:
|
|
304
|
+
- Query strings: 1-5000 characters
|
|
305
|
+
- File paths: Maximum 500 characters, max 100 paths per request
|
|
306
|
+
- Languages: Maximum 20 languages per request
|
|
307
|
+
- topK: 1-1000 results
|
|
308
|
+
- Git refs: Validated against safe patterns (no shell metacharacters)
|
|
309
|
+
- Module size limits: 100-100000 LOC
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Rate Limiting
|
|
313
|
+
|
|
314
|
+
```typescript
|
|
315
|
+
const rateLimits = {
|
|
316
|
+
'code/semantic-search': { requestsPerMinute: 60, maxConcurrent: 5 },
|
|
317
|
+
'code/architecture-analyze': { requestsPerMinute: 10, maxConcurrent: 2 },
|
|
318
|
+
'code/refactor-impact': { requestsPerMinute: 20, maxConcurrent: 3 },
|
|
319
|
+
'code/split-suggest': { requestsPerMinute: 5, maxConcurrent: 1 },
|
|
320
|
+
'code/learn-patterns': { requestsPerMinute: 5, maxConcurrent: 1 }
|
|
321
|
+
};
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## Performance
|
|
325
|
+
|
|
326
|
+
| Metric | Target |
|
|
327
|
+
|--------|--------|
|
|
328
|
+
| Semantic code search | <100ms for 1M LOC |
|
|
329
|
+
| Architecture analysis | <10s for 100K LOC |
|
|
330
|
+
| Refactor impact | <5s for single change |
|
|
331
|
+
| Module splitting | <30s for 50K LOC |
|
|
332
|
+
| Pattern learning | <2min for 1000 commits |
|
|
333
|
+
|
|
334
|
+
## IDE Integration
|
|
335
|
+
|
|
336
|
+
- **VS Code Extension**: Real-time analysis and suggestions
|
|
337
|
+
- **JetBrains Plugin**: IntelliJ, WebStorm, PyCharm support
|
|
338
|
+
- **CLI**: CI/CD pipeline integration
|
|
339
|
+
- **MCP**: Direct Claude Code integration
|
|
340
|
+
|
|
341
|
+
## Dependencies
|
|
342
|
+
|
|
343
|
+
- `micro-hnsw-wasm`: Semantic code search and clone detection (150x faster)
|
|
344
|
+
- `ruvector-gnn-wasm`: Code dependency graphs, call graphs, and control flow analysis
|
|
345
|
+
- `ruvector-mincut-wasm`: Module boundary detection and optimal code splitting
|
|
346
|
+
- `sona`: Self-optimizing learning from code review patterns
|
|
347
|
+
- `ruvector-dag-wasm`: Build dependency analysis and incremental compilation
|
|
348
|
+
- `@babel/parser`: JavaScript/TypeScript AST parsing
|
|
349
|
+
- `typescript`: TypeScript compiler API
|
|
350
|
+
|
|
351
|
+
## Related Plugins
|
|
352
|
+
|
|
353
|
+
| Plugin | Description | Use Case |
|
|
354
|
+
|--------|-------------|----------|
|
|
355
|
+
| [@claude-flow/plugin-test-intelligence](../test-intelligence) | Test optimization | Predictive test selection based on code changes |
|
|
356
|
+
| [@claude-flow/plugin-perf-optimizer](../perf-optimizer) | Performance optimization | Code performance bottleneck detection |
|
|
357
|
+
| [@claude-flow/plugin-legal-contracts](../legal-contracts) | Contract analysis | Software licensing compliance |
|
|
358
|
+
|
|
359
|
+
## License
|
|
360
|
+
|
|
361
|
+
MIT License
|
|
362
|
+
|
|
363
|
+
Copyright (c) 2026 Claude Flow
|
|
364
|
+
|
|
365
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
366
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
367
|
+
in the Software without restriction, including without limitation the rights
|
|
368
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
369
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
370
|
+
furnished to do so, subject to the following conditions:
|
|
371
|
+
|
|
372
|
+
The above copyright notice and this permission notice shall be included in all
|
|
373
|
+
copies or substantial portions of the Software.
|
|
374
|
+
|
|
375
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
376
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
377
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
378
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
379
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
380
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
381
|
+
SOFTWARE.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GNN Bridge for Code Graph Analysis
|
|
3
|
+
*
|
|
4
|
+
* Provides graph neural network operations for code structure analysis
|
|
5
|
+
* using ruvector-gnn-wasm for high-performance graph algorithms.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Code graph construction
|
|
9
|
+
* - Node embedding computation
|
|
10
|
+
* - Impact prediction using graph propagation
|
|
11
|
+
* - Community detection for module discovery
|
|
12
|
+
* - Pattern matching in code graphs
|
|
13
|
+
*
|
|
14
|
+
* Based on ADR-035: Advanced Code Intelligence Plugin
|
|
15
|
+
*
|
|
16
|
+
* @module v3/plugins/code-intelligence/bridges/gnn-bridge
|
|
17
|
+
*/
|
|
18
|
+
import type { IGNNBridge, DependencyGraph } from '../types.js';
|
|
19
|
+
/**
|
|
20
|
+
* GNN Bridge Implementation
|
|
21
|
+
*/
|
|
22
|
+
export declare class GNNBridge implements IGNNBridge {
|
|
23
|
+
private wasmModule;
|
|
24
|
+
private initialized;
|
|
25
|
+
private readonly embeddingDim;
|
|
26
|
+
constructor(embeddingDim?: number);
|
|
27
|
+
/**
|
|
28
|
+
* Initialize the WASM module
|
|
29
|
+
*/
|
|
30
|
+
initialize(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Check if initialized
|
|
33
|
+
*/
|
|
34
|
+
isInitialized(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Build code graph from files
|
|
37
|
+
*/
|
|
38
|
+
buildCodeGraph(files: string[], _includeCallGraph: boolean): Promise<DependencyGraph>;
|
|
39
|
+
/**
|
|
40
|
+
* Compute node embeddings using GNN
|
|
41
|
+
*/
|
|
42
|
+
computeNodeEmbeddings(graph: DependencyGraph, embeddingDim: number): Promise<Map<string, Float32Array>>;
|
|
43
|
+
/**
|
|
44
|
+
* Predict impact of changes using GNN
|
|
45
|
+
*/
|
|
46
|
+
predictImpact(graph: DependencyGraph, changedNodes: string[], depth: number): Promise<Map<string, number>>;
|
|
47
|
+
/**
|
|
48
|
+
* Detect communities in code graph
|
|
49
|
+
*/
|
|
50
|
+
detectCommunities(graph: DependencyGraph): Promise<Map<string, number>>;
|
|
51
|
+
/**
|
|
52
|
+
* Find similar code patterns
|
|
53
|
+
*/
|
|
54
|
+
findSimilarPatterns(graph: DependencyGraph, patternGraph: DependencyGraph, threshold: number): Promise<Array<{
|
|
55
|
+
matchId: string;
|
|
56
|
+
score: number;
|
|
57
|
+
}>>;
|
|
58
|
+
/**
|
|
59
|
+
* Load WASM module dynamically
|
|
60
|
+
*/
|
|
61
|
+
private loadWasmModule;
|
|
62
|
+
/**
|
|
63
|
+
* Detect language from file extension
|
|
64
|
+
*/
|
|
65
|
+
private detectLanguage;
|
|
66
|
+
/**
|
|
67
|
+
* Extract imports from file (simplified)
|
|
68
|
+
*/
|
|
69
|
+
private extractImports;
|
|
70
|
+
/**
|
|
71
|
+
* Calculate max depth of dependency graph
|
|
72
|
+
*/
|
|
73
|
+
private calculateMaxDepth;
|
|
74
|
+
/**
|
|
75
|
+
* Encode node type as number
|
|
76
|
+
*/
|
|
77
|
+
private encodeNodeType;
|
|
78
|
+
/**
|
|
79
|
+
* Encode language as number
|
|
80
|
+
*/
|
|
81
|
+
private encodeLanguage;
|
|
82
|
+
/**
|
|
83
|
+
* Compute embeddings using JS (fallback)
|
|
84
|
+
*/
|
|
85
|
+
private computeEmbeddingsJS;
|
|
86
|
+
/**
|
|
87
|
+
* Compute cosine similarity
|
|
88
|
+
*/
|
|
89
|
+
private cosineSimilarity;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create and export default bridge instance
|
|
93
|
+
*/
|
|
94
|
+
export declare function createGNNBridge(embeddingDim?: number): IGNNBridge;
|
|
95
|
+
export default GNNBridge;
|
|
96
|
+
//# sourceMappingURL=gnn-bridge.d.ts.map
|
|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