context-mode 0.9.2 → 0.9.4
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/build/cli.js +78 -42
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@
|
|
|
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": "0.9.
|
|
16
|
+
"version": "0.9.4",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Mert Koseoğlu"
|
|
19
19
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"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.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mert Koseoğlu",
|
package/build/cli.js
CHANGED
|
@@ -76,12 +76,26 @@ async function fetchLatestVersion() {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
function getMarketplaceVersion() {
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
// Primary: read from installed_plugins.json (source of truth for Claude Code)
|
|
80
|
+
try {
|
|
81
|
+
const ipPath = resolve(homedir(), ".claude", "plugins", "installed_plugins.json");
|
|
82
|
+
const ipRaw = JSON.parse(readFileSync(ipPath, "utf-8"));
|
|
83
|
+
const plugins = ipRaw.plugins ?? {};
|
|
84
|
+
for (const [key, entries] of Object.entries(plugins)) {
|
|
85
|
+
if (!key.toLowerCase().includes("context-mode"))
|
|
86
|
+
continue;
|
|
87
|
+
const arr = entries;
|
|
88
|
+
if (arr.length > 0 && typeof arr[0].version === "string") {
|
|
89
|
+
return arr[0].version;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch { /* fallback below */ }
|
|
94
|
+
// Fallback: read from own package.json
|
|
95
|
+
const localVer = getLocalVersion();
|
|
96
|
+
if (localVer !== "unknown")
|
|
97
|
+
return localVer;
|
|
98
|
+
// Last resort: scan common plugin cache locations
|
|
85
99
|
const bases = [
|
|
86
100
|
resolve(homedir(), ".claude"),
|
|
87
101
|
resolve(homedir(), ".config", "claude"),
|
|
@@ -378,48 +392,70 @@ async function upgrade() {
|
|
|
378
392
|
timeout: 60000,
|
|
379
393
|
});
|
|
380
394
|
s.stop("Dependencies ready");
|
|
381
|
-
// Step 2.5:
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
395
|
+
// Step 2.5: Spawn post-upgrade from NEW code on disk to update registry & clean cache
|
|
396
|
+
// This ensures even users upgrading from old versions get the fix
|
|
397
|
+
s.start("Updating plugin registry");
|
|
398
|
+
try {
|
|
399
|
+
const postUpgradeScript = `
|
|
400
|
+
const fs = require("fs");
|
|
401
|
+
const path = require("path");
|
|
402
|
+
const home = require("os").homedir();
|
|
403
|
+
const pluginRoot = ${JSON.stringify(pluginRoot)};
|
|
404
|
+
const newVersion = ${JSON.stringify(newVersion)};
|
|
405
|
+
|
|
406
|
+
// Update installed_plugins.json
|
|
407
|
+
const ipPath = path.resolve(home, ".claude", "plugins", "installed_plugins.json");
|
|
408
|
+
try {
|
|
409
|
+
const ipRaw = JSON.parse(fs.readFileSync(ipPath, "utf-8"));
|
|
410
|
+
const plugins = ipRaw.plugins || {};
|
|
411
|
+
let updated = false;
|
|
412
|
+
for (const [key, entries] of Object.entries(plugins)) {
|
|
413
|
+
if (!key.toLowerCase().includes("context-mode")) continue;
|
|
414
|
+
for (const entry of entries) {
|
|
415
|
+
entry.installPath = pluginRoot;
|
|
416
|
+
entry.version = newVersion;
|
|
417
|
+
entry.lastUpdated = new Date().toISOString();
|
|
418
|
+
updated = true;
|
|
394
419
|
}
|
|
395
|
-
|
|
396
|
-
|
|
420
|
+
}
|
|
421
|
+
if (updated) {
|
|
422
|
+
fs.writeFileSync(ipPath, JSON.stringify(ipRaw, null, 2) + "\\n", "utf-8");
|
|
423
|
+
console.log("REGISTRY_UPDATED");
|
|
424
|
+
}
|
|
425
|
+
} catch (e) { console.error("REGISTRY_FAILED:" + e.message); }
|
|
426
|
+
|
|
427
|
+
// Clean old cache directories
|
|
428
|
+
const m = pluginRoot.match(/^(.*\\/plugins\\/cache\\/[^/]+\\/[^/]+\\/)([^/]+)$/);
|
|
429
|
+
if (m) {
|
|
430
|
+
try {
|
|
431
|
+
const dirs = fs.readdirSync(m[1]).filter(d => d !== m[2]);
|
|
432
|
+
for (const old of dirs) {
|
|
433
|
+
try { fs.rmSync(path.resolve(m[1], old), { recursive: true, force: true }); } catch {}
|
|
397
434
|
}
|
|
435
|
+
if (dirs.length > 0) console.log("CLEANED:" + dirs.length);
|
|
436
|
+
} catch {}
|
|
398
437
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
for (const entry of entries) {
|
|
409
|
-
entry.installPath = pluginRoot;
|
|
410
|
-
entry.version = newVersion;
|
|
411
|
-
entry.lastUpdated = new Date().toISOString();
|
|
412
|
-
updated = true;
|
|
413
|
-
}
|
|
438
|
+
`;
|
|
439
|
+
const result = execSync(`node -e ${JSON.stringify(postUpgradeScript)}`, {
|
|
440
|
+
stdio: "pipe",
|
|
441
|
+
timeout: 10000,
|
|
442
|
+
encoding: "utf-8",
|
|
443
|
+
});
|
|
444
|
+
if (result.includes("REGISTRY_UPDATED")) {
|
|
445
|
+
s.stop(color.green("Plugin registry updated"));
|
|
446
|
+
changes.push("Updated plugin registry");
|
|
414
447
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
448
|
+
else {
|
|
449
|
+
s.stop(color.yellow("Plugin registry unchanged"));
|
|
450
|
+
}
|
|
451
|
+
const cleanMatch = result.match(/CLEANED:(\d+)/);
|
|
452
|
+
if (cleanMatch) {
|
|
453
|
+
p.log.info(color.dim(` Cleaned ${cleanMatch[1]} old cache dir(s)`));
|
|
419
454
|
}
|
|
420
455
|
}
|
|
421
|
-
catch {
|
|
422
|
-
|
|
456
|
+
catch (err) {
|
|
457
|
+
s.stop(color.yellow("Plugin registry update skipped"));
|
|
458
|
+
p.log.warn(color.yellow("Could not update plugin registry") + color.dim(` — ${err instanceof Error ? err.message : String(err)}`));
|
|
423
459
|
}
|
|
424
460
|
// Update global npm package from same GitHub source
|
|
425
461
|
s.start("Updating npm global package");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution, FTS5 knowledge base, and intent-driven search.",
|
|
6
6
|
"author": "Mert Koseoğlu",
|