remem-mcp 0.5.17
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 +235 -0
- package/dist/chunk-34TEZ5U4.js +1676 -0
- package/dist/chunk-34TEZ5U4.js.map +1 -0
- package/dist/chunk-RITPZHIB.js +475 -0
- package/dist/chunk-RITPZHIB.js.map +1 -0
- package/dist/engine-ZNZRRSBV.js +25 -0
- package/dist/engine-ZNZRRSBV.js.map +1 -0
- package/dist/index.js +12625 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk.js +41 -0
- package/dist/sdk.js.map +1 -0
- package/dist/storage/schema.sql +292 -0
- package/package.json +82 -0
- package/scripts/bench-all.sh +147 -0
- package/scripts/cast-to-mp4.py +264 -0
- package/scripts/loop-bench.sh +179 -0
- package/scripts/loop-longmemeval.sh +159 -0
- package/scripts/loop-mem0-bench.sh +310 -0
- package/scripts/merge-casts.py +131 -0
- package/scripts/postinstall.js +51 -0
- package/skills/remem-mcp/SKILL.md +562 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __esm = (fn, res) => function __init() {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
};
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// node_modules/tsup/assets/esm_shims.js
|
|
23
|
+
import path from "path";
|
|
24
|
+
import { fileURLToPath } from "url";
|
|
25
|
+
var getFilename, getDirname, __dirname;
|
|
26
|
+
var init_esm_shims = __esm({
|
|
27
|
+
"node_modules/tsup/assets/esm_shims.js"() {
|
|
28
|
+
"use strict";
|
|
29
|
+
getFilename = () => fileURLToPath(import.meta.url);
|
|
30
|
+
getDirname = () => path.dirname(getFilename());
|
|
31
|
+
__dirname = /* @__PURE__ */ getDirname();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// src/codegraph/engine.ts
|
|
36
|
+
init_esm_shims();
|
|
37
|
+
import { createHash } from "crypto";
|
|
38
|
+
import { readdirSync, readFileSync, statSync } from "fs";
|
|
39
|
+
import { extname, join, relative, sep } from "path";
|
|
40
|
+
|
|
41
|
+
// src/utils/ulid.ts
|
|
42
|
+
init_esm_shims();
|
|
43
|
+
import { ulid } from "ulid";
|
|
44
|
+
function generateId() {
|
|
45
|
+
return ulid();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/codegraph/engine.ts
|
|
49
|
+
var _pack = null;
|
|
50
|
+
async function getPack() {
|
|
51
|
+
if (!_pack) {
|
|
52
|
+
const mod = await import("@kreuzberg/tree-sitter-language-pack");
|
|
53
|
+
_pack = mod.default ?? mod;
|
|
54
|
+
}
|
|
55
|
+
return _pack;
|
|
56
|
+
}
|
|
57
|
+
var EXTENSION_MAP = {
|
|
58
|
+
".ts": "typescript",
|
|
59
|
+
".tsx": "tsx",
|
|
60
|
+
".js": "javascript",
|
|
61
|
+
".jsx": "javascript",
|
|
62
|
+
".mjs": "javascript",
|
|
63
|
+
".cjs": "javascript",
|
|
64
|
+
".py": "python",
|
|
65
|
+
".go": "go",
|
|
66
|
+
".rs": "rust",
|
|
67
|
+
".java": "java",
|
|
68
|
+
".c": "c",
|
|
69
|
+
".h": "c",
|
|
70
|
+
".cpp": "cpp",
|
|
71
|
+
".cc": "cpp",
|
|
72
|
+
".cxx": "cpp",
|
|
73
|
+
".hpp": "cpp",
|
|
74
|
+
".cs": "csharp"
|
|
75
|
+
};
|
|
76
|
+
var SUPPORTED_LANGUAGES = new Set(Object.values(EXTENSION_MAP));
|
|
77
|
+
function detectLanguage(filePath) {
|
|
78
|
+
const ext = extname(filePath).toLowerCase();
|
|
79
|
+
return EXTENSION_MAP[ext] ?? null;
|
|
80
|
+
}
|
|
81
|
+
async function parseFile(filePath, repoPath) {
|
|
82
|
+
const language = detectLanguage(filePath);
|
|
83
|
+
if (!language) return null;
|
|
84
|
+
const pack = await getPack();
|
|
85
|
+
if (!pack.hasLanguage(language)) return null;
|
|
86
|
+
let source;
|
|
87
|
+
try {
|
|
88
|
+
source = readFileSync(filePath, "utf-8");
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
const result = pack.process(source, { language });
|
|
93
|
+
if (!result) return null;
|
|
94
|
+
const relPath = relative(repoPath, filePath).split(sep).join("/");
|
|
95
|
+
const symbols = [];
|
|
96
|
+
const calls = [];
|
|
97
|
+
const imports = [];
|
|
98
|
+
const extractSymbols = (items, parentId) => {
|
|
99
|
+
for (const item of items) {
|
|
100
|
+
if (!item.name) continue;
|
|
101
|
+
const id = generateId();
|
|
102
|
+
const lineStart = (item.span?.startLine ?? 0) + 1;
|
|
103
|
+
const lineEnd = (item.span?.endLine ?? lineStart) + 1;
|
|
104
|
+
const _bodyText = source.slice(
|
|
105
|
+
item.span?.startLine !== void 0 ? source.split("\n").slice(0, item.span.startLine).join("\n").length + 1 : 0,
|
|
106
|
+
item.span?.endLine !== void 0 ? source.split("\n").slice(0, item.span.endLine + 1).join("\n").length : source.length
|
|
107
|
+
);
|
|
108
|
+
symbols.push({
|
|
109
|
+
id,
|
|
110
|
+
name: item.name,
|
|
111
|
+
kind: item.kind ?? "unknown",
|
|
112
|
+
filePath: relPath,
|
|
113
|
+
lineStart,
|
|
114
|
+
lineEnd,
|
|
115
|
+
language,
|
|
116
|
+
signature: item.signature ?? null,
|
|
117
|
+
docstring: item.docComment ?? null,
|
|
118
|
+
parentId,
|
|
119
|
+
contentHash: createHash("sha256").update(item.name + relPath + lineStart).digest("hex")
|
|
120
|
+
});
|
|
121
|
+
const callRegex = /\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/g;
|
|
122
|
+
let match;
|
|
123
|
+
const bodyStartLine = lineStart;
|
|
124
|
+
const bodyLines = source.split("\n").slice(lineStart - 1, lineEnd);
|
|
125
|
+
for (let i = 0; i < bodyLines.length; i++) {
|
|
126
|
+
const line = bodyLines[i];
|
|
127
|
+
callRegex.lastIndex = 0;
|
|
128
|
+
match = callRegex.exec(line);
|
|
129
|
+
while (match !== null) {
|
|
130
|
+
const calleeName = match[1];
|
|
131
|
+
const isKeyword = calleeName === item.name || calleeName === "if" || calleeName === "for" || calleeName === "while" || calleeName === "switch" || calleeName === "return" || calleeName === "function" || calleeName === "def" || calleeName === "func" || calleeName === "fn" || calleeName === "print" || calleeName === "console";
|
|
132
|
+
if (!isKeyword) {
|
|
133
|
+
calls.push({
|
|
134
|
+
callerId: id,
|
|
135
|
+
calleeName,
|
|
136
|
+
calleeId: null,
|
|
137
|
+
line: bodyStartLine + i,
|
|
138
|
+
kind: "call"
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
match = callRegex.exec(line);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (item.children && item.children.length > 0) {
|
|
145
|
+
extractSymbols(item.children, id);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
extractSymbols(result.structure ?? [], null);
|
|
150
|
+
for (const imp of result.imports ?? []) {
|
|
151
|
+
imports.push({
|
|
152
|
+
filePath: relPath,
|
|
153
|
+
symbolName: imp.items?.join(", ") ?? imp.source ?? "unknown",
|
|
154
|
+
sourcePath: imp.source ?? null,
|
|
155
|
+
line: (imp.span?.startLine ?? 0) + 1,
|
|
156
|
+
language
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return { symbols, calls, imports };
|
|
160
|
+
}
|
|
161
|
+
async function indexFile(db, filePath, repoPath, teamId) {
|
|
162
|
+
const language = detectLanguage(filePath);
|
|
163
|
+
if (!language) {
|
|
164
|
+
return { file: filePath, language: "unknown", symbols: 0, calls: 0, imports: 0, skipped: true };
|
|
165
|
+
}
|
|
166
|
+
const parsed = await parseFile(filePath, repoPath);
|
|
167
|
+
if (!parsed) {
|
|
168
|
+
return { file: filePath, language, symbols: 0, calls: 0, imports: 0, skipped: true };
|
|
169
|
+
}
|
|
170
|
+
const relPath = relative(repoPath, filePath).split(sep).join("/");
|
|
171
|
+
const now = Date.now();
|
|
172
|
+
const existingIds = db.prepare("SELECT id FROM symbols WHERE file_path = ? AND team_id IS ?").all(relPath, teamId);
|
|
173
|
+
if (existingIds.length > 0) {
|
|
174
|
+
const placeholders = existingIds.map(() => "?").join(",");
|
|
175
|
+
db.prepare(`DELETE FROM calls WHERE caller_id IN (${placeholders})`).run(
|
|
176
|
+
...existingIds.map((e) => e.id)
|
|
177
|
+
);
|
|
178
|
+
db.prepare("DELETE FROM symbols WHERE file_path = ? AND team_id IS ?").run(relPath, teamId);
|
|
179
|
+
}
|
|
180
|
+
db.prepare("DELETE FROM imports WHERE file_path = ? AND team_id IS ?").run(relPath, teamId);
|
|
181
|
+
const symbolStmt = db.prepare(
|
|
182
|
+
`INSERT INTO symbols (id, name, kind, file_path, line_start, line_end, language, signature, docstring, parent_id, team_id, repo_path, content_hash, created_at, updated_at)
|
|
183
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
184
|
+
);
|
|
185
|
+
for (const s of parsed.symbols) {
|
|
186
|
+
symbolStmt.run(
|
|
187
|
+
s.id,
|
|
188
|
+
s.name,
|
|
189
|
+
s.kind,
|
|
190
|
+
s.filePath,
|
|
191
|
+
s.lineStart,
|
|
192
|
+
s.lineEnd,
|
|
193
|
+
s.language,
|
|
194
|
+
s.signature,
|
|
195
|
+
s.docstring,
|
|
196
|
+
s.parentId,
|
|
197
|
+
teamId,
|
|
198
|
+
repoPath,
|
|
199
|
+
s.contentHash,
|
|
200
|
+
now,
|
|
201
|
+
now
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
const callStmt = db.prepare(
|
|
205
|
+
`INSERT INTO calls (caller_id, callee_name, callee_id, line, kind, team_id) VALUES (?, ?, ?, ?, ?, ?)`
|
|
206
|
+
);
|
|
207
|
+
for (const c of parsed.calls) {
|
|
208
|
+
const callee = db.prepare("SELECT id FROM symbols WHERE name = ? AND team_id IS ? LIMIT 1").get(c.calleeName, teamId);
|
|
209
|
+
callStmt.run(c.callerId, c.calleeName, callee?.id ?? null, c.line, c.kind, teamId);
|
|
210
|
+
}
|
|
211
|
+
const importStmt = db.prepare(
|
|
212
|
+
`INSERT INTO imports (file_path, symbol_name, source_path, line, language, team_id, repo_path) VALUES (?, ?, ?, ?, ?, ?, ?)`
|
|
213
|
+
);
|
|
214
|
+
for (const imp of parsed.imports) {
|
|
215
|
+
importStmt.run(
|
|
216
|
+
imp.filePath,
|
|
217
|
+
imp.symbolName,
|
|
218
|
+
imp.sourcePath,
|
|
219
|
+
imp.line,
|
|
220
|
+
imp.language,
|
|
221
|
+
teamId,
|
|
222
|
+
repoPath
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
file: relPath,
|
|
227
|
+
language,
|
|
228
|
+
symbols: parsed.symbols.length,
|
|
229
|
+
calls: parsed.calls.length,
|
|
230
|
+
imports: parsed.imports.length,
|
|
231
|
+
skipped: false
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
async function indexDirectory(db, dirPath, repoPath, teamId, maxFiles = 1e4) {
|
|
235
|
+
const results = [];
|
|
236
|
+
const files = [];
|
|
237
|
+
const walk = (dir) => {
|
|
238
|
+
if (files.length >= maxFiles) return;
|
|
239
|
+
let entries;
|
|
240
|
+
try {
|
|
241
|
+
entries = readdirSync(dir);
|
|
242
|
+
} catch {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
for (const entry of entries) {
|
|
246
|
+
if (files.length >= maxFiles) return;
|
|
247
|
+
const fullPath = join(dir, entry);
|
|
248
|
+
let stat;
|
|
249
|
+
try {
|
|
250
|
+
stat = statSync(fullPath);
|
|
251
|
+
} catch {
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (stat.isDirectory()) {
|
|
255
|
+
if (entry === "node_modules" || entry === ".git" || entry === "dist" || entry === "build" || entry === "target" || entry === "__pycache__" || entry === ".next" || entry === "vendor" || entry === ".venv" || entry.startsWith("."))
|
|
256
|
+
continue;
|
|
257
|
+
walk(fullPath);
|
|
258
|
+
} else if (stat.isFile()) {
|
|
259
|
+
if (detectLanguage(fullPath)) {
|
|
260
|
+
files.push(fullPath);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
walk(dirPath);
|
|
266
|
+
for (const file of files) {
|
|
267
|
+
const result = await indexFile(db, file, repoPath, teamId);
|
|
268
|
+
results.push(result);
|
|
269
|
+
}
|
|
270
|
+
const unresolved = db.prepare("SELECT id, callee_name FROM calls WHERE callee_id IS NULL").all();
|
|
271
|
+
if (unresolved.length > 0) {
|
|
272
|
+
const updateStmt = db.prepare("UPDATE calls SET callee_id = ? WHERE id = ?");
|
|
273
|
+
for (const u of unresolved) {
|
|
274
|
+
const callee = db.prepare("SELECT id FROM symbols WHERE name = ? AND team_id IS ? LIMIT 1").get(u.callee_name, teamId);
|
|
275
|
+
if (callee) {
|
|
276
|
+
updateStmt.run(callee.id, u.id);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return results;
|
|
281
|
+
}
|
|
282
|
+
function searchSymbols(db, query, opts = {}) {
|
|
283
|
+
const limit = opts.limit ?? 20;
|
|
284
|
+
const pattern = `%${query}%`;
|
|
285
|
+
let sql = "SELECT * FROM symbols WHERE name LIKE ?";
|
|
286
|
+
const params = [pattern];
|
|
287
|
+
if (opts.teamId !== void 0) {
|
|
288
|
+
sql += " AND team_id IS ?";
|
|
289
|
+
params.push(opts.teamId);
|
|
290
|
+
}
|
|
291
|
+
if (opts.repoPath !== void 0) {
|
|
292
|
+
sql += " AND repo_path = ?";
|
|
293
|
+
params.push(opts.repoPath);
|
|
294
|
+
}
|
|
295
|
+
if (opts.kind) {
|
|
296
|
+
sql += " AND kind = ?";
|
|
297
|
+
params.push(opts.kind);
|
|
298
|
+
}
|
|
299
|
+
if (opts.language) {
|
|
300
|
+
sql += " AND language = ?";
|
|
301
|
+
params.push(opts.language);
|
|
302
|
+
}
|
|
303
|
+
sql += " LIMIT ?";
|
|
304
|
+
params.push(limit);
|
|
305
|
+
const rows = db.prepare(sql).all(...params);
|
|
306
|
+
return rows.map((r) => ({
|
|
307
|
+
id: r.id,
|
|
308
|
+
name: r.name,
|
|
309
|
+
kind: r.kind,
|
|
310
|
+
filePath: r.file_path,
|
|
311
|
+
lineStart: r.line_start,
|
|
312
|
+
lineEnd: r.line_end,
|
|
313
|
+
language: r.language,
|
|
314
|
+
signature: r.signature,
|
|
315
|
+
docstring: r.docstring,
|
|
316
|
+
parentId: r.parent_id,
|
|
317
|
+
contentHash: r.content_hash
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
320
|
+
function findCallers(db, symbolId, opts = {}) {
|
|
321
|
+
const limit = opts.limit ?? 50;
|
|
322
|
+
const rows = db.prepare(
|
|
323
|
+
`SELECT s.*, c.line as call_line
|
|
324
|
+
FROM calls c
|
|
325
|
+
JOIN symbols s ON s.id = c.caller_id
|
|
326
|
+
WHERE c.callee_id = ? OR c.callee_name = (SELECT name FROM symbols WHERE id = ?)
|
|
327
|
+
LIMIT ?`
|
|
328
|
+
).all(symbolId, symbolId, limit);
|
|
329
|
+
return rows.map((r) => ({
|
|
330
|
+
caller: {
|
|
331
|
+
id: r.id,
|
|
332
|
+
name: r.name,
|
|
333
|
+
kind: r.kind,
|
|
334
|
+
filePath: r.file_path,
|
|
335
|
+
lineStart: r.line_start,
|
|
336
|
+
lineEnd: r.line_end,
|
|
337
|
+
language: r.language,
|
|
338
|
+
signature: r.signature,
|
|
339
|
+
docstring: r.docstring,
|
|
340
|
+
parentId: r.parent_id,
|
|
341
|
+
contentHash: r.content_hash
|
|
342
|
+
},
|
|
343
|
+
line: r.call_line
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
function findCallees(db, symbolId, opts = {}) {
|
|
347
|
+
const limit = opts.limit ?? 50;
|
|
348
|
+
const rows = db.prepare(
|
|
349
|
+
`SELECT c.callee_name, c.callee_id, c.line,
|
|
350
|
+
s.id as sid, s.name as sname, s.kind as skind, s.file_path as sfile,
|
|
351
|
+
s.line_start as sline_start, s.line_end as sline_end, s.language as slang,
|
|
352
|
+
s.signature as ssig, s.docstring as sdoc, s.parent_id as sparent, s.content_hash as shash
|
|
353
|
+
FROM calls c
|
|
354
|
+
LEFT JOIN symbols s ON s.id = c.callee_id
|
|
355
|
+
WHERE c.caller_id = ?
|
|
356
|
+
LIMIT ?`
|
|
357
|
+
).all(symbolId, limit);
|
|
358
|
+
return rows.map((r) => ({
|
|
359
|
+
callee: r.sid ? {
|
|
360
|
+
id: r.sid,
|
|
361
|
+
name: r.sname ?? "",
|
|
362
|
+
kind: r.skind ?? "",
|
|
363
|
+
filePath: r.sfile ?? "",
|
|
364
|
+
lineStart: r.sline_start ?? 0,
|
|
365
|
+
lineEnd: r.sline_end ?? 0,
|
|
366
|
+
language: r.slang ?? "",
|
|
367
|
+
signature: r.ssig,
|
|
368
|
+
docstring: r.sdoc,
|
|
369
|
+
parentId: r.sparent,
|
|
370
|
+
contentHash: r.shash ?? ""
|
|
371
|
+
} : null,
|
|
372
|
+
calleeName: r.callee_name,
|
|
373
|
+
line: r.line
|
|
374
|
+
}));
|
|
375
|
+
}
|
|
376
|
+
function impactAnalysis(db, symbolId, opts = {}) {
|
|
377
|
+
const maxDepth = opts.maxDepth ?? 5;
|
|
378
|
+
const rootRow = db.prepare("SELECT * FROM symbols WHERE id = ?").get(symbolId);
|
|
379
|
+
if (!rootRow) {
|
|
380
|
+
throw new Error(`Symbol not found: ${symbolId}`);
|
|
381
|
+
}
|
|
382
|
+
const root = {
|
|
383
|
+
id: rootRow.id,
|
|
384
|
+
name: rootRow.name,
|
|
385
|
+
kind: rootRow.kind,
|
|
386
|
+
filePath: rootRow.file_path,
|
|
387
|
+
lineStart: rootRow.line_start,
|
|
388
|
+
lineEnd: rootRow.line_end,
|
|
389
|
+
language: rootRow.language,
|
|
390
|
+
signature: rootRow.signature,
|
|
391
|
+
docstring: rootRow.docstring,
|
|
392
|
+
parentId: rootRow.parent_id,
|
|
393
|
+
contentHash: rootRow.content_hash
|
|
394
|
+
};
|
|
395
|
+
const affected = [];
|
|
396
|
+
const visited = /* @__PURE__ */ new Set([symbolId]);
|
|
397
|
+
const queue = [
|
|
398
|
+
{ id: symbolId, depth: 0, path: [root.name] }
|
|
399
|
+
];
|
|
400
|
+
while (queue.length > 0) {
|
|
401
|
+
const item = queue.shift();
|
|
402
|
+
if (!item) continue;
|
|
403
|
+
const { id, depth, path: path2 } = item;
|
|
404
|
+
if (depth >= maxDepth) continue;
|
|
405
|
+
const callers = findCallers(db, id, { limit: 100 });
|
|
406
|
+
for (const { caller } of callers) {
|
|
407
|
+
if (visited.has(caller.id)) continue;
|
|
408
|
+
visited.add(caller.id);
|
|
409
|
+
const newPath = [...path2, caller.name];
|
|
410
|
+
affected.push({ symbol: caller, depth: depth + 1, path: newPath });
|
|
411
|
+
queue.push({ id: caller.id, depth: depth + 1, path: newPath });
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return { rootSymbol: root, affected };
|
|
415
|
+
}
|
|
416
|
+
function listSymbols(db, filePath, opts = {}) {
|
|
417
|
+
const limit = opts.limit ?? 100;
|
|
418
|
+
let relPath = filePath;
|
|
419
|
+
if (opts.repoPath) {
|
|
420
|
+
try {
|
|
421
|
+
relPath = relative(opts.repoPath, filePath).split(sep).join("/");
|
|
422
|
+
} catch {
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
let sql = "SELECT * FROM symbols WHERE file_path LIKE ?";
|
|
426
|
+
const params = [`${relPath}%`];
|
|
427
|
+
if (opts.teamId !== void 0) {
|
|
428
|
+
sql += " AND team_id IS ?";
|
|
429
|
+
params.push(opts.teamId);
|
|
430
|
+
}
|
|
431
|
+
if (opts.repoPath !== void 0) {
|
|
432
|
+
sql += " AND repo_path = ?";
|
|
433
|
+
params.push(opts.repoPath);
|
|
434
|
+
}
|
|
435
|
+
if (opts.kind) {
|
|
436
|
+
sql += " AND kind = ?";
|
|
437
|
+
params.push(opts.kind);
|
|
438
|
+
}
|
|
439
|
+
sql += " ORDER BY line_start LIMIT ?";
|
|
440
|
+
params.push(limit);
|
|
441
|
+
const rows = db.prepare(sql).all(...params);
|
|
442
|
+
return rows.map((r) => ({
|
|
443
|
+
id: r.id,
|
|
444
|
+
name: r.name,
|
|
445
|
+
kind: r.kind,
|
|
446
|
+
filePath: r.file_path,
|
|
447
|
+
lineStart: r.line_start,
|
|
448
|
+
lineEnd: r.line_end,
|
|
449
|
+
language: r.language,
|
|
450
|
+
signature: r.signature,
|
|
451
|
+
docstring: r.docstring,
|
|
452
|
+
parentId: r.parent_id,
|
|
453
|
+
contentHash: r.content_hash
|
|
454
|
+
}));
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export {
|
|
458
|
+
__esm,
|
|
459
|
+
__export,
|
|
460
|
+
__toCommonJS,
|
|
461
|
+
__dirname,
|
|
462
|
+
init_esm_shims,
|
|
463
|
+
generateId,
|
|
464
|
+
SUPPORTED_LANGUAGES,
|
|
465
|
+
detectLanguage,
|
|
466
|
+
parseFile,
|
|
467
|
+
indexFile,
|
|
468
|
+
indexDirectory,
|
|
469
|
+
searchSymbols,
|
|
470
|
+
findCallers,
|
|
471
|
+
findCallees,
|
|
472
|
+
impactAnalysis,
|
|
473
|
+
listSymbols
|
|
474
|
+
};
|
|
475
|
+
//# sourceMappingURL=chunk-RITPZHIB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/tsup/assets/esm_shims.js","../src/codegraph/engine.ts","../src/utils/ulid.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","/**\n * CodeGraph engine: parse code, extract symbols, build call graph, impact analysis.\n *\n * Uses @kreuzberg/tree-sitter-language-pack for multi-language parsing.\n * Supports: TypeScript, JavaScript, Python, Go, Rust, Java, C, C++, C#.\n */\nimport { createHash } from \"node:crypto\";\nimport { readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { extname, join, relative, sep } from \"node:path\";\nimport type { Database } from \"better-sqlite3\";\nimport { generateId } from \"../utils/ulid.js\";\n\n// Lazy-load the language pack (CommonJS interop)\nlet _pack: unknown = null;\nasync function getPack(): Promise<Record<string, unknown>> {\n if (!_pack) {\n const mod = await import(\"@kreuzberg/tree-sitter-language-pack\");\n // Handle both ESM default and CJS module.exports\n _pack = mod.default ?? mod;\n }\n return _pack as Record<string, unknown>;\n}\n\n/** Supported languages mapped to file extensions. */\nconst EXTENSION_MAP: Record<string, string> = {\n \".ts\": \"typescript\",\n \".tsx\": \"tsx\",\n \".js\": \"javascript\",\n \".jsx\": \"javascript\",\n \".mjs\": \"javascript\",\n \".cjs\": \"javascript\",\n \".py\": \"python\",\n \".go\": \"go\",\n \".rs\": \"rust\",\n \".java\": \"java\",\n \".c\": \"c\",\n \".h\": \"c\",\n \".cpp\": \"cpp\",\n \".cc\": \"cpp\",\n \".cxx\": \"cpp\",\n \".hpp\": \"cpp\",\n \".cs\": \"csharp\",\n};\n\n/** Languages we support for symbol extraction. */\nexport const SUPPORTED_LANGUAGES = new Set(Object.values(EXTENSION_MAP));\n\n/** Detect language from file extension. Returns null if unsupported. */\nexport function detectLanguage(filePath: string): string | null {\n const ext = extname(filePath).toLowerCase();\n return EXTENSION_MAP[ext] ?? null;\n}\n\n/** A symbol extracted from code. */\nexport interface SymbolInfo {\n id: string;\n name: string;\n kind: string;\n filePath: string;\n lineStart: number;\n lineEnd: number;\n language: string;\n signature: string | null;\n docstring: string | null;\n parentId: string | null;\n contentHash: string;\n}\n\n/** A call relationship. */\nexport interface CallInfo {\n callerId: string;\n calleeName: string;\n calleeId: string | null;\n line: number;\n kind: string;\n}\n\n/** An import relationship. */\nexport interface ImportInfo {\n filePath: string;\n symbolName: string;\n sourcePath: string | null;\n line: number;\n language: string;\n}\n\n/** Result of indexing a file. */\nexport interface IndexResult {\n file: string;\n language: string;\n symbols: number;\n calls: number;\n imports: number;\n skipped: boolean;\n}\n\n/** Impact analysis result. */\nexport interface ImpactResult {\n rootSymbol: SymbolInfo;\n affected: Array<{ symbol: SymbolInfo; depth: number; path: string[] }>;\n}\n\n/** Parse a file and extract symbols, calls, and imports. */\nexport async function parseFile(\n filePath: string,\n repoPath: string,\n): Promise<{ symbols: SymbolInfo[]; calls: CallInfo[]; imports: ImportInfo[] } | null> {\n const language = detectLanguage(filePath);\n if (!language) return null;\n\n const pack = await getPack();\n if (!pack.hasLanguage(language)) return null;\n\n let source: string;\n try {\n source = readFileSync(filePath, \"utf-8\");\n } catch {\n return null;\n }\n\n const result = pack.process(source, { language });\n if (!result) return null;\n\n const relPath = relative(repoPath, filePath).split(sep).join(\"/\");\n const symbols: SymbolInfo[] = [];\n const calls: CallInfo[] = [];\n const imports: ImportInfo[] = [];\n\n // Extract symbols from structure\n const extractSymbols = (\n items: Array<{\n kind?: string;\n name?: string;\n span?: { startLine?: number; endLine?: number };\n signature?: string;\n docComment?: string;\n children?: Array<{\n kind?: string;\n name?: string;\n span?: { startLine?: number; endLine?: number };\n signature?: string;\n docComment?: string;\n }>;\n }>,\n parentId: string | null,\n ) => {\n for (const item of items) {\n if (!item.name) continue;\n const id = generateId();\n const lineStart = (item.span?.startLine ?? 0) + 1; // 1-indexed\n const lineEnd = (item.span?.endLine ?? lineStart) + 1;\n const _bodyText = source.slice(\n item.span?.startLine !== undefined\n ? source.split(\"\\n\").slice(0, item.span.startLine).join(\"\\n\").length + 1\n : 0,\n item.span?.endLine !== undefined\n ? source\n .split(\"\\n\")\n .slice(0, item.span.endLine + 1)\n .join(\"\\n\").length\n : source.length,\n );\n symbols.push({\n id,\n name: item.name,\n kind: item.kind ?? \"unknown\",\n filePath: relPath,\n lineStart,\n lineEnd,\n language,\n signature: item.signature ?? null,\n docstring: item.docComment ?? null,\n parentId,\n contentHash: createHash(\"sha256\")\n .update(item.name + relPath + lineStart)\n .digest(\"hex\"),\n });\n\n // Extract calls within this symbol's body\n // We do a simple regex-based call extraction for now\n const callRegex = /\\b([a-zA-Z_$][a-zA-Z0-9_$]*)\\s*\\(/g;\n let match: RegExpExecArray | null;\n const bodyStartLine = lineStart;\n const bodyLines = source.split(\"\\n\").slice(lineStart - 1, lineEnd);\n for (let i = 0; i < bodyLines.length; i++) {\n const line = bodyLines[i];\n callRegex.lastIndex = 0;\n match = callRegex.exec(line);\n while (match !== null) {\n const calleeName = match[1];\n // Skip language keywords and the symbol itself\n const isKeyword =\n calleeName === item.name ||\n calleeName === \"if\" ||\n calleeName === \"for\" ||\n calleeName === \"while\" ||\n calleeName === \"switch\" ||\n calleeName === \"return\" ||\n calleeName === \"function\" ||\n calleeName === \"def\" ||\n calleeName === \"func\" ||\n calleeName === \"fn\" ||\n calleeName === \"print\" ||\n calleeName === \"console\";\n if (!isKeyword) {\n calls.push({\n callerId: id,\n calleeName,\n calleeId: null,\n line: bodyStartLine + i,\n kind: \"call\",\n });\n }\n match = callRegex.exec(line);\n }\n }\n\n // Recurse into children\n if (item.children && item.children.length > 0) {\n extractSymbols(item.children, id);\n }\n }\n };\n\n extractSymbols(result.structure ?? [], null);\n\n // Extract imports\n for (const imp of result.imports ?? []) {\n imports.push({\n filePath: relPath,\n symbolName: imp.items?.join(\", \") ?? imp.source ?? \"unknown\",\n sourcePath: imp.source ?? null,\n line: (imp.span?.startLine ?? 0) + 1,\n language,\n });\n }\n\n return { symbols, calls, imports };\n}\n\n/** Index a single file into the database. */\nexport async function indexFile(\n db: Database,\n filePath: string,\n repoPath: string,\n teamId: string | null,\n): Promise<IndexResult> {\n const language = detectLanguage(filePath);\n if (!language) {\n return { file: filePath, language: \"unknown\", symbols: 0, calls: 0, imports: 0, skipped: true };\n }\n\n const parsed = await parseFile(filePath, repoPath);\n if (!parsed) {\n return { file: filePath, language, symbols: 0, calls: 0, imports: 0, skipped: true };\n }\n\n const relPath = relative(repoPath, filePath).split(sep).join(\"/\");\n const now = Date.now();\n\n // Delete existing symbols for this file\n const existingIds = db\n .prepare(\"SELECT id FROM symbols WHERE file_path = ? AND team_id IS ?\")\n .all(relPath, teamId) as { id: string }[];\n if (existingIds.length > 0) {\n const placeholders = existingIds.map(() => \"?\").join(\",\");\n db.prepare(`DELETE FROM calls WHERE caller_id IN (${placeholders})`).run(\n ...existingIds.map((e) => e.id),\n );\n db.prepare(\"DELETE FROM symbols WHERE file_path = ? AND team_id IS ?\").run(relPath, teamId);\n }\n db.prepare(\"DELETE FROM imports WHERE file_path = ? AND team_id IS ?\").run(relPath, teamId);\n\n // Insert symbols\n const symbolStmt = db.prepare(\n `INSERT INTO symbols (id, name, kind, file_path, line_start, line_end, language, signature, docstring, parent_id, team_id, repo_path, content_hash, created_at, updated_at)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n );\n for (const s of parsed.symbols) {\n symbolStmt.run(\n s.id,\n s.name,\n s.kind,\n s.filePath,\n s.lineStart,\n s.lineEnd,\n s.language,\n s.signature,\n s.docstring,\n s.parentId,\n teamId,\n repoPath,\n s.contentHash,\n now,\n now,\n );\n }\n\n // Resolve callee IDs and insert calls\n const callStmt = db.prepare(\n `INSERT INTO calls (caller_id, callee_name, callee_id, line, kind, team_id) VALUES (?, ?, ?, ?, ?, ?)`,\n );\n for (const c of parsed.calls) {\n // Try to resolve callee by name within the same repo\n const callee = db\n .prepare(\"SELECT id FROM symbols WHERE name = ? AND team_id IS ? LIMIT 1\")\n .get(c.calleeName, teamId) as { id: string } | undefined;\n callStmt.run(c.callerId, c.calleeName, callee?.id ?? null, c.line, c.kind, teamId);\n }\n\n // Insert imports\n const importStmt = db.prepare(\n `INSERT INTO imports (file_path, symbol_name, source_path, line, language, team_id, repo_path) VALUES (?, ?, ?, ?, ?, ?, ?)`,\n );\n for (const imp of parsed.imports) {\n importStmt.run(\n imp.filePath,\n imp.symbolName,\n imp.sourcePath,\n imp.line,\n imp.language,\n teamId,\n repoPath,\n );\n }\n\n return {\n file: relPath,\n language,\n symbols: parsed.symbols.length,\n calls: parsed.calls.length,\n imports: parsed.imports.length,\n skipped: false,\n };\n}\n\n/** Index a directory recursively. */\nexport async function indexDirectory(\n db: Database,\n dirPath: string,\n repoPath: string,\n teamId: string | null,\n maxFiles = 10000,\n): Promise<IndexResult[]> {\n const results: IndexResult[] = [];\n const files: string[] = [];\n\n const walk = (dir: string) => {\n if (files.length >= maxFiles) return;\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n for (const entry of entries) {\n if (files.length >= maxFiles) return;\n const fullPath = join(dir, entry);\n let stat: ReturnType<typeof statSync>;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n if (stat.isDirectory()) {\n // Skip common ignore dirs\n if (\n entry === \"node_modules\" ||\n entry === \".git\" ||\n entry === \"dist\" ||\n entry === \"build\" ||\n entry === \"target\" ||\n entry === \"__pycache__\" ||\n entry === \".next\" ||\n entry === \"vendor\" ||\n entry === \".venv\" ||\n entry.startsWith(\".\")\n )\n continue;\n walk(fullPath);\n } else if (stat.isFile()) {\n if (detectLanguage(fullPath)) {\n files.push(fullPath);\n }\n }\n }\n };\n\n walk(dirPath);\n\n for (const file of files) {\n const result = await indexFile(db, file, repoPath, teamId);\n results.push(result);\n }\n\n // Re-resolve callee IDs now that all symbols are indexed\n const unresolved = db\n .prepare(\"SELECT id, callee_name FROM calls WHERE callee_id IS NULL\")\n .all() as { id: number; callee_name: string }[];\n if (unresolved.length > 0) {\n const updateStmt = db.prepare(\"UPDATE calls SET callee_id = ? WHERE id = ?\");\n for (const u of unresolved) {\n const callee = db\n .prepare(\"SELECT id FROM symbols WHERE name = ? AND team_id IS ? LIMIT 1\")\n .get(u.callee_name, teamId) as { id: string } | undefined;\n if (callee) {\n updateStmt.run(callee.id, u.id);\n }\n }\n }\n\n return results;\n}\n\n/** Search symbols by name or pattern. */\nexport function searchSymbols(\n db: Database,\n query: string,\n opts: {\n teamId?: string;\n kind?: string;\n language?: string;\n limit?: number;\n repoPath?: string;\n } = {},\n): SymbolInfo[] {\n const limit = opts.limit ?? 20;\n const pattern = `%${query}%`;\n let sql = \"SELECT * FROM symbols WHERE name LIKE ?\";\n const params: unknown[] = [pattern];\n if (opts.teamId !== undefined) {\n sql += \" AND team_id IS ?\";\n params.push(opts.teamId);\n }\n if (opts.repoPath !== undefined) {\n sql += \" AND repo_path = ?\";\n params.push(opts.repoPath);\n }\n if (opts.kind) {\n sql += \" AND kind = ?\";\n params.push(opts.kind);\n }\n if (opts.language) {\n sql += \" AND language = ?\";\n params.push(opts.language);\n }\n sql += \" LIMIT ?\";\n params.push(limit);\n\n const rows = db.prepare(sql).all(...params) as Array<{\n id: string;\n name: string;\n kind: string;\n file_path: string;\n line_start: number;\n line_end: number;\n language: string;\n signature: string | null;\n docstring: string | null;\n parent_id: string | null;\n content_hash: string;\n }>;\n\n return rows.map((r) => ({\n id: r.id,\n name: r.name,\n kind: r.kind,\n filePath: r.file_path,\n lineStart: r.line_start,\n lineEnd: r.line_end,\n language: r.language,\n signature: r.signature,\n docstring: r.docstring,\n parentId: r.parent_id,\n contentHash: r.content_hash,\n }));\n}\n\n/** Find all callers of a symbol (who calls X?). */\nexport function findCallers(\n db: Database,\n symbolId: string,\n opts: { limit?: number } = {},\n): Array<{ caller: SymbolInfo; line: number }> {\n const limit = opts.limit ?? 50;\n const rows = db\n .prepare(\n `SELECT s.*, c.line as call_line\n FROM calls c\n JOIN symbols s ON s.id = c.caller_id\n WHERE c.callee_id = ? OR c.callee_name = (SELECT name FROM symbols WHERE id = ?)\n LIMIT ?`,\n )\n .all(symbolId, symbolId, limit) as Array<{\n id: string;\n name: string;\n kind: string;\n file_path: string;\n line_start: number;\n line_end: number;\n language: string;\n signature: string | null;\n docstring: string | null;\n parent_id: string | null;\n content_hash: string;\n call_line: number;\n }>;\n\n return rows.map((r) => ({\n caller: {\n id: r.id,\n name: r.name,\n kind: r.kind,\n filePath: r.file_path,\n lineStart: r.line_start,\n lineEnd: r.line_end,\n language: r.language,\n signature: r.signature,\n docstring: r.docstring,\n parentId: r.parent_id,\n contentHash: r.content_hash,\n },\n line: r.call_line,\n }));\n}\n\n/** Find all callees of a symbol (X calls whom?). */\nexport function findCallees(\n db: Database,\n symbolId: string,\n opts: { limit?: number } = {},\n): Array<{ callee: SymbolInfo | null; calleeName: string; line: number }> {\n const limit = opts.limit ?? 50;\n const rows = db\n .prepare(\n `SELECT c.callee_name, c.callee_id, c.line,\n s.id as sid, s.name as sname, s.kind as skind, s.file_path as sfile,\n s.line_start as sline_start, s.line_end as sline_end, s.language as slang,\n s.signature as ssig, s.docstring as sdoc, s.parent_id as sparent, s.content_hash as shash\n FROM calls c\n LEFT JOIN symbols s ON s.id = c.callee_id\n WHERE c.caller_id = ?\n LIMIT ?`,\n )\n .all(symbolId, limit) as Array<{\n callee_name: string;\n callee_id: string | null;\n line: number;\n sid: string | null;\n sname: string | null;\n skind: string | null;\n sfile: string | null;\n sline_start: number | null;\n sline_end: number | null;\n slang: string | null;\n ssig: string | null;\n sdoc: string | null;\n sparent: string | null;\n shash: string | null;\n }>;\n\n return rows.map((r) => ({\n callee: r.sid\n ? {\n id: r.sid,\n name: r.sname ?? \"\",\n kind: r.skind ?? \"\",\n filePath: r.sfile ?? \"\",\n lineStart: r.sline_start ?? 0,\n lineEnd: r.sline_end ?? 0,\n language: r.slang ?? \"\",\n signature: r.ssig,\n docstring: r.sdoc,\n parentId: r.sparent,\n contentHash: r.shash ?? \"\",\n }\n : null,\n calleeName: r.callee_name,\n line: r.line,\n }));\n}\n\n/** Impact analysis: BFS from a symbol through the caller chain.\n * Returns all symbols that might be affected if the given symbol changes. */\nexport function impactAnalysis(\n db: Database,\n symbolId: string,\n opts: { maxDepth?: number } = {},\n): ImpactResult {\n const maxDepth = opts.maxDepth ?? 5;\n\n const rootRow = db.prepare(\"SELECT * FROM symbols WHERE id = ?\").get(symbolId) as\n | {\n id: string;\n name: string;\n kind: string;\n file_path: string;\n line_start: number;\n line_end: number;\n language: string;\n signature: string | null;\n docstring: string | null;\n parent_id: string | null;\n content_hash: string;\n }\n | undefined;\n\n if (!rootRow) {\n throw new Error(`Symbol not found: ${symbolId}`);\n }\n\n const root: SymbolInfo = {\n id: rootRow.id,\n name: rootRow.name,\n kind: rootRow.kind,\n filePath: rootRow.file_path,\n lineStart: rootRow.line_start,\n lineEnd: rootRow.line_end,\n language: rootRow.language,\n signature: rootRow.signature,\n docstring: rootRow.docstring,\n parentId: rootRow.parent_id,\n contentHash: rootRow.content_hash,\n };\n\n const affected: Array<{ symbol: SymbolInfo; depth: number; path: string[] }> = [];\n const visited = new Set<string>([symbolId]);\n\n // BFS through callers (who calls X → who calls them → ...)\n const queue: Array<{ id: string; depth: number; path: string[] }> = [\n { id: symbolId, depth: 0, path: [root.name] },\n ];\n\n while (queue.length > 0) {\n const item = queue.shift();\n if (!item) continue;\n const { id, depth, path } = item;\n if (depth >= maxDepth) continue;\n\n const callers = findCallers(db, id, { limit: 100 });\n for (const { caller } of callers) {\n if (visited.has(caller.id)) continue;\n visited.add(caller.id);\n const newPath = [...path, caller.name];\n affected.push({ symbol: caller, depth: depth + 1, path: newPath });\n queue.push({ id: caller.id, depth: depth + 1, path: newPath });\n }\n }\n\n return { rootSymbol: root, affected };\n}\n\n/** List symbols in a file or directory. */\nexport function listSymbols(\n db: Database,\n filePath: string,\n opts: { teamId?: string; kind?: string; limit?: number; repoPath?: string } = {},\n): SymbolInfo[] {\n const limit = opts.limit ?? 100;\n\n // Convert absolute path to relative if repoPath is provided\n let relPath = filePath;\n if (opts.repoPath) {\n try {\n relPath = relative(opts.repoPath, filePath).split(sep).join(\"/\");\n } catch {\n // If relative() fails, use the original path\n }\n }\n\n let sql = \"SELECT * FROM symbols WHERE file_path LIKE ?\";\n const params: unknown[] = [`${relPath}%`];\n if (opts.teamId !== undefined) {\n sql += \" AND team_id IS ?\";\n params.push(opts.teamId);\n }\n if (opts.repoPath !== undefined) {\n sql += \" AND repo_path = ?\";\n params.push(opts.repoPath);\n }\n if (opts.kind) {\n sql += \" AND kind = ?\";\n params.push(opts.kind);\n }\n sql += \" ORDER BY line_start LIMIT ?\";\n params.push(limit);\n\n const rows = db.prepare(sql).all(...params) as Array<{\n id: string;\n name: string;\n kind: string;\n file_path: string;\n line_start: number;\n line_end: number;\n language: string;\n signature: string | null;\n docstring: string | null;\n parent_id: string | null;\n content_hash: string;\n }>;\n\n return rows.map((r) => ({\n id: r.id,\n name: r.name,\n kind: r.kind,\n filePath: r.file_path,\n lineStart: r.line_start,\n lineEnd: r.line_end,\n language: r.language,\n signature: r.signature,\n docstring: r.docstring,\n parentId: r.parent_id,\n contentHash: r.content_hash,\n }));\n}\n","import { ulid } from \"ulid\";\n\n/**\n * Generate a sortable unique ID.\n * Uses ULID (Universally Unique Lexicographically Sortable Identifier).\n */\nexport function generateId(): string {\n return ulid();\n}\n"],"mapp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
+
indexFile,
|
|
9
|
+
listSymbols,
|
|
10
|
+
parseFile,
|
|
11
|
+
searchSymbols
|
|
12
|
+
} from "./chunk-RITPZHIB.js";
|
|
13
|
+
export {
|
|
14
|
+
SUPPORTED_LANGUAGES,
|
|
15
|
+
detectLanguage,
|
|
16
|
+
findCallees,
|
|
17
|
+
findCallers,
|
|
18
|
+
impactAnalysis,
|
|
19
|
+
indexDirectory,
|
|
20
|
+
indexFile,
|
|
21
|
+
listSymbols,
|
|
22
|
+
parseFile,
|
|
23
|
+
searchSymbols
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=engine-ZNZRRSBV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|