context-mode 1.0.115 → 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.
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Claude Code plugins by Mert Koseoğlu",
9
- "version": "1.0.115"
9
+ "version": "1.0.116"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "context-mode",
14
14
  "source": "./",
15
15
  "description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
16
- "version": "1.0.115",
16
+ "version": "1.0.116",
17
17
  "author": {
18
18
  "name": "Mert Koseoğlu"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "1.0.115",
3
+ "version": "1.0.116",
4
4
  "description": "MCP server that saves 98% of your context window with session continuity. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and automatic state restore across compactions.",
5
5
  "author": {
6
6
  "name": "Mert Koseoğlu",
@@ -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.115",
6
+ "version": "1.0.116",
7
7
  "sandbox": {
8
8
  "mode": "permissive",
9
9
  "filesystem_access": "full",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "1.0.115",
3
+ "version": "1.0.116",
4
4
  "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.",
5
5
  "author": {
6
6
  "name": "Mert Koseoğlu",
@@ -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.115",
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.115",
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) ──
package/start.mjs CHANGED
@@ -122,16 +122,19 @@ if (cacheMatch) {
122
122
  // truth) so users who fix themselves via `npm install -g context-mode`
123
123
  // follow the exact same code path. Best-effort, never blocks MCP boot.
124
124
  try {
125
- const { healInstalledPlugins } = await import("./scripts/heal-installed-plugins.mjs");
125
+ const { healInstalledPlugins, healSettingsEnabledPlugins } =
126
+ await import("./scripts/heal-installed-plugins.mjs");
127
+ const pluginKey = "context-mode@context-mode";
126
128
  const registryPath = resolve(homedir(), ".claude", "plugins", "installed_plugins.json");
127
129
  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 */ }
130
+ const settingsPath = resolve(homedir(), ".claude", "settings.json");
131
+ try { healInstalledPlugins({ registryPath, pluginCacheRoot, pluginKey }); }
132
+ catch { /* best effort */ }
133
+ // v1.0.116: Claude Code's plugin loader reads settings.json.enabledPlugins
134
+ // (NOT installed_plugins.json) — heal that one too so /ctx-upgrade-induced
135
+ // disable state is repaired before next /reload-plugins.
136
+ try { healSettingsEnabledPlugins({ settingsPath, pluginKey }); }
137
+ catch { /* best effort */ }
135
138
  } catch { /* best effort — never block MCP boot */ }
136
139
 
137
140
  // ── Self-heal Layer 4: Deploy global SessionStart hook + register in settings.json ──