context-mode 1.0.114 → 1.0.116

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.
@@ -3,7 +3,7 @@
3
3
  "name": "Context Mode",
4
4
  "kind": "tool",
5
5
  "description": "OpenClaw plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
6
- "version": "1.0.114",
6
+ "version": "1.0.116",
7
7
  "sandbox": {
8
8
  "mode": "permissive",
9
9
  "filesystem_access": "full",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "1.0.114",
3
+ "version": "1.0.116",
4
4
  "type": "module",
5
5
  "description": "MCP plugin that saves 98% of your context window. Works with Claude Code, Gemini CLI, VS Code Copilot, OpenCode, and Codex CLI. Sandboxed code execution, FTS5 knowledge base, and intent-driven search.",
6
6
  "author": "Mert Koseoğlu",
@@ -127,3 +127,55 @@ export function healInstalledPlugins({ registryPath, pluginCacheRoot, pluginKey
127
127
 
128
128
  return { healed };
129
129
  }
130
+
131
+ /**
132
+ * Heal `~/.claude/settings.json.enabledPlugins[pluginKey]`.
133
+ *
134
+ * v1.0.114's heal targeted `installed_plugins.json.enabledPlugins`, which is
135
+ * what we control. But Claude Code's plugin loader actually reads the truth
136
+ * from `settings.json.enabledPlugins`. After every `/ctx-upgrade`, Claude
137
+ * Code's plugin manager seems to clear the settings.json key (likely on
138
+ * version-mismatch detection), so the plugin appears disabled even though
139
+ * `installed_plugins.json` is fully consistent. v1.0.116 closes that gap.
140
+ *
141
+ * Respects explicit user opt-out: if the key is `false`, leaves it alone.
142
+ *
143
+ * @param {{ settingsPath: string, pluginKey: string }} opts
144
+ * @returns {HealResult}
145
+ */
146
+ export function healSettingsEnabledPlugins({ settingsPath, pluginKey }) {
147
+ if (!settingsPath || !existsSync(settingsPath)) {
148
+ return { healed: [], skipped: "no-settings" };
149
+ }
150
+
151
+ let raw;
152
+ try { raw = readFileSync(settingsPath, "utf-8"); }
153
+ catch (err) { return { healed: [], error: `read-failed: ${(err && err.message) || err}` }; }
154
+
155
+ let settings;
156
+ try { settings = JSON.parse(raw); }
157
+ catch (err) { return { healed: [], error: `parse-failed: ${(err && err.message) || err}` }; }
158
+
159
+ const healed = [];
160
+ if (!settings.enabledPlugins || typeof settings.enabledPlugins !== "object" || Array.isArray(settings.enabledPlugins)) {
161
+ settings.enabledPlugins = {};
162
+ }
163
+ const current = settings.enabledPlugins[pluginKey];
164
+ if (current === false) {
165
+ return { healed: [], skipped: "explicit-opt-out" };
166
+ }
167
+ if (current !== true) {
168
+ settings.enabledPlugins[pluginKey] = true;
169
+ healed.push("enabled-plugins");
170
+ }
171
+
172
+ if (healed.length > 0) {
173
+ try {
174
+ writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
175
+ } catch (err) {
176
+ return { healed: [], error: `write-failed: ${(err && err.message) || err}` };
177
+ }
178
+ }
179
+
180
+ return { healed };
181
+ }
@@ -14,7 +14,7 @@ import { dirname, resolve, join, sep } from "node:path";
14
14
  import { fileURLToPath } from "node:url";
15
15
  import { homedir } from "node:os";
16
16
  import { healBetterSqlite3Binding } from "./heal-better-sqlite3.mjs";
17
- import { healInstalledPlugins } from "./heal-installed-plugins.mjs";
17
+ import { healInstalledPlugins, healSettingsEnabledPlugins } from "./heal-installed-plugins.mjs";
18
18
 
19
19
  const __dirname = dirname(fileURLToPath(import.meta.url));
20
20
  const pkgRoot = resolve(__dirname, "..");
@@ -82,6 +82,20 @@ if (isGlobalInstall()) {
82
82
  process.stderr.write(`context-mode: install OK, heal aborted (${(err && err.message) || err})\n`);
83
83
  } catch { /* truly best effort */ }
84
84
  }
85
+
86
+ // v1.0.116: also heal settings.json.enabledPlugins (the file Claude Code's
87
+ // plugin loader actually reads). v1.0.114 only touched installed_plugins.json.
88
+ try {
89
+ const settingsPath = resolve(homedir(), ".claude", "settings.json");
90
+ const r = healSettingsEnabledPlugins({
91
+ settingsPath,
92
+ pluginKey: "context-mode@context-mode",
93
+ });
94
+ if (r.healed && r.healed.length > 0) {
95
+ process.stderr.write(`context-mode: healed settings.json (${r.healed.join(", ")})\n`);
96
+ }
97
+ // skipped/error: silent — already covered by the prior heal's stderr line.
98
+ } catch { /* never block install */ }
85
99
  }
86
100
 
87
101
  // ── 0. Self-heal Layer 3: Backward symlink for stale registry (anthropics/claude-code#46915) ──