context-mode 1.0.103 → 1.0.104
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/README.md +66 -5
- package/bin/statusline.mjs +321 -0
- package/build/adapters/antigravity/index.d.ts +6 -0
- package/build/adapters/antigravity/index.js +10 -0
- package/build/adapters/base.d.ts +23 -0
- package/build/adapters/base.js +29 -0
- package/build/adapters/codex/index.d.ts +10 -0
- package/build/adapters/codex/index.js +22 -4
- package/build/adapters/cursor/index.d.ts +7 -0
- package/build/adapters/cursor/index.js +11 -0
- package/build/adapters/detect.d.ts +12 -1
- package/build/adapters/detect.js +69 -7
- package/build/adapters/gemini-cli/index.d.ts +8 -1
- package/build/adapters/gemini-cli/index.js +19 -7
- package/build/adapters/jetbrains-copilot/index.d.ts +7 -0
- package/build/adapters/jetbrains-copilot/index.js +12 -0
- package/build/adapters/kiro/index.d.ts +8 -0
- package/build/adapters/kiro/index.js +12 -0
- package/build/adapters/openclaw/index.d.ts +17 -0
- package/build/adapters/openclaw/index.js +29 -4
- package/build/adapters/opencode/index.d.ts +8 -0
- package/build/adapters/opencode/index.js +18 -6
- package/build/adapters/qwen-code/index.d.ts +1 -0
- package/build/adapters/qwen-code/index.js +3 -0
- package/build/adapters/types.d.ts +33 -0
- package/build/adapters/vscode-copilot/index.d.ts +6 -0
- package/build/adapters/vscode-copilot/index.js +10 -0
- package/build/adapters/zed/index.d.ts +1 -0
- package/build/adapters/zed/index.js +3 -0
- package/build/cli.d.ts +15 -0
- package/build/cli.js +62 -16
- package/build/concurrency/runPool.d.ts +36 -0
- package/build/concurrency/runPool.js +51 -0
- package/build/executor.d.ts +11 -1
- package/build/executor.js +59 -16
- package/build/fetch-cache.d.ts +13 -0
- package/build/fetch-cache.js +15 -0
- package/build/lifecycle.d.ts +6 -2
- package/build/lifecycle.js +29 -2
- package/build/opencode-plugin.d.ts +6 -0
- package/build/opencode-plugin.js +60 -1
- package/build/routing-block.d.ts +8 -0
- package/build/routing-block.js +86 -0
- package/build/runtime.d.ts +1 -0
- package/build/runtime.js +54 -3
- package/build/search/auto-memory.d.ts +23 -10
- package/build/search/auto-memory.js +64 -26
- package/build/search/unified.d.ts +3 -0
- package/build/search/unified.js +2 -2
- package/build/server.d.ts +42 -0
- package/build/server.js +693 -164
- package/build/session/analytics.d.ts +49 -1
- package/build/session/analytics.js +278 -16
- package/build/session/db.d.ts +39 -8
- package/build/session/db.js +170 -19
- package/build/session/extract.js +124 -2
- package/build/tool-naming.d.ts +4 -0
- package/build/tool-naming.js +24 -0
- package/cli.bundle.mjs +201 -159
- package/configs/antigravity/GEMINI.md +11 -0
- package/configs/claude-code/CLAUDE.md +11 -0
- package/configs/codex/AGENTS.md +11 -0
- package/configs/cursor/context-mode.mdc +11 -0
- package/configs/gemini-cli/GEMINI.md +11 -0
- package/configs/jetbrains-copilot/copilot-instructions.md +3 -0
- package/configs/kilo/AGENTS.md +11 -0
- package/configs/kiro/KIRO.md +11 -0
- package/configs/openclaw/AGENTS.md +11 -0
- package/configs/opencode/AGENTS.md +11 -0
- package/configs/pi/AGENTS.md +11 -0
- package/configs/qwen-code/QWEN.md +11 -0
- package/configs/vscode-copilot/copilot-instructions.md +3 -0
- package/configs/zed/AGENTS.md +11 -0
- package/hooks/auto-injection.mjs +36 -10
- package/hooks/cache-heal-utils.mjs +231 -0
- package/hooks/codex/sessionstart.mjs +7 -4
- package/hooks/core/routing.mjs +5 -0
- package/hooks/cursor/sessionstart.mjs +7 -4
- package/hooks/formatters/claude-code.mjs +20 -0
- package/hooks/gemini-cli/sessionstart.mjs +7 -2
- package/hooks/jetbrains-copilot/sessionstart.mjs +7 -2
- package/hooks/normalize-hooks.mjs +184 -0
- package/hooks/session-db.bundle.mjs +33 -14
- package/hooks/session-extract.bundle.mjs +2 -2
- package/hooks/session-helpers.mjs +68 -20
- package/hooks/session-loaders.mjs +8 -2
- package/hooks/sessionstart.mjs +8 -2
- package/hooks/vscode-copilot/sessionstart.mjs +7 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -1
- package/server.bundle.mjs +164 -125
- package/skills/ctx-insight/SKILL.md +1 -1
- package/start.mjs +63 -3
|
@@ -15,7 +15,7 @@ Open the personal analytics dashboard in the browser.
|
|
|
15
15
|
|
|
16
16
|
## Instructions
|
|
17
17
|
|
|
18
|
-
1. Call the `ctx_insight` MCP tool (no parameters needed, or pass `port: 4747` to customize).
|
|
18
|
+
1. Call the `ctx_insight` MCP tool (no parameters needed, or pass `port: 4747` to customize). Optional data-dir overrides: `sessionDir`/`insightSessionDir` for `INSIGHT_SESSION_DIR`, and `contentDir`/`insightContentDir` for `INSIGHT_CONTENT_DIR`.
|
|
19
19
|
2. The tool will:
|
|
20
20
|
- Copy source files to cache (first run only)
|
|
21
21
|
- Install dependencies (first run only, ~30s)
|
package/start.mjs
CHANGED
|
@@ -101,7 +101,18 @@ if (cacheMatch) {
|
|
|
101
101
|
// even when the plugin cache is completely broken. It creates symlinks for any
|
|
102
102
|
// missing plugin cache directories on every session start.
|
|
103
103
|
// Pure Node.js — no bash dependency. Works on Windows, macOS (SIP), Linux.
|
|
104
|
+
//
|
|
105
|
+
// Brew node upgrade resilience:
|
|
106
|
+
// - On Unix we register the hook command as the bare script path. The script
|
|
107
|
+
// itself carries `#!/usr/bin/env node`, so `env` resolves node from PATH at
|
|
108
|
+
// runtime. This survives Brew/asdf/nvm upgrades that move node binaries.
|
|
109
|
+
// - On Windows there is no shebang; we fall back to "<execPath>" "<scriptPath>".
|
|
110
|
+
// - On every boot we self-heal stale "/opt/homebrew/Cellar/node/<ver>/..." paths
|
|
111
|
+
// left behind by older versions of this code.
|
|
104
112
|
try {
|
|
113
|
+
const { buildHookCommand, selfHealCacheHealHook, ensureShebangAndExecBit } =
|
|
114
|
+
await import("./hooks/cache-heal-utils.mjs");
|
|
115
|
+
|
|
105
116
|
const globalHooksDir = resolve(homedir(), ".claude", "hooks");
|
|
106
117
|
const healHookPath = resolve(globalHooksDir, "context-mode-cache-heal.mjs");
|
|
107
118
|
// Clean up old bash version if it exists
|
|
@@ -142,6 +153,13 @@ try{
|
|
|
142
153
|
`;
|
|
143
154
|
writeFileSync(healHookPath, healScript, { mode: 0o755 });
|
|
144
155
|
}
|
|
156
|
+
|
|
157
|
+
// Always re-assert shebang + chmod +x on Unix so the bare-script hook
|
|
158
|
+
// command is spawnable even if the file was created without exec bit.
|
|
159
|
+
if (process.platform !== "win32") {
|
|
160
|
+
try { ensureShebangAndExecBit(healHookPath); } catch { /* best effort */ }
|
|
161
|
+
}
|
|
162
|
+
|
|
145
163
|
// Register the hook in ~/.claude/settings.json (Claude Code doesn't auto-discover hook files)
|
|
146
164
|
const settingsPath = resolve(homedir(), ".claude", "settings.json");
|
|
147
165
|
if (existsSync(settingsPath)) {
|
|
@@ -152,18 +170,60 @@ try{
|
|
|
152
170
|
h.hooks?.some((hh) => hh.command?.includes("context-mode-cache-heal")),
|
|
153
171
|
);
|
|
154
172
|
if (!alreadyRegistered) {
|
|
155
|
-
const _nodePath = process.execPath.replace(/\\/g, "/");
|
|
156
|
-
const _healPath = healHookPath.replace(/\\/g, "/");
|
|
157
173
|
sessionStart.push({
|
|
158
|
-
hooks: [
|
|
174
|
+
hooks: [
|
|
175
|
+
{
|
|
176
|
+
type: "command",
|
|
177
|
+
command: buildHookCommand({
|
|
178
|
+
scriptPath: healHookPath,
|
|
179
|
+
platform: process.platform,
|
|
180
|
+
nodePath: process.execPath,
|
|
181
|
+
}),
|
|
182
|
+
},
|
|
183
|
+
],
|
|
159
184
|
});
|
|
160
185
|
hooks.SessionStart = sessionStart;
|
|
161
186
|
settings.hooks = hooks;
|
|
162
187
|
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
|
|
163
188
|
}
|
|
189
|
+
|
|
190
|
+
// Self-heal: rewrite an existing cache-heal hook command if it points at
|
|
191
|
+
// a node binary that no longer exists (Brew node upgrade scenario).
|
|
192
|
+
try {
|
|
193
|
+
selfHealCacheHealHook({
|
|
194
|
+
settingsPath,
|
|
195
|
+
scriptPath: healHookPath,
|
|
196
|
+
platform: process.platform,
|
|
197
|
+
nodePath: process.execPath,
|
|
198
|
+
});
|
|
199
|
+
} catch { /* best effort */ }
|
|
164
200
|
}
|
|
165
201
|
} catch { /* best effort */ }
|
|
166
202
|
|
|
203
|
+
// ── Self-heal Layer 5: Windows hooks.json + plugin.json normalization (#378) ──
|
|
204
|
+
// Static committed files use ${CLAUDE_PLUGIN_ROOT} placeholder + bare `node`.
|
|
205
|
+
// On Windows + Claude Code this hits cjs/loader:1479 because:
|
|
206
|
+
// 1. bare `node` may not resolve via PATH (Git Bash, see #369)
|
|
207
|
+
// 2. ${CLAUDE_PLUGIN_ROOT} can hit MSYS path mangling (#372)
|
|
208
|
+
// 3. backslash paths corrupt under shell quoting
|
|
209
|
+
// Rewrites placeholders to absolute paths using process.execPath (Datadog
|
|
210
|
+
// model). Idempotent — only writes when needed. Survives upgrades because
|
|
211
|
+
// it runs at every MCP boot.
|
|
212
|
+
//
|
|
213
|
+
// Skip under vitest: server.test.ts spawns this script from the repo root,
|
|
214
|
+
// and a mutated .claude-plugin/plugin.json poisons sibling tests that read
|
|
215
|
+
// the file (cli.test.ts). VITEST is inherited by spawned subprocesses.
|
|
216
|
+
if (!process.env.VITEST) {
|
|
217
|
+
try {
|
|
218
|
+
const { normalizeHooksOnStartup } = await import("./hooks/normalize-hooks.mjs");
|
|
219
|
+
normalizeHooksOnStartup({
|
|
220
|
+
pluginRoot: __dirname,
|
|
221
|
+
nodePath: process.execPath,
|
|
222
|
+
platform: process.platform,
|
|
223
|
+
});
|
|
224
|
+
} catch { /* best effort — never block server startup */ }
|
|
225
|
+
}
|
|
226
|
+
|
|
167
227
|
// Ensure native dependencies + ABI compatibility (shared with hooks via ensure-deps.mjs)
|
|
168
228
|
// ensure-deps handles better-sqlite3 install + ABI cache/rebuild automatically (#148, #203)
|
|
169
229
|
import "./hooks/ensure-deps.mjs";
|