@colbymchenry/codegraph 0.7.6 → 0.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +35 -10
  2. package/dist/bin/codegraph.js +72 -4
  3. package/dist/bin/codegraph.js.map +1 -1
  4. package/dist/bin/uninstall.d.ts +7 -7
  5. package/dist/bin/uninstall.d.ts.map +1 -1
  6. package/dist/bin/uninstall.js +23 -135
  7. package/dist/bin/uninstall.js.map +1 -1
  8. package/dist/installer/claude-md-template.d.ts +10 -6
  9. package/dist/installer/claude-md-template.d.ts.map +1 -1
  10. package/dist/installer/claude-md-template.js +15 -40
  11. package/dist/installer/claude-md-template.js.map +1 -1
  12. package/dist/installer/config-writer.d.ts +17 -24
  13. package/dist/installer/config-writer.d.ts.map +1 -1
  14. package/dist/installer/config-writer.js +44 -239
  15. package/dist/installer/config-writer.js.map +1 -1
  16. package/dist/installer/index.d.ts +45 -4
  17. package/dist/installer/index.d.ts.map +1 -1
  18. package/dist/installer/index.js +214 -78
  19. package/dist/installer/index.js.map +1 -1
  20. package/dist/installer/instructions-template.d.ts +28 -0
  21. package/dist/installer/instructions-template.d.ts.map +1 -0
  22. package/dist/installer/instructions-template.js +63 -0
  23. package/dist/installer/instructions-template.js.map +1 -0
  24. package/dist/installer/targets/claude.d.ts +27 -0
  25. package/dist/installer/targets/claude.d.ts.map +1 -0
  26. package/dist/installer/targets/claude.js +246 -0
  27. package/dist/installer/targets/claude.js.map +1 -0
  28. package/dist/installer/targets/codex.d.ts +18 -0
  29. package/dist/installer/targets/codex.d.ts.map +1 -0
  30. package/dist/installer/targets/codex.js +185 -0
  31. package/dist/installer/targets/codex.js.map +1 -0
  32. package/dist/installer/targets/cursor.d.ts +35 -0
  33. package/dist/installer/targets/cursor.d.ts.map +1 -0
  34. package/dist/installer/targets/cursor.js +229 -0
  35. package/dist/installer/targets/cursor.js.map +1 -0
  36. package/dist/installer/targets/opencode.d.ts +30 -0
  37. package/dist/installer/targets/opencode.d.ts.map +1 -0
  38. package/dist/installer/targets/opencode.js +235 -0
  39. package/dist/installer/targets/opencode.js.map +1 -0
  40. package/dist/installer/targets/registry.d.ts +35 -0
  41. package/dist/installer/targets/registry.d.ts.map +1 -0
  42. package/dist/installer/targets/registry.js +83 -0
  43. package/dist/installer/targets/registry.js.map +1 -0
  44. package/dist/installer/targets/shared.d.ts +77 -0
  45. package/dist/installer/targets/shared.d.ts.map +1 -0
  46. package/dist/installer/targets/shared.js +246 -0
  47. package/dist/installer/targets/shared.js.map +1 -0
  48. package/dist/installer/targets/toml.d.ts +52 -0
  49. package/dist/installer/targets/toml.d.ts.map +1 -0
  50. package/dist/installer/targets/toml.js +147 -0
  51. package/dist/installer/targets/toml.js.map +1 -0
  52. package/dist/installer/targets/types.d.ts +116 -0
  53. package/dist/installer/targets/types.d.ts.map +1 -0
  54. package/dist/installer/targets/types.js +16 -0
  55. package/dist/installer/targets/types.js.map +1 -0
  56. package/package.json +2 -1
  57. package/scripts/local-install.sh +41 -0
  58. package/scripts/release.sh +70 -0
@@ -1,46 +1,21 @@
1
1
  "use strict";
