@sdsrs/code-graph 0.11.2 → 0.11.4

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.
@@ -4,7 +4,7 @@
4
4
  "author": {
5
5
  "name": "sdsrs"
6
6
  },
7
- "version": "0.11.2",
7
+ "version": "0.11.4",
8
8
  "keywords": [
9
9
  "code-graph",
10
10
  "ast",
@@ -18,9 +18,11 @@ type: reference
18
18
 
19
19
  ## 何时调用 MCP/CLI(替代多步 Grep/Read)
20
20
 
21
- > v0.10.0 起:tools/list 默认只暴露 7 个核心工具;下表中 `⚙` 标记的 5 个工具
22
- > 已从 tools/list 隐藏以节省 session 启动 tokens,但**仍可通过名称直接调用**
23
- > (向后兼容别名)或用 CLI 子命令。高频场景可优先用核心 7 个。
21
+ > v0.10.0 起:tools/list 默认只暴露 7 个核心工具;下表"进阶 5"中的工具
22
+ > 已从 tools/list 隐藏以节省 session 启动 tokens。**Claude Code 里请走 CLI
23
+ > 子命令**(MCP schema 不在 list,Claude Code 的 ToolSearch 不会加载,直接
24
+ > 调用会得到 `No such tool available`——实测验证见下方"进阶 5")。写
25
+ > MCP SDK / 原生 `tools/call` JSON-RPC 的脚本场景仍可按名调用。
24
26
 
25
27
  ### 核心 7(tools/list 默认暴露)
26
28
 
@@ -34,19 +36,24 @@ type: reference
34
36
  | "看 X 的源码 / 签名" | `get_ast_node` / `show X` | `include_impact=true` 含影响面(替代 impact_analysis) |
35
37
  | "项目结构总览" | `project_map` / `map` | 起手势用 `--compact` |
36
38
 
37
- ### 进阶 5(隐藏但可调)
39
+ ### 进阶 5(Claude Code 里走 CLI;MCP 名调用仅限脚本/SDK)
38
40
 
39
- 5 个工具从 `tools/list` 隐藏(省 token),但**仍可按名调用**。由于 schema 不在 list 里,**必须用下表列出的精确参数名**(猜错会返回 `"<param> is required"` 错误)。
41
+ **实测**:从 Claude Code 里直接调 `mcp__plugin_code-graph-mcp_code-graph__<tool>`
42
+ 会得到 `No such tool available`——Claude Code 的 `ToolSearch` 只为 `tools/list`
43
+ 里的工具生成 schema,hidden 5 在 list 之外就加载不到。**Claude Code 场景一律用
44
+ 下表 CLI 列**。raw JSON-RPC (`tools/call`) 仍接受这 5 个名字(含向后兼容别名
45
+ `find_http_route` → `trace_http_chain`, `read_snippet` → `get_ast_node`)。
40
46
 
41
- | 意图 | 工具 | 必填参数 | 可选参数 |
42
- |------|------|----------|----------|
43
- | "改 X 会炸啥?" | `impact_analysis` | `symbol_name` | `file_path`, `change_type` ∈ {signature,behavior,remove}, `depth` |
44
- | HTTP 路由 → handler 链路 | `trace_http_chain` | **`route_path`** ⚠(不是 `route`) | `depth` |
45
- | "X 文件依赖谁?" | `dependency_graph` | `file_path` | `direction` ∈ {outgoing,incoming,both}, `depth`, `compact` |
46
- | "相似/重复函数"(需 embedding) | `find_similar_code` | `symbol_name` 或 `node_id` | `top_k`, `max_distance` |
47
- | "未使用的代码" | `find_dead_code` | | `path`, `node_type`, `include_tests`, `min_lines`, `compact`, **`ignore_paths`** (prefix glob 数组;默认 `["claude-plugin/"]`,传 `[]` 关闭默认豁免) |
47
+ | 意图 | CLI(Claude Code 首选) | MCP 工具名(SDK/脚本) | 关键参数 |
48
+ |------|--------------------------|------------------------|----------|
49
+ | "改 X 会炸啥?" | `code-graph-mcp impact X` | `impact_analysis` | `symbol_name` (必), `file_path`, `change_type` ∈ {signature,behavior,remove}, `depth` |
50
+ | HTTP 路由 → handler 链路 | `code-graph-mcp trace /api/x` | `trace_http_chain` | **`route_path`** (不是 `route`), `depth` |
51
+ | "X 文件依赖谁?" | `code-graph-mcp deps src/x.rs` | `dependency_graph` | `file_path` (必), `direction` ∈ {outgoing,incoming,both}, `depth`, `compact` |
52
+ | "相似/重复函数"(需 embedding) | `code-graph-mcp similar X` | `find_similar_code` | `symbol_name` 或 `node_id` (必), `top_k`, `max_distance` |
53
+ | "未使用的代码" | `code-graph-mcp dead-code [path]` | `find_dead_code` | `path`, `node_type`, `include_tests`, `min_lines`, `compact`, **`ignore_paths`** (prefix glob 数组;默认 `["claude-plugin/"]`,传 `[]` 关闭默认豁免) |
48
54
 
49
- CLI 等价:`impact/trace/deps/similar/dead-code`(见下方 CLI 速查)。
55
+ **替代路径**:核心 7 里的 `get_ast_node include_impact=true` 覆盖 `impact_analysis`
56
+ 的常用场景(风险等级 + 直接/传递调用者 + 受影响文件/路由),不必跳到 CLI。
50
57
 
51
58
  ## 不要替代
52
59
 
@@ -59,8 +66,8 @@ CLI 等价:`impact/trace/deps/similar/dead-code`(见下方 CLI 速查)。
59
66
  1. 起手 `project_map --compact` 看架构
60
67
  2. `semantic_code_search` 默认带 `compact=true`,省 token
61
68
  3. 展开节点:`get_ast_node node_id=N compact=true` 看签名 / 不带 compact 看全文
62
- 4. 改前评估影响:`get_ast_node symbol_name=X include_impact=true`(核心 7 内)
63
- 或直接 `impact_analysis symbol_name=X`(隐藏但可调,输出更细:风险等级 + 路由 + 文件计数)
69
+ 4. 改前评估影响:`get_ast_node symbol_name=X include_impact=true`(核心 7 内,首选)
70
+ Bash 调 `code-graph-mcp impact X`(独立进程;输出更细:风险等级 + 路由 + 文件计数)
64
71
  5. 搜不到结果 → `code-graph-mcp health-check` 检查索引与 embedding 覆盖率
65
72
 
66
73
  可用 prompts:`impact-analysis`、`understand-module`、`trace-request`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdsrs/code-graph",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "MCP server that indexes codebases into an AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -34,10 +34,10 @@
34
34
  "node": ">=16"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@sdsrs/code-graph-linux-x64": "0.11.2",
38
- "@sdsrs/code-graph-linux-arm64": "0.11.2",
39
- "@sdsrs/code-graph-darwin-x64": "0.11.2",
40
- "@sdsrs/code-graph-darwin-arm64": "0.11.2",
41
- "@sdsrs/code-graph-win32-x64": "0.11.2"
37
+ "@sdsrs/code-graph-linux-x64": "0.11.4",
38
+ "@sdsrs/code-graph-linux-arm64": "0.11.4",
39
+ "@sdsrs/code-graph-darwin-x64": "0.11.4",
40
+ "@sdsrs/code-graph-darwin-arm64": "0.11.4",
41
+ "@sdsrs/code-graph-win32-x64": "0.11.4"
42
42
  }
43
43
  }