@agentspec/adapter-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,55 @@
1
+ import { AgentSpecManifest, GeneratedAgent } from '@agentspec/sdk';
2
+
3
+ /**
4
+ * @agentspec/adapter-claude
5
+ *
6
+ * Agentic code generation using Claude API.
7
+ * Claude receives the full manifest JSON + a framework-specific skill file as system prompt and
8
+ * generates production-ready code covering all manifest fields.
9
+ *
10
+ * Requires: ANTHROPIC_API_KEY environment variable.
11
+ *
12
+ * Usage:
13
+ * import { generateWithClaude, listFrameworks } from '@agentspec/adapter-claude'
14
+ * const result = await generateWithClaude(manifest, { framework: 'langgraph' })
15
+ * const frameworks = listFrameworks() // ['crewai', 'langgraph', 'mastra']
16
+ */
17
+
18
+ /**
19
+ * Returns the list of supported framework names (based on .md files in skills/).
20
+ * Excludes guidelines.md which is a universal base layer, not a framework.
21
+ */
22
+ declare function listFrameworks(): string[];
23
+ interface GenerationProgress {
24
+ /** Cumulative output characters received so far during streaming. */
25
+ outputChars: number;
26
+ }
27
+ interface ClaudeAdapterOptions {
28
+ /** Target framework (e.g. 'langgraph', 'crewai', 'mastra'). */
29
+ framework: string;
30
+ /** Claude model ID. Defaults to claude-opus-4-6. */
31
+ model?: string;
32
+ /** Optional source files to append to the user message for richer context. */
33
+ contextFiles?: string[];
34
+ /**
35
+ * Base directory of the manifest file. When provided, $file: references in
36
+ * spec.tools[].module are automatically resolved and included as context files.
37
+ */
38
+ manifestDir?: string;
39
+ /**
40
+ * Called on each streamed chunk with cumulative char count.
41
+ * When provided, generation uses the streaming API so the caller can show
42
+ * a live progress indicator. Omit to use a single blocking request.
43
+ */
44
+ onProgress?: (progress: GenerationProgress) => void;
45
+ }
46
+ /**
47
+ * Generate agent code using Claude API.
48
+ *
49
+ * Throws if ANTHROPIC_API_KEY is not set (with a helpful remediation message).
50
+ * Throws if the framework is not supported.
51
+ * Throws if Claude does not return a parseable JSON response.
52
+ */
53
+ declare function generateWithClaude(manifest: AgentSpecManifest, options: ClaudeAdapterOptions): Promise<GeneratedAgent>;
54
+
55
+ export { type ClaudeAdapterOptions, type GenerationProgress, generateWithClaude, listFrameworks };
package/dist/index.js ADDED
@@ -0,0 +1,153 @@
1
+ // src/index.ts
2
+ import Anthropic from "@anthropic-ai/sdk";
3
+ import { readFileSync as readFileSync2, readdirSync } from "fs";
4
+ import { join as join2, dirname } from "path";
5
+ import { fileURLToPath } from "url";
6
+
7
+ // src/context-builder.ts
8
+ import { readFileSync } from "fs";
9
+ import { join } from "path";
10
+ function extractFileRefs(manifest, baseDir) {
11
+ const refs = [];
12
+ for (const tool of manifest.spec.tools ?? []) {
13
+ const mod = tool.module;
14
+ if (typeof mod === "string" && mod.startsWith("$file:")) {
15
+ refs.push(join(baseDir, mod.slice(6)));
16
+ }
17
+ }
18
+ return refs;
19
+ }
20
+ function buildContext(options) {
21
+ const { manifest, contextFiles = [], manifestDir } = options;
22
+ const resolvedRefs = manifestDir ? extractFileRefs(manifest, manifestDir) : [];
23
+ const allContextFiles = [...resolvedRefs, ...contextFiles];
24
+ const parts = [
25
+ "## Agent Manifest (JSON)",
26
+ "```json",
27
+ JSON.stringify(manifest, null, 2),
28
+ "```"
29
+ ];
30
+ for (const filePath of allContextFiles) {
31
+ try {
32
+ const content = readFileSync(filePath, "utf-8");
33
+ const ext = filePath.split(".").pop() ?? "";
34
+ parts.push(`
35
+ ## Context File: ${filePath}`);
36
+ parts.push(`\`\`\`${ext}`);
37
+ parts.push(content);
38
+ parts.push("```");
39
+ } catch {
40
+ }
41
+ }
42
+ return parts.join("\n");
43
+ }
44
+
45
+ // src/index.ts
46
+ var __dirname = dirname(fileURLToPath(import.meta.url));
47
+ var skillsDir = join2(__dirname, "skills");
48
+ function listFrameworks() {
49
+ return readdirSync(skillsDir).filter((f) => f.endsWith(".md") && f !== "guidelines.md").map((f) => f.slice(0, -3)).sort();
50
+ }
51
+ function loadSkill(framework) {
52
+ const available = listFrameworks();
53
+ if (!available.includes(framework)) {
54
+ throw new Error(
55
+ `Framework '${framework}' is not supported. Available: ${available.join(", ")}`
56
+ );
57
+ }
58
+ const guidelinesPath = join2(skillsDir, "guidelines.md");
59
+ let guidelines = "";
60
+ try {
61
+ guidelines = readFileSync2(guidelinesPath, "utf-8") + "\n\n---\n\n";
62
+ } catch {
63
+ }
64
+ return guidelines + readFileSync2(join2(skillsDir, `${framework}.md`), "utf-8");
65
+ }
66
+ async function generateWithClaude(manifest, options) {
67
+ const apiKey = process.env["ANTHROPIC_API_KEY"];
68
+ if (!apiKey) {
69
+ throw new Error(
70
+ "ANTHROPIC_API_KEY is not set. AgentSpec generates code using Claude.\nGet a key at https://console.anthropic.com and add it to your environment."
71
+ );
72
+ }
73
+ const skillMd = loadSkill(options.framework);
74
+ const baseURL = process.env["ANTHROPIC_BASE_URL"];
75
+ const client = new Anthropic({ apiKey, ...baseURL ? { baseURL } : {} });
76
+ const context = buildContext({
77
+ manifest,
78
+ contextFiles: options.contextFiles,
79
+ manifestDir: options.manifestDir
80
+ });
81
+ const model = options.model ?? process.env["ANTHROPIC_MODEL"] ?? "claude-opus-4-6";
82
+ const requestParams = {
83
+ model,
84
+ max_tokens: 32768,
85
+ system: skillMd,
86
+ messages: [{ role: "user", content: context }]
87
+ };
88
+ let text;
89
+ if (options.onProgress) {
90
+ let accumulated = "";
91
+ for await (const event of client.messages.stream(requestParams)) {
92
+ if (event.type === "content_block_delta" && event.delta.type === "text_delta") {
93
+ accumulated += event.delta.text;
94
+ options.onProgress({ outputChars: accumulated.length });
95
+ }
96
+ }
97
+ text = accumulated;
98
+ } else {
99
+ const response = await client.messages.create(requestParams);
100
+ text = response.content.filter((block) => block.type === "text").map((block) => block.text).join("");
101
+ }
102
+ return extractGeneratedAgent(text, options.framework);
103
+ }
104
+ function extractGeneratedAgent(text, framework) {
105
+ const candidates = [];
106
+ const trimmed = text.trim();
107
+ if (trimmed.startsWith("{")) {
108
+ candidates.push(trimmed);
109
+ }
110
+ const fenceOpen = text.indexOf("```json");
111
+ if (fenceOpen !== -1) {
112
+ const contentStart = text.indexOf("\n", fenceOpen) + 1;
113
+ const fenceClose = text.lastIndexOf("\n```");
114
+ if (fenceClose > contentStart) {
115
+ candidates.push(text.slice(contentStart, fenceClose));
116
+ }
117
+ }
118
+ const braceMatch = text.match(/(\{[\s\S]*\})/);
119
+ if (braceMatch?.[1]) candidates.push(braceMatch[1]);
120
+ let parsedAny = false;
121
+ for (const candidate of candidates) {
122
+ let parsed;
123
+ try {
124
+ parsed = JSON.parse(candidate);
125
+ } catch {
126
+ continue;
127
+ }
128
+ parsedAny = true;
129
+ if (!parsed || typeof parsed !== "object" || !("files" in parsed)) continue;
130
+ const result = parsed;
131
+ return {
132
+ framework,
133
+ files: result.files,
134
+ installCommands: result.installCommands ?? [],
135
+ envVars: result.envVars ?? [],
136
+ readme: result.files["README.md"] ?? ""
137
+ };
138
+ }
139
+ if (parsedAny) {
140
+ throw new Error('Claude response JSON is missing the required "files" field.');
141
+ }
142
+ throw new Error(
143
+ `Claude did not return a valid JSON response.
144
+
145
+ Received:
146
+ ${text.slice(0, 500)}`
147
+ );
148
+ }
149
+ export {
150
+ generateWithClaude,
151
+ listFrameworks
152
+ };
153
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/context-builder.ts"],"sourcesContent":["/**\n * @agentspec/adapter-claude\n *\n * Agentic code generation using Claude API.\n * Claude receives the full manifest JSON + a framework-specific skill file as system prompt and\n * generates production-ready code covering all manifest fields.\n *\n * Requires: ANTHROPIC_API_KEY environment variable.\n *\n * Usage:\n * import { generateWithClaude, listFrameworks } from '@agentspec/adapter-claude'\n * const result = await generateWithClaude(manifest, { framework: 'langgraph' })\n * const frameworks = listFrameworks() // ['crewai', 'langgraph', 'mastra']\n */\n\nimport Anthropic from '@anthropic-ai/sdk'\nimport { readFileSync, readdirSync } from 'node:fs'\nimport { join, dirname } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { AgentSpecManifest, GeneratedAgent } from '@agentspec/sdk'\nimport { buildContext } from './context-builder.js'\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\nconst skillsDir = join(__dirname, 'skills')\n\n/**\n * Returns the list of supported framework names (based on .md files in skills/).\n * Excludes guidelines.md which is a universal base layer, not a framework.\n */\nexport function listFrameworks(): string[] {\n return readdirSync(skillsDir)\n .filter((f) => f.endsWith('.md') && f !== 'guidelines.md')\n .map((f) => f.slice(0, -3))\n .sort()\n}\n\n/**\n * Load the skill file for a given framework, prepended with universal guidelines.\n * Throws a descriptive error if the framework is not supported.\n */\nfunction loadSkill(framework: string): string {\n const available = listFrameworks()\n if (!available.includes(framework)) {\n throw new Error(\n `Framework '${framework}' is not supported. Available: ${available.join(', ')}`,\n )\n }\n const guidelinesPath = join(skillsDir, 'guidelines.md')\n let guidelines = ''\n try {\n guidelines = readFileSync(guidelinesPath, 'utf-8') + '\\n\\n---\\n\\n'\n } catch {\n // guidelines.md is optional — skip if missing\n }\n return guidelines + readFileSync(join(skillsDir, `${framework}.md`), 'utf-8')\n}\n\nexport interface GenerationProgress {\n /** Cumulative output characters received so far during streaming. */\n outputChars: number\n}\n\nexport interface ClaudeAdapterOptions {\n /** Target framework (e.g. 'langgraph', 'crewai', 'mastra'). */\n framework: string\n /** Claude model ID. Defaults to claude-opus-4-6. */\n model?: string\n /** Optional source files to append to the user message for richer context. */\n contextFiles?: string[]\n /**\n * Base directory of the manifest file. When provided, $file: references in\n * spec.tools[].module are automatically resolved and included as context files.\n */\n manifestDir?: string\n /**\n * Called on each streamed chunk with cumulative char count.\n * When provided, generation uses the streaming API so the caller can show\n * a live progress indicator. Omit to use a single blocking request.\n */\n onProgress?: (progress: GenerationProgress) => void\n}\n\n/**\n * Generate agent code using Claude API.\n *\n * Throws if ANTHROPIC_API_KEY is not set (with a helpful remediation message).\n * Throws if the framework is not supported.\n * Throws if Claude does not return a parseable JSON response.\n */\nexport async function generateWithClaude(\n manifest: AgentSpecManifest,\n options: ClaudeAdapterOptions,\n): Promise<GeneratedAgent> {\n const apiKey = process.env['ANTHROPIC_API_KEY']\n if (!apiKey) {\n throw new Error(\n 'ANTHROPIC_API_KEY is not set. AgentSpec generates code using Claude.\\n' +\n 'Get a key at https://console.anthropic.com and add it to your environment.',\n )\n }\n\n const skillMd = loadSkill(options.framework)\n\n const baseURL = process.env['ANTHROPIC_BASE_URL']\n const client = new Anthropic({ apiKey, ...(baseURL ? { baseURL } : {}) })\n const context = buildContext({\n manifest,\n contextFiles: options.contextFiles,\n manifestDir: options.manifestDir,\n })\n const model = options.model ?? process.env['ANTHROPIC_MODEL'] ?? 'claude-opus-4-6'\n\n const requestParams = {\n model,\n max_tokens: 32768,\n system: skillMd,\n messages: [{ role: 'user' as const, content: context }],\n }\n\n let text: string\n\n if (options.onProgress) {\n // Streaming path — yields chunks so the caller can show live progress.\n let accumulated = ''\n for await (const event of client.messages.stream(requestParams)) {\n if (event.type === 'content_block_delta' && event.delta.type === 'text_delta') {\n accumulated += event.delta.text\n options.onProgress({ outputChars: accumulated.length })\n }\n }\n text = accumulated\n } else {\n // Blocking path — single request, no progress callbacks.\n const response = await client.messages.create(requestParams)\n text = response.content\n .filter((block): block is Anthropic.TextBlock => block.type === 'text')\n .map((block) => block.text)\n .join('')\n }\n\n return extractGeneratedAgent(text, options.framework)\n}\n\n// ── Response parsing ──────────────────────────────────────────────────────────\n\ninterface ClaudeGenerationResult {\n files: Record<string, string>\n installCommands?: string[]\n envVars?: string[]\n}\n\nfunction extractGeneratedAgent(text: string, framework: string): GeneratedAgent {\n // Build candidates in priority order and return the first one that parses\n // correctly. Multiple strategies are needed because:\n //\n // 1. Claude may return bare JSON (no fence).\n // 2. Claude may wrap in ```json … ``` but the generated code inside the\n // JSON string values can contain backtick sequences that fool a naive\n // non-greedy regex — so we use lastIndexOf('\\n```') as the close marker.\n // 3. As a last resort, pull the outermost {...} from the text.\n const candidates: string[] = []\n\n const trimmed = text.trim()\n\n // Strategy 1: bare JSON\n if (trimmed.startsWith('{')) {\n candidates.push(trimmed)\n }\n\n // Strategy 2: ```json fence — close at the last newline+``` to survive\n // backtick sequences embedded inside generated code strings.\n const fenceOpen = text.indexOf('```json')\n if (fenceOpen !== -1) {\n const contentStart = text.indexOf('\\n', fenceOpen) + 1\n const fenceClose = text.lastIndexOf('\\n```')\n if (fenceClose > contentStart) {\n candidates.push(text.slice(contentStart, fenceClose))\n }\n }\n\n // Strategy 3: greedy brace match\n const braceMatch = text.match(/(\\{[\\s\\S]*\\})/)\n if (braceMatch?.[1]) candidates.push(braceMatch[1])\n\n let parsedAny = false\n for (const candidate of candidates) {\n let parsed: unknown\n try {\n parsed = JSON.parse(candidate)\n } catch {\n continue\n }\n parsedAny = true\n if (!parsed || typeof parsed !== 'object' || !('files' in parsed)) continue\n\n const result = parsed as ClaudeGenerationResult\n return {\n framework,\n files: result.files,\n installCommands: result.installCommands ?? [],\n envVars: result.envVars ?? [],\n readme: result.files['README.md'] ?? '',\n }\n }\n\n if (parsedAny) {\n throw new Error('Claude response JSON is missing the required \"files\" field.')\n }\n\n throw new Error(\n `Claude did not return a valid JSON response.\\n\\nReceived:\\n${text.slice(0, 500)}`,\n )\n}\n","import type { AgentSpecManifest } from '@agentspec/sdk'\nimport { readFileSync } from 'node:fs'\nimport { join } from 'node:path'\n\nexport interface BuildContextOptions {\n manifest: AgentSpecManifest\n contextFiles?: string[]\n /** Base directory for resolving $file: references in spec.tools[].module */\n manifestDir?: string\n}\n\n/**\n * Scan spec.tools[].module for $file: references and return resolved absolute paths.\n * This gives Claude the actual tool implementations to reference when generating typed wrappers.\n */\nfunction extractFileRefs(manifest: AgentSpecManifest, baseDir: string): string[] {\n const refs: string[] = []\n for (const tool of manifest.spec.tools ?? []) {\n const mod = (tool as Record<string, unknown>).module as string | undefined\n if (typeof mod === 'string' && mod.startsWith('$file:')) {\n refs.push(join(baseDir, mod.slice(6)))\n }\n }\n return refs\n}\n\n/**\n * Build the user-message context for Claude from a manifest + optional source files.\n * The manifest is serialised as JSON. Context files are appended verbatim so Claude\n * can infer tool signatures, existing patterns, etc.\n *\n * When manifestDir is provided, $file: references in spec.tools[].module are automatically\n * resolved and included as context files.\n */\nexport function buildContext(options: BuildContextOptions): string {\n const { manifest, contextFiles = [], manifestDir } = options\n\n const resolvedRefs = manifestDir ? extractFileRefs(manifest, manifestDir) : []\n const allContextFiles = [...resolvedRefs, ...contextFiles]\n\n const parts: string[] = [\n '## Agent Manifest (JSON)',\n '```json',\n JSON.stringify(manifest, null, 2),\n '```',\n ]\n\n for (const filePath of allContextFiles) {\n try {\n const content = readFileSync(filePath, 'utf-8')\n const ext = filePath.split('.').pop() ?? ''\n parts.push(`\\n## Context File: ${filePath}`)\n parts.push(`\\`\\`\\`${ext}`)\n parts.push(content)\n parts.push('```')\n } catch {\n // Silently skip unreadable context files\n }\n }\n\n return parts.join('\\n')\n}\n"],"mappings":";AAeA,OAAO,eAAe;AACtB,SAAS,gBAAAA,eAAc,mBAAmB;AAC1C,SAAS,QAAAC,OAAM,eAAe;AAC9B,SAAS,qBAAqB;;;ACjB9B,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AAarB,SAAS,gBAAgB,UAA6B,SAA2B;AAC/E,QAAM,OAAiB,CAAC;AACxB,aAAW,QAAQ,SAAS,KAAK,SAAS,CAAC,GAAG;AAC5C,UAAM,MAAO,KAAiC;AAC9C,QAAI,OAAO,QAAQ,YAAY,IAAI,WAAW,QAAQ,GAAG;AACvD,WAAK,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC;AAAA,IACvC;AAAA,EACF;AACA,SAAO;AACT;AAUO,SAAS,aAAa,SAAsC;AACjE,QAAM,EAAE,UAAU,eAAe,CAAC,GAAG,YAAY,IAAI;AAErD,QAAM,eAAe,cAAc,gBAAgB,UAAU,WAAW,IAAI,CAAC;AAC7E,QAAM,kBAAkB,CAAC,GAAG,cAAc,GAAG,YAAY;AAEzD,QAAM,QAAk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