create-agentmark 0.10.6 → 0.10.8
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/index.js +58 -61
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,56 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __esm = (fn, res) => function __init() {
|
|
5
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
6
|
+
};
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/utils/install-skill.ts
|
|
13
|
+
var install_skill_exports = {};
|
|
14
|
+
__export(install_skill_exports, {
|
|
15
|
+
installAgentmarkSkill: () => installAgentmarkSkill
|
|
16
|
+
});
|
|
17
|
+
import { execFileSync } from "child_process";
|
|
18
|
+
var shouldSkip, installAgentmarkSkill;
|
|
19
|
+
var init_install_skill = __esm({
|
|
20
|
+
"src/utils/install-skill.ts"() {
|
|
21
|
+
"use strict";
|
|
22
|
+
shouldSkip = () => process.env.VITEST === "true" || process.env.NODE_ENV === "test" || process.env.AGENTMARK_SKIP_SKILL_INSTALL === "1";
|
|
23
|
+
installAgentmarkSkill = (targetPath) => {
|
|
24
|
+
if (shouldSkip()) {
|
|
25
|
+
console.log("\n\u23ED\uFE0F Skipping agent skill install (test environment detected).");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
console.log("\n\u{1F4DA} Installing AgentMark agent skill...");
|
|
30
|
+
console.log(" (teaches Claude Code / Codex / Cursor / Copilot how to use AgentMark)");
|
|
31
|
+
execFileSync(
|
|
32
|
+
"npx",
|
|
33
|
+
["--yes", "skills", "add", "agentmark-ai/skills"],
|
|
34
|
+
{
|
|
35
|
+
cwd: targetPath,
|
|
36
|
+
stdio: "inherit"
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
console.log("\u2705 Agent skill installed at ./.agents/skills/agentmark/");
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.warn(
|
|
42
|
+
"\n\u26A0\uFE0F Could not install the AgentMark agent skill automatically."
|
|
43
|
+
);
|
|
44
|
+
console.warn(" You can install it later with:");
|
|
45
|
+
console.warn(" cd " + targetPath);
|
|
46
|
+
console.warn(" npx skills add agentmark-ai/skills");
|
|
47
|
+
if (error instanceof Error) {
|
|
48
|
+
console.warn(` Reason: ${error.message.split("\n")[0]}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
2
54
|
|
|
3
55
|
// src/index.ts
|
|
4
56
|
import fs8 from "fs-extra";
|
|
@@ -1026,13 +1078,6 @@ var setupMCPServer = (client, targetPath) => {
|
|
|
1026
1078
|
servers: {
|
|
1027
1079
|
"agentmark-docs": {
|
|
1028
1080
|
url: "https://docs.agentmark.co/mcp"
|
|
1029
|
-
},
|
|
1030
|
-
"agentmark-traces": {
|
|
1031
|
-
command: "npx",
|
|
1032
|
-
args: ["@agentmark-ai/mcp-server"],
|
|
1033
|
-
env: {
|
|
1034
|
-
AGENTMARK_URL: "http://localhost:9418"
|
|
1035
|
-
}
|
|
1036
1081
|
}
|
|
1037
1082
|
}
|
|
1038
1083
|
};
|
|
@@ -1053,13 +1098,6 @@ var setupMCPServer = (client, targetPath) => {
|
|
|
1053
1098
|
context_servers: {
|
|
1054
1099
|
"agentmark-docs": {
|
|
1055
1100
|
url: "https://docs.agentmark.co/mcp"
|
|
1056
|
-
},
|
|
1057
|
-
"agentmark-traces": {
|
|
1058
|
-
command: "npx",
|
|
1059
|
-
args: ["@agentmark-ai/mcp-server"],
|
|
1060
|
-
env: {
|
|
1061
|
-
AGENTMARK_URL: "http://localhost:9418"
|
|
1062
|
-
}
|
|
1063
1101
|
}
|
|
1064
1102
|
}
|
|
1065
1103
|
};
|
|
@@ -1080,13 +1118,6 @@ var setupMCPServer = (client, targetPath) => {
|
|
|
1080
1118
|
mcpServers: {
|
|
1081
1119
|
"agentmark-docs": {
|
|
1082
1120
|
url: "https://docs.agentmark.co/mcp"
|
|
1083
|
-
},
|
|
1084
|
-
"agentmark-traces": {
|
|
1085
|
-
command: "npx",
|
|
1086
|
-
args: ["@agentmark-ai/mcp-server"],
|
|
1087
|
-
env: {
|
|
1088
|
-
AGENTMARK_URL: "http://localhost:9418"
|
|
1089
|
-
}
|
|
1090
1121
|
}
|
|
1091
1122
|
}
|
|
1092
1123
|
};
|
|
@@ -1106,13 +1137,6 @@ var setupMCPServer = (client, targetPath) => {
|
|
|
1106
1137
|
"agentmark-docs": {
|
|
1107
1138
|
type: "http",
|
|
1108
1139
|
url: "https://docs.agentmark.co/mcp"
|
|
1109
|
-
},
|
|
1110
|
-
"agentmark-traces": {
|
|
1111
|
-
command: "npx",
|
|
1112
|
-
args: ["@agentmark-ai/mcp-server"],
|
|
1113
|
-
env: {
|
|
1114
|
-
AGENTMARK_URL: "http://localhost:9418"
|
|
1115
|
-
}
|
|
1116
1140
|
}
|
|
1117
1141
|
}
|
|
1118
1142
|
};
|
|
@@ -1328,6 +1352,8 @@ main().catch((err) => {
|
|
|
1328
1352
|
fs4.writeFileSync(devEntryPath, devEntryContent);
|
|
1329
1353
|
console.log(`\u2705 Created dev-entry.ts at project root`);
|
|
1330
1354
|
}
|
|
1355
|
+
const { installAgentmarkSkill: installAgentmarkSkill2 } = await Promise.resolve().then(() => (init_install_skill(), install_skill_exports));
|
|
1356
|
+
installAgentmarkSkill2(targetPath);
|
|
1331
1357
|
console.log("\n\u2705 Agentmark initialization completed successfully!");
|
|
1332
1358
|
console.log(
|
|
1333
1359
|
`
|
|
@@ -1379,13 +1405,6 @@ var setupMCPServer2 = (client, targetPath) => {
|
|
|
1379
1405
|
servers: {
|
|
1380
1406
|
"agentmark-docs": {
|
|
1381
1407
|
url: "https://docs.agentmark.co/mcp"
|
|
1382
|
-
},
|
|
1383
|
-
"agentmark-traces": {
|
|
1384
|
-
command: "npx",
|
|
1385
|
-
args: ["@agentmark-ai/mcp-server"],
|
|
1386
|
-
env: {
|
|
1387
|
-
AGENTMARK_URL: "http://localhost:9418"
|
|
1388
|
-
}
|
|
1389
1408
|
}
|
|
1390
1409
|
}
|
|
1391
1410
|
};
|
|
@@ -1405,13 +1424,6 @@ var setupMCPServer2 = (client, targetPath) => {
|
|
|
1405
1424
|
context_servers: {
|
|
1406
1425
|
"agentmark-docs": {
|
|
1407
1426
|
url: "https://docs.agentmark.co/mcp"
|
|
1408
|
-
},
|
|
1409
|
-
"agentmark-traces": {
|
|
1410
|
-
command: "npx",
|
|
1411
|
-
args: ["@agentmark-ai/mcp-server"],
|
|
1412
|
-
env: {
|
|
1413
|
-
AGENTMARK_URL: "http://localhost:9418"
|
|
1414
|
-
}
|
|
1415
1427
|
}
|
|
1416
1428
|
}
|
|
1417
1429
|
};
|
|
@@ -1431,13 +1443,6 @@ var setupMCPServer2 = (client, targetPath) => {
|
|
|
1431
1443
|
mcpServers: {
|
|
1432
1444
|
"agentmark-docs": {
|
|
1433
1445
|
url: "https://docs.agentmark.co/mcp"
|
|
1434
|
-
},
|
|
1435
|
-
"agentmark-traces": {
|
|
1436
|
-
command: "npx",
|
|
1437
|
-
args: ["@agentmark-ai/mcp-server"],
|
|
1438
|
-
env: {
|
|
1439
|
-
AGENTMARK_URL: "http://localhost:9418"
|
|
1440
|
-
}
|
|
1441
1446
|
}
|
|
1442
1447
|
}
|
|
1443
1448
|
};
|
|
@@ -1456,13 +1461,6 @@ var setupMCPServer2 = (client, targetPath) => {
|
|
|
1456
1461
|
"agentmark-docs": {
|
|
1457
1462
|
type: "http",
|
|
1458
1463
|
url: "https://docs.agentmark.co/mcp"
|
|
1459
|
-
},
|
|
1460
|
-
"agentmark-traces": {
|
|
1461
|
-
command: "npx",
|
|
1462
|
-
args: ["@agentmark-ai/mcp-server"],
|
|
1463
|
-
env: {
|
|
1464
|
-
AGENTMARK_URL: "http://localhost:9418"
|
|
1465
|
-
}
|
|
1466
1464
|
}
|
|
1467
1465
|
}
|
|
1468
1466
|
};
|
|
@@ -1604,9 +1602,8 @@ var getAgentmarkClientContent = (deploymentMode, adapter) => {
|
|
|
1604
1602
|
const isCloud = deploymentMode === "cloud";
|
|
1605
1603
|
const loaderImport = isCloud ? `from agentmark.prompt_core import ApiLoader` : `from agentmark.prompt_core import FileLoader`;
|
|
1606
1604
|
const loaderSetup = isCloud ? `# API loader for cloud deployment \u2014 fetches datasets from the AgentMark gateway
|
|
1607
|
-
loader = ApiLoader.cloud()` : `# File loader for local development
|
|
1608
|
-
|
|
1609
|
-
loader = FileLoader(base_dir=str(project_root))`;
|
|
1605
|
+
loader = ApiLoader.cloud()` : `# File loader for local development \u2014 reads pre-built prompts from the build output directory
|
|
1606
|
+
loader = FileLoader("./dist/agentmark")`;
|
|
1610
1607
|
if (adapter === "claude-agent-sdk") {
|
|
1611
1608
|
return `"""AgentMark client configuration.
|
|
1612
1609
|
|
|
@@ -1616,7 +1613,6 @@ Customize the model registry and eval registry as needed.
|
|
|
1616
1613
|
|
|
1617
1614
|
import json
|
|
1618
1615
|
import os
|
|
1619
|
-
from pathlib import Path
|
|
1620
1616
|
from dotenv import load_dotenv
|
|
1621
1617
|
|
|
1622
1618
|
${loaderImport}
|
|
@@ -1682,7 +1678,6 @@ Customize the model registry, tools, and eval registry as needed.
|
|
|
1682
1678
|
|
|
1683
1679
|
import json
|
|
1684
1680
|
import os
|
|
1685
|
-
from pathlib import Path
|
|
1686
1681
|
from dotenv import load_dotenv
|
|
1687
1682
|
|
|
1688
1683
|
${loaderImport}
|
|
@@ -2096,6 +2091,8 @@ var createPythonApp = async (client, targetPath = ".", apiKey = "", deploymentMo
|
|
|
2096
2091
|
console.log("Note: You'll need to set up a virtual environment and install dependencies.");
|
|
2097
2092
|
console.log("");
|
|
2098
2093
|
}
|
|
2094
|
+
const { installAgentmarkSkill: installAgentmarkSkill2 } = await Promise.resolve().then(() => (init_install_skill(), install_skill_exports));
|
|
2095
|
+
installAgentmarkSkill2(targetPath);
|
|
2099
2096
|
console.log("\n\u2705 AgentMark Python initialization completed successfully!");
|
|
2100
2097
|
console.log(
|
|
2101
2098
|
`
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/utils/examples/create-example-app.ts","../src/utils/examples/templates/adapters.ts","../src/utils/examples/templates/app-index.ts","../src/utils/examples/templates/env.ts","../src/utils/examples/templates/package-setup.ts","../src/utils/file-merge.ts","../src/utils/types.ts","../src/utils/examples/templates/tsconfig.ts","../src/utils/examples/templates/animal-drawing-prompt.ts","../src/utils/examples/templates/customer-support-prompt.ts","../src/utils/examples/templates/party-planner-prompt.ts","../src/utils/examples/templates/story-teller-prompt.ts","../src/utils/examples/templates/datasets.ts","../src/utils/examples/templates/example-prompts.ts","../src/utils/examples/templates/user-client-config.ts","../src/utils/conflict-resolution.ts","../src/utils/examples/create-python-app.ts","../src/utils/project-detection.ts","../src/utils/package-manager.ts","../src/utils/git-init.ts"],"sourcesContent":["import fs from \"fs-extra\";\nimport path from \"path\";\nimport prompts from \"prompts\";\nimport { createExampleApp } from \"./utils/examples/create-example-app\";\nimport { createPythonApp } from \"./utils/examples/create-python-app\";\nimport { detectProjectInfo, isCurrentDirectory } from \"./utils/project-detection.js\";\nimport { displayProjectDetectionSummary, promptForResolutions } from \"./utils/conflict-resolution.js\";\nimport type { ProjectInfo, ConflictResolution } from \"./utils/types.js\";\nimport { initGitRepo } from \"./utils/git-init.js\";\n\ninterface CliArgs {\n path?: string;\n language?: \"typescript\" | \"python\";\n adapter?: string;\n deploymentMode?: \"cloud\" | \"static\";\n apiKey?: string;\n client?: string;\n overwrite?: boolean;\n}\n\nconst VALID_ADAPTERS_TS = [\"ai-sdk\", \"claude-agent-sdk\", \"mastra\"];\nconst VALID_ADAPTERS_PY = [\"pydantic-ai\", \"claude-agent-sdk\"];\nconst VALID_CLIENTS = [\"claude-code\", \"cursor\", \"vscode\", \"zed\", \"skip\"];\n\nconst parseArgs = (): CliArgs => {\n const args = process.argv.slice(2);\n const result: CliArgs = {};\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n switch (arg) {\n case \"--cloud\":\n result.deploymentMode = \"cloud\";\n break;\n case \"--self-host\":\n result.deploymentMode = \"static\";\n break;\n case \"--python\":\n result.language = \"python\";\n break;\n case \"--typescript\":\n result.language = \"typescript\";\n break;\n case \"--overwrite\":\n result.overwrite = true;\n break;\n case \"--path\":\n result.path = args[++i];\n break;\n case \"--adapter\":\n result.adapter = args[++i];\n break;\n case \"--api-key\":\n result.apiKey = args[++i];\n break;\n case \"--client\":\n result.client = args[++i];\n break;\n }\n }\n\n return result;\n};\n\nconst main = async () => {\n const cliArgs = parseArgs();\n const config: any = {\n $schema:\n \"https://raw.githubusercontent.com/agentmark-ai/agentmark/refs/heads/main/packages/cli/agentmark.schema.json\",\n version: \"2.0.0\",\n mdxVersion: \"1.0\",\n agentmarkPath: \".\",\n };\n console.log(\"Initializing project.\");\n\n // Folder name — from --path flag or prompt\n let folderName = cliArgs.path;\n if (!folderName) {\n const response = await prompts({\n name: \"folderName\",\n type: \"text\",\n message: \"Where would you like to create your AgentMark app?\",\n initial: \"my-agentmark-app\",\n });\n folderName = response.folderName;\n }\n\n // Determine target path - handle \".\" for current directory\n const isCurrentDir = isCurrentDirectory(folderName!);\n const targetPath = isCurrentDir ? process.cwd() : path.resolve(folderName!);\n\n // Create the target folder only if not using current directory\n if (!isCurrentDir) {\n fs.ensureDirSync(targetPath);\n }\n\n // Detect existing project\n const projectInfo: ProjectInfo = detectProjectInfo(targetPath);\n\n // Show detection summary if existing project found\n if (projectInfo.isExistingProject) {\n displayProjectDetectionSummary(projectInfo);\n }\n\n // Prompt for conflict resolutions if needed (--overwrite skips prompts)\n let resolutions: ConflictResolution[];\n if (cliArgs.overwrite) {\n resolutions = projectInfo.conflictingFiles.map((f) => ({\n path: f.path,\n action: \"overwrite\" as const,\n }));\n } else {\n resolutions = await promptForResolutions(projectInfo.conflictingFiles);\n }\n\n // Language selection — from flag or prompt\n let language = cliArgs.language;\n if (!language) {\n const response = await prompts({\n name: \"language\",\n type: \"select\",\n message: \"Which language would you like to use?\",\n choices: [\n { title: \"TypeScript\", value: \"typescript\" },\n { title: \"Python\", value: \"python\" },\n ],\n });\n language = response.language;\n }\n\n // Adapter selection — from flag or prompt\n let adapter = cliArgs.adapter;\n if (!adapter) {\n if (language === \"python\") {\n const response = await prompts({\n name: \"adapter\",\n type: \"select\",\n message: \"Which adapter would you like to use?\",\n choices: [\n { title: \"Pydantic AI\", value: \"pydantic-ai\" },\n { title: \"Claude Agent SDK\", value: \"claude-agent-sdk\" },\n ],\n });\n adapter = response.adapter;\n } else {\n const response = await prompts({\n name: \"adapter\",\n type: \"select\",\n message: \"Which adapter would you like to use?\",\n choices: [\n { title: \"AI SDK (Vercel)\", value: \"ai-sdk\" },\n { title: \"Claude Agent SDK\", value: \"claude-agent-sdk\" },\n { title: \"Mastra\", value: \"mastra\" },\n ],\n });\n adapter = response.adapter;\n }\n }\n\n // Validate adapter for the selected language\n const validAdapters = language === \"python\" ? VALID_ADAPTERS_PY : VALID_ADAPTERS_TS;\n if (!validAdapters.includes(adapter!)) {\n console.error(`Invalid adapter \"${adapter}\" for ${language}. Valid: ${validAdapters.join(\", \")}`);\n process.exit(1);\n }\n\n // API key — from flag or prompt\n let apiKey = cliArgs.apiKey ?? \"\";\n if (!cliArgs.apiKey && cliArgs.apiKey !== \"\") {\n const apiKeyName = adapter === 'claude-agent-sdk' ? 'Anthropic' : 'OpenAI';\n const { providedApiKey } = await prompts({\n name: \"providedApiKey\",\n type: \"password\",\n message: `Enter your ${apiKeyName} API key (or press Enter to skip):`,\n initial: \"\",\n });\n apiKey = providedApiKey || \"\";\n }\n\n // Deployment mode — from flag or prompt\n let deploymentMode = cliArgs.deploymentMode;\n if (!deploymentMode) {\n const response = await prompts({\n name: \"deploymentMode\",\n type: \"select\",\n message: \"Use AgentMark Cloud or manage yourself?\",\n choices: [\n {\n title: \"AgentMark Cloud (recommended)\",\n value: \"cloud\",\n description: \"Have AgentMark cloud manage prompts, datasets, traces, experiments, alerts & more\"\n },\n {\n title: \"Self-hosted\",\n value: \"static\",\n description: \"Self-manage your prompts, datasets, traces & experiments\"\n },\n ],\n });\n deploymentMode = response.deploymentMode;\n }\n\n // IDE client — from flag or prompt\n let client = cliArgs.client;\n if (!client) {\n const response = await prompts({\n name: \"client\",\n type: \"select\",\n message: \"Make your IDE an AgentMark expert\",\n choices: [\n { title: \"Claude Code\", value: \"claude-code\" },\n { title: \"Cursor\", value: \"cursor\" },\n { title: \"VS Code\", value: \"vscode\" },\n { title: \"Zed\", value: \"zed\" },\n { title: \"Skip\", value: \"skip\" },\n ],\n });\n client = response.client;\n }\n\n // Validate client\n if (!VALID_CLIENTS.includes(client!)) {\n console.error(`Invalid client \"${client}\". Valid: ${VALID_CLIENTS.join(\", \")}`);\n process.exit(1);\n }\n\n let usedModels: string[];\n if (language === \"python\") {\n usedModels = await createPythonApp(client!, targetPath, apiKey, deploymentMode, adapter!, projectInfo, resolutions);\n } else {\n usedModels = await createExampleApp(client!, targetPath, apiKey, adapter!, deploymentMode, projectInfo, resolutions);\n }\n config.builtInModels = usedModels;\n\n if (deploymentMode === \"cloud\") {\n config.handler = language === \"python\" ? \"handler.py\" : \"handler.ts\";\n }\n\n // Generate agentmark.json based on conflict resolution\n const agentmarkJsonPath = path.join(targetPath, \"agentmark.json\");\n const agentmarkJsonResolution = resolutions.find((r) => r.path === \"agentmark.json\");\n\n // Write agentmark.json if it doesn't exist or if user chose to overwrite\n if (!fs.existsSync(agentmarkJsonPath) || agentmarkJsonResolution?.action === \"overwrite\") {\n fs.writeJsonSync(agentmarkJsonPath, config, { spaces: 2 });\n } else if (agentmarkJsonResolution?.action === \"skip\") {\n console.log(\"⏭️ Skipped agentmark.json (keeping existing file)\");\n }\n\n // Initialize git repo after ALL files are written (including agentmark.json)\n if (!projectInfo.isExistingProject) {\n initGitRepo(targetPath);\n }\n};\n\nmain().catch((error) => {\n console.error(\"Error:\", error);\n process.exit(1);\n});\n","import fs from \"fs-extra\";\nimport * as path from \"path\";\nimport {\n setupPackageJson,\n installDependencies,\n getIndexFileContent,\n getTsConfigContent,\n getEnvFileContent,\n createExamplePrompts,\n getClientConfigContent,\n getAdapterConfig,\n} from \"./templates/index.js\";\nimport { fetchPromptsFrontmatter, generateTypeDefinitions } from \"@agentmark-ai/shared-utils\";\nimport { appendGitignore, appendEnv } from \"../file-merge.js\";\nimport { shouldMergeFile } from \"../conflict-resolution.js\";\nimport type { ProjectInfo, ConflictResolution } from \"../types.js\";\n\nconst setupMCPServer = (client: string, targetPath: string) => {\n if (client === \"skip\") {\n console.log(\"Skipping MCP server setup.\");\n return;\n }\n\n // Keep ./ prefix for display in messages\n const folderName = targetPath;\n\n // Handle VS Code\n if (client === \"vscode\") {\n try {\n console.log(`Setting up MCP server for VS Code in ${folderName}...`);\n const vscodeDir = path.join(targetPath, \".vscode\");\n fs.ensureDirSync(vscodeDir);\n\n const mcpConfig = {\n servers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n },\n \"agentmark-traces\": {\n command: \"npx\",\n args: [\"@agentmark-ai/mcp-server\"],\n env: {\n AGENTMARK_URL: \"http://localhost:9418\"\n }\n }\n }\n };\n\n fs.writeJsonSync(path.join(vscodeDir, \"mcp.json\"), mcpConfig, { spaces: 2 });\n console.log(`✅ MCP server configured for VS Code in ${folderName}/.vscode/mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for VS Code:`, error);\n console.log(\"See https://docs.agentmark.co/agentmark/further_reference/agentmark-mcp for setup instructions.\");\n }\n return;\n }\n\n // Handle Zed\n if (client === \"zed\") {\n try {\n console.log(`Setting up MCP server for Zed in ${folderName}...`);\n const zedDir = path.join(targetPath, \".zed\");\n fs.ensureDirSync(zedDir);\n\n const zedConfig = {\n context_servers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n },\n \"agentmark-traces\": {\n command: \"npx\",\n args: [\"@agentmark-ai/mcp-server\"],\n env: {\n AGENTMARK_URL: \"http://localhost:9418\"\n }\n }\n }\n };\n\n fs.writeJsonSync(path.join(zedDir, \"settings.json\"), zedConfig, { spaces: 2 });\n console.log(`✅ MCP server configured for Zed in ${folderName}/.zed/settings.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Zed:`, error);\n console.log(\"See https://docs.agentmark.co/agentmark/further_reference/agentmark-mcp for setup instructions.\");\n }\n return;\n }\n\n // Handle Cursor\n if (client === \"cursor\") {\n try {\n console.log(`Setting up MCP server for Cursor in ${folderName}...`);\n const cursorDir = path.join(targetPath, \".cursor\");\n fs.ensureDirSync(cursorDir);\n\n const cursorConfig = {\n mcpServers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n },\n \"agentmark-traces\": {\n command: \"npx\",\n args: [\"@agentmark-ai/mcp-server\"],\n env: {\n AGENTMARK_URL: \"http://localhost:9418\"\n }\n }\n }\n };\n\n fs.writeJsonSync(path.join(cursorDir, \"mcp.json\"), cursorConfig, { spaces: 2 });\n console.log(`✅ MCP server configured for Cursor in ${folderName}/.cursor/mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Cursor:`, error);\n console.log(\"See https://docs.agentmark.co/agentmark/further_reference/agentmark-mcp for setup instructions.\");\n }\n return;\n }\n\n // Handle Claude Code\n if (client === \"claude-code\") {\n try {\n console.log(`Setting up MCP server for Claude Code in ${folderName}...`);\n\n const mcpConfig = {\n mcpServers: {\n \"agentmark-docs\": {\n type: \"http\",\n url: \"https://docs.agentmark.co/mcp\"\n },\n \"agentmark-traces\": {\n command: \"npx\",\n args: [\"@agentmark-ai/mcp-server\"],\n env: {\n AGENTMARK_URL: \"http://localhost:9418\"\n }\n }\n }\n };\n\n fs.writeJsonSync(path.join(targetPath, \".mcp.json\"), mcpConfig, { spaces: 2 });\n console.log(`✅ MCP server configured for Claude Code in ${folderName}/.mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Claude Code:`, error);\n console.log(\"See https://docs.agentmark.co/agentmark/further_reference/agentmark-mcp for setup instructions.\");\n }\n return;\n }\n};\n\n\nexport const createExampleApp = async (\n client: string,\n targetPath: string = \".\",\n apiKey: string = \"\",\n adapter: string = \"ai-sdk\",\n deploymentMode: \"cloud\" | \"static\" = \"cloud\",\n projectInfo: ProjectInfo | null = null,\n resolutions: ConflictResolution[] = []\n): Promise<string[]> => {\n try {\n const modelProvider = adapter === 'claude-agent-sdk' ? 'anthropic' : 'openai';\n const model = adapter === 'claude-agent-sdk' ? 'anthropic/claude-sonnet-4-20250514' : 'openai/gpt-4o';\n const isExistingProject = projectInfo?.isExistingProject ?? false;\n\n if (isExistingProject) {\n console.log(\"Adding AgentMark to existing project...\");\n } else {\n console.log(\"Creating AgentMark example app...\");\n }\n\n // Keep ./ prefix for display in messages\n const folderName = targetPath;\n\n // Create directory structure\n fs.ensureDirSync(`${targetPath}/agentmark`);\n\n setupMCPServer(client, targetPath);\n\n // Create example prompts — returns the model IDs actually written\n const usedModels = createExamplePrompts(model, targetPath, adapter);\n console.log(`✅ Example prompts and datasets created in ${folderName}/agentmark/`);\n\n // Create user client config at project root\n // Prefer TS for dev ergonomics\n fs.writeFileSync(\n `${targetPath}/agentmark.client.ts`,\n getClientConfigContent({ provider: modelProvider, adapter, deploymentMode })\n );\n\n // Create or append to .gitignore FIRST so the `.env` rule is in place\n // before any secret values land on disk. `git init` runs at the very end\n // (see src/index.ts), so as long as .gitignore lists `.env` before .env\n // is written we're safe even if someone reshuffles steps later.\n // Note: .agentmark/ removed - dev-entry.ts is now at project root for version control\n const gitignoreEntries = ['node_modules/', '.env', '*.agentmark-outputs/', 'dist/'];\n if (shouldMergeFile('.gitignore', projectInfo, resolutions)) {\n const result = appendGitignore(targetPath, gitignoreEntries);\n if (result.added.length > 0) {\n console.log(`✅ Added to .gitignore: ${result.added.join(', ')}`);\n }\n if (result.skipped.length > 0) {\n console.log(`⏭️ Already in .gitignore: ${result.skipped.join(', ')}`);\n }\n } else {\n const gitignore = gitignoreEntries.join('\\n');\n fs.writeFileSync(`${targetPath}/.gitignore`, gitignore);\n }\n\n // Create or append to .env file (after .gitignore is in place)\n if (shouldMergeFile('.env', projectInfo, resolutions)) {\n const envVars: Record<string, string> = {};\n const apiKeyEnvVar = adapter === 'claude-agent-sdk' ? 'ANTHROPIC_API_KEY' : 'OPENAI_API_KEY';\n if (apiKey) {\n envVars[apiKeyEnvVar] = apiKey;\n } else {\n envVars[apiKeyEnvVar] = adapter === 'claude-agent-sdk' ? 'your-anthropic-api-key' : 'your-openai-api-key';\n }\n if (deploymentMode === 'cloud') {\n envVars['AGENTMARK_API_KEY'] = 'your_agentmark_api_key';\n envVars['AGENTMARK_APP_ID'] = 'your_agentmark_app_id';\n }\n const result = appendEnv(targetPath, envVars);\n if (result.added.length > 0) {\n console.log(`✅ Added to .env: ${result.added.join(', ')}`);\n }\n if (result.skipped.length > 0) {\n console.log(`⏭️ Skipped existing .env vars: ${result.skipped.join(', ')}`);\n }\n } else {\n fs.writeFileSync(`${targetPath}/.env`, getEnvFileContent(modelProvider, apiKey, adapter, deploymentMode));\n }\n\n // Create the main application file (skip for existing projects)\n if (!isExistingProject) {\n fs.writeFileSync(\n `${targetPath}/index.ts`,\n getIndexFileContent(adapter, deploymentMode)\n );\n } else {\n console.log(\"⏭️ Skipped index.ts (existing project)\");\n }\n\n // Create tsconfig.json (skip for existing projects)\n if (!isExistingProject) {\n fs.writeJsonSync(`${targetPath}/tsconfig.json`, getTsConfigContent(), { spaces: 2 });\n } else {\n console.log(\"⏭️ Skipped tsconfig.json (existing project)\");\n }\n\n // Setup package.json and install dependencies\n const packageManager = projectInfo?.packageManager ?? null;\n setupPackageJson(targetPath, deploymentMode, projectInfo);\n installDependencies(modelProvider, targetPath, adapter, deploymentMode, packageManager);\n\n // Generate types file using the type generation library\n console.log(\"Generating types from prompts...\");\n try {\n const agentmarkDir = path.join(targetPath, 'agentmark');\n const prompts = await fetchPromptsFrontmatter({ rootDir: agentmarkDir });\n const typeDefinitions = await generateTypeDefinitions(prompts);\n fs.writeFileSync(`${targetPath}/agentmark.types.ts`, typeDefinitions);\n } catch (error) {\n console.warn(\"Warning: Could not generate types automatically:\", error);\n console.log(\"You can generate types later by running: npx agentmark generate-types --root-dir agentmark\");\n // Create a placeholder types file\n fs.writeFileSync(`${targetPath}/agentmark.types.ts`, `// Auto-generated types from AgentMark\\n// Run 'npx agentmark generate-types --root-dir agentmark' to generate types\\nexport default interface AgentmarkTypes {}\\n`);\n }\n\n // Create handler.ts for cloud deployments (managed code execution)\n if (deploymentMode === \"cloud\") {\n const handlerAdapterConfig = getAdapterConfig(adapter, modelProvider);\n const { webhookHandler: handlerClass } = handlerAdapterConfig.classes;\n\n const handlerContent = `import { ${handlerClass} } from '${handlerAdapterConfig.package}/runner';\nimport { AgentMarkSDK } from '@agentmark-ai/sdk';\nimport { client } from './agentmark.client';\n\n// Initialize tracing — sends traces to AgentMark Cloud\nconst sdk = new AgentMarkSDK({\n apiKey: process.env.AGENTMARK_API_KEY ?? '',\n appId: process.env.AGENTMARK_APP_ID ?? '',\n baseUrl: process.env.AGENTMARK_BASE_URL,\n});\nsdk.initTracing({ disableBatch: true });\n\nconst adapter = new ${handlerClass}(client as any);\n\nexport default async function handler(request: {\n type: 'prompt-run' | 'dataset-run' | 'get-evals';\n data: {\n ast?: any;\n customProps?: Record<string, unknown>;\n options?: { shouldStream?: boolean };\n experimentId?: string;\n datasetPath?: string;\n };\n}) {\n if (request.type === 'get-evals') {\n return {\n type: 'evals',\n result: JSON.stringify(Object.keys(client.getEvalRegistry())),\n traceId: '',\n };\n }\n\n if (request.type === 'prompt-run') {\n return adapter.runPrompt(request.data.ast, {\n shouldStream: request.data.options?.shouldStream,\n customProps: request.data.customProps,\n });\n }\n\n if (request.type === 'dataset-run') {\n return adapter.runExperiment(\n request.data.ast,\n request.data.experimentId ?? '',\n request.data.datasetPath,\n );\n }\n\n throw new Error(\\`Unknown request type: \\${request.type}\\`);\n}\n`;\n\n const handlerPath = path.join(targetPath, 'handler.ts');\n if (fs.existsSync(handlerPath)) {\n console.log(\"⏭️ Skipped handler.ts (already exists - preserving customizations)\");\n } else {\n fs.writeFileSync(handlerPath, handlerContent);\n console.log(`✅ Created handler.ts for cloud deployment`);\n }\n }\n\n // Create dev-entry.ts at project root (version controlled)\n console.log(\"Creating development server entry point...\");\n\n // Get adapter-specific values from config\n const adapterConfig = getAdapterConfig(adapter, modelProvider);\n const { webhookHandler } = adapterConfig.classes;\n\n const devEntryPath = path.join(targetPath, 'dev-entry.ts');\n\n const devEntryContent = `// Development webhook server entry point\n// This file is version controlled - customize as needed for your project\n\nimport { createWebhookServer } from '@agentmark-ai/cli/runner-server';\nimport { ${webhookHandler} } from '${adapterConfig.package}/runner';\nimport { AgentMarkSDK } from '@agentmark-ai/sdk';\nimport path from 'path';\n\nasync function main() {\n const args = process.argv.slice(2);\n const webhookPortArg = args.find(arg => arg.startsWith('--webhook-port='));\n const apiServerPortArg = args.find(arg => arg.startsWith('--api-server-port='));\n\n const webhookPort = webhookPortArg ? parseInt(webhookPortArg.split('=')[1]) : 9417;\n const apiServerPort = apiServerPortArg ? parseInt(apiServerPortArg.split('=')[1]) : 9418;\n const apiServerUrl = \\`http://localhost:\\${apiServerPort}\\`;\n\n // Set environment for development mode before importing client\n process.env.NODE_ENV = 'development';\n process.env.AGENTMARK_BASE_URL = apiServerUrl;\n\n // Now import client - it will pick up the dev environment\n const { client } = await import('./agentmark.client.js');\n\n // Initialize OpenTelemetry tracing to export traces to the API server\n const sdk = new AgentMarkSDK({\n apiKey: '',\n appId: '',\n baseUrl: apiServerUrl,\n });\n sdk.initTracing({ disableBatch: true });\n\n const handler = new ${webhookHandler}(client as any);\n const templatesDirectory = path.join(process.cwd(), 'agentmark');\n\n await createWebhookServer({\n port: webhookPort,\n handler,\n apiServerUrl,\n templatesDirectory\n });\n}\n\nmain().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n`;\n\n // Only create dev-entry.ts if it doesn't exist (preserve existing customizations - FR-003)\n if (fs.existsSync(devEntryPath)) {\n console.log(\"⏭️ Skipped dev-entry.ts (already exists - preserving customizations)\");\n } else {\n fs.writeFileSync(devEntryPath, devEntryContent);\n console.log(`✅ Created dev-entry.ts at project root`);\n }\n\n // Success message\n console.log(\"\\n✅ Agentmark initialization completed successfully!\");\n\n console.log(\n `\n █████╗ ██████╗ ███████╗███╗ ██╗████████╗███╗ ███╗ █████╗ ██████╗ ██╗ ██╗\n██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝████╗ ████║██╔══██╗██╔══██╗██║ ██╔╝\n███████║██║ ███╗█████╗ ██╔██╗ ██║ ██║ ██╔████╔██║███████║██████╔╝█████╔╝\n██╔══██║██║ ██║██╔══╝ ██║╚██╗██║ ██║ ██║╚██╔╝██║██╔══██║██╔══██╗██╔═██╗\n██║ ██║╚██████╔╝███████╗██║ ╚████║ ██║ ██║ ╚═╝ ██║██║ ██║██║ ██║██║ ██╗\n╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝\n\n `\n );\n\n console.log('\\n' + '═'.repeat(70));\n console.log('Next Steps');\n console.log('═'.repeat(70));\n\n console.log('\\n Get Started:');\n if (folderName !== \".\" && folderName !== \"./\" && !isExistingProject) {\n console.log(` $ cd ${folderName}`);\n }\n console.log(` $ npx agentmark dev\\n`);\n\n console.log('─'.repeat(70));\n console.log('Resources');\n console.log('─'.repeat(70));\n console.log(' Documentation: https://docs.agentmark.co');\n console.log('═'.repeat(70) + '\\n');\n\n return usedModels;\n } catch (error) {\n console.error(\"Error creating example app:\", error);\n throw error;\n }\n};\n","export interface AdapterConfig {\n /** npm package name for the adapter */\n package: string;\n /** Additional npm packages required by this adapter */\n dependencies: string[];\n /** Class names used in generated code */\n classes: {\n modelRegistry: string;\n webhookHandler: string;\n };\n}\n\nexport const createAdapterConfig = (\n provider: string\n): Record<string, AdapterConfig> => {\n return {\n \"ai-sdk\": {\n package: \"@agentmark-ai/ai-sdk-v5-adapter\",\n dependencies: [\"ai@^5\", `@ai-sdk/${provider}@^2`],\n classes: {\n modelRegistry: \"VercelAIModelRegistry\",\n webhookHandler: \"VercelAdapterWebhookHandler\",\n },\n },\n mastra: {\n package: \"@agentmark-ai/mastra-v0-adapter\",\n dependencies: [\n \"@mastra/core@<0.20.0\",\n \"@mastra/mcp@<0.13.4\",\n `@ai-sdk/${provider}@<2`,\n \"ai@^4\",\n ],\n classes: {\n modelRegistry: \"MastraModelRegistry\",\n webhookHandler: \"MastraAdapterWebhookHandler\",\n },\n },\n \"claude-agent-sdk\": {\n package: \"@agentmark-ai/claude-agent-sdk-v0-adapter\",\n dependencies: [\"@anthropic-ai/claude-agent-sdk@^0.1.0\"],\n classes: {\n modelRegistry: \"ClaudeAgentModelRegistry\",\n webhookHandler: \"ClaudeAgentWebhookHandler\",\n },\n },\n };\n};\n\nexport function getAdapterConfig(\n adapter: string,\n provider: string\n): AdapterConfig {\n const config = createAdapterConfig(provider)[adapter];\n if (!config) {\n throw new Error(\n `Unknown adapter: ${adapter}. Available adapters: ${Object.keys(\n createAdapterConfig(provider)\n ).join(\", \")}`\n );\n }\n return config;\n}\n","export const getIndexFileContent = (adapter: string = \"ai-sdk\", deploymentMode: \"cloud\" | \"static\" = \"cloud\"): string => {\n const isCloud = deploymentMode === \"cloud\";\n\n const tracingImport = `import { AgentMarkSDK } from \"@agentmark-ai/sdk\";\n`;\n\n const cloudTracingInit = `\n// Initialize tracing - traces will be sent to AgentMark Cloud\n// To disable tracing, comment out sdk.initTracing() below\nconst sdk = new AgentMarkSDK({\n apiKey: process.env.AGENTMARK_API_KEY ?? \"\",\n appId: process.env.AGENTMARK_APP_ID ?? \"\",\n});\nsdk.initTracing({ disableBatch: true });\n`;\n\n const staticTracingInit = `\n// Initialize tracing - traces will be sent to local dev server\n// Make sure to run \"npx agentmark dev\" in another terminal first\n// To disable tracing, comment out sdk.initTracing() below\nconst sdk = new AgentMarkSDK({\n apiKey: \"\",\n appId: \"\",\n baseUrl: \"http://localhost:9418\",\n});\nsdk.initTracing({ disableBatch: true });\n`;\n\n const tracingInit = isCloud ? cloudTracingInit : staticTracingInit;\n\n if (adapter === \"claude-agent-sdk\") {\n return `import \"dotenv/config\";\nimport { query } from \"@anthropic-ai/claude-agent-sdk\";\nimport { withTracing } from \"@agentmark-ai/claude-agent-sdk-v0-adapter\";\n${tracingImport}import { client } from \"./agentmark.client\";\n${tracingInit}\nconst telemetry = {\n isEnabled: true,\n metadata: {\n trace_name: \"customer-support\",\n user_id: \"user-123\",\n session_id: \"session-123\",\n session_name: \"my-first-session\",\n },\n};\n\nconst runCustomerSupport = async (customer_message: string) => {\n const prompt = await client.loadTextPrompt(\"customer-support-agent\");\n const adapted = await prompt.format({\n props: {\n customer_question: customer_message,\n },\n telemetry,\n });\n\n // Execute with Claude Agent SDK using withTracing for telemetry\n // The adapted object contains { query, telemetry } ready for withTracing()\n const tracedResult = await withTracing(query, adapted);\n\n // traceId is available immediately\n console.log(\"Trace ID:\", tracedResult.traceId);\n\n let result = \"\";\n for await (const message of tracedResult) {\n if (message.type === \"result\" && message.subtype === \"success\") {\n result = message.result || \"\";\n }\n }\n\n return result;\n};\n\nconst main = async () => {\n try {\n const user_message = \"How long does shipping take?\";\n const assistant = await runCustomerSupport(user_message);\n console.log(\"Customer support response:\", assistant);\n } catch (error) {\n console.error(error);\n }\n};\n\nmain();\n`;\n } else if (adapter === \"mastra\") {\n return `import \"dotenv/config\";\nimport { Agent } from \"@mastra/core/agent\";\n${tracingImport}import { client } from \"./agentmark.client\";\n${tracingInit}\nconst telemetry = {\n isEnabled: true,\n metadata: {\n trace_name: \"customer-support\",\n user_id: \"user-123\",\n session_id: \"session-123\",\n session_name: \"my-first-session\",\n },\n};\n\nconst runCustomerSupport = async (customer_message: string) => {\n const prompt = await client.loadTextPrompt(\"customer-support-agent\");\n const agentConfig = await prompt.formatAgent({\n options: {\n telemetry,\n },\n });\n\n const [messages, generateOptions] = await agentConfig.formatMessages({\n props: {\n customer_question: customer_message,\n },\n });\n\n const agent = new Agent(agentConfig);\n const response = await agent.generate(messages, generateOptions);\n\n return (response as any).text || (response as any).content || String(response);\n};\n\nconst main = async () => {\n try {\n const user_message = \"How long does shipping take?\";\n const assistant = await runCustomerSupport(user_message);\n console.log(\"Customer support response:\", assistant);\n } catch (error) {\n console.error(error);\n }\n};\n\nmain();\n`;\n } else {\n return `import \"dotenv/config\";\nimport { generateText } from \"ai\";\n${tracingImport}import { client } from \"./agentmark.client\";\n${tracingInit}\nconst telemetry = {\n isEnabled: true,\n metadata: {\n trace_name: \"customer-support\",\n user_id: \"user-123\",\n session_id: \"session-123\",\n session_name: \"my-first-session\",\n },\n};\n\nconst runCustomerSupport = async (customer_message: string) => {\n const prompt = await client.loadTextPrompt(\"customer-support-agent\");\n const vercelInput = await prompt.format({\n props: {\n customer_question: customer_message,\n },\n telemetry,\n });\n\n const resp = await generateText(vercelInput);\n\n return resp.text;\n};\n\nconst main = async () => {\n try {\n const user_message = \"How long does shipping take?\";\n const assistant = await runCustomerSupport(user_message);\n console.log(\"Customer support response:\", assistant);\n } catch (error) {\n console.error(error);\n }\n};\n\nmain();\n`;\n }\n};\n","export const getEnvFileContent = (\n _modelProvider: string,\n apiKey: string = '',\n adapter: string = 'ai-sdk',\n deploymentMode: 'cloud' | 'static' = 'cloud'\n): string => {\n const apiKeyValue = apiKey || 'your_api_key_here';\n\n // Use ANTHROPIC_API_KEY for claude-agent-sdk adapter\n const apiKeyName = adapter === 'claude-agent-sdk' ? 'ANTHROPIC_API_KEY' : 'OPENAI_API_KEY';\n\n const cloudEnvVars = deploymentMode === 'cloud'\n ? `\n# AgentMark Cloud — required for managed deployments\nAGENTMARK_API_KEY=your_agentmark_api_key\nAGENTMARK_APP_ID=your_agentmark_app_id\n`\n : `\n# Cloud deployment: Set these environment variables\n# AGENTMARK_BASE_URL=https://api.agentmark.co\n# AGENTMARK_API_KEY=your_agentmark_api_key\n# AGENTMARK_APP_ID=your_agentmark_app_id\n`;\n\n return `${apiKeyName}=${apiKeyValue}\n${cloudEnvVars}\n# Learn more: https://docs.agentmark.co/getting-started/quickstart\n`;\n};\n","import fs from \"fs-extra\";\nimport { execSync } from \"child_process\";\nimport { getAdapterConfig } from \"./adapters.js\";\nimport { mergePackageJson } from \"../../file-merge.js\";\nimport { DEFAULT_PACKAGE_MANAGER } from \"../../types.js\";\nimport type { ProjectInfo, PackageManagerConfig } from \"../../types.js\";\n\nexport const setupPackageJson = (\n targetPath: string = \".\",\n deploymentMode: \"cloud\" | \"static\" = \"cloud\",\n projectInfo: ProjectInfo | null = null\n) => {\n const packageJsonPath = `${targetPath}/package.json`;\n const isExistingProject = projectInfo?.isExistingProject ?? false;\n\n if (!fs.existsSync(packageJsonPath)) {\n console.log(\"Creating package.json...\");\n execSync(\"npm init -y\", { cwd: targetPath });\n }\n\n // In static/self-hosted mode the demo runs index.ts which uses FileLoader\n // against ./dist/agentmark — those compiled prompts only exist after\n // `agentmark build`. Prefix the demo script so a fresh `npm run demo`\n // succeeds without users having to discover the build step manually.\n // Cloud mode hits the API directly, so no build is needed.\n const demoScript =\n deploymentMode === \"static\"\n ? \"npx agentmark build --out dist/agentmark && npx tsx index.ts\"\n : \"npx tsx index.ts\";\n\n // For existing projects, use merge logic\n if (isExistingProject && fs.existsSync(packageJsonPath)) {\n // Build scripts to add - with namespacing for conflicts\n const scriptsToAdd: Record<string, string> = {\n \"demo\": demoScript,\n \"agentmark\": \"agentmark\",\n };\n\n if (deploymentMode === \"static\") {\n scriptsToAdd[\"build\"] = \"agentmark build --out dist/agentmark\";\n }\n\n // Use mergePackageJson for existing projects\n const result = mergePackageJson(targetPath, {}, {}, scriptsToAdd);\n\n if (result.added.length > 0) {\n console.log(`✅ Added to package.json: ${result.added.join(', ')}`);\n }\n if (result.skipped.length > 0) {\n console.log(`⏭️ Skipped existing in package.json: ${result.skipped.join(', ')}`);\n }\n if (result.warnings.length > 0) {\n result.warnings.forEach((w) => console.log(`⚠️ ${w}`));\n }\n } else {\n // Update the created package.json with additional information\n const pkgJson = fs.readJsonSync(packageJsonPath);\n pkgJson.name =\n pkgJson.name === \"test\" || !pkgJson.name\n ? \"agentmark-example-app\"\n : pkgJson.name;\n pkgJson.description =\n pkgJson.description || \"A simple Node.js app using the Agentmark SDK\";\n\n // `npm init -y` writes \"type\": \"commonjs\". With tsconfig set to NodeNext,\n // dev-entry.ts uses `await import('./agentmark.client.js')` (NodeNext\n // requires the .js extension). Plain node would fail to resolve the .js\n // path because no compiled .js exists alongside the .ts. Drop the field\n // so node falls back to its default CJS interpretation, and let tsx\n // (which the dev/demo scripts use) do extension resolution.\n if (pkgJson.type === \"commonjs\") {\n delete pkgJson.type;\n }\n\n // Base scripts for all modes\n const scripts: Record<string, string> = {\n ...pkgJson.scripts,\n \"demo\": demoScript,\n \"agentmark\": \"agentmark\",\n };\n\n // For static/self-hosted mode, add the build script\n if (deploymentMode === \"static\") {\n scripts[\"build\"] = \"agentmark build --out dist/agentmark\";\n }\n\n pkgJson.scripts = scripts;\n\n fs.writeJsonSync(packageJsonPath, pkgJson, { spaces: 2 });\n }\n};\n\nexport const installDependencies = (\n modelProvider: string,\n targetPath: string = \".\",\n adapter: string = \"ai-sdk\",\n deploymentMode: \"cloud\" | \"static\" = \"cloud\",\n packageManager: PackageManagerConfig | null = null\n) => {\n console.log(\"Installing required packages...\");\n console.log(\"This might take a moment...\");\n\n const adapterConfig = getAdapterConfig(adapter, modelProvider);\n\n // Use detected package manager or default to npm\n const pm = packageManager || DEFAULT_PACKAGE_MANAGER;\n\n // npm needs --legacy-peer-deps due to some transitive dependency conflicts\n const npmSuffix = pm.name === 'npm' ? ' --legacy-peer-deps' : '';\n\n try {\n // Dev dependencies to install\n const devDeps = ['typescript', 'ts-node', '@types/node', '@agentmark-ai/cli'];\n\n // Install dev dependencies using detected package manager config\n const devDepsCmd = `${pm.addDevCmd} ${devDeps.join(' ')}${npmSuffix}`;\n\n console.log(`Using ${pm.name} to install dependencies...`);\n\n execSync(devDepsCmd, {\n stdio: \"inherit\",\n cwd: targetPath,\n });\n\n // Install the common packages\n // SDK is required for both local (connects to agentmark serve) and cloud (connects to API)\n // Loader packages are imported directly - ApiLoader always needed, FileLoader only for static mode\n const loaderPackages = deploymentMode === \"static\"\n ? [\"@agentmark-ai/loader-api\", \"@agentmark-ai/loader-file\"]\n : [\"@agentmark-ai/loader-api\"];\n\n const deps = [\n \"dotenv\",\n \"@agentmark-ai/prompt-core\",\n \"@agentmark-ai/sdk\",\n adapterConfig.package,\n ...loaderPackages,\n ...adapterConfig.dependencies,\n ];\n\n // Install regular dependencies using detected package manager config\n const depsCmd = `${pm.addCmd} ${deps.join(' ')}${npmSuffix}`;\n\n execSync(depsCmd, { stdio: \"inherit\", cwd: targetPath });\n\n console.log(\"Packages installed successfully!\");\n } catch (error) {\n console.error(\"Error installing packages:\", error);\n throw new Error(\n \"Failed to install required packages. Please check your network connection and try again.\"\n );\n }\n};\n","/**\n * File merge utilities for handling existing files during initialization.\n * Supports merging package.json, appending to .gitignore and .env files.\n */\n\nimport fs from 'fs-extra';\nimport path from 'path';\nimport type { MergeResult } from './types.js';\n\n/**\n * Merge AgentMark dependencies and scripts into an existing package.json.\n * Preserves all existing content, only adds missing AgentMark entries.\n */\nexport function mergePackageJson(\n targetPath: string,\n agentmarkDeps: Record<string, string>,\n agentmarkDevDeps: Record<string, string>,\n agentmarkScripts: Record<string, string>\n): MergeResult {\n const packageJsonPath = path.join(targetPath, 'package.json');\n const result: MergeResult = {\n success: false,\n warnings: [],\n added: [],\n skipped: [],\n };\n\n try {\n // Read existing package.json\n if (!fs.existsSync(packageJsonPath)) {\n result.warnings.push('No existing package.json found');\n return result;\n }\n\n const existing = fs.readJsonSync(packageJsonPath) as Record<string, unknown>;\n\n // Initialize sections if they don't exist\n if (!existing.dependencies) {\n existing.dependencies = {};\n }\n if (!existing.devDependencies) {\n existing.devDependencies = {};\n }\n if (!existing.scripts) {\n existing.scripts = {};\n }\n\n const deps = existing.dependencies as Record<string, string>;\n const devDeps = existing.devDependencies as Record<string, string>;\n const scripts = existing.scripts as Record<string, string>;\n\n // Add AgentMark dependencies (only if not already present)\n for (const [pkg, version] of Object.entries(agentmarkDeps)) {\n if (deps[pkg]) {\n result.skipped.push(`dependency: ${pkg} (already exists)`);\n } else {\n deps[pkg] = version;\n result.added.push(`dependency: ${pkg}@${version}`);\n }\n }\n\n // Add AgentMark devDependencies (only if not already present)\n for (const [pkg, version] of Object.entries(agentmarkDevDeps)) {\n if (devDeps[pkg]) {\n result.skipped.push(`devDependency: ${pkg} (already exists)`);\n } else {\n devDeps[pkg] = version;\n result.added.push(`devDependency: ${pkg}@${version}`);\n }\n }\n\n // Add AgentMark scripts (use namespace if conflict exists)\n for (const [scriptName, scriptCmd] of Object.entries(agentmarkScripts)) {\n if (scripts[scriptName]) {\n // Conflict - use namespaced script name\n const namespacedName = `agentmark:${scriptName}`;\n if (scripts[namespacedName]) {\n // Both the original and namespaced version exist - skip with warning\n result.skipped.push(`script: ${scriptName}`);\n result.warnings.push(\n `Script \"${scriptName}\" and \"${namespacedName}\" both already exist. Skipping.`\n );\n } else {\n scripts[namespacedName] = scriptCmd;\n result.added.push(`script: ${namespacedName} (namespaced due to conflict)`);\n result.warnings.push(\n `Script \"${scriptName}\" already exists. Added as \"${namespacedName}\" instead.`\n );\n }\n } else {\n scripts[scriptName] = scriptCmd;\n result.added.push(`script: ${scriptName}`);\n }\n }\n\n // Write merged package.json\n fs.writeJsonSync(packageJsonPath, existing, { spaces: 2 });\n\n result.success = true;\n result.content = JSON.stringify(existing, null, 2);\n return result;\n } catch (error) {\n result.warnings.push(`Error merging package.json: ${error}`);\n return result;\n }\n}\n\n/**\n * Append AgentMark entries to an existing .gitignore file.\n * Checks for duplicates before adding.\n */\nexport function appendGitignore(targetPath: string, entries: string[]): MergeResult {\n const gitignorePath = path.join(targetPath, '.gitignore');\n const result: MergeResult = {\n success: false,\n warnings: [],\n added: [],\n skipped: [],\n };\n\n try {\n let existingContent = '';\n\n if (fs.existsSync(gitignorePath)) {\n existingContent = fs.readFileSync(gitignorePath, 'utf-8');\n }\n\n // Parse existing entries (normalize trailing slashes)\n const existingEntries = new Set(\n existingContent\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line && !line.startsWith('#'))\n .map((line) => line.replace(/\\/$/, '')) // Remove trailing slashes for comparison\n );\n\n const entriesToAdd: string[] = [];\n\n for (const entry of entries) {\n const normalizedEntry = entry.replace(/\\/$/, '');\n if (existingEntries.has(normalizedEntry)) {\n result.skipped.push(entry);\n } else {\n entriesToAdd.push(entry);\n result.added.push(entry);\n }\n }\n\n if (entriesToAdd.length > 0) {\n // Add a header comment and the new entries\n let newContent = existingContent;\n\n // Ensure file ends with newline\n if (newContent && !newContent.endsWith('\\n')) {\n newContent += '\\n';\n }\n\n // Add blank line if file has content\n if (newContent.trim()) {\n newContent += '\\n';\n }\n\n newContent += '# AgentMark\\n';\n newContent += entriesToAdd.join('\\n');\n newContent += '\\n';\n\n fs.writeFileSync(gitignorePath, newContent);\n result.content = newContent;\n }\n\n result.success = true;\n return result;\n } catch (error) {\n result.warnings.push(`Error appending to .gitignore: ${error}`);\n return result;\n }\n}\n\n/**\n * Append AgentMark environment variables to an existing .env file.\n * Does not overwrite existing keys.\n */\nexport function appendEnv(\n targetPath: string,\n envVars: Record<string, string>\n): MergeResult {\n const envPath = path.join(targetPath, '.env');\n const result: MergeResult = {\n success: false,\n warnings: [],\n added: [],\n skipped: [],\n };\n\n try {\n let existingContent = '';\n\n if (fs.existsSync(envPath)) {\n existingContent = fs.readFileSync(envPath, 'utf-8');\n }\n\n // Parse existing keys\n const existingKeys = new Set<string>();\n const lines = existingContent.split('\\n');\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed && !trimmed.startsWith('#')) {\n const match = trimmed.match(/^([^=]+)=/);\n if (match && match[1]) {\n existingKeys.add(match[1]);\n }\n }\n }\n\n const varsToAdd: Array<[string, string]> = [];\n\n for (const [key, value] of Object.entries(envVars)) {\n if (existingKeys.has(key)) {\n result.skipped.push(key);\n } else {\n varsToAdd.push([key, value]);\n result.added.push(key);\n }\n }\n\n if (varsToAdd.length > 0) {\n let newContent = existingContent;\n\n // Ensure file ends with newline\n if (newContent && !newContent.endsWith('\\n')) {\n newContent += '\\n';\n }\n\n // Add blank line if file has content\n if (newContent.trim()) {\n newContent += '\\n';\n }\n\n newContent += '# AgentMark\\n';\n for (const [key, value] of varsToAdd) {\n newContent += `${key}=${value}\\n`;\n }\n\n fs.writeFileSync(envPath, newContent);\n result.content = newContent;\n }\n\n result.success = true;\n return result;\n } catch (error) {\n result.warnings.push(`Error appending to .env: ${error}`);\n return result;\n }\n}\n\n/**\n * Check if a file should be skipped based on existing project detection.\n * Used for files like index.ts that should never be generated in existing projects.\n */\nexport function shouldSkipFile(\n fileName: string,\n isExistingProject: boolean,\n skipFiles: string[]\n): boolean {\n if (!isExistingProject) {\n return false;\n }\n return skipFiles.includes(fileName);\n}\n","/**\n * Type definitions for existing repository initialization.\n * These types support project detection, conflict resolution, and package manager handling.\n */\n\n/** Supported package managers for TypeScript projects */\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\n/** Configuration for a specific package manager */\nexport interface PackageManagerConfig {\n /** Package manager name */\n name: PackageManager;\n /** Lock file that indicates this package manager is in use */\n lockFile: string;\n /** Command to install all dependencies */\n installCmd: string;\n /** Command to add a production dependency */\n addCmd: string;\n /** Command to add a dev dependency */\n addDevCmd: string;\n /** Command prefix for running scripts (e.g., 'npm run', 'yarn') */\n runCmd: string;\n}\n\n/** Package manager configurations indexed by lock file name */\nexport const PACKAGE_MANAGERS: Record<string, PackageManagerConfig> = {\n 'yarn.lock': {\n name: 'yarn',\n lockFile: 'yarn.lock',\n installCmd: 'yarn install',\n addCmd: 'yarn add',\n addDevCmd: 'yarn add --dev',\n runCmd: 'yarn',\n },\n 'pnpm-lock.yaml': {\n name: 'pnpm',\n lockFile: 'pnpm-lock.yaml',\n installCmd: 'pnpm install',\n addCmd: 'pnpm add',\n addDevCmd: 'pnpm add --save-dev',\n runCmd: 'pnpm',\n },\n 'bun.lockb': {\n name: 'bun',\n lockFile: 'bun.lockb',\n installCmd: 'bun install',\n addCmd: 'bun add',\n addDevCmd: 'bun add --dev',\n runCmd: 'bun run',\n },\n 'package-lock.json': {\n name: 'npm',\n lockFile: 'package-lock.json',\n installCmd: 'npm install',\n addCmd: 'npm install',\n addDevCmd: 'npm install --save-dev',\n runCmd: 'npm run',\n },\n};\n\n/** Default package manager when no lock file is found */\nexport const DEFAULT_PACKAGE_MANAGER: PackageManagerConfig = PACKAGE_MANAGERS['package-lock.json']!;\n\n/** Information about a detected Python virtual environment */\nexport interface PythonVenvInfo {\n /** Absolute path to the venv directory */\n path: string;\n /** Relative name (e.g., '.venv' or 'venv') */\n name: string;\n /** Platform-specific activate command */\n activateCmd: string;\n /** Platform-specific pip path */\n pipPath: string;\n}\n\n/** Type of file for determining merge strategy */\nexport type FileType = 'config' | 'source' | 'directory' | 'dotfile';\n\n/** Resolution strategy for a conflicting file */\nexport type ConflictStrategy = 'merge' | 'append' | 'prompt' | 'skip';\n\n/** Represents a file that may conflict with AgentMark initialization */\nexport interface ConflictFile {\n /** Relative path from project root */\n path: string;\n /** Type of file for determining merge strategy */\n type: FileType;\n /** Recommended resolution strategy */\n strategy: ConflictStrategy;\n}\n\n/** Files that may conflict with AgentMark initialization */\nexport const CONFLICT_FILES: ConflictFile[] = [\n { path: 'agentmark.json', type: 'config', strategy: 'prompt' },\n { path: 'agentmark', type: 'directory', strategy: 'prompt' },\n { path: 'agentmark.client.ts', type: 'source', strategy: 'prompt' },\n { path: 'agentmark_client.py', type: 'source', strategy: 'prompt' },\n { path: '.gitignore', type: 'dotfile', strategy: 'append' },\n { path: '.env', type: 'dotfile', strategy: 'append' },\n { path: 'package.json', type: 'config', strategy: 'merge' },\n { path: 'index.ts', type: 'source', strategy: 'skip' },\n { path: 'main.py', type: 'source', strategy: 'skip' },\n { path: 'tsconfig.json', type: 'config', strategy: 'skip' },\n { path: 'pyproject.toml', type: 'config', strategy: 'skip' },\n];\n\n/** User's resolution choice for a conflict */\nexport type ConflictAction = 'skip' | 'overwrite' | 'merge';\n\n/** A conflict resolution decision from the user */\nexport interface ConflictResolution {\n /** Path to the conflicting file */\n path: string;\n /** Action chosen by the user */\n action: ConflictAction;\n}\n\n/** Detected information about an existing project */\nexport interface ProjectInfo {\n /** Whether any project indicators were found */\n isExistingProject: boolean;\n /** Detected project type */\n type: 'typescript' | 'python' | 'unknown';\n /** Detected package manager (for TypeScript projects) */\n packageManager: PackageManagerConfig;\n /** Files that exist and may conflict */\n conflictingFiles: ConflictFile[];\n /** Whether the agentmark/ directory already exists */\n hasAgentmarkDir: boolean;\n /** Whether an existing Python venv was detected */\n pythonVenv: PythonVenvInfo | null;\n}\n\n/** Result of a file merge operation */\nexport interface MergeResult {\n /** Whether the merge was successful */\n success: boolean;\n /** The merged content (if applicable) */\n content?: string;\n /** Any warnings generated during merge */\n warnings: string[];\n /** What was added (for user feedback) */\n added: string[];\n /** What was skipped (already present) */\n skipped: string[];\n}\n\n/** Extended options for initialization in existing projects */\nexport interface InitOptions {\n /** Target directory path */\n targetPath: string;\n /** Selected language */\n language: 'typescript' | 'python';\n /** Selected adapter (TypeScript only) */\n adapter?: string;\n /** Deployment mode */\n deploymentMode: 'cloud' | 'static';\n /** API key (if provided) */\n apiKey?: string;\n /** IDE client for MCP setup */\n client: string;\n /** Detected project info (null if new project) */\n projectInfo: ProjectInfo | null;\n /** User's conflict resolutions */\n conflictResolutions: ConflictResolution[];\n}\n","export const getTsConfigContent = (): object => {\n return {\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"NodeNext\",\n \"moduleResolution\": \"NodeNext\",\n \"esModuleInterop\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"skipLibCheck\": true\n }\n };\n}; ","export const getAnimalDrawingPrompt = (): string => {\n return `---\nname: animal-drawing\nimage_config:\n model_name: openai/dall-e-3\n num_images: 1\n size: 1024x1024\n aspect_ratio: 1:1\ntest_settings:\n dataset: animal.jsonl\n props:\n animal: \"cat\"\n---\n\n<ImagePrompt>\nDraw a hyper-realistic picture of a {props.animal}\n</ImagePrompt>`;\n};","export const getCustomerSupportPrompt = (model: string): string => {\n return `---\nname: customer-support-agent\ntext_config:\n model_name: ${model}\n max_calls: 2\n tools:\n - search_knowledgebase\ntest_settings:\n dataset: customer-query.jsonl\n props:\n customer_question: \"I'm having trouble with my order. How long does shipping take?\"\ninput_schema:\n type: object\n properties:\n customer_question:\n type: string\n description: \"The customer's question\"\n required:\n - customer_question\n---\n\n<System>\nYou are a customer service agent for a company that sells products online. You are given a customer's question and you need to respond to the customer. You need to be friendly, professional, and helpful.\n\nYou have access to the following tool:\n- search_knowledgebase: Search the company knowledgebase for information about shipping, warranty, and returns. Use this when customers ask about these topics.\n</System>\n\n<User>{props.customer_question}</User>`;\n};","export const getPartyPlannerPrompt = (model: string): string => {\n return `---\nname: party-planner\nobject_config:\n model_name: ${model}\n schema:\n type: object\n properties:\n names:\n type: array\n description: \"List of names of people attending the party.\"\n items:\n type: string\n required:\n - names\ntest_settings:\n dataset: party.jsonl\n evals:\n - exact_match_json\n props:\n party_text: \"We're having a party with Alice, Bob, and Carol.\"\ninput_schema:\n type: object\n properties:\n party_text:\n type: string\n description: \"A block of text describing the upcoming party and attendees.\"\n required:\n - party_text\n---\n\n<System>\nExtract the names of all people attending the party from the following text. Respond with a list of names only.\n</System>\n\n<User>\nText: {props.party_text}\n</User>`;\n};","export const getStoryTellerPrompt = (): string => {\n return `---\nname: story-teller\nspeech_config:\n model_name: openai/tts-1-hd\n voice: \"nova\"\n speed: 1.0\n output_format: \"mp3\"\ntest_settings:\n dataset: story.jsonl\n props:\n story: \"Once upon a time, there was a cat who loved to play with a ball.\"\n---\n\n<System>\nYou are a storyteller for children. Make sure your story is engaging and interesting.\n</System>\n\n<SpeechPrompt>\n- {props.story}\n</SpeechPrompt>`;\n};","export const getAnimalDataset = (): string => {\n return `{\"input\": {\"animal\": \"cat\"}, \"expected_output\": \"A realistic picture of a cat\"}\n{\"input\": {\"animal\": \"dog\"}, \"expected_output\": \"A realistic picture of a dog\"}\n{\"input\": {\"animal\": \"bird\"}, \"expected_output\": \"A realistic picture of a bird\"}`;\n};\n\nexport const getCustomerQueryDataset = (): string => {\n return `{\"input\": {\"customer_question\": \"My package hasn't arrived yet. Can you help me track it?\"}}\n{\"input\": {\"customer_question\": \"I received the wrong item in my order. What should I do?\"}}\n{\"input\": {\"customer_question\": \"How do I return a product that I purchased last week?\"}}`;\n};\n\nexport const getPartyDataset = (): string => {\n return `{\"input\": {\"party_text\": \"We're having a party with Alice, Bob, and Carol.\"}, \"expected_output\": \"{\\\\\"names\\\\\": [\\\\\"Alice\\\\\", \\\\\"Bob\\\\\", \\\\\"Carol\\\\\"]}\"}\n{\"input\": {\"party_text\": \"The guest list includes Dave, Emma, and Frank.\"}, \"expected_output\": \"{\\\\\"names\\\\\": [\\\\\"Dave\\\\\", \\\\\"Emma\\\\\", \\\\\"Frank\\\\\"]}\"}\n{\"input\": {\"party_text\": \"Join us for a celebration with Grace, Henry, and Isla.\"}, \"expected_output\": \"{\\\\\"names\\\\\": [\\\\\"Grace\\\\\", \\\\\"Henry\\\\\", \\\\\"Isla\\\\\"]}\"}`;\n};\n\nexport const getStoryDataset = (): string => {\n return `{\"input\": {\"story\": \"Once upon a time, the Moon woke up and found her glow missing! She floated around the sky asking stars, clouds, and even comets if they'd seen her light. It wasn't until she peeked into a mountain lake that she saw her glow shining back—hidden in her own reflection! Laughing, she realized she had never lost it—it was with her all along, just hiding beneath a cloudy sky.\"}}\n{\"input\": {\"story\": \"Benny was no ordinary banana—he dreamed of becoming a superhero. One day, when a monkey slipped in the jungle and cried for help, Benny rolled into action, dodging vines and swinging from branches using his peel like a lasso. The monkey was saved, and from that day on, Benny was known as \\\\\"The Peel of Justice,\\\\\" the bravest fruit in the whole rainforest.\"}}\n{\"input\": {\"story\": \"In the town of Maplebrook, there was a library that whispered stories when no one was looking. Curious little Nia tiptoed in one rainy day and heard the books giggling softly. She opened one called The Secret Tunnel, and to her surprise, it sucked her in! She found herself riding a dragon through glittering caves. When she returned, the book winked shut—waiting for its next reader to listen.\"}}`;\n};","import fs from 'fs-extra';\nimport { getAnimalDrawingPrompt } from './animal-drawing-prompt.js';\nimport { getCustomerSupportPrompt } from './customer-support-prompt.js';\nimport { getPartyPlannerPrompt } from './party-planner-prompt.js';\nimport { getStoryTellerPrompt } from './story-teller-prompt.js';\nimport { getAnimalDataset, getCustomerQueryDataset, getPartyDataset, getStoryDataset } from './datasets.js';\n\n/**\n * Creates example prompt files and returns the list of model IDs they use.\n * The returned array is the authoritative source for `builtInModels` in agentmark.json —\n * it reflects exactly which models were written, so the two can never drift apart.\n */\nexport const createExamplePrompts = (model: string, targetPath: string = \".\", adapter: string = \"ai-sdk\"): string[] => {\n // Ensure the templates directory exists\n fs.ensureDirSync(`${targetPath}/agentmark`);\n\n const noImageSupport = [\"mastra\", \"claude-agent-sdk\", \"pydantic-ai\"];\n const noSpeechSupport = [\"mastra\", \"claude-agent-sdk\", \"pydantic-ai\"];\n const skipImagePrompts = noImageSupport.includes(adapter);\n const skipSpeechPrompts = noSpeechSupport.includes(adapter);\n\n const usedModels: string[] = [];\n\n // Create animal drawing prompt and dataset (uses image_config - skip for unsupported adapters)\n if (!skipImagePrompts) {\n const animalDrawingPrompt = getAnimalDrawingPrompt();\n fs.writeFileSync(`${targetPath}/agentmark/animal-drawing.prompt.mdx`, animalDrawingPrompt);\n const animalDataset = getAnimalDataset();\n fs.writeFileSync(`${targetPath}/agentmark/animal.jsonl`, animalDataset);\n usedModels.push('openai/dall-e-3');\n }\n\n // Create customer support prompt and dataset\n const customerSupportPrompt = getCustomerSupportPrompt(model);\n fs.writeFileSync(`${targetPath}/agentmark/customer-support-agent.prompt.mdx`, customerSupportPrompt);\n const customerQueryDataset = getCustomerQueryDataset();\n fs.writeFileSync(`${targetPath}/agentmark/customer-query.jsonl`, customerQueryDataset);\n usedModels.push(model);\n\n // Create party planner prompt and dataset\n const partyPlannerPrompt = getPartyPlannerPrompt(model);\n fs.writeFileSync(`${targetPath}/agentmark/party-planner.prompt.mdx`, partyPlannerPrompt);\n const partyDataset = getPartyDataset();\n fs.writeFileSync(`${targetPath}/agentmark/party.jsonl`, partyDataset);\n\n // Create story teller prompt and dataset (uses speech_config - skip for unsupported adapters)\n if (!skipSpeechPrompts) {\n const storyTellerPrompt = getStoryTellerPrompt();\n fs.writeFileSync(`${targetPath}/agentmark/story-teller.prompt.mdx`, storyTellerPrompt);\n const storyDataset = getStoryDataset();\n fs.writeFileSync(`${targetPath}/agentmark/story.jsonl`, storyDataset);\n usedModels.push('openai/tts-1-hd');\n }\n\n // Deduplicate in case the language model appears under multiple prompts\n return [...new Set(usedModels)];\n};","import { getAdapterConfig } from \"./adapters.js\";\n\nexport const getClientConfigContent = (options: { provider: string; adapter: string; deploymentMode?: \"cloud\" | \"static\" }) => {\n const { provider, adapter, deploymentMode = \"cloud\" } = options;\n const isMastra = adapter === \"mastra\";\n const adapterConfig = getAdapterConfig(adapter, provider);\n const { modelRegistry } = adapterConfig.classes;\n\n // Claude Agent SDK doesn't use @ai-sdk provider imports\n const isClaudeAgentSdk = adapter === \"claude-agent-sdk\";\n const providerImport = isClaudeAgentSdk ? '' : `import { ${provider} } from '@ai-sdk/${provider}';`;\n\n // Import loaders from dedicated packages\n const loaderImport = deploymentMode === \"cloud\"\n ? `import { ApiLoader } from \"@agentmark-ai/loader-api\";`\n : `import { ApiLoader } from \"@agentmark-ai/loader-api\";\nimport { FileLoader } from \"@agentmark-ai/loader-file\";`;\n\n const loaderSetup = deploymentMode === \"cloud\"\n ? ` // ApiLoader works for both development and production\n // - Development: 'agentmark dev' sets AGENTMARK_BASE_URL to localhost\n // - Production: Set AGENTMARK_API_KEY and AGENTMARK_APP_ID for cloud.\n // AGENTMARK_BASE_URL overrides the default https://api.agentmark.co\n // target — managed deployments use this to point back at the gateway\n // that dispatched the job.\n const loader = process.env.NODE_ENV === 'development'\n ? ApiLoader.local({ baseUrl: process.env.AGENTMARK_BASE_URL || 'http://localhost:9418' })\n : ApiLoader.cloud({\n apiKey: process.env.AGENTMARK_API_KEY!,\n appId: process.env.AGENTMARK_APP_ID!,\n baseUrl: process.env.AGENTMARK_BASE_URL,\n });`\n : ` const loader = process.env.NODE_ENV === 'development'\n ? ApiLoader.local({ baseUrl: process.env.AGENTMARK_BASE_URL || 'http://localhost:9418' })\n : new FileLoader('./dist/agentmark');`;\n\n // Claude Agent SDK model registry setup is different\n const modelRegistrySetup = isClaudeAgentSdk\n ? `function createModelRegistry() {\n // Claude Agent SDK accepts model names directly.\n // Use createDefault() for simple pass-through of model names.\n const modelRegistry = ${modelRegistry}.createDefault();\n\n // To configure specific models (e.g., extended thinking), use:\n // const modelRegistry = new ${modelRegistry}()\n // .registerModels(/claude-.*-thinking/, (name) => ({\n // model: name,\n // maxThinkingTokens: 10000, // Enable extended thinking\n // }))\n // .registerModels(\"claude-sonnet-4-20250514\", (name) => ({ model: name }));\n\n return modelRegistry;\n}`\n : `function createModelRegistry() {\n const modelRegistry = new ${modelRegistry}()\n .registerProviders({ ${provider} });\n return modelRegistry;\n}`;\n\n // Claude Agent SDK adapter options\n const adapterOptionsImport = isClaudeAgentSdk\n ? `\n// Claude Agent SDK adapter options\n// See: https://github.com/anthropics/claude-agent-sdk\nconst adapterOptions = {\n // Permission mode controls tool access:\n // - 'default': Requires user approval for each tool use\n // - 'acceptEdits': Auto-approve file edits only\n // - 'bypassPermissions': Auto-approve all tools (use for automated pipelines)\n // - 'plan': Planning mode only, no tool execution\n permissionMode: 'bypassPermissions' as const,\n\n // Maximum conversation turns before stopping\n maxTurns: 20,\n\n // Optional: Set working directory for file operations\n // cwd: process.cwd(),\n\n // Optional: Budget limit in USD\n // maxBudgetUsd: 10.00,\n\n // Optional: Restrict which tools the agent can use\n // allowedTools: ['Read', 'Write', 'Glob'],\n // disallowedTools: ['Bash'],\n};`\n : '';\n\n // Tool import: each adapter imports tools differently\n const toolImport = isClaudeAgentSdk\n ? `import { tool, createSdkMcpServer } from \"@anthropic-ai/claude-agent-sdk\";\nimport { z } from 'zod';`\n : isMastra\n ? `import { tool } from 'ai';\nimport type { ToolsInput } from '@mastra/core/agent';\nimport { z } from 'zod';`\n : `import { tool } from 'ai';\nimport type { Tool } from 'ai';\nimport { z } from 'zod';`;\n\n const createClientCall = isClaudeAgentSdk\n ? `return createAgentMarkClient<AgentMarkTypes>({ loader, modelRegistry, evals, adapterOptions, mcpServers: { 'customer-support': customerSupportTools } });`\n : `return createAgentMarkClient<AgentMarkTypes>({ loader, modelRegistry, tools, evals });`;\n\n // AI SDK v5 uses inputSchema (Zod), Mastra uses parameters (Zod via ai v4 tool helper)\n const toolSchemaField = isMastra\n ? `parameters: z.object({ query: z.string().describe('The search query') })`\n : `inputSchema: z.object({ query: z.string().describe('The search query') })`;\n\n const toolsReturnType = isMastra ? 'ToolsInput' : 'Record<string, Tool>';\n\n const toolsSetup = isClaudeAgentSdk\n ? `\n// Custom tools exposed as an MCP server — the SDK's native tool mechanism.\n// The server name is used in mcpServers config; tool names are used in prompt files.\nconst knowledgeBase = tool(\n 'search_knowledgebase',\n 'Search the knowledge base for relevant articles',\n { query: z.string().describe('The search query') },\n async ({ query }) => ({\n content: [{ type: 'text' as const, text: JSON.stringify({\n articles: [\n { topic: 'shipping', content: 'Standard shipping takes 3–5 business days.' },\n { topic: 'warranty', content: 'All products include a 1-year limited warranty.' },\n { topic: 'returns', content: 'You can return items within 30 days of delivery.' },\n ],\n }) }],\n })\n);\n\nconst customerSupportTools = createSdkMcpServer({\n name: 'customer-support',\n tools: [knowledgeBase],\n});`\n : `\nfunction createTools(): ${toolsReturnType} {\n return {\n search_knowledgebase: tool({\n description: 'Search the knowledge base for relevant articles',\n ${toolSchemaField},\n execute: async ({ query }) => {\n // Simulate search delay\n await new Promise(resolve => setTimeout(resolve, 500));\n\n // Return all three knowledge base articles\n // The LLM will select the relevant one based on the query\n return {\n articles: [\n { topic: 'shipping', content: 'Standard shipping takes 3–5 business days.' },\n { topic: 'warranty', content: 'All products include a 1-year limited warranty.' },\n { topic: 'returns', content: 'You can return items within 30 days of delivery.' }\n ]\n };\n },\n }),\n };\n}`;\n\n const toolsVariable = isClaudeAgentSdk ? '' : ` const tools = createTools();`;\n\n return `// agentmark.client.ts\nimport path from 'node:path';\nimport dotenv from 'dotenv';\ndotenv.config({ path: path.resolve(__dirname, '.env') });\nimport { createAgentMarkClient, ${modelRegistry} } from \"${adapterConfig.package}\";\nimport type { EvalRegistry } from \"@agentmark-ai/prompt-core\";\n${loaderImport}\nimport AgentMarkTypes from './agentmark.types';\n${providerImport}\n${toolImport}\n${adapterOptionsImport}\n\n${modelRegistrySetup}\n${toolsSetup}\n\nconst evals: EvalRegistry = {\n exact_match_json: async ({ output, expectedOutput }) => {\n if (!expectedOutput) {\n return { score: 0, label: 'error', reason: 'No expected output provided', passed: false };\n }\n try {\n const ok = JSON.stringify(output) === JSON.stringify(JSON.parse(expectedOutput));\n return {\n score: ok ? 1 : 0,\n label: ok ? 'correct' : 'incorrect',\n reason: ok ? 'Exact match' : 'Mismatch',\n passed: ok\n };\n } catch (e) {\n return { score: 0, label: 'error', reason: 'Failed to parse expected output as JSON', passed: false };\n }\n },\n};\n\nfunction createClient() {\n${loaderSetup}\n const modelRegistry = createModelRegistry();\n${toolsVariable}\n ${createClientCall}\n}\n\nexport const client = createClient();\n`;\n};\n","/**\n * Conflict resolution utilities for handling existing files.\n * Prompts users for resolution when files would be overwritten.\n */\n\nimport prompts from 'prompts';\nimport type {\n ConflictFile,\n ConflictResolution,\n ConflictAction,\n ProjectInfo,\n} from './types.js';\n\n/**\n * Filter conflicts that require user prompting.\n * Returns only conflicts with 'prompt' strategy that actually exist.\n */\nexport function getPromptableConflicts(conflictingFiles: ConflictFile[]): ConflictFile[] {\n return conflictingFiles.filter((file) => file.strategy === 'prompt');\n}\n\n/**\n * Prompt user for resolution of a single conflict.\n */\nasync function promptForSingleConflict(\n conflict: ConflictFile\n): Promise<ConflictResolution> {\n const typeLabel = conflict.type === 'directory' ? 'directory' : 'file';\n\n const { action } = await prompts({\n type: 'select',\n name: 'action',\n message: `${conflict.path} already exists. What would you like to do?`,\n choices: [\n {\n title: `Skip (keep existing ${typeLabel})`,\n value: 'skip',\n description: `Don't modify the existing ${typeLabel}`,\n },\n {\n title: 'Overwrite',\n value: 'overwrite',\n description: `Replace with new AgentMark ${typeLabel}`,\n },\n ],\n initial: 0, // Default to skip for safety\n });\n\n return {\n path: conflict.path,\n action: action as ConflictAction || 'skip',\n };\n}\n\n/**\n * Prompt user for resolution of all conflicts that require prompting.\n * Returns an array of resolution decisions.\n */\nexport async function promptForResolutions(\n conflictingFiles: ConflictFile[]\n): Promise<ConflictResolution[]> {\n const promptableConflicts = getPromptableConflicts(conflictingFiles);\n\n if (promptableConflicts.length === 0) {\n return [];\n }\n\n console.log('\\n⚠️ Found existing files that may conflict with AgentMark initialization:\\n');\n\n const resolutions: ConflictResolution[] = [];\n\n for (const conflict of promptableConflicts) {\n const resolution = await promptForSingleConflict(conflict);\n resolutions.push(resolution);\n }\n\n console.log(''); // Add blank line after prompts\n return resolutions;\n}\n\n/**\n * Get the resolution action for a specific file path.\n * Returns the user's choice or the default strategy if no prompt was needed.\n */\nexport function getResolutionAction(\n filePath: string,\n resolutions: ConflictResolution[],\n conflictingFiles: ConflictFile[]\n): ConflictAction {\n // First check if user provided a resolution\n const userResolution = resolutions.find((r) => r.path === filePath);\n if (userResolution) {\n return userResolution.action;\n }\n\n // Check the default strategy for this file\n const conflictFile = conflictingFiles.find((f) => f.path === filePath);\n if (conflictFile) {\n // Map strategy to action\n switch (conflictFile.strategy) {\n case 'skip':\n return 'skip';\n case 'merge':\n return 'merge';\n case 'append':\n return 'merge'; // Append is a form of merge\n case 'prompt':\n // If we got here without a resolution, default to skip for safety\n return 'skip';\n }\n }\n\n // Default: overwrite (file doesn't conflict or isn't tracked)\n return 'overwrite';\n}\n\n/**\n * Check if a file should be skipped based on resolutions.\n */\nexport function shouldSkipFile(\n filePath: string,\n projectInfo: ProjectInfo | null,\n resolutions: ConflictResolution[]\n): boolean {\n if (!projectInfo || !projectInfo.isExistingProject) {\n return false;\n }\n\n const action = getResolutionAction(filePath, resolutions, projectInfo.conflictingFiles);\n return action === 'skip';\n}\n\n/**\n * Check if a file should be merged based on resolutions.\n */\nexport function shouldMergeFile(\n filePath: string,\n projectInfo: ProjectInfo | null,\n resolutions: ConflictResolution[]\n): boolean {\n if (!projectInfo || !projectInfo.isExistingProject) {\n return false;\n }\n\n const action = getResolutionAction(filePath, resolutions, projectInfo.conflictingFiles);\n return action === 'merge';\n}\n\n/**\n * Display a summary of existing project detection.\n */\nexport function displayProjectDetectionSummary(projectInfo: ProjectInfo): void {\n if (!projectInfo.isExistingProject) {\n return;\n }\n\n console.log('\\n📁 Detected existing project:');\n console.log(` Type: ${projectInfo.type}`);\n\n if (projectInfo.type === 'typescript') {\n console.log(` Package Manager: ${projectInfo.packageManager.name}`);\n }\n\n if (projectInfo.pythonVenv) {\n console.log(` Python Venv: ${projectInfo.pythonVenv.name}`);\n }\n\n if (projectInfo.hasAgentmarkDir) {\n console.log(' ⚠️ AgentMark directory already exists');\n }\n\n console.log('');\n}\n","import fs from \"fs-extra\";\nimport * as path from \"path\";\nimport {\n createExamplePrompts,\n} from \"./templates/index.js\";\nimport { appendGitignore, appendEnv } from \"../file-merge.js\";\nimport { shouldMergeFile } from \"../conflict-resolution.js\";\nimport type { ProjectInfo, ConflictResolution } from \"../types.js\";\n\nconst setupMCPServer = (client: string, targetPath: string) => {\n if (client === \"skip\") {\n console.log(\"Skipping MCP server setup.\");\n return;\n }\n\n const folderName = targetPath;\n\n // Handle VS Code\n if (client === \"vscode\") {\n try {\n console.log(`Setting up MCP server for VS Code in ${folderName}...`);\n const vscodeDir = path.join(targetPath, \".vscode\");\n fs.ensureDirSync(vscodeDir);\n\n const mcpConfig = {\n servers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n },\n \"agentmark-traces\": {\n command: \"npx\",\n args: [\"@agentmark-ai/mcp-server\"],\n env: {\n AGENTMARK_URL: \"http://localhost:9418\"\n }\n }\n }\n };\n\n fs.writeJsonSync(path.join(vscodeDir, \"mcp.json\"), mcpConfig, { spaces: 2 });\n console.log(`MCP server configured for VS Code in ${folderName}/.vscode/mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for VS Code:`, error);\n }\n return;\n }\n\n // Handle Zed\n if (client === \"zed\") {\n try {\n console.log(`Setting up MCP server for Zed in ${folderName}...`);\n const zedDir = path.join(targetPath, \".zed\");\n fs.ensureDirSync(zedDir);\n\n const zedConfig = {\n context_servers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n },\n \"agentmark-traces\": {\n command: \"npx\",\n args: [\"@agentmark-ai/mcp-server\"],\n env: {\n AGENTMARK_URL: \"http://localhost:9418\"\n }\n }\n }\n };\n\n fs.writeJsonSync(path.join(zedDir, \"settings.json\"), zedConfig, { spaces: 2 });\n console.log(`MCP server configured for Zed in ${folderName}/.zed/settings.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Zed:`, error);\n }\n return;\n }\n\n // Handle Cursor\n if (client === \"cursor\") {\n try {\n console.log(`Setting up MCP server for Cursor in ${folderName}...`);\n const cursorDir = path.join(targetPath, \".cursor\");\n fs.ensureDirSync(cursorDir);\n\n const cursorConfig = {\n mcpServers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n },\n \"agentmark-traces\": {\n command: \"npx\",\n args: [\"@agentmark-ai/mcp-server\"],\n env: {\n AGENTMARK_URL: \"http://localhost:9418\"\n }\n }\n }\n };\n\n fs.writeJsonSync(path.join(cursorDir, \"mcp.json\"), cursorConfig, { spaces: 2 });\n console.log(`MCP server configured for Cursor in ${folderName}/.cursor/mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Cursor:`, error);\n }\n return;\n }\n\n // Handle Claude Code\n if (client === \"claude-code\") {\n try {\n console.log(`Setting up MCP server for Claude Code in ${folderName}...`);\n\n const mcpConfig = {\n mcpServers: {\n \"agentmark-docs\": {\n type: \"http\",\n url: \"https://docs.agentmark.co/mcp\"\n },\n \"agentmark-traces\": {\n command: \"npx\",\n args: [\"@agentmark-ai/mcp-server\"],\n env: {\n AGENTMARK_URL: \"http://localhost:9418\"\n }\n }\n }\n };\n\n fs.writeJsonSync(path.join(targetPath, \".mcp.json\"), mcpConfig, { spaces: 2 });\n console.log(`MCP server configured for Claude Code in ${folderName}/.mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Claude Code:`, error);\n }\n return;\n }\n};\n\nconst getPyprojectContent = (projectName: string, adapter: string, deploymentMode: \"cloud\" | \"static\"): string => {\n // Scaffolded Python projects are flat-layout (top-level .py modules, no package dir),\n // so setuptools with explicit py-modules is the simplest build backend.\n // Hatchling requires explicit per-file inclusion rules for this layout, which adds noise.\n const pyModules = deploymentMode === \"cloud\"\n ? `[\"agentmark_client\", \"main\", \"handler\"]`\n : `[\"agentmark_client\", \"main\"]`;\n\n if (adapter === \"claude-agent-sdk\") {\n return `[project]\nname = \"${projectName}\"\nversion = \"0.1.0\"\ndescription = \"An AgentMark application using Claude Agent SDK\"\nrequires-python = \">=3.12\"\ndependencies = [\n \"agentmark-sdk>=0.2.0\",\n \"agentmark-claude-agent-sdk-v0>=0.1.4\",\n \"agentmark-prompt-core>=0.1.2\",\n \"python-dotenv>=1.0.0\",\n \"claude-agent-sdk>=0.1.0\",\n]\n\n[project.optional-dependencies]\ndev = [\n \"pytest>=7.0\",\n \"pytest-asyncio>=0.21\",\n \"mypy>=1.0\",\n]\n\n[build-system]\nrequires = [\"setuptools>=61\", \"wheel\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[tool.setuptools]\npy-modules = ${pyModules}\n\n[tool.pytest.ini_options]\nasyncio_mode = \"auto\"\n\n[tool.mypy]\nstrict = true\n`;\n }\n\n // Default: pydantic-ai.\n // pydantic-ai-slim with explicit extras avoids the meta-package's transitive extras explosion (pip resolution-too-deep).\n return `[project]\nname = \"${projectName}\"\nversion = \"0.1.0\"\ndescription = \"An AgentMark application using Pydantic AI\"\nrequires-python = \">=3.12\"\ndependencies = [\n \"agentmark-sdk>=0.2.0\",\n \"agentmark-pydantic-ai-v0>=0.1.4\",\n \"agentmark-prompt-core>=0.1.2\",\n \"python-dotenv>=1.0.0\",\n \"pydantic-ai-slim[openai]>=1.0,<2.0\",\n]\n\n[project.optional-dependencies]\ndev = [\n \"pytest>=7.0\",\n \"pytest-asyncio>=0.21\",\n \"mypy>=1.0\",\n]\n\n[build-system]\nrequires = [\"setuptools>=61\", \"wheel\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[tool.setuptools]\npy-modules = ${pyModules}\n\n[tool.pytest.ini_options]\nasyncio_mode = \"auto\"\n\n[tool.mypy]\nstrict = true\n`;\n};\n\nconst getHandlerPyContent = (adapter: string): string => {\n const webhookClass = adapter === \"claude-agent-sdk\"\n ? \"ClaudeAgentWebhookHandler\"\n : \"PydanticAIWebhookHandler\";\n const webhookImport = adapter === \"claude-agent-sdk\"\n ? \"from agentmark_claude_agent_sdk_v0 import ClaudeAgentWebhookHandler\"\n : \"from agentmark_pydantic_ai_v0 import PydanticAIWebhookHandler\";\n\n return `\"\"\"AgentMark handler for managed cloud deployments.\n\nThis file is used by the AgentMark platform to execute prompts and experiments\non deployed infrastructure. It mirrors the TypeScript handler.ts pattern.\n\"\"\"\n\nimport os\n\nfrom agentmark_sdk import AgentMarkSDK\n${webhookImport}\nfrom agentmark_client import client\n\n# Initialize tracing\nsdk = AgentMarkSDK(\n api_key=os.environ.get(\"AGENTMARK_API_KEY\", \"\"),\n app_id=os.environ.get(\"AGENTMARK_APP_ID\", \"\"),\n base_url=os.environ.get(\"AGENTMARK_BASE_URL\"),\n)\nsdk.init_tracing(disable_batch=True)\n\nadapter = ${webhookClass}(client)\n\n\nasync def handler(request: dict):\n \"\"\"Handle prompt-run, dataset-run, and get-evals requests from the platform.\"\"\"\n req_type = request.get(\"type\")\n data = request.get(\"data\", {})\n\n if req_type == \"get-evals\":\n import json\n return {\n \"type\": \"evals\",\n \"result\": json.dumps(list(client.get_eval_registry().keys())),\n \"traceId\": \"\",\n }\n\n if req_type == \"prompt-run\":\n return await adapter.run_prompt(data[\"ast\"], {\n \"shouldStream\": data.get(\"options\", {}).get(\"shouldStream\", True),\n \"customProps\": data.get(\"customProps\"),\n })\n\n if req_type == \"dataset-run\":\n return await adapter.run_experiment(\n data[\"ast\"],\n data.get(\"experimentId\", \"\"),\n data.get(\"datasetPath\"),\n )\n\n raise ValueError(f\"Unknown request type: {req_type}\")\n`;\n};\n\nconst getAgentmarkClientContent = (deploymentMode: \"cloud\" | \"static\", adapter: string): string => {\n const isCloud = deploymentMode === \"cloud\";\n const loaderImport = isCloud\n ? `from agentmark.prompt_core import ApiLoader`\n : `from agentmark.prompt_core import FileLoader`;\n const loaderSetup = isCloud\n ? `# API loader for cloud deployment — fetches datasets from the AgentMark gateway\nloader = ApiLoader.cloud()`\n : `# File loader for local development\nproject_root = Path(__file__).parent.resolve()\nloader = FileLoader(base_dir=str(project_root))`;\n\n if (adapter === \"claude-agent-sdk\") {\n return `\"\"\"AgentMark client configuration.\n\nThis file configures the AgentMark client with Claude Agent SDK adapter.\nCustomize the model registry and eval registry as needed.\n\"\"\"\n\nimport json\nimport os\nfrom pathlib import Path\nfrom dotenv import load_dotenv\n\n${loaderImport}\nfrom agentmark.prompt_core import EvalRegistry\nfrom agentmark_claude_agent_sdk_v0 import (\n create_claude_agent_client,\n ClaudeAgentModelRegistry,\n)\n\n# Load environment variables\nload_dotenv()\n\n# Register the model providers your prompts use.\n# This maps \"anthropic/claude-sonnet-4-20250514\" in prompt files to the Claude Agent SDK.\nmodel_registry = ClaudeAgentModelRegistry()\nmodel_registry.register_providers({\n \"anthropic\": \"anthropic\",\n})\n\n\n# Evaluation functions — used by experiments to score model outputs\ndef exact_match_json(params):\n \"\"\"Check if output matches expected output exactly.\"\"\"\n output = params.get(\"output\")\n expected_output = params.get(\"expectedOutput\")\n if not expected_output:\n return {\"score\": 0, \"label\": \"error\", \"reason\": \"No expected output provided\", \"passed\": False}\n try:\n actual = json.loads(output) if isinstance(output, str) else output\n expected = json.loads(expected_output) if isinstance(expected_output, str) else expected_output\n ok = actual == expected\n return {\n \"score\": 1 if ok else 0,\n \"label\": \"correct\" if ok else \"incorrect\",\n \"reason\": \"Exact match\" if ok else \"Mismatch\",\n \"passed\": ok,\n }\n except (json.JSONDecodeError, TypeError):\n return {\"score\": 0, \"label\": \"error\", \"reason\": \"Failed to parse JSON\", \"passed\": False}\n\nevals: EvalRegistry = {\n \"exact_match_json\": exact_match_json,\n}\n\n${loaderSetup}\n\n# Create the client\n# Claude Agent SDK handles tools natively through the SDK\nclient = create_claude_agent_client(\n model_registry=model_registry,\n evals=evals,\n loader=loader,\n)\n\n__all__ = [\"client\"]\n`;\n }\n\n // Default: pydantic-ai\n return `\"\"\"AgentMark client configuration.\n\nThis file configures the AgentMark client with Pydantic AI adapter.\nCustomize the model registry, tools, and eval registry as needed.\n\"\"\"\n\nimport json\nimport os\nfrom pathlib import Path\nfrom dotenv import load_dotenv\n\n${loaderImport}\nfrom agentmark.prompt_core import EvalRegistry\nfrom agentmark_pydantic_ai_v0 import (\n create_pydantic_ai_client,\n PydanticAIModelRegistry,\n)\n\n# Load environment variables\nload_dotenv()\n\n# Register the model providers your prompts use.\n# This maps \"openai/gpt-4o\" in prompt files to \"openai:gpt-4o\" for Pydantic AI.\nmodel_registry = PydanticAIModelRegistry()\nmodel_registry.register_providers({\n \"openai\": \"openai\",\n \"anthropic\": \"anthropic\",\n})\n\n# Define tools as native pydantic-ai Tool objects or callables\n# Example:\n# def search(query: str) -> str:\n# return f\"Search results for: {query}\"\n# tools = [search]\ntools = []\n\n\n# Evaluation functions — used by experiments to score model outputs\ndef exact_match_json(params):\n \"\"\"Check if output matches expected output exactly.\"\"\"\n output = params.get(\"output\")\n expected_output = params.get(\"expectedOutput\")\n if not expected_output:\n return {\"score\": 0, \"label\": \"error\", \"reason\": \"No expected output provided\", \"passed\": False}\n try:\n actual = json.loads(output) if isinstance(output, str) else output\n expected = json.loads(expected_output) if isinstance(expected_output, str) else expected_output\n ok = actual == expected\n return {\n \"score\": 1 if ok else 0,\n \"label\": \"correct\" if ok else \"incorrect\",\n \"reason\": \"Exact match\" if ok else \"Mismatch\",\n \"passed\": ok,\n }\n except (json.JSONDecodeError, TypeError):\n return {\"score\": 0, \"label\": \"error\", \"reason\": \"Failed to parse JSON\", \"passed\": False}\n\nevals: EvalRegistry = {\n \"exact_match_json\": exact_match_json,\n}\n\n${loaderSetup}\n\n# Create the client\nclient = create_pydantic_ai_client(\n model_registry=model_registry,\n tools=tools,\n evals=evals,\n loader=loader,\n)\n\n__all__ = [\"client\"]\n`;\n};\n\nexport const getMainPyContent = (adapter: string, deploymentMode: \"cloud\" | \"static\" = \"cloud\"): string => {\n const isCloud = deploymentMode === \"cloud\";\n\n const cloudTracingInit = `\n# Initialize tracing - traces will be sent to AgentMark Cloud\n# To disable tracing, comment out sdk.init_tracing() below\nsdk = AgentMarkSDK(\n api_key=os.environ.get(\"AGENTMARK_API_KEY\", \"\"),\n app_id=os.environ.get(\"AGENTMARK_APP_ID\", \"\"),\n)\nsdk.init_tracing(disable_batch=True)\n`;\n\n const staticTracingInit = `\n# Initialize tracing - traces will be sent to local dev server\n# Make sure to run \"npx agentmark dev\" in another terminal first\n# To disable tracing, comment out sdk.init_tracing() below\nsdk = AgentMarkSDK(\n api_key=\"\",\n app_id=\"\",\n base_url=\"http://localhost:9418\",\n)\nsdk.init_tracing(disable_batch=True)\n`;\n\n const tracingInit = isCloud ? cloudTracingInit : staticTracingInit;\n\n if (adapter === \"claude-agent-sdk\") {\n return `\"\"\"Example usage of AgentMark with Claude Agent SDK.\n\nRun with:\n npx agentmark build # compile party-planner.prompt.mdx -> dist/agentmark/*.json\n python main.py\n\"\"\"\n\nimport asyncio\nimport os\n\nfrom agentmark_sdk import AgentMarkSDK\nfrom agentmark_claude_agent_sdk_v0 import traced_query\nfrom agentmark_client import client\n${tracingInit}\n\nasync def main():\n \"\"\"Run the party planner prompt (object_config: extracts attendee names).\"\"\"\n # \\`agentmark build\\` writes pre-compiled prompts to dist/agentmark/.\n # The FileLoader reads them by name — extension is optional.\n try:\n prompt = await client.load_object_prompt(\"party-planner.prompt.mdx\")\n except FileNotFoundError:\n print(\"Pre-built prompt not found. Run 'npx agentmark build' first.\")\n return\n\n adapted = await prompt.format(props={\n \"party_text\": \"We're having a party with Alice, Bob, and Carol.\",\n })\n\n # Execute via Claude Agent SDK (streamed) with automatic OTEL tracing.\n # adapted.query.options.output_format is set to the object schema.\n print(\"Running party planner prompt...\")\n print(\"=\" * 50)\n async for message in traced_query(adapted):\n print(message)\n print(\"=\" * 50)\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n`;\n }\n\n // Default: pydantic-ai\n return `\"\"\"Example usage of AgentMark with Pydantic AI.\n\nRun with:\n npx agentmark build # compile party-planner.prompt.mdx -> dist/agentmark/*.json\n python main.py\n\"\"\"\n# To use a different LLM provider, install: pip install \"pydantic-ai-slim[anthropic]\" (or [google], [bedrock], etc.)\n\nimport asyncio\nimport os\n\nfrom agentmark_sdk import AgentMarkSDK\nfrom agentmark_pydantic_ai_v0 import run_object_prompt\nfrom agentmark_client import client\n${tracingInit}\n\nasync def main():\n \"\"\"Run the party planner prompt (object_config: extracts attendee names).\"\"\"\n # \\`agentmark build\\` writes pre-compiled prompts to dist/agentmark/.\n # The FileLoader reads them by name — extension is optional, and it\n # extracts the inner AST from the { ast, metadata } wrapper for you.\n try:\n prompt = await client.load_object_prompt(\"party-planner.prompt.mdx\")\n except FileNotFoundError:\n print(\"Pre-built prompt not found. Run 'npx agentmark build' first.\")\n return\n\n params = await prompt.format(props={\n \"party_text\": \"We're having a party with Alice, Bob, and Carol.\",\n })\n\n # Execute the prompt\n print(\"Running party planner prompt...\")\n result = await run_object_prompt(params)\n\n print(\"\\\\n\" + \"=\" * 50)\n print(\"Extracted attendees:\")\n print(\"=\" * 50)\n # result.output is a Pydantic model instance with the schema's fields\n print(result.output.names)\n print(\"\\\\n\" + \"-\" * 50)\n print(f\"Tokens used: {result.usage.total_tokens}\")\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n`;\n};\n\nconst getDevServerContent = (adapter: string): string => {\n const adapterPackage = adapter === \"claude-agent-sdk\"\n ? \"agentmark_claude_agent_sdk_v0\"\n : \"agentmark_pydantic_ai_v0\";\n\n return `\"\"\"Auto-generated webhook server for AgentMark development.\n\nThis server is started by 'npx agentmark dev' (agentmark dev) and handles\nprompt execution requests from the CLI.\n\"\"\"\n\nimport argparse\nimport sys\nfrom pathlib import Path\n\n# Add parent directory to path for imports\nsys.path.insert(0, str(Path(__file__).parent.parent))\n\nfrom ${adapterPackage} import create_webhook_server\nfrom agentmark_client import client\n\n\nif __name__ == \"__main__\":\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--webhook-port\", type=int, default=9417)\n parser.add_argument(\"--api-server-port\", type=int, default=9418)\n args = parser.parse_args()\n\n create_webhook_server(client, args.webhook_port, args.api_server_port)\n`;\n};\n\nconst getEnvContent = (apiKey: string, adapter: string): string => {\n if (adapter === \"claude-agent-sdk\") {\n return `# Anthropic API Key\nANTHROPIC_API_KEY=${apiKey}\n`;\n }\n\n // Default: pydantic-ai (OpenAI)\n return `# OpenAI API Key\nOPENAI_API_KEY=${apiKey}\n\n# For Anthropic models, add:\n# ANTHROPIC_API_KEY=your-key-here\n\n# For Google Gemini models, add:\n# GOOGLE_API_KEY=your-key-here\n`;\n};\n\nconst getReadmeContent = (projectName: string, adapter: string): string => {\n const adapterName = adapter === \"claude-agent-sdk\" ? \"Claude Agent SDK\" : \"Pydantic AI\";\n const apiKeyEnvVar = adapter === \"claude-agent-sdk\" ? \"ANTHROPIC_API_KEY\" : \"OPENAI_API_KEY\";\n const directInstallCmd = adapter === \"claude-agent-sdk\"\n ? 'pip install agentmark-sdk agentmark-claude-agent-sdk-v0 agentmark-prompt-core python-dotenv claude-agent-sdk'\n : 'pip install agentmark-sdk agentmark-pydantic-ai-v0 agentmark-prompt-core python-dotenv \"pydantic-ai-slim[openai]>=1.0,<2.0\"';\n\n return `# ${projectName}\n\nAn AgentMark application using ${adapterName}.\n\n## Prerequisites\n\n- Python 3.12+\n- **pip 26.1+** (older pip versions fail to resolve the dependency graph — see \"Why pip 26.1?\" below)\n\n## Setup\n\n\\`\\`\\`bash\n# 1. Create and activate a virtual environment\npython -m venv .venv\nsource .venv/bin/activate # On Windows: .venv\\\\Scripts\\\\activate\n\n# 2. Upgrade pip (REQUIRED — older pip cannot resolve pydantic-ai's transitive graph)\npython -m pip install --upgrade \"pip>=26.1\"\n\n# 3. Install dependencies\n${directInstallCmd}\n\n# 4. Set your API key\necho \"${apiKeyEnvVar}=your-key-here\" > .env\n\\`\\`\\`\n\n## Run\n\n\\`\\`\\`bash\n# Start the AgentMark dev server (in another terminal)\nnpx agentmark dev\n\n# Run the example prompt\npython main.py\n\\`\\`\\`\n\nThen open [http://localhost:9418](http://localhost:9418) to view your traces.\n\n## Why pip 26.1?\n\nThe \\`pydantic-ai-slim\\` package transitively depends on \\`mcp\\`, \\`fastmcp\\`, and\n\\`logfire\\`, which together produce a deep dependency graph. Pip versions before\n26.1 fall into long backtracking loops and abort with \\`resolution-too-deep\\`.\nPip 26.1's resolver handles this graph efficiently. If you skip the upgrade and\nhit the error, run \\`python -m pip install --upgrade pip\\` and retry.\n\n## Resources\n\n- [Documentation](https://docs.agentmark.co)\n- [GitHub](https://github.com/agentmark-ai/agentmark)\n`;\n};\n\nconst getGitignoreContent = (): string => {\n return `# Python\n__pycache__/\n*.py[cod]\n*$py.class\n.venv/\nvenv/\n.env\n\n# AgentMark\n*.agentmark-outputs/\n.agentmark/\n\n# IDE\n.idea/\n.vscode/\n*.swp\n\n# Build\ndist/\nbuild/\n*.egg-info/\n\n# Testing\n.pytest_cache/\n.coverage\nhtmlcov/\n`;\n};\n\nexport const createPythonApp = async (\n client: string,\n targetPath: string = \".\",\n apiKey: string = \"\",\n deploymentMode: \"cloud\" | \"static\" = \"cloud\",\n adapter: string = \"pydantic-ai\",\n projectInfo: ProjectInfo | null = null,\n resolutions: ConflictResolution[] = []\n): Promise<string[]> => {\n try {\n const model = adapter === 'claude-agent-sdk' ? 'anthropic/claude-sonnet-4-20250514' : 'openai/gpt-4o';\n const adapterDisplayName = adapter === 'claude-agent-sdk' ? 'Claude Agent SDK' : 'Pydantic AI';\n const isExistingProject = projectInfo?.isExistingProject ?? false;\n\n if (isExistingProject) {\n console.log(`Adding AgentMark to existing Python project with ${adapterDisplayName}...`);\n } else {\n console.log(`Creating AgentMark Python app with ${adapterDisplayName}...`);\n }\n\n const folderName = targetPath;\n\n // Create directory structure\n fs.ensureDirSync(`${targetPath}/agentmark`);\n\n setupMCPServer(client, targetPath);\n\n // Create example prompts (reuse from TypeScript) — returns the model IDs actually written\n const usedModels = createExamplePrompts(model, targetPath, adapter);\n console.log(`Example prompts and datasets created in ${folderName}/agentmark/`);\n\n // Create pyproject.toml (skip for existing projects)\n if (!isExistingProject) {\n const projectName = path.basename(targetPath).replace(/[^a-zA-Z0-9_-]/g, \"-\");\n fs.writeFileSync(`${targetPath}/pyproject.toml`, getPyprojectContent(projectName, adapter, deploymentMode));\n } else {\n console.log(\"⏭️ Skipped pyproject.toml (existing project)\");\n }\n\n // Create agentmark_client.py (always create - this is AgentMark-specific)\n fs.writeFileSync(`${targetPath}/agentmark_client.py`, getAgentmarkClientContent(deploymentMode, adapter));\n\n // Create handler.py for cloud deployments (managed code execution)\n if (deploymentMode === \"cloud\") {\n const handlerPath = path.join(targetPath, 'handler.py');\n if (fs.existsSync(handlerPath)) {\n console.log(\"⏭️ Skipped handler.py (already exists - preserving customizations)\");\n } else {\n fs.writeFileSync(handlerPath, getHandlerPyContent(adapter));\n console.log(`✅ Created handler.py for cloud deployment`);\n }\n }\n\n // Create main.py (skip for existing projects)\n if (!isExistingProject) {\n fs.writeFileSync(`${targetPath}/main.py`, getMainPyContent(adapter, deploymentMode));\n } else {\n console.log(\"⏭️ Skipped main.py (existing project)\");\n }\n\n // Create or append to .env file\n if (shouldMergeFile('.env', projectInfo, resolutions)) {\n const envVars: Record<string, string> = {};\n const apiKeyEnvVar = adapter === 'claude-agent-sdk' ? 'ANTHROPIC_API_KEY' : 'OPENAI_API_KEY';\n if (apiKey) {\n envVars[apiKeyEnvVar] = apiKey;\n } else {\n envVars[apiKeyEnvVar] = adapter === 'claude-agent-sdk' ? 'your-anthropic-api-key' : 'your-openai-api-key';\n }\n const result = appendEnv(targetPath, envVars);\n if (result.added.length > 0) {\n console.log(`✅ Added to .env: ${result.added.join(', ')}`);\n }\n if (result.skipped.length > 0) {\n console.log(`⏭️ Skipped existing .env vars: ${result.skipped.join(', ')}`);\n }\n } else {\n fs.writeFileSync(`${targetPath}/.env`, getEnvContent(apiKey, adapter));\n }\n\n // Create or append to .gitignore\n const gitignoreEntries = [\n '__pycache__/', '*.py[cod]', '*$py.class', '.venv/', 'venv/', '.env',\n '*.agentmark-outputs/', '.agentmark/', '.idea/', '.vscode/', '*.swp',\n 'dist/', 'build/', '*.egg-info/', '.pytest_cache/', '.coverage', 'htmlcov/'\n ];\n if (shouldMergeFile('.gitignore', projectInfo, resolutions)) {\n const result = appendGitignore(targetPath, gitignoreEntries);\n if (result.added.length > 0) {\n console.log(`✅ Added to .gitignore: ${result.added.join(', ')}`);\n }\n if (result.skipped.length > 0) {\n console.log(`⏭️ Already in .gitignore: ${result.skipped.join(', ')}`);\n }\n } else {\n fs.writeFileSync(`${targetPath}/.gitignore`, getGitignoreContent());\n }\n\n // Create README.md (skip for existing projects — they likely already have one)\n if (!isExistingProject) {\n const readmePath = path.join(targetPath, 'README.md');\n if (!fs.existsSync(readmePath)) {\n const projectName = path.basename(targetPath).replace(/[^a-zA-Z0-9_-]/g, \"-\");\n fs.writeFileSync(readmePath, getReadmeContent(projectName, adapter));\n console.log(`✅ Created README.md`);\n }\n }\n\n // Create .agentmark directory with dev_server.py\n const agentmarkInternalDir = path.join(targetPath, '.agentmark');\n fs.ensureDirSync(agentmarkInternalDir);\n fs.writeFileSync(path.join(agentmarkInternalDir, 'dev_server.py'), getDevServerContent(adapter));\n\n // Python environment setup notes\n const pythonVenv = projectInfo?.pythonVenv;\n if (pythonVenv) {\n console.log(`\\n📦 Detected existing Python venv: ${pythonVenv.name}`);\n console.log(\" Remember to activate it before running AgentMark commands.\");\n } else if (!isExistingProject) {\n console.log(\"Setting up Python environment...\");\n console.log(\"Note: You'll need to set up a virtual environment and install dependencies.\");\n console.log(\"\");\n }\n\n // Success message\n console.log(\"\\n✅ AgentMark Python initialization completed successfully!\");\n\n console.log(\n `\n ██████╗ ██╗ ██╗████████╗██╗ ██╗ ██████╗ ███╗ ██╗\n ██╔══██╗╚██╗ ██╔╝╚══██╔══╝██║ ██║██╔═══██╗████╗ ██║\n ██████╔╝ ╚████╔╝ ██║ ███████║██║ ██║██╔██╗ ██║\n ██╔═══╝ ╚██╔╝ ██║ ██╔══██║██║ ██║██║╚██╗██║\n ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║\n ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝\n + AgentMark\n `\n );\n\n console.log('\\n' + '═'.repeat(70));\n console.log('Next Steps');\n console.log('═'.repeat(70));\n\n console.log('\\n Get Started:');\n if (folderName !== \".\" && folderName !== \"./\" && !isExistingProject) {\n console.log(` $ cd ${folderName}`);\n }\n\n // Recommend installing deps directly — `pip install -e \".[dev]\"` on flat-layout\n // projects triggers pip's \"dependency graph too complex\" backtracking limit,\n // even though the same deps resolve fine when passed directly to pip.\n //\n // Even with the direct-install workaround, pip < 26.1 still hits \"resolution-too-deep\"\n // on the pydantic-ai-slim transitive graph (mcp/fastmcp/logfire/etc). Pip 26.1+ ships\n // a far better resolver — upgrade first so the install reliably converges.\n const pipInstallCmd = adapter === 'claude-agent-sdk'\n ? ' $ pip install agentmark-sdk agentmark-claude-agent-sdk-v0 agentmark-prompt-core python-dotenv claude-agent-sdk'\n : ' $ pip install agentmark-sdk agentmark-pydantic-ai-v0 agentmark-prompt-core python-dotenv \"pydantic-ai-slim[openai]>=1.0,<2.0\"';\n const pipUpgradeCmd = ' $ python -m pip install --upgrade \"pip>=26.1\"';\n\n if (pythonVenv) {\n const activateCmd = process.platform === 'win32'\n ? `${pythonVenv.name}\\\\Scripts\\\\activate`\n : `source ${pythonVenv.name}/bin/activate`;\n console.log(` $ ${activateCmd}`);\n console.log(pipUpgradeCmd);\n console.log(pipInstallCmd);\n } else {\n console.log(' $ python -m venv .venv');\n console.log(' $ source .venv/bin/activate # On Windows: .venv\\\\Scripts\\\\activate');\n console.log(pipUpgradeCmd);\n console.log(pipInstallCmd);\n }\n console.log(' $ npx agentmark dev\\n');\n\n console.log('─'.repeat(70));\n console.log('Resources');\n console.log('─'.repeat(70));\n console.log(' Documentation: https://docs.agentmark.co');\n console.log('═'.repeat(70) + '\\n');\n\n return usedModels;\n } catch (error) {\n console.error(\"Error creating Python app:\", error);\n throw error;\n }\n};\n","/**\n * Project detection utilities for identifying existing projects.\n * Detects TypeScript/Python projects and their configurations.\n */\n\nimport fs from 'fs-extra';\nimport path from 'path';\nimport {\n type ProjectInfo,\n type ConflictFile,\n type PythonVenvInfo,\n CONFLICT_FILES,\n} from './types.js';\nimport { detectPackageManager } from './package-manager.js';\n\n// Re-export for backwards compatibility\nexport { detectPackageManager };\n\nconst IS_WINDOWS = process.platform === 'win32';\n\n/**\n * Detect if a TypeScript/Node.js project exists in the target directory.\n * Checks for package.json, tsconfig.json, or node_modules.\n */\nexport function detectTypeScriptProject(targetPath: string): boolean {\n const indicators = ['package.json', 'tsconfig.json', 'node_modules'];\n return indicators.some((file) => fs.existsSync(path.join(targetPath, file)));\n}\n\n/**\n * Detect if a Python project exists in the target directory.\n * Checks for pyproject.toml, requirements.txt, setup.py, or virtual environments.\n */\nexport function detectPythonProject(targetPath: string): boolean {\n const indicators = ['pyproject.toml', 'requirements.txt', 'setup.py', '.venv', 'venv'];\n return indicators.some((file) => fs.existsSync(path.join(targetPath, file)));\n}\n\n/**\n * Detect existing Python virtual environment.\n * Checks .venv and venv directories, returns platform-specific paths.\n */\nexport function detectPythonVenv(targetPath: string): PythonVenvInfo | null {\n const venvNames = ['.venv', 'venv'];\n\n for (const name of venvNames) {\n const venvPath = path.join(targetPath, name);\n if (fs.existsSync(venvPath) && fs.statSync(venvPath).isDirectory()) {\n // Check if it's actually a venv (has bin/Scripts and pyvenv.cfg or similar)\n const binDir = IS_WINDOWS ? 'Scripts' : 'bin';\n const binPath = path.join(venvPath, binDir);\n\n if (fs.existsSync(binPath)) {\n const pipExe = IS_WINDOWS ? 'pip.exe' : 'pip';\n\n return {\n path: venvPath,\n name,\n activateCmd: IS_WINDOWS\n ? `${name}\\\\Scripts\\\\activate`\n : `source ${name}/bin/activate`,\n pipPath: path.join(binPath, pipExe),\n };\n }\n }\n }\n\n // Check VIRTUAL_ENV environment variable\n const envVenv = process.env.VIRTUAL_ENV;\n if (envVenv && fs.existsSync(envVenv)) {\n // Check if VIRTUAL_ENV is inside the target directory\n const resolvedTarget = path.resolve(targetPath);\n const resolvedVenv = path.resolve(envVenv);\n const isInsideTarget = resolvedVenv.startsWith(resolvedTarget + path.sep) ||\n resolvedVenv === resolvedTarget;\n\n if (!isInsideTarget) {\n // VIRTUAL_ENV points outside target directory - likely from another project\n // Don't use it as it could give incorrect instructions\n console.warn(\n `⚠️ Note: VIRTUAL_ENV (${envVenv}) points outside the target directory. ` +\n `It will not be used for this initialization.`\n );\n return null;\n }\n\n const binDir = IS_WINDOWS ? 'Scripts' : 'bin';\n const pipExe = IS_WINDOWS ? 'pip.exe' : 'pip';\n const name = path.basename(envVenv);\n\n return {\n path: envVenv,\n name,\n activateCmd: IS_WINDOWS\n ? `${name}\\\\Scripts\\\\activate`\n : `source ${name}/bin/activate`,\n pipPath: path.join(envVenv, binDir, pipExe),\n };\n }\n\n return null;\n}\n\n/**\n * Detect files that may conflict with AgentMark initialization.\n * Returns only the files that actually exist in the target directory.\n */\nexport function detectConflictingFiles(targetPath: string): ConflictFile[] {\n const existingConflicts: ConflictFile[] = [];\n\n for (const conflictFile of CONFLICT_FILES) {\n const fullPath = path.join(targetPath, conflictFile.path);\n if (fs.existsSync(fullPath)) {\n existingConflicts.push(conflictFile);\n }\n }\n\n return existingConflicts;\n}\n\n/**\n * Detect all project information for the target directory.\n * This is the main function that combines all detection logic.\n */\nexport function detectProjectInfo(targetPath: string): ProjectInfo {\n const isTypeScript = detectTypeScriptProject(targetPath);\n const isPython = detectPythonProject(targetPath);\n const isExistingProject = isTypeScript || isPython;\n\n let type: 'typescript' | 'python' | 'unknown' = 'unknown';\n if (isTypeScript && !isPython) {\n type = 'typescript';\n } else if (isPython && !isTypeScript) {\n type = 'python';\n } else if (isTypeScript && isPython) {\n // If both, prefer TypeScript (more common case for polyglot projects)\n type = 'typescript';\n }\n\n const packageManager = detectPackageManager(targetPath);\n const conflictingFiles = detectConflictingFiles(targetPath);\n const hasAgentmarkDir = fs.existsSync(path.join(targetPath, 'agentmark'));\n const pythonVenv = detectPythonVenv(targetPath);\n\n return {\n isExistingProject,\n type,\n packageManager,\n conflictingFiles,\n hasAgentmarkDir,\n pythonVenv,\n };\n}\n\n/**\n * Check if the target path is the current directory.\n * Used to determine if we need to skip mkdir and cd instructions.\n */\nexport function isCurrentDirectory(folderName: string): boolean {\n return folderName === '.' || folderName === './' || folderName === '.\\\\';\n}\n","/**\n * Package manager utilities for detecting and using the correct package manager.\n */\n\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { execSync, execFileSync } from 'child_process';\nimport {\n type PackageManager,\n type PackageManagerConfig,\n PACKAGE_MANAGERS,\n DEFAULT_PACKAGE_MANAGER,\n} from './types.js';\n\n/**\n * Detect the package manager in use by checking for lock files.\n * Priority order: yarn > pnpm > bun > npm.\n */\nexport function detectPackageManager(targetPath: string): PackageManagerConfig {\n // Check lock files in priority order\n const lockFiles = ['yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'package-lock.json'];\n\n for (const lockFile of lockFiles) {\n if (fs.existsSync(path.join(targetPath, lockFile))) {\n const config = PACKAGE_MANAGERS[lockFile];\n if (config) {\n return config;\n }\n }\n }\n\n // Default to npm if no lock file found\n return DEFAULT_PACKAGE_MANAGER;\n}\n\n/**\n * Get the package manager configuration by name.\n */\nexport function getPackageManagerConfig(name: PackageManager): PackageManagerConfig {\n const configs = Object.values(PACKAGE_MANAGERS);\n const config = configs.find((c) => c.name === name);\n return config || DEFAULT_PACKAGE_MANAGER;\n}\n\n/**\n * Install dependencies using the detected package manager.\n */\nexport function installDependencies(\n targetPath: string,\n packageManager: PackageManagerConfig\n): void {\n console.log(`Installing dependencies with ${packageManager.name}...`);\n\n try {\n execSync(packageManager.installCmd, {\n stdio: 'inherit',\n cwd: targetPath,\n });\n console.log('Dependencies installed successfully!');\n } catch (error) {\n console.error(`Error installing dependencies with ${packageManager.name}:`, error);\n throw new Error(\n `Failed to install dependencies. Please run \"${packageManager.installCmd}\" manually.`\n );\n }\n}\n\n/**\n * Add production dependencies using the detected package manager.\n */\nexport function addDependencies(\n targetPath: string,\n packageManager: PackageManagerConfig,\n packages: string[]\n): void {\n if (packages.length === 0) return;\n\n console.log(`Adding dependencies with ${packageManager.name}...`);\n\n try {\n // Build the command arguments\n const cmdParts = packageManager.addCmd.split(' ');\n const cmd = cmdParts[0]!;\n const args = [...cmdParts.slice(1), ...packages];\n\n execFileSync(cmd, args, {\n stdio: 'inherit',\n cwd: targetPath,\n });\n } catch (error) {\n console.error(`Error adding dependencies:`, error);\n throw new Error(\n `Failed to add dependencies. Please run \"${packageManager.addCmd} ${packages.join(' ')}\" manually.`\n );\n }\n}\n\n/**\n * Add dev dependencies using the detected package manager.\n */\nexport function addDevDependencies(\n targetPath: string,\n packageManager: PackageManagerConfig,\n packages: string[]\n): void {\n if (packages.length === 0) return;\n\n console.log(`Adding dev dependencies with ${packageManager.name}...`);\n\n try {\n // Build the command arguments\n const cmdParts = packageManager.addDevCmd.split(' ');\n const cmd = cmdParts[0]!;\n const args = [...cmdParts.slice(1), ...packages];\n\n execFileSync(cmd, args, {\n stdio: 'inherit',\n cwd: targetPath,\n });\n } catch (error) {\n console.error(`Error adding dev dependencies:`, error);\n throw new Error(\n `Failed to add dev dependencies. Please run \"${packageManager.addDevCmd} ${packages.join(' ')}\" manually.`\n );\n }\n}\n\n/**\n * Get the run script command for a package manager.\n * e.g., \"npm run dev\" or \"yarn dev\" or \"pnpm dev\"\n */\nexport function getRunScriptCmd(\n packageManager: PackageManagerConfig,\n script: string\n): string {\n return `${packageManager.runCmd} ${script}`;\n}\n","import { execSync } from \"child_process\";\n\n/**\n * Initialize a git repository and create an initial commit.\n *\n * Skips silently when:\n * - The target path is already inside a git repository\n * - git is not installed\n * - Any git command fails (non-fatal)\n */\nexport function initGitRepo(targetPath: string): boolean {\n try {\n // Check if git is available\n try {\n execSync(\"git --version\", { stdio: \"ignore\" });\n } catch {\n console.log(\"⚠️ git not found — skipping repository initialization\");\n return false;\n }\n\n // Check if already inside a git repo\n try {\n execSync(\"git rev-parse --is-inside-work-tree\", {\n cwd: targetPath,\n stdio: \"ignore\",\n });\n // Already in a git repo — skip\n return false;\n } catch {\n // Not in a git repo — proceed\n }\n\n execSync(\"git init\", { cwd: targetPath, stdio: \"ignore\" });\n execSync(\"git add -A\", { cwd: targetPath, stdio: \"ignore\" });\n execSync(\n 'git -c user.name=\"create-agentmark\" -c user.email=\"noreply\" commit -m \"Initial commit from create-agentmark\"',\n { cwd: targetPath, stdio: \"ignore\" },\n );\n\n console.log(\"✅ Initialized git repository with initial commit\");\n return true;\n } catch {\n console.log(\"⚠️ Could not initialize git repository\");\n return false;\n }\n}\n"],"mappings":";;;AAAA,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,OAAOC,cAAa;;;ACFpB,OAAOC,SAAQ;AACf,YAAYC,WAAU;;;ACWf,IAAM,sBAAsB,CACjC,aACkC;AAClC,SAAO;AAAA,IACL,UAAU;AAAA,MACR,SAAS;AAAA,MACT,cAAc,CAAC,SAAS,WAAW,QAAQ,KAAK;AAAA,MAChD,SAAS;AAAA,QACP,eAAe;AAAA,QACf,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,cAAc;AAAA,QACZ;AAAA,QACA;AAAA,QACA,WAAW,QAAQ;AAAA,QACnB;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACP,eAAe;AAAA,QACf,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB,SAAS;AAAA,MACT,cAAc,CAAC,uCAAuC;AAAA,MACtD,SAAS;AAAA,QACP,eAAe;AAAA,QACf,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,iBACd,SACA,UACe;AACf,QAAM,SAAS,oBAAoB,QAAQ,EAAE,OAAO;AACpD,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR,oBAAoB,OAAO,yBAAyB,OAAO;AAAA,QACzD,oBAAoB,QAAQ;AAAA,MAC9B,EAAE,KAAK,IAAI,CAAC;AAAA,IACd;AAAA,EACF;AACA,SAAO;AACT;;;AC7DO,IAAM,sBAAsB,CAAC,UAAkB,UAAU,iBAAqC,YAAoB;AACvH,QAAM,UAAU,mBAAmB;AAEnC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O;AACL,iBAAa,MAAM,iBAAiB,QAAS,YAAY,QAAQ,SAAU,gBAAgB,aAAa,WAAW;AAAA,EACrH;AACA,SAAO,gBAAgB;AAEvB,MAAI,mBAAmB,SAAS;AAC9B,WAAO,UAAU,aAAa,WAAW,eAAe;AAAA,EAC1D;AAGA,QAAM,oBAAoBC,MAAK,KAAK,YAAY,gBAAgB;AAChE,QAAM,0BAA0B,YAAY,KAAK,CAAC,MAAM,EAAE,SAAS,gBAAgB;AAGnF,MAAI,CAACC,IAAG,WAAW,iBAAiB,KAAK,yBAAyB,WAAW,aAAa;AACxF,IAAAA,IAAG,cAAc,mBAAmB,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAAA,EAC3D,WAAW,yBAAyB,WAAW,QAAQ;AACrD,YAAQ,IAAI,8DAAoD;AAAA,EAClE;AAGA,MAAI,CAAC,YAAY,mBAAmB;AAClC,gBAAY,UAAU;AAAA,EACxB;AACF;AAEA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAM,UAAU,KAAK;AAC7B,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["fs","path","prompts","fs","path","fs","fs","fs","fs","fs","prompts","fs","path","setupMCPServer","fs","fs","path","fs","path","fs","path","fs","path","execSync","prompts","path","fs"]}
|
|
1
|
+
{"version":3,"sources":["../src/utils/install-skill.ts","../src/index.ts","../src/utils/examples/create-example-app.ts","../src/utils/examples/templates/adapters.ts","../src/utils/examples/templates/app-index.ts","../src/utils/examples/templates/env.ts","../src/utils/examples/templates/package-setup.ts","../src/utils/file-merge.ts","../src/utils/types.ts","../src/utils/examples/templates/tsconfig.ts","../src/utils/examples/templates/animal-drawing-prompt.ts","../src/utils/examples/templates/customer-support-prompt.ts","../src/utils/examples/templates/party-planner-prompt.ts","../src/utils/examples/templates/story-teller-prompt.ts","../src/utils/examples/templates/datasets.ts","../src/utils/examples/templates/example-prompts.ts","../src/utils/examples/templates/user-client-config.ts","../src/utils/conflict-resolution.ts","../src/utils/examples/create-python-app.ts","../src/utils/project-detection.ts","../src/utils/package-manager.ts","../src/utils/git-init.ts"],"sourcesContent":["import { execFileSync } from \"child_process\";\n\n/**\n * Installs the AgentMark agent skill (https://github.com/agentmark-ai/skills)\n * into the freshly-scaffolded project. The vercel-labs/skills tool puts files\n * at `./.agents/skills/agentmark/` and symlinks them into per-tool paths\n * (Claude Code, Codex, Cursor, GitHub Copilot, +others) per the\n * agentskills.io 0.0.2 spec.\n *\n * Uses execFileSync (no shell) for safety. All arguments are hardcoded\n * literals; no user input is interpolated.\n *\n * Best-effort: if the install fails (no network, npx unavailable, etc.) we\n * log a warning and keep going. The skill is a nice-to-have on top of a\n * working AgentMark project, not a hard requirement.\n */\n/**\n * True when the helper should skip the network install. Set in test runs\n * so the OSS Parity CI suite doesn't hit `npx skills add` per scaffolder\n * test (each call clones the public skills repo, adding 10-30s/test).\n *\n * Detected via:\n * - VITEST=true (Vitest sets this automatically)\n * - NODE_ENV=test (broad convention; many runners set this)\n * - AGENTMARK_SKIP_SKILL_INSTALL=1 (explicit opt-out for any other context)\n */\nconst shouldSkip = (): boolean =>\n process.env.VITEST === \"true\" ||\n process.env.NODE_ENV === \"test\" ||\n process.env.AGENTMARK_SKIP_SKILL_INSTALL === \"1\";\n\nexport const installAgentmarkSkill = (targetPath: string): void => {\n if (shouldSkip()) {\n console.log(\"\\n⏭️ Skipping agent skill install (test environment detected).\");\n return;\n }\n try {\n console.log(\"\\n📚 Installing AgentMark agent skill...\");\n console.log(\" (teaches Claude Code / Codex / Cursor / Copilot how to use AgentMark)\");\n execFileSync(\n \"npx\",\n [\"--yes\", \"skills\", \"add\", \"agentmark-ai/skills\"],\n {\n cwd: targetPath,\n stdio: \"inherit\",\n },\n );\n console.log(\"✅ Agent skill installed at ./.agents/skills/agentmark/\");\n } catch (error) {\n console.warn(\n \"\\n⚠️ Could not install the AgentMark agent skill automatically.\",\n );\n console.warn(\" You can install it later with:\");\n console.warn(\" cd \" + targetPath);\n console.warn(\" npx skills add agentmark-ai/skills\");\n if (error instanceof Error) {\n console.warn(` Reason: ${error.message.split(\"\\n\")[0]}`);\n }\n }\n};\n","import fs from \"fs-extra\";\nimport path from \"path\";\nimport prompts from \"prompts\";\nimport { createExampleApp } from \"./utils/examples/create-example-app\";\nimport { createPythonApp } from \"./utils/examples/create-python-app\";\nimport { detectProjectInfo, isCurrentDirectory } from \"./utils/project-detection.js\";\nimport { displayProjectDetectionSummary, promptForResolutions } from \"./utils/conflict-resolution.js\";\nimport type { ProjectInfo, ConflictResolution } from \"./utils/types.js\";\nimport { initGitRepo } from \"./utils/git-init.js\";\n\ninterface CliArgs {\n path?: string;\n language?: \"typescript\" | \"python\";\n adapter?: string;\n deploymentMode?: \"cloud\" | \"static\";\n apiKey?: string;\n client?: string;\n overwrite?: boolean;\n}\n\nconst VALID_ADAPTERS_TS = [\"ai-sdk\", \"claude-agent-sdk\", \"mastra\"];\nconst VALID_ADAPTERS_PY = [\"pydantic-ai\", \"claude-agent-sdk\"];\nconst VALID_CLIENTS = [\"claude-code\", \"cursor\", \"vscode\", \"zed\", \"skip\"];\n\nconst parseArgs = (): CliArgs => {\n const args = process.argv.slice(2);\n const result: CliArgs = {};\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n switch (arg) {\n case \"--cloud\":\n result.deploymentMode = \"cloud\";\n break;\n case \"--self-host\":\n result.deploymentMode = \"static\";\n break;\n case \"--python\":\n result.language = \"python\";\n break;\n case \"--typescript\":\n result.language = \"typescript\";\n break;\n case \"--overwrite\":\n result.overwrite = true;\n break;\n case \"--path\":\n result.path = args[++i];\n break;\n case \"--adapter\":\n result.adapter = args[++i];\n break;\n case \"--api-key\":\n result.apiKey = args[++i];\n break;\n case \"--client\":\n result.client = args[++i];\n break;\n }\n }\n\n return result;\n};\n\nconst main = async () => {\n const cliArgs = parseArgs();\n const config: any = {\n $schema:\n \"https://raw.githubusercontent.com/agentmark-ai/agentmark/refs/heads/main/packages/cli/agentmark.schema.json\",\n version: \"2.0.0\",\n mdxVersion: \"1.0\",\n agentmarkPath: \".\",\n };\n console.log(\"Initializing project.\");\n\n // Folder name — from --path flag or prompt\n let folderName = cliArgs.path;\n if (!folderName) {\n const response = await prompts({\n name: \"folderName\",\n type: \"text\",\n message: \"Where would you like to create your AgentMark app?\",\n initial: \"my-agentmark-app\",\n });\n folderName = response.folderName;\n }\n\n // Determine target path - handle \".\" for current directory\n const isCurrentDir = isCurrentDirectory(folderName!);\n const targetPath = isCurrentDir ? process.cwd() : path.resolve(folderName!);\n\n // Create the target folder only if not using current directory\n if (!isCurrentDir) {\n fs.ensureDirSync(targetPath);\n }\n\n // Detect existing project\n const projectInfo: ProjectInfo = detectProjectInfo(targetPath);\n\n // Show detection summary if existing project found\n if (projectInfo.isExistingProject) {\n displayProjectDetectionSummary(projectInfo);\n }\n\n // Prompt for conflict resolutions if needed (--overwrite skips prompts)\n let resolutions: ConflictResolution[];\n if (cliArgs.overwrite) {\n resolutions = projectInfo.conflictingFiles.map((f) => ({\n path: f.path,\n action: \"overwrite\" as const,\n }));\n } else {\n resolutions = await promptForResolutions(projectInfo.conflictingFiles);\n }\n\n // Language selection — from flag or prompt\n let language = cliArgs.language;\n if (!language) {\n const response = await prompts({\n name: \"language\",\n type: \"select\",\n message: \"Which language would you like to use?\",\n choices: [\n { title: \"TypeScript\", value: \"typescript\" },\n { title: \"Python\", value: \"python\" },\n ],\n });\n language = response.language;\n }\n\n // Adapter selection — from flag or prompt\n let adapter = cliArgs.adapter;\n if (!adapter) {\n if (language === \"python\") {\n const response = await prompts({\n name: \"adapter\",\n type: \"select\",\n message: \"Which adapter would you like to use?\",\n choices: [\n { title: \"Pydantic AI\", value: \"pydantic-ai\" },\n { title: \"Claude Agent SDK\", value: \"claude-agent-sdk\" },\n ],\n });\n adapter = response.adapter;\n } else {\n const response = await prompts({\n name: \"adapter\",\n type: \"select\",\n message: \"Which adapter would you like to use?\",\n choices: [\n { title: \"AI SDK (Vercel)\", value: \"ai-sdk\" },\n { title: \"Claude Agent SDK\", value: \"claude-agent-sdk\" },\n { title: \"Mastra\", value: \"mastra\" },\n ],\n });\n adapter = response.adapter;\n }\n }\n\n // Validate adapter for the selected language\n const validAdapters = language === \"python\" ? VALID_ADAPTERS_PY : VALID_ADAPTERS_TS;\n if (!validAdapters.includes(adapter!)) {\n console.error(`Invalid adapter \"${adapter}\" for ${language}. Valid: ${validAdapters.join(\", \")}`);\n process.exit(1);\n }\n\n // API key — from flag or prompt\n let apiKey = cliArgs.apiKey ?? \"\";\n if (!cliArgs.apiKey && cliArgs.apiKey !== \"\") {\n const apiKeyName = adapter === 'claude-agent-sdk' ? 'Anthropic' : 'OpenAI';\n const { providedApiKey } = await prompts({\n name: \"providedApiKey\",\n type: \"password\",\n message: `Enter your ${apiKeyName} API key (or press Enter to skip):`,\n initial: \"\",\n });\n apiKey = providedApiKey || \"\";\n }\n\n // Deployment mode — from flag or prompt\n let deploymentMode = cliArgs.deploymentMode;\n if (!deploymentMode) {\n const response = await prompts({\n name: \"deploymentMode\",\n type: \"select\",\n message: \"Use AgentMark Cloud or manage yourself?\",\n choices: [\n {\n title: \"AgentMark Cloud (recommended)\",\n value: \"cloud\",\n description: \"Have AgentMark cloud manage prompts, datasets, traces, experiments, alerts & more\"\n },\n {\n title: \"Self-hosted\",\n value: \"static\",\n description: \"Self-manage your prompts, datasets, traces & experiments\"\n },\n ],\n });\n deploymentMode = response.deploymentMode;\n }\n\n // IDE client — from flag or prompt\n let client = cliArgs.client;\n if (!client) {\n const response = await prompts({\n name: \"client\",\n type: \"select\",\n message: \"Make your IDE an AgentMark expert\",\n choices: [\n { title: \"Claude Code\", value: \"claude-code\" },\n { title: \"Cursor\", value: \"cursor\" },\n { title: \"VS Code\", value: \"vscode\" },\n { title: \"Zed\", value: \"zed\" },\n { title: \"Skip\", value: \"skip\" },\n ],\n });\n client = response.client;\n }\n\n // Validate client\n if (!VALID_CLIENTS.includes(client!)) {\n console.error(`Invalid client \"${client}\". Valid: ${VALID_CLIENTS.join(\", \")}`);\n process.exit(1);\n }\n\n let usedModels: string[];\n if (language === \"python\") {\n usedModels = await createPythonApp(client!, targetPath, apiKey, deploymentMode, adapter!, projectInfo, resolutions);\n } else {\n usedModels = await createExampleApp(client!, targetPath, apiKey, adapter!, deploymentMode, projectInfo, resolutions);\n }\n config.builtInModels = usedModels;\n\n if (deploymentMode === \"cloud\") {\n config.handler = language === \"python\" ? \"handler.py\" : \"handler.ts\";\n }\n\n // Generate agentmark.json based on conflict resolution\n const agentmarkJsonPath = path.join(targetPath, \"agentmark.json\");\n const agentmarkJsonResolution = resolutions.find((r) => r.path === \"agentmark.json\");\n\n // Write agentmark.json if it doesn't exist or if user chose to overwrite\n if (!fs.existsSync(agentmarkJsonPath) || agentmarkJsonResolution?.action === \"overwrite\") {\n fs.writeJsonSync(agentmarkJsonPath, config, { spaces: 2 });\n } else if (agentmarkJsonResolution?.action === \"skip\") {\n console.log(\"⏭️ Skipped agentmark.json (keeping existing file)\");\n }\n\n // Initialize git repo after ALL files are written (including agentmark.json)\n if (!projectInfo.isExistingProject) {\n initGitRepo(targetPath);\n }\n};\n\nmain().catch((error) => {\n console.error(\"Error:\", error);\n process.exit(1);\n});\n","import fs from \"fs-extra\";\nimport * as path from \"path\";\nimport {\n setupPackageJson,\n installDependencies,\n getIndexFileContent,\n getTsConfigContent,\n getEnvFileContent,\n createExamplePrompts,\n getClientConfigContent,\n getAdapterConfig,\n} from \"./templates/index.js\";\nimport { fetchPromptsFrontmatter, generateTypeDefinitions } from \"@agentmark-ai/shared-utils\";\nimport { appendGitignore, appendEnv } from \"../file-merge.js\";\nimport { shouldMergeFile } from \"../conflict-resolution.js\";\nimport type { ProjectInfo, ConflictResolution } from \"../types.js\";\n\nconst setupMCPServer = (client: string, targetPath: string) => {\n if (client === \"skip\") {\n console.log(\"Skipping MCP server setup.\");\n return;\n }\n\n // Keep ./ prefix for display in messages\n const folderName = targetPath;\n\n // Handle VS Code\n if (client === \"vscode\") {\n try {\n console.log(`Setting up MCP server for VS Code in ${folderName}...`);\n const vscodeDir = path.join(targetPath, \".vscode\");\n fs.ensureDirSync(vscodeDir);\n\n const mcpConfig = {\n servers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n }\n }\n };\n\n fs.writeJsonSync(path.join(vscodeDir, \"mcp.json\"), mcpConfig, { spaces: 2 });\n console.log(`✅ MCP server configured for VS Code in ${folderName}/.vscode/mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for VS Code:`, error);\n console.log(\"See https://docs.agentmark.co/agentmark/further_reference/agentmark-mcp for setup instructions.\");\n }\n return;\n }\n\n // Handle Zed\n if (client === \"zed\") {\n try {\n console.log(`Setting up MCP server for Zed in ${folderName}...`);\n const zedDir = path.join(targetPath, \".zed\");\n fs.ensureDirSync(zedDir);\n\n const zedConfig = {\n context_servers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n }\n }\n };\n\n fs.writeJsonSync(path.join(zedDir, \"settings.json\"), zedConfig, { spaces: 2 });\n console.log(`✅ MCP server configured for Zed in ${folderName}/.zed/settings.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Zed:`, error);\n console.log(\"See https://docs.agentmark.co/agentmark/further_reference/agentmark-mcp for setup instructions.\");\n }\n return;\n }\n\n // Handle Cursor\n if (client === \"cursor\") {\n try {\n console.log(`Setting up MCP server for Cursor in ${folderName}...`);\n const cursorDir = path.join(targetPath, \".cursor\");\n fs.ensureDirSync(cursorDir);\n\n const cursorConfig = {\n mcpServers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n }\n }\n };\n\n fs.writeJsonSync(path.join(cursorDir, \"mcp.json\"), cursorConfig, { spaces: 2 });\n console.log(`✅ MCP server configured for Cursor in ${folderName}/.cursor/mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Cursor:`, error);\n console.log(\"See https://docs.agentmark.co/agentmark/further_reference/agentmark-mcp for setup instructions.\");\n }\n return;\n }\n\n // Handle Claude Code\n if (client === \"claude-code\") {\n try {\n console.log(`Setting up MCP server for Claude Code in ${folderName}...`);\n\n const mcpConfig = {\n mcpServers: {\n \"agentmark-docs\": {\n type: \"http\",\n url: \"https://docs.agentmark.co/mcp\"\n }\n }\n };\n\n fs.writeJsonSync(path.join(targetPath, \".mcp.json\"), mcpConfig, { spaces: 2 });\n console.log(`✅ MCP server configured for Claude Code in ${folderName}/.mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Claude Code:`, error);\n console.log(\"See https://docs.agentmark.co/agentmark/further_reference/agentmark-mcp for setup instructions.\");\n }\n return;\n }\n};\n\n\nexport const createExampleApp = async (\n client: string,\n targetPath: string = \".\",\n apiKey: string = \"\",\n adapter: string = \"ai-sdk\",\n deploymentMode: \"cloud\" | \"static\" = \"cloud\",\n projectInfo: ProjectInfo | null = null,\n resolutions: ConflictResolution[] = []\n): Promise<string[]> => {\n try {\n const modelProvider = adapter === 'claude-agent-sdk' ? 'anthropic' : 'openai';\n const model = adapter === 'claude-agent-sdk' ? 'anthropic/claude-sonnet-4-20250514' : 'openai/gpt-4o';\n const isExistingProject = projectInfo?.isExistingProject ?? false;\n\n if (isExistingProject) {\n console.log(\"Adding AgentMark to existing project...\");\n } else {\n console.log(\"Creating AgentMark example app...\");\n }\n\n // Keep ./ prefix for display in messages\n const folderName = targetPath;\n\n // Create directory structure\n fs.ensureDirSync(`${targetPath}/agentmark`);\n\n setupMCPServer(client, targetPath);\n\n // Create example prompts — returns the model IDs actually written\n const usedModels = createExamplePrompts(model, targetPath, adapter);\n console.log(`✅ Example prompts and datasets created in ${folderName}/agentmark/`);\n\n // Create user client config at project root\n // Prefer TS for dev ergonomics\n fs.writeFileSync(\n `${targetPath}/agentmark.client.ts`,\n getClientConfigContent({ provider: modelProvider, adapter, deploymentMode })\n );\n\n // Create or append to .gitignore FIRST so the `.env` rule is in place\n // before any secret values land on disk. `git init` runs at the very end\n // (see src/index.ts), so as long as .gitignore lists `.env` before .env\n // is written we're safe even if someone reshuffles steps later.\n // Note: .agentmark/ removed - dev-entry.ts is now at project root for version control\n const gitignoreEntries = ['node_modules/', '.env', '*.agentmark-outputs/', 'dist/'];\n if (shouldMergeFile('.gitignore', projectInfo, resolutions)) {\n const result = appendGitignore(targetPath, gitignoreEntries);\n if (result.added.length > 0) {\n console.log(`✅ Added to .gitignore: ${result.added.join(', ')}`);\n }\n if (result.skipped.length > 0) {\n console.log(`⏭️ Already in .gitignore: ${result.skipped.join(', ')}`);\n }\n } else {\n const gitignore = gitignoreEntries.join('\\n');\n fs.writeFileSync(`${targetPath}/.gitignore`, gitignore);\n }\n\n // Create or append to .env file (after .gitignore is in place)\n if (shouldMergeFile('.env', projectInfo, resolutions)) {\n const envVars: Record<string, string> = {};\n const apiKeyEnvVar = adapter === 'claude-agent-sdk' ? 'ANTHROPIC_API_KEY' : 'OPENAI_API_KEY';\n if (apiKey) {\n envVars[apiKeyEnvVar] = apiKey;\n } else {\n envVars[apiKeyEnvVar] = adapter === 'claude-agent-sdk' ? 'your-anthropic-api-key' : 'your-openai-api-key';\n }\n if (deploymentMode === 'cloud') {\n envVars['AGENTMARK_API_KEY'] = 'your_agentmark_api_key';\n envVars['AGENTMARK_APP_ID'] = 'your_agentmark_app_id';\n }\n const result = appendEnv(targetPath, envVars);\n if (result.added.length > 0) {\n console.log(`✅ Added to .env: ${result.added.join(', ')}`);\n }\n if (result.skipped.length > 0) {\n console.log(`⏭️ Skipped existing .env vars: ${result.skipped.join(', ')}`);\n }\n } else {\n fs.writeFileSync(`${targetPath}/.env`, getEnvFileContent(modelProvider, apiKey, adapter, deploymentMode));\n }\n\n // Create the main application file (skip for existing projects)\n if (!isExistingProject) {\n fs.writeFileSync(\n `${targetPath}/index.ts`,\n getIndexFileContent(adapter, deploymentMode)\n );\n } else {\n console.log(\"⏭️ Skipped index.ts (existing project)\");\n }\n\n // Create tsconfig.json (skip for existing projects)\n if (!isExistingProject) {\n fs.writeJsonSync(`${targetPath}/tsconfig.json`, getTsConfigContent(), { spaces: 2 });\n } else {\n console.log(\"⏭️ Skipped tsconfig.json (existing project)\");\n }\n\n // Setup package.json and install dependencies\n const packageManager = projectInfo?.packageManager ?? null;\n setupPackageJson(targetPath, deploymentMode, projectInfo);\n installDependencies(modelProvider, targetPath, adapter, deploymentMode, packageManager);\n\n // Generate types file using the type generation library\n console.log(\"Generating types from prompts...\");\n try {\n const agentmarkDir = path.join(targetPath, 'agentmark');\n const prompts = await fetchPromptsFrontmatter({ rootDir: agentmarkDir });\n const typeDefinitions = await generateTypeDefinitions(prompts);\n fs.writeFileSync(`${targetPath}/agentmark.types.ts`, typeDefinitions);\n } catch (error) {\n console.warn(\"Warning: Could not generate types automatically:\", error);\n console.log(\"You can generate types later by running: npx agentmark generate-types --root-dir agentmark\");\n // Create a placeholder types file\n fs.writeFileSync(`${targetPath}/agentmark.types.ts`, `// Auto-generated types from AgentMark\\n// Run 'npx agentmark generate-types --root-dir agentmark' to generate types\\nexport default interface AgentmarkTypes {}\\n`);\n }\n\n // Create handler.ts for cloud deployments (managed code execution)\n if (deploymentMode === \"cloud\") {\n const handlerAdapterConfig = getAdapterConfig(adapter, modelProvider);\n const { webhookHandler: handlerClass } = handlerAdapterConfig.classes;\n\n const handlerContent = `import { ${handlerClass} } from '${handlerAdapterConfig.package}/runner';\nimport { AgentMarkSDK } from '@agentmark-ai/sdk';\nimport { client } from './agentmark.client';\n\n// Initialize tracing — sends traces to AgentMark Cloud\nconst sdk = new AgentMarkSDK({\n apiKey: process.env.AGENTMARK_API_KEY ?? '',\n appId: process.env.AGENTMARK_APP_ID ?? '',\n baseUrl: process.env.AGENTMARK_BASE_URL,\n});\nsdk.initTracing({ disableBatch: true });\n\nconst adapter = new ${handlerClass}(client as any);\n\nexport default async function handler(request: {\n type: 'prompt-run' | 'dataset-run' | 'get-evals';\n data: {\n ast?: any;\n customProps?: Record<string, unknown>;\n options?: { shouldStream?: boolean };\n experimentId?: string;\n datasetPath?: string;\n };\n}) {\n if (request.type === 'get-evals') {\n return {\n type: 'evals',\n result: JSON.stringify(Object.keys(client.getEvalRegistry())),\n traceId: '',\n };\n }\n\n if (request.type === 'prompt-run') {\n return adapter.runPrompt(request.data.ast, {\n shouldStream: request.data.options?.shouldStream,\n customProps: request.data.customProps,\n });\n }\n\n if (request.type === 'dataset-run') {\n return adapter.runExperiment(\n request.data.ast,\n request.data.experimentId ?? '',\n request.data.datasetPath,\n );\n }\n\n throw new Error(\\`Unknown request type: \\${request.type}\\`);\n}\n`;\n\n const handlerPath = path.join(targetPath, 'handler.ts');\n if (fs.existsSync(handlerPath)) {\n console.log(\"⏭️ Skipped handler.ts (already exists - preserving customizations)\");\n } else {\n fs.writeFileSync(handlerPath, handlerContent);\n console.log(`✅ Created handler.ts for cloud deployment`);\n }\n }\n\n // Create dev-entry.ts at project root (version controlled)\n console.log(\"Creating development server entry point...\");\n\n // Get adapter-specific values from config\n const adapterConfig = getAdapterConfig(adapter, modelProvider);\n const { webhookHandler } = adapterConfig.classes;\n\n const devEntryPath = path.join(targetPath, 'dev-entry.ts');\n\n const devEntryContent = `// Development webhook server entry point\n// This file is version controlled - customize as needed for your project\n\nimport { createWebhookServer } from '@agentmark-ai/cli/runner-server';\nimport { ${webhookHandler} } from '${adapterConfig.package}/runner';\nimport { AgentMarkSDK } from '@agentmark-ai/sdk';\nimport path from 'path';\n\nasync function main() {\n const args = process.argv.slice(2);\n const webhookPortArg = args.find(arg => arg.startsWith('--webhook-port='));\n const apiServerPortArg = args.find(arg => arg.startsWith('--api-server-port='));\n\n const webhookPort = webhookPortArg ? parseInt(webhookPortArg.split('=')[1]) : 9417;\n const apiServerPort = apiServerPortArg ? parseInt(apiServerPortArg.split('=')[1]) : 9418;\n const apiServerUrl = \\`http://localhost:\\${apiServerPort}\\`;\n\n // Set environment for development mode before importing client\n process.env.NODE_ENV = 'development';\n process.env.AGENTMARK_BASE_URL = apiServerUrl;\n\n // Now import client - it will pick up the dev environment\n const { client } = await import('./agentmark.client.js');\n\n // Initialize OpenTelemetry tracing to export traces to the API server\n const sdk = new AgentMarkSDK({\n apiKey: '',\n appId: '',\n baseUrl: apiServerUrl,\n });\n sdk.initTracing({ disableBatch: true });\n\n const handler = new ${webhookHandler}(client as any);\n const templatesDirectory = path.join(process.cwd(), 'agentmark');\n\n await createWebhookServer({\n port: webhookPort,\n handler,\n apiServerUrl,\n templatesDirectory\n });\n}\n\nmain().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n`;\n\n // Only create dev-entry.ts if it doesn't exist (preserve existing customizations - FR-003)\n if (fs.existsSync(devEntryPath)) {\n console.log(\"⏭️ Skipped dev-entry.ts (already exists - preserving customizations)\");\n } else {\n fs.writeFileSync(devEntryPath, devEntryContent);\n console.log(`✅ Created dev-entry.ts at project root`);\n }\n\n // Install the AgentMark agent skill so this project's agents\n // (Claude Code, Codex, Cursor, Copilot, etc.) know how to use AgentMark.\n // Best-effort — failures are logged and do not break bootstrap.\n const { installAgentmarkSkill } = await import(\"../install-skill\");\n installAgentmarkSkill(targetPath);\n\n // Success message\n console.log(\"\\n✅ Agentmark initialization completed successfully!\");\n\n console.log(\n `\n █████╗ ██████╗ ███████╗███╗ ██╗████████╗███╗ ███╗ █████╗ ██████╗ ██╗ ██╗\n██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝████╗ ████║██╔══██╗██╔══██╗██║ ██╔╝\n███████║██║ ███╗█████╗ ██╔██╗ ██║ ██║ ██╔████╔██║███████║██████╔╝█████╔╝\n██╔══██║██║ ██║██╔══╝ ██║╚██╗██║ ██║ ██║╚██╔╝██║██╔══██║██╔══██╗██╔═██╗\n██║ ██║╚██████╔╝███████╗██║ ╚████║ ██║ ██║ ╚═╝ ██║██║ ██║██║ ██║██║ ██╗\n╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝\n\n `\n );\n\n console.log('\\n' + '═'.repeat(70));\n console.log('Next Steps');\n console.log('═'.repeat(70));\n\n console.log('\\n Get Started:');\n if (folderName !== \".\" && folderName !== \"./\" && !isExistingProject) {\n console.log(` $ cd ${folderName}`);\n }\n console.log(` $ npx agentmark dev\\n`);\n\n console.log('─'.repeat(70));\n console.log('Resources');\n console.log('─'.repeat(70));\n console.log(' Documentation: https://docs.agentmark.co');\n console.log('═'.repeat(70) + '\\n');\n\n return usedModels;\n } catch (error) {\n console.error(\"Error creating example app:\", error);\n throw error;\n }\n};\n","export interface AdapterConfig {\n /** npm package name for the adapter */\n package: string;\n /** Additional npm packages required by this adapter */\n dependencies: string[];\n /** Class names used in generated code */\n classes: {\n modelRegistry: string;\n webhookHandler: string;\n };\n}\n\nexport const createAdapterConfig = (\n provider: string\n): Record<string, AdapterConfig> => {\n return {\n \"ai-sdk\": {\n package: \"@agentmark-ai/ai-sdk-v5-adapter\",\n dependencies: [\"ai@^5\", `@ai-sdk/${provider}@^2`],\n classes: {\n modelRegistry: \"VercelAIModelRegistry\",\n webhookHandler: \"VercelAdapterWebhookHandler\",\n },\n },\n mastra: {\n package: \"@agentmark-ai/mastra-v0-adapter\",\n dependencies: [\n \"@mastra/core@<0.20.0\",\n \"@mastra/mcp@<0.13.4\",\n `@ai-sdk/${provider}@<2`,\n \"ai@^4\",\n ],\n classes: {\n modelRegistry: \"MastraModelRegistry\",\n webhookHandler: \"MastraAdapterWebhookHandler\",\n },\n },\n \"claude-agent-sdk\": {\n package: \"@agentmark-ai/claude-agent-sdk-v0-adapter\",\n dependencies: [\"@anthropic-ai/claude-agent-sdk@^0.1.0\"],\n classes: {\n modelRegistry: \"ClaudeAgentModelRegistry\",\n webhookHandler: \"ClaudeAgentWebhookHandler\",\n },\n },\n };\n};\n\nexport function getAdapterConfig(\n adapter: string,\n provider: string\n): AdapterConfig {\n const config = createAdapterConfig(provider)[adapter];\n if (!config) {\n throw new Error(\n `Unknown adapter: ${adapter}. Available adapters: ${Object.keys(\n createAdapterConfig(provider)\n ).join(\", \")}`\n );\n }\n return config;\n}\n","export const getIndexFileContent = (adapter: string = \"ai-sdk\", deploymentMode: \"cloud\" | \"static\" = \"cloud\"): string => {\n const isCloud = deploymentMode === \"cloud\";\n\n const tracingImport = `import { AgentMarkSDK } from \"@agentmark-ai/sdk\";\n`;\n\n const cloudTracingInit = `\n// Initialize tracing - traces will be sent to AgentMark Cloud\n// To disable tracing, comment out sdk.initTracing() below\nconst sdk = new AgentMarkSDK({\n apiKey: process.env.AGENTMARK_API_KEY ?? \"\",\n appId: process.env.AGENTMARK_APP_ID ?? \"\",\n});\nsdk.initTracing({ disableBatch: true });\n`;\n\n const staticTracingInit = `\n// Initialize tracing - traces will be sent to local dev server\n// Make sure to run \"npx agentmark dev\" in another terminal first\n// To disable tracing, comment out sdk.initTracing() below\nconst sdk = new AgentMarkSDK({\n apiKey: \"\",\n appId: \"\",\n baseUrl: \"http://localhost:9418\",\n});\nsdk.initTracing({ disableBatch: true });\n`;\n\n const tracingInit = isCloud ? cloudTracingInit : staticTracingInit;\n\n if (adapter === \"claude-agent-sdk\") {\n return `import \"dotenv/config\";\nimport { query } from \"@anthropic-ai/claude-agent-sdk\";\nimport { withTracing } from \"@agentmark-ai/claude-agent-sdk-v0-adapter\";\n${tracingImport}import { client } from \"./agentmark.client\";\n${tracingInit}\nconst telemetry = {\n isEnabled: true,\n metadata: {\n trace_name: \"customer-support\",\n user_id: \"user-123\",\n session_id: \"session-123\",\n session_name: \"my-first-session\",\n },\n};\n\nconst runCustomerSupport = async (customer_message: string) => {\n const prompt = await client.loadTextPrompt(\"customer-support-agent\");\n const adapted = await prompt.format({\n props: {\n customer_question: customer_message,\n },\n telemetry,\n });\n\n // Execute with Claude Agent SDK using withTracing for telemetry\n // The adapted object contains { query, telemetry } ready for withTracing()\n const tracedResult = await withTracing(query, adapted);\n\n // traceId is available immediately\n console.log(\"Trace ID:\", tracedResult.traceId);\n\n let result = \"\";\n for await (const message of tracedResult) {\n if (message.type === \"result\" && message.subtype === \"success\") {\n result = message.result || \"\";\n }\n }\n\n return result;\n};\n\nconst main = async () => {\n try {\n const user_message = \"How long does shipping take?\";\n const assistant = await runCustomerSupport(user_message);\n console.log(\"Customer support response:\", assistant);\n } catch (error) {\n console.error(error);\n }\n};\n\nmain();\n`;\n } else if (adapter === \"mastra\") {\n return `import \"dotenv/config\";\nimport { Agent } from \"@mastra/core/agent\";\n${tracingImport}import { client } from \"./agentmark.client\";\n${tracingInit}\nconst telemetry = {\n isEnabled: true,\n metadata: {\n trace_name: \"customer-support\",\n user_id: \"user-123\",\n session_id: \"session-123\",\n session_name: \"my-first-session\",\n },\n};\n\nconst runCustomerSupport = async (customer_message: string) => {\n const prompt = await client.loadTextPrompt(\"customer-support-agent\");\n const agentConfig = await prompt.formatAgent({\n options: {\n telemetry,\n },\n });\n\n const [messages, generateOptions] = await agentConfig.formatMessages({\n props: {\n customer_question: customer_message,\n },\n });\n\n const agent = new Agent(agentConfig);\n const response = await agent.generate(messages, generateOptions);\n\n return (response as any).text || (response as any).content || String(response);\n};\n\nconst main = async () => {\n try {\n const user_message = \"How long does shipping take?\";\n const assistant = await runCustomerSupport(user_message);\n console.log(\"Customer support response:\", assistant);\n } catch (error) {\n console.error(error);\n }\n};\n\nmain();\n`;\n } else {\n return `import \"dotenv/config\";\nimport { generateText } from \"ai\";\n${tracingImport}import { client } from \"./agentmark.client\";\n${tracingInit}\nconst telemetry = {\n isEnabled: true,\n metadata: {\n trace_name: \"customer-support\",\n user_id: \"user-123\",\n session_id: \"session-123\",\n session_name: \"my-first-session\",\n },\n};\n\nconst runCustomerSupport = async (customer_message: string) => {\n const prompt = await client.loadTextPrompt(\"customer-support-agent\");\n const vercelInput = await prompt.format({\n props: {\n customer_question: customer_message,\n },\n telemetry,\n });\n\n const resp = await generateText(vercelInput);\n\n return resp.text;\n};\n\nconst main = async () => {\n try {\n const user_message = \"How long does shipping take?\";\n const assistant = await runCustomerSupport(user_message);\n console.log(\"Customer support response:\", assistant);\n } catch (error) {\n console.error(error);\n }\n};\n\nmain();\n`;\n }\n};\n","export const getEnvFileContent = (\n _modelProvider: string,\n apiKey: string = '',\n adapter: string = 'ai-sdk',\n deploymentMode: 'cloud' | 'static' = 'cloud'\n): string => {\n const apiKeyValue = apiKey || 'your_api_key_here';\n\n // Use ANTHROPIC_API_KEY for claude-agent-sdk adapter\n const apiKeyName = adapter === 'claude-agent-sdk' ? 'ANTHROPIC_API_KEY' : 'OPENAI_API_KEY';\n\n const cloudEnvVars = deploymentMode === 'cloud'\n ? `\n# AgentMark Cloud — required for managed deployments\nAGENTMARK_API_KEY=your_agentmark_api_key\nAGENTMARK_APP_ID=your_agentmark_app_id\n`\n : `\n# Cloud deployment: Set these environment variables\n# AGENTMARK_BASE_URL=https://api.agentmark.co\n# AGENTMARK_API_KEY=your_agentmark_api_key\n# AGENTMARK_APP_ID=your_agentmark_app_id\n`;\n\n return `${apiKeyName}=${apiKeyValue}\n${cloudEnvVars}\n# Learn more: https://docs.agentmark.co/getting-started/quickstart\n`;\n};\n","import fs from \"fs-extra\";\nimport { execSync } from \"child_process\";\nimport { getAdapterConfig } from \"./adapters.js\";\nimport { mergePackageJson } from \"../../file-merge.js\";\nimport { DEFAULT_PACKAGE_MANAGER } from \"../../types.js\";\nimport type { ProjectInfo, PackageManagerConfig } from \"../../types.js\";\n\nexport const setupPackageJson = (\n targetPath: string = \".\",\n deploymentMode: \"cloud\" | \"static\" = \"cloud\",\n projectInfo: ProjectInfo | null = null\n) => {\n const packageJsonPath = `${targetPath}/package.json`;\n const isExistingProject = projectInfo?.isExistingProject ?? false;\n\n if (!fs.existsSync(packageJsonPath)) {\n console.log(\"Creating package.json...\");\n execSync(\"npm init -y\", { cwd: targetPath });\n }\n\n // In static/self-hosted mode the demo runs index.ts which uses FileLoader\n // against ./dist/agentmark — those compiled prompts only exist after\n // `agentmark build`. Prefix the demo script so a fresh `npm run demo`\n // succeeds without users having to discover the build step manually.\n // Cloud mode hits the API directly, so no build is needed.\n const demoScript =\n deploymentMode === \"static\"\n ? \"npx agentmark build --out dist/agentmark && npx tsx index.ts\"\n : \"npx tsx index.ts\";\n\n // For existing projects, use merge logic\n if (isExistingProject && fs.existsSync(packageJsonPath)) {\n // Build scripts to add - with namespacing for conflicts\n const scriptsToAdd: Record<string, string> = {\n \"demo\": demoScript,\n \"agentmark\": \"agentmark\",\n };\n\n if (deploymentMode === \"static\") {\n scriptsToAdd[\"build\"] = \"agentmark build --out dist/agentmark\";\n }\n\n // Use mergePackageJson for existing projects\n const result = mergePackageJson(targetPath, {}, {}, scriptsToAdd);\n\n if (result.added.length > 0) {\n console.log(`✅ Added to package.json: ${result.added.join(', ')}`);\n }\n if (result.skipped.length > 0) {\n console.log(`⏭️ Skipped existing in package.json: ${result.skipped.join(', ')}`);\n }\n if (result.warnings.length > 0) {\n result.warnings.forEach((w) => console.log(`⚠️ ${w}`));\n }\n } else {\n // Update the created package.json with additional information\n const pkgJson = fs.readJsonSync(packageJsonPath);\n pkgJson.name =\n pkgJson.name === \"test\" || !pkgJson.name\n ? \"agentmark-example-app\"\n : pkgJson.name;\n pkgJson.description =\n pkgJson.description || \"A simple Node.js app using the Agentmark SDK\";\n\n // `npm init -y` writes \"type\": \"commonjs\". With tsconfig set to NodeNext,\n // dev-entry.ts uses `await import('./agentmark.client.js')` (NodeNext\n // requires the .js extension). Plain node would fail to resolve the .js\n // path because no compiled .js exists alongside the .ts. Drop the field\n // so node falls back to its default CJS interpretation, and let tsx\n // (which the dev/demo scripts use) do extension resolution.\n if (pkgJson.type === \"commonjs\") {\n delete pkgJson.type;\n }\n\n // Base scripts for all modes\n const scripts: Record<string, string> = {\n ...pkgJson.scripts,\n \"demo\": demoScript,\n \"agentmark\": \"agentmark\",\n };\n\n // For static/self-hosted mode, add the build script\n if (deploymentMode === \"static\") {\n scripts[\"build\"] = \"agentmark build --out dist/agentmark\";\n }\n\n pkgJson.scripts = scripts;\n\n fs.writeJsonSync(packageJsonPath, pkgJson, { spaces: 2 });\n }\n};\n\nexport const installDependencies = (\n modelProvider: string,\n targetPath: string = \".\",\n adapter: string = \"ai-sdk\",\n deploymentMode: \"cloud\" | \"static\" = \"cloud\",\n packageManager: PackageManagerConfig | null = null\n) => {\n console.log(\"Installing required packages...\");\n console.log(\"This might take a moment...\");\n\n const adapterConfig = getAdapterConfig(adapter, modelProvider);\n\n // Use detected package manager or default to npm\n const pm = packageManager || DEFAULT_PACKAGE_MANAGER;\n\n // npm needs --legacy-peer-deps due to some transitive dependency conflicts\n const npmSuffix = pm.name === 'npm' ? ' --legacy-peer-deps' : '';\n\n try {\n // Dev dependencies to install\n const devDeps = ['typescript', 'ts-node', '@types/node', '@agentmark-ai/cli'];\n\n // Install dev dependencies using detected package manager config\n const devDepsCmd = `${pm.addDevCmd} ${devDeps.join(' ')}${npmSuffix}`;\n\n console.log(`Using ${pm.name} to install dependencies...`);\n\n execSync(devDepsCmd, {\n stdio: \"inherit\",\n cwd: targetPath,\n });\n\n // Install the common packages\n // SDK is required for both local (connects to agentmark serve) and cloud (connects to API)\n // Loader packages are imported directly - ApiLoader always needed, FileLoader only for static mode\n const loaderPackages = deploymentMode === \"static\"\n ? [\"@agentmark-ai/loader-api\", \"@agentmark-ai/loader-file\"]\n : [\"@agentmark-ai/loader-api\"];\n\n const deps = [\n \"dotenv\",\n \"@agentmark-ai/prompt-core\",\n \"@agentmark-ai/sdk\",\n adapterConfig.package,\n ...loaderPackages,\n ...adapterConfig.dependencies,\n ];\n\n // Install regular dependencies using detected package manager config\n const depsCmd = `${pm.addCmd} ${deps.join(' ')}${npmSuffix}`;\n\n execSync(depsCmd, { stdio: \"inherit\", cwd: targetPath });\n\n console.log(\"Packages installed successfully!\");\n } catch (error) {\n console.error(\"Error installing packages:\", error);\n throw new Error(\n \"Failed to install required packages. Please check your network connection and try again.\"\n );\n }\n};\n","/**\n * File merge utilities for handling existing files during initialization.\n * Supports merging package.json, appending to .gitignore and .env files.\n */\n\nimport fs from 'fs-extra';\nimport path from 'path';\nimport type { MergeResult } from './types.js';\n\n/**\n * Merge AgentMark dependencies and scripts into an existing package.json.\n * Preserves all existing content, only adds missing AgentMark entries.\n */\nexport function mergePackageJson(\n targetPath: string,\n agentmarkDeps: Record<string, string>,\n agentmarkDevDeps: Record<string, string>,\n agentmarkScripts: Record<string, string>\n): MergeResult {\n const packageJsonPath = path.join(targetPath, 'package.json');\n const result: MergeResult = {\n success: false,\n warnings: [],\n added: [],\n skipped: [],\n };\n\n try {\n // Read existing package.json\n if (!fs.existsSync(packageJsonPath)) {\n result.warnings.push('No existing package.json found');\n return result;\n }\n\n const existing = fs.readJsonSync(packageJsonPath) as Record<string, unknown>;\n\n // Initialize sections if they don't exist\n if (!existing.dependencies) {\n existing.dependencies = {};\n }\n if (!existing.devDependencies) {\n existing.devDependencies = {};\n }\n if (!existing.scripts) {\n existing.scripts = {};\n }\n\n const deps = existing.dependencies as Record<string, string>;\n const devDeps = existing.devDependencies as Record<string, string>;\n const scripts = existing.scripts as Record<string, string>;\n\n // Add AgentMark dependencies (only if not already present)\n for (const [pkg, version] of Object.entries(agentmarkDeps)) {\n if (deps[pkg]) {\n result.skipped.push(`dependency: ${pkg} (already exists)`);\n } else {\n deps[pkg] = version;\n result.added.push(`dependency: ${pkg}@${version}`);\n }\n }\n\n // Add AgentMark devDependencies (only if not already present)\n for (const [pkg, version] of Object.entries(agentmarkDevDeps)) {\n if (devDeps[pkg]) {\n result.skipped.push(`devDependency: ${pkg} (already exists)`);\n } else {\n devDeps[pkg] = version;\n result.added.push(`devDependency: ${pkg}@${version}`);\n }\n }\n\n // Add AgentMark scripts (use namespace if conflict exists)\n for (const [scriptName, scriptCmd] of Object.entries(agentmarkScripts)) {\n if (scripts[scriptName]) {\n // Conflict - use namespaced script name\n const namespacedName = `agentmark:${scriptName}`;\n if (scripts[namespacedName]) {\n // Both the original and namespaced version exist - skip with warning\n result.skipped.push(`script: ${scriptName}`);\n result.warnings.push(\n `Script \"${scriptName}\" and \"${namespacedName}\" both already exist. Skipping.`\n );\n } else {\n scripts[namespacedName] = scriptCmd;\n result.added.push(`script: ${namespacedName} (namespaced due to conflict)`);\n result.warnings.push(\n `Script \"${scriptName}\" already exists. Added as \"${namespacedName}\" instead.`\n );\n }\n } else {\n scripts[scriptName] = scriptCmd;\n result.added.push(`script: ${scriptName}`);\n }\n }\n\n // Write merged package.json\n fs.writeJsonSync(packageJsonPath, existing, { spaces: 2 });\n\n result.success = true;\n result.content = JSON.stringify(existing, null, 2);\n return result;\n } catch (error) {\n result.warnings.push(`Error merging package.json: ${error}`);\n return result;\n }\n}\n\n/**\n * Append AgentMark entries to an existing .gitignore file.\n * Checks for duplicates before adding.\n */\nexport function appendGitignore(targetPath: string, entries: string[]): MergeResult {\n const gitignorePath = path.join(targetPath, '.gitignore');\n const result: MergeResult = {\n success: false,\n warnings: [],\n added: [],\n skipped: [],\n };\n\n try {\n let existingContent = '';\n\n if (fs.existsSync(gitignorePath)) {\n existingContent = fs.readFileSync(gitignorePath, 'utf-8');\n }\n\n // Parse existing entries (normalize trailing slashes)\n const existingEntries = new Set(\n existingContent\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line && !line.startsWith('#'))\n .map((line) => line.replace(/\\/$/, '')) // Remove trailing slashes for comparison\n );\n\n const entriesToAdd: string[] = [];\n\n for (const entry of entries) {\n const normalizedEntry = entry.replace(/\\/$/, '');\n if (existingEntries.has(normalizedEntry)) {\n result.skipped.push(entry);\n } else {\n entriesToAdd.push(entry);\n result.added.push(entry);\n }\n }\n\n if (entriesToAdd.length > 0) {\n // Add a header comment and the new entries\n let newContent = existingContent;\n\n // Ensure file ends with newline\n if (newContent && !newContent.endsWith('\\n')) {\n newContent += '\\n';\n }\n\n // Add blank line if file has content\n if (newContent.trim()) {\n newContent += '\\n';\n }\n\n newContent += '# AgentMark\\n';\n newContent += entriesToAdd.join('\\n');\n newContent += '\\n';\n\n fs.writeFileSync(gitignorePath, newContent);\n result.content = newContent;\n }\n\n result.success = true;\n return result;\n } catch (error) {\n result.warnings.push(`Error appending to .gitignore: ${error}`);\n return result;\n }\n}\n\n/**\n * Append AgentMark environment variables to an existing .env file.\n * Does not overwrite existing keys.\n */\nexport function appendEnv(\n targetPath: string,\n envVars: Record<string, string>\n): MergeResult {\n const envPath = path.join(targetPath, '.env');\n const result: MergeResult = {\n success: false,\n warnings: [],\n added: [],\n skipped: [],\n };\n\n try {\n let existingContent = '';\n\n if (fs.existsSync(envPath)) {\n existingContent = fs.readFileSync(envPath, 'utf-8');\n }\n\n // Parse existing keys\n const existingKeys = new Set<string>();\n const lines = existingContent.split('\\n');\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed && !trimmed.startsWith('#')) {\n const match = trimmed.match(/^([^=]+)=/);\n if (match && match[1]) {\n existingKeys.add(match[1]);\n }\n }\n }\n\n const varsToAdd: Array<[string, string]> = [];\n\n for (const [key, value] of Object.entries(envVars)) {\n if (existingKeys.has(key)) {\n result.skipped.push(key);\n } else {\n varsToAdd.push([key, value]);\n result.added.push(key);\n }\n }\n\n if (varsToAdd.length > 0) {\n let newContent = existingContent;\n\n // Ensure file ends with newline\n if (newContent && !newContent.endsWith('\\n')) {\n newContent += '\\n';\n }\n\n // Add blank line if file has content\n if (newContent.trim()) {\n newContent += '\\n';\n }\n\n newContent += '# AgentMark\\n';\n for (const [key, value] of varsToAdd) {\n newContent += `${key}=${value}\\n`;\n }\n\n fs.writeFileSync(envPath, newContent);\n result.content = newContent;\n }\n\n result.success = true;\n return result;\n } catch (error) {\n result.warnings.push(`Error appending to .env: ${error}`);\n return result;\n }\n}\n\n/**\n * Check if a file should be skipped based on existing project detection.\n * Used for files like index.ts that should never be generated in existing projects.\n */\nexport function shouldSkipFile(\n fileName: string,\n isExistingProject: boolean,\n skipFiles: string[]\n): boolean {\n if (!isExistingProject) {\n return false;\n }\n return skipFiles.includes(fileName);\n}\n","/**\n * Type definitions for existing repository initialization.\n * These types support project detection, conflict resolution, and package manager handling.\n */\n\n/** Supported package managers for TypeScript projects */\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\n/** Configuration for a specific package manager */\nexport interface PackageManagerConfig {\n /** Package manager name */\n name: PackageManager;\n /** Lock file that indicates this package manager is in use */\n lockFile: string;\n /** Command to install all dependencies */\n installCmd: string;\n /** Command to add a production dependency */\n addCmd: string;\n /** Command to add a dev dependency */\n addDevCmd: string;\n /** Command prefix for running scripts (e.g., 'npm run', 'yarn') */\n runCmd: string;\n}\n\n/** Package manager configurations indexed by lock file name */\nexport const PACKAGE_MANAGERS: Record<string, PackageManagerConfig> = {\n 'yarn.lock': {\n name: 'yarn',\n lockFile: 'yarn.lock',\n installCmd: 'yarn install',\n addCmd: 'yarn add',\n addDevCmd: 'yarn add --dev',\n runCmd: 'yarn',\n },\n 'pnpm-lock.yaml': {\n name: 'pnpm',\n lockFile: 'pnpm-lock.yaml',\n installCmd: 'pnpm install',\n addCmd: 'pnpm add',\n addDevCmd: 'pnpm add --save-dev',\n runCmd: 'pnpm',\n },\n 'bun.lockb': {\n name: 'bun',\n lockFile: 'bun.lockb',\n installCmd: 'bun install',\n addCmd: 'bun add',\n addDevCmd: 'bun add --dev',\n runCmd: 'bun run',\n },\n 'package-lock.json': {\n name: 'npm',\n lockFile: 'package-lock.json',\n installCmd: 'npm install',\n addCmd: 'npm install',\n addDevCmd: 'npm install --save-dev',\n runCmd: 'npm run',\n },\n};\n\n/** Default package manager when no lock file is found */\nexport const DEFAULT_PACKAGE_MANAGER: PackageManagerConfig = PACKAGE_MANAGERS['package-lock.json']!;\n\n/** Information about a detected Python virtual environment */\nexport interface PythonVenvInfo {\n /** Absolute path to the venv directory */\n path: string;\n /** Relative name (e.g., '.venv' or 'venv') */\n name: string;\n /** Platform-specific activate command */\n activateCmd: string;\n /** Platform-specific pip path */\n pipPath: string;\n}\n\n/** Type of file for determining merge strategy */\nexport type FileType = 'config' | 'source' | 'directory' | 'dotfile';\n\n/** Resolution strategy for a conflicting file */\nexport type ConflictStrategy = 'merge' | 'append' | 'prompt' | 'skip';\n\n/** Represents a file that may conflict with AgentMark initialization */\nexport interface ConflictFile {\n /** Relative path from project root */\n path: string;\n /** Type of file for determining merge strategy */\n type: FileType;\n /** Recommended resolution strategy */\n strategy: ConflictStrategy;\n}\n\n/** Files that may conflict with AgentMark initialization */\nexport const CONFLICT_FILES: ConflictFile[] = [\n { path: 'agentmark.json', type: 'config', strategy: 'prompt' },\n { path: 'agentmark', type: 'directory', strategy: 'prompt' },\n { path: 'agentmark.client.ts', type: 'source', strategy: 'prompt' },\n { path: 'agentmark_client.py', type: 'source', strategy: 'prompt' },\n { path: '.gitignore', type: 'dotfile', strategy: 'append' },\n { path: '.env', type: 'dotfile', strategy: 'append' },\n { path: 'package.json', type: 'config', strategy: 'merge' },\n { path: 'index.ts', type: 'source', strategy: 'skip' },\n { path: 'main.py', type: 'source', strategy: 'skip' },\n { path: 'tsconfig.json', type: 'config', strategy: 'skip' },\n { path: 'pyproject.toml', type: 'config', strategy: 'skip' },\n];\n\n/** User's resolution choice for a conflict */\nexport type ConflictAction = 'skip' | 'overwrite' | 'merge';\n\n/** A conflict resolution decision from the user */\nexport interface ConflictResolution {\n /** Path to the conflicting file */\n path: string;\n /** Action chosen by the user */\n action: ConflictAction;\n}\n\n/** Detected information about an existing project */\nexport interface ProjectInfo {\n /** Whether any project indicators were found */\n isExistingProject: boolean;\n /** Detected project type */\n type: 'typescript' | 'python' | 'unknown';\n /** Detected package manager (for TypeScript projects) */\n packageManager: PackageManagerConfig;\n /** Files that exist and may conflict */\n conflictingFiles: ConflictFile[];\n /** Whether the agentmark/ directory already exists */\n hasAgentmarkDir: boolean;\n /** Whether an existing Python venv was detected */\n pythonVenv: PythonVenvInfo | null;\n}\n\n/** Result of a file merge operation */\nexport interface MergeResult {\n /** Whether the merge was successful */\n success: boolean;\n /** The merged content (if applicable) */\n content?: string;\n /** Any warnings generated during merge */\n warnings: string[];\n /** What was added (for user feedback) */\n added: string[];\n /** What was skipped (already present) */\n skipped: string[];\n}\n\n/** Extended options for initialization in existing projects */\nexport interface InitOptions {\n /** Target directory path */\n targetPath: string;\n /** Selected language */\n language: 'typescript' | 'python';\n /** Selected adapter (TypeScript only) */\n adapter?: string;\n /** Deployment mode */\n deploymentMode: 'cloud' | 'static';\n /** API key (if provided) */\n apiKey?: string;\n /** IDE client for MCP setup */\n client: string;\n /** Detected project info (null if new project) */\n projectInfo: ProjectInfo | null;\n /** User's conflict resolutions */\n conflictResolutions: ConflictResolution[];\n}\n","export const getTsConfigContent = (): object => {\n return {\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"NodeNext\",\n \"moduleResolution\": \"NodeNext\",\n \"esModuleInterop\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"skipLibCheck\": true\n }\n };\n}; ","export const getAnimalDrawingPrompt = (): string => {\n return `---\nname: animal-drawing\nimage_config:\n model_name: openai/dall-e-3\n num_images: 1\n size: 1024x1024\n aspect_ratio: 1:1\ntest_settings:\n dataset: animal.jsonl\n props:\n animal: \"cat\"\n---\n\n<ImagePrompt>\nDraw a hyper-realistic picture of a {props.animal}\n</ImagePrompt>`;\n};","export const getCustomerSupportPrompt = (model: string): string => {\n return `---\nname: customer-support-agent\ntext_config:\n model_name: ${model}\n max_calls: 2\n tools:\n - search_knowledgebase\ntest_settings:\n dataset: customer-query.jsonl\n props:\n customer_question: \"I'm having trouble with my order. How long does shipping take?\"\ninput_schema:\n type: object\n properties:\n customer_question:\n type: string\n description: \"The customer's question\"\n required:\n - customer_question\n---\n\n<System>\nYou are a customer service agent for a company that sells products online. You are given a customer's question and you need to respond to the customer. You need to be friendly, professional, and helpful.\n\nYou have access to the following tool:\n- search_knowledgebase: Search the company knowledgebase for information about shipping, warranty, and returns. Use this when customers ask about these topics.\n</System>\n\n<User>{props.customer_question}</User>`;\n};","export const getPartyPlannerPrompt = (model: string): string => {\n return `---\nname: party-planner\nobject_config:\n model_name: ${model}\n schema:\n type: object\n properties:\n names:\n type: array\n description: \"List of names of people attending the party.\"\n items:\n type: string\n required:\n - names\ntest_settings:\n dataset: party.jsonl\n evals:\n - exact_match_json\n props:\n party_text: \"We're having a party with Alice, Bob, and Carol.\"\ninput_schema:\n type: object\n properties:\n party_text:\n type: string\n description: \"A block of text describing the upcoming party and attendees.\"\n required:\n - party_text\n---\n\n<System>\nExtract the names of all people attending the party from the following text. Respond with a list of names only.\n</System>\n\n<User>\nText: {props.party_text}\n</User>`;\n};","export const getStoryTellerPrompt = (): string => {\n return `---\nname: story-teller\nspeech_config:\n model_name: openai/tts-1-hd\n voice: \"nova\"\n speed: 1.0\n output_format: \"mp3\"\ntest_settings:\n dataset: story.jsonl\n props:\n story: \"Once upon a time, there was a cat who loved to play with a ball.\"\n---\n\n<System>\nYou are a storyteller for children. Make sure your story is engaging and interesting.\n</System>\n\n<SpeechPrompt>\n- {props.story}\n</SpeechPrompt>`;\n};","export const getAnimalDataset = (): string => {\n return `{\"input\": {\"animal\": \"cat\"}, \"expected_output\": \"A realistic picture of a cat\"}\n{\"input\": {\"animal\": \"dog\"}, \"expected_output\": \"A realistic picture of a dog\"}\n{\"input\": {\"animal\": \"bird\"}, \"expected_output\": \"A realistic picture of a bird\"}`;\n};\n\nexport const getCustomerQueryDataset = (): string => {\n return `{\"input\": {\"customer_question\": \"My package hasn't arrived yet. Can you help me track it?\"}}\n{\"input\": {\"customer_question\": \"I received the wrong item in my order. What should I do?\"}}\n{\"input\": {\"customer_question\": \"How do I return a product that I purchased last week?\"}}`;\n};\n\nexport const getPartyDataset = (): string => {\n return `{\"input\": {\"party_text\": \"We're having a party with Alice, Bob, and Carol.\"}, \"expected_output\": \"{\\\\\"names\\\\\": [\\\\\"Alice\\\\\", \\\\\"Bob\\\\\", \\\\\"Carol\\\\\"]}\"}\n{\"input\": {\"party_text\": \"The guest list includes Dave, Emma, and Frank.\"}, \"expected_output\": \"{\\\\\"names\\\\\": [\\\\\"Dave\\\\\", \\\\\"Emma\\\\\", \\\\\"Frank\\\\\"]}\"}\n{\"input\": {\"party_text\": \"Join us for a celebration with Grace, Henry, and Isla.\"}, \"expected_output\": \"{\\\\\"names\\\\\": [\\\\\"Grace\\\\\", \\\\\"Henry\\\\\", \\\\\"Isla\\\\\"]}\"}`;\n};\n\nexport const getStoryDataset = (): string => {\n return `{\"input\": {\"story\": \"Once upon a time, the Moon woke up and found her glow missing! She floated around the sky asking stars, clouds, and even comets if they'd seen her light. It wasn't until she peeked into a mountain lake that she saw her glow shining back—hidden in her own reflection! Laughing, she realized she had never lost it—it was with her all along, just hiding beneath a cloudy sky.\"}}\n{\"input\": {\"story\": \"Benny was no ordinary banana—he dreamed of becoming a superhero. One day, when a monkey slipped in the jungle and cried for help, Benny rolled into action, dodging vines and swinging from branches using his peel like a lasso. The monkey was saved, and from that day on, Benny was known as \\\\\"The Peel of Justice,\\\\\" the bravest fruit in the whole rainforest.\"}}\n{\"input\": {\"story\": \"In the town of Maplebrook, there was a library that whispered stories when no one was looking. Curious little Nia tiptoed in one rainy day and heard the books giggling softly. She opened one called The Secret Tunnel, and to her surprise, it sucked her in! She found herself riding a dragon through glittering caves. When she returned, the book winked shut—waiting for its next reader to listen.\"}}`;\n};","import fs from 'fs-extra';\nimport { getAnimalDrawingPrompt } from './animal-drawing-prompt.js';\nimport { getCustomerSupportPrompt } from './customer-support-prompt.js';\nimport { getPartyPlannerPrompt } from './party-planner-prompt.js';\nimport { getStoryTellerPrompt } from './story-teller-prompt.js';\nimport { getAnimalDataset, getCustomerQueryDataset, getPartyDataset, getStoryDataset } from './datasets.js';\n\n/**\n * Creates example prompt files and returns the list of model IDs they use.\n * The returned array is the authoritative source for `builtInModels` in agentmark.json —\n * it reflects exactly which models were written, so the two can never drift apart.\n */\nexport const createExamplePrompts = (model: string, targetPath: string = \".\", adapter: string = \"ai-sdk\"): string[] => {\n // Ensure the templates directory exists\n fs.ensureDirSync(`${targetPath}/agentmark`);\n\n const noImageSupport = [\"mastra\", \"claude-agent-sdk\", \"pydantic-ai\"];\n const noSpeechSupport = [\"mastra\", \"claude-agent-sdk\", \"pydantic-ai\"];\n const skipImagePrompts = noImageSupport.includes(adapter);\n const skipSpeechPrompts = noSpeechSupport.includes(adapter);\n\n const usedModels: string[] = [];\n\n // Create animal drawing prompt and dataset (uses image_config - skip for unsupported adapters)\n if (!skipImagePrompts) {\n const animalDrawingPrompt = getAnimalDrawingPrompt();\n fs.writeFileSync(`${targetPath}/agentmark/animal-drawing.prompt.mdx`, animalDrawingPrompt);\n const animalDataset = getAnimalDataset();\n fs.writeFileSync(`${targetPath}/agentmark/animal.jsonl`, animalDataset);\n usedModels.push('openai/dall-e-3');\n }\n\n // Create customer support prompt and dataset\n const customerSupportPrompt = getCustomerSupportPrompt(model);\n fs.writeFileSync(`${targetPath}/agentmark/customer-support-agent.prompt.mdx`, customerSupportPrompt);\n const customerQueryDataset = getCustomerQueryDataset();\n fs.writeFileSync(`${targetPath}/agentmark/customer-query.jsonl`, customerQueryDataset);\n usedModels.push(model);\n\n // Create party planner prompt and dataset\n const partyPlannerPrompt = getPartyPlannerPrompt(model);\n fs.writeFileSync(`${targetPath}/agentmark/party-planner.prompt.mdx`, partyPlannerPrompt);\n const partyDataset = getPartyDataset();\n fs.writeFileSync(`${targetPath}/agentmark/party.jsonl`, partyDataset);\n\n // Create story teller prompt and dataset (uses speech_config - skip for unsupported adapters)\n if (!skipSpeechPrompts) {\n const storyTellerPrompt = getStoryTellerPrompt();\n fs.writeFileSync(`${targetPath}/agentmark/story-teller.prompt.mdx`, storyTellerPrompt);\n const storyDataset = getStoryDataset();\n fs.writeFileSync(`${targetPath}/agentmark/story.jsonl`, storyDataset);\n usedModels.push('openai/tts-1-hd');\n }\n\n // Deduplicate in case the language model appears under multiple prompts\n return [...new Set(usedModels)];\n};","import { getAdapterConfig } from \"./adapters.js\";\n\nexport const getClientConfigContent = (options: { provider: string; adapter: string; deploymentMode?: \"cloud\" | \"static\" }) => {\n const { provider, adapter, deploymentMode = \"cloud\" } = options;\n const isMastra = adapter === \"mastra\";\n const adapterConfig = getAdapterConfig(adapter, provider);\n const { modelRegistry } = adapterConfig.classes;\n\n // Claude Agent SDK doesn't use @ai-sdk provider imports\n const isClaudeAgentSdk = adapter === \"claude-agent-sdk\";\n const providerImport = isClaudeAgentSdk ? '' : `import { ${provider} } from '@ai-sdk/${provider}';`;\n\n // Import loaders from dedicated packages\n const loaderImport = deploymentMode === \"cloud\"\n ? `import { ApiLoader } from \"@agentmark-ai/loader-api\";`\n : `import { ApiLoader } from \"@agentmark-ai/loader-api\";\nimport { FileLoader } from \"@agentmark-ai/loader-file\";`;\n\n const loaderSetup = deploymentMode === \"cloud\"\n ? ` // ApiLoader works for both development and production\n // - Development: 'agentmark dev' sets AGENTMARK_BASE_URL to localhost\n // - Production: Set AGENTMARK_API_KEY and AGENTMARK_APP_ID for cloud.\n // AGENTMARK_BASE_URL overrides the default https://api.agentmark.co\n // target — managed deployments use this to point back at the gateway\n // that dispatched the job.\n const loader = process.env.NODE_ENV === 'development'\n ? ApiLoader.local({ baseUrl: process.env.AGENTMARK_BASE_URL || 'http://localhost:9418' })\n : ApiLoader.cloud({\n apiKey: process.env.AGENTMARK_API_KEY!,\n appId: process.env.AGENTMARK_APP_ID!,\n baseUrl: process.env.AGENTMARK_BASE_URL,\n });`\n : ` const loader = process.env.NODE_ENV === 'development'\n ? ApiLoader.local({ baseUrl: process.env.AGENTMARK_BASE_URL || 'http://localhost:9418' })\n : new FileLoader('./dist/agentmark');`;\n\n // Claude Agent SDK model registry setup is different\n const modelRegistrySetup = isClaudeAgentSdk\n ? `function createModelRegistry() {\n // Claude Agent SDK accepts model names directly.\n // Use createDefault() for simple pass-through of model names.\n const modelRegistry = ${modelRegistry}.createDefault();\n\n // To configure specific models (e.g., extended thinking), use:\n // const modelRegistry = new ${modelRegistry}()\n // .registerModels(/claude-.*-thinking/, (name) => ({\n // model: name,\n // maxThinkingTokens: 10000, // Enable extended thinking\n // }))\n // .registerModels(\"claude-sonnet-4-20250514\", (name) => ({ model: name }));\n\n return modelRegistry;\n}`\n : `function createModelRegistry() {\n const modelRegistry = new ${modelRegistry}()\n .registerProviders({ ${provider} });\n return modelRegistry;\n}`;\n\n // Claude Agent SDK adapter options\n const adapterOptionsImport = isClaudeAgentSdk\n ? `\n// Claude Agent SDK adapter options\n// See: https://github.com/anthropics/claude-agent-sdk\nconst adapterOptions = {\n // Permission mode controls tool access:\n // - 'default': Requires user approval for each tool use\n // - 'acceptEdits': Auto-approve file edits only\n // - 'bypassPermissions': Auto-approve all tools (use for automated pipelines)\n // - 'plan': Planning mode only, no tool execution\n permissionMode: 'bypassPermissions' as const,\n\n // Maximum conversation turns before stopping\n maxTurns: 20,\n\n // Optional: Set working directory for file operations\n // cwd: process.cwd(),\n\n // Optional: Budget limit in USD\n // maxBudgetUsd: 10.00,\n\n // Optional: Restrict which tools the agent can use\n // allowedTools: ['Read', 'Write', 'Glob'],\n // disallowedTools: ['Bash'],\n};`\n : '';\n\n // Tool import: each adapter imports tools differently\n const toolImport = isClaudeAgentSdk\n ? `import { tool, createSdkMcpServer } from \"@anthropic-ai/claude-agent-sdk\";\nimport { z } from 'zod';`\n : isMastra\n ? `import { tool } from 'ai';\nimport type { ToolsInput } from '@mastra/core/agent';\nimport { z } from 'zod';`\n : `import { tool } from 'ai';\nimport type { Tool } from 'ai';\nimport { z } from 'zod';`;\n\n const createClientCall = isClaudeAgentSdk\n ? `return createAgentMarkClient<AgentMarkTypes>({ loader, modelRegistry, evals, adapterOptions, mcpServers: { 'customer-support': customerSupportTools } });`\n : `return createAgentMarkClient<AgentMarkTypes>({ loader, modelRegistry, tools, evals });`;\n\n // AI SDK v5 uses inputSchema (Zod), Mastra uses parameters (Zod via ai v4 tool helper)\n const toolSchemaField = isMastra\n ? `parameters: z.object({ query: z.string().describe('The search query') })`\n : `inputSchema: z.object({ query: z.string().describe('The search query') })`;\n\n const toolsReturnType = isMastra ? 'ToolsInput' : 'Record<string, Tool>';\n\n const toolsSetup = isClaudeAgentSdk\n ? `\n// Custom tools exposed as an MCP server — the SDK's native tool mechanism.\n// The server name is used in mcpServers config; tool names are used in prompt files.\nconst knowledgeBase = tool(\n 'search_knowledgebase',\n 'Search the knowledge base for relevant articles',\n { query: z.string().describe('The search query') },\n async ({ query }) => ({\n content: [{ type: 'text' as const, text: JSON.stringify({\n articles: [\n { topic: 'shipping', content: 'Standard shipping takes 3–5 business days.' },\n { topic: 'warranty', content: 'All products include a 1-year limited warranty.' },\n { topic: 'returns', content: 'You can return items within 30 days of delivery.' },\n ],\n }) }],\n })\n);\n\nconst customerSupportTools = createSdkMcpServer({\n name: 'customer-support',\n tools: [knowledgeBase],\n});`\n : `\nfunction createTools(): ${toolsReturnType} {\n return {\n search_knowledgebase: tool({\n description: 'Search the knowledge base for relevant articles',\n ${toolSchemaField},\n execute: async ({ query }) => {\n // Simulate search delay\n await new Promise(resolve => setTimeout(resolve, 500));\n\n // Return all three knowledge base articles\n // The LLM will select the relevant one based on the query\n return {\n articles: [\n { topic: 'shipping', content: 'Standard shipping takes 3–5 business days.' },\n { topic: 'warranty', content: 'All products include a 1-year limited warranty.' },\n { topic: 'returns', content: 'You can return items within 30 days of delivery.' }\n ]\n };\n },\n }),\n };\n}`;\n\n const toolsVariable = isClaudeAgentSdk ? '' : ` const tools = createTools();`;\n\n return `// agentmark.client.ts\nimport path from 'node:path';\nimport dotenv from 'dotenv';\ndotenv.config({ path: path.resolve(__dirname, '.env') });\nimport { createAgentMarkClient, ${modelRegistry} } from \"${adapterConfig.package}\";\nimport type { EvalRegistry } from \"@agentmark-ai/prompt-core\";\n${loaderImport}\nimport AgentMarkTypes from './agentmark.types';\n${providerImport}\n${toolImport}\n${adapterOptionsImport}\n\n${modelRegistrySetup}\n${toolsSetup}\n\nconst evals: EvalRegistry = {\n exact_match_json: async ({ output, expectedOutput }) => {\n if (!expectedOutput) {\n return { score: 0, label: 'error', reason: 'No expected output provided', passed: false };\n }\n try {\n const ok = JSON.stringify(output) === JSON.stringify(JSON.parse(expectedOutput));\n return {\n score: ok ? 1 : 0,\n label: ok ? 'correct' : 'incorrect',\n reason: ok ? 'Exact match' : 'Mismatch',\n passed: ok\n };\n } catch (e) {\n return { score: 0, label: 'error', reason: 'Failed to parse expected output as JSON', passed: false };\n }\n },\n};\n\nfunction createClient() {\n${loaderSetup}\n const modelRegistry = createModelRegistry();\n${toolsVariable}\n ${createClientCall}\n}\n\nexport const client = createClient();\n`;\n};\n","/**\n * Conflict resolution utilities for handling existing files.\n * Prompts users for resolution when files would be overwritten.\n */\n\nimport prompts from 'prompts';\nimport type {\n ConflictFile,\n ConflictResolution,\n ConflictAction,\n ProjectInfo,\n} from './types.js';\n\n/**\n * Filter conflicts that require user prompting.\n * Returns only conflicts with 'prompt' strategy that actually exist.\n */\nexport function getPromptableConflicts(conflictingFiles: ConflictFile[]): ConflictFile[] {\n return conflictingFiles.filter((file) => file.strategy === 'prompt');\n}\n\n/**\n * Prompt user for resolution of a single conflict.\n */\nasync function promptForSingleConflict(\n conflict: ConflictFile\n): Promise<ConflictResolution> {\n const typeLabel = conflict.type === 'directory' ? 'directory' : 'file';\n\n const { action } = await prompts({\n type: 'select',\n name: 'action',\n message: `${conflict.path} already exists. What would you like to do?`,\n choices: [\n {\n title: `Skip (keep existing ${typeLabel})`,\n value: 'skip',\n description: `Don't modify the existing ${typeLabel}`,\n },\n {\n title: 'Overwrite',\n value: 'overwrite',\n description: `Replace with new AgentMark ${typeLabel}`,\n },\n ],\n initial: 0, // Default to skip for safety\n });\n\n return {\n path: conflict.path,\n action: action as ConflictAction || 'skip',\n };\n}\n\n/**\n * Prompt user for resolution of all conflicts that require prompting.\n * Returns an array of resolution decisions.\n */\nexport async function promptForResolutions(\n conflictingFiles: ConflictFile[]\n): Promise<ConflictResolution[]> {\n const promptableConflicts = getPromptableConflicts(conflictingFiles);\n\n if (promptableConflicts.length === 0) {\n return [];\n }\n\n console.log('\\n⚠️ Found existing files that may conflict with AgentMark initialization:\\n');\n\n const resolutions: ConflictResolution[] = [];\n\n for (const conflict of promptableConflicts) {\n const resolution = await promptForSingleConflict(conflict);\n resolutions.push(resolution);\n }\n\n console.log(''); // Add blank line after prompts\n return resolutions;\n}\n\n/**\n * Get the resolution action for a specific file path.\n * Returns the user's choice or the default strategy if no prompt was needed.\n */\nexport function getResolutionAction(\n filePath: string,\n resolutions: ConflictResolution[],\n conflictingFiles: ConflictFile[]\n): ConflictAction {\n // First check if user provided a resolution\n const userResolution = resolutions.find((r) => r.path === filePath);\n if (userResolution) {\n return userResolution.action;\n }\n\n // Check the default strategy for this file\n const conflictFile = conflictingFiles.find((f) => f.path === filePath);\n if (conflictFile) {\n // Map strategy to action\n switch (conflictFile.strategy) {\n case 'skip':\n return 'skip';\n case 'merge':\n return 'merge';\n case 'append':\n return 'merge'; // Append is a form of merge\n case 'prompt':\n // If we got here without a resolution, default to skip for safety\n return 'skip';\n }\n }\n\n // Default: overwrite (file doesn't conflict or isn't tracked)\n return 'overwrite';\n}\n\n/**\n * Check if a file should be skipped based on resolutions.\n */\nexport function shouldSkipFile(\n filePath: string,\n projectInfo: ProjectInfo | null,\n resolutions: ConflictResolution[]\n): boolean {\n if (!projectInfo || !projectInfo.isExistingProject) {\n return false;\n }\n\n const action = getResolutionAction(filePath, resolutions, projectInfo.conflictingFiles);\n return action === 'skip';\n}\n\n/**\n * Check if a file should be merged based on resolutions.\n */\nexport function shouldMergeFile(\n filePath: string,\n projectInfo: ProjectInfo | null,\n resolutions: ConflictResolution[]\n): boolean {\n if (!projectInfo || !projectInfo.isExistingProject) {\n return false;\n }\n\n const action = getResolutionAction(filePath, resolutions, projectInfo.conflictingFiles);\n return action === 'merge';\n}\n\n/**\n * Display a summary of existing project detection.\n */\nexport function displayProjectDetectionSummary(projectInfo: ProjectInfo): void {\n if (!projectInfo.isExistingProject) {\n return;\n }\n\n console.log('\\n📁 Detected existing project:');\n console.log(` Type: ${projectInfo.type}`);\n\n if (projectInfo.type === 'typescript') {\n console.log(` Package Manager: ${projectInfo.packageManager.name}`);\n }\n\n if (projectInfo.pythonVenv) {\n console.log(` Python Venv: ${projectInfo.pythonVenv.name}`);\n }\n\n if (projectInfo.hasAgentmarkDir) {\n console.log(' ⚠️ AgentMark directory already exists');\n }\n\n console.log('');\n}\n","import fs from \"fs-extra\";\nimport * as path from \"path\";\nimport {\n createExamplePrompts,\n} from \"./templates/index.js\";\nimport { appendGitignore, appendEnv } from \"../file-merge.js\";\nimport { shouldMergeFile } from \"../conflict-resolution.js\";\nimport type { ProjectInfo, ConflictResolution } from \"../types.js\";\n\nconst setupMCPServer = (client: string, targetPath: string) => {\n if (client === \"skip\") {\n console.log(\"Skipping MCP server setup.\");\n return;\n }\n\n const folderName = targetPath;\n\n // Handle VS Code\n if (client === \"vscode\") {\n try {\n console.log(`Setting up MCP server for VS Code in ${folderName}...`);\n const vscodeDir = path.join(targetPath, \".vscode\");\n fs.ensureDirSync(vscodeDir);\n\n const mcpConfig = {\n servers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n }\n }\n };\n\n fs.writeJsonSync(path.join(vscodeDir, \"mcp.json\"), mcpConfig, { spaces: 2 });\n console.log(`MCP server configured for VS Code in ${folderName}/.vscode/mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for VS Code:`, error);\n }\n return;\n }\n\n // Handle Zed\n if (client === \"zed\") {\n try {\n console.log(`Setting up MCP server for Zed in ${folderName}...`);\n const zedDir = path.join(targetPath, \".zed\");\n fs.ensureDirSync(zedDir);\n\n const zedConfig = {\n context_servers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n }\n }\n };\n\n fs.writeJsonSync(path.join(zedDir, \"settings.json\"), zedConfig, { spaces: 2 });\n console.log(`MCP server configured for Zed in ${folderName}/.zed/settings.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Zed:`, error);\n }\n return;\n }\n\n // Handle Cursor\n if (client === \"cursor\") {\n try {\n console.log(`Setting up MCP server for Cursor in ${folderName}...`);\n const cursorDir = path.join(targetPath, \".cursor\");\n fs.ensureDirSync(cursorDir);\n\n const cursorConfig = {\n mcpServers: {\n \"agentmark-docs\": {\n url: \"https://docs.agentmark.co/mcp\"\n }\n }\n };\n\n fs.writeJsonSync(path.join(cursorDir, \"mcp.json\"), cursorConfig, { spaces: 2 });\n console.log(`MCP server configured for Cursor in ${folderName}/.cursor/mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Cursor:`, error);\n }\n return;\n }\n\n // Handle Claude Code\n if (client === \"claude-code\") {\n try {\n console.log(`Setting up MCP server for Claude Code in ${folderName}...`);\n\n const mcpConfig = {\n mcpServers: {\n \"agentmark-docs\": {\n type: \"http\",\n url: \"https://docs.agentmark.co/mcp\"\n }\n }\n };\n\n fs.writeJsonSync(path.join(targetPath, \".mcp.json\"), mcpConfig, { spaces: 2 });\n console.log(`MCP server configured for Claude Code in ${folderName}/.mcp.json`);\n } catch (error) {\n console.warn(`Warning: Could not set up MCP server for Claude Code:`, error);\n }\n return;\n }\n};\n\nconst getPyprojectContent = (projectName: string, adapter: string, deploymentMode: \"cloud\" | \"static\"): string => {\n // Scaffolded Python projects are flat-layout (top-level .py modules, no package dir),\n // so setuptools with explicit py-modules is the simplest build backend.\n // Hatchling requires explicit per-file inclusion rules for this layout, which adds noise.\n const pyModules = deploymentMode === \"cloud\"\n ? `[\"agentmark_client\", \"main\", \"handler\"]`\n : `[\"agentmark_client\", \"main\"]`;\n\n if (adapter === \"claude-agent-sdk\") {\n return `[project]\nname = \"${projectName}\"\nversion = \"0.1.0\"\ndescription = \"An AgentMark application using Claude Agent SDK\"\nrequires-python = \">=3.12\"\ndependencies = [\n \"agentmark-sdk>=0.2.0\",\n \"agentmark-claude-agent-sdk-v0>=0.1.4\",\n \"agentmark-prompt-core>=0.1.2\",\n \"python-dotenv>=1.0.0\",\n \"claude-agent-sdk>=0.1.0\",\n]\n\n[project.optional-dependencies]\ndev = [\n \"pytest>=7.0\",\n \"pytest-asyncio>=0.21\",\n \"mypy>=1.0\",\n]\n\n[build-system]\nrequires = [\"setuptools>=61\", \"wheel\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[tool.setuptools]\npy-modules = ${pyModules}\n\n[tool.pytest.ini_options]\nasyncio_mode = \"auto\"\n\n[tool.mypy]\nstrict = true\n`;\n }\n\n // Default: pydantic-ai.\n // pydantic-ai-slim with explicit extras avoids the meta-package's transitive extras explosion (pip resolution-too-deep).\n return `[project]\nname = \"${projectName}\"\nversion = \"0.1.0\"\ndescription = \"An AgentMark application using Pydantic AI\"\nrequires-python = \">=3.12\"\ndependencies = [\n \"agentmark-sdk>=0.2.0\",\n \"agentmark-pydantic-ai-v0>=0.1.4\",\n \"agentmark-prompt-core>=0.1.2\",\n \"python-dotenv>=1.0.0\",\n \"pydantic-ai-slim[openai]>=1.0,<2.0\",\n]\n\n[project.optional-dependencies]\ndev = [\n \"pytest>=7.0\",\n \"pytest-asyncio>=0.21\",\n \"mypy>=1.0\",\n]\n\n[build-system]\nrequires = [\"setuptools>=61\", \"wheel\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[tool.setuptools]\npy-modules = ${pyModules}\n\n[tool.pytest.ini_options]\nasyncio_mode = \"auto\"\n\n[tool.mypy]\nstrict = true\n`;\n};\n\nconst getHandlerPyContent = (adapter: string): string => {\n const webhookClass = adapter === \"claude-agent-sdk\"\n ? \"ClaudeAgentWebhookHandler\"\n : \"PydanticAIWebhookHandler\";\n const webhookImport = adapter === \"claude-agent-sdk\"\n ? \"from agentmark_claude_agent_sdk_v0 import ClaudeAgentWebhookHandler\"\n : \"from agentmark_pydantic_ai_v0 import PydanticAIWebhookHandler\";\n\n return `\"\"\"AgentMark handler for managed cloud deployments.\n\nThis file is used by the AgentMark platform to execute prompts and experiments\non deployed infrastructure. It mirrors the TypeScript handler.ts pattern.\n\"\"\"\n\nimport os\n\nfrom agentmark_sdk import AgentMarkSDK\n${webhookImport}\nfrom agentmark_client import client\n\n# Initialize tracing\nsdk = AgentMarkSDK(\n api_key=os.environ.get(\"AGENTMARK_API_KEY\", \"\"),\n app_id=os.environ.get(\"AGENTMARK_APP_ID\", \"\"),\n base_url=os.environ.get(\"AGENTMARK_BASE_URL\"),\n)\nsdk.init_tracing(disable_batch=True)\n\nadapter = ${webhookClass}(client)\n\n\nasync def handler(request: dict):\n \"\"\"Handle prompt-run, dataset-run, and get-evals requests from the platform.\"\"\"\n req_type = request.get(\"type\")\n data = request.get(\"data\", {})\n\n if req_type == \"get-evals\":\n import json\n return {\n \"type\": \"evals\",\n \"result\": json.dumps(list(client.get_eval_registry().keys())),\n \"traceId\": \"\",\n }\n\n if req_type == \"prompt-run\":\n return await adapter.run_prompt(data[\"ast\"], {\n \"shouldStream\": data.get(\"options\", {}).get(\"shouldStream\", True),\n \"customProps\": data.get(\"customProps\"),\n })\n\n if req_type == \"dataset-run\":\n return await adapter.run_experiment(\n data[\"ast\"],\n data.get(\"experimentId\", \"\"),\n data.get(\"datasetPath\"),\n )\n\n raise ValueError(f\"Unknown request type: {req_type}\")\n`;\n};\n\nconst getAgentmarkClientContent = (deploymentMode: \"cloud\" | \"static\", adapter: string): string => {\n const isCloud = deploymentMode === \"cloud\";\n const loaderImport = isCloud\n ? `from agentmark.prompt_core import ApiLoader`\n : `from agentmark.prompt_core import FileLoader`;\n const loaderSetup = isCloud\n ? `# API loader for cloud deployment — fetches datasets from the AgentMark gateway\nloader = ApiLoader.cloud()`\n : `# File loader for local development — reads pre-built prompts from the build output directory\nloader = FileLoader(\"./dist/agentmark\")`;\n\n if (adapter === \"claude-agent-sdk\") {\n return `\"\"\"AgentMark client configuration.\n\nThis file configures the AgentMark client with Claude Agent SDK adapter.\nCustomize the model registry and eval registry as needed.\n\"\"\"\n\nimport json\nimport os\nfrom dotenv import load_dotenv\n\n${loaderImport}\nfrom agentmark.prompt_core import EvalRegistry\nfrom agentmark_claude_agent_sdk_v0 import (\n create_claude_agent_client,\n ClaudeAgentModelRegistry,\n)\n\n# Load environment variables\nload_dotenv()\n\n# Register the model providers your prompts use.\n# This maps \"anthropic/claude-sonnet-4-20250514\" in prompt files to the Claude Agent SDK.\nmodel_registry = ClaudeAgentModelRegistry()\nmodel_registry.register_providers({\n \"anthropic\": \"anthropic\",\n})\n\n\n# Evaluation functions — used by experiments to score model outputs\ndef exact_match_json(params):\n \"\"\"Check if output matches expected output exactly.\"\"\"\n output = params.get(\"output\")\n expected_output = params.get(\"expectedOutput\")\n if not expected_output:\n return {\"score\": 0, \"label\": \"error\", \"reason\": \"No expected output provided\", \"passed\": False}\n try:\n actual = json.loads(output) if isinstance(output, str) else output\n expected = json.loads(expected_output) if isinstance(expected_output, str) else expected_output\n ok = actual == expected\n return {\n \"score\": 1 if ok else 0,\n \"label\": \"correct\" if ok else \"incorrect\",\n \"reason\": \"Exact match\" if ok else \"Mismatch\",\n \"passed\": ok,\n }\n except (json.JSONDecodeError, TypeError):\n return {\"score\": 0, \"label\": \"error\", \"reason\": \"Failed to parse JSON\", \"passed\": False}\n\nevals: EvalRegistry = {\n \"exact_match_json\": exact_match_json,\n}\n\n${loaderSetup}\n\n# Create the client\n# Claude Agent SDK handles tools natively through the SDK\nclient = create_claude_agent_client(\n model_registry=model_registry,\n evals=evals,\n loader=loader,\n)\n\n__all__ = [\"client\"]\n`;\n }\n\n // Default: pydantic-ai\n return `\"\"\"AgentMark client configuration.\n\nThis file configures the AgentMark client with Pydantic AI adapter.\nCustomize the model registry, tools, and eval registry as needed.\n\"\"\"\n\nimport json\nimport os\nfrom dotenv import load_dotenv\n\n${loaderImport}\nfrom agentmark.prompt_core import EvalRegistry\nfrom agentmark_pydantic_ai_v0 import (\n create_pydantic_ai_client,\n PydanticAIModelRegistry,\n)\n\n# Load environment variables\nload_dotenv()\n\n# Register the model providers your prompts use.\n# This maps \"openai/gpt-4o\" in prompt files to \"openai:gpt-4o\" for Pydantic AI.\nmodel_registry = PydanticAIModelRegistry()\nmodel_registry.register_providers({\n \"openai\": \"openai\",\n \"anthropic\": \"anthropic\",\n})\n\n# Define tools as native pydantic-ai Tool objects or callables\n# Example:\n# def search(query: str) -> str:\n# return f\"Search results for: {query}\"\n# tools = [search]\ntools = []\n\n\n# Evaluation functions — used by experiments to score model outputs\ndef exact_match_json(params):\n \"\"\"Check if output matches expected output exactly.\"\"\"\n output = params.get(\"output\")\n expected_output = params.get(\"expectedOutput\")\n if not expected_output:\n return {\"score\": 0, \"label\": \"error\", \"reason\": \"No expected output provided\", \"passed\": False}\n try:\n actual = json.loads(output) if isinstance(output, str) else output\n expected = json.loads(expected_output) if isinstance(expected_output, str) else expected_output\n ok = actual == expected\n return {\n \"score\": 1 if ok else 0,\n \"label\": \"correct\" if ok else \"incorrect\",\n \"reason\": \"Exact match\" if ok else \"Mismatch\",\n \"passed\": ok,\n }\n except (json.JSONDecodeError, TypeError):\n return {\"score\": 0, \"label\": \"error\", \"reason\": \"Failed to parse JSON\", \"passed\": False}\n\nevals: EvalRegistry = {\n \"exact_match_json\": exact_match_json,\n}\n\n${loaderSetup}\n\n# Create the client\nclient = create_pydantic_ai_client(\n model_registry=model_registry,\n tools=tools,\n evals=evals,\n loader=loader,\n)\n\n__all__ = [\"client\"]\n`;\n};\n\nexport const getMainPyContent = (adapter: string, deploymentMode: \"cloud\" | \"static\" = \"cloud\"): string => {\n const isCloud = deploymentMode === \"cloud\";\n\n const cloudTracingInit = `\n# Initialize tracing - traces will be sent to AgentMark Cloud\n# To disable tracing, comment out sdk.init_tracing() below\nsdk = AgentMarkSDK(\n api_key=os.environ.get(\"AGENTMARK_API_KEY\", \"\"),\n app_id=os.environ.get(\"AGENTMARK_APP_ID\", \"\"),\n)\nsdk.init_tracing(disable_batch=True)\n`;\n\n const staticTracingInit = `\n# Initialize tracing - traces will be sent to local dev server\n# Make sure to run \"npx agentmark dev\" in another terminal first\n# To disable tracing, comment out sdk.init_tracing() below\nsdk = AgentMarkSDK(\n api_key=\"\",\n app_id=\"\",\n base_url=\"http://localhost:9418\",\n)\nsdk.init_tracing(disable_batch=True)\n`;\n\n const tracingInit = isCloud ? cloudTracingInit : staticTracingInit;\n\n if (adapter === \"claude-agent-sdk\") {\n return `\"\"\"Example usage of AgentMark with Claude Agent SDK.\n\nRun with:\n npx agentmark build # compile party-planner.prompt.mdx -> dist/agentmark/*.json\n python main.py\n\"\"\"\n\nimport asyncio\nimport os\n\nfrom agentmark_sdk import AgentMarkSDK\nfrom agentmark_claude_agent_sdk_v0 import traced_query\nfrom agentmark_client import client\n${tracingInit}\n\nasync def main():\n \"\"\"Run the party planner prompt (object_config: extracts attendee names).\"\"\"\n # \\`agentmark build\\` writes pre-compiled prompts to dist/agentmark/.\n # The FileLoader reads them by name — extension is optional.\n try:\n prompt = await client.load_object_prompt(\"party-planner.prompt.mdx\")\n except FileNotFoundError:\n print(\"Pre-built prompt not found. Run 'npx agentmark build' first.\")\n return\n\n adapted = await prompt.format(props={\n \"party_text\": \"We're having a party with Alice, Bob, and Carol.\",\n })\n\n # Execute via Claude Agent SDK (streamed) with automatic OTEL tracing.\n # adapted.query.options.output_format is set to the object schema.\n print(\"Running party planner prompt...\")\n print(\"=\" * 50)\n async for message in traced_query(adapted):\n print(message)\n print(\"=\" * 50)\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n`;\n }\n\n // Default: pydantic-ai\n return `\"\"\"Example usage of AgentMark with Pydantic AI.\n\nRun with:\n npx agentmark build # compile party-planner.prompt.mdx -> dist/agentmark/*.json\n python main.py\n\"\"\"\n# To use a different LLM provider, install: pip install \"pydantic-ai-slim[anthropic]\" (or [google], [bedrock], etc.)\n\nimport asyncio\nimport os\n\nfrom agentmark_sdk import AgentMarkSDK\nfrom agentmark_pydantic_ai_v0 import run_object_prompt\nfrom agentmark_client import client\n${tracingInit}\n\nasync def main():\n \"\"\"Run the party planner prompt (object_config: extracts attendee names).\"\"\"\n # \\`agentmark build\\` writes pre-compiled prompts to dist/agentmark/.\n # The FileLoader reads them by name — extension is optional, and it\n # extracts the inner AST from the { ast, metadata } wrapper for you.\n try:\n prompt = await client.load_object_prompt(\"party-planner.prompt.mdx\")\n except FileNotFoundError:\n print(\"Pre-built prompt not found. Run 'npx agentmark build' first.\")\n return\n\n params = await prompt.format(props={\n \"party_text\": \"We're having a party with Alice, Bob, and Carol.\",\n })\n\n # Execute the prompt\n print(\"Running party planner prompt...\")\n result = await run_object_prompt(params)\n\n print(\"\\\\n\" + \"=\" * 50)\n print(\"Extracted attendees:\")\n print(\"=\" * 50)\n # result.output is a Pydantic model instance with the schema's fields\n print(result.output.names)\n print(\"\\\\n\" + \"-\" * 50)\n print(f\"Tokens used: {result.usage.total_tokens}\")\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n`;\n};\n\nconst getDevServerContent = (adapter: string): string => {\n const adapterPackage = adapter === \"claude-agent-sdk\"\n ? \"agentmark_claude_agent_sdk_v0\"\n : \"agentmark_pydantic_ai_v0\";\n\n return `\"\"\"Auto-generated webhook server for AgentMark development.\n\nThis server is started by 'npx agentmark dev' (agentmark dev) and handles\nprompt execution requests from the CLI.\n\"\"\"\n\nimport argparse\nimport sys\nfrom pathlib import Path\n\n# Add parent directory to path for imports\nsys.path.insert(0, str(Path(__file__).parent.parent))\n\nfrom ${adapterPackage} import create_webhook_server\nfrom agentmark_client import client\n\n\nif __name__ == \"__main__\":\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--webhook-port\", type=int, default=9417)\n parser.add_argument(\"--api-server-port\", type=int, default=9418)\n args = parser.parse_args()\n\n create_webhook_server(client, args.webhook_port, args.api_server_port)\n`;\n};\n\nconst getEnvContent = (apiKey: string, adapter: string): string => {\n if (adapter === \"claude-agent-sdk\") {\n return `# Anthropic API Key\nANTHROPIC_API_KEY=${apiKey}\n`;\n }\n\n // Default: pydantic-ai (OpenAI)\n return `# OpenAI API Key\nOPENAI_API_KEY=${apiKey}\n\n# For Anthropic models, add:\n# ANTHROPIC_API_KEY=your-key-here\n\n# For Google Gemini models, add:\n# GOOGLE_API_KEY=your-key-here\n`;\n};\n\nconst getReadmeContent = (projectName: string, adapter: string): string => {\n const adapterName = adapter === \"claude-agent-sdk\" ? \"Claude Agent SDK\" : \"Pydantic AI\";\n const apiKeyEnvVar = adapter === \"claude-agent-sdk\" ? \"ANTHROPIC_API_KEY\" : \"OPENAI_API_KEY\";\n const directInstallCmd = adapter === \"claude-agent-sdk\"\n ? 'pip install agentmark-sdk agentmark-claude-agent-sdk-v0 agentmark-prompt-core python-dotenv claude-agent-sdk'\n : 'pip install agentmark-sdk agentmark-pydantic-ai-v0 agentmark-prompt-core python-dotenv \"pydantic-ai-slim[openai]>=1.0,<2.0\"';\n\n return `# ${projectName}\n\nAn AgentMark application using ${adapterName}.\n\n## Prerequisites\n\n- Python 3.12+\n- **pip 26.1+** (older pip versions fail to resolve the dependency graph — see \"Why pip 26.1?\" below)\n\n## Setup\n\n\\`\\`\\`bash\n# 1. Create and activate a virtual environment\npython -m venv .venv\nsource .venv/bin/activate # On Windows: .venv\\\\Scripts\\\\activate\n\n# 2. Upgrade pip (REQUIRED — older pip cannot resolve pydantic-ai's transitive graph)\npython -m pip install --upgrade \"pip>=26.1\"\n\n# 3. Install dependencies\n${directInstallCmd}\n\n# 4. Set your API key\necho \"${apiKeyEnvVar}=your-key-here\" > .env\n\\`\\`\\`\n\n## Run\n\n\\`\\`\\`bash\n# Start the AgentMark dev server (in another terminal)\nnpx agentmark dev\n\n# Run the example prompt\npython main.py\n\\`\\`\\`\n\nThen open [http://localhost:9418](http://localhost:9418) to view your traces.\n\n## Why pip 26.1?\n\nThe \\`pydantic-ai-slim\\` package transitively depends on \\`mcp\\`, \\`fastmcp\\`, and\n\\`logfire\\`, which together produce a deep dependency graph. Pip versions before\n26.1 fall into long backtracking loops and abort with \\`resolution-too-deep\\`.\nPip 26.1's resolver handles this graph efficiently. If you skip the upgrade and\nhit the error, run \\`python -m pip install --upgrade pip\\` and retry.\n\n## Resources\n\n- [Documentation](https://docs.agentmark.co)\n- [GitHub](https://github.com/agentmark-ai/agentmark)\n`;\n};\n\nconst getGitignoreContent = (): string => {\n return `# Python\n__pycache__/\n*.py[cod]\n*$py.class\n.venv/\nvenv/\n.env\n\n# AgentMark\n*.agentmark-outputs/\n.agentmark/\n\n# IDE\n.idea/\n.vscode/\n*.swp\n\n# Build\ndist/\nbuild/\n*.egg-info/\n\n# Testing\n.pytest_cache/\n.coverage\nhtmlcov/\n`;\n};\n\nexport const createPythonApp = async (\n client: string,\n targetPath: string = \".\",\n apiKey: string = \"\",\n deploymentMode: \"cloud\" | \"static\" = \"cloud\",\n adapter: string = \"pydantic-ai\",\n projectInfo: ProjectInfo | null = null,\n resolutions: ConflictResolution[] = []\n): Promise<string[]> => {\n try {\n const model = adapter === 'claude-agent-sdk' ? 'anthropic/claude-sonnet-4-20250514' : 'openai/gpt-4o';\n const adapterDisplayName = adapter === 'claude-agent-sdk' ? 'Claude Agent SDK' : 'Pydantic AI';\n const isExistingProject = projectInfo?.isExistingProject ?? false;\n\n if (isExistingProject) {\n console.log(`Adding AgentMark to existing Python project with ${adapterDisplayName}...`);\n } else {\n console.log(`Creating AgentMark Python app with ${adapterDisplayName}...`);\n }\n\n const folderName = targetPath;\n\n // Create directory structure\n fs.ensureDirSync(`${targetPath}/agentmark`);\n\n setupMCPServer(client, targetPath);\n\n // Create example prompts (reuse from TypeScript) — returns the model IDs actually written\n const usedModels = createExamplePrompts(model, targetPath, adapter);\n console.log(`Example prompts and datasets created in ${folderName}/agentmark/`);\n\n // Create pyproject.toml (skip for existing projects)\n if (!isExistingProject) {\n const projectName = path.basename(targetPath).replace(/[^a-zA-Z0-9_-]/g, \"-\");\n fs.writeFileSync(`${targetPath}/pyproject.toml`, getPyprojectContent(projectName, adapter, deploymentMode));\n } else {\n console.log(\"⏭️ Skipped pyproject.toml (existing project)\");\n }\n\n // Create agentmark_client.py (always create - this is AgentMark-specific)\n fs.writeFileSync(`${targetPath}/agentmark_client.py`, getAgentmarkClientContent(deploymentMode, adapter));\n\n // Create handler.py for cloud deployments (managed code execution)\n if (deploymentMode === \"cloud\") {\n const handlerPath = path.join(targetPath, 'handler.py');\n if (fs.existsSync(handlerPath)) {\n console.log(\"⏭️ Skipped handler.py (already exists - preserving customizations)\");\n } else {\n fs.writeFileSync(handlerPath, getHandlerPyContent(adapter));\n console.log(`✅ Created handler.py for cloud deployment`);\n }\n }\n\n // Create main.py (skip for existing projects)\n if (!isExistingProject) {\n fs.writeFileSync(`${targetPath}/main.py`, getMainPyContent(adapter, deploymentMode));\n } else {\n console.log(\"⏭️ Skipped main.py (existing project)\");\n }\n\n // Create or append to .env file\n if (shouldMergeFile('.env', projectInfo, resolutions)) {\n const envVars: Record<string, string> = {};\n const apiKeyEnvVar = adapter === 'claude-agent-sdk' ? 'ANTHROPIC_API_KEY' : 'OPENAI_API_KEY';\n if (apiKey) {\n envVars[apiKeyEnvVar] = apiKey;\n } else {\n envVars[apiKeyEnvVar] = adapter === 'claude-agent-sdk' ? 'your-anthropic-api-key' : 'your-openai-api-key';\n }\n const result = appendEnv(targetPath, envVars);\n if (result.added.length > 0) {\n console.log(`✅ Added to .env: ${result.added.join(', ')}`);\n }\n if (result.skipped.length > 0) {\n console.log(`⏭️ Skipped existing .env vars: ${result.skipped.join(', ')}`);\n }\n } else {\n fs.writeFileSync(`${targetPath}/.env`, getEnvContent(apiKey, adapter));\n }\n\n // Create or append to .gitignore\n const gitignoreEntries = [\n '__pycache__/', '*.py[cod]', '*$py.class', '.venv/', 'venv/', '.env',\n '*.agentmark-outputs/', '.agentmark/', '.idea/', '.vscode/', '*.swp',\n 'dist/', 'build/', '*.egg-info/', '.pytest_cache/', '.coverage', 'htmlcov/'\n ];\n if (shouldMergeFile('.gitignore', projectInfo, resolutions)) {\n const result = appendGitignore(targetPath, gitignoreEntries);\n if (result.added.length > 0) {\n console.log(`✅ Added to .gitignore: ${result.added.join(', ')}`);\n }\n if (result.skipped.length > 0) {\n console.log(`⏭️ Already in .gitignore: ${result.skipped.join(', ')}`);\n }\n } else {\n fs.writeFileSync(`${targetPath}/.gitignore`, getGitignoreContent());\n }\n\n // Create README.md (skip for existing projects — they likely already have one)\n if (!isExistingProject) {\n const readmePath = path.join(targetPath, 'README.md');\n if (!fs.existsSync(readmePath)) {\n const projectName = path.basename(targetPath).replace(/[^a-zA-Z0-9_-]/g, \"-\");\n fs.writeFileSync(readmePath, getReadmeContent(projectName, adapter));\n console.log(`✅ Created README.md`);\n }\n }\n\n // Create .agentmark directory with dev_server.py\n const agentmarkInternalDir = path.join(targetPath, '.agentmark');\n fs.ensureDirSync(agentmarkInternalDir);\n fs.writeFileSync(path.join(agentmarkInternalDir, 'dev_server.py'), getDevServerContent(adapter));\n\n // Python environment setup notes\n const pythonVenv = projectInfo?.pythonVenv;\n if (pythonVenv) {\n console.log(`\\n📦 Detected existing Python venv: ${pythonVenv.name}`);\n console.log(\" Remember to activate it before running AgentMark commands.\");\n } else if (!isExistingProject) {\n console.log(\"Setting up Python environment...\");\n console.log(\"Note: You'll need to set up a virtual environment and install dependencies.\");\n console.log(\"\");\n }\n\n // Install the AgentMark agent skill so this project's agents\n // (Claude Code, Codex, Cursor, Copilot, etc.) know how to use AgentMark.\n // Best-effort — failures are logged and do not break bootstrap.\n const { installAgentmarkSkill } = await import(\"../install-skill\");\n installAgentmarkSkill(targetPath);\n\n // Success message\n console.log(\"\\n✅ AgentMark Python initialization completed successfully!\");\n\n console.log(\n `\n ██████╗ ██╗ ██╗████████╗██╗ ██╗ ██████╗ ███╗ ██╗\n ██╔══██╗╚██╗ ██╔╝╚══██╔══╝██║ ██║██╔═══██╗████╗ ██║\n ██████╔╝ ╚████╔╝ ██║ ███████║██║ ██║██╔██╗ ██║\n ██╔═══╝ ╚██╔╝ ██║ ██╔══██║██║ ██║██║╚██╗██║\n ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║\n ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝\n + AgentMark\n `\n );\n\n console.log('\\n' + '═'.repeat(70));\n console.log('Next Steps');\n console.log('═'.repeat(70));\n\n console.log('\\n Get Started:');\n if (folderName !== \".\" && folderName !== \"./\" && !isExistingProject) {\n console.log(` $ cd ${folderName}`);\n }\n\n // Recommend installing deps directly — `pip install -e \".[dev]\"` on flat-layout\n // projects triggers pip's \"dependency graph too complex\" backtracking limit,\n // even though the same deps resolve fine when passed directly to pip.\n //\n // Even with the direct-install workaround, pip < 26.1 still hits \"resolution-too-deep\"\n // on the pydantic-ai-slim transitive graph (mcp/fastmcp/logfire/etc). Pip 26.1+ ships\n // a far better resolver — upgrade first so the install reliably converges.\n const pipInstallCmd = adapter === 'claude-agent-sdk'\n ? ' $ pip install agentmark-sdk agentmark-claude-agent-sdk-v0 agentmark-prompt-core python-dotenv claude-agent-sdk'\n : ' $ pip install agentmark-sdk agentmark-pydantic-ai-v0 agentmark-prompt-core python-dotenv \"pydantic-ai-slim[openai]>=1.0,<2.0\"';\n const pipUpgradeCmd = ' $ python -m pip install --upgrade \"pip>=26.1\"';\n\n if (pythonVenv) {\n const activateCmd = process.platform === 'win32'\n ? `${pythonVenv.name}\\\\Scripts\\\\activate`\n : `source ${pythonVenv.name}/bin/activate`;\n console.log(` $ ${activateCmd}`);\n console.log(pipUpgradeCmd);\n console.log(pipInstallCmd);\n } else {\n console.log(' $ python -m venv .venv');\n console.log(' $ source .venv/bin/activate # On Windows: .venv\\\\Scripts\\\\activate');\n console.log(pipUpgradeCmd);\n console.log(pipInstallCmd);\n }\n console.log(' $ npx agentmark dev\\n');\n\n console.log('─'.repeat(70));\n console.log('Resources');\n console.log('─'.repeat(70));\n console.log(' Documentation: https://docs.agentmark.co');\n console.log('═'.repeat(70) + '\\n');\n\n return usedModels;\n } catch (error) {\n console.error(\"Error creating Python app:\", error);\n throw error;\n }\n};\n","/**\n * Project detection utilities for identifying existing projects.\n * Detects TypeScript/Python projects and their configurations.\n */\n\nimport fs from 'fs-extra';\nimport path from 'path';\nimport {\n type ProjectInfo,\n type ConflictFile,\n type PythonVenvInfo,\n CONFLICT_FILES,\n} from './types.js';\nimport { detectPackageManager } from './package-manager.js';\n\n// Re-export for backwards compatibility\nexport { detectPackageManager };\n\nconst IS_WINDOWS = process.platform === 'win32';\n\n/**\n * Detect if a TypeScript/Node.js project exists in the target directory.\n * Checks for package.json, tsconfig.json, or node_modules.\n */\nexport function detectTypeScriptProject(targetPath: string): boolean {\n const indicators = ['package.json', 'tsconfig.json', 'node_modules'];\n return indicators.some((file) => fs.existsSync(path.join(targetPath, file)));\n}\n\n/**\n * Detect if a Python project exists in the target directory.\n * Checks for pyproject.toml, requirements.txt, setup.py, or virtual environments.\n */\nexport function detectPythonProject(targetPath: string): boolean {\n const indicators = ['pyproject.toml', 'requirements.txt', 'setup.py', '.venv', 'venv'];\n return indicators.some((file) => fs.existsSync(path.join(targetPath, file)));\n}\n\n/**\n * Detect existing Python virtual environment.\n * Checks .venv and venv directories, returns platform-specific paths.\n */\nexport function detectPythonVenv(targetPath: string): PythonVenvInfo | null {\n const venvNames = ['.venv', 'venv'];\n\n for (const name of venvNames) {\n const venvPath = path.join(targetPath, name);\n if (fs.existsSync(venvPath) && fs.statSync(venvPath).isDirectory()) {\n // Check if it's actually a venv (has bin/Scripts and pyvenv.cfg or similar)\n const binDir = IS_WINDOWS ? 'Scripts' : 'bin';\n const binPath = path.join(venvPath, binDir);\n\n if (fs.existsSync(binPath)) {\n const pipExe = IS_WINDOWS ? 'pip.exe' : 'pip';\n\n return {\n path: venvPath,\n name,\n activateCmd: IS_WINDOWS\n ? `${name}\\\\Scripts\\\\activate`\n : `source ${name}/bin/activate`,\n pipPath: path.join(binPath, pipExe),\n };\n }\n }\n }\n\n // Check VIRTUAL_ENV environment variable\n const envVenv = process.env.VIRTUAL_ENV;\n if (envVenv && fs.existsSync(envVenv)) {\n // Check if VIRTUAL_ENV is inside the target directory\n const resolvedTarget = path.resolve(targetPath);\n const resolvedVenv = path.resolve(envVenv);\n const isInsideTarget = resolvedVenv.startsWith(resolvedTarget + path.sep) ||\n resolvedVenv === resolvedTarget;\n\n if (!isInsideTarget) {\n // VIRTUAL_ENV points outside target directory - likely from another project\n // Don't use it as it could give incorrect instructions\n console.warn(\n `⚠️ Note: VIRTUAL_ENV (${envVenv}) points outside the target directory. ` +\n `It will not be used for this initialization.`\n );\n return null;\n }\n\n const binDir = IS_WINDOWS ? 'Scripts' : 'bin';\n const pipExe = IS_WINDOWS ? 'pip.exe' : 'pip';\n const name = path.basename(envVenv);\n\n return {\n path: envVenv,\n name,\n activateCmd: IS_WINDOWS\n ? `${name}\\\\Scripts\\\\activate`\n : `source ${name}/bin/activate`,\n pipPath: path.join(envVenv, binDir, pipExe),\n };\n }\n\n return null;\n}\n\n/**\n * Detect files that may conflict with AgentMark initialization.\n * Returns only the files that actually exist in the target directory.\n */\nexport function detectConflictingFiles(targetPath: string): ConflictFile[] {\n const existingConflicts: ConflictFile[] = [];\n\n for (const conflictFile of CONFLICT_FILES) {\n const fullPath = path.join(targetPath, conflictFile.path);\n if (fs.existsSync(fullPath)) {\n existingConflicts.push(conflictFile);\n }\n }\n\n return existingConflicts;\n}\n\n/**\n * Detect all project information for the target directory.\n * This is the main function that combines all detection logic.\n */\nexport function detectProjectInfo(targetPath: string): ProjectInfo {\n const isTypeScript = detectTypeScriptProject(targetPath);\n const isPython = detectPythonProject(targetPath);\n const isExistingProject = isTypeScript || isPython;\n\n let type: 'typescript' | 'python' | 'unknown' = 'unknown';\n if (isTypeScript && !isPython) {\n type = 'typescript';\n } else if (isPython && !isTypeScript) {\n type = 'python';\n } else if (isTypeScript && isPython) {\n // If both, prefer TypeScript (more common case for polyglot projects)\n type = 'typescript';\n }\n\n const packageManager = detectPackageManager(targetPath);\n const conflictingFiles = detectConflictingFiles(targetPath);\n const hasAgentmarkDir = fs.existsSync(path.join(targetPath, 'agentmark'));\n const pythonVenv = detectPythonVenv(targetPath);\n\n return {\n isExistingProject,\n type,\n packageManager,\n conflictingFiles,\n hasAgentmarkDir,\n pythonVenv,\n };\n}\n\n/**\n * Check if the target path is the current directory.\n * Used to determine if we need to skip mkdir and cd instructions.\n */\nexport function isCurrentDirectory(folderName: string): boolean {\n return folderName === '.' || folderName === './' || folderName === '.\\\\';\n}\n","/**\n * Package manager utilities for detecting and using the correct package manager.\n */\n\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { execSync, execFileSync } from 'child_process';\nimport {\n type PackageManager,\n type PackageManagerConfig,\n PACKAGE_MANAGERS,\n DEFAULT_PACKAGE_MANAGER,\n} from './types.js';\n\n/**\n * Detect the package manager in use by checking for lock files.\n * Priority order: yarn > pnpm > bun > npm.\n */\nexport function detectPackageManager(targetPath: string): PackageManagerConfig {\n // Check lock files in priority order\n const lockFiles = ['yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'package-lock.json'];\n\n for (const lockFile of lockFiles) {\n if (fs.existsSync(path.join(targetPath, lockFile))) {\n const config = PACKAGE_MANAGERS[lockFile];\n if (config) {\n return config;\n }\n }\n }\n\n // Default to npm if no lock file found\n return DEFAULT_PACKAGE_MANAGER;\n}\n\n/**\n * Get the package manager configuration by name.\n */\nexport function getPackageManagerConfig(name: PackageManager): PackageManagerConfig {\n const configs = Object.values(PACKAGE_MANAGERS);\n const config = configs.find((c) => c.name === name);\n return config || DEFAULT_PACKAGE_MANAGER;\n}\n\n/**\n * Install dependencies using the detected package manager.\n */\nexport function installDependencies(\n targetPath: string,\n packageManager: PackageManagerConfig\n): void {\n console.log(`Installing dependencies with ${packageManager.name}...`);\n\n try {\n execSync(packageManager.installCmd, {\n stdio: 'inherit',\n cwd: targetPath,\n });\n console.log('Dependencies installed successfully!');\n } catch (error) {\n console.error(`Error installing dependencies with ${packageManager.name}:`, error);\n throw new Error(\n `Failed to install dependencies. Please run \"${packageManager.installCmd}\" manually.`\n );\n }\n}\n\n/**\n * Add production dependencies using the detected package manager.\n */\nexport function addDependencies(\n targetPath: string,\n packageManager: PackageManagerConfig,\n packages: string[]\n): void {\n if (packages.length === 0) return;\n\n console.log(`Adding dependencies with ${packageManager.name}...`);\n\n try {\n // Build the command arguments\n const cmdParts = packageManager.addCmd.split(' ');\n const cmd = cmdParts[0]!;\n const args = [...cmdParts.slice(1), ...packages];\n\n execFileSync(cmd, args, {\n stdio: 'inherit',\n cwd: targetPath,\n });\n } catch (error) {\n console.error(`Error adding dependencies:`, error);\n throw new Error(\n `Failed to add dependencies. Please run \"${packageManager.addCmd} ${packages.join(' ')}\" manually.`\n );\n }\n}\n\n/**\n * Add dev dependencies using the detected package manager.\n */\nexport function addDevDependencies(\n targetPath: string,\n packageManager: PackageManagerConfig,\n packages: string[]\n): void {\n if (packages.length === 0) return;\n\n console.log(`Adding dev dependencies with ${packageManager.name}...`);\n\n try {\n // Build the command arguments\n const cmdParts = packageManager.addDevCmd.split(' ');\n const cmd = cmdParts[0]!;\n const args = [...cmdParts.slice(1), ...packages];\n\n execFileSync(cmd, args, {\n stdio: 'inherit',\n cwd: targetPath,\n });\n } catch (error) {\n console.error(`Error adding dev dependencies:`, error);\n throw new Error(\n `Failed to add dev dependencies. Please run \"${packageManager.addDevCmd} ${packages.join(' ')}\" manually.`\n );\n }\n}\n\n/**\n * Get the run script command for a package manager.\n * e.g., \"npm run dev\" or \"yarn dev\" or \"pnpm dev\"\n */\nexport function getRunScriptCmd(\n packageManager: PackageManagerConfig,\n script: string\n): string {\n return `${packageManager.runCmd} ${script}`;\n}\n","import { execSync } from \"child_process\";\n\n/**\n * Initialize a git repository and create an initial commit.\n *\n * Skips silently when:\n * - The target path is already inside a git repository\n * - git is not installed\n * - Any git command fails (non-fatal)\n */\nexport function initGitRepo(targetPath: string): boolean {\n try {\n // Check if git is available\n try {\n execSync(\"git --version\", { stdio: \"ignore\" });\n } catch {\n console.log(\"⚠️ git not found — skipping repository initialization\");\n return false;\n }\n\n // Check if already inside a git repo\n try {\n execSync(\"git rev-parse --is-inside-work-tree\", {\n cwd: targetPath,\n stdio: \"ignore\",\n });\n // Already in a git repo — skip\n return false;\n } catch {\n // Not in a git repo — proceed\n }\n\n execSync(\"git init\", { cwd: targetPath, stdio: \"ignore\" });\n execSync(\"git add -A\", { cwd: targetPath, stdio: \"ignore\" });\n execSync(\n 'git -c user.name=\"create-agentmark\" -c user.email=\"noreply\" commit -m \"Initial commit from create-agentmark\"',\n { cwd: targetPath, stdio: \"ignore\" },\n );\n\n console.log(\"✅ Initialized git repository with initial commit\");\n return true;\n } catch {\n console.log(\"⚠️ Could not initialize git repository\");\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,oBAAoB;AAA7B,IA0BM,YAKO;AA/Bb;AAAA;AAAA;AA0BA,IAAM,aAAa,MACjB,QAAQ,IAAI,WAAW,UACvB,QAAQ,IAAI,aAAa,UACzB,QAAQ,IAAI,iCAAiC;AAExC,IAAM,wBAAwB,CAAC,eAA6B;AACjE,UAAI,WAAW,GAAG;AAChB,gBAAQ,IAAI,2EAAiE;AAC7E;AAAA,MACF;AACA,UAAI;AACF,gBAAQ,IAAI,iDAA0C;AACtD,gBAAQ,IAAI,0EAA0E;AACtF;AAAA,UACE;AAAA,UACA,CAAC,SAAS,UAAU,OAAO,qBAAqB;AAAA,UAChD;AAAA,YACE,KAAK;AAAA,YACL,OAAO;AAAA,UACT;AAAA,QACF;AACA,gBAAQ,IAAI,6DAAwD;AAAA,MACtE,SAAS,OAAO;AACd,gBAAQ;AAAA,UACN;AAAA,QACF;AACA,gBAAQ,KAAK,mCAAmC;AAChD,gBAAQ,KAAK,aAAa,UAAU;AACpC,gBAAQ,KAAK,yCAAyC;AACtD,YAAI,iBAAiB,OAAO;AAC1B,kBAAQ,KAAK,cAAc,MAAM,QAAQ,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE;AAAA,QAC3D;AAAA,MACF;AAAA,IACF;AAAA;AAAA;;;AC3DA,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,OAAOC,cAAa;;;ACFpB,OAAOC,SAAQ;AACf,YAAYC,WAAU;;;ACWf,IAAM,sBAAsB,CACjC,aACkC;AAClC,SAAO;AAAA,IACL,UAAU;AAAA,MACR,SAAS;AAAA,MACT,c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BAAgB,aAAa,WAAW;AAAA,EACrH;AACA,SAAO,gBAAgB;AAEvB,MAAI,mBAAmB,SAAS;AAC9B,WAAO,UAAU,aAAa,WAAW,eAAe;AAAA,EAC1D;AAGA,QAAM,oBAAoBC,MAAK,KAAK,YAAY,gBAAgB;AAChE,QAAM,0BAA0B,YAAY,KAAK,CAAC,MAAM,EAAE,SAAS,gBAAgB;AAGnF,MAAI,CAACC,IAAG,WAAW,iBAAiB,KAAK,yBAAyB,WAAW,aAAa;AACxF,IAAAA,IAAG,cAAc,mBAAmB,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAAA,EAC3D,WAAW,yBAAyB,WAAW,QAAQ;AACrD,YAAQ,IAAI,8DAAoD;AAAA,EAClE;AAGA,MAAI,CAAC,YAAY,mBAAmB;AAClC,gBAAY,UAAU;AAAA,EACxB;AACF;AAEA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAM,UAAU,KAAK;AAC7B,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["fs","path","prompts","fs","path","fs","fs","fs","fs","fs","prompts","installAgentmarkSkill","fs","path","setupMCPServer","fs","installAgentmarkSkill","fs","path","fs","path","fs","path","fs","path","execSync","prompts","path","fs"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-agentmark",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Create AgentMark projects with npm create agentmark",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"author": "",
|
|
31
31
|
"license": "AGPL-3.0-or-later",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@agentmark-ai/shared-utils": "0.
|
|
33
|
+
"@agentmark-ai/shared-utils": "0.4.0",
|
|
34
34
|
"fs-extra": "^11.2.0",
|
|
35
35
|
"prompts": "^2.4.2"
|
|
36
36
|
},
|