ariadne-mcp 0.1.0 → 0.2.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/README.md +4 -4
- package/dist/graph/queries.d.ts +25 -0
- package/dist/graph/queries.d.ts.map +1 -1
- package/dist/graph/queries.js +92 -3
- package/dist/graph/queries.js.map +1 -1
- package/dist/indexer/scip-runner.d.ts +1 -1
- package/dist/indexer/scip-runner.d.ts.map +1 -1
- package/dist/indexer/scip-runner.js +78 -14
- package/dist/indexer/scip-runner.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +15 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/find-symbol.d.ts +19 -0
- package/dist/tools/find-symbol.d.ts.map +1 -0
- package/dist/tools/find-symbol.js +26 -0
- package/dist/tools/find-symbol.js.map +1 -0
- package/dist/tools/get-file-symbols.d.ts +7 -2
- package/dist/tools/get-file-symbols.d.ts.map +1 -1
- package/dist/tools/get-file-symbols.js +32 -9
- package/dist/tools/get-file-symbols.js.map +1 -1
- package/dist/tools/get-importers.d.ts +19 -0
- package/dist/tools/get-importers.d.ts.map +1 -0
- package/dist/tools/get-importers.js +30 -0
- package/dist/tools/get-importers.js.map +1 -0
- package/dist/tools/index.d.ts +48 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +16 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/search-files.d.ts +19 -0
- package/dist/tools/search-files.d.ts.map +1 -0
- package/dist/tools/search-files.js +23 -0
- package/dist/tools/search-files.js.map +1 -0
- package/package.json +13 -6
package/README.md
CHANGED
|
@@ -29,20 +29,20 @@ This burns tokens fast and produces shallow answers. Ariadne gives agents the sa
|
|
|
29
29
|
|
|
30
30
|
## Setup
|
|
31
31
|
|
|
32
|
-
Add this to your MCP config (
|
|
32
|
+
Add this to your **project-level** MCP config (not global) — Ariadne uses `process.cwd()` as the repo root, so it must be spawned from the project directory:
|
|
33
33
|
|
|
34
34
|
```json
|
|
35
35
|
{
|
|
36
36
|
"mcpServers": {
|
|
37
37
|
"ariadne": {
|
|
38
38
|
"command": "npx",
|
|
39
|
-
"args": ["-y", "ariadne"]
|
|
39
|
+
"args": ["-y", "ariadne-mcp"]
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
> ⚠️ **Do not add Ariadne to your global MCP config.** It needs to run inside a project directory to index correctly. Use your editor's per-project config (e.g. `.cursor/mcp.json`, `.kiro/settings/mcp.json`, or the project-level Claude Desktop config).
|
|
46
46
|
|
|
47
47
|
## What happens on first run
|
|
48
48
|
|
|
@@ -84,7 +84,7 @@ That's it. Ariadne is spawned as a subprocess and inherits the editor's working
|
|
|
84
84
|
## How it works
|
|
85
85
|
|
|
86
86
|
```
|
|
87
|
-
npx ariadne
|
|
87
|
+
npx ariadne-mcp
|
|
88
88
|
→ process.cwd() repo root (inherited from editor)
|
|
89
89
|
→ scip-typescript / scip-python full semantic index → .ariadne/index.scip
|
|
90
90
|
→ loadScipIndex() symbols + edges → .ariadne/graph.db (SQLite)
|
package/dist/graph/queries.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ import type { Symbol, DefinitionResult, CallSite, CallPath } from "../types/inde
|
|
|
7
7
|
export declare function getDefinition(db: Database.Database, name: string, file?: string): Promise<DefinitionResult | null>;
|
|
8
8
|
/**
|
|
9
9
|
* Find all call sites that invoke symbols matching `symbolName`.
|
|
10
|
+
* Falls back to all reference edges (imports, references) when no call edges
|
|
11
|
+
* exist — this surfaces class registrations and import sites for non-callable
|
|
12
|
+
* symbols like classes.
|
|
10
13
|
*/
|
|
11
14
|
export declare function getCallers(db: Database.Database, symbolName: string): Promise<CallSite[]>;
|
|
12
15
|
/**
|
|
@@ -15,6 +18,8 @@ export declare function getCallers(db: Database.Database, symbolName: string): P
|
|
|
15
18
|
export declare function getCallees(db: Database.Database, symbolName: string): Promise<Symbol[]>;
|
|
16
19
|
/**
|
|
17
20
|
* Find all edges pointing at symbols matching `symbolName`, any edge kind.
|
|
21
|
+
* Includes calls, imports, references, and implements edges — so decorators,
|
|
22
|
+
* class registrations, and function calls are all surfaced.
|
|
18
23
|
*/
|
|
19
24
|
export declare function getReferences(db: Database.Database, symbolName: string): Promise<CallSite[]>;
|
|
20
25
|
/**
|
|
@@ -25,6 +30,26 @@ export declare function getImplementations(db: Database.Database, symbolName: st
|
|
|
25
30
|
* Return all symbols defined in a given file, ordered by line number.
|
|
26
31
|
*/
|
|
27
32
|
export declare function getFileSymbols(db: Database.Database, filePath: string): Promise<Symbol[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Return all symbols defined in files under a given directory, ordered by file + line.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getDirectorySymbols(db: Database.Database, dirPath: string): Promise<Symbol[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Fuzzy symbol search — returns all symbols whose name contains the query string.
|
|
39
|
+
*/
|
|
40
|
+
export declare function findSymbol(db: Database.Database, query: string, limit?: number): Promise<Symbol[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Return all symbols (in other files) that import the given file.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getImporters(db: Database.Database, filePath: string): Promise<{
|
|
45
|
+
symbol: Symbol;
|
|
46
|
+
line: number;
|
|
47
|
+
}[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Find all indexed files whose path matches a glob-style pattern.
|
|
50
|
+
* Supports * (any chars except /) and ** (any chars including /).
|
|
51
|
+
*/
|
|
52
|
+
export declare function searchFiles(db: Database.Database, pattern: string): Promise<string[]>;
|
|
28
53
|
/**
|
|
29
54
|
* Best-effort: find the type/interface a symbol references.
|
|
30
55
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/graph/queries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,O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,GACb,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA8E1B"}
|
package/dist/graph/queries.js
CHANGED
|
@@ -6,6 +6,10 @@ exports.getCallees = getCallees;
|
|
|
6
6
|
exports.getReferences = getReferences;
|
|
7
7
|
exports.getImplementations = getImplementations;
|
|
8
8
|
exports.getFileSymbols = getFileSymbols;
|
|
9
|
+
exports.getDirectorySymbols = getDirectorySymbols;
|
|
10
|
+
exports.findSymbol = findSymbol;
|
|
11
|
+
exports.getImporters = getImporters;
|
|
12
|
+
exports.searchFiles = searchFiles;
|
|
9
13
|
exports.getTypeDefinition = getTypeDefinition;
|
|
10
14
|
exports.getSourceDefinition = getSourceDefinition;
|
|
11
15
|
exports.getCallPath = getCallPath;
|
|
@@ -42,9 +46,12 @@ async function getDefinition(db, name, file) {
|
|
|
42
46
|
}
|
|
43
47
|
/**
|
|
44
48
|
* Find all call sites that invoke symbols matching `symbolName`.
|
|
49
|
+
* Falls back to all reference edges (imports, references) when no call edges
|
|
50
|
+
* exist — this surfaces class registrations and import sites for non-callable
|
|
51
|
+
* symbols like classes.
|
|
45
52
|
*/
|
|
46
53
|
async function getCallers(db, symbolName) {
|
|
47
|
-
const
|
|
54
|
+
const callRows = db.prepare(`
|
|
48
55
|
SELECT
|
|
49
56
|
s.id, s.name, s.kind, s.file, s.line, s.signature, s.docstring,
|
|
50
57
|
e.line AS call_line
|
|
@@ -54,7 +61,24 @@ async function getCallers(db, symbolName) {
|
|
|
54
61
|
AND e.kind = 'calls'
|
|
55
62
|
ORDER BY s.file, e.line
|
|
56
63
|
`).all({ name: symbolName });
|
|
57
|
-
|
|
64
|
+
if (callRows.length > 0) {
|
|
65
|
+
return callRows.map((row) => ({
|
|
66
|
+
caller: rowToSymbol(row),
|
|
67
|
+
line: row["call_line"] ?? row["line"],
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
// No call edges — fall back to imports + references (e.g. class registrations)
|
|
71
|
+
const refRows = db.prepare(`
|
|
72
|
+
SELECT
|
|
73
|
+
s.id, s.name, s.kind, s.file, s.line, s.signature, s.docstring,
|
|
74
|
+
e.line AS call_line
|
|
75
|
+
FROM edges e
|
|
76
|
+
JOIN symbols s ON s.id = e.from_symbol
|
|
77
|
+
WHERE e.to_symbol IN (SELECT id FROM symbols WHERE name = $name)
|
|
78
|
+
AND e.kind IN ('imports', 'references')
|
|
79
|
+
ORDER BY s.file, e.line
|
|
80
|
+
`).all({ name: symbolName });
|
|
81
|
+
return refRows.map((row) => ({
|
|
58
82
|
caller: rowToSymbol(row),
|
|
59
83
|
line: row["call_line"] ?? row["line"],
|
|
60
84
|
}));
|
|
@@ -78,12 +102,15 @@ async function getCallees(db, symbolName) {
|
|
|
78
102
|
}
|
|
79
103
|
/**
|
|
80
104
|
* Find all edges pointing at symbols matching `symbolName`, any edge kind.
|
|
105
|
+
* Includes calls, imports, references, and implements edges — so decorators,
|
|
106
|
+
* class registrations, and function calls are all surfaced.
|
|
81
107
|
*/
|
|
82
108
|
async function getReferences(db, symbolName) {
|
|
83
109
|
const rows = db.prepare(`
|
|
84
110
|
SELECT
|
|
85
111
|
s.id, s.name, s.kind, s.file, s.line, s.signature, s.docstring,
|
|
86
|
-
e.line AS ref_line
|
|
112
|
+
e.line AS ref_line,
|
|
113
|
+
e.kind AS edge_kind
|
|
87
114
|
FROM edges e
|
|
88
115
|
JOIN symbols s ON s.id = e.from_symbol
|
|
89
116
|
WHERE e.to_symbol IN (SELECT id FROM symbols WHERE name = $name)
|
|
@@ -115,6 +142,68 @@ async function getFileSymbols(db, filePath) {
|
|
|
115
142
|
const rows = db.prepare(`SELECT * FROM symbols WHERE file = $file ORDER BY line`).all({ file: filePath });
|
|
116
143
|
return rows.map(rowToSymbol);
|
|
117
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Return all symbols defined in files under a given directory, ordered by file + line.
|
|
147
|
+
*/
|
|
148
|
+
async function getDirectorySymbols(db, dirPath) {
|
|
149
|
+
const prefix = dirPath.replace(/\/$/, "") + "/";
|
|
150
|
+
const rows = db.prepare(`SELECT * FROM symbols WHERE file LIKE $prefix ORDER BY file, line`).all({ prefix: prefix + "%" });
|
|
151
|
+
return rows.map(rowToSymbol);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Fuzzy symbol search — returns all symbols whose name contains the query string.
|
|
155
|
+
*/
|
|
156
|
+
async function findSymbol(db, query, limit = 50) {
|
|
157
|
+
const rows = db.prepare(`
|
|
158
|
+
SELECT * FROM symbols
|
|
159
|
+
WHERE name LIKE $pattern
|
|
160
|
+
ORDER BY
|
|
161
|
+
CASE WHEN name = $exact THEN 0
|
|
162
|
+
WHEN name LIKE $prefix THEN 1
|
|
163
|
+
ELSE 2 END,
|
|
164
|
+
name
|
|
165
|
+
LIMIT $limit
|
|
166
|
+
`).all({
|
|
167
|
+
pattern: `%${query}%`,
|
|
168
|
+
exact: query,
|
|
169
|
+
prefix: `${query}%`,
|
|
170
|
+
limit,
|
|
171
|
+
});
|
|
172
|
+
return rows.map(rowToSymbol);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Return all symbols (in other files) that import the given file.
|
|
176
|
+
*/
|
|
177
|
+
async function getImporters(db, filePath) {
|
|
178
|
+
const rows = db.prepare(`
|
|
179
|
+
SELECT
|
|
180
|
+
s.id, s.name, s.kind, s.file, s.line, s.signature, s.docstring,
|
|
181
|
+
e.line AS import_line
|
|
182
|
+
FROM edges e
|
|
183
|
+
JOIN symbols s ON s.id = e.from_symbol
|
|
184
|
+
WHERE e.kind = 'imports'
|
|
185
|
+
AND e.to_symbol IN (SELECT id FROM symbols WHERE file = $file OR file = $absFile)
|
|
186
|
+
GROUP BY s.file
|
|
187
|
+
ORDER BY s.file
|
|
188
|
+
`).all({ file: filePath, absFile: filePath });
|
|
189
|
+
return rows.map((row) => ({
|
|
190
|
+
symbol: rowToSymbol(row),
|
|
191
|
+
line: row["import_line"] ?? row["line"],
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Find all indexed files whose path matches a glob-style pattern.
|
|
196
|
+
* Supports * (any chars except /) and ** (any chars including /).
|
|
197
|
+
*/
|
|
198
|
+
async function searchFiles(db, pattern) {
|
|
199
|
+
// Convert glob pattern to SQL LIKE pattern
|
|
200
|
+
const sqlPattern = pattern
|
|
201
|
+
.replace(/%/g, "\\%") // escape existing %
|
|
202
|
+
.replace(/\*\*/g, "%") // ** → %
|
|
203
|
+
.replace(/\*/g, "%"); // * → %
|
|
204
|
+
const rows = db.prepare(`SELECT DISTINCT file FROM symbols WHERE file LIKE $pattern ESCAPE '\\' ORDER BY file`).all({ pattern: sqlPattern });
|
|
205
|
+
return rows.map((r) => r.file);
|
|
206
|
+
}
|
|
118
207
|
/**
|
|
119
208
|
* Best-effort: find the type/interface a symbol references.
|
|
120
209
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/graph/queries.ts"],"names":[],"mappings":";;AA4BA,sCAaC;
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/graph/queries.ts"],"names":[],"mappings":";;AA4BA,sCAaC;AAQD,gCAsCC;AAKD,gCAiBC;AAOD,sCAmBC;AAKD,gDAcC;AAKD,wCASC;AAKD,kDASC;AAKD,gCAqBC;AAKD,oCAmBC;AAMD,kCAeC;AAKD,8CAoBC;AAKD,kDAoBC;AAMD,kCAkFC;AAnYD,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,SAAS,WAAW,CAAC,GAA4B;IAC/C,OAAO;QACL,EAAE,EAAS,GAAG,CAAC,IAAI,CAAW;QAC9B,IAAI,EAAO,GAAG,CAAC,MAAM,CAAW;QAChC,IAAI,EAAO,GAAG,CAAC,MAAM,CAAmB;QACxC,IAAI,EAAO,GAAG,CAAC,MAAM,CAAW;QAChC,IAAI,EAAO,GAAG,CAAC,MAAM,CAAW;QAChC,SAAS,EAAG,GAAG,CAAC,WAAW,CAAmB,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,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAE5F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;AAC7C,CAAC"}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
export declare function runPythonIndexer(repoPath: string): Promise<string>;
|
|
21
21
|
/**
|
|
22
22
|
* Run the TypeScript/JavaScript SCIP indexer against repoPath.
|
|
23
|
-
*
|
|
23
|
+
* Auto-detects monorepo type and uses the appropriate scip-typescript flags.
|
|
24
24
|
* Returns the path to the generated .scip file.
|
|
25
25
|
*/
|
|
26
26
|
export declare function runTypescriptIndexer(repoPath: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scip-runner.d.ts","sourceRoot":"","sources":["../../src/indexer/scip-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4CH;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDxE;
|
|
1
|
+
{"version":3,"file":"scip-runner.d.ts","sourceRoot":"","sources":["../../src/indexer/scip-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4CH;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDxE;AA8DD;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwC5E"}
|
|
@@ -97,33 +97,97 @@ async function runPythonIndexer(repoPath) {
|
|
|
97
97
|
}
|
|
98
98
|
return outputPath;
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
async function fileExists(p) {
|
|
101
|
+
return promises_1.default.access(p).then(() => true).catch(() => false);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Detect the best indexing strategy for the repo.
|
|
105
|
+
*
|
|
106
|
+
* Tier 1: pnpm-workspace.yaml → --pnpm-workspaces (native, single run)
|
|
107
|
+
* Tier 2: package.json#workspaces or lerna.json → --yarn-workspaces
|
|
108
|
+
* Tier 3: root tsconfig.json (may have project references) → pass as positional arg
|
|
109
|
+
* Tier 4: filesystem walk — find first tsconfig.json in common monorepo dirs
|
|
110
|
+
* Tier 5: fallback (no tsconfig found, let scip-typescript try from root)
|
|
111
|
+
*/
|
|
112
|
+
async function detectStrategy(repoPath) {
|
|
113
|
+
// Tier 1: pnpm workspaces
|
|
114
|
+
if (await fileExists(node_path_1.default.join(repoPath, "pnpm-workspace.yaml"))) {
|
|
115
|
+
return { kind: "pnpm-workspaces" };
|
|
116
|
+
}
|
|
117
|
+
// Tier 2: yarn/npm workspaces or lerna
|
|
118
|
+
if (await fileExists(node_path_1.default.join(repoPath, "lerna.json"))) {
|
|
119
|
+
return { kind: "yarn-workspaces" };
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
const pkg = JSON.parse(await promises_1.default.readFile(node_path_1.default.join(repoPath, "package.json"), "utf8"));
|
|
123
|
+
if (pkg.workspaces)
|
|
124
|
+
return { kind: "yarn-workspaces" };
|
|
125
|
+
}
|
|
126
|
+
catch { /* no package.json */ }
|
|
127
|
+
// Tier 3: root tsconfig.json (handles project references automatically)
|
|
128
|
+
const rootTsconfig = node_path_1.default.join(repoPath, "tsconfig.json");
|
|
129
|
+
if (await fileExists(rootTsconfig)) {
|
|
130
|
+
return { kind: "tsconfig-root", tsconfig: rootTsconfig };
|
|
131
|
+
}
|
|
132
|
+
// Tier 4: search one level deep in common monorepo dirs
|
|
133
|
+
const searchDirs = ["packages", "apps", "applications", "src"];
|
|
134
|
+
for (const dir of searchDirs) {
|
|
135
|
+
let entries;
|
|
136
|
+
try {
|
|
137
|
+
entries = await promises_1.default.readdir(node_path_1.default.join(repoPath, dir));
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
for (const entry of entries) {
|
|
143
|
+
const candidate = node_path_1.default.join(repoPath, dir, entry, "tsconfig.json");
|
|
144
|
+
if (await fileExists(candidate)) {
|
|
145
|
+
return { kind: "tsconfig-root", tsconfig: candidate };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return { kind: "fallback" };
|
|
150
|
+
}
|
|
103
151
|
/**
|
|
104
152
|
* Run the TypeScript/JavaScript SCIP indexer against repoPath.
|
|
105
|
-
*
|
|
153
|
+
* Auto-detects monorepo type and uses the appropriate scip-typescript flags.
|
|
106
154
|
* Returns the path to the generated .scip file.
|
|
107
155
|
*/
|
|
108
156
|
async function runTypescriptIndexer(repoPath) {
|
|
109
157
|
const outputPath = node_path_1.default.join(repoPath, ".ariadne", "index-ts.scip");
|
|
110
|
-
//
|
|
111
|
-
// This avoids a 5–10 min scip-typescript run when only the DB load needs to
|
|
112
|
-
// be re-done (e.g. after a crash during the loading phase).
|
|
158
|
+
// Reuse fresh index (< 24 h old)
|
|
113
159
|
try {
|
|
114
|
-
const
|
|
115
|
-
const ageMs = Date.now() - stat.mtimeMs;
|
|
160
|
+
const ageMs = Date.now() - (await promises_1.default.stat(outputPath)).mtimeMs;
|
|
116
161
|
if (ageMs < 24 * 60 * 60 * 1000) {
|
|
117
162
|
process.stderr.write("→ Reusing existing TypeScript SCIP index (< 24 h old).\n");
|
|
118
163
|
return outputPath;
|
|
119
164
|
}
|
|
120
165
|
}
|
|
121
|
-
catch {
|
|
122
|
-
|
|
166
|
+
catch { /* no existing index */ }
|
|
167
|
+
const strategy = await detectStrategy(repoPath);
|
|
168
|
+
const baseArgs = ["--yes", "@sourcegraph/scip-typescript", "index",
|
|
169
|
+
"--cwd", repoPath, "--output", outputPath];
|
|
170
|
+
let args;
|
|
171
|
+
switch (strategy.kind) {
|
|
172
|
+
case "pnpm-workspaces":
|
|
173
|
+
process.stderr.write("→ Indexing TypeScript/JavaScript files (pnpm workspaces)...\n");
|
|
174
|
+
args = [...baseArgs, "--pnpm-workspaces"];
|
|
175
|
+
break;
|
|
176
|
+
case "yarn-workspaces":
|
|
177
|
+
process.stderr.write("→ Indexing TypeScript/JavaScript files (yarn/npm workspaces)...\n");
|
|
178
|
+
args = [...baseArgs, "--yarn-workspaces"];
|
|
179
|
+
break;
|
|
180
|
+
case "tsconfig-root": {
|
|
181
|
+
const rel = node_path_1.default.relative(repoPath, strategy.tsconfig);
|
|
182
|
+
process.stderr.write(`→ Indexing TypeScript/JavaScript files (tsconfig: ${rel})...\n`);
|
|
183
|
+
args = [...baseArgs, strategy.tsconfig];
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
default:
|
|
187
|
+
process.stderr.write("→ Indexing TypeScript/JavaScript files...\n");
|
|
188
|
+
args = baseArgs;
|
|
123
189
|
}
|
|
124
|
-
|
|
125
|
-
// npx --yes auto-installs the package if not cached
|
|
126
|
-
await runSubprocess("npx", ["--yes", "@sourcegraph/scip-typescript", "index", "--output", outputPath], repoPath);
|
|
190
|
+
await runSubprocess("npx", args, repoPath);
|
|
127
191
|
await promises_1.default.access(outputPath);
|
|
128
192
|
return outputPath;
|
|
129
193
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scip-runner.js","sourceRoot":"","sources":["../../src/indexer/scip-runner.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;AAsDH,4CAoDC;
|
|
1
|
+
{"version":3,"file":"scip-runner.js","sourceRoot":"","sources":["../../src/indexer/scip-runner.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;AAsDH,4CAoDC;AAmED,oDAwCC;AAnND,2DAA2C;AAC3C,gEAAkC;AAClC,0DAA6B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,CAAC,CAAC;YAC1C,MAAM;QACR,KAAK,eAAe,CAAC,CAAC,CAAC;YACrB,MAAM,GAAG,GAAG,mBAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACvD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qDAAqD,GAAG,QAAQ,CAAC,CAAC;YACvF,IAAI,GAAG,CAAC,GAAG,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACxC,MAAM;QACR,CAAC;QACD;YACE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;YACpE,IAAI,GAAG,QAAQ,CAAC;IACpB,CAAC;IAED,MAAM,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,kBAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC5B,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAuBpE,wBAAgB,YAAY,IAAI,SAAS,CAwJxC"}
|
package/dist/server.js
CHANGED
|
@@ -22,7 +22,7 @@ function createServer() {
|
|
|
22
22
|
{ type: "text", text: await (0, index_js_1.handleGetDefinition)((0, db_js_1.getDb)(), { symbol, file }) },
|
|
23
23
|
],
|
|
24
24
|
}));
|
|
25
|
-
server.tool("get_callers", "List all call sites that invoke the given symbol.", { symbol: zod_1.z.string().describe("Symbol name to find callers for") }, async ({ symbol }) => ({
|
|
25
|
+
server.tool("get_callers", "List all call sites that invoke the given symbol. For classes, also returns import and registration sites (e.g. NestJS module registrations).", { symbol: zod_1.z.string().describe("Symbol name to find callers for") }, async ({ symbol }) => ({
|
|
26
26
|
content: [{ type: "text", text: await (0, index_js_1.handleGetCallers)((0, db_js_1.getDb)(), { symbol }) }],
|
|
27
27
|
}));
|
|
28
28
|
server.tool("get_callees", "List all symbols that the given symbol calls.", { symbol: zod_1.z.string().describe("Symbol name to find callees for") }, async ({ symbol }) => ({
|
|
@@ -45,8 +45,11 @@ function createServer() {
|
|
|
45
45
|
server.tool("get_references", "Find every place in the repo that references the given symbol.", { symbol: zod_1.z.string().describe("Symbol name to find references for") }, async ({ symbol }) => ({
|
|
46
46
|
content: [{ type: "text", text: await (0, index_js_1.handleGetReferences)((0, db_js_1.getDb)(), { symbol }) }],
|
|
47
47
|
}));
|
|
48
|
-
server.tool("get_file_symbols", "Return
|
|
49
|
-
|
|
48
|
+
server.tool("get_file_symbols", "Return every symbol defined in a file or directory. Pass a file path (e.g. src/auth/guard.ts) for a single file, or a directory path (e.g. src/modules/copilot) to get all symbols across every file in that directory. Use the optional 'query' param to filter by name (e.g. query='password' returns only symbols whose name contains 'password').", {
|
|
49
|
+
file: zod_1.z.string().describe("Repo-relative path to a file or directory"),
|
|
50
|
+
query: zod_1.z.string().optional().describe("Optional: filter symbols by name (case-insensitive substring match)"),
|
|
51
|
+
}, async ({ file, query }) => ({
|
|
52
|
+
content: [{ type: "text", text: await (0, index_js_1.handleGetFileSymbols)((0, db_js_1.getDb)(), { file, query }) }],
|
|
50
53
|
}));
|
|
51
54
|
server.tool("get_type_definition", "Best-effort: find the type or interface that a symbol references.", { symbol: zod_1.z.string().describe("Symbol name to look up the type for") }, async ({ symbol }) => ({
|
|
52
55
|
content: [
|
|
@@ -69,6 +72,15 @@ function createServer() {
|
|
|
69
72
|
"If state is not 'ready', tell the user the index is still being built and they should wait.", {}, async () => ({
|
|
70
73
|
content: [{ type: "text", text: (0, index_js_1.handleGetIndexStatus)() }],
|
|
71
74
|
}));
|
|
75
|
+
server.tool("find_symbol", "Fuzzy search for symbols by name across the entire codebase. Use when you don't know the exact symbol name — e.g. find_symbol('password') returns all symbols whose name contains 'password'. Replaces glob patterns like **/*password*.", { query: zod_1.z.string().describe("Substring to search for in symbol names (case-insensitive)") }, async ({ query }) => ({
|
|
76
|
+
content: [{ type: "text", text: await (0, index_js_1.handleFindSymbol)((0, db_js_1.getDb)(), { query }) }],
|
|
77
|
+
}));
|
|
78
|
+
server.tool("get_importers", "Find all files that import a given file. Use this to trace usage upward through the module tree — e.g. get_importers('src/services/auth-service.ts') shows every file that imports it.", { file: zod_1.z.string().describe("Repo-relative path to the file") }, async ({ file }) => ({
|
|
79
|
+
content: [{ type: "text", text: await (0, index_js_1.handleGetImporters)((0, db_js_1.getDb)(), { file }) }],
|
|
80
|
+
}));
|
|
81
|
+
server.tool("search_files", "Find all indexed files whose path matches a pattern. Supports * (any chars) and ** (any path segment). E.g. search_files('**/*password*') finds all files with 'password' in the name. Replaces glob.", { pattern: zod_1.z.string().describe("Glob-style pattern (e.g. **/*password*, src/modules/**)") }, async ({ pattern }) => ({
|
|
82
|
+
content: [{ type: "text", text: await (0, index_js_1.handleSearchFiles)((0, db_js_1.getDb)(), { pattern }) }],
|
|
83
|
+
}));
|
|
72
84
|
return server;
|
|
73
85
|
}
|
|
74
86
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;AAwBA,oCAwJC;AAhLD,6DAA6D;AAC7D,oEAAoE;AACpE,6BAAwB;AACxB,yCAAsC;AACtC,+CAc0B;AAE1B,mFAAmF;AACnF,gFAAgF;AAChF,yFAAyF;AAEzF,SAAgB,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;QAC3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MAAuM,EACvM,EAAE,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC,EAAE,EAC3F,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QACtB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,IAAA,4BAAiB,EAAC,IAAA,aAAK,GAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;KAC1F,CAAC,CACH,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Database } from "../graph/db.js";
|
|
2
|
+
export declare const FIND_SYMBOL_TOOL: {
|
|
3
|
+
readonly name: "find_symbol";
|
|
4
|
+
readonly description: "Fuzzy search for symbols by name across the entire codebase. Use this when you don't know the exact symbol name — e.g. find_symbol('password') returns all symbols whose name contains 'password'. Replaces glob patterns like **/*password*.";
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly query: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly description: "Substring to search for in symbol names (case-insensitive)";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
readonly required: readonly ["query"];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function handleFindSymbol(db: Database.Database, args: {
|
|
17
|
+
query: string;
|
|
18
|
+
}): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=find-symbol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-symbol.d.ts","sourceRoot":"","sources":["../../src/tools/find-symbol.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI/C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAUnB,CAAC;AAEX,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC,MAAM,CAAC,CAMjB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FIND_SYMBOL_TOOL = void 0;
|
|
4
|
+
exports.handleFindSymbol = handleFindSymbol;
|
|
5
|
+
const queries_js_1 = require("../graph/queries.js");
|
|
6
|
+
const format_js_1 = require("./format.js");
|
|
7
|
+
exports.FIND_SYMBOL_TOOL = {
|
|
8
|
+
name: "find_symbol",
|
|
9
|
+
description: "Fuzzy search for symbols by name across the entire codebase. Use this when you don't know the exact symbol name — e.g. find_symbol('password') returns all symbols whose name contains 'password'. Replaces glob patterns like **/*password*.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
query: { type: "string", description: "Substring to search for in symbol names (case-insensitive)" },
|
|
14
|
+
},
|
|
15
|
+
required: ["query"],
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
async function handleFindSymbol(db, args) {
|
|
19
|
+
const results = await (0, queries_js_1.findSymbol)(db, args.query);
|
|
20
|
+
if (results.length === 0)
|
|
21
|
+
return `No symbols found matching "${args.query}".`;
|
|
22
|
+
const { items, note } = (0, format_js_1.cap)(results, "symbols");
|
|
23
|
+
const out = items.map(format_js_1.fmtSymbol);
|
|
24
|
+
return JSON.stringify(note ? { note, symbols: out } : out, null, 2);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=find-symbol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-symbol.js","sourceRoot":"","sources":["../../src/tools/find-symbol.ts"],"names":[],"mappings":";;;AAiBA,4CASC;AAxBD,oDAAiD;AACjD,2CAA6C;AAEhC,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,+OAA+O;IAC5P,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4DAA4D,EAAE;SACrG;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB;CACO,CAAC;AAEJ,KAAK,UAAU,gBAAgB,CACpC,EAAqB,EACrB,IAAuB;IAEvB,MAAM,OAAO,GAAG,MAAM,IAAA,uBAAU,EAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,8BAA8B,IAAI,CAAC,KAAK,IAAI,CAAC;IAC9E,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAA,eAAG,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,qBAAS,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { Database } from "../graph/db.js";
|
|
2
2
|
export declare const GET_FILE_SYMBOLS_TOOL: {
|
|
3
3
|
readonly name: "get_file_symbols";
|
|
4
|
-
readonly description: "Return
|
|
4
|
+
readonly description: "Return every symbol defined in a file or directory. Pass a file path (e.g. src/auth/guard.ts) for a single file, or a directory path (e.g. src/modules/copilot) to get all symbols across every file in that directory. Use the optional 'query' param to filter by name (e.g. query='password' returns only symbols whose name contains 'password').";
|
|
5
5
|
readonly inputSchema: {
|
|
6
6
|
readonly type: "object";
|
|
7
7
|
readonly properties: {
|
|
8
8
|
readonly file: {
|
|
9
9
|
readonly type: "string";
|
|
10
|
-
readonly description: "Repo-relative path to
|
|
10
|
+
readonly description: "Repo-relative path to a file or directory";
|
|
11
|
+
};
|
|
12
|
+
readonly query: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly description: "Optional: filter symbols by name (case-insensitive substring match)";
|
|
11
15
|
};
|
|
12
16
|
};
|
|
13
17
|
readonly required: readonly ["file"];
|
|
@@ -15,5 +19,6 @@ export declare const GET_FILE_SYMBOLS_TOOL: {
|
|
|
15
19
|
};
|
|
16
20
|
export declare function handleGetFileSymbols(db: Database.Database, args: {
|
|
17
21
|
file: string;
|
|
22
|
+
query?: string;
|
|
18
23
|
}): Promise<string>;
|
|
19
24
|
//# sourceMappingURL=get-file-symbols.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-symbols.d.ts","sourceRoot":"","sources":["../../src/tools/get-file-symbols.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-file-symbols.d.ts","sourceRoot":"","sources":["../../src/tools/get-file-symbols.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI/C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;CAWxB,CAAC;AAEX,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,MAAM,CAAC,CA0BjB"}
|
|
@@ -1,28 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.GET_FILE_SYMBOLS_TOOL = void 0;
|
|
4
7
|
exports.handleGetFileSymbols = handleGetFileSymbols;
|
|
8
|
+
// MCP tool: get_file_symbols
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
5
10
|
const queries_js_1 = require("../graph/queries.js");
|
|
6
11
|
const format_js_1 = require("./format.js");
|
|
7
12
|
exports.GET_FILE_SYMBOLS_TOOL = {
|
|
8
13
|
name: "get_file_symbols",
|
|
9
|
-
description: "Return
|
|
14
|
+
description: "Return every symbol defined in a file or directory. Pass a file path (e.g. src/auth/guard.ts) for a single file, or a directory path (e.g. src/modules/copilot) to get all symbols across every file in that directory. Use the optional 'query' param to filter by name (e.g. query='password' returns only symbols whose name contains 'password').",
|
|
10
15
|
inputSchema: {
|
|
11
16
|
type: "object",
|
|
12
17
|
properties: {
|
|
13
|
-
file: { type: "string", description: "Repo-relative path to
|
|
18
|
+
file: { type: "string", description: "Repo-relative path to a file or directory" },
|
|
19
|
+
query: { type: "string", description: "Optional: filter symbols by name (case-insensitive substring match)" },
|
|
14
20
|
},
|
|
15
21
|
required: ["file"],
|
|
16
22
|
},
|
|
17
23
|
};
|
|
18
24
|
async function handleGetFileSymbols(db, args) {
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
let results
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
const input = args.file;
|
|
26
|
+
const isDir = !node_path_1.default.extname(input);
|
|
27
|
+
let results;
|
|
28
|
+
if (isDir) {
|
|
29
|
+
const absDir = input.startsWith("/") ? input : node_path_1.default.join(process.cwd(), input);
|
|
30
|
+
results = await (0, queries_js_1.getDirectorySymbols)(db, absDir);
|
|
31
|
+
if (results.length === 0)
|
|
32
|
+
results = await (0, queries_js_1.getDirectorySymbols)(db, input);
|
|
33
|
+
if (results.length === 0)
|
|
34
|
+
return `No symbols found under "${input}".`;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const absFile = input.startsWith("/") ? input : node_path_1.default.join(process.cwd(), input);
|
|
38
|
+
results = await (0, queries_js_1.getFileSymbols)(db, absFile);
|
|
39
|
+
if (results.length === 0)
|
|
40
|
+
results = await (0, queries_js_1.getFileSymbols)(db, input);
|
|
41
|
+
if (results.length === 0)
|
|
42
|
+
return `No symbols found in "${input}". The file may not have been indexed, or the path may be incorrect.`;
|
|
43
|
+
}
|
|
44
|
+
if (args.query) {
|
|
45
|
+
const q = args.query.toLowerCase();
|
|
46
|
+
results = results.filter((s) => s.name.toLowerCase().includes(q));
|
|
47
|
+
if (results.length === 0)
|
|
48
|
+
return `No symbols matching "${args.query}" found in "${input}".`;
|
|
26
49
|
}
|
|
27
50
|
const { items, note } = (0, format_js_1.cap)(results, "symbols");
|
|
28
51
|
const out = items.map(format_js_1.fmtSymbol);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-symbols.js","sourceRoot":"","sources":["../../src/tools/get-file-symbols.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-file-symbols.js","sourceRoot":"","sources":["../../src/tools/get-file-symbols.ts"],"names":[],"mappings":";;;;;;AAmBA,oDA6BC;AAhDD,6BAA6B;AAC7B,0DAA6B;AAE7B,oDAA0E;AAC1E,2CAA6C;AAEhC,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,uVAAuV;IACpW,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2CAA2C,EAAE;YACnF,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qEAAqE,EAAE;SAC9G;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;CACO,CAAC;AAEJ,KAAK,UAAU,oBAAoB,CACxC,EAAqB,EACrB,IAAsC;IAEtC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;IACxB,MAAM,KAAK,GAAG,CAAC,mBAAI,CAAC,OAAO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QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,wBAAwB,IAAI,CAAC,KAAK,eAAe,KAAK,IAAI,CAAC;IAC9F,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAA,eAAG,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,qBAAS,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Database } from "../graph/db.js";
|
|
2
|
+
export declare const GET_IMPORTERS_TOOL: {
|
|
3
|
+
readonly name: "get_importers";
|
|
4
|
+
readonly description: "Find all files that import a given file. Use this to trace usage upward through the module tree — e.g. get_importers('src/services/auth-service.ts') shows every file that imports it.";
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly file: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly description: "Repo-relative path to the file";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
readonly required: readonly ["file"];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function handleGetImporters(db: Database.Database, args: {
|
|
17
|
+
file: string;
|
|
18
|
+
}): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=get-importers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-importers.d.ts","sourceRoot":"","sources":["../../src/tools/get-importers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI/C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;CAUrB,CAAC;AAEX,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GACrB,OAAO,CAAC,MAAM,CAAC,CAUjB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_IMPORTERS_TOOL = void 0;
|
|
4
|
+
exports.handleGetImporters = handleGetImporters;
|
|
5
|
+
const queries_js_1 = require("../graph/queries.js");
|
|
6
|
+
const format_js_1 = require("./format.js");
|
|
7
|
+
exports.GET_IMPORTERS_TOOL = {
|
|
8
|
+
name: "get_importers",
|
|
9
|
+
description: "Find all files that import a given file. Use this to trace usage upward through the module tree — e.g. get_importers('src/services/auth-service.ts') shows every file that imports it.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
file: { type: "string", description: "Repo-relative path to the file" },
|
|
14
|
+
},
|
|
15
|
+
required: ["file"],
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
async function handleGetImporters(db, args) {
|
|
19
|
+
const absFile = args.file.startsWith("/") ? args.file : `${process.cwd()}/${args.file}`;
|
|
20
|
+
let results = await (0, queries_js_1.getImporters)(db, absFile);
|
|
21
|
+
if (results.length === 0)
|
|
22
|
+
results = await (0, queries_js_1.getImporters)(db, args.file);
|
|
23
|
+
if (results.length === 0)
|
|
24
|
+
return `No importers found for "${args.file}".`;
|
|
25
|
+
const callSites = results.map((r) => ({ caller: r.symbol, line: r.line }));
|
|
26
|
+
const { items, note } = (0, format_js_1.cap)(callSites, "importers");
|
|
27
|
+
const out = items.map(format_js_1.fmtCallSite);
|
|
28
|
+
return JSON.stringify(note ? { note, importers: out } : out, null, 2);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=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AS,EAAE,WAAW,CAAC,CAAC;IACpD,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,uBAAW,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export { GET_FILE_SYMBOLS_TOOL, handleGetFileSymbols } from "./get-file-symbols.
|
|
|
8
8
|
export { GET_TYPE_DEFINITION_TOOL, handleGetTypeDefinition } from "./get-type-definition.js";
|
|
9
9
|
export { GET_SOURCE_DEFINITION_TOOL, handleGetSourceDefinition } from "./get-source-definition.js";
|
|
10
10
|
export { GET_INDEX_STATUS_TOOL, handleGetIndexStatus } from "./get-index-status.js";
|
|
11
|
+
export { FIND_SYMBOL_TOOL, handleFindSymbol } from "./find-symbol.js";
|
|
12
|
+
export { GET_IMPORTERS_TOOL, handleGetImporters } from "./get-importers.js";
|
|
13
|
+
export { SEARCH_FILES_TOOL, handleSearchFiles } from "./search-files.js";
|
|
11
14
|
export declare const ALL_TOOLS: ({
|
|
12
15
|
readonly name: "get_definition";
|
|
13
16
|
readonly description: "Find where a symbol is defined — returns its file, line, and signature.";
|
|
@@ -96,13 +99,17 @@ export declare const ALL_TOOLS: ({
|
|
|
96
99
|
};
|
|
97
100
|
} | {
|
|
98
101
|
readonly name: "get_file_symbols";
|
|
99
|
-
readonly description: "Return
|
|
102
|
+
readonly description: "Return every symbol defined in a file or directory. Pass a file path (e.g. src/auth/guard.ts) for a single file, or a directory path (e.g. src/modules/copilot) to get all symbols across every file in that directory. Use the optional 'query' param to filter by name (e.g. query='password' returns only symbols whose name contains 'password').";
|
|
100
103
|
readonly inputSchema: {
|
|
101
104
|
readonly type: "object";
|
|
102
105
|
readonly properties: {
|
|
103
106
|
readonly file: {
|
|
104
107
|
readonly type: "string";
|
|
105
|
-
readonly description: "Repo-relative path to
|
|
108
|
+
readonly description: "Repo-relative path to a file or directory";
|
|
109
|
+
};
|
|
110
|
+
readonly query: {
|
|
111
|
+
readonly type: "string";
|
|
112
|
+
readonly description: "Optional: filter symbols by name (case-insensitive substring match)";
|
|
106
113
|
};
|
|
107
114
|
};
|
|
108
115
|
readonly required: readonly ["file"];
|
|
@@ -145,5 +152,44 @@ export declare const ALL_TOOLS: ({
|
|
|
145
152
|
readonly properties: {};
|
|
146
153
|
readonly required: readonly [];
|
|
147
154
|
};
|
|
155
|
+
} | {
|
|
156
|
+
readonly name: "find_symbol";
|
|
157
|
+
readonly description: "Fuzzy search for symbols by name across the entire codebase. Use this when you don't know the exact symbol name — e.g. find_symbol('password') returns all symbols whose name contains 'password'. Replaces glob patterns like **/*password*.";
|
|
158
|
+
readonly inputSchema: {
|
|
159
|
+
readonly type: "object";
|
|
160
|
+
readonly properties: {
|
|
161
|
+
readonly query: {
|
|
162
|
+
readonly type: "string";
|
|
163
|
+
readonly description: "Substring to search for in symbol names (case-insensitive)";
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
readonly required: readonly ["query"];
|
|
167
|
+
};
|
|
168
|
+
} | {
|
|
169
|
+
readonly name: "get_importers";
|
|
170
|
+
readonly description: "Find all files that import a given file. Use this to trace usage upward through the module tree — e.g. get_importers('src/services/auth-service.ts') shows every file that imports it.";
|
|
171
|
+
readonly inputSchema: {
|
|
172
|
+
readonly type: "object";
|
|
173
|
+
readonly properties: {
|
|
174
|
+
readonly file: {
|
|
175
|
+
readonly type: "string";
|
|
176
|
+
readonly description: "Repo-relative path to the file";
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
readonly required: readonly ["file"];
|
|
180
|
+
};
|
|
181
|
+
} | {
|
|
182
|
+
readonly name: "search_files";
|
|
183
|
+
readonly description: "Find all indexed files whose path matches a pattern. Supports * (any chars) and ** (any path segment). E.g. search_files('**/*password*') finds all files with 'password' in the name. Replaces glob.";
|
|
184
|
+
readonly inputSchema: {
|
|
185
|
+
readonly type: "object";
|
|
186
|
+
readonly properties: {
|
|
187
|
+
readonly pattern: {
|
|
188
|
+
readonly type: "string";
|
|
189
|
+
readonly description: "Glob-style pattern (e.g. **/*password*, src/modules/**)";
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
readonly required: readonly ["pattern"];
|
|
193
|
+
};
|
|
148
194
|
})[];
|
|
149
195
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,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IndexStatus = exports.GET_INDEX_STATUS_TOOL = exports.handleGetSourceDefinition = exports.GET_SOURCE_DEFINITION_TOOL = exports.handleGetTypeDefinition = exports.GET_TYPE_DEFINITION_TOOL = exports.handleGetFileSymbols = exports.GET_FILE_SYMBOLS_TOOL = exports.handleGetReferences = exports.GET_REFERENCES_TOOL = exports.handleGetCallPath = exports.GET_CALL_PATH_TOOL = exports.handleGetImplementations = exports.GET_IMPLEMENTATIONS_TOOL = exports.handleGetCallees = exports.GET_CALLEES_TOOL = exports.handleGetCallers = exports.GET_CALLERS_TOOL = exports.handleGetDefinition = exports.GET_DEFINITION_TOOL = void 0;
|
|
3
|
+
exports.ALL_TOOLS = exports.handleSearchFiles = exports.SEARCH_FILES_TOOL = exports.handleGetImporters = exports.GET_IMPORTERS_TOOL = exports.handleFindSymbol = exports.FIND_SYMBOL_TOOL = exports.handleGetIndexStatus = exports.GET_INDEX_STATUS_TOOL = exports.handleGetSourceDefinition = exports.GET_SOURCE_DEFINITION_TOOL = exports.handleGetTypeDefinition = exports.GET_TYPE_DEFINITION_TOOL = exports.handleGetFileSymbols = exports.GET_FILE_SYMBOLS_TOOL = exports.handleGetReferences = exports.GET_REFERENCES_TOOL = exports.handleGetCallPath = exports.GET_CALL_PATH_TOOL = exports.handleGetImplementations = exports.GET_IMPLEMENTATIONS_TOOL = exports.handleGetCallees = exports.GET_CALLEES_TOOL = exports.handleGetCallers = exports.GET_CALLERS_TOOL = exports.handleGetDefinition = exports.GET_DEFINITION_TOOL = void 0;
|
|
4
4
|
// Barrel: re-export all tool definitions and handlers.
|
|
5
5
|
var get_definition_js_1 = require("./get-definition.js");
|
|
6
6
|
Object.defineProperty(exports, "GET_DEFINITION_TOOL", { enumerable: true, get: function () { return get_definition_js_1.GET_DEFINITION_TOOL; } });
|
|
@@ -32,6 +32,15 @@ Object.defineProperty(exports, "handleGetSourceDefinition", { enumerable: true,
|
|
|
32
32
|
var get_index_status_js_1 = require("./get-index-status.js");
|
|
33
33
|
Object.defineProperty(exports, "GET_INDEX_STATUS_TOOL", { enumerable: true, get: function () { return get_index_status_js_1.GET_INDEX_STATUS_TOOL; } });
|
|
34
34
|
Object.defineProperty(exports, "handleGetIndexStatus", { enumerable: true, get: function () { return get_index_status_js_1.handleGetIndexStatus; } });
|
|
35
|
+
var find_symbol_js_1 = require("./find-symbol.js");
|
|
36
|
+
Object.defineProperty(exports, "FIND_SYMBOL_TOOL", { enumerable: true, get: function () { return find_symbol_js_1.FIND_SYMBOL_TOOL; } });
|
|
37
|
+
Object.defineProperty(exports, "handleFindSymbol", { enumerable: true, get: function () { return find_symbol_js_1.handleFindSymbol; } });
|
|
38
|
+
var get_importers_js_1 = require("./get-importers.js");
|
|
39
|
+
Object.defineProperty(exports, "GET_IMPORTERS_TOOL", { enumerable: true, get: function () { return get_importers_js_1.GET_IMPORTERS_TOOL; } });
|
|
40
|
+
Object.defineProperty(exports, "handleGetImporters", { enumerable: true, get: function () { return get_importers_js_1.handleGetImporters; } });
|
|
41
|
+
var search_files_js_1 = require("./search-files.js");
|
|
42
|
+
Object.defineProperty(exports, "SEARCH_FILES_TOOL", { enumerable: true, get: function () { return search_files_js_1.SEARCH_FILES_TOOL; } });
|
|
43
|
+
Object.defineProperty(exports, "handleSearchFiles", { enumerable: true, get: function () { return search_files_js_1.handleSearchFiles; } });
|
|
35
44
|
const get_definition_js_2 = require("./get-definition.js");
|
|
36
45
|
const get_callers_js_2 = require("./get-callers.js");
|
|
37
46
|
const get_callees_js_2 = require("./get-callees.js");
|
|
@@ -42,6 +51,9 @@ const get_file_symbols_js_2 = require("./get-file-symbols.js");
|
|
|
42
51
|
const get_type_definition_js_2 = require("./get-type-definition.js");
|
|
43
52
|
const get_source_definition_js_2 = require("./get-source-definition.js");
|
|
44
53
|
const get_index_status_js_2 = require("./get-index-status.js");
|
|
54
|
+
const find_symbol_js_2 = require("./find-symbol.js");
|
|
55
|
+
const get_importers_js_2 = require("./get-importers.js");
|
|
56
|
+
const search_files_js_2 = require("./search-files.js");
|
|
45
57
|
exports.ALL_TOOLS = [
|
|
46
58
|
get_definition_js_2.GET_DEFINITION_TOOL,
|
|
47
59
|
get_callers_js_2.GET_CALLERS_TOOL,
|
|
@@ -53,5 +65,8 @@ exports.ALL_TOOLS = [
|
|
|
53
65
|
get_type_definition_js_2.GET_TYPE_DEFINITION_TOOL,
|
|
54
66
|
get_source_definition_js_2.GET_SOURCE_DEFINITION_TOOL,
|
|
55
67
|
get_index_status_js_2.GET_INDEX_STATUS_TOOL,
|
|
68
|
+
find_symbol_js_2.FIND_SYMBOL_TOOL,
|
|
69
|
+
get_importers_js_2.GET_IMPORTERS_TOOL,
|
|
70
|
+
search_files_js_2.SEARCH_FILES_TOOL,
|
|
56
71
|
];
|
|
57
72
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,yDAA+E;AAAtE,wHAAA,mBAAmB,OAAA;AAAE,wHAAA,mBAAmB,OAAA;AACjD,mDAAsE;AAA7D,kHAAA,gBAAgB,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAC3C,mDAAsE;AAA7D,kHAAA,gBAAgB,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAC3C,mEAA8F;AAArF,kIAAA,wBAAwB,OAAA;AAAE,kIAAA,wBAAwB,OAAA;AAC3D,uDAA2E;AAAlE,sHAAA,kBAAkB,OAAA;AAAE,qHAAA,iBAAiB,OAAA;AAC9C,yDAA+E;AAAtE,wHAAA,mBAAmB,OAAA;AAAE,wHAAA,mBAAmB,OAAA;AACjD,6DAAoF;AAA3E,4HAAA,qBAAqB,OAAA;AAAE,2HAAA,oBAAoB,OAAA;AACpD,mEAA6F;AAApF,kIAAA,wBAAwB,OAAA;AAAE,iIAAA,uBAAuB,OAAA;AAC1D,uEAAmG;AAA1F,sIAAA,0BAA0B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;AAC9D,qEAAoE;AACpE,yEAAwE;AACxE,+DAA8D;AAC9D,qDAAoD;AACpD,yDAAwD;AACxD,uDAAsD;AAEzC,QAAA,SAAS,GAAG;IACvB,uCAAmB;IACnB,iCAAgB;IAChB,iCAAgB;IAChB,iDAAwB;IACxB,qCAAkB;IAClB,uCAAmB;IACnB,2CAAqB;IACrB,iDAAwB;IACxB,qDAA0B;IAC1B,2CAAqB;IACrB,iCAAgB;IAChB,qCAAkB;IAClB,mCAAiB;CAClB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Database } from "../graph/db.js";
|
|
2
|
+
export declare const SEARCH_FILES_TOOL: {
|
|
3
|
+
readonly name: "search_files";
|
|
4
|
+
readonly description: "Find all indexed files whose path matches a pattern. Supports * (any chars) and ** (any path segment). E.g. search_files('**/*password*') finds all files with 'password' in the name. Replaces glob.";
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly pattern: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly description: "Glob-style pattern (e.g. **/*password*, src/modules/**)";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
readonly required: readonly ["pattern"];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function handleSearchFiles(db: Database.Database, args: {
|
|
17
|
+
pattern: string;
|
|
18
|
+
}): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=search-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-files.d.ts","sourceRoot":"","sources":["../../src/tools/search-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;CAUpB,CAAC;AAEX,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACxB,OAAO,CAAC,MAAM,CAAC,CAIjB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SEARCH_FILES_TOOL = void 0;
|
|
4
|
+
exports.handleSearchFiles = handleSearchFiles;
|
|
5
|
+
const queries_js_1 = require("../graph/queries.js");
|
|
6
|
+
exports.SEARCH_FILES_TOOL = {
|
|
7
|
+
name: "search_files",
|
|
8
|
+
description: "Find all indexed files whose path matches a pattern. Supports * (any chars) and ** (any path segment). E.g. search_files('**/*password*') finds all files with 'password' in the name. Replaces glob.",
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
pattern: { type: "string", description: "Glob-style pattern (e.g. **/*password*, src/modules/**)" },
|
|
13
|
+
},
|
|
14
|
+
required: ["pattern"],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
async function handleSearchFiles(db, args) {
|
|
18
|
+
const results = await (0, queries_js_1.searchFiles)(db, args.pattern);
|
|
19
|
+
if (results.length === 0)
|
|
20
|
+
return `No files found matching "${args.pattern}".`;
|
|
21
|
+
return JSON.stringify(results, null, 2);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=search-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-files.js","sourceRoot":"","sources":["../../src/tools/search-files.ts"],"names":[],"mappings":";;;AAgBA,8CAOC;AArBD,oDAAkD;AAErC,QAAA,iBAAiB,GAAG;IAC/B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,uMAAuM;IACpN,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yDAAyD,EAAE;SACpG;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;CACO,CAAC;AAEJ,KAAK,UAAU,iBAAiB,CACrC,EAAqB,EACrB,IAAyB;IAEzB,MAAM,OAAO,GAAG,MAAM,IAAA,wBAAW,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACpD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,4BAA4B,IAAI,CAAC,OAAO,IAAI,CAAC;IAC9E,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ariadne-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "MCP server that gives coding agents a structural map of a codebase",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,23 +25,25 @@
|
|
|
25
25
|
],
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/Madan2248c/ariadne.git"
|
|
29
29
|
},
|
|
30
|
-
"homepage": "https://github.com/
|
|
30
|
+
"homepage": "https://github.com/Madan2248c/ariadne#readme",
|
|
31
31
|
"bugs": {
|
|
32
|
-
"url": "https://github.com/
|
|
32
|
+
"url": "https://github.com/Madan2248c/ariadne/issues"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsc",
|
|
36
36
|
"dev": "tsc --watch",
|
|
37
37
|
"start": "node dist/index.js",
|
|
38
38
|
"clean": "rm -rf dist",
|
|
39
|
+
"lint": "eslint src/",
|
|
40
|
+
"smoke": "npx tsx scripts/smoke-test.ts",
|
|
39
41
|
"prepublishOnly": "npm run clean && npm run build"
|
|
40
42
|
},
|
|
41
43
|
"dependencies": {
|
|
42
44
|
"@modelcontextprotocol/sdk": "^1.10.1",
|
|
43
|
-
"better-sqlite3": "^11.9.1",
|
|
44
45
|
"@types/google-protobuf": "^3.15.12",
|
|
46
|
+
"better-sqlite3": "^11.9.1",
|
|
45
47
|
"chokidar": "^3.6.0",
|
|
46
48
|
"google-protobuf": "^3.21.4",
|
|
47
49
|
"tree-sitter": "^0.21.1",
|
|
@@ -50,10 +52,15 @@
|
|
|
50
52
|
"tree-sitter-typescript": "^0.21.2"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
55
|
+
"@eslint/js": "^10.0.1",
|
|
53
56
|
"@types/better-sqlite3": "^7.6.13",
|
|
54
57
|
"@types/node": "^22.0.0",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.58.2",
|
|
59
|
+
"@typescript-eslint/parser": "^8.58.2",
|
|
60
|
+
"eslint": "^10.2.0",
|
|
55
61
|
"tsx": "^4.21.0",
|
|
56
|
-
"typescript": "^5.7.0"
|
|
62
|
+
"typescript": "^5.7.0",
|
|
63
|
+
"typescript-eslint": "^8.58.2"
|
|
57
64
|
},
|
|
58
65
|
"engines": {
|
|
59
66
|
"node": ">=20.0.0"
|