@graphpilot-oss/graphpilot 0.0.1 → 0.1.0
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/CHANGELOG.md +73 -126
- package/README.md +359 -101
- package/dist/cli.js +20 -0
- package/dist/cli.js.map +1 -1
- package/dist/indexer.js +3 -3
- package/dist/indexer.js.map +1 -1
- package/dist/init.d.ts +28 -0
- package/dist/init.js +112 -0
- package/dist/init.js.map +1 -0
- package/dist/interactions.d.ts +5 -4
- package/dist/interactions.js +0 -0
- package/dist/interactions.js.map +1 -1
- package/dist/mcp.js +126 -46
- package/dist/mcp.js.map +1 -1
- package/dist/repo-resolve.d.ts +47 -0
- package/dist/repo-resolve.js +195 -0
- package/dist/repo-resolve.js.map +1 -0
- package/dist/storage.js +10 -1
- package/dist/storage.js.map +1 -1
- package/dist/validation.js +30 -4
- package/dist/validation.js.map +1 -1
- package/dist/watcher.d.ts +10 -0
- package/dist/watcher.js +70 -7
- package/dist/watcher.js.map +1 -1
- package/examples/README.md +105 -0
- package/examples/claude-code/README.md +125 -0
- package/examples/claude-code/claude-routing.md +102 -0
- package/examples/claude-code/claude_config.json +8 -0
- package/examples/cline/.clinerules +39 -0
- package/examples/cline/README.md +104 -0
- package/examples/cline/cline_mcp_settings.json +10 -0
- package/examples/continue/.continuerules +39 -0
- package/examples/continue/README.md +98 -0
- package/examples/continue/config.json +13 -0
- package/examples/cursor/.cursorrules +39 -0
- package/examples/cursor/README.md +98 -0
- package/examples/cursor/mcp.json +11 -0
- package/examples/windsurf/.windsurfrules +39 -0
- package/examples/windsurf/README.md +85 -0
- package/examples/windsurf/mcp_config.json +8 -0
- package/package.json +12 -3
- package/.editorconfig +0 -15
- package/.github/CODEOWNERS +0 -22
- package/.github/FUNDING.yml +0 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -33
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -23
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -19
- package/.github/dependabot.yml +0 -15
- package/.github/workflows/ci.yml +0 -62
- package/.github/workflows/release.yml +0 -50
- package/.prettierignore +0 -19
- package/.prettierrc.json +0 -20
- package/CODE_OF_CONDUCT.md +0 -83
- package/CONTRIBUTING.md +0 -111
- package/bench/README.md +0 -544
- package/bench/results/agent-tier-2026-05-22.md +0 -28
- package/bench/results/agent-tier-summary.md +0 -44
- package/bench/results/baseline-tier-2026-05-22.md +0 -23
- package/bench/results/baseline.json +0 -810
- package/bench/results/baseline.md +0 -28
- package/bench/run-agent-tier-automated.ts +0 -234
- package/bench/run-agent-tier.md +0 -125
- package/bench/run-baseline-tier.ts +0 -200
- package/bench/run.ts +0 -210
- package/bench/runner-baseline.ts +0 -177
- package/bench/runner-graphpilot.ts +0 -131
- package/bench/score-agent-tier.ts +0 -191
- package/bench/score.ts +0 -59
- package/bench/tasks.ts +0 -236
- package/dist/provenance.d.ts +0 -74
- package/dist/provenance.js +0 -95
- package/dist/provenance.js.map +0 -1
- package/docs/architecture.md +0 -311
- package/docs/limitations.md +0 -156
- package/docs/mcp-setup.md +0 -231
- package/docs/quickstart.md +0 -202
- package/eslint.config.js +0 -148
- package/lefthook.yml +0 -81
- package/pnpm-workspace.yaml +0 -6
- package/scripts/smoke-stdio.mjs +0 -97
- package/src/cli.ts +0 -171
- package/src/edges.ts +0 -202
- package/src/git.ts +0 -255
- package/src/graph-schema.ts +0 -229
- package/src/impact.ts +0 -218
- package/src/indexer.ts +0 -152
- package/src/interactions.ts +0 -0
- package/src/mcp.ts +0 -652
- package/src/parser.ts +0 -138
- package/src/provenance.ts +0 -115
- package/src/query.ts +0 -148
- package/src/redact.ts +0 -122
- package/src/storage.ts +0 -115
- package/src/symbols.ts +0 -173
- package/src/validation.ts +0 -69
- package/src/validators.ts +0 -253
- package/src/watcher.ts +0 -383
- package/tests/edges.test.ts +0 -175
- package/tests/fixtures/sample.ts +0 -32
- package/tests/git.test.ts +0 -303
- package/tests/graph-schema.test.ts +0 -321
- package/tests/impact.test.ts +0 -454
- package/tests/interactions.test.ts +0 -180
- package/tests/lint-policy.test.ts +0 -106
- package/tests/mcp-stdio.test.ts +0 -171
- package/tests/mcp.test.ts +0 -335
- package/tests/parser.test.ts +0 -31
- package/tests/provenance.test.ts +0 -132
- package/tests/query.test.ts +0 -160
- package/tests/redact.test.ts +0 -167
- package/tests/security.test.ts +0 -144
- package/tests/symbols.test.ts +0 -78
- package/tests/validators.test.ts +0 -193
- package/tests/watcher.test.ts +0 -250
- package/tsconfig.json +0 -18
package/docs/mcp-setup.md
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
# MCP Setup per Client
|
|
2
|
-
|
|
3
|
-
GraphPilot is an [MCP](https://modelcontextprotocol.io) server that
|
|
4
|
-
speaks JSON-RPC over **stdio**. Any MCP-compatible client can use it.
|
|
5
|
-
|
|
6
|
-
This doc covers the five most common clients. The pattern is the same
|
|
7
|
-
everywhere: tell the client to launch `graphpilot mcp` (or
|
|
8
|
-
`node /path/to/dist/cli.js mcp`) when it starts.
|
|
9
|
-
|
|
10
|
-
## Two ways to invoke GraphPilot
|
|
11
|
-
|
|
12
|
-
| Mode | Command + args | When to use |
|
|
13
|
-
| ----------- | ---------------------------------------------- | ------------------------------------ |
|
|
14
|
-
| Local build | `node /abs/path/to/graphpilot/dist/cli.js mcp` | Pre-v0.1.0, contributors, dev mode |
|
|
15
|
-
| `npx` | `npx graphpilot mcp` | Once v0.1.0 ships to npm (preferred) |
|
|
16
|
-
|
|
17
|
-
Examples below show both. Pick whichever matches your install.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Claude Code (Anthropic)
|
|
22
|
-
|
|
23
|
-
**Config file:** `~/.claude.json` (macOS, Linux) or
|
|
24
|
-
`%USERPROFILE%\.claude.json` (Windows).
|
|
25
|
-
|
|
26
|
-
```jsonc
|
|
27
|
-
{
|
|
28
|
-
"mcpServers": {
|
|
29
|
-
"graphpilot": {
|
|
30
|
-
"command": "node",
|
|
31
|
-
"args": ["/Users/you/code/graphpilot/dist/cli.js", "mcp"],
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Or post-v0.1.0:
|
|
38
|
-
|
|
39
|
-
```jsonc
|
|
40
|
-
{
|
|
41
|
-
"mcpServers": {
|
|
42
|
-
"graphpilot": {
|
|
43
|
-
"command": "npx",
|
|
44
|
-
"args": ["graphpilot", "mcp"],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**Verify:** fully restart Claude Code (quit, don't just close the
|
|
51
|
-
window). Type `/mcp` — you should see:
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
graphpilot
|
|
55
|
-
5 tools: gp_index, gp_recall, gp_callers, gp_impact, gp_stats
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**Common gotcha:** `~/.claude.json` is read only on launch. Edits don't
|
|
59
|
-
hot-reload — you must relaunch.
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## Cursor
|
|
64
|
-
|
|
65
|
-
**Settings UI:** `Cmd/Ctrl + ,` → search "MCP" → "Edit MCP config".
|
|
66
|
-
|
|
67
|
-
**File path:** `~/.cursor/mcp.json`.
|
|
68
|
-
|
|
69
|
-
```jsonc
|
|
70
|
-
{
|
|
71
|
-
"mcpServers": {
|
|
72
|
-
"graphpilot": {
|
|
73
|
-
"command": "node",
|
|
74
|
-
"args": ["/Users/you/code/graphpilot/dist/cli.js", "mcp"],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**Verify:** Settings → MCP — `graphpilot` should show as **Connected**
|
|
81
|
-
with 5 tools listed underneath.
|
|
82
|
-
|
|
83
|
-
**Common gotcha:** Cursor sometimes caches MCP server state. If the
|
|
84
|
-
server shows red after a config change, click the refresh icon next to
|
|
85
|
-
it.
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Cline (VS Code extension)
|
|
90
|
-
|
|
91
|
-
Cline reads MCP config from a per-OS path:
|
|
92
|
-
|
|
93
|
-
- macOS: `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
|
|
94
|
-
- Linux: `~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
|
|
95
|
-
- Windows: `%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json`
|
|
96
|
-
|
|
97
|
-
Easier: open the Cline panel in VS Code → "MCP Servers" → click the gear
|
|
98
|
-
icon → "Edit MCP Settings". Then add:
|
|
99
|
-
|
|
100
|
-
```jsonc
|
|
101
|
-
{
|
|
102
|
-
"mcpServers": {
|
|
103
|
-
"graphpilot": {
|
|
104
|
-
"command": "node",
|
|
105
|
-
"args": ["/Users/you/code/graphpilot/dist/cli.js", "mcp"],
|
|
106
|
-
"disabled": false,
|
|
107
|
-
"autoApprove": [],
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**Verify:** the Cline panel's "MCP Servers" section lists `graphpilot`
|
|
114
|
-
with a green status dot.
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
## Windsurf (Codeium)
|
|
119
|
-
|
|
120
|
-
**Config file:** `~/.codeium/windsurf/mcp_config.json`.
|
|
121
|
-
|
|
122
|
-
```jsonc
|
|
123
|
-
{
|
|
124
|
-
"mcpServers": {
|
|
125
|
-
"graphpilot": {
|
|
126
|
-
"command": "node",
|
|
127
|
-
"args": ["/Users/you/code/graphpilot/dist/cli.js", "mcp"],
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**Verify:** restart Windsurf → open the Cascade panel → MCP tools list
|
|
134
|
-
should include the four `gp_*` tools.
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## Continue.dev
|
|
139
|
-
|
|
140
|
-
Continue uses `~/.continue/config.json` (global) or
|
|
141
|
-
`<repo>/.continue/config.json` (per-project).
|
|
142
|
-
|
|
143
|
-
```jsonc
|
|
144
|
-
{
|
|
145
|
-
"experimental": {
|
|
146
|
-
"modelContextProtocolServers": [
|
|
147
|
-
{
|
|
148
|
-
"transport": {
|
|
149
|
-
"type": "stdio",
|
|
150
|
-
"command": "node",
|
|
151
|
-
"args": ["/Users/you/code/graphpilot/dist/cli.js", "mcp"],
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
],
|
|
155
|
-
},
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
**Verify:** Continue → Settings → "MCP Servers" panel should list
|
|
160
|
-
graphpilot.
|
|
161
|
-
|
|
162
|
-
**Common gotcha:** Continue's MCP support is still flagged as
|
|
163
|
-
experimental — versions vary. If `modelContextProtocolServers` is
|
|
164
|
-
unrecognized, check the Continue version + their docs for the current
|
|
165
|
-
config key.
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
## Any other MCP-capable client
|
|
170
|
-
|
|
171
|
-
Generic pattern works anywhere the client supports stdio MCP:
|
|
172
|
-
|
|
173
|
-
- **Transport:** `stdio`
|
|
174
|
-
- **Command:** `node` (or `npx`)
|
|
175
|
-
- **Args:** `["/abs/path/to/graphpilot/dist/cli.js", "mcp"]`
|
|
176
|
-
(or `["graphpilot", "mcp"]` once on npm)
|
|
177
|
-
- **Protocol version:** `2024-11-05` (matches
|
|
178
|
-
`@modelcontextprotocol/sdk@1.29.x`)
|
|
179
|
-
|
|
180
|
-
### Use the MCP Inspector to verify the wire
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
npx @modelcontextprotocol/inspector node dist/cli.js mcp
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
Opens a browser-based UI listing the 5 tools with their schemas. Lets
|
|
187
|
-
you fire a test call and see the JSON-RPC frames.
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Environment variables
|
|
192
|
-
|
|
193
|
-
| Variable | Effect |
|
|
194
|
-
| --------------------- | --------------------------------------------------------------------- |
|
|
195
|
-
| `GRAPHPILOT_NO_LOG=1` | Disable the interaction log (`~/.graphpilot/<id>/interactions.jsonl`) |
|
|
196
|
-
|
|
197
|
-
There are intentionally **no other env vars**. No API keys, no telemetry
|
|
198
|
-
endpoints, no remote URLs. If a future feature needs one, it'll be
|
|
199
|
-
opt-in and documented.
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
## End-to-end smoke test
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
# In your project's terminal
|
|
207
|
-
node /abs/path/to/graphpilot/dist/cli.js index .
|
|
208
|
-
|
|
209
|
-
# Then in your agent:
|
|
210
|
-
# "Use graphpilot's gp_stats tool to show the index for this repo."
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
If the response includes repo id, file/symbol/edge counts, and an
|
|
214
|
-
`indexedAt` timestamp — the wire is healthy.
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
## Troubleshooting
|
|
219
|
-
|
|
220
|
-
| Symptom | Likely cause | Fix |
|
|
221
|
-
| -------------------------------------------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
222
|
-
| Server connects then immediately disconnects | Server crashing on startup, or you're on a build older than the Day-10 stdio fix | Run `node dist/cli.js mcp` in a terminal — inspect stderr for the error. Rebuild from `main`. |
|
|
223
|
-
| Client shows no servers | Config file has a JSON syntax error | Validate JSON; clients often silently ignore broken configs |
|
|
224
|
-
| Tools list but every call returns "No index found" | Path mismatch — Claude's `cwd` ≠ the path you indexed | Pass an explicit `path: "/abs/path"` argument to each tool call |
|
|
225
|
-
| Some `gp_*` tools missing from the catalog | Stale build cached by the client | `pnpm build` then fully restart the client |
|
|
226
|
-
| stderr says "Failed to load native bindings" | `tree-sitter` native module didn't compile | `pnpm approve-builds --all && pnpm rebuild`. If on Node 23+, drop to Node 22 LTS. |
|
|
227
|
-
| Tool returns "Invalid input: Unknown field(s)" | Caller passed an unrecognized argument | Schemas are strict — only the documented fields are allowed |
|
|
228
|
-
|
|
229
|
-
Anything not in this table → please file an
|
|
230
|
-
[issue](https://github.com/graphpilot-oss/graphpilot/issues) with the agent's
|
|
231
|
-
stderr + the failing JSON-RPC payload.
|
package/docs/quickstart.md
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
# Quickstart
|
|
2
|
-
|
|
3
|
-
Five-minute path from a fresh clone to Claude Code answering structural
|
|
4
|
-
questions about your codebase using GraphPilot.
|
|
5
|
-
|
|
6
|
-
## Prerequisites
|
|
7
|
-
|
|
8
|
-
- Node.js **≥ 20** — check with `node --version`
|
|
9
|
-
- **pnpm 9+** (or use `npm` if you prefer — examples below default to pnpm)
|
|
10
|
-
- An MCP-compatible coding agent: Claude Code, Cursor, Cline, Windsurf,
|
|
11
|
-
or Continue.dev
|
|
12
|
-
|
|
13
|
-
## 1. Install
|
|
14
|
-
|
|
15
|
-
Until v0.1.0 is published to npm, build from source:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
git clone https://github.com/graphpilot-oss/graphpilot.git
|
|
19
|
-
cd graphpilot
|
|
20
|
-
pnpm install
|
|
21
|
-
pnpm build
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
The compiled CLI lives at `dist/cli.js`. Verify:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
node dist/cli.js help
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Once v0.1.0 publishes:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npx graphpilot --help # zero-install
|
|
34
|
-
# or
|
|
35
|
-
npm install -g @graphpilot-oss/graphpilot
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## 2. Index your first repo
|
|
39
|
-
|
|
40
|
-
Pick a TypeScript or JavaScript project — preferably a real one with
|
|
41
|
-
several hundred files so you can feel the value.
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
node dist/cli.js index /path/to/your/repo
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Expected output:
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
Indexing /path/to/your/repo ...
|
|
51
|
-
|
|
52
|
-
✓ Remembered 412 symbols, 1138 calls (387 resolved) across 87 files in 320ms.
|
|
53
|
-
Repo id: a1b2c3d4e5f6abcd
|
|
54
|
-
Graph file: /Users/you/.graphpilot/a1b2c3d4e5f6abcd/graph.json
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
What just happened:
|
|
58
|
-
|
|
59
|
-
- Every `.ts/.tsx/.js/.jsx/.mjs/.cjs` file got parsed by tree-sitter
|
|
60
|
-
- Functions, classes, methods, interfaces, types, enums were extracted
|
|
61
|
-
- Every call site inside every function body was captured
|
|
62
|
-
- The resolver matched in-repo callees back to their definitions
|
|
63
|
-
- Result saved to `~/.graphpilot/<repo-id>/graph.json` (mode 0600)
|
|
64
|
-
|
|
65
|
-
## 3. Sanity-check the index
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
# Re-read what was saved
|
|
69
|
-
node dist/cli.js status /path/to/your/repo
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Or peek at the raw JSON:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
jq '{filesIndexed, symbolCount, edgeCount, indexedAt}' \
|
|
76
|
-
~/.graphpilot/<repo-id>/graph.json
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## 4. Wire to Claude Code
|
|
80
|
-
|
|
81
|
-
Edit `~/.claude.json` (create the file if it doesn't exist):
|
|
82
|
-
|
|
83
|
-
```jsonc
|
|
84
|
-
{
|
|
85
|
-
"mcpServers": {
|
|
86
|
-
"graphpilot": {
|
|
87
|
-
"command": "node",
|
|
88
|
-
"args": ["/absolute/path/to/graphpilot/dist/cli.js", "mcp"],
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Once v0.1.0 ships to npm, you can simplify to:
|
|
95
|
-
|
|
96
|
-
```jsonc
|
|
97
|
-
{
|
|
98
|
-
"mcpServers": {
|
|
99
|
-
"graphpilot": {
|
|
100
|
-
"command": "npx",
|
|
101
|
-
"args": ["graphpilot", "mcp"],
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**Restart Claude Code fully** (quit, don't just close the window). Then
|
|
108
|
-
type `/mcp` — `graphpilot` should appear with **5 tools** (gp_index,
|
|
109
|
-
gp_recall, gp_callers, gp_impact, gp_stats).
|
|
110
|
-
|
|
111
|
-
For Cursor / Cline / Windsurf / Continue, see
|
|
112
|
-
[mcp-setup.md](mcp-setup.md).
|
|
113
|
-
|
|
114
|
-
## 5. Ask Claude a structural question
|
|
115
|
-
|
|
116
|
-
In a project where you've already run `gp_index`, try these in Claude
|
|
117
|
-
Code. Pick real symbol names from your indexed repo:
|
|
118
|
-
|
|
119
|
-
```text
|
|
120
|
-
"Use graphpilot to find where parseToken is defined."
|
|
121
|
-
|
|
122
|
-
"Who calls authenticate in this repo? Use graphpilot."
|
|
123
|
-
|
|
124
|
-
"What does indexDirectory call? Use graphpilot's callees."
|
|
125
|
-
|
|
126
|
-
"Re-index this repo with graphpilot."
|
|
127
|
-
|
|
128
|
-
"Use graphpilot to show the current index stats."
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Watch the response for a `Calling graphpilot/gp_*` line — that's the
|
|
132
|
-
tool firing. If you see it, you're done.
|
|
133
|
-
|
|
134
|
-
## 6. Keep the index fresh while you edit (optional)
|
|
135
|
-
|
|
136
|
-
By default the index is a snapshot — it grows stale as you edit. Either
|
|
137
|
-
re-run `graphpilot index .` after big changes, or just leave watch mode
|
|
138
|
-
running in a side terminal:
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
node dist/cli.js watch /path/to/your/repo
|
|
142
|
-
# [graphpilot:watch] Watching ... (412 symbols, 1138 calls, 87 files).
|
|
143
|
-
# [graphpilot:watch] src/auth.ts: 32 (+1) symbols, 89 (+3) calls (4ms).
|
|
144
|
-
# [graphpilot:watch] src/auth.ts deleted: 30 (-2) symbols, 84 (-5) calls (3ms).
|
|
145
|
-
# Ctrl+C to stop.
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Each save triggers a sub-10ms incremental update. The on-disk
|
|
149
|
-
`graph.json` is rewritten atomically — Claude always sees a consistent
|
|
150
|
-
view, even mid-edit.
|
|
151
|
-
|
|
152
|
-
## 7. Make Claude reach for GraphPilot automatically
|
|
153
|
-
|
|
154
|
-
You shouldn't have to type "use graphpilot to..." every time. Add a
|
|
155
|
-
`CLAUDE.md` to the root of the indexed repo:
|
|
156
|
-
|
|
157
|
-
```markdown
|
|
158
|
-
When asked any of:
|
|
159
|
-
|
|
160
|
-
- "who calls X" / "what uses X" / "where is X called from"
|
|
161
|
-
- "what does X call" / "what does X depend on"
|
|
162
|
-
- "rename X — what breaks" / "impact of changing X"
|
|
163
|
-
- "find function X" / "where is X defined"
|
|
164
|
-
|
|
165
|
-
→ Use graphpilot MCP tools (`gp_recall`, `gp_callers`) BEFORE grep or
|
|
166
|
-
reading files. Graphpilot is a pre-built code-graph for this repo.
|
|
167
|
-
|
|
168
|
-
Fall back to grep/read for: comments, string literals, config files,
|
|
169
|
-
languages other than TS/JS, git history.
|
|
170
|
-
|
|
171
|
-
After 10+ file edits, call `gp_index` once before further structural
|
|
172
|
-
questions.
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
Restart Claude Code one more time. From here, structural questions route
|
|
176
|
-
to GraphPilot automatically.
|
|
177
|
-
|
|
178
|
-
When `gp_impact` is part of the routing, add this line so it's used too:
|
|
179
|
-
|
|
180
|
-
```
|
|
181
|
-
- "rename X — what breaks" / "impact of changing X" / "what depends on X"
|
|
182
|
-
→ use gp_impact (returns direct + transitive callers + tests + public-API flag)
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
## What to do next
|
|
186
|
-
|
|
187
|
-
- [mcp-setup.md](mcp-setup.md) — per-client configuration
|
|
188
|
-
- [architecture.md](architecture.md) — how the pipeline works
|
|
189
|
-
- [limitations.md](limitations.md) — what GraphPilot deliberately doesn't do
|
|
190
|
-
|
|
191
|
-
## Troubleshooting
|
|
192
|
-
|
|
193
|
-
| Symptom | Fix |
|
|
194
|
-
| ----------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
195
|
-
| `/mcp` doesn't list graphpilot | Run `pnpm build` again, then **fully** quit and reopen Claude Code |
|
|
196
|
-
| Every tool call returns "No GraphPilot index found" | Run `node dist/cli.js index /path` first, and pass an absolute `path` to tool calls |
|
|
197
|
-
| Tool errors with "Invalid input: Unknown field(s)..." | Schemas are strict — remove extra fields from the tool call |
|
|
198
|
-
| `pnpm install` fails on native modules | `pnpm approve-builds --all && pnpm rebuild` |
|
|
199
|
-
| Server starts but never responds | You're on a build older than the Day-10 stdio fix; rebuild from `main` |
|
|
200
|
-
| The server keeps showing the same stale data | Call `gp_index` from the agent (or re-run `node dist/cli.js index .`) |
|
|
201
|
-
|
|
202
|
-
Issues not in this table → [open an issue](https://github.com/graphpilot-oss/graphpilot/issues).
|
package/eslint.config.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
// ESLint flat config (ESLint v9+).
|
|
2
|
-
//
|
|
3
|
-
// Primary purpose: enforce the "local-first, no network" promise at the
|
|
4
|
-
// build gate. Until this rule was added the promise was a convention,
|
|
5
|
-
// not an enforced contract — see SECURITY.md for the user-facing
|
|
6
|
-
// guarantee this protects.
|
|
7
|
-
//
|
|
8
|
-
// Secondary purpose: catch the small set of rules where tsc isn't enough
|
|
9
|
-
// (no unused variables, no console.log left in production code).
|
|
10
|
-
|
|
11
|
-
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
12
|
-
import tsparser from '@typescript-eslint/parser';
|
|
13
|
-
|
|
14
|
-
const NETWORK_MSG =
|
|
15
|
-
'No network code in src/. GraphPilot is local-first; runtime must not ' +
|
|
16
|
-
'open sockets. If you genuinely need an outbound call, it belongs in ' +
|
|
17
|
-
'a separate opt-in path — open an issue first.';
|
|
18
|
-
|
|
19
|
-
const SHELL_MSG =
|
|
20
|
-
'No child_process in src/. Shelling out from runtime code creates ' +
|
|
21
|
-
'injection surface against user-supplied symbol names / paths. Tests ' +
|
|
22
|
-
'and scripts (subprocess MCP test, bench harness) are exempt — those ' +
|
|
23
|
-
'live under tests/ and scripts/.';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Modules banned from `src/`. The product promise is that nothing leaves
|
|
27
|
-
* the user's machine — that's only true if there's no networking code
|
|
28
|
-
* anywhere in the runtime path.
|
|
29
|
-
*/
|
|
30
|
-
const BANNED_NETWORK_IMPORTS = [
|
|
31
|
-
{ name: 'http', message: NETWORK_MSG },
|
|
32
|
-
{ name: 'https', message: NETWORK_MSG },
|
|
33
|
-
{ name: 'node:http', message: NETWORK_MSG },
|
|
34
|
-
{ name: 'node:https', message: NETWORK_MSG },
|
|
35
|
-
{ name: 'undici', message: NETWORK_MSG },
|
|
36
|
-
{ name: 'axios', message: NETWORK_MSG },
|
|
37
|
-
{ name: 'node-fetch', message: NETWORK_MSG },
|
|
38
|
-
{ name: 'cross-fetch', message: NETWORK_MSG },
|
|
39
|
-
{ name: 'got', message: NETWORK_MSG },
|
|
40
|
-
{ name: 'request', message: NETWORK_MSG },
|
|
41
|
-
{ name: 'superagent', message: NETWORK_MSG },
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Modules where shelling out to a child process would create injection
|
|
46
|
-
* surface; enforced at the build gate.
|
|
47
|
-
*/
|
|
48
|
-
const BANNED_SHELL_IMPORTS = [
|
|
49
|
-
{ name: 'child_process', message: SHELL_MSG },
|
|
50
|
-
{ name: 'node:child_process', message: SHELL_MSG },
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
export default [
|
|
54
|
-
// ---------------------------------------------------------------------
|
|
55
|
-
// src/ — production code
|
|
56
|
-
// ---------------------------------------------------------------------
|
|
57
|
-
{
|
|
58
|
-
files: ['src/**/*.ts'],
|
|
59
|
-
languageOptions: {
|
|
60
|
-
parser: tsparser,
|
|
61
|
-
parserOptions: {
|
|
62
|
-
sourceType: 'module',
|
|
63
|
-
ecmaVersion: 2022,
|
|
64
|
-
},
|
|
65
|
-
globals: {
|
|
66
|
-
process: 'readonly',
|
|
67
|
-
console: 'readonly',
|
|
68
|
-
Buffer: 'readonly',
|
|
69
|
-
setTimeout: 'readonly',
|
|
70
|
-
clearTimeout: 'readonly',
|
|
71
|
-
setInterval: 'readonly',
|
|
72
|
-
clearInterval: 'readonly',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
plugins: {
|
|
76
|
-
'@typescript-eslint': tseslint,
|
|
77
|
-
},
|
|
78
|
-
rules: {
|
|
79
|
-
'no-restricted-imports': [
|
|
80
|
-
'error',
|
|
81
|
-
{
|
|
82
|
-
paths: [...BANNED_NETWORK_IMPORTS, ...BANNED_SHELL_IMPORTS],
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
'@typescript-eslint/no-unused-vars': [
|
|
86
|
-
'error',
|
|
87
|
-
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
88
|
-
],
|
|
89
|
-
'no-console': ['warn', { allow: ['error', 'warn'] }],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
// ---------------------------------------------------------------------
|
|
94
|
-
// tests/ and scripts/ — looser rules
|
|
95
|
-
// ---------------------------------------------------------------------
|
|
96
|
-
{
|
|
97
|
-
files: ['tests/**/*.ts', 'scripts/**/*.{ts,mjs}'],
|
|
98
|
-
languageOptions: {
|
|
99
|
-
parser: tsparser,
|
|
100
|
-
parserOptions: {
|
|
101
|
-
sourceType: 'module',
|
|
102
|
-
ecmaVersion: 2022,
|
|
103
|
-
},
|
|
104
|
-
globals: {
|
|
105
|
-
process: 'readonly',
|
|
106
|
-
console: 'readonly',
|
|
107
|
-
Buffer: 'readonly',
|
|
108
|
-
setTimeout: 'readonly',
|
|
109
|
-
clearTimeout: 'readonly',
|
|
110
|
-
setInterval: 'readonly',
|
|
111
|
-
clearInterval: 'readonly',
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
plugins: {
|
|
115
|
-
'@typescript-eslint': tseslint,
|
|
116
|
-
},
|
|
117
|
-
rules: {
|
|
118
|
-
// Tests + scripts ARE allowed to use child_process (subprocess test,
|
|
119
|
-
// smoke runner, future bench harness).
|
|
120
|
-
'no-console': 'off',
|
|
121
|
-
'@typescript-eslint/no-unused-vars': [
|
|
122
|
-
'error',
|
|
123
|
-
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
// ---------------------------------------------------------------------
|
|
129
|
-
// tests/fixtures — these files deliberately contain "unused" symbols
|
|
130
|
-
// because they exist for parser tests to detect. This block must come
|
|
131
|
-
// AFTER the broader tests/ block so its override wins (ESLint flat
|
|
132
|
-
// configs cascade — later matches override earlier ones).
|
|
133
|
-
// ---------------------------------------------------------------------
|
|
134
|
-
{
|
|
135
|
-
files: ['tests/fixtures/**/*.ts'],
|
|
136
|
-
rules: {
|
|
137
|
-
'@typescript-eslint/no-unused-vars': 'off',
|
|
138
|
-
'no-unused-vars': 'off',
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
// ---------------------------------------------------------------------
|
|
143
|
-
// Things to ignore
|
|
144
|
-
// ---------------------------------------------------------------------
|
|
145
|
-
{
|
|
146
|
-
ignores: ['dist/**', 'node_modules/**', 'coverage/**', '.notes/**', 'pnpm-lock.yaml'],
|
|
147
|
-
},
|
|
148
|
-
];
|
package/lefthook.yml
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# lefthook — git hooks for GraphPilot
|
|
2
|
-
#
|
|
3
|
-
# Why:
|
|
4
|
-
# - Catch lint / type errors BEFORE they land in main.
|
|
5
|
-
# - Enforce Conventional Commits so the changelog stays clean and
|
|
6
|
-
# release automation can parse history (when we add release-please
|
|
7
|
-
# later).
|
|
8
|
-
# - Cheap to bypass intentionally (LEFTHOOK=0 git commit) but the
|
|
9
|
-
# default makes the right thing the easy thing.
|
|
10
|
-
#
|
|
11
|
-
# Install path:
|
|
12
|
-
# `pnpm install` runs lefthook's postinstall hook which wires this
|
|
13
|
-
# file into .git/hooks/. No manual `lefthook install` step required.
|
|
14
|
-
#
|
|
15
|
-
# Bypass:
|
|
16
|
-
# LEFTHOOK=0 git commit # skip all hooks
|
|
17
|
-
# LEFTHOOK_EXCLUDE=lint git commit # skip the lint job only
|
|
18
|
-
|
|
19
|
-
pre-commit:
|
|
20
|
-
parallel: true
|
|
21
|
-
jobs:
|
|
22
|
-
- name: typecheck
|
|
23
|
-
run: pnpm typecheck
|
|
24
|
-
glob:
|
|
25
|
-
- 'src/**/*.ts'
|
|
26
|
-
- 'tests/**/*.ts'
|
|
27
|
-
- 'bench/**/*.ts'
|
|
28
|
-
|
|
29
|
-
- name: lint
|
|
30
|
-
# Only lint files actually staged — fast, accurate.
|
|
31
|
-
run: pnpm exec eslint {staged_files}
|
|
32
|
-
glob:
|
|
33
|
-
- 'src/**/*.ts'
|
|
34
|
-
- 'tests/**/*.ts'
|
|
35
|
-
- 'scripts/**/*.{ts,mjs}'
|
|
36
|
-
|
|
37
|
-
- name: format
|
|
38
|
-
# Format-check staged files. If drift, the dev runs `pnpm format`
|
|
39
|
-
# to fix and re-stages. No auto-write here — explicit is safer
|
|
40
|
-
# (auto-write on commit can clobber a stash or rebase mid-edit).
|
|
41
|
-
run: pnpm exec prettier --check {staged_files}
|
|
42
|
-
glob:
|
|
43
|
-
- '**/*.{ts,tsx,js,jsx,mjs,cjs,json,yml,yaml,md}'
|
|
44
|
-
|
|
45
|
-
commit-msg:
|
|
46
|
-
jobs:
|
|
47
|
-
- name: conventional-commits
|
|
48
|
-
# Conventional Commits regex. Allows:
|
|
49
|
-
# feat: ... feat(scope): ...
|
|
50
|
-
# fix: ... fix(scope)!: ... (! marks breaking change)
|
|
51
|
-
# chore: ... docs: ... refactor: ... test: ...
|
|
52
|
-
# perf: ... build: ... ci: ... revert: ...
|
|
53
|
-
# Plus the standard merge-commit / fixup / WIP forms.
|
|
54
|
-
run: |
|
|
55
|
-
first=$(head -1 "{1}")
|
|
56
|
-
if echo "$first" | grep -qE '^(Merge |Revert |fixup!|squash!|amend!)'; then
|
|
57
|
-
exit 0
|
|
58
|
-
fi
|
|
59
|
-
if echo "$first" | grep -qE '^(feat|fix|chore|docs|test|refactor|perf|build|ci|revert)(\([^)]+\))?!?: .+'; then
|
|
60
|
-
exit 0
|
|
61
|
-
fi
|
|
62
|
-
echo ""
|
|
63
|
-
echo "❌ Commit message does not follow Conventional Commits."
|
|
64
|
-
echo ""
|
|
65
|
-
echo " Got: $first"
|
|
66
|
-
echo ""
|
|
67
|
-
echo " Format: <type>(<scope>)?: <subject>"
|
|
68
|
-
echo " Types : feat, fix, chore, docs, test, refactor, perf, build, ci, revert"
|
|
69
|
-
echo ""
|
|
70
|
-
echo " Examples:"
|
|
71
|
-
echo " feat(mcp): add gp_impact tool"
|
|
72
|
-
echo " fix: handle empty TS files gracefully"
|
|
73
|
-
echo " docs(quickstart): clarify Claude Code setup"
|
|
74
|
-
echo ""
|
|
75
|
-
echo " To bypass once: LEFTHOOK=0 git commit ..."
|
|
76
|
-
exit 1
|
|
77
|
-
|
|
78
|
-
pre-push:
|
|
79
|
-
jobs:
|
|
80
|
-
- name: test
|
|
81
|
-
run: pnpm test
|