@ksm0709/context 0.0.30 → 0.0.31

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
@@ -2,9 +2,9 @@
2
2
  // @bun
3
3
 
4
4
  // src/cli/commands/update.ts
5
- import { resolve, join as join3 } from "path";
6
- import { existsSync as existsSync3 } from "fs";
7
- import { homedir } from "os";
5
+ import { resolve as resolve3, join as join7 } from "path";
6
+ import { existsSync as existsSync8 } from "fs";
7
+ import { homedir as homedir3 } from "os";
8
8
 
9
9
  // src/lib/scaffold.ts
10
10
  import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -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.30",
30
+ version: "0.0.31",
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.29",
72
+ "@ksm0709/context": "^0.0.30",
73
73
  "@modelcontextprotocol/sdk": "^1.27.1",
74
74
  "jsonc-parser": "^3.0.0"
75
75
  },
@@ -449,189 +449,39 @@ function writeVersion(contextDir, version) {
449
449
  writeFileSync(join2(contextDir, ".version"), version, "utf-8");
450
450
  }
451
451
 
452
- // src/cli/commands/update.ts
453
- var KNOWN_SUBCOMMANDS = ["all", "prompt", "plugin"];
454
- function runUpdate(args) {
455
- const [subcommand, ...rest] = args;
456
- switch (subcommand) {
457
- case undefined:
458
- case "all":
459
- runUpdateAll(resolve(rest[0] ?? process.cwd()));
460
- break;
461
- case "prompt":
462
- process.stdout.write(`Prompt update is no longer supported.
463
- `);
464
- break;
465
- case "plugin":
466
- runUpdatePlugin(rest[0] ?? "latest");
467
- break;
468
- default:
469
- if (!KNOWN_SUBCOMMANDS.includes(subcommand)) {
470
- runUpdateAll(resolve(subcommand));
471
- } else {
472
- process.stderr.write(`Unknown update subcommand: ${subcommand}
473
- `);
474
- process.exit(1);
475
- }
476
- break;
477
- }
478
- }
479
- function runUpdateAll(projectDir) {
480
- const updated = updateScaffold(projectDir);
481
- if (updated.length === 0) {
482
- process.stdout.write(`All scaffold files are already up to date.
483
- `);
484
- } else {
485
- process.stdout.write(`Updated ${updated.length} file(s):
486
- `);
487
- for (const f of updated) {
488
- process.stdout.write(` - ${f}
489
- `);
490
- }
491
- }
492
- }
493
- function detectPackageManager() {
494
- if (existsSync3("bun.lock") || existsSync3("bun.lockb"))
495
- return "bun";
496
- if (existsSync3("pnpm-lock.yaml"))
497
- return "pnpm";
498
- if (existsSync3("yarn.lock"))
499
- return "yarn";
500
- if (existsSync3("package-lock.json"))
501
- return "npm";
502
- return "bun";
503
- }
504
- function detectGlobalInstalls() {
505
- const installs = [];
506
- const bunGlobalBin = join3(homedir(), ".bun", "bin", "context");
507
- if (existsSync3(bunGlobalBin)) {
508
- installs.push({ pm: "bun", label: "bun global", installCmd: ["bun", "install", "-g"] });
509
- }
510
- const spawnSync = globalThis.Bun?.spawnSync;
511
- if (spawnSync) {
512
- const whichResult = spawnSync(["which", "context"]);
513
- if (whichResult.exitCode === 0) {
514
- const binPath = whichResult.stdout.toString().trim();
515
- if (binPath && !binPath.includes(".bun") && !binPath.includes("node_modules")) {
516
- installs.push({ pm: "npm", label: "npm global", installCmd: ["npm", "install", "-g"] });
517
- }
518
- }
519
- }
520
- return installs;
521
- }
522
- function runUpdatePlugin(version) {
523
- const pkg = `@ksm0709/context@${version}`;
524
- const spawnSync = globalThis.Bun?.spawnSync;
525
- if (!spawnSync) {
526
- process.stderr.write(`Bun runtime required for plugin updates.
527
- `);
528
- process.exit(1);
529
- return;
530
- }
531
- const globalInstalls = detectGlobalInstalls();
532
- for (const { label, installCmd } of globalInstalls) {
533
- process.stdout.write(`Updating ${label} ${pkg}...
534
- `);
535
- const result = spawnSync([...installCmd, pkg]);
536
- if (result.exitCode !== 0) {
537
- process.stderr.write(`Failed to update ${label}: ${result.stderr.toString()}
538
- `);
539
- process.exit(1);
540
- return;
541
- }
542
- process.stdout.write(`Successfully updated ${label} ${pkg}.
543
- `);
544
- }
545
- const pm = detectPackageManager();
546
- process.stdout.write(`Updating local ${pkg} using ${pm}...
547
- `);
548
- const localResult = spawnSync([pm, "add", pkg]);
549
- if (localResult.exitCode !== 0) {
550
- process.stderr.write(`Failed to update local: ${localResult.stderr.toString()}
551
- `);
552
- process.exit(1);
553
- return;
554
- }
555
- process.stdout.write(`Successfully updated local ${pkg}.
556
- `);
557
- }
558
-
559
- // src/cli/commands/migrate.ts
560
- import { resolve as resolve2, join as join4 } from "path";
561
- import { existsSync as existsSync4, cpSync, rmSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
562
- var LEGACY_CONTEXT_DIR = ".opencode/context";
563
- var NEW_CONTEXT_DIR = ".context";
564
- function runMigrate(args) {
565
- const keepFlag = args.includes("--keep");
566
- const pathArg = args.find((a) => !a.startsWith("--"));
567
- const projectDir = resolve2(pathArg ?? process.cwd());
568
- const legacyDir = join4(projectDir, LEGACY_CONTEXT_DIR);
569
- const newDir = join4(projectDir, NEW_CONTEXT_DIR);
570
- if (!existsSync4(legacyDir)) {
571
- process.stdout.write(`Nothing to migrate.
572
- `);
573
- return;
574
- }
575
- if (existsSync4(newDir)) {
576
- process.stderr.write(`Target .context/ already exists. Aborting.
577
- `);
578
- process.exit(1);
579
- return;
580
- }
581
- cpSync(legacyDir, newDir, { recursive: true });
582
- updateConfigPaths(newDir);
583
- if (!keepFlag) {
584
- rmSync(legacyDir, { recursive: true, force: true });
585
- }
586
- process.stdout.write(`Migrated .opencode/context/ \u2192 .context/
587
- `);
588
- }
589
- function updateConfigPaths(contextDir) {
590
- const configPath = join4(contextDir, "config.jsonc");
591
- if (!existsSync4(configPath))
592
- return;
593
- try {
594
- const content = readFileSync2(configPath, "utf-8");
595
- const updated = content.replaceAll(".opencode/context/", "");
596
- if (updated !== content) {
597
- writeFileSync2(configPath, updated, "utf-8");
598
- }
599
- } catch {}
600
- }
601
-
602
452
  // src/cli/commands/install.ts
603
- import { join as join8, resolve as resolve4, dirname as dirname5 } from "path";
604
- import { existsSync as existsSync9, mkdirSync as mkdirSync5, copyFileSync } from "fs";
453
+ import { join as join6, resolve as resolve2, dirname as dirname5 } from "path";
454
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, copyFileSync } from "fs";
605
455
  import { fileURLToPath as fileURLToPath2 } from "url";
