jinzd-ai-cli 0.4.142 → 0.4.143
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 +2 -2
- package/README.zh-CN.md +1 -1
- package/dist/{batch-MJUH762U.js → batch-FTCB7YHA.js} +2 -2
- package/dist/{chunk-G3CH252E.js → chunk-2JLVHUMU.js} +1 -1
- package/dist/{chunk-UXGHSFGB.js → chunk-2YEBAHAB.js} +1 -1
- package/dist/{chunk-3UZBSMNI.js → chunk-CSWA553M.js} +1 -1
- package/dist/{chunk-BJAT4GNC.js → chunk-DQ2OHJNF.js} +15 -0
- package/dist/{chunk-WLZJANJO.js → chunk-DX5JYNVN.js} +1 -1
- package/dist/{chunk-DES5NNPU.js → chunk-GDCLDXEC.js} +2 -2
- package/dist/{chunk-KSLJCZCE.js → chunk-IMYOBDJG.js} +1 -1
- package/dist/{chunk-MO7MWNWC.js → chunk-NKR53CPL.js} +1 -1
- package/dist/{chunk-6VRJGH25.js → chunk-OVWE4E46.js} +15 -0
- package/dist/{chunk-RFQVUMDB.js → chunk-SEFOKYYP.js} +276 -5
- package/dist/{chunk-3BICTI5M.js → chunk-UQQJWHRV.js} +1 -1
- package/dist/{chunk-NHNWUBXB.js → chunk-VNNYHW6N.js} +276 -5
- package/dist/{chunk-NSTXHD33.js → chunk-VXFBUMWG.js} +1 -1
- package/dist/{chunk-INPG2HXR.js → chunk-YCIJZ2XS.js} +1 -1
- package/dist/{chunk-Q3ZEZHSU.js → chunk-YPFCJ5KC.js} +7 -7
- package/dist/{constants-QDFO3IJP.js → constants-YVTEGGKB.js} +1 -1
- package/dist/{doctor-cli-CLKZYOOI.js → doctor-cli-EGD6OLJO.js} +5 -5
- package/dist/electron-server.js +9 -9
- package/dist/{hub-X4ISNM7B.js → hub-YNT2PVCA.js} +1 -1
- package/dist/index.js +30 -28
- package/dist/{indexer-Z6AQTGBK.js → indexer-ISSNIFQY.js} +2 -2
- package/dist/{indexer-XGY7XGJM.js → indexer-S6UMGQKA.js} +2 -2
- package/dist/{run-tests-QER6ETNZ.js → run-tests-3KUDRXXZ.js} +2 -2
- package/dist/{run-tests-3AYPKO5U.js → run-tests-VK2S7V3X.js} +1 -1
- package/dist/{semantic-FR2ZSQLY.js → semantic-IJKF5ZZC.js} +2 -2
- package/dist/{semantic-UFKVYKFE.js → semantic-V37U4MCW.js} +2 -2
- package/dist/{server-PBOIZFFD.js → server-7UH5SJSC.js} +7 -7
- package/dist/{server-FFPJP2GQ.js → server-KZOHU7OE.js} +14 -14
- package/dist/{store-Q7NMUCPP.js → store-A3TZM6PS.js} +1 -1
- package/dist/{store-JDEW743P.js → store-VMK543OQ.js} +1 -1
- package/dist/{task-orchestrator-O4FTLSHK.js → task-orchestrator-E46H7NUK.js} +7 -7
- package/dist/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/wasm/tree-sitter-go.wasm +0 -0
- package/dist/wasm/tree-sitter-java.wasm +0 -0
- package/dist/wasm/tree-sitter-rust.wasm +0 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
- **Anthropic Batches API** *(v0.4.73+)* — `aicli batch submit/list/status/results/cancel` for 50%-off, 24-hour async processing — ideal for offline analysis and bulk evals
|
|
30
30
|
- **Web UI Session Replay** *(v0.4.71+)* — 🎬 button on every saved session opens a timeline replay: every message, tool call, reasoning, and cache-aware token usage at a glance
|
|
31
31
|
- **Conversation Branching** *(v0.4.74+)* — `/branch list/new/switch/delete/rename` inside the REPL, plus a 🌿 "fork here" button on every replay step — explore alternate directions without losing the original thread
|
|
32
|
-
- **Symbol Index** *(v0.4.76
|
|
32
|
+
- **Symbol Index** *(v0.4.76+, multi-language since v0.4.143)* — persistent tree-sitter index for TypeScript / JavaScript / TSX / Python / Go / Rust / Java / C/C++ powers three new AI tools: `find_symbol`, `get_outline`, `find_references`. Orders of magnitude faster than grep for definition lookups; background refresh on REPL startup, `/index status|rebuild|clear` to manage
|
|
33
33
|
- **Semantic Code Search** *(v0.4.77+)* — `search_code` tool finds code by meaning, not name. Local sentence embeddings (multilingual MiniLM, 117 MB one-time download) score symbols by cosine similarity against natural-language queries in English or Chinese ("where are users authenticated", "哪里做了速率限制"). No API key, runs on CPU. Manage with `/index semantic-rebuild|semantic-clear`
|
|
34
34
|
- **MCP Server Mode** *(v0.4.84+)* — `aicli mcp-serve` reverses ai-cli into an MCP server (JSON-RPC 2.0 over stdio), exposing its 26 built-in tools (incl. `find_symbol` / `search_code` / `run_tests`) to Claude Desktop / Cursor / any MCP client. Opt-in destructive-tool allow, `--tools` whitelist, `--cwd` override
|
|
35
35
|
- **Session Sensitive-Data Redaction** *(v0.4.88+)* — unified redactor scrubs `password=` / `api_key` / bearer tokens / OpenAI-style keys from every message **before it hits disk**. Query text is redacted too, so secrets never reach embeddings or logs. `/security status` + `/security scan` to audit
|
|
@@ -179,7 +179,7 @@ AI autonomously invokes these 27 tools during conversations:
|
|
|
179
179
|
| `git_log` | safe | Show commit history (oneline/full, filter by file/author) |
|
|
180
180
|
| `git_commit` | write | Create a git commit (stage files, message) |
|
|
181
181
|
| `notebook_edit` | write | Edit Jupyter notebook cells (add/edit/delete/move) |
|
|
182
|
-
| `find_symbol` | safe | Locate symbol definitions via persistent tree-sitter index (TS/JS/TSX/Python) |
|
|
182
|
+
| `find_symbol` | safe | Locate symbol definitions via persistent tree-sitter index (TS/JS/TSX/Python/Go/Rust/Java/C++) |
|
|
183
183
|
| `get_outline` | safe | Enumerate all top-level declarations in one source file |
|
|
184
184
|
| `find_references` | safe | Search indexed files for references to a symbol name |
|
|
185
185
|
| `search_code` | safe | Semantic (meaning-based) code search via local sentence embeddings — bilingual, "grep by meaning" |
|
package/README.zh-CN.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
- **Anthropic Batches API**(v0.4.73+)— `aicli batch submit/list/status/results/cancel` 包 Message Batches(50% 折扣 + 24 小时窗口),适合离线分析和批量 eval
|
|
22
22
|
- **Web UI 会话回放**(v0.4.71+)— 会话列表每项 🎬 按钮打开时间轴回放:消息、工具调用、推理内容、cache-aware token 用量一目了然
|
|
23
23
|
- **对话分支**(v0.4.74+)— REPL 内 `/branch list/new/switch/delete/rename/diff/cherry-pick`,Web UI 回放面板每条消息旁 🌿 "fork here" 按钮,任意位置开辟新分支探索不同方向,原对话保持不变;v0.4.81 起所有子命令支持 id / title / 唯一前缀
|
|
24
|
-
- **符号索引**(v0.4.76+,C1
|
|
24
|
+
- **符号索引**(v0.4.76+,C1;v0.4.143 起多语言)— tree-sitter 持久化索引(TS / JS / TSX / JSX / Python / Go / Rust / Java / C/C++)+ 3 个只读 AI 工具(`find_symbol` / `get_outline` / `find_references`)+ `/index status/rebuild/clear`;启动后台增量刷新,`write_file` 后自动 upsert
|
|
25
25
|
- **语义代码搜索**(v0.4.77+,C2)— `search_code` AI 工具 + 本地 sentence embedding(`paraphrase-multilingual-MiniLM-L12-v2`,117 MB 一次性下载,384 维,CPU 运行);支持中英文自然语言查询代码;`/index semantic-rebuild/semantic-clear` 管理
|
|
26
26
|
- **MCP Server 模式**(v0.4.84+,E1)— `aicli mcp-serve` 把 aicli 反转为 MCP 服务器(JSON-RPC 2.0 over stdio),把 26 个内置工具(含 `find_symbol` / `search_code` / `run_tests`)输出给 Claude Desktop / Cursor / 任何 MCP 客户端;支持 `--tools` 白名单、`--cwd` 覆盖、`--allow-destructive`
|
|
27
27
|
- **Session 敏感数据脱敏**(v0.4.88+)— 统一 redactor 在 session **落盘前**自动替换 `password=` / `api_key` / bearer token / OpenAI key 为 `[REDACTED:*]`;查询文本也走脱敏,secret 不会进 embedding 或日志;`/security status` + `/security scan` 审计
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ConfigManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DX5JYNVN.js";
|
|
5
5
|
import "./chunk-2ZD3YTVM.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-VXFBUMWG.js";
|
|
7
7
|
import "./chunk-PDX44BCA.js";
|
|
8
8
|
|
|
9
9
|
// src/cli/batch.ts
|
|
@@ -22,6 +22,21 @@ function detectLanguage(ext) {
|
|
|
22
22
|
case "py":
|
|
23
23
|
case "pyi":
|
|
24
24
|
return "python";
|
|
25
|
+
case "go":
|
|
26
|
+
return "go";
|
|
27
|
+
case "rs":
|
|
28
|
+
return "rust";
|
|
29
|
+
case "java":
|
|
30
|
+
return "java";
|
|
31
|
+
case "c":
|
|
32
|
+
case "cc":
|
|
33
|
+
case "cpp":
|
|
34
|
+
case "cxx":
|
|
35
|
+
case "h":
|
|
36
|
+
case "hh":
|
|
37
|
+
case "hpp":
|
|
38
|
+
case "hxx":
|
|
39
|
+
return "cpp";
|
|
25
40
|
default:
|
|
26
41
|
return null;
|
|
27
42
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YPFCJ5KC.js";
|
|
5
5
|
import {
|
|
6
6
|
APP_NAME,
|
|
7
7
|
CONFIG_DIR_NAME,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
MCP_PROTOCOL_VERSION,
|
|
12
12
|
MCP_TOOL_PREFIX,
|
|
13
13
|
VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VXFBUMWG.js";
|
|
15
15
|
import {
|
|
16
16
|
redactJson
|
|
17
17
|
} from "./chunk-7ZJN4KLV.js";
|
|
@@ -24,6 +24,21 @@ function detectLanguage(ext) {
|
|
|
24
24
|
case "py":
|
|
25
25
|
case "pyi":
|
|
26
26
|
return "python";
|
|
27
|
+
case "go":
|
|
28
|
+
return "go";
|
|
29
|
+
case "rs":
|
|
30
|
+
return "rust";
|
|
31
|
+
case "java":
|
|
32
|
+
return "java";
|
|
33
|
+
case "c":
|
|
34
|
+
case "cc":
|
|
35
|
+
case "cpp":
|
|
36
|
+
case "cxx":
|
|
37
|
+
case "h":
|
|
38
|
+
case "hh":
|
|
39
|
+
case "hpp":
|
|
40
|
+
case "hxx":
|
|
41
|
+
return "cpp";
|
|
27
42
|
default:
|
|
28
43
|
return null;
|
|
29
44
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
removeFile,
|
|
6
6
|
saveIndex,
|
|
7
7
|
upsertFileSymbols
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DQ2OHJNF.js";
|
|
9
9
|
|
|
10
10
|
// src/symbols/indexer.ts
|
|
11
11
|
import fs2 from "fs";
|
|
@@ -29,7 +29,11 @@ var GRAMMAR_FILE = {
|
|
|
29
29
|
typescript: "tree-sitter-typescript.wasm",
|
|
30
30
|
tsx: "tree-sitter-tsx.wasm",
|
|
31
31
|
javascript: "tree-sitter-javascript.wasm",
|
|
32
|
-
python: "tree-sitter-python.wasm"
|
|
32
|
+
python: "tree-sitter-python.wasm",
|
|
33
|
+
go: "tree-sitter-go.wasm",
|
|
34
|
+
rust: "tree-sitter-rust.wasm",
|
|
35
|
+
java: "tree-sitter-java.wasm",
|
|
36
|
+
cpp: "tree-sitter-cpp.wasm"
|
|
33
37
|
};
|
|
34
38
|
var RUNTIME_WASM = "web-tree-sitter.wasm";
|
|
35
39
|
var parserInitPromise = null;
|
|
@@ -270,6 +274,253 @@ function extractPython(root, file) {
|
|
|
270
274
|
visit(root, void 0, true);
|
|
271
275
|
return out;
|
|
272
276
|
}
|
|
277
|
+
function extractGo(root, file) {
|
|
278
|
+
const out = [];
|
|
279
|
+
const isExported = (name) => /^[A-Z]/.test(name);
|
|
280
|
+
const pushTypeSpec = (spec) => {
|
|
281
|
+
const name = nameOf(spec);
|
|
282
|
+
if (!name) return;
|
|
283
|
+
const typeNode = childByFieldName(spec, "type");
|
|
284
|
+
let kind = "type";
|
|
285
|
+
if (typeNode?.type === "struct_type") kind = "class";
|
|
286
|
+
else if (typeNode?.type === "interface_type") kind = "interface";
|
|
287
|
+
out.push({
|
|
288
|
+
name,
|
|
289
|
+
kind,
|
|
290
|
+
language: "go",
|
|
291
|
+
location: locationOf(file, spec),
|
|
292
|
+
signature: firstLine(spec.text),
|
|
293
|
+
exported: isExported(name)
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
for (const child of root.children) {
|
|
297
|
+
if (!child) continue;
|
|
298
|
+
if (child.type === "function_declaration") {
|
|
299
|
+
const name = nameOf(child);
|
|
300
|
+
if (name) out.push({ name, kind: "function", language: "go", location: locationOf(file, child), signature: firstLine(child.text), exported: isExported(name) });
|
|
301
|
+
} else if (child.type === "method_declaration") {
|
|
302
|
+
const name = nameOf(child);
|
|
303
|
+
if (!name) continue;
|
|
304
|
+
const receiver = childByFieldName(child, "receiver");
|
|
305
|
+
let container;
|
|
306
|
+
if (receiver) {
|
|
307
|
+
const paramDecl = receiver.children.find((c) => c?.type === "parameter_declaration");
|
|
308
|
+
const typeNode = paramDecl ? childByFieldName(paramDecl, "type") : null;
|
|
309
|
+
if (typeNode) {
|
|
310
|
+
container = typeNode.text.replace(/^\*/, "").trim();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
out.push({ name, kind: "method", language: "go", location: locationOf(file, child), signature: firstLine(child.text), container, exported: isExported(name) });
|
|
314
|
+
} else if (child.type === "type_declaration") {
|
|
315
|
+
for (const spec of child.children) {
|
|
316
|
+
if (spec?.type === "type_spec" || spec?.type === "type_alias") pushTypeSpec(spec);
|
|
317
|
+
}
|
|
318
|
+
} else if (child.type === "const_declaration" || child.type === "var_declaration") {
|
|
319
|
+
for (const spec of child.children) {
|
|
320
|
+
if (spec?.type !== "const_spec" && spec?.type !== "var_spec") continue;
|
|
321
|
+
for (const id of spec.children) {
|
|
322
|
+
if (id?.type !== "identifier") continue;
|
|
323
|
+
out.push({ name: id.text, kind: "variable", language: "go", location: locationOf(file, spec), signature: firstLine(spec.text), exported: isExported(id.text) });
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return out;
|
|
329
|
+
}
|
|
330
|
+
function extractRust(root, file) {
|
|
331
|
+
const out = [];
|
|
332
|
+
const isPub = (node) => node.children.some((c) => c?.type === "visibility_modifier" && c.text.startsWith("pub"));
|
|
333
|
+
const visit = (node, container) => {
|
|
334
|
+
const kindMap = {
|
|
335
|
+
function_item: container ? "method" : "function",
|
|
336
|
+
struct_item: "class",
|
|
337
|
+
union_item: "class",
|
|
338
|
+
enum_item: "enum",
|
|
339
|
+
trait_item: "interface",
|
|
340
|
+
type_item: "type",
|
|
341
|
+
const_item: "variable",
|
|
342
|
+
static_item: "variable",
|
|
343
|
+
macro_definition: "function",
|
|
344
|
+
mod_item: "module"
|
|
345
|
+
};
|
|
346
|
+
const kind = kindMap[node.type];
|
|
347
|
+
if (kind) {
|
|
348
|
+
const name = nameOf(node);
|
|
349
|
+
if (name) {
|
|
350
|
+
out.push({ name, kind, language: "rust", location: locationOf(file, node), signature: firstLine(node.text), container, exported: isPub(node) });
|
|
351
|
+
if (node.type === "mod_item") {
|
|
352
|
+
const body = childByFieldName(node, "body");
|
|
353
|
+
if (body) for (const c of body.children) {
|
|
354
|
+
if (c) visit(c, name);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (node.type === "impl_item") {
|
|
361
|
+
const typeNode = childByFieldName(node, "type");
|
|
362
|
+
const implContainer = typeNode?.text.trim();
|
|
363
|
+
const body = childByFieldName(node, "body");
|
|
364
|
+
if (body) for (const c of body.children) {
|
|
365
|
+
if (c) visit(c, implContainer);
|
|
366
|
+
}
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
if (node.type === "source_file" || node.type === "declaration_list") {
|
|
370
|
+
for (const c of node.children) {
|
|
371
|
+
if (c) visit(c, container);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
visit(root, void 0);
|
|
376
|
+
return out;
|
|
377
|
+
}
|
|
378
|
+
function extractJava(root, file) {
|
|
379
|
+
const out = [];
|
|
380
|
+
const isPublic = (node) => {
|
|
381
|
+
const mods = node.children.find((c) => c?.type === "modifiers");
|
|
382
|
+
return !!mods && mods.children.some((c) => c?.type === "public" || c?.text === "public");
|
|
383
|
+
};
|
|
384
|
+
const visit = (node, container) => {
|
|
385
|
+
const containerKindMap = {
|
|
386
|
+
class_declaration: "class",
|
|
387
|
+
interface_declaration: "interface",
|
|
388
|
+
enum_declaration: "enum",
|
|
389
|
+
record_declaration: "class",
|
|
390
|
+
annotation_type_declaration: "interface"
|
|
391
|
+
};
|
|
392
|
+
const containerKind = containerKindMap[node.type];
|
|
393
|
+
if (containerKind) {
|
|
394
|
+
const name = nameOf(node);
|
|
395
|
+
if (name) {
|
|
396
|
+
out.push({ name, kind: containerKind, language: "java", location: locationOf(file, node), signature: firstLine(node.text), container, exported: isPublic(node) });
|
|
397
|
+
const body = node.children.find((c) => c?.type === "class_body" || c?.type === "interface_body" || c?.type === "enum_body" || c?.type === "record_body" || c?.type === "annotation_type_body");
|
|
398
|
+
if (body) for (const c of body.children) {
|
|
399
|
+
if (c) visit(c, name);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (node.type === "method_declaration" || node.type === "constructor_declaration" || node.type === "compact_constructor_declaration") {
|
|
405
|
+
const name = nameOf(node);
|
|
406
|
+
if (name) out.push({ name, kind: "method", language: "java", location: locationOf(file, node), signature: firstLine(node.text), container, exported: isPublic(node) });
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
if (node.type === "field_declaration") {
|
|
410
|
+
const exported = isPublic(node);
|
|
411
|
+
for (const c of node.children) {
|
|
412
|
+
if (c?.type !== "variable_declarator") continue;
|
|
413
|
+
const id = childByFieldName(c, "name");
|
|
414
|
+
if (id?.type === "identifier") out.push({ name: id.text, kind: "property", language: "java", location: locationOf(file, c), signature: firstLine(node.text), container, exported });
|
|
415
|
+
}
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
if (node.type === "program") {
|
|
419
|
+
for (const c of node.children) {
|
|
420
|
+
if (c) visit(c, container);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
visit(root, void 0);
|
|
425
|
+
return out;
|
|
426
|
+
}
|
|
427
|
+
function extractCpp(root, file) {
|
|
428
|
+
const out = [];
|
|
429
|
+
const declaratorName = (decl) => {
|
|
430
|
+
if (!decl) return null;
|
|
431
|
+
if (decl.type === "identifier" || decl.type === "field_identifier" || decl.type === "type_identifier") {
|
|
432
|
+
return { name: decl.text };
|
|
433
|
+
}
|
|
434
|
+
if (decl.type === "qualified_identifier") {
|
|
435
|
+
const text = decl.text;
|
|
436
|
+
const idx = text.lastIndexOf("::");
|
|
437
|
+
if (idx >= 0) return { name: text.slice(idx + 2), container: text.slice(0, idx) };
|
|
438
|
+
return { name: text };
|
|
439
|
+
}
|
|
440
|
+
if (decl.type === "destructor_name" || decl.type === "operator_name") {
|
|
441
|
+
return { name: decl.text };
|
|
442
|
+
}
|
|
443
|
+
const inner = childByFieldName(decl, "declarator");
|
|
444
|
+
if (inner) return declaratorName(inner);
|
|
445
|
+
return null;
|
|
446
|
+
};
|
|
447
|
+
const visit = (node, container) => {
|
|
448
|
+
if (node.type === "template_declaration") {
|
|
449
|
+
for (const c of node.children) {
|
|
450
|
+
if (c && (c.type === "function_definition" || c.type === "class_specifier" || c.type === "struct_specifier" || c.type === "declaration")) {
|
|
451
|
+
visit(c, container);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if (node.type === "function_definition") {
|
|
457
|
+
const decl = childByFieldName(node, "declarator");
|
|
458
|
+
const info = declaratorName(decl);
|
|
459
|
+
if (info) {
|
|
460
|
+
const finalContainer = info.container ?? container;
|
|
461
|
+
out.push({
|
|
462
|
+
name: info.name,
|
|
463
|
+
kind: finalContainer ? "method" : "function",
|
|
464
|
+
language: "cpp",
|
|
465
|
+
location: locationOf(file, node),
|
|
466
|
+
signature: firstLine(node.text),
|
|
467
|
+
container: finalContainer
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
const specMap = {
|
|
473
|
+
class_specifier: "class",
|
|
474
|
+
struct_specifier: "class",
|
|
475
|
+
union_specifier: "class",
|
|
476
|
+
enum_specifier: "enum"
|
|
477
|
+
};
|
|
478
|
+
const specKind = specMap[node.type];
|
|
479
|
+
if (specKind) {
|
|
480
|
+
const name = nameOf(node);
|
|
481
|
+
if (name) {
|
|
482
|
+
out.push({ name, kind: specKind, language: "cpp", location: locationOf(file, node), signature: firstLine(node.text), container });
|
|
483
|
+
const body = node.children.find((c) => c?.type === "field_declaration_list" || c?.type === "enumerator_list");
|
|
484
|
+
if (body) for (const c of body.children) {
|
|
485
|
+
if (c) visit(c, name);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
if (node.type === "namespace_definition") {
|
|
491
|
+
const name = nameOf(node) ?? "<anonymous>";
|
|
492
|
+
out.push({ name, kind: "module", language: "cpp", location: locationOf(file, node), signature: firstLine(node.text), container });
|
|
493
|
+
const body = childByFieldName(node, "body");
|
|
494
|
+
if (body) for (const c of body.children) {
|
|
495
|
+
if (c) visit(c, name);
|
|
496
|
+
}
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
if (node.type === "type_definition" || node.type === "alias_declaration") {
|
|
500
|
+
const decl = node.children[node.children.length - 1];
|
|
501
|
+
const info = decl ? declaratorName(decl) : null;
|
|
502
|
+
if (info) out.push({ name: info.name, kind: "type", language: "cpp", location: locationOf(file, node), signature: firstLine(node.text), container });
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (node.type === "field_declaration" && container) {
|
|
506
|
+
const hasFn = node.children.some((c) => c?.type === "function_declarator" || c?.type === "pointer_declarator" && c.children.some((x) => x?.type === "function_declarator"));
|
|
507
|
+
if (hasFn) return;
|
|
508
|
+
for (const c of node.children) {
|
|
509
|
+
if (c?.type === "field_identifier") {
|
|
510
|
+
out.push({ name: c.text, kind: "property", language: "cpp", location: locationOf(file, node), signature: firstLine(node.text), container });
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
if (node.type === "translation_unit" || node.type === "declaration_list" || node.type === "linkage_specification") {
|
|
516
|
+
for (const c of node.children) {
|
|
517
|
+
if (c) visit(c, container);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
visit(root, void 0);
|
|
522
|
+
return out;
|
|
523
|
+
}
|
|
273
524
|
async function parseSource(file, source, language) {
|
|
274
525
|
const lang = language ?? detectLanguage(path2.extname(file).slice(1));
|
|
275
526
|
if (!lang) return [];
|
|
@@ -278,8 +529,20 @@ async function parseSource(file, source, language) {
|
|
|
278
529
|
const tree = parser.parse(source);
|
|
279
530
|
if (!tree) return [];
|
|
280
531
|
const root = tree.rootNode;
|
|
281
|
-
|
|
282
|
-
|
|
532
|
+
switch (lang) {
|
|
533
|
+
case "python":
|
|
534
|
+
return extractPython(root, file);
|
|
535
|
+
case "go":
|
|
536
|
+
return extractGo(root, file);
|
|
537
|
+
case "rust":
|
|
538
|
+
return extractRust(root, file);
|
|
539
|
+
case "java":
|
|
540
|
+
return extractJava(root, file);
|
|
541
|
+
case "cpp":
|
|
542
|
+
return extractCpp(root, file);
|
|
543
|
+
default:
|
|
544
|
+
return extractTsJs(root, file, lang);
|
|
545
|
+
}
|
|
283
546
|
} catch (err) {
|
|
284
547
|
return [];
|
|
285
548
|
}
|
|
@@ -303,7 +566,15 @@ var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
|
303
566
|
"venv",
|
|
304
567
|
".idea",
|
|
305
568
|
".vscode",
|
|
306
|
-
"release"
|
|
569
|
+
"release",
|
|
570
|
+
"target",
|
|
571
|
+
// Rust (cargo build) + Java (Maven)
|
|
572
|
+
"vendor",
|
|
573
|
+
// Go (vendored deps)
|
|
574
|
+
".gradle",
|
|
575
|
+
// Java (Gradle)
|
|
576
|
+
"cmake-build-debug",
|
|
577
|
+
"cmake-build-release"
|
|
307
578
|
]);
|
|
308
579
|
var MAX_FILE_BYTES = 2 * 1024 * 1024;
|
|
309
580
|
function collectFiles(root, maxFiles) {
|