@@ -6,7 +6,7 @@ AST-based code graph mapping plugin for [Claude Code](https://docs.anthropic.com
66
77## 特性 / Features
88
9- - ** AST 解析 / AST Parsing** — 使用 tree-sitter (WASM) 进行精确的结构分析 ,非正则猜测 / Uses tree-sitter (WASM) for accurate structural analysis, no regex guessing
9+ - ** AST 解析 / AST Parsing** — 使用 tree-sitter 原生绑定进行精确的结构分析 ,非正则猜测 / Uses tree-sitter native bindings for accurate structural analysis, no regex guessing
1010- ** 多语言支持 / Multi-Language** — TypeScript, JavaScript, Python, Go, Rust, Java, C, C++
1111- ** 智能切片 / Smart Slicing** — 项目概览 (~ 500 tokens) + 按模块切片 (~ 2-5k tokens),替代全量源码 (~ 200k+) / Project overview (~ 500 tokens) + per-module slices (~ 2-5k tokens) instead of full source (~ 200k+)
1212- ** 增量更新 / Incremental Updates** — 基于文件哈希比较检测变更,仅重新解析修改的文件 / File hash comparison detects changes; only re-parses modified files
@@ -19,8 +19,6 @@ AST-based code graph mapping plugin for [Claude Code](https://docs.anthropic.com
1919
2020### 前置条件 / Prerequisites
2121
22- - ** Node.js** >= 18
23- - ** npm** >= 9
2422- ** Claude Code** CLI ([ 安装指南 / Install Guide] ( https://docs.anthropic.com/en/docs/claude-code ) )
2523
2624### 方式一:作为 Claude Code 插件安装(推荐)/ Install as Claude Code Plugin (Recommended)
@@ -32,22 +30,26 @@ git clone https://github.com/killvxk/CodeMap.git
3230cd CodeMap
3331```
3432
35- #### 2. 安装 CLI 依赖 / Install CLI dependencies
33+ #### 2. 验证 CLI 可用 / Verify CLI works
3634
37- ``` bash
38- cd ccplugin/cli
39- npm install
40- cd ../..
41- ```
35+ 预编译二进制已包含在 ` ccplugin/bin/ ` 目录中,无需额外安装依赖:
4236
43- #### 3. 验证 CLI 可用 / Verify CLI works
37+ The pre-compiled binary is included in ` ccplugin/bin/ ` — no additional dependencies required:
4438
4539``` bash
46- node ccplugin/cli/bin/codegraph.js --version
47- # 输出 / Output: 0.1.0
40+ # Linux / macOS
41+ ccplugin/bin/codegraph-linux --version # Linux x64
42+ ccplugin/bin/codegraph-macos --version # macOS (Intel/Apple Silicon)
43+
44+ # Windows (Git Bash / PowerShell)
45+ ccplugin/bin/codegraph-windows.exe --version
4846```
4947
50- #### 4. 安装为 Claude Code 插件 / Install as Claude Code plugin
48+ > 如果 ` ccplugin/bin/ ` 中没有适合你平台的二进制,可以从 [ GitHub Releases] ( https://github.com/killvxk/CodeMap/releases ) 下载,或参考下方"从源码构建"说明。
49+ >
50+ > If no binary matches your platform in ` ccplugin/bin/ ` , download from [ GitHub Releases] ( https://github.com/killvxk/CodeMap/releases ) or see "Build from Source" below.
51+
52+ #### 3. 安装为 Claude Code 插件 / Install as Claude Code plugin
5153
5254在 Claude Code 对话中执行以下命令(注意:这是 Claude Code 内部的斜杠命令,不是终端命令):
5355
@@ -75,7 +77,7 @@ After installation, **restart Claude Code** for the plugin to take effect.
7577>
7678> Claude Code reads ` .claude-plugin/marketplace.json ` at the repo root, where ` "source": "./ccplugin" ` points to the plugin directory. It then loads ` ccplugin/.claude-plugin/plugin.json ` and auto-discovers commands in ` ccplugin/commands/ ` , skills in ` ccplugin/skills/ ` , and hooks in ` ccplugin/hooks/ ` .
7779
78- #### 5 . 验证插件已安装 / Verify plugin installed
80+ #### 4 . 验证插件已安装 / Verify plugin installed
7981
8082重启 Claude Code 后,输入 / After restarting Claude Code, type:
8183
@@ -93,17 +95,25 @@ If the plugin is installed correctly, this command will trigger the code scan wo
9395/plugin uninstall codemap@codemap-plugins
9496```
9597
96- ### 方式二:全局安装 CLI / Global CLI Installation
98+ ### 方式二:下载预编译二进制 / Download Pre-compiled Binary
9799
98- 如果你只需要 CLI 工具(不需要 Claude Code 插件集成) :
100+ 从 [ GitHub Releases ] ( https://github.com/killvxk/CodeMap/releases ) 下载适合你平台的二进制文件 :
99101
100- If you only need the CLI tool (without Claude Code plugin integration ):
102+ Download the binary for your platform from [ GitHub Releases ] ( https://github.com/killvxk/CodeMap/releases ) :
101103
102104``` bash
103- git clone https://github.com/killvxk/CodeMap.git
104- cd CodeMap/ccplugin/cli
105- npm install
106- npm link
105+ # Linux x64
106+ curl -L https://github.com/killvxk/CodeMap/releases/latest/download/codegraph-linux -o codegraph
107+ chmod +x codegraph
108+ sudo mv codegraph /usr/local/bin/
109+
110+ # macOS (Intel / Apple Silicon — 通用二进制)
111+ curl -L https://github.com/killvxk/CodeMap/releases/latest/download/codegraph-macos -o codegraph
112+ chmod +x codegraph
113+ sudo mv codegraph /usr/local/bin/
114+
115+ # Windows (PowerShell)
116+ Invoke-WebRequest -Uri https://github.com/killvxk/CodeMap/releases/latest/download/codegraph-windows.exe -OutFile codegraph.exe
107117```
108118
109119安装后可以直接使用 ` codegraph ` 命令:
@@ -116,51 +126,43 @@ codegraph status /path/to/project
116126codegraph query handleLogin --dir /path/to/project
117127```
118128
119- ### 方式三:构建发布包 / Build Release Distribution
120-
121- 用于将 CLI 打包分发给他人或部署到 CI。
129+ ### 方式三:从源码构建 / Build from Source
122130
123- For packaging the CLI to distribute or deploy in CI.
131+ 需要 Rust 工具链( [ rustup.rs ] ( https://rustup.rs ) ):
124132
125- #### 生成 npm tarball / Generate npm tarball
133+ Requires Rust toolchain ( [ rustup.rs ] ( https://rustup.rs ) ):
126134
127135``` bash
128- cd ccplugin/cli
129- npm pack
130- # 生成 / Produces: codegraph-0.1.0.tgz
131- ```
132-
133- #### 从 tarball 安装 / Install from tarball
134-
135- ``` bash
136- npm install -g codegraph-0.1.0.tgz
137- codegraph --version
136+ git clone https://github.com/killvxk/CodeMap.git
137+ cd CodeMap/rust-cli
138+ cargo build --release
139+ # 二进制输出到 / Binary at: target/release/codegraph
138140```
139141
140142#### GitHub Release 发布流程 / GitHub Release Workflow
141143
142144``` bash
143145# 1. 确保测试通过 / Ensure tests pass
144- cd ccplugin/cli && npm test
145-
146- # 2. 更新版本号 / Bump version
147- npm version patch # 或 minor / major
146+ cd rust-cli && cargo test
148147
149- # 3. 生成发布包 / Generate release package
150- npm pack
148+ # 2. 交叉编译所有平台 / Cross-compile for all platforms
149+ cargo build --release --target x86_64-unknown-linux-gnu
150+ cargo build --release --target aarch64-apple-darwin
151+ cargo build --release --target x86_64-pc-windows-gnu
151152
152- # 4 . 提交并打 tag / Commit and tag
153- cd ../..
153+ # 3 . 提交并打 tag / Commit and tag
154+ cd ..
154155git add .
155- git commit -m " release: v $( node -p " require('./ccplugin/cli/package.json').version " ) "
156- git tag " v $( node -p " require('./ccplugin/cli/package.json').version " ) "
156+ git commit -m " release: v0.2.0 "
157+ git tag v0.2.0
157158git push origin main --tags
158159
159- # 5. 在 GitHub 创建 Release,上传 .tgz 文件
160- # Create a GitHub Release and upload the .tgz file
161- gh release create " v$( node -p " require('./ccplugin/cli/package.json').version" ) " \
162- ccplugin/cli/codegraph-* .tgz \
163- --title " CodeMap v$( node -p " require('./ccplugin/cli/package.json').version" ) " \
160+ # 4. 在 GitHub 创建 Release,上传二进制 / Create GitHub Release and upload binaries
161+ gh release create v0.2.0 \
162+ ccplugin/bin/codegraph-linux \
163+ ccplugin/bin/codegraph-macos \
164+ ccplugin/bin/codegraph-windows.exe \
165+ --title " CodeMap v0.2.0" \
164166 --generate-notes
165167```
166168
@@ -187,22 +189,24 @@ CodeMap/
187189│ │ ├── hooks.json # SessionStart 自动检测
188190│ │ └── scripts/
189191│ │ └── detect-codemap.sh
190- │ └── cli/ # CLI 工具
191- │ ├── bin/codegraph.js # 入口 / Entry point
192- │ ├── src/ # 源码 / Source
193- │ │ ├── index.js # Commander 注册
194- │ │ ├── scanner.js # 全量扫描引擎
195- │ │ ├── parser.js # tree-sitter WASM 解析
196- │ │ ├── graph.js # 图谱数据结构
197- │ │ ├── differ.js # 增量更新引擎
198- │ │ ├── query.js # 查询引擎
199- │ │ ├── slicer.js # 切片生成
200- │ │ ├── impact.js # 影响分析
201- │ │ ├── traverser.js # 文件遍历与语言检测
202- │ │ ├── commands/ # CLI 命令实现
203- │ │ └── languages/ # 语言适配器 (8 种)
204- │ ├── test/ # 测试 (84 tests)
205- │ └── package.json
192+ │ └── bin/ # 预编译二进制 / Pre-compiled binaries
193+ │ ├── codegraph-linux # Linux x64
194+ │ ├── codegraph-macos # macOS (Intel + Apple Silicon)
195+ │ └── codegraph-windows.exe # Windows x64
196+ ├── rust-cli/ # Rust CLI 源码 / Rust CLI source
197+ │ ├── Cargo.toml
198+ │ ├── src/
199+ │ │ ├── main.rs # CLI 入口(clap)
200+ │ │ ├── scanner.rs # 全量扫描引擎
201+ │ │ ├── graph.rs # 图谱数据结构
202+ │ │ ├── differ.rs # 增量更新引擎
203+ │ │ ├── query.rs # 查询引擎
204+ │ │ ├── slicer.rs # 切片生成
205+ │ │ ├── impact.rs # 影响分析
206+ │ │ ├── path_utils.rs # 共享路径工具函数
207+ │ │ ├── traverser.rs # 文件遍历与语言检测
208+ │ │ └── languages/ # 语言适配器 (8 种)
209+ │ └── tests/ # 集成测试 (286 tests)
206210├── README.md
207211└── LICENSE # MIT
208212```
@@ -211,9 +215,9 @@ CodeMap/
211215
212216## CLI 命令 / CLI Commands
213217
214- 所有命令通过 ` codegraph <command> ` 或 ` node ccplugin/cli/bin/codegraph .js <command> ` 运行 。
218+ 所有命令通过 ` codegraph <command> ` 运行(预编译二进制,无需 Node .js) 。
215219
216- All commands run via ` codegraph <command> ` or ` node ccplugin/cli/bin/codegraph .js <command> ` .
220+ All commands run via ` codegraph <command> ` (pre-compiled binary, no Node .js required) .
217221
218222| 命令 / Command | 描述 / Description |
219223| ---------| -------------|
@@ -322,9 +326,9 @@ Scanning produces a `.codemap/` directory inside the target project:
322326## 测试 / Tests
323327
324328``` bash
325- cd ccplugin/ cli
326- npm test
327- # 84 tests, 14 test suites
329+ cd rust- cli
330+ cargo test
331+ # 286 tests, all passing
328332```
329333
330334## 许可证 / License
0 commit comments