@ksm0709/context 0.0.31 → 0.0.32

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/dist/cli/index.js CHANGED
@@ -27,7 +27,7 @@ function resolveContextDir(projectDir) {
27
27
  // package.json
28
28
  var package_default = {
29
29
  name: "@ksm0709/context",
30
- version: "0.0.31",
30
+ version: "0.0.32",
31
31
  author: {
32
32
  name: "TaehoKang",
33
33
  email: "ksm07091@gmail.com"
@@ -69,7 +69,7 @@ var package_default = {
69
69
  "@opencode-ai/plugin": ">=1.0.0"
70
70
  },
71
71
  dependencies: {
72
- "@ksm0709/context": "^0.0.30",
72
+ "@ksm0709/context": "^0.0.31",
73
73
  "@modelcontextprotocol/sdk": "^1.27.1",
74
74
  "jsonc-parser": "^3.0.0"
75
75
  },
@@ -454,11 +454,12 @@ import { join as join6, resolve as resolve2, dirname as dirname5 } from "path";
454
454
  import { existsSync as existsSync7, mkdirSync as mkdirSync5, copyFileSync } from "fs";
455
455
  import { fileURLToPath as fileURLToPath2 } from "url";
456
456
  import { createRequire as createRequire2 } from "module";
457
- import { execSync } from "child_process";
457
+ import { execSync as execSync2 } from "child_process";
458
458
 
459
459
  // src/omx/registry.ts
460
460
  import { join as join4, dirname as dirname2 } from "path";
461
461
  import { existsSync as existsSync4, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "fs";
462
+ import { execSync } from "child_process";
462
463
  import { homedir } from "os";
463
464
 
464
465
  // src/shared/mcp-path.ts
@@ -487,6 +488,13 @@ function resolveMcpPath() {
487
488
  }
488
489
 
489
490
  // src/omx/registry.ts
491
+ function resolveBunPath() {
492
+ try {
493
+ return execSync("which bun", { encoding: "utf-8", stdio: "pipe" }).trim();
494
+ } catch {
495
+ return "bun";
496
+ }
497
+ }
490
498
  function getRegistryPaths() {
491
499
  return [
492
500
  join4(homedir(), ".omx", "mcp-registry.json"),
@@ -515,18 +523,20 @@ function ensureMcpRegistered(sdkLog) {
515
523
  }
516
524
  }
517
525
  const mcpPath = resolveMcpPath();
526
+ const bunPath = resolveBunPath();
518
527
  const expectedConfig = {
519
- command: "bun",
520
- args: [mcpPath]
528
+ command: bunPath,
529
+ args: [mcpPath],
530
+ enabled: true
521
531
  };
522
- const currentConfig = registry["context_mcp"];
532
+ const currentConfig = registry["context-mcp"];
523
533
  let changed = false;
524
- if ("context-mcp" in registry) {
525
- delete registry["context-mcp"];
534
+ if ("context_mcp" in registry) {
535
+ delete registry["context_mcp"];
526
536
  changed = true;
527
537
  }
528
- if (!currentConfig || currentConfig.command !== expectedConfig.command || !Array.isArray(currentConfig.args) || currentConfig.args[0] !== expectedConfig.args[0]) {
529
- registry["context_mcp"] = expectedConfig;
538
+ if (!currentConfig || currentConfig.command !== expectedConfig.command || !Array.isArray(currentConfig.args) || currentConfig.args[0] !== expectedConfig.args[0] || currentConfig.enabled !== true) {
539
+ registry["context-mcp"] = expectedConfig;
530
540
  changed = true;
531
541
  }
532
542
  if (changed) {
@@ -534,7 +544,7 @@ function ensureMcpRegistered(sdkLog) {
534
544
  mkdirSync2(dirname2(targetPath), { recursive: true });
535
545
  writeFileSync2(targetPath, JSON.stringify(registry, null, 2), "utf-8");
536
546
  if (sdkLog) {
537
- sdkLog(`[INFO] Registered context_mcp in ${targetPath}`);
547
+ sdkLog(`[INFO] Registered context-mcp in ${targetPath}`);
538
548
  }
539
549
  return true;
540
550
  } catch (e) {
@@ -2000,14 +2010,6 @@ function writeClaudeSettings(settings) {
2000
2010
  writeFileSync4(tmp, content, "utf8");
2001
2011
  renameSync2(tmp, settingsPath);
2002
2012
  }
2003
- function registerMcpServer(name, entry) {
2004
- const settings = readClaudeSettings();
2005
- if (!settings.mcpServers) {
2006
- settings.mcpServers = {};
2007
- }
2008
- settings.mcpServers[name] = entry;
2009
- writeClaudeSettings(settings);
2010
- }
2011
2013
  function removeMcpServer(name) {
2012
2014
  const settings = readClaudeSettings();
2013
2015
  if (settings.mcpServers) {
@@ -2080,12 +2082,22 @@ function installOmc(projectDir) {
2080
2082
  injectIntoAgentsMd(join6(projectDir, "AGENTS.md"), STATIC_KNOWLEDGE_CONTEXT);
2081
2083
  let bunPath = "bun";
2082
2084
  try {
2083
- bunPath = execSync("which bun", { encoding: "utf-8" }).trim();
2085
+ bunPath = execSync2("which bun", { encoding: "utf-8" }).trim();
2084
2086
  } catch {}
2085
2087
  const mcpPath = resolveMcpPath();
2086
2088
  const hookBasePath = join6(dirname5(mcpPath), "omc") + "/";
2087
2089
  removeMcpServer("context_mcp");
2088
- registerMcpServer("context-mcp", { command: bunPath, args: [mcpPath], enabled: true });
2090
+ removeMcpServer("context-mcp");
2091
+ try {
2092
+ try {
2093
+ execSync2("claude mcp remove -s user context-mcp", { encoding: "utf-8", stdio: "pipe" });
2094
+ } catch {}
2095
+ execSync2(`claude mcp add -s user context-mcp -- ${bunPath} ${mcpPath}`, { encoding: "utf-8", stdio: "pipe" });
2096
+ } catch (e) {
2097
+ process.stderr.write(`Warning: Failed to register MCP via Claude CLI: ${e instanceof Error ? e.message : String(e)}
2098
+ ` + `You can manually run: claude mcp add -s user context-mcp -- ${bunPath} ${mcpPath}
2099
+ `);
2100
+ }
2089
2101
  registerHook("SessionStart", {
2090
2102
  matcher: "startup",
2091
2103
  hooks: [
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ import { join as join2 } from "path";
25
25
  // package.json
26
26
  var package_default = {
27
27
  name: "@ksm0709/context",
28
- version: "0.0.31",
28
+ version: "0.0.32",
29
29
  author: {
30
30
  name: "TaehoKang",
31
31
  email: "ksm07091@gmail.com"
@@ -67,7 +67,7 @@ var package_default = {
67
67
  "@opencode-ai/plugin": ">=1.0.0"
68
68
  },
69
69
  dependencies: {
70
- "@ksm0709/context": "^0.0.30",
70
+ "@ksm0709/context": "^0.0.31",
71
71
  "@modelcontextprotocol/sdk": "^1.27.1",
72
72
  "jsonc-parser": "^3.0.0"
73
73
  },
package/dist/mcp.js CHANGED
@@ -32651,7 +32651,7 @@ function startMcpServer() {
32651
32651
  description: "Search .md files in docs/ and .context/ directories for a keyword or regex",
32652
32652
  inputSchema: {
32653
32653
  query: exports_external.string().describe("The keyword or regex to search for"),
32654
- limit: exports_external.number().optional().default(50).describe("Maximum number of results to return")
32654
+ limit: exports_external.number().optional().describe("Maximum number of results to return (default: 50)")
32655
32655
  }
32656
32656
  }, async ({ query, limit = 50 }) => {
32657
32657
  const searchDirs = ["docs", ".context"];
@@ -32819,11 +32819,14 @@ Snippet: ${r.snippet}`).join(`
32819
32819
  server.registerTool("read_daily_note", {
32820
32820
  description: "Read a daily note from N days ago",
32821
32821
  inputSchema: {
32822
- days_before: exports_external.number().optional().default(0).describe("Number of days ago (0 for today)"),
32823
- offset: exports_external.number().optional().default(0).describe("Line number to start reading from (0-indexed)"),
32824
- lines: exports_external.number().optional().default(100).describe("Number of lines to read")
32825
- }
32826
- }, async ({ days_before, offset, lines }) => {
32822
+ days_before: exports_external.number().optional().describe("Number of days ago (0 for today, default: 0)"),
32823
+ offset: exports_external.number().optional().describe("Line number to start reading from (0-indexed, default: 0)"),
32824
+ lines: exports_external.number().optional().describe("Number of lines to read (default: 100)")
32825
+ }
32826
+ }, async ({ days_before: _days_before, offset: _offset, lines: _lines }) => {
32827
+ const days_before = _days_before ?? 0;
32828
+ const offset = _offset ?? 0;
32829
+ const lines = _lines ?? 100;
32827
32830
  try {
32828
32831
  const date6 = new Date;
32829
32832
  date6.setDate(date6.getDate() - days_before);
@@ -33015,11 +33018,11 @@ ${tags.map((t) => ` - ${t}`).join(`
33015
33018
  server.registerTool("submit_turn_complete", {
33016
33019
  description: "Mark the current turn as complete after verifying all required steps",
33017
33020
  inputSchema: {
33018
- daily_note_update_proof: exports_external.string().min(5).optional().describe("Provide the file path of the updated daily note, or explicitly write 'skipped' if no update was needed."),
33019
- knowledge_note_proof: exports_external.string().min(5).optional().describe("Provide the file path of the created knowledge note, or explicitly write 'skipped' if no note was created."),
33020
- quality_check_output: exports_external.string().min(20).describe("Provide the last 5 lines of the `mise run lint && mise run test` execution output to prove quality checks passed."),
33021
- checkpoint_commit_hashes: exports_external.string().min(7).describe("Provide the output of `git log -1 --oneline` or an explanation if the task was too small for checkpoints."),
33022
- scope_review_notes: exports_external.string().min(10).describe("Provide a brief sentence confirming the scope check and that the work did not exceed the intended boundaries.")
33021
+ daily_note_update_proof: exports_external.string().optional().describe("Provide the file path of the updated daily note, or explicitly write 'skipped' if no update was needed."),
33022
+ knowledge_note_proof: exports_external.string().optional().describe("Provide the file path of the created knowledge note, or explicitly write 'skipped' if no note was created."),
33023
+ quality_check_output: exports_external.string().describe("Provide the last 5 lines of the `mise run lint && mise run test` execution output to prove quality checks passed."),
33024
+ checkpoint_commit_hashes: exports_external.string().describe("Provide the output of `git log -1 --oneline` or an explanation if the task was too small for checkpoints."),
33025
+ scope_review_notes: exports_external.string().describe("Provide a brief sentence confirming the scope check and that the work did not exceed the intended boundaries.")
33023
33026
  }
33024
33027
  }, async ({
33025
33028
  daily_note_update_proof,
@@ -33105,6 +33108,10 @@ ${tags.map((t) => ` - ${t}`).join(`
33105
33108
  return response;
33106
33109
  });
33107
33110
  }
33111
+ const rawServer = server.server;
33112
+ if (rawServer._capabilities?.tools) {
33113
+ rawServer._capabilities.tools = {};
33114
+ }
33108
33115
  const transport = new StdioServerTransport;
33109
33116
  server.connect(transport);
33110
33117
  return server;
@@ -20,7 +20,7 @@ function resolveContextDir(projectDir) {
20
20
  // package.json
21
21
  var package_default = {
22
22
  name: "@ksm0709/context",
23
- version: "0.0.31",
23
+ version: "0.0.32",
24
24
  author: {
25
25
  name: "TaehoKang",
26
26
  email: "ksm07091@gmail.com"
@@ -62,7 +62,7 @@ var package_default = {
62
62
  "@opencode-ai/plugin": ">=1.0.0"
63
63
  },
64
64
  dependencies: {
65
- "@ksm0709/context": "^0.0.30",
65
+ "@ksm0709/context": "^0.0.31",
66
66
  "@modelcontextprotocol/sdk": "^1.27.1",
67
67
  "jsonc-parser": "^3.0.0"
68
68
  },
@@ -105,7 +105,7 @@ import { join as join3 } from "node:path";
105
105
  // package.json
106
106
  var package_default = {
107
107
  name: "@ksm0709/context",
108
- version: "0.0.31",
108
+ version: "0.0.32",
109
109
  author: {
110
110
  name: "TaehoKang",
111
111
  email: "ksm07091@gmail.com"
@@ -147,7 +147,7 @@ var package_default = {
147
147
  "@opencode-ai/plugin": ">=1.0.0"
148
148
  },
149
149
  dependencies: {
150
- "@ksm0709/context": "^0.0.30",
150
+ "@ksm0709/context": "^0.0.31",
151
151
  "@modelcontextprotocol/sdk": "^1.27.1",
152
152
  "jsonc-parser": "^3.0.0"
153
153
  },
@@ -595,6 +595,7 @@ var STATIC_KNOWLEDGE_CONTEXT = `## Knowledge Context
595
595
  // src/omx/registry.ts
596
596
  import { join as join5, dirname as dirname3 } from "node:path";
597
597
  import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "node:fs";
598
+ import { execSync } from "node:child_process";
598
599
  import { homedir } from "node:os";
599
600
 
600
601
  // src/shared/mcp-path.ts
@@ -623,6 +624,13 @@ function resolveMcpPath() {
623
624
  }
624
625
 
625
626
  // src/omx/registry.ts
627
+ function resolveBunPath() {
628
+ try {
629
+ return execSync("which bun", { encoding: "utf-8", stdio: "pipe" }).trim();
630
+ } catch {
631
+ return "bun";
632
+ }
633
+ }
626
634
  function getRegistryPaths() {
627
635
  return [
628
636
  join5(homedir(), ".omx", "mcp-registry.json"),
@@ -651,18 +659,20 @@ function ensureMcpRegistered(sdkLog) {
651
659
  }
652
660
  }
653
661
  const mcpPath = resolveMcpPath();
662
+ const bunPath = resolveBunPath();
654
663
  const expectedConfig = {
655
- command: "bun",
656
- args: [mcpPath]
664
+ command: bunPath,
665
+ args: [mcpPath],
666
+ enabled: true
657
667
  };
658
- const currentConfig = registry["context_mcp"];
668
+ const currentConfig = registry["context-mcp"];
659
669
  let changed = false;
660
- if ("context-mcp" in registry) {
661
- delete registry["context-mcp"];
670
+ if ("context_mcp" in registry) {
671
+ delete registry["context_mcp"];
662
672
  changed = true;
663
673
  }
664
- if (!currentConfig || currentConfig.command !== expectedConfig.command || !Array.isArray(currentConfig.args) || currentConfig.args[0] !== expectedConfig.args[0]) {
665
- registry["context_mcp"] = expectedConfig;
674
+ if (!currentConfig || currentConfig.command !== expectedConfig.command || !Array.isArray(currentConfig.args) || currentConfig.args[0] !== expectedConfig.args[0] || currentConfig.enabled !== true) {
675
+ registry["context-mcp"] = expectedConfig;
666
676
  changed = true;
667
677
  }
668
678
  if (changed) {
@@ -670,7 +680,7 @@ function ensureMcpRegistered(sdkLog) {
670
680
  mkdirSync3(dirname3(targetPath), { recursive: true });
671
681
  writeFileSync3(targetPath, JSON.stringify(registry, null, 2), "utf-8");
672
682
  if (sdkLog) {
673
- sdkLog(`[INFO] Registered context_mcp in ${targetPath}`);
683
+ sdkLog(`[INFO] Registered context-mcp in ${targetPath}`);
674
684
  }
675
685
  return true;
676
686
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ksm0709/context",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "author": {
5
5
  "name": "TaehoKang",
6
6
  "email": "ksm07091@gmail.com"
@@ -42,7 +42,7 @@
42
42
  "@opencode-ai/plugin": ">=1.0.0"
43
43
  },
44
44
  "dependencies": {
45
- "@ksm0709/context": "^0.0.30",
45
+ "@ksm0709/context": "^0.0.31",
46
46
  "@modelcontextprotocol/sdk": "^1.27.1",
47
47
  "jsonc-parser": "^3.0.0"
48
48
  },