@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.
- package/README.md +35 -10
- package/dist/bin/codegraph.js +72 -4
- package/dist/bin/codegraph.js.map +1 -1
- package/dist/bin/uninstall.d.ts +7 -7
- package/dist/bin/uninstall.d.ts.map +1 -1
- package/dist/bin/uninstall.js +23 -135
- package/dist/bin/uninstall.js.map +1 -1
- package/dist/installer/claude-md-template.d.ts +10 -6
- package/dist/installer/claude-md-template.d.ts.map +1 -1
- package/dist/installer/claude-md-template.js +15 -40
- package/dist/installer/claude-md-template.js.map +1 -1
- package/dist/installer/config-writer.d.ts +17 -24
- package/dist/installer/config-writer.d.ts.map +1 -1
- package/dist/installer/config-writer.js +44 -239
- package/dist/installer/config-writer.js.map +1 -1
- package/dist/installer/index.d.ts +45 -4
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +214 -78
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/instructions-template.d.ts +28 -0
- package/dist/installer/instructions-template.d.ts.map +1 -0
- package/dist/installer/instructions-template.js +63 -0
- package/dist/installer/instructions-template.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +27 -0
- package/dist/installer/targets/claude.d.ts.map +1 -0
- package/dist/installer/targets/claude.js +246 -0
- package/dist/installer/targets/claude.js.map +1 -0
- package/dist/installer/targets/codex.d.ts +18 -0
- package/dist/installer/targets/codex.d.ts.map +1 -0
- package/dist/installer/targets/codex.js +185 -0
- package/dist/installer/targets/codex.js.map +1 -0
- package/dist/installer/targets/cursor.d.ts +35 -0
- package/dist/installer/targets/cursor.d.ts.map +1 -0
- package/dist/installer/targets/cursor.js +229 -0
- package/dist/installer/targets/cursor.js.map +1 -0
- package/dist/installer/targets/opencode.d.ts +30 -0
- package/dist/installer/targets/opencode.d.ts.map +1 -0
- package/dist/installer/targets/opencode.js +235 -0
- package/dist/installer/targets/opencode.js.map +1 -0
- package/dist/installer/targets/registry.d.ts +35 -0
- package/dist/installer/targets/registry.d.ts.map +1 -0
- package/dist/installer/targets/registry.js +83 -0
- package/dist/installer/targets/registry.js.map +1 -0
- package/dist/installer/targets/shared.d.ts +77 -0
- package/dist/installer/targets/shared.d.ts.map +1 -0
- package/dist/installer/targets/shared.js +246 -0
- package/dist/installer/targets/shared.js.map +1 -0
- package/dist/installer/targets/toml.d.ts +52 -0
- package/dist/installer/targets/toml.d.ts.map +1 -0
- package/dist/installer/targets/toml.js +147 -0
- package/dist/installer/targets/toml.js.map +1 -0
- package/dist/installer/targets/types.d.ts +116 -0
- package/dist/installer/targets/types.d.ts.map +1 -0
- package/dist/installer/targets/types.js +16 -0
- package/dist/installer/targets/types.js.map +1 -0
- package/package.json +2 -1
- package/scripts/local-install.sh +41 -0
- package/scripts/release.sh +70 -0
package/dist/installer/index.js
CHANGED
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* CodeGraph Interactive Installer
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Multi-target: writes MCP server config + instructions for the
|
|
6
|
+
* agents the user picks (Claude Code, Cursor, Codex CLI, opencode).
|
|
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.
|
|
6
13
|
*/
|
|
7
14
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
15
|
if (k2 === undefined) k2 = k;
|
|
@@ -38,24 +45,31 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
45
|
};
|
|
39
46
|
})();
|
|
40
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.hasClaudeMdSection = exports.hasPermissions = exports.hasMcpConfig = exports.writeClaudeMd = exports.writePermissions = exports.writeMcpConfig = void 0;
|
|
41
49
|
exports.runInstaller = runInstaller;
|
|
50
|
+
exports.runInstallerWithOptions = runInstallerWithOptions;
|
|
51
|
+
exports.wireProjectSurfacesForGlobalAgents = wireProjectSurfacesForGlobalAgents;
|
|
42
52
|
const child_process_1 = require("child_process");
|
|
43
53
|
const path = __importStar(require("path"));
|
|
44
54
|
const fs = __importStar(require("fs"));
|
|
45
|
-
const
|
|
55
|
+
const registry_1 = require("./targets/registry");
|
|
56
|
+
// Backwards-compat: keep these named exports — downstream code may
|
|
57
|
+
// import them. The shim in `config-writer.ts` continues to re-export
|
|
58
|
+
// them too.
|
|
59
|
+
var config_writer_1 = require("./config-writer");
|
|
60
|
+
Object.defineProperty(exports, "writeMcpConfig", { enumerable: true, get: function () { return config_writer_1.writeMcpConfig; } });
|
|
61
|
+
Object.defineProperty(exports, "writePermissions", { enumerable: true, get: function () { return config_writer_1.writePermissions; } });
|
|
62
|
+
Object.defineProperty(exports, "writeClaudeMd", { enumerable: true, get: function () { return config_writer_1.writeClaudeMd; } });
|
|
63
|
+
Object.defineProperty(exports, "hasMcpConfig", { enumerable: true, get: function () { return config_writer_1.hasMcpConfig; } });
|
|
64
|
+
Object.defineProperty(exports, "hasPermissions", { enumerable: true, get: function () { return config_writer_1.hasPermissions; } });
|
|
65
|
+
Object.defineProperty(exports, "hasClaudeMdSection", { enumerable: true, get: function () { return config_writer_1.hasClaudeMdSection; } });
|
|
46
66
|
// Dynamic import helper — tsc compiles import() to require() in CJS mode,
|
|
47
67
|
// which fails for ESM-only packages. This bypasses the transformation.
|
|
48
68
|
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
49
69
|
const importESM = new Function('specifier', 'return import(specifier)');
|
|
50
|
-
/**
|
|
51
|
-
* Format a number with commas
|
|
52
|
-
*/
|
|
53
70
|
function formatNumber(n) {
|
|
54
71
|
return n.toLocaleString();
|
|
55
72
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Get the package version
|
|
58
|
-
*/
|
|
59
73
|
function getVersion() {
|
|
60
74
|
try {
|
|
61
75
|
const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');
|
|
@@ -67,103 +81,225 @@ function getVersion() {
|
|
|
67
81
|
}
|
|
68
82
|
}
|
|
69
83
|
/**
|
|
70
|
-
*
|
|
84
|
+
* Interactive entry point — preserves the historical UX (`codegraph
|
|
85
|
+
* install` with no args goes through the prompts), but now starts
|
|
86
|
+
* the targets multi-select pre-populated with detected agents.
|
|
71
87
|
*/
|
|
72
88
|
async function runInstaller() {
|
|
89
|
+
return runInstallerWithOptions({});
|
|
90
|
+
}
|
|
91
|
+
async function runInstallerWithOptions(opts) {
|
|
73
92
|
const clack = await importESM('@clack/prompts');
|
|
74
93
|
clack.intro(`CodeGraph v${getVersion()}`);
|
|
75
|
-
//
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
// --yes implies all defaults; explicit flags still win.
|
|
95
|
+
const useDefaults = opts.yes === true;
|
|
96
|
+
// Step 1: which agent targets? Asked FIRST so the user knows what
|
|
97
|
+
// they're committing to before we touch npm or disk. Detection
|
|
98
|
+
// probes the user-provided location if known, else 'global' as the
|
|
99
|
+
// most common default — labels are a hint, not load-bearing.
|
|
100
|
+
const detectionLocation = opts.location ?? 'global';
|
|
101
|
+
const targets = await resolveTargets(clack, opts, detectionLocation, useDefaults);
|
|
102
|
+
if (targets.length === 0) {
|
|
103
|
+
clack.outro('No agent targets selected — nothing to do.');
|
|
104
|
+
return;
|
|
83
105
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
106
|
+
// Step 2: install the codegraph npm package on PATH (always offered;
|
|
107
|
+
// matches existing behavior). Skipped when --yes (assume present).
|
|
108
|
+
if (!useDefaults) {
|
|
109
|
+
const shouldInstallGlobally = await clack.confirm({
|
|
110
|
+
message: 'Install the codegraph CLI on your PATH? (Required so agents can launch the MCP server)',
|
|
111
|
+
initialValue: true,
|
|
112
|
+
});
|
|
113
|
+
if (clack.isCancel(shouldInstallGlobally)) {
|
|
114
|
+
clack.cancel('Installation cancelled.');
|
|
115
|
+
process.exit(0);
|
|
116
|
+
}
|
|
117
|
+
if (shouldInstallGlobally) {
|
|
118
|
+
const s = clack.spinner();
|
|
119
|
+
s.start('Installing codegraph CLI...');
|
|
120
|
+
try {
|
|
121
|
+
(0, child_process_1.execSync)('npm install -g @colbymchenry/codegraph', { stdio: 'pipe' });
|
|
122
|
+
s.stop('Installed codegraph CLI on PATH');
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
s.stop('Could not install (permission denied)');
|
|
126
|
+
clack.log.warn('Try: sudo npm install -g @colbymchenry/codegraph');
|
|
127
|
+
}
|
|
90
128
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
clack.log.warn('Try: sudo npm install -g @colbymchenry/codegraph');
|
|
129
|
+
else {
|
|
130
|
+
clack.log.info('Skipped CLI install — agents will not be able to launch the MCP server without it');
|
|
94
131
|
}
|
|
95
132
|
}
|
|
133
|
+
// Step 3: where the per-agent config files should land.
|
|
134
|
+
let location;
|
|
135
|
+
if (opts.location) {
|
|
136
|
+
location = opts.location;
|
|
137
|
+
}
|
|
138
|
+
else if (useDefaults) {
|
|
139
|
+
location = 'global';
|
|
140
|
+
}
|
|
96
141
|
else {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
142
|
+
// If every selected target is global-only (e.g. Codex), skip the
|
|
143
|
+
// prompt and force user-wide — project-local would just produce
|
|
144
|
+
// skip warnings.
|
|
145
|
+
const allGlobalOnly = targets.every((t) => !t.supportsLocation('local'));
|
|
146
|
+
if (allGlobalOnly) {
|
|
147
|
+
location = 'global';
|
|
148
|
+
clack.log.info('Writing user-wide configs (selected agents have no project-local config).');
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const sel = await clack.select({
|
|
152
|
+
message: 'Apply agent configs to all your projects, or just this one?',
|
|
153
|
+
options: [
|
|
154
|
+
{ value: 'global', label: 'All projects', hint: '~/.claude, ~/.cursor, etc.' },
|
|
155
|
+
{ value: 'local', label: 'Just this project', hint: './.claude, ./.cursor, etc.' },
|
|
156
|
+
],
|
|
157
|
+
initialValue: 'global',
|
|
158
|
+
});
|
|
159
|
+
if (clack.isCancel(sel)) {
|
|
160
|
+
clack.cancel('Installation cancelled.');
|
|
161
|
+
process.exit(0);
|
|
162
|
+
}
|
|
163
|
+
location = sel;
|
|
164
|
+
}
|
|
111
165
|
}
|
|
112
|
-
// Step
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
166
|
+
// Step 4: auto-allow permissions (only meaningful for Claude;
|
|
167
|
+
// skipped silently by other targets).
|
|
168
|
+
let autoAllow;
|
|
169
|
+
if (opts.autoAllow !== undefined) {
|
|
170
|
+
autoAllow = opts.autoAllow;
|
|
171
|
+
}
|
|
172
|
+
else if (useDefaults) {
|
|
173
|
+
autoAllow = true;
|
|
120
174
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
175
|
+
else if (targets.some((t) => t.id === 'claude')) {
|
|
176
|
+
const ans = await clack.confirm({
|
|
177
|
+
message: 'Auto-allow CodeGraph commands? (Skips permission prompts in Claude Code)',
|
|
178
|
+
initialValue: true,
|
|
179
|
+
});
|
|
180
|
+
if (clack.isCancel(ans)) {
|
|
181
|
+
clack.cancel('Installation cancelled.');
|
|
182
|
+
process.exit(0);
|
|
183
|
+
}
|
|
184
|
+
autoAllow = ans;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
autoAllow = false;
|
|
188
|
+
}
|
|
189
|
+
// Step 5: per-target install loop.
|
|
190
|
+
for (const target of targets) {
|
|
191
|
+
if (!target.supportsLocation(location)) {
|
|
192
|
+
clack.log.warn(`${target.displayName}: skipped — does not support --location=${location}.`);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
const result = target.install(location, { autoAllow });
|
|
196
|
+
for (const file of result.files) {
|
|
197
|
+
const verb = file.action === 'unchanged'
|
|
198
|
+
? 'Unchanged'
|
|
199
|
+
: file.action === 'created' ? 'Created' : 'Updated';
|
|
200
|
+
clack.log.success(`${target.displayName}: ${verb} ${tildify(file.path)}`);
|
|
201
|
+
}
|
|
202
|
+
for (const note of result.notes ?? []) {
|
|
203
|
+
clack.log.info(`${target.displayName}: ${note}`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// Step 6: for local install, initialize the project.
|
|
124
207
|
if (location === 'local') {
|
|
125
208
|
await initializeLocalProject(clack);
|
|
126
209
|
}
|
|
127
|
-
// Done
|
|
128
210
|
if (location === 'global') {
|
|
129
211
|
clack.note('cd your-project\ncodegraph init -i', 'Quick start');
|
|
130
212
|
}
|
|
131
|
-
|
|
213
|
+
const finalNote = targets.length > 0
|
|
214
|
+
? `Done! Restart your agent${targets.length > 1 ? 's' : ''} to use CodeGraph.`
|
|
215
|
+
: 'Done!';
|
|
216
|
+
clack.outro(finalNote);
|
|
132
217
|
}
|
|
133
218
|
/**
|
|
134
|
-
*
|
|
219
|
+
* For every target that has a global config and exposes
|
|
220
|
+
* `wireProjectSurfaces`, write its project-local surfaces (e.g.
|
|
221
|
+
* Cursor's `.cursor/rules/codegraph.mdc`). Idempotent — runs
|
|
222
|
+
* silently when there's nothing to write.
|
|
223
|
+
*
|
|
224
|
+
* Called by `codegraph init` so that a user who ran
|
|
225
|
+
* `codegraph install` once globally doesn't have to re-run it per
|
|
226
|
+
* project to get full agent support.
|
|
227
|
+
*
|
|
228
|
+
* Returns the list of `(target, file)` pairs that were created or
|
|
229
|
+
* updated — caller decides how to surface them.
|
|
135
230
|
*/
|
|
136
|
-
function
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const claudeMdPath = `${locationLabel}/CLAUDE.md`;
|
|
151
|
-
if (claudeMdResult.created) {
|
|
152
|
-
clack.log.success(`Created ${claudeMdPath}`);
|
|
153
|
-
}
|
|
154
|
-
else if (claudeMdResult.updated) {
|
|
155
|
-
clack.log.success(`Updated ${claudeMdPath}`);
|
|
231
|
+
function wireProjectSurfacesForGlobalAgents() {
|
|
232
|
+
const written = [];
|
|
233
|
+
for (const target of registry_1.ALL_TARGETS) {
|
|
234
|
+
if (typeof target.wireProjectSurfaces !== 'function')
|
|
235
|
+
continue;
|
|
236
|
+
const detection = target.detect('global');
|
|
237
|
+
if (!detection.alreadyConfigured)
|
|
238
|
+
continue;
|
|
239
|
+
const result = target.wireProjectSurfaces();
|
|
240
|
+
for (const file of result.files) {
|
|
241
|
+
if (file.action === 'created' || file.action === 'updated') {
|
|
242
|
+
written.push({ target, file });
|
|
243
|
+
}
|
|
244
|
+
}
|
|
156
245
|
}
|
|
157
|
-
|
|
158
|
-
|
|
246
|
+
return written;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Replace home-directory prefix in a path with `~/` for cleaner log
|
|
250
|
+
* lines. Pure cosmetic.
|
|
251
|
+
*/
|
|
252
|
+
function tildify(p) {
|
|
253
|
+
const home = require('os').homedir();
|
|
254
|
+
if (p.startsWith(home + path.sep))
|
|
255
|
+
return '~' + p.substring(home.length);
|
|
256
|
+
return p;
|
|
257
|
+
}
|
|
258
|
+
async function resolveTargets(clack, opts, location, useDefaults) {
|
|
259
|
+
// Explicit --target flag wins.
|
|
260
|
+
if (opts.target !== undefined) {
|
|
261
|
+
return (0, registry_1.resolveTargetFlag)(opts.target, location);
|
|
262
|
+
}
|
|
263
|
+
// --yes implies auto-detect.
|
|
264
|
+
if (useDefaults) {
|
|
265
|
+
return (0, registry_1.resolveTargetFlag)('auto', location);
|
|
266
|
+
}
|
|
267
|
+
// Interactive multi-select.
|
|
268
|
+
const detected = (0, registry_1.detectAll)(location);
|
|
269
|
+
const initialValues = detected
|
|
270
|
+
.filter(({ detection }) => detection.installed)
|
|
271
|
+
.map(({ target }) => target.id);
|
|
272
|
+
// If nothing detected, default to Claude alone (matches the
|
|
273
|
+
// historical default and the smallest-surprise outcome).
|
|
274
|
+
const initial = initialValues.length > 0 ? initialValues : ['claude'];
|
|
275
|
+
const choice = await clack.multiselect({
|
|
276
|
+
message: 'Which agents should CodeGraph configure?',
|
|
277
|
+
options: registry_1.ALL_TARGETS.map((t) => {
|
|
278
|
+
const det = detected.find(({ target }) => target.id === t.id).detection;
|
|
279
|
+
const flag = det.installed ? '(detected)' : '(not found)';
|
|
280
|
+
const globalOnly = !t.supportsLocation('local') ? ' — global only' : '';
|
|
281
|
+
return {
|
|
282
|
+
value: t.id,
|
|
283
|
+
label: `${t.displayName} ${flag}${globalOnly}`,
|
|
284
|
+
};
|
|
285
|
+
}),
|
|
286
|
+
initialValues: initial,
|
|
287
|
+
required: false,
|
|
288
|
+
});
|
|
289
|
+
if (clack.isCancel(choice)) {
|
|
290
|
+
clack.cancel('Installation cancelled.');
|
|
291
|
+
process.exit(0);
|
|
159
292
|
}
|
|
293
|
+
return choice
|
|
294
|
+
.map((id) => (0, registry_1.getTarget)(id))
|
|
295
|
+
.filter((t) => t !== undefined);
|
|
160
296
|
}
|
|
161
297
|
/**
|
|
162
|
-
* Initialize CodeGraph in the current project (for local installs)
|
|
298
|
+
* Initialize CodeGraph in the current project (for local installs).
|
|
299
|
+
* Unchanged from the pre-refactor version — agent-agnostic by nature.
|
|
163
300
|
*/
|
|
164
301
|
async function initializeLocalProject(clack) {
|
|
165
302
|
const projectPath = process.cwd();
|
|
166
|
-
// Lazy-load CodeGraph (requires native modules)
|
|
167
303
|
let CodeGraph;
|
|
168
304
|
try {
|
|
169
305
|
CodeGraph = (await Promise.resolve().then(() => __importStar(require('../index')))).default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/installer/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/installer/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEH,oCAEC;AAED,0DAkIC;AAeD,gFAiBC;AArOD,iDAAyC;AACzC,2CAA6B;AAC7B,uCAAyB;AACzB,iDAK4B;AAG5B,mEAAmE;AACnE,qEAAqE;AACrE,YAAY;AACZ,iDAOyB;AANvB,+GAAA,cAAc,OAAA;AACd,iHAAA,gBAAgB,OAAA;AAChB,8GAAA,aAAa,OAAA;AACb,6GAAA,YAAY,OAAA;AACZ,+GAAA,cAAc,OAAA;AACd,mHAAA,kBAAkB,OAAA;AAIpB,0EAA0E;AAC1E,uEAAuE;AACvE,8DAA8D;AAC9D,MAAM,SAAS,GAAG,IAAI,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CACL,CAAC;AAElE,SAAS,YAAY,CAAC,CAAS;IAC7B,OAAO,CAAC,CAAC,cAAc,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,UAAU;IACjB,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACzE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1E,OAAO,WAAW,CAAC,OAAO,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,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AEnD,+EAA+E;IAC/E,MAAM,EAAE,qBAAqB,EAAE,GAAG,wDAAa,wBAAwB,GAAC,CAAC;IACzE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,qBAAqB,EAAE,CAAC;IAEzC,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC;QAC/B,UAAU,EAAE,QAAQ,CAAC,UAAU;KAChC,CAAC,CAAC;IAEH,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEtB,IAAI,MAAM,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;QAC5B,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,YAAY,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IACtK,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IACzH,CAAC;IAED,EAAE,CAAC,KAAK,EAAE,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|