2
2
  /**
3
- * CLAUDE.md template for CodeGraph instructions
3
+ * Backwards-compat re-export shim.
4
4
  *
5
- * This template is injected into ~/.claude/CLAUDE.md (global) or ./.claude/CLAUDE.md (local)
6
- * Keep this in sync with the README.md "Recommended: Add Global Instructions" section
5
+ * The instructions template moved to `instructions-template.ts` so it
6
+ * can be shared across all agent targets (Claude Code, Cursor, Codex
7
+ * CLI, opencode). This file is preserved purely so existing imports
8
+ * (`@colbymchenry/codegraph` consumers, downstream tooling) keep
9
+ * working unchanged. New code should import from
10
+ * `./instructions-template` directly.
11
+ *
12
+ * @deprecated Import from `./instructions-template` instead.
7
13
  */
8
14
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.CLAUDE_MD_TEMPLATE = exports.CODEGRAPH_SECTION_END = exports.CODEGRAPH_SECTION_START = void 0;
10
- // Markers to identify CodeGraph section for updates
11
- exports.CODEGRAPH_SECTION_START = '<!-- CODEGRAPH_START -->';
12
- exports.CODEGRAPH_SECTION_END = '<!-- CODEGRAPH_END -->';
13
- exports.CLAUDE_MD_TEMPLATE = `${exports.CODEGRAPH_SECTION_START}
14
- ## CodeGraph
15
-
16
- CodeGraph builds a semantic knowledge graph of codebases for faster, smarter code exploration.
17
-
18
- ### If \`.codegraph/\` exists in the project
19
-
20
- **NEVER call \`codegraph_explore\` or \`codegraph_context\` directly in the main session.** These tools return large amounts of source code that fills up main session context. Instead, ALWAYS spawn an Explore agent for any exploration question (e.g., "how does X work?", "explain the Y system", "where is Z implemented?").
21
-
22
- **When spawning Explore agents**, include this instruction in the prompt:
23
-
24
- > This project has CodeGraph initialized (.codegraph/ exists). Use \`codegraph_explore\` as your PRIMARY tool — it returns full source code sections from all relevant files in one call.
25
- >
26
- > **Rules:**
27
- > 1. Follow the explore call budget in the \`codegraph_explore\` tool description — it scales automatically based on project size.
28
- > 2. Do NOT re-read files that codegraph_explore already returned source code for. The source sections are complete and authoritative.
29
- > 3. Only fall back to grep/glob/read for files listed under "Additional relevant files" if you need more detail, or if codegraph returned no results.
30
-
31
- **The main session may only use these lightweight tools directly** (for targeted lookups before making edits, not for exploration):
32
-
33
- | Tool | Use For |
34
- |------|---------|
35
- | \`codegraph_search\` | Find symbols by name |
36
- | \`codegraph_callers\` / \`codegraph_callees\` | Trace call flow |
37
- | \`codegraph_impact\` | Check what's affected before editing |
38
- | \`codegraph_node\` | Get a single symbol's details |
39
-
40
- ### If \`.codegraph/\` does NOT exist
41
-
42
- At the start of a session, ask the user if they'd like to initialize CodeGraph:
43
-
44
- "I notice this project doesn't have CodeGraph initialized. Would you like me to run \`codegraph init -i\` to build a code knowledge graph?"
45
- ${exports.CODEGRAPH_SECTION_END}`;
15
+ exports.INSTRUCTIONS_TEMPLATE = exports.CLAUDE_MD_TEMPLATE = exports.CODEGRAPH_SECTION_END = exports.CODEGRAPH_SECTION_START = void 0;
16
+ var instructions_template_1 = require("./instructions-template");
17
+ Object.defineProperty(exports, "CODEGRAPH_SECTION_START", { enumerable: true, get: function () { return instructions_template_1.CODEGRAPH_SECTION_START; } });
18
+ Object.defineProperty(exports, "CODEGRAPH_SECTION_END", { enumerable: true, get: function () { return instructions_template_1.CODEGRAPH_SECTION_END; } });
19
+ Object.defineProperty(exports, "CLAUDE_MD_TEMPLATE", { enumerable: true, get: function () { return instructions_template_1.CLAUDE_MD_TEMPLATE; } });
20
+ Object.defineProperty(exports, "INSTRUCTIONS_TEMPLATE", { enumerable: true, get: function () { return instructions_template_1.INSTRUCTIONS_TEMPLATE; } });
46
21
  //# sourceMappingURL=claude-md-template.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude-md-template.js","sourceRoot":"","sources":["../../src/installer/claude-md-template.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,oDAAoD;AACvC,QAAA,uBAAuB,GAAG,0BAA0B,CAAC;AACrD,QAAA,qBAAqB,GAAG,wBAAwB,CAAC;AAEjD,QAAA,kBAAkB,GAAG,GAAG,+BAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgC1D,6BAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"claude-md-template.js","sourceRoot":"","sources":["../../src/installer/claude-md-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,iEAKiC;AAJ/B,gIAAA,uBAAuB,OAAA;AACvB,8HAAA,qBAAqB,OAAA;AACrB,2HAAA,kBAAkB,OAAA;AAClB,8HAAA,qBAAqB,OAAA"}
