context-mode 0.9.5 → 0.9.7
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 +56 -59
- 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.7",
|
|
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.7",
|
|
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
|
@@ -370,21 +370,31 @@ async function upgrade() {
|
|
|
370
370
|
timeout: 30000,
|
|
371
371
|
});
|
|
372
372
|
s.stop("Built successfully");
|
|
373
|
-
// Step 3:
|
|
374
|
-
s.start("Installing
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
373
|
+
// Step 3: Nuke entire cache parent and install fresh with correct version dir
|
|
374
|
+
s.start("Installing fresh");
|
|
375
|
+
const cacheParentMatch = pluginRoot.match(/^(.*[\\/]plugins[\\/]cache[\\/][^\\/]+[\\/][^\\/]+[\\/])/);
|
|
376
|
+
const freshDir = cacheParentMatch
|
|
377
|
+
? resolve(cacheParentMatch[1], newVersion)
|
|
378
|
+
: pluginRoot;
|
|
379
|
+
// Wipe all old cache directories
|
|
380
|
+
if (cacheParentMatch) {
|
|
381
|
+
const cacheParent = cacheParentMatch[1];
|
|
380
382
|
try {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
+
const oldDirs = readdirSync(cacheParent);
|
|
384
|
+
for (const d of oldDirs) {
|
|
385
|
+
try {
|
|
386
|
+
rmSync(resolve(cacheParent, d), { recursive: true, force: true });
|
|
387
|
+
}
|
|
388
|
+
catch { /* skip */ }
|
|
389
|
+
}
|
|
383
390
|
}
|
|
384
|
-
catch { /*
|
|
391
|
+
catch { /* parent may not exist */ }
|
|
385
392
|
}
|
|
386
|
-
|
|
387
|
-
|
|
393
|
+
// Copy entire built source to fresh version directory
|
|
394
|
+
cpSync(srcDir, freshDir, { recursive: true });
|
|
395
|
+
pluginRoot = freshDir;
|
|
396
|
+
s.stop(color.green(`Installed to ${newVersion}`));
|
|
397
|
+
// Install production deps in fresh dir
|
|
388
398
|
s.start("Installing production dependencies");
|
|
389
399
|
execSync("npm install --production --no-audit --no-fund", {
|
|
390
400
|
cwd: pluginRoot,
|
|
@@ -392,55 +402,46 @@ async function upgrade() {
|
|
|
392
402
|
timeout: 60000,
|
|
393
403
|
});
|
|
394
404
|
s.stop("Dependencies ready");
|
|
395
|
-
// Step
|
|
396
|
-
// This ensures even users upgrading from old versions get the fix
|
|
405
|
+
// Step 4: Update installed_plugins.json via spawned script (works from any old version)
|
|
397
406
|
s.start("Updating plugin registry");
|
|
398
407
|
try {
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
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 {}
|
|
434
|
-
}
|
|
435
|
-
if (dirs.length > 0) console.log("CLEANED:" + dirs.length);
|
|
436
|
-
} catch {}
|
|
437
|
-
}
|
|
438
|
-
`;
|
|
439
|
-
const result = execSync(`node -e ${JSON.stringify(postUpgradeScript)}`, {
|
|
408
|
+
const scriptPath = resolve(tmpDir + "-post-upgrade.mjs");
|
|
409
|
+
const scriptContent = [
|
|
410
|
+
`import { readFileSync, writeFileSync } from "fs";`,
|
|
411
|
+
`import { resolve } from "path";`,
|
|
412
|
+
`import { homedir } from "os";`,
|
|
413
|
+
`const pluginRoot = ${JSON.stringify(pluginRoot)};`,
|
|
414
|
+
`const newVersion = ${JSON.stringify(newVersion)};`,
|
|
415
|
+
`const ipPath = resolve(homedir(), ".claude", "plugins", "installed_plugins.json");`,
|
|
416
|
+
`try {`,
|
|
417
|
+
` const ipRaw = JSON.parse(readFileSync(ipPath, "utf-8"));`,
|
|
418
|
+
` const plugins = ipRaw.plugins || {};`,
|
|
419
|
+
` let updated = false;`,
|
|
420
|
+
` for (const [key, entries] of Object.entries(plugins)) {`,
|
|
421
|
+
` if (!key.toLowerCase().includes("context-mode")) continue;`,
|
|
422
|
+
` for (const entry of entries) {`,
|
|
423
|
+
` entry.installPath = pluginRoot;`,
|
|
424
|
+
` entry.version = newVersion;`,
|
|
425
|
+
` entry.lastUpdated = new Date().toISOString();`,
|
|
426
|
+
` updated = true;`,
|
|
427
|
+
` }`,
|
|
428
|
+
` }`,
|
|
429
|
+
` if (updated) {`,
|
|
430
|
+
` writeFileSync(ipPath, JSON.stringify(ipRaw, null, 2) + "\\n", "utf-8");`,
|
|
431
|
+
` console.log("REGISTRY_UPDATED");`,
|
|
432
|
+
` }`,
|
|
433
|
+
`} catch (e) { console.error("REGISTRY_FAILED:" + e.message); }`,
|
|
434
|
+
].join("\n");
|
|
435
|
+
writeFileSync(scriptPath, scriptContent, "utf-8");
|
|
436
|
+
const result = execSync(`node ${scriptPath}`, {
|
|
440
437
|
stdio: "pipe",
|
|
441
438
|
timeout: 10000,
|
|
442
439
|
encoding: "utf-8",
|
|
443
440
|
});
|
|
441
|
+
try {
|
|
442
|
+
rmSync(scriptPath, { force: true });
|
|
443
|
+
}
|
|
444
|
+
catch { /* ignore */ }
|
|
444
445
|
if (result.includes("REGISTRY_UPDATED")) {
|
|
445
446
|
s.stop(color.green("Plugin registry updated"));
|
|
446
447
|
changes.push("Updated plugin registry");
|
|
@@ -448,10 +449,6 @@ async function upgrade() {
|
|
|
448
449
|
else {
|
|
449
450
|
s.stop(color.yellow("Plugin registry unchanged"));
|
|
450
451
|
}
|
|
451
|
-
const cleanMatch = result.match(/CLEANED:(\d+)/);
|
|
452
|
-
if (cleanMatch) {
|
|
453
|
-
p.log.info(color.dim(` Cleaned ${cleanMatch[1]} old cache dir(s)`));
|
|
454
|
-
}
|
|
455
452
|
}
|
|
456
453
|
catch (err) {
|
|
457
454
|
s.stop(color.yellow("Plugin registry update skipped"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
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",
|