@kalera/munin-claude 0.1.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.
@@ -0,0 +1,4 @@
1
+
2
+ > @kalera/munin-claude@0.1.0 build /home/runner/work/munin-for-agents/munin-for-agents/adapters/claude
3
+ > tsc -p tsconfig.json
4
+
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # Munin Adapter for Claude Code
2
+
3
+ ## Status
4
+
5
+ - Phase: scaffold
6
+ - Dispatch style: generic `execute(action, payload)`
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { createClaudeCodeMuninAdapter } from "@kalera/munin-claude";
12
+
13
+ const adapter = createClaudeCodeMuninAdapter({
14
+ baseUrl: process.env.MUNIN_BASE_URL!,
15
+ apiKey: process.env.MUNIN_API_KEY,
16
+ project: process.env.MUNIN_PROJECT ?? "default",
17
+ });
18
+
19
+ await adapter.execute("search", { query: "ecosystem" });
20
+ ```
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,32 @@
1
+ import { executeWithRetry, loadCliEnv, parseCliArgs, safeError, startMcpServer, } from "@kalera/munin-runtime";
2
+ import { createClaudeCodeMuninAdapter } from "./index.js";
3
+ async function main() {
4
+ try {
5
+ const args = process.argv.slice(2);
6
+ // Start MCP server if requested or empty args
7
+ if (args.length === 0 || args[0] === 'mcp') {
8
+ await startMcpServer();
9
+ return;
10
+ }
11
+ const { action, payload } = parseCliArgs(args, "Usage: munin-claude <action> [payload-json] OR munin-claude mcp");
12
+ const env = loadCliEnv();
13
+ const adapter = createClaudeCodeMuninAdapter({
14
+ baseUrl: env.baseUrl,
15
+ apiKey: env.apiKey,
16
+ project: env.project,
17
+ timeoutMs: env.timeoutMs,
18
+ });
19
+ const result = await executeWithRetry(async () => {
20
+ if (action === "capabilities") {
21
+ return { ok: true, data: await adapter.capabilities() };
22
+ }
23
+ return adapter.execute(action, payload);
24
+ }, env.retries, env.backoffMs);
25
+ console.log(JSON.stringify(result, null, 2));
26
+ }
27
+ catch (error) {
28
+ console.error(JSON.stringify({ ok: false, error: safeError(error) }));
29
+ process.exitCode = 1;
30
+ }
31
+ }
32
+ void main();
@@ -0,0 +1,9 @@
1
+ export declare function createClaudeCodeMuninAdapter(config: {
2
+ baseUrl: string;
3
+ apiKey?: string;
4
+ project: string;
5
+ timeoutMs?: number;
6
+ }): {
7
+ execute: (action: string, payload: Record<string, unknown>) => Promise<import("@kalera/munin-sdk").MuninResponse<unknown>>;
8
+ capabilities: () => Promise<import("@kalera/munin-sdk").MuninCapabilities>;
9
+ };
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import { MuninClient } from "@kalera/munin-sdk";
2
+ export function createClaudeCodeMuninAdapter(config) {
3
+ const client = new MuninClient(config);
4
+ return {
5
+ execute: async (action, payload) => client.invoke(action, payload, { ensureCapability: true }),
6
+ capabilities: () => client.capabilities(),
7
+ };
8
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@kalera/munin-claude",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "munin-claude": "dist/cli.js"
7
+ },
8
+ "dependencies": {
9
+ "@kalera/munin-sdk": "0.1.0",
10
+ "@kalera/munin-runtime": "0.1.0"
11
+ },
12
+ "devDependencies": {
13
+ "typescript": "^5.9.2"
14
+ },
15
+ "scripts": {
16
+ "build": "tsc -p tsconfig.json",
17
+ "lint": "tsc -p tsconfig.json --noEmit",
18
+ "test": "echo 'adapter-claude-code tests: pending'"
19
+ }
20
+ }
package/src/cli.ts ADDED
@@ -0,0 +1,47 @@
1
+ import {
2
+ executeWithRetry,
3
+ loadCliEnv,
4
+ parseCliArgs,
5
+ safeError,
6
+ startMcpServer,
7
+ } from "@kalera/munin-runtime";
8
+ import { createClaudeCodeMuninAdapter } from "./index.js";
9
+
10
+ async function main() {
11
+ try {
12
+ const args = process.argv.slice(2);
13
+
14
+ // Start MCP server if requested or empty args
15
+ if (args.length === 0 || args[0] === 'mcp') {
16
+ await startMcpServer();
17
+ return;
18
+ }
19
+
20
+ const { action, payload } = parseCliArgs(
21
+ args,
22
+ "Usage: munin-claude <action> [payload-json] OR munin-claude mcp",
23
+ );
24
+ const env = loadCliEnv();
25
+
26
+ const adapter = createClaudeCodeMuninAdapter({
27
+ baseUrl: env.baseUrl,
28
+ apiKey: env.apiKey,
29
+ project: env.project,
30
+ timeoutMs: env.timeoutMs,
31
+ });
32
+
33
+ const result = await executeWithRetry(async () => {
34
+ if (action === "capabilities") {
35
+ return { ok: true, data: await adapter.capabilities() };
36
+ }
37
+ return adapter.execute(action, payload);
38
+ }, env.retries, env.backoffMs);
39
+
40
+ console.log(JSON.stringify(result, null, 2));
41
+ } catch (error) {
42
+ console.error(JSON.stringify({ ok: false, error: safeError(error) }));
43
+ process.exitCode = 1;
44
+ }
45
+ }
46
+
47
+ void main();
package/src/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { MuninClient } from "@kalera/munin-sdk";
2
+
3
+ export function createClaudeCodeMuninAdapter(config: {
4
+ baseUrl: string;
5
+ apiKey?: string;
6
+ project: string;
7
+ timeoutMs?: number;
8
+ }) {
9
+ const client = new MuninClient(config);
10
+
11
+ return {
12
+ execute: async (action: string, payload: Record<string, unknown>) =>
13
+ client.invoke(action as any, payload, { ensureCapability: true }),
14
+ capabilities: () => client.capabilities(),
15
+ };
16
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "dist"
6
+ },
7
+ "include": ["src"]
8
+ }