@kalera/munin-claude 1.2.9 → 1.4.1
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/.turbo/turbo-build.log +1 -1
- package/dist/cli.js +26 -8
- package/dist/index.d.ts +1 -1
- package/package.json +4 -3
- package/src/cli.ts +30 -7
package/.turbo/turbo-build.log
CHANGED
package/dist/cli.js
CHANGED
|
@@ -12,25 +12,43 @@ async function main() {
|
|
|
12
12
|
// Handle env subcommands: munin-claude env <set|get> <key> [value]
|
|
13
13
|
if (args[0] === "env") {
|
|
14
14
|
const [, subcmd, key, ...rest] = args;
|
|
15
|
+
const SUPPORTED_ENV_KEYS = ["MUNIN_API_KEY", "MUNIN_PROJECT", "MUNIN_ENCRYPTION_KEY"];
|
|
16
|
+
const isSupportedKey = (k) => SUPPORTED_ENV_KEYS.includes(k);
|
|
15
17
|
if (subcmd === "set") {
|
|
16
18
|
if (!key)
|
|
17
19
|
throw new Error("Usage: munin-claude env set <key> <value>");
|
|
20
|
+
if (!isSupportedKey(key)) {
|
|
21
|
+
throw new Error(`Unsupported key '${key}'. Supported: ${SUPPORTED_ENV_KEYS.join(", ")}`);
|
|
22
|
+
}
|
|
18
23
|
const value = rest.join(" ");
|
|
19
24
|
if (!value)
|
|
20
25
|
throw new Error("Usage: munin-claude env set <key> <value>");
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
// Write to .env.local (gitignored by default) — never .env, which may be committed.
|
|
27
|
+
writeEnvFile(".env.local", [{ key, value }]);
|
|
28
|
+
console.log(JSON.stringify({ ok: true, message: `Set ${key} in .env.local` }));
|
|
23
29
|
return;
|
|
24
30
|
}
|
|
25
31
|
if (subcmd === "get") {
|
|
26
32
|
if (!key)
|
|
27
33
|
throw new Error("Usage: munin-claude env get <key>");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
if (!isSupportedKey(key)) {
|
|
35
|
+
throw new Error(`Unsupported key '${key}'. Supported: ${SUPPORTED_ENV_KEYS.join(", ")}`);
|
|
36
|
+
}
|
|
37
|
+
if (key === "MUNIN_PROJECT") {
|
|
38
|
+
const { resolveProjectId } = await import("@kalera/munin-runtime");
|
|
39
|
+
const projectId = resolveProjectId();
|
|
40
|
+
console.log(JSON.stringify({ ok: true, key, value: projectId ?? null }));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// For MUNIN_API_KEY / MUNIN_ENCRYPTION_KEY — read via the runtime CLI env loader
|
|
44
|
+
// so resolution order matches actual MCP server behavior:
|
|
45
|
+
// shell env → .env.local (walked up) → .env (walked up).
|
|
46
|
+
const { loadCliEnv } = await import("@kalera/munin-runtime");
|
|
47
|
+
const env = loadCliEnv();
|
|
48
|
+
const value = key === "MUNIN_API_KEY"
|
|
49
|
+
? env.apiKey ?? null
|
|
50
|
+
: process.env.MUNIN_ENCRYPTION_KEY ?? null;
|
|
51
|
+
console.log(JSON.stringify({ ok: true, key, value }));
|
|
34
52
|
return;
|
|
35
53
|
}
|
|
36
54
|
throw new Error("Usage: munin-claude env <set|get> <key> [value]");
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export declare function createClaudeCodeMuninAdapter(config: {
|
|
|
3
3
|
apiKey?: string;
|
|
4
4
|
timeoutMs?: number;
|
|
5
5
|
}): {
|
|
6
|
-
execute: (projectId: string, action: string, payload: Record<string, unknown>) => Promise<
|
|
6
|
+
execute: (projectId: string, action: string, payload: Record<string, unknown>) => Promise<any>;
|
|
7
7
|
capabilities: () => Promise<import("@kalera/munin-sdk").MuninCapabilities>;
|
|
8
8
|
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalera/munin-claude",
|
|
3
|
-
"version": "1.2.9",
|
|
4
3
|
"type": "module",
|
|
5
4
|
"bin": {
|
|
6
5
|
"munin-claude": "dist/cli.js"
|
|
7
6
|
},
|
|
8
7
|
"dependencies": {
|
|
9
|
-
"@kalera/munin-sdk": "1.
|
|
10
|
-
"@kalera/munin-runtime": "1.
|
|
8
|
+
"@kalera/munin-sdk": "1.4.1",
|
|
9
|
+
"@kalera/munin-runtime": "1.4.1"
|
|
11
10
|
},
|
|
12
11
|
"devDependencies": {
|
|
12
|
+
"@types/node": "^24.3.0",
|
|
13
13
|
"typescript": "^5.9.2"
|
|
14
14
|
},
|
|
15
|
+
"version": "1.4.1",
|
|
15
16
|
"scripts": {
|
|
16
17
|
"build": "tsc -p tsconfig.json",
|
|
17
18
|
"lint": "tsc -p tsconfig.json --noEmit",
|
package/src/cli.ts
CHANGED
|
@@ -23,22 +23,45 @@ async function main() {
|
|
|
23
23
|
if (args[0] === "env") {
|
|
24
24
|
const [, subcmd, key, ...rest] = args;
|
|
25
25
|
|
|
26
|
+
const SUPPORTED_ENV_KEYS = ["MUNIN_API_KEY", "MUNIN_PROJECT", "MUNIN_ENCRYPTION_KEY"] as const;
|
|
27
|
+
type SupportedEnvKey = (typeof SUPPORTED_ENV_KEYS)[number];
|
|
28
|
+
const isSupportedKey = (k: string): k is SupportedEnvKey =>
|
|
29
|
+
(SUPPORTED_ENV_KEYS as readonly string[]).includes(k);
|
|
30
|
+
|
|
26
31
|
if (subcmd === "set") {
|
|
27
32
|
if (!key) throw new Error("Usage: munin-claude env set <key> <value>");
|
|
33
|
+
if (!isSupportedKey(key)) {
|
|
34
|
+
throw new Error(`Unsupported key '${key}'. Supported: ${SUPPORTED_ENV_KEYS.join(", ")}`);
|
|
35
|
+
}
|
|
28
36
|
const value = rest.join(" ");
|
|
29
37
|
if (!value) throw new Error("Usage: munin-claude env set <key> <value>");
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
// Write to .env.local (gitignored by default) — never .env, which may be committed.
|
|
39
|
+
writeEnvFile(".env.local", [{ key, value }]);
|
|
40
|
+
console.log(JSON.stringify({ ok: true, message: `Set ${key} in .env.local` }));
|
|
32
41
|
return;
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
if (subcmd === "get") {
|
|
36
45
|
if (!key) throw new Error("Usage: munin-claude env get <key>");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
if (!isSupportedKey(key)) {
|
|
47
|
+
throw new Error(`Unsupported key '${key}'. Supported: ${SUPPORTED_ENV_KEYS.join(", ")}`);
|
|
48
|
+
}
|
|
49
|
+
if (key === "MUNIN_PROJECT") {
|
|
50
|
+
const { resolveProjectId } = await import("@kalera/munin-runtime");
|
|
51
|
+
const projectId = resolveProjectId();
|
|
52
|
+
console.log(JSON.stringify({ ok: true, key, value: projectId ?? null }));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// For MUNIN_API_KEY / MUNIN_ENCRYPTION_KEY — read via the runtime CLI env loader
|
|
56
|
+
// so resolution order matches actual MCP server behavior:
|
|
57
|
+
// shell env → .env.local (walked up) → .env (walked up).
|
|
58
|
+
const { loadCliEnv } = await import("@kalera/munin-runtime");
|
|
59
|
+
const env = loadCliEnv();
|
|
60
|
+
const value =
|
|
61
|
+
key === "MUNIN_API_KEY"
|
|
62
|
+
? env.apiKey ?? null
|
|
63
|
+
: process.env.MUNIN_ENCRYPTION_KEY ?? null;
|
|
64
|
+
console.log(JSON.stringify({ ok: true, key, value }));
|
|
42
65
|
return;
|
|
43
66
|
}
|
|
44
67
|
|