context-mode 0.9.7 → 0.9.8

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.
@@ -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.7",
16
+ "version": "0.9.8",
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.7",
3
+ "version": "0.9.8",
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,30 +370,33 @@ async function upgrade() {
370
370
  timeout: 30000,
371
371
  });
372
372
  s.stop("Built successfully");
373
- // Step 3: Nuke entire cache parent and install fresh with correct version dir
373
+ // Step 3: Install fresh into new version directory (don't touch old dir - process runs from it)
374
374
  s.start("Installing fresh");
375
375
  const cacheParentMatch = pluginRoot.match(/^(.*[\\/]plugins[\\/]cache[\\/][^\\/]+[\\/][^\\/]+[\\/])/);
376
376
  const freshDir = cacheParentMatch
377
377
  ? resolve(cacheParentMatch[1], newVersion)
378
378
  : pluginRoot;
379
- // Wipe all old cache directories
380
- if (cacheParentMatch) {
381
- const cacheParent = cacheParentMatch[1];
382
- try {
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 */ }
379
+ // If fresh dir is different from current, create it. Otherwise update in-place.
380
+ if (freshDir !== pluginRoot) {
381
+ rmSync(freshDir, { recursive: true, force: true });
382
+ cpSync(srcDir, freshDir, { recursive: true });
383
+ pluginRoot = freshDir;
384
+ }
385
+ else {
386
+ // Same dir copy files in-place
387
+ const items = [
388
+ "build", "src", "hooks", "skills", ".claude-plugin",
389
+ "start.mjs", "server.bundle.mjs", "package.json", ".mcp.json",
390
+ ];
391
+ for (const item of items) {
392
+ try {
393
+ rmSync(resolve(pluginRoot, item), { recursive: true, force: true });
394
+ cpSync(resolve(srcDir, item), resolve(pluginRoot, item), { recursive: true });
389
395
  }
396
+ catch { /* some files may not exist */ }
390
397
  }
391
- catch { /* parent may not exist */ }
392
398
  }
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}`));
399
+ s.stop(color.green(`Installed to ${freshDir.split("/").pop() ?? newVersion}`));
397
400
  // Install production deps in fresh dir
398
401
  s.start("Installing production dependencies");
399
402
  execSync("npm install --production --no-audit --no-fund", {
@@ -407,7 +410,7 @@ async function upgrade() {
407
410
  try {
408
411
  const scriptPath = resolve(tmpDir + "-post-upgrade.mjs");
409
412
  const scriptContent = [
410
- `import { readFileSync, writeFileSync } from "fs";`,
413
+ `import { readFileSync, writeFileSync, readdirSync, rmSync as rm } from "fs";`,
411
414
  `import { resolve } from "path";`,
412
415
  `import { homedir } from "os";`,
413
416
  `const pluginRoot = ${JSON.stringify(pluginRoot)};`,
@@ -431,6 +434,13 @@ async function upgrade() {
431
434
  ` console.log("REGISTRY_UPDATED");`,
432
435
  ` }`,
433
436
  `} catch (e) { console.error("REGISTRY_FAILED:" + e.message); }`,
437
+ `const curDir = pluginRoot.split(/[\\/\\\\]/).pop();`,
438
+ `const parDir = pluginRoot.replace(/[\\/\\\\][^\\/\\\\]+$/, "");`,
439
+ `try {`,
440
+ ` for (const d of readdirSync(parDir).filter(x => x !== curDir)) {`,
441
+ ` try { rm(resolve(parDir, d), { recursive: true, force: true }); console.log("CLEANED:" + d); } catch {}`,
442
+ ` }`,
443
+ `} catch {}`,
434
444
  ].join("\n");
435
445
  writeFileSync(scriptPath, scriptContent, "utf-8");
436
446
  const result = execSync(`node ${scriptPath}`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
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",