@colbymchenry/codegraph 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -7
- package/npm-shim.js +43 -0
- package/package.json +13 -51
- package/LICENSE +0 -21
- package/dist/bin/codegraph.d.ts +0 -21
- package/dist/bin/codegraph.d.ts.map +0 -1
- package/dist/bin/codegraph.js +0 -1257
- package/dist/bin/codegraph.js.map +0 -1
- package/dist/bin/node-version-check.d.ts +0 -20
- package/dist/bin/node-version-check.d.ts.map +0 -1
- package/dist/bin/node-version-check.js +0 -42
- package/dist/bin/node-version-check.js.map +0 -1
- package/dist/bin/uninstall.d.ts +0 -14
- package/dist/bin/uninstall.d.ts.map +0 -1
- package/dist/bin/uninstall.js +0 -36
- package/dist/bin/uninstall.js.map +0 -1
- package/dist/config.d.ts +0 -51
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -321
- package/dist/config.js.map +0 -1
- package/dist/context/formatter.d.ts +0 -30
- package/dist/context/formatter.d.ts.map +0 -1
- package/dist/context/formatter.js +0 -244
- package/dist/context/formatter.js.map +0 -1
- package/dist/context/index.d.ts +0 -97
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -1050
- package/dist/context/index.js.map +0 -1
- package/dist/db/index.d.ts +0 -72
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/index.js +0 -200
- package/dist/db/index.js.map +0 -1
- package/dist/db/migrations.d.ts +0 -44
- package/dist/db/migrations.d.ts.map +0 -1
- package/dist/db/migrations.js +0 -131
- package/dist/db/migrations.js.map +0 -1
- package/dist/db/queries.d.ts +0 -253
- package/dist/db/queries.d.ts.map +0 -1
- package/dist/db/queries.js +0 -1207
- package/dist/db/queries.js.map +0 -1
- package/dist/db/schema.sql +0 -151
- package/dist/db/sqlite-adapter.d.ts +0 -52
- package/dist/db/sqlite-adapter.d.ts.map +0 -1
- package/dist/db/sqlite-adapter.js +0 -237
- package/dist/db/sqlite-adapter.js.map +0 -1
- package/dist/directory.d.ts +0 -57
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js +0 -264
- package/dist/directory.js.map +0 -1
- package/dist/errors.d.ts +0 -136
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -219
- package/dist/errors.js.map +0 -1
- package/dist/extraction/dfm-extractor.d.ts +0 -31
- package/dist/extraction/dfm-extractor.d.ts.map +0 -1
- package/dist/extraction/dfm-extractor.js +0 -151
- package/dist/extraction/dfm-extractor.js.map +0 -1
- package/dist/extraction/grammars.d.ts +0 -78
- package/dist/extraction/grammars.d.ts.map +0 -1
- package/dist/extraction/grammars.js +0 -322
- package/dist/extraction/grammars.js.map +0 -1
- package/dist/extraction/index.d.ts +0 -130
- package/dist/extraction/index.d.ts.map +0 -1
- package/dist/extraction/index.js +0 -1305
- package/dist/extraction/index.js.map +0 -1
- package/dist/extraction/languages/c-cpp.d.ts +0 -4
- package/dist/extraction/languages/c-cpp.d.ts.map +0 -1
- package/dist/extraction/languages/c-cpp.js +0 -126
- package/dist/extraction/languages/c-cpp.js.map +0 -1
- package/dist/extraction/languages/csharp.d.ts +0 -3
- package/dist/extraction/languages/csharp.d.ts.map +0 -1
- package/dist/extraction/languages/csharp.js +0 -72
- package/dist/extraction/languages/csharp.js.map +0 -1
- package/dist/extraction/languages/dart.d.ts +0 -3
- package/dist/extraction/languages/dart.d.ts.map +0 -1
- package/dist/extraction/languages/dart.js +0 -192
- package/dist/extraction/languages/dart.js.map +0 -1
- package/dist/extraction/languages/go.d.ts +0 -3
- package/dist/extraction/languages/go.d.ts.map +0 -1
- package/dist/extraction/languages/go.js +0 -58
- package/dist/extraction/languages/go.js.map +0 -1
- package/dist/extraction/languages/index.d.ts +0 -10
- package/dist/extraction/languages/index.d.ts.map +0 -1
- package/dist/extraction/languages/index.js +0 -45
- package/dist/extraction/languages/index.js.map +0 -1
- package/dist/extraction/languages/java.d.ts +0 -3
- package/dist/extraction/languages/java.d.ts.map +0 -1
- package/dist/extraction/languages/java.js +0 -64
- package/dist/extraction/languages/java.js.map +0 -1
- package/dist/extraction/languages/javascript.d.ts +0 -3
- package/dist/extraction/languages/javascript.d.ts.map +0 -1
- package/dist/extraction/languages/javascript.js +0 -90
- package/dist/extraction/languages/javascript.js.map +0 -1
- package/dist/extraction/languages/kotlin.d.ts +0 -3
- package/dist/extraction/languages/kotlin.d.ts.map +0 -1
- package/dist/extraction/languages/kotlin.js +0 -253
- package/dist/extraction/languages/kotlin.js.map +0 -1
- package/dist/extraction/languages/pascal.d.ts +0 -3
- package/dist/extraction/languages/pascal.d.ts.map +0 -1
- package/dist/extraction/languages/pascal.js +0 -66
- package/dist/extraction/languages/pascal.js.map +0 -1
- package/dist/extraction/languages/php.d.ts +0 -3
- package/dist/extraction/languages/php.d.ts.map +0 -1
- package/dist/extraction/languages/php.js +0 -107
- package/dist/extraction/languages/php.js.map +0 -1
- package/dist/extraction/languages/python.d.ts +0 -3
- package/dist/extraction/languages/python.d.ts.map +0 -1
- package/dist/extraction/languages/python.js +0 -56
- package/dist/extraction/languages/python.js.map +0 -1
- package/dist/extraction/languages/ruby.d.ts +0 -3
- package/dist/extraction/languages/ruby.d.ts.map +0 -1
- package/dist/extraction/languages/ruby.js +0 -114
- package/dist/extraction/languages/ruby.js.map +0 -1
- package/dist/extraction/languages/rust.d.ts +0 -3
- package/dist/extraction/languages/rust.d.ts.map +0 -1
- package/dist/extraction/languages/rust.js +0 -109
- package/dist/extraction/languages/rust.js.map +0 -1
- package/dist/extraction/languages/scala.d.ts +0 -3
- package/dist/extraction/languages/scala.d.ts.map +0 -1
- package/dist/extraction/languages/scala.js +0 -139
- package/dist/extraction/languages/scala.js.map +0 -1
- package/dist/extraction/languages/swift.d.ts +0 -3
- package/dist/extraction/languages/swift.d.ts.map +0 -1
- package/dist/extraction/languages/swift.js +0 -91
- package/dist/extraction/languages/swift.js.map +0 -1
- package/dist/extraction/languages/typescript.d.ts +0 -3
- package/dist/extraction/languages/typescript.d.ts.map +0 -1
- package/dist/extraction/languages/typescript.js +0 -129
- package/dist/extraction/languages/typescript.js.map +0 -1
- package/dist/extraction/liquid-extractor.d.ts +0 -52
- package/dist/extraction/liquid-extractor.d.ts.map +0 -1
- package/dist/extraction/liquid-extractor.js +0 -313
- package/dist/extraction/liquid-extractor.js.map +0 -1
- package/dist/extraction/parse-worker.d.ts +0 -8
- package/dist/extraction/parse-worker.d.ts.map +0 -1
- package/dist/extraction/parse-worker.js +0 -94
- package/dist/extraction/parse-worker.js.map +0 -1
- package/dist/extraction/svelte-extractor.d.ts +0 -56
- package/dist/extraction/svelte-extractor.d.ts.map +0 -1
- package/dist/extraction/svelte-extractor.js +0 -272
- package/dist/extraction/svelte-extractor.js.map +0 -1
- package/dist/extraction/tree-sitter-helpers.d.ts +0 -28
- package/dist/extraction/tree-sitter-helpers.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-helpers.js +0 -103
- package/dist/extraction/tree-sitter-helpers.js.map +0 -1
- package/dist/extraction/tree-sitter-types.d.ts +0 -179
- package/dist/extraction/tree-sitter-types.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-types.js +0 -10
- package/dist/extraction/tree-sitter-types.js.map +0 -1
- package/dist/extraction/tree-sitter.d.ts +0 -233
- package/dist/extraction/tree-sitter.d.ts.map +0 -1
- package/dist/extraction/tree-sitter.js +0 -2393
- package/dist/extraction/tree-sitter.js.map +0 -1
- package/dist/extraction/vue-extractor.d.ts +0 -36
- package/dist/extraction/vue-extractor.d.ts.map +0 -1
- package/dist/extraction/vue-extractor.js +0 -163
- package/dist/extraction/vue-extractor.js.map +0 -1
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/graph/index.d.ts +0 -8
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js +0 -13
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/queries.d.ts +0 -106
- package/dist/graph/queries.d.ts.map +0 -1
- package/dist/graph/queries.js +0 -366
- package/dist/graph/queries.js.map +0 -1
- package/dist/graph/traversal.d.ts +0 -127
- package/dist/graph/traversal.d.ts.map +0 -1
- package/dist/graph/traversal.js +0 -493
- package/dist/graph/traversal.js.map +0 -1
- package/dist/index.d.ts +0 -447
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -825
- package/dist/index.js.map +0 -1
- package/dist/installer/claude-md-template.d.ts +0 -14
- package/dist/installer/claude-md-template.d.ts.map +0 -1
- package/dist/installer/claude-md-template.js +0 -21
- package/dist/installer/claude-md-template.js.map +0 -1
- package/dist/installer/config-writer.d.ts +0 -29
- package/dist/installer/config-writer.d.ts.map +0 -1
- package/dist/installer/config-writer.js +0 -111
- package/dist/installer/config-writer.js.map +0 -1
- package/dist/installer/index.d.ts +0 -65
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js +0 -406
- package/dist/installer/index.js.map +0 -1
- package/dist/installer/instructions-template.d.ts +0 -28
- package/dist/installer/instructions-template.d.ts.map +0 -1
- package/dist/installer/instructions-template.js +0 -64
- package/dist/installer/instructions-template.js.map +0 -1
- package/dist/installer/targets/claude.d.ts +0 -31
- package/dist/installer/targets/claude.d.ts.map +0 -1
- package/dist/installer/targets/claude.js +0 -308
- package/dist/installer/targets/claude.js.map +0 -1
- package/dist/installer/targets/codex.d.ts +0 -18
- package/dist/installer/targets/codex.d.ts.map +0 -1
- package/dist/installer/targets/codex.js +0 -185
- package/dist/installer/targets/codex.js.map +0 -1
- package/dist/installer/targets/cursor.d.ts +0 -35
- package/dist/installer/targets/cursor.d.ts.map +0 -1
- package/dist/installer/targets/cursor.js +0 -229
- package/dist/installer/targets/cursor.js.map +0 -1
- package/dist/installer/targets/opencode.d.ts +0 -30
- package/dist/installer/targets/opencode.d.ts.map +0 -1
- package/dist/installer/targets/opencode.js +0 -235
- package/dist/installer/targets/opencode.js.map +0 -1
- package/dist/installer/targets/registry.d.ts +0 -35
- package/dist/installer/targets/registry.d.ts.map +0 -1
- package/dist/installer/targets/registry.js +0 -83
- package/dist/installer/targets/registry.js.map +0 -1
- package/dist/installer/targets/shared.d.ts +0 -77
- package/dist/installer/targets/shared.d.ts.map +0 -1
- package/dist/installer/targets/shared.js +0 -246
- package/dist/installer/targets/shared.js.map +0 -1
- package/dist/installer/targets/toml.d.ts +0 -52
- package/dist/installer/targets/toml.d.ts.map +0 -1
- package/dist/installer/targets/toml.js +0 -147
- package/dist/installer/targets/toml.js.map +0 -1
- package/dist/installer/targets/types.d.ts +0 -116
- package/dist/installer/targets/types.d.ts.map +0 -1
- package/dist/installer/targets/types.js +0 -16
- package/dist/installer/targets/types.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -94
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -453
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/server-instructions.d.ts +0 -19
- package/dist/mcp/server-instructions.d.ts.map +0 -1
- package/dist/mcp/server-instructions.js +0 -71
- package/dist/mcp/server-instructions.js.map +0 -1
- package/dist/mcp/tools.d.ts +0 -257
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js +0 -1633
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/transport.d.ts +0 -106
- package/dist/mcp/transport.d.ts.map +0 -1
- package/dist/mcp/transport.js +0 -233
- package/dist/mcp/transport.js.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -18
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.js +0 -225
- package/dist/resolution/frameworks/cargo-workspace.js.map +0 -1
- package/dist/resolution/frameworks/csharp.d.ts +0 -8
- package/dist/resolution/frameworks/csharp.d.ts.map +0 -1
- package/dist/resolution/frameworks/csharp.js +0 -213
- package/dist/resolution/frameworks/csharp.js.map +0 -1
- package/dist/resolution/frameworks/express.d.ts +0 -8
- package/dist/resolution/frameworks/express.d.ts.map +0 -1
- package/dist/resolution/frameworks/express.js +0 -225
- package/dist/resolution/frameworks/express.js.map +0 -1
- package/dist/resolution/frameworks/go.d.ts +0 -8
- package/dist/resolution/frameworks/go.d.ts.map +0 -1
- package/dist/resolution/frameworks/go.js +0 -158
- package/dist/resolution/frameworks/go.js.map +0 -1
- package/dist/resolution/frameworks/index.d.ts +0 -42
- package/dist/resolution/frameworks/index.d.ts.map +0 -1
- package/dist/resolution/frameworks/index.js +0 -133
- package/dist/resolution/frameworks/index.js.map +0 -1
- package/dist/resolution/frameworks/java.d.ts +0 -8
- package/dist/resolution/frameworks/java.d.ts.map +0 -1
- package/dist/resolution/frameworks/java.js +0 -177
- package/dist/resolution/frameworks/java.js.map +0 -1
- package/dist/resolution/frameworks/laravel.d.ts +0 -13
- package/dist/resolution/frameworks/laravel.d.ts.map +0 -1
- package/dist/resolution/frameworks/laravel.js +0 -248
- package/dist/resolution/frameworks/laravel.js.map +0 -1
- package/dist/resolution/frameworks/nestjs.d.ts +0 -26
- package/dist/resolution/frameworks/nestjs.d.ts.map +0 -1
- package/dist/resolution/frameworks/nestjs.js +0 -374
- package/dist/resolution/frameworks/nestjs.js.map +0 -1
- package/dist/resolution/frameworks/python.d.ts +0 -10
- package/dist/resolution/frameworks/python.d.ts.map +0 -1
- package/dist/resolution/frameworks/python.js +0 -278
- package/dist/resolution/frameworks/python.js.map +0 -1
- package/dist/resolution/frameworks/react.d.ts +0 -8
- package/dist/resolution/frameworks/react.d.ts.map +0 -1
- package/dist/resolution/frameworks/react.js +0 -272
- package/dist/resolution/frameworks/react.js.map +0 -1
- package/dist/resolution/frameworks/ruby.d.ts +0 -8
- package/dist/resolution/frameworks/ruby.d.ts.map +0 -1
- package/dist/resolution/frameworks/ruby.js +0 -198
- package/dist/resolution/frameworks/ruby.js.map +0 -1
- package/dist/resolution/frameworks/rust.d.ts +0 -8
- package/dist/resolution/frameworks/rust.d.ts.map +0 -1
- package/dist/resolution/frameworks/rust.js +0 -207
- package/dist/resolution/frameworks/rust.js.map +0 -1
- package/dist/resolution/frameworks/svelte.d.ts +0 -9
- package/dist/resolution/frameworks/svelte.d.ts.map +0 -1
- package/dist/resolution/frameworks/svelte.js +0 -249
- package/dist/resolution/frameworks/svelte.js.map +0 -1
- package/dist/resolution/frameworks/swift.d.ts +0 -10
- package/dist/resolution/frameworks/swift.d.ts.map +0 -1
- package/dist/resolution/frameworks/swift.js +0 -376
- package/dist/resolution/frameworks/swift.js.map +0 -1
- package/dist/resolution/frameworks/vue.d.ts +0 -9
- package/dist/resolution/frameworks/vue.d.ts.map +0 -1
- package/dist/resolution/frameworks/vue.js +0 -306
- package/dist/resolution/frameworks/vue.js.map +0 -1
- package/dist/resolution/import-resolver.d.ts +0 -40
- package/dist/resolution/import-resolver.d.ts.map +0 -1
- package/dist/resolution/import-resolver.js +0 -663
- package/dist/resolution/import-resolver.js.map +0 -1
- package/dist/resolution/index.d.ts +0 -106
- package/dist/resolution/index.d.ts.map +0 -1
- package/dist/resolution/index.js +0 -709
- package/dist/resolution/index.js.map +0 -1
- package/dist/resolution/name-matcher.d.ts +0 -32
- package/dist/resolution/name-matcher.d.ts.map +0 -1
- package/dist/resolution/name-matcher.js +0 -384
- package/dist/resolution/name-matcher.js.map +0 -1
- package/dist/resolution/path-aliases.d.ts +0 -68
- package/dist/resolution/path-aliases.d.ts.map +0 -1
- package/dist/resolution/path-aliases.js +0 -238
- package/dist/resolution/path-aliases.js.map +0 -1
- package/dist/resolution/strip-comments.d.ts +0 -27
- package/dist/resolution/strip-comments.d.ts.map +0 -1
- package/dist/resolution/strip-comments.js +0 -441
- package/dist/resolution/strip-comments.js.map +0 -1
- package/dist/resolution/types.d.ts +0 -172
- package/dist/resolution/types.d.ts.map +0 -1
- package/dist/resolution/types.js +0 -8
- package/dist/resolution/types.js.map +0 -1
- package/dist/search/query-parser.d.ts +0 -57
- package/dist/search/query-parser.d.ts.map +0 -1
- package/dist/search/query-parser.js +0 -177
- package/dist/search/query-parser.js.map +0 -1
- package/dist/search/query-utils.d.ts +0 -53
- package/dist/search/query-utils.d.ts.map +0 -1
- package/dist/search/query-utils.js +0 -350
- package/dist/search/query-utils.js.map +0 -1
- package/dist/sync/git-hooks.d.ts +0 -45
- package/dist/sync/git-hooks.d.ts.map +0 -1
- package/dist/sync/git-hooks.js +0 -223
- package/dist/sync/git-hooks.js.map +0 -1
- package/dist/sync/index.d.ts +0 -17
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js +0 -28
- package/dist/sync/index.js.map +0 -1
- package/dist/sync/watch-policy.d.ts +0 -48
- package/dist/sync/watch-policy.d.ts.map +0 -1
- package/dist/sync/watch-policy.js +0 -124
- package/dist/sync/watch-policy.js.map +0 -1
- package/dist/sync/watcher.d.ts +0 -81
- package/dist/sync/watcher.d.ts.map +0 -1
- package/dist/sync/watcher.js +0 -194
- package/dist/sync/watcher.js.map +0 -1
- package/dist/types.d.ts +0 -423
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -256
- package/dist/types.js.map +0 -1
- package/dist/ui/glyphs.d.ts +0 -42
- package/dist/ui/glyphs.d.ts.map +0 -1
- package/dist/ui/glyphs.js +0 -78
- package/dist/ui/glyphs.js.map +0 -1
- package/dist/ui/shimmer-progress.d.ts +0 -11
- package/dist/ui/shimmer-progress.d.ts.map +0 -1
- package/dist/ui/shimmer-progress.js +0 -90
- package/dist/ui/shimmer-progress.js.map +0 -1
- package/dist/ui/shimmer-worker.d.ts +0 -2
- package/dist/ui/shimmer-worker.d.ts.map +0 -1
- package/dist/ui/shimmer-worker.js +0 -118
- package/dist/ui/shimmer-worker.js.map +0 -1
- package/dist/ui/types.d.ts +0 -17
- package/dist/ui/types.d.ts.map +0 -1
- package/dist/ui/types.js +0 -3
- package/dist/ui/types.js.map +0 -1
- package/dist/utils.d.ts +0 -205
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -549
- package/dist/utils.js.map +0 -1
- package/scripts/agent-eval/audit.sh +0 -68
- package/scripts/agent-eval/itrun.sh +0 -107
- package/scripts/agent-eval/parse-run.mjs +0 -45
- package/scripts/agent-eval/parse-session.mjs +0 -93
- package/scripts/agent-eval/run-agent.sh +0 -34
- package/scripts/agent-eval/run-all.sh +0 -67
- package/scripts/extract-release-notes.mjs +0 -130
- package/scripts/local-install.sh +0 -41
- package/scripts/patch-tree-sitter-dart.js +0 -112
- package/scripts/release.sh +0 -68
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/installer/targets/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAElE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;KAChF,CAAC,CAAC;IACH;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,gBAAgB,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzC,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,eAAe,CAAC;IACvC,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,GAAG,WAAW,CAAC;IAC1D;;;;;OAKG;IACH,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,WAAW,CAAC;IACtC;;;;OAIG;IACH,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC;IACnC,oEAAoE;IACpE,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,EAAE,CAAC;IACvC;;;;;;;;;;;;;OAaG;IACH,mBAAmB,CAAC,IAAI,WAAW,CAAC;CACrC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Agent target abstraction for the installer.
|
|
4
|
-
*
|
|
5
|
-
* Each MCP-capable agent (Claude Code, Cursor, Codex CLI, opencode, ...)
|
|
6
|
-
* implements this interface so the installer orchestrator can write the
|
|
7
|
-
* right MCP-server config + instructions file + permissions for that
|
|
8
|
-
* agent without baking client-specific paths into core code. Adding a
|
|
9
|
-
* new agent = one new file in `targets/` + one entry in `registry.ts`.
|
|
10
|
-
*
|
|
11
|
-
* Closes the Claude-locked installer issue (upstream #137). The
|
|
12
|
-
* runtime MCP server is already agent-agnostic; this brings the
|
|
13
|
-
* installer to the same surface.
|
|
14
|
-
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/installer/targets/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG"}
|
package/dist/mcp/index.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CodeGraph MCP Server
|
|
3
|
-
*
|
|
4
|
-
* Model Context Protocol server that exposes CodeGraph functionality
|
|
5
|
-
* as tools for AI assistants like Claude.
|
|
6
|
-
*
|
|
7
|
-
* @module mcp
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* import { MCPServer } from 'codegraph';
|
|
12
|
-
*
|
|
13
|
-
* const server = new MCPServer('/path/to/project');
|
|
14
|
-
* await server.start();
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* MCP Server for CodeGraph
|
|
19
|
-
*
|
|
20
|
-
* Implements the Model Context Protocol to expose CodeGraph
|
|
21
|
-
* functionality as tools that can be called by AI assistants.
|
|
22
|
-
*/
|
|
23
|
-
export declare class MCPServer {
|
|
24
|
-
private transport;
|
|
25
|
-
private cg;
|
|
26
|
-
private toolHandler;
|
|
27
|
-
private projectPath;
|
|
28
|
-
private initPromise;
|
|
29
|
-
private clientSupportsRoots;
|
|
30
|
-
private rootsAttempted;
|
|
31
|
-
constructor(projectPath?: string);
|
|
32
|
-
/**
|
|
33
|
-
* Start the MCP server
|
|
34
|
-
*
|
|
35
|
-
* Note: CodeGraph initialization is deferred until the initialize request
|
|
36
|
-
* is received, which includes the rootUri from the client.
|
|
37
|
-
*/
|
|
38
|
-
start(): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Try to initialize CodeGraph for the default project.
|
|
41
|
-
*
|
|
42
|
-
* Walks up parent directories to find the nearest .codegraph/ folder,
|
|
43
|
-
* similar to how git finds .git/ directories.
|
|
44
|
-
*
|
|
45
|
-
* If initialization fails, the error is recorded but the server continues
|
|
46
|
-
* to work — cross-project queries and retries on subsequent tool calls
|
|
47
|
-
* are still possible.
|
|
48
|
-
*/
|
|
49
|
-
private tryInitializeDefault;
|
|
50
|
-
/**
|
|
51
|
-
* Retry initialization of the default project if it previously failed.
|
|
52
|
-
* Called lazily on tool calls that need the default project.
|
|
53
|
-
* Re-walks parent directories each time so it picks up projects
|
|
54
|
-
* initialized after the MCP server started.
|
|
55
|
-
*
|
|
56
|
-
* Awaits any in-flight background init (kicked off by handleInitialize) so
|
|
57
|
-
* we never open the SQLite file twice concurrently.
|
|
58
|
-
*/
|
|
59
|
-
private retryInitIfNeeded;
|
|
60
|
-
/**
|
|
61
|
-
* Resolve the project root via the MCP `roots/list` request and initialize
|
|
62
|
-
* from the first root the client reports. Falls back to the process cwd if
|
|
63
|
-
* the client returns no usable root or doesn't answer in time. See issue #196.
|
|
64
|
-
*/
|
|
65
|
-
private initFromRoots;
|
|
66
|
-
/**
|
|
67
|
-
* Start file watching on the active CodeGraph instance.
|
|
68
|
-
* Logs sync activity to stderr for diagnostics.
|
|
69
|
-
*/
|
|
70
|
-
private startWatching;
|
|
71
|
-
/**
|
|
72
|
-
* Stop the server
|
|
73
|
-
*/
|
|
74
|
-
stop(): void;
|
|
75
|
-
/**
|
|
76
|
-
* Handle incoming JSON-RPC messages
|
|
77
|
-
*/
|
|
78
|
-
private handleMessage;
|
|
79
|
-
/**
|
|
80
|
-
* Handle initialize request
|
|
81
|
-
*/
|
|
82
|
-
private handleInitialize;
|
|
83
|
-
/**
|
|
84
|
-
* Handle tools/list request
|
|
85
|
-
*/
|
|
86
|
-
private handleToolsList;
|
|
87
|
-
/**
|
|
88
|
-
* Handle tools/call request
|
|
89
|
-
*/
|
|
90
|
-
private handleToolsCall;
|
|
91
|
-
}
|
|
92
|
-
export { StdioTransport } from './transport';
|
|
93
|
-
export { tools, ToolHandler } from './tools';
|
|
94
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/mcp/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA6DH;;;;;GAKG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,WAAW,CAAgB;IAGnC,OAAO,CAAC,WAAW,CAA8B;IAIjD,OAAO,CAAC,mBAAmB,CAAS;IAGpC,OAAO,CAAC,cAAc,CAAS;gBAEnB,WAAW,CAAC,EAAE,MAAM;IAOhC;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAe5B;;;;;;;;;OASG;YACW,oBAAoB;IAyBlC;;;;;;;;OAQG;YACW,iBAAiB;IA+C/B;;;;OAIG;YACW,aAAa;IAiB3B;;;OAGG;IACH,OAAO,CAAC,aAAa;IAsCrB;;OAEG;IACH,IAAI,IAAI,IAAI;IAYZ;;OAEG;YACW,aAAa;IA6C3B;;OAEG;YACW,gBAAgB;IA6D9B;;OAEG;YACW,eAAe;IAO7B;;OAEG;YACW,eAAe;CAqC9B;AAGD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/mcp/index.js
DELETED
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* CodeGraph MCP Server
|
|
4
|
-
*
|
|
5
|
-
* Model Context Protocol server that exposes CodeGraph functionality
|
|
6
|
-
* as tools for AI assistants like Claude.
|
|
7
|
-
*
|
|
8
|
-
* @module mcp
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import { MCPServer } from 'codegraph';
|
|
13
|
-
*
|
|
14
|
-
* const server = new MCPServer('/path/to/project');
|
|
15
|
-
* await server.start();
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k;
|
|
20
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
21
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
22
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
23
|
-
}
|
|
24
|
-
Object.defineProperty(o, k2, desc);
|
|
25
|
-
}) : (function(o, m, k, k2) {
|
|
26
|
-
if (k2 === undefined) k2 = k;
|
|
27
|
-
o[k2] = m[k];
|
|
28
|
-
}));
|
|
29
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
30
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
31
|
-
}) : function(o, v) {
|
|
32
|
-
o["default"] = v;
|
|
33
|
-
});
|
|
34
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
35
|
-
var ownKeys = function(o) {
|
|
36
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
37
|
-
var ar = [];
|
|
38
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
39
|
-
return ar;
|
|
40
|
-
};
|
|
41
|
-
return ownKeys(o);
|
|
42
|
-
};
|
|
43
|
-
return function (mod) {
|
|
44
|
-
if (mod && mod.__esModule) return mod;
|
|
45
|
-
var result = {};
|
|
46
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
47
|
-
__setModuleDefault(result, mod);
|
|
48
|
-
return result;
|
|
49
|
-
};
|
|
50
|
-
})();
|
|
51
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
-
exports.ToolHandler = exports.tools = exports.StdioTransport = exports.MCPServer = void 0;
|
|
53
|
-
const path = __importStar(require("path"));
|
|
54
|
-
const index_1 = __importStar(require("../index"));
|
|
55
|
-
const sync_1 = require("../sync");
|
|
56
|
-
const transport_1 = require("./transport");
|
|
57
|
-
const tools_1 = require("./tools");
|
|
58
|
-
const server_instructions_1 = require("./server-instructions");
|
|
59
|
-
/**
|
|
60
|
-
* Convert a file:// URI to a filesystem path.
|
|
61
|
-
* Handles URL encoding and Windows drive letter paths.
|
|
62
|
-
*/
|
|
63
|
-
function fileUriToPath(uri) {
|
|
64
|
-
try {
|
|
65
|
-
const url = new URL(uri);
|
|
66
|
-
let filePath = decodeURIComponent(url.pathname);
|
|
67
|
-
// On Windows, file:///C:/path produces pathname /C:/path — strip leading /
|
|
68
|
-
if (process.platform === 'win32' && /^\/[a-zA-Z]:/.test(filePath)) {
|
|
69
|
-
filePath = filePath.slice(1);
|
|
70
|
-
}
|
|
71
|
-
return path.resolve(filePath);
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
// Fallback for non-standard URIs
|
|
75
|
-
return uri.replace(/^file:\/\/\/?/, '');
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* MCP Server Info
|
|
80
|
-
*/
|
|
81
|
-
const SERVER_INFO = {
|
|
82
|
-
name: 'codegraph',
|
|
83
|
-
version: '0.1.0',
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* MCP Protocol Version
|
|
87
|
-
*/
|
|
88
|
-
const PROTOCOL_VERSION = '2024-11-05';
|
|
89
|
-
/**
|
|
90
|
-
* How long to wait for the client's `roots/list` response before giving up
|
|
91
|
-
* and falling back to the process cwd.
|
|
92
|
-
*/
|
|
93
|
-
const ROOTS_LIST_TIMEOUT_MS = 5000;
|
|
94
|
-
/**
|
|
95
|
-
* Extract the first usable filesystem path from a `roots/list` result.
|
|
96
|
-
* Shape per MCP spec: `{ roots: [{ uri: "file:///path", name?: string }] }`.
|
|
97
|
-
* Returns null if the result is empty or malformed.
|
|
98
|
-
*/
|
|
99
|
-
function firstRootPath(result) {
|
|
100
|
-
if (!result || typeof result !== 'object')
|
|
101
|
-
return null;
|
|
102
|
-
const roots = result.roots;
|
|
103
|
-
if (!Array.isArray(roots) || roots.length === 0)
|
|
104
|
-
return null;
|
|
105
|
-
const first = roots[0];
|
|
106
|
-
if (typeof first?.uri !== 'string')
|
|
107
|
-
return null;
|
|
108
|
-
return fileUriToPath(first.uri);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* MCP Server for CodeGraph
|
|
112
|
-
*
|
|
113
|
-
* Implements the Model Context Protocol to expose CodeGraph
|
|
114
|
-
* functionality as tools that can be called by AI assistants.
|
|
115
|
-
*/
|
|
116
|
-
class MCPServer {
|
|
117
|
-
transport;
|
|
118
|
-
cg = null;
|
|
119
|
-
toolHandler;
|
|
120
|
-
projectPath;
|
|
121
|
-
// In-flight background init kicked off from handleInitialize. Tracked so the
|
|
122
|
-
// sync retry path doesn't race against it (double-opening the SQLite file).
|
|
123
|
-
initPromise = null;
|
|
124
|
-
// Whether the client advertised the MCP `roots` capability during initialize.
|
|
125
|
-
// If so, and no explicit project path was given, we ask it for the workspace
|
|
126
|
-
// root via roots/list rather than guessing from the (often wrong) cwd.
|
|
127
|
-
clientSupportsRoots = false;
|
|
128
|
-
// Guards the one-shot deferred resolution (roots/list or cwd) so we don't
|
|
129
|
-
// re-issue roots/list on every tool call.
|
|
130
|
-
rootsAttempted = false;
|
|
131
|
-
constructor(projectPath) {
|
|
132
|
-
this.projectPath = projectPath || null;
|
|
133
|
-
this.transport = new transport_1.StdioTransport();
|
|
134
|
-
// Create ToolHandler eagerly — cross-project queries work even without a default project
|
|
135
|
-
this.toolHandler = new tools_1.ToolHandler(null);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Start the MCP server
|
|
139
|
-
*
|
|
140
|
-
* Note: CodeGraph initialization is deferred until the initialize request
|
|
141
|
-
* is received, which includes the rootUri from the client.
|
|
142
|
-
*/
|
|
143
|
-
async start() {
|
|
144
|
-
// Start listening for messages immediately - don't check initialization yet
|
|
145
|
-
// We'll get the project path from the initialize request's rootUri
|
|
146
|
-
this.transport.start(this.handleMessage.bind(this));
|
|
147
|
-
// Keep the process running
|
|
148
|
-
process.on('SIGINT', () => this.stop());
|
|
149
|
-
process.on('SIGTERM', () => this.stop());
|
|
150
|
-
// When the parent process (Claude Code) exits, stdin closes.
|
|
151
|
-
// Detect this and shut down gracefully to prevent orphaned processes.
|
|
152
|
-
process.stdin.on('end', () => this.stop());
|
|
153
|
-
process.stdin.on('close', () => this.stop());
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Try to initialize CodeGraph for the default project.
|
|
157
|
-
*
|
|
158
|
-
* Walks up parent directories to find the nearest .codegraph/ folder,
|
|
159
|
-
* similar to how git finds .git/ directories.
|
|
160
|
-
*
|
|
161
|
-
* If initialization fails, the error is recorded but the server continues
|
|
162
|
-
* to work — cross-project queries and retries on subsequent tool calls
|
|
163
|
-
* are still possible.
|
|
164
|
-
*/
|
|
165
|
-
async tryInitializeDefault(projectPath) {
|
|
166
|
-
// Record where we searched so a later "not initialized" error can name it.
|
|
167
|
-
this.toolHandler.setDefaultProjectHint(projectPath);
|
|
168
|
-
// Walk up parent directories to find nearest .codegraph/
|
|
169
|
-
const resolvedRoot = (0, index_1.findNearestCodeGraphRoot)(projectPath);
|
|
170
|
-
if (!resolvedRoot) {
|
|
171
|
-
this.projectPath = projectPath;
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
this.projectPath = resolvedRoot;
|
|
175
|
-
try {
|
|
176
|
-
this.cg = await index_1.default.open(resolvedRoot);
|
|
177
|
-
this.toolHandler.setDefaultCodeGraph(this.cg);
|
|
178
|
-
this.startWatching();
|
|
179
|
-
}
|
|
180
|
-
catch (err) {
|
|
181
|
-
// Log the error so transient failures are diagnosable (see issue #47)
|
|
182
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
183
|
-
process.stderr.write(`[CodeGraph MCP] Failed to open project at ${resolvedRoot}: ${msg}\n`);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Retry initialization of the default project if it previously failed.
|
|
188
|
-
* Called lazily on tool calls that need the default project.
|
|
189
|
-
* Re-walks parent directories each time so it picks up projects
|
|
190
|
-
* initialized after the MCP server started.
|
|
191
|
-
*
|
|
192
|
-
* Awaits any in-flight background init (kicked off by handleInitialize) so
|
|
193
|
-
* we never open the SQLite file twice concurrently.
|
|
194
|
-
*/
|
|
195
|
-
async retryInitIfNeeded() {
|
|
196
|
-
// Wait for the background init started during handleInitialize, if any.
|
|
197
|
-
if (this.initPromise) {
|
|
198
|
-
try {
|
|
199
|
-
await this.initPromise;
|
|
200
|
-
}
|
|
201
|
-
catch { /* errored init falls through to retry */ }
|
|
202
|
-
}
|
|
203
|
-
// Already initialized successfully
|
|
204
|
-
if (this.toolHandler.hasDefaultCodeGraph())
|
|
205
|
-
return;
|
|
206
|
-
// No explicit path was given at initialize. Resolve it now, exactly once:
|
|
207
|
-
// ask the client via roots/list (if it advertised roots), else use cwd.
|
|
208
|
-
// Deferring to here lets a roots answer override the wrong cwd, and the
|
|
209
|
-
// one-shot guard means we never re-issue roots/list per tool call.
|
|
210
|
-
if (!this.projectPath && !this.rootsAttempted) {
|
|
211
|
-
this.rootsAttempted = true;
|
|
212
|
-
this.initPromise = (this.clientSupportsRoots
|
|
213
|
-
? this.initFromRoots()
|
|
214
|
-
: this.tryInitializeDefault(process.cwd())).finally(() => { this.initPromise = null; });
|
|
215
|
-
try {
|
|
216
|
-
await this.initPromise;
|
|
217
|
-
}
|
|
218
|
-
catch { /* fall through to last-resort below */ }
|
|
219
|
-
if (this.toolHandler.hasDefaultCodeGraph())
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
// Last resort: re-walk from the best candidate we have. Picks up projects
|
|
223
|
-
// initialized after the server started, and covers clients that sent no
|
|
224
|
-
// usable initialize signal at all.
|
|
225
|
-
const candidate = this.projectPath ?? process.cwd();
|
|
226
|
-
this.toolHandler.setDefaultProjectHint(candidate);
|
|
227
|
-
const resolvedRoot = (0, index_1.findNearestCodeGraphRoot)(candidate);
|
|
228
|
-
if (!resolvedRoot)
|
|
229
|
-
return;
|
|
230
|
-
try {
|
|
231
|
-
// Close any previously failed instance to avoid leaking resources
|
|
232
|
-
if (this.cg) {
|
|
233
|
-
try {
|
|
234
|
-
this.cg.close();
|
|
235
|
-
}
|
|
236
|
-
catch { /* ignore */ }
|
|
237
|
-
this.cg = null;
|
|
238
|
-
}
|
|
239
|
-
this.cg = index_1.default.openSync(resolvedRoot);
|
|
240
|
-
this.projectPath = resolvedRoot;
|
|
241
|
-
this.toolHandler.setDefaultCodeGraph(this.cg);
|
|
242
|
-
this.startWatching();
|
|
243
|
-
}
|
|
244
|
-
catch {
|
|
245
|
-
// Still failing — will retry on next tool call
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Resolve the project root via the MCP `roots/list` request and initialize
|
|
250
|
-
* from the first root the client reports. Falls back to the process cwd if
|
|
251
|
-
* the client returns no usable root or doesn't answer in time. See issue #196.
|
|
252
|
-
*/
|
|
253
|
-
async initFromRoots() {
|
|
254
|
-
let target = process.cwd();
|
|
255
|
-
try {
|
|
256
|
-
const result = await this.transport.request('roots/list', undefined, ROOTS_LIST_TIMEOUT_MS);
|
|
257
|
-
const rootPath = firstRootPath(result);
|
|
258
|
-
if (rootPath) {
|
|
259
|
-
target = rootPath;
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
process.stderr.write('[CodeGraph MCP] Client returned no workspace roots; falling back to process cwd.\n');
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
catch (err) {
|
|
266
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
267
|
-
process.stderr.write(`[CodeGraph MCP] roots/list request failed (${msg}); falling back to process cwd.\n`);
|
|
268
|
-
}
|
|
269
|
-
await this.tryInitializeDefault(target);
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Start file watching on the active CodeGraph instance.
|
|
273
|
-
* Logs sync activity to stderr for diagnostics.
|
|
274
|
-
*/
|
|
275
|
-
startWatching() {
|
|
276
|
-
if (!this.cg)
|
|
277
|
-
return;
|
|
278
|
-
// When the watcher is intentionally disabled (e.g. WSL2 /mnt drives, or
|
|
279
|
-
// CODEGRAPH_NO_WATCH=1), say so explicitly and tell the user how to keep
|
|
280
|
-
// the graph fresh — otherwise the silent staleness is hard to diagnose.
|
|
281
|
-
const disabledReason = (0, sync_1.watchDisabledReason)(this.projectPath ?? process.cwd());
|
|
282
|
-
if (disabledReason) {
|
|
283
|
-
process.stderr.write(`[CodeGraph MCP] File watcher disabled — ${disabledReason}. ` +
|
|
284
|
-
`The graph will not auto-update; run \`codegraph sync\` (or install the git sync hooks via \`codegraph init\`) to refresh.\n`);
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
const started = this.cg.watch({
|
|
288
|
-
onSyncComplete: (result) => {
|
|
289
|
-
if (result.filesChanged > 0) {
|
|
290
|
-
process.stderr.write(`[CodeGraph MCP] Auto-synced ${result.filesChanged} file(s) in ${result.durationMs}ms\n`);
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
onSyncError: (err) => {
|
|
294
|
-
process.stderr.write(`[CodeGraph MCP] Auto-sync error: ${err.message}\n`);
|
|
295
|
-
},
|
|
296
|
-
});
|
|
297
|
-
if (started) {
|
|
298
|
-
process.stderr.write('[CodeGraph MCP] File watcher active — graph will auto-sync on changes\n');
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
// start() can also return false when recursive fs.watch isn't supported.
|
|
302
|
-
process.stderr.write('[CodeGraph MCP] File watcher unavailable on this platform — run `codegraph sync` to refresh the graph after changes.\n');
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Stop the server
|
|
307
|
-
*/
|
|
308
|
-
stop() {
|
|
309
|
-
// Close all cached cross-project connections first
|
|
310
|
-
this.toolHandler.closeAll();
|
|
311
|
-
// Close the main CodeGraph instance
|
|
312
|
-
if (this.cg) {
|
|
313
|
-
this.cg.close();
|
|
314
|
-
this.cg = null;
|
|
315
|
-
}
|
|
316
|
-
this.transport.stop();
|
|
317
|
-
process.exit(0);
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Handle incoming JSON-RPC messages
|
|
321
|
-
*/
|
|
322
|
-
async handleMessage(message) {
|
|
323
|
-
// Check if it's a request (has id) or notification (no id)
|
|
324
|
-
const isRequest = 'id' in message;
|
|
325
|
-
switch (message.method) {
|
|
326
|
-
case 'initialize':
|
|
327
|
-
if (isRequest) {
|
|
328
|
-
await this.handleInitialize(message);
|
|
329
|
-
}
|
|
330
|
-
break;
|
|
331
|
-
case 'initialized':
|
|
332
|
-
// Notification that client has finished initialization
|
|
333
|
-
// No action needed - the client is ready
|
|
334
|
-
break;
|
|
335
|
-
case 'tools/list':
|
|
336
|
-
if (isRequest) {
|
|
337
|
-
await this.handleToolsList(message);
|
|
338
|
-
}
|
|
339
|
-
break;
|
|
340
|
-
case 'tools/call':
|
|
341
|
-
if (isRequest) {
|
|
342
|
-
await this.handleToolsCall(message);
|
|
343
|
-
}
|
|
344
|
-
break;
|
|
345
|
-
case 'ping':
|
|
346
|
-
if (isRequest) {
|
|
347
|
-
this.transport.sendResult(message.id, {});
|
|
348
|
-
}
|
|
349
|
-
break;
|
|
350
|
-
default:
|
|
351
|
-
if (isRequest) {
|
|
352
|
-
this.transport.sendError(message.id, transport_1.ErrorCodes.MethodNotFound, `Method not found: ${message.method}`);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Handle initialize request
|
|
358
|
-
*/
|
|
359
|
-
async handleInitialize(request) {
|
|
360
|
-
const params = request.params;
|
|
361
|
-
// Does the client support the MCP `roots` protocol? If so, and we have no
|
|
362
|
-
// explicit path, we ask it for the workspace root after the handshake
|
|
363
|
-
// instead of falling back to the (frequently wrong) cwd. See issue #196.
|
|
364
|
-
this.clientSupportsRoots = !!params?.capabilities?.roots;
|
|
365
|
-
// Explicit project signal, strongest first: a client-provided rootUri /
|
|
366
|
-
// workspaceFolders (LSP-style, non-standard but some clients send it), else
|
|
367
|
-
// the --path the server was launched with. cwd is NOT used here — we defer
|
|
368
|
-
// it so a roots/list answer can win over it.
|
|
369
|
-
let explicitPath = null;
|
|
370
|
-
if (params?.rootUri) {
|
|
371
|
-
explicitPath = fileUriToPath(params.rootUri);
|
|
372
|
-
}
|
|
373
|
-
else if (params?.workspaceFolders?.[0]?.uri) {
|
|
374
|
-
explicitPath = fileUriToPath(params.workspaceFolders[0].uri);
|
|
375
|
-
}
|
|
376
|
-
else if (this.projectPath) {
|
|
377
|
-
explicitPath = this.projectPath;
|
|
378
|
-
}
|
|
379
|
-
// Respond to the handshake BEFORE doing any heavy initialization. Loading
|
|
380
|
-
// the SQLite DB and the tree-sitter WASM runtime can take many seconds on
|
|
381
|
-
// slow filesystems (Docker Desktop VirtioFS on macOS, WSL2). Clients like
|
|
382
|
-
// Claude Code time out the handshake at ~30s, which manifested as
|
|
383
|
-
// "MCP tools never appear" — the child was alive and had received the
|
|
384
|
-
// initialize but was still awaiting initGrammars(). See issue #172.
|
|
385
|
-
//
|
|
386
|
-
// We accept the client's protocol version but respond with our supported
|
|
387
|
-
// version. The `instructions` field is surfaced by MCP clients in the
|
|
388
|
-
// agent's system prompt automatically — it's the right place for the
|
|
389
|
-
// universal tool-selection playbook, ahead of individual tool descriptions.
|
|
390
|
-
this.transport.sendResult(request.id, {
|
|
391
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
392
|
-
capabilities: {
|
|
393
|
-
tools: {},
|
|
394
|
-
},
|
|
395
|
-
serverInfo: SERVER_INFO,
|
|
396
|
-
instructions: server_instructions_1.SERVER_INSTRUCTIONS,
|
|
397
|
-
});
|
|
398
|
-
// If we know the project dir, kick off init in the background now. Tool
|
|
399
|
-
// calls that arrive before it finishes fall through to `retryInitIfNeeded`,
|
|
400
|
-
// which waits for this promise rather than racing it with a second open.
|
|
401
|
-
//
|
|
402
|
-
// If we DON'T know it (no rootUri, no --path), defer: the first tool call
|
|
403
|
-
// resolves it via roots/list (when the client supports roots) or cwd. This
|
|
404
|
-
// is the fix for issue #196 — clients that launch the server outside the
|
|
405
|
-
// project and don't pass a rootUri previously got a misleading "not
|
|
406
|
-
// initialized" error on every call.
|
|
407
|
-
if (explicitPath) {
|
|
408
|
-
this.initPromise = this.tryInitializeDefault(explicitPath).finally(() => {
|
|
409
|
-
this.initPromise = null;
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Handle tools/list request
|
|
415
|
-
*/
|
|
416
|
-
async handleToolsList(request) {
|
|
417
|
-
await this.retryInitIfNeeded();
|
|
418
|
-
this.transport.sendResult(request.id, {
|
|
419
|
-
tools: this.toolHandler.getTools(),
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Handle tools/call request
|
|
424
|
-
*/
|
|
425
|
-
async handleToolsCall(request) {
|
|
426
|
-
const params = request.params;
|
|
427
|
-
if (!params || !params.name) {
|
|
428
|
-
this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, 'Missing tool name');
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
const toolName = params.name;
|
|
432
|
-
const toolArgs = params.arguments || {};
|
|
433
|
-
// Validate tool exists
|
|
434
|
-
const tool = tools_1.tools.find(t => t.name === toolName);
|
|
435
|
-
if (!tool) {
|
|
436
|
-
this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, `Unknown tool: ${toolName}`);
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
// If the default project isn't initialized yet, retry in case it was
|
|
440
|
-
// initialized after the MCP server started (e.g. user ran codegraph init)
|
|
441
|
-
await this.retryInitIfNeeded();
|
|
442
|
-
const result = await this.toolHandler.execute(toolName, toolArgs);
|
|
443
|
-
this.transport.sendResult(request.id, result);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
exports.MCPServer = MCPServer;
|
|
447
|
-
// Export for use in CLI
|
|
448
|
-
var transport_2 = require("./transport");
|
|
449
|
-
Object.defineProperty(exports, "StdioTransport", { enumerable: true, get: function () { return transport_2.StdioTransport; } });
|
|
450
|
-
var tools_2 = require("./tools");
|
|
451
|
-
Object.defineProperty(exports, "tools", { enumerable: true, get: function () { return tools_2.tools; } });
|
|
452
|
-
Object.defineProperty(exports, "ToolHandler", { enumerable: true, get: function () { return tools_2.ToolHandler; } });
|
|
453
|
-
//# sourceMappingURL=index.js.map
|
package/dist/mcp/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,kDAA+D;AAC/D,kCAA8C;AAC9C,2CAA8F;AAC9F,mCAA6C;AAC7C,+DAA4D;AAE5D;;;GAGG;AACH,SAAS,aAAa,CAAC,GAAW;IAChC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAChD,2EAA2E;QAC3E,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClE,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,iCAAiC;QACjC,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,OAAO;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAAG,YAAY,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AAiB,QAAQ,EAAE,CAC5B,CAAC;YACF,OAAO;QACT,CAAC;QAED,qEAAqE;QACrE,0EAA0E;QAC1E,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAE/B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAElE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF;AAxXD,8BAwXC;AAED,wBAAwB;AACxB,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AACvB,iCAA6C;AAApC,8FAAA,KAAK,OAAA;AAAE,oGAAA,WAAW,OAAA"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Server-level instructions emitted in the MCP `initialize` response.
|
|
3
|
-
*
|
|
4
|
-
* MCP clients (Claude Code, Cursor, opencode, LangChain, OpenAI Agent
|
|
5
|
-
* SDK, …) surface this text in the agent's system prompt automatically,
|
|
6
|
-
* giving the agent a high-level playbook for the codegraph toolset
|
|
7
|
-
* before it sees individual tool descriptions.
|
|
8
|
-
*
|
|
9
|
-
* Goals when editing this:
|
|
10
|
-
* - Tool selection by intent (which tool for which question)
|
|
11
|
-
* - Common chains (refactor planning = X then Y)
|
|
12
|
-
* - Anti-patterns (don't grep when codegraph_search is faster)
|
|
13
|
-
*
|
|
14
|
-
* Keep it tight. The agent reads this every session — long instructions
|
|
15
|
-
* burn tokens. Reference only tools that exist on `main`; gate any
|
|
16
|
-
* conditional tools behind feature checks if/when they ship.
|
|
17
|
-
*/
|
|
18
|
-
export declare const SERVER_INSTRUCTIONS = "# Codegraph \u2014 code intelligence over an indexed knowledge graph\n\nCodegraph is a SQLite knowledge graph of every symbol, edge, and file\nin the workspace. Reads are sub-millisecond; the index lags writes by\nabout a second through the file watcher. Consult it BEFORE writing or\nediting code, not during.\n\n## Answer directly \u2014 don't delegate exploration\n\nFor \"how does X work\", architecture, trace, or where-is-X questions,\nanswer DIRECTLY using 2-3 codegraph calls: `codegraph_context` first,\nthen ONE `codegraph_explore` for the source of the symbols it surfaces.\nCodegraph IS the pre-built search index \u2014 so delegating the lookup to a\nseparate file-reading sub-task/agent, or running your own grep + read\nloop, repeats work codegraph already did and costs more for the same\nanswer. Reach for raw Read/Grep only to confirm a specific detail\ncodegraph didn't cover. A direct codegraph answer is typically a handful\nof calls; a grep/read exploration is dozens.\n\n## Tool selection by intent\n\n- **\"What is the symbol named X?\"** \u2192 `codegraph_search`\n- **\"What's the deal with this task / feature / area?\"** \u2192 `codegraph_context` (PRIMARY \u2014 composes search + node + callers + callees in one call)\n- **\"What calls this?\"** \u2192 `codegraph_callers`\n- **\"What does this call?\"** \u2192 `codegraph_callees`\n- **\"What would changing this break?\"** \u2192 `codegraph_impact`\n- **\"Show me this symbol's source / signature / docstring.\"** \u2192 `codegraph_node`\n- **\"Show me several related symbols' source / survey an area.\"** \u2192 `codegraph_explore` (ONE capped call; prefer over many codegraph_node/Read)\n- **\"What's in directory X?\"** \u2192 `codegraph_files`\n- **\"Is the index ready / what's its size?\"** \u2192 `codegraph_status`\n\n## Common chains\n\n- **Onboarding**: `codegraph_context` first. If still unclear, `codegraph_explore` for breadth, then `codegraph_node` on specific symbols.\n- **Refactor planning**: `codegraph_search` \u2192 `codegraph_callers` \u2192 `codegraph_impact`. The blast-radius answer comes from impact, not from walking callers manually.\n- **Debugging a regression**: `codegraph_callers` of the suspected symbol; widen with `codegraph_impact` if an unexpected call appears.\n\n## Anti-patterns\n\n- **Don't grep first** when looking up a symbol by name \u2014 `codegraph_search` is faster and returns kind + location + signature.\n- **Don't chain `codegraph_search` + `codegraph_node`** when you just want context \u2014 `codegraph_context` is one round-trip.\n- **Don't loop `codegraph_node` over many symbols** \u2014 one `codegraph_explore` call returns them all grouped by file, while each separate call re-reads the whole context and costs far more. Use `codegraph_node` for a single symbol.\n- **Don't query the index immediately after editing a file** \u2014 the watcher needs ~500ms to debounce + sync. Wait for the next turn.\n\n## Limitations\n\n- Index lags file writes by ~1 second.\n- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.\n- No live correctness validation \u2014 that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.\n";
|
|
19
|
-
//# sourceMappingURL=server-instructions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mBAAmB,wtGAiD/B,CAAC"}
|