context-mode 1.0.161 → 1.0.163
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/.codex-plugin/plugin.json +1 -1
- package/.openclaw-plugin/openclaw.plugin.json +1 -1
- package/.openclaw-plugin/package.json +1 -1
- package/README.md +142 -28
- package/bin/statusline.mjs +24 -4
- package/build/adapters/antigravity/index.d.ts +1 -1
- package/build/adapters/antigravity-cli/index.d.ts +51 -0
- package/build/adapters/antigravity-cli/index.js +341 -0
- package/build/adapters/claude-code/hooks.d.ts +1 -0
- package/build/adapters/claude-code/hooks.js +3 -0
- package/build/adapters/claude-code/index.js +24 -5
- package/build/adapters/client-map.js +5 -0
- package/build/adapters/codex/hooks.d.ts +5 -1
- package/build/adapters/codex/hooks.js +5 -1
- package/build/adapters/codex/index.d.ts +9 -1
- package/build/adapters/codex/index.js +87 -5
- package/build/adapters/copilot-cli/hooks.d.ts +33 -0
- package/build/adapters/copilot-cli/hooks.js +64 -0
- package/build/adapters/copilot-cli/index.d.ts +48 -0
- package/build/adapters/copilot-cli/index.js +341 -0
- package/build/adapters/detect.d.ts +1 -1
- package/build/adapters/detect.js +71 -3
- package/build/adapters/openclaw/mcp-tools.js +1 -1
- package/build/adapters/opencode/index.js +31 -17
- package/build/adapters/opencode/zod3tov4.js +27 -6
- package/build/adapters/pi/extension.d.ts +2 -12
- package/build/adapters/pi/extension.js +114 -96
- package/build/adapters/types.d.ts +5 -4
- package/build/adapters/types.js +4 -3
- package/build/cache-heal.d.ts +48 -0
- package/build/cache-heal.js +150 -0
- package/build/cli.js +37 -97
- package/build/executor.d.ts +25 -0
- package/build/executor.js +143 -22
- package/build/opencode-plugin.js +5 -2
- package/build/routing-block.d.ts +8 -0
- package/build/routing-block.js +86 -0
- package/build/runtime.d.ts +0 -36
- package/build/runtime.js +107 -27
- package/build/search/flood-guard.d.ts +57 -0
- package/build/search/flood-guard.js +80 -0
- package/build/security.d.ts +8 -3
- package/build/security.js +155 -29
- package/build/server.d.ts +14 -0
- package/build/server.js +368 -350
- package/build/session/analytics.d.ts +8 -8
- package/build/session/analytics.js +18 -13
- package/build/session/db.d.ts +1 -0
- package/build/session/db.js +37 -4
- package/build/session/extract.d.ts +46 -0
- package/build/session/extract.js +764 -13
- package/build/session/project-attribution.js +14 -0
- package/build/store.d.ts +1 -1
- package/build/store.js +139 -25
- package/build/tool-naming.d.ts +4 -0
- package/build/tool-naming.js +24 -0
- package/build/util/jsonc.d.ts +14 -0
- package/build/util/jsonc.js +104 -0
- package/cli.bundle.mjs +260 -254
- package/configs/antigravity/GEMINI.md +2 -2
- package/configs/antigravity-cli/hooks/hooks.json +37 -0
- package/configs/antigravity-cli/hooks.json +37 -0
- package/configs/antigravity-cli/mcp_config.json +10 -0
- package/configs/antigravity-cli/plugin.json +14 -0
- package/configs/antigravity-cli/rules/context-mode.md +77 -0
- package/configs/antigravity-cli/skills/context-mode/SKILL.md +77 -0
- package/configs/claude-code/CLAUDE.md +2 -2
- package/configs/codex/AGENTS.md +2 -2
- package/configs/copilot-cli/.github/plugin/plugin.json +23 -0
- package/configs/copilot-cli/.mcp.json +12 -0
- package/configs/copilot-cli/README.md +47 -0
- package/configs/copilot-cli/hooks.json +41 -0
- package/configs/copilot-cli/skills/context-mode/SKILL.md +38 -0
- package/configs/gemini-cli/GEMINI.md +2 -2
- package/configs/jetbrains-copilot/copilot-instructions.md +2 -2
- package/configs/kilo/AGENTS.md +2 -2
- package/configs/kiro/KIRO.md +2 -2
- package/configs/omp/SYSTEM.md +2 -2
- package/configs/openclaw/AGENTS.md +2 -2
- package/configs/opencode/AGENTS.md +2 -2
- package/configs/qwen-code/QWEN.md +2 -2
- package/configs/vscode-copilot/copilot-instructions.md +2 -2
- package/configs/zed/AGENTS.md +2 -2
- package/hooks/antigravity-cli/payload.mjs +98 -0
- package/hooks/antigravity-cli/posttooluse.mjs +138 -0
- package/hooks/antigravity-cli/pretooluse.mjs +78 -0
- package/hooks/antigravity-cli/stop.mjs +58 -0
- package/hooks/codex/pretooluse.mjs +14 -4
- package/hooks/codex/stop.mjs +12 -4
- package/hooks/copilot-cli/posttooluse.mjs +79 -0
- package/hooks/copilot-cli/precompact.mjs +66 -0
- package/hooks/copilot-cli/pretooluse.mjs +41 -0
- package/hooks/copilot-cli/sessionstart.mjs +121 -0
- package/hooks/copilot-cli/stop.mjs +59 -0
- package/hooks/copilot-cli/userpromptsubmit.mjs +77 -0
- package/hooks/core/codex-caps.mjs +112 -0
- package/hooks/core/formatters.mjs +158 -7
- package/hooks/core/mcp-ready.mjs +37 -8
- package/hooks/core/routing.mjs +94 -8
- package/hooks/core/tool-naming.mjs +3 -0
- package/hooks/hooks.json +12 -1
- package/hooks/pretooluse.mjs +6 -2
- package/hooks/routing-block.mjs +2 -2
- package/hooks/security.bundle.mjs +2 -1
- package/hooks/session-db.bundle.mjs +11 -7
- package/hooks/session-directive.mjs +88 -20
- package/hooks/session-extract.bundle.mjs +2 -2
- package/hooks/session-helpers.mjs +21 -0
- package/hooks/session-loaders.mjs +8 -5
- package/hooks/sessionstart.mjs +53 -7
- package/hooks/stop.mjs +49 -0
- package/hooks/userpromptsubmit.mjs +9 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -10
- package/scripts/install-antigravity-cli-plugin.mjs +141 -0
- package/server.bundle.mjs +214 -205
- package/skills/ctx-insight/SKILL.md +12 -17
- package/build/util/db-lock.d.ts +0 -65
- package/build/util/db-lock.js +0 -166
- package/insight/index.html +0 -13
- package/insight/package.json +0 -55
- package/insight/server.mjs +0 -1265
- package/insight/src/components/analytics.tsx +0 -112
- package/insight/src/components/ui/badge.tsx +0 -52
- package/insight/src/components/ui/button.tsx +0 -58
- package/insight/src/components/ui/card.tsx +0 -103
- package/insight/src/components/ui/chart.tsx +0 -371
- package/insight/src/components/ui/collapsible.tsx +0 -19
- package/insight/src/components/ui/input.tsx +0 -20
- package/insight/src/components/ui/progress.tsx +0 -83
- package/insight/src/components/ui/scroll-area.tsx +0 -55
- package/insight/src/components/ui/separator.tsx +0 -23
- package/insight/src/components/ui/table.tsx +0 -114
- package/insight/src/components/ui/tabs.tsx +0 -82
- package/insight/src/components/ui/tooltip.tsx +0 -64
- package/insight/src/lib/api.ts +0 -144
- package/insight/src/lib/utils.ts +0 -6
- package/insight/src/main.tsx +0 -22
- package/insight/src/routeTree.gen.ts +0 -189
- package/insight/src/router.tsx +0 -19
- package/insight/src/routes/__root.tsx +0 -55
- package/insight/src/routes/enterprise.tsx +0 -316
- package/insight/src/routes/index.tsx +0 -1482
- package/insight/src/routes/knowledge.tsx +0 -221
- package/insight/src/routes/knowledge_.$dbHash.$sourceId.tsx +0 -137
- package/insight/src/routes/search.tsx +0 -97
- package/insight/src/routes/sessions.tsx +0 -179
- package/insight/src/routes/sessions_.$dbHash.$sessionId.tsx +0 -181
- package/insight/src/styles.css +0 -104
- package/insight/tsconfig.json +0 -29
- package/insight/vite.config.ts +0 -19
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Cross-platform installer: register the context-mode plugin into Antigravity CLI (agy).
|
|
4
|
+
*
|
|
5
|
+
* Replaces the former bash-only scripts/install-antigravity-cli-plugin.sh so
|
|
6
|
+
* `npm run install:agy` runs natively on Windows (PowerShell/cmd) as well as
|
|
7
|
+
* macOS/Linux. agy itself runs on Windows, so its installer must too — unlike
|
|
8
|
+
* the openclaw installer, which is genuinely POSIX-only (signals, pgrep, /tmp).
|
|
9
|
+
*
|
|
10
|
+
* The bundle (configs/antigravity-cli/) registers the context-mode MCP server,
|
|
11
|
+
* routing rule, routing skill, and bounded PreToolUse/PostToolUse/Stop hooks in
|
|
12
|
+
* one step.
|
|
13
|
+
*
|
|
14
|
+
* Usage: npm run install:agy (or: node scripts/install-antigravity-cli-plugin.mjs)
|
|
15
|
+
*/
|
|
16
|
+
import { spawnSync } from "node:child_process";
|
|
17
|
+
import { existsSync, rmSync } from "node:fs";
|
|
18
|
+
import { homedir } from "node:os";
|
|
19
|
+
import { dirname, join, resolve } from "node:path";
|
|
20
|
+
import { fileURLToPath } from "node:url";
|
|
21
|
+
|
|
22
|
+
const isWin = process.platform === "win32";
|
|
23
|
+
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
24
|
+
const bundle = resolve(repoRoot, "configs", "antigravity-cli");
|
|
25
|
+
|
|
26
|
+
// Double-quote a path so a clone dir with spaces survives the shell on both
|
|
27
|
+
// cmd.exe and /bin/sh (paths never contain literal quotes).
|
|
28
|
+
const q = (s) => `"${s}"`;
|
|
29
|
+
|
|
30
|
+
// Cross-platform "is <cmd> on PATH?" — `where` on Windows, `command -v` on POSIX.
|
|
31
|
+
// shell:true is required: `command -v` is a shell builtin and `where`/`agy` may
|
|
32
|
+
// resolve to a .cmd shim on Windows that only the shell can launch.
|
|
33
|
+
function onPath(cmd) {
|
|
34
|
+
const probe = isWin ? `where ${cmd}` : `command -v ${cmd}`;
|
|
35
|
+
return spawnSync(probe, { stdio: "ignore", shell: true }).status === 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// — preflight —
|
|
39
|
+
if (!onPath("agy")) {
|
|
40
|
+
console.error("✗ 'agy' (Antigravity CLI) not found in PATH. Install agy first, then re-run.");
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
if (!existsSync(bundle)) {
|
|
44
|
+
console.error(`✗ plugin bundle not found at ${bundle}`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log("→ context-mode agy plugin installer");
|
|
49
|
+
console.log(` bundle : ${bundle}`);
|
|
50
|
+
|
|
51
|
+
// The plugin's MCP server runs the global `context-mode` binary (it needs the
|
|
52
|
+
// native better-sqlite3 dependency, which a bare clone does not have). Warn — do
|
|
53
|
+
// not silently global-install on the user's behalf.
|
|
54
|
+
const hasContextMode = onPath("context-mode");
|
|
55
|
+
if (!hasContextMode) {
|
|
56
|
+
console.error("⚠ 'context-mode' is not on PATH — the plugin's MCP server requires it.");
|
|
57
|
+
console.error(" Install it with: npm install -g context-mode");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Run `agy plugin install <bundle>`. String command + shell:true so cmd.exe can
|
|
61
|
+
// resolve agy's .cmd shim on Windows; the quoted bundle path handles spaces.
|
|
62
|
+
const install = spawnSync(`agy plugin install ${q(bundle)}`, { stdio: "inherit", shell: true });
|
|
63
|
+
if (install.status !== 0) {
|
|
64
|
+
console.error(`✗ 'agy plugin install' failed (exit ${install.status ?? "unknown"}).`);
|
|
65
|
+
process.exit(install.status ?? 1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// MCP is registered by `agy plugin install` above, straight from the bundle's
|
|
69
|
+
// native `mcp_config.json` (env-pinned CONTEXT_MODE_PLATFORM=antigravity-cli).
|
|
70
|
+
// Verified on agy 1.0.6: it logs "mcpServers : 1 processed" and writes the
|
|
71
|
+
// server into agy's plugin profile
|
|
72
|
+
// (~/.gemini/config/plugins/context-mode/mcp_config.json, env preserved).
|
|
73
|
+
// agy native validation/install does not read `.mcp.json`; keep the bundle on
|
|
74
|
+
// the single native `mcp_config.json` path to avoid manifest drift.
|
|
75
|
+
|
|
76
|
+
// agy CACHES each MCP server's tool schemas under
|
|
77
|
+
// ~/.gemini/antigravity-cli/mcp/<server>/ and does NOT refresh them on reconnect
|
|
78
|
+
// (verified on agy 1.0.6). A cache captured by an older context-mode holds the
|
|
79
|
+
// Gemini-incompatible schemas (`const` / `additionalProperties`) that make
|
|
80
|
+
// Antigravity CLI silently DROP the ctx_* tools from the model's function list —
|
|
81
|
+
// so even after upgrading, agy keeps hiding the tools and the agent works around
|
|
82
|
+
// them via shell scripts. Clear the cache so agy re-fetches the current
|
|
83
|
+
// (Gemini-safe) tools/list on its next launch.
|
|
84
|
+
const agyToolCache = join(homedir(), ".gemini", "antigravity-cli", "mcp", "context-mode");
|
|
85
|
+
let cacheCleared = false;
|
|
86
|
+
if (existsSync(agyToolCache)) {
|
|
87
|
+
try {
|
|
88
|
+
rmSync(agyToolCache, { recursive: true, force: true });
|
|
89
|
+
cacheCleared = true;
|
|
90
|
+
} catch (err) {
|
|
91
|
+
console.error(`⚠ Could not clear agy's stale tool-schema cache at ${agyToolCache}: ${err.message}`);
|
|
92
|
+
console.error(" If ctx_* tools don't appear in agy, delete that folder manually and restart agy.");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Probe whether the global `context-mode` understands the antigravity-cli hooks.
|
|
97
|
+
// The shipped hook commands resolve the GLOBAL binary at runtime. A context-mode
|
|
98
|
+
// older than the release that added Antigravity CLI support may have no
|
|
99
|
+
// `antigravity-cli` HOOK_MAP entry, and the dispatcher suppresses stderr, so the
|
|
100
|
+
// hooks would be a SILENT no-op. Detect that here and tell the user instead.
|
|
101
|
+
let hooksOk = false;
|
|
102
|
+
if (hasContextMode) {
|
|
103
|
+
hooksOk = ["pretooluse", "posttooluse", "stop"].every((event) => {
|
|
104
|
+
const probe = spawnSync(`context-mode hook antigravity-cli ${event}`, {
|
|
105
|
+
input: "{}",
|
|
106
|
+
stdio: ["pipe", "ignore", "ignore"],
|
|
107
|
+
shell: true,
|
|
108
|
+
});
|
|
109
|
+
return probe.status === 0;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
console.log("");
|
|
114
|
+
// Confirm `agy plugin install` actually registered the MCP from the bundle's
|
|
115
|
+
// MCP config (it writes it into agy's plugin profile). If a future agy build
|
|
116
|
+
// skips it, fall back to a one-line manual instruction rather than silently
|
|
117
|
+
// leaving MCP unconfigured — never re-introduce a blind global-profile write.
|
|
118
|
+
const pluginMcp = join(homedir(), ".gemini", "config", "plugins", "context-mode", "mcp_config.json");
|
|
119
|
+
if (existsSync(pluginMcp)) {
|
|
120
|
+
console.log("✓ Installed the context-mode agy plugin: MCP server + routing rule + routing skill + hooks.");
|
|
121
|
+
console.log(` MCP registered from the bundle's mcp_config.json → ${pluginMcp}`);
|
|
122
|
+
} else {
|
|
123
|
+
console.log("✓ Installed the context-mode agy plugin: routing rule + routing skill + hooks.");
|
|
124
|
+
console.error("⚠ MCP server not found in agy's plugin profile. If ctx_* tools don't appear, add");
|
|
125
|
+
console.error(' { "mcpServers": { "context-mode": { "command": "context-mode" } } }');
|
|
126
|
+
console.error(" to ~/.gemini/config/mcp_config.json and restart agy.");
|
|
127
|
+
}
|
|
128
|
+
if (cacheCleared) {
|
|
129
|
+
console.log("✓ Cleared agy's stale tool-schema cache — agy re-fetches Gemini-safe schemas on next launch.");
|
|
130
|
+
}
|
|
131
|
+
if (hooksOk) {
|
|
132
|
+
console.log("✓ Antigravity CLI hooks are ACTIVE (this context-mode supports antigravity-cli).");
|
|
133
|
+
} else {
|
|
134
|
+
console.error("⚠ Antigravity CLI hooks may be INACTIVE: your global 'context-mode' is missing or too old");
|
|
135
|
+
console.error(" to handle 'context-mode hook antigravity-cli'. MCP tools + the routing rule + routing skill still work.");
|
|
136
|
+
console.error(" Enable hook enforcement/capture with: npm install -g context-mode@latest");
|
|
137
|
+
}
|
|
138
|
+
console.log("");
|
|
139
|
+
console.log(" Restart agy, then verify:");
|
|
140
|
+
console.log(' agy -p "Use the context-mode ctx_execute MCP tool to compute 7 + 5. Answer only the number." --dangerously-skip-permissions');
|
|
141
|
+
console.log(" Expected output: 12");
|