clast-ai 0.1.0 → 0.1.2
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.
- package/README.md +92 -23
- package/dist/server/tools/clast-call-graph.js +1 -1
- package/dist/server/tools/clast-call-graph.js.map +1 -1
- package/dist/server/tools/clast-file-summary.js +1 -1
- package/dist/server/tools/clast-file-summary.js.map +1 -1
- package/dist/server/tools/clast-get-context.js +1 -1
- package/dist/server/tools/clast-get-context.js.map +1 -1
- package/dist/server/tools/clast-search.js +1 -1
- package/dist/server/tools/clast-search.js.map +1 -1
- package/package.json +1 -1
- package/src/server/tools/clast-call-graph.ts +1 -1
- package/src/server/tools/clast-file-summary.ts +1 -1
- package/src/server/tools/clast-get-context.ts +1 -1
- package/src/server/tools/clast-search.ts +1 -1
package/README.md
CHANGED
|
@@ -16,50 +16,63 @@ AST-based code intelligence plugin for Claude Code. Indexes your repository usin
|
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
**Two steps:** install the package, then register it with Claude Code.
|
|
20
|
+
|
|
21
|
+
### Step 1: Install
|
|
20
22
|
|
|
21
23
|
```bash
|
|
22
24
|
npm install -g clast-ai
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
###
|
|
27
|
+
### Step 2: Register with Claude Code
|
|
26
28
|
|
|
27
29
|
```bash
|
|
28
|
-
|
|
30
|
+
claude mcp add -s user clast clast-ai
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
The `-s user` flag makes it available globally across all projects. Without it, the server is only registered for the current directory.
|
|
34
|
+
|
|
35
|
+
### Step 3: Reload
|
|
36
|
+
|
|
37
|
+
- **VS Code:** Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac) → type "Developer: Reload Window" → Enter
|
|
38
|
+
- **CLI:** Just relaunch `claude`
|
|
39
|
+
|
|
40
|
+
### Step 4: Verify
|
|
41
|
+
|
|
42
|
+
Type `/mcp` in the Claude Code chat panel. You should see `clast` listed with 7 tools.
|
|
43
|
+
|
|
44
|
+
> **That's it.** Clast will automatically index your project when Claude Code starts. No config files needed.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### Alternative Install Methods
|
|
32
49
|
|
|
33
|
-
|
|
50
|
+
**From GitHub (no npm publish needed):**
|
|
34
51
|
|
|
35
52
|
```bash
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
npm install
|
|
39
|
-
npm run build
|
|
53
|
+
npm install -g github:xls/clast
|
|
54
|
+
claude mcp add -s user clast clast-ai
|
|
40
55
|
```
|
|
41
56
|
|
|
42
|
-
|
|
57
|
+
**Clone and build:**
|
|
43
58
|
|
|
44
59
|
```bash
|
|
45
60
|
git clone https://github.com/xls/clast.git
|
|
46
61
|
cd clast
|
|
47
62
|
npm install && npm run build
|
|
48
|
-
claude
|
|
63
|
+
claude mcp add clast node /path/to/clast/dist/server/index.js
|
|
49
64
|
```
|
|
50
65
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
### Publishing to npm
|
|
54
|
-
|
|
55
|
-
If you want to publish your own fork:
|
|
66
|
+
**As a Claude Code Plugin** (includes auto-triggering skill):
|
|
56
67
|
|
|
57
68
|
```bash
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
git clone https://github.com/xls/clast.git
|
|
70
|
+
cd clast
|
|
71
|
+
npm install && npm run build
|
|
72
|
+
claude plugin add /path/to/clast
|
|
60
73
|
```
|
|
61
74
|
|
|
62
|
-
|
|
75
|
+
> The plugin install bundles a model-invoked skill that automatically tells Claude to prefer Clast tools over grep/file reading. With the MCP-only install, you may need to tell Claude to use the clast tools.
|
|
63
76
|
|
|
64
77
|
---
|
|
65
78
|
|
|
@@ -80,10 +93,14 @@ Add to `~/.claude/settings.local.json`:
|
|
|
80
93
|
Or using the CLI:
|
|
81
94
|
|
|
82
95
|
```bash
|
|
83
|
-
claude mcp add
|
|
96
|
+
claude mcp add -s user clast clast-ai
|
|
97
|
+
# ^^^^^^^ ^^^^^ ^^^^^^^^
|
|
98
|
+
# global name command
|
|
84
99
|
```
|
|
85
100
|
|
|
86
|
-
|
|
101
|
+
> `-s user` makes it global (available in all projects). `clast` is the server name. `clast-ai` is the npm binary.
|
|
102
|
+
|
|
103
|
+
Reload VS Code (`Ctrl+Shift+P` → "Developer: Reload Window") or relaunch the CLI. Clast will automatically index whichever project directory you open.
|
|
87
104
|
|
|
88
105
|
## Setup for VS Code (Claude Code Extension)
|
|
89
106
|
|
|
@@ -92,7 +109,7 @@ The Claude Code extension for VS Code uses the **same MCP configuration files**
|
|
|
92
109
|
**Step 1:** Open VS Code's integrated terminal and run:
|
|
93
110
|
|
|
94
111
|
```bash
|
|
95
|
-
claude mcp add
|
|
112
|
+
claude mcp add -s user clast clast-ai
|
|
96
113
|
```
|
|
97
114
|
|
|
98
115
|
Or manually add to `~/.claude/settings.local.json`:
|
|
@@ -107,7 +124,10 @@ Or manually add to `~/.claude/settings.local.json`:
|
|
|
107
124
|
}
|
|
108
125
|
```
|
|
109
126
|
|
|
110
|
-
**Step 2:**
|
|
127
|
+
**Step 2:** Reload VS Code:
|
|
128
|
+
|
|
129
|
+
- Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac)
|
|
130
|
+
- Type "Developer: Reload Window" and hit Enter
|
|
111
131
|
|
|
112
132
|
**Step 3:** Verify by typing `/mcp` in the Claude Code chat panel — you should see `clast` listed with 7 tools.
|
|
113
133
|
|
|
@@ -144,6 +164,55 @@ This way Clast only activates when you open that project.
|
|
|
144
164
|
|
|
145
165
|
---
|
|
146
166
|
|
|
167
|
+
## Usage
|
|
168
|
+
|
|
169
|
+
### What happens when you start Claude Code?
|
|
170
|
+
|
|
171
|
+
1. Claude Code spawns the Clast MCP server as a background process
|
|
172
|
+
2. Clast automatically scans and indexes your entire project (typically under a second)
|
|
173
|
+
3. The file watcher starts monitoring for changes
|
|
174
|
+
4. All 7 `clast_*` tools become available to Claude
|
|
175
|
+
|
|
176
|
+
**You don't need to do anything** — the AST database is created automatically. There's no manual "index" step.
|
|
177
|
+
|
|
178
|
+
### How does Claude know to use Clast?
|
|
179
|
+
|
|
180
|
+
**If installed as a plugin** (`claude plugin add`): The bundled skill automatically tells Claude to prefer Clast tools over `Grep`/`Read` when exploring code.
|
|
181
|
+
|
|
182
|
+
**If installed as an MCP server** (`claude mcp add`): Claude sees the tools and their descriptions, which instruct it to prefer Clast for symbol lookups, call graphs, and file structure. You can also explicitly ask Claude to use them:
|
|
183
|
+
|
|
184
|
+
- *"Use clast to find the Database class"*
|
|
185
|
+
- *"What calls parseAndStore? Check the call graph"*
|
|
186
|
+
- *"Show me the structure of queries.ts using clast"*
|
|
187
|
+
|
|
188
|
+
Or you can tell Claude once at the start of a session:
|
|
189
|
+
|
|
190
|
+
> *"Use the clast tools to navigate code instead of reading files directly"*
|
|
191
|
+
|
|
192
|
+
### What can you ask Claude?
|
|
193
|
+
|
|
194
|
+
| What you want | What to ask | Tool Claude uses |
|
|
195
|
+
|---------------|-------------|------------------|
|
|
196
|
+
| Find a function | *"Find the extractFromTree function"* | `clast_search` |
|
|
197
|
+
| Understand a function before editing | *"What does parseAndStore do? Show me its context"* | `clast_get_context` |
|
|
198
|
+
| Check what calls a function | *"What calls resolveCallEdges?"* | `clast_call_graph` |
|
|
199
|
+
| Understand a file's structure | *"What's in src/db/queries.ts?"* | `clast_file_summary` |
|
|
200
|
+
| Check if the index is working | *"Show clast status"* | `clast_status` |
|
|
201
|
+
| Force re-index after big changes | *"Reindex the project"* | `clast_reindex` |
|
|
202
|
+
| Generate a missing docstring | *"Generate a comment for the insertNodes function"* | `clast_comment` |
|
|
203
|
+
|
|
204
|
+
### Does the index stay up to date?
|
|
205
|
+
|
|
206
|
+
Yes. The file watcher detects changes in real-time:
|
|
207
|
+
|
|
208
|
+
- **File saved** → re-parsed, AST database updated, call edges re-resolved
|
|
209
|
+
- **File deleted** → removed from database
|
|
210
|
+
- **New file created** → parsed and added
|
|
211
|
+
|
|
212
|
+
Only changed files are re-parsed (SHA-256 hash comparison), so incremental updates are near-instant.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
147
216
|
## Testing with MCP Inspector
|
|
148
217
|
|
|
149
218
|
To interactively test the tools without Claude Code:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export function registerCallGraphTool(server, db) {
|
|
3
|
-
server.tool('clast_call_graph', 'Get the call graph for a function or method: what it calls (callees) and what calls it (callers).
|
|
3
|
+
server.tool('clast_call_graph', 'Get the call graph for a function or method: what it calls (callees) and what calls it (callers). Use this BEFORE refactoring to understand impact — shows the full dependency chain with file paths and line numbers. Supports depth 1-5.', {
|
|
4
4
|
name: z.string().describe('Function or method name to trace'),
|
|
5
5
|
depth: z.number().int().min(1).max(5).default(2).describe('How many levels deep to traverse'),
|
|
6
6
|
direction: z.enum(['callers', 'callees', 'both']).default('both').describe('Direction to traverse'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clast-call-graph.js","sourceRoot":"","sources":["../../../src/server/tools/clast-call-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,EAAiB;IACxE,MAAM,CAAC,IAAI,CACT,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"clast-call-graph.js","sourceRoot":"","sources":["../../../src/server/tools/clast-call-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,EAAiB;IACxE,MAAM,CAAC,IAAI,CACT,kBAAkB,EAClB,4OAA4O,EAC5O;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;QAC7D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC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,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBACjC,QAAQ,EAAE,CAAC,CAAC,SAAS;oBACrB,IAAI,EAAE,CAAC,CAAC,IAAI;iBACb,CAAC,CAAC;aACJ,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtC,CAAC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export function registerFileSummaryTool(server, db) {
|
|
3
|
-
server.tool('clast_file_summary', 'Get a structured summary of all symbols in a file, grouped by type (imports, classes, functions, exports, etc.).
|
|
3
|
+
server.tool('clast_file_summary', 'Get a structured summary of all symbols in a file, grouped by type (imports, classes, functions, exports, etc.). PREFER THIS over reading an entire file when you need to understand its structure — returns all symbols with line numbers without the noise of implementation details.', {
|
|
4
4
|
filePath: z.string().describe('Relative file path (forward slashes, e.g. "src/parser/index.ts")'),
|
|
5
5
|
}, async ({ filePath }) => {
|
|
6
6
|
// Normalize path
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clast-file-summary.js","sourceRoot":"","sources":["../../../src/server/tools/clast-file-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,uBAAuB,CAAC,MAAiB,EAAE,EAAiB;IAC1E,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"clast-file-summary.js","sourceRoot":"","sources":["../../../src/server/tools/clast-file-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,uBAAuB,CAAC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IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;iBACvC,CAAC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export function registerGetContextTool(server, db) {
|
|
3
|
-
server.tool('clast_get_context', 'Get full context for a symbol:
|
|
3
|
+
server.tool('clast_get_context', 'Get full context for a symbol: definition, comments/documentation, callers, callees, and parent class. PREFER THIS over reading entire files when you need to understand a specific function or class before editing. Returns everything needed to make informed code changes.', {
|
|
4
4
|
name: z.string().describe('Symbol name to look up'),
|
|
5
5
|
includeBody: z.boolean().default(false).describe('Include the full function/class body text'),
|
|
6
6
|
}, async ({ name, includeBody }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clast-get-context.js","sourceRoot":"","sources":["../../../src/server/tools/clast-get-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,EAAiB;IACzE,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"clast-get-context.js","sourceRoot":"","sources":["../../../src/server/tools/clast-get-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,EAAiB;IACzE,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,gRAAgR,EAChR;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QACnD,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,2CAA2C,CAAC;KAC9F,EACD,KAAK,EA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C,SAAS;YACrB,SAAS,EAAE,CAAC,CAAC,UAAU;YACvB,SAAS,EAAE,CAAC,CAAC,SAAS;SACvB,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,WAAW,EAAE,MAAM;wBACnB,OAAO;wBACP,OAAO;qBACR,EAAE,IAAI,EAAE,CAAC,CAAC;iBACZ,CAAC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export function registerSearchTool(server, db) {
|
|
3
|
-
server.tool('clast_search', 'Search AST
|
|
3
|
+
server.tool('clast_search', 'Search the pre-built AST index for functions, classes, methods, and other symbols by name pattern. PREFER THIS over grep/file search when looking for symbol definitions — it is faster and returns structured results with exact file paths, line numbers, and signatures.', {
|
|
4
4
|
query: z.string().describe('Search pattern (matches against symbol names, supports partial matches)'),
|
|
5
5
|
type: z.enum([
|
|
6
6
|
'function', 'method', 'class', 'interface', 'enum',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clast-search.js","sourceRoot":"","sources":["../../../src/server/tools/clast-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,EAAiB;IACrE,MAAM,CAAC,IAAI,CACT,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"clast-search.js","sourceRoot":"","sources":["../../../src/server/tools/clast-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,EAAiB;IACrE,MAAM,CAAC,IAAI,CACT,cAAc,EACd,6QAA6Q,EAC7Q;QACE,KAAK,EAAE,CAAC,CAA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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clast-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "AST-based code intelligence plugin for Claude Code: search symbols, trace call graphs, generate comments, and provide structured context for any repository",
|
|
5
5
|
"main": "dist/server/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -5,7 +5,7 @@ import type { ClastDatabase } from '../../db/index.js';
|
|
|
5
5
|
export function registerCallGraphTool(server: McpServer, db: ClastDatabase): void {
|
|
6
6
|
server.tool(
|
|
7
7
|
'clast_call_graph',
|
|
8
|
-
'Get the call graph for a function or method: what it calls (callees) and what calls it (callers).
|
|
8
|
+
'Get the call graph for a function or method: what it calls (callees) and what calls it (callers). Use this BEFORE refactoring to understand impact — shows the full dependency chain with file paths and line numbers. Supports depth 1-5.',
|
|
9
9
|
{
|
|
10
10
|
name: z.string().describe('Function or method name to trace'),
|
|
11
11
|
depth: z.number().int().min(1).max(5).default(2).describe('How many levels deep to traverse'),
|
|
@@ -5,7 +5,7 @@ import type { ClastDatabase } from '../../db/index.js';
|
|
|
5
5
|
export function registerFileSummaryTool(server: McpServer, db: ClastDatabase): void {
|
|
6
6
|
server.tool(
|
|
7
7
|
'clast_file_summary',
|
|
8
|
-
'Get a structured summary of all symbols in a file, grouped by type (imports, classes, functions, exports, etc.).
|
|
8
|
+
'Get a structured summary of all symbols in a file, grouped by type (imports, classes, functions, exports, etc.). PREFER THIS over reading an entire file when you need to understand its structure — returns all symbols with line numbers without the noise of implementation details.',
|
|
9
9
|
{
|
|
10
10
|
filePath: z.string().describe('Relative file path (forward slashes, e.g. "src/parser/index.ts")'),
|
|
11
11
|
},
|
|
@@ -5,7 +5,7 @@ import type { ClastDatabase } from '../../db/index.js';
|
|
|
5
5
|
export function registerGetContextTool(server: McpServer, db: ClastDatabase): void {
|
|
6
6
|
server.tool(
|
|
7
7
|
'clast_get_context',
|
|
8
|
-
'Get full context for a symbol:
|
|
8
|
+
'Get full context for a symbol: definition, comments/documentation, callers, callees, and parent class. PREFER THIS over reading entire files when you need to understand a specific function or class before editing. Returns everything needed to make informed code changes.',
|
|
9
9
|
{
|
|
10
10
|
name: z.string().describe('Symbol name to look up'),
|
|
11
11
|
includeBody: z.boolean().default(false).describe('Include the full function/class body text'),
|
|
@@ -5,7 +5,7 @@ import type { ClastDatabase } from '../../db/index.js';
|
|
|
5
5
|
export function registerSearchTool(server: McpServer, db: ClastDatabase): void {
|
|
6
6
|
server.tool(
|
|
7
7
|
'clast_search',
|
|
8
|
-
'Search AST
|
|
8
|
+
'Search the pre-built AST index for functions, classes, methods, and other symbols by name pattern. PREFER THIS over grep/file search when looking for symbol definitions — it is faster and returns structured results with exact file paths, line numbers, and signatures.',
|
|
9
9
|
{
|
|
10
10
|
query: z.string().describe('Search pattern (matches against symbol names, supports partial matches)'),
|
|
11
11
|
type: z.enum([
|