create-agentmark 0.8.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9,34 +9,6 @@ import prompts2 from "prompts";
9
9
  import fs4 from "fs-extra";
10
10
  import * as path2 from "path";
11
11
 
12
- // src/utils/providers.ts
13
- var Providers = {
14
- openai: {
15
- label: "OpenAI",
16
- languageModels: [
17
- "gpt-4o",
18
- "gpt-4o-mini",
19
- "gpt-4",
20
- "gpt-5",
21
- "gpt-4-turbo",
22
- "gpt-3.5-turbo"
23
- ],
24
- imageModels: ["dall-e-3", "dall-e-2"],
25
- speechModels: ["tts-1", "tts-1-hd"]
26
- },
27
- anthropic: {
28
- label: "Anthropic",
29
- languageModels: [
30
- "claude-sonnet-4-20250514",
31
- "claude-opus-4-20250514",
32
- "claude-3-5-sonnet-20241022",
33
- "claude-3-5-haiku-20241022"
34
- ],
35
- imageModels: [],
36
- speechModels: []
37
- }
38
- };
39
-
40
12
  // src/utils/examples/templates/adapters.ts
41
13
  var createAdapterConfig = (provider) => {
42
14
  return {
@@ -599,7 +571,7 @@ var getAnimalDrawingPrompt = () => {
599
571
  return `---
600
572
  name: animal-drawing
601
573
  image_config:
602
- model_name: dall-e-3
574
+ model_name: openai/dall-e-3
603
575
  num_images: 1
604
576
  size: 1024x1024
605
577
  aspect_ratio: 1:1
@@ -701,7 +673,7 @@ var getStoryTellerPrompt = () => {
701
673
  return `---
702
674
  name: story-teller
703
675
  speech_config:
704
- model_name: tts-1-hd
676
+ model_name: openai/tts-1-hd
705
677
  voice: "nova"
706
678
  speed: 1.0
707
679
  output_format: "mp3"
@@ -746,20 +718,23 @@ var getStoryDataset = () => {
746
718
  import fs3 from "fs-extra";
747
719
  var createExamplePrompts = (model, targetPath = ".", adapter = "ai-sdk") => {
748
720
  fs3.ensureDirSync(`${targetPath}/agentmark`);
749
- const noImageSupport = ["mastra", "claude-agent-sdk"];
750
- const noSpeechSupport = ["mastra", "claude-agent-sdk"];
721
+ const noImageSupport = ["mastra", "claude-agent-sdk", "pydantic-ai"];
722
+ const noSpeechSupport = ["mastra", "claude-agent-sdk", "pydantic-ai"];
751
723
  const skipImagePrompts = noImageSupport.includes(adapter);
752
724
  const skipSpeechPrompts = noSpeechSupport.includes(adapter);
725
+ const usedModels = [];
753
726
  if (!skipImagePrompts) {
754
727
  const animalDrawingPrompt = getAnimalDrawingPrompt();
755
728
  fs3.writeFileSync(`${targetPath}/agentmark/animal-drawing.prompt.mdx`, animalDrawingPrompt);
756
729
  const animalDataset = getAnimalDataset();
757
730
  fs3.writeFileSync(`${targetPath}/agentmark/animal.jsonl`, animalDataset);
731
+ usedModels.push("openai/dall-e-3");
758
732
  }
759
733
  const customerSupportPrompt = getCustomerSupportPrompt(model);
760
734
  fs3.writeFileSync(`${targetPath}/agentmark/customer-support-agent.prompt.mdx`, customerSupportPrompt);
761
735
  const customerQueryDataset = getCustomerQueryDataset();
762
736
  fs3.writeFileSync(`${targetPath}/agentmark/customer-query.jsonl`, customerQueryDataset);
737
+ usedModels.push(model);
763
738
  const partyPlannerPrompt = getPartyPlannerPrompt(model);
764
739
  fs3.writeFileSync(`${targetPath}/agentmark/party-planner.prompt.mdx`, partyPlannerPrompt);
765
740
  const partyDataset = getPartyDataset();
@@ -769,18 +744,18 @@ var createExamplePrompts = (model, targetPath = ".", adapter = "ai-sdk") => {
769
744
  fs3.writeFileSync(`${targetPath}/agentmark/story-teller.prompt.mdx`, storyTellerPrompt);
770
745
  const storyDataset = getStoryDataset();
771
746
  fs3.writeFileSync(`${targetPath}/agentmark/story.jsonl`, storyDataset);
747
+ usedModels.push("openai/tts-1-hd");
772
748
  }
749
+ return [...new Set(usedModels)];
773
750
  };
774
751
 
775
752
  // src/utils/examples/templates/user-client-config.ts
776
753
  var getClientConfigContent = (options) => {
777
- const { provider, languageModels, adapter, deploymentMode = "cloud" } = options;
754
+ const { provider, adapter, deploymentMode = "cloud" } = options;
778
755
  const adapterConfig = getAdapterConfig(adapter, provider);
779
756
  const { modelRegistry, toolRegistry } = adapterConfig.classes;
780
757
  const isClaudeAgentSdk = adapter === "claude-agent-sdk";
781
758
  const providerImport = isClaudeAgentSdk ? "" : `import { ${provider} } from '@ai-sdk/${provider}';`;
782
- const extraModelRegs = provider === "openai" && !isClaudeAgentSdk ? `.registerModels(["dall-e-3"], (name: string) => ${provider}.image(name))
783
- .registerModels(["tts-1-hd"], (name: string) => ${provider}.speech(name))` : "";
784
759
  const loaderImport = deploymentMode === "cloud" ? `import { ApiLoader } from "@agentmark-ai/loader-api";` : `import { ApiLoader } from "@agentmark-ai/loader-api";
785
760
  import { FileLoader } from "@agentmark-ai/loader-file";`;
786
761
  const loaderSetup = deploymentMode === "cloud" ? ` // ApiLoader works for both development and production
@@ -810,8 +785,7 @@ import { FileLoader } from "@agentmark-ai/loader-file";`;
810
785
  return modelRegistry;
811
786
  }` : `function createModelRegistry() {
812
787
  const modelRegistry = new ${modelRegistry}()
813
- .registerModels(${JSON.stringify(languageModels)}, (name: string) => ${provider}(name))
814
- ${extraModelRegs};
788
+ .registerProviders({ ${provider} });
815
789
  return modelRegistry;
816
790
  }`;
817
791
  const adapterOptionsImport = isClaudeAgentSdk ? `
@@ -997,38 +971,6 @@ function displayProjectDetectionSummary(projectInfo) {
997
971
  console.log("");
998
972
  }
999
973
 
1000
- // src/utils/git-init.ts
1001
- import { execSync as execSync2 } from "child_process";
1002
- function initGitRepo(targetPath) {
1003
- try {
1004
- try {
1005
- execSync2("git --version", { stdio: "ignore" });
1006
- } catch {
1007
- console.log("\u26A0\uFE0F git not found \u2014 skipping repository initialization");
1008
- return false;
1009
- }
1010
- try {
1011
- execSync2("git rev-parse --is-inside-work-tree", {
1012
- cwd: targetPath,
1013
- stdio: "ignore"
1014
- });
1015
- return false;
1016
- } catch {
1017
- }
1018
- execSync2("git init", { cwd: targetPath, stdio: "ignore" });
1019
- execSync2("git add -A", { cwd: targetPath, stdio: "ignore" });
1020
- execSync2(
1021
- 'git -c user.name="create-agentmark" -c user.email="noreply" commit -m "Initial commit from create-agentmark"',
1022
- { cwd: targetPath, stdio: "ignore" }
1023
- );
1024
- console.log("\u2705 Initialized git repository with initial commit");
1025
- return true;
1026
- } catch {
1027
- console.log("\u26A0\uFE0F Could not initialize git repository");
1028
- return false;
1029
- }
1030
- }
1031
-
1032
974
  // src/utils/examples/create-example-app.ts
1033
975
  var setupMCPServer = (client, targetPath) => {
1034
976
  if (client === "skip") {
@@ -1147,7 +1089,7 @@ var setupMCPServer = (client, targetPath) => {
1147
1089
  var createExampleApp = async (client, targetPath = ".", apiKey = "", adapter = "ai-sdk", deploymentMode = "cloud", projectInfo = null, resolutions = []) => {
1148
1090
  try {
1149
1091
  const modelProvider = adapter === "claude-agent-sdk" ? "anthropic" : "openai";
1150
- const model = adapter === "claude-agent-sdk" ? "claude-sonnet-4-20250514" : "gpt-4o";
1092
+ const model = adapter === "claude-agent-sdk" ? "anthropic/claude-sonnet-4-20250514" : "openai/gpt-4o";
1151
1093
  const isExistingProject = projectInfo?.isExistingProject ?? false;
1152
1094
  if (isExistingProject) {
1153
1095
  console.log("Adding AgentMark to existing project...");
@@ -1157,12 +1099,11 @@ var createExampleApp = async (client, targetPath = ".", apiKey = "", adapter = "
1157
1099
  const folderName = targetPath;
1158
1100
  fs4.ensureDirSync(`${targetPath}/agentmark`);
1159
1101
  setupMCPServer(client, targetPath);
1160
- createExamplePrompts(model, targetPath, adapter);
1102
+ const usedModels = createExamplePrompts(model, targetPath, adapter);
1161
1103
  console.log(`\u2705 Example prompts and datasets created in ${folderName}/agentmark/`);
1162
- const langModels = Providers[modelProvider].languageModels.slice(0, 1);
1163
1104
  fs4.writeFileSync(
1164
1105
  `${targetPath}/agentmark.client.ts`,
1165
- getClientConfigContent({ provider: modelProvider, languageModels: langModels, adapter, deploymentMode })
1106
+ getClientConfigContent({ provider: modelProvider, adapter, deploymentMode })
1166
1107
  );
1167
1108
  if (shouldMergeFile(".env", projectInfo, resolutions)) {
1168
1109
  const envVars = {};
@@ -1283,9 +1224,6 @@ main().catch((err) => {
1283
1224
  fs4.writeFileSync(devEntryPath, devEntryContent);
1284
1225
  console.log(`\u2705 Created dev-entry.ts at project root`);
1285
1226
  }
1286
- if (!isExistingProject) {
1287
- initGitRepo(targetPath);
1288
- }
1289
1227
  console.log("\n\u2705 Agentmark initialization completed successfully!");
1290
1228
  console.log(
1291
1229
  `
@@ -1321,6 +1259,7 @@ main().catch((err) => {
1321
1259
  console.log("\u2500".repeat(70));
1322
1260
  console.log(" Documentation: https://docs.agentmark.co");
1323
1261
  console.log("\u2550".repeat(70) + "\n");
1262
+ return usedModels;
1324
1263
  } catch (error) {
1325
1264
  console.error("Error creating example app:", error);
1326
1265
  throw error;
@@ -1807,7 +1746,7 @@ htmlcov/
1807
1746
  };
1808
1747
  var createPythonApp = async (client, targetPath = ".", apiKey = "", deploymentMode = "cloud", adapter = "pydantic-ai", projectInfo = null, resolutions = []) => {
1809
1748
  try {
1810
- const model = adapter === "claude-agent-sdk" ? "claude-sonnet-4-20250514" : "gpt-4o";
1749
+ const model = adapter === "claude-agent-sdk" ? "anthropic/claude-sonnet-4-20250514" : "openai/gpt-4o";
1811
1750
  const adapterDisplayName = adapter === "claude-agent-sdk" ? "Claude Agent SDK" : "Pydantic AI";
1812
1751
  const isExistingProject = projectInfo?.isExistingProject ?? false;
1813
1752
  if (isExistingProject) {
@@ -1818,7 +1757,7 @@ var createPythonApp = async (client, targetPath = ".", apiKey = "", deploymentMo
1818
1757
  const folderName = targetPath;
1819
1758
  fs5.ensureDirSync(`${targetPath}/agentmark`);
1820
1759
  setupMCPServer2(client, targetPath);
1821
- createExamplePrompts(model, targetPath, adapter);
1760
+ const usedModels = createExamplePrompts(model, targetPath, adapter);
1822
1761
  console.log(`Example prompts and datasets created in ${folderName}/agentmark/`);
1823
1762
  if (!isExistingProject) {
1824
1763
  const projectName = path3.basename(targetPath).replace(/[^a-zA-Z0-9_-]/g, "-");
@@ -1893,9 +1832,6 @@ var createPythonApp = async (client, targetPath = ".", apiKey = "", deploymentMo
1893
1832
  console.log("Note: You'll need to set up a virtual environment and install dependencies.");
1894
1833
  console.log("");
1895
1834
  }
1896
- if (!isExistingProject) {
1897
- initGitRepo(targetPath);
1898
- }
1899
1835
  console.log("\n\u2705 AgentMark Python initialization completed successfully!");
1900
1836
  console.log(
1901
1837
  `
@@ -1930,6 +1866,7 @@ var createPythonApp = async (client, targetPath = ".", apiKey = "", deploymentMo
1930
1866
  console.log("\u2500".repeat(70));
1931
1867
  console.log(" Documentation: https://docs.agentmark.co");
1932
1868
  console.log("\u2550".repeat(70) + "\n");
1869
+ return usedModels;
1933
1870
  } catch (error) {
1934
1871
  console.error("Error creating Python app:", error);
1935
1872
  throw error;
@@ -2046,6 +1983,38 @@ function isCurrentDirectory(folderName) {
2046
1983
  return folderName === "." || folderName === "./" || folderName === ".\\";
2047
1984
  }
2048
1985
 
1986
+ // src/utils/git-init.ts
1987
+ import { execSync as execSync2 } from "child_process";
1988
+ function initGitRepo(targetPath) {
1989
+ try {
1990
+ try {
1991
+ execSync2("git --version", { stdio: "ignore" });
1992
+ } catch {
1993
+ console.log("\u26A0\uFE0F git not found \u2014 skipping repository initialization");
1994
+ return false;
1995
+ }
1996
+ try {
1997
+ execSync2("git rev-parse --is-inside-work-tree", {
1998
+ cwd: targetPath,
1999
+ stdio: "ignore"
2000
+ });
2001
+ return false;
2002
+ } catch {
2003
+ }
2004
+ execSync2("git init", { cwd: targetPath, stdio: "ignore" });
2005
+ execSync2("git add -A", { cwd: targetPath, stdio: "ignore" });
2006
+ execSync2(
2007
+ 'git -c user.name="create-agentmark" -c user.email="noreply" commit -m "Initial commit from create-agentmark"',
2008
+ { cwd: targetPath, stdio: "ignore" }
2009
+ );
2010
+ console.log("\u2705 Initialized git repository with initial commit");
2011
+ return true;
2012
+ } catch {
2013
+ console.log("\u26A0\uFE0F Could not initialize git repository");
2014
+ return false;
2015
+ }
2016
+ }
2017
+
2049
2018
  // src/index.ts
2050
2019
  var parseArgs = () => {
2051
2020
  const args = process.argv.slice(2);
@@ -2127,7 +2096,6 @@ var main = async () => {
2127
2096
  });
2128
2097
  adapter = response.adapter;
2129
2098
  }
2130
- config.builtInModels = adapter === "claude-agent-sdk" ? ["claude-sonnet-4-20250514"] : ["gpt-4o"];
2131
2099
  const apiKeyName = adapter === "claude-agent-sdk" ? "Anthropic" : "OpenAI";
2132
2100
  let apiKey = "";
2133
2101
  const { providedApiKey } = await prompts2({
@@ -2170,11 +2138,13 @@ var main = async () => {
2170
2138
  { title: "Skip", value: "skip" }
2171
2139
  ]
2172
2140
  });
2141
+ let usedModels;
2173
2142
  if (language === "python") {
2174
- await createPythonApp(client, targetPath, apiKey, deploymentMode, adapter, projectInfo, resolutions);
2143
+ usedModels = await createPythonApp(client, targetPath, apiKey, deploymentMode, adapter, projectInfo, resolutions);
2175
2144
  } else {
2176
- await createExampleApp(client, targetPath, apiKey, adapter, deploymentMode, projectInfo, resolutions);
2145
+ usedModels = await createExampleApp(client, targetPath, apiKey, adapter, deploymentMode, projectInfo, resolutions);
2177
2146
  }
2147
+ config.builtInModels = usedModels;
2178
2148
  const agentmarkJsonPath = path6.join(targetPath, "agentmark.json");
2179
2149
  const agentmarkJsonResolution = resolutions.find((r) => r.path === "agentmark.json");
2180
2150
  if (!fs8.existsSync(agentmarkJsonPath) || agentmarkJsonResolution?.action === "overwrite") {
@@ -2182,6 +2152,9 @@ var main = async () => {
2182
2152
  } else if (agentmarkJsonResolution?.action === "skip") {
2183
2153
  console.log("\u23ED\uFE0F Skipped agentmark.json (keeping existing file)");
2184
2154
  }
2155
+ if (!projectInfo.isExistingProject) {
2156
+ initGitRepo(targetPath);
2157
+ }
2185
2158
  };
2186
2159
  main().catch((error) => {
2187
2160
  console.error("Error:", error);