context-mode 1.0.113 → 1.0.115

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
@@ -108,6 +108,32 @@ if (cacheMatch) {
108
108
  }
109
109
  }
110
110
 
111
+ // ── Self-heal Layer 3 + 4: installed_plugins.json registry repair ──
112
+ // v1.0.113 hotfix follow-up. /ctx-upgrade can leave installed_plugins.json
113
+ // with two distinct kinds of poison:
114
+ // HEAL 3: per-entry `version` drifts away from the actual cache dir's
115
+ // plugin.json `version` field. Claude Code's plugin loader then
116
+ // rejects the entry as a manifest mismatch and silently
117
+ // disconnects context-mode.
118
+ // HEAL 4: top-level `enabledPlugins[<key>]` is missing or emptied.
119
+ // Claude Code skips disabled plugins, so MCP never starts and
120
+ // the user has no /ctx-upgrade escape hatch.
121
+ // Logic is shared verbatim with scripts/postinstall.mjs (single source of
122
+ // truth) so users who fix themselves via `npm install -g context-mode`
123
+ // follow the exact same code path. Best-effort, never blocks MCP boot.
124
+ try {
125
+ const { healInstalledPlugins } = await import("./scripts/heal-installed-plugins.mjs");
126
+ const registryPath = resolve(homedir(), ".claude", "plugins", "installed_plugins.json");
127
+ const pluginCacheRoot = resolve(homedir(), ".claude", "plugins", "cache");
128
+ try {
129
+ healInstalledPlugins({
130
+ registryPath,
131
+ pluginCacheRoot,
132
+ pluginKey: "context-mode@context-mode",
133
+ });
134
+ } catch { /* best effort — never block MCP boot */ }
135
+ } catch { /* best effort — never block MCP boot */ }
136
+
111
137
  // ── Self-heal Layer 4: Deploy global SessionStart hook + register in settings.json ──
112
138
  // This hook lives outside the plugin directory (~/.claude/hooks/) so it works
113
139
  // even when the plugin cache is completely broken. It creates symlinks for any