context-mode 1.0.35 → 1.0.37
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 +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.openclaw-plugin/openclaw.plugin.json +1 -1
- package/.openclaw-plugin/package.json +1 -1
- package/build/openclaw-plugin.js +8 -2
- package/build/server.js +8 -2
- package/cli.bundle.mjs +110 -103
- package/openclaw.plugin.json +1 -1
- package/package.json +5 -5
- package/scripts/postinstall.mjs +64 -0
- package/server.bundle.mjs +93 -86
- package/start.mjs +44 -2
- package/native-abi.mjs +0 -73
package/openclaw.plugin.json
CHANGED
|
@@ -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.
|
|
6
|
+
"version": "1.0.37",
|
|
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.
|
|
3
|
+
"version": "1.0.37",
|
|
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",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
".": "./build/opencode-plugin.js",
|
|
38
38
|
"./plugin": "./build/opencode-plugin.js",
|
|
39
39
|
"./openclaw": "./build/openclaw-plugin.js",
|
|
40
|
-
"./cli": "./
|
|
40
|
+
"./cli": "./cli.bundle.mjs"
|
|
41
41
|
},
|
|
42
42
|
"bin": {
|
|
43
|
-
"context-mode": "./
|
|
43
|
+
"context-mode": "./cli.bundle.mjs"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"build",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
".mcp.json",
|
|
55
55
|
"openclaw.plugin.json",
|
|
56
56
|
"start.mjs",
|
|
57
|
-
"
|
|
57
|
+
"scripts/postinstall.mjs",
|
|
58
58
|
"README.md",
|
|
59
59
|
"LICENSE"
|
|
60
60
|
],
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"test:compare": "npx tsx tests/context-comparison.ts",
|
|
76
76
|
"test:ecosystem": "npx tsx tests/ecosystem-benchmark.ts",
|
|
77
77
|
"install:openclaw": "node -e \"if(process.platform==='win32'){console.error('OpenClaw install requires bash (Git Bash or WSL)');process.exit(1)}else{require('child_process').execSync('bash scripts/install-openclaw-plugin.sh',{stdio:'inherit'})}\"",
|
|
78
|
-
"postinstall": "node
|
|
78
|
+
"postinstall": "node scripts/postinstall.mjs"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@clack/prompts": "^1.0.1",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* postinstall — cross-platform post-install tasks
|
|
4
|
+
*
|
|
5
|
+
* 1. OpenClaw detection (print helper message)
|
|
6
|
+
* 2. Windows global install: fix broken bin→node_modules path
|
|
7
|
+
* when nvm4w places the shim and node_modules in different directories.
|
|
8
|
+
* Creates a directory junction so npm's %~dp0\node_modules\... resolves.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
12
|
+
import { execSync } from "node:child_process";
|
|
13
|
+
import { dirname, resolve, join } from "node:path";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
15
|
+
|
|
16
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const pkgRoot = resolve(__dirname, "..");
|
|
18
|
+
|
|
19
|
+
// ── 1. OpenClaw detection ────────────────────────────────────────────
|
|
20
|
+
if (process.env.OPENCLAW_STATE_DIR) {
|
|
21
|
+
console.log("\n OpenClaw detected. Run: npm run install:openclaw\n");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ── 2. Windows global install — nvm4w junction fix ───────────────────
|
|
25
|
+
// npm's .cmd shim resolves modules via %~dp0\node_modules\<pkg>\...
|
|
26
|
+
// On nvm4w the shim lives at C:\nvm4w\nodejs\ but node_modules is at
|
|
27
|
+
// C:\Users\<USER>\AppData\Roaming\npm\node_modules\. The relative path
|
|
28
|
+
// breaks because they're on different prefixes.
|
|
29
|
+
//
|
|
30
|
+
// Fix: detect the mismatch and create a directory junction so the shim
|
|
31
|
+
// can reach us through the expected relative path.
|
|
32
|
+
|
|
33
|
+
if (process.platform === "win32" && process.env.npm_config_global === "true") {
|
|
34
|
+
try {
|
|
35
|
+
// Where npm puts bin shims (the directory the .cmd lives in)
|
|
36
|
+
const binDir = execSync("npm bin -g", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
37
|
+
// Where our package actually lives
|
|
38
|
+
const actualPkgDir = pkgRoot;
|
|
39
|
+
// Where the .cmd shim expects us to be
|
|
40
|
+
const expectedPkgDir = join(binDir, "node_modules", "context-mode");
|
|
41
|
+
|
|
42
|
+
// If shim expects a different path than where we actually are, create a junction
|
|
43
|
+
if (
|
|
44
|
+
resolve(expectedPkgDir).toLowerCase() !== resolve(actualPkgDir).toLowerCase() &&
|
|
45
|
+
!existsSync(expectedPkgDir)
|
|
46
|
+
) {
|
|
47
|
+
// Ensure parent node_modules dir exists
|
|
48
|
+
const expectedNodeModules = join(binDir, "node_modules");
|
|
49
|
+
if (!existsSync(expectedNodeModules)) {
|
|
50
|
+
mkdirSync(expectedNodeModules, { recursive: true });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Create directory junction (no admin privileges needed on Windows 10+)
|
|
54
|
+
execSync(`mklink /J "${expectedPkgDir}" "${actualPkgDir}"`, {
|
|
55
|
+
shell: "cmd.exe",
|
|
56
|
+
stdio: "pipe",
|
|
57
|
+
});
|
|
58
|
+
console.log(`\n context-mode: created junction for nvm4w compatibility`);
|
|
59
|
+
console.log(` ${expectedPkgDir} → ${actualPkgDir}\n`);
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
// Best effort — don't block install. User can use npx as fallback.
|
|
63
|
+
}
|
|
64
|
+
}
|