@stupidloud/codegraph 0.7.7

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.
Files changed (340) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +482 -0
  3. package/dist/bin/codegraph.d.ts +21 -0
  4. package/dist/bin/codegraph.d.ts.map +1 -0
  5. package/dist/bin/codegraph.js +1296 -0
  6. package/dist/bin/codegraph.js.map +1 -0
  7. package/dist/bin/node-version-check.d.ts +17 -0
  8. package/dist/bin/node-version-check.d.ts.map +1 -0
  9. package/dist/bin/node-version-check.js +39 -0
  10. package/dist/bin/node-version-check.js.map +1 -0
  11. package/dist/bin/uninstall.d.ts +14 -0
  12. package/dist/bin/uninstall.d.ts.map +1 -0
  13. package/dist/bin/uninstall.js +148 -0
  14. package/dist/bin/uninstall.js.map +1 -0
  15. package/dist/config.d.ts +51 -0
  16. package/dist/config.d.ts.map +1 -0
  17. package/dist/config.js +342 -0
  18. package/dist/config.js.map +1 -0
  19. package/dist/context/formatter.d.ts +30 -0
  20. package/dist/context/formatter.d.ts.map +1 -0
  21. package/dist/context/formatter.js +244 -0
  22. package/dist/context/formatter.js.map +1 -0
  23. package/dist/context/index.d.ts +99 -0
  24. package/dist/context/index.d.ts.map +1 -0
  25. package/dist/context/index.js +1075 -0
  26. package/dist/context/index.js.map +1 -0
  27. package/dist/db/index.d.ts +72 -0
  28. package/dist/db/index.d.ts.map +1 -0
  29. package/dist/db/index.js +200 -0
  30. package/dist/db/index.js.map +1 -0
  31. package/dist/db/migrations.d.ts +44 -0
  32. package/dist/db/migrations.d.ts.map +1 -0
  33. package/dist/db/migrations.js +160 -0
  34. package/dist/db/migrations.js.map +1 -0
  35. package/dist/db/queries.d.ts +253 -0
  36. package/dist/db/queries.d.ts.map +1 -0
  37. package/dist/db/queries.js +1202 -0
  38. package/dist/db/queries.js.map +1 -0
  39. package/dist/db/schema.sql +169 -0
  40. package/dist/db/sqlite-adapter.d.ts +52 -0
  41. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  42. package/dist/db/sqlite-adapter.js +237 -0
  43. package/dist/db/sqlite-adapter.js.map +1 -0
  44. package/dist/directory.d.ts +57 -0
  45. package/dist/directory.d.ts.map +1 -0
  46. package/dist/directory.js +264 -0
  47. package/dist/directory.js.map +1 -0
  48. package/dist/errors.d.ts +136 -0
  49. package/dist/errors.d.ts.map +1 -0
  50. package/dist/errors.js +219 -0
  51. package/dist/errors.js.map +1 -0
  52. package/dist/extraction/dfm-extractor.d.ts +31 -0
  53. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  54. package/dist/extraction/dfm-extractor.js +151 -0
  55. package/dist/extraction/dfm-extractor.js.map +1 -0
  56. package/dist/extraction/grammars.d.ts +78 -0
  57. package/dist/extraction/grammars.d.ts.map +1 -0
  58. package/dist/extraction/grammars.js +322 -0
  59. package/dist/extraction/grammars.js.map +1 -0
  60. package/dist/extraction/index.d.ts +130 -0
  61. package/dist/extraction/index.d.ts.map +1 -0
  62. package/dist/extraction/index.js +1279 -0
  63. package/dist/extraction/index.js.map +1 -0
  64. package/dist/extraction/languages/c-cpp.d.ts +4 -0
  65. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  66. package/dist/extraction/languages/c-cpp.js +126 -0
  67. package/dist/extraction/languages/c-cpp.js.map +1 -0
  68. package/dist/extraction/languages/csharp.d.ts +3 -0
  69. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  70. package/dist/extraction/languages/csharp.js +72 -0
  71. package/dist/extraction/languages/csharp.js.map +1 -0
  72. package/dist/extraction/languages/dart.d.ts +3 -0
  73. package/dist/extraction/languages/dart.d.ts.map +1 -0
  74. package/dist/extraction/languages/dart.js +192 -0
  75. package/dist/extraction/languages/dart.js.map +1 -0
  76. package/dist/extraction/languages/go.d.ts +3 -0
  77. package/dist/extraction/languages/go.d.ts.map +1 -0
  78. package/dist/extraction/languages/go.js +58 -0
  79. package/dist/extraction/languages/go.js.map +1 -0
  80. package/dist/extraction/languages/index.d.ts +10 -0
  81. package/dist/extraction/languages/index.d.ts.map +1 -0
  82. package/dist/extraction/languages/index.js +45 -0
  83. package/dist/extraction/languages/index.js.map +1 -0
  84. package/dist/extraction/languages/java.d.ts +3 -0
  85. package/dist/extraction/languages/java.d.ts.map +1 -0
  86. package/dist/extraction/languages/java.js +64 -0
  87. package/dist/extraction/languages/java.js.map +1 -0
  88. package/dist/extraction/languages/javascript.d.ts +3 -0
  89. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  90. package/dist/extraction/languages/javascript.js +90 -0
  91. package/dist/extraction/languages/javascript.js.map +1 -0
  92. package/dist/extraction/languages/kotlin.d.ts +3 -0
  93. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  94. package/dist/extraction/languages/kotlin.js +253 -0
  95. package/dist/extraction/languages/kotlin.js.map +1 -0
  96. package/dist/extraction/languages/pascal.d.ts +3 -0
  97. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  98. package/dist/extraction/languages/pascal.js +66 -0
  99. package/dist/extraction/languages/pascal.js.map +1 -0
  100. package/dist/extraction/languages/php.d.ts +3 -0
  101. package/dist/extraction/languages/php.d.ts.map +1 -0
  102. package/dist/extraction/languages/php.js +107 -0
  103. package/dist/extraction/languages/php.js.map +1 -0
  104. package/dist/extraction/languages/python.d.ts +3 -0
  105. package/dist/extraction/languages/python.d.ts.map +1 -0
  106. package/dist/extraction/languages/python.js +56 -0
  107. package/dist/extraction/languages/python.js.map +1 -0
  108. package/dist/extraction/languages/ruby.d.ts +3 -0
  109. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  110. package/dist/extraction/languages/ruby.js +114 -0
  111. package/dist/extraction/languages/ruby.js.map +1 -0
  112. package/dist/extraction/languages/rust.d.ts +3 -0
  113. package/dist/extraction/languages/rust.d.ts.map +1 -0
  114. package/dist/extraction/languages/rust.js +109 -0
  115. package/dist/extraction/languages/rust.js.map +1 -0
  116. package/dist/extraction/languages/scala.d.ts +3 -0
  117. package/dist/extraction/languages/scala.d.ts.map +1 -0
  118. package/dist/extraction/languages/scala.js +139 -0
  119. package/dist/extraction/languages/scala.js.map +1 -0
  120. package/dist/extraction/languages/swift.d.ts +3 -0
  121. package/dist/extraction/languages/swift.d.ts.map +1 -0
  122. package/dist/extraction/languages/swift.js +91 -0
  123. package/dist/extraction/languages/swift.js.map +1 -0
  124. package/dist/extraction/languages/typescript.d.ts +3 -0
  125. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  126. package/dist/extraction/languages/typescript.js +129 -0
  127. package/dist/extraction/languages/typescript.js.map +1 -0
  128. package/dist/extraction/liquid-extractor.d.ts +52 -0
  129. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  130. package/dist/extraction/liquid-extractor.js +313 -0
  131. package/dist/extraction/liquid-extractor.js.map +1 -0
  132. package/dist/extraction/parse-worker.d.ts +8 -0
  133. package/dist/extraction/parse-worker.d.ts.map +1 -0
  134. package/dist/extraction/parse-worker.js +94 -0
  135. package/dist/extraction/parse-worker.js.map +1 -0
  136. package/dist/extraction/svelte-extractor.d.ts +56 -0
  137. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  138. package/dist/extraction/svelte-extractor.js +272 -0
  139. package/dist/extraction/svelte-extractor.js.map +1 -0
  140. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  141. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  142. package/dist/extraction/tree-sitter-helpers.js +103 -0
  143. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  144. package/dist/extraction/tree-sitter-types.d.ts +179 -0
  145. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  146. package/dist/extraction/tree-sitter-types.js +10 -0
  147. package/dist/extraction/tree-sitter-types.js.map +1 -0
  148. package/dist/extraction/tree-sitter.d.ts +233 -0
  149. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  150. package/dist/extraction/tree-sitter.js +2393 -0
  151. package/dist/extraction/tree-sitter.js.map +1 -0
  152. package/dist/extraction/vue-extractor.d.ts +36 -0
  153. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  154. package/dist/extraction/vue-extractor.js +163 -0
  155. package/dist/extraction/vue-extractor.js.map +1 -0
  156. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  157. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  158. package/dist/graph/index.d.ts +8 -0
  159. package/dist/graph/index.d.ts.map +1 -0
  160. package/dist/graph/index.js +13 -0
  161. package/dist/graph/index.js.map +1 -0
  162. package/dist/graph/queries.d.ts +106 -0
  163. package/dist/graph/queries.d.ts.map +1 -0
  164. package/dist/graph/queries.js +366 -0
  165. package/dist/graph/queries.js.map +1 -0
  166. package/dist/graph/traversal.d.ts +127 -0
  167. package/dist/graph/traversal.d.ts.map +1 -0
  168. package/dist/graph/traversal.js +493 -0
  169. package/dist/graph/traversal.js.map +1 -0
  170. package/dist/index.d.ts +504 -0
  171. package/dist/index.d.ts.map +1 -0
  172. package/dist/index.js +982 -0
  173. package/dist/index.js.map +1 -0
  174. package/dist/installer/claude-md-template.d.ts +10 -0
  175. package/dist/installer/claude-md-template.d.ts.map +1 -0
  176. package/dist/installer/claude-md-template.js +46 -0
  177. package/dist/installer/claude-md-template.js.map +1 -0
  178. package/dist/installer/config-writer.d.ts +36 -0
  179. package/dist/installer/config-writer.d.ts.map +1 -0
  180. package/dist/installer/config-writer.js +304 -0
  181. package/dist/installer/config-writer.js.map +1 -0
  182. package/dist/installer/index.d.ts +12 -0
  183. package/dist/installer/index.d.ts.map +1 -0
  184. package/dist/installer/index.js +201 -0
  185. package/dist/installer/index.js.map +1 -0
  186. package/dist/mcp/index.d.ts +82 -0
  187. package/dist/mcp/index.d.ts.map +1 -0
  188. package/dist/mcp/index.js +330 -0
  189. package/dist/mcp/index.js.map +1 -0
  190. package/dist/mcp/server-instructions.d.ts +19 -0
  191. package/dist/mcp/server-instructions.d.ts.map +1 -0
  192. package/dist/mcp/server-instructions.js +59 -0
  193. package/dist/mcp/server-instructions.js.map +1 -0
  194. package/dist/mcp/tools.d.ts +187 -0
  195. package/dist/mcp/tools.d.ts.map +1 -0
  196. package/dist/mcp/tools.js +1250 -0
  197. package/dist/mcp/tools.js.map +1 -0
  198. package/dist/mcp/transport.d.ts +89 -0
  199. package/dist/mcp/transport.d.ts.map +1 -0
  200. package/dist/mcp/transport.js +170 -0
  201. package/dist/mcp/transport.js.map +1 -0
  202. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  203. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  204. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  205. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  206. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  207. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  208. package/dist/resolution/frameworks/csharp.js +213 -0
  209. package/dist/resolution/frameworks/csharp.js.map +1 -0
  210. package/dist/resolution/frameworks/express.d.ts +8 -0
  211. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  212. package/dist/resolution/frameworks/express.js +225 -0
  213. package/dist/resolution/frameworks/express.js.map +1 -0
  214. package/dist/resolution/frameworks/go.d.ts +8 -0
  215. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  216. package/dist/resolution/frameworks/go.js +158 -0
  217. package/dist/resolution/frameworks/go.js.map +1 -0
  218. package/dist/resolution/frameworks/index.d.ts +41 -0
  219. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  220. package/dist/resolution/frameworks/index.js +129 -0
  221. package/dist/resolution/frameworks/index.js.map +1 -0
  222. package/dist/resolution/frameworks/java.d.ts +8 -0
  223. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  224. package/dist/resolution/frameworks/java.js +177 -0
  225. package/dist/resolution/frameworks/java.js.map +1 -0
  226. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  227. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  228. package/dist/resolution/frameworks/laravel.js +248 -0
  229. package/dist/resolution/frameworks/laravel.js.map +1 -0
  230. package/dist/resolution/frameworks/python.d.ts +10 -0
  231. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  232. package/dist/resolution/frameworks/python.js +278 -0
  233. package/dist/resolution/frameworks/python.js.map +1 -0
  234. package/dist/resolution/frameworks/react.d.ts +8 -0
  235. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  236. package/dist/resolution/frameworks/react.js +272 -0
  237. package/dist/resolution/frameworks/react.js.map +1 -0
  238. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  239. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  240. package/dist/resolution/frameworks/ruby.js +198 -0
  241. package/dist/resolution/frameworks/ruby.js.map +1 -0
  242. package/dist/resolution/frameworks/rust.d.ts +8 -0
  243. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  244. package/dist/resolution/frameworks/rust.js +207 -0
  245. package/dist/resolution/frameworks/rust.js.map +1 -0
  246. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  247. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  248. package/dist/resolution/frameworks/svelte.js +249 -0
  249. package/dist/resolution/frameworks/svelte.js.map +1 -0
  250. package/dist/resolution/frameworks/swift.d.ts +10 -0
  251. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  252. package/dist/resolution/frameworks/swift.js +376 -0
  253. package/dist/resolution/frameworks/swift.js.map +1 -0
  254. package/dist/resolution/frameworks/vue.d.ts +9 -0
  255. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  256. package/dist/resolution/frameworks/vue.js +306 -0
  257. package/dist/resolution/frameworks/vue.js.map +1 -0
  258. package/dist/resolution/import-resolver.d.ts +40 -0
  259. package/dist/resolution/import-resolver.d.ts.map +1 -0
  260. package/dist/resolution/import-resolver.js +663 -0
  261. package/dist/resolution/import-resolver.js.map +1 -0
  262. package/dist/resolution/index.d.ts +106 -0
  263. package/dist/resolution/index.d.ts.map +1 -0
  264. package/dist/resolution/index.js +709 -0
  265. package/dist/resolution/index.js.map +1 -0
  266. package/dist/resolution/name-matcher.d.ts +32 -0
  267. package/dist/resolution/name-matcher.d.ts.map +1 -0
  268. package/dist/resolution/name-matcher.js +384 -0
  269. package/dist/resolution/name-matcher.js.map +1 -0
  270. package/dist/resolution/path-aliases.d.ts +68 -0
  271. package/dist/resolution/path-aliases.d.ts.map +1 -0
  272. package/dist/resolution/path-aliases.js +238 -0
  273. package/dist/resolution/path-aliases.js.map +1 -0
  274. package/dist/resolution/strip-comments.d.ts +27 -0
  275. package/dist/resolution/strip-comments.d.ts.map +1 -0
  276. package/dist/resolution/strip-comments.js +441 -0
  277. package/dist/resolution/strip-comments.js.map +1 -0
  278. package/dist/resolution/types.d.ts +172 -0
  279. package/dist/resolution/types.d.ts.map +1 -0
  280. package/dist/resolution/types.js +8 -0
  281. package/dist/resolution/types.js.map +1 -0
  282. package/dist/search/query-parser.d.ts +57 -0
  283. package/dist/search/query-parser.d.ts.map +1 -0
  284. package/dist/search/query-parser.js +177 -0
  285. package/dist/search/query-parser.js.map +1 -0
  286. package/dist/search/query-utils.d.ts +53 -0
  287. package/dist/search/query-utils.d.ts.map +1 -0
  288. package/dist/search/query-utils.js +347 -0
  289. package/dist/search/query-utils.js.map +1 -0
  290. package/dist/sync/index.d.ts +13 -0
  291. package/dist/sync/index.d.ts.map +1 -0
  292. package/dist/sync/index.js +17 -0
  293. package/dist/sync/index.js.map +1 -0
  294. package/dist/sync/watcher.d.ts +81 -0
  295. package/dist/sync/watcher.d.ts.map +1 -0
  296. package/dist/sync/watcher.js +184 -0
  297. package/dist/sync/watcher.js.map +1 -0
  298. package/dist/types.d.ts +438 -0
  299. package/dist/types.d.ts.map +1 -0
  300. package/dist/types.js +263 -0
  301. package/dist/types.js.map +1 -0
  302. package/dist/ui/shimmer-progress.d.ts +11 -0
  303. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  304. package/dist/ui/shimmer-progress.js +90 -0
  305. package/dist/ui/shimmer-progress.js.map +1 -0
  306. package/dist/ui/shimmer-worker.d.ts +2 -0
  307. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  308. package/dist/ui/shimmer-worker.js +112 -0
  309. package/dist/ui/shimmer-worker.js.map +1 -0
  310. package/dist/ui/types.d.ts +17 -0
  311. package/dist/ui/types.d.ts.map +1 -0
  312. package/dist/ui/types.js +3 -0
  313. package/dist/ui/types.js.map +1 -0
  314. package/dist/utils.d.ts +205 -0
  315. package/dist/utils.d.ts.map +1 -0
  316. package/dist/utils.js +549 -0
  317. package/dist/utils.js.map +1 -0
  318. package/dist/vectors/embedder.d.ts +121 -0
  319. package/dist/vectors/embedder.d.ts.map +1 -0
  320. package/dist/vectors/embedder.js +237 -0
  321. package/dist/vectors/embedder.js.map +1 -0
  322. package/dist/vectors/index.d.ts +9 -0
  323. package/dist/vectors/index.d.ts.map +1 -0
  324. package/dist/vectors/index.js +20 -0
  325. package/dist/vectors/index.js.map +1 -0
  326. package/dist/vectors/manager.d.ts +124 -0
  327. package/dist/vectors/manager.d.ts.map +1 -0
  328. package/dist/vectors/manager.js +322 -0
  329. package/dist/vectors/manager.js.map +1 -0
  330. package/dist/vectors/search.d.ts +143 -0
  331. package/dist/vectors/search.d.ts.map +1 -0
  332. package/dist/vectors/search.js +460 -0
  333. package/dist/vectors/search.js.map +1 -0
  334. package/dist/visualizer/public/index.html +1994 -0
  335. package/dist/visualizer/server.d.ts +46 -0
  336. package/dist/visualizer/server.d.ts.map +1 -0
  337. package/dist/visualizer/server.js +491 -0
  338. package/dist/visualizer/server.js.map +1 -0
  339. package/package.json +60 -0
  340. package/scripts/patch-tree-sitter-dart.js +112 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Colby Mchenry
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,482 @@
1
+ <div align="center">
2
+
3
+ # CodeGraph
4
+
5
+ ### Supercharge Claude Code with Semantic Code Intelligence
6
+
7
+ **94% fewer tool calls · 77% faster exploration · 100% local**
8
+
9
+ [![npm version](https://img.shields.io/npm/v/@stupidloud/codegraph.svg)](https://www.npmjs.com/package/@stupidloud/codegraph)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
+ [![Node.js](https://img.shields.io/badge/Node.js-18+-green.svg)](https://nodejs.org/)
12
+
13
+ [![Windows](https://img.shields.io/badge/Windows-supported-blue.svg)](#)
14
+ [![macOS](https://img.shields.io/badge/macOS-supported-blue.svg)](#)
15
+ [![Linux](https://img.shields.io/badge/Linux-supported-blue.svg)](#)
16
+
17
+ <br />
18
+
19
+ ### Get Started
20
+
21
+ ```bash
22
+ npx @stupidloud/codegraph
23
+ ```
24
+
25
+ <sub>Interactive installer configures Claude Code automatically</sub>
26
+
27
+ #### Initialize Projects
28
+
29
+ ```bash
30
+ cd your-project
31
+ codegraph init -i
32
+ ```
33
+
34
+ ![1_C_VYnhpys0UHrOuOgpgoyw](https://github.com/user-attachments/assets/f168182f-4d9a-44e0-94d7-08d018cc8a3a)
35
+
36
+ </div>
37
+
38
+ ---
39
+
40
+ ## Why CodeGraph?
41
+
42
+ When Claude Code explores a codebase, it spawns **Explore agents** that scan files with grep, glob, and Read — consuming tokens on every tool call.
43
+
44
+ **CodeGraph gives those agents a pre-indexed knowledge graph** — symbol relationships, call graphs, and code structure. Agents query the graph instantly instead of scanning files.
45
+
46
+ ### Benchmark Results
47
+
48
+ Tested across 6 real-world codebases comparing Claude Code's Explore agent **with** and **without** CodeGraph:
49
+
50
+ > **Average: 92% fewer tool calls · 71% faster**
51
+
52
+ | Codebase | With CG | Without CG | Improvement |
53
+ |----------|---------|------------|-------------|
54
+ | **VS Code** · TypeScript | 3 calls, 17s | 52 calls, 1m 37s | **94% fewer · 82% faster** |
55
+ | **Excalidraw** · TypeScript | 3 calls, 29s | 47 calls, 1m 45s | **94% fewer · 72% faster** |
56
+ | **Claude Code** · Python + Rust | 3 calls, 39s | 40 calls, 1m 8s | **93% fewer · 43% faster** |
57
+ | **Claude Code** · Java | 1 call, 19s | 26 calls, 1m 22s | **96% fewer · 77% faster** |
58
+ | **Alamofire** · Swift | 3 calls, 22s | 32 calls, 1m 39s | **91% fewer · 78% faster** |
59
+ | **Swift Compiler** · Swift/C++ | 6 calls, 35s | 37 calls, 2m 8s | **84% fewer · 73% faster** |
60
+
61
+ <details>
62
+ <summary><strong>Full benchmark details</strong></summary>
63
+
64
+ All tests used Claude Opus 4.6 (1M context) with Claude Code v2.1.91. Each test spawned a single Explore agent with the same question.
65
+
66
+ **Queries used:**
67
+ | Codebase | Query |
68
+ |----------|-------|
69
+ | VS Code | "How does the extension host communicate with the main process?" |
70
+ | Excalidraw | "How does collaborative editing and real-time sync work?" |
71
+ | Claude Code (Python+Rust) | "How does tool execution work end to end?" |
72
+ | Claude Code (Java) | "How does tool execution work end to end?" |
73
+ | Alamofire | "Trace how a request flows from Session.request() through to the URLSession layer" |
74
+ | Swift Compiler | "How does the Swift compiler handle error diagnostics?" |
75
+
76
+ **With CodeGraph — the agent uses `codegraph_explore` and stops:**
77
+ | Codebase | Files Indexed | Nodes | Tool Uses | Tokens | Time | File Reads |
78
+ |----------|--------------|-------|-----------|--------|------|------------|
79
+ | VS Code (TypeScript) | 4,002 | 59,377 | 3 | 56.6k | 17s | 0 |
80
+ | Excalidraw (TypeScript) | 626 | 9,859 | 3 | 57.1k | 29s | 0 |
81
+ | Claude Code (Python+Rust) | 115 | 3,080 | 3 | 67.1k | 39s | 0 |
82
+ | Claude Code (Java) | — | — | 1 | 40.8k | 19s | 0 |
83
+ | Alamofire (Swift) | 102 | 2,624 | 3 | 57.3k | 22s | 0 |
84
+ | Swift Compiler (Swift/C++) | 25,874 | 272,898 | 6 | 77.4k | 35s | 0 |
85
+
86
+ **Without CodeGraph — the agent uses grep, find, ls, and Read extensively:**
87
+ | Codebase | Tool Uses | Tokens | Time | File Reads |
88
+ |----------|-----------|--------|------|------------|
89
+ | VS Code (TypeScript) | 52 | 89.4k | 1m 37s | ~15 |
90
+ | Excalidraw (TypeScript) | 47 | 77.9k | 1m 45s | ~20 |
91
+ | Claude Code (Python+Rust) | 40 | 69.3k | 1m 8s | ~15 |
92
+ | Claude Code (Java) | 26 | 73.3k | 1m 22s | ~15 |
93
+ | Alamofire (Swift) | 32 | 52.4k | 1m 39s | ~10 |
94
+ | Swift Compiler (Swift/C++) | 37 | 99.1k | 2m 8s | ~20 |
95
+
96
+ **Key observations:**
97
+ - With CodeGraph, the agent **never fell back to reading files** — it trusted the codegraph_explore results completely
98
+ - Without CodeGraph, agents spent most of their time on discovery (find, ls, grep) before they could even start reading relevant code
99
+ - The Java codebase needed only **1 codegraph_explore call** to answer the entire question
100
+ - Cross-language queries (Python+Rust) worked seamlessly — CodeGraph's graph traversal found connections across language boundaries
101
+ - The Swift benchmark (Alamofire) traced a **9-step call chain** from `Session.request()` to `URLSession.dataTask()` — CodeGraph's graph traversal at depth 3 captured the full chain in one explore call
102
+ - The **Swift Compiler** benchmark is the largest codebase tested (**25,874 files, 272,898 nodes**) — CodeGraph indexed it in under 4 minutes and the agent answered a complex cross-cutting question with **6 explore calls and zero file reads** in 35 seconds
103
+
104
+ </details>
105
+
106
+ ---
107
+
108
+ ## Key Features
109
+
110
+ | | |
111
+ |---|---|
112
+ | **Smart Context Building** | One tool call returns entry points, related symbols, and code snippets — no expensive exploration agents |
113
+ | **Full-Text Search** | Find code by name instantly across your entire codebase, powered by FTS5 |
114
+ | **Impact Analysis** | Trace callers, callees, and the full impact radius of any symbol before making changes |
115
+ | **Always Fresh** | File watcher uses native OS events (FSEvents/inotify/ReadDirectoryChangesW) with debounced auto-sync — the graph stays current as you code, zero config |
116
+ | **19+ Languages** | TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C, C++, Swift, Kotlin, Dart, Svelte, Liquid, Pascal/Delphi |
117
+ | **Framework-aware Routes** | Recognizes web-framework routing files and links URL patterns to their handlers across 13 frameworks |
118
+ | **100% Local** | No data leaves your machine. No API keys. No external services. SQLite database only |
119
+
120
+ ---
121
+
122
+ ## Framework-aware Routes
123
+
124
+ CodeGraph detects web-framework routing files and emits `route` nodes linked by `references` edges to their handler classes or functions. Querying callers of a view/controller now surfaces the URL pattern that binds it.
125
+
126
+ | Framework | Shapes recognized |
127
+ |---|---|
128
+ | **Django** | `path()`, `re_path()`, `url()`, `include()` in `urls.py` (CBV `.as_view()`, dotted paths) |
129
+ | **Flask** | `@app.route('/path', methods=[...])`, blueprint routes |
130
+ | **FastAPI** | `@app.get(...)`, `@router.post(...)`, all standard methods |
131
+ | **Express** | `app.get(...)`, `router.post(...)` with middleware chains |
132
+ | **Laravel** | `Route::get()`, `Route::resource()`, `Controller@action`, tuple syntax |
133
+ | **Rails** | `get '/x', to: 'users#index'`, hash-rocket `=>` syntax |
134
+ | **Spring** | `@GetMapping`, `@PostMapping`, `@RequestMapping` on methods |
135
+ | **Gin / chi / gorilla / mux** | `r.GET(...)`, `router.HandleFunc(...)` |
136
+ | **Axum / actix / Rocket** | `.route("/x", get(handler))` |
137
+ | **ASP.NET** | `[HttpGet("/x")]` attributes on action methods |
138
+ | **Vapor** | `app.get("x", use: handler)` |
139
+ | **React Router** / **SvelteKit** | Route component nodes |
140
+
141
+ ---
142
+
143
+ ## Quick Start
144
+
145
+ ### 1. Run the Installer
146
+
147
+ ```bash
148
+ npx @stupidloud/codegraph
149
+ ```
150
+
151
+ The installer will:
152
+ - Prompt to install `codegraph` globally (needed for the MCP server)
153
+ - Configure the MCP server in `~/.claude.json`
154
+ - Set up auto-allow permissions for CodeGraph tools
155
+ - Add global instructions to `~/.claude/CLAUDE.md`
156
+ - Optionally initialize your current project
157
+
158
+ ### 2. Restart Claude Code
159
+
160
+ Restart Claude Code for the MCP server to load.
161
+
162
+ ### 3. Initialize Projects
163
+
164
+ ```bash
165
+ cd your-project
166
+ codegraph init -i
167
+ ```
168
+
169
+ That's it! Claude Code will use CodeGraph tools automatically when a `.codegraph/` directory exists.
170
+
171
+ <details>
172
+ <summary><strong>Manual Setup (Alternative)</strong></summary>
173
+
174
+ **Install globally:**
175
+ ```bash
176
+ npm install -g @stupidloud/codegraph
177
+ ```
178
+
179
+ **Add to `~/.claude.json`:**
180
+ ```json
181
+ {
182
+ "mcpServers": {
183
+ "codegraph": {
184
+ "type": "stdio",
185
+ "command": "codegraph",
186
+ "args": ["serve", "--mcp"]
187
+ }
188
+ }
189
+ }
190
+ ```
191
+
192
+ **Add to `~/.claude/settings.json` (optional, for auto-allow):**
193
+ ```json
194
+ {
195
+ "permissions": {
196
+ "allow": [
197
+ "mcp__codegraph__codegraph_search",
198
+ "mcp__codegraph__codegraph_context",
199
+ "mcp__codegraph__codegraph_callers",
200
+ "mcp__codegraph__codegraph_callees",
201
+ "mcp__codegraph__codegraph_impact",
202
+ "mcp__codegraph__codegraph_node",
203
+ "mcp__codegraph__codegraph_status",
204
+ "mcp__codegraph__codegraph_files"
205
+ ]
206
+ }
207
+ }
208
+ ```
209
+
210
+ </details>
211
+
212
+ <details>
213
+ <summary><strong>Global Instructions Reference</strong></summary>
214
+
215
+ The installer automatically adds these instructions to `~/.claude/CLAUDE.md`:
216
+
217
+ ```markdown
218
+ ## CodeGraph
219
+
220
+ CodeGraph builds a semantic knowledge graph of codebases for faster, smarter code exploration.
221
+
222
+ ### If `.codegraph/` exists in the project
223
+
224
+ **NEVER call `codegraph_explore` or `codegraph_context` directly in the main session.** These tools return large amounts of source code that fills up main session context. Instead, ALWAYS spawn an Explore agent for any exploration question (e.g., "how does X work?", "explain the Y system", "where is Z implemented?").
225
+
226
+ **When spawning Explore agents**, include this instruction in the prompt:
227
+
228
+ > This project has CodeGraph initialized (.codegraph/ exists). Use `codegraph_explore` as your PRIMARY tool — it returns full source code sections from all relevant files in one call.
229
+ >
230
+ > **Rules:**
231
+ > 1. Follow the explore call budget in the `codegraph_explore` tool description — it scales automatically based on project size.
232
+ > 2. Do NOT re-read files that codegraph_explore already returned source code for. The source sections are complete and authoritative.
233
+ > 3. Only fall back to grep/glob/read for files listed under "Additional relevant files" if you need more detail, or if codegraph returned no results.
234
+
235
+ **The main session may only use these lightweight tools directly** (for targeted lookups before making edits, not for exploration):
236
+
237
+ | Tool | Use For |
238
+ |------|---------|
239
+ | `codegraph_search` | Find symbols by name |
240
+ | `codegraph_callers` / `codegraph_callees` | Trace call flow |
241
+ | `codegraph_impact` | Check what's affected before editing |
242
+ | `codegraph_node` | Get a single symbol's details |
243
+
244
+ ### If `.codegraph/` does NOT exist
245
+
246
+ At the start of a session, ask the user if they'd like to initialize CodeGraph:
247
+
248
+ "I notice this project doesn't have CodeGraph initialized. Would you like me to run `codegraph init -i` to build a code knowledge graph?"
249
+ ```
250
+
251
+ </details>
252
+
253
+ ---
254
+
255
+ ## How It Works
256
+
257
+ ```
258
+ ┌─────────────────────────────────────────────────────────────────┐
259
+ │ Claude Code │
260
+ │ │
261
+ │ "Implement user authentication" │
262
+ │ │ │
263
+ │ ▼ │
264
+ │ ┌─────────────────┐ ┌─────────────────┐ │
265
+ │ │ Explore Agent │ ──── │ Explore Agent │ │
266
+ │ └────────┬────────┘ └────────┬────────┘ │
267
+ │ │ │ │
268
+ └───────────┼────────────────────────┼─────────────────────────────┘
269
+ │ │
270
+ ▼ ▼
271
+ ┌───────────────────────────────────────────────────────────────────┐
272
+ │ CodeGraph MCP Server │
273
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
274
+ │ │ Search │ │ Callers │ │ Context │ │
275
+ │ │ "auth" │ │ "login()" │ │ for task │ │
276
+ │ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
277
+ │ │ │ │ │
278
+ │ └────────────────┼────────────────┘ │
279
+ │ ▼ │
280
+ │ ┌───────────────────────┐ │
281
+ │ │ SQLite Graph DB │ │
282
+ │ │ • 387 symbols │ │
283
+ │ │ • 1,204 edges │ │
284
+ │ │ • Instant lookups │ │
285
+ │ └───────────────────────┘ │
286
+ └───────────────────────────────────────────────────────────────────┘
287
+ ```
288
+
289
+ 1. **Extraction** — [tree-sitter](https://tree-sitter.github.io/) parses source code into ASTs. Language-specific queries extract nodes (functions, classes, methods) and edges (calls, imports, extends, implements).
290
+
291
+ 2. **Storage** — Everything goes into a local SQLite database (`.codegraph/codegraph.db`) with FTS5 full-text search.
292
+
293
+ 3. **Resolution** — After extraction, references are resolved: function calls → definitions, imports → source files, class inheritance, and framework-specific patterns.
294
+
295
+ 4. **Auto-Sync** — The MCP server watches your project using native OS file events. Changes are debounced (2-second quiet window), filtered to source files only, and incrementally synced. The graph stays fresh as you code — no configuration needed.
296
+
297
+ ---
298
+
299
+ ## CLI Reference
300
+
301
+ ```bash
302
+ codegraph # Run interactive installer
303
+ codegraph install # Run installer (explicit)
304
+ codegraph init [path] # Initialize in a project (--index to also index)
305
+ codegraph uninit [path] # Remove CodeGraph from a project (--force to skip prompt)
306
+ codegraph index [path] # Full index (--force to re-index, --quiet for less output)
307
+ codegraph sync [path] # Incremental update
308
+ codegraph status [path] # Show statistics
309
+ codegraph query <search> # Search symbols (--kind, --limit, --json)
310
+ codegraph files [path] # Show file structure (--format, --filter, --max-depth, --json)
311
+ codegraph context <task> # Build context for AI (--format, --max-nodes)
312
+ codegraph affected [files...] # Find test files affected by changes (see below)
313
+ codegraph serve --mcp # Start MCP server
314
+ ```
315
+
316
+ ### `codegraph affected`
317
+
318
+ Traces import dependencies transitively to find which test files are affected by changed source files.
319
+
320
+ ```bash
321
+ codegraph affected src/utils.ts src/api.ts # Pass files as arguments
322
+ git diff --name-only | codegraph affected --stdin # Pipe from git diff
323
+ codegraph affected src/auth.ts --filter "e2e/*" # Custom test file pattern
324
+ ```
325
+
326
+ | Option | Description | Default |
327
+ |--------|-------------|---------|
328
+ | `--stdin` | Read file list from stdin | `false` |
329
+ | `-d, --depth <n>` | Max dependency traversal depth | `5` |
330
+ | `-f, --filter <glob>` | Custom glob to identify test files | auto-detect |
331
+ | `-j, --json` | Output as JSON | `false` |
332
+ | `-q, --quiet` | Output file paths only | `false` |
333
+
334
+ **CI/hook example:**
335
+
336
+ ```bash
337
+ #!/usr/bin/env bash
338
+ AFFECTED=$(git diff --name-only HEAD | codegraph affected --stdin --quiet)
339
+ if [ -n "$AFFECTED" ]; then
340
+ npx vitest run $AFFECTED
341
+ fi
342
+ ```
343
+
344
+ ---
345
+
346
+ ## MCP Tools
347
+
348
+ When running as an MCP server, CodeGraph exposes these tools to Claude Code:
349
+
350
+ | Tool | Purpose |
351
+ |------|---------|
352
+ | `codegraph_search` | Find symbols by name across the codebase |
353
+ | `codegraph_context` | Build relevant code context for a task |
354
+ | `codegraph_callers` | Find what calls a function |
355
+ | `codegraph_callees` | Find what a function calls |
356
+ | `codegraph_impact` | Analyze what code is affected by changing a symbol |
357
+ | `codegraph_node` | Get details about a specific symbol (optionally with source code) |
358
+ | `codegraph_files` | Get indexed file structure (faster than filesystem scanning) |
359
+ | `codegraph_status` | Check index health and statistics |
360
+
361
+ ---
362
+
363
+ ## Library Usage
364
+
365
+ ```typescript
366
+ import CodeGraph from '@stupidloud/codegraph';
367
+
368
+ const cg = await CodeGraph.init('/path/to/project');
369
+ // Or: const cg = await CodeGraph.open('/path/to/project');
370
+
371
+ await cg.indexAll({
372
+ onProgress: (p) => console.log(`${p.phase}: ${p.current}/${p.total}`)
373
+ });
374
+
375
+ const results = cg.searchNodes('UserService');
376
+ const callers = cg.getCallers(results[0].node.id);
377
+ const context = await cg.buildContext('fix login bug', { maxNodes: 20, includeCode: true, format: 'markdown' });
378
+ const impact = cg.getImpactRadius(results[0].node.id, 2);
379
+
380
+ cg.watch(); // auto-sync on file changes
381
+ cg.unwatch(); // stop watching
382
+ cg.close();
383
+ ```
384
+
385
+ ---
386
+
387
+ ## Configuration
388
+
389
+ The `.codegraph/config.json` file controls indexing:
390
+
391
+ ```json
392
+ {
393
+ "version": 1,
394
+ "languages": ["typescript", "javascript"],
395
+ "exclude": ["node_modules/**", "dist/**", "build/**", "*.min.js"],
396
+ "frameworks": [],
397
+ "maxFileSize": 1048576,
398
+ "extractDocstrings": true,
399
+ "trackCallSites": true
400
+ }
401
+ ```
402
+
403
+ | Option | Description | Default |
404
+ |--------|-------------|---------|
405
+ | `languages` | Languages to index (auto-detected if empty) | `[]` |
406
+ | `exclude` | Glob patterns to ignore | `["node_modules/**", ...]` |
407
+ | `frameworks` | Framework hints for better resolution | `[]` |
408
+ | `maxFileSize` | Skip files larger than this (bytes) | `1048576` (1MB) |
409
+ | `extractDocstrings` | Extract docstrings from code | `true` |
410
+ | `trackCallSites` | Track call site locations | `true` |
411
+
412
+ ## Supported Languages
413
+
414
+ | Language | Extension | Status |
415
+ |----------|-----------|--------|
416
+ | TypeScript | `.ts`, `.tsx` | Full support |
417
+ | JavaScript | `.js`, `.jsx`, `.mjs` | Full support |
418
+ | Python | `.py` | Full support |
419
+ | Go | `.go` | Full support |
420
+ | Rust | `.rs` | Full support |
421
+ | Java | `.java` | Full support |
422
+ | C# | `.cs` | Full support |
423
+ | PHP | `.php` | Full support |
424
+ | Ruby | `.rb` | Full support |
425
+ | C | `.c`, `.h` | Full support |
426
+ | C++ | `.cpp`, `.hpp`, `.cc` | Full support |
427
+ | Swift | `.swift` | Full support |
428
+ | Kotlin | `.kt`, `.kts` | Full support |
429
+ | Scala | `.scala`, `.sc` | Full support (classes, traits, methods, type aliases, Scala 3 enums) |
430
+ | Dart | `.dart` | Full support |
431
+ | Svelte | `.svelte` | Full support (script extraction, Svelte 5 runes, SvelteKit routes) |
432
+ | Vue | `.vue` | Full support (script + script-setup extraction, Nuxt page/API/middleware routes) |
433
+ | Liquid | `.liquid` | Full support |
434
+ | Pascal / Delphi | `.pas`, `.dpr`, `.dpk`, `.lpr` | Full support (classes, records, interfaces, enums, DFM/FMX form files) |
435
+
436
+ ## Troubleshooting
437
+
438
+ **"CodeGraph not initialized"** — Run `codegraph init` in your project directory first.
439
+
440
+ **Indexing is slow** — Check that `node_modules` and other large directories are excluded. Use `--quiet` to reduce output overhead.
441
+
442
+ **Indexing is slow / MCP `database is locked` / WASM fallback active** — `codegraph` ships with a WASM SQLite fallback for environments where `better-sqlite3` (a native module, declared as `optionalDependencies`) can't install. The fallback is 5-10x slower than the native backend and uses a journal mode that lets writers block readers, so MCP queries can also hit `database is locked` while indexing runs. Run `codegraph status` and look at the `Backend:` line:
443
+
444
+ - `Backend: native` — you're on the fast path, nothing to do.
445
+ - `Backend: wasm` — you're on the slow fallback. Common causes: missing C build tools, prebuilt binary unavailable for your Node version, or your Node version changed after install. Fix:
446
+
447
+ ```bash
448
+ # macOS
449
+ xcode-select --install # installs the C compiler
450
+
451
+ # Linux (Debian / Ubuntu)
452
+ sudo apt install build-essential python3 make
453
+
454
+ # Linux (RHEL / Fedora)
455
+ sudo yum groupinstall "Development Tools"
456
+
457
+ # Then rebuild on any platform:
458
+ npm rebuild better-sqlite3
459
+
460
+ # Or force-include as a hard dep:
461
+ npm install better-sqlite3 --save
462
+ ```
463
+
464
+ After the fix, `codegraph status` should show `Backend: native`.
465
+
466
+ **MCP server not connecting** — Ensure the project is initialized/indexed, verify the path in your MCP config, and check that `codegraph serve --mcp` works from the command line.
467
+
468
+ **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 excluded by config patterns.
469
+
470
+ ## License
471
+
472
+ MIT
473
+
474
+ ---
475
+
476
+ <div align="center">
477
+
478
+ **Made for the Claude Code community**
479
+
480
+ [Report Bug](https://github.com/colbymchenry/codegraph/issues) · [Request Feature](https://github.com/colbymchenry/codegraph/issues)
481
+
482
+ </div>
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CodeGraph CLI
4
+ *
5
+ * Command-line interface for CodeGraph code intelligence.
6
+ *
7
+ * Usage:
8
+ * codegraph Run interactive installer (when no args)
9
+ * codegraph install Run interactive installer
10
+ * codegraph init [path] Initialize CodeGraph in a project
11
+ * codegraph uninit [path] Remove CodeGraph from a project
12
+ * codegraph index [path] Index all files in the project
13
+ * codegraph sync [path] Sync changes since last index
14
+ * codegraph status [path] Show index status
15
+ * codegraph query <search> Search for symbols
16
+ * codegraph files [options] Show project file structure
17
+ * codegraph context <task> Build context for a task
18
+ * codegraph affected [files] Find test files affected by changes
19
+ */
20
+ export {};
21
+ //# sourceMappingURL=codegraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegraph.d.ts","sourceRoot":"","sources":["../../src/bin/codegraph.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG"}