@@ -1,36 +1,29 @@
1
1
  /**
2
- * Config file writing for the CodeGraph installer
3
- * Writes to claude.json, settings.json, and CLAUDE.md
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.
4
12
  */
5
13
  export type InstallLocation = 'global' | 'local';
6
14
  /**
7
- * Write the MCP server configuration to claude.json
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.
8
19
  */
9
20
  export declare function writeMcpConfig(location: InstallLocation): void;
10
- /**
11
- * Write permissions to settings.json
12
- */
13
21
  export declare function writePermissions(location: InstallLocation): void;
14
- /**
15
- * Check if MCP config already exists for CodeGraph
16
- */
17
- export declare function hasMcpConfig(location: InstallLocation): boolean;
18
- /**
19
- * Check if permissions already exist for CodeGraph
20
- */
21
- export declare function hasPermissions(location: InstallLocation): boolean;
22
- /**
23
- * Check if CLAUDE.md has CodeGraph section
24
- */
25
- export declare function hasClaudeMdSection(location: InstallLocation): boolean;
26
- /**
27
- * Write or update CLAUDE.md with CodeGraph instructions
28
- *
29
- * If the file exists and has a CodeGraph section (marked or unmarked),
30
- * it will be replaced. Otherwise, the template is appended.
31
- */
32
22
  export declare function writeClaudeMd(location: InstallLocation): {
33
23
  created: boolean;
34
24
  updated: boolean;
35
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;
36
29
  //# sourceMappingURL=config-writer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-writer.d.ts","sourceRoot":"","sources":["../../src/installer/config-writer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,CAAC;AAsGjD;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAa9D;AAiBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAuBhE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAI/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CASjE;AAYD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAWrE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,eAAe,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAiE/F"}
1
+ {"version":3,"file":"config-writer.d.ts","sourceRoot":"","sources":["../../src/installer/config-writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAE9D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAEhE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,eAAe,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAM/F;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAM/D;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAQjE;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAWrE"}
@@ -1,7 +1,15 @@
1
1
  "use strict";
2
2
  /**
3
- * Config file writing for the CodeGraph installer
4
- * Writes to claude.json, settings.json, and CLAUDE.md
3
+ * Backwards-compat shim original Claude-only writer functions.
4
+ *
5
+ * The installer now uses the multi-target architecture in
6
+ * `./targets/`. This file is preserved so existing imports (the test
7
+ * suite, downstream tooling) keep working unchanged. Each function
8
+ * delegates to the Claude target. New code should import the target
9
+ * registry from `./targets/registry` directly.
10
+ *
11
+ * @deprecated Use `targets/registry.ts` and the `AgentTarget`
12
+ * abstraction instead.
5
13
  */
6
14
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
15
  if (k2 === undefined) k2 = k;
@@ -39,266 +47,63 @@ var __importStar = (this && this.__importStar) || (function () {
39
47
  Object.defineProperty(exports, "__esModule", { value: true });
40
48
  exports.writeMcpConfig = writeMcpConfig;
41
49
  exports.writePermissions = writePermissions;
50
+ exports.writeClaudeMd = writeClaudeMd;
42
51
  exports.hasMcpConfig = hasMcpConfig;
43
52
  exports.hasPermissions = hasPermissions;
44
53
  exports.hasClaudeMdSection = hasClaudeMdSection;
45
- exports.writeClaudeMd = writeClaudeMd;
46
54
  const fs = __importStar(require("fs"));
47
55
  const path = __importStar(require("path"));
48
56
  const os = __importStar(require("os"));
49
- const claude_md_template_1 = require("./claude-md-template");
50
- /**
51
- * Get the path to the Claude config directory
52
- */
53
- function getClaudeConfigDir(location) {
54
- if (location === 'global') {
55
- return path.join(os.homedir(), '.claude');
56
- }
57
- return path.join(process.cwd(), '.claude');
58
- }
59
- /**
60
- * Get the path to the claude.json file
61
- * - Global: ~/.claude.json (root level)
62
- * - Local: ./.claude.json (project root)
63
- */
64
- function getClaudeJsonPath(location) {
65
- if (location === 'global') {
66
- return path.join(os.homedir(), '.claude.json');
67
- }
68
- return path.join(process.cwd(), '.claude.json');
69
- }
70
- /**
71
- * Get the path to the settings.json file
72
- * - Global: ~/.claude/settings.json
73
- * - Local: ./.claude/settings.json
74
- */
75
- function getSettingsJsonPath(location) {
76
- const configDir = getClaudeConfigDir(location);
77
- return path.join(configDir, 'settings.json');
78
- }
79
- /**
80
- * Read a JSON file, returning an empty object if it doesn't exist.
81
- * Distinguishes between missing files (returns {}) and corrupted
82
- * files (logs warning, returns {}).
83
- */
84
- function readJsonFile(filePath) {
85
- if (!fs.existsSync(filePath)) {
86
- return {};
87
- }
88
- try {
89
- const content = fs.readFileSync(filePath, 'utf-8');
90
- return JSON.parse(content);
91
- }
92
- catch (err) {
93
- const msg = err instanceof Error ? err.message : String(err);
94
- console.warn(` Warning: Could not parse ${path.basename(filePath)}: ${msg}`);
95
- console.warn(` A backup will be created before overwriting.`);
96
- // Create a backup of the corrupted file
97
- try {
98
- const backupPath = filePath + '.backup';
99
- fs.copyFileSync(filePath, backupPath);
100
- }
101
- catch { /* ignore backup failure */ }
102
- return {};
103
- }
104
- }
57
+ const claude_1 = require("./targets/claude");
58
+ const shared_1 = require("./targets/shared");
105
59
  /**
106
- * Write a file atomically by writing to a temp file then renaming.
107
- * Prevents corruption if the process crashes mid-write.
60
+ * Each shim calls ONLY the named per-file helper writeMcpConfig
61
+ * writes only the MCP JSON, writePermissions only settings.json,
62
+ * writeClaudeMd only CLAUDE.md. The full multi-file install lives
63
+ * in `claudeTarget.install()` which the new orchestrator uses.
108
64
  */
109
- function atomicWriteFileSync(filePath, content) {
110
- const dir = path.dirname(filePath);
111
- if (!fs.existsSync(dir)) {
112
- fs.mkdirSync(dir, { recursive: true });
113
- }
114
- const tmpPath = filePath + '.tmp.' + process.pid;
115
- try {
116
- fs.writeFileSync(tmpPath, content);
117
- fs.renameSync(tmpPath, filePath);
118
- }
119
- catch (err) {
120
- // Clean up temp file on failure
121
- try {
122
- fs.unlinkSync(tmpPath);
123
- }
124
- catch { /* ignore */ }
125
- throw err;
126
- }
65
+ function writeMcpConfig(location) {
66
+ (0, claude_1.writeMcpEntry)(location);
127
67
  }
128
- /**
129
- * Write a JSON file, creating parent directories if needed
130
- */
131
- function writeJsonFile(filePath, data) {
132
- atomicWriteFileSync(filePath, JSON.stringify(data, null, 2) + '\n');
68
+ function writePermissions(location) {
69
+ (0, claude_1.writePermissionsEntry)(location);
133
70
  }
134
- /**
135
- * Get the MCP server configuration
136
- */
137
- function getMcpServerConfig() {
71
+ function writeClaudeMd(location) {
72
+ const file = (0, claude_1.writeInstructionsEntry)(location);
138
73
  return {
139
- type: 'stdio',
140
- command: 'codegraph',
141
- args: ['serve', '--mcp'],
74
+ created: file.action === 'created',
75
+ updated: file.action === 'updated',
142
76
  };
143
77
  }
144
- /**
145
- * Write the MCP server configuration to claude.json
146
- */
147
- function writeMcpConfig(location) {
148
- const claudeJsonPath = getClaudeJsonPath(location);
149
- const config = readJsonFile(claudeJsonPath);
150
- // Ensure mcpServers object exists
151
- if (!config.mcpServers) {
152
- config.mcpServers = {};
153
- }
154
- // Add or update codegraph server
155
- config.mcpServers.codegraph = getMcpServerConfig();
156
- writeJsonFile(claudeJsonPath, config);
157
- }
158
- /**
159
- * Get the list of permissions for CodeGraph tools
160
- */
161
- function getCodeGraphPermissions() {
162
- return [
163
- 'mcp__codegraph__codegraph_search',
164
- 'mcp__codegraph__codegraph_context',
165
- 'mcp__codegraph__codegraph_callers',
166
- 'mcp__codegraph__codegraph_callees',
167
- 'mcp__codegraph__codegraph_impact',
168
- 'mcp__codegraph__codegraph_node',
169
- 'mcp__codegraph__codegraph_status',
170
- ];
171
- }
172
- /**
173
- * Write permissions to settings.json
174
- */
175
- function writePermissions(location) {
176
- const settingsPath = getSettingsJsonPath(location);
177
- const settings = readJsonFile(settingsPath);
178
- // Ensure permissions object exists
179
- if (!settings.permissions) {
180
- settings.permissions = {};
181
- }
182
- // Ensure allow array exists
183
- if (!Array.isArray(settings.permissions.allow)) {
184
- settings.permissions.allow = [];
185
- }
186
- // Add CodeGraph permissions (avoiding duplicates)
187
- const codegraphPermissions = getCodeGraphPermissions();
188
- for (const permission of codegraphPermissions) {
189
- if (!settings.permissions.allow.includes(permission)) {
190
- settings.permissions.allow.push(permission);
191
- }
192
- }
193
- writeJsonFile(settingsPath, settings);
194
- }
195
- /**
196
- * Check if MCP config already exists for CodeGraph
197
- */
198
78
  function hasMcpConfig(location) {
199
- const claudeJsonPath = getClaudeJsonPath(location);
200
- const config = readJsonFile(claudeJsonPath);
79
+ const file = location === 'global'
80
+ ? path.join(os.homedir(), '.claude.json')
81
+ : path.join(process.cwd(), '.claude.json');
82
+ const config = (0, shared_1.readJsonFile)(file);
201
83
  return !!config.mcpServers?.codegraph;
202
84
  }
203
- /**
204
- * Check if permissions already exist for CodeGraph
205
- */
206
85
  function hasPermissions(location) {
207
- const settingsPath = getSettingsJsonPath(location);
208
- const settings = readJsonFile(settingsPath);
209
- const permissions = settings.permissions?.allow;
210
- if (!Array.isArray(permissions)) {
86
+ const file = location === 'global'
87
+ ? path.join(os.homedir(), '.claude', 'settings.json')
88
+ : path.join(process.cwd(), '.claude', 'settings.json');
89
+ const settings = (0, shared_1.readJsonFile)(file);
90
+ const allow = settings.permissions?.allow;
91
+ if (!Array.isArray(allow))
211
92
  return false;
212
- }
213
- // Check if at least one CodeGraph permission exists
214
- return permissions.some((p) => p.startsWith('mcp__codegraph__'));
215
- }
216
- /**
217
- * Get the path to CLAUDE.md
218
- * - Global: ~/.claude/CLAUDE.md
219
- * - Local: ./.claude/CLAUDE.md
220
- */
221
- function getClaudeMdPath(location) {
222
- const configDir = getClaudeConfigDir(location);
223
- return path.join(configDir, 'CLAUDE.md');
93
+ return allow.some((p) => p.startsWith('mcp__codegraph__'));
224
94
  }
225
- /**
226
- * Check if CLAUDE.md has CodeGraph section
227
- */
228
95
  function hasClaudeMdSection(location) {
229
- const claudeMdPath = getClaudeMdPath(location);
96
+ const file = location === 'global'
97
+ ? path.join(os.homedir(), '.claude', 'CLAUDE.md')
98
+ : path.join(process.cwd(), '.claude', 'CLAUDE.md');
230
99
  try {
231
- if (fs.existsSync(claudeMdPath)) {
232
- const content = fs.readFileSync(claudeMdPath, 'utf-8');
233
- return content.includes(claude_md_template_1.CODEGRAPH_SECTION_START) || content.includes('## CodeGraph');
234
- }
100
+ if (!fs.existsSync(file))
101
+ return false;
102
+ const content = fs.readFileSync(file, 'utf-8');
103
+ return content.includes('<!-- CODEGRAPH_START -->') || content.includes('## CodeGraph');
235
104
  }
236
105
  catch {
237
- // Ignore errors
238
- }
239
- return false;
240
- }
241
- /**
242
- * Write or update CLAUDE.md with CodeGraph instructions
243
- *
244
- * If the file exists and has a CodeGraph section (marked or unmarked),
245
- * it will be replaced. Otherwise, the template is appended.
246
- */
247
- function writeClaudeMd(location) {
248
- const claudeMdPath = getClaudeMdPath(location);
249
- const configDir = getClaudeConfigDir(location);
250
- // Ensure directory exists
251
- if (!fs.existsSync(configDir)) {
252
- fs.mkdirSync(configDir, { recursive: true });
253
- }
254
- // Check if file exists
255
- if (!fs.existsSync(claudeMdPath)) {
256
- // Create new file with just the CodeGraph section
257
- atomicWriteFileSync(claudeMdPath, claude_md_template_1.CLAUDE_MD_TEMPLATE + '\n');
258
- return { created: true, updated: false };
259
- }
260
- // Read existing content
261
- let content = fs.readFileSync(claudeMdPath, 'utf-8');
262
- // Check for marked section (from previous installer)
263
- if (content.includes(claude_md_template_1.CODEGRAPH_SECTION_START)) {
264
- // Replace the marked section
265
- const startIdx = content.indexOf(claude_md_template_1.CODEGRAPH_SECTION_START);
266
- const endIdx = content.indexOf(claude_md_template_1.CODEGRAPH_SECTION_END);
267
- if (endIdx > startIdx) {
268
- // Replace existing marked section
269
- const before = content.substring(0, startIdx);
270
- const after = content.substring(endIdx + claude_md_template_1.CODEGRAPH_SECTION_END.length);
271
- content = before + claude_md_template_1.CLAUDE_MD_TEMPLATE + after;
272
- atomicWriteFileSync(claudeMdPath, content);
273
- return { created: false, updated: true };
274
- }
275
- }
276
- // Check for unmarked "## CodeGraph" section (from manual setup)
277
- const codegraphHeaderRegex = /\n## CodeGraph\n/;
278
- const match = content.match(codegraphHeaderRegex);
279
- if (match && match.index !== undefined) {
280
- // Find the end of the CodeGraph section (next h2 header or end of file)
281
- // Use negative lookahead (?!#) to match "## X" but not "### X"
282
- const sectionStart = match.index;
283
- const afterSection = content.substring(sectionStart + 1);
284
- const nextHeaderMatch = afterSection.match(/\n## (?!#)/);
285
- let sectionEnd;
286
- if (nextHeaderMatch && nextHeaderMatch.index !== undefined) {
287
- sectionEnd = sectionStart + 1 + nextHeaderMatch.index;
288
- }
289
- else {
290
- sectionEnd = content.length;
291
- }
292
- // Replace the section
293
- const before = content.substring(0, sectionStart);
294
- const after = content.substring(sectionEnd);
295
- content = before + '\n' + claude_md_template_1.CLAUDE_MD_TEMPLATE + after;
296
- atomicWriteFileSync(claudeMdPath, content);
297
- return { created: false, updated: true };
106
+ return false;
298
107
  }
299
- // No existing section, append to end
300
- content = content.trimEnd() + '\n\n' + claude_md_template_1.CLAUDE_MD_TEMPLATE + '\n';
301
- atomicWriteFileSync(claudeMdPath, content);
302
- return { created: false, updated: false };
303
108
  }
304
109
  //# sourceMappingURL=config-writer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-writer.js","sourceRoot":"","sources":["../../src/installer/config-writer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GH,wCAaC;AAoBD,4CAuBC;AAKD,oCAIC;AAKD,wCASC;AAeD,gDAWC;AAQD,sCAiEC;AA9RD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,6DAI8B;AAE9B;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAAyB;IACnD,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,QAAyB;IAClD,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,IAAI,CAAC,IAAI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AACH,CAAC"}
@@ -1,12 +1,53 @@
1
1
  /**
2
2
  * CodeGraph Interactive Installer
3
3
  *
4
- * Uses @clack/prompts for a polished interactive CLI experience.
4
+ * Multi-target: writes MCP server config + instructions for the
5
+ * agents the user picks (Claude Code, Cursor, Codex CLI, opencode).
6
+ * Defaults to the Claude-only behavior for backwards compatibility
7
+ * when no targets are explicitly chosen and nothing else is detected.
8
+ *
9
+ * Uses @clack/prompts for the interactive UI; `runInstallerWithOptions`
10
+ * is the non-interactive entry point used by the `--target` /
11
+ * `--print-config` CLI flags.
5
12
  */
6
- import type { InstallLocation } from './config-writer';
13
+ import type { AgentTarget, Location, WriteResult } from './targets/types';
14
+ export { writeMcpConfig, writePermissions, writeClaudeMd, hasMcpConfig, hasPermissions, hasClaudeMdSection, } from './config-writer';
15
+ export type { InstallLocation } from './config-writer';
16
+ export interface RunInstallerOptions {
17
+ /** Comma-separated target list, or `auto` / `all` / `none`. */
18
+ target?: string;
19
+ /** Skip the location prompt; use this value directly. */
20
+ location?: Location;
21
+ /** Skip the auto-allow prompt; use this value directly. */
22
+ autoAllow?: boolean;
23
+ /**
24
+ * Skip every confirm and use defaults: location=global,
25
+ * autoAllow=true, target=auto. For scripting / CI.
26
+ */
27
+ yes?: boolean;
28
+ }
7
29
  /**
8
- * Run the interactive installer
30
+ * Interactive entry point — preserves the historical UX (`codegraph
31
+ * install` with no args goes through the prompts), but now starts
32
+ * the targets multi-select pre-populated with detected agents.
9
33
  */
10
34
  export declare function runInstaller(): Promise<void>;
11
- export type { InstallLocation };
35
+ export declare function runInstallerWithOptions(opts: RunInstallerOptions): Promise<void>;
36
+ /**
37
+ * For every target that has a global config and exposes
38
+ * `wireProjectSurfaces`, write its project-local surfaces (e.g.
39
+ * Cursor's `.cursor/rules/codegraph.mdc`). Idempotent — runs
40
+ * silently when there's nothing to write.
41
+ *
42
+ * Called by `codegraph init` so that a user who ran
43
+ * `codegraph install` once globally doesn't have to re-run it per
44
+ * project to get full agent support.
45
+ *
46
+ * Returns the list of `(target, file)` pairs that were created or
47
+ * updated — caller decides how to surface them.
48
+ */
49
+ export declare function wireProjectSurfacesForGlobalAgents(): Array<{
50
+ target: AgentTarget;
51
+ file: WriteResult['files'][number];
52
+ }>;
12
53
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/installer/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA4BvD;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAyElD;AAoFD,YAAY,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/installer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK1E,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAsBvD,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAElD;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkItF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,IAAI,KAAK,CAAC;IAC1D,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;CACpC,CAAC,CAcD"}