@sdsrs/code-graph 0.5.17 → 0.5.19

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 CHANGED
@@ -109,7 +109,7 @@ Install as a Claude Code plugin for the best experience — includes slash comma
109
109
  /plugin marketplace add sdsrss/code-graph-mcp
110
110
 
111
111
  # Step 2: Install the plugin
112
- /plugin install code-graph@sdsrss-code-graph
112
+ /plugin install code-graph-mcp
113
113
  ```
114
114
 
115
115
  What you get:
@@ -176,13 +176,13 @@ code-graph-mcp
176
176
 
177
177
  ```bash
178
178
  # Uninstall the plugin
179
- /plugin uninstall code-graph@sdsrss-code-graph
179
+ /plugin uninstall code-graph-mcp
180
180
 
181
181
  # (Optional) Remove the marketplace
182
- /plugin marketplace remove sdsrss-code-graph
182
+ /plugin marketplace remove code-graph-mcp
183
183
 
184
184
  # (Optional) Clean up all config and cache data
185
- node ~/.claude/plugins/cache/sdsrss/code-graph/*/scripts/lifecycle.js uninstall
185
+ node ~/.claude/plugins/cache/code-graph-mcp/code-graph-mcp/*/scripts/lifecycle.js uninstall
186
186
  ```
187
187
 
188
188
  ### Claude Code MCP Server
@@ -1,9 +1,9 @@
1
1
  {
2
- "name": "code-graph",
2
+ "name": "code-graph-mcp",
3
3
  "description": "AST knowledge graph for intelligent code navigation — auto-indexes your codebase and provides semantic search, call graph traversal, HTTP route tracing, and impact analysis via MCP tools",
4
4
  "author": {
5
5
  "name": "sdsrs"
6
6
  },
7
- "version": "0.5.15",
7
+ "version": "0.5.19",
8
8
  "keywords": ["code-graph", "ast", "navigation", "mcp", "knowledge-graph"]
9
9
  }
@@ -125,7 +125,7 @@ async function downloadAndInstall(latest) {
125
125
  // 3. Copy plugin files to cache (cross-platform)
126
126
  const pluginSrc = path.join(tmpDir, 'claude-plugin');
127
127
  const pluginDst = path.join(
128
- os.homedir(), '.claude', 'plugins', 'cache', MARKETPLACE_NAME, 'code-graph', latest.version
128
+ os.homedir(), '.claude', 'plugins', 'cache', MARKETPLACE_NAME, 'code-graph-mcp', latest.version
129
129
  );
130
130
 
131
131
  if (fs.existsSync(pluginSrc)) {
@@ -4,9 +4,12 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
6
 
7
- const PLUGIN_ID = 'code-graph@sdsrss-code-graph';
8
- const OLD_PLUGIN_ID = 'code-graph@sdsrss'; // Legacy ID — kept for migration cleanup
9
- const MARKETPLACE_NAME = 'sdsrss-code-graph';
7
+ const PLUGIN_ID = 'code-graph-mcp@code-graph-mcp';
8
+ const OLD_PLUGIN_IDS = [
9
+ 'code-graph@sdsrss', // v1 legacy ID
10
+ 'code-graph@sdsrss-code-graph', // v2 legacy ID (pre-rename)
11
+ ];
12
+ const MARKETPLACE_NAME = 'code-graph-mcp';
10
13
  const CACHE_DIR = path.join(os.homedir(), '.cache', 'code-graph');
11
14
  const PLUGIN_ROOT = process.env.CLAUDE_PLUGIN_ROOT || path.resolve(__dirname, '..');
12
15
  const MANIFEST_FILE = path.join(CACHE_DIR, 'install-manifest.json');
@@ -97,34 +100,53 @@ function checkScopeConflict() {
97
100
  if (!installed || !installed.plugins) return null;
98
101
  for (const [key, entries] of Object.entries(installed.plugins)) {
99
102
  if (key === PLUGIN_ID) continue;
100
- if (key.startsWith('code-graph@')) {
103
+ // Detect any old code-graph plugin IDs still installed
104
+ if (key.startsWith('code-graph@') || key.startsWith('code-graph-mcp@')) {
101
105
  return { existingId: key, scope: entries[0] && entries[0].scope, entries };
102
106
  }
103
107
  }
104
108
  return null;
105
109
  }
106
110
 
107
- // --- Migration: clean up old PLUGIN_ID remnants ---
111
+ // --- Migration: clean up old plugin ID remnants ---
108
112
 
109
- function migrateOldPluginId(settings) {
113
+ function migrateOldPluginIds(settings) {
110
114
  let changed = false;
111
115
 
112
- // Clean old ID from enabledPlugins
113
- if (settings.enabledPlugins && OLD_PLUGIN_ID in settings.enabledPlugins) {
114
- delete settings.enabledPlugins[OLD_PLUGIN_ID];
115
- changed = true;
116
+ for (const oldId of OLD_PLUGIN_IDS) {
117
+ // Clean old ID from enabledPlugins
118
+ if (settings.enabledPlugins && oldId in settings.enabledPlugins) {
119
+ delete settings.enabledPlugins[oldId];
120
+ changed = true;
121
+ }
122
+
123
+ // Clean old ID from installed_plugins.json
124
+ const installed = readJson(INSTALLED_PLUGINS_PATH);
125
+ if (installed && installed.plugins && oldId in installed.plugins) {
126
+ delete installed.plugins[oldId];
127
+ writeJsonAtomic(INSTALLED_PLUGINS_PATH, installed);
128
+ }
116
129
  }
117
130
 
118
- // Clean old ID from installed_plugins.json
119
- const installed = readJson(INSTALLED_PLUGINS_PATH);
120
- if (installed && installed.plugins && OLD_PLUGIN_ID in installed.plugins) {
121
- delete installed.plugins[OLD_PLUGIN_ID];
122
- writeJsonAtomic(INSTALLED_PLUGINS_PATH, installed);
131
+ // Clean old marketplace names from extraKnownMarketplaces
132
+ if (settings.extraKnownMarketplaces) {
133
+ for (const oldName of ['sdsrss-code-graph']) {
134
+ if (oldName in settings.extraKnownMarketplaces) {
135
+ delete settings.extraKnownMarketplaces[oldName];
136
+ changed = true;
137
+ }
138
+ }
123
139
  }
124
140
 
125
- // Clean old cache path (was using 'sdsrss' instead of 'sdsrss-code-graph')
126
- const oldCacheDir = path.join(os.homedir(), '.claude', 'plugins', 'cache', 'sdsrss', 'code-graph');
127
- try { fs.rmSync(oldCacheDir, { recursive: true, force: true }); } catch { /* ok */ }
141
+ // Clean old cache paths
142
+ const oldCacheDirs = [
143
+ path.join(os.homedir(), '.claude', 'plugins', 'cache', 'sdsrss', 'code-graph'),
144
+ path.join(os.homedir(), '.claude', 'plugins', 'cache', 'sdsrss-code-graph', 'code-graph'),
145
+ path.join(os.homedir(), '.claude', 'plugins', 'cache', 'sdsrss-code-graph'),
146
+ ];
147
+ for (const dir of oldCacheDirs) {
148
+ try { fs.rmSync(dir, { recursive: true, force: true }); } catch { /* ok */ }
149
+ }
128
150
 
129
151
  return changed;
130
152
  }
@@ -137,8 +159,8 @@ function install() {
137
159
  const settings = readJson(SETTINGS_PATH) || {};
138
160
  let settingsChanged = false;
139
161
 
140
- // 0. Migrate from old PLUGIN_ID
141
- if (migrateOldPluginId(settings)) {
162
+ // 0. Migrate from old plugin IDs
163
+ if (migrateOldPluginIds(settings)) {
142
164
  settingsChanged = true;
143
165
  }
144
166
 
@@ -203,9 +225,9 @@ function uninstall() {
203
225
  // else: other providers still using composite — leave it
204
226
  }
205
227
 
206
- // 2. Remove both old and new IDs from enabledPlugins
228
+ // 2. Remove all known IDs from enabledPlugins
207
229
  if (settings.enabledPlugins) {
208
- for (const id of [PLUGIN_ID, OLD_PLUGIN_ID]) {
230
+ for (const id of [PLUGIN_ID, ...OLD_PLUGIN_IDS]) {
209
231
  if (id in settings.enabledPlugins) {
210
232
  delete settings.enabledPlugins[id];
211
233
  settingsChanged = true;
@@ -219,11 +241,11 @@ function uninstall() {
219
241
  }
220
242
  }
221
243
 
222
- // 4. Remove both old and new IDs from installed_plugins.json
244
+ // 4. Remove all known IDs from installed_plugins.json
223
245
  const installedPlugins = readJson(INSTALLED_PLUGINS_PATH);
224
246
  if (installedPlugins && installedPlugins.plugins) {
225
247
  let ipChanged = false;
226
- for (const id of [PLUGIN_ID, OLD_PLUGIN_ID]) {
248
+ for (const id of [PLUGIN_ID, ...OLD_PLUGIN_IDS]) {
227
249
  if (id in installedPlugins.plugins) {
228
250
  delete installedPlugins.plugins[id];
229
251
  ipChanged = true;
@@ -235,10 +257,11 @@ function uninstall() {
235
257
  // 5. Remove cache directory
236
258
  try { fs.rmSync(CACHE_DIR, { recursive: true, force: true }); } catch { /* ok */ }
237
259
 
238
- // 6. Remove plugin files from cache (both old and new paths)
260
+ // 6. Remove plugin files from cache (all known paths)
239
261
  const pluginCacheDirs = [
240
- path.join(os.homedir(), '.claude', 'plugins', 'cache', MARKETPLACE_NAME, 'code-graph'),
241
- path.join(os.homedir(), '.claude', 'plugins', 'cache', 'sdsrss', 'code-graph'), // legacy
262
+ path.join(os.homedir(), '.claude', 'plugins', 'cache', MARKETPLACE_NAME, 'code-graph-mcp'),
263
+ path.join(os.homedir(), '.claude', 'plugins', 'cache', 'sdsrss-code-graph', 'code-graph'),
264
+ path.join(os.homedir(), '.claude', 'plugins', 'cache', 'sdsrss', 'code-graph'),
242
265
  ];
243
266
  for (const dir of pluginCacheDirs) {
244
267
  try { fs.rmSync(dir, { recursive: true, force: true }); } catch { /* ok */ }
@@ -256,8 +279,8 @@ function update() {
256
279
  const settings = readJson(SETTINGS_PATH) || {};
257
280
  let settingsChanged = false;
258
281
 
259
- // 0. Migrate from old PLUGIN_ID
260
- if (migrateOldPluginId(settings)) {
282
+ // 0. Migrate from old plugin IDs
283
+ if (migrateOldPluginIds(settings)) {
261
284
  settingsChanged = true;
262
285
  }
263
286
 
@@ -297,7 +320,7 @@ module.exports = {
297
320
  readManifest, readJson, writeJsonAtomic,
298
321
  readRegistry, writeRegistry,
299
322
  getPluginVersion,
300
- PLUGIN_ID, OLD_PLUGIN_ID, MARKETPLACE_NAME, CACHE_DIR, REGISTRY_FILE,
323
+ PLUGIN_ID, OLD_PLUGIN_IDS, MARKETPLACE_NAME, CACHE_DIR, REGISTRY_FILE,
301
324
  };
302
325
 
303
326
  // CLI: node lifecycle.js <install|uninstall|update>
@@ -8,7 +8,30 @@ const { findBinary } = require('./find-binary');
8
8
  const { install, update, readManifest, getPluginVersion, checkScopeConflict } = require('./lifecycle');
9
9
  const { checkForUpdate } = require('./auto-update');
10
10
 
11
- const BIN = findBinary();
11
+ let BIN = findBinary();
12
+
13
+ // --- 0. Auto-install binary if missing ---
14
+ if (!BIN) {
15
+ const version = getPluginVersion();
16
+ process.stderr.write(`[code-graph] Binary not found, installing @sdsrs/code-graph@${version}...\n`);
17
+ try {
18
+ execFileSync('npm', ['install', '-g', `@sdsrs/code-graph@${version}`], {
19
+ timeout: 60000, stdio: 'pipe'
20
+ });
21
+ // Clear cached path so findBinary picks up the new install
22
+ try { fs.unlinkSync(path.join(os.homedir(), '.cache', 'code-graph', 'binary-path')); } catch {}
23
+ BIN = findBinary();
24
+ if (BIN) {
25
+ process.stderr.write(`[code-graph] Installed v${version} at ${BIN}\n`);
26
+ } else {
27
+ process.stderr.write('[code-graph] Install succeeded but binary not found in PATH. Try: npx @sdsrs/code-graph@latest\n');
28
+ }
29
+ } catch {
30
+ process.stderr.write(
31
+ `[code-graph] Auto-install failed. Run manually: npm install -g @sdsrs/code-graph@${version}\n`
32
+ );
33
+ }
34
+ }
12
35
 
13
36
  // --- 1. Health check (always runs) ---
14
37
  if (BIN) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdsrs/code-graph",
3
- "version": "0.5.17",
3
+ "version": "0.5.19",
4
4
  "description": "MCP server that indexes codebases into an AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,10 +33,10 @@
33
33
  "node": ">=16"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@sdsrs/code-graph-linux-x64": "0.5.17",
37
- "@sdsrs/code-graph-linux-arm64": "0.5.17",
38
- "@sdsrs/code-graph-darwin-x64": "0.5.17",
39
- "@sdsrs/code-graph-darwin-arm64": "0.5.17",
40
- "@sdsrs/code-graph-win32-x64": "0.5.17"
36
+ "@sdsrs/code-graph-linux-x64": "0.5.19",
37
+ "@sdsrs/code-graph-linux-arm64": "0.5.19",
38
+ "@sdsrs/code-graph-darwin-x64": "0.5.19",
39
+ "@sdsrs/code-graph-darwin-arm64": "0.5.19",
40
+ "@sdsrs/code-graph-win32-x64": "0.5.19"
41
41
  }
42
42
  }