context-mode 2.0.0-next.5 → 2.0.0-next.6
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 +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/hooks.json +50 -0
- package/.codex-plugin/mcp.json +14 -0
- package/.codex-plugin/plugin.json +12 -0
- package/SHA256SUMS +19 -13
- package/cli.mjs +125 -10
- package/codex/skills/ctx-doctor/SKILL.md +6 -0
- package/codex/skills/ctx-stats/SKILL.md +6 -0
- package/codex/skills/ctx-upgrade/SKILL.md +6 -0
- package/copilot/plugin.json +1 -1
- package/gemini-extension.json +1 -1
- package/hook.mjs +79 -79
- package/opencode/plugin.js +51 -16
- package/package.json +4 -1
- package/pi/index.js +51 -16
- package/qwen-extension.json +1 -1
- package/run.mjs +8 -2
- package/search.mjs +8 -2
- package/server.mjs +28 -12
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"PostToolUse": [
|
|
4
|
+
{
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"command": "node \"${PLUGIN_ROOT}/hook.mjs\" --agent codex",
|
|
8
|
+
"timeout": 5,
|
|
9
|
+
"type": "command"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"matcher": "^(Bash|apply_patch|mcp__context_mode__ctx_.*)$"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"PreToolUse": [
|
|
16
|
+
{
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"command": "node \"${PLUGIN_ROOT}/hook.mjs\" --agent codex",
|
|
20
|
+
"timeout": 5,
|
|
21
|
+
"type": "command"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"matcher": "^(Bash|apply_patch|mcp__context_mode__ctx_.*)$"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"SessionStart": [
|
|
28
|
+
{
|
|
29
|
+
"hooks": [
|
|
30
|
+
{
|
|
31
|
+
"command": "node \"${PLUGIN_ROOT}/hook.mjs\" --agent codex",
|
|
32
|
+
"timeout": 5,
|
|
33
|
+
"type": "command"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"UserPromptSubmit": [
|
|
39
|
+
{
|
|
40
|
+
"hooks": [
|
|
41
|
+
{
|
|
42
|
+
"command": "node \"${PLUGIN_ROOT}/hook.mjs\" --agent codex",
|
|
43
|
+
"timeout": 5,
|
|
44
|
+
"type": "command"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Context Mode for Codex",
|
|
3
|
+
"hooks": "./.codex-plugin/hooks.json",
|
|
4
|
+
"interface": {
|
|
5
|
+
"category": "Productivity",
|
|
6
|
+
"displayName": "context-mode"
|
|
7
|
+
},
|
|
8
|
+
"mcpServers": "./.codex-plugin/mcp.json",
|
|
9
|
+
"name": "context-mode",
|
|
10
|
+
"skills": "./codex/skills/",
|
|
11
|
+
"version": "2.0.0-next.6"
|
|
12
|
+
}
|
package/SHA256SUMS
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
ec9431cac1bad3f1dd18cda6621ae6519a7659035460c79cab889533ba9b8e31 .claude-plugin/marketplace.json
|
|
2
|
+
c091746d92f019001fdcf260a57b662ed6d802a71f31fd2b97de0e82ef25b032 .claude-plugin/plugin.json
|
|
3
|
+
187503e1455560d4ab5a72e3b8cd2f274abd4ccc5faa60dd66c37e44bb5f10c2 .codex-plugin/hooks.json
|
|
4
|
+
4edea851775bc3f0418f8d9cf6ead74f2767c3a9e3b8c05749eacb78ebb3b896 .codex-plugin/mcp.json
|
|
5
|
+
8f4a0b488d80d8ba70d1a25cdfd9b3935bb32deb0d383429be79039d846d9894 .codex-plugin/plugin.json
|
|
3
6
|
1773e40a89384dd1af9023ba533da1908f3e2435dbaaa7cc941edf0514148313 claude-code/skills/ctx-doctor/SKILL.md
|
|
4
7
|
34fffb9c76d69c551f07036230bec0fbaca7a69177a5a47f89ddb9a9990a1fa2 claude-code/skills/ctx-stats/SKILL.md
|
|
5
8
|
d8f835d2f2b3eb70c5902f8707e7c5857977cec9e20ace76c499378a04e178e0 claude-code/skills/ctx-upgrade/SKILL.md
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
82bd80c094cbf0920b164a74b1e22c8ba7eccb89df04fba304a4406bc573fd2d cli.mjs
|
|
10
|
+
83c297020ed0c592fc68c9c482546a6999d41df5d06d8a329498f10edb1bd38e codex/skills/ctx-doctor/SKILL.md
|
|
11
|
+
adc2c374f699d3698110920bb48411965de09fc6e7232ce59c913f6d58c0d738 codex/skills/ctx-stats/SKILL.md
|
|
12
|
+
5c12cdd19a5e3ed7d9ba3a47b24d03864a28d36cf7006876284ee07cd4221ec4 codex/skills/ctx-upgrade/SKILL.md
|
|
13
|
+
364b764e81df2a876a97ffe6b6424052e22c30063b0e36471afe3c89e4a4a86f copilot/plugin.json
|
|
8
14
|
832bf0d31c37a448f3904bc41c7df071777aec2f8fce9d667f1fcf5b03a52a91 fixtures/hook-roundtrip.json
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
d46975c85d99661aa9f59651ff1d156b3049c627104d37f6da1e6d3eadb4ba9f gemini-extension.json
|
|
16
|
+
72f1094e3490df9999cef526e9469ca3718b43a0f3141270d7819d0f557d2972 hook.mjs
|
|
11
17
|
1f8d8650d2b38737522cab6b875878e8baf84a74acf98cd924c7af22852d873f hooks/claude-code.json
|
|
12
18
|
2524a0eb52683b65c65943c5097db513e9845ba14e84324b39e9a8ea2bb43193 hooks/codex.json
|
|
13
19
|
b656fed2b754ebcfd4c156bee81d5879c21a8083fc0d6b8e3241462b63a214b6 hooks/copilot-cli.json
|
|
@@ -16,16 +22,16 @@ f336d1db67de49e641687bbd41ba1a9424e31dfe2377b2284bf44358288ebd8b hooks/kiro.jso
|
|
|
16
22
|
017c9cc3997dd53231b8548b1a1609fddc51177af53501565a4f334602039860 hooks/qwen.json
|
|
17
23
|
33f69267645338d0dc392ce551dcd7c69a0b508113469d6ea637d3f34239ef1d hooks/vscode.json
|
|
18
24
|
085630bccf2073ac9a62be24ef91dfc47d106092dc82c822db70890b7d3ae1c0 hooks/zcode.json
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
ce0e82ae94d97103b08058b6c0cd3aa88168328ca94523080c6d58864b0a0a3a opencode/plugin.js
|
|
26
|
+
c0f9d6011560ae0f9a7a212984505214f182132727abd700a6a067ec7424181f package.json
|
|
27
|
+
21172035b576a01907f5c95043d2312900eb2a31d866bfcce5b78834e9de764d pi/index.js
|
|
22
28
|
8712881622c9905aa4836af50d903042d34a91506264e459bc7839331f6f0192 pi/skills/ctx-doctor/SKILL.md
|
|
23
29
|
8d6e8e2a82eb079bddc60727f52d9f9a6e0bf9e15391357fed82ee76ab5fe76c pi/skills/ctx-stats/SKILL.md
|
|
24
30
|
db6f9c006bc864a7271f1eeffb1e316ebb537a3414f1c22f8b9de0a896e8e3c5 pi/skills/ctx-upgrade/SKILL.md
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
cc99f508510142cda078515bca4da72745525bb781f93d4a2a3bbf771bba6e63 qwen-extension.json
|
|
32
|
+
c57cd6641d5a09230d77eba0dd9c5f1907a85be87c3a18ef41d680c73f91c2dc run.mjs
|
|
33
|
+
c57cd6641d5a09230d77eba0dd9c5f1907a85be87c3a18ef41d680c73f91c2dc search.mjs
|
|
34
|
+
7dbfce4aa5843a009a194d2b43ea5537dcfd82e7a9e41398b3aa5241bc789b5e server.mjs
|
|
29
35
|
6a7fdf30ff29c57a0edbcbe508b77151cc71dd78ef3b6ee90d957ce0c8d28d6f skills/ctx-doctor/SKILL.md
|
|
30
36
|
81be076a843f0b352075c73a09ec0fa62adea4f3bc01409f516d26891b32e835 skills/ctx-stats/SKILL.md
|
|
31
37
|
df85a77653622d23d8851fb7eb16f977e5f8646aa54ca5ede0db811dcd950916 skills/ctx-upgrade/SKILL.md
|
package/cli.mjs
CHANGED
|
@@ -442,8 +442,10 @@ var UPGRADE_REPORT_ONLY_REASONS = Object.freeze([V1_REASON.statusLine, V1_REASON
|
|
|
442
442
|
var OPENCODE_TOOL_PREFIX = SERVER_KEY + "_";
|
|
443
443
|
var JSON_INDENT_UNIT = " ";
|
|
444
444
|
var ZCODE_MCP_FEATURE_KEY = Object.freeze(["features", "mcp"]);
|
|
445
|
+
var CODEX_OMIT_TOOLS_FROM_FIELD = "omit_tools_from";
|
|
446
|
+
var CODEX_OMIT_DEFERRED = Object.freeze(["deferred"]);
|
|
445
447
|
var OWN_MCP_ENTRY = Object.freeze({
|
|
446
|
-
codex: { file: [".codex", "config.toml"], key: ["mcp_servers", SERVER_KEY] },
|
|
448
|
+
codex: { file: [".codex", "config.toml"], key: ["mcp_servers", SERVER_KEY], fields: { [CODEX_OMIT_TOOLS_FROM_FIELD]: CODEX_OMIT_DEFERRED } },
|
|
447
449
|
vscode: { file: [".vscode", "mcp.json"], key: ["servers", SERVER_KEY] },
|
|
448
450
|
kiro: { file: [".kiro", "settings", "mcp.json"], key: ["mcpServers", SERVER_KEY] },
|
|
449
451
|
zcode: {
|
|
@@ -5151,6 +5153,7 @@ var STATE_DIR = ".context-mode";
|
|
|
5151
5153
|
var LOCK_FILE = "setup.lock";
|
|
5152
5154
|
var BACKUP_DIR = "backups";
|
|
5153
5155
|
var PLUGIN_ID = `${SERVER_KEY}@${SERVER_KEY}`;
|
|
5156
|
+
var SKILLS_DIR_NAME = "skills";
|
|
5154
5157
|
var INSTRUCTION_FILES = Object.freeze([
|
|
5155
5158
|
"CLAUDE.md",
|
|
5156
5159
|
"AGENTS.md",
|
|
@@ -5164,10 +5167,17 @@ function configEdits(c3) {
|
|
|
5164
5167
|
return [[c3.key, c3.value], ...c3.also ?? []];
|
|
5165
5168
|
}
|
|
5166
5169
|
var COMMAND_SKILLS = Object.freeze(["ctx-doctor", "ctx-stats", "ctx-upgrade"]);
|
|
5167
|
-
var SKILLS_DIR = "skills";
|
|
5168
5170
|
var SKILL_FILE = "SKILL.md";
|
|
5169
5171
|
var OPENCODE_PLUGIN = ["opencode", "plugin.js"];
|
|
5170
5172
|
var CODEX_CONFIG_FILE = "config.toml";
|
|
5173
|
+
var CODEX_HOME_ENV2 = "CODEX_HOME";
|
|
5174
|
+
var CODEX_DIR = ".codex";
|
|
5175
|
+
function agentPath(ctx, id, rel) {
|
|
5176
|
+
const segs = typeof rel === "string" ? rel.split("/") : [...rel];
|
|
5177
|
+
const codexHome = ctx.env[CODEX_HOME_ENV2];
|
|
5178
|
+
if (id === "codex" && segs[0] === CODEX_DIR && codexHome !== void 0 && codexHome !== "") return path2.join(codexHome, ...segs.slice(1));
|
|
5179
|
+
return path2.join(ctx.home, ...segs);
|
|
5180
|
+
}
|
|
5171
5181
|
function renderSkill(text2, prefix) {
|
|
5172
5182
|
const prefixes = typeof prefix === "string" ? [prefix] : prefix;
|
|
5173
5183
|
if (prefixes.length === 1 && prefixes[0] === "") return text2;
|
|
@@ -5183,6 +5193,23 @@ function skillDirPrefixes(dirPath) {
|
|
|
5183
5193
|
}
|
|
5184
5194
|
return out2;
|
|
5185
5195
|
}
|
|
5196
|
+
var EXTENSION_LIST = ["extensions", "list"];
|
|
5197
|
+
function extensionPlugin(bin, id) {
|
|
5198
|
+
return {
|
|
5199
|
+
bin,
|
|
5200
|
+
args: EXTENSION_LIST,
|
|
5201
|
+
plugin: SERVER_KEY,
|
|
5202
|
+
hooksVia: getAdapter(id).hookChannel.path,
|
|
5203
|
+
skillsVia: SKILLS_DIR_NAME,
|
|
5204
|
+
format: "extension",
|
|
5205
|
+
enable: ["extensions", "enable", SERVER_KEY]
|
|
5206
|
+
};
|
|
5207
|
+
}
|
|
5208
|
+
var NATIVE_PLUGIN = {
|
|
5209
|
+
codex: { bin: "codex", args: ["plugin", "list"], plugin: PLUGIN_ID, hooksVia: ".codex-plugin", skillsVia: path2.join("codex", SKILLS_DIR_NAME), format: "table" },
|
|
5210
|
+
qwen: extensionPlugin("qwen", "qwen"),
|
|
5211
|
+
gemini: extensionPlugin("gemini", "gemini")
|
|
5212
|
+
};
|
|
5186
5213
|
function serverCmd(ctx, id) {
|
|
5187
5214
|
return [process.execPath, path2.join(ctx.pkgDir, SERVER_BUNDLE), AGENT_FLAG, id];
|
|
5188
5215
|
}
|
|
@@ -5205,7 +5232,7 @@ function configFor(ctx, id) {
|
|
|
5205
5232
|
const [node, server, flag, agent] = serverCmd(ctx, id);
|
|
5206
5233
|
const own2 = OWN_MCP_ENTRY[id];
|
|
5207
5234
|
if (own2) {
|
|
5208
|
-
const file =
|
|
5235
|
+
const file = agentPath(ctx, id, own2.file);
|
|
5209
5236
|
const format = file.endsWith(".toml") ? "toml" : id === "vscode" ? "jsonc" : "json";
|
|
5210
5237
|
const args = id === "vscode" ? [server, flag, agent, WORKSPACE_FOLDER_FLAG, VSCODE_WORKSPACE_VAR] : [server, flag, agent];
|
|
5211
5238
|
const also = own2.also?.map(([k, v]) => [k, v]);
|
|
@@ -5255,10 +5282,11 @@ var LIST = {
|
|
|
5255
5282
|
// D-HF-OPENCODE-LIST-1: --pure skips external plugins, so a fresh HOME does not wait on the @opencode-ai/plugin install.
|
|
5256
5283
|
opencode: { bin: "opencode", args: ["mcp", "list", "--pure"] }
|
|
5257
5284
|
};
|
|
5258
|
-
function hookFilesFor(
|
|
5285
|
+
function hookFilesFor(ctx, id) {
|
|
5286
|
+
const home = ctx.home;
|
|
5259
5287
|
switch (id) {
|
|
5260
5288
|
case "codex":
|
|
5261
|
-
return [{ file:
|
|
5289
|
+
return [{ file: agentPath(ctx, id, [CODEX_DIR, "hooks.json"]), mode: "rewrite" }];
|
|
5262
5290
|
case "copilot-cli":
|
|
5263
5291
|
return [{ file: path2.join(home, ".copilot", "hooks", "context-mode.json"), mode: "rewrite" }];
|
|
5264
5292
|
case "claude-code":
|
|
@@ -5276,7 +5304,7 @@ function hookInstallFor(ctx, row, command) {
|
|
|
5276
5304
|
if (ch.kind === "home-file") {
|
|
5277
5305
|
const shape = HOOK_SHAPES[row.id];
|
|
5278
5306
|
if (!shape) throw new Error(`setup: ${row.id} has a home-file hook channel and no hook shape`);
|
|
5279
|
-
const file =
|
|
5307
|
+
const file = agentPath(ctx, row.id, ch.path);
|
|
5280
5308
|
if (row.id === "codex") return { kind: "file", file, shape: shape(row, command), command, trust: path2.join(path2.dirname(file), CODEX_CONFIG_FILE) };
|
|
5281
5309
|
return { kind: "file", file, shape: shape(row, command), command };
|
|
5282
5310
|
}
|
|
@@ -5290,13 +5318,19 @@ function hookInstallFor(ctx, row, command) {
|
|
|
5290
5318
|
}
|
|
5291
5319
|
return { kind: "package", via: ch.path };
|
|
5292
5320
|
}
|
|
5321
|
+
function bareSkillDir() {
|
|
5322
|
+
const row = ADAPTERS.find((r2) => r2.skillChannel.kind === "package" && r2.toolNamePrefix === "");
|
|
5323
|
+
if (row === void 0) throw new Error("setup: no package skill channel holds the bare tool names");
|
|
5324
|
+
return row.skillChannel.path;
|
|
5325
|
+
}
|
|
5293
5326
|
function skillInstallFor(ctx, row) {
|
|
5294
5327
|
const ch = row.skillChannel;
|
|
5295
5328
|
if (ch.kind === "package") return { kind: "package", via: ch.path };
|
|
5296
|
-
const dir =
|
|
5329
|
+
const dir = agentPath(ctx, row.id, ch.path);
|
|
5330
|
+
const src = path2.join(ctx.pkgDir, bareSkillDir());
|
|
5297
5331
|
return { kind: "dir", dir, prefixes: skillDirPrefixes(ch.path), files: COMMAND_SKILLS.map((name) => ({
|
|
5298
5332
|
name,
|
|
5299
|
-
src: path2.join(
|
|
5333
|
+
src: path2.join(src, name, SKILL_FILE),
|
|
5300
5334
|
file: path2.join(dir, name, SKILL_FILE)
|
|
5301
5335
|
})) };
|
|
5302
5336
|
}
|
|
@@ -5304,7 +5338,7 @@ function buildRegistry(ctx) {
|
|
|
5304
5338
|
return ADAPTERS.map((row) => {
|
|
5305
5339
|
const id = row.id;
|
|
5306
5340
|
const config = configFor(ctx, id);
|
|
5307
|
-
const hookFiles = hookFilesFor(ctx
|
|
5341
|
+
const hookFiles = hookFilesFor(ctx, id);
|
|
5308
5342
|
const hookCommand = [process.execPath, path2.join(ctx.pkgDir, HOOK_BUNDLE), AGENT_FLAG, id];
|
|
5309
5343
|
const command = `"${hookCommand[0]}" "${hookCommand[1]}" ${AGENT_FLAG} ${id}`;
|
|
5310
5344
|
const hookInstall = hookInstallFor(ctx, getAdapter(id), command);
|
|
@@ -5333,6 +5367,8 @@ function buildRegistry(ctx) {
|
|
|
5333
5367
|
if (row.installMode !== "in-process") out2.hookCommand = hookCommand;
|
|
5334
5368
|
const copy = copyFor(ctx, id);
|
|
5335
5369
|
if (copy) out2.copy = copy;
|
|
5370
|
+
const native = NATIVE_PLUGIN[id];
|
|
5371
|
+
if (native) out2.nativePlugin = native;
|
|
5336
5372
|
return out2;
|
|
5337
5373
|
});
|
|
5338
5374
|
}
|
|
@@ -5935,6 +5971,79 @@ function skillsCheck(row, pkgDir) {
|
|
|
5935
5971
|
const bad = s.files.filter((f2) => readOr(f2.file) !== (existsSync6(f2.src) ? renderSkill(readFileSync3(f2.src, "utf8"), s.prefixes) : void 0));
|
|
5936
5972
|
return { name: "skills", ok: bad.length === 0, detail: bad.length ? `${bad.map((f2) => f2.file).join(", ")} missing or without the ${s.prefixes.join(" / ") || "plain"} tool prefix` : void 0 };
|
|
5937
5973
|
}
|
|
5974
|
+
var PLUGIN_ENABLED = "enabled";
|
|
5975
|
+
var WORD_TRIM = ",;";
|
|
5976
|
+
var EXT_ENABLED_USER = "Enabled (User):";
|
|
5977
|
+
var EXT_TRUE = "true";
|
|
5978
|
+
function tableState(n3, text2) {
|
|
5979
|
+
const line = text2.split("\n").find((l2) => l2.split(" ").includes(n3.plugin));
|
|
5980
|
+
if (line === void 0) return void 0;
|
|
5981
|
+
return line.split(" ").map((w) => trimChars(w, WORD_TRIM)).includes(PLUGIN_ENABLED) ? "enabled" : "disabled";
|
|
5982
|
+
}
|
|
5983
|
+
function extensionState(n3, text2) {
|
|
5984
|
+
let mine = false;
|
|
5985
|
+
for (const raw of text2.split("\n")) {
|
|
5986
|
+
const line = raw.trimEnd();
|
|
5987
|
+
if (line.length && !line.startsWith(" ")) {
|
|
5988
|
+
mine = line.split(" ")[1] === n3.plugin;
|
|
5989
|
+
continue;
|
|
5990
|
+
}
|
|
5991
|
+
const t2 = line.trim();
|
|
5992
|
+
if (mine && t2.startsWith(EXT_ENABLED_USER)) return t2.slice(EXT_ENABLED_USER.length).trim() === EXT_TRUE ? "enabled" : "disabled";
|
|
5993
|
+
}
|
|
5994
|
+
return void 0;
|
|
5995
|
+
}
|
|
5996
|
+
function nativeState(row, env) {
|
|
5997
|
+
const n3 = row.nativePlugin;
|
|
5998
|
+
if (!n3 || !hostBin(n3.bin, env).file) return void 0;
|
|
5999
|
+
const r2 = runBin(n3.bin, n3.args, env);
|
|
6000
|
+
if (r2.status !== 0) return void 0;
|
|
6001
|
+
return n3.format === "extension" ? extensionState(n3, `${r2.stdout}${r2.stderr}`) : tableState(n3, `${r2.stdout}`);
|
|
6002
|
+
}
|
|
6003
|
+
function nativeRow(row, n3) {
|
|
6004
|
+
return {
|
|
6005
|
+
...row,
|
|
6006
|
+
config: void 0,
|
|
6007
|
+
cli: void 0,
|
|
6008
|
+
copy: void 0,
|
|
6009
|
+
hookFiles: [],
|
|
6010
|
+
listCommand: { bin: n3.bin, args: n3.args },
|
|
6011
|
+
hookInstall: { kind: "package", via: n3.hooksVia },
|
|
6012
|
+
skillInstall: { kind: "package", via: n3.skillsVia }
|
|
6013
|
+
};
|
|
6014
|
+
}
|
|
6015
|
+
function trimChars(w, chars) {
|
|
6016
|
+
let a2 = 0;
|
|
6017
|
+
let b3 = w.length;
|
|
6018
|
+
while (a2 < b3 && chars.includes(w.charAt(a2))) a2++;
|
|
6019
|
+
while (b3 > a2 && chars.includes(w.charAt(b3 - 1))) b3--;
|
|
6020
|
+
return w.slice(a2, b3);
|
|
6021
|
+
}
|
|
6022
|
+
async function nativeResult(row, ctx) {
|
|
6023
|
+
const n3 = row.nativePlugin;
|
|
6024
|
+
const state = nativeState(row, ctx.env);
|
|
6025
|
+
if (!n3 || state === void 0) return void 0;
|
|
6026
|
+
const bin = hostBin(n3.bin, ctx.env).file;
|
|
6027
|
+
if (state === "disabled") {
|
|
6028
|
+
if (!n3.enable) return void 0;
|
|
6029
|
+
return {
|
|
6030
|
+
id: row.id,
|
|
6031
|
+
status: "FAIL",
|
|
6032
|
+
v1: [],
|
|
6033
|
+
changes: [],
|
|
6034
|
+
checks: [],
|
|
6035
|
+
bin,
|
|
6036
|
+
reason: `context-mode is installed but disabled in ${n3.bin}, run ${n3.bin} ${n3.enable.join(" ")}`
|
|
6037
|
+
};
|
|
6038
|
+
}
|
|
6039
|
+
const res = { id: row.id, status: "PASS", v1: [], changes: [], checks: await verifyRow(nativeRow(row, n3), ctx), bin };
|
|
6040
|
+
const bad = res.checks.filter((c3) => !c3.ok);
|
|
6041
|
+
if (bad.length) {
|
|
6042
|
+
res.status = "FAIL";
|
|
6043
|
+
res.reason = bad.map((c3) => `${c3.name}: ${c3.detail}`).join("; ");
|
|
6044
|
+
}
|
|
6045
|
+
return res;
|
|
6046
|
+
}
|
|
5938
6047
|
async function verifyRow(row, ctx) {
|
|
5939
6048
|
const env = ctx.env;
|
|
5940
6049
|
const checks = [parseCheck(row)];
|
|
@@ -6042,7 +6151,7 @@ async function runSetup(opts) {
|
|
|
6042
6151
|
}
|
|
6043
6152
|
current = id;
|
|
6044
6153
|
opts.onAgent?.(id, "start");
|
|
6045
|
-
const res = await setupRow(row, ctx, run, !!opts.dryRun);
|
|
6154
|
+
const res = await nativeResult(row, ctx) ?? await setupRow(row, ctx, run, !!opts.dryRun);
|
|
6046
6155
|
current = void 0;
|
|
6047
6156
|
agents.push(res);
|
|
6048
6157
|
opts.onAgent?.(id, "done", res);
|
|
@@ -6117,6 +6226,12 @@ async function runDoctor(opts) {
|
|
|
6117
6226
|
continue;
|
|
6118
6227
|
}
|
|
6119
6228
|
opts.onAgent?.(id, "start");
|
|
6229
|
+
const native = await nativeResult(row, ctx);
|
|
6230
|
+
if (native) {
|
|
6231
|
+
agents.push(native);
|
|
6232
|
+
opts.onAgent?.(id, "done", native);
|
|
6233
|
+
continue;
|
|
6234
|
+
}
|
|
6120
6235
|
const res = await setupRow(row, ctx, run, true);
|
|
6121
6236
|
if (res.status === "PASS") {
|
|
6122
6237
|
if (res.v1.some((f2) => !UPGRADE_REPORT_ONLY_REASONS.includes(f2.reason))) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ctx-doctor
|
|
3
|
+
description: Check that context-mode is installed and working, as a table.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
Call the mcp__context_mode__ctx_doctor tool and show its table to the user unchanged. If a row failed, list the fixes it names, in order.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ctx-stats
|
|
3
|
+
description: Show how much context context-mode saved, as a table.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
Call the mcp__context_mode__ctx_stats tool and show its table to the user unchanged. Add one sentence under the table that names the largest saving.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ctx-upgrade
|
|
3
|
+
description: Update context-mode to the latest release.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
Call the mcp__context_mode__ctx_upgrade tool and show its table to the user. Then call mcp__context_mode__ctx_doctor and show its table. If a restart is needed, say so in one sentence.
|
package/copilot/plugin.json
CHANGED
package/gemini-extension.json
CHANGED