@ksm0709/context 0.0.32 → 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 +83 -24
- package/dist/index.js +2 -2
- package/dist/omc/session-start-hook.js +2 -2
- package/dist/omx/index.mjs +2 -2
- package/package.json +2 -2
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.
|
|
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.
|
|
72
|
+
"@ksm0709/context": "^0.0.33",
|
|
73
73
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
74
74
|
"jsonc-parser": "^3.0.0"
|
|
75
75
|
},
|
|
@@ -1976,6 +1976,8 @@ function applyEdits(text, edits) {
|
|
|
1976
1976
|
}
|
|
1977
1977
|
|
|
1978
1978
|
// src/shared/claude-settings.ts
|
|
1979
|
+
var CONTEXT_MCP_SERVER_NAME = "context-mcp";
|
|
1980
|
+
var LEGACY_CONTEXT_MCP_SERVER_NAME = "context_mcp";
|
|
1979
1981
|
var settingsPath = join5(homedir2(), ".claude", "settings.json");
|
|
1980
1982
|
function readClaudeSettings() {
|
|
1981
1983
|
if (!existsSync6(settingsPath)) {
|
|
@@ -1984,6 +1986,12 @@ function readClaudeSettings() {
|
|
|
1984
1986
|
const content = readFileSync4(settingsPath, "utf8");
|
|
1985
1987
|
return parse2(content) ?? {};
|
|
1986
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
|
+
}
|
|
1987
1995
|
function writeClaudeSettings(settings) {
|
|
1988
1996
|
const dir = dirname4(settingsPath);
|
|
1989
1997
|
if (!existsSync6(dir)) {
|
|
@@ -2017,6 +2025,31 @@ function removeMcpServer(name) {
|
|
|
2017
2025
|
writeClaudeSettings(settings);
|
|
2018
2026
|
}
|
|
2019
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
|
+
}
|
|
2020
2053
|
function registerHook(event, rule) {
|
|
2021
2054
|
const settings = readClaudeSettings();
|
|
2022
2055
|
if (!settings.hooks) {
|
|
@@ -2092,12 +2125,16 @@ function installOmc(projectDir) {
|
|
|
2092
2125
|
try {
|
|
2093
2126
|
execSync2("claude mcp remove -s user context-mcp", { encoding: "utf-8", stdio: "pipe" });
|
|
2094
2127
|
} catch {}
|
|
2095
|
-
execSync2(`claude mcp add -s user context-mcp -- ${bunPath} ${mcpPath}`, {
|
|
2128
|
+
execSync2(`claude mcp add -s user context-mcp -- ${bunPath} ${mcpPath}`, {
|
|
2129
|
+
encoding: "utf-8",
|
|
2130
|
+
stdio: "pipe"
|
|
2131
|
+
});
|
|
2096
2132
|
} catch (e) {
|
|
2097
2133
|
process.stderr.write(`Warning: Failed to register MCP via Claude CLI: ${e instanceof Error ? e.message : String(e)}
|
|
2098
2134
|
` + `You can manually run: claude mcp add -s user context-mcp -- ${bunPath} ${mcpPath}
|
|
2099
2135
|
`);
|
|
2100
2136
|
}
|
|
2137
|
+
normalizeContextMcpServer();
|
|
2101
2138
|
registerHook("SessionStart", {
|
|
2102
2139
|
matcher: "startup",
|
|
2103
2140
|
hooks: [
|
|
@@ -2153,7 +2190,7 @@ function runInstall(args) {
|
|
|
2153
2190
|
}
|
|
2154
2191
|
|
|
2155
2192
|
// src/cli/commands/update.ts
|
|
2156
|
-
var KNOWN_SUBCOMMANDS = ["all", "prompt", "plugin"];
|
|
2193
|
+
var KNOWN_SUBCOMMANDS = ["all", "prompt", "plugin", "omx"];
|
|
2157
2194
|
function runUpdate(args) {
|
|
2158
2195
|
const [subcommand, ...rest] = args;
|
|
2159
2196
|
switch (subcommand) {
|
|
@@ -2168,6 +2205,9 @@ function runUpdate(args) {
|
|
|
2168
2205
|
case "plugin":
|
|
2169
2206
|
runUpdatePlugin(rest[0] ?? "latest");
|
|
2170
2207
|
break;
|
|
2208
|
+
case "omx":
|
|
2209
|
+
runUpdateOmx(resolve3(rest[0] ?? process.cwd()));
|
|
2210
|
+
break;
|
|
2171
2211
|
default:
|
|
2172
2212
|
if (!KNOWN_SUBCOMMANDS.includes(subcommand)) {
|
|
2173
2213
|
runUpdateAll(resolve3(subcommand));
|
|
@@ -2185,24 +2225,40 @@ function isOmxInstalled(projectDir) {
|
|
|
2185
2225
|
function isOmcInstalled() {
|
|
2186
2226
|
try {
|
|
2187
2227
|
const settings = readClaudeSettings();
|
|
2188
|
-
return settings
|
|
2228
|
+
return hasContextMcpServer(settings);
|
|
2189
2229
|
} catch {
|
|
2190
2230
|
return false;
|
|
2191
2231
|
}
|
|
2192
2232
|
}
|
|
2193
|
-
function
|
|
2194
|
-
const updated = updateScaffold(projectDir);
|
|
2233
|
+
function writeUpdatedFiles(updated) {
|
|
2195
2234
|
if (updated.length === 0) {
|
|
2196
2235
|
process.stdout.write(`All scaffold files are already up to date.
|
|
2197
2236
|
`);
|
|
2198
|
-
|
|
2199
|
-
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
process.stdout.write(`Updated ${updated.length} file(s):
|
|
2200
2240
|
`);
|
|
2201
|
-
|
|
2202
|
-
|
|
2241
|
+
for (const f of updated) {
|
|
2242
|
+
process.stdout.write(` - ${f}
|
|
2203
2243
|
`);
|
|
2204
|
-
}
|
|
2205
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.
|
|
2256
|
+
`);
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
function runUpdateAll(projectDir) {
|
|
2260
|
+
const updated = updateScaffold(projectDir);
|
|
2261
|
+
writeUpdatedFiles(updated);
|
|
2206
2262
|
if (isOmcInstalled()) {
|
|
2207
2263
|
process.stdout.write(`
|
|
2208
2264
|
Re-installing omc hooks and settings...
|
|
@@ -2210,18 +2266,19 @@ Re-installing omc hooks and settings...
|
|
|
2210
2266
|
installOmc(projectDir);
|
|
2211
2267
|
}
|
|
2212
2268
|
if (isOmxInstalled(projectDir)) {
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
`);
|
|
2223
|
-
}
|
|
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;
|
|
2224
2278
|
}
|
|
2279
|
+
process.stdout.write(`
|
|
2280
|
+
OMX plugin is not installed for this project; skipping omx reinstall.
|
|
2281
|
+
`);
|
|
2225
2282
|
}
|
|
2226
2283
|
function detectPackageManager() {
|
|
2227
2284
|
if (existsSync8("bun.lock") || existsSync8("bun.lockb"))
|
|
@@ -2344,7 +2401,9 @@ function printHelp(out) {
|
|
|
2344
2401
|
`);
|
|
2345
2402
|
write(`Commands:
|
|
2346
2403
|
`);
|
|
2347
|
-
write(` update [all] [path] Force-update scaffold + reinstall
|
|
2404
|
+
write(` update [all] [path] Force-update scaffold + reinstall installed targets
|
|
2405
|
+
`);
|
|
2406
|
+
write(` update omx [path] Force-update scaffold + reinstall OMX only
|
|
2348
2407
|
`);
|
|
2349
2408
|
write(` update prompt [path] Force-update prompt files only
|
|
2350
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.
|
|
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.
|
|
70
|
+
"@ksm0709/context": "^0.0.33",
|
|
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.
|
|
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.
|
|
65
|
+
"@ksm0709/context": "^0.0.33",
|
|
66
66
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
67
67
|
"jsonc-parser": "^3.0.0"
|
|
68
68
|
},
|
package/dist/omx/index.mjs
CHANGED
|
@@ -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.
|
|
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.
|
|
150
|
+
"@ksm0709/context": "^0.0.33",
|
|
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.
|
|
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.
|
|
45
|
+
"@ksm0709/context": "^0.0.33",
|
|
46
46
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
47
47
|
"jsonc-parser": "^3.0.0"
|
|
48
48
|
},
|