context-mode 1.0.7 → 1.0.9

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.7"
9
+ "version": "1.0.9"
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.7",
16
+ "version": "1.0.9",
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.7",
3
+ "version": "1.0.9",
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",
package/build/cli.js CHANGED
@@ -14,7 +14,8 @@
14
14
  import * as p from "@clack/prompts";
15
15
  import color from "picocolors";
16
16
  import { execSync } from "node:child_process";
17
- import { readFileSync, cpSync, accessSync, readdirSync, rmSync, closeSync, openSync, constants } from "node:fs";
17
+ import { readFileSync, cpSync, accessSync, existsSync, readdirSync, rmSync, closeSync, openSync, constants } from "node:fs";
18
+ import { request as httpsRequest } from "node:https";
18
19
  import { resolve, dirname, join } from "node:path";
19
20
  import { tmpdir, devNull } from "node:os";
20
21
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -91,7 +92,11 @@ export function toUnixPath(p) {
91
92
  function getPluginRoot() {
92
93
  const __filename = fileURLToPath(import.meta.url);
93
94
  const __dirname = dirname(__filename);
94
- return resolve(__dirname, "..");
95
+ // build/cli.js → go up one level; cli.bundle.mjs at project root → stay here
96
+ if (__dirname.endsWith("/build") || __dirname.endsWith("\\build")) {
97
+ return resolve(__dirname, "..");
98
+ }
99
+ return __dirname;
95
100
  }
96
101
  function getLocalVersion() {
97
102
  try {
@@ -103,16 +108,27 @@ function getLocalVersion() {
103
108
  }
104
109
  }
105
110
  async function fetchLatestVersion() {
106
- try {
107
- const resp = await fetch("https://registry.npmjs.org/context-mode/latest");
108
- if (!resp.ok)
109
- return "unknown";
110
- const data = (await resp.json());
111
- return data.version ?? "unknown";
112
- }
113
- catch {
114
- return "unknown";
115
- }
111
+ // Use node:https instead of global fetch to avoid a Windows libuv assertion
112
+ // (UV_HANDLE_CLOSING) caused by undici's connection-pool background threads
113
+ // racing with process.exit() teardown on Node.js v24+.
114
+ return new Promise((resolve) => {
115
+ const req = httpsRequest("https://registry.npmjs.org/context-mode/latest", { headers: { Connection: "close" } }, (res) => {
116
+ let raw = "";
117
+ res.on("data", (chunk) => { raw += chunk; });
118
+ res.on("end", () => {
119
+ try {
120
+ const data = JSON.parse(raw);
121
+ resolve(data.version ?? "unknown");
122
+ }
123
+ catch {
124
+ resolve("unknown");
125
+ }
126
+ });
127
+ });
128
+ req.on("error", () => resolve("unknown"));
129
+ req.setTimeout(5000, () => { req.destroy(); resolve("unknown"); });
130
+ req.end();
131
+ });
116
132
  }
117
133
  /* -------------------------------------------------------
118
134
  * Doctor — adapter-aware diagnostics
@@ -370,7 +386,7 @@ async function upgrade() {
370
386
  }
371
387
  const items = [
372
388
  "build", "src", "hooks", "skills", ".claude-plugin",
373
- "start.mjs", "server.bundle.mjs", "package.json", ".mcp.json",
389
+ "start.mjs", "server.bundle.mjs", "cli.bundle.mjs", "package.json", ".mcp.json",
374
390
  ];
375
391
  for (const item of items) {
376
392
  try {
@@ -445,14 +461,16 @@ async function upgrade() {
445
461
  // Step 5: Set hook script permissions — adapter-aware
446
462
  p.log.step("Setting hook script permissions...");
447
463
  const permSet = adapter.setHookPermissions(pluginRoot);
448
- // Also ensure CLI binary is executable (tsc doesn't set +x)
449
- const cliBin = resolve(pluginRoot, "build", "cli.js");
450
- try {
451
- accessSync(cliBin, constants.F_OK);
452
- execSync(`chmod +x "${cliBin}"`, { stdio: "ignore" });
453
- permSet.push(cliBin);
464
+ // Also ensure CLI binaries are executable (tsc doesn't set +x)
465
+ for (const bin of ["build/cli.js", "cli.bundle.mjs"]) {
466
+ const binPath = resolve(pluginRoot, bin);
467
+ try {
468
+ accessSync(binPath, constants.F_OK);
469
+ execSync(`chmod +x "${binPath}"`, { stdio: "ignore" });
470
+ permSet.push(binPath);
471
+ }
472
+ catch { /* not found — skip */ }
454
473
  }
455
- catch { /* cli.js not found — skip */ }
456
474
  if (permSet.length > 0) {
457
475
  p.log.success(color.green("Permissions set") + color.dim(` — ${permSet.length} hook script(s)`));
458
476
  changes.push(`Set ${permSet.length} hook scripts as executable`);
@@ -472,7 +490,10 @@ async function upgrade() {
472
490
  p.log.step("Running doctor to verify...");
473
491
  console.log();
474
492
  try {
475
- execSync(`node "${resolve(pluginRoot, "build", "cli.js")}" doctor`, {
493
+ const cliBundlePath = resolve(pluginRoot, "cli.bundle.mjs");
494
+ const cliBuildPath = resolve(pluginRoot, "build", "cli.js");
495
+ const cliPath = existsSync(cliBundlePath) ? cliBundlePath : cliBuildPath;
496
+ execSync(`node "${cliPath}" doctor`, {
476
497
  stdio: "inherit",
477
498
  timeout: 30000,
478
499
  cwd: pluginRoot,
package/build/server.js CHANGED
@@ -13,7 +13,7 @@ import { ContentStore, cleanupStaleDBs } from "./store.js";
13
13
  import { readBashPolicies, evaluateCommandDenyOnly, extractShellCommands, readToolDenyPatterns, evaluateFilePath, } from "./security.js";
14
14
  import { detectRuntimes, getRuntimeSummary, getAvailableLanguages, hasBunRuntime, } from "./runtime.js";
15
15
  import { classifyNonZeroExit } from "./exit-classify.js";
16
- const VERSION = "1.0.7";
16
+ const VERSION = "1.0.9";
17
17
  // Prevent silent server death from unhandled async errors
18
18
  process.on("unhandledRejection", (err) => {
19
19
  process.stderr.write(`[context-mode] unhandledRejection: ${err}\n`);