@colbymchenry/codegraph 0.9.8 โ 1.0.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/README.md +150 -70
- package/dist/bin/codegraph.d.ts +1 -0
- package/dist/context/index.d.ts +9 -0
- package/dist/context/markers.d.ts +19 -0
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/queries.d.ts +43 -0
- package/dist/db/sqlite-adapter.d.ts +7 -0
- package/dist/directory.d.ts +34 -2
- package/dist/extraction/astro-extractor.d.ts +79 -0
- package/dist/extraction/extraction-version.d.ts +25 -0
- package/dist/extraction/function-ref.d.ts +118 -0
- package/dist/extraction/grammars.d.ts +7 -1
- package/dist/extraction/index.d.ts +34 -0
- package/dist/extraction/languages/c-cpp.d.ts +8 -0
- package/dist/extraction/languages/csharp.d.ts +22 -0
- package/dist/extraction/languages/r.d.ts +3 -0
- package/dist/extraction/languages/typescript.d.ts +13 -0
- package/dist/extraction/liquid-extractor.d.ts +7 -0
- package/dist/extraction/razor-extractor.d.ts +42 -0
- package/dist/extraction/tree-sitter-types.d.ts +33 -0
- package/dist/extraction/tree-sitter.d.ts +237 -0
- package/dist/extraction/vue-extractor.d.ts +15 -0
- package/dist/index.d.ts +41 -3
- package/dist/installer/instructions-template.d.ts +34 -11
- package/dist/installer/targets/opencode.d.ts +9 -1
- package/dist/installer/targets/shared.d.ts +14 -0
- package/dist/mcp/daemon.d.ts +60 -1
- package/dist/mcp/dynamic-boundaries.d.ts +41 -0
- package/dist/mcp/ppid-watchdog.d.ts +44 -0
- package/dist/mcp/proxy.d.ts +6 -0
- package/dist/mcp/server-instructions.d.ts +12 -1
- package/dist/mcp/session.d.ts +2 -0
- package/dist/mcp/stdin-teardown.d.ts +27 -0
- package/dist/mcp/tools.d.ts +110 -49
- package/dist/resolution/callback-synthesizer.d.ts +3 -3
- package/dist/resolution/frameworks/astro.d.ts +9 -0
- package/dist/resolution/frameworks/index.d.ts +1 -0
- package/dist/resolution/import-resolver.d.ts +10 -0
- package/dist/resolution/index.d.ts +80 -0
- package/dist/resolution/name-matcher.d.ts +61 -0
- package/dist/resolution/types.d.ts +27 -3
- package/dist/resolution/workspace-packages.d.ts +48 -0
- package/dist/search/query-utils.d.ts +35 -1
- package/dist/sync/watcher.d.ts +124 -32
- package/dist/telemetry/index.d.ts +146 -0
- package/dist/types.d.ts +25 -2
- package/dist/upgrade/index.d.ts +132 -0
- package/dist/utils.d.ts +30 -24
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# CodeGraph
|
|
4
4
|
|
|
5
|
+
## ๐ 1.0 Released!
|
|
6
|
+
|
|
7
|
+
Follow [@getcodegraph](https://x.com/getcodegraph) on X for updates.
|
|
8
|
+
|
|
5
9
|
### Supercharge Claude Code, Cursor, Codex, OpenCode, Hermes Agent, Gemini, Antigravity, and Kiro with Semantic Code Intelligence
|
|
6
10
|
|
|
7
|
-
**~
|
|
11
|
+
**~16% cheaper ยท ~58% fewer tool calls ยท 100% local**
|
|
8
12
|
|
|
9
13
|
### [Documentation & Website โ](https://colbymchenry.github.io/codegraph/)
|
|
10
14
|
|
|
@@ -25,10 +29,20 @@
|
|
|
25
29
|
[](#supported-agents)
|
|
26
30
|
[](#supported-agents)
|
|
27
31
|
|
|
32
|
+
<br>
|
|
33
|
+
|
|
34
|
+
**The CodeGraph platform is coming** โ for every PR, know exactly what to test, what could break, which flows are affected, and whether business logic is compromised.
|
|
35
|
+
|
|
36
|
+
<a href="https://getcodegraph.com"><img alt="Join the waitlist for early beta access" src="https://raw.githubusercontent.com/colbymchenry/codegraph/main/assets/waitlist.svg?v=2" height="52"></a>
|
|
37
|
+
|
|
38
|
+
<sub>Get <b>early beta access</b> to the hosted product ยท <a href="https://getcodegraph.com">getcodegraph.com</a></sub>
|
|
39
|
+
|
|
28
40
|
</div>
|
|
29
41
|
|
|
30
42
|
## Get Started
|
|
31
43
|
|
|
44
|
+
### 1. Install the CLI
|
|
45
|
+
|
|
32
46
|
**No Node.js required** โ one command grabs the right build for your OS:
|
|
33
47
|
|
|
34
48
|
```bash
|
|
@@ -42,13 +56,24 @@ irm https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.ps1 |
|
|
|
42
56
|
Already have Node? Use npm instead (works on any version):
|
|
43
57
|
|
|
44
58
|
```bash
|
|
45
|
-
npx @colbymchenry/codegraph # zero-install, or:
|
|
46
59
|
npm i -g @colbymchenry/codegraph
|
|
47
60
|
```
|
|
48
61
|
|
|
49
|
-
<sub>CodeGraph bundles its own runtime โ nothing to compile, no native build, works the same everywhere. The
|
|
62
|
+
<sub>CodeGraph bundles its own runtime โ nothing to compile, no native build, works the same everywhere. The installer puts `codegraph` on your PATH but **doesn't change your current shell** โ open a new terminal before the next step so the command resolves.</sub>
|
|
63
|
+
|
|
64
|
+
<sub>**Upgrade any time** with `codegraph upgrade` โ it detects how you installed (bundle, npm, or npx) and updates in place. Add `--check` to see if an update is available, or `codegraph upgrade <version>` to pin one.</sub>
|
|
50
65
|
|
|
51
|
-
###
|
|
66
|
+
### 2. Wire up your agent(s)
|
|
67
|
+
|
|
68
|
+
In a **new terminal**, run the installer to connect CodeGraph to the agents you use:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
codegraph install
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
<sub>Detects and auto-configures Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, and Kiro โ wiring the CodeGraph MCP server into each. **This is the step that connects CodeGraph to your agent;** installing the CLI in step 1 does not do it on its own. (Shortcut: `npx @colbymchenry/codegraph` downloads and runs this in one go.)</sub>
|
|
75
|
+
|
|
76
|
+
### 3. Initialize each project
|
|
52
77
|
|
|
53
78
|
```bash
|
|
54
79
|
cd your-project
|
|
@@ -83,21 +108,21 @@ When Claude Code explores a codebase, it spawns **Explore agents** that scan fil
|
|
|
83
108
|
|
|
84
109
|
### Benchmark Results
|
|
85
110
|
|
|
86
|
-
Tested across **7 real-world open-source codebases** spanning 7 languages, comparing an agent (Claude Code, headless) answering one architecture question **with** and **without** CodeGraph. Each cell is the savings at the **median of 4 runs per arm**. _Re-validated on Opus 4.8 (2026-
|
|
111
|
+
Tested across **7 real-world open-source codebases** spanning 7 languages, comparing an agent (Claude Code, headless) answering one architecture question **with** and **without** CodeGraph. Each cell is the savings at the **median of 4 runs per arm**. _Re-validated on Opus 4.8 (2026-06-02), on the current build (`codegraph_explore` as the primary tool)._
|
|
87
112
|
|
|
88
|
-
> **Average:
|
|
113
|
+
> **Average: 16% cheaper ยท 47% fewer tokens ยท 22% faster ยท 58% fewer tool calls**
|
|
89
114
|
|
|
90
115
|
| Codebase | Language | Cost | Tokens | Time | Tool calls |
|
|
91
116
|
|----------|----------|------|--------|------|------------|
|
|
92
|
-
| **VS Code** | TypeScript ยท ~10k files |
|
|
93
|
-
| **Excalidraw** | TypeScript ยท ~640 |
|
|
94
|
-
| **Django** | Python ยท ~3k |
|
|
95
|
-
| **Tokio** | Rust ยท ~790 |
|
|
96
|
-
| **OkHttp** | Java ยท ~645 |
|
|
97
|
-
| **Gin** | Go ยท ~110 |
|
|
98
|
-
| **Alamofire** | Swift ยท ~110 |
|
|
117
|
+
| **VS Code** | TypeScript ยท ~10k files | 18% cheaper | 64% fewer | 11% faster | 81% fewer |
|
|
118
|
+
| **Excalidraw** | TypeScript ยท ~640 | even | 25% fewer | 27% faster | 40% fewer |
|
|
119
|
+
| **Django** | Python ยท ~3k | 8% cheaper | 60% fewer | 13% faster | 77% fewer |
|
|
120
|
+
| **Tokio** | Rust ยท ~790 | even | 38% fewer | 18% faster | 57% fewer |
|
|
121
|
+
| **OkHttp** | Java ยท ~645 | 25% cheaper | 54% fewer | 31% faster | 50% fewer |
|
|
122
|
+
| **Gin** | Go ยท ~110 | 19% cheaper | 23% fewer | 24% faster | 44% fewer |
|
|
123
|
+
| **Alamofire** | Swift ยท ~110 | 40% cheaper | 64% fewer | 33% faster | 58% fewer |
|
|
99
124
|
|
|
100
|
-
CodeGraph cuts **
|
|
125
|
+
CodeGraph cuts **tokens, tool calls, and wall-clock time on every repo** โ across small, medium, and large codebases โ and answers them with **near-zero file reads**, while the no-CodeGraph agent spends its budget on grep/find/Read discovery. `codegraph_explore` shows the answer in full โ the mechanism plus the exact methods you asked about, even when they're buried in a multi-thousand-line file โ while collapsing redundant interchangeable implementations to signatures, so the response is sized to the *answer* rather than the file count. **Cost stays flat-to-cheaper everywhere** โ largest on the small repos (Alamofire, OkHttp), roughly break-even on the most response-heavy ones (Excalidraw, Tokio), where CodeGraph trades the no-CodeGraph agent's many small grep/read round-trips for a few large, cache-heavy tool responses.
|
|
101
126
|
|
|
102
127
|
<details>
|
|
103
128
|
<summary><strong>Per-repo breakdown โ WITH vs WITHOUT (median of 4)</strong></summary>
|
|
@@ -105,79 +130,79 @@ CodeGraph cuts **cost, tokens, tool calls, and time on every repo** โ across s
|
|
|
105
130
|
**VS Code** ยท ~10k files
|
|
106
131
|
| Metric | WITH cg | WITHOUT cg | ฮ |
|
|
107
132
|
|---|---|---|---|
|
|
108
|
-
| Time | 1m
|
|
133
|
+
| Time | 1m 59s | 2m 13s | 11% faster |
|
|
109
134
|
| File Reads | 0 | 9 | โ9 |
|
|
110
135
|
| Grep/Bash | 0 | 11 | โ11 |
|
|
111
|
-
| Tool calls | 4 | 21 |
|
|
112
|
-
| Total tokens |
|
|
113
|
-
| Cost | $0.
|
|
136
|
+
| Tool calls | 4 | 21 | 81% fewer |
|
|
137
|
+
| Total tokens | 640k | 1.79M | 64% fewer |
|
|
138
|
+
| Cost | $0.68 | $0.83 | 18% cheaper |
|
|
114
139
|
|
|
115
140
|
**Excalidraw** ยท ~640 files
|
|
116
141
|
| Metric | WITH cg | WITHOUT cg | ฮ |
|
|
117
142
|
|---|---|---|---|
|
|
118
|
-
| Time | 1m
|
|
143
|
+
| Time | 1m 32s | 2m 6s | 27% faster |
|
|
119
144
|
| File Reads | 0 | 7 | โ7 |
|
|
120
|
-
| Grep/Bash |
|
|
121
|
-
| Tool calls |
|
|
122
|
-
| Total tokens |
|
|
123
|
-
| Cost | $0.
|
|
145
|
+
| Grep/Bash | 1 | 8 | โ7 |
|
|
146
|
+
| Tool calls | 9 | 15 | 40% fewer |
|
|
147
|
+
| Total tokens | 1.27M | 1.69M | 25% fewer |
|
|
148
|
+
| Cost | $0.78 | $0.78 | even |
|
|
124
149
|
|
|
125
150
|
**Django** ยท ~3k files
|
|
126
151
|
| Metric | WITH cg | WITHOUT cg | ฮ |
|
|
127
152
|
|---|---|---|---|
|
|
128
|
-
| Time | 1m
|
|
153
|
+
| Time | 1m 43s | 1m 58s | 13% faster |
|
|
129
154
|
| File Reads | 0 | 9 | โ9 |
|
|
130
155
|
| Grep/Bash | 0 | 5 | โ5 |
|
|
131
156
|
| Tool calls | 3 | 13 | 77% fewer |
|
|
132
|
-
| Total tokens |
|
|
133
|
-
| Cost | $0.
|
|
157
|
+
| Total tokens | 559k | 1.41M | 60% fewer |
|
|
158
|
+
| Cost | $0.57 | $0.62 | 8% cheaper |
|
|
134
159
|
|
|
135
160
|
**Tokio** ยท ~790 files
|
|
136
161
|
| Metric | WITH cg | WITHOUT cg | ฮ |
|
|
137
162
|
|---|---|---|---|
|
|
138
|
-
| Time | 1m
|
|
163
|
+
| Time | 1m 55s | 2m 20s | 18% faster |
|
|
139
164
|
| File Reads | 0 | 8 | โ8 |
|
|
140
165
|
| Grep/Bash | 0 | 6 | โ6 |
|
|
141
|
-
| Tool calls |
|
|
142
|
-
| Total tokens |
|
|
143
|
-
| Cost | $0.
|
|
166
|
+
| Tool calls | 6 | 14 | 57% fewer |
|
|
167
|
+
| Total tokens | 1.08M | 1.73M | 38% fewer |
|
|
168
|
+
| Cost | $0.82 | $0.82 | even |
|
|
144
169
|
|
|
145
170
|
**OkHttp** ยท ~645 files
|
|
146
171
|
| Metric | WITH cg | WITHOUT cg | ฮ |
|
|
147
172
|
|---|---|---|---|
|
|
148
|
-
| Time | 1m
|
|
149
|
-
| File Reads |
|
|
150
|
-
| Grep/Bash |
|
|
151
|
-
| Tool calls |
|
|
152
|
-
| Total tokens |
|
|
153
|
-
| Cost | $0.
|
|
173
|
+
| Time | 1m 1s | 1m 29s | 31% faster |
|
|
174
|
+
| File Reads | 0 | 4 | โ4 |
|
|
175
|
+
| Grep/Bash | 2 | 6 | โ4 |
|
|
176
|
+
| Tool calls | 5 | 10 | 50% fewer |
|
|
177
|
+
| Total tokens | 502k | 1.10M | 54% fewer |
|
|
178
|
+
| Cost | $0.41 | $0.55 | 25% cheaper |
|
|
154
179
|
|
|
155
180
|
**Gin** ยท ~110 files
|
|
156
181
|
| Metric | WITH cg | WITHOUT cg | ฮ |
|
|
157
182
|
|---|---|---|---|
|
|
158
|
-
| Time | 1m
|
|
159
|
-
| File Reads |
|
|
160
|
-
| Grep/Bash |
|
|
161
|
-
| Tool calls | 5 | 9 |
|
|
162
|
-
| Total tokens |
|
|
163
|
-
| Cost | $0.
|
|
183
|
+
| Time | 1m 14s | 1m 37s | 24% faster |
|
|
184
|
+
| File Reads | 1 | 6 | โ5 |
|
|
185
|
+
| Grep/Bash | 1 | 2 | โ1 |
|
|
186
|
+
| Tool calls | 5 | 9 | 44% fewer |
|
|
187
|
+
| Total tokens | 651k | 847k | 23% fewer |
|
|
188
|
+
| Cost | $0.46 | $0.57 | 19% cheaper |
|
|
164
189
|
|
|
165
190
|
**Alamofire** ยท ~110 files
|
|
166
191
|
| Metric | WITH cg | WITHOUT cg | ฮ |
|
|
167
192
|
|---|---|---|---|
|
|
168
|
-
| Time |
|
|
169
|
-
| File Reads |
|
|
170
|
-
| Grep/Bash |
|
|
171
|
-
| Tool calls |
|
|
172
|
-
| Total tokens |
|
|
173
|
-
| Cost | $0.
|
|
193
|
+
| Time | 1m 35s | 2m 21s | 33% faster |
|
|
194
|
+
| File Reads | 0 | 9 | โ9 |
|
|
195
|
+
| Grep/Bash | 0 | 4 | โ4 |
|
|
196
|
+
| Tool calls | 5 | 12 | 58% fewer |
|
|
197
|
+
| Total tokens | 766k | 2.10M | 64% fewer |
|
|
198
|
+
| Cost | $0.57 | $0.95 | 40% cheaper |
|
|
174
199
|
|
|
175
200
|
</details>
|
|
176
201
|
|
|
177
202
|
<details>
|
|
178
203
|
<summary><strong>Full benchmark details</strong></summary>
|
|
179
204
|
|
|
180
|
-
**Methodology.** Each arm is `claude -p` (Claude Opus 4.8) run headlessly against the repo with `--strict-mcp-config`: **WITH** = CodeGraph's MCP server enabled, **WITHOUT** = an empty MCP config. Built-in Read/Grep/Bash stay available to both. Same question per repo, **4 runs per arm, median reported**. Cost = the run's `total_cost_usd`; Tokens = total tokens processed (input incl. cached + output); Time = wall-clock; Tool calls = every tool invocation, including those inside any sub-agents the model spawns. Repos cloned at `--depth 1` and indexed by the same CodeGraph build that served them. Re-validated 2026-
|
|
205
|
+
**Methodology.** Each arm is `claude -p` (Claude Opus 4.8) run headlessly against the repo with `--strict-mcp-config`: **WITH** = CodeGraph's MCP server enabled, **WITHOUT** = an empty MCP config. Built-in Read/Grep/Bash stay available to both. Same question per repo, **4 runs per arm, median reported**. Cost = the run's `total_cost_usd`; Tokens = total tokens processed (input incl. cached + output); Time = wall-clock; Tool calls = every tool invocation, including those inside any sub-agents the model spawns. Repos cloned at `--depth 1` and indexed by the same CodeGraph build that served them. Re-validated 2026-06-02 on the current build. These numbers are lower than the prior Opus 4.7 validation โ not a CodeGraph regression but a stronger native baseline: Opus 4.8 greps/reads efficiently on the main thread instead of fanning out into large Explore-subagent sweeps, so the no-CodeGraph arm is leaner than it used to be. Per-repo numbers move run-to-run with how hard the without-arm thrashes (the median-of-4 smooths it, but tails remain โ e.g. Django's without-arm hit $2.71/14m one batch).
|
|
181
206
|
|
|
182
207
|
**Queries:**
|
|
183
208
|
| Codebase | Query |
|
|
@@ -190,7 +215,7 @@ CodeGraph cuts **cost, tokens, tool calls, and time on every repo** โ across s
|
|
|
190
215
|
| Gin | "How does gin route requests through its middleware chain?" |
|
|
191
216
|
| Alamofire | "How does Alamofire build, send, and validate a request?" |
|
|
192
217
|
|
|
193
|
-
**Why CodeGraph wins:** with the index available, the agent answers directly โ
|
|
218
|
+
**Why CodeGraph wins:** with the index available, the agent answers directly โ usually one `codegraph_explore` returns the relevant source โ and stops, usually with zero file reads. Without it, the agent spends most of its budget on discovery (find/ls/grep) before reading the right code. CodeGraph only helps when queried *directly*, so its instructions steer agents to answer directly rather than delegate exploration to file-reading sub-agents โ otherwise a sub-agent reads files regardless and CodeGraph becomes overhead.
|
|
194
219
|
|
|
195
220
|
</details>
|
|
196
221
|
|
|
@@ -204,8 +229,8 @@ CodeGraph cuts **cost, tokens, tool calls, and time on every repo** โ across s
|
|
|
204
229
|
| **Full-Text Search** | Find code by name instantly across your entire codebase, powered by FTS5 |
|
|
205
230
|
| **Impact Analysis** | Trace callers, callees, and the full impact radius of any symbol before making changes |
|
|
206
231
|
| **Always Fresh** | File watcher uses native OS events (FSEvents/inotify/ReadDirectoryChangesW) with debounced auto-sync โ the graph stays current as you code, zero config |
|
|
207
|
-
| **20+ Languages** | TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C, C++, Objective-C, Swift, Kotlin, Dart, Lua, Luau, Svelte, Liquid, Pascal/Delphi |
|
|
208
|
-
| **Framework-aware Routes** | Recognizes web-framework routing files and links URL patterns to their handlers across
|
|
232
|
+
| **20+ Languages** | TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C, C++, Objective-C, Swift, Kotlin, Scala, Dart, Lua, Luau, R, Svelte, Vue, Astro, Liquid, Pascal/Delphi |
|
|
233
|
+
| **Framework-aware Routes** | Recognizes web-framework routing files and links URL patterns to their handlers across 17 frameworks |
|
|
209
234
|
| **Mixed iOS / React Native / Expo** | Closes cross-language flows that static parsing misses: Swift โ ObjC bridging, React Native legacy bridge + TurboModules + Fabric view components, native โ JS event emitters, Expo Modules |
|
|
210
235
|
| **100% Local** | No data leaves your machine. No API keys. No external services. SQLite database only |
|
|
211
236
|
|
|
@@ -253,11 +278,14 @@ CodeGraph detects web-framework routing files and emits `route` nodes linked by
|
|
|
253
278
|
| **Drupal** | `*.routing.yml` routes (`_controller`, `_form`, entity handlers); `hook_*` implementations in `.module`/`.theme`/`.install`/`.inc` |
|
|
254
279
|
| **Rails** | `get '/x', to: 'users#index'`, hash-rocket `=>` syntax |
|
|
255
280
|
| **Spring** | `@GetMapping`, `@PostMapping`, `@RequestMapping` on methods |
|
|
281
|
+
| **Play** | `GET`/`POST`/โฆ verb routes in `conf/routes` โ `Controller.method` actions (Scala + Java) |
|
|
256
282
|
| **Gin / chi / gorilla / mux** | `r.GET(...)`, `router.HandleFunc(...)` |
|
|
257
283
|
| **Axum / actix / Rocket** | `.route("/x", get(handler))` |
|
|
258
284
|
| **ASP.NET** | `[HttpGet("/x")]` attributes on action methods |
|
|
259
285
|
| **Vapor** | `app.get("x", use: handler)` |
|
|
260
286
|
| **React Router** / **SvelteKit** | Route component nodes |
|
|
287
|
+
| **Vue Router** / **Nuxt** | `pages/` file-based routes, `server/api/` endpoints, route middleware |
|
|
288
|
+
| **Astro** | `src/pages/` file-based routes (`.astro` pages + `.ts` endpoints, `[param]`/`[...rest]` syntax) |
|
|
261
289
|
|
|
262
290
|
---
|
|
263
291
|
|
|
@@ -302,7 +330,7 @@ The installer will:
|
|
|
302
330
|
- Ask which agent(s) to configure โ auto-detects installed ones from: **Claude Code**, **Cursor**, **Codex CLI**, **opencode**, **Hermes Agent**, **Gemini CLI**, **Antigravity IDE**, **Kiro**
|
|
303
331
|
- Prompt to install `codegraph` on your PATH (so agents can launch the MCP server)
|
|
304
332
|
- Ask whether configs apply to all your projects or just this one
|
|
305
|
-
- Write each chosen agent's MCP server config
|
|
333
|
+
- Write each chosen agent's MCP server config, plus a small marker-fenced CodeGraph section in the agent's instructions file (`CLAUDE.md` / `AGENTS.md` / `GEMINI.md`) โ that's how subagents and non-MCP agents learn the `codegraph explore` / `codegraph node` commands, since the MCP server's own guidance only reaches the main agent. Removed cleanly by `codegraph uninstall`.
|
|
306
334
|
- Set up auto-allow permissions when Claude Code is one of the targets
|
|
307
335
|
- Initialize your current project (local installs only)
|
|
308
336
|
|
|
@@ -365,7 +393,7 @@ npm install -g @colbymchenry/codegraph
|
|
|
365
393
|
"permissions": {
|
|
366
394
|
"allow": [
|
|
367
395
|
"mcp__codegraph__codegraph_search",
|
|
368
|
-
"
|
|
396
|
+
"mcp__codegraph__codegraph_explore",
|
|
369
397
|
"mcp__codegraph__codegraph_callers",
|
|
370
398
|
"mcp__codegraph__codegraph_callees",
|
|
371
399
|
"mcp__codegraph__codegraph_impact",
|
|
@@ -382,14 +410,14 @@ npm install -g @colbymchenry/codegraph
|
|
|
382
410
|
<details>
|
|
383
411
|
<summary><strong>Agent Tool Guidance</strong></summary>
|
|
384
412
|
|
|
385
|
-
CodeGraph's MCP server delivers its usage guidance to your agent **automatically**, in the MCP `initialize` response
|
|
413
|
+
CodeGraph's MCP server delivers its usage guidance to your agent **automatically**, in the MCP `initialize` response. In short, it tells the agent to:
|
|
386
414
|
|
|
387
415
|
- **Answer structural questions directly with CodeGraph** โ it *is* the pre-built index, so a grep/read loop just repeats work it already did. Treat the returned source as already read.
|
|
388
|
-
- **Pick the tool by intent:** `
|
|
416
|
+
- **Pick the tool by intent:** `codegraph_explore` for almost anything โ "how does X work", a flow/"how does X reach Y", or surveying an area (one call returns the relevant symbols' source grouped by file); `codegraph_search` to just locate a symbol; `codegraph_callers` for every call site (including callback registrations); `codegraph_node` for one symbol's full source + callers, or to read a file like the Read tool.
|
|
389
417
|
- **Trust the results โ don't re-verify with grep**, and check the staleness banner after edits.
|
|
390
|
-
-
|
|
418
|
+
- In a workspace with no index, CodeGraph announces itself inactive and serves no tools โ indexing stays your decision.
|
|
391
419
|
|
|
392
|
-
The exact text is `src/mcp/server-instructions.ts` โ the single source of truth.
|
|
420
|
+
The exact text is `src/mcp/server-instructions.ts` โ the single source of truth for the main agent. Because subagents and non-MCP harnesses never see the MCP guidance, the installer also writes a four-line marker-fenced section into the agent's instructions file pointing at the `codegraph explore` / `codegraph node` CLI equivalents.
|
|
393
421
|
|
|
394
422
|
</details>
|
|
395
423
|
|
|
@@ -410,7 +438,7 @@ The exact text is `src/mcp/server-instructions.ts` โ the single source of trut
|
|
|
410
438
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
411
439
|
โ CodeGraph MCP Server โ
|
|
412
440
|
โ โ
|
|
413
|
-
โ
|
|
441
|
+
โ explore ยท search ยท callers ยท callees ยท impact ยท node โ
|
|
414
442
|
โ โ โ
|
|
415
443
|
โ โผ โ
|
|
416
444
|
โ SQLite knowledge graph โ
|
|
@@ -440,13 +468,15 @@ codegraph index [path] # Full index (--force to re-index, --quiet for
|
|
|
440
468
|
codegraph sync [path] # Incremental update
|
|
441
469
|
codegraph status [path] # Show statistics
|
|
442
470
|
codegraph query <search> # Search symbols (--kind, --limit, --json)
|
|
471
|
+
codegraph explore <query> # Relevant symbols' source + call paths in one shot (same output as the codegraph_explore MCP tool)
|
|
472
|
+
codegraph node <symbol|file> # One symbol's source + callers, or read a file with line numbers (same output as codegraph_node)
|
|
443
473
|
codegraph files [path] # Show file structure (--format, --filter, --max-depth, --json)
|
|
444
|
-
codegraph context <task> # Build context for AI (--format, --max-nodes)
|
|
445
474
|
codegraph callers <symbol> # Find what calls a function/method (--limit, --json)
|
|
446
475
|
codegraph callees <symbol> # Find what a function/method calls (--limit, --json)
|
|
447
476
|
codegraph impact <symbol> # Analyze what code is affected by changing a symbol (--depth, --json)
|
|
448
477
|
codegraph affected [files...] # Find test files affected by changes (see below)
|
|
449
478
|
codegraph serve --mcp # Start MCP server
|
|
479
|
+
codegraph upgrade [version] # Update to the latest release (--check, --force)
|
|
450
480
|
```
|
|
451
481
|
|
|
452
482
|
### `codegraph affected`
|
|
@@ -481,20 +511,18 @@ fi
|
|
|
481
511
|
|
|
482
512
|
## MCP Tools
|
|
483
513
|
|
|
484
|
-
When running as an MCP server, CodeGraph exposes
|
|
514
|
+
When running as an MCP server, CodeGraph exposes a focused set of four tools โ measured agent behavior showed a leaner list steers agents to the right tool and saves context every session:
|
|
485
515
|
|
|
486
516
|
| Tool | Purpose |
|
|
487
517
|
|------|---------|
|
|
518
|
+
| `codegraph_explore` | **Primary.** Answer almost any question in one call โ "how does X work", a flow ("how does X reach Y"), or surveying an area โ returning the relevant symbols' verbatim source grouped by file, plus a relationship map and blast radius. Surfaces dynamic-dispatch hops (callbacks, React re-render, interfaceโimpl) grep can't follow. |
|
|
519
|
+
| `codegraph_node` | One symbol's full source + caller/callee trail (every overload for an ambiguous name) โ or pass a file path to **read a whole file like the Read tool** (same line-numbered output, `offset`/`limit`), with its dependents attached. |
|
|
488
520
|
| `codegraph_search` | Find symbols by name across the codebase |
|
|
489
|
-
| `
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
| `codegraph_node` | Get details about a specific symbol (optionally with source code) |
|
|
495
|
-
| `codegraph_explore` | Return source for several related symbols grouped by file, plus a relationship map, in one call |
|
|
496
|
-
| `codegraph_files` | Get indexed file structure (faster than filesystem scanning) |
|
|
497
|
-
| `codegraph_status` | Check index health and statistics |
|
|
521
|
+
| `codegraph_callers` | Every call site of a function โ including where it's registered as a callback โ with one section per definition when several share a name |
|
|
522
|
+
|
|
523
|
+
Four more tools (`codegraph_callees`, `codegraph_impact`, `codegraph_files`, `codegraph_status`) stay fully functional but unlisted by default โ measured across eval runs, agents never or rarely picked them, and their information already arrives inline on the four above (explore's blast-radius section, node's dependents note, a symbol's body as its callee list). Re-enable any of them with the `CODEGRAPH_MCP_TOOLS` environment variable (e.g. `CODEGRAPH_MCP_TOOLS=explore,node,search,callers,impact`), or use their CLI equivalents (`codegraph callees` / `impact` / `files` / `status`).
|
|
524
|
+
|
|
525
|
+
In a workspace with no `.codegraph/` index, the server announces itself inactive and lists **no** tools โ agents work normally with their built-in tools, and indexing stays your decision.
|
|
498
526
|
|
|
499
527
|
---
|
|
500
528
|
|
|
@@ -565,6 +593,23 @@ add a negation โ `!vendor/`. The defaults apply uniformly, so committing a
|
|
|
565
593
|
dependency or build directory doesn't force it into the graph; the `.gitignore`
|
|
566
594
|
negation is the explicit opt-in.
|
|
567
595
|
|
|
596
|
+
## Telemetry
|
|
597
|
+
|
|
598
|
+
CodeGraph collects **anonymous usage statistics** โ which tools and commands get
|
|
599
|
+
used, which languages get indexed โ to guide where language and agent support
|
|
600
|
+
work goes. **Never** any code, paths, file or symbol names, queries, or IP
|
|
601
|
+
addresses; usage is aggregated locally into daily totals before anything is
|
|
602
|
+
sent, and the ingest endpoint is [public code in this repo](telemetry-worker/)
|
|
603
|
+
that enforces the documented field list. The installer asks up front; turn it
|
|
604
|
+
off any time:
|
|
605
|
+
|
|
606
|
+
```bash
|
|
607
|
+
codegraph telemetry off # or: CODEGRAPH_TELEMETRY=0, or DO_NOT_TRACK=1
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
[`TELEMETRY.md`](TELEMETRY.md) lists every field, with the off-switches and the
|
|
611
|
+
full data-handling story.
|
|
612
|
+
|
|
568
613
|
## Supported Platforms
|
|
569
614
|
|
|
570
615
|
Every release ships a self-contained build (bundled Node runtime โ nothing to
|
|
@@ -615,11 +660,44 @@ is written):
|
|
|
615
660
|
| Dart | `.dart` | Full support |
|
|
616
661
|
| Svelte | `.svelte` | Full support (script extraction, Svelte 5 runes, SvelteKit routes) |
|
|
617
662
|
| Vue | `.vue` | Full support (script + script-setup extraction, Nuxt page/API/middleware routes) |
|
|
663
|
+
| Astro | `.astro` | Full support (frontmatter + script extraction, template component/call references, `src/pages/` routes) |
|
|
618
664
|
| Liquid | `.liquid` | Full support |
|
|
619
665
|
| Pascal / Delphi | `.pas`, `.dpr`, `.dpk`, `.lpr` | Full support (classes, records, interfaces, enums, DFM/FMX form files) |
|
|
620
666
|
| Lua | `.lua` | Full support (functions, methods with receivers, local variables, `require` imports, call edges) |
|
|
667
|
+
| R | `.R` `.r` | Full support (functions in every assignment form, S4/R5/R6 classes with methods, `library`/`require` imports, `source()` file references, call edges) |
|
|
621
668
|
| Luau | `.luau` | Full support (everything in Lua, plus `type`/`export type` aliases, typed signatures, and Roblox instance-path `require`) |
|
|
622
669
|
|
|
670
|
+
## Measured cross-file coverage
|
|
671
|
+
|
|
672
|
+
Impact and blast-radius queries are only as good as the dependency graph behind them, so coverage is measured rather than asserted. **Fair coverage** = the share of symbol-bearing source files that have at least one *resolved cross-file dependent* โ something that imports, calls, references, or (through a framework convention) routes to them โ on a real-world benchmark repo per language. The residual is always a genuine static-analysis frontier (runtime dynamic dispatch, reflection / DI containers, framework-convention entry points, vendored third-party code), never hidden by gaming the denominator.
|
|
673
|
+
|
|
674
|
+
| Language | Benchmark repo | Coverage |
|
|
675
|
+
|---|---|---|
|
|
676
|
+
| TypeScript / JavaScript | this repo | 95.8% |
|
|
677
|
+
| Python | psf/requests | 100% |
|
|
678
|
+
| Go | gin-gonic/gin | 96.6% |
|
|
679
|
+
| Rust | BurntSushi/ripgrep | 86.7% |
|
|
680
|
+
| Java | google/gson | 93.3% |
|
|
681
|
+
| C# | jbogard/MediatR | 85.2% |
|
|
682
|
+
| PHP | guzzle/guzzle | 100% |
|
|
683
|
+
| Ruby | sidekiq/sidekiq | 100% |
|
|
684
|
+
| C | redis/redis | 92.2% |
|
|
685
|
+
| C++ | google/leveldb | 94.8% |
|
|
686
|
+
| Objective-C | SDWebImage | 91.6% |
|
|
687
|
+
| Swift | Alamofire | 95.3% |
|
|
688
|
+
| Kotlin | square/okhttp | 96.2% |
|
|
689
|
+
| Scala | gatling/gatling | 91.2% |
|
|
690
|
+
| Dart | flutter/packages | 92.4% |
|
|
691
|
+
| Svelte / SvelteKit | sveltejs/realworld | 100% |
|
|
692
|
+
| Vue / Nuxt | nuxt/movies | 93.5% |
|
|
693
|
+
| Astro | xingwangzhe/stalux | 93.0% |
|
|
694
|
+
| Lua | nvim-telescope/telescope.nvim | 84.2% |
|
|
695
|
+
| Luau | dphfox/Fusion | 92.2% |
|
|
696
|
+
| Liquid | Shopify/dawn | 73.8% |
|
|
697
|
+
| Pascal / Delphi | PascalCoin | 77.4% |
|
|
698
|
+
|
|
699
|
+
Framework routing is validated the same way, on a canonical app per framework: Express 100%, FastAPI 98%, Flask 100%, NestJS 96.8%, Gin 96.5%, Axum 100%, Rocket 93.8%, Vapor 100%, Laravel 92%, Rails 89.6%, React Router 100% โ and the convention/reflection-heavy ones at their honest static-analysis ceiling: ASP.NET 83.9%, Spring 83.3%, Drupal 78.9%, Play 76.3%, Django 74.1%. SvelteKit, Vue/Nuxt, and Astro use file-based routing, so their page/endpoint coverage is the Svelte/SvelteKit (100%), Vue/Nuxt (93.5%), and Astro (93.0% โ every `src/pages/` file maps to a route node on the two validation repos) figures in the table above.
|
|
700
|
+
|
|
623
701
|
## Troubleshooting
|
|
624
702
|
|
|
625
703
|
**"CodeGraph not initialized"** โ Run `codegraph init` in your project directory first.
|
|
@@ -635,6 +713,8 @@ is written):
|
|
|
635
713
|
|
|
636
714
|
**Missing symbols** โ The MCP server auto-syncs on save (wait a couple seconds). Run `codegraph sync` manually if needed. Check that the file's language is supported and isn't inside a `.gitignore`d or default-excluded directory (e.g. `node_modules`, `dist`).
|
|
637
715
|
|
|
716
|
+
**Sharing one checkout between Windows and WSL** โ Don't point both at the same `.codegraph/`: the background-server lock and the SQLite index are tied to the OS that wrote them, and SQLite locking across the WSL2/Windows filesystem boundary is unreliable. Give each side its own index in the same tree by setting `CODEGRAPH_DIR` to a distinct name on one of them โ e.g. `CODEGRAPH_DIR=.codegraph-win` on Windows, leaving WSL on the default `.codegraph`. CodeGraph skips any sibling `.codegraph-*` directory when indexing and watching, so the two never trip over each other.
|
|
717
|
+
|
|
638
718
|
## Star History
|
|
639
719
|
|
|
640
720
|
<a href="https://www.star-history.com/?repos=colbymchenry%2Fcodegraph&type=date&legend=top-left">
|
package/dist/bin/codegraph.d.ts
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* codegraph callees <symbol> Find what a function/method calls
|
|
21
21
|
* codegraph impact <symbol> Analyze what code is affected by changing a symbol
|
|
22
22
|
* codegraph affected [files] Find test files affected by changes
|
|
23
|
+
* codegraph upgrade [version] Update CodeGraph to the latest release
|
|
23
24
|
*/
|
|
24
25
|
export {};
|
|
25
26
|
//# sourceMappingURL=codegraph.d.ts.map
|
package/dist/context/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { Subgraph, TaskContext, TaskInput, BuildContextOptions, FindRelevantContextOptions } from '../types';
|
|
8
8
|
import { QueryBuilder } from '../db/queries';
|
|
9
9
|
import { GraphTraverser } from '../graph';
|
|
10
|
+
export { LOW_CONFIDENCE_MARKER } from './markers';
|
|
10
11
|
/**
|
|
11
12
|
* Context Builder
|
|
12
13
|
*
|
|
@@ -33,6 +34,14 @@ export declare class ContextBuilder {
|
|
|
33
34
|
* @returns TaskContext (structured) or formatted string
|
|
34
35
|
*/
|
|
35
36
|
buildContext(input: TaskInput, options?: BuildContextOptions): Promise<TaskContext | string>;
|
|
37
|
+
/**
|
|
38
|
+
* Honest handoff appended when retrieval confidence is low (the query matched
|
|
39
|
+
* mostly common words). Instead of the usual "this covers the surface" framing
|
|
40
|
+
* โ which, when wrong, sends the agent off to Read/Grep โ it admits the
|
|
41
|
+
* uncertainty and routes the agent to the precise tools (explore with real
|
|
42
|
+
* symbol names, search, or files to browse the closest areas we *did* surface).
|
|
43
|
+
*/
|
|
44
|
+
private buildLowConfidenceNote;
|
|
36
45
|
/**
|
|
37
46
|
* Surface short call-paths among the symbols this context already found,
|
|
38
47
|
* derived in-memory from the subgraph's `calls` edges (no extra queries).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable sentinel strings shared between the context builder (which emits them
|
|
3
|
+
* into its markdown) and the MCP layer (which detects them to adjust framing).
|
|
4
|
+
*
|
|
5
|
+
* Intentionally a dependency-free leaf module: the MCP tool layer imports this
|
|
6
|
+
* to recognise a low-confidence response, and routing that recognition through
|
|
7
|
+
* the full context module would drag its dependencies onto the cold-start path.
|
|
8
|
+
* Keep this file import-free.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Heading that leads the honest low-confidence handoff appended to a context
|
|
12
|
+
* response when the query resolved only to weak/isolated matches. The MCP layer
|
|
13
|
+
* checks for it to suppress the contradictory "this is comprehensive, don't call
|
|
14
|
+
* explore" small-repo footer. Changing the text is a breaking sentinel change โ
|
|
15
|
+
* both the emitter (`ContextBuilder`) and the detector (`src/mcp/tools.ts`)
|
|
16
|
+
* import this constant, so they stay in sync automatically.
|
|
17
|
+
*/
|
|
18
|
+
export declare const LOW_CONFIDENCE_MARKER = "### \u26A0\uFE0F Low-confidence match";
|
|
19
|
+
//# sourceMappingURL=markers.d.ts.map
|
package/dist/db/migrations.d.ts
CHANGED
package/dist/db/queries.d.ts
CHANGED
|
@@ -10,10 +10,16 @@ import { Node, Edge, FileRecord, UnresolvedReference, NodeKind, EdgeKind, GraphS
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class QueryBuilder {
|
|
12
12
|
private db;
|
|
13
|
+
private projectNameTokens;
|
|
13
14
|
private nodeCache;
|
|
14
15
|
private readonly maxCacheSize;
|
|
15
16
|
private stmts;
|
|
16
17
|
constructor(db: SqliteDatabase);
|
|
18
|
+
/** Set the normalized project-name tokens used to down-weight non-discriminative
|
|
19
|
+
* query words in path scoring (#720). Called once when the project opens. */
|
|
20
|
+
setProjectNameTokens(tokens: Set<string>): void;
|
|
21
|
+
/** The normalized project-name tokens (#720); empty if none were derived. */
|
|
22
|
+
getProjectNameTokens(): Set<string>;
|
|
17
23
|
/**
|
|
18
24
|
* Insert a new node
|
|
19
25
|
*/
|
|
@@ -134,6 +140,14 @@ export declare class QueryBuilder {
|
|
|
134
140
|
* Get all nodes of a specific kind
|
|
135
141
|
*/
|
|
136
142
|
getNodesByKind(kind: NodeKind): Node[];
|
|
143
|
+
/**
|
|
144
|
+
* Stream every node of a kind one at a time (lazy) instead of materializing
|
|
145
|
+
* them all like {@link getNodesByKind}. For unbounded kinds (`function`,
|
|
146
|
+
* `method`) on a symbol-dense project the full array is gigabytes; the
|
|
147
|
+
* dynamic-edge synthesizers only scan-and-filter, so they iterate to keep
|
|
148
|
+
* memory O(1) in the node count rather than O(nodes) (#610).
|
|
149
|
+
*/
|
|
150
|
+
iterateNodesByKind(kind: NodeKind): IterableIterator<Node>;
|
|
137
151
|
/**
|
|
138
152
|
* Get all nodes in the database
|
|
139
153
|
*/
|
|
@@ -230,6 +244,30 @@ export declare class QueryBuilder {
|
|
|
230
244
|
* Useful for recovering inter-node connectivity after BFS.
|
|
231
245
|
*/
|
|
232
246
|
findEdgesBetweenNodes(nodeIds: string[], kinds?: EdgeKind[]): Edge[];
|
|
247
|
+
/**
|
|
248
|
+
* Distinct file paths that DEPEND ON `filePath`: every file containing a
|
|
249
|
+
* symbol with a cross-file edge (any kind except `contains`) into a symbol
|
|
250
|
+
* of this file. This is the file-level projection of the symbol dependency
|
|
251
|
+
* graph and the basis for blast-radius / `affected` test selection.
|
|
252
|
+
*
|
|
253
|
+
* It deliberately does NOT restrict to `imports` edges. In this graph an
|
|
254
|
+
* `imports` edge connects a file to its own local import declarations
|
|
255
|
+
* (it is always same-file), so an imports-only lookup returns zero
|
|
256
|
+
* cross-file dependents for every file. The real cross-file dependency
|
|
257
|
+
* signal is the resolved call/reference graph โ calls, references,
|
|
258
|
+
* instantiates, extends, implements, overrides, type_of, returns,
|
|
259
|
+
* decorates โ exactly what {@link GraphTraverser.getImpactRadius} traverses.
|
|
260
|
+
* `contains` is excluded: a parent containing a symbol does not *depend* on
|
|
261
|
+
* it. One indexed query (idx_nodes_file_path + idx_edges_target_kind).
|
|
262
|
+
*/
|
|
263
|
+
getDependentFilePaths(filePath: string): string[];
|
|
264
|
+
/**
|
|
265
|
+
* Distinct file paths that `filePath` DEPENDS ON โ the inverse of
|
|
266
|
+
* {@link getDependentFilePaths}: every file containing a symbol that a
|
|
267
|
+
* symbol of this file has a cross-file edge into. Same edge-kind rules
|
|
268
|
+
* (all kinds except `contains`); same reason imports-only is insufficient.
|
|
269
|
+
*/
|
|
270
|
+
getDependencyFilePaths(filePath: string): string[];
|
|
233
271
|
/**
|
|
234
272
|
* Insert or update a file record
|
|
235
273
|
*/
|
|
@@ -246,6 +284,11 @@ export declare class QueryBuilder {
|
|
|
246
284
|
* Get all tracked files
|
|
247
285
|
*/
|
|
248
286
|
getAllFiles(): FileRecord[];
|
|
287
|
+
/**
|
|
288
|
+
* Most recent index timestamp (ms since epoch) across all tracked files, or
|
|
289
|
+
* null when nothing is indexed yet. One indexed aggregate, no per-row scan. (#329)
|
|
290
|
+
*/
|
|
291
|
+
getLastIndexedAt(): number | null;
|
|
249
292
|
/**
|
|
250
293
|
* Get files that need re-indexing (hash changed)
|
|
251
294
|
*/
|
|
@@ -16,6 +16,13 @@ export interface SqliteStatement {
|
|
|
16
16
|
};
|
|
17
17
|
get(...params: any[]): any;
|
|
18
18
|
all(...params: any[]): any[];
|
|
19
|
+
/**
|
|
20
|
+
* Lazily yield result rows one at a time instead of materializing the whole
|
|
21
|
+
* set with `all()`. Use for unbounded scans (e.g. every function/method node)
|
|
22
|
+
* so memory stays O(1) in the row count rather than O(rows) โ see #610, where
|
|
23
|
+
* `all()`-ing every symbol on a dense project spiked the heap into an OOM.
|
|
24
|
+
*/
|
|
25
|
+
iterate(...params: any[]): IterableIterator<any>;
|
|
19
26
|
}
|
|
20
27
|
export interface SqliteDatabase {
|
|
21
28
|
prepare(sql: string): SqliteStatement;
|
package/dist/directory.d.ts
CHANGED
|
@@ -4,9 +4,41 @@
|
|
|
4
4
|
* Manages the .codegraph/ directory structure for CodeGraph data.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Resolve the per-project data directory name, honoring the `CODEGRAPH_DIR`
|
|
8
|
+
* environment override (default `.codegraph`). The override is a single path
|
|
9
|
+
* segment that lives in the project root.
|
|
10
|
+
*
|
|
11
|
+
* Why this exists: two environments that share one working tree must NOT share
|
|
12
|
+
* one `.codegraph/` โ most concretely Windows-native and WSL (issue #636). The
|
|
13
|
+
* daemon lockfile (`.codegraph/daemon.pid`) records a platform-specific pid and
|
|
14
|
+
* socket path (a Windows named pipe vs a WSL Unix socket), and SQLite file
|
|
15
|
+
* locking across the WSL2 โ Windows filesystem boundary is unreliable, so two
|
|
16
|
+
* daemons sharing one index risks corruption. Setting `CODEGRAPH_DIR=.codegraph-win`
|
|
17
|
+
* on one side gives each environment its own index in the same tree.
|
|
18
|
+
*
|
|
19
|
+
* Read live (not captured at load) so it is both process-accurate and testable.
|
|
20
|
+
* An override that isn't a plain directory name โ empty, containing a path
|
|
21
|
+
* separator, `.`, `..`/traversal, or absolute โ is ignored (we keep the
|
|
22
|
+
* default) rather than risk writing the index outside the project or into the
|
|
23
|
+
* project root itself; we warn once to stderr so the misconfiguration is seen.
|
|
24
|
+
*/
|
|
25
|
+
export declare function codeGraphDirName(): string;
|
|
26
|
+
/**
|
|
27
|
+
* CodeGraph directory name โ a load-time snapshot of {@link codeGraphDirName}.
|
|
28
|
+
* A running process's environment is fixed, so this equals the live value;
|
|
29
|
+
* it's kept as a stable string export for backward compatibility. Internal code
|
|
30
|
+
* resolves the name through {@link codeGraphDirName} / {@link getCodeGraphDir}
|
|
31
|
+
* so the `CODEGRAPH_DIR` override always applies.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CODEGRAPH_DIR: string;
|
|
34
|
+
/**
|
|
35
|
+
* Is `name` (a single path segment) a CodeGraph data directory? Matches the
|
|
36
|
+
* default `.codegraph`, the active `CODEGRAPH_DIR` override, and any
|
|
37
|
+
* `.codegraph-*` sibling. File-watching and the indexer skip ALL of these, so
|
|
38
|
+
* when two environments share one working tree (Windows + WSL, issue #636)
|
|
39
|
+
* neither indexes or watches the other's index directory.
|
|
8
40
|
*/
|
|
9
|
-
export declare
|
|
41
|
+
export declare function isCodeGraphDataDir(name: string): boolean;
|
|
10
42
|
/**
|
|
11
43
|
* Get the .codegraph directory path for a project
|
|
12
44
|
*/
|