Skip to content

Commit 141358d

Browse files
invalidclaude
andcommitted
docs: add README, MIT license, ignore docs/ directory
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8db2e4d commit 141358d

3 files changed

Lines changed: 129 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules/
22
dist/
33
.codemap/
4+
docs/
45
*.log
56
.DS_Store

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# CodeMap
2+
3+
AST-based code graph mapping plugin for [Claude Code](https://docs.anthropic.com/en/docs/claude-code). Scan your codebase once, persist a structural graph, and load compact slices in future sessions — saving ~95% tokens compared to re-reading all source files.
4+
5+
## Features
6+
7+
- **AST Parsing** — Uses tree-sitter (WASM) for accurate structural analysis, no regex guessing
8+
- **Multi-Language** — TypeScript, JavaScript, Python, Go, Rust, Java, C, C++
9+
- **Smart Slicing** — Project overview (~500 tokens) + per-module slices (~2-5k tokens) instead of full source (~200k+)
10+
- **Incremental Updates** — File hash comparison detects changes; only re-parses modified files
11+
- **Impact Analysis** — See what's affected before you refactor
12+
- **Auto-Triggering** — Skills activate automatically based on your conversation context
13+
14+
## Installation
15+
16+
```bash
17+
cd cli
18+
npm install
19+
```
20+
21+
Then register the plugin in Claude Code by pointing to the `.claude-plugin/` directory.
22+
23+
## CLI Commands
24+
25+
All commands are run via `node cli/bin/codegraph.js <command>`.
26+
27+
| Command | Description |
28+
|---------|-------------|
29+
| `scan <dir>` | Full AST scan, generates `.codemap/` with graph + slices |
30+
| `status` | Show graph metadata (files, modules, last scan time) |
31+
| `query <symbol>` | Search for functions, classes, types by name |
32+
| `slice [module]` | Output project overview or a specific module slice as JSON |
33+
| `update` | Incremental update — re-parse only changed files |
34+
| `impact <target>` | Analyze which modules are affected by changing a target |
35+
36+
### Examples
37+
38+
```bash
39+
# Scan a project
40+
node cli/bin/codegraph.js scan /path/to/project
41+
42+
# Check graph status
43+
node cli/bin/codegraph.js status
44+
45+
# Query a symbol
46+
node cli/bin/codegraph.js query "handleLogin"
47+
48+
# Get module slice with dependencies
49+
node cli/bin/codegraph.js slice auth --with-deps
50+
51+
# Incremental update after code changes
52+
node cli/bin/codegraph.js update
53+
54+
# Impact analysis before refactoring
55+
node cli/bin/codegraph.js impact auth --depth 3
56+
```
57+
58+
## Skills
59+
60+
When installed as a Claude Code plugin, these skills auto-trigger based on conversation context:
61+
62+
| Skill | Triggers On |
63+
|-------|------------|
64+
| `/scan` | "扫描", "索引", "scan", "index", "map codebase" |
65+
| `/load` | "加载图谱", "项目结构", "load", "code structure" |
66+
| `/update` | "更新图谱", "refresh", "代码改了" |
67+
| `/query` | "查找", "谁调用了", "where is", "find function" |
68+
| `/impact` | "影响范围", "refactor impact", "change impact" |
69+
70+
## Supported Languages
71+
72+
| Language | Extensions | Extracted Structures |
73+
|----------|-----------|---------------------|
74+
| TypeScript | `.ts`, `.tsx` | Functions, imports, exports, classes, interfaces, type aliases |
75+
| JavaScript | `.js`, `.jsx`, `.mjs`, `.cjs` | Functions, imports, exports, classes |
76+
| Python | `.py` | Functions (decorated), imports, `__all__` exports, classes |
77+
| Go | `.go` | Functions, methods (with receiver), imports, exported names, structs, type specs |
78+
| Rust | `.rs` | Functions, impl methods, use declarations, pub exports, structs, enums, traits |
79+
| Java | `.java` | Methods, constructors, imports, public exports, classes, interfaces, enums |
80+
| C | `.c`, `.h` | Functions, `#include`, non-static exports, structs, enums, typedefs |
81+
| C++ | `.cpp`, `.cc`, `.cxx`, `.hpp`, `.hh` | Qualified functions (`Class::method`), includes, classes, structs, namespaces |
82+
83+
## Graph Structure
84+
85+
Scanning produces a `.codemap/` directory:
86+
87+
```
88+
.codemap/
89+
├── graph.json # Full structural graph
90+
├── meta.json # File hashes, timestamps, commit info
91+
└── slices/
92+
├── _overview.json # Compact project overview (~500 tokens)
93+
├── auth.json # Per-module detailed slice
94+
├── api.json
95+
└── ...
96+
```
97+
98+
## Tests
99+
100+
```bash
101+
cd cli
102+
npm test
103+
```
104+
105+
## License
106+
107+
[MIT](LICENSE)

0 commit comments

Comments
 (0)