clast-ai 0.1.0 → 0.1.1
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 +58 -2
- 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
|
@@ -81,9 +81,13 @@ Or using the CLI:
|
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
83
|
claude mcp add clast -- clast-ai
|
|
84
|
+
# ^^^^^ ^^^^^^^^
|
|
85
|
+
# alias command (npm package)
|
|
84
86
|
```
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
> `clast` is the local alias (shows up in `/mcp` and settings). `clast-ai` is the actual npm binary that gets executed. The alias can be anything you want.
|
|
89
|
+
|
|
90
|
+
Restart Claude Code (`Ctrl+Shift+P` → "Claude Code: Restart" in VS Code, or just relaunch the CLI). Clast will automatically index whichever project directory you open.
|
|
87
91
|
|
|
88
92
|
## Setup for VS Code (Claude Code Extension)
|
|
89
93
|
|
|
@@ -107,7 +111,10 @@ Or manually add to `~/.claude/settings.local.json`:
|
|
|
107
111
|
}
|
|
108
112
|
```
|
|
109
113
|
|
|
110
|
-
**Step 2:** Restart the Claude Code extension (
|
|
114
|
+
**Step 2:** Restart the Claude Code extension (no need to restart VS Code itself):
|
|
115
|
+
|
|
116
|
+
- Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac)
|
|
117
|
+
- Type "Claude Code: Restart" and hit Enter
|
|
111
118
|
|
|
112
119
|
**Step 3:** Verify by typing `/mcp` in the Claude Code chat panel — you should see `clast` listed with 7 tools.
|
|
113
120
|
|
|
@@ -144,6 +151,55 @@ This way Clast only activates when you open that project.
|
|
|
144
151
|
|
|
145
152
|
---
|
|
146
153
|
|
|
154
|
+
## Usage
|
|
155
|
+
|
|
156
|
+
### What happens when you start Claude Code?
|
|
157
|
+
|
|
158
|
+
1. Claude Code spawns the Clast MCP server as a background process
|
|
159
|
+
2. Clast automatically scans and indexes your entire project (typically under a second)
|
|
160
|
+
3. The file watcher starts monitoring for changes
|
|
161
|
+
4. All 7 `clast_*` tools become available to Claude
|
|
162
|
+
|
|
163
|
+
**You don't need to do anything** — the AST database is created automatically. There's no manual "index" step.
|
|
164
|
+
|
|
165
|
+
### How does Claude know to use Clast?
|
|
166
|
+
|
|
167
|
+
**If installed as a plugin** (`claude plugin add`): The bundled skill automatically tells Claude to prefer Clast tools over `Grep`/`Read` when exploring code.
|
|
168
|
+
|
|
169
|
+
**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:
|
|
170
|
+
|
|
171
|
+
- *"Use clast to find the Database class"*
|
|
172
|
+
- *"What calls parseAndStore? Check the call graph"*
|
|
173
|
+
- *"Show me the structure of queries.ts using clast"*
|
|
174
|
+
|
|
175
|
+
Or you can tell Claude once at the start of a session:
|
|
176
|
+
|
|
177
|
+
> *"Use the clast tools to navigate code instead of reading files directly"*
|
|
178
|
+
|
|
179
|
+
### What can you ask Claude?
|
|
180
|
+
|
|
181
|
+
| What you want | What to ask | Tool Claude uses |
|
|
182
|
+
|---------------|-------------|------------------|
|
|
183
|
+
| Find a function | *"Find the extractFromTree function"* | `clast_search` |
|
|
184
|
+
| Understand a function before editing | *"What does parseAndStore do? Show me its context"* | `clast_get_context` |
|
|
185
|
+
| Check what calls a function | *"What calls resolveCallEdges?"* | `clast_call_graph` |
|
|
186
|
+
| Understand a file's structure | *"What's in src/db/queries.ts?"* | `clast_file_summary` |
|
|
187
|
+
| Check if the index is working | *"Show clast status"* | `clast_status` |
|
|
188
|
+
| Force re-index after big changes | *"Reindex the project"* | `clast_reindex` |
|
|
189
|
+
| Generate a missing docstring | *"Generate a comment for the insertNodes function"* | `clast_comment` |
|
|
190
|
+
|
|
191
|
+
### Does the index stay up to date?
|
|
192
|
+
|
|
193
|
+
Yes. The file watcher detects changes in real-time:
|
|
194
|
+
|
|
195
|
+
- **File saved** → re-parsed, AST database updated, call edges re-resolved
|
|
196
|
+
- **File deleted** → removed from database
|
|
197
|
+
- **New file created** → parsed and added
|
|
198
|
+
|
|
199
|
+
Only changed files are re-parsed (SHA-256 hash comparison), so incremental updates are near-instant.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
147
203
|
## Testing with MCP Inspector
|
|
148
204
|
|
|
149
205
|
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,E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AI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACZ,MAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACzD,MAAM,CAAC,WAAW,GAAG;gBACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBACjC,UAAU,EAAE,CAAC,CAAC,WAAW;oBACzB,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,QAAQ,EAAE,CAAC,CAAC,SAAS,KAAK,IAAI;iBAC/B,CAAC,CAAC;gBACH,QAAQ,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,MAAiB,EAAE,EAAiB;IAC1E,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,yRAAyR,EACzR;QACE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kEAAkE,CAAC;KAClG,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QACrB,iBAAiB;QACjB,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QAEpD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,6BAA6B,UAAU,6BAA6B,EAAE,CAAC;qBACtG,CAAC;aACH,CAAC;QACJ,CAAC;QAED,gBAAgB;QAChB,MAAM,OAAO,GAKP,EAAE,CAAC;QAET,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC;gBACT,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,SAAS,EAAE,IAAI,CAAC,UAAU;gBAC1B,OAAO,EAAE,IAAI,CAAC,QAAQ;aACvB,CAAC,CAAC;QACL,CAAC;QAED,MAAM,OAAO,GAAG;YACd,QAAQ,EAAE,UAAU;YACpB,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ;YAC5B,YAAY,EAAE,KAAK,CAAC,MAAM;YAC1B,OAAO,EAAE,OAAO;SACjB,CAAC;QAEF,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,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":"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AC,CAAC,EAAE,CAAC,CAAC;YACpC,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,QAAQ,EAAE,CAAC,CAAC,SAAS;YACrB,SAAS,EAAE,CAAC,CAAC,UAAU;YACvB,SAAS,EAAE,CAAC,CAAC,SAAS;SACvB,CAAC,CAAC,CAAC;QAEJ,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACpC,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,QAAQ,EAAE,CAAC,CAAC,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"],"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CAAC,CAAC,IAAI;YACZ,QAAQ,EAAE,CAAC,CAAC,SAAS;YACrB,SAAS,EAAE,CAAC,CAAC,UAAU;YACvB,OAAO,EAAE,CAAC,CAAC,QAAQ;YACnB,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,QAAQ,EAAE,CAAC,CAAC,QAAQ;SACrB,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;iBACzC,CAAC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clast-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
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([
|