@sdsrs/code-graph 0.11.1 → 0.11.3

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.1",
7
+ "version": "0.11.3",
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,15 +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
- | 意图 | 工具 | 关键参数 / 例子 |
40
- |------|------|----------------|
41
- | "改 X 会炸啥?" | `impact_analysis` / `impact X` | 修改签名前用;或 `get_ast_node` + `include_impact=true` |
42
- | HTTP 路由 → handler 链路 | `trace_http_chain` / `trace ROUTE` | API 调试 |
43
- | ⚙ "X 文件依赖谁?" | `dependency_graph` / `deps X` | file 级别 |
44
- | ⚙ "相似/重复函数" | `find_similar_code` / `similar X` | 需 embedding |
45
- | "未使用的代码" | `find_dead_code` / `dead-code [path]` | 清理 exports |
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`)。
46
+
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/"]`,传 `[]` 关闭默认豁免) |
54
+
55
+ **替代路径**:核心 7 里的 `get_ast_node include_impact=true` 覆盖 `impact_analysis`
56
+ 的常用场景(风险等级 + 直接/传递调用者 + 受影响文件/路由),不必跳到 CLI。
46
57
 
47
58
  ## 不要替代
48
59
 
@@ -55,8 +66,8 @@ type: reference
55
66
  1. 起手 `project_map --compact` 看架构
56
67
  2. `semantic_code_search` 默认带 `compact=true`,省 token
57
68
  3. 展开节点:`get_ast_node node_id=N compact=true` 看签名 / 不带 compact 看全文
58
- 4. 改前评估影响:`get_ast_node symbol_name=X include_impact=true`(核心 7 内)
59
- 或直接 `impact_analysis symbol_name=X`(隐藏但可调,输出更细:风险等级 + 路由 + 文件计数)
69
+ 4. 改前评估影响:`get_ast_node symbol_name=X include_impact=true`(核心 7 内,首选)
70
+ Bash 调 `code-graph-mcp impact X`(独立进程;输出更细:风险等级 + 路由 + 文件计数)
60
71
  5. 搜不到结果 → `code-graph-mcp health-check` 检查索引与 embedding 覆盖率
61
72
 
62
73
  可用 prompts:`impact-analysis`、`understand-module`、`trace-request`
@@ -73,7 +84,9 @@ code-graph-mcp callgraph SYMBOL # 调用图
73
84
  code-graph-mcp impact SYMBOL # 影响面
74
85
  code-graph-mcp show SYMBOL # 节点详情
75
86
  code-graph-mcp refs SYMBOL --relation calls # 引用筛选
76
- code-graph-mcp dead-code [path] # 未使用代码
87
+ code-graph-mcp dead-code [path] # 未使用代码(默认豁免 claude-plugin/)
88
+ code-graph-mcp dead-code --ignore tmp/ --ignore scripts/bin/ # 自定义豁免前缀
89
+ code-graph-mcp dead-code --no-ignore # 关掉默认豁免,看完整列表
77
90
  code-graph-mcp health-check # 索引健康
78
91
  ```
79
92
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdsrs/code-graph",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
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.1",
38
- "@sdsrs/code-graph-linux-arm64": "0.11.1",
39
- "@sdsrs/code-graph-darwin-x64": "0.11.1",
40
- "@sdsrs/code-graph-darwin-arm64": "0.11.1",
41
- "@sdsrs/code-graph-win32-x64": "0.11.1"
37
+ "@sdsrs/code-graph-linux-x64": "0.11.3",
38
+ "@sdsrs/code-graph-linux-arm64": "0.11.3",
39
+ "@sdsrs/code-graph-darwin-x64": "0.11.3",
40
+ "@sdsrs/code-graph-darwin-arm64": "0.11.3",
41
+ "@sdsrs/code-graph-win32-x64": "0.11.3"
42
42
  }
43
43
  }