606
456
  import { createRequire as createRequire2 } from "module";
607
457
  import { execSync } from "child_process";
608
458
 
609
459
  // src/omx/registry.ts
610
- import { join as join6, dirname as dirname2 } from "path";
611
- import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2 } from "fs";
612
- import { homedir as homedir2 } from "os";
460
+ import { join as join4, dirname as dirname2 } from "path";
461
+ import { existsSync as existsSync4, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "fs";
462
+ import { homedir } from "os";
613
463
 
614
464
  // src/shared/mcp-path.ts
615
465
  import { fileURLToPath } from "url";
616
- import { dirname, join as join5, resolve as resolve3 } from "path";
617
- import { existsSync as existsSync5 } from "fs";
466
+ import { dirname, join as join3, resolve } from "path";
467
+ import { existsSync as existsSync3 } from "fs";
618
468
  import { createRequire } from "module";
619
469
  function resolveMcpPath() {
620
470
  try {
621
471
  const req = createRequire(import.meta.url);
622
472
  const pkgJsonPath = req.resolve("@ksm0709/context/package.json");
623
473
  const pkgRoot = dirname(pkgJsonPath);
624
- const distMcp = join5(pkgRoot, "dist", "mcp.js");
625
- if (existsSync5(distMcp))
474
+ const distMcp = join3(pkgRoot, "dist", "mcp.js");
475
+ if (existsSync3(distMcp))
626
476
  return distMcp;
627
477
  } catch {}
628
478
  const currentFile = fileURLToPath(import.meta.url);
629
479
  const currentDir = dirname(currentFile);
630
- const distMcpPath = resolve3(currentDir, "..", "mcp.js");
631
- if (existsSync5(distMcpPath))
480
+ const distMcpPath = resolve(currentDir, "..", "mcp.js");
481
+ if (existsSync3(distMcpPath))
632
482
  return distMcpPath;
633
- const srcMcpPath = resolve3(currentDir, "..", "mcp.ts");
634
- if (existsSync5(srcMcpPath))
483
+ const srcMcpPath = resolve(currentDir, "..", "mcp.ts");
484
+ if (existsSync3(srcMcpPath))
635
485
  return srcMcpPath;
636
486
  return distMcpPath;
637
487
  }
@@ -639,23 +489,23 @@ function resolveMcpPath() {
639
489
  // src/omx/registry.ts
640
490
  function getRegistryPaths() {
641
491
  return [
642
- join6(homedir2(), ".omx", "mcp-registry.json"),
643
- join6(homedir2(), ".omc", "mcp-registry.json")
492
+ join4(homedir(), ".omx", "mcp-registry.json"),
493
+ join4(homedir(), ".omc", "mcp-registry.json")
644
494
  ];
645
495
  }
646
496
  function ensureMcpRegistered(sdkLog) {
647
497
  const registryPaths = getRegistryPaths();
648
498
  let targetPath = registryPaths[0];
649
499
  for (const p of registryPaths) {
650
- if (existsSync6(p)) {
500
+ if (existsSync4(p)) {
651
501
  targetPath = p;
652
502
  break;
653
503
  }
654
504
  }
655
505
  let registry = {};
656
- if (existsSync6(targetPath)) {
506
+ if (existsSync4(targetPath)) {
657
507
  try {
658
- const content = readFileSync3(targetPath, "utf-8");
508
+ const content = readFileSync2(targetPath, "utf-8");
659
509
  registry = JSON.parse(content);
660
510
  } catch (e) {
661
511
  if (sdkLog) {
@@ -682,7 +532,7 @@ function ensureMcpRegistered(sdkLog) {
682
532
  if (changed) {
683
533
  try {
684
534
  mkdirSync2(dirname2(targetPath), { recursive: true });
685
- writeFileSync3(targetPath, JSON.stringify(registry, null, 2), "utf-8");
535
+ writeFileSync2(targetPath, JSON.stringify(registry, null, 2), "utf-8");
686
536
  if (sdkLog) {
687
537
  sdkLog(`[INFO] Registered context_mcp in ${targetPath}`);
688
538
  }
@@ -698,7 +548,7 @@ function ensureMcpRegistered(sdkLog) {
698
548
  }
699
549
 
700
550
  // src/shared/agents-md.ts
701
- import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync, writeFileSync as writeFileSync4 } from "fs";
551
+ import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync3, renameSync, writeFileSync as writeFileSync3 } from "fs";
702
552
  import { dirname as dirname3 } from "path";
703
553
  var START_MARKER = "<!-- context:start -->";
704
554
  var END_MARKER = "<!-- context:end -->";
@@ -736,16 +586,16 @@ function replaceMarkerBlock(existingContent, content) {
736
586
  }
737
587
  function writeFileAtomically(filePath, content) {
738
588
  const tempPath = `${filePath}.tmp`;
739
- writeFileSync4(tempPath, content, "utf-8");
589
+ writeFileSync3(tempPath, content, "utf-8");
740
590
  renameSync(tempPath, filePath);
741
591
  }
742
592
  function injectIntoAgentsMd(agentsMdPath, content) {
743
593
  mkdirSync3(dirname3(agentsMdPath), { recursive: true });
744
- if (!existsSync7(agentsMdPath)) {
594
+ if (!existsSync5(agentsMdPath)) {
745
595
  writeFileAtomically(agentsMdPath, renderMarkerBlock(content, true));
746
596
  return;
747
597
  }
748
- const existingContent = readFileSync4(agentsMdPath, "utf-8");
598
+ const existingContent = readFileSync3(agentsMdPath, "utf-8");
749
599
  const nextContent = existingContent.includes(START_MARKER) && existingContent.includes(END_MARKER) ? replaceMarkerBlock(existingContent, content) : appendMarkerBlock(existingContent, content);
750
600
  writeFileAtomically(agentsMdPath, nextContent);
751
601
  }
@@ -788,9 +638,9 @@ var STATIC_KNOWLEDGE_CONTEXT = `## Knowledge Context
788
638
  - \uD544\uC694\uD55C \uC778\uC790: daily_note_update_proof, knowledge_note_proof, quality_check_output, checkpoint_commit_hashes, scope_review_notes`;
789
639
 
790
640
  // src/shared/claude-settings.ts
791
- import { existsSync as existsSync8, readFileSync as readFileSync5, writeFileSync as writeFileSync5, renameSync as renameSync2, mkdirSync as mkdirSync4 } from "fs";
792
- import { dirname as dirname4, join as join7 } from "path";
793
- import { homedir as homedir3 } from "os";
641
+ import { existsSync as existsSync6, readFileSync as readFileSync4, writeFileSync as writeFileSync4, renameSync as renameSync2, mkdirSync as mkdirSync4 } from "fs";
642
+ import { dirname as dirname4, join as join5 } from "path";
643
+ import { homedir as homedir2 } from "os";
794
644
 
795
645
  // node_modules/jsonc-parser/lib/esm/impl/scanner.js
796
646
  function createScanner(text, ignoreTrivia = false) {
@@ -2116,22 +1966,22 @@ function applyEdits(text, edits) {
2116
1966
  }
2117
1967
 
2118
1968
  // src/shared/claude-settings.ts
2119
- var settingsPath = join7(homedir3(), ".claude", "settings.json");
1969
+ var settingsPath = join5(homedir2(), ".claude", "settings.json");
2120
1970
  function readClaudeSettings() {
2121
- if (!existsSync8(settingsPath)) {
1971
+ if (!existsSync6(settingsPath)) {
2122
1972
  return {};
2123
1973
  }
2124
- const content = readFileSync5(settingsPath, "utf8");
1974
+ const content = readFileSync4(settingsPath, "utf8");
2125
1975
  return parse2(content) ?? {};
2126
1976
  }
2127
1977
  function writeClaudeSettings(settings) {
2128
1978
  const dir = dirname4(settingsPath);
2129
- if (!existsSync8(dir)) {
1979
+ if (!existsSync6(dir)) {
2130
1980
  mkdirSync4(dir, { recursive: true });
2131
1981
  }
2132
1982
  let content;
2133
- if (existsSync8(settingsPath)) {
2134
- content = readFileSync5(settingsPath, "utf8");
1983
+ if (existsSync6(settingsPath)) {
1984
+ content = readFileSync4(settingsPath, "utf8");
2135
1985
  for (const [key, value] of Object.entries(settings)) {
2136
1986
  const edits = modify(content, [key], value, {});
2137
1987
  content = applyEdits(content, edits);
@@ -2147,7 +1997,7 @@ function writeClaudeSettings(settings) {
2147
1997
  content = JSON.stringify(settings, null, 2);
2148
1998
  }
2149
1999
  const tmp = settingsPath + ".tmp";
2150
- writeFileSync5(tmp, content, "utf8");
2000
+ writeFileSync4(tmp, content, "utf8");
2151
2001
  renameSync2(tmp, settingsPath);
2152
2002
  }
2153
2003
  function registerMcpServer(name, entry) {
@@ -2196,9 +2046,9 @@ function registerHook(event, rule) {
2196
2046
  function resolveOmxSource() {
2197
2047
  try {
2198
2048
  const cliDir = dirname5(fileURLToPath2(import.meta.url));
2199
- const pkgRoot = resolve4(cliDir, "..", "..");
2200
- const source = join8(pkgRoot, "dist", "omx", "index.mjs");
2201
- if (existsSync9(source))
2049
+ const pkgRoot = resolve2(cliDir, "..", "..");
2050
+ const source = join6(pkgRoot, "dist", "omx", "index.mjs");
2051
+ if (existsSync7(source))
2202
2052
  return source;
2203
2053
  } catch {}
2204
2054
  try {
@@ -2209,15 +2059,15 @@ function resolveOmxSource() {
2209
2059
  }
2210
2060
  }
2211
2061
  function installOmx(projectDir, sourcePath) {
2212
- if (!existsSync9(sourcePath)) {
2062
+ if (!existsSync7(sourcePath)) {
2213
2063
  process.stderr.write(`Could not find OMX plugin source file: ${sourcePath}
2214
2064
  `);
2215
2065
  process.exit(1);
2216
2066
  return;
2217
2067
  }
2218
- const targetDir = join8(projectDir, ".omx", "hooks");
2068
+ const targetDir = join6(projectDir, ".omx", "hooks");
2219
2069
  mkdirSync5(targetDir, { recursive: true });
2220
- copyFileSync(sourcePath, join8(targetDir, "context.mjs"));
2070
+ copyFileSync(sourcePath, join6(targetDir, "context.mjs"));
2221
2071
  process.stdout.write(`Installed context plugin to .omx/hooks/context.mjs
2222
2072
  `);
2223
2073
  if (ensureMcpRegistered()) {
@@ -2227,13 +2077,13 @@ function installOmx(projectDir, sourcePath) {
2227
2077
  }
2228
2078
  function installOmc(projectDir) {
2229
2079
  scaffoldIfNeeded(projectDir);
2230
- injectIntoAgentsMd(join8(projectDir, "AGENTS.md"), STATIC_KNOWLEDGE_CONTEXT);
2080
+ injectIntoAgentsMd(join6(projectDir, "AGENTS.md"), STATIC_KNOWLEDGE_CONTEXT);
2231
2081
  let bunPath = "bun";
2232
2082
  try {
2233
2083
  bunPath = execSync("which bun", { encoding: "utf-8" }).trim();
2234
2084
  } catch {}
2235
2085
  const mcpPath = resolveMcpPath();
2236
- const hookBasePath = join8(dirname5(mcpPath), "omc") + "/";
2086
+ const hookBasePath = join6(dirname5(mcpPath), "omc") + "/";
2237
2087
  removeMcpServer("context_mcp");
2238
2088
  registerMcpServer("context-mcp", { command: bunPath, args: [mcpPath], enabled: true });
2239
2089
  registerHook("SessionStart", {
@@ -2290,6 +2140,186 @@ function runInstall(args) {
2290
2140
  }
2291
2141
  }
2292
2142
 
2143
+ // src/cli/commands/update.ts
2144
+ var KNOWN_SUBCOMMANDS = ["all", "prompt", "plugin"];
2145
+ function runUpdate(args) {
2146
+ const [subcommand, ...rest] = args;
2147
+ switch (subcommand) {
2148
+ case undefined:
2149
+ case "all":
2150
+ runUpdateAll(resolve3(rest[0] ?? process.cwd()));
2151
+ break;
2152
+ case "prompt":
2153
+ process.stdout.write(`Prompt update is no longer supported.
2154
+ `);
2155
+ break;
2156
+ case "plugin":
2157
+ runUpdatePlugin(rest[0] ?? "latest");
2158
+ break;
2159
+ default:
2160
+ if (!KNOWN_SUBCOMMANDS.includes(subcommand)) {
2161
+ runUpdateAll(resolve3(subcommand));
2162
+ } else {
2163
+ process.stderr.write(`Unknown update subcommand: ${subcommand}
2164
+ `);
2165
+ process.exit(1);
2166
+ }
2167
+ break;
2168
+ }
2169
+ }
2170
+ function isOmxInstalled(projectDir) {
2171
+ return existsSync8(join7(projectDir, ".omx", "hooks", "context.mjs"));
2172
+ }
2173
+ function isOmcInstalled() {
2174
+ try {
2175
+ const settings = readClaudeSettings();
2176
+ return settings.mcpServers != null && "context-mcp" in settings.mcpServers;
2177
+ } catch {
2178
+ return false;
2179
+ }
2180
+ }
2181
+ function runUpdateAll(projectDir) {
2182
+ const updated = updateScaffold(projectDir);
2183
+ if (updated.length === 0) {
2184
+ process.stdout.write(`All scaffold files are already up to date.
2185
+ `);
2186
+ } else {
2187
+ process.stdout.write(`Updated ${updated.length} file(s):
2188
+ `);
2189
+ for (const f of updated) {
2190
+ process.stdout.write(` - ${f}
2191
+ `);
2192
+ }
2193
+ }
2194
+ if (isOmcInstalled()) {
2195
+ process.stdout.write(`
2196
+ Re-installing omc hooks and settings...
2197
+ `);
2198
+ installOmc(projectDir);
2199
+ }
2200
+ 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
+ }
2212
+ }
2213
+ }
2214
+ function detectPackageManager() {
2215
+ if (existsSync8("bun.lock") || existsSync8("bun.lockb"))
2216
+ return "bun";
2217
+ if (existsSync8("pnpm-lock.yaml"))
2218
+ return "pnpm";
2219
+ if (existsSync8("yarn.lock"))
2220
+ return "yarn";
2221
+ if (existsSync8("package-lock.json"))
2222
+ return "npm";
2223
+ return "bun";
2224
+ }
2225
+ function detectGlobalInstalls() {
2226
+ const installs = [];
2227
+ const bunGlobalBin = join7(homedir3(), ".bun", "bin", "context");
2228
+ if (existsSync8(bunGlobalBin)) {
2229
+ installs.push({ pm: "bun", label: "bun global", installCmd: ["bun", "install", "-g"] });
2230
+ }
2231
+ const spawnSync = globalThis.Bun?.spawnSync;
2232
+ if (spawnSync) {
2233
+ const whichResult = spawnSync(["which", "context"]);
2234
+ if (whichResult.exitCode === 0) {
2235
+ const binPath = whichResult.stdout.toString().trim();
2236
+ if (binPath && !binPath.includes(".bun") && !binPath.includes("node_modules")) {
2237
+ installs.push({ pm: "npm", label: "npm global", installCmd: ["npm", "install", "-g"] });
2238
+ }
2239
+ }
2240
+ }
2241
+ return installs;
2242
+ }
2243
+ function runUpdatePlugin(version) {
2244
+ const pkg = `@ksm0709/context@${version}`;
2245
+ const spawnSync = globalThis.Bun?.spawnSync;
2246
+ if (!spawnSync) {
2247
+ process.stderr.write(`Bun runtime required for plugin updates.
2248
+ `);
2249
+ process.exit(1);
2250
+ return;
2251
+ }
2252
+ const globalInstalls = detectGlobalInstalls();
2253
+ for (const { label, installCmd } of globalInstalls) {
2254
+ process.stdout.write(`Updating ${label} ${pkg}...
2255
+ `);
2256
+ const result = spawnSync([...installCmd, pkg]);
2257
+ if (result.exitCode !== 0) {
2258
+ process.stderr.write(`Failed to update ${label}: ${result.stderr.toString()}
2259
+ `);
2260
+ process.exit(1);
2261
+ return;
2262
+ }
2263
+ process.stdout.write(`Successfully updated ${label} ${pkg}.
2264
+ `);
2265
+ }
2266
+ const pm = detectPackageManager();
2267
+ process.stdout.write(`Updating local ${pkg} using ${pm}...
2268
+ `);
2269
+ const localResult = spawnSync([pm, "add", pkg]);
2270
+ if (localResult.exitCode !== 0) {
2271
+ process.stderr.write(`Failed to update local: ${localResult.stderr.toString()}
2272
+ `);
2273
+ process.exit(1);
2274
+ return;
2275
+ }
2276
+ process.stdout.write(`Successfully updated local ${pkg}.
2277
+ `);
2278
+ }
2279
+
2280
+ // src/cli/commands/migrate.ts
2281
+ import { resolve as resolve4, join as join8 } from "path";
2282
+ import { existsSync as existsSync9, cpSync, rmSync, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "fs";
2283
+ var LEGACY_CONTEXT_DIR = ".opencode/context";
2284
+ var NEW_CONTEXT_DIR = ".context";
2285
+ function runMigrate(args) {
2286
+ const keepFlag = args.includes("--keep");
2287
+ const pathArg = args.find((a) => !a.startsWith("--"));
2288
+ const projectDir = resolve4(pathArg ?? process.cwd());
2289
+ const legacyDir = join8(projectDir, LEGACY_CONTEXT_DIR);
2290
+ const newDir = join8(projectDir, NEW_CONTEXT_DIR);
2291
+ if (!existsSync9(legacyDir)) {
2292
+ process.stdout.write(`Nothing to migrate.
2293
+ `);
2294
+ return;
2295
+ }
2296
+ if (existsSync9(newDir)) {
2297
+ process.stderr.write(`Target .context/ already exists. Aborting.
2298
+ `);
2299
+ process.exit(1);
2300
+ return;
2301
+ }
2302
+ cpSync(legacyDir, newDir, { recursive: true });
2303
+ updateConfigPaths(newDir);
2304
+ if (!keepFlag) {
2305
+ rmSync(legacyDir, { recursive: true, force: true });
2306
+ }
2307
+ process.stdout.write(`Migrated .opencode/context/ \u2192 .context/
2308
+ `);
2309
+ }
2310
+ function updateConfigPaths(contextDir) {
2311
+ const configPath = join8(contextDir, "config.jsonc");
2312
+ if (!existsSync9(configPath))
2313
+ return;
2314
+ try {
2315
+ const content = readFileSync5(configPath, "utf-8");
2316
+ const updated = content.replaceAll(".opencode/context/", "");
2317
+ if (updated !== content) {
2318
+ writeFileSync5(configPath, updated, "utf-8");
2319
+ }
2320
+ } catch {}
2321
+ }
2322
+
2293
2323
  // src/cli/index.ts
2294
2324
  var PLUGIN_VERSION2 = package_default.version;
2295
2325
  function printHelp(out) {
@@ -2302,7 +2332,7 @@ function printHelp(out) {
2302
2332
  `);
2303
2333
  write(`Commands:
2304
2334
  `);
2305
- write(` update [all] [path] Force-update all scaffold files
2335
+ write(` update [all] [path] Force-update scaffold + reinstall omc/omx
2306
2336
  `);
2307
2337
  write(` update prompt [path] Force-update prompt files only
2308
2338
  `);
@@ -2311,6 +2341,8 @@ function printHelp(out) {
2311
2341
  write(` migrate [path] [--keep] Migrate .opencode/context/ \u2192 .context/
2312
2342
  `);
2313
2343
  write(` install omx Install OMX hook plugin to .omx/hooks/
2344
+ `);
2345
+ write(` install omc Install OMC hooks/MCP to Claude settings
2314
2346
  `);
2315
2347
  write(`
2316
2348
  `);
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.30",
28
+ version: "0.0.31",
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.29",
70
+ "@ksm0709/context": "^0.0.30",
71
71
  "@modelcontextprotocol/sdk": "^1.27.1",
72
72
  "jsonc-parser": "^3.0.0"
73
73
  },
@@ -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.30",
23
+ version: "0.0.31",
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.29",
65
+ "@ksm0709/context": "^0.0.30",
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.30",
108
+ version: "0.0.31",
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.29",
150
+ "@ksm0709/context": "^0.0.30",
151
151
  "@modelcontextprotocol/sdk": "^1.27.1",
152
152
  "jsonc-parser": "^3.0.0"
153
153
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ksm0709/context",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
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.29",
45
+ "@ksm0709/context": "^0.0.30",
46
46
  "@modelcontextprotocol/sdk": "^1.27.1",
47
47
  "jsonc-parser": "^3.0.0"
48
48
  },