create-agentmark 1.1.3 → 1.1.5

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.d.ts CHANGED
@@ -41,7 +41,7 @@
41
41
  * IDE inherits the shell — what we write here is the default for
42
42
  * cold-launched IDEs.
43
43
  */
44
- type McpClient = "vscode" | "zed" | "cursor" | "claude-code" | "skip";
44
+ type McpClient = "vscode" | "zed" | "cursor" | "claude-code" | "codex" | "skip";
45
45
 
46
46
  /**
47
47
  * `npm create agentmark` — minimal init.
@@ -102,12 +102,33 @@ declare const resolveTargetPath: (cliPath: string | undefined, yes?: boolean) =>
102
102
  isCurrentDir: boolean;
103
103
  } | null>;
104
104
  /**
105
- * Resolves which IDE clients to wire MCP into. All 4 are pre-selected on
106
- * the prompt so the typical "I use everything" case is one keystroke
107
- * (Enter). Empty selection is equivalent to the old "Skip" option — the
108
- * caller just writes nothing.
105
+ * Detects which IDE clients the user has installed or is actively running.
106
+ *
107
+ * Detection order (matches the vercel-labs/skills CLI approach):
108
+ * 1. Home dir which editors are *installed* (`~/.claude`, `~/.cursor`,
109
+ * Zed config dir). Most reliable; works for greenfield projects too.
110
+ * 2. Env vars — detect the *current* editor session. VS Code has no
111
+ * canonical home-dir marker, so env vars are the right signal for it.
112
+ * Cursor-specific vars are checked before VS Code vars because Cursor
113
+ * inherits `VSCODE_PID`/`TERM_PROGRAM=vscode`.
114
+ * 3. Project dir — already-wired editors in this specific repo (fallback
115
+ * when steps 1–2 return nothing, e.g. in a fully offline environment
116
+ * with a pre-existing project).
117
+ *
118
+ * Returns an empty array when nothing can be inferred — callers treat that
119
+ * as "no default; let the user choose explicitly."
120
+ *
121
+ * `homedir` is injectable for tests (defaults to `os.homedir()`).
122
+ */
123
+ declare const detectCurrentClients: (targetPath: string, homedir?: string) => McpClient[];
124
+ /**
125
+ * Resolves which IDE clients to wire MCP into. The prompt pre-selects
126
+ * clients already detected in the project (or the running editor via env
127
+ * vars); if nothing is detected the list starts with nothing selected so
128
+ * the user makes an explicit choice. Empty selection skips MCP wiring
129
+ * entirely.
109
130
  */
110
- declare const resolveClients: (cliClients: McpClient[] | undefined, yes?: boolean) => Promise<McpClient[]>;
131
+ declare const resolveClients: (cliClients: McpClient[] | undefined, yes?: boolean, targetPath?: string) => Promise<McpClient[]>;
111
132
  /**
112
133
  * agentmark.json is the only file we conflict on (the others — MCP config
113
134
  * dirs, agentmark/, .gitkeep — are either additive or no-ops if present).
@@ -118,4 +139,4 @@ declare const shouldWriteAgentmarkJson: (filePath: string, overwrite: boolean |
118
139
  declare const USAGE = "Usage: npm create agentmark [folder] [-- options]\n npx create-agentmark [folder] [options]\n\nSets up AgentMark in a new or existing project: writes agentmark.json,\ncreates the agentmark/ prompts directory, wires IDE MCP configs, and\ninstalls the AgentMark agent skill.\n\nOptions:\n [folder], --path <folder> Target directory. Default: \".\" inside an\n existing project, else \"my-agentmark-app\".\n --client <ids|all> IDE clients to wire MCP configs for, comma-\n separated: claude-code, cursor, vscode, zed.\n -y, --yes Non-interactive: accept the default for every\n prompt (folder default above, all IDE clients,\n keep an existing agentmark.json). For CI and\n coding agents.\n --overwrite Replace an existing agentmark.json with the\n default config.\n -h, --help Show this help.\n";
119
140
  declare const main: () => Promise<void>;
120
141
 
121
- export { AGENTMARK_JSON, ALL_CLIENTS, type CliArgs, USAGE, clientLabel, defaultFolderName, main, parseArgs, resolveClients, resolveTargetPath, shouldWriteAgentmarkJson };
142
+ export { AGENTMARK_JSON, ALL_CLIENTS, type CliArgs, USAGE, clientLabel, defaultFolderName, detectCurrentClients, main, parseArgs, resolveClients, resolveTargetPath, shouldWriteAgentmarkJson };
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  // src/index.ts
4
4
  import fs3 from "fs-extra";
5
+ import os from "os";
5
6
  import path3 from "path";
6
7
  import prompts from "prompts";
7
8
  import { pathToFileURL, fileURLToPath } from "url";
@@ -12,6 +13,7 @@ import * as path from "path";
12
13
  var CLOUD_API_URL = "https://api.agentmark.co";
13
14
  var LOCAL_DEV_URL = "http://localhost:9418";
14
15
  var MCP_SERVER_PACKAGE = "@agentmark-ai/mcp-server";
16
+ var DOCS_ENTRY_URL = "https://docs.agentmark.co/mcp";
15
17
  function stdioEntry(apiUrl, includeType) {
16
18
  const entry = {
17
19
  command: "npx",
@@ -113,6 +115,30 @@ function writeMcpConfig(client, targetPath, opts = {}) {
113
115
  fs.writeJsonSync(configPath, config, { spaces: 2 });
114
116
  return { configPath };
115
117
  }
118
+ if (client === "codex") {
119
+ const codexDir = path.join(targetPath, ".codex");
120
+ fs.ensureDirSync(codexDir);
121
+ const configPath = path.join(codexDir, "config.toml");
122
+ const cloudEnv = cloudUrl !== CLOUD_API_URL ? `
123
+ env = { AGENTMARK_API_URL = "${cloudUrl}" }` : "";
124
+ const toml = [
125
+ "# AgentMark MCP servers \u2014 managed by create-agentmark",
126
+ "[mcp_servers.agentmark-docs]",
127
+ `url = "${DOCS_ENTRY_URL}"`,
128
+ "",
129
+ "[mcp_servers.agentmark]",
130
+ `command = "npx"`,
131
+ `args = ["-y", "${MCP_SERVER_PACKAGE}"]${cloudEnv}`,
132
+ "",
133
+ "[mcp_servers.agentmark-local]",
134
+ `command = "npx"`,
135
+ `args = ["-y", "${MCP_SERVER_PACKAGE}"]`,
136
+ `env = { AGENTMARK_API_URL = "${LOCAL_DEV_URL}" }`,
137
+ ""
138
+ ].join("\n");
139
+ fs.writeFileSync(configPath, toml, "utf8");
140
+ return { configPath };
141
+ }
116
142
  return null;
117
143
  }
118
144
 
@@ -204,14 +230,14 @@ function isCurrentDirectory(folderName) {
204
230
  }
205
231
 
206
232
  // src/index.ts
207
- var ALL_CLIENTS = ["claude-code", "cursor", "vscode", "zed"];
233
+ var ALL_CLIENTS = ["claude-code", "codex", "cursor", "vscode", "zed"];
208
234
  var AGENTMARK_JSON = {
209
235
  $schema: "https://raw.githubusercontent.com/agentmark-ai/agentmark/refs/heads/main/packages/cli/agentmark.schema.json",
210
236
  version: "2.0.0",
211
237
  mdxVersion: "1.0",
212
238
  agentmarkPath: ".",
213
239
  // Seed one model so the dashboard prompt editor isn't an empty dropdown on
214
- // first run. Add more with `npx agentmark pull-models` (writes provider/model
240
+ // first run. Add more with `npx @agentmark-ai/cli pull-models` (writes provider/model
215
241
  // entries here) — see https://docs.agentmark.co/configure/model-schemas.
216
242
  builtInModels: ["openai/gpt-5.5"]
217
243
  };
@@ -244,7 +270,7 @@ var parseArgs = (argv = process.argv.slice(2)) => {
244
270
  }
245
271
  return result;
246
272
  };
247
- var clientLabel = (id) => id === "vscode" ? "VS Code" : id === "zed" ? "Zed" : id === "cursor" ? "Cursor" : id === "claude-code" ? "Claude Code" : id;
273
+ var clientLabel = (id) => id === "vscode" ? "VS Code" : id === "zed" ? "Zed" : id === "cursor" ? "Cursor" : id === "claude-code" ? "Claude Code" : id === "codex" ? "Codex" : id;
248
274
  var defaultFolderName = (cwd = process.cwd()) => fs3.existsSync(path3.join(cwd, "package.json")) || fs3.existsSync(path3.join(cwd, "pyproject.toml")) ? "." : "my-agentmark-app";
249
275
  var resolveTargetPath = async (cliPath, yes) => {
250
276
  let folderName = cliPath;
@@ -266,7 +292,26 @@ var resolveTargetPath = async (cliPath, yes) => {
266
292
  if (!isCurrentDir) fs3.ensureDirSync(targetPath);
267
293
  return { targetPath, isCurrentDir };
268
294
  };
269
- var resolveClients = async (cliClients, yes) => {
295
+ var detectCurrentClients = (targetPath, homedir = os.homedir()) => {
296
+ const detected = /* @__PURE__ */ new Set();
297
+ if (fs3.existsSync(path3.join(homedir, ".claude"))) detected.add("claude-code");
298
+ if (fs3.existsSync(path3.join(homedir, ".codex"))) detected.add("codex");
299
+ if (fs3.existsSync(path3.join(homedir, ".cursor"))) detected.add("cursor");
300
+ if (fs3.existsSync(path3.join(homedir, ".config", "zed")) || fs3.existsSync(path3.join(homedir, "Library", "Application Support", "zed"))) detected.add("zed");
301
+ if (process.env["CURSOR_TRACE_ID"] ?? process.env["CURSOR_CHANNEL"]) {
302
+ detected.add("cursor");
303
+ } else if (process.env["VSCODE_PID"] ?? process.env["TERM_PROGRAM"] === "vscode") {
304
+ detected.add("vscode");
305
+ }
306
+ if (detected.size > 0) return [...detected];
307
+ if (fs3.existsSync(path3.join(targetPath, ".vscode"))) detected.add("vscode");
308
+ if (fs3.existsSync(path3.join(targetPath, ".codex"))) detected.add("codex");
309
+ if (fs3.existsSync(path3.join(targetPath, ".cursor"))) detected.add("cursor");
310
+ if (fs3.existsSync(path3.join(targetPath, ".zed"))) detected.add("zed");
311
+ if (fs3.existsSync(path3.join(targetPath, ".mcp.json")) || fs3.existsSync(path3.join(targetPath, ".claude"))) detected.add("claude-code");
312
+ return [...detected];
313
+ };
314
+ var resolveClients = async (cliClients, yes, targetPath) => {
270
315
  if (cliClients && cliClients.length > 0) {
271
316
  for (const c of cliClients) {
272
317
  if (!ALL_CLIENTS.includes(c)) {
@@ -276,6 +321,7 @@ var resolveClients = async (cliClients, yes) => {
276
321
  return cliClients;
277
322
  }
278
323
  if (yes) return [...ALL_CLIENTS];
324
+ const defaultSelected = targetPath ? detectCurrentClients(targetPath) : [];
279
325
  const response = await prompts({
280
326
  name: "clients",
281
327
  type: "multiselect",
@@ -285,7 +331,7 @@ var resolveClients = async (cliClients, yes) => {
285
331
  choices: ALL_CLIENTS.map((id) => ({
286
332
  title: clientLabel(id),
287
333
  value: id,
288
- selected: true
334
+ selected: defaultSelected.includes(id)
289
335
  }))
290
336
  });
291
337
  return response.clients ?? [];
@@ -339,7 +385,7 @@ var main = async () => {
339
385
  }
340
386
  const { targetPath } = target;
341
387
  const projectInfo = detectProjectInfo(targetPath);
342
- const clients = await resolveClients(cliArgs.clients, cliArgs.yes);
388
+ const clients = await resolveClients(cliArgs.clients, cliArgs.yes, targetPath);
343
389
  console.log("");
344
390
  const agentmarkJsonPath = path3.join(targetPath, "agentmark.json");
345
391
  if (await shouldWriteAgentmarkJson(agentmarkJsonPath, cliArgs.overwrite, cliArgs.yes)) {
@@ -405,6 +451,7 @@ export {
405
451
  USAGE,
406
452
  clientLabel,
407
453
  defaultFolderName,
454
+ detectCurrentClients,
408
455
  main,
409
456
  parseArgs,
410
457
  resolveClients,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/utils/examples/mcp-config.ts","../src/utils/install-skill.ts","../src/utils/git-init.ts","../src/utils/project-detection.ts"],"sourcesContent":["import fs from \"fs-extra\";\nimport path from \"path\";\nimport prompts from \"prompts\";\nimport { pathToFileURL, fileURLToPath } from \"url\";\nimport { writeMcpConfig, type McpClient } from \"./utils/examples/mcp-config.js\";\nimport { installAgentmarkSkill } from \"./utils/install-skill.js\";\nimport { initGitRepo } from \"./utils/git-init.js\";\nimport { detectProjectInfo, isCurrentDirectory } from \"./utils/project-detection.js\";\n\n/**\n * `npm create agentmark` — minimal init.\n *\n * Scope is deliberately small. The CLI does NOT scaffold example code,\n * pick an LLM adapter, or handle login. Its job is:\n *\n * 1. Write `agentmark.json` (the SDK loader's config root)\n * 2. Create an empty `agentmark/` directory (where prompts go)\n * 3. Wire MCP configs for any IDE clients the user selects\n * 4. Install the AgentMark agent skill (`npx skills add agentmark-ai/skills`)\n * 5. Hand off to the AI tool: \"Open Claude Code / Cursor and say:\n * Set up AgentMark in this project.\"\n *\n * Everything else — framework detection, package install, code wiring,\n * first prompt — is the job of the `setup-and-integration` skill workflow,\n * which runs inside the user's IDE agent. That keeps integration adaptive\n * to whatever stack the user already has, instead of forcing a template.\n */\n\nexport interface CliArgs {\n path?: string;\n clients?: McpClient[];\n /**\n * Undocumented escape hatch for internal staging\n * (`https://api-stg.agentmark.co`) and rare self-hosters. Defaults to\n * `https://api.agentmark.co`. The `agentmark-local` MCP entry always\n * points at `http://localhost:9418` regardless of this flag.\n */\n apiUrl?: string;\n overwrite?: boolean;\n /**\n * Non-interactive mode for CI and coding agents: every prompt is replaced\n * by its default (target folder per `defaultFolderName`, all IDE clients,\n * keep an existing agentmark.json). Headless onboarding depends on this —\n * without it the init blocks on a TTY no agent has.\n */\n yes?: boolean;\n help?: boolean;\n}\n\nexport const ALL_CLIENTS: readonly McpClient[] = [\"claude-code\", \"cursor\", \"vscode\", \"zed\"];\n\nexport const AGENTMARK_JSON: Record<string, unknown> = {\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 // Seed one model so the dashboard prompt editor isn't an empty dropdown on\n // first run. Add more with `npx agentmark pull-models` (writes provider/model\n // entries here) — see https://docs.agentmark.co/configure/model-schemas.\n builtInModels: [\"openai/gpt-5.5\"],\n};\n\nexport const parseArgs = (argv: string[] = process.argv.slice(2)): CliArgs => {\n const result: CliArgs = {};\n\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg === \"--path\") {\n result.path = argv[++i];\n } else if (arg === \"--client\") {\n const value = argv[++i];\n if (!value) throw new Error(\"--client requires a value\");\n const ids = value === \"all\"\n ? [...ALL_CLIENTS]\n : value.split(\",\").map((s) => s.trim()).filter(Boolean) as McpClient[];\n result.clients = [...(result.clients ?? []), ...ids];\n } else if (arg === \"--overwrite\") {\n result.overwrite = true;\n } else if (arg === \"--yes\" || arg === \"-y\") {\n result.yes = true;\n } else if (arg === \"--help\" || arg === \"-h\") {\n result.help = true;\n } else if (arg === \"--api-url\") {\n const value = argv[++i];\n if (!value || !/^https?:\\/\\//.test(value)) {\n throw new Error(`--api-url requires a full http(s) URL (got \"${value}\")`);\n }\n result.apiUrl = value;\n } else if (arg && !arg.startsWith(\"--\") && !result.path) {\n // Positional: folder name, matches `npx create-next-app my-app` shape.\n result.path = arg;\n }\n }\n\n return result;\n};\n\nexport const clientLabel = (id: string): string =>\n id === \"vscode\" ? \"VS Code\"\n : id === \"zed\" ? \"Zed\"\n : id === \"cursor\" ? \"Cursor\"\n : id === \"claude-code\" ? \"Claude Code\"\n : id;\n\n/**\n * The folder the interactive prompt would offer as its default: \".\" when\n * cwd looks like an existing project (the common \"wire AgentMark into my\n * repo\" case), a fresh folder name when cwd is empty (greenfield). `--yes`\n * resolves to exactly this value, so a non-interactive run lands where an\n * Enter-mashing interactive run would have.\n */\nexport const defaultFolderName = (cwd: string = process.cwd()): string =>\n fs.existsSync(path.join(cwd, \"package.json\")) ||\n fs.existsSync(path.join(cwd, \"pyproject.toml\"))\n ? \".\"\n : \"my-agentmark-app\";\n\n/**\n * Resolves the target folder via positional/flag arg, `--yes` default, or\n * interactive prompt.\n */\nexport const resolveTargetPath = async (\n cliPath: string | undefined,\n yes?: boolean,\n): Promise<{ targetPath: string; isCurrentDir: boolean } | null> => {\n let folderName = cliPath;\n if (!folderName && yes) {\n folderName = defaultFolderName();\n }\n if (!folderName) {\n const response = await prompts({\n name: \"folderName\",\n type: \"text\",\n message: \"Where would you like to set up AgentMark?\",\n initial: defaultFolderName(),\n });\n folderName = response.folderName;\n }\n if (!folderName) return null; // Ctrl+C / empty input\n\n const isCurrentDir = isCurrentDirectory(folderName);\n const targetPath = isCurrentDir ? process.cwd() : path.resolve(folderName);\n if (!isCurrentDir) fs.ensureDirSync(targetPath);\n return { targetPath, isCurrentDir };\n};\n\n/**\n * Resolves which IDE clients to wire MCP into. All 4 are pre-selected on\n * the prompt so the typical \"I use everything\" case is one keystroke\n * (Enter). Empty selection is equivalent to the old \"Skip\" option — the\n * caller just writes nothing.\n */\nexport const resolveClients = async (\n cliClients: McpClient[] | undefined,\n yes?: boolean,\n): Promise<McpClient[]> => {\n if (cliClients && cliClients.length > 0) {\n for (const c of cliClients) {\n if (!ALL_CLIENTS.includes(c)) {\n throw new Error(`Invalid client \"${c}\". Valid: ${ALL_CLIENTS.join(\", \")}`);\n }\n }\n return cliClients;\n }\n // --yes mirrors the interactive default: all clients pre-selected.\n if (yes) return [...ALL_CLIENTS];\n const response = await prompts({\n name: \"clients\",\n type: \"multiselect\",\n message: \"Wire AgentMark MCP into which IDE clients?\",\n instructions: false,\n hint: \"Space to toggle. Enter to submit. Skip all = empty selection.\",\n choices: ALL_CLIENTS.map((id) => ({\n title: clientLabel(id),\n value: id,\n selected: true,\n })),\n });\n return (response.clients ?? []) as McpClient[];\n};\n\n/**\n * agentmark.json is the only file we conflict on (the others — MCP config\n * dirs, agentmark/, .gitkeep — are either additive or no-ops if present).\n * Default to \"skip\" so we never silently clobber an existing project's\n * config; `--overwrite` is the explicit opt-in for re-init scripts.\n */\nexport const shouldWriteAgentmarkJson = async (\n filePath: string,\n overwrite: boolean | undefined,\n yes?: boolean,\n): Promise<boolean> => {\n if (!fs.existsSync(filePath)) return true;\n if (overwrite) return true;\n // --yes takes the safe interactive default: keep the existing file.\n // Clobbering config is never a default; --overwrite is the explicit opt-in.\n if (yes) return false;\n const { action } = await prompts({\n type: \"select\",\n name: \"action\",\n message: \"agentmark.json already exists. What would you like to do?\",\n choices: [\n { title: \"Skip (keep existing)\", value: \"skip\" },\n { title: \"Overwrite with default config\", value: \"overwrite\" },\n ],\n initial: 0,\n });\n return action === \"overwrite\";\n};\n\nexport const USAGE = `Usage: npm create agentmark [folder] [-- options]\n npx create-agentmark [folder] [options]\n\nSets up AgentMark in a new or existing project: writes agentmark.json,\ncreates the agentmark/ prompts directory, wires IDE MCP configs, and\ninstalls the AgentMark agent skill.\n\nOptions:\n [folder], --path <folder> Target directory. Default: \".\" inside an\n existing project, else \"my-agentmark-app\".\n --client <ids|all> IDE clients to wire MCP configs for, comma-\n separated: claude-code, cursor, vscode, zed.\n -y, --yes Non-interactive: accept the default for every\n prompt (folder default above, all IDE clients,\n keep an existing agentmark.json). For CI and\n coding agents.\n --overwrite Replace an existing agentmark.json with the\n default config.\n -h, --help Show this help.\n`;\n\nexport const main = async (): Promise<void> => {\n const cliArgs = parseArgs();\n\n if (cliArgs.help) {\n console.log(USAGE);\n return;\n }\n\n const target = await resolveTargetPath(cliArgs.path, cliArgs.yes);\n if (!target) {\n console.log(\"Aborted.\");\n return;\n }\n const { targetPath } = target;\n\n const projectInfo = detectProjectInfo(targetPath);\n const clients = await resolveClients(cliArgs.clients, cliArgs.yes);\n\n console.log(\"\");\n\n // 1. agentmark.json — the SDK loader's config root\n const agentmarkJsonPath = path.join(targetPath, \"agentmark.json\");\n if (await shouldWriteAgentmarkJson(agentmarkJsonPath, cliArgs.overwrite, cliArgs.yes)) {\n fs.writeJsonSync(agentmarkJsonPath, AGENTMARK_JSON, { spaces: 2 });\n console.log(\"✅ agentmark.json\");\n } else {\n console.log(\"⏭️ agentmark.json (kept existing)\");\n }\n\n // 2. agentmark/ — where prompts go. Empty + .gitkeep so the folder is\n // discoverable and version-controlled before the user adds anything.\n // Matches agentmarkPath: \".\" in agentmark.json.\n const agentmarkDirPath = path.join(targetPath, \"agentmark\");\n if (!fs.existsSync(agentmarkDirPath)) {\n fs.ensureDirSync(agentmarkDirPath);\n fs.writeFileSync(path.join(agentmarkDirPath, \".gitkeep\"), \"\");\n console.log(\"✅ agentmark/ (empty, ready for your .prompt.mdx files)\");\n } else {\n console.log(\"⏭️ agentmark/ (kept existing)\");\n }\n\n // 3. MCP wiring — one config file per selected IDE client\n for (const client of clients) {\n try {\n const result = writeMcpConfig(client, targetPath, { customApiUrl: cliArgs.apiUrl });\n if (result) {\n const rel = path.relative(targetPath, result.configPath) || result.configPath;\n console.log(`✅ MCP wired (${clientLabel(client)}): ${rel}`);\n }\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n console.warn(`⚠️ Could not write MCP config for ${clientLabel(client)}: ${message}`);\n }\n }\n\n // 4. AgentMark agent skill (best-effort; logs its own status)\n installAgentmarkSkill(targetPath);\n\n // 5. git init — only if this is a greenfield folder\n if (!projectInfo.isExistingProject) {\n initGitRepo(targetPath);\n }\n\n // 6. Handoff to the AI tool. The integration logic lives in the skill\n // workflow (`setup-and-integration.md`), not here, so the rest of\n // onboarding adapts to whatever stack the user already has.\n console.log(\"\");\n console.log(\"✨ AgentMark is wired up.\");\n console.log(\"\");\n console.log(\" Next: open this project in Claude Code, Cursor, VS Code, or Zed and say:\");\n console.log(\"\");\n console.log(\" \\\"Set up AgentMark in this project.\\\"\");\n console.log(\"\");\n console.log(\" The AgentMark skill will detect your stack, propose the wiring against\");\n console.log(\" the docs MCP (https://docs.agentmark.co/mcp), and integrate adaptively.\");\n};\n\n/**\n * Run main() only when this module is invoked directly as the CLI entry —\n * NOT when imported by a test or another module.\n *\n * Both sides MUST be realpath'd before comparing. npm/npx invoke bins\n * through a `node_modules/.bin` SYMLINK, so `process.argv[1]` is the\n * symlink path while `import.meta.url` is the resolved real path — a naive\n * URL comparison never matches and the CLI exits 0 having done nothing.\n * That exact bug shipped in 1.0.0 and made `npm create agentmark` a silent\n * no-op for every user (macOS additionally symlinks /tmp, which is why\n * even \"direct\" invocations failed in temp dirs). Regression-pinned by\n * test/bin-invocation.test.ts, which runs the built bin through a symlink.\n */\nconst isDirectlyInvoked = (): boolean => {\n const entry = process.argv[1];\n if (!entry) return false;\n try {\n const entryReal = pathToFileURL(fs.realpathSync(entry)).href;\n const selfReal = pathToFileURL(fs.realpathSync(fileURLToPath(import.meta.url))).href;\n return entryReal === selfReal;\n } catch {\n // realpath can throw on exotic entries (deleted cwd, permissions);\n // treat as \"not the CLI entry\" rather than crashing an import.\n return false;\n }\n};\n\nif (isDirectlyInvoked()) {\n main().catch((error) => {\n console.error(\"Error:\", error);\n process.exit(1);\n });\n}\n","/**\n * Shared MCP-config builder for the scaffolders.\n *\n * Writes the project-local IDE config (mcp.json / settings.json) for\n * the four supported clients. Every scaffolded project gets THREE\n * MCP servers wired up by default:\n *\n * 1. `agentmark-docs` (remote HTTP) — read-only docs / reference,\n * hosted at `https://docs.agentmark.co/mcp`.\n *\n * 2. `agentmark` (stdio, `@agentmark-ai/mcp-server`) — AgentMark\n * Cloud surface. Defaults to `https://api.agentmark.co`; pass a\n * custom URL via `customApiUrl` (the undocumented `--api-url`\n * flag on the CLI) to point at a non-prod gateway (staging,\n * self-hosted).\n *\n * 3. `agentmark-local` (stdio, `@agentmark-ai/mcp-server`) — the\n * same MCP binary, pointed at the local `agentmark dev` server\n * (`http://localhost:9418`). The local dev server serves the\n * same OpenAPI contract under `/v1/openapi.json`, so the same\n * tool surface (`list_traces`, `get_trace`, …) is available\n * against local SQLite traces.\n *\n * Why both `agentmark` and `agentmark-local`: workflows like \"pull\n * failing traces from AgentMark Cloud, fix locally, re-verify against\n * `agentmark dev` traces\" need BOTH endpoints reachable in the same\n * conversation. MCP clients namespace tools by server name, so the\n * agent calls `agentmark/list_traces` for cloud and\n * `agentmark-local/list_traces` for local — same tool, explicit\n * destination.\n *\n * Auth chain is endpoint-agnostic:\n *\n * - `AGENTMARK_API_KEY` env (CI / dedicated agents) wins\n * - falls back to `~/.agentmark/auth.json` from\n * `agentmark login [--base-url <matching-endpoint>]`\n * - local dev calls are unauthenticated by design (the local dev\n * server doesn't validate auth headers)\n *\n * Shell `export AGENTMARK_API_URL=…` still wins at runtime when the\n * IDE inherits the shell — what we write here is the default for\n * cold-launched IDEs.\n */\n\nimport fs from \"fs-extra\";\nimport * as path from \"path\";\n\nexport type McpClient = \"vscode\" | \"zed\" | \"cursor\" | \"claude-code\" | \"skip\";\n\n/** URL the cloud-pointing `agentmark` MCP entry talks to by default. */\nconst CLOUD_API_URL = \"https://api.agentmark.co\";\n\n/** Local `agentmark dev` server URL — matches AGENTMARK_PORT default. */\nconst LOCAL_DEV_URL = \"http://localhost:9418\";\n\n/** The npm package id of the stdio MCP server (used for both entries). */\nconst MCP_SERVER_PACKAGE = \"@agentmark-ai/mcp-server\";\n\ninterface StdioServerEntry {\n command: string;\n args: string[];\n env?: Record<string, string>;\n type?: \"stdio\";\n}\n\ninterface RemoteServerEntry {\n url: string;\n type?: \"http\";\n}\n\n/**\n * Builds an stdio MCP server entry pointed at the given URL.\n *\n * - When the URL matches the MCP server's built-in default\n * (`https://api.agentmark.co`), the `env` block is omitted so a\n * future change to that default cleanly propagates to existing\n * scaffolded projects.\n * - For any other URL (custom `--api-url`, or the local dev URL),\n * we write `env: { AGENTMARK_API_URL: <url> }` explicitly.\n */\nfunction stdioEntry(apiUrl: string, includeType: boolean): StdioServerEntry {\n const entry: StdioServerEntry = {\n command: \"npx\",\n args: [\"-y\", MCP_SERVER_PACKAGE],\n };\n if (apiUrl !== CLOUD_API_URL) {\n entry.env = { AGENTMARK_API_URL: apiUrl };\n }\n if (includeType) entry.type = \"stdio\";\n return entry;\n}\n\ninterface WriteResult {\n /** Absolute or relative path to the file that was written. */\n configPath: string;\n}\n\nexport interface WriteMcpConfigOptions {\n /**\n * Arbitrary AgentMark gateway URL for the cloud-side `agentmark` MCP\n * entry. Defaults to `https://api.agentmark.co`. Escape hatch for\n * internal AgentMark engineers (staging) and self-hosters — NOT a\n * customer-facing option.\n */\n customApiUrl?: string;\n}\n\n/**\n * Writes the IDE-specific MCP config file with three servers wired up.\n * Idempotent: caller passes a fresh target dir per scaffold.\n */\nexport function writeMcpConfig(\n client: McpClient,\n targetPath: string,\n opts: WriteMcpConfigOptions = {},\n): WriteResult | null {\n if (client === \"skip\") return null;\n\n const cloudUrl = opts.customApiUrl ?? CLOUD_API_URL;\n const docsEntry: RemoteServerEntry = { url: \"https://docs.agentmark.co/mcp\" };\n\n if (client === \"vscode\") {\n const vscodeDir = path.join(targetPath, \".vscode\");\n fs.ensureDirSync(vscodeDir);\n const configPath = path.join(vscodeDir, \"mcp.json\");\n const config = {\n servers: {\n \"agentmark-docs\": docsEntry,\n \"agentmark\": stdioEntry(cloudUrl, /* includeType */ false),\n \"agentmark-local\": stdioEntry(LOCAL_DEV_URL, /* includeType */ false),\n },\n };\n fs.writeJsonSync(configPath, config, { spaces: 2 });\n return { configPath };\n }\n\n if (client === \"zed\") {\n const zedDir = path.join(targetPath, \".zed\");\n fs.ensureDirSync(zedDir);\n const configPath = path.join(zedDir, \"settings.json\");\n const config = {\n context_servers: {\n \"agentmark-docs\": docsEntry,\n \"agentmark\": stdioEntry(cloudUrl, /* includeType */ false),\n \"agentmark-local\": stdioEntry(LOCAL_DEV_URL, /* includeType */ false),\n },\n };\n fs.writeJsonSync(configPath, config, { spaces: 2 });\n return { configPath };\n }\n\n if (client === \"cursor\") {\n const cursorDir = path.join(targetPath, \".cursor\");\n fs.ensureDirSync(cursorDir);\n const configPath = path.join(cursorDir, \"mcp.json\");\n const config = {\n mcpServers: {\n \"agentmark-docs\": docsEntry,\n \"agentmark\": stdioEntry(cloudUrl, /* includeType */ false),\n \"agentmark-local\": stdioEntry(LOCAL_DEV_URL, /* includeType */ false),\n },\n };\n fs.writeJsonSync(configPath, config, { spaces: 2 });\n return { configPath };\n }\n\n if (client === \"claude-code\") {\n const configPath = path.join(targetPath, \".mcp.json\");\n const config = {\n mcpServers: {\n \"agentmark-docs\": { type: \"http\" as const, ...docsEntry },\n \"agentmark\": stdioEntry(cloudUrl, /* includeType */ true),\n \"agentmark-local\": stdioEntry(LOCAL_DEV_URL, /* includeType */ true),\n },\n };\n fs.writeJsonSync(configPath, config, { spaces: 2 });\n return { configPath };\n }\n\n return null;\n}\n","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 { 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","/**\n * Project detection for the minimal `npm create agentmark` init flow.\n *\n * Two questions only: \"is this an existing project?\" (drives whether we\n * run `git init`) and \"does AgentMark already exist here?\" (drives the\n * `agentmark.json` conflict prompt). Everything else — language, package\n * manager, Python venv, conflict file inventory — lives in the skill\n * workflow now, which can ask the docs MCP for current guidance instead\n * of encoding heuristics into the CLI.\n */\n\nimport fs from 'fs-extra';\nimport path from 'path';\nimport type { ProjectInfo } from './types.js';\n\nconst TYPESCRIPT_INDICATORS = ['package.json', 'tsconfig.json', 'node_modules'] as const;\nconst PYTHON_INDICATORS = ['pyproject.toml', 'requirements.txt', 'setup.py', '.venv', 'venv'] as const;\n\n/** Any TypeScript/Node.js project marker present in the target directory. */\nexport function detectTypeScriptProject(targetPath: string): boolean {\n return TYPESCRIPT_INDICATORS.some((file) => fs.existsSync(path.join(targetPath, file)));\n}\n\n/** Any Python project marker present in the target directory. */\nexport function detectPythonProject(targetPath: string): boolean {\n return PYTHON_INDICATORS.some((file) => fs.existsSync(path.join(targetPath, file)));\n}\n\n/**\n * Combined detection. `isExistingProject` is true if either language's\n * markers are present; the init flow uses it only to decide whether to\n * run `git init`.\n */\nexport function detectProjectInfo(targetPath: string): ProjectInfo {\n return {\n isExistingProject: detectTypeScriptProject(targetPath) || detectPythonProject(targetPath),\n hasAgentmarkJson: fs.existsSync(path.join(targetPath, 'agentmark.json')),\n hasAgentmarkDir: fs.existsSync(path.join(targetPath, 'agentmark')),\n };\n}\n\n/**\n * True for any spelling of \"current directory\" the user might type at the\n * folder prompt. Used to skip mkdir/cd noise when the user wants to wire\n * AgentMark into the directory they're already in.\n */\nexport function isCurrentDirectory(folderName: string): boolean {\n return folderName === '.' || folderName === './' || folderName === '.\\\\';\n}\n"],"mappings":";;;AAAA,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,OAAO,aAAa;AACpB,SAAS,eAAe,qBAA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AM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,cAAQ,KAAK,gDAAsC,YAAY,MAAM,CAAC,KAAK,OAAO,EAAE;AAAA,IACtF;AAAA,EACF;AAGA,wBAAsB,UAAU;AAGhC,MAAI,CAAC,YAAY,mBAAmB;AAClC,gBAAY,UAAU;AAAA,EACxB;AAKA,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,+BAA0B;AACtC,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,6EAA6E;AACzF,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,4CAA8C;AAC1D,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,2EAA2E;AACvF,UAAQ,IAAI,4EAA4E;AAC1F;AAeA,IAAM,oBAAoB,MAAe;AACvC,QAAM,QAAQ,QAAQ,KAAK,CAAC;AAC5B,MAAI,CAAC,MAAO,QAAO;AACnB,MAAI;AACF,UAAM,YAAY,cAAcD,IAAG,aAAa,KAAK,CAAC,EAAE;AACxD,UAAM,WAAW,cAAcA,IAAG,aAAa,cAAc,YAAY,GAAG,CAAC,CAAC,EAAE;AAChF,WAAO,cAAc;AAAA,EACvB,QAAQ;AAGN,WAAO;AAAA,EACT;AACF;AAEA,IAAI,kBAAkB,GAAG;AACvB,OAAK,EAAE,MAAM,CAAC,UAAU;AACtB,YAAQ,MAAM,UAAU,KAAK;AAC7B,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;","names":["fs","path","fs","path","fs","path"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/utils/examples/mcp-config.ts","../src/utils/install-skill.ts","../src/utils/git-init.ts","../src/utils/project-detection.ts"],"sourcesContent":["import fs from \"fs-extra\";\nimport os from \"os\";\nimport path from \"path\";\nimport prompts from \"prompts\";\nimport { pathToFileURL, fileURLToPath } from \"url\";\nimport { writeMcpConfig, type McpClient } from \"./utils/examples/mcp-config.js\";\nimport { installAgentmarkSkill } from \"./utils/install-skill.js\";\nimport { initGitRepo } from \"./utils/git-init.js\";\nimport { detectProjectInfo, isCurrentDirectory } from \"./utils/project-detection.js\";\n\n/**\n * `npm create agentmark` — minimal init.\n *\n * Scope is deliberately small. The CLI does NOT scaffold example code,\n * pick an LLM adapter, or handle login. Its job is:\n *\n * 1. Write `agentmark.json` (the SDK loader's config root)\n * 2. Create an empty `agentmark/` directory (where prompts go)\n * 3. Wire MCP configs for any IDE clients the user selects\n * 4. Install the AgentMark agent skill (`npx skills add agentmark-ai/skills`)\n * 5. Hand off to the AI tool: \"Open Claude Code / Cursor and say:\n * Set up AgentMark in this project.\"\n *\n * Everything else — framework detection, package install, code wiring,\n * first prompt — is the job of the `setup-and-integration` skill workflow,\n * which runs inside the user's IDE agent. That keeps integration adaptive\n * to whatever stack the user already has, instead of forcing a template.\n */\n\nexport interface CliArgs {\n path?: string;\n clients?: McpClient[];\n /**\n * Undocumented escape hatch for internal staging\n * (`https://api-stg.agentmark.co`) and rare self-hosters. Defaults to\n * `https://api.agentmark.co`. The `agentmark-local` MCP entry always\n * points at `http://localhost:9418` regardless of this flag.\n */\n apiUrl?: string;\n overwrite?: boolean;\n /**\n * Non-interactive mode for CI and coding agents: every prompt is replaced\n * by its default (target folder per `defaultFolderName`, all IDE clients,\n * keep an existing agentmark.json). Headless onboarding depends on this —\n * without it the init blocks on a TTY no agent has.\n */\n yes?: boolean;\n help?: boolean;\n}\n\nexport const ALL_CLIENTS: readonly McpClient[] = [\"claude-code\", \"codex\", \"cursor\", \"vscode\", \"zed\"];\n\nexport const AGENTMARK_JSON: Record<string, unknown> = {\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 // Seed one model so the dashboard prompt editor isn't an empty dropdown on\n // first run. Add more with `npx @agentmark-ai/cli pull-models` (writes provider/model\n // entries here) — see https://docs.agentmark.co/configure/model-schemas.\n builtInModels: [\"openai/gpt-5.5\"],\n};\n\nexport const parseArgs = (argv: string[] = process.argv.slice(2)): CliArgs => {\n const result: CliArgs = {};\n\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg === \"--path\") {\n result.path = argv[++i];\n } else if (arg === \"--client\") {\n const value = argv[++i];\n if (!value) throw new Error(\"--client requires a value\");\n const ids = value === \"all\"\n ? [...ALL_CLIENTS]\n : value.split(\",\").map((s) => s.trim()).filter(Boolean) as McpClient[];\n result.clients = [...(result.clients ?? []), ...ids];\n } else if (arg === \"--overwrite\") {\n result.overwrite = true;\n } else if (arg === \"--yes\" || arg === \"-y\") {\n result.yes = true;\n } else if (arg === \"--help\" || arg === \"-h\") {\n result.help = true;\n } else if (arg === \"--api-url\") {\n const value = argv[++i];\n if (!value || !/^https?:\\/\\//.test(value)) {\n throw new Error(`--api-url requires a full http(s) URL (got \"${value}\")`);\n }\n result.apiUrl = value;\n } else if (arg && !arg.startsWith(\"--\") && !result.path) {\n // Positional: folder name, matches `npx create-next-app my-app` shape.\n result.path = arg;\n }\n }\n\n return result;\n};\n\nexport const clientLabel = (id: string): string =>\n id === \"vscode\" ? \"VS Code\"\n : id === \"zed\" ? \"Zed\"\n : id === \"cursor\" ? \"Cursor\"\n : id === \"claude-code\" ? \"Claude Code\"\n : id === \"codex\" ? \"Codex\"\n : id;\n\n/**\n * The folder the interactive prompt would offer as its default: \".\" when\n * cwd looks like an existing project (the common \"wire AgentMark into my\n * repo\" case), a fresh folder name when cwd is empty (greenfield). `--yes`\n * resolves to exactly this value, so a non-interactive run lands where an\n * Enter-mashing interactive run would have.\n */\nexport const defaultFolderName = (cwd: string = process.cwd()): string =>\n fs.existsSync(path.join(cwd, \"package.json\")) ||\n fs.existsSync(path.join(cwd, \"pyproject.toml\"))\n ? \".\"\n : \"my-agentmark-app\";\n\n/**\n * Resolves the target folder via positional/flag arg, `--yes` default, or\n * interactive prompt.\n */\nexport const resolveTargetPath = async (\n cliPath: string | undefined,\n yes?: boolean,\n): Promise<{ targetPath: string; isCurrentDir: boolean } | null> => {\n let folderName = cliPath;\n if (!folderName && yes) {\n folderName = defaultFolderName();\n }\n if (!folderName) {\n const response = await prompts({\n name: \"folderName\",\n type: \"text\",\n message: \"Where would you like to set up AgentMark?\",\n initial: defaultFolderName(),\n });\n folderName = response.folderName;\n }\n if (!folderName) return null; // Ctrl+C / empty input\n\n const isCurrentDir = isCurrentDirectory(folderName);\n const targetPath = isCurrentDir ? process.cwd() : path.resolve(folderName);\n if (!isCurrentDir) fs.ensureDirSync(targetPath);\n return { targetPath, isCurrentDir };\n};\n\n/**\n * Detects which IDE clients the user has installed or is actively running.\n *\n * Detection order (matches the vercel-labs/skills CLI approach):\n * 1. Home dir — which editors are *installed* (`~/.claude`, `~/.cursor`,\n * Zed config dir). Most reliable; works for greenfield projects too.\n * 2. Env vars — detect the *current* editor session. VS Code has no\n * canonical home-dir marker, so env vars are the right signal for it.\n * Cursor-specific vars are checked before VS Code vars because Cursor\n * inherits `VSCODE_PID`/`TERM_PROGRAM=vscode`.\n * 3. Project dir — already-wired editors in this specific repo (fallback\n * when steps 1–2 return nothing, e.g. in a fully offline environment\n * with a pre-existing project).\n *\n * Returns an empty array when nothing can be inferred — callers treat that\n * as \"no default; let the user choose explicitly.\"\n *\n * `homedir` is injectable for tests (defaults to `os.homedir()`).\n */\nexport const detectCurrentClients = (\n targetPath: string,\n homedir: string = os.homedir(),\n): McpClient[] => {\n const detected = new Set<McpClient>();\n\n // 1. Home dir: editors with a known config location\n if (fs.existsSync(path.join(homedir, \".claude\"))) detected.add(\"claude-code\");\n if (fs.existsSync(path.join(homedir, \".codex\"))) detected.add(\"codex\");\n if (fs.existsSync(path.join(homedir, \".cursor\"))) detected.add(\"cursor\");\n // Zed uses platform-specific config dirs; check the two common ones\n if (\n fs.existsSync(path.join(homedir, \".config\", \"zed\")) ||\n fs.existsSync(path.join(homedir, \"Library\", \"Application Support\", \"zed\"))\n ) detected.add(\"zed\");\n\n // 2. Env vars: detect active editor session (VS Code has no home-dir marker)\n if (process.env[\"CURSOR_TRACE_ID\"] ?? process.env[\"CURSOR_CHANNEL\"]) {\n detected.add(\"cursor\");\n } else if (process.env[\"VSCODE_PID\"] ?? process.env[\"TERM_PROGRAM\"] === \"vscode\") {\n detected.add(\"vscode\");\n }\n\n if (detected.size > 0) return [...detected];\n\n // 3. Project dir fallback: editors already wired in this repo\n if (fs.existsSync(path.join(targetPath, \".vscode\"))) detected.add(\"vscode\");\n if (fs.existsSync(path.join(targetPath, \".codex\"))) detected.add(\"codex\");\n if (fs.existsSync(path.join(targetPath, \".cursor\"))) detected.add(\"cursor\");\n if (fs.existsSync(path.join(targetPath, \".zed\"))) detected.add(\"zed\");\n if (\n fs.existsSync(path.join(targetPath, \".mcp.json\")) ||\n fs.existsSync(path.join(targetPath, \".claude\"))\n ) detected.add(\"claude-code\");\n\n return [...detected];\n};\n\n/**\n * Resolves which IDE clients to wire MCP into. The prompt pre-selects\n * clients already detected in the project (or the running editor via env\n * vars); if nothing is detected the list starts with nothing selected so\n * the user makes an explicit choice. Empty selection skips MCP wiring\n * entirely.\n */\nexport const resolveClients = async (\n cliClients: McpClient[] | undefined,\n yes?: boolean,\n targetPath?: string,\n): Promise<McpClient[]> => {\n if (cliClients && cliClients.length > 0) {\n for (const c of cliClients) {\n if (!ALL_CLIENTS.includes(c)) {\n throw new Error(`Invalid client \"${c}\". Valid: ${ALL_CLIENTS.join(\", \")}`);\n }\n }\n return cliClients;\n }\n // --yes is the non-interactive/CI/agent path: wire everything so headless\n // onboarding never silently skips an editor the agent expects to use.\n if (yes) return [...ALL_CLIENTS];\n const defaultSelected = targetPath ? detectCurrentClients(targetPath) : [];\n const response = await prompts({\n name: \"clients\",\n type: \"multiselect\",\n message: \"Wire AgentMark MCP into which IDE clients?\",\n instructions: false,\n hint: \"Space to toggle. Enter to submit. Skip all = empty selection.\",\n choices: ALL_CLIENTS.map((id) => ({\n title: clientLabel(id),\n value: id,\n selected: defaultSelected.includes(id),\n })),\n });\n return (response.clients ?? []) as McpClient[];\n};\n\n/**\n * agentmark.json is the only file we conflict on (the others — MCP config\n * dirs, agentmark/, .gitkeep — are either additive or no-ops if present).\n * Default to \"skip\" so we never silently clobber an existing project's\n * config; `--overwrite` is the explicit opt-in for re-init scripts.\n */\nexport const shouldWriteAgentmarkJson = async (\n filePath: string,\n overwrite: boolean | undefined,\n yes?: boolean,\n): Promise<boolean> => {\n if (!fs.existsSync(filePath)) return true;\n if (overwrite) return true;\n // --yes takes the safe interactive default: keep the existing file.\n // Clobbering config is never a default; --overwrite is the explicit opt-in.\n if (yes) return false;\n const { action } = await prompts({\n type: \"select\",\n name: \"action\",\n message: \"agentmark.json already exists. What would you like to do?\",\n choices: [\n { title: \"Skip (keep existing)\", value: \"skip\" },\n { title: \"Overwrite with default config\", value: \"overwrite\" },\n ],\n initial: 0,\n });\n return action === \"overwrite\";\n};\n\nexport const USAGE = `Usage: npm create agentmark [folder] [-- options]\n npx create-agentmark [folder] [options]\n\nSets up AgentMark in a new or existing project: writes agentmark.json,\ncreates the agentmark/ prompts directory, wires IDE MCP configs, and\ninstalls the AgentMark agent skill.\n\nOptions:\n [folder], --path <folder> Target directory. Default: \".\" inside an\n existing project, else \"my-agentmark-app\".\n --client <ids|all> IDE clients to wire MCP configs for, comma-\n separated: claude-code, cursor, vscode, zed.\n -y, --yes Non-interactive: accept the default for every\n prompt (folder default above, all IDE clients,\n keep an existing agentmark.json). For CI and\n coding agents.\n --overwrite Replace an existing agentmark.json with the\n default config.\n -h, --help Show this help.\n`;\n\nexport const main = async (): Promise<void> => {\n const cliArgs = parseArgs();\n\n if (cliArgs.help) {\n console.log(USAGE);\n return;\n }\n\n const target = await resolveTargetPath(cliArgs.path, cliArgs.yes);\n if (!target) {\n console.log(\"Aborted.\");\n return;\n }\n const { targetPath } = target;\n\n const projectInfo = detectProjectInfo(targetPath);\n const clients = await resolveClients(cliArgs.clients, cliArgs.yes, targetPath);\n\n console.log(\"\");\n\n // 1. agentmark.json — the SDK loader's config root\n const agentmarkJsonPath = path.join(targetPath, \"agentmark.json\");\n if (await shouldWriteAgentmarkJson(agentmarkJsonPath, cliArgs.overwrite, cliArgs.yes)) {\n fs.writeJsonSync(agentmarkJsonPath, AGENTMARK_JSON, { spaces: 2 });\n console.log(\"✅ agentmark.json\");\n } else {\n console.log(\"⏭️ agentmark.json (kept existing)\");\n }\n\n // 2. agentmark/ — where prompts go. Empty + .gitkeep so the folder is\n // discoverable and version-controlled before the user adds anything.\n // Matches agentmarkPath: \".\" in agentmark.json.\n const agentmarkDirPath = path.join(targetPath, \"agentmark\");\n if (!fs.existsSync(agentmarkDirPath)) {\n fs.ensureDirSync(agentmarkDirPath);\n fs.writeFileSync(path.join(agentmarkDirPath, \".gitkeep\"), \"\");\n console.log(\"✅ agentmark/ (empty, ready for your .prompt.mdx files)\");\n } else {\n console.log(\"⏭️ agentmark/ (kept existing)\");\n }\n\n // 3. MCP wiring — one config file per selected IDE client\n for (const client of clients) {\n try {\n const result = writeMcpConfig(client, targetPath, { customApiUrl: cliArgs.apiUrl });\n if (result) {\n const rel = path.relative(targetPath, result.configPath) || result.configPath;\n console.log(`✅ MCP wired (${clientLabel(client)}): ${rel}`);\n }\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n console.warn(`⚠️ Could not write MCP config for ${clientLabel(client)}: ${message}`);\n }\n }\n\n // 4. AgentMark agent skill (best-effort; logs its own status)\n installAgentmarkSkill(targetPath);\n\n // 5. git init — only if this is a greenfield folder\n if (!projectInfo.isExistingProject) {\n initGitRepo(targetPath);\n }\n\n // 6. Handoff to the AI tool. The integration logic lives in the skill\n // workflow (`setup-and-integration.md`), not here, so the rest of\n // onboarding adapts to whatever stack the user already has.\n console.log(\"\");\n console.log(\"✨ AgentMark is wired up.\");\n console.log(\"\");\n console.log(\" Next: open this project in Claude Code, Cursor, VS Code, or Zed and say:\");\n console.log(\"\");\n console.log(\" \\\"Set up AgentMark in this project.\\\"\");\n console.log(\"\");\n console.log(\" The AgentMark skill will detect your stack, propose the wiring against\");\n console.log(\" the docs MCP (https://docs.agentmark.co/mcp), and integrate adaptively.\");\n};\n\n/**\n * Run main() only when this module is invoked directly as the CLI entry —\n * NOT when imported by a test or another module.\n *\n * Both sides MUST be realpath'd before comparing. npm/npx invoke bins\n * through a `node_modules/.bin` SYMLINK, so `process.argv[1]` is the\n * symlink path while `import.meta.url` is the resolved real path — a naive\n * URL comparison never matches and the CLI exits 0 having done nothing.\n * That exact bug shipped in 1.0.0 and made `npm create agentmark` a silent\n * no-op for every user (macOS additionally symlinks /tmp, which is why\n * even \"direct\" invocations failed in temp dirs). Regression-pinned by\n * test/bin-invocation.test.ts, which runs the built bin through a symlink.\n */\nconst isDirectlyInvoked = (): boolean => {\n const entry = process.argv[1];\n if (!entry) return false;\n try {\n const entryReal = pathToFileURL(fs.realpathSync(entry)).href;\n const selfReal = pathToFileURL(fs.realpathSync(fileURLToPath(import.meta.url))).href;\n return entryReal === selfReal;\n } catch {\n // realpath can throw on exotic entries (deleted cwd, permissions);\n // treat as \"not the CLI entry\" rather than crashing an import.\n return false;\n }\n};\n\nif (isDirectlyInvoked()) {\n main().catch((error) => {\n console.error(\"Error:\", error);\n process.exit(1);\n });\n}\n","/**\n * Shared MCP-config builder for the scaffolders.\n *\n * Writes the project-local IDE config (mcp.json / settings.json) for\n * the four supported clients. Every scaffolded project gets THREE\n * MCP servers wired up by default:\n *\n * 1. `agentmark-docs` (remote HTTP) — read-only docs / reference,\n * hosted at `https://docs.agentmark.co/mcp`.\n *\n * 2. `agentmark` (stdio, `@agentmark-ai/mcp-server`) — AgentMark\n * Cloud surface. Defaults to `https://api.agentmark.co`; pass a\n * custom URL via `customApiUrl` (the undocumented `--api-url`\n * flag on the CLI) to point at a non-prod gateway (staging,\n * self-hosted).\n *\n * 3. `agentmark-local` (stdio, `@agentmark-ai/mcp-server`) — the\n * same MCP binary, pointed at the local `agentmark dev` server\n * (`http://localhost:9418`). The local dev server serves the\n * same OpenAPI contract under `/v1/openapi.json`, so the same\n * tool surface (`list_traces`, `get_trace`, …) is available\n * against local SQLite traces.\n *\n * Why both `agentmark` and `agentmark-local`: workflows like \"pull\n * failing traces from AgentMark Cloud, fix locally, re-verify against\n * `agentmark dev` traces\" need BOTH endpoints reachable in the same\n * conversation. MCP clients namespace tools by server name, so the\n * agent calls `agentmark/list_traces` for cloud and\n * `agentmark-local/list_traces` for local — same tool, explicit\n * destination.\n *\n * Auth chain is endpoint-agnostic:\n *\n * - `AGENTMARK_API_KEY` env (CI / dedicated agents) wins\n * - falls back to `~/.agentmark/auth.json` from\n * `agentmark login [--base-url <matching-endpoint>]`\n * - local dev calls are unauthenticated by design (the local dev\n * server doesn't validate auth headers)\n *\n * Shell `export AGENTMARK_API_URL=…` still wins at runtime when the\n * IDE inherits the shell — what we write here is the default for\n * cold-launched IDEs.\n */\n\nimport fs from \"fs-extra\";\nimport * as path from \"path\";\n\nexport type McpClient = \"vscode\" | \"zed\" | \"cursor\" | \"claude-code\" | \"codex\" | \"skip\";\n\n/** URL the cloud-pointing `agentmark` MCP entry talks to by default. */\nconst CLOUD_API_URL = \"https://api.agentmark.co\";\n\n/** Local `agentmark dev` server URL — matches AGENTMARK_PORT default. */\nconst LOCAL_DEV_URL = \"http://localhost:9418\";\n\n/** The npm package id of the stdio MCP server (used for both entries). */\nconst MCP_SERVER_PACKAGE = \"@agentmark-ai/mcp-server\";\n\n/** Docs MCP endpoint (remote HTTP, used across all clients). */\nconst DOCS_ENTRY_URL = \"https://docs.agentmark.co/mcp\";\n\ninterface StdioServerEntry {\n command: string;\n args: string[];\n env?: Record<string, string>;\n type?: \"stdio\";\n}\n\ninterface RemoteServerEntry {\n url: string;\n type?: \"http\";\n}\n\n/**\n * Builds an stdio MCP server entry pointed at the given URL.\n *\n * - When the URL matches the MCP server's built-in default\n * (`https://api.agentmark.co`), the `env` block is omitted so a\n * future change to that default cleanly propagates to existing\n * scaffolded projects.\n * - For any other URL (custom `--api-url`, or the local dev URL),\n * we write `env: { AGENTMARK_API_URL: <url> }` explicitly.\n */\nfunction stdioEntry(apiUrl: string, includeType: boolean): StdioServerEntry {\n const entry: StdioServerEntry = {\n command: \"npx\",\n args: [\"-y\", MCP_SERVER_PACKAGE],\n };\n if (apiUrl !== CLOUD_API_URL) {\n entry.env = { AGENTMARK_API_URL: apiUrl };\n }\n if (includeType) entry.type = \"stdio\";\n return entry;\n}\n\ninterface WriteResult {\n /** Absolute or relative path to the file that was written. */\n configPath: string;\n}\n\nexport interface WriteMcpConfigOptions {\n /**\n * Arbitrary AgentMark gateway URL for the cloud-side `agentmark` MCP\n * entry. Defaults to `https://api.agentmark.co`. Escape hatch for\n * internal AgentMark engineers (staging) and self-hosters — NOT a\n * customer-facing option.\n */\n customApiUrl?: string;\n}\n\n/**\n * Writes the IDE-specific MCP config file with three servers wired up.\n * Idempotent: caller passes a fresh target dir per scaffold.\n */\nexport function writeMcpConfig(\n client: McpClient,\n targetPath: string,\n opts: WriteMcpConfigOptions = {},\n): WriteResult | null {\n if (client === \"skip\") return null;\n\n const cloudUrl = opts.customApiUrl ?? CLOUD_API_URL;\n const docsEntry: RemoteServerEntry = { url: \"https://docs.agentmark.co/mcp\" };\n\n if (client === \"vscode\") {\n const vscodeDir = path.join(targetPath, \".vscode\");\n fs.ensureDirSync(vscodeDir);\n const configPath = path.join(vscodeDir, \"mcp.json\");\n const config = {\n servers: {\n \"agentmark-docs\": docsEntry,\n \"agentmark\": stdioEntry(cloudUrl, /* includeType */ false),\n \"agentmark-local\": stdioEntry(LOCAL_DEV_URL, /* includeType */ false),\n },\n };\n fs.writeJsonSync(configPath, config, { spaces: 2 });\n return { configPath };\n }\n\n if (client === \"zed\") {\n const zedDir = path.join(targetPath, \".zed\");\n fs.ensureDirSync(zedDir);\n const configPath = path.join(zedDir, \"settings.json\");\n const config = {\n context_servers: {\n \"agentmark-docs\": docsEntry,\n \"agentmark\": stdioEntry(cloudUrl, /* includeType */ false),\n \"agentmark-local\": stdioEntry(LOCAL_DEV_URL, /* includeType */ false),\n },\n };\n fs.writeJsonSync(configPath, config, { spaces: 2 });\n return { configPath };\n }\n\n if (client === \"cursor\") {\n const cursorDir = path.join(targetPath, \".cursor\");\n fs.ensureDirSync(cursorDir);\n const configPath = path.join(cursorDir, \"mcp.json\");\n const config = {\n mcpServers: {\n \"agentmark-docs\": docsEntry,\n \"agentmark\": stdioEntry(cloudUrl, /* includeType */ false),\n \"agentmark-local\": stdioEntry(LOCAL_DEV_URL, /* includeType */ false),\n },\n };\n fs.writeJsonSync(configPath, config, { spaces: 2 });\n return { configPath };\n }\n\n if (client === \"claude-code\") {\n const configPath = path.join(targetPath, \".mcp.json\");\n const config = {\n mcpServers: {\n \"agentmark-docs\": { type: \"http\" as const, ...docsEntry },\n \"agentmark\": stdioEntry(cloudUrl, /* includeType */ true),\n \"agentmark-local\": stdioEntry(LOCAL_DEV_URL, /* includeType */ true),\n },\n };\n fs.writeJsonSync(configPath, config, { spaces: 2 });\n return { configPath };\n }\n\n if (client === \"codex\") {\n const codexDir = path.join(targetPath, \".codex\");\n fs.ensureDirSync(codexDir);\n const configPath = path.join(codexDir, \"config.toml\");\n // Codex uses TOML with an untagged transport enum: presence of `url`\n // selects StreamableHttp; presence of `command` selects Stdio. No\n // explicit `type` field is written.\n const cloudEnv = cloudUrl !== CLOUD_API_URL\n ? `\\nenv = { AGENTMARK_API_URL = \"${cloudUrl}\" }`\n : \"\";\n const toml = [\n \"# AgentMark MCP servers — managed by create-agentmark\",\n \"[mcp_servers.agentmark-docs]\",\n `url = \"${DOCS_ENTRY_URL}\"`,\n \"\",\n \"[mcp_servers.agentmark]\",\n `command = \"npx\"`,\n `args = [\"-y\", \"${MCP_SERVER_PACKAGE}\"]${cloudEnv}`,\n \"\",\n \"[mcp_servers.agentmark-local]\",\n `command = \"npx\"`,\n `args = [\"-y\", \"${MCP_SERVER_PACKAGE}\"]`,\n `env = { AGENTMARK_API_URL = \"${LOCAL_DEV_URL}\" }`,\n \"\",\n ].join(\"\\n\");\n fs.writeFileSync(configPath, toml, \"utf8\");\n return { configPath };\n }\n\n return null;\n}\n","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 { 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","/**\n * Project detection for the minimal `npm create agentmark` init flow.\n *\n * Two questions only: \"is this an existing project?\" (drives whether we\n * run `git init`) and \"does AgentMark already exist here?\" (drives the\n * `agentmark.json` conflict prompt). Everything else — language, package\n * manager, Python venv, conflict file inventory — lives in the skill\n * workflow now, which can ask the docs MCP for current guidance instead\n * of encoding heuristics into the CLI.\n */\n\nimport fs from 'fs-extra';\nimport path from 'path';\nimport type { ProjectInfo } from './types.js';\n\nconst TYPESCRIPT_INDICATORS = ['package.json', 'tsconfig.json', 'node_modules'] as const;\nconst PYTHON_INDICATORS = ['pyproject.toml', 'requirements.txt', 'setup.py', '.venv', 'venv'] as const;\n\n/** Any TypeScript/Node.js project marker present in the target directory. */\nexport function detectTypeScriptProject(targetPath: string): boolean {\n return TYPESCRIPT_INDICATORS.some((file) => fs.existsSync(path.join(targetPath, file)));\n}\n\n/** Any Python project marker present in the target directory. */\nexport function detectPythonProject(targetPath: string): boolean {\n return PYTHON_INDICATORS.some((file) => fs.existsSync(path.join(targetPath, file)));\n}\n\n/**\n * Combined detection. `isExistingProject` is true if either language's\n * markers are present; the init flow uses it only to decide whether to\n * run `git init`.\n */\nexport function detectProjectInfo(targetPath: string): ProjectInfo {\n return {\n isExistingProject: detectTypeScriptProject(targetPath) || detectPythonProject(targetPath),\n hasAgentmarkJson: fs.existsSync(path.join(targetPath, 'agentmark.json')),\n hasAgentmarkDir: fs.existsSync(path.join(targetPath, 'agentmark')),\n };\n}\n\n/**\n * True for any spelling of \"current directory\" the user might type at the\n * folder prompt. Used to skip mkdir/cd noise when the user wants to wire\n * AgentMark into the directory they're already in.\n */\nexport function isCurrentDirectory(folderName: string): boolean {\n return folderName === '.' || folderName === './' || folderName === '.\\\\';\n}\n"],"mappings":";;;AAAA,OAAOA,SAAQ;AACf,OAAO,QAAQ;AACf,OAAOC,WAAU;AACjB,OAAO,aAAa;AACpB,SAAS,eAAe,qBAAqB;;;ACwC7C,OAAO,QAAQ;AACf,YAAY,UAAU;AAKtB,IAAM,gBAAgB;AAGtB,IAAM,gBAAgB;AAGtB,IAAM,qBAAqB;AAG3B,IAAM,iBAAiB;AAwBvB,SAAS,WAAW,QAAgB,aAAwC;AAC1E,QAAM,QAA0B;AAAA,IAC9B,SAAS;AAAA,IACT,MAAM,CAAC,MAAM,kBAAkB;AAAA,EACjC;AACA,MAAI,WAAW,eAAe;AAC5B,UAAM,MAAM,EAAE,mBAAmB,OAAO;AAAA,EAC1C;AACA,MAAI,YAAa,OAAM,OAAO;AAC9B,SAAO;AACT;AAqBO,SAAS,eACd,QACA,YACA,OAA8B,CAAC,GACX;AACpB,MAAI,WAAW,OAAQ,QAAO;AAE9B,QAAM,WAAW,KAAK,gBAAgB;AACtC,QAAM,YAA+B,EAAE,KAAK,gCAAgC;AAE5E,MAAI,WAAW,UAAU;AACvB,UAAM,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IAAI,qBAAgB,YAAY,MAAM,CAAC,MAAM,GAAG,EAAE;AAAA,MAC5D;AAAA,IACF,SAAS,KAAK;AACZ,YAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,cAAQ,KAAK,gDAAsC,YAAY,MAAM,CAAC,KAAK,OAAO,EAAE;AAAA,IACtF;AAAA,EACF;AAGA,wBAAsB,UAAU;AAGhC,MAAI,CAAC,YAAY,mBAAmB;AAClC,gBAAY,UAAU;AAAA,EACxB;AAKA,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,+BAA0B;AACtC,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,6EAA6E;AACzF,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,4CAA8C;AAC1D,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,2EAA2E;AACvF,UAAQ,IAAI,4EAA4E;AAC1F;AAeA,IAAM,oBAAoB,MAAe;AACvC,QAAM,QAAQ,QAAQ,KAAK,CAAC;AAC5B,MAAI,CAAC,MAAO,QAAO;AACnB,MAAI;AACF,UAAM,YAAY,cAAcD,IAAG,aAAa,KAAK,CAAC,EAAE;AACxD,UAAM,WAAW,cAAcA,IAAG,aAAa,cAAc,YAAY,GAAG,CAAC,CAAC,EAAE;AAChF,WAAO,cAAc;AAAA,EACvB,QAAQ;AAGN,WAAO;AAAA,EACT;AACF;AAEA,IAAI,kBAAkB,GAAG;AACvB,OAAK,EAAE,MAAM,CAAC,UAAU;AACtB,YAAQ,MAAM,UAAU,KAAK;AAC7B,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;","names":["fs","path","fs","path","fs","path"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-agentmark",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "type": "module",
5
5
  "description": "Create AgentMark projects with npm create agentmark",
6
6
  "main": "dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "author": "",
30
30
  "license": "AGPL-3.0-or-later",
31
31
  "dependencies": {
32
- "@agentmark-ai/shared-utils": "0.6.1",
32
+ "@agentmark-ai/shared-utils": "0.7.0",
33
33
  "fs-extra": "^11.2.0",
34
34
  "prompts": "^2.4.2"
35
35
  },