Skip to content

Commit fc547bb

Browse files
sdsrssclaude
andcommitted
fix(mcp): 4 residual precision fixes after 12-tool audit (v0.11.2)
Follow-up on v0.11.1 audit. All additive/tightening, no schema breakage. 1. module_overview no longer leaks inline #[cfg(test)] fns - SQL now filters n.is_test=0 on both explicit-exports and fallback paths in get_module_exports; AST flag propagates end-to-end. - Name-heuristic was missing `#[cfg(test)] mod tests { #[test] fn X }` where X lacked the test_ prefix. 2. Disambiguation suggestions carry node_id + start_line - NameCandidate extended with both fields; resolve_fuzzy_name and disambiguate_symbol emit them. - disambiguate_symbol now fires on same-file multi-def (not just cross-file), closing the 2-fn-new()-in-one-module gap. 3. find_references gains node_id parameter - Same-file multi-def surfaces an ambiguity response with per-def suggestions (node_id + start_line) instead of silently merging refs across defs. 4. find_dead_code gets ignore_paths (MCP) / --ignore + --no-ignore (CLI) - Prefix-match exclusions with default [claude-plugin/] to suppress shell-invoked plugin entry points that the AST graph can't reach. - Response carries ignored_count / ignore_paths_applied / ignore_paths_defaulted for transparency. Docs: plugin_code_graph_mcp.md adds explicit param tables for hidden-5 tools — notably trace_http_chain takes route_path (not route). Tests: +4 (1 unit, 3 integration). 347 passed default features, 340 passed --no-default-features. Clippy -D warnings clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c82eafa commit fc547bb

File tree

20 files changed

+441
-56
lines changed

20 files changed

+441
-56
lines changed

.claude-plugin/marketplace.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
},
66
"metadata": {
77
"description": "AST knowledge graph plugin for Claude Code — semantic search, call graph, HTTP tracing, impact analysis",
8-
"version": "0.11.1"
8+
"version": "0.11.2"
99
},
1010
"plugins": [
1111
{
1212
"name": "code-graph-mcp",
1313
"source": "./claude-plugin",
1414
"description": "AST knowledge graph for intelligent code navigation — auto-indexes your codebase and provides semantic search, call graph traversal, HTTP route tracing, and impact analysis via MCP tools",
15-
"version": "0.11.1",
15+
"version": "0.11.2",
1616
"author": {
1717
"name": "sdsrs"
1818
},

CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
# Changelog
22

3+
## v0.11.2 — Post-audit follow-up: 4 residual precision fixes
4+
5+
Follow-up audit on top of v0.11.1. All additive/tightening — no schema breakage.
6+
7+
### Fixes
8+
9+
1. **`module_overview` no longer leaks inline `#[cfg(test)]` test fns.**
10+
Name-heuristic `is_test_symbol` couldn't catch `#[cfg(test)] mod tests { #[test] fn anything_goes }`
11+
whose names don't prefix `test_`. Root fix: `get_module_exports` SQL now
12+
`WHERE n.is_test = 0` on both the explicit-exports (JS/TS) path and the
13+
fallback (Rust / Go / Python) path — AST-level flag propagates through.
14+
15+
2. **Disambiguation suggestions carry `node_id` + `start_line`.**
16+
`resolve_fuzzy_name` and `disambiguate_symbol` suggestions now include
17+
both fields so callers can pick a specific definition when multiple
18+
same-name functions live in one file (e.g. two `fn new()` in different
19+
`impl` blocks of the same module). `disambiguate_symbol` also fires on
20+
same-file multi-def, not just cross-file collisions.
21+
22+
3. **`find_references` gains `node_id` parameter.** Lets callers pass the
23+
`node_id` from a suggestion directly, skipping the ambiguous name-lookup
24+
step. When a name is ambiguous within one file, the tool now returns
25+
a per-definition suggestion list (with `start_line`) instead of silently
26+
merging refs across defs.
27+
28+
4. **`find_dead_code` gets `ignore_paths` (MCP) / `--ignore` (CLI).**
29+
Shell-invoked plugin entry points (lifecycle/hook scripts in
30+
`claude-plugin/`) are not in the static AST call graph, so they surfaced
31+
as false-positive orphans. Added prefix-match exclusions with a sensible
32+
default (`["claude-plugin/"]`). Pass `ignore_paths: []` or
33+
`--no-ignore` to see the full list. Response carries `ignored_count`,
34+
`ignore_paths_applied`, `ignore_paths_defaulted` for transparency.
35+
36+
### Docs
37+
38+
- `plugin_code_graph_mcp.md`: hidden-5 tools now have an explicit
39+
required/optional parameter table (notably `trace_http_chain` takes
40+
`route_path`, not `route`) — users calling by name no longer need to
41+
trigger the error message to discover arg names.
42+
43+
### Tests
44+
45+
+4 new (+1 unit in `queries.rs`, +3 integration covering Bug #1 / Issue #3 /
46+
Bug #2). Full suite: **347 passed / 0 failed** default features,
47+
**340 passed / 0 failed** `--no-default-features`; clippy
48+
`-D warnings` clean under both feature configs.
49+
350
## v0.11.1 — 12-tool accuracy audit: 1 critical bugfix + 5 precision improvements
451

552
Post-audit fixes for tool output correctness. All changes are additive/tightening —

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "code-graph-mcp"
3-
version = "0.11.1"
3+
version = "0.11.2"
44
edition = "2021"
55

66
[features]

claude-plugin/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"author": {
55
"name": "sdsrs"
66
},
7-
"version": "0.11.1",
7+
"version": "0.11.2",
88
"keywords": [
99
"code-graph",
1010
"ast",

claude-plugin/templates/plugin_code_graph_mcp.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ type: reference
3636

3737
### 进阶 5(隐藏但可调)
3838

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 |
39+
这 5 个工具从 `tools/list` 隐藏(省 token),但**仍可按名调用**。由于 schema 不在 list 里,**必须用下表列出的精确参数名**(猜错会返回 `"<param> is required"` 错误)。
40+
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/"]`,传 `[]` 关闭默认豁免) |
48+
49+
CLI 等价:`impact/trace/deps/similar/dead-code`(见下方 CLI 速查)。
4650

4751
## 不要替代
4852

@@ -73,7 +77,9 @@ code-graph-mcp callgraph SYMBOL # 调用图
7377
code-graph-mcp impact SYMBOL # 影响面
7478
code-graph-mcp show SYMBOL # 节点详情
7579
code-graph-mcp refs SYMBOL --relation calls # 引用筛选
76-
code-graph-mcp dead-code [path] # 未使用代码
80+
code-graph-mcp dead-code [path] # 未使用代码(默认豁免 claude-plugin/)
81+
code-graph-mcp dead-code --ignore tmp/ --ignore scripts/bin/ # 自定义豁免前缀
82+
code-graph-mcp dead-code --no-ignore # 关掉默认豁免,看完整列表
7783
code-graph-mcp health-check # 索引健康
7884
```
7985

npm/darwin-arm64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sdsrs/code-graph-darwin-arm64",
3-
"version": "0.11.1",
3+
"version": "0.11.2",
44
"description": "code-graph-mcp binary for macOS ARM64",
55
"license": "MIT",
66
"repository": {

npm/darwin-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sdsrs/code-graph-darwin-x64",
3-
"version": "0.11.1",
3+
"version": "0.11.2",
44
"description": "code-graph-mcp binary for macOS x64",
55
"license": "MIT",
66
"repository": {

npm/linux-arm64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sdsrs/code-graph-linux-arm64",
3-
"version": "0.11.1",
3+
"version": "0.11.2",
44
"description": "code-graph-mcp binary for Linux ARM64",
55
"license": "MIT",
66
"repository": {

npm/linux-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sdsrs/code-graph-linux-x64",
3-
"version": "0.11.1",
3+
"version": "0.11.2",
44
"description": "code-graph-mcp binary for Linux x64",
55
"license": "MIT",
66
"repository": {

0 commit comments

Comments
 (0)