@colbymchenry/codegraph 0.7.10 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -54
- 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 -1232
- 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 -1048
- 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 -1279
- 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 -109
- package/dist/installer/config-writer.js.map +0 -1
- package/dist/installer/index.d.ts +0 -53
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js +0 -338
- 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 -63
- package/dist/installer/instructions-template.js.map +0 -1
- package/dist/installer/targets/claude.d.ts +0 -27
- package/dist/installer/targets/claude.d.ts.map +0 -1
- package/dist/installer/targets/claude.js +0 -246
- 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 -86
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -355
- 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 -59
- package/dist/mcp/server-instructions.js.map +0 -1
- package/dist/mcp/tools.d.ts +0 -200
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js +0 -1319
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/transport.d.ts +0 -89
- package/dist/mcp/transport.d.ts.map +0 -1
- package/dist/mcp/transport.js +0 -170
- 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 -41
- package/dist/resolution/frameworks/index.d.ts.map +0 -1
- package/dist/resolution/frameworks/index.js +0 -129
- 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/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 -347
- package/dist/search/query-utils.js.map +0 -1
- package/dist/sync/index.d.ts +0 -13
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js +0 -17
- package/dist/sync/index.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 -184
- 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/local-install.sh +0 -41
- package/scripts/patch-tree-sitter-dart.js +0 -112
- package/scripts/release.sh +0 -70
|
@@ -1,28 +0,0 @@
|
|
|
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 = "<!-- 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| \"Survey an unfamiliar module/topic\" | `codegraph_explore` |\n| \"What files exist under path/\" | `codegraph_files` |\n| \"Is the index healthy?\" | `codegraph_status` |\n\n### Rules of thumb\n\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- **`codegraph_explore` is the heavy hitter** for unfamiliar areas \u2014 it returns full source from all relevant files in one call, but is token-heavy. If your harness supports parallel subagents (e.g., Claude Code's Task tool), spawn one for explore-class questions to keep main session context clean.\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 -->";
|
|
22
|
-
/**
|
|
23
|
-
* Backwards-compat alias. Existing downstream code may import
|
|
24
|
-
* `CLAUDE_MD_TEMPLATE` from this module via the re-export shim in
|
|
25
|
-
* `claude-md-template.ts`.
|
|
26
|
-
*/
|
|
27
|
-
export declare const CLAUDE_MD_TEMPLATE = "<!-- 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| \"Survey an unfamiliar module/topic\" | `codegraph_explore` |\n| \"What files exist under path/\" | `codegraph_files` |\n| \"Is the index healthy?\" | `codegraph_status` |\n\n### Rules of thumb\n\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- **`codegraph_explore` is the heavy hitter** for unfamiliar areas \u2014 it returns full source from all relevant files in one call, but is token-heavy. If your harness supports parallel subagents (e.g., Claude Code's Task tool), spawn one for explore-class questions to keep main session context clean.\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 -->";
|
|
28
|
-
//# sourceMappingURL=instructions-template.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instructions-template.d.ts","sourceRoot":"","sources":["../../src/installer/instructions-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,4DAA4D;AAC5D,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAClE,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,+wEAgCT,CAAC;AAE1B;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,+wEAAwB,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Agent-instructions template — the markdown body each agent target
|
|
4
|
-
* writes into its conventional instructions file (CLAUDE.md /
|
|
5
|
-
* AGENTS.md / codegraph.mdc / etc.).
|
|
6
|
-
*
|
|
7
|
-
* The body content is identical across agents because the codegraph
|
|
8
|
-
* usage advice is agent-agnostic — only the destination filename and
|
|
9
|
-
* any optional frontmatter (Cursor `.mdc`) varies per target.
|
|
10
|
-
*
|
|
11
|
-
* The legacy `claude-md-template.ts` re-exports these names for
|
|
12
|
-
* backwards compatibility with downstream importers.
|
|
13
|
-
*/
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.CLAUDE_MD_TEMPLATE = exports.INSTRUCTIONS_TEMPLATE = exports.CODEGRAPH_SECTION_END = exports.CODEGRAPH_SECTION_START = void 0;
|
|
16
|
-
/** Markers used by the marker-based section replacement. */
|
|
17
|
-
exports.CODEGRAPH_SECTION_START = '<!-- CODEGRAPH_START -->';
|
|
18
|
-
exports.CODEGRAPH_SECTION_END = '<!-- CODEGRAPH_END -->';
|
|
19
|
-
/**
|
|
20
|
-
* The full marker-delimited block written into each agent's
|
|
21
|
-
* instructions file. Includes the start/end markers so the section
|
|
22
|
-
* can be detected and replaced on re-install.
|
|
23
|
-
*/
|
|
24
|
-
exports.INSTRUCTIONS_TEMPLATE = `${exports.CODEGRAPH_SECTION_START}
|
|
25
|
-
## CodeGraph
|
|
26
|
-
|
|
27
|
-
This 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.
|
|
28
|
-
|
|
29
|
-
### When to prefer codegraph over native search
|
|
30
|
-
|
|
31
|
-
Use codegraph for **structural** questions — 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.
|
|
32
|
-
|
|
33
|
-
| Question | Tool |
|
|
34
|
-
|---|---|
|
|
35
|
-
| "Where is X defined?" / "Find symbol named X" | \`codegraph_search\` |
|
|
36
|
-
| "What calls function Y?" | \`codegraph_callers\` |
|
|
37
|
-
| "What does Y call?" | \`codegraph_callees\` |
|
|
38
|
-
| "What would break if I changed Z?" | \`codegraph_impact\` |
|
|
39
|
-
| "Show me Y's signature / source / docstring" | \`codegraph_node\` |
|
|
40
|
-
| "Give me focused context for a task/area" | \`codegraph_context\` |
|
|
41
|
-
| "Survey an unfamiliar module/topic" | \`codegraph_explore\` |
|
|
42
|
-
| "What files exist under path/" | \`codegraph_files\` |
|
|
43
|
-
| "Is the index healthy?" | \`codegraph_status\` |
|
|
44
|
-
|
|
45
|
-
### Rules of thumb
|
|
46
|
-
|
|
47
|
-
- **Trust codegraph results.** They come from a full AST parse. Do NOT re-verify them with grep — that's slower, less accurate, and wastes context.
|
|
48
|
-
- **Don't grep first** when looking up a symbol by name. \`codegraph_search\` is faster and returns kind + location + signature in one call.
|
|
49
|
-
- **Don't chain \`codegraph_search\` + \`codegraph_node\`** when you just want context — \`codegraph_context\` is one call.
|
|
50
|
-
- **\`codegraph_explore\` is the heavy hitter** for unfamiliar areas — it returns full source from all relevant files in one call, but is token-heavy. If your harness supports parallel subagents (e.g., Claude Code's Task tool), spawn one for explore-class questions to keep main session context clean.
|
|
51
|
-
- **Index lag**: the file watcher debounces ~500ms behind writes; don't re-query immediately after editing a file in the same turn.
|
|
52
|
-
|
|
53
|
-
### If \`.codegraph/\` doesn't exist
|
|
54
|
-
|
|
55
|
-
The 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?"*
|
|
56
|
-
${exports.CODEGRAPH_SECTION_END}`;
|
|
57
|
-
/**
|
|
58
|
-
* Backwards-compat alias. Existing downstream code may import
|
|
59
|
-
* `CLAUDE_MD_TEMPLATE` from this module via the re-export shim in
|
|
60
|
-
* `claude-md-template.ts`.
|
|
61
|
-
*/
|
|
62
|
-
exports.CLAUDE_MD_TEMPLATE = exports.INSTRUCTIONS_TEMPLATE;
|
|
63
|
-
//# sourceMappingURL=instructions-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instructions-template.js","sourceRoot":"","sources":["../../src/installer/instructions-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,4DAA4D;AAC/C,QAAA,uBAAuB,GAAG,0BAA0B,CAAC;AACrD,QAAA,qBAAqB,GAAG,wBAAwB,CAAC;AAE9D;;;;GAIG;AACU,QAAA,qBAAqB,GAAG,GAAG,+BAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgC7D,6BAAqB,EAAE,CAAC;AAE1B;;;;GAIG;AACU,QAAA,kBAAkB,GAAG,6BAAqB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Code target — the historical default. Writes:
|
|
3
|
-
*
|
|
4
|
-
* - MCP server entry to `~/.claude.json` (global) or
|
|
5
|
-
* `./.claude.json` (local).
|
|
6
|
-
* - Permissions to `~/.claude/settings.json` (global) or
|
|
7
|
-
* `./.claude/settings.json` (local), gated on `autoAllow`.
|
|
8
|
-
* - Instructions to `~/.claude/CLAUDE.md` (global) or
|
|
9
|
-
* `./.claude/CLAUDE.md` (local).
|
|
10
|
-
*
|
|
11
|
-
* All paths and shapes ported verbatim from the original
|
|
12
|
-
* `config-writer.ts` so existing Claude Code installs upgrade in
|
|
13
|
-
* place — no migration on disk required.
|
|
14
|
-
*/
|
|
15
|
-
import { AgentTarget, Location, WriteResult } from './types';
|
|
16
|
-
/**
|
|
17
|
-
* Per-file write helpers, exported so the legacy `config-writer.ts`
|
|
18
|
-
* shim can call only the named operation (writeMcpConfig writes ONLY
|
|
19
|
-
* the MCP entry, etc.) instead of `claudeTarget.install()` which
|
|
20
|
-
* writes all three files. Without this split the shims silently
|
|
21
|
-
* cause side effects callers don't expect.
|
|
22
|
-
*/
|
|
23
|
-
export declare function writeMcpEntry(loc: Location): WriteResult['files'][number];
|
|
24
|
-
export declare function writePermissionsEntry(loc: Location): WriteResult['files'][number];
|
|
25
|
-
export declare function writeInstructionsEntry(loc: Location): WriteResult['files'][number];
|
|
26
|
-
export declare const claudeTarget: AgentTarget;
|
|
27
|
-
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/installer/targets/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,EACL,WAAW,EAGX,QAAQ,EACR,WAAW,EACZ,MAAM,SAAS,CAAC;AAqIjB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAqBzE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAoBjF;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CA0ClF;AAED,eAAO,MAAM,YAAY,EAAE,WAAoC,CAAC"}
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Claude Code target — the historical default. Writes:
|
|
4
|
-
*
|
|
5
|
-
* - MCP server entry to `~/.claude.json` (global) or
|
|
6
|
-
* `./.claude.json` (local).
|
|
7
|
-
* - Permissions to `~/.claude/settings.json` (global) or
|
|
8
|
-
* `./.claude/settings.json` (local), gated on `autoAllow`.
|
|
9
|
-
* - Instructions to `~/.claude/CLAUDE.md` (global) or
|
|
10
|
-
* `./.claude/CLAUDE.md` (local).
|
|
11
|
-
*
|
|
12
|
-
* All paths and shapes ported verbatim from the original
|
|
13
|
-
* `config-writer.ts` so existing Claude Code installs upgrade in
|
|
14
|
-
* place — no migration on disk required.
|
|
15
|
-
*/
|
|
16
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
-
}
|
|
22
|
-
Object.defineProperty(o, k2, desc);
|
|
23
|
-
}) : (function(o, m, k, k2) {
|
|
24
|
-
if (k2 === undefined) k2 = k;
|
|
25
|
-
o[k2] = m[k];
|
|
26
|
-
}));
|
|
27
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
-
}) : function(o, v) {
|
|
30
|
-
o["default"] = v;
|
|
31
|
-
});
|
|
32
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
-
var ownKeys = function(o) {
|
|
34
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
-
var ar = [];
|
|
36
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
-
return ar;
|
|
38
|
-
};
|
|
39
|
-
return ownKeys(o);
|
|
40
|
-
};
|
|
41
|
-
return function (mod) {
|
|
42
|
-
if (mod && mod.__esModule) return mod;
|
|
43
|
-
var result = {};
|
|
44
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
-
__setModuleDefault(result, mod);
|
|
46
|
-
return result;
|
|
47
|
-
};
|
|
48
|
-
})();
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.claudeTarget = void 0;
|
|
51
|
-
exports.writeMcpEntry = writeMcpEntry;
|
|
52
|
-
exports.writePermissionsEntry = writePermissionsEntry;
|
|
53
|
-
exports.writeInstructionsEntry = writeInstructionsEntry;
|
|
54
|
-
const fs = __importStar(require("fs"));
|
|
55
|
-
const path = __importStar(require("path"));
|
|
56
|
-
const os = __importStar(require("os"));
|
|
57
|
-
const shared_1 = require("./shared");
|
|
58
|
-
const instructions_template_1 = require("../instructions-template");
|
|
59
|
-
function configDir(loc) {
|
|
60
|
-
return loc === 'global'
|
|
61
|
-
? path.join(os.homedir(), '.claude')
|
|
62
|
-
: path.join(process.cwd(), '.claude');
|
|
63
|
-
}
|
|
64
|
-
function mcpJsonPath(loc) {
|
|
65
|
-
return loc === 'global'
|
|
66
|
-
? path.join(os.homedir(), '.claude.json')
|
|
67
|
-
: path.join(process.cwd(), '.claude.json');
|
|
68
|
-
}
|
|
69
|
-
function settingsJsonPath(loc) {
|
|
70
|
-
return path.join(configDir(loc), 'settings.json');
|
|
71
|
-
}
|
|
72
|
-
function instructionsPath(loc) {
|
|
73
|
-
return path.join(configDir(loc), 'CLAUDE.md');
|
|
74
|
-
}
|
|
75
|
-
class ClaudeCodeTarget {
|
|
76
|
-
id = 'claude';
|
|
77
|
-
displayName = 'Claude Code';
|
|
78
|
-
docsUrl = 'https://docs.claude.com/en/docs/claude-code';
|
|
79
|
-
supportsLocation(_loc) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
detect(loc) {
|
|
83
|
-
const mcpPath = mcpJsonPath(loc);
|
|
84
|
-
const config = (0, shared_1.readJsonFile)(mcpPath);
|
|
85
|
-
const alreadyConfigured = !!config.mcpServers?.codegraph;
|
|
86
|
-
// For "installed" we infer from the existence of either the dir
|
|
87
|
-
// (global) or the project marker file (local). Cheap and avoids
|
|
88
|
-
// shelling out to `claude --version`.
|
|
89
|
-
const installed = loc === 'global'
|
|
90
|
-
? fs.existsSync(configDir(loc)) || fs.existsSync(mcpPath)
|
|
91
|
-
: fs.existsSync(mcpPath) || fs.existsSync(configDir(loc));
|
|
92
|
-
return { installed, alreadyConfigured, configPath: mcpPath };
|
|
93
|
-
}
|
|
94
|
-
install(loc, opts) {
|
|
95
|
-
const files = [];
|
|
96
|
-
// 1. MCP server entry
|
|
97
|
-
files.push(writeMcpEntry(loc));
|
|
98
|
-
// 2. Permissions (only when autoAllow)
|
|
99
|
-
if (opts.autoAllow) {
|
|
100
|
-
files.push(writePermissionsEntry(loc));
|
|
101
|
-
}
|
|
102
|
-
// 3. CLAUDE.md instructions
|
|
103
|
-
files.push(writeInstructionsEntry(loc));
|
|
104
|
-
return { files };
|
|
105
|
-
}
|
|
106
|
-
uninstall(loc) {
|
|
107
|
-
const files = [];
|
|
108
|
-
// 1. MCP server entry
|
|
109
|
-
const mcpPath = mcpJsonPath(loc);
|
|
110
|
-
const config = (0, shared_1.readJsonFile)(mcpPath);
|
|
111
|
-
if (config.mcpServers?.codegraph) {
|
|
112
|
-
delete config.mcpServers.codegraph;
|
|
113
|
-
if (Object.keys(config.mcpServers).length === 0) {
|
|
114
|
-
delete config.mcpServers;
|
|
115
|
-
}
|
|
116
|
-
(0, shared_1.writeJsonFile)(mcpPath, config);
|
|
117
|
-
files.push({ path: mcpPath, action: 'removed' });
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
files.push({ path: mcpPath, action: 'not-found' });
|
|
121
|
-
}
|
|
122
|
-
// 2. Permissions
|
|
123
|
-
const settingsPath = settingsJsonPath(loc);
|
|
124
|
-
const settings = (0, shared_1.readJsonFile)(settingsPath);
|
|
125
|
-
if (Array.isArray(settings.permissions?.allow)) {
|
|
126
|
-
const before = settings.permissions.allow.length;
|
|
127
|
-
settings.permissions.allow = settings.permissions.allow.filter((p) => !p.startsWith('mcp__codegraph__'));
|
|
128
|
-
if (settings.permissions.allow.length !== before) {
|
|
129
|
-
if (settings.permissions.allow.length === 0) {
|
|
130
|
-
delete settings.permissions.allow;
|
|
131
|
-
}
|
|
132
|
-
if (Object.keys(settings.permissions).length === 0) {
|
|
133
|
-
delete settings.permissions;
|
|
134
|
-
}
|
|
135
|
-
(0, shared_1.writeJsonFile)(settingsPath, settings);
|
|
136
|
-
files.push({ path: settingsPath, action: 'removed' });
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
files.push({ path: settingsPath, action: 'not-found' });
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
files.push({ path: settingsPath, action: 'not-found' });
|
|
144
|
-
}
|
|
145
|
-
// 3. Instructions
|
|
146
|
-
const instr = instructionsPath(loc);
|
|
147
|
-
const action = (0, shared_1.removeMarkedSection)(instr, instructions_template_1.CODEGRAPH_SECTION_START, instructions_template_1.CODEGRAPH_SECTION_END);
|
|
148
|
-
files.push({ path: instr, action });
|
|
149
|
-
return { files };
|
|
150
|
-
}
|
|
151
|
-
printConfig(loc) {
|
|
152
|
-
const target = mcpJsonPath(loc);
|
|
153
|
-
const snippet = JSON.stringify({ mcpServers: { codegraph: (0, shared_1.getMcpServerConfig)() } }, null, 2);
|
|
154
|
-
return `# Add to ${target}\n\n${snippet}\n`;
|
|
155
|
-
}
|
|
156
|
-
describePaths(loc) {
|
|
157
|
-
return [mcpJsonPath(loc), settingsJsonPath(loc), instructionsPath(loc)];
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Per-file write helpers, exported so the legacy `config-writer.ts`
|
|
162
|
-
* shim can call only the named operation (writeMcpConfig writes ONLY
|
|
163
|
-
* the MCP entry, etc.) instead of `claudeTarget.install()` which
|
|
164
|
-
* writes all three files. Without this split the shims silently
|
|
165
|
-
* cause side effects callers don't expect.
|
|
166
|
-
*/
|
|
167
|
-
function writeMcpEntry(loc) {
|
|
168
|
-
const file = mcpJsonPath(loc);
|
|
169
|
-
const existing = (0, shared_1.readJsonFile)(file);
|
|
170
|
-
const before = existing.mcpServers?.codegraph;
|
|
171
|
-
const after = (0, shared_1.getMcpServerConfig)();
|
|
172
|
-
if ((0, shared_1.jsonDeepEqual)(before, after)) {
|
|
173
|
-
// Already exactly what we'd write — preserve byte-identical file.
|
|
174
|
-
return { path: file, action: 'unchanged' };
|
|
175
|
-
}
|
|
176
|
-
// 'created' here means: the file itself did not exist before this
|
|
177
|
-
// write. A pre-existing `.claude.json` containing other MCP servers
|
|
178
|
-
// (no `codegraph` key) is 'updated', not 'created' — we're adding
|
|
179
|
-
// an entry to a file that was already there. Codex uses a different
|
|
180
|
-
// idiom (empty-content => 'created') because its config.toml is
|
|
181
|
-
// ours alone to manage.
|
|
182
|
-
const action = before ? 'updated' : (fs.existsSync(file) ? 'updated' : 'created');
|
|
183
|
-
if (!existing.mcpServers)
|
|
184
|
-
existing.mcpServers = {};
|
|
185
|
-
existing.mcpServers.codegraph = after;
|
|
186
|
-
(0, shared_1.writeJsonFile)(file, existing);
|
|
187
|
-
return { path: file, action };
|
|
188
|
-
}
|
|
189
|
-
function writePermissionsEntry(loc) {
|
|
190
|
-
const file = settingsJsonPath(loc);
|
|
191
|
-
const settings = (0, shared_1.readJsonFile)(file);
|
|
192
|
-
const created = !fs.existsSync(file);
|
|
193
|
-
if (!settings.permissions)
|
|
194
|
-
settings.permissions = {};
|
|
195
|
-
if (!Array.isArray(settings.permissions.allow))
|
|
196
|
-
settings.permissions.allow = [];
|
|
197
|
-
const want = (0, shared_1.getCodeGraphPermissions)();
|
|
198
|
-
const before = [...settings.permissions.allow];
|
|
199
|
-
for (const perm of want) {
|
|
200
|
-
if (!settings.permissions.allow.includes(perm)) {
|
|
201
|
-
settings.permissions.allow.push(perm);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
if ((0, shared_1.jsonDeepEqual)(before, settings.permissions.allow) && !created) {
|
|
205
|
-
return { path: file, action: 'unchanged' };
|
|
206
|
-
}
|
|
207
|
-
(0, shared_1.writeJsonFile)(file, settings);
|
|
208
|
-
return { path: file, action: created ? 'created' : 'updated' };
|
|
209
|
-
}
|
|
210
|
-
function writeInstructionsEntry(loc) {
|
|
211
|
-
const file = instructionsPath(loc);
|
|
212
|
-
// Ensure config dir exists (for global ~/.claude/).
|
|
213
|
-
const dir = path.dirname(file);
|
|
214
|
-
if (!fs.existsSync(dir))
|
|
215
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
216
|
-
// Honor the legacy "unmarked ## CodeGraph" rewrite path that the
|
|
217
|
-
// original installer supported (some users hand-pasted a section
|
|
218
|
-
// before markers existed). Detect first and migrate inline.
|
|
219
|
-
if (fs.existsSync(file)) {
|
|
220
|
-
const content = fs.readFileSync(file, 'utf-8');
|
|
221
|
-
if (!content.includes(instructions_template_1.CODEGRAPH_SECTION_START)) {
|
|
222
|
-
const headerMatch = content.match(/\n## CodeGraph\n/);
|
|
223
|
-
if (headerMatch && headerMatch.index !== undefined) {
|
|
224
|
-
const sectionStart = headerMatch.index;
|
|
225
|
-
const after = content.substring(sectionStart + 1);
|
|
226
|
-
const nextHeader = after.match(/\n## (?!#)/);
|
|
227
|
-
const sectionEnd = nextHeader && nextHeader.index !== undefined
|
|
228
|
-
? sectionStart + 1 + nextHeader.index
|
|
229
|
-
: content.length;
|
|
230
|
-
const merged = content.substring(0, sectionStart) +
|
|
231
|
-
'\n' + instructions_template_1.INSTRUCTIONS_TEMPLATE +
|
|
232
|
-
content.substring(sectionEnd);
|
|
233
|
-
(0, shared_1.atomicWriteFileSync)(file, merged);
|
|
234
|
-
return { path: file, action: 'updated' };
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
const action = (0, shared_1.replaceOrAppendMarkedSection)(file, instructions_template_1.INSTRUCTIONS_TEMPLATE, instructions_template_1.CODEGRAPH_SECTION_START, instructions_template_1.CODEGRAPH_SECTION_END);
|
|
239
|
-
// Map the four-state action to WriteResult's action vocabulary.
|
|
240
|
-
const mapped = action === 'created' ? 'created'
|
|
241
|
-
: action === 'unchanged' ? 'unchanged'
|
|
242
|
-
: 'updated';
|
|
243
|
-
return { path: file, action: mapped };
|
|
244
|
-
}
|
|
245
|
-
exports.claudeTarget = new ClaudeCodeTarget();
|
|
246
|
-
//# sourceMappingURL=claude.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../../src/installer/targets/claude.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuJH,sCAqBC;AAED,sDAoBC;AAED,wDA0CC;AA5OD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAQzB,qCASkB;AAClB,oEAIkC;AAElC,SAAS,SAAS,CAAC,GAAa;IAC9B,OAAO,GAAG,KAAK,QAAQ;QACrB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC;QACpC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG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
* 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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/installer/targets/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EACL,WAAW,EAKZ,MAAM,SAAS,CAAC;AA2JjB,eAAO,MAAM,WAAW,EAAE,WAA+B,CAAC"}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* OpenAI Codex CLI target.
|
|
4
|
-
*
|
|
5
|
-
* - MCP server entry to `~/.codex/config.toml` as the dotted-key
|
|
6
|
-
* table `[mcp_servers.codegraph]`. TOML — not JSON — handled by
|
|
7
|
-
* the narrow serializer in `./toml.ts`.
|
|
8
|
-
* - Instructions to `~/.codex/AGENTS.md`.
|
|
9
|
-
*
|
|
10
|
-
* Codex CLI as of 2026-05 has no project-local config concept —
|
|
11
|
-
* everything lives under `~/.codex/`. `supportsLocation('local')`
|
|
12
|
-
* returns false; the orchestrator skips Codex when the user picks
|
|
13
|
-
* the local install location.
|
|
14
|
-
*
|
|
15
|
-
* No permissions concept.
|
|
16
|
-
*/
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
34
|
-
var ownKeys = function(o) {
|
|
35
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36
|
-
var ar = [];
|
|
37
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
38
|
-
return ar;
|
|
39
|
-
};
|
|
40
|
-
return ownKeys(o);
|
|
41
|
-
};
|
|
42
|
-
return function (mod) {
|
|
43
|
-
if (mod && mod.__esModule) return mod;
|
|
44
|
-
var result = {};
|
|
45
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
46
|
-
__setModuleDefault(result, mod);
|
|
47
|
-
return result;
|
|
48
|
-
};
|
|
49
|
-
})();
|
|
50
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
exports.codexTarget = void 0;
|
|
52
|
-
const fs = __importStar(require("fs"));
|
|
53
|
-
const path = __importStar(require("path"));
|
|
54
|
-
const os = __importStar(require("os"));
|
|
55
|
-
const shared_1 = require("./shared");
|
|
56
|
-
const instructions_template_1 = require("../instructions-template");
|
|
57
|
-
const toml_1 = require("./toml");
|
|
58
|
-
const TOML_HEADER = 'mcp_servers.codegraph';
|
|
59
|
-
function configDir() {
|
|
60
|
-
return path.join(os.homedir(), '.codex');
|
|
61
|
-
}
|
|
62
|
-
function tomlConfigPath() {
|
|
63
|
-
return path.join(configDir(), 'config.toml');
|
|
64
|
-
}
|
|
65
|
-
function instructionsPath() {
|
|
66
|
-
return path.join(configDir(), 'AGENTS.md');
|
|
67
|
-
}
|
|
68
|
-
class CodexTarget {
|
|
69
|
-
id = 'codex';
|
|
70
|
-
displayName = 'Codex CLI';
|
|
71
|
-
docsUrl = 'https://github.com/openai/codex';
|
|
72
|
-
supportsLocation(loc) {
|
|
73
|
-
return loc === 'global';
|
|
74
|
-
}
|
|
75
|
-
detect(loc) {
|
|
76
|
-
if (loc !== 'global') {
|
|
77
|
-
return { installed: false, alreadyConfigured: false };
|
|
78
|
-
}
|
|
79
|
-
const tomlPath = tomlConfigPath();
|
|
80
|
-
let alreadyConfigured = false;
|
|
81
|
-
if (fs.existsSync(tomlPath)) {
|
|
82
|
-
try {
|
|
83
|
-
const content = fs.readFileSync(tomlPath, 'utf-8');
|
|
84
|
-
alreadyConfigured = content.includes(`[${TOML_HEADER}]`);
|
|
85
|
-
}
|
|
86
|
-
catch { /* ignore */ }
|
|
87
|
-
}
|
|
88
|
-
const installed = fs.existsSync(configDir());
|
|
89
|
-
return { installed, alreadyConfigured, configPath: tomlPath };
|
|
90
|
-
}
|
|
91
|
-
install(loc, _opts) {
|
|
92
|
-
if (loc !== 'global') {
|
|
93
|
-
return {
|
|
94
|
-
files: [],
|
|
95
|
-
notes: ['Codex CLI has no project-local config — re-run with --location=global to install.'],
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
const files = [];
|
|
99
|
-
files.push(writeMcpEntry());
|
|
100
|
-
files.push(writeInstructionsEntry());
|
|
101
|
-
return { files };
|
|
102
|
-
}
|
|
103
|
-
uninstall(loc) {
|
|
104
|
-
if (loc !== 'global')
|
|
105
|
-
return { files: [] };
|
|
106
|
-
const files = [];
|
|
107
|
-
const tomlPath = tomlConfigPath();
|
|
108
|
-
if (fs.existsSync(tomlPath)) {
|
|
109
|
-
const content = fs.readFileSync(tomlPath, 'utf-8');
|
|
110
|
-
const { content: nextContent, action } = (0, toml_1.removeTomlTable)(content, TOML_HEADER);
|
|
111
|
-
if (action === 'removed') {
|
|
112
|
-
if (nextContent.trim() === '') {
|
|
113
|
-
try {
|
|
114
|
-
fs.unlinkSync(tomlPath);
|
|
115
|
-
}
|
|
116
|
-
catch { /* ignore */ }
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
(0, shared_1.atomicWriteFileSync)(tomlPath, nextContent.trimEnd() + '\n');
|
|
120
|
-
}
|
|
121
|
-
files.push({ path: tomlPath, action: 'removed' });
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
files.push({ path: tomlPath, action: 'not-found' });
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
files.push({ path: tomlPath, action: 'not-found' });
|
|
129
|
-
}
|
|
130
|
-
const instr = instructionsPath();
|
|
131
|
-
const instrAction = (0, shared_1.removeMarkedSection)(instr, instructions_template_1.CODEGRAPH_SECTION_START, instructions_template_1.CODEGRAPH_SECTION_END);
|
|
132
|
-
files.push({ path: instr, action: instrAction });
|
|
133
|
-
return { files };
|
|
134
|
-
}
|
|
135
|
-
printConfig(loc) {
|
|
136
|
-
if (loc !== 'global') {
|
|
137
|
-
return '# Codex CLI has no project-local config — use --location=global.\n';
|
|
138
|
-
}
|
|
139
|
-
const block = buildCodegraphBlock();
|
|
140
|
-
return `# Add to ${tomlConfigPath()}\n\n${block}\n`;
|
|
141
|
-
}
|
|
142
|
-
describePaths(loc) {
|
|
143
|
-
if (loc !== 'global')
|
|
144
|
-
return [];
|
|
145
|
-
return [tomlConfigPath(), instructionsPath()];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function buildCodegraphBlock() {
|
|
149
|
-
const mcp = (0, shared_1.getMcpServerConfig)();
|
|
150
|
-
return (0, toml_1.buildTomlTable)(TOML_HEADER, {
|
|
151
|
-
command: mcp.command,
|
|
152
|
-
args: mcp.args,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
function writeMcpEntry() {
|
|
156
|
-
const file = tomlConfigPath();
|
|
157
|
-
const dir = path.dirname(file);
|
|
158
|
-
if (!fs.existsSync(dir))
|
|
159
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
160
|
-
const block = buildCodegraphBlock();
|
|
161
|
-
// Single read — `existing === ''` derives both "is the file empty
|
|
162
|
-
// or absent" and "what was its content," avoiding a TOCTOU window
|
|
163
|
-
// between two `fs.existsSync` calls.
|
|
164
|
-
const existing = fs.existsSync(file) ? fs.readFileSync(file, 'utf-8') : '';
|
|
165
|
-
const created = existing.length === 0;
|
|
166
|
-
const { content: nextContent, action } = (0, toml_1.upsertTomlTable)(existing, TOML_HEADER, block);
|
|
167
|
-
if (action === 'unchanged') {
|
|
168
|
-
return { path: file, action: 'unchanged' };
|
|
169
|
-
}
|
|
170
|
-
(0, shared_1.atomicWriteFileSync)(file, nextContent);
|
|
171
|
-
return { path: file, action: created ? 'created' : 'updated' };
|
|
172
|
-
}
|
|
173
|
-
function writeInstructionsEntry() {
|
|
174
|
-
const file = instructionsPath();
|
|
175
|
-
const dir = path.dirname(file);
|
|
176
|
-
if (!fs.existsSync(dir))
|
|
177
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
178
|
-
const action = (0, shared_1.replaceOrAppendMarkedSection)(file, instructions_template_1.INSTRUCTIONS_TEMPLATE, instructions_template_1.CODEGRAPH_SECTION_START, instructions_template_1.CODEGRAPH_SECTION_END);
|
|
179
|
-
const mapped = action === 'created' ? 'created'
|
|
180
|
-
: action === 'unchanged' ? 'unchanged'
|
|
181
|
-
: 'updated';
|
|
182
|
-
return { path: file, action: mapped };
|
|
183
|
-
}
|
|
184
|
-
exports.codexTarget = new CodexTarget();
|
|
185
|
-
//# sourceMappingUR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AAE,CAAC;AACjE,CAAC;AAED,SAAS,sBAAsB;IAC7B,MAAM,IAAI,GAAG,gBAAgB,EAAE,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhE,MAAM,MAAM,GAAG,IAAA,qCAA4B,EACzC,IAAI,EACJ,6CAAqB,EACrB,+CAAuB,EACvB,6CAAqB,CACtB,CAAC;IACF,MAAM,MAAM,GACV,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS;QAC9B,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW;YACpC,CAAC,CAAC,SAAS,CAAC;IAClB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC;AAEY,QAAA,WAAW,GAAgB,IAAI,WAAW,EAAE,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|