@saluzi/codegraph 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/codegraph.d.ts +25 -0
- package/dist/bin/node-version-check.d.ts +37 -0
- package/dist/bin/uninstall.d.ts +14 -0
- package/dist/context/formatter.d.ts +33 -0
- package/dist/context/formatter.js +244 -0
- package/dist/context/index.d.ts +117 -0
- package/dist/context/index.js +1050 -0
- package/dist/db/index.d.ts +101 -0
- package/dist/db/index.js +250 -0
- package/dist/db/migrations.d.ts +47 -0
- package/dist/db/migrations.js +131 -0
- package/dist/db/queries.d.ts +291 -0
- package/dist/db/queries.js +1349 -0
- package/dist/db/schema.sql +151 -0
- package/dist/db/sqlite-adapter.d.ts +49 -0
- package/dist/db/sqlite-adapter.js +141 -0
- package/dist/directory.d.ts +62 -0
- package/dist/directory.js +264 -0
- package/dist/errors.d.ts +149 -0
- package/dist/errors.js +219 -0
- package/dist/extraction/dfm-extractor.d.ts +31 -0
- package/dist/extraction/dfm-extractor.js +151 -0
- package/dist/extraction/grammars.d.ts +94 -0
- package/dist/extraction/grammars.js +357 -0
- package/dist/extraction/index.d.ts +148 -0
- package/dist/extraction/index.js +1286 -0
- package/dist/extraction/languages/c-cpp.d.ts +4 -0
- package/dist/extraction/languages/c-cpp.js +126 -0
- package/dist/extraction/languages/csharp.d.ts +3 -0
- package/dist/extraction/languages/csharp.js +72 -0
- package/dist/extraction/languages/dart.d.ts +3 -0
- package/dist/extraction/languages/dart.js +192 -0
- package/dist/extraction/languages/go.d.ts +3 -0
- package/dist/extraction/languages/go.js +58 -0
- package/dist/extraction/languages/index.d.ts +10 -0
- package/dist/extraction/languages/index.js +49 -0
- package/dist/extraction/languages/java.d.ts +3 -0
- package/dist/extraction/languages/java.js +64 -0
- package/dist/extraction/languages/javascript.d.ts +3 -0
- package/dist/extraction/languages/javascript.js +90 -0
- package/dist/extraction/languages/kotlin.d.ts +3 -0
- package/dist/extraction/languages/kotlin.js +253 -0
- package/dist/extraction/languages/lua.d.ts +3 -0
- package/dist/extraction/languages/lua.js +150 -0
- package/dist/extraction/languages/luau.d.ts +3 -0
- package/dist/extraction/languages/luau.js +37 -0
- package/dist/extraction/languages/pascal.d.ts +3 -0
- package/dist/extraction/languages/pascal.js +66 -0
- package/dist/extraction/languages/php.d.ts +3 -0
- package/dist/extraction/languages/php.js +107 -0
- package/dist/extraction/languages/python.d.ts +3 -0
- package/dist/extraction/languages/python.js +56 -0
- package/dist/extraction/languages/ruby.d.ts +3 -0
- package/dist/extraction/languages/ruby.js +114 -0
- package/dist/extraction/languages/rust.d.ts +3 -0
- package/dist/extraction/languages/rust.js +109 -0
- package/dist/extraction/languages/scala.d.ts +3 -0
- package/dist/extraction/languages/scala.js +139 -0
- package/dist/extraction/languages/swift.d.ts +3 -0
- package/dist/extraction/languages/swift.js +91 -0
- package/dist/extraction/languages/typescript.d.ts +3 -0
- package/dist/extraction/languages/typescript.js +129 -0
- package/dist/extraction/liquid-extractor.d.ts +52 -0
- package/dist/extraction/liquid-extractor.js +313 -0
- package/dist/extraction/parse-worker.d.ts +8 -0
- package/dist/extraction/parse-worker.js +94 -0
- package/dist/extraction/svelte-extractor.d.ts +56 -0
- package/dist/extraction/svelte-extractor.js +272 -0
- package/dist/extraction/tree-sitter-helpers.d.ts +39 -0
- package/dist/extraction/tree-sitter-helpers.js +103 -0
- package/dist/extraction/tree-sitter-types.d.ts +191 -0
- package/dist/extraction/tree-sitter-types.js +10 -0
- package/dist/extraction/tree-sitter.d.ts +238 -0
- package/dist/extraction/tree-sitter.js +2430 -0
- package/dist/extraction/vue-extractor.d.ts +36 -0
- package/dist/extraction/vue-extractor.js +163 -0
- 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 +46 -0
- package/dist/extraction/wasm-runtime-flags.js +105 -0
- package/dist/graph/index.d.ts +8 -0
- package/dist/graph/index.js +13 -0
- package/dist/graph/queries.d.ts +109 -0
- package/dist/graph/queries.js +366 -0
- package/dist/graph/traversal.d.ts +137 -0
- package/dist/graph/traversal.js +528 -0
- package/dist/index.d.ts +509 -0
- package/dist/index.js +800 -0
- package/dist/installer/claude-md-template.d.ts +19 -0
- package/dist/installer/config-writer.d.ts +29 -0
- package/dist/installer/index.d.ts +140 -0
- package/dist/installer/instructions-template.d.ts +30 -0
- package/dist/installer/targets/claude.d.ts +55 -0
- package/dist/installer/targets/codex.d.ts +18 -0
- package/dist/installer/targets/cursor.d.ts +35 -0
- package/dist/installer/targets/hermes.d.ts +18 -0
- package/dist/installer/targets/opencode.d.ts +30 -0
- package/dist/installer/targets/registry.d.ts +38 -0
- package/dist/installer/targets/shared.d.ts +92 -0
- package/dist/installer/targets/toml.d.ts +64 -0
- package/dist/installer/targets/types.d.ts +122 -0
- package/dist/mcp/index.d.ts +98 -0
- package/dist/mcp/server-instructions.d.ts +20 -0
- package/dist/mcp/tools.d.ts +269 -0
- package/dist/mcp/transport.d.ts +117 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts +20 -0
- package/dist/resolution/frameworks/cargo-workspace.js +225 -0
- package/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/dist/resolution/frameworks/csharp.js +213 -0
- package/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/dist/resolution/frameworks/drupal.js +335 -0
- package/dist/resolution/frameworks/express.d.ts +8 -0
- package/dist/resolution/frameworks/express.js +225 -0
- package/dist/resolution/frameworks/go.d.ts +8 -0
- package/dist/resolution/frameworks/go.js +158 -0
- package/dist/resolution/frameworks/index.d.ts +52 -0
- package/dist/resolution/frameworks/index.js +137 -0
- package/dist/resolution/frameworks/java.d.ts +8 -0
- package/dist/resolution/frameworks/java.js +177 -0
- package/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/dist/resolution/frameworks/laravel.js +248 -0
- package/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/dist/resolution/frameworks/nestjs.js +374 -0
- package/dist/resolution/frameworks/python.d.ts +10 -0
- package/dist/resolution/frameworks/python.js +278 -0
- package/dist/resolution/frameworks/react.d.ts +8 -0
- package/dist/resolution/frameworks/react.js +272 -0
- package/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/dist/resolution/frameworks/ruby.js +198 -0
- package/dist/resolution/frameworks/rust.d.ts +8 -0
- package/dist/resolution/frameworks/rust.js +207 -0
- package/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/dist/resolution/frameworks/svelte.js +249 -0
- package/dist/resolution/frameworks/swift.d.ts +10 -0
- package/dist/resolution/frameworks/swift.js +376 -0
- package/dist/resolution/frameworks/vue.d.ts +9 -0
- package/dist/resolution/frameworks/vue.js +306 -0
- package/dist/resolution/import-resolver.d.ts +61 -0
- package/dist/resolution/import-resolver.js +663 -0
- package/dist/resolution/index.d.ts +118 -0
- package/dist/resolution/index.js +744 -0
- package/dist/resolution/lru-cache.d.ts +24 -0
- package/dist/resolution/lru-cache.js +62 -0
- package/dist/resolution/name-matcher.d.ts +50 -0
- package/dist/resolution/name-matcher.js +384 -0
- package/dist/resolution/path-aliases.d.ts +72 -0
- package/dist/resolution/path-aliases.js +238 -0
- package/dist/resolution/strip-comments.d.ts +40 -0
- package/dist/resolution/strip-comments.js +441 -0
- package/dist/resolution/types.d.ts +181 -0
- package/dist/resolution/types.js +8 -0
- package/dist/search/query-parser.d.ts +61 -0
- package/dist/search/query-parser.js +177 -0
- package/dist/search/query-utils.d.ts +59 -0
- package/dist/search/query-utils.js +383 -0
- package/dist/sync/git-hooks.d.ts +54 -0
- package/dist/sync/git-hooks.js +223 -0
- package/dist/sync/index.d.ts +25 -0
- package/dist/sync/index.js +28 -0
- package/dist/sync/watch-policy.d.ts +51 -0
- package/dist/sync/watch-policy.js +124 -0
- package/dist/sync/watcher.d.ts +83 -0
- package/dist/sync/watcher.js +192 -0
- package/dist/types.d.ts +433 -0
- package/dist/types.js +75 -0
- package/dist/ui/glyphs.d.ts +42 -0
- package/dist/ui/shimmer-progress.d.ts +11 -0
- package/dist/ui/shimmer-worker.d.ts +2 -0
- package/dist/ui/types.d.ts +20 -0
- package/dist/utils.d.ts +231 -0
- package/dist/utils.js +549 -0
- package/package.json +24 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backwards-compat re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* The instructions template moved to `instructions-template.ts` so it
|
|
5
|
+
* can be shared across all agent targets (Claude Code, Cursor, Codex
|
|
6
|
+
* CLI, opencode). This file is preserved purely so existing imports
|
|
7
|
+
* (`@colbymchenry/codegraph` consumers, downstream tooling) keep
|
|
8
|
+
* working unchanged. New code should import from
|
|
9
|
+
* `./instructions-template` directly.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated Import from `./instructions-template` instead.
|
|
12
|
+
*/
|
|
13
|
+
export {
|
|
14
|
+
CODEGRAPH_SECTION_START,
|
|
15
|
+
CODEGRAPH_SECTION_END,
|
|
16
|
+
CLAUDE_MD_TEMPLATE,
|
|
17
|
+
INSTRUCTIONS_TEMPLATE,
|
|
18
|
+
} from './instructions-template'
|
|
19
|
+
//# sourceMappingURL=claude-md-template.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backwards-compat shim — original Claude-only writer functions.
|
|
3
|
+
*
|
|
4
|
+
* The installer now uses the multi-target architecture in
|
|
5
|
+
* `./targets/`. This file is preserved so existing imports (the test
|
|
6
|
+
* suite, downstream tooling) keep working unchanged. Each function
|
|
7
|
+
* delegates to the Claude target. New code should import the target
|
|
8
|
+
* registry from `./targets/registry` directly.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated Use `targets/registry.ts` and the `AgentTarget`
|
|
11
|
+
* abstraction instead.
|
|
12
|
+
*/
|
|
13
|
+
export type InstallLocation = 'global' | 'local'
|
|
14
|
+
/**
|
|
15
|
+
* Each shim calls ONLY the named per-file helper — writeMcpConfig
|
|
16
|
+
* writes only the MCP JSON, writePermissions only settings.json,
|
|
17
|
+
* writeClaudeMd only CLAUDE.md. The full multi-file install lives
|
|
18
|
+
* in `claudeTarget.install()` which the new orchestrator uses.
|
|
19
|
+
*/
|
|
20
|
+
export declare function writeMcpConfig(location: InstallLocation): void
|
|
21
|
+
export declare function writePermissions(location: InstallLocation): void
|
|
22
|
+
export declare function writeClaudeMd(location: InstallLocation): {
|
|
23
|
+
created: boolean
|
|
24
|
+
updated: boolean
|
|
25
|
+
}
|
|
26
|
+
export declare function hasMcpConfig(location: InstallLocation): boolean
|
|
27
|
+
export declare function hasPermissions(location: InstallLocation): boolean
|
|
28
|
+
export declare function hasClaudeMdSection(location: InstallLocation): boolean
|
|
29
|
+
//# sourceMappingURL=config-writer.d.ts.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodeGraph Interactive Installer
|
|
3
|
+
*
|
|
4
|
+
* Multi-target: writes MCP server config + instructions for the
|
|
5
|
+
* agents the user picks (Claude Code, Cursor, Codex CLI, opencode,
|
|
6
|
+
* Hermes Agent).
|
|
7
|
+
* Defaults to the Claude-only behavior for backwards compatibility
|
|
8
|
+
* when no targets are explicitly chosen and nothing else is detected.
|
|
9
|
+
*
|
|
10
|
+
* Uses @clack/prompts for the interactive UI; `runInstallerWithOptions`
|
|
11
|
+
* is the non-interactive entry point used by the `--target` /
|
|
12
|
+
* `--print-config` CLI flags.
|
|
13
|
+
*/
|
|
14
|
+
import type {
|
|
15
|
+
AgentTarget,
|
|
16
|
+
Location,
|
|
17
|
+
TargetId,
|
|
18
|
+
WriteResult,
|
|
19
|
+
} from './targets/types'
|
|
20
|
+
export {
|
|
21
|
+
writeMcpConfig,
|
|
22
|
+
writePermissions,
|
|
23
|
+
writeClaudeMd,
|
|
24
|
+
hasMcpConfig,
|
|
25
|
+
hasPermissions,
|
|
26
|
+
hasClaudeMdSection,
|
|
27
|
+
} from './config-writer'
|
|
28
|
+
export type { InstallLocation } from './config-writer'
|
|
29
|
+
export interface RunInstallerOptions {
|
|
30
|
+
/** Comma-separated target list, or `auto` / `all` / `none`. */
|
|
31
|
+
target?: string
|
|
32
|
+
/** Skip the location prompt; use this value directly. */
|
|
33
|
+
location?: Location
|
|
34
|
+
/** Skip the auto-allow prompt; use this value directly. */
|
|
35
|
+
autoAllow?: boolean
|
|
36
|
+
/**
|
|
37
|
+
* Skip every confirm and use defaults: location=global,
|
|
38
|
+
* autoAllow=true, target=auto. For scripting / CI.
|
|
39
|
+
*/
|
|
40
|
+
yes?: boolean
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Interactive entry point — preserves the historical UX (`codegraph
|
|
44
|
+
* install` with no args goes through the prompts), but now starts
|
|
45
|
+
* the targets multi-select pre-populated with detected agents.
|
|
46
|
+
*/
|
|
47
|
+
export declare function runInstaller(): Promise<void>
|
|
48
|
+
export declare function runInstallerWithOptions(
|
|
49
|
+
opts: RunInstallerOptions,
|
|
50
|
+
): Promise<void>
|
|
51
|
+
export interface RunUninstallerOptions {
|
|
52
|
+
/**
|
|
53
|
+
* Comma-separated target list, or `auto` / `all` / `none`. Defaults
|
|
54
|
+
* to `all` — uninstall sweeps every known agent and reports which
|
|
55
|
+
* ones it actually touched, so the user doesn't have to know where
|
|
56
|
+
* they configured it.
|
|
57
|
+
*/
|
|
58
|
+
target?: string
|
|
59
|
+
/** Skip the location prompt; use this value directly. */
|
|
60
|
+
location?: Location
|
|
61
|
+
/** Non-interactive: location=global, target=all, no prompts. */
|
|
62
|
+
yes?: boolean
|
|
63
|
+
}
|
|
64
|
+
export type UninstallStatus = 'removed' | 'not-configured' | 'unsupported'
|
|
65
|
+
/**
|
|
66
|
+
* Per-target outcome of an uninstall sweep. `removed` means we deleted
|
|
67
|
+
* at least one thing; `not-configured` means the agent had no codegraph
|
|
68
|
+
* config at this location (nothing to do); `unsupported` means the
|
|
69
|
+
* agent has no config concept for this location (e.g. Codex is
|
|
70
|
+
* global-only, so a `local` uninstall skips it).
|
|
71
|
+
*/
|
|
72
|
+
export interface UninstallReport {
|
|
73
|
+
id: TargetId
|
|
74
|
+
displayName: string
|
|
75
|
+
status: UninstallStatus
|
|
76
|
+
/** Absolute paths we actually edited/removed (action === 'removed'). */
|
|
77
|
+
removedPaths: string[]
|
|
78
|
+
/** Verbatim notes from the target (rare for uninstall). */
|
|
79
|
+
notes: string[]
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Pure uninstall sweep — no prompts, no I/O beyond the targets' own
|
|
83
|
+
* file edits. Exposed (and unit-tested) separately from the clack UI in
|
|
84
|
+
* `runUninstaller` so the aggregation logic can be asserted directly.
|
|
85
|
+
*
|
|
86
|
+
* Each target's `uninstall()` is already safe to call when nothing was
|
|
87
|
+
* installed (it returns `not-found` actions), so this is safe to run
|
|
88
|
+
* across every target unconditionally.
|
|
89
|
+
*/
|
|
90
|
+
export declare function uninstallTargets(
|
|
91
|
+
targets: readonly AgentTarget[],
|
|
92
|
+
location: Location,
|
|
93
|
+
): UninstallReport[]
|
|
94
|
+
/**
|
|
95
|
+
* Interactive uninstaller — the inverse of `runInstallerWithOptions`.
|
|
96
|
+
* Asks global-vs-local first (unless `--location`/`--yes` is given),
|
|
97
|
+
* then sweeps every agent target (or the `--target` subset) and prints
|
|
98
|
+
* one block per agent so the user sees exactly which providers it hit.
|
|
99
|
+
*
|
|
100
|
+
* Removes only what install wrote (MCP server entry, instructions
|
|
101
|
+
* block, permissions) — never the `.codegraph/` index, which `codegraph
|
|
102
|
+
* uninit` owns.
|
|
103
|
+
*/
|
|
104
|
+
export declare function runUninstaller(
|
|
105
|
+
opts: RunUninstallerOptions,
|
|
106
|
+
): Promise<void>
|
|
107
|
+
/**
|
|
108
|
+
* For every target that has a global config and exposes
|
|
109
|
+
* `wireProjectSurfaces`, write its project-local surfaces (e.g.
|
|
110
|
+
* Cursor's `.cursor/rules/codegraph.mdc`). Idempotent — runs
|
|
111
|
+
* silently when there's nothing to write.
|
|
112
|
+
*
|
|
113
|
+
* Called by `codegraph init` so that a user who ran
|
|
114
|
+
* `codegraph install` once globally doesn't have to re-run it per
|
|
115
|
+
* project to get full agent support.
|
|
116
|
+
*
|
|
117
|
+
* Returns the list of `(target, file)` pairs that were created or
|
|
118
|
+
* updated — caller decides how to surface them.
|
|
119
|
+
*/
|
|
120
|
+
export declare function wireProjectSurfacesForGlobalAgents(): Array<{
|
|
121
|
+
target: AgentTarget
|
|
122
|
+
file: WriteResult['files'][number]
|
|
123
|
+
}>
|
|
124
|
+
/**
|
|
125
|
+
* When the live file watcher will be disabled for this project (e.g. WSL2
|
|
126
|
+
* /mnt drives, or CODEGRAPH_NO_WATCH), the index would silently go stale.
|
|
127
|
+
* Explain that, and offer to keep it fresh automatically via git hooks
|
|
128
|
+
* (commit / pull / checkout) instead of manual `codegraph sync`.
|
|
129
|
+
*
|
|
130
|
+
* No-op on environments where the watcher runs normally, so it's safe to
|
|
131
|
+
* call unconditionally after init.
|
|
132
|
+
*/
|
|
133
|
+
export declare function offerWatchFallback(
|
|
134
|
+
clack: typeof import('@clack/prompts'),
|
|
135
|
+
projectPath: string,
|
|
136
|
+
opts?: {
|
|
137
|
+
yes?: boolean
|
|
138
|
+
},
|
|
139
|
+
): Promise<void>
|
|
140
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-instructions template — the markdown body each agent target
|
|
3
|
+
* writes into its conventional instructions file (CLAUDE.md /
|
|
4
|
+
* AGENTS.md / codegraph.mdc / etc.).
|
|
5
|
+
*
|
|
6
|
+
* The body content is identical across agents because the codegraph
|
|
7
|
+
* usage advice is agent-agnostic — only the destination filename and
|
|
8
|
+
* any optional frontmatter (Cursor `.mdc`) varies per target.
|
|
9
|
+
*
|
|
10
|
+
* The legacy `claude-md-template.ts` re-exports these names for
|
|
11
|
+
* backwards compatibility with downstream importers.
|
|
12
|
+
*/
|
|
13
|
+
/** Markers used by the marker-based section replacement. */
|
|
14
|
+
export declare const CODEGRAPH_SECTION_START = '<!-- CODEGRAPH_START -->'
|
|
15
|
+
export declare const CODEGRAPH_SECTION_END = '<!-- CODEGRAPH_END -->'
|
|
16
|
+
/**
|
|
17
|
+
* The full marker-delimited block written into each agent's
|
|
18
|
+
* instructions file. Includes the start/end markers so the section
|
|
19
|
+
* can be detected and replaced on re-install.
|
|
20
|
+
*/
|
|
21
|
+
export declare const INSTRUCTIONS_TEMPLATE =
|
|
22
|
+
'<!-- CODEGRAPH_START -->\n## CodeGraph\n\nThis project has a CodeGraph MCP server (`codegraph_*` tools) configured. CodeGraph is a tree-sitter-parsed knowledge graph of every symbol, edge, and file. Reads are sub-millisecond and return structural information grep cannot.\n\n### When to prefer codegraph over native search\n\nUse codegraph for **structural** questions \u2014 what calls what, what would break, where is X defined, what is X\'s signature. Use native grep/read only for **literal text** queries (string contents, comments, log messages) or after you already have a specific file open.\n\n| Question | Tool |\n|---|---|\n| "Where is X defined?" / "Find symbol named X" | `codegraph_search` |\n| "What calls function Y?" | `codegraph_callers` |\n| "What does Y call?" | `codegraph_callees` |\n| "What would break if I changed Z?" | `codegraph_impact` |\n| "Show me Y\'s signature / source / docstring" | `codegraph_node` |\n| "Give me focused context for a task/area" | `codegraph_context` |\n| "See several related symbols\' source at once" | `codegraph_explore` |\n| "What files exist under path/" | `codegraph_files` |\n| "Is the index healthy?" | `codegraph_status` |\n\n### Rules of thumb\n\n- **Answer directly \u2014 don\'t delegate exploration.** For "how does X work" / architecture / trace questions, answer with 2-3 codegraph calls: `codegraph_context` first, then ONE `codegraph_explore` for the source of the symbols it surfaces. Codegraph IS the pre-built index, so spawning a separate file-reading sub-task/agent \u2014 or running a grep + read loop \u2014 repeats work codegraph already did and costs more for the same answer.\n- **Trust codegraph results.** They come from a full AST parse. Do NOT re-verify them with grep \u2014 that\'s slower, less accurate, and wastes context.\n- **Don\'t grep first** when looking up a symbol by name. `codegraph_search` is faster and returns kind + location + signature in one call.\n- **Don\'t chain `codegraph_search` + `codegraph_node`** when you just want context \u2014 `codegraph_context` is one call.\n- **Don\'t loop `codegraph_node` over many symbols** \u2014 one `codegraph_explore` call returns several symbols\' source grouped in a single capped call, while each separate node/Read call re-reads the whole context and costs far more.\n- **Index lag**: the file watcher debounces ~500ms behind writes; don\'t re-query immediately after editing a file in the same turn.\n\n### If `.codegraph/` doesn\'t exist\n\nThe MCP server returns "not initialized." Ask the user: *"I notice this project doesn\'t have CodeGraph initialized. Want me to run `codegraph init -i` to build the index?"*\n<!-- CODEGRAPH_END -->'
|
|
23
|
+
/**
|
|
24
|
+
* Backwards-compat alias. Existing downstream code may import
|
|
25
|
+
* `CLAUDE_MD_TEMPLATE` from this module via the re-export shim in
|
|
26
|
+
* `claude-md-template.ts`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const CLAUDE_MD_TEMPLATE =
|
|
29
|
+
'<!-- CODEGRAPH_START -->\n## CodeGraph\n\nThis project has a CodeGraph MCP server (`codegraph_*` tools) configured. CodeGraph is a tree-sitter-parsed knowledge graph of every symbol, edge, and file. Reads are sub-millisecond and return structural information grep cannot.\n\n### When to prefer codegraph over native search\n\nUse codegraph for **structural** questions \u2014 what calls what, what would break, where is X defined, what is X\'s signature. Use native grep/read only for **literal text** queries (string contents, comments, log messages) or after you already have a specific file open.\n\n| Question | Tool |\n|---|---|\n| "Where is X defined?" / "Find symbol named X" | `codegraph_search` |\n| "What calls function Y?" | `codegraph_callers` |\n| "What does Y call?" | `codegraph_callees` |\n| "What would break if I changed Z?" | `codegraph_impact` |\n| "Show me Y\'s signature / source / docstring" | `codegraph_node` |\n| "Give me focused context for a task/area" | `codegraph_context` |\n| "See several related symbols\' source at once" | `codegraph_explore` |\n| "What files exist under path/" | `codegraph_files` |\n| "Is the index healthy?" | `codegraph_status` |\n\n### Rules of thumb\n\n- **Answer directly \u2014 don\'t delegate exploration.** For "how does X work" / architecture / trace questions, answer with 2-3 codegraph calls: `codegraph_context` first, then ONE `codegraph_explore` for the source of the symbols it surfaces. Codegraph IS the pre-built index, so spawning a separate file-reading sub-task/agent \u2014 or running a grep + read loop \u2014 repeats work codegraph already did and costs more for the same answer.\n- **Trust codegraph results.** They come from a full AST parse. Do NOT re-verify them with grep \u2014 that\'s slower, less accurate, and wastes context.\n- **Don\'t grep first** when looking up a symbol by name. `codegraph_search` is faster and returns kind + location + signature in one call.\n- **Don\'t chain `codegraph_search` + `codegraph_node`** when you just want context \u2014 `codegraph_context` is one call.\n- **Don\'t loop `codegraph_node` over many symbols** \u2014 one `codegraph_explore` call returns several symbols\' source grouped in a single capped call, while each separate node/Read call re-reads the whole context and costs far more.\n- **Index lag**: the file watcher debounces ~500ms behind writes; don\'t re-query immediately after editing a file in the same turn.\n\n### If `.codegraph/` doesn\'t exist\n\nThe MCP server returns "not initialized." Ask the user: *"I notice this project doesn\'t have CodeGraph initialized. Want me to run `codegraph init -i` to build the index?"*\n<!-- CODEGRAPH_END -->'
|
|
30
|
+
//# sourceMappingURL=instructions-template.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code target. Writes:
|
|
3
|
+
*
|
|
4
|
+
* - MCP server entry to `~/.claude.json` (global = user scope, loads
|
|
5
|
+
* in every project) or `./.mcp.json` (local = project scope, the
|
|
6
|
+
* file Claude Code actually reads for a single project). See the
|
|
7
|
+
* scope table at https://code.claude.com/docs/en/mcp.
|
|
8
|
+
* - Permissions to `~/.claude/settings.json` (global) or
|
|
9
|
+
* `./.claude/settings.json` (local), gated on `autoAllow`.
|
|
10
|
+
* - Instructions to `~/.claude/CLAUDE.md` (global) or
|
|
11
|
+
* `./.claude/CLAUDE.md` (local).
|
|
12
|
+
*
|
|
13
|
+
* Earlier versions wrote the local MCP entry to `./.claude.json` — a
|
|
14
|
+
* file Claude Code never reads — so the server silently never loaded
|
|
15
|
+
* until the user manually renamed it to `.mcp.json` (issue #207). We
|
|
16
|
+
* now write `./.mcp.json` and migrate any stale `./.claude.json` entry
|
|
17
|
+
* out of the way on install and uninstall.
|
|
18
|
+
*/
|
|
19
|
+
import { AgentTarget, Location, WriteResult } from './types'
|
|
20
|
+
/**
|
|
21
|
+
* Per-file write helpers, exported so the legacy `config-writer.ts`
|
|
22
|
+
* shim can call only the named operation (writeMcpConfig writes ONLY
|
|
23
|
+
* the MCP entry, etc.) instead of `claudeTarget.install()` which
|
|
24
|
+
* writes all three files. Without this split the shims silently
|
|
25
|
+
* cause side effects callers don't expect.
|
|
26
|
+
*/
|
|
27
|
+
export declare function writeMcpEntry(
|
|
28
|
+
loc: Location,
|
|
29
|
+
): WriteResult['files'][number]
|
|
30
|
+
/**
|
|
31
|
+
* Remove stale codegraph auto-sync hooks from Claude `settings.json`.
|
|
32
|
+
*
|
|
33
|
+
* Surgical at the individual-command level: only entries matching
|
|
34
|
+
* `isLegacyCodegraphHookCommand` are dropped, so a sibling hook sharing
|
|
35
|
+
* a matcher group (or the Stop event) with ours survives. We prune a
|
|
36
|
+
* matcher group only once its `hooks` array is empty, an event only
|
|
37
|
+
* once it has no groups left, and `hooks` itself only once every event
|
|
38
|
+
* is gone — and none of that runs unless we actually removed a
|
|
39
|
+
* codegraph command, so a settings.json with no legacy hooks is left
|
|
40
|
+
* byte-for-byte untouched and reported `unchanged`.
|
|
41
|
+
*
|
|
42
|
+
* Exported so it can be unit-tested directly and reused by both
|
|
43
|
+
* `install` (an upgrade self-heals) and `uninstall`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function cleanupLegacyHooks(
|
|
46
|
+
loc: Location,
|
|
47
|
+
): WriteResult['files'][number]
|
|
48
|
+
export declare function writePermissionsEntry(
|
|
49
|
+
loc: Location,
|
|
50
|
+
): WriteResult['files'][number]
|
|
51
|
+
export declare function writeInstructionsEntry(
|
|
52
|
+
loc: Location,
|
|
53
|
+
): WriteResult['files'][number]
|
|
54
|
+
export declare const claudeTarget: AgentTarget
|
|
55
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI Codex CLI target.
|
|
3
|
+
*
|
|
4
|
+
* - MCP server entry to `~/.codex/config.toml` as the dotted-key
|
|
5
|
+
* table `[mcp_servers.codegraph]`. TOML — not JSON — handled by
|
|
6
|
+
* the narrow serializer in `./toml.ts`.
|
|
7
|
+
* - Instructions to `~/.codex/AGENTS.md`.
|
|
8
|
+
*
|
|
9
|
+
* Codex CLI as of 2026-05 has no project-local config concept —
|
|
10
|
+
* everything lives under `~/.codex/`. `supportsLocation('local')`
|
|
11
|
+
* returns false; the orchestrator skips Codex when the user picks
|
|
12
|
+
* the local install location.
|
|
13
|
+
*
|
|
14
|
+
* No permissions concept.
|
|
15
|
+
*/
|
|
16
|
+
import { AgentTarget } from './types'
|
|
17
|
+
export declare const codexTarget: AgentTarget
|
|
18
|
+
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor target.
|
|
3
|
+
*
|
|
4
|
+
* - MCP server entry to `~/.cursor/mcp.json` (global) or
|
|
5
|
+
* `./.cursor/mcp.json` (local). Same `{mcpServers: {...}}` shape
|
|
6
|
+
* as Claude.
|
|
7
|
+
* - Instructions to `./.cursor/rules/codegraph.mdc` (project-local
|
|
8
|
+
* ONLY). Cursor's rules system is a project-scoped surface;
|
|
9
|
+
* global cursor rules aren't a stable convention as of 2026-05.
|
|
10
|
+
* For `--location=global`, only mcp.json is written.
|
|
11
|
+
*
|
|
12
|
+
* ## Why we hardcode `--path` for Cursor
|
|
13
|
+
*
|
|
14
|
+
* Cursor launches MCP-server subprocesses with a working directory
|
|
15
|
+
* that ISN'T the workspace root AND doesn't pass `rootUri` /
|
|
16
|
+
* `workspaceFolders` in the MCP initialize call. The codegraph MCP
|
|
17
|
+
* server's `process.cwd()` fallback therefore misses the workspace's
|
|
18
|
+
* `.codegraph/` and reports "not initialized" on every tool call.
|
|
19
|
+
*
|
|
20
|
+
* So we inject `--path` into the args ourselves:
|
|
21
|
+
*
|
|
22
|
+
* - `local` install: absolute path (we know it at install time).
|
|
23
|
+
* - `global` install: `${workspaceFolder}` — Cursor expands this to
|
|
24
|
+
* the open workspace's root, giving us per-workspace behavior
|
|
25
|
+
* from a single global config.
|
|
26
|
+
*
|
|
27
|
+
* Codex and Claude do not need this — they launch MCP servers with
|
|
28
|
+
* `cwd = workspace` and pass `rootUri`, respectively.
|
|
29
|
+
*
|
|
30
|
+
* No permissions concept — Cursor doesn't have an auto-allow list
|
|
31
|
+
* the installer can populate. `autoAllow` is silently ignored.
|
|
32
|
+
*/
|
|
33
|
+
import { AgentTarget } from './types'
|
|
34
|
+
export declare const cursorTarget: AgentTarget
|
|
35
|
+
//# sourceMappingURL=cursor.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hermes Agent target.
|
|
3
|
+
*
|
|
4
|
+
* Hermes reads MCP servers from `$HERMES_HOME/config.yaml` under the
|
|
5
|
+
* top-level `mcp_servers` key, and exposes discovered MCP tools through
|
|
6
|
+
* dynamic toolsets named `mcp-<server>`. We add:
|
|
7
|
+
*
|
|
8
|
+
* mcp_servers.codegraph -> `codegraph serve --mcp`
|
|
9
|
+
* platform_toolsets.cli -> `mcp-codegraph`
|
|
10
|
+
*
|
|
11
|
+
* The second entry matters because Hermes CLI profiles often enable an
|
|
12
|
+
* explicit `platform_toolsets.cli` list. Without `mcp-codegraph` in that
|
|
13
|
+
* list, the MCP server can be configured and connected but its tools may
|
|
14
|
+
* still be filtered out of normal CLI sessions.
|
|
15
|
+
*/
|
|
16
|
+
import { AgentTarget } from './types'
|
|
17
|
+
export declare const hermesTarget: AgentTarget
|
|
18
|
+
//# sourceMappingURL=hermes.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* opencode target.
|
|
3
|
+
*
|
|
4
|
+
* - MCP server entry to `~/.config/opencode/opencode.jsonc` (global,
|
|
5
|
+
* XDG-style; `%APPDATA%/opencode/opencode.jsonc` on Windows) or
|
|
6
|
+
* `./opencode.jsonc` (local). Falls back to `opencode.json` when a
|
|
7
|
+
* `.json` file already exists; defaults new installs to `.jsonc`
|
|
8
|
+
* because that's what opencode itself creates on first run.
|
|
9
|
+
* - Instructions to `~/.config/opencode/AGENTS.md` (global) or
|
|
10
|
+
* `./AGENTS.md` (local). opencode reads AGENTS.md for agent
|
|
11
|
+
* instructions — same convention Codex CLI uses.
|
|
12
|
+
* - No permissions concept.
|
|
13
|
+
*
|
|
14
|
+
* Config shape uses opencode's wrapper:
|
|
15
|
+
* {
|
|
16
|
+
* "$schema": "https://opencode.ai/config.json",
|
|
17
|
+
* "mcp": { "codegraph": { "type": "local", "command": [...], "enabled": true } }
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* The shape differs from Claude/Cursor — opencode uses `mcp.<name>`
|
|
21
|
+
* (not `mcpServers`), takes `command` as a string array combining
|
|
22
|
+
* binary + args, and includes an explicit `enabled` flag.
|
|
23
|
+
*
|
|
24
|
+
* Reads + writes go through `jsonc-parser` so any `//` and `/* *\/`
|
|
25
|
+
* comments the user has added to their `.jsonc` survive idempotent
|
|
26
|
+
* re-runs.
|
|
27
|
+
*/
|
|
28
|
+
import { AgentTarget } from './types'
|
|
29
|
+
export declare const opencodeTarget: AgentTarget
|
|
30
|
+
//# sourceMappingURL=opencode.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry of all known agent targets.
|
|
3
|
+
*
|
|
4
|
+
* Adding a new target = create `targets/<id>.ts` exporting an
|
|
5
|
+
* `AgentTarget`, then add it to the array below. Order here is the
|
|
6
|
+
* order they appear in the multiselect prompt, in `--target=all`,
|
|
7
|
+
* and in `--print-config`'s help listing — keep it stable.
|
|
8
|
+
*/
|
|
9
|
+
import { AgentTarget, Location, TargetId } from './types'
|
|
10
|
+
export declare const ALL_TARGETS: readonly AgentTarget[]
|
|
11
|
+
export declare function getTarget(id: string): AgentTarget | undefined
|
|
12
|
+
export declare function listTargetIds(): TargetId[]
|
|
13
|
+
/**
|
|
14
|
+
* Run `detect()` for every target at the given location. Returns the
|
|
15
|
+
* full registry zipped with detection results — orchestrator uses
|
|
16
|
+
* this to seed the multiselect prompt with installed agents
|
|
17
|
+
* pre-checked.
|
|
18
|
+
*/
|
|
19
|
+
export declare function detectAll(loc: Location): Array<{
|
|
20
|
+
target: AgentTarget
|
|
21
|
+
detection: ReturnType<AgentTarget['detect']>
|
|
22
|
+
}>
|
|
23
|
+
/**
|
|
24
|
+
* Resolve a `--target=` flag value to a list of `AgentTarget`
|
|
25
|
+
* instances. Accepts:
|
|
26
|
+
*
|
|
27
|
+
* - `auto` — return all targets whose `detect().installed` is true,
|
|
28
|
+
* or `['claude']` as a fallback if none detected (least-surprise
|
|
29
|
+
* for existing users).
|
|
30
|
+
* - `all` — every target in the registry.
|
|
31
|
+
* - `none` — empty list (caller skips agent writes entirely).
|
|
32
|
+
* - csv list — `'claude,cursor'` etc. Unknown ids throw.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveTargetFlag(
|
|
35
|
+
value: string,
|
|
36
|
+
loc: Location,
|
|
37
|
+
): AgentTarget[]
|
|
38
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers shared across `AgentTarget` implementations.
|
|
3
|
+
*
|
|
4
|
+
* Lifted from the original `config-writer.ts` so each target can
|
|
5
|
+
* compose them without inheritance. Kept deliberately small — the
|
|
6
|
+
* targets are different enough (JSON vs TOML vs Markdown, varying
|
|
7
|
+
* idempotency markers) that a base class would force the awkward
|
|
8
|
+
* shape onto everyone.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The MCP-server config block codegraph injects. Same shape across
|
|
12
|
+
* all JSON-shaped agent configs (Claude, Cursor, opencode), only the
|
|
13
|
+
* surrounding wrapper differs. Codex (TOML) builds its own block.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getMcpServerConfig(): {
|
|
16
|
+
type: string
|
|
17
|
+
command: string
|
|
18
|
+
args: string[]
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Permissions list for Claude `settings.json`. Other targets that
|
|
22
|
+
* have a permissions concept can compose this list directly. The
|
|
23
|
+
* permission strings follow Claude's `mcp__<server>__<tool>` format.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getCodeGraphPermissions(): string[]
|
|
26
|
+
/**
|
|
27
|
+
* Read a JSON file, returning `{}` when missing or unparseable.
|
|
28
|
+
*
|
|
29
|
+
* Unparseable files are backed up to `<path>.backup` BEFORE we return
|
|
30
|
+
* `{}` — so an idempotent re-run never silently deletes a user's
|
|
31
|
+
* existing config that happened to break JSON parse temporarily.
|
|
32
|
+
*/
|
|
33
|
+
export declare function readJsonFile(filePath: string): Record<string, any>
|
|
34
|
+
/**
|
|
35
|
+
* Write a file atomically: write to `<path>.tmp.<pid>`, then rename.
|
|
36
|
+
*
|
|
37
|
+
* Prevents corruption if the process crashes mid-write. The temp
|
|
38
|
+
* file is cleaned up on rename failure.
|
|
39
|
+
*/
|
|
40
|
+
export declare function atomicWriteFileSync(
|
|
41
|
+
filePath: string,
|
|
42
|
+
content: string,
|
|
43
|
+
): void
|
|
44
|
+
/**
|
|
45
|
+
* Atomic JSON write. Trailing newline matches the convention every
|
|
46
|
+
* existing target had — preserves diff-friendly file shape.
|
|
47
|
+
*/
|
|
48
|
+
export declare function writeJsonFile(
|
|
49
|
+
filePath: string,
|
|
50
|
+
data: Record<string, any>,
|
|
51
|
+
): void
|
|
52
|
+
/**
|
|
53
|
+
* Compare two JSON values for deep equality, ignoring key order.
|
|
54
|
+
*
|
|
55
|
+
* Used for idempotency: when the on-disk config already exactly
|
|
56
|
+
* matches what we'd write, return action=`unchanged` instead of
|
|
57
|
+
* re-writing (and emitting a confusing "Updated" log line).
|
|
58
|
+
*/
|
|
59
|
+
export declare function jsonDeepEqual(a: unknown, b: unknown): boolean
|
|
60
|
+
/**
|
|
61
|
+
* Replace or append a marker-delimited section in a markdown-ish file.
|
|
62
|
+
*
|
|
63
|
+
* Used by Claude / Codex for the `<!-- CODEGRAPH_START --> ... <!--
|
|
64
|
+
* CODEGRAPH_END -->` block. Preserves all content outside the
|
|
65
|
+
* markers verbatim.
|
|
66
|
+
*
|
|
67
|
+
* Returns `created` when the file didn't exist; `updated` when
|
|
68
|
+
* markers were found and content swapped; `appended` when markers
|
|
69
|
+
* weren't found and section was added at end. `unchanged` when the
|
|
70
|
+
* existing block already matches `body`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function replaceOrAppendMarkedSection(
|
|
73
|
+
filePath: string,
|
|
74
|
+
body: string,
|
|
75
|
+
startMarker: string,
|
|
76
|
+
endMarker: string,
|
|
77
|
+
): 'created' | 'updated' | 'appended' | 'unchanged'
|
|
78
|
+
/**
|
|
79
|
+
* Inverse of `replaceOrAppendMarkedSection`. Strips the marker
|
|
80
|
+
* block from `filePath` if present. If the file becomes empty after
|
|
81
|
+
* removal, deletes the file entirely (matches the existing Claude
|
|
82
|
+
* uninstall behavior).
|
|
83
|
+
*
|
|
84
|
+
* Returns `removed` when content was stripped, `not-found` when
|
|
85
|
+
* the markers weren't present, `kept` when the file didn't exist.
|
|
86
|
+
*/
|
|
87
|
+
export declare function removeMarkedSection(
|
|
88
|
+
filePath: string,
|
|
89
|
+
startMarker: string,
|
|
90
|
+
endMarker: string,
|
|
91
|
+
): 'removed' | 'not-found' | 'kept'
|
|
92
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny TOML helpers — just enough to inject / replace / remove a
|
|
3
|
+
* single dotted-key table block (`[mcp_servers.codegraph]`) inside an
|
|
4
|
+
* existing `~/.codex/config.toml`. We deliberately do NOT try to be a
|
|
5
|
+
* general TOML parser/serializer; that would mean pulling in a
|
|
6
|
+
* dependency (~50KB) for ~6 lines of output.
|
|
7
|
+
*
|
|
8
|
+
* Strategy: treat the file as text. Find the `[mcp_servers.codegraph]`
|
|
9
|
+
* header line, splice it (and the lines that follow it until the next
|
|
10
|
+
* `[...]` header or EOF) in or out. Everything outside that block is
|
|
11
|
+
* preserved verbatim, byte-for-byte.
|
|
12
|
+
*
|
|
13
|
+
* Limitations (acceptable for our narrow use):
|
|
14
|
+
* - Only handles top-level table headers; not array-of-tables or
|
|
15
|
+
* subtables nested inside `[mcp_servers]` itself (we always write
|
|
16
|
+
* the full dotted key `[mcp_servers.codegraph]`).
|
|
17
|
+
* - Doesn't validate sibling TOML — if the file is malformed
|
|
18
|
+
* elsewhere, our injection won't fix it but won't make it worse.
|
|
19
|
+
* - Quotes string values with double quotes; escapes `\` and `"`.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Serialize a record into the body lines of a TOML table. Values
|
|
23
|
+
* supported: string, string[]. Other types throw — the codex MCP
|
|
24
|
+
* config only needs these two.
|
|
25
|
+
*/
|
|
26
|
+
export declare function serializeTomlTableBody(
|
|
27
|
+
values: Record<string, string | string[]>,
|
|
28
|
+
): string
|
|
29
|
+
/**
|
|
30
|
+
* Build a full table block: header line + body. Suitable for direct
|
|
31
|
+
* insertion into a TOML file.
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildTomlTable(
|
|
34
|
+
header: string,
|
|
35
|
+
values: Record<string, string | string[]>,
|
|
36
|
+
): string
|
|
37
|
+
/**
|
|
38
|
+
* Insert or replace a top-level dotted-key TOML table block in the
|
|
39
|
+
* given file content. Preserves all other content verbatim.
|
|
40
|
+
*
|
|
41
|
+
* Returns `'inserted'` when the table was newly added, `'replaced'`
|
|
42
|
+
* when an existing one was rewritten, `'unchanged'` when the
|
|
43
|
+
* existing block already matches `block` byte-for-byte.
|
|
44
|
+
*/
|
|
45
|
+
export declare function upsertTomlTable(
|
|
46
|
+
fileContent: string,
|
|
47
|
+
header: string,
|
|
48
|
+
block: string,
|
|
49
|
+
): {
|
|
50
|
+
content: string
|
|
51
|
+
action: 'inserted' | 'replaced' | 'unchanged'
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Remove a top-level dotted-key TOML table block. Returns the
|
|
55
|
+
* possibly-empty new content + an action flag.
|
|
56
|
+
*/
|
|
57
|
+
export declare function removeTomlTable(
|
|
58
|
+
fileContent: string,
|
|
59
|
+
header: string,
|
|
60
|
+
): {
|
|
61
|
+
content: string
|
|
62
|
+
action: 'removed' | 'not-found'
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=toml.d.ts.map
|