context-mode 2.0.2 → 2.1.0

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.
@@ -12,5 +12,5 @@
12
12
  }
13
13
  },
14
14
  "name": "context-mode",
15
- "version": "2.0.2"
15
+ "version": "2.1.0"
16
16
  }
package/run.mjs CHANGED
@@ -359,8 +359,8 @@ var DB_SIBLING_SUFFIXES = Object.freeze(["", DB_WAL_SUFFIX, DB_SHM_SUFFIX]);
359
359
  var UPGRADE_HOST_COMMAND = Object.freeze({
360
360
  "claude-code": "claude plugin marketplace update context-mode && claude plugin update context-mode@context-mode",
361
361
  codex: "rewrite config.toml's [mcp_servers.context-mode*] block to the v2 entry, then restart Codex",
362
- gemini: "gemini extensions install https://github.com/mksglu/context-mode --ref release --auto-update",
363
- qwen: "qwen extensions install https://github.com/mksglu/context-mode --ref release --auto-update"
362
+ gemini: "gemini extensions install https://github.com/mksglu/context-mode --auto-update",
363
+ qwen: "qwen extensions install https://github.com/mksglu/context-mode --auto-update"
364
364
  });
365
365
  var V1_SCRIPT_NAMES = Object.freeze([
366
366
  "afteragentresponse.mjs",
@@ -385,6 +385,7 @@ var VSCODE_MCP_FILE = "mcp.json";
385
385
  var KIRO_AGENT_FILE = Object.freeze(["agents", "default.json"]);
386
386
  var KIRO_STEERING_FILE = Object.freeze(["steering", "KIRO.md"]);
387
387
  var OPENCODE_CONFIG_FILES = Object.freeze(["opencode.jsonc", "opencode.json"]);
388
+ var OPENCODE_NPM_SPEC_PREFIX = `${SERVER_KEY}@`;
388
389
  var V1_DATA_ROOT_ENTRIES = Object.freeze(["content", "platform.json"]);
389
390
  var PI_ROLE = "custom";
390
391
  var V1_PATH_SEPS = Object.freeze(["/", "\\"]);
@@ -438,6 +439,7 @@ var DOCTOR_DOCS_LABEL = "Docs: ";
438
439
  var DOCTOR_REPORT_LINE = "Report file: ";
439
440
  var DOCTOR_GH_LINE = "File it: ";
440
441
  var DOCTOR_URL_LINE = "Or open: ";
442
+ var DOCTOR_RULES_LINE = "Rules: ";
441
443
  var DOCTOR_GH_NEXT = " --";
442
444
  var DOCTOR_NOTE_PREFIXES = Object.freeze([
443
445
  DOCTOR_ENV_PREFIX,
@@ -445,10 +447,23 @@ var DOCTOR_NOTE_PREFIXES = Object.freeze([
445
447
  DOCTOR_REPORT_LINE,
446
448
  DOCTOR_GH_LINE,
447
449
  DOCTOR_GH_NEXT.trim(),
448
- DOCTOR_URL_LINE
450
+ DOCTOR_URL_LINE,
451
+ DOCTOR_RULES_LINE
449
452
  ]);
450
453
  var ISSUE_REPO_SLUG = "mksglu/context-mode";
451
454
  var ISSUE_FORM_FILE = "agent-report.yml";
455
+ var ISSUE_GUIDE_URL = `https://github.com/${ISSUE_REPO_SLUG}/blob/main/.github/AGENT_ISSUE.md`;
456
+ var ISSUE_AGENT_RULES = Object.freeze([
457
+ 'Search for the same problem first: `gh issue list -R mksglu/context-mode --state all --search "<check id or error>"`. When one matches, add your facts there as a comment.',
458
+ "File one bug per issue.",
459
+ "Call the `ctx_doctor` tool and paste its full output unchanged in the `ctx-report` field.",
460
+ "Give the versions: context-mode, the agent, the OS and arch, and Node.",
461
+ "Write numbered repro steps that start from a fresh project (`mktemp -d`) and the agent's own install command.",
462
+ "Give the exact command and its exact output in a fenced code block.",
463
+ "Say what you expected and what happened instead.",
464
+ "Name the source file and line when you found the cause.",
465
+ "Replace every secret with `<masked>` and the home folder with `~` before you send."
466
+ ]);
452
467
  var ISSUE_FORM_HEADINGS = Object.freeze([
453
468
  "Summary",
454
469
  "ctx-report",
@@ -474,16 +489,16 @@ var DOCTOR_ENV_NAMES = Object.freeze([
474
489
  var DOCTOR_PATH_TOOLS = Object.freeze(["node", "git", "sh"]);
475
490
  var DOCTOR_SECRET_WORDS = Object.freeze(["token", "secret", "password", "apikey", "api_key", "authorization", "bearer"]);
476
491
  var NATIVE_INSTALL = Object.freeze({
477
- "claude-code": ["claude plugin marketplace add mksglu/context-mode#release", "claude plugin install context-mode@context-mode"],
478
- codex: ["codex plugin marketplace add mksglu/context-mode@release", "codex plugin add context-mode@context-mode"],
479
- gemini: ["gemini extensions install https://github.com/mksglu/context-mode --ref release"],
480
- qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release"],
481
- opencode: ["opencode plugin add context-mode@next"],
482
- pi: ["pi install npm:context-mode@next"],
483
- "copilot-cli": ["npm i -g context-mode@next", "context-mode setup --agents copilot-cli"],
484
- vscode: ["npm i -g context-mode@next", "context-mode setup --agents vscode"],
485
- kiro: ["npm i -g context-mode@next", "context-mode setup --agents kiro"],
486
- zcode: ["npm i -g context-mode@next", "context-mode setup --agents zcode"]
492
+ "claude-code": ["claude plugin marketplace add mksglu/context-mode", "claude plugin install context-mode@context-mode"],
493
+ codex: ["codex plugin marketplace add mksglu/context-mode", "codex plugin add context-mode@context-mode"],
494
+ gemini: ["gemini extensions install https://github.com/mksglu/context-mode"],
495
+ qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode"],
496
+ opencode: ["opencode plugin add context-mode"],
497
+ pi: ["pi install npm:context-mode"],
498
+ "copilot-cli": ["npm i -g context-mode", "context-mode setup --agents copilot-cli"],
499
+ vscode: ["npm i -g context-mode", "context-mode setup --agents vscode"],
500
+ kiro: ["npm i -g context-mode", "context-mode setup --agents kiro"],
501
+ zcode: ["npm i -g context-mode", "context-mode setup --agents zcode"]
487
502
  });
488
503
  var ISSUE_FORM_URL = `https://github.com/${ISSUE_REPO_SLUG}/issues/new?template=${ISSUE_FORM_FILE}`;
489
504
 
@@ -995,7 +1010,8 @@ function encode6(ev, d, _extra) {
995
1010
  }
996
1011
 
997
1012
  // src/adapters/kiro.ts
998
- var TOOL_NAME_PREFIX7 = "mcp_context-mode_";
1013
+ var TOOL_NAME_PREFIX7 = "mcp_context_mode_";
1014
+ var LEGACY_TOOL_NAME_PREFIX = "mcp_context-mode_";
999
1015
  var KIRO_EVENTS = {
1000
1016
  SessionStart: "SessionStart",
1001
1017
  agentSpawn: "SessionStart",
@@ -1007,6 +1023,7 @@ var KIRO_EVENTS = {
1007
1023
  PostToolUse: "PostToolUse",
1008
1024
  postToolUse: "PostToolUse"
1009
1025
  };
1026
+ var PROMPT_FIELD = "prompt";
1010
1027
  var PROMPT_ENV = "USER_PROMPT";
1011
1028
  var MCP_PREFIX3 = "mcp_";
1012
1029
  var SHELL_TOOL_NAMES4 = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
@@ -1015,6 +1032,7 @@ var MCP_SEP3 = "_";
1015
1032
  var KIRO_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
1016
1033
  function canonicalName5(name) {
1017
1034
  if (name.startsWith(TOOL_NAME_PREFIX7)) return name.slice(TOOL_NAME_PREFIX7.length);
1035
+ if (name.startsWith(LEGACY_TOOL_NAME_PREFIX)) return name.slice(LEGACY_TOOL_NAME_PREFIX.length);
1018
1036
  if (Object.hasOwn(NATIVE_TO_CANONICAL5, name)) return NATIVE_TO_CANONICAL5[name];
1019
1037
  if (!name.startsWith(MCP_PREFIX3)) return name;
1020
1038
  const rest = name.slice(MCP_PREFIX3.length);
@@ -1035,7 +1053,8 @@ function decode7(raw) {
1035
1053
  const ev = { event, agent: "kiro", sessionId: String(p.session_id ?? ""), cwd: String(p.cwd ?? "") };
1036
1054
  if (event === "SessionStart" && typeof p.source === "string" && KIRO_SOURCES[p.source] !== void 0) ev.source = KIRO_SOURCES[p.source];
1037
1055
  if (event === "UserPromptSubmit") {
1038
- const prompt = process.env[PROMPT_ENV];
1056
+ const field = p[PROMPT_FIELD];
1057
+ const prompt = typeof field === "string" ? field : process.env[PROMPT_ENV];
1039
1058
  if (prompt !== void 0) ev.prompt = prompt;
1040
1059
  }
1041
1060
  if (event === "PreToolUse" || event === "PostToolUse") {
@@ -1047,7 +1066,7 @@ function decode7(raw) {
1047
1066
  return ev;
1048
1067
  }
1049
1068
  function encode7(ev, d, _extra) {
1050
- if (ev.event === "UserPromptSubmit") return { stdout: "", exitCode: 0 };
1069
+ if (ev.event === "UserPromptSubmit") return { stdout: d.kind === "hint" ? d.text : "", exitCode: 0 };
1051
1070
  switch (d.kind) {
1052
1071
  case "allow":
1053
1072
  return { stdout: "", exitCode: 0 };
package/search.mjs CHANGED
@@ -359,8 +359,8 @@ var DB_SIBLING_SUFFIXES = Object.freeze(["", DB_WAL_SUFFIX, DB_SHM_SUFFIX]);
359
359
  var UPGRADE_HOST_COMMAND = Object.freeze({
360
360
  "claude-code": "claude plugin marketplace update context-mode && claude plugin update context-mode@context-mode",
361
361
  codex: "rewrite config.toml's [mcp_servers.context-mode*] block to the v2 entry, then restart Codex",
362
- gemini: "gemini extensions install https://github.com/mksglu/context-mode --ref release --auto-update",
363
- qwen: "qwen extensions install https://github.com/mksglu/context-mode --ref release --auto-update"
362
+ gemini: "gemini extensions install https://github.com/mksglu/context-mode --auto-update",
363
+ qwen: "qwen extensions install https://github.com/mksglu/context-mode --auto-update"
364
364
  });
365
365
  var V1_SCRIPT_NAMES = Object.freeze([
366
366
  "afteragentresponse.mjs",
@@ -385,6 +385,7 @@ var VSCODE_MCP_FILE = "mcp.json";
385
385
  var KIRO_AGENT_FILE = Object.freeze(["agents", "default.json"]);
386
386
  var KIRO_STEERING_FILE = Object.freeze(["steering", "KIRO.md"]);
387
387
  var OPENCODE_CONFIG_FILES = Object.freeze(["opencode.jsonc", "opencode.json"]);
388
+ var OPENCODE_NPM_SPEC_PREFIX = `${SERVER_KEY}@`;
388
389
  var V1_DATA_ROOT_ENTRIES = Object.freeze(["content", "platform.json"]);
389
390
  var PI_ROLE = "custom";
390
391
  var V1_PATH_SEPS = Object.freeze(["/", "\\"]);
@@ -438,6 +439,7 @@ var DOCTOR_DOCS_LABEL = "Docs: ";
438
439
  var DOCTOR_REPORT_LINE = "Report file: ";
439
440
  var DOCTOR_GH_LINE = "File it: ";
440
441
  var DOCTOR_URL_LINE = "Or open: ";
442
+ var DOCTOR_RULES_LINE = "Rules: ";
441
443
  var DOCTOR_GH_NEXT = " --";
442
444
  var DOCTOR_NOTE_PREFIXES = Object.freeze([
443
445
  DOCTOR_ENV_PREFIX,
@@ -445,10 +447,23 @@ var DOCTOR_NOTE_PREFIXES = Object.freeze([
445
447
  DOCTOR_REPORT_LINE,
446
448
  DOCTOR_GH_LINE,
447
449
  DOCTOR_GH_NEXT.trim(),
448
- DOCTOR_URL_LINE
450
+ DOCTOR_URL_LINE,
451
+ DOCTOR_RULES_LINE
449
452
  ]);
450
453
  var ISSUE_REPO_SLUG = "mksglu/context-mode";
451
454
  var ISSUE_FORM_FILE = "agent-report.yml";
455
+ var ISSUE_GUIDE_URL = `https://github.com/${ISSUE_REPO_SLUG}/blob/main/.github/AGENT_ISSUE.md`;
456
+ var ISSUE_AGENT_RULES = Object.freeze([
457
+ 'Search for the same problem first: `gh issue list -R mksglu/context-mode --state all --search "<check id or error>"`. When one matches, add your facts there as a comment.',
458
+ "File one bug per issue.",
459
+ "Call the `ctx_doctor` tool and paste its full output unchanged in the `ctx-report` field.",
460
+ "Give the versions: context-mode, the agent, the OS and arch, and Node.",
461
+ "Write numbered repro steps that start from a fresh project (`mktemp -d`) and the agent's own install command.",
462
+ "Give the exact command and its exact output in a fenced code block.",
463
+ "Say what you expected and what happened instead.",
464
+ "Name the source file and line when you found the cause.",
465
+ "Replace every secret with `<masked>` and the home folder with `~` before you send."
466
+ ]);
452
467
  var ISSUE_FORM_HEADINGS = Object.freeze([
453
468
  "Summary",
454
469
  "ctx-report",
@@ -474,16 +489,16 @@ var DOCTOR_ENV_NAMES = Object.freeze([
474
489
  var DOCTOR_PATH_TOOLS = Object.freeze(["node", "git", "sh"]);
475
490
  var DOCTOR_SECRET_WORDS = Object.freeze(["token", "secret", "password", "apikey", "api_key", "authorization", "bearer"]);
476
491
  var NATIVE_INSTALL = Object.freeze({
477
- "claude-code": ["claude plugin marketplace add mksglu/context-mode#release", "claude plugin install context-mode@context-mode"],
478
- codex: ["codex plugin marketplace add mksglu/context-mode@release", "codex plugin add context-mode@context-mode"],
479
- gemini: ["gemini extensions install https://github.com/mksglu/context-mode --ref release"],
480
- qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release"],
481
- opencode: ["opencode plugin add context-mode@next"],
482
- pi: ["pi install npm:context-mode@next"],
483
- "copilot-cli": ["npm i -g context-mode@next", "context-mode setup --agents copilot-cli"],
484
- vscode: ["npm i -g context-mode@next", "context-mode setup --agents vscode"],
485
- kiro: ["npm i -g context-mode@next", "context-mode setup --agents kiro"],
486
- zcode: ["npm i -g context-mode@next", "context-mode setup --agents zcode"]
492
+ "claude-code": ["claude plugin marketplace add mksglu/context-mode", "claude plugin install context-mode@context-mode"],
493
+ codex: ["codex plugin marketplace add mksglu/context-mode", "codex plugin add context-mode@context-mode"],
494
+ gemini: ["gemini extensions install https://github.com/mksglu/context-mode"],
495
+ qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode"],
496
+ opencode: ["opencode plugin add context-mode"],
497
+ pi: ["pi install npm:context-mode"],
498
+ "copilot-cli": ["npm i -g context-mode", "context-mode setup --agents copilot-cli"],
499
+ vscode: ["npm i -g context-mode", "context-mode setup --agents vscode"],
500
+ kiro: ["npm i -g context-mode", "context-mode setup --agents kiro"],
501
+ zcode: ["npm i -g context-mode", "context-mode setup --agents zcode"]
487
502
  });
488
503
  var ISSUE_FORM_URL = `https://github.com/${ISSUE_REPO_SLUG}/issues/new?template=${ISSUE_FORM_FILE}`;
489
504
 
@@ -995,7 +1010,8 @@ function encode6(ev, d, _extra) {
995
1010
  }
996
1011
 
997
1012
  // src/adapters/kiro.ts
998
- var TOOL_NAME_PREFIX7 = "mcp_context-mode_";
1013
+ var TOOL_NAME_PREFIX7 = "mcp_context_mode_";
1014
+ var LEGACY_TOOL_NAME_PREFIX = "mcp_context-mode_";
999
1015
  var KIRO_EVENTS = {
1000
1016
  SessionStart: "SessionStart",
1001
1017
  agentSpawn: "SessionStart",
@@ -1007,6 +1023,7 @@ var KIRO_EVENTS = {
1007
1023
  PostToolUse: "PostToolUse",
1008
1024
  postToolUse: "PostToolUse"
1009
1025
  };
1026
+ var PROMPT_FIELD = "prompt";
1010
1027
  var PROMPT_ENV = "USER_PROMPT";
1011
1028
  var MCP_PREFIX3 = "mcp_";
1012
1029
  var SHELL_TOOL_NAMES4 = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
@@ -1015,6 +1032,7 @@ var MCP_SEP3 = "_";
1015
1032
  var KIRO_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
1016
1033
  function canonicalName5(name) {
1017
1034
  if (name.startsWith(TOOL_NAME_PREFIX7)) return name.slice(TOOL_NAME_PREFIX7.length);
1035
+ if (name.startsWith(LEGACY_TOOL_NAME_PREFIX)) return name.slice(LEGACY_TOOL_NAME_PREFIX.length);
1018
1036
  if (Object.hasOwn(NATIVE_TO_CANONICAL5, name)) return NATIVE_TO_CANONICAL5[name];
1019
1037
  if (!name.startsWith(MCP_PREFIX3)) return name;
1020
1038
  const rest = name.slice(MCP_PREFIX3.length);
@@ -1035,7 +1053,8 @@ function decode7(raw) {
1035
1053
  const ev = { event, agent: "kiro", sessionId: String(p.session_id ?? ""), cwd: String(p.cwd ?? "") };
1036
1054
  if (event === "SessionStart" && typeof p.source === "string" && KIRO_SOURCES[p.source] !== void 0) ev.source = KIRO_SOURCES[p.source];
1037
1055
  if (event === "UserPromptSubmit") {
1038
- const prompt = process.env[PROMPT_ENV];
1056
+ const field = p[PROMPT_FIELD];
1057
+ const prompt = typeof field === "string" ? field : process.env[PROMPT_ENV];
1039
1058
  if (prompt !== void 0) ev.prompt = prompt;
1040
1059
  }
1041
1060
  if (event === "PreToolUse" || event === "PostToolUse") {
@@ -1047,7 +1066,7 @@ function decode7(raw) {
1047
1066
  return ev;
1048
1067
  }
1049
1068
  function encode7(ev, d, _extra) {
1050
- if (ev.event === "UserPromptSubmit") return { stdout: "", exitCode: 0 };
1069
+ if (ev.event === "UserPromptSubmit") return { stdout: d.kind === "hint" ? d.text : "", exitCode: 0 };
1051
1070
  switch (d.kind) {
1052
1071
  case "allow":
1053
1072
  return { stdout: "", exitCode: 0 };