@kalera/munin-claude 1.2.8 → 1.4.0

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @kalera/munin-claude@1.2.8 build /home/runner/work/munin-for-agents/munin-for-agents/adapters/claude
2
+ > @kalera/munin-claude@1.4.0 build /home/runner/work/munin-for-agents/munin-for-agents/adapters/claude
3
3
  > tsc -p tsconfig.json
4
4
 
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
- writeEnvFile(".env", [{ key, value }]);
22
- console.log(JSON.stringify({ ok: true, message: `Set ${key} in .env` }));
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
- // Only support MUNIN_PROJECT for now
29
- if (key !== "MUNIN_PROJECT")
30
- throw new Error("Only MUNIN_PROJECT is supported");
31
- const { resolveProjectId } = await import("@kalera/munin-runtime");
32
- const projectId = resolveProjectId();
33
- console.log(JSON.stringify({ ok: true, key, value: projectId ?? null }));
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<import("@kalera/munin-sdk").MuninResponse<unknown>>;
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.8",
4
3
  "type": "module",
5
4
  "bin": {
6
5
  "munin-claude": "dist/cli.js"
7
6
  },
8
7
  "dependencies": {
9
- "@kalera/munin-sdk": "1.2.8",
10
- "@kalera/munin-runtime": "1.2.8"
8
+ "@kalera/munin-sdk": "1.4.0",
9
+ "@kalera/munin-runtime": "1.4.0"
11
10
  },
12
11
  "devDependencies": {
12
+ "@types/node": "^24.3.0",
13
13
  "typescript": "^5.9.2"
14
14
  },
15
+ "version": "1.4.0",
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
- writeEnvFile(".env", [{ key, value }]);
31
- console.log(JSON.stringify({ ok: true, message: `Set ${key} in .env` }));
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
- // Only support MUNIN_PROJECT for now
38
- if (key !== "MUNIN_PROJECT") throw new Error("Only MUNIN_PROJECT is supported");
39
- const { resolveProjectId } = await import("@kalera/munin-runtime");
40
- const projectId = resolveProjectId();
41
- console.log(JSON.stringify({ ok: true, key, value: projectId ?? null }));
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