grok-cli-hurry-mode 1.0.1 → 1.0.3
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 +60 -12
- package/dist/agent/grok-agent.d.ts +5 -0
- package/dist/agent/grok-agent.js +17 -1
- package/dist/agent/grok-agent.js.map +1 -1
- package/dist/grok/tools.js +257 -0
- package/dist/grok/tools.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/intelligence/ast-parser.d.ts +141 -0
- package/dist/tools/intelligence/ast-parser.js +619 -0
- package/dist/tools/intelligence/ast-parser.js.map +1 -0
- package/dist/tools/intelligence/code-context.d.ts +181 -0
- package/dist/tools/intelligence/code-context.js +573 -0
- package/dist/tools/intelligence/code-context.js.map +1 -0
- package/dist/tools/intelligence/dependency-analyzer.d.ts +124 -0
- package/dist/tools/intelligence/dependency-analyzer.js +469 -0
- package/dist/tools/intelligence/dependency-analyzer.js.map +1 -0
- package/dist/tools/intelligence/index.d.ts +10 -0
- package/dist/tools/intelligence/index.js +6 -0
- package/dist/tools/intelligence/index.js.map +1 -0
- package/dist/tools/intelligence/refactoring-assistant.d.ts +196 -0
- package/dist/tools/intelligence/refactoring-assistant.js +612 -0
- package/dist/tools/intelligence/refactoring-assistant.js.map +1 -0
- package/dist/tools/intelligence/symbol-search.d.ts +121 -0
- package/dist/tools/intelligence/symbol-search.js +336 -0
- package/dist/tools/intelligence/symbol-search.js.map +1 -0
- package/package.json +17 -3
@@ -0,0 +1,124 @@
|
|
1
|
+
import { ToolResult } from "../../types/index.js";
|
2
|
+
import { ImportInfo, ExportInfo } from "./ast-parser.js";
|
3
|
+
export interface DependencyNode {
|
4
|
+
filePath: string;
|
5
|
+
absolutePath: string;
|
6
|
+
imports: ImportInfo[];
|
7
|
+
exports: ExportInfo[];
|
8
|
+
dependencies: string[];
|
9
|
+
dependents: string[];
|
10
|
+
isEntryPoint: boolean;
|
11
|
+
isLeaf: boolean;
|
12
|
+
circularDependencies: string[][];
|
13
|
+
}
|
14
|
+
export interface DependencyGraph {
|
15
|
+
nodes: Map<string, DependencyNode>;
|
16
|
+
entryPoints: string[];
|
17
|
+
leafNodes: string[];
|
18
|
+
circularDependencies: CircularDependency[];
|
19
|
+
unreachableFiles: string[];
|
20
|
+
statistics: DependencyStatistics;
|
21
|
+
}
|
22
|
+
export interface CircularDependency {
|
23
|
+
cycle: string[];
|
24
|
+
severity: 'warning' | 'error';
|
25
|
+
type: 'direct' | 'indirect';
|
26
|
+
}
|
27
|
+
export interface DependencyStatistics {
|
28
|
+
totalFiles: number;
|
29
|
+
totalDependencies: number;
|
30
|
+
averageDependencies: number;
|
31
|
+
maxDependencyDepth: number;
|
32
|
+
circularDependencyCount: number;
|
33
|
+
unreachableFileCount: number;
|
34
|
+
}
|
35
|
+
export interface ModuleAnalysis {
|
36
|
+
filePath: string;
|
37
|
+
externalDependencies: string[];
|
38
|
+
internalDependencies: string[];
|
39
|
+
circularImports: string[];
|
40
|
+
unusedImports: string[];
|
41
|
+
missingDependencies: string[];
|
42
|
+
duplicateImports: string[];
|
43
|
+
}
|
44
|
+
export declare class DependencyAnalyzerTool {
|
45
|
+
name: string;
|
46
|
+
description: string;
|
47
|
+
private astParser;
|
48
|
+
constructor();
|
49
|
+
execute(args: any): Promise<ToolResult>;
|
50
|
+
private findSourceFiles;
|
51
|
+
private buildDependencyGraph;
|
52
|
+
private resolveImportPaths;
|
53
|
+
private resolveRelativeImport;
|
54
|
+
private resolveAbsoluteImport;
|
55
|
+
private detectCircularDependencies;
|
56
|
+
private findUnreachableFiles;
|
57
|
+
private inferEntryPoints;
|
58
|
+
private calculateStatistics;
|
59
|
+
private calculateNodeDepth;
|
60
|
+
private serializeDependencyGraph;
|
61
|
+
private generateEdges;
|
62
|
+
analyzeModule(filePath: string): Promise<ModuleAnalysis>;
|
63
|
+
getSchema(): {
|
64
|
+
type: string;
|
65
|
+
properties: {
|
66
|
+
rootPath: {
|
67
|
+
type: string;
|
68
|
+
description: string;
|
69
|
+
default: string;
|
70
|
+
};
|
71
|
+
filePatterns: {
|
72
|
+
type: string;
|
73
|
+
items: {
|
74
|
+
type: string;
|
75
|
+
};
|
76
|
+
description: string;
|
77
|
+
default: string[];
|
78
|
+
};
|
79
|
+
excludePatterns: {
|
80
|
+
type: string;
|
81
|
+
items: {
|
82
|
+
type: string;
|
83
|
+
};
|
84
|
+
description: string;
|
85
|
+
default: string[];
|
86
|
+
};
|
87
|
+
includeExternals: {
|
88
|
+
type: string;
|
89
|
+
description: string;
|
90
|
+
default: boolean;
|
91
|
+
};
|
92
|
+
detectCircular: {
|
93
|
+
type: string;
|
94
|
+
description: string;
|
95
|
+
default: boolean;
|
96
|
+
};
|
97
|
+
findUnreachable: {
|
98
|
+
type: string;
|
99
|
+
description: string;
|
100
|
+
default: boolean;
|
101
|
+
};
|
102
|
+
generateGraph: {
|
103
|
+
type: string;
|
104
|
+
description: string;
|
105
|
+
default: boolean;
|
106
|
+
};
|
107
|
+
entryPoints: {
|
108
|
+
type: string;
|
109
|
+
items: {
|
110
|
+
type: string;
|
111
|
+
};
|
112
|
+
description: string;
|
113
|
+
default: never[];
|
114
|
+
};
|
115
|
+
maxDepth: {
|
116
|
+
type: string;
|
117
|
+
description: string;
|
118
|
+
default: number;
|
119
|
+
minimum: number;
|
120
|
+
maximum: number;
|
121
|
+
};
|
122
|
+
};
|
123
|
+
};
|
124
|
+
}
|
@@ -0,0 +1,469 @@
|
|
1
|
+
import { ASTParserTool } from "./ast-parser.js";
|
2
|
+
import fs from "fs-extra";
|
3
|
+
import path from "path";
|
4
|
+
import { glob } from "glob";
|
5
|
+
export class DependencyAnalyzerTool {
|
6
|
+
constructor() {
|
7
|
+
this.name = "dependency_analyzer";
|
8
|
+
this.description = "Analyze import/export dependencies, detect circular dependencies, and generate dependency graphs";
|
9
|
+
this.astParser = new ASTParserTool();
|
10
|
+
}
|
11
|
+
async execute(args) {
|
12
|
+
try {
|
13
|
+
const { rootPath = process.cwd(), filePatterns = ['**/*.{ts,tsx,js,jsx}'], excludePatterns = ['**/node_modules/**', '**/dist/**', '**/.git/**'], includeExternals = false, detectCircular = true, findUnreachable = true, generateGraph = false, entryPoints = [], maxDepth = 50 } = args;
|
14
|
+
if (!await fs.pathExists(rootPath)) {
|
15
|
+
throw new Error(`Root path does not exist: ${rootPath}`);
|
16
|
+
}
|
17
|
+
// Find all source files
|
18
|
+
const sourceFiles = await this.findSourceFiles(rootPath, filePatterns, excludePatterns);
|
19
|
+
// Build dependency graph
|
20
|
+
const dependencyGraph = await this.buildDependencyGraph(sourceFiles, rootPath, includeExternals, maxDepth);
|
21
|
+
// Detect circular dependencies
|
22
|
+
if (detectCircular) {
|
23
|
+
dependencyGraph.circularDependencies = this.detectCircularDependencies(dependencyGraph);
|
24
|
+
}
|
25
|
+
// Find unreachable files
|
26
|
+
if (findUnreachable) {
|
27
|
+
dependencyGraph.unreachableFiles = this.findUnreachableFiles(dependencyGraph, entryPoints.length > 0 ? entryPoints : this.inferEntryPoints(dependencyGraph));
|
28
|
+
}
|
29
|
+
// Calculate statistics
|
30
|
+
dependencyGraph.statistics = this.calculateStatistics(dependencyGraph);
|
31
|
+
// Format response
|
32
|
+
const result = {
|
33
|
+
rootPath,
|
34
|
+
totalFiles: sourceFiles.length,
|
35
|
+
entryPoints: dependencyGraph.entryPoints,
|
36
|
+
leafNodes: dependencyGraph.leafNodes,
|
37
|
+
statistics: dependencyGraph.statistics
|
38
|
+
};
|
39
|
+
if (detectCircular) {
|
40
|
+
result.circularDependencies = dependencyGraph.circularDependencies;
|
41
|
+
}
|
42
|
+
if (findUnreachable) {
|
43
|
+
result.unreachableFiles = dependencyGraph.unreachableFiles;
|
44
|
+
}
|
45
|
+
if (generateGraph) {
|
46
|
+
result.dependencyGraph = this.serializeDependencyGraph(dependencyGraph);
|
47
|
+
}
|
48
|
+
return {
|
49
|
+
success: true,
|
50
|
+
output: JSON.stringify(result, null, 2)
|
51
|
+
};
|
52
|
+
}
|
53
|
+
catch (error) {
|
54
|
+
return {
|
55
|
+
success: false,
|
56
|
+
error: error instanceof Error ? error.message : String(error)
|
57
|
+
};
|
58
|
+
}
|
59
|
+
}
|
60
|
+
async findSourceFiles(rootPath, filePatterns, excludePatterns) {
|
61
|
+
const allFiles = [];
|
62
|
+
for (const pattern of filePatterns) {
|
63
|
+
const files = await glob(pattern, {
|
64
|
+
cwd: rootPath,
|
65
|
+
absolute: true,
|
66
|
+
ignore: excludePatterns
|
67
|
+
});
|
68
|
+
allFiles.push(...files);
|
69
|
+
}
|
70
|
+
return [...new Set(allFiles)]; // Remove duplicates
|
71
|
+
}
|
72
|
+
async buildDependencyGraph(sourceFiles, rootPath, includeExternals, maxDepth) {
|
73
|
+
const graph = {
|
74
|
+
nodes: new Map(),
|
75
|
+
entryPoints: [],
|
76
|
+
leafNodes: [],
|
77
|
+
circularDependencies: [],
|
78
|
+
unreachableFiles: [],
|
79
|
+
statistics: {
|
80
|
+
totalFiles: 0,
|
81
|
+
totalDependencies: 0,
|
82
|
+
averageDependencies: 0,
|
83
|
+
maxDependencyDepth: 0,
|
84
|
+
circularDependencyCount: 0,
|
85
|
+
unreachableFileCount: 0
|
86
|
+
}
|
87
|
+
};
|
88
|
+
// Parse each file and extract imports/exports
|
89
|
+
for (const filePath of sourceFiles) {
|
90
|
+
try {
|
91
|
+
const parseResult = await this.astParser.execute({
|
92
|
+
filePath,
|
93
|
+
includeSymbols: false,
|
94
|
+
includeImports: true,
|
95
|
+
includeTree: false
|
96
|
+
});
|
97
|
+
if (!parseResult.success || !parseResult.output)
|
98
|
+
continue;
|
99
|
+
const parsed = JSON.parse(parseResult.output);
|
100
|
+
if (parsed.success && parsed.result) {
|
101
|
+
const imports = parsed.result.imports || [];
|
102
|
+
const exports = parsed.result.exports || [];
|
103
|
+
// Resolve import paths
|
104
|
+
const dependencies = await this.resolveImportPaths(imports, filePath, rootPath, includeExternals);
|
105
|
+
const node = {
|
106
|
+
filePath: path.relative(rootPath, filePath),
|
107
|
+
absolutePath: filePath,
|
108
|
+
imports,
|
109
|
+
exports,
|
110
|
+
dependencies,
|
111
|
+
dependents: [],
|
112
|
+
isEntryPoint: false,
|
113
|
+
isLeaf: dependencies.length === 0,
|
114
|
+
circularDependencies: []
|
115
|
+
};
|
116
|
+
graph.nodes.set(filePath, node);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
catch (error) {
|
120
|
+
console.warn(`Failed to parse ${filePath}: ${error}`);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
// Build reverse dependencies (dependents)
|
124
|
+
for (const [filePath, node] of graph.nodes) {
|
125
|
+
for (const dependency of node.dependencies) {
|
126
|
+
const depNode = graph.nodes.get(dependency);
|
127
|
+
if (depNode) {
|
128
|
+
depNode.dependents.push(filePath);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
// Identify entry points and leaf nodes
|
133
|
+
for (const [filePath, node] of graph.nodes) {
|
134
|
+
node.isEntryPoint = node.dependents.length === 0;
|
135
|
+
node.isLeaf = node.dependencies.length === 0;
|
136
|
+
if (node.isEntryPoint) {
|
137
|
+
graph.entryPoints.push(filePath);
|
138
|
+
}
|
139
|
+
if (node.isLeaf) {
|
140
|
+
graph.leafNodes.push(filePath);
|
141
|
+
}
|
142
|
+
}
|
143
|
+
return graph;
|
144
|
+
}
|
145
|
+
async resolveImportPaths(imports, currentFile, rootPath, includeExternals) {
|
146
|
+
const dependencies = [];
|
147
|
+
const currentDir = path.dirname(currentFile);
|
148
|
+
for (const importInfo of imports) {
|
149
|
+
let resolvedPath = null;
|
150
|
+
if (importInfo.source.startsWith('.')) {
|
151
|
+
// Relative import
|
152
|
+
resolvedPath = await this.resolveRelativeImport(importInfo.source, currentDir);
|
153
|
+
}
|
154
|
+
else if (importInfo.source.startsWith('/')) {
|
155
|
+
// Absolute import from root
|
156
|
+
resolvedPath = await this.resolveAbsoluteImport(importInfo.source, rootPath);
|
157
|
+
}
|
158
|
+
else if (includeExternals) {
|
159
|
+
// External module
|
160
|
+
dependencies.push(importInfo.source);
|
161
|
+
continue;
|
162
|
+
}
|
163
|
+
else {
|
164
|
+
// Skip external modules if not including them
|
165
|
+
continue;
|
166
|
+
}
|
167
|
+
if (resolvedPath && await fs.pathExists(resolvedPath)) {
|
168
|
+
dependencies.push(resolvedPath);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
return dependencies;
|
172
|
+
}
|
173
|
+
async resolveRelativeImport(importPath, currentDir) {
|
174
|
+
const basePath = path.resolve(currentDir, importPath);
|
175
|
+
// Try different extensions
|
176
|
+
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.json'];
|
177
|
+
for (const ext of extensions) {
|
178
|
+
const fullPath = basePath + ext;
|
179
|
+
if (await fs.pathExists(fullPath)) {
|
180
|
+
return fullPath;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
// Try index files
|
184
|
+
for (const ext of extensions) {
|
185
|
+
const indexPath = path.join(basePath, `index${ext}`);
|
186
|
+
if (await fs.pathExists(indexPath)) {
|
187
|
+
return indexPath;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
return null;
|
191
|
+
}
|
192
|
+
async resolveAbsoluteImport(importPath, rootPath) {
|
193
|
+
const fullPath = path.join(rootPath, importPath.slice(1)); // Remove leading slash
|
194
|
+
return await this.resolveRelativeImport('.', path.dirname(fullPath));
|
195
|
+
}
|
196
|
+
detectCircularDependencies(graph) {
|
197
|
+
const circularDeps = [];
|
198
|
+
const visited = new Set();
|
199
|
+
const visiting = new Set();
|
200
|
+
const dfs = (filePath, path) => {
|
201
|
+
if (visiting.has(filePath)) {
|
202
|
+
// Found a cycle
|
203
|
+
const cycleStart = path.indexOf(filePath);
|
204
|
+
const cycle = path.slice(cycleStart).concat([filePath]);
|
205
|
+
circularDeps.push({
|
206
|
+
cycle: cycle.map(fp => graph.nodes.get(fp)?.filePath || fp),
|
207
|
+
severity: cycle.length <= 2 ? 'error' : 'warning',
|
208
|
+
type: cycle.length <= 2 ? 'direct' : 'indirect'
|
209
|
+
});
|
210
|
+
return;
|
211
|
+
}
|
212
|
+
if (visited.has(filePath)) {
|
213
|
+
return;
|
214
|
+
}
|
215
|
+
visiting.add(filePath);
|
216
|
+
const node = graph.nodes.get(filePath);
|
217
|
+
if (node) {
|
218
|
+
for (const dependency of node.dependencies) {
|
219
|
+
if (graph.nodes.has(dependency)) {
|
220
|
+
dfs(dependency, [...path, filePath]);
|
221
|
+
}
|
222
|
+
}
|
223
|
+
}
|
224
|
+
visiting.delete(filePath);
|
225
|
+
visited.add(filePath);
|
226
|
+
};
|
227
|
+
for (const filePath of graph.nodes.keys()) {
|
228
|
+
if (!visited.has(filePath)) {
|
229
|
+
dfs(filePath, []);
|
230
|
+
}
|
231
|
+
}
|
232
|
+
return circularDeps;
|
233
|
+
}
|
234
|
+
findUnreachableFiles(graph, entryPoints) {
|
235
|
+
const reachable = new Set();
|
236
|
+
const dfs = (filePath) => {
|
237
|
+
if (reachable.has(filePath)) {
|
238
|
+
return;
|
239
|
+
}
|
240
|
+
reachable.add(filePath);
|
241
|
+
const node = graph.nodes.get(filePath);
|
242
|
+
if (node) {
|
243
|
+
for (const dependency of node.dependencies) {
|
244
|
+
if (graph.nodes.has(dependency)) {
|
245
|
+
dfs(dependency);
|
246
|
+
}
|
247
|
+
}
|
248
|
+
}
|
249
|
+
};
|
250
|
+
// Start DFS from entry points
|
251
|
+
for (const entryPoint of entryPoints) {
|
252
|
+
if (graph.nodes.has(entryPoint)) {
|
253
|
+
dfs(entryPoint);
|
254
|
+
}
|
255
|
+
}
|
256
|
+
// Find unreachable files
|
257
|
+
const unreachable = [];
|
258
|
+
for (const filePath of graph.nodes.keys()) {
|
259
|
+
if (!reachable.has(filePath)) {
|
260
|
+
const node = graph.nodes.get(filePath);
|
261
|
+
unreachable.push(node?.filePath || filePath);
|
262
|
+
}
|
263
|
+
}
|
264
|
+
return unreachable;
|
265
|
+
}
|
266
|
+
inferEntryPoints(graph) {
|
267
|
+
// If no explicit entry points, use files with no dependents
|
268
|
+
if (graph.entryPoints.length > 0) {
|
269
|
+
return graph.entryPoints;
|
270
|
+
}
|
271
|
+
// Look for common entry point patterns
|
272
|
+
const commonEntryPatterns = [
|
273
|
+
/index\.(ts|js|tsx|jsx)$/,
|
274
|
+
/main\.(ts|js|tsx|jsx)$/,
|
275
|
+
/app\.(ts|js|tsx|jsx)$/,
|
276
|
+
/server\.(ts|js|tsx|jsx)$/
|
277
|
+
];
|
278
|
+
const entryPoints = [];
|
279
|
+
for (const [filePath, node] of graph.nodes) {
|
280
|
+
const fileName = path.basename(filePath);
|
281
|
+
if (node.dependents.length === 0 ||
|
282
|
+
commonEntryPatterns.some(pattern => pattern.test(fileName))) {
|
283
|
+
entryPoints.push(filePath);
|
284
|
+
}
|
285
|
+
}
|
286
|
+
return entryPoints;
|
287
|
+
}
|
288
|
+
calculateStatistics(graph) {
|
289
|
+
const totalFiles = graph.nodes.size;
|
290
|
+
let totalDependencies = 0;
|
291
|
+
let maxDepth = 0;
|
292
|
+
for (const node of graph.nodes.values()) {
|
293
|
+
totalDependencies += node.dependencies.length;
|
294
|
+
// Calculate depth from entry points
|
295
|
+
const depth = this.calculateNodeDepth(node.absolutePath, graph);
|
296
|
+
maxDepth = Math.max(maxDepth, depth);
|
297
|
+
}
|
298
|
+
return {
|
299
|
+
totalFiles,
|
300
|
+
totalDependencies,
|
301
|
+
averageDependencies: totalFiles > 0 ? totalDependencies / totalFiles : 0,
|
302
|
+
maxDependencyDepth: maxDepth,
|
303
|
+
circularDependencyCount: graph.circularDependencies.length,
|
304
|
+
unreachableFileCount: graph.unreachableFiles.length
|
305
|
+
};
|
306
|
+
}
|
307
|
+
calculateNodeDepth(filePath, graph) {
|
308
|
+
const visited = new Set();
|
309
|
+
const dfs = (currentPath, depth) => {
|
310
|
+
if (visited.has(currentPath)) {
|
311
|
+
return depth;
|
312
|
+
}
|
313
|
+
visited.add(currentPath);
|
314
|
+
const node = graph.nodes.get(currentPath);
|
315
|
+
if (!node || node.dependencies.length === 0) {
|
316
|
+
return depth;
|
317
|
+
}
|
318
|
+
let maxChildDepth = depth;
|
319
|
+
for (const dependency of node.dependencies) {
|
320
|
+
if (graph.nodes.has(dependency)) {
|
321
|
+
const childDepth = dfs(dependency, depth + 1);
|
322
|
+
maxChildDepth = Math.max(maxChildDepth, childDepth);
|
323
|
+
}
|
324
|
+
}
|
325
|
+
return maxChildDepth;
|
326
|
+
};
|
327
|
+
return dfs(filePath, 0);
|
328
|
+
}
|
329
|
+
serializeDependencyGraph(graph) {
|
330
|
+
const nodes = [];
|
331
|
+
for (const [filePath, node] of graph.nodes) {
|
332
|
+
nodes.push({
|
333
|
+
id: filePath,
|
334
|
+
filePath: node.filePath,
|
335
|
+
dependencies: node.dependencies,
|
336
|
+
dependents: node.dependents,
|
337
|
+
isEntryPoint: node.isEntryPoint,
|
338
|
+
isLeaf: node.isLeaf,
|
339
|
+
importCount: node.imports.length,
|
340
|
+
exportCount: node.exports.length
|
341
|
+
});
|
342
|
+
}
|
343
|
+
return {
|
344
|
+
nodes,
|
345
|
+
edges: this.generateEdges(graph)
|
346
|
+
};
|
347
|
+
}
|
348
|
+
generateEdges(graph) {
|
349
|
+
const edges = [];
|
350
|
+
for (const [filePath, node] of graph.nodes) {
|
351
|
+
for (const dependency of node.dependencies) {
|
352
|
+
if (graph.nodes.has(dependency)) {
|
353
|
+
edges.push({
|
354
|
+
from: filePath,
|
355
|
+
to: dependency,
|
356
|
+
type: 'dependency'
|
357
|
+
});
|
358
|
+
}
|
359
|
+
}
|
360
|
+
}
|
361
|
+
return edges;
|
362
|
+
}
|
363
|
+
// Additional utility methods
|
364
|
+
async analyzeModule(filePath) {
|
365
|
+
const parseResult = await this.astParser.execute({
|
366
|
+
filePath,
|
367
|
+
includeSymbols: false,
|
368
|
+
includeImports: true,
|
369
|
+
includeTree: false
|
370
|
+
});
|
371
|
+
if (!parseResult.success || !parseResult.output) {
|
372
|
+
throw new Error(`Failed to parse module: ${filePath}`);
|
373
|
+
}
|
374
|
+
const parsed = JSON.parse(parseResult.output);
|
375
|
+
if (!parsed.success) {
|
376
|
+
throw new Error(`Failed to parse module: ${filePath}`);
|
377
|
+
}
|
378
|
+
const imports = parsed.result.imports || [];
|
379
|
+
const rootPath = process.cwd();
|
380
|
+
const externalDependencies = [];
|
381
|
+
const internalDependencies = [];
|
382
|
+
const duplicateImports = [];
|
383
|
+
const seenSources = new Set();
|
384
|
+
for (const importInfo of imports) {
|
385
|
+
if (seenSources.has(importInfo.source)) {
|
386
|
+
duplicateImports.push(importInfo.source);
|
387
|
+
}
|
388
|
+
else {
|
389
|
+
seenSources.add(importInfo.source);
|
390
|
+
}
|
391
|
+
if (importInfo.source.startsWith('.') || importInfo.source.startsWith('/')) {
|
392
|
+
const resolved = await this.resolveRelativeImport(importInfo.source, path.dirname(filePath));
|
393
|
+
if (resolved) {
|
394
|
+
internalDependencies.push(resolved);
|
395
|
+
}
|
396
|
+
}
|
397
|
+
else {
|
398
|
+
externalDependencies.push(importInfo.source);
|
399
|
+
}
|
400
|
+
}
|
401
|
+
return {
|
402
|
+
filePath: path.relative(rootPath, filePath),
|
403
|
+
externalDependencies,
|
404
|
+
internalDependencies,
|
405
|
+
circularImports: [], // TODO: Implement
|
406
|
+
unusedImports: [], // TODO: Implement with symbol usage analysis
|
407
|
+
missingDependencies: [], // TODO: Implement with file existence checks
|
408
|
+
duplicateImports
|
409
|
+
};
|
410
|
+
}
|
411
|
+
getSchema() {
|
412
|
+
return {
|
413
|
+
type: "object",
|
414
|
+
properties: {
|
415
|
+
rootPath: {
|
416
|
+
type: "string",
|
417
|
+
description: "Root path to analyze dependencies from",
|
418
|
+
default: "current working directory"
|
419
|
+
},
|
420
|
+
filePatterns: {
|
421
|
+
type: "array",
|
422
|
+
items: { type: "string" },
|
423
|
+
description: "Glob patterns for files to include",
|
424
|
+
default: ["**/*.{ts,tsx,js,jsx}"]
|
425
|
+
},
|
426
|
+
excludePatterns: {
|
427
|
+
type: "array",
|
428
|
+
items: { type: "string" },
|
429
|
+
description: "Glob patterns for files to exclude",
|
430
|
+
default: ["**/node_modules/**", "**/dist/**", "**/.git/**"]
|
431
|
+
},
|
432
|
+
includeExternals: {
|
433
|
+
type: "boolean",
|
434
|
+
description: "Include external module dependencies",
|
435
|
+
default: false
|
436
|
+
},
|
437
|
+
detectCircular: {
|
438
|
+
type: "boolean",
|
439
|
+
description: "Detect circular dependencies",
|
440
|
+
default: true
|
441
|
+
},
|
442
|
+
findUnreachable: {
|
443
|
+
type: "boolean",
|
444
|
+
description: "Find unreachable files from entry points",
|
445
|
+
default: true
|
446
|
+
},
|
447
|
+
generateGraph: {
|
448
|
+
type: "boolean",
|
449
|
+
description: "Generate serialized dependency graph",
|
450
|
+
default: false
|
451
|
+
},
|
452
|
+
entryPoints: {
|
453
|
+
type: "array",
|
454
|
+
items: { type: "string" },
|
455
|
+
description: "Explicit entry point files (if not provided, will be inferred)",
|
456
|
+
default: []
|
457
|
+
},
|
458
|
+
maxDepth: {
|
459
|
+
type: "integer",
|
460
|
+
description: "Maximum dependency depth to analyze",
|
461
|
+
default: 50,
|
462
|
+
minimum: 1,
|
463
|
+
maximum: 1000
|
464
|
+
}
|
465
|
+
}
|
466
|
+
};
|
467
|
+
}
|
468
|
+
}
|
469
|
+
//# sourceMappingURL=dependency-analyzer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dependency-analyzer.js","sourceRoot":"","sources":["../../../src/tools/intelligence/dependency-analyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAA0B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAgD5B,MAAM,OAAO,sBAAsB;IAMjC;QALA,SAAI,GAAG,qBAAqB,CAAC;QAC7B,gBAAW,GAAG,kGAAkG,CAAC;QAK/G,IAAI,CA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
|
+
export { DependencyAnalyzerTool } from "./dependency-analyzer.js";
|
4
|
+
export { CodeContextTool } from "./code-context.js";
|
5
|
+
export { RefactoringAssistantTool } from "./refactoring-assistant.js";
|
6
|
+
export type { ASTNode, ParseResult, SymbolInfo, ParameterInfo, ImportInfo, ExportInfo, ParseError } from "./ast-parser.js";
|
7
|
+
export type { SymbolReference, SymbolUsage, SearchResult, CrossReference } from "./symbol-search.js";
|
8
|
+
export type { DependencyNode, DependencyGraph, CircularDependency, DependencyStatistics, ModuleAnalysis } from "./dependency-analyzer.js";
|
9
|
+
export type { CodeContext, ContextualSymbol, ContextualDependency, CodeRelationship, SemanticContext, DesignPattern, UsagePattern, CodeMetrics, ComplexityMetrics, QualityMetrics, ProjectContext, ArchitectureInfo } from "./code-context.js";
|
10
|
+
export type { RefactoringOperation, RefactoringFileChange, TextChange, SafetyAnalysis, RenameRequest, ExtractFunctionRequest, ExtractedParameter, MoveRequest, InlineRequest } from "./refactoring-assistant.js";
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export { ASTParserTool } from "./ast-parser.js";
|
2
|
+
export { SymbolSearchTool } from "./symbol-search.js";
|
3
|
+
export { DependencyAnalyzerTool } from "./dependency-analyzer.js";
|
4
|
+
export { CodeContextTool } from "./code-context.js";
|
5
|
+
export { RefactoringAssistantTool } from "./refactoring-assistant.js";
|
6
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/intelligence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|