mcp-codebase-intelligence 0.1.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/LICENSE +21 -0
- package/README.md +166 -0
- package/dist/graph/code-graph.d.ts +119 -0
- package/dist/graph/code-graph.js +279 -0
- package/dist/graph/code-graph.js.map +1 -0
- package/dist/graph/schema.d.ts +2 -0
- package/dist/graph/schema.js +62 -0
- package/dist/graph/schema.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +171 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer/file-watcher.d.ts +13 -0
- package/dist/indexer/file-watcher.js +106 -0
- package/dist/indexer/file-watcher.js.map +1 -0
- package/dist/indexer/lang-go.d.ts +2 -0
- package/dist/indexer/lang-go.js +246 -0
- package/dist/indexer/lang-go.js.map +1 -0
- package/dist/indexer/lang-java.d.ts +2 -0
- package/dist/indexer/lang-java.js +307 -0
- package/dist/indexer/lang-java.js.map +1 -0
- package/dist/indexer/lang-python.d.ts +2 -0
- package/dist/indexer/lang-python.js +232 -0
- package/dist/indexer/lang-python.js.map +1 -0
- package/dist/indexer/lang-rust.d.ts +2 -0
- package/dist/indexer/lang-rust.js +323 -0
- package/dist/indexer/lang-rust.js.map +1 -0
- package/dist/indexer/language-plugin.d.ts +22 -0
- package/dist/indexer/language-plugin.js +22 -0
- package/dist/indexer/language-plugin.js.map +1 -0
- package/dist/indexer/tree-sitter-indexer.d.ts +12 -0
- package/dist/indexer/tree-sitter-indexer.js +618 -0
- package/dist/indexer/tree-sitter-indexer.js.map +1 -0
- package/dist/lsp/lsp-client.d.ts +45 -0
- package/dist/lsp/lsp-client.js +315 -0
- package/dist/lsp/lsp-client.js.map +1 -0
- package/dist/lsp/lsp-manager.d.ts +13 -0
- package/dist/lsp/lsp-manager.js +96 -0
- package/dist/lsp/lsp-manager.js.map +1 -0
- package/dist/tools/analyze-impact.d.ts +38 -0
- package/dist/tools/analyze-impact.js +126 -0
- package/dist/tools/analyze-impact.js.map +1 -0
- package/dist/tools/architecture-diagram.d.ts +33 -0
- package/dist/tools/architecture-diagram.js +216 -0
- package/dist/tools/architecture-diagram.js.map +1 -0
- package/dist/tools/find-implementations.d.ts +33 -0
- package/dist/tools/find-implementations.js +68 -0
- package/dist/tools/find-implementations.js.map +1 -0
- package/dist/tools/find-symbol.d.ts +39 -0
- package/dist/tools/find-symbol.js +52 -0
- package/dist/tools/find-symbol.js.map +1 -0
- package/dist/tools/get-call-graph.d.ts +40 -0
- package/dist/tools/get-call-graph.js +174 -0
- package/dist/tools/get-call-graph.js.map +1 -0
- package/dist/tools/get-dependencies.d.ts +28 -0
- package/dist/tools/get-dependencies.js +68 -0
- package/dist/tools/get-dependencies.js.map +1 -0
- package/dist/tools/get-exports.d.ts +23 -0
- package/dist/tools/get-exports.js +40 -0
- package/dist/tools/get-exports.js.map +1 -0
- package/dist/tools/get-references.d.ts +28 -0
- package/dist/tools/get-references.js +53 -0
- package/dist/tools/get-references.js.map +1 -0
- package/dist/tools/get-stats.d.ts +15 -0
- package/dist/tools/get-stats.js +23 -0
- package/dist/tools/get-stats.js.map +1 -0
- package/dist/tools/get-type-info.d.ts +33 -0
- package/dist/tools/get-type-info.js +69 -0
- package/dist/tools/get-type-info.js.map +1 -0
- package/dist/tools/goto-definition.d.ts +33 -0
- package/dist/tools/goto-definition.js +77 -0
- package/dist/tools/goto-definition.js.map +1 -0
- package/dist/tools/natural-language-query.d.ts +23 -0
- package/dist/tools/natural-language-query.js +426 -0
- package/dist/tools/natural-language-query.js.map +1 -0
- package/dist/tools/reindex.d.ts +15 -0
- package/dist/tools/reindex.js +20 -0
- package/dist/tools/reindex.js.map +1 -0
- package/dist/tools/semantic-diff.d.ts +32 -0
- package/dist/tools/semantic-diff.js +407 -0
- package/dist/tools/semantic-diff.js.map +1 -0
- package/dist/utils/logger.d.ts +6 -0
- package/dist/utils/logger.js +15 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CodeGraph } from "../graph/code-graph.js";
|
|
2
|
+
export declare const architectureDiagramTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
scope: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
max_depth: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
format: {
|
|
17
|
+
type: string;
|
|
18
|
+
enum: string[];
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare function handleArchitectureDiagram(graph: CodeGraph, args: {
|
|
25
|
+
scope?: string;
|
|
26
|
+
max_depth?: number;
|
|
27
|
+
format?: string;
|
|
28
|
+
}, projectRoot?: string): {
|
|
29
|
+
content: {
|
|
30
|
+
type: "text";
|
|
31
|
+
text: string;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
export const architectureDiagramTool = {
|
|
2
|
+
name: "architecture_diagram",
|
|
3
|
+
description: "Auto-generate a mermaid diagram of the project's module dependency graph. Shows which files import from which other files, grouped by directory. Useful for understanding project structure at a glance.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
scope: {
|
|
8
|
+
type: "string",
|
|
9
|
+
description: "Optional: limit diagram to files under this path prefix (e.g. 'src/api')",
|
|
10
|
+
},
|
|
11
|
+
max_depth: {
|
|
12
|
+
type: "number",
|
|
13
|
+
description: "Maximum directory nesting depth for subgraph grouping (default: 2)",
|
|
14
|
+
},
|
|
15
|
+
format: {
|
|
16
|
+
type: "string",
|
|
17
|
+
enum: ["mermaid", "text"],
|
|
18
|
+
description: "Output format (default: mermaid)",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export function handleArchitectureDiagram(graph, args, projectRoot) {
|
|
24
|
+
const db = graph.getDb();
|
|
25
|
+
const maxDepth = Math.min(Math.max(args.max_depth ?? 2, 1), 5);
|
|
26
|
+
const format = args.format ?? "mermaid";
|
|
27
|
+
// Get all files and their imports
|
|
28
|
+
const scopeFilter = args.scope
|
|
29
|
+
? `WHERE f.path LIKE ?`
|
|
30
|
+
: "";
|
|
31
|
+
const scopeParam = args.scope ? `${args.scope}%` : undefined;
|
|
32
|
+
const filesQuery = `
|
|
33
|
+
SELECT f.path, i.source_path as importSource
|
|
34
|
+
FROM files f
|
|
35
|
+
LEFT JOIN imports i ON i.file_id = f.id
|
|
36
|
+
${scopeFilter}
|
|
37
|
+
ORDER BY f.path
|
|
38
|
+
`;
|
|
39
|
+
const rows = (scopeParam
|
|
40
|
+
? db.prepare(filesQuery).all(scopeParam)
|
|
41
|
+
: db.prepare(filesQuery).all());
|
|
42
|
+
if (rows.length === 0) {
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: "text",
|
|
47
|
+
text: args.scope
|
|
48
|
+
? `No files found under scope "${args.scope}".`
|
|
49
|
+
: "No files indexed yet. Run reindex first.",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// Build file → imports map
|
|
55
|
+
const fileMap = new Map();
|
|
56
|
+
const allFiles = new Set();
|
|
57
|
+
for (const row of rows) {
|
|
58
|
+
allFiles.add(row.path);
|
|
59
|
+
if (row.importSource) {
|
|
60
|
+
const imports = fileMap.get(row.path) ?? new Set();
|
|
61
|
+
imports.add(row.importSource);
|
|
62
|
+
fileMap.set(row.path, imports);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Resolve relative imports to actual indexed file paths
|
|
66
|
+
const edges = [];
|
|
67
|
+
const indexedPaths = [...allFiles];
|
|
68
|
+
for (const [filePath, importSources] of fileMap) {
|
|
69
|
+
for (const source of importSources) {
|
|
70
|
+
const resolved = resolveImport(filePath, source, indexedPaths);
|
|
71
|
+
if (resolved) {
|
|
72
|
+
edges.push({ from: filePath, to: resolved });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const header = projectRoot ? `Project: ${projectRoot}\n\n` : "";
|
|
77
|
+
if (format === "text") {
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: "text",
|
|
82
|
+
text: header + buildTextDiagram(allFiles, edges),
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
content: [
|
|
89
|
+
{
|
|
90
|
+
type: "text",
|
|
91
|
+
text: header + buildMermaidDiagram(allFiles, edges, maxDepth),
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function resolveImport(fromFile, importSource, indexedPaths) {
|
|
97
|
+
// If it's a relative import (starts with . or ..)
|
|
98
|
+
if (importSource.startsWith(".")) {
|
|
99
|
+
const fromDir = fromFile.substring(0, fromFile.lastIndexOf("/"));
|
|
100
|
+
const resolved = normalizePath(fromDir + "/" + importSource);
|
|
101
|
+
// Try exact match and common extensions
|
|
102
|
+
const extensions = ["", ".ts", ".tsx", ".js", ".jsx", ".py", ".go", ".rs", ".java"];
|
|
103
|
+
for (const ext of extensions) {
|
|
104
|
+
const candidate = resolved + ext;
|
|
105
|
+
if (indexedPaths.includes(candidate))
|
|
106
|
+
return candidate;
|
|
107
|
+
}
|
|
108
|
+
// Try index files
|
|
109
|
+
for (const idx of ["/index.ts", "/index.js", "/index.tsx"]) {
|
|
110
|
+
const candidate = resolved + idx;
|
|
111
|
+
if (indexedPaths.includes(candidate))
|
|
112
|
+
return candidate;
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
// Absolute/package imports — try suffix match
|
|
117
|
+
for (const p of indexedPaths) {
|
|
118
|
+
if (p.endsWith("/" + importSource) || p.endsWith("/" + importSource + ".ts") || p.endsWith("/" + importSource + ".js")) {
|
|
119
|
+
return p;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
function normalizePath(p) {
|
|
125
|
+
const parts = [];
|
|
126
|
+
for (const part of p.split("/")) {
|
|
127
|
+
if (part === "..") {
|
|
128
|
+
parts.pop();
|
|
129
|
+
}
|
|
130
|
+
else if (part !== ".") {
|
|
131
|
+
parts.push(part);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return parts.join("/");
|
|
135
|
+
}
|
|
136
|
+
function getDirectory(filePath, depth) {
|
|
137
|
+
const parts = filePath.split("/");
|
|
138
|
+
return parts.slice(0, Math.min(depth, parts.length - 1)).join("/");
|
|
139
|
+
}
|
|
140
|
+
function buildMermaidDiagram(allFiles, edges, maxDepth) {
|
|
141
|
+
const sanitize = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
142
|
+
const shortName = (p) => {
|
|
143
|
+
const parts = p.split("/");
|
|
144
|
+
return parts[parts.length - 1];
|
|
145
|
+
};
|
|
146
|
+
// Group files by directory
|
|
147
|
+
const dirGroups = new Map();
|
|
148
|
+
for (const file of allFiles) {
|
|
149
|
+
const dir = getDirectory(file, maxDepth) || "root";
|
|
150
|
+
const list = dirGroups.get(dir) ?? [];
|
|
151
|
+
list.push(file);
|
|
152
|
+
dirGroups.set(dir, list);
|
|
153
|
+
}
|
|
154
|
+
const lines = [
|
|
155
|
+
"# Architecture Diagram\n",
|
|
156
|
+
"```mermaid",
|
|
157
|
+
"graph LR",
|
|
158
|
+
];
|
|
159
|
+
// Add subgraphs for each directory
|
|
160
|
+
for (const [dir, files] of dirGroups) {
|
|
161
|
+
if (dirGroups.size > 1) {
|
|
162
|
+
lines.push(` subgraph ${sanitize(dir)}["${dir}"]`);
|
|
163
|
+
}
|
|
164
|
+
for (const file of files) {
|
|
165
|
+
lines.push(` ${sanitize(file)}["${shortName(file)}"]`);
|
|
166
|
+
}
|
|
167
|
+
if (dirGroups.size > 1) {
|
|
168
|
+
lines.push(" end");
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Add edges
|
|
172
|
+
const seenEdges = new Set();
|
|
173
|
+
for (const edge of edges) {
|
|
174
|
+
const key = `${edge.from}->${edge.to}`;
|
|
175
|
+
if (seenEdges.has(key))
|
|
176
|
+
continue;
|
|
177
|
+
seenEdges.add(key);
|
|
178
|
+
lines.push(` ${sanitize(edge.from)} --> ${sanitize(edge.to)}`);
|
|
179
|
+
}
|
|
180
|
+
lines.push("```");
|
|
181
|
+
// Add summary
|
|
182
|
+
const fileCount = allFiles.size;
|
|
183
|
+
const edgeCount = seenEdges.size;
|
|
184
|
+
lines.push(`\n**${fileCount} modules, ${edgeCount} dependencies**`);
|
|
185
|
+
return lines.join("\n");
|
|
186
|
+
}
|
|
187
|
+
function buildTextDiagram(allFiles, edges) {
|
|
188
|
+
const lines = ["# Module Dependencies\n"];
|
|
189
|
+
// Group edges by source file
|
|
190
|
+
const bySource = new Map();
|
|
191
|
+
for (const edge of edges) {
|
|
192
|
+
const list = bySource.get(edge.from) ?? [];
|
|
193
|
+
list.push(edge.to);
|
|
194
|
+
bySource.set(edge.from, list);
|
|
195
|
+
}
|
|
196
|
+
// Files with dependencies
|
|
197
|
+
for (const [file, deps] of [...bySource].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
198
|
+
lines.push(`${file}`);
|
|
199
|
+
for (const dep of deps.sort()) {
|
|
200
|
+
lines.push(` --> ${dep}`);
|
|
201
|
+
}
|
|
202
|
+
lines.push("");
|
|
203
|
+
}
|
|
204
|
+
// Files with no dependencies
|
|
205
|
+
const filesWithDeps = new Set(bySource.keys());
|
|
206
|
+
const filesWithNoDeps = [...allFiles].filter((f) => !filesWithDeps.has(f)).sort();
|
|
207
|
+
if (filesWithNoDeps.length > 0) {
|
|
208
|
+
lines.push("## Standalone modules (no imports)");
|
|
209
|
+
for (const f of filesWithNoDeps) {
|
|
210
|
+
lines.push(` ${f}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
lines.push(`\n**${allFiles.size} modules, ${edges.length} dependencies**`);
|
|
214
|
+
return lines.join("\n");
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=architecture-diagram.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architecture-diagram.js","sourceRoot":"","sources":["../../src/tools/architecture-diagram.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,0MAA0M;IAC5M,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,0EAA0E;aAC7E;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,oEAAoE;aACvE;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;gBACzB,WAAW,EAAE,kCAAkC;aAChD;SACF;KACF;CACF,CAAC;AAYF,MAAM,UAAU,yBAAyB,CACvC,KAAgB,EAChB,IAA6D,EAC7D,WAAoB;IAEpB,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;IACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,SAAS,CAAC;IAExC,kCAAkC;IAClC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK;QAC5B,CAAC,CAAC,qBAAqB;QACvB,CAAC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EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAClF,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QACjD,KAAK,MAAM,CAAC,IAAI,eAAe,EAAE,CAAC;YAChC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,IAAI,aAAa,KAAK,CAAC,MAAM,iBAAiB,CAAC,CAAC;IAE3E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LspManager } from "../lsp/lsp-manager.js";
|
|
2
|
+
export declare const findImplementationsTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
file_path: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
line: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
character: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
required: string[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare function handleFindImplementations(lspManager: LspManager, args: {
|
|
25
|
+
file_path: string;
|
|
26
|
+
line: number;
|
|
27
|
+
character: number;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
content: {
|
|
30
|
+
type: "text";
|
|
31
|
+
text: string;
|
|
32
|
+
}[];
|
|
33
|
+
}>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
export const findImplementationsTool = {
|
|
3
|
+
name: "find_implementations",
|
|
4
|
+
description: "Find all implementations of an interface or abstract method. Uses LSP for precise type-aware resolution across files.",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
file_path: {
|
|
9
|
+
type: "string",
|
|
10
|
+
description: "Absolute path to the file containing the interface/abstract method",
|
|
11
|
+
},
|
|
12
|
+
line: {
|
|
13
|
+
type: "number",
|
|
14
|
+
description: "Line number of the interface/method (1-based)",
|
|
15
|
+
},
|
|
16
|
+
character: {
|
|
17
|
+
type: "number",
|
|
18
|
+
description: "Column number (0-based)",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
required: ["file_path", "line", "character"],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export async function handleFindImplementations(lspManager, args) {
|
|
25
|
+
const client = lspManager.getClientForFile(args.file_path);
|
|
26
|
+
if (!client) {
|
|
27
|
+
return {
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: "text",
|
|
31
|
+
text: `No LSP server available for ${args.file_path}. LSP features require a running language server.`,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const implementations = await client.getImplementations(args.file_path, args.line, args.character);
|
|
37
|
+
if (implementations.length === 0) {
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: "text",
|
|
42
|
+
text: `No implementations found at ${args.file_path}:${args.line}:${args.character}`,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const results = implementations.map((loc) => {
|
|
48
|
+
const filePath = loc.uri.replace("file://", "");
|
|
49
|
+
let lineText = "";
|
|
50
|
+
try {
|
|
51
|
+
const lines = readFileSync(filePath, "utf-8").split("\n");
|
|
52
|
+
lineText = lines[loc.line - 1]?.trim() ?? "";
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// ignore read errors
|
|
56
|
+
}
|
|
57
|
+
return ` ${filePath}:${loc.line}:${loc.character} ${lineText}`;
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: "text",
|
|
63
|
+
text: `Found ${implementations.length} implementation(s):\n\n${results.join("\n")}`,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=find-implementations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-implementations.js","sourceRoot":"","sources":["../../src/tools/find-implementations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAElC,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,uHAAuH;IACzH,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oEAAoE;aAClF;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+CAA+C;aAC7D;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yBAAyB;aACvC;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC;KAC7C;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,UAAsB,EACtB,IAA4D;IAE5D,MAAM,MAAM,GAAG,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,mDAAmD;iBACvG;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CodeGraph } from "../graph/code-graph.js";
|
|
2
|
+
export declare const findSymbolTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
name: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
kind: {
|
|
13
|
+
type: string;
|
|
14
|
+
enum: string[];
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
scope: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
limit: {
|
|
22
|
+
type: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
required: string[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare function handleFindSymbol(graph: CodeGraph, args: {
|
|
30
|
+
name: string;
|
|
31
|
+
kind?: string;
|
|
32
|
+
scope?: string;
|
|
33
|
+
limit?: number;
|
|
34
|
+
}): {
|
|
35
|
+
content: {
|
|
36
|
+
type: "text";
|
|
37
|
+
text: string;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const findSymbolTool = {
|
|
2
|
+
name: "find_symbol",
|
|
3
|
+
description: "Find symbols (functions, classes, interfaces, types, variables, methods) by name with full type information and location. Supports fuzzy matching.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
name: {
|
|
8
|
+
type: "string",
|
|
9
|
+
description: "Symbol name to search for (supports partial matching)",
|
|
10
|
+
},
|
|
11
|
+
kind: {
|
|
12
|
+
type: "string",
|
|
13
|
+
enum: ["function", "class", "interface", "type", "variable", "method", "enum", "property"],
|
|
14
|
+
description: "Optional: filter by symbol kind",
|
|
15
|
+
},
|
|
16
|
+
scope: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Optional: limit search to files under this path prefix",
|
|
19
|
+
},
|
|
20
|
+
limit: {
|
|
21
|
+
type: "number",
|
|
22
|
+
description: "Maximum results to return (default: 20)",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ["name"],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export function handleFindSymbol(graph, args) {
|
|
29
|
+
const results = graph.findSymbols({
|
|
30
|
+
name: args.name,
|
|
31
|
+
kind: args.kind,
|
|
32
|
+
scope: args.scope,
|
|
33
|
+
limit: args.limit ?? 20,
|
|
34
|
+
});
|
|
35
|
+
if (results.length === 0) {
|
|
36
|
+
return { content: [{ type: "text", text: `No symbols found matching "${args.name}"` }] };
|
|
37
|
+
}
|
|
38
|
+
const formatted = results.map((s) => {
|
|
39
|
+
const exported = s.isExported ? " [exported]" : "";
|
|
40
|
+
const sig = s.signature ? `\n Signature: ${s.signature}` : "";
|
|
41
|
+
return `${s.kind} ${s.name}${exported}\n Location: ${s.filePath}:${s.lineStart}-${s.lineEnd}${sig}`;
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: "text",
|
|
47
|
+
text: `Found ${results.length} symbol(s) matching "${args.name}":\n\n${formatted.join("\n\n")}`,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=find-symbol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-symbol.js","sourceRoot":"","sources":["../../src/tools/find-symbol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,oJAAoJ;IACtJ,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uDAAuD;aACrE;YACD,IAAI,EAAE;gBACJ,IAAI,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,CAAC,QAAQ,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC;IACvG,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,SAAS,OAAO,CAAC,MAAM,wBAAwB,IAAI,CAAC,IAAI,SAAS,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;aAChG;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CodeGraph } from "../graph/code-graph.js";
|
|
2
|
+
export declare const getCallGraphTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
function_name: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
direction: {
|
|
13
|
+
type: string;
|
|
14
|
+
enum: string[];
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
depth: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
format: {
|
|
22
|
+
type: string;
|
|
23
|
+
enum: string[];
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
required: string[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function handleGetCallGraph(graph: CodeGraph, args: {
|
|
31
|
+
function_name: string;
|
|
32
|
+
direction?: string;
|
|
33
|
+
depth?: number;
|
|
34
|
+
format?: string;
|
|
35
|
+
}): {
|
|
36
|
+
content: {
|
|
37
|
+
type: "text";
|
|
38
|
+
text: string;
|
|
39
|
+
}[];
|
|
40
|
+
};
|