context-mode 2.1.0 → 2.1.1
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 +6 -2
- package/.claude-plugin/plugin.json +5 -2
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +73 -73
- package/SHA256SUMS +18 -21
- package/cli.mjs +42 -7
- package/copilot/plugin.json +1 -1
- package/gemini-extension.json +1 -1
- package/hook.mjs +86 -83
- package/opencode/plugin.js +32 -6
- package/package.json +1 -2
- package/pi/index.js +32 -6
- package/qwen-extension.json +1 -1
- package/run.mjs +31 -5
- package/search.mjs +31 -5
- package/server.mjs +32 -6
- package/skills/ctx-doctor/SKILL.md +1 -1
- package/skills/ctx-stats/SKILL.md +1 -1
- package/skills/ctx-upgrade/SKILL.md +1 -1
- package/claude-code/skills/ctx-doctor/SKILL.md +0 -6
- package/claude-code/skills/ctx-stats/SKILL.md +0 -6
- package/claude-code/skills/ctx-upgrade/SKILL.md +0 -6
package/opencode/plugin.js
CHANGED
|
@@ -426,7 +426,7 @@ var DECISION_OPTION_KEY = "option";
|
|
|
426
426
|
var DECISION_LABEL_JOIN = " | ";
|
|
427
427
|
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
428
428
|
var RELEASE_BRANCH = "release";
|
|
429
|
-
var BUNDLE_SHA = true ? "
|
|
429
|
+
var BUNDLE_SHA = true ? "2652fe27fc5d4e368fdc38eda49d3011d38e631e" : void 0;
|
|
430
430
|
var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
|
|
431
431
|
var DOCTOR_LABEL = Object.freeze({
|
|
432
432
|
D1: "version",
|
|
@@ -1066,7 +1066,7 @@ function outputOf(resp) {
|
|
|
1066
1066
|
function textSlot(r) {
|
|
1067
1067
|
const file2 = r.file;
|
|
1068
1068
|
if (r.type === "text" && typeof file2 === "object" && file2 !== null && typeof file2.content === "string") {
|
|
1069
|
-
return { text: file2.content, put: (o, output) => ({ ...o, file:
|
|
1069
|
+
return { text: file2.content, put: (o, output) => ({ ...o, file: readFile(o.file, output) }) };
|
|
1070
1070
|
}
|
|
1071
1071
|
if (isGrepContent(r)) return { text: r.content, put: (o, output) => ({ ...o, content: output }) };
|
|
1072
1072
|
if (Array.isArray(r.filenames) && r.filenames.every((f) => typeof f === "string")) {
|
|
@@ -1075,13 +1075,35 @@ function textSlot(r) {
|
|
|
1075
1075
|
if (typeof r.result === "string") return { text: r.result, put: (o, output) => ({ ...o, result: output }) };
|
|
1076
1076
|
return null;
|
|
1077
1077
|
}
|
|
1078
|
+
function readFile(file2, output) {
|
|
1079
|
+
const start = typeof file2.startLine === "number" ? file2.startLine : 1;
|
|
1080
|
+
const lines = String(file2.content).split("\n");
|
|
1081
|
+
const read3 = typeof file2.numLines === "number" ? file2.numLines : lines.length;
|
|
1082
|
+
const out = output.split("\n");
|
|
1083
|
+
const run = firstRun(lines, out);
|
|
1084
|
+
if (run === null) return { ...file2, content: output, startLine: start + read3, numLines: out.length };
|
|
1085
|
+
const kept = out.slice(0, run.length);
|
|
1086
|
+
if (run.length < out.length) kept.push(out[out.length - 1]);
|
|
1087
|
+
return { ...file2, content: kept.join("\n"), startLine: start + run.at, numLines: kept.length };
|
|
1088
|
+
}
|
|
1089
|
+
function firstRun(lines, out) {
|
|
1090
|
+
let best = null;
|
|
1091
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1092
|
+
if (lines[i] !== out[0]) continue;
|
|
1093
|
+
let n = 1;
|
|
1094
|
+
while (n < out.length && i + n < lines.length && lines[i + n] === out[n]) n++;
|
|
1095
|
+
if (best === null || n > best.length) best = { at: i, length: n };
|
|
1096
|
+
if (n === out.length) break;
|
|
1097
|
+
}
|
|
1098
|
+
return best;
|
|
1099
|
+
}
|
|
1078
1100
|
function isShellShape(resp) {
|
|
1079
1101
|
const r = resp;
|
|
1080
1102
|
return typeof r.stdout === "string" || typeof r.stderr === "string";
|
|
1081
1103
|
}
|
|
1082
1104
|
function isGrepContent(resp) {
|
|
1083
1105
|
const r = resp;
|
|
1084
|
-
return r.mode === "content" && typeof r.content === "string";
|
|
1106
|
+
return (r.mode === "content" || r.mode === "count") && typeof r.content === "string";
|
|
1085
1107
|
}
|
|
1086
1108
|
function blocksOf(resp) {
|
|
1087
1109
|
const parts = [];
|
|
@@ -1097,6 +1119,7 @@ function readResult(resp) {
|
|
|
1097
1119
|
const text = outputOf(resp);
|
|
1098
1120
|
const isError = typeof resp === "object" && resp !== null && resp.is_error === true;
|
|
1099
1121
|
const info = { isError, bytes: Buffer.byteLength(text), text };
|
|
1122
|
+
if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && isShellShape(resp)) info.shape = resp;
|
|
1100
1123
|
if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && !isShellShape(resp)) {
|
|
1101
1124
|
if (textSlot(resp) !== null) info.shape = resp;
|
|
1102
1125
|
else info.keep = true;
|
|
@@ -1136,8 +1159,11 @@ function decodeClaudeShape(raw, agent, ownPrefix, sources) {
|
|
|
1136
1159
|
return ev;
|
|
1137
1160
|
}
|
|
1138
1161
|
function replaceShape(ev, output) {
|
|
1139
|
-
if (ev.tool?.canonicalName === "Bash") return { stdout: output, stderr: "", interrupted: false };
|
|
1140
1162
|
const shape = ev.result?.shape;
|
|
1163
|
+
if (ev.tool?.canonicalName === "Bash") {
|
|
1164
|
+
const { persistedOutputPath: _p, persistedOutputSize: _s, ...host } = shape ?? {};
|
|
1165
|
+
return { interrupted: false, ...host, stdout: output, stderr: "" };
|
|
1166
|
+
}
|
|
1141
1167
|
const slot = shape === void 0 ? null : textSlot(shape);
|
|
1142
1168
|
if (shape !== void 0 && slot !== null) return slot.put(shape, output);
|
|
1143
1169
|
if (ev.result?.blocks === true) return [{ type: "text", text: output }];
|
|
@@ -1757,8 +1783,8 @@ var ADAPTERS = Object.freeze([
|
|
|
1757
1783
|
hookTimeoutMs: HOOK_TIMEOUT_MS,
|
|
1758
1784
|
denyChannel: "deny-reason",
|
|
1759
1785
|
hookChannel: { kind: "package", path: "hooks/claude-code.json" },
|
|
1760
|
-
skillChannel: { kind: "package", path: "
|
|
1761
|
-
// ADR-0020, D-
|
|
1786
|
+
skillChannel: { kind: "package", path: "skills" },
|
|
1787
|
+
// ADR-0020, D-R33-CC-SKILLS-1: Claude Code always loads <plugin>/skills, shared with gemini and qwen
|
|
1762
1788
|
decode,
|
|
1763
1789
|
encode
|
|
1764
1790
|
},
|
package/package.json
CHANGED
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"LICENSE",
|
|
20
20
|
"README.md",
|
|
21
21
|
"SHA256SUMS",
|
|
22
|
-
"claude-code",
|
|
23
22
|
"cli.mjs",
|
|
24
23
|
"codex",
|
|
25
24
|
"copilot",
|
|
@@ -69,5 +68,5 @@
|
|
|
69
68
|
"url": "git+https://github.com/mksglu/context-mode.git"
|
|
70
69
|
},
|
|
71
70
|
"type": "module",
|
|
72
|
-
"version": "2.1.
|
|
71
|
+
"version": "2.1.1"
|
|
73
72
|
}
|
package/pi/index.js
CHANGED
|
@@ -11571,7 +11571,7 @@ var DECISION_OPTION_KEY = "option";
|
|
|
11571
11571
|
var DECISION_LABEL_JOIN = " | ";
|
|
11572
11572
|
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
11573
11573
|
var RELEASE_BRANCH = "release";
|
|
11574
|
-
var BUNDLE_SHA = true ? "
|
|
11574
|
+
var BUNDLE_SHA = true ? "2652fe27fc5d4e368fdc38eda49d3011d38e631e" : void 0;
|
|
11575
11575
|
var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
|
|
11576
11576
|
var DOCTOR_LABEL = Object.freeze({
|
|
11577
11577
|
D1: "version",
|
|
@@ -12273,7 +12273,7 @@ function outputOf(resp) {
|
|
|
12273
12273
|
function textSlot(r) {
|
|
12274
12274
|
const file2 = r.file;
|
|
12275
12275
|
if (r.type === "text" && typeof file2 === "object" && file2 !== null && typeof file2.content === "string") {
|
|
12276
|
-
return { text: file2.content, put: (o, output) => ({ ...o, file:
|
|
12276
|
+
return { text: file2.content, put: (o, output) => ({ ...o, file: readFile(o.file, output) }) };
|
|
12277
12277
|
}
|
|
12278
12278
|
if (isGrepContent(r)) return { text: r.content, put: (o, output) => ({ ...o, content: output }) };
|
|
12279
12279
|
if (Array.isArray(r.filenames) && r.filenames.every((f) => typeof f === "string")) {
|
|
@@ -12282,13 +12282,35 @@ function textSlot(r) {
|
|
|
12282
12282
|
if (typeof r.result === "string") return { text: r.result, put: (o, output) => ({ ...o, result: output }) };
|
|
12283
12283
|
return null;
|
|
12284
12284
|
}
|
|
12285
|
+
function readFile(file2, output) {
|
|
12286
|
+
const start = typeof file2.startLine === "number" ? file2.startLine : 1;
|
|
12287
|
+
const lines = String(file2.content).split("\n");
|
|
12288
|
+
const read3 = typeof file2.numLines === "number" ? file2.numLines : lines.length;
|
|
12289
|
+
const out = output.split("\n");
|
|
12290
|
+
const run = firstRun(lines, out);
|
|
12291
|
+
if (run === null) return { ...file2, content: output, startLine: start + read3, numLines: out.length };
|
|
12292
|
+
const kept = out.slice(0, run.length);
|
|
12293
|
+
if (run.length < out.length) kept.push(out[out.length - 1]);
|
|
12294
|
+
return { ...file2, content: kept.join("\n"), startLine: start + run.at, numLines: kept.length };
|
|
12295
|
+
}
|
|
12296
|
+
function firstRun(lines, out) {
|
|
12297
|
+
let best = null;
|
|
12298
|
+
for (let i = 0; i < lines.length; i++) {
|
|
12299
|
+
if (lines[i] !== out[0]) continue;
|
|
12300
|
+
let n = 1;
|
|
12301
|
+
while (n < out.length && i + n < lines.length && lines[i + n] === out[n]) n++;
|
|
12302
|
+
if (best === null || n > best.length) best = { at: i, length: n };
|
|
12303
|
+
if (n === out.length) break;
|
|
12304
|
+
}
|
|
12305
|
+
return best;
|
|
12306
|
+
}
|
|
12285
12307
|
function isShellShape(resp) {
|
|
12286
12308
|
const r = resp;
|
|
12287
12309
|
return typeof r.stdout === "string" || typeof r.stderr === "string";
|
|
12288
12310
|
}
|
|
12289
12311
|
function isGrepContent(resp) {
|
|
12290
12312
|
const r = resp;
|
|
12291
|
-
return r.mode === "content" && typeof r.content === "string";
|
|
12313
|
+
return (r.mode === "content" || r.mode === "count") && typeof r.content === "string";
|
|
12292
12314
|
}
|
|
12293
12315
|
function blocksOf(resp) {
|
|
12294
12316
|
const parts = [];
|
|
@@ -12304,6 +12326,7 @@ function readResult2(resp) {
|
|
|
12304
12326
|
const text = outputOf(resp);
|
|
12305
12327
|
const isError = typeof resp === "object" && resp !== null && resp.is_error === true;
|
|
12306
12328
|
const info = { isError, bytes: Buffer.byteLength(text), text };
|
|
12329
|
+
if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && isShellShape(resp)) info.shape = resp;
|
|
12307
12330
|
if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && !isShellShape(resp)) {
|
|
12308
12331
|
if (textSlot(resp) !== null) info.shape = resp;
|
|
12309
12332
|
else info.keep = true;
|
|
@@ -12343,8 +12366,11 @@ function decodeClaudeShape(raw, agent, ownPrefix, sources) {
|
|
|
12343
12366
|
return ev;
|
|
12344
12367
|
}
|
|
12345
12368
|
function replaceShape(ev, output) {
|
|
12346
|
-
if (ev.tool?.canonicalName === "Bash") return { stdout: output, stderr: "", interrupted: false };
|
|
12347
12369
|
const shape = ev.result?.shape;
|
|
12370
|
+
if (ev.tool?.canonicalName === "Bash") {
|
|
12371
|
+
const { persistedOutputPath: _p, persistedOutputSize: _s, ...host } = shape ?? {};
|
|
12372
|
+
return { interrupted: false, ...host, stdout: output, stderr: "" };
|
|
12373
|
+
}
|
|
12348
12374
|
const slot = shape === void 0 ? null : textSlot(shape);
|
|
12349
12375
|
if (shape !== void 0 && slot !== null) return slot.put(shape, output);
|
|
12350
12376
|
if (ev.result?.blocks === true) return [{ type: "text", text: output }];
|
|
@@ -12906,8 +12932,8 @@ var ADAPTERS = Object.freeze([
|
|
|
12906
12932
|
hookTimeoutMs: HOOK_TIMEOUT_MS,
|
|
12907
12933
|
denyChannel: "deny-reason",
|
|
12908
12934
|
hookChannel: { kind: "package", path: "hooks/claude-code.json" },
|
|
12909
|
-
skillChannel: { kind: "package", path: "
|
|
12910
|
-
// ADR-0020, D-
|
|
12935
|
+
skillChannel: { kind: "package", path: "skills" },
|
|
12936
|
+
// ADR-0020, D-R33-CC-SKILLS-1: Claude Code always loads <plugin>/skills, shared with gemini and qwen
|
|
12911
12937
|
decode: decode2,
|
|
12912
12938
|
encode: encode2
|
|
12913
12939
|
},
|
package/qwen-extension.json
CHANGED
package/run.mjs
CHANGED
|
@@ -544,7 +544,7 @@ function outputOf(resp) {
|
|
|
544
544
|
function textSlot(r) {
|
|
545
545
|
const file = r.file;
|
|
546
546
|
if (r.type === "text" && typeof file === "object" && file !== null && typeof file.content === "string") {
|
|
547
|
-
return { text: file.content, put: (o, output) => ({ ...o, file:
|
|
547
|
+
return { text: file.content, put: (o, output) => ({ ...o, file: readFile(o.file, output) }) };
|
|
548
548
|
}
|
|
549
549
|
if (isGrepContent(r)) return { text: r.content, put: (o, output) => ({ ...o, content: output }) };
|
|
550
550
|
if (Array.isArray(r.filenames) && r.filenames.every((f) => typeof f === "string")) {
|
|
@@ -553,13 +553,35 @@ function textSlot(r) {
|
|
|
553
553
|
if (typeof r.result === "string") return { text: r.result, put: (o, output) => ({ ...o, result: output }) };
|
|
554
554
|
return null;
|
|
555
555
|
}
|
|
556
|
+
function readFile(file, output) {
|
|
557
|
+
const start = typeof file.startLine === "number" ? file.startLine : 1;
|
|
558
|
+
const lines = String(file.content).split("\n");
|
|
559
|
+
const read2 = typeof file.numLines === "number" ? file.numLines : lines.length;
|
|
560
|
+
const out = output.split("\n");
|
|
561
|
+
const run = firstRun(lines, out);
|
|
562
|
+
if (run === null) return { ...file, content: output, startLine: start + read2, numLines: out.length };
|
|
563
|
+
const kept = out.slice(0, run.length);
|
|
564
|
+
if (run.length < out.length) kept.push(out[out.length - 1]);
|
|
565
|
+
return { ...file, content: kept.join("\n"), startLine: start + run.at, numLines: kept.length };
|
|
566
|
+
}
|
|
567
|
+
function firstRun(lines, out) {
|
|
568
|
+
let best = null;
|
|
569
|
+
for (let i = 0; i < lines.length; i++) {
|
|
570
|
+
if (lines[i] !== out[0]) continue;
|
|
571
|
+
let n = 1;
|
|
572
|
+
while (n < out.length && i + n < lines.length && lines[i + n] === out[n]) n++;
|
|
573
|
+
if (best === null || n > best.length) best = { at: i, length: n };
|
|
574
|
+
if (n === out.length) break;
|
|
575
|
+
}
|
|
576
|
+
return best;
|
|
577
|
+
}
|
|
556
578
|
function isShellShape(resp) {
|
|
557
579
|
const r = resp;
|
|
558
580
|
return typeof r.stdout === "string" || typeof r.stderr === "string";
|
|
559
581
|
}
|
|
560
582
|
function isGrepContent(resp) {
|
|
561
583
|
const r = resp;
|
|
562
|
-
return r.mode === "content" && typeof r.content === "string";
|
|
584
|
+
return (r.mode === "content" || r.mode === "count") && typeof r.content === "string";
|
|
563
585
|
}
|
|
564
586
|
function blocksOf(resp) {
|
|
565
587
|
const parts = [];
|
|
@@ -575,6 +597,7 @@ function readResult(resp) {
|
|
|
575
597
|
const text = outputOf(resp);
|
|
576
598
|
const isError = typeof resp === "object" && resp !== null && resp.is_error === true;
|
|
577
599
|
const info = { isError, bytes: Buffer.byteLength(text), text };
|
|
600
|
+
if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && isShellShape(resp)) info.shape = resp;
|
|
578
601
|
if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && !isShellShape(resp)) {
|
|
579
602
|
if (textSlot(resp) !== null) info.shape = resp;
|
|
580
603
|
else info.keep = true;
|
|
@@ -614,8 +637,11 @@ function decodeClaudeShape(raw, agent, ownPrefix, sources) {
|
|
|
614
637
|
return ev;
|
|
615
638
|
}
|
|
616
639
|
function replaceShape(ev, output) {
|
|
617
|
-
if (ev.tool?.canonicalName === "Bash") return { stdout: output, stderr: "", interrupted: false };
|
|
618
640
|
const shape = ev.result?.shape;
|
|
641
|
+
if (ev.tool?.canonicalName === "Bash") {
|
|
642
|
+
const { persistedOutputPath: _p, persistedOutputSize: _s, ...host } = shape ?? {};
|
|
643
|
+
return { interrupted: false, ...host, stdout: output, stderr: "" };
|
|
644
|
+
}
|
|
619
645
|
const slot = shape === void 0 ? null : textSlot(shape);
|
|
620
646
|
if (shape !== void 0 && slot !== null) return slot.put(shape, output);
|
|
621
647
|
if (ev.result?.blocks === true) return [{ type: "text", text: output }];
|
|
@@ -1235,8 +1261,8 @@ var ADAPTERS = Object.freeze([
|
|
|
1235
1261
|
hookTimeoutMs: HOOK_TIMEOUT_MS,
|
|
1236
1262
|
denyChannel: "deny-reason",
|
|
1237
1263
|
hookChannel: { kind: "package", path: "hooks/claude-code.json" },
|
|
1238
|
-
skillChannel: { kind: "package", path: "
|
|
1239
|
-
// ADR-0020, D-
|
|
1264
|
+
skillChannel: { kind: "package", path: "skills" },
|
|
1265
|
+
// ADR-0020, D-R33-CC-SKILLS-1: Claude Code always loads <plugin>/skills, shared with gemini and qwen
|
|
1240
1266
|
decode,
|
|
1241
1267
|
encode
|
|
1242
1268
|
},
|
package/search.mjs
CHANGED
|
@@ -544,7 +544,7 @@ function outputOf(resp) {
|
|
|
544
544
|
function textSlot(r) {
|
|
545
545
|
const file = r.file;
|
|
546
546
|
if (r.type === "text" && typeof file === "object" && file !== null && typeof file.content === "string") {
|
|
547
|
-
return { text: file.content, put: (o, output) => ({ ...o, file:
|
|
547
|
+
return { text: file.content, put: (o, output) => ({ ...o, file: readFile(o.file, output) }) };
|
|
548
548
|
}
|
|
549
549
|
if (isGrepContent(r)) return { text: r.content, put: (o, output) => ({ ...o, content: output }) };
|
|
550
550
|
if (Array.isArray(r.filenames) && r.filenames.every((f) => typeof f === "string")) {
|
|
@@ -553,13 +553,35 @@ function textSlot(r) {
|
|
|
553
553
|
if (typeof r.result === "string") return { text: r.result, put: (o, output) => ({ ...o, result: output }) };
|
|
554
554
|
return null;
|
|
555
555
|
}
|
|
556
|
+
function readFile(file, output) {
|
|
557
|
+
const start = typeof file.startLine === "number" ? file.startLine : 1;
|
|
558
|
+
const lines = String(file.content).split("\n");
|
|
559
|
+
const read2 = typeof file.numLines === "number" ? file.numLines : lines.length;
|
|
560
|
+
const out = output.split("\n");
|
|
561
|
+
const run = firstRun(lines, out);
|
|
562
|
+
if (run === null) return { ...file, content: output, startLine: start + read2, numLines: out.length };
|
|
563
|
+
const kept = out.slice(0, run.length);
|
|
564
|
+
if (run.length < out.length) kept.push(out[out.length - 1]);
|
|
565
|
+
return { ...file, content: kept.join("\n"), startLine: start + run.at, numLines: kept.length };
|
|
566
|
+
}
|
|
567
|
+
function firstRun(lines, out) {
|
|
568
|
+
let best = null;
|
|
569
|
+
for (let i = 0; i < lines.length; i++) {
|
|
570
|
+
if (lines[i] !== out[0]) continue;
|
|
571
|
+
let n = 1;
|
|
572
|
+
while (n < out.length && i + n < lines.length && lines[i + n] === out[n]) n++;
|
|
573
|
+
if (best === null || n > best.length) best = { at: i, length: n };
|
|
574
|
+
if (n === out.length) break;
|
|
575
|
+
}
|
|
576
|
+
return best;
|
|
577
|
+
}
|
|
556
578
|
function isShellShape(resp) {
|
|
557
579
|
const r = resp;
|
|
558
580
|
return typeof r.stdout === "string" || typeof r.stderr === "string";
|
|
559
581
|
}
|
|
560
582
|
function isGrepContent(resp) {
|
|
561
583
|
const r = resp;
|
|
562
|
-
return r.mode === "content" && typeof r.content === "string";
|
|
584
|
+
return (r.mode === "content" || r.mode === "count") && typeof r.content === "string";
|
|
563
585
|
}
|
|
564
586
|
function blocksOf(resp) {
|
|
565
587
|
const parts = [];
|
|
@@ -575,6 +597,7 @@ function readResult(resp) {
|
|
|
575
597
|
const text = outputOf(resp);
|
|
576
598
|
const isError = typeof resp === "object" && resp !== null && resp.is_error === true;
|
|
577
599
|
const info = { isError, bytes: Buffer.byteLength(text), text };
|
|
600
|
+
if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && isShellShape(resp)) info.shape = resp;
|
|
578
601
|
if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && !isShellShape(resp)) {
|
|
579
602
|
if (textSlot(resp) !== null) info.shape = resp;
|
|
580
603
|
else info.keep = true;
|
|
@@ -614,8 +637,11 @@ function decodeClaudeShape(raw, agent, ownPrefix, sources) {
|
|
|
614
637
|
return ev;
|
|
615
638
|
}
|
|
616
639
|
function replaceShape(ev, output) {
|
|
617
|
-
if (ev.tool?.canonicalName === "Bash") return { stdout: output, stderr: "", interrupted: false };
|
|
618
640
|
const shape = ev.result?.shape;
|
|
641
|
+
if (ev.tool?.canonicalName === "Bash") {
|
|
642
|
+
const { persistedOutputPath: _p, persistedOutputSize: _s, ...host } = shape ?? {};
|
|
643
|
+
return { interrupted: false, ...host, stdout: output, stderr: "" };
|
|
644
|
+
}
|
|
619
645
|
const slot = shape === void 0 ? null : textSlot(shape);
|
|
620
646
|
if (shape !== void 0 && slot !== null) return slot.put(shape, output);
|
|
621
647
|
if (ev.result?.blocks === true) return [{ type: "text", text: output }];
|
|
@@ -1235,8 +1261,8 @@ var ADAPTERS = Object.freeze([
|
|
|
1235
1261
|
hookTimeoutMs: HOOK_TIMEOUT_MS,
|
|
1236
1262
|
denyChannel: "deny-reason",
|
|
1237
1263
|
hookChannel: { kind: "package", path: "hooks/claude-code.json" },
|
|
1238
|
-
skillChannel: { kind: "package", path: "
|
|
1239
|
-
// ADR-0020, D-
|
|
1264
|
+
skillChannel: { kind: "package", path: "skills" },
|
|
1265
|
+
// ADR-0020, D-R33-CC-SKILLS-1: Claude Code always loads <plugin>/skills, shared with gemini and qwen
|
|
1240
1266
|
decode,
|
|
1241
1267
|
encode
|
|
1242
1268
|
},
|
package/server.mjs
CHANGED
|
@@ -28407,7 +28407,7 @@ var DECISION_SOURCE = "decision";
|
|
|
28407
28407
|
var DECISION_USER_LABEL = "decision (user)";
|
|
28408
28408
|
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
28409
28409
|
var RELEASE_BRANCH = "release";
|
|
28410
|
-
var BUNDLE_SHA = true ? "
|
|
28410
|
+
var BUNDLE_SHA = true ? "2652fe27fc5d4e368fdc38eda49d3011d38e631e" : void 0;
|
|
28411
28411
|
var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
|
|
28412
28412
|
var DOCTOR_LABEL = Object.freeze({
|
|
28413
28413
|
D1: "version",
|
|
@@ -44838,7 +44838,7 @@ function outputOf(resp) {
|
|
|
44838
44838
|
function textSlot(r) {
|
|
44839
44839
|
const file2 = r.file;
|
|
44840
44840
|
if (r.type === "text" && typeof file2 === "object" && file2 !== null && typeof file2.content === "string") {
|
|
44841
|
-
return { text: file2.content, put: (o, output) => ({ ...o, file:
|
|
44841
|
+
return { text: file2.content, put: (o, output) => ({ ...o, file: readFile(o.file, output) }) };
|
|
44842
44842
|
}
|
|
44843
44843
|
if (isGrepContent(r)) return { text: r.content, put: (o, output) => ({ ...o, content: output }) };
|
|
44844
44844
|
if (Array.isArray(r.filenames) && r.filenames.every((f) => typeof f === "string")) {
|
|
@@ -44847,13 +44847,35 @@ function textSlot(r) {
|
|
|
44847
44847
|
if (typeof r.result === "string") return { text: r.result, put: (o, output) => ({ ...o, result: output }) };
|
|
44848
44848
|
return null;
|
|
44849
44849
|
}
|
|
44850
|
+
function readFile(file2, output) {
|
|
44851
|
+
const start = typeof file2.startLine === "number" ? file2.startLine : 1;
|
|
44852
|
+
const lines = String(file2.content).split("\n");
|
|
44853
|
+
const read = typeof file2.numLines === "number" ? file2.numLines : lines.length;
|
|
44854
|
+
const out = output.split("\n");
|
|
44855
|
+
const run = firstRun(lines, out);
|
|
44856
|
+
if (run === null) return { ...file2, content: output, startLine: start + read, numLines: out.length };
|
|
44857
|
+
const kept = out.slice(0, run.length);
|
|
44858
|
+
if (run.length < out.length) kept.push(out[out.length - 1]);
|
|
44859
|
+
return { ...file2, content: kept.join("\n"), startLine: start + run.at, numLines: kept.length };
|
|
44860
|
+
}
|
|
44861
|
+
function firstRun(lines, out) {
|
|
44862
|
+
let best = null;
|
|
44863
|
+
for (let i = 0; i < lines.length; i++) {
|
|
44864
|
+
if (lines[i] !== out[0]) continue;
|
|
44865
|
+
let n = 1;
|
|
44866
|
+
while (n < out.length && i + n < lines.length && lines[i + n] === out[n]) n++;
|
|
44867
|
+
if (best === null || n > best.length) best = { at: i, length: n };
|
|
44868
|
+
if (n === out.length) break;
|
|
44869
|
+
}
|
|
44870
|
+
return best;
|
|
44871
|
+
}
|
|
44850
44872
|
function isShellShape(resp) {
|
|
44851
44873
|
const r = resp;
|
|
44852
44874
|
return typeof r.stdout === "string" || typeof r.stderr === "string";
|
|
44853
44875
|
}
|
|
44854
44876
|
function isGrepContent(resp) {
|
|
44855
44877
|
const r = resp;
|
|
44856
|
-
return r.mode === "content" && typeof r.content === "string";
|
|
44878
|
+
return (r.mode === "content" || r.mode === "count") && typeof r.content === "string";
|
|
44857
44879
|
}
|
|
44858
44880
|
function blocksOf(resp) {
|
|
44859
44881
|
const parts = [];
|
|
@@ -44869,6 +44891,7 @@ function readResult(resp) {
|
|
|
44869
44891
|
const text = outputOf(resp);
|
|
44870
44892
|
const isError = typeof resp === "object" && resp !== null && resp.is_error === true;
|
|
44871
44893
|
const info = { isError, bytes: Buffer.byteLength(text), text };
|
|
44894
|
+
if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && isShellShape(resp)) info.shape = resp;
|
|
44872
44895
|
if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && !isShellShape(resp)) {
|
|
44873
44896
|
if (textSlot(resp) !== null) info.shape = resp;
|
|
44874
44897
|
else info.keep = true;
|
|
@@ -44908,8 +44931,11 @@ function decodeClaudeShape(raw, agent, ownPrefix, sources) {
|
|
|
44908
44931
|
return ev;
|
|
44909
44932
|
}
|
|
44910
44933
|
function replaceShape(ev, output) {
|
|
44911
|
-
if (ev.tool?.canonicalName === "Bash") return { stdout: output, stderr: "", interrupted: false };
|
|
44912
44934
|
const shape = ev.result?.shape;
|
|
44935
|
+
if (ev.tool?.canonicalName === "Bash") {
|
|
44936
|
+
const { persistedOutputPath: _p, persistedOutputSize: _s, ...host } = shape ?? {};
|
|
44937
|
+
return { interrupted: false, ...host, stdout: output, stderr: "" };
|
|
44938
|
+
}
|
|
44913
44939
|
const slot = shape === void 0 ? null : textSlot(shape);
|
|
44914
44940
|
if (shape !== void 0 && slot !== null) return slot.put(shape, output);
|
|
44915
44941
|
if (ev.result?.blocks === true) return [{ type: "text", text: output }];
|
|
@@ -45529,8 +45555,8 @@ var ADAPTERS = Object.freeze([
|
|
|
45529
45555
|
hookTimeoutMs: HOOK_TIMEOUT_MS,
|
|
45530
45556
|
denyChannel: "deny-reason",
|
|
45531
45557
|
hookChannel: { kind: "package", path: "hooks/claude-code.json" },
|
|
45532
|
-
skillChannel: { kind: "package", path: "
|
|
45533
|
-
// ADR-0020, D-
|
|
45558
|
+
skillChannel: { kind: "package", path: "skills" },
|
|
45559
|
+
// ADR-0020, D-R33-CC-SKILLS-1: Claude Code always loads <plugin>/skills, shared with gemini and qwen
|
|
45534
45560
|
decode: decode3,
|
|
45535
45561
|
encode: encode3
|
|
45536
45562
|
},
|
|
@@ -3,4 +3,4 @@ name: ctx-doctor
|
|
|
3
3
|
description: Check that context-mode is installed and working, as a table.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
|
-
Call the mcp_context-mode_ctx_doctor or 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.
|
|
6
|
+
Call the mcp__plugin_context-mode_context-mode__ctx_doctor or mcp_context-mode_ctx_doctor or 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.
|
|
@@ -3,4 +3,4 @@ name: ctx-stats
|
|
|
3
3
|
description: Show how much context context-mode saved, as a detailed report.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
|
-
Call the mcp_context-mode_ctx_stats or mcp__context-mode__ctx_stats tool and show the text block of its reply to the user unchanged, inside a code block so the columns stay aligned. Add one sentence under it that names the largest saving.
|
|
6
|
+
Call the mcp__plugin_context-mode_context-mode__ctx_stats or mcp_context-mode_ctx_stats or mcp__context-mode__ctx_stats tool and show the text block of its reply to the user unchanged, inside a code block so the columns stay aligned. Add one sentence under it that names the largest saving.
|
|
@@ -3,4 +3,4 @@ name: ctx-upgrade
|
|
|
3
3
|
description: Update context-mode to the latest release.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
|
-
Call the mcp_context-mode_ctx_upgrade or mcp__context-mode__ctx_upgrade tool and show its table to the user. Then call mcp_context-mode_ctx_doctor or mcp__context-mode__ctx_doctor and show its table. If a restart is needed, say so in one sentence.
|
|
6
|
+
Call the mcp__plugin_context-mode_context-mode__ctx_upgrade or mcp_context-mode_ctx_upgrade or mcp__context-mode__ctx_upgrade tool and show its table to the user. Then call mcp__plugin_context-mode_context-mode__ctx_doctor or mcp_context-mode_ctx_doctor or mcp__context-mode__ctx_doctor and show its table. If a restart is needed, say so in one sentence.
|
|
@@ -1,6 +0,0 @@
|
|
|
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__plugin_context-mode_context-mode__ctx_doctor tool and show its table to the user unchanged. If a row failed, list the fixes it names, in order.
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ctx-stats
|
|
3
|
-
description: Show how much context context-mode saved, as a detailed report.
|
|
4
|
-
disable-model-invocation: true
|
|
5
|
-
---
|
|
6
|
-
Call the mcp__plugin_context-mode_context-mode__ctx_stats tool and show the text block of its reply to the user unchanged, inside a code block so the columns stay aligned. Add one sentence under it that names the largest saving.
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ctx-upgrade
|
|
3
|
-
description: Update context-mode to the latest release.
|
|
4
|
-
disable-model-invocation: true
|
|
5
|
-
---
|
|
6
|
-
Call the mcp__plugin_context-mode_context-mode__ctx_upgrade tool and show its table to the user. Then call mcp__plugin_context-mode_context-mode__ctx_doctor and show its table. If a restart is needed, say so in one sentence.
|