@saluzi/codegraph 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +885 -0
- package/package.json +42 -10
- package/scripts/add-lang/bench.sh +60 -0
- package/scripts/add-lang/check-grammar.mjs +75 -0
- package/scripts/add-lang/dump-ast.mjs +103 -0
- package/scripts/add-lang/verify-extraction.mjs +70 -0
- package/scripts/agent-eval/ab-adoption.sh +91 -0
- package/scripts/agent-eval/ab-hook.sh +86 -0
- package/scripts/agent-eval/ab-impl.sh +78 -0
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -0
- package/scripts/agent-eval/ab-sufficiency.sh +78 -0
- package/scripts/agent-eval/arms-F.sh +21 -0
- package/scripts/agent-eval/arms-matrix.sh +37 -0
- package/scripts/agent-eval/audit.sh +68 -0
- package/scripts/agent-eval/bench-readme.sh +28 -0
- package/scripts/agent-eval/bench-why-repo.sh +22 -0
- package/scripts/agent-eval/block-read-hook.sh +19 -0
- package/scripts/agent-eval/hook-settings.json +15 -0
- package/scripts/agent-eval/itrun.sh +120 -0
- package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
- package/scripts/agent-eval/offload-eval-setup.sh +24 -0
- package/scripts/agent-eval/offload-eval-styles.sh +72 -0
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
- package/scripts/agent-eval/offload-eval.md +76 -0
- package/scripts/agent-eval/parse-arms.mjs +116 -0
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
- package/scripts/agent-eval/parse-run.mjs +45 -0
- package/scripts/agent-eval/parse-session.mjs +93 -0
- package/scripts/agent-eval/probe-context.mjs +21 -0
- package/scripts/agent-eval/probe-explore.mjs +40 -0
- package/scripts/agent-eval/probe-node.mjs +20 -0
- package/scripts/agent-eval/probe-sweep.mjs +119 -0
- package/scripts/agent-eval/probe-trace.mjs +20 -0
- package/scripts/agent-eval/redirect-read-hook.sh +38 -0
- package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
- package/scripts/agent-eval/run-agent.sh +34 -0
- package/scripts/agent-eval/run-all.sh +75 -0
- package/scripts/agent-eval/run-arms.sh +56 -0
- package/scripts/agent-eval/seq-matrix.mjs +137 -0
- package/scripts/build-bundle.sh +123 -0
- package/scripts/extract-release-notes.mjs +130 -0
- package/scripts/local-install.sh +41 -0
- package/scripts/npm-sdk.js +75 -0
- package/scripts/npm-shim.js +275 -0
- package/scripts/pack-npm.sh +119 -0
- package/scripts/prepare-release.mjs +270 -0
- package/dist/bin/codegraph.d.ts +0 -25
- package/dist/bin/node-version-check.d.ts +0 -37
- package/dist/bin/uninstall.d.ts +0 -14
- package/dist/context/formatter.d.ts +0 -33
- package/dist/context/formatter.js +0 -244
- package/dist/context/index.d.ts +0 -117
- package/dist/context/index.js +0 -1050
- package/dist/db/index.d.ts +0 -101
- package/dist/db/index.js +0 -250
- package/dist/db/migrations.d.ts +0 -47
- package/dist/db/migrations.js +0 -131
- package/dist/db/queries.d.ts +0 -291
- package/dist/db/queries.js +0 -1349
- package/dist/db/schema.sql +0 -151
- package/dist/db/sqlite-adapter.d.ts +0 -49
- package/dist/db/sqlite-adapter.js +0 -141
- package/dist/directory.d.ts +0 -62
- package/dist/directory.js +0 -264
- package/dist/errors.d.ts +0 -149
- package/dist/errors.js +0 -219
- package/dist/extraction/dfm-extractor.d.ts +0 -31
- package/dist/extraction/dfm-extractor.js +0 -151
- package/dist/extraction/grammars.d.ts +0 -94
- package/dist/extraction/grammars.js +0 -357
- package/dist/extraction/index.d.ts +0 -148
- package/dist/extraction/index.js +0 -1286
- package/dist/extraction/languages/c-cpp.d.ts +0 -4
- package/dist/extraction/languages/c-cpp.js +0 -126
- package/dist/extraction/languages/csharp.d.ts +0 -3
- package/dist/extraction/languages/csharp.js +0 -72
- package/dist/extraction/languages/dart.d.ts +0 -3
- package/dist/extraction/languages/dart.js +0 -192
- package/dist/extraction/languages/go.d.ts +0 -3
- package/dist/extraction/languages/go.js +0 -58
- package/dist/extraction/languages/index.d.ts +0 -10
- package/dist/extraction/languages/index.js +0 -49
- package/dist/extraction/languages/java.d.ts +0 -3
- package/dist/extraction/languages/java.js +0 -64
- package/dist/extraction/languages/javascript.d.ts +0 -3
- package/dist/extraction/languages/javascript.js +0 -90
- package/dist/extraction/languages/kotlin.d.ts +0 -3
- package/dist/extraction/languages/kotlin.js +0 -253
- package/dist/extraction/languages/lua.d.ts +0 -3
- package/dist/extraction/languages/lua.js +0 -150
- package/dist/extraction/languages/luau.d.ts +0 -3
- package/dist/extraction/languages/luau.js +0 -37
- package/dist/extraction/languages/pascal.d.ts +0 -3
- package/dist/extraction/languages/pascal.js +0 -66
- package/dist/extraction/languages/php.d.ts +0 -3
- package/dist/extraction/languages/php.js +0 -107
- package/dist/extraction/languages/python.d.ts +0 -3
- package/dist/extraction/languages/python.js +0 -56
- package/dist/extraction/languages/ruby.d.ts +0 -3
- package/dist/extraction/languages/ruby.js +0 -114
- package/dist/extraction/languages/rust.d.ts +0 -3
- package/dist/extraction/languages/rust.js +0 -109
- package/dist/extraction/languages/scala.d.ts +0 -3
- package/dist/extraction/languages/scala.js +0 -139
- package/dist/extraction/languages/swift.d.ts +0 -3
- package/dist/extraction/languages/swift.js +0 -91
- package/dist/extraction/languages/typescript.d.ts +0 -3
- package/dist/extraction/languages/typescript.js +0 -129
- package/dist/extraction/liquid-extractor.d.ts +0 -52
- package/dist/extraction/liquid-extractor.js +0 -313
- package/dist/extraction/parse-worker.d.ts +0 -8
- package/dist/extraction/parse-worker.js +0 -94
- package/dist/extraction/svelte-extractor.d.ts +0 -56
- package/dist/extraction/svelte-extractor.js +0 -272
- package/dist/extraction/tree-sitter-helpers.d.ts +0 -39
- package/dist/extraction/tree-sitter-helpers.js +0 -103
- package/dist/extraction/tree-sitter-types.d.ts +0 -191
- package/dist/extraction/tree-sitter-types.js +0 -10
- package/dist/extraction/tree-sitter.d.ts +0 -238
- package/dist/extraction/tree-sitter.js +0 -2430
- package/dist/extraction/vue-extractor.d.ts +0 -36
- package/dist/extraction/vue-extractor.js +0 -163
- package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +0 -46
- package/dist/extraction/wasm-runtime-flags.js +0 -105
- package/dist/graph/index.d.ts +0 -8
- package/dist/graph/index.js +0 -13
- package/dist/graph/queries.d.ts +0 -109
- package/dist/graph/queries.js +0 -366
- package/dist/graph/traversal.d.ts +0 -137
- package/dist/graph/traversal.js +0 -528
- package/dist/index.d.ts +0 -509
- package/dist/index.js +0 -800
- package/dist/installer/claude-md-template.d.ts +0 -19
- package/dist/installer/config-writer.d.ts +0 -29
- package/dist/installer/index.d.ts +0 -140
- package/dist/installer/instructions-template.d.ts +0 -30
- package/dist/installer/targets/claude.d.ts +0 -55
- package/dist/installer/targets/codex.d.ts +0 -18
- package/dist/installer/targets/cursor.d.ts +0 -35
- package/dist/installer/targets/hermes.d.ts +0 -18
- package/dist/installer/targets/opencode.d.ts +0 -30
- package/dist/installer/targets/registry.d.ts +0 -38
- package/dist/installer/targets/shared.d.ts +0 -92
- package/dist/installer/targets/toml.d.ts +0 -64
- package/dist/installer/targets/types.d.ts +0 -122
- package/dist/mcp/index.d.ts +0 -98
- package/dist/mcp/server-instructions.d.ts +0 -20
- package/dist/mcp/tools.d.ts +0 -269
- package/dist/mcp/transport.d.ts +0 -117
- package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -20
- package/dist/resolution/frameworks/cargo-workspace.js +0 -225
- package/dist/resolution/frameworks/csharp.d.ts +0 -8
- package/dist/resolution/frameworks/csharp.js +0 -213
- package/dist/resolution/frameworks/drupal.d.ts +0 -51
- package/dist/resolution/frameworks/drupal.js +0 -335
- package/dist/resolution/frameworks/express.d.ts +0 -8
- package/dist/resolution/frameworks/express.js +0 -225
- package/dist/resolution/frameworks/go.d.ts +0 -8
- package/dist/resolution/frameworks/go.js +0 -158
- package/dist/resolution/frameworks/index.d.ts +0 -52
- package/dist/resolution/frameworks/index.js +0 -137
- package/dist/resolution/frameworks/java.d.ts +0 -8
- package/dist/resolution/frameworks/java.js +0 -177
- package/dist/resolution/frameworks/laravel.d.ts +0 -13
- package/dist/resolution/frameworks/laravel.js +0 -248
- package/dist/resolution/frameworks/nestjs.d.ts +0 -26
- package/dist/resolution/frameworks/nestjs.js +0 -374
- package/dist/resolution/frameworks/python.d.ts +0 -10
- package/dist/resolution/frameworks/python.js +0 -278
- package/dist/resolution/frameworks/react.d.ts +0 -8
- package/dist/resolution/frameworks/react.js +0 -272
- package/dist/resolution/frameworks/ruby.d.ts +0 -8
- package/dist/resolution/frameworks/ruby.js +0 -198
- package/dist/resolution/frameworks/rust.d.ts +0 -8
- package/dist/resolution/frameworks/rust.js +0 -207
- package/dist/resolution/frameworks/svelte.d.ts +0 -9
- package/dist/resolution/frameworks/svelte.js +0 -249
- package/dist/resolution/frameworks/swift.d.ts +0 -10
- package/dist/resolution/frameworks/swift.js +0 -376
- package/dist/resolution/frameworks/vue.d.ts +0 -9
- package/dist/resolution/frameworks/vue.js +0 -306
- package/dist/resolution/import-resolver.d.ts +0 -61
- package/dist/resolution/import-resolver.js +0 -663
- package/dist/resolution/index.d.ts +0 -118
- package/dist/resolution/index.js +0 -744
- package/dist/resolution/lru-cache.d.ts +0 -24
- package/dist/resolution/lru-cache.js +0 -62
- package/dist/resolution/name-matcher.d.ts +0 -50
- package/dist/resolution/name-matcher.js +0 -384
- package/dist/resolution/path-aliases.d.ts +0 -72
- package/dist/resolution/path-aliases.js +0 -238
- package/dist/resolution/strip-comments.d.ts +0 -40
- package/dist/resolution/strip-comments.js +0 -441
- package/dist/resolution/types.d.ts +0 -181
- package/dist/resolution/types.js +0 -8
- package/dist/search/query-parser.d.ts +0 -61
- package/dist/search/query-parser.js +0 -177
- package/dist/search/query-utils.d.ts +0 -59
- package/dist/search/query-utils.js +0 -383
- package/dist/sync/git-hooks.d.ts +0 -54
- package/dist/sync/git-hooks.js +0 -223
- package/dist/sync/index.d.ts +0 -25
- package/dist/sync/index.js +0 -28
- package/dist/sync/watch-policy.d.ts +0 -51
- package/dist/sync/watch-policy.js +0 -124
- package/dist/sync/watcher.d.ts +0 -83
- package/dist/sync/watcher.js +0 -192
- package/dist/types.d.ts +0 -433
- package/dist/types.js +0 -75
- package/dist/ui/glyphs.d.ts +0 -42
- package/dist/ui/shimmer-progress.d.ts +0 -11
- package/dist/ui/shimmer-worker.d.ts +0 -2
- package/dist/ui/types.d.ts +0 -20
- package/dist/utils.d.ts +0 -231
- package/dist/utils.js +0 -549
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent target abstraction for the installer.
|
|
3
|
-
*
|
|
4
|
-
* Each MCP-capable agent (Claude Code, Cursor, Codex CLI, opencode, ...)
|
|
5
|
-
* implements this interface so the installer orchestrator can write the
|
|
6
|
-
* right MCP-server config + instructions file + permissions for that
|
|
7
|
-
* agent without baking client-specific paths into core code. Adding a
|
|
8
|
-
* new agent = one new file in `targets/` + one entry in `registry.ts`.
|
|
9
|
-
*
|
|
10
|
-
* Closes the Claude-locked installer issue (upstream #137). The
|
|
11
|
-
* runtime MCP server is already agent-agnostic; this brings the
|
|
12
|
-
* installer to the same surface.
|
|
13
|
-
*/
|
|
14
|
-
export type Location = 'global' | 'local'
|
|
15
|
-
/**
|
|
16
|
-
* Stable string id used in the `--target` CLI flag and the registry
|
|
17
|
-
* lookup. New targets add a value here when they're added to the
|
|
18
|
-
* registry. Keep these short and lowercase.
|
|
19
|
-
*/
|
|
20
|
-
export type TargetId = 'claude' | 'cursor' | 'codex' | 'opencode' | 'hermes'
|
|
21
|
-
/**
|
|
22
|
-
* Result of `target.detect(location)`.
|
|
23
|
-
*
|
|
24
|
-
* `installed` is a best-effort heuristic that the agent's CLI / app /
|
|
25
|
-
* config dir is present on this system — used to default the
|
|
26
|
-
* multiselect prompt to "what's actually here." False positives are
|
|
27
|
-
* acceptable (we still write); false negatives just mean the user
|
|
28
|
-
* has to opt in manually.
|
|
29
|
-
*
|
|
30
|
-
* `alreadyConfigured` reports whether codegraph has already been
|
|
31
|
-
* wired into this target at this location — drives the
|
|
32
|
-
* "Updated"-vs-"Added" log line and lets `--check` exit 0/1.
|
|
33
|
-
*/
|
|
34
|
-
export interface DetectionResult {
|
|
35
|
-
installed: boolean
|
|
36
|
-
alreadyConfigured: boolean
|
|
37
|
-
/** Path inspected; surfaced in diagnostic / dry-run output. */
|
|
38
|
-
configPath?: string
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* What `target.install(location)` actually changed on disk. The
|
|
42
|
-
* orchestrator renders one log line per file using `action`.
|
|
43
|
-
*
|
|
44
|
-
* `unchanged` means we touched the file but its contents were already
|
|
45
|
-
* what we'd write — used for byte-identical idempotent re-runs.
|
|
46
|
-
*/
|
|
47
|
-
export interface WriteResult {
|
|
48
|
-
files: Array<{
|
|
49
|
-
path: string
|
|
50
|
-
action:
|
|
51
|
-
| 'created'
|
|
52
|
-
| 'updated'
|
|
53
|
-
| 'unchanged'
|
|
54
|
-
| 'removed'
|
|
55
|
-
| 'not-found'
|
|
56
|
-
| 'kept'
|
|
57
|
-
}>
|
|
58
|
-
/**
|
|
59
|
-
* Optional one-line notes the orchestrator surfaces verbatim — e.g.
|
|
60
|
-
* "Restart Cursor to apply." Keep these short; multi-line goes in
|
|
61
|
-
* the README.
|
|
62
|
-
*/
|
|
63
|
-
notes?: string[]
|
|
64
|
-
}
|
|
65
|
-
export interface InstallOptions {
|
|
66
|
-
/**
|
|
67
|
-
* Whether to write the agent's permissions / auto-allow surface
|
|
68
|
-
* (Claude `settings.json`, others where applicable). When the
|
|
69
|
-
* target has no permissions concept this option is a no-op.
|
|
70
|
-
*/
|
|
71
|
-
autoAllow: boolean
|
|
72
|
-
}
|
|
73
|
-
export interface AgentTarget {
|
|
74
|
-
/** Stable id; matches the `TargetId` union. */
|
|
75
|
-
readonly id: TargetId
|
|
76
|
-
/** Human-readable name shown in clack prompts and log lines. */
|
|
77
|
-
readonly displayName: string
|
|
78
|
-
/** Optional URL for "where do I learn more about this agent." */
|
|
79
|
-
readonly docsUrl?: string
|
|
80
|
-
/**
|
|
81
|
-
* Whether this target supports the given install location.
|
|
82
|
-
*
|
|
83
|
-
* Some agents (Codex CLI as of 2026-05) have no project-local
|
|
84
|
-
* config concept — only a single `~/.codex/` dir. Returning false
|
|
85
|
-
* for an unsupported (target, location) pair lets the orchestrator
|
|
86
|
-
* skip cleanly with a clear message.
|
|
87
|
-
*/
|
|
88
|
-
supportsLocation(loc: Location): boolean
|
|
89
|
-
detect(loc: Location): DetectionResult
|
|
90
|
-
install(loc: Location, opts: InstallOptions): WriteResult
|
|
91
|
-
/**
|
|
92
|
-
* Inverse of install. Removes only what install would have written;
|
|
93
|
-
* preserves sibling MCP servers, sibling permissions, and unrelated
|
|
94
|
-
* markdown sections. Must be safe to call when nothing was ever
|
|
95
|
-
* installed (returns `not-found` actions).
|
|
96
|
-
*/
|
|
97
|
-
uninstall(loc: Location): WriteResult
|
|
98
|
-
/**
|
|
99
|
-
* Print the MCP-server snippet a user would paste manually for this
|
|
100
|
-
* target. Used by `codegraph install --print-config <id>` and by
|
|
101
|
-
* the README. Must NOT touch the filesystem.
|
|
102
|
-
*/
|
|
103
|
-
printConfig(loc: Location): string
|
|
104
|
-
/** Filesystem paths this target would write to at this location. */
|
|
105
|
-
describePaths(loc: Location): string[]
|
|
106
|
-
/**
|
|
107
|
-
* Optional. Write any project-local surfaces this target needs in
|
|
108
|
-
* order to work fully when its MCP config is configured globally.
|
|
109
|
-
* Called by `codegraph init` to bootstrap new projects without
|
|
110
|
-
* forcing the user to re-run `codegraph install` per project.
|
|
111
|
-
*
|
|
112
|
-
* Most targets need nothing here — their global config is complete.
|
|
113
|
-
* Cursor is the notable exception: its rules system
|
|
114
|
-
* (`.cursor/rules/*.mdc`) is project-scoped only, and is what makes
|
|
115
|
-
* Cursor's agent prefer codegraph over its built-in grep.
|
|
116
|
-
*
|
|
117
|
-
* Must be idempotent. Targets that have nothing project-local omit
|
|
118
|
-
* the method entirely.
|
|
119
|
-
*/
|
|
120
|
-
wireProjectSurfaces?(): WriteResult
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/mcp/index.d.ts
DELETED
|
@@ -1,98 +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
|
-
private originalPpid
|
|
32
|
-
private hostPpid
|
|
33
|
-
private ppidWatchdog
|
|
34
|
-
private stopped
|
|
35
|
-
constructor(projectPath?: string)
|
|
36
|
-
/**
|
|
37
|
-
* Start the MCP server
|
|
38
|
-
*
|
|
39
|
-
* Note: CodeGraph initialization is deferred until the initialize request
|
|
40
|
-
* is received, which includes the rootUri from the client.
|
|
41
|
-
*/
|
|
42
|
-
start(): Promise<void>
|
|
43
|
-
/**
|
|
44
|
-
* Try to initialize CodeGraph for the default project.
|
|
45
|
-
*
|
|
46
|
-
* Walks up parent directories to find the nearest .codegraph/ folder,
|
|
47
|
-
* similar to how git finds .git/ directories.
|
|
48
|
-
*
|
|
49
|
-
* If initialization fails, the error is recorded but the server continues
|
|
50
|
-
* to work — cross-project queries and retries on subsequent tool calls
|
|
51
|
-
* are still possible.
|
|
52
|
-
*/
|
|
53
|
-
private tryInitializeDefault
|
|
54
|
-
/**
|
|
55
|
-
* Retry initialization of the default project if it previously failed.
|
|
56
|
-
* Called lazily on tool calls that need the default project.
|
|
57
|
-
* Re-walks parent directories each time so it picks up projects
|
|
58
|
-
* initialized after the MCP server started.
|
|
59
|
-
*
|
|
60
|
-
* Awaits any in-flight background init (kicked off by handleInitialize) so
|
|
61
|
-
* we never open the SQLite file twice concurrently.
|
|
62
|
-
*/
|
|
63
|
-
private retryInitIfNeeded
|
|
64
|
-
/**
|
|
65
|
-
* Resolve the project root via the MCP `roots/list` request and initialize
|
|
66
|
-
* from the first root the client reports. Falls back to the process cwd if
|
|
67
|
-
* the client returns no usable root or doesn't answer in time. See issue #196.
|
|
68
|
-
*/
|
|
69
|
-
private initFromRoots
|
|
70
|
-
/**
|
|
71
|
-
* Start file watching on the active CodeGraph instance.
|
|
72
|
-
* Logs sync activity to stderr for diagnostics.
|
|
73
|
-
*/
|
|
74
|
-
private startWatching
|
|
75
|
-
/**
|
|
76
|
-
* Stop the server
|
|
77
|
-
*/
|
|
78
|
-
stop(): void
|
|
79
|
-
/**
|
|
80
|
-
* Handle incoming JSON-RPC messages
|
|
81
|
-
*/
|
|
82
|
-
private handleMessage
|
|
83
|
-
/**
|
|
84
|
-
* Handle initialize request
|
|
85
|
-
*/
|
|
86
|
-
private handleInitialize
|
|
87
|
-
/**
|
|
88
|
-
* Handle tools/list request
|
|
89
|
-
*/
|
|
90
|
-
private handleToolsList
|
|
91
|
-
/**
|
|
92
|
-
* Handle tools/call request
|
|
93
|
-
*/
|
|
94
|
-
private handleToolsCall
|
|
95
|
-
}
|
|
96
|
-
export { StdioTransport } from './transport'
|
|
97
|
-
export { tools, ToolHandler } from './tools'
|
|
98
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,20 +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 =
|
|
19
|
-
'# 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'
|
|
20
|
-
//# sourceMappingURL=server-instructions.d.ts.map
|
package/dist/mcp/tools.d.ts
DELETED
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Tool Definitions
|
|
3
|
-
*
|
|
4
|
-
* Defines the tools exposed by the CodeGraph MCP server.
|
|
5
|
-
*/
|
|
6
|
-
import CodeGraph from '../index'
|
|
7
|
-
/**
|
|
8
|
-
* Calculate the recommended number of codegraph_explore calls based on project size.
|
|
9
|
-
* Larger codebases need more exploration calls to cover their surface area,
|
|
10
|
-
* but smaller ones should use fewer to avoid unnecessary overhead.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getExploreBudget(fileCount: number): number
|
|
13
|
-
/**
|
|
14
|
-
* Adaptive output budget for `codegraph_explore`, scaled to project size.
|
|
15
|
-
*
|
|
16
|
-
* Smaller codebases get a tighter total cap, fewer default files, smaller
|
|
17
|
-
* per-file cap, and tighter clustering — so a focused query on a 100-file
|
|
18
|
-
* project doesn't dump a whole file's worth of source into the agent's
|
|
19
|
-
* context. Larger codebases keep the generous defaults because the
|
|
20
|
-
* agent's native discovery cost (grep + find + many Reads) genuinely
|
|
21
|
-
* dwarfs a fat explore call at that scale.
|
|
22
|
-
*
|
|
23
|
-
* Meta-text (relationships map, "additional relevant files" list,
|
|
24
|
-
* completeness signal, budget note) is gated off for tiny projects
|
|
25
|
-
* where one rich call is the whole story and the extra prose is just
|
|
26
|
-
* overhead.
|
|
27
|
-
*
|
|
28
|
-
* Tier breakpoints mirror `getExploreBudget` so a project sits in the
|
|
29
|
-
* same tier across both knobs.
|
|
30
|
-
*/
|
|
31
|
-
export interface ExploreOutputBudget {
|
|
32
|
-
/** Hard cap on total output characters. */
|
|
33
|
-
maxOutputChars: number
|
|
34
|
-
/** Default `maxFiles` when the caller didn't specify one. */
|
|
35
|
-
defaultMaxFiles: number
|
|
36
|
-
/** Cap on contiguous source returned per file (across all its clusters). */
|
|
37
|
-
maxCharsPerFile: number
|
|
38
|
-
/** Cluster gap threshold in lines — tighter clustering on small projects. */
|
|
39
|
-
gapThreshold: number
|
|
40
|
-
/** Max symbols listed in the per-file header (`#### path — sym(kind), ...`). */
|
|
41
|
-
maxSymbolsInFileHeader: number
|
|
42
|
-
/** Max edges shown per relationship kind in the Relationships section. */
|
|
43
|
-
maxEdgesPerRelationshipKind: number
|
|
44
|
-
/** Include the "Relationships" section. */
|
|
45
|
-
includeRelationships: boolean
|
|
46
|
-
/** Include the "Additional relevant files (not shown)" trailing list. */
|
|
47
|
-
includeAdditionalFiles: boolean
|
|
48
|
-
/** Include the "Complete source code is included above…" reminder. */
|
|
49
|
-
includeCompletenessSignal: boolean
|
|
50
|
-
/** Include the explore-budget reminder at the end. */
|
|
51
|
-
includeBudgetNote: boolean
|
|
52
|
-
}
|
|
53
|
-
export declare function getExploreOutputBudget(
|
|
54
|
-
fileCount: number,
|
|
55
|
-
): ExploreOutputBudget
|
|
56
|
-
/**
|
|
57
|
-
* MCP Tool definition
|
|
58
|
-
*/
|
|
59
|
-
export interface ToolDefinition {
|
|
60
|
-
name: string
|
|
61
|
-
description: string
|
|
62
|
-
inputSchema: {
|
|
63
|
-
type: 'object'
|
|
64
|
-
properties: Record<string, PropertySchema>
|
|
65
|
-
required?: string[]
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
interface PropertySchema {
|
|
69
|
-
type: string
|
|
70
|
-
description: string
|
|
71
|
-
enum?: string[]
|
|
72
|
-
default?: unknown
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Tool execution result
|
|
76
|
-
*/
|
|
77
|
-
export interface ToolResult {
|
|
78
|
-
content: Array<{
|
|
79
|
-
type: 'text'
|
|
80
|
-
text: string
|
|
81
|
-
}>
|
|
82
|
-
isError?: boolean
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* All CodeGraph MCP tools
|
|
86
|
-
*
|
|
87
|
-
* Designed for minimal context usage - use codegraph_context as the primary tool,
|
|
88
|
-
* and only use other tools for targeted follow-up queries.
|
|
89
|
-
*
|
|
90
|
-
* All tools support cross-project queries via the optional `projectPath` parameter.
|
|
91
|
-
*/
|
|
92
|
-
export declare const tools: ToolDefinition[]
|
|
93
|
-
/**
|
|
94
|
-
* Tool handler that executes tools against a CodeGraph instance
|
|
95
|
-
*
|
|
96
|
-
* Supports cross-project queries via the projectPath parameter.
|
|
97
|
-
* Other projects are opened on-demand and cached for performance.
|
|
98
|
-
*/
|
|
99
|
-
export declare class ToolHandler {
|
|
100
|
-
private cg
|
|
101
|
-
private projectCache
|
|
102
|
-
private defaultProjectHint
|
|
103
|
-
constructor(cg: CodeGraph | null)
|
|
104
|
-
/**
|
|
105
|
-
* Update the default CodeGraph instance (e.g. after lazy initialization)
|
|
106
|
-
*/
|
|
107
|
-
setDefaultCodeGraph(cg: CodeGraph): void
|
|
108
|
-
/**
|
|
109
|
-
* Record the directory the server tried to resolve the default project from.
|
|
110
|
-
* Used only to make the "no default project" error actionable.
|
|
111
|
-
*/
|
|
112
|
-
setDefaultProjectHint(searchedPath: string): void
|
|
113
|
-
/**
|
|
114
|
-
* Whether a default CodeGraph instance is available
|
|
115
|
-
*/
|
|
116
|
-
hasDefaultCodeGraph(): boolean
|
|
117
|
-
/**
|
|
118
|
-
* Get tool definitions with dynamic descriptions based on project size.
|
|
119
|
-
* The codegraph_explore tool description includes a budget recommendation
|
|
120
|
-
* scaled to the number of indexed files.
|
|
121
|
-
*/
|
|
122
|
-
getTools(): ToolDefinition[]
|
|
123
|
-
/**
|
|
124
|
-
* Get CodeGraph instance for a project
|
|
125
|
-
*
|
|
126
|
-
* If projectPath is provided, opens that project's CodeGraph (cached).
|
|
127
|
-
* Otherwise returns the default CodeGraph instance.
|
|
128
|
-
*
|
|
129
|
-
* Walks up parent directories to find the nearest .codegraph/ folder,
|
|
130
|
-
* similar to how git finds .git/ directories.
|
|
131
|
-
*/
|
|
132
|
-
private getCodeGraph
|
|
133
|
-
/**
|
|
134
|
-
* Close all cached project connections
|
|
135
|
-
*/
|
|
136
|
-
closeAll(): void
|
|
137
|
-
/**
|
|
138
|
-
* Validate that a value is a non-empty string within length bounds.
|
|
139
|
-
*
|
|
140
|
-
* The `maxLength` cap protects against MCP clients that ship huge
|
|
141
|
-
* payloads (10MB+ query strings either by accident or maliciously).
|
|
142
|
-
* Without this, a single oversized input can pin the FTS5 index or
|
|
143
|
-
* exhaust memory before any real work runs.
|
|
144
|
-
*/
|
|
145
|
-
private validateString
|
|
146
|
-
/**
|
|
147
|
-
* Validate an optional path-like string input. Returns the value if
|
|
148
|
-
* valid (or undefined), or a ToolResult with the error.
|
|
149
|
-
*/
|
|
150
|
-
private validateOptionalPath
|
|
151
|
-
/**
|
|
152
|
-
* Execute a tool by name
|
|
153
|
-
*/
|
|
154
|
-
execute(toolName: string, args: Record<string, unknown>): Promise<ToolResult>
|
|
155
|
-
/**
|
|
156
|
-
* Handle codegraph_search
|
|
157
|
-
*/
|
|
158
|
-
private handleSearch
|
|
159
|
-
/**
|
|
160
|
-
* Handle codegraph_context
|
|
161
|
-
*/
|
|
162
|
-
private handleContext
|
|
163
|
-
/**
|
|
164
|
-
* Heuristic to detect if a query looks like a feature request
|
|
165
|
-
*/
|
|
166
|
-
private looksLikeFeatureRequest
|
|
167
|
-
/**
|
|
168
|
-
* Handle codegraph_callers
|
|
169
|
-
*/
|
|
170
|
-
private handleCallers
|
|
171
|
-
/**
|
|
172
|
-
* Handle codegraph_callees
|
|
173
|
-
*/
|
|
174
|
-
private handleCallees
|
|
175
|
-
/**
|
|
176
|
-
* Handle codegraph_impact
|
|
177
|
-
*/
|
|
178
|
-
private handleImpact
|
|
179
|
-
/**
|
|
180
|
-
* Handle codegraph_explore — deep exploration in a single call
|
|
181
|
-
*
|
|
182
|
-
* Strategy: find relevant symbols via graph traversal, group by file,
|
|
183
|
-
* then read contiguous file sections covering all symbols per file.
|
|
184
|
-
* This replaces multiple codegraph_node + Read calls.
|
|
185
|
-
*
|
|
186
|
-
* Output size is adaptive to project file count via
|
|
187
|
-
* `getExploreOutputBudget` — see #185 for why a fixed 35k cap was a
|
|
188
|
-
* tax on small projects while earning its keep on large ones.
|
|
189
|
-
*/
|
|
190
|
-
private handleExplore
|
|
191
|
-
/**
|
|
192
|
-
* Handle codegraph_node
|
|
193
|
-
*/
|
|
194
|
-
private handleNode
|
|
195
|
-
/**
|
|
196
|
-
* Handle codegraph_status
|
|
197
|
-
*/
|
|
198
|
-
private handleStatus
|
|
199
|
-
/**
|
|
200
|
-
* Handle codegraph_files - get project file structure from the index
|
|
201
|
-
*/
|
|
202
|
-
private handleFiles
|
|
203
|
-
/**
|
|
204
|
-
* Convert glob pattern to regex
|
|
205
|
-
*/
|
|
206
|
-
private globToRegex
|
|
207
|
-
/**
|
|
208
|
-
* Format files as a flat list
|
|
209
|
-
*/
|
|
210
|
-
private formatFilesFlat
|
|
211
|
-
/**
|
|
212
|
-
* Format files grouped by language
|
|
213
|
-
*/
|
|
214
|
-
private formatFilesGrouped
|
|
215
|
-
/**
|
|
216
|
-
* Format files as a tree structure
|
|
217
|
-
*/
|
|
218
|
-
private formatFilesTree
|
|
219
|
-
/**
|
|
220
|
-
* Find a symbol by name, handling disambiguation when multiple matches exist.
|
|
221
|
-
* Returns the best match and a note about alternatives if any.
|
|
222
|
-
*/
|
|
223
|
-
/**
|
|
224
|
-
* Check if a node matches a symbol query.
|
|
225
|
-
*
|
|
226
|
-
* Accepts simple names (`run`) and three flavors of qualifier:
|
|
227
|
-
* - dotted `Session.request` (TS/JS/Python)
|
|
228
|
-
* - colon-pair `stage_apply::run` (Rust, C++, Ruby)
|
|
229
|
-
* - slash `configurator/stage_apply` (path-ish)
|
|
230
|
-
*
|
|
231
|
-
* Multi-level qualifiers compose: `crate::configurator::stage_apply::run`
|
|
232
|
-
* works. Rust path prefixes (`crate`, `super`, `self`) are stripped so
|
|
233
|
-
* the canonical `crate::module::symbol` form resolves.
|
|
234
|
-
*
|
|
235
|
-
* Resolution order, last part must always equal `node.name`:
|
|
236
|
-
* 1. Suffix-match against `qualifiedName` (handles class-scoped methods
|
|
237
|
-
* where the extractor builds the qualified name from the AST stack)
|
|
238
|
-
* 2. File-path containment (handles file-derived modules in Rust/
|
|
239
|
-
* Python — `stage_apply::run` matches a `run` in `stage_apply.rs`)
|
|
240
|
-
*/
|
|
241
|
-
private matchesSymbol
|
|
242
|
-
private findSymbol
|
|
243
|
-
/**
|
|
244
|
-
* Find ALL symbols matching a name. Used by callers/callees/impact to aggregate
|
|
245
|
-
* results across all matching symbols (e.g., multiple classes with an `execute` method).
|
|
246
|
-
*/
|
|
247
|
-
private findAllSymbols
|
|
248
|
-
/**
|
|
249
|
-
* Truncate output if it exceeds the maximum length
|
|
250
|
-
*/
|
|
251
|
-
private truncateOutput
|
|
252
|
-
private formatSearchResults
|
|
253
|
-
private formatNodeList
|
|
254
|
-
private formatImpact
|
|
255
|
-
/**
|
|
256
|
-
* Build a compact structural outline of a container symbol from its
|
|
257
|
-
* indexed children (methods, fields, properties, …) — name, kind,
|
|
258
|
-
* line number, and signature — so the agent gets the shape of a class
|
|
259
|
-
* without the full source of every method. Returns '' when the container
|
|
260
|
-
* has no indexed children, so the caller can fall back to full source.
|
|
261
|
-
*/
|
|
262
|
-
private buildContainerOutline
|
|
263
|
-
private formatNodeDetails
|
|
264
|
-
private formatTaskContext
|
|
265
|
-
private textResult
|
|
266
|
-
private errorResult
|
|
267
|
-
}
|
|
268
|
-
export {}
|
|
269
|
-
//# sourceMappingURL=tools.d.ts.map
|
package/dist/mcp/transport.d.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Stdio Transport
|
|
3
|
-
*
|
|
4
|
-
* Handles JSON-RPC 2.0 communication over stdin/stdout for MCP protocol.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* JSON-RPC 2.0 Request
|
|
8
|
-
*/
|
|
9
|
-
export interface JsonRpcRequest {
|
|
10
|
-
jsonrpc: '2.0'
|
|
11
|
-
id: string | number
|
|
12
|
-
method: string
|
|
13
|
-
params?: unknown
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* JSON-RPC 2.0 Response
|
|
17
|
-
*/
|
|
18
|
-
export interface JsonRpcResponse {
|
|
19
|
-
jsonrpc: '2.0'
|
|
20
|
-
id: string | number | null
|
|
21
|
-
result?: unknown
|
|
22
|
-
error?: JsonRpcError
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* JSON-RPC 2.0 Error
|
|
26
|
-
*/
|
|
27
|
-
export interface JsonRpcError {
|
|
28
|
-
code: number
|
|
29
|
-
message: string
|
|
30
|
-
data?: unknown
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* JSON-RPC 2.0 Notification (no id, no response expected)
|
|
34
|
-
*/
|
|
35
|
-
export interface JsonRpcNotification {
|
|
36
|
-
jsonrpc: '2.0'
|
|
37
|
-
method: string
|
|
38
|
-
params?: unknown
|
|
39
|
-
}
|
|
40
|
-
export declare const ErrorCodes: {
|
|
41
|
-
readonly ParseError: -32700
|
|
42
|
-
readonly InvalidRequest: -32600
|
|
43
|
-
readonly MethodNotFound: -32601
|
|
44
|
-
readonly InvalidParams: -32602
|
|
45
|
-
readonly InternalError: -32603
|
|
46
|
-
}
|
|
47
|
-
export type MessageHandler = (
|
|
48
|
-
message: JsonRpcRequest | JsonRpcNotification,
|
|
49
|
-
) => Promise<void>
|
|
50
|
-
/**
|
|
51
|
-
* Stdio Transport for MCP
|
|
52
|
-
*
|
|
53
|
-
* Reads JSON-RPC messages from stdin and writes responses to stdout.
|
|
54
|
-
*/
|
|
55
|
-
export declare class StdioTransport {
|
|
56
|
-
private rl
|
|
57
|
-
private messageHandler
|
|
58
|
-
private pending
|
|
59
|
-
private nextRequestId
|
|
60
|
-
/**
|
|
61
|
-
* Start listening for messages on stdin
|
|
62
|
-
*/
|
|
63
|
-
start(handler: MessageHandler): void
|
|
64
|
-
/**
|
|
65
|
-
* Stop listening
|
|
66
|
-
*/
|
|
67
|
-
stop(): void
|
|
68
|
-
/**
|
|
69
|
-
* Send a server-initiated request to the client and await its response.
|
|
70
|
-
*
|
|
71
|
-
* MCP is bidirectional: the server can ask the client questions too. We use
|
|
72
|
-
* this for `roots/list` — the spec-blessed way to learn the workspace root
|
|
73
|
-
* when the client didn't pass one in `initialize` (see issue #196). Rejects
|
|
74
|
-
* on timeout so callers can fall back rather than hang forever.
|
|
75
|
-
*/
|
|
76
|
-
request(
|
|
77
|
-
method: string,
|
|
78
|
-
params?: unknown,
|
|
79
|
-
timeoutMs?: number,
|
|
80
|
-
): Promise<unknown>
|
|
81
|
-
/**
|
|
82
|
-
* Send a response
|
|
83
|
-
*/
|
|
84
|
-
send(response: JsonRpcResponse): void
|
|
85
|
-
/**
|
|
86
|
-
* Send a notification (no id)
|
|
87
|
-
*/
|
|
88
|
-
notify(method: string, params?: unknown): void
|
|
89
|
-
/**
|
|
90
|
-
* Send a success response
|
|
91
|
-
*/
|
|
92
|
-
sendResult(id: string | number, result: unknown): void
|
|
93
|
-
/**
|
|
94
|
-
* Send an error response
|
|
95
|
-
*/
|
|
96
|
-
sendError(
|
|
97
|
-
id: string | number | null,
|
|
98
|
-
code: number,
|
|
99
|
-
message: string,
|
|
100
|
-
data?: unknown,
|
|
101
|
-
): void
|
|
102
|
-
/**
|
|
103
|
-
* Handle an incoming line of JSON
|
|
104
|
-
*/
|
|
105
|
-
private handleLine
|
|
106
|
-
/**
|
|
107
|
-
* Resolve (or reject) the pending server-initiated request matching this
|
|
108
|
-
* response's id. Unknown ids are ignored — the client may echo something we
|
|
109
|
-
* never sent, or a request may have already timed out.
|
|
110
|
-
*/
|
|
111
|
-
private handleResponse
|
|
112
|
-
/**
|
|
113
|
-
* Check if message is a valid JSON-RPC 2.0 message
|
|
114
|
-
*/
|
|
115
|
-
private isValidMessage
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cargo Workspace Resolver Helper
|
|
3
|
-
*
|
|
4
|
-
* Parses a project's root Cargo.toml and member crate manifests to
|
|
5
|
-
* build a crate-name -> member-directory map. Used by the Rust
|
|
6
|
-
* resolver to resolve `use crate_name::...` references that point
|
|
7
|
-
* into workspace member crates.
|
|
8
|
-
*/
|
|
9
|
-
import { ResolutionContext } from '../types'
|
|
10
|
-
/**
|
|
11
|
-
* Build a map from crate-name aliases to workspace member directory paths.
|
|
12
|
-
* Example: "mytool-core" and "mytool_core" -> "crates/mytool-core"
|
|
13
|
-
*
|
|
14
|
-
* Supports glob members (e.g. `members = ["crates/*"]`) via picomatch
|
|
15
|
-
* when the context exposes `listDirectories`.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getCargoWorkspaceCrateMap(
|
|
18
|
-
context: ResolutionContext,
|
|
19
|
-
): Map<string, string>
|
|
20
|
-
//# sourceMappingURL=cargo-workspace.d.ts.map
|