@ksm0709/context 0.0.31 → 0.0.33

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.33",
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.33",
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) {
@@ -1966,6 +1976,8 @@ function applyEdits(text, edits) {
1966
1976
  }
1967
1977
 
1968
1978
  // src/shared/claude-settings.ts
1979
+ var CONTEXT_MCP_SERVER_NAME = "context-mcp";
1980
+ var LEGACY_CONTEXT_MCP_SERVER_NAME = "context_mcp";
1969
1981
  var settingsPath = join5(homedir2(), ".claude", "settings.json");
1970
1982
  function readClaudeSettings() {
1971
1983
  if (!existsSync6(settingsPath)) {
@@ -1974,6 +1986,12 @@ function readClaudeSettings() {
1974
1986
  const content = readFileSync4(settingsPath, "utf8");
1975
1987
  return parse2(content) ?? {};
1976
1988
  }
1989
+ function hasContextMcpServer(settings) {
1990
+ if (!settings.mcpServers) {
1991
+ return false;
1992
+ }
1993
+ return CONTEXT_MCP_SERVER_NAME in settings.mcpServers || LEGACY_CONTEXT_MCP_SERVER_NAME in settings.mcpServers;
1994
+ }
1977
1995
  function writeClaudeSettings(settings) {
1978
1996
  const dir = dirname4(settingsPath);
1979
1997
  if (!existsSync6(dir)) {
@@ -2000,14 +2018,6 @@ function writeClaudeSettings(settings) {
2000
2018
  writeFileSync4(tmp, content, "utf8");
2001
2019
  renameSync2(tmp, settingsPath);
2002
2020
  }
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
2021
  function removeMcpServer(name) {
2012
2022
  const settings = readClaudeSettings();
2013
2023
  if (settings.mcpServers) {
@@ -2015,6 +2025,31 @@ function removeMcpServer(name) {
2015
2025
  writeClaudeSettings(settings);
2016
2026
  }
2017
2027
  }
2028
+ function normalizeContextMcpServer() {
2029
+ const settings = readClaudeSettings();
2030
+ if (!settings.mcpServers) {
2031
+ return false;
2032
+ }
2033
+ const currentEntry = settings.mcpServers[CONTEXT_MCP_SERVER_NAME];
2034
+ const legacyEntry = settings.mcpServers[LEGACY_CONTEXT_MCP_SERVER_NAME];
2035
+ if (!currentEntry && !legacyEntry) {
2036
+ return false;
2037
+ }
2038
+ const nextEntry = currentEntry ?? legacyEntry;
2039
+ let changed = false;
2040
+ if (legacyEntry) {
2041
+ delete settings.mcpServers[LEGACY_CONTEXT_MCP_SERVER_NAME];
2042
+ changed = true;
2043
+ }
2044
+ if (!currentEntry && nextEntry) {
2045
+ settings.mcpServers[CONTEXT_MCP_SERVER_NAME] = nextEntry;
2046
+ changed = true;
2047
+ }
2048
+ if (changed) {
2049
+ writeClaudeSettings(settings);
2050
+ }
2051
+ return changed;
2052
+ }
2018
2053
  function registerHook(event, rule) {
2019
2054
  const settings = readClaudeSettings();
2020
2055
  if (!settings.hooks) {
@@ -2080,12 +2115,26 @@ function installOmc(projectDir) {
2080
2115
  injectIntoAgentsMd(join6(projectDir, "AGENTS.md"), STATIC_KNOWLEDGE_CONTEXT);
2081
2116
  let bunPath = "bun";
2082
2117
  try {
2083
- bunPath = execSync("which bun", { encoding: "utf-8" }).trim();
2118
+ bunPath = execSync2("which bun", { encoding: "utf-8" }).trim();
2084
2119
  } catch {}
2085
2120
  const mcpPath = resolveMcpPath();
2086
2121
  const hookBasePath = join6(dirname5(mcpPath), "omc") + "/";
2087
2122
  removeMcpServer("context_mcp");
2088
- registerMcpServer("context-mcp", { command: bunPath, args: [mcpPath], enabled: true });
2123
+ removeMcpServer("context-mcp");
2124
+ try {
2125
+ try {
2126
+ execSync2("claude mcp remove -s user context-mcp", { encoding: "utf-8", stdio: "pipe" });
2127
+ } catch {}
2128
+ execSync2(`claude mcp add -s user context-mcp -- ${bunPath} ${mcpPath}`, {
2129
+ encoding: "utf-8",
2130
+ stdio: "pipe"
2131
+ });
2132
+ } catch (e) {
2133
+ process.stderr.write(`Warning: Failed to register MCP via Claude CLI: ${e instanceof Error ? e.message : String(e)}
2134
+ ` + `You can manually run: claude mcp add -s user context-mcp -- ${bunPath} ${mcpPath}
2135
+ `);
2136
+ }
2137
+ normalizeContextMcpServer();
2089
2138
  registerHook("SessionStart", {
2090
2139
  matcher: "startup",
2091
2140
  hooks: [
@@ -2141,7 +2190,7 @@ function runInstall(args) {
2141
2190
  }
2142
2191
 
2143
2192
  // src/cli/commands/update.ts
2144
- var KNOWN_SUBCOMMANDS = ["all", "prompt", "plugin"];
2193
+ var KNOWN_SUBCOMMANDS = ["all", "prompt", "plugin", "omx"];
2145
2194
  function runUpdate(args) {
2146
2195
  const [subcommand, ...rest] = args;
2147
2196
  switch (subcommand) {
@@ -2156,6 +2205,9 @@ function runUpdate(args) {
2156
2205
  case "plugin":
2157
2206
  runUpdatePlugin(rest[0] ?? "latest");
2158
2207
  break;
2208
+ case "omx":
2209
+ runUpdateOmx(resolve3(rest[0] ?? process.cwd()));
2210
+ break;
2159
2211
  default:
2160
2212
  if (!KNOWN_SUBCOMMANDS.includes(subcommand)) {
2161
2213
  runUpdateAll(resolve3(subcommand));
@@ -2173,24 +2225,40 @@ function isOmxInstalled(projectDir) {
2173
2225
  function isOmcInstalled() {
2174
2226
  try {
2175
2227
  const settings = readClaudeSettings();
2176
- return settings.mcpServers != null && "context-mcp" in settings.mcpServers;
2228
+ return hasContextMcpServer(settings);
2177
2229
  } catch {
2178
2230
  return false;
2179
2231
  }
2180
2232
  }
2181
- function runUpdateAll(projectDir) {
2182
- const updated = updateScaffold(projectDir);
2233
+ function writeUpdatedFiles(updated) {
2183
2234
  if (updated.length === 0) {
2184
2235
  process.stdout.write(`All scaffold files are already up to date.
2185
2236
  `);
2186
- } else {
2187
- process.stdout.write(`Updated ${updated.length} file(s):
2237
+ return;
2238
+ }
2239
+ process.stdout.write(`Updated ${updated.length} file(s):
2188
2240
  `);
2189
- for (const f of updated) {
2190
- process.stdout.write(` - ${f}
2241
+ for (const f of updated) {
2242
+ process.stdout.write(` - ${f}
2243
+ `);
2244
+ }
2245
+ }
2246
+ function reinstallOmx(projectDir) {
2247
+ const source = resolveOmxSource();
2248
+ if (source) {
2249
+ process.stdout.write(`
2250
+ Re-installing omx plugin...
2251
+ `);
2252
+ installOmx(projectDir, source);
2253
+ } else {
2254
+ process.stderr.write(`
2255
+ Warning: could not resolve omx source; skipping omx reinstall.
2191
2256
  `);
2192
- }
2193
2257
  }
2258
+ }
2259
+ function runUpdateAll(projectDir) {
2260
+ const updated = updateScaffold(projectDir);
2261
+ writeUpdatedFiles(updated);
2194
2262
  if (isOmcInstalled()) {
2195
2263
  process.stdout.write(`
2196
2264
  Re-installing omc hooks and settings...
@@ -2198,18 +2266,19 @@ Re-installing omc hooks and settings...
2198
2266
  installOmc(projectDir);
2199
2267
  }
2200
2268
  if (isOmxInstalled(projectDir)) {
2201
- const source = resolveOmxSource();
2202
- if (source) {
2203
- process.stdout.write(`
2204
- Re-installing omx plugin...
2205
- `);
2206
- installOmx(projectDir, source);
2207
- } else {
2208
- process.stderr.write(`
2209
- Warning: could not resolve omx source; skipping omx reinstall.
2210
- `);
2211
- }
2269
+ reinstallOmx(projectDir);
2270
+ }
2271
+ }
2272
+ function runUpdateOmx(projectDir) {
2273
+ const updated = updateScaffold(projectDir);
2274
+ writeUpdatedFiles(updated);
2275
+ if (isOmxInstalled(projectDir)) {
2276
+ reinstallOmx(projectDir);
2277
+ return;
2212
2278
  }
2279
+ process.stdout.write(`
2280
+ OMX plugin is not installed for this project; skipping omx reinstall.
2281
+ `);
2213
2282
  }
2214
2283
  function detectPackageManager() {
2215
2284
  if (existsSync8("bun.lock") || existsSync8("bun.lockb"))
@@ -2332,7 +2401,9 @@ function printHelp(out) {
2332
2401
  `);
2333
2402
  write(`Commands:
2334
2403
  `);
2335
- write(` update [all] [path] Force-update scaffold + reinstall omc/omx
2404
+ write(` update [all] [path] Force-update scaffold + reinstall installed targets
2405
+ `);
2406
+ write(` update omx [path] Force-update scaffold + reinstall OMX only
2336
2407
  `);
2337
2408
  write(` update prompt [path] Force-update prompt files only
2338
2409
  `);
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.33",
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.33",
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.33",
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.33",
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.33",
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.33",
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.33",
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.33",
46
46
  "@modelcontextprotocol/sdk": "^1.27.1",
47
47
  "jsonc-parser": "^3.0.0"
48
48
  },