context-mode 1.0.137 → 1.0.138

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/start.mjs CHANGED
@@ -174,7 +174,7 @@ if (cacheMatch) {
174
174
  // truth) so users who fix themselves via `npm install -g context-mode`
175
175
  // follow the exact same code path. Best-effort, never blocks MCP boot.
176
176
  try {
177
- const { healInstalledPlugins, healSettingsEnabledPlugins, healPluginJsonMcpServers, healMcpJsonArgs } =
177
+ const { healInstalledPlugins, healSettingsEnabledPlugins, healPluginJsonMcpServers, sweepStaleMcpJson } =
178
178
  await import("./scripts/heal-installed-plugins.mjs");
179
179
  const pluginKey = "context-mode@context-mode";
180
180
  const claudeConfigDir = resolveClaudeConfigDir();
@@ -193,12 +193,6 @@ try {
193
193
  // path baked in. Iterates EVERY installed cache entry's installPath so
194
194
  // multi-version installs all self-recover. Each call is independently wrapped
195
195
  // because one poisoned entry must not block heals on the others. Best effort.
196
- //
197
- // v1.0.122 — Layer 5b extended (Issue #531): asymmetric-heal sibling for the
198
- // `.mcp.json` file Claude Code reads at plugin load. Same per-entry loop, same
199
- // defensive wrap. Covers both the #253/aea633c bare `./start.mjs` fresh-install
200
- // regression AND the /ctx-upgrade tmpdir leak class. Both heals must run on
201
- // every boot so users self-recover regardless of which drift shape hit them.
202
196
  try {
203
197
  if (existsSync(registryPath)) {
204
198
  const ip = JSON.parse(readFileSync(registryPath, "utf-8"));
@@ -214,17 +208,20 @@ try {
214
208
  pluginKey,
215
209
  });
216
210
  } catch { /* best effort — per-entry */ }
217
- try {
218
- healMcpJsonArgs({
219
- pluginRoot: installPath,
220
- pluginCacheRoot,
221
- pluginKey,
222
- });
223
- } catch { /* best effort — per-entry */ }
224
211
  }
225
212
  }
226
213
  }
227
214
  } catch { /* best effort */ }
215
+ // Issue #609 — Layer 5c (replaces v1.0.122 healMcpJsonArgs per-entry loop):
216
+ // sweep stale `.mcp.json` files from every per-version cache dir. cli.ts
217
+ // no longer writes `.mcp.json` (PR fix for #609), so the only `.mcp.json`
218
+ // files in the cache are stale carry-forwards from earlier installs or
219
+ // Claude Code's plugin manager copying them between version dirs. Removing
220
+ // them blocks the previous-version-carry replay vector at MCP boot.
221
+ // One sweep per boot — bounded, idempotent, best-effort.
222
+ try {
223
+ sweepStaleMcpJson({ pluginCacheRoot, pluginKey });
224
+ } catch { /* best effort */ }
228
225
  } catch { /* best effort — never block MCP boot */ }
229
226
 
230
227
  // ── Self-heal Layer 4: Deploy global SessionStart hook + register in settings.json ──