mastra 1.6.3 → 1.6.4-alpha.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/CHANGELOG.md +10 -0
- package/dist/analytics/index.js +1 -1
- package/dist/{chunk-MSJDGXV3.js → chunk-45TLE2K2.js} +36 -55
- package/dist/chunk-45TLE2K2.js.map +1 -0
- package/dist/{chunk-2AYZWBIP.js → chunk-TE2X4TLK.js} +20 -20
- package/dist/chunk-TE2X4TLK.js.map +1 -0
- package/dist/commands/create/create.js +2 -2
- package/dist/commands/create/utils.d.ts.map +1 -1
- package/dist/commands/init/utils.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +4 -4
- package/dist/index.js +4 -4
- package/dist/studio/assets/{index-IwjxwEgz.js → index-B-kc6Ug0.js} +1 -1
- package/dist/studio/assets/{index-BT1M4Tvm.js → index-B2hrd-_b.js} +1 -1
- package/dist/studio/assets/{index-QkfdAm36.js → index-BDLciS-I.js} +1 -1
- package/dist/studio/assets/{index-DEkXmX_Q.js → index-BJdrZl7A.js} +1 -1
- package/dist/studio/assets/{index-BceBaibN.js → index-BiY2wW_y.js} +1 -1
- package/dist/studio/assets/{index-DyXMr5Sr.js → index-BvxNdF_C.js} +1 -1
- package/dist/studio/assets/{index-BZhvsxnW.js → index-C0xtqs3A.js} +1 -1
- package/dist/studio/assets/{index-CL4WKYIM.js → index-CAHAtm4d.js} +1 -1
- package/dist/studio/assets/{index-DLVxKTWV.js → index-CV69fQaz.js} +1 -1
- package/dist/studio/assets/{index-CUFhG44G.js → index-C_LW8eZR.js} +1 -1
- package/dist/studio/assets/{index-Cvyi01vl.js → index-D0uOX4X4.js} +1 -1
- package/dist/studio/assets/{index-BnpFxttj.js → index-D4Itb5pT.js} +1 -1
- package/dist/studio/assets/{index-vEgxgSsB.js → index-DwPIujMA.js} +1 -1
- package/dist/studio/assets/{index-BR1-CN8-.js → index-U_w3DmC7.js} +1 -1
- package/dist/studio/assets/{index-CwmEzW2b.js → index-Z0ge7D1k.js} +1 -1
- package/dist/studio/assets/{index-D93D1PwR.js → index-jdAnP8zL.js} +1 -1
- package/dist/studio/assets/{index-DdSK5DLd.js → index-wzDIgXIr.js} +1 -1
- package/dist/studio/assets/{index-cqQUVS11.js → index-yyeH8auD.js} +1 -1
- package/dist/studio/assets/{main-SFRlLrky.js → main-DuMxgDor.js} +200 -200
- package/dist/studio/assets/style-DJPdzrnd.css +1 -0
- package/dist/studio/index.html +2 -2
- package/package.json +5 -6
- package/dist/chunk-2AYZWBIP.js.map +0 -1
- package/dist/chunk-MSJDGXV3.js.map +0 -1
- package/dist/studio/assets/style-DkX8nf5X.css +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# mastra
|
|
2
2
|
|
|
3
|
+
## 1.6.4-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Removed Prettier from the CLI install path so generated project setup no longer pulls in the prettier dependency. ([#15711](https://github.com/mastra-ai/mastra/pull/15711))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`b510d36`](https://github.com/mastra-ai/mastra/commit/b510d368f73dab6be2e2c2bc99035aaef1fb7d7a), [`cd13713`](https://github.com/mastra-ai/mastra/commit/cd13713c01c29df6bfed64de204c5b588da222e1)]:
|
|
10
|
+
- @mastra/core@1.29.0-alpha.0
|
|
11
|
+
- @mastra/deployer@1.29.0-alpha.0
|
|
12
|
+
|
|
3
13
|
## 1.6.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/analytics/index.js
CHANGED
|
@@ -14,7 +14,6 @@ import fs4 from 'fs/promises';
|
|
|
14
14
|
import util from 'util';
|
|
15
15
|
import * as p from '@clack/prompts';
|
|
16
16
|
import color from 'picocolors';
|
|
17
|
-
import prettier from 'prettier';
|
|
18
17
|
import shellQuote from 'shell-quote';
|
|
19
18
|
import yoctoSpinner from 'yocto-spinner';
|
|
20
19
|
|
|
@@ -395,33 +394,25 @@ var getModelIdentifier = (llmProvider) => {
|
|
|
395
394
|
};
|
|
396
395
|
async function writeAgentSample(llmProvider, destPath, addExampleTool, addScorers) {
|
|
397
396
|
const modelString = getModelIdentifier(llmProvider);
|
|
398
|
-
const instructions = `
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
export const weatherAgent = new Agent({
|
|
419
|
-
id: 'weather-agent',
|
|
420
|
-
name: 'Weather Agent',
|
|
421
|
-
instructions: \`${instructions}\`,
|
|
422
|
-
model: '${modelString}',
|
|
423
|
-
${addExampleTool ? "tools: { weatherTool }," : ""}
|
|
424
|
-
${addScorers ? `scorers: {
|
|
397
|
+
const instructions = `You are a helpful weather assistant that provides accurate weather information and can help planning activities based on the weather.
|
|
398
|
+
|
|
399
|
+
Your primary function is to help users get weather details for specific locations. When responding:
|
|
400
|
+
- Always ask for a location if none is provided
|
|
401
|
+
- If the location name isn't in English, please translate it
|
|
402
|
+
- If giving a location with multiple parts (e.g. "New York, NY"), use the most relevant part (e.g. "New York")
|
|
403
|
+
- Include relevant details like humidity, wind conditions, and precipitation
|
|
404
|
+
- Keep responses concise but informative
|
|
405
|
+
- If the user asks for activities and provides the weather forecast, suggest activities based on the weather forecast.
|
|
406
|
+
- If the user asks for activities, respond in the format they request.${addExampleTool ? "\n\nUse the weatherTool to fetch current weather data." : ""}`;
|
|
407
|
+
const imports = [
|
|
408
|
+
`import { Agent } from '@mastra/core/agent';`,
|
|
409
|
+
`import { Memory } from '@mastra/memory';`,
|
|
410
|
+
addExampleTool ? `import { weatherTool } from '../tools/weather-tool';` : void 0,
|
|
411
|
+
addScorers ? `import { scorers } from '../scorers/weather-scorer';` : void 0
|
|
412
|
+
].filter(Boolean).join("\n");
|
|
413
|
+
const toolsConfig = addExampleTool ? ` tools: { weatherTool },
|
|
414
|
+
` : "";
|
|
415
|
+
const scorersConfig = addScorers ? ` scorers: {
|
|
425
416
|
toolCallAppropriateness: {
|
|
426
417
|
scorer: scorers.toolCallAppropriatenessScorer,
|
|
427
418
|
sampling: {
|
|
@@ -443,16 +434,19 @@ export const weatherAgent = new Agent({
|
|
|
443
434
|
rate: 1,
|
|
444
435
|
},
|
|
445
436
|
},
|
|
446
|
-
}
|
|
447
|
-
|
|
437
|
+
},
|
|
438
|
+
` : "";
|
|
439
|
+
const content = `${imports}
|
|
440
|
+
|
|
441
|
+
export const weatherAgent = new Agent({
|
|
442
|
+
id: 'weather-agent',
|
|
443
|
+
name: 'Weather Agent',
|
|
444
|
+
instructions: \`${instructions}\`,
|
|
445
|
+
model: '${modelString}',
|
|
446
|
+
${toolsConfig}${scorersConfig} memory: new Memory(),
|
|
448
447
|
});
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
parser: "typescript",
|
|
452
|
-
singleQuote: true
|
|
453
|
-
});
|
|
454
|
-
await fs4.writeFile(destPath, "");
|
|
455
|
-
await fs4.writeFile(destPath, formattedContent);
|
|
448
|
+
`;
|
|
449
|
+
await fs4.writeFile(destPath, content);
|
|
456
450
|
}
|
|
457
451
|
async function writeWorkflowSample(destPath) {
|
|
458
452
|
const content = `import { createStep, createWorkflow } from '@mastra/core/workflows';
|
|
@@ -640,12 +634,7 @@ const weatherWorkflow = createWorkflow({
|
|
|
640
634
|
weatherWorkflow.commit();
|
|
641
635
|
|
|
642
636
|
export { weatherWorkflow };`;
|
|
643
|
-
|
|
644
|
-
parser: "typescript",
|
|
645
|
-
semi: true,
|
|
646
|
-
singleQuote: true
|
|
647
|
-
});
|
|
648
|
-
await fs4.writeFile(destPath, formattedContent);
|
|
637
|
+
await fs4.writeFile(destPath, content);
|
|
649
638
|
}
|
|
650
639
|
async function writeToolSample(destPath) {
|
|
651
640
|
const fileService = new FileService();
|
|
@@ -733,11 +722,7 @@ export const scorers = {
|
|
|
733
722
|
completenessScorer,
|
|
734
723
|
translationScorer,
|
|
735
724
|
};`;
|
|
736
|
-
|
|
737
|
-
parser: "typescript",
|
|
738
|
-
singleQuote: true
|
|
739
|
-
});
|
|
740
|
-
await fs4.writeFile(destPath, formattedContent);
|
|
725
|
+
await fs4.writeFile(destPath, content);
|
|
741
726
|
}
|
|
742
727
|
async function writeCodeSampleForComponents(llmprovider, component, destPath, importComponents) {
|
|
743
728
|
switch (component) {
|
|
@@ -1249,12 +1234,8 @@ Learn more in the [MCP Documentation](https://mastra.ai/docs/mcp/overview).
|
|
|
1249
1234
|
}
|
|
1250
1235
|
async function writeAgentsMarkdown(options) {
|
|
1251
1236
|
const content = generateAgentsMarkdown(options);
|
|
1252
|
-
const formattedContent = await prettier.format(content, {
|
|
1253
|
-
parser: "markdown",
|
|
1254
|
-
singleQuote: true
|
|
1255
|
-
});
|
|
1256
1237
|
const filePath = path.join(process.cwd(), "AGENTS.md");
|
|
1257
|
-
await fs4.writeFile(filePath,
|
|
1238
|
+
await fs4.writeFile(filePath, content);
|
|
1258
1239
|
}
|
|
1259
1240
|
async function writeClaudeMarkdown() {
|
|
1260
1241
|
const filePath = path.join(process.cwd(), "CLAUDE.md");
|
|
@@ -1551,5 +1532,5 @@ var PosthogAnalytics = class {
|
|
|
1551
1532
|
};
|
|
1552
1533
|
|
|
1553
1534
|
export { COMPONENTS, DepsService, FileService, LLMProvider, LLM_PROVIDERS, PosthogAnalytics, checkAndInstallCoreDeps, checkForPkgJson, createComponentsDir, createMastraDir, getAPIKey, getAnalytics, getModelIdentifier, getPackageManager, getPackageManagerAddCommand, getVersionTag, gitInit, installMastraDocsMCPServer, interactivePrompt, isGitInitialized, parseComponents, parseLlmProvider, parseMcp, parseSkills, setAnalytics, shouldSkipDotenvLoading, writeAPIKey, writeAgentsMarkdown, writeClaudeMarkdown, writeCodeSample, writeIndexFile };
|
|
1554
|
-
//# sourceMappingURL=chunk-
|
|
1555
|
-
//# sourceMappingURL=chunk-
|
|
1535
|
+
//# sourceMappingURL=chunk-45TLE2K2.js.map
|
|
1536
|
+
//# sourceMappingURL=chunk-45TLE2K2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/init/mcp-docs-server-install.ts","../src/utils/package-manager.ts","../src/services/service.deps.ts","../src/services/service.env.ts","../src/services/service.fileEnv.ts","../src/services/service.file.ts","../src/commands/init/utils.ts","../src/commands/utils.ts","../src/analytics/index.ts"],"names":["hasMastraMCP","fs","path","fsPromises","fs2","__filename","__dirname","fsExtra","p","confirm","fileURLToPath","execa","existsSync","os"],"mappings":";;;;;;;;;;;;;;;;;;;;AAKA,IAAM,UAAA,GAAa,CAAC,UAAA,KAAwB;AAC1C,EAAA,MAAM,WAAA,GAAc,UAAA,GAAa,CAAA,wBAAA,EAA2B,UAAU,CAAA,CAAA,GAAK,yBAAA;AAC3E,EAAA,OAAO,CAAC,MAAM,WAAW,CAAA;AAC3B,CAAA;AAEA,IAAM,eAAA,GAAkB,CAAC,MAAA,EAAgB,UAAA,KAAwB;AAC/D,EAAA,MAAM,IAAA,GAAO,WAAW,UAAU,CAAA;AAClC,EAAA,IAAI,WAAW,QAAA,EAAU;AACvB,IAAA,OAAO;AAAA,MACL,OAAA,EAAS;AAAA,QACP,MAAA,EACE,OAAA,CAAQ,QAAA,KAAa,CAAA,KAAA,CAAA,GACjB;AAAA,UACE,OAAA,EAAS,KAAA;AAAA,UACT,IAAA,EAAM,CAAC,IAAA,EAAM,KAAA,EAAO,GAAG,IAAI,CAAA;AAAA,UAC3B,IAAA,EAAM;AAAA,SACR,GACA;AAAA,UACE,OAAA,EAAS,KAAA;AAAA,UACT,IAAA;AAAA,UACA,IAAA,EAAM;AAAA;AACR;AACR,KACF;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL,UAAA,EAAY;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AAA;AAAA,IACR;AAAA,EACF;AAAA;AAAA,EAGA,MAAM,QAAA,GAA0B;AAC9B,IAAA,IAAI,CAAC,KAAK,MAAA,EAAQ;AAChB,MAAA;AAAA,IACF;AACA,IAAA,IAAI;AACF,MAAA,MAAM,IAAA,CAAK,OAAO,QAAA,EAAS;AAAA,IAC7B,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACF","file":"chunk-45TLE2K2.js","sourcesContent":["import { existsSync } from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { ensureFile, readJSON, writeJSON } from 'fs-extra/esm';\n\nconst createArgs = (versionTag?: string) => {\n const packageName = versionTag ? `@mastra/mcp-docs-server@${versionTag}` : '@mastra/mcp-docs-server';\n return ['-y', packageName];\n};\n\nconst createMcpConfig = (editor: Editor, versionTag?: string) => {\n const args = createArgs(versionTag);\n if (editor === 'vscode') {\n return {\n servers: {\n mastra:\n process.platform === `win32`\n ? {\n command: 'cmd',\n args: ['/c', 'npx', ...args],\n type: 'stdio',\n }\n : {\n command: 'npx',\n args,\n type: 'stdio',\n },\n },\n };\n }\n return {\n mcpServers: {\n mastra: {\n command: 'npx',\n args,\n },\n },\n };\n};\n\nfunction makeConfig(\n original: { mcpServers?: Record<string, unknown>; servers?: Record<string, unknown> },\n editor: Editor,\n versionTag?: string,\n) {\n if (editor === 'vscode') {\n return {\n ...original,\n servers: {\n ...(original?.servers || {}),\n ...createMcpConfig(editor, versionTag).servers,\n },\n };\n }\n return {\n ...original,\n mcpServers: {\n ...(original?.mcpServers || {}),\n ...createMcpConfig(editor, versionTag).mcpServers,\n },\n };\n}\n\nasync function writeMergedConfig(configPath: string, editor: Editor, versionTag?: string) {\n const configExists = existsSync(configPath);\n const config = makeConfig(configExists ? await readJSON(configPath) : {}, editor, versionTag);\n await ensureFile(configPath);\n await writeJSON(configPath, config, {\n spaces: 2,\n });\n}\n\nexport const windsurfGlobalMCPConfigPath = path.join(os.homedir(), '.codeium', 'windsurf', 'mcp_config.json');\nexport const antigravityGlobalMCPConfigPath = path.join(os.homedir(), '.gemini', 'antigravity', 'mcp_config.json');\nexport const cursorGlobalMCPConfigPath = path.join(os.homedir(), '.cursor', 'mcp.json');\nexport const vscodeMCPConfigPath = path.join(process.cwd(), '.vscode', 'mcp.json');\nexport const vscodeGlobalMCPConfigPath = path.join(\n os.homedir(),\n process.platform === 'win32'\n ? path.join('AppData', 'Roaming', 'Code', 'User', 'settings.json')\n : process.platform === 'darwin'\n ? path.join('Library', 'Application Support', 'Code', 'User', 'settings.json')\n : path.join('.config', 'Code', 'User', 'settings.json'),\n);\n\nexport const EDITOR = ['cursor', 'cursor-global', 'windsurf', 'vscode', 'antigravity'] as const;\nexport type Editor = (typeof EDITOR)[number];\n\nexport const MCP_SERVER = ['cursor', 'cursor-global', 'windsurf', 'antigravity'] as const;\nexport type MCPServer = (typeof MCP_SERVER)[number];\n\n/**\n * Type-guard to check if a string is a valid MCPServer\n */\nexport function isValidMCPServer(value: string): value is MCPServer {\n return MCP_SERVER.includes(value as MCPServer);\n}\n\n/**\n * Type-guard to check if a string is a valid Editor\n */\nexport function isValidEditor(value: string): value is Editor {\n return EDITOR.includes(value as Editor);\n}\n\nexport async function installMastraDocsMCPServer({\n editor,\n directory,\n versionTag,\n}: {\n editor?: Editor;\n directory: string;\n versionTag?: string;\n}) {\n if (editor === `cursor`) {\n await writeMergedConfig(path.join(directory, '.cursor', 'mcp.json'), 'cursor', versionTag);\n }\n if (editor === `vscode`) {\n await writeMergedConfig(path.join(directory, '.vscode', 'mcp.json'), 'vscode', versionTag);\n }\n if (editor === `cursor-global`) {\n const alreadyInstalled = await globalMCPIsAlreadyInstalled(editor, versionTag);\n if (alreadyInstalled) {\n return;\n }\n await writeMergedConfig(cursorGlobalMCPConfigPath, 'cursor-global', versionTag);\n }\n\n if (editor === `windsurf`) {\n const alreadyInstalled = await globalMCPIsAlreadyInstalled(editor, versionTag);\n if (alreadyInstalled) {\n return;\n }\n await writeMergedConfig(windsurfGlobalMCPConfigPath, editor, versionTag);\n }\n\n if (editor === `antigravity`) {\n const alreadyInstalled = await globalMCPIsAlreadyInstalled(editor, versionTag);\n if (alreadyInstalled) {\n return;\n }\n await writeMergedConfig(antigravityGlobalMCPConfigPath, editor, versionTag);\n }\n}\n\nexport async function globalMCPIsAlreadyInstalled(editor: Editor, versionTag?: string) {\n let configPath: string = ``;\n\n if (editor === 'windsurf') {\n configPath = windsurfGlobalMCPConfigPath;\n } else if (editor === 'antigravity') {\n configPath = antigravityGlobalMCPConfigPath;\n } else if (editor === 'cursor-global') {\n configPath = cursorGlobalMCPConfigPath;\n } else if (editor === 'vscode') {\n configPath = vscodeGlobalMCPConfigPath;\n }\n\n if (!configPath || !existsSync(configPath)) {\n return false;\n }\n\n try {\n const configContents = await readJSON(configPath);\n\n if (!configContents) return false;\n\n // Construct the expected package string based on versionTag\n const expectedPackage = versionTag ? `@mastra/mcp-docs-server@${versionTag}` : '@mastra/mcp-docs-server';\n\n if (editor === 'vscode') {\n if (!configContents.servers) return false;\n const hasMastraMCP = Object.values(configContents.servers).some((server?: any) =>\n server?.args?.find((arg?: string) => arg === expectedPackage),\n );\n return hasMastraMCP;\n }\n\n if (!configContents?.mcpServers) return false;\n const hasMastraMCP = Object.values(configContents.mcpServers).some((server?: any) =>\n server?.args?.find((arg?: string) => arg === expectedPackage),\n );\n\n return hasMastraMCP;\n } catch {\n return false;\n }\n}\n","export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\nexport function getPackageManagerAddCommand(pm: PackageManager): string {\n switch (pm) {\n case 'npm':\n return 'install --audit=false --fund=false --loglevel=error --progress=false --update-notifier=false';\n case 'yarn':\n return 'add';\n case 'pnpm':\n return 'add --loglevel=error';\n case 'bun':\n return 'add';\n default:\n return 'add';\n }\n}\n","import fs from 'node:fs';\nimport fsPromises from 'node:fs/promises';\nimport path from 'node:path';\nimport { execa } from 'execa';\nimport { getPackageManagerAddCommand } from '../utils/package-manager';\nimport type { PackageManager } from '../utils/package-manager';\n\nexport class DepsService {\n readonly packageManager: PackageManager;\n\n constructor() {\n this.packageManager = this.getPackageManager();\n }\n\n private findLockFile(dir: string): string | null {\n const lockFiles = ['pnpm-lock.yaml', 'package-lock.json', 'yarn.lock', 'bun.lock', 'bun.lockb'];\n for (const file of lockFiles) {\n if (fs.existsSync(path.join(dir, file))) {\n return file;\n }\n }\n const parentDir = path.resolve(dir, '..');\n if (parentDir !== dir) {\n return this.findLockFile(parentDir);\n }\n return null;\n }\n\n private getPackageManager(): PackageManager {\n const lockFile = this.findLockFile(process.cwd());\n switch (lockFile) {\n case 'pnpm-lock.yaml':\n return 'pnpm';\n case 'package-lock.json':\n return 'npm';\n case 'yarn.lock':\n return 'yarn';\n case 'bun.lock':\n case 'bun.lockb':\n return 'bun';\n default:\n return 'npm';\n }\n }\n\n public async installPackages(packages: string[]) {\n const pm = this.packageManager;\n const installCommand = getPackageManagerAddCommand(pm);\n\n const packageList = packages.join(' ');\n return execa(`${pm} ${installCommand} ${packageList}`, {\n all: true,\n shell: true,\n stdio: 'pipe',\n });\n }\n\n public async checkDependencies(dependencies: string[]): Promise<string> {\n try {\n const packageJsonPath = path.join(process.cwd(), 'package.json');\n\n try {\n await fsPromises.access(packageJsonPath);\n } catch {\n return 'No package.json file found in the current directory';\n }\n\n const packageJson = JSON.parse(await fsPromises.readFile(packageJsonPath, 'utf-8'));\n for (const dependency of dependencies) {\n if (!packageJson.dependencies || !packageJson.dependencies[dependency]) {\n return `Please install ${dependency} before running this command (${this.packageManager} install ${dependency})`;\n }\n }\n\n return 'ok';\n } catch (err) {\n console.error(err);\n return 'Could not check dependencies';\n }\n }\n\n public async getProjectName() {\n try {\n const packageJsonPath = path.join(process.cwd(), 'package.json');\n const packageJson = await fsPromises.readFile(packageJsonPath, 'utf-8');\n const pkg = JSON.parse(packageJson);\n return pkg.name;\n } catch (err) {\n throw err;\n }\n }\n\n public async addScriptsToPackageJson(scripts: Record<string, string>) {\n const packageJson = JSON.parse(await fsPromises.readFile('package.json', 'utf-8'));\n packageJson.scripts = {\n ...packageJson.scripts,\n ...scripts,\n };\n await fsPromises.writeFile('package.json', JSON.stringify(packageJson, null, 2));\n }\n}\n","export abstract class EnvService {\n abstract getEnvValue(key: string): Promise<string | null>;\n abstract setEnvValue(key: string, value: string): Promise<void>;\n}\n","import * as fs from 'node:fs';\n\nimport { EnvService } from './service.env';\n\n// TODO: Refactor (copied from admin)\nexport class FileEnvService extends EnvService {\n private filePath: string;\n\n constructor(filePath: string) {\n super();\n this.filePath = filePath;\n }\n\n private readFile(filePath: string): Promise<string> {\n return new Promise((resolve, reject) => {\n fs.readFile(filePath, 'utf8', (err: NodeJS.ErrnoException | null, data: string) => {\n if (err) reject(err);\n else resolve(data);\n });\n });\n }\n\n private writeFile({ filePath, data }: { filePath: string; data: string }): Promise<void> {\n return new Promise((resolve, reject) => {\n fs.writeFile(filePath, data, 'utf8', (err: NodeJS.ErrnoException | null) => {\n if (err) reject(err);\n else resolve();\n });\n });\n }\n\n private async updateEnvData({\n key,\n value,\n filePath = this.filePath,\n data,\n }: {\n key: string;\n value: string;\n filePath?: string;\n data: string;\n }): Promise<string> {\n const regex = new RegExp(`^${key}=.*$`, 'm');\n if (data.match(regex)) {\n data = data.replace(regex, `${key}=${value}`);\n } else {\n data += `\\n${key}=${value}`;\n }\n await this.writeFile({ filePath, data });\n console.info(`${key} set to ${value} in ENV file.`);\n return data;\n }\n\n async getEnvValue(key: string): Promise<string | null> {\n try {\n const data = await this.readFile(this.filePath);\n const regex = new RegExp(`^${key}=(.*)$`, 'm');\n const match = data.match(regex);\n return match?.[1] || null;\n } catch (err) {\n console.error(`Error reading ENV value: ${err}`);\n return null;\n }\n }\n\n async setEnvValue(key: string, value: string): Promise<void> {\n try {\n const data = await this.readFile(this.filePath);\n await this.updateEnvData({ key, value, data });\n } catch (err) {\n console.error(`Error writing ENV value: ${err}`);\n }\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport fsExtra from 'fs-extra/esm';\n\nimport { FileEnvService } from './service.fileEnv';\n\nexport class FileService {\n /**\n *\n * @param inputFile the file in the starter files directory to copy\n * @param outputFilePath the destination path\n * @param replaceIfExists flag to replace if it exists\n * @returns\n */\n public async copyStarterFile(inputFile: string, outputFilePath: string, replaceIfExists?: boolean) {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n const filePath = path.resolve(__dirname, 'starter-files', inputFile);\n const fileString = fs.readFileSync(filePath, 'utf8');\n\n if (fs.existsSync(outputFilePath) && !replaceIfExists) {\n console.info(`${outputFilePath} already exists`);\n return false;\n }\n\n await fsExtra.outputFile(outputFilePath, fileString);\n\n return true;\n }\n\n public async setupEnvFile({ dbUrl }: { dbUrl: string }) {\n const envPath = path.join(process.cwd(), '.env.development');\n\n await fsExtra.ensureFile(envPath);\n\n const fileEnvService = new FileEnvService(envPath);\n await fileEnvService.setEnvValue('DB_URL', dbUrl);\n }\n\n public getFirstExistingFile(files: string[]): string {\n for (const f of files) {\n if (fs.existsSync(f)) {\n return f;\n }\n }\n\n throw new Error('Missing required file, checked the following paths: ' + files.join(', '));\n }\n\n public replaceValuesInFile({\n filePath,\n replacements,\n }: {\n filePath: string;\n replacements: { search: string; replace: string }[];\n }) {\n let fileContent = fs.readFileSync(filePath, 'utf8');\n replacements.forEach(({ search, replace }) => {\n fileContent = fileContent.replaceAll(search, replace);\n });\n\n fs.writeFileSync(filePath, fileContent);\n }\n}\n","import child_process from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport util from 'node:util';\nimport * as p from '@clack/prompts';\nimport type { ModelRouterModelId } from '@mastra/core/llm/model';\nimport fsExtra from 'fs-extra/esm';\nimport color from 'picocolors';\nimport shellQuote from 'shell-quote';\nimport yoctoSpinner from 'yocto-spinner';\n\nimport { DepsService } from '../../services/service.deps';\nimport { FileService } from '../../services/service.file';\nimport {\n cursorGlobalMCPConfigPath,\n windsurfGlobalMCPConfigPath,\n antigravityGlobalMCPConfigPath,\n} from './mcp-docs-server-install';\nimport type { Editor } from './mcp-docs-server-install';\n\nconst exec = util.promisify(child_process.exec);\n\nexport const LLMProvider = ['openai', 'anthropic', 'groq', 'google', 'cerebras', 'mistral'] as const;\nexport const COMPONENTS = ['agents', 'workflows', 'tools', 'scorers'] as const;\n\nexport type LLMProvider = (typeof LLMProvider)[number];\nexport type Component = (typeof COMPONENTS)[number];\n\n/**\n * Type-guard to check if a value is a valid LLMProvider\n */\nexport function isValidLLMProvider(value: string): value is LLMProvider {\n return LLMProvider.includes(value as LLMProvider);\n}\n\n/**\n * Type-guard to check if a value contains only valid Components\n */\nexport function areValidComponents(values: string[]): values is Component[] {\n return values.every(value => COMPONENTS.includes(value as Component));\n}\n\nexport const getModelIdentifier = (llmProvider: LLMProvider): ModelRouterModelId => {\n let model: ModelRouterModelId = 'openai/gpt-5-mini';\n\n if (llmProvider === 'anthropic') {\n model = 'anthropic/claude-sonnet-4-5';\n } else if (llmProvider === 'groq') {\n model = 'groq/llama-3.3-70b-versatile';\n } else if (llmProvider === 'google') {\n model = 'google/gemini-2.5-pro';\n } else if (llmProvider === 'cerebras') {\n model = 'cerebras/llama-3.3-70b';\n } else if (llmProvider === 'mistral') {\n model = 'mistral/mistral-medium-2508';\n }\n\n return model;\n};\n\nexport async function writeAgentSample(\n llmProvider: LLMProvider,\n destPath: string,\n addExampleTool: boolean,\n addScorers: boolean,\n) {\n const modelString = getModelIdentifier(llmProvider);\n\n const instructions = `You are a helpful weather assistant that provides accurate weather information and can help planning activities based on the weather.\n\nYour primary function is to help users get weather details for specific locations. When responding:\n- Always ask for a location if none is provided\n- If the location name isn't in English, please translate it\n- If giving a location with multiple parts (e.g. \"New York, NY\"), use the most relevant part (e.g. \"New York\")\n- Include relevant details like humidity, wind conditions, and precipitation\n- Keep responses concise but informative\n- If the user asks for activities and provides the weather forecast, suggest activities based on the weather forecast.\n- If the user asks for activities, respond in the format they request.${addExampleTool ? '\\n\\nUse the weatherTool to fetch current weather data.' : ''}`;\n const imports = [\n `import { Agent } from '@mastra/core/agent';`,\n `import { Memory } from '@mastra/memory';`,\n addExampleTool ? `import { weatherTool } from '../tools/weather-tool';` : undefined,\n addScorers ? `import { scorers } from '../scorers/weather-scorer';` : undefined,\n ]\n .filter(Boolean)\n .join('\\n');\n const toolsConfig = addExampleTool ? ` tools: { weatherTool },\\n` : '';\n const scorersConfig = addScorers\n ? ` scorers: {\n toolCallAppropriateness: {\n scorer: scorers.toolCallAppropriatenessScorer,\n sampling: {\n type: 'ratio',\n rate: 1,\n },\n },\n completeness: {\n scorer: scorers.completenessScorer,\n sampling: {\n type: 'ratio',\n rate: 1,\n },\n },\n translation: {\n scorer: scorers.translationScorer,\n sampling: {\n type: 'ratio',\n rate: 1,\n },\n },\n },\n`\n : '';\n const content = `${imports}\n\nexport const weatherAgent = new Agent({\n id: 'weather-agent',\n name: 'Weather Agent',\n instructions: \\`${instructions}\\`,\n model: '${modelString}',\n${toolsConfig}${scorersConfig} memory: new Memory(),\n});\n`;\n\n await fs.writeFile(destPath, content);\n}\n\nexport async function writeWorkflowSample(destPath: string) {\n const content = `import { createStep, createWorkflow } from '@mastra/core/workflows';\nimport { z } from 'zod';\n\nconst forecastSchema = z.object({\n date: z.string(),\n maxTemp: z.number(),\n minTemp: z.number(),\n precipitationChance: z.number(),\n condition: z.string(),\n location: z.string(),\n})\n\nfunction getWeatherCondition(code: number): string {\n const conditions: Record<number, string> = {\n 0: 'Clear sky',\n 1: 'Mainly clear',\n 2: 'Partly cloudy',\n 3: 'Overcast',\n 45: 'Foggy',\n 48: 'Depositing rime fog',\n 51: 'Light drizzle',\n 53: 'Moderate drizzle',\n 55: 'Dense drizzle',\n 61: 'Slight rain',\n 63: 'Moderate rain',\n 65: 'Heavy rain',\n 71: 'Slight snow fall',\n 73: 'Moderate snow fall',\n 75: 'Heavy snow fall',\n 95: 'Thunderstorm',\n }\n return conditions[code] || 'Unknown'\n}\n\nconst fetchWeather = createStep({\n id: 'fetch-weather',\n description: 'Fetches weather forecast for a given city',\n inputSchema: z.object({\n city: z.string().describe('The city to get the weather for'),\n }),\n outputSchema: forecastSchema,\n execute: async ({ inputData }) => {\n if (!inputData) {\n throw new Error('Input data not found');\n }\n\n const geocodingUrl = \\`https://geocoding-api.open-meteo.com/v1/search?name=\\${encodeURIComponent(inputData.city)}&count=1\\`;\n const geocodingResponse = await fetch(geocodingUrl);\n const geocodingData = (await geocodingResponse.json()) as {\n results: { latitude: number; longitude: number; name: string }[];\n };\n\n if (!geocodingData.results?.[0]) {\n throw new Error(\\`Location '\\${inputData.city}' not found\\`);\n }\n\n const { latitude, longitude, name } = geocodingData.results[0];\n\n const weatherUrl = \\`https://api.open-meteo.com/v1/forecast?latitude=\\${latitude}&longitude=\\${longitude}¤t=precipitation,weathercode&timezone=auto,&hourly=precipitation_probability,temperature_2m\\`;\n const response = await fetch(weatherUrl);\n const data = (await response.json()) as {\n current: {\n time: string\n precipitation: number\n weathercode: number\n }\n hourly: {\n precipitation_probability: number[]\n temperature_2m: number[]\n }\n }\n\n const forecast = {\n date: new Date().toISOString(),\n maxTemp: Math.max(...data.hourly.temperature_2m),\n minTemp: Math.min(...data.hourly.temperature_2m),\n condition: getWeatherCondition(data.current.weathercode),\n precipitationChance: data.hourly.precipitation_probability.reduce(\n (acc, curr) => Math.max(acc, curr),\n 0\n ),\n location: name\n }\n\n return forecast;\n },\n});\n\n\nconst planActivities = createStep({\n id: 'plan-activities',\n description: 'Suggests activities based on weather conditions',\n inputSchema: forecastSchema,\n outputSchema: z.object({\n activities: z.string(),\n }),\n execute: async ({ inputData, mastra }) => {\n const forecast = inputData\n\n if (!forecast) {\n throw new Error('Forecast data not found')\n }\n\n const agent = mastra?.getAgent('weatherAgent');\n if (!agent) {\n throw new Error('Weather agent not found');\n }\n\n const prompt = \\`Based on the following weather forecast for \\${forecast.location}, suggest appropriate activities:\n \\${JSON.stringify(forecast, null, 2)}\n For each day in the forecast, structure your response exactly as follows:\n\n 📅 [Day, Month Date, Year]\n ═══════════════════════════\n\n 🌡️ WEATHER SUMMARY\n • Conditions: [brief description]\n • Temperature: [X°C/Y°F to A°C/B°F]\n • Precipitation: [X% chance]\n\n 🌅 MORNING ACTIVITIES\n Outdoor:\n • [Activity Name] - [Brief description including specific location/route]\n Best timing: [specific time range]\n Note: [relevant weather consideration]\n\n 🌞 AFTERNOON ACTIVITIES\n Outdoor:\n • [Activity Name] - [Brief description including specific location/route]\n Best timing: [specific time range]\n Note: [relevant weather consideration]\n\n 🏠 INDOOR ALTERNATIVES\n • [Activity Name] - [Brief description including specific venue]\n Ideal for: [weather condition that would trigger this alternative]\n\n ⚠️ SPECIAL CONSIDERATIONS\n • [Any relevant weather warnings, UV index, wind conditions, etc.]\n\n Guidelines:\n - Suggest 2-3 time-specific outdoor activities per day\n - Include 1-2 indoor backup options\n - For precipitation >50%, lead with indoor activities\n - All activities must be specific to the location\n - Include specific venues, trails, or locations\n - Consider activity intensity based on temperature\n - Keep descriptions concise but informative\n\n Maintain this exact formatting for consistency, using the emoji and section headers as shown.\\`;\n\n const response = await agent.stream([\n {\n role: 'user',\n content: prompt,\n },\n ]);\n\n let activitiesText = '';\n\n for await (const chunk of response.textStream) {\n process.stdout.write(chunk);\n activitiesText += chunk;\n }\n\n return {\n activities: activitiesText,\n };\n },\n});\n\nconst weatherWorkflow = createWorkflow({\n id: 'weather-workflow',\n inputSchema: z.object({\n city: z.string().describe('The city to get the weather for'),\n }),\n outputSchema: z.object({\n activities: z.string(),\n })\n})\n .then(fetchWeather)\n .then(planActivities);\n\nweatherWorkflow.commit();\n\nexport { weatherWorkflow };`;\n\n await fs.writeFile(destPath, content);\n}\n\nexport async function writeToolSample(destPath: string) {\n const fileService = new FileService();\n await fileService.copyStarterFile('tools.ts', destPath);\n}\n\nexport async function writeScorersSample(llmProvider: LLMProvider, destPath: string) {\n const modelString = getModelIdentifier(llmProvider);\n const content = `import { z } from 'zod';\nimport { createToolCallAccuracyScorerCode } from '@mastra/evals/scorers/prebuilt';\nimport { createCompletenessScorer } from '@mastra/evals/scorers/prebuilt';\nimport { getAssistantMessageFromRunOutput, getUserMessageFromRunInput } from '@mastra/evals/scorers/utils';\nimport { createScorer } from '@mastra/core/evals';\n\nexport const toolCallAppropriatenessScorer = createToolCallAccuracyScorerCode({\n expectedTool: 'weatherTool',\n strictMode: false,\n});\n\nexport const completenessScorer = createCompletenessScorer();\n\n// Custom LLM-judged scorer: evaluates if non-English locations are translated appropriately\nexport const translationScorer = createScorer({\n id: 'translation-quality-scorer',\n name: 'Translation Quality',\n description: 'Checks that non-English location names are translated and used correctly',\n type: 'agent',\n judge: {\n model: '${modelString}',\n instructions:\n 'You are an expert evaluator of translation quality for geographic locations. ' +\n 'Determine whether the user text mentions a non-English location and whether the assistant correctly uses an English translation of that location. ' +\n 'Be lenient with transliteration differences and diacritics. ' +\n 'Return only the structured JSON matching the provided schema.',\n },\n})\n .preprocess(({ run }) => {\n const userText = getUserMessageFromRunInput(run.input) || '';\n const assistantText = getAssistantMessageFromRunOutput(run.output) || '';\n return { userText, assistantText };\n })\n .analyze({\n description: 'Extract location names and detect language/translation adequacy',\n outputSchema: z.object({\n nonEnglish: z.boolean(),\n translated: z.boolean(),\n confidence: z.number().min(0).max(1).default(1),\n explanation: z.string().default(''),\n }),\n createPrompt: ({ results }) => \\`\n You are evaluating if a weather assistant correctly handled translation of a non-English location.\n User text:\n \"\"\"\n \\${results.preprocessStepResult.userText}\n \"\"\"\n Assistant response:\n \"\"\"\n \\${results.preprocessStepResult.assistantText}\n \"\"\"\n Tasks:\n 1) Identify if the user mentioned a location that appears non-English.\n 2) If non-English, check whether the assistant used a correct English translation of that location in its response.\n 3) Be lenient with transliteration differences (e.g., accents/diacritics).\n Return JSON with fields:\n {\n \"nonEnglish\": boolean,\n \"translated\": boolean,\n \"confidence\": number, // 0-1\n \"explanation\": string\n }\n \\`,\n })\n .generateScore(({ results }) => {\n const r = (results as any)?.analyzeStepResult || {};\n if (!r.nonEnglish) return 1; // If not applicable, full credit\n if (r.translated) return Math.max(0, Math.min(1, 0.7 + 0.3 * (r.confidence ?? 1)));\n return 0; // Non-English but not translated\n })\n .generateReason(({ results, score }) => {\n const r = (results as any)?.analyzeStepResult || {};\n return \\`Translation scoring: nonEnglish=\\${r.nonEnglish ?? false}, translated=\\${r.translated ?? false}, confidence=\\${r.confidence ?? 0}. Score=\\${score}. \\${r.explanation ?? ''}\\`;\n });\n\nexport const scorers = {\n toolCallAppropriatenessScorer,\n completenessScorer,\n translationScorer,\n};`;\n\n await fs.writeFile(destPath, content);\n}\n\nexport async function writeCodeSampleForComponents(\n llmprovider: LLMProvider,\n component: Component,\n destPath: string,\n importComponents: Component[],\n) {\n switch (component) {\n case 'agents':\n return writeAgentSample(\n llmprovider,\n destPath,\n importComponents.includes('tools'),\n importComponents.includes('scorers'),\n );\n case 'tools':\n return writeToolSample(destPath);\n case 'workflows':\n return writeWorkflowSample(destPath);\n case 'scorers':\n return writeScorersSample(llmprovider, destPath);\n default:\n return '';\n }\n}\n\nexport const createComponentsDir = async (dirPath: string, component: string) => {\n const componentPath = dirPath + `/${component}`;\n\n await fsExtra.ensureDir(componentPath);\n};\n\nexport const writeIndexFile = async ({\n dirPath,\n addAgent,\n addExample,\n addWorkflow,\n addScorers,\n}: {\n dirPath: string;\n addExample: boolean;\n addWorkflow: boolean;\n addAgent: boolean;\n addScorers: boolean;\n}) => {\n const indexPath = dirPath + '/index.ts';\n const destPath = path.join(indexPath);\n try {\n await fs.writeFile(destPath, '');\n const filteredExports = [\n addWorkflow ? `workflows: { weatherWorkflow },` : '',\n addAgent ? `agents: { weatherAgent },` : '',\n addScorers ? `scorers: { toolCallAppropriatenessScorer, completenessScorer, translationScorer },` : '',\n ].filter(Boolean);\n if (!addExample) {\n await fs.writeFile(\n destPath,\n `\nimport { Mastra } from '@mastra/core/mastra';\n\nexport const mastra = new Mastra()\n `,\n );\n\n return;\n }\n await fs.writeFile(\n destPath,\n `\nimport { Mastra } from '@mastra/core/mastra';\nimport { PinoLogger } from '@mastra/loggers';\nimport { LibSQLStore } from '@mastra/libsql';\nimport { DuckDBStore } from \"@mastra/duckdb\";\nimport { MastraCompositeStore } from '@mastra/core/storage';\nimport { Observability, DefaultExporter, CloudExporter, SensitiveDataFilter } from '@mastra/observability';\n${addWorkflow ? `import { weatherWorkflow } from './workflows/weather-workflow';` : ''}\n${addAgent ? `import { weatherAgent } from './agents/weather-agent';` : ''}\n${addScorers ? `import { toolCallAppropriatenessScorer, completenessScorer, translationScorer } from './scorers/weather-scorer';` : ''}\n\nexport const mastra = new Mastra({\n ${filteredExports.join('\\n ')}\n storage: new MastraCompositeStore({\n id: 'composite-storage',\n default: new LibSQLStore({\n id: \"mastra-storage\",\n url: \"file:./mastra.db\",\n }),\n domains: {\n observability: await new DuckDBStore().getStore('observability'),\n }\n }),\n logger: new PinoLogger({\n name: 'Mastra',\n level: 'info',\n }),\n observability: new Observability({\n configs: {\n default: {\n serviceName: 'mastra',\n exporters: [\n new DefaultExporter(), // Persists traces to storage for Mastra Studio\n new CloudExporter(), // Sends observability data to hosted Mastra Studio (if MASTRA_CLOUD_ACCESS_TOKEN is set)\n ],\n spanOutputProcessors: [\n new SensitiveDataFilter(), // Redacts sensitive data like passwords, tokens, keys\n ],\n },\n },\n }),\n});\n`,\n );\n } catch (err) {\n throw err;\n }\n};\n\nexport const checkInitialization = async (dirPath: string) => {\n try {\n await fs.access(dirPath);\n return true;\n } catch {\n return false;\n }\n};\n\nexport const checkAndInstallCoreDeps = async (addExample: boolean, versionTag?: string) => {\n const spinner = yoctoSpinner({ text: 'Installing Mastra core dependencies' });\n let packages: Array<{ name: string; version: string }> = [];\n const mastraVersionTag = versionTag || 'latest';\n\n try {\n const depService = new DepsService();\n\n spinner.start();\n\n const needsCore = (await depService.checkDependencies(['@mastra/core'])) !== `ok`;\n const needsCli = (await depService.checkDependencies(['mastra'])) !== `ok`;\n const needsZod = (await depService.checkDependencies(['zod'])) !== `ok`;\n\n if (needsCore) {\n packages.push({ name: '@mastra/core', version: mastraVersionTag });\n }\n\n if (needsCli) {\n packages.push({ name: 'mastra', version: mastraVersionTag });\n }\n\n if (needsZod) {\n packages.push({ name: 'zod', version: '^4' });\n }\n\n if (addExample) {\n const needsLibsql = (await depService.checkDependencies(['@mastra/libsql'])) !== `ok`;\n\n if (needsLibsql) {\n packages.push({ name: '@mastra/libsql', version: mastraVersionTag });\n }\n }\n\n if (packages.length > 0) {\n await depService.installPackages(packages.map(pkg => `${pkg.name}@${pkg.version}`));\n }\n\n spinner.success('Successfully installed Mastra core dependencies');\n } catch (err) {\n spinner.error(`Failed to install core dependencies: ${err instanceof Error ? err.message : 'Unknown error'}`);\n }\n};\n\nexport const getAPIKey = async (provider: LLMProvider) => {\n let key = 'OPENAI_API_KEY';\n switch (provider) {\n case 'anthropic':\n key = 'ANTHROPIC_API_KEY';\n return key;\n case 'groq':\n key = 'GROQ_API_KEY';\n return key;\n case 'google':\n key = 'GOOGLE_GENERATIVE_AI_API_KEY';\n return key;\n case 'cerebras':\n key = 'CEREBRAS_API_KEY';\n return key;\n case 'mistral':\n key = 'MISTRAL_API_KEY';\n return key;\n default:\n return key;\n }\n};\n\nexport const writeAPIKey = async ({ provider, apiKey }: { provider: LLMProvider; apiKey?: string }) => {\n /**\n * If people skip entering an API key (because they e.g. have it in their environment already), we write to .env.example instead of .env so that they can immediately run Mastra without having to delete an .env file with an invalid key.\n */\n const envFileName = apiKey ? '.env' : '.env.example';\n\n const key = await getAPIKey(provider);\n const escapedKey = shellQuote.quote([key]);\n const escapedApiKey = shellQuote.quote([apiKey ? apiKey : 'your-api-key']);\n await exec(`echo ${escapedKey}=${escapedApiKey} >> ${envFileName}`);\n};\nexport const createMastraDir = async (directory: string): Promise<{ ok: true; dirPath: string } | { ok: false }> => {\n let dir = directory\n .trim()\n .split('/')\n .filter(item => item !== '');\n\n const dirPath = path.join(process.cwd(), ...dir, 'mastra');\n\n try {\n await fs.access(dirPath);\n return { ok: false };\n } catch {\n await fsExtra.ensureDir(dirPath);\n return { ok: true, dirPath };\n }\n};\n\nexport const writeCodeSample = async (\n dirPath: string,\n component: Component,\n llmProvider: LLMProvider,\n importComponents: Component[],\n) => {\n const destPath = dirPath + `/${component}/weather-${component.slice(0, -1)}.ts`;\n\n try {\n await writeCodeSampleForComponents(llmProvider, component, destPath, importComponents);\n } catch (err) {\n throw err;\n }\n};\n\nexport const LLM_PROVIDERS: { value: LLMProvider; label: string; hint?: string }[] = [\n { value: 'openai', label: 'OpenAI', hint: 'recommended' },\n { value: 'anthropic', label: 'Anthropic' },\n { value: 'groq', label: 'Groq' },\n { value: 'google', label: 'Google' },\n { value: 'cerebras', label: 'Cerebras' },\n { value: 'mistral', label: 'Mistral' },\n];\n\ninterface InteractivePromptArgs {\n options?: {\n showBanner?: boolean;\n };\n skip?: {\n directory?: boolean;\n llmProvider?: boolean;\n llmApiKey?: boolean;\n gitInit?: boolean;\n skills?: boolean;\n mcpServer?: boolean;\n };\n}\n\nexport const interactivePrompt = async (args: InteractivePromptArgs = {}) => {\n const { skip = {}, options: { showBanner = true } = {} } = args;\n\n if (showBanner) {\n p.intro(color.inverse(' Mastra Init '));\n }\n const mastraProject = await p.group(\n {\n directory: () =>\n skip?.directory\n ? undefined\n : p.text({\n message: 'Where should we create the Mastra files? (default: src/)',\n placeholder: 'src/',\n defaultValue: 'src/',\n }),\n llmProvider: () =>\n skip?.llmProvider\n ? undefined\n : p.select({\n message: 'Select a default provider:',\n options: LLM_PROVIDERS,\n }),\n llmApiKey: async ({ results: { llmProvider } }) => {\n if (skip?.llmApiKey) return undefined;\n\n const llmName = LLM_PROVIDERS.find(p => p.value === llmProvider)?.label || 'provider';\n const keyChoice = await p.select({\n message: `Enter your ${llmName} API key?`,\n options: [\n { value: 'skip', label: 'Skip for now', hint: 'default' },\n { value: 'enter', label: 'Enter API key' },\n ],\n initialValue: 'skip',\n });\n\n if (keyChoice === 'enter') {\n return p.password({\n message: 'Enter your API key:',\n mask: '*',\n clearOnError: true,\n validate: value => {\n if (!value || value.length === 0) return 'API key cannot be empty';\n },\n });\n }\n return undefined;\n },\n configureMastraToolingForAgents: async () => {\n if (skip?.skills && skip?.mcpServer) return { skills: undefined, mcpServer: undefined };\n\n const choice = await p.select({\n message: `Configure Mastra tooling for agents?`,\n options: [\n { value: 'skills', label: 'Skills', hint: 'recommended' },\n { value: 'mcp', label: 'MCP Docs Server' },\n ],\n initialValue: 'skills',\n });\n\n if (p.isCancel(choice)) {\n return { skills: undefined, mcpServer: undefined };\n }\n\n if (choice === 'skills') {\n // Popular agents\n const POPULAR_AGENTS: { value: string; label: string }[] = [\n { value: 'universal', label: 'Universal (Codex, Cursor, Gemini, GitHub, OpenCode)' },\n { value: 'claude-code', label: 'Claude Code' },\n ];\n\n // All agents (alphabetically)\n const ALL_AGENTS: { value: string; label: string }[] = [\n ...POPULAR_AGENTS,\n { value: 'adal', label: 'AdaL' },\n { value: 'antigravity', label: 'Antigravity' },\n { value: 'augment', label: 'Augment' },\n { value: 'codebuddy', label: 'CodeBuddy' },\n { value: 'command-code', label: 'Command Code' },\n { value: 'crush', label: 'Crush' },\n { value: 'droid', label: 'Droid' },\n { value: 'goose', label: 'Goose' },\n { value: 'iflow-cli', label: 'iFlow CLI' },\n { value: 'junie', label: 'Junie' },\n { value: 'kilo', label: 'Kilo Code' },\n { value: 'kiro-cli', label: 'Kiro CLI' },\n { value: 'kode', label: 'Kode' },\n { value: 'mcpjam', label: 'MCPJam' },\n { value: 'mistral-vibe', label: 'Mistral Vibe' },\n { value: 'mux', label: 'Mux' },\n { value: 'neovate', label: 'Neovate' },\n { value: 'openclaude', label: 'OpenClaude IDE' },\n { value: 'openclaw', label: 'OpenClaw' },\n { value: 'openhands', label: 'OpenHands' },\n { value: 'pi', label: 'Pi' },\n { value: 'pochi', label: 'Pochi' },\n { value: 'qoder', label: 'Qoder' },\n { value: 'qwen-code', label: 'Qwen Code' },\n { value: 'replit', label: 'Replit' },\n { value: 'roo', label: 'Roo Code' },\n { value: 'trae', label: 'Trae' },\n { value: 'trae-cn', label: 'Trae CN' },\n { value: 'windsurf', label: 'Windsurf' },\n { value: 'zencoder', label: 'Zencoder' },\n ];\n\n // Show popular agents first with \"Show all\" option\n const initialSelection = await p.select({\n message: `Select your agent:`,\n options: [...POPULAR_AGENTS, { value: '__show_all__', label: '+ Show all agents' }],\n initialValue: 'universal',\n });\n\n if (p.isCancel(initialSelection)) {\n return { skills: undefined, mcpServer: undefined };\n }\n\n let selectedAgents = new Set<string>();\n\n // If user selected \"Show all\", show full list\n if (initialSelection === '__show_all__') {\n const followUpSelection = await p.select({\n message: `Select your agent:`,\n options: ALL_AGENTS,\n });\n\n if (p.isCancel(followUpSelection)) {\n return { skills: undefined, mcpServer: undefined };\n }\n\n selectedAgents.add(followUpSelection);\n } else {\n selectedAgents.add(initialSelection);\n }\n\n // Always add \"universal\" type so that the definition there gets symlinked to the proprietary agent folders\n selectedAgents.add('universal');\n\n return { skills: Array.from(selectedAgents), mcpServer: undefined };\n }\n\n // If MCP selected, show editor sub-selection\n if (choice === 'mcp') {\n const editor = await p.select({\n message: `Which editor?`,\n options: [\n {\n value: 'cursor',\n label: 'Cursor (project only)',\n },\n {\n value: 'cursor-global',\n label: 'Cursor (global, all projects)',\n },\n {\n value: 'windsurf',\n label: 'Windsurf',\n },\n {\n value: 'vscode',\n label: 'VSCode',\n },\n {\n value: 'antigravity',\n label: 'Antigravity',\n },\n ] satisfies { value: Editor; label: string }[],\n });\n\n if (p.isCancel(editor)) {\n return { skills: undefined, mcpServer: undefined };\n }\n\n // Handle MCP editor selections with confirmations\n if (editor === `cursor`) {\n p.log.message(\n `\\nNote: you will need to go into Cursor Settings -> MCP Settings and manually enable the installed Mastra MCP server.\\n`,\n );\n }\n\n if (editor === `cursor-global`) {\n const confirm = await p.select({\n message: `Global install will add/update ${cursorGlobalMCPConfigPath} and make the Mastra docs MCP server available in all your Cursor projects. Continue?`,\n options: [\n { value: 'yes', label: 'Yes, I understand' },\n { value: 'no', label: 'No, cancel' },\n ],\n });\n if (confirm !== `yes`) {\n return { skills: undefined, mcpServer: undefined };\n }\n }\n\n if (editor === `windsurf`) {\n const confirm = await p.select({\n message: `Windsurf only supports a global MCP config (at ${windsurfGlobalMCPConfigPath}) is it ok to add/update that global config?\\nThis means the Mastra docs MCP server will be available in all your Windsurf projects.`,\n options: [\n { value: 'yes', label: 'Yes, I understand' },\n { value: 'no', label: 'No, cancel' },\n ],\n });\n if (confirm !== `yes`) {\n return { skills: undefined, mcpServer: undefined };\n }\n }\n\n if (editor === `antigravity`) {\n const confirm = await p.select({\n message: `Antigravity only supports a global MCP config (at ${antigravityGlobalMCPConfigPath}). Is it ok to add/update that global config?\\nThis will make the Mastra docs MCP server available in all Antigravity projects.`,\n options: [\n { value: 'yes', label: 'Yes, I understand' },\n { value: 'no', label: 'No, cancel' },\n ],\n });\n\n if (confirm !== `yes`) {\n return { skills: undefined, mcpServer: undefined };\n }\n }\n return { skills: undefined, mcpServer: editor };\n }\n\n return { skills: undefined, mcpServer: undefined };\n },\n initGit: async () => {\n if (skip?.gitInit) return false;\n\n return p.confirm({\n message: 'Initialize a new git repository?',\n initialValue: true,\n });\n },\n },\n {\n onCancel: () => {\n p.cancel('Operation cancelled.');\n process.exit(0);\n },\n },\n );\n\n // Flatten the configureMastraToolingForAgents return value\n const { configureMastraToolingForAgents, ...rest } = mastraProject;\n return {\n ...rest,\n skills: configureMastraToolingForAgents?.skills as string[] | undefined,\n mcpServer: configureMastraToolingForAgents?.mcpServer as Editor | undefined,\n };\n};\n\n/**\n * Check if the current directory has a package.json file. If not, we should alert the user to create one or run \"mastra create\" to create a new project. The package.json file is required to install dependencies in the next steps.\n */\nexport const checkForPkgJson = async () => {\n const cwd = process.cwd();\n const pkgJsonPath = path.join(cwd, 'package.json');\n\n try {\n await fs.access(pkgJsonPath);\n\n // Do nothing\n } catch {\n p.log.error(\n 'No package.json file found in the current directory. Please run \"npm init -y\" to create one, or run \"npx create-mastra@latest\" to create a new Mastra project.',\n );\n\n process.exit(1);\n }\n};\n\n/**\n * Generate content for AGENTS.md file\n */\nexport function generateAgentsMarkdown({ skills, mcpServer }: { skills?: string[]; mcpServer?: Editor }): string {\n const hasSkills = skills && skills.length > 0;\n const hasMcp = !!mcpServer;\n\n let content = `# AGENTS.md\n\nYou are a TypeScript developer experienced with the Mastra framework. You build AI agents, tools, workflows, and scorers. You follow strict TypeScript practices and always consult up-to-date Mastra documentation before making changes.\n\n`;\n\n // Add critical Mastra skill section if skills were installed\n if (hasSkills) {\n content += `\n## CRITICAL: Load \\`mastra\\` skill\n\n**BEFORE doing ANYTHING with Mastra, load the \\`mastra\\` skill FIRST.** Never rely on cached knowledge as Mastra's APIs change frequently between versions. Use the skill to read up-to-date documentation from \\`node_modules\\`.\n`;\n }\n\n content += `\n## Project Overview\n\nThis is a **Mastra** project written in TypeScript. Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack. The Node.js runtime is \\`>=22.13.0\\`.\n\n## Commands\n\n\\`\\`\\`bash\nnpm run dev # Start Mastra Studio at localhost:4111 (long-running, use a separate terminal)\nnpm run build # Build a production-ready server\n\\`\\`\\`\n\n## Project Structure\n\n| Folder | Description |\n| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| \\`src/mastra\\` | Entry point for all Mastra-related code and configuration. |\n| \\`src/mastra/agents\\` | Define and configure your agents - their behavior, goals, and tools. |\n| \\`src/mastra/workflows\\` | Define multi-step workflows that orchestrate agents and tools together. |\n| \\`src/mastra/tools\\` | Create reusable tools that your agents can call |\n| \\`src/mastra/mcp\\` | (Optional) Implement custom MCP servers to share your tools with external agents |\n| \\`src/mastra/scorers\\` | (Optional) Define scorers for evaluating agent performance over time |\n| \\`src/mastra/public\\` | (Optional) Contents are copied into the \\`.build/output\\` directory during the build process, making them available for serving at runtime |\n\n### Top-level files\n\nTop-level files define how your Mastra project is configured, built, and connected to its environment.\n\n| File | Description |\n| --------------------- | ----------------------------------------------------------------------------------------------------------------- |\n| \\`src/mastra/index.ts\\` | Central entry point where you configure and initialize Mastra. |\n| \\`.env.example\\` | Template for environment variables - copy and rename to \\`.env\\` to add your secret [model provider](/models) keys. |\n| \\`package.json\\` | Defines project metadata, dependencies, and available npm scripts. |\n| \\`tsconfig.json\\` | Configures TypeScript options such as path aliases, compiler settings, and build output. |\n\n## Boundaries\n\n### Always do\n\n- Load the \\`mastra\\` skill before any Mastra-related work\n- Register new agents, tools, workflows, and scorers in \\`src/mastra/index.ts\\`\n- Use schemas for tool inputs and outputs\n- Run \\`npm run build\\` to verify changes compile\n\n### Never do\n\n- Never commit \\`.env\\` files or secrets\n- Never modify \\`node_modules\\` or Mastra's database files directly\n- Never hardcode API keys (always use environment variables)\n`;\n\n // Add MCP section if MCP server was configured\n if (hasMcp) {\n const editorName =\n mcpServer === 'cursor-global' ? 'Cursor (global)' : mcpServer!.charAt(0).toUpperCase() + mcpServer!.slice(1);\n\n content += `## MCP Docs Server\n\nThis project has the Mastra MCP Docs Server configured for ${editorName}.\n\n### Using MCP Docs\n\nThe MCP server provides embedded documentation access within your editor:\n\n1. The server was automatically configured during project creation\n2. Restart your editor to load the MCP server\n3. Use the Mastra docs tools in your editor to access:\n - API references\n - Code examples\n - Integration guides\n\nLearn more in the [MCP Documentation](https://mastra.ai/docs/mcp/overview).\n\n`;\n }\n\n // Add resources section\n content += `## Resources\n\n- [Mastra Documentation](https://mastra.ai/llms.txt)\n- [Mastra .well-known skills discovery](https://mastra.ai/.well-known/skills/index.json)\n`;\n\n return content;\n}\n\n/**\n * Write AGENTS.md file to project root\n */\nexport async function writeAgentsMarkdown(options: { skills?: string[]; mcpServer?: Editor }): Promise<void> {\n const content = generateAgentsMarkdown(options);\n const filePath = path.join(process.cwd(), 'AGENTS.md');\n await fs.writeFile(filePath, content);\n}\n\n/**\n * Write CLAUDE.md file to project root\n */\nexport async function writeClaudeMarkdown(): Promise<void> {\n const filePath = path.join(process.cwd(), 'CLAUDE.md');\n await fs.writeFile(filePath, '@AGENTS.md');\n}\n","import { fileURLToPath } from 'node:url';\nimport { InvalidArgumentError } from 'commander';\nimport { execa } from 'execa';\nimport fsExtra from 'fs-extra';\nimport type { PackageManager } from '../utils/package-manager';\nimport { EDITOR, isValidEditor } from './init/mcp-docs-server-install';\nimport { areValidComponents, COMPONENTS, isValidLLMProvider, LLMProvider } from './init/utils';\n\nexport function getPackageManager(): PackageManager {\n const userAgent = process.env.npm_config_user_agent || '';\n const execPath = process.env.npm_execpath || '';\n\n // Check user agent first\n if (userAgent.includes('bun')) {\n return 'bun';\n }\n if (userAgent.includes('yarn')) {\n return 'yarn';\n }\n if (userAgent.includes('pnpm')) {\n return 'pnpm';\n }\n if (userAgent.includes('npm')) {\n return 'npm';\n }\n\n // Fallback to execpath check\n if (execPath.includes('bun')) {\n return 'bun';\n }\n if (execPath.includes('yarn')) {\n return 'yarn';\n }\n if (execPath.includes('pnpm')) {\n return 'pnpm';\n }\n if (execPath.includes('npm')) {\n return 'npm';\n }\n\n return 'npm'; // Default fallback\n}\n\nexport function parseMcp(value: string) {\n if (!isValidEditor(value)) {\n throw new InvalidArgumentError(`Choose a valid value: ${EDITOR.join(', ')}`);\n }\n return value;\n}\n\nexport function parseSkills(value: string) {\n // Skills flag accepts comma-separated agent names\n return value\n .split(',')\n .map(s => s.trim())\n .filter(Boolean);\n}\n\nexport function parseComponents(value: string) {\n const parsedValue = value.split(',');\n\n if (!areValidComponents(parsedValue)) {\n throw new InvalidArgumentError(`Choose valid components: ${COMPONENTS.join(', ')}`);\n }\n\n return parsedValue;\n}\n\nexport function parseLlmProvider(value: string) {\n if (!isValidLLMProvider(value)) {\n throw new InvalidArgumentError(`Choose a valid provider: ${LLMProvider.join(', ')}`);\n }\n return value;\n}\n\nexport function shouldSkipDotenvLoading(): boolean {\n return process.env.MASTRA_SKIP_DOTENV === 'true' || process.env.MASTRA_SKIP_DOTENV === '1';\n}\n\n/**\n * Get the version tag (e.g., 'beta', 'latest') for the currently running mastra CLI.\n * This queries npm dist-tags to find which tag corresponds to the current version.\n */\nexport async function getVersionTag(): Promise<string | undefined> {\n try {\n const pkgPath = fileURLToPath(import.meta.resolve('mastra/package.json'));\n const json = await fsExtra.readJSON(pkgPath);\n const currentVersion = json.version;\n\n const { stdout } = await execa('npm', ['dist-tag', 'ls', 'mastra'], {\n cwd: import.meta.dirname,\n });\n const tagLine = stdout.split('\\n').find((distLine: string) => distLine.endsWith(`: ${currentVersion}`));\n const tag = tagLine ? tagLine.split(':')[0]?.trim() : undefined;\n\n return tag;\n } catch {\n // If we can't determine the tag, return undefined (will use default/latest)\n return undefined;\n }\n}\n\n/**\n * Check if the current directory already has git initialized.\n */\nexport async function isGitInitialized({ cwd }: { cwd: string }): Promise<boolean> {\n try {\n await execa('git', ['rev-parse', '--is-inside-work-tree'], { cwd, stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Initialize a git repository in the specified directory.\n */\nexport async function gitInit({ cwd }: { cwd: string }) {\n await execa('git', ['init'], { cwd, stdio: 'ignore' });\n await execa('git', ['add', '-A'], { cwd, stdio: 'ignore' });\n await execa(\n 'git',\n [\n 'commit',\n '-m',\n '\"Initial commit from Mastra\"',\n '--author=\"dane-ai-mastra[bot] <dane-ai-mastra[bot]@users.noreply.github.com>\"',\n ],\n { cwd, stdio: 'ignore' },\n );\n}\n","import { randomUUID } from 'node:crypto';\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { PostHog } from 'posthog-node';\nimport { getPackageManager } from '../commands/utils.js';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\ninterface CommandData {\n command: string;\n args?: Record<string, unknown>;\n durationMs?: number;\n status: 'success' | 'error';\n error?: string;\n}\n\nexport type CLI_ORIGIN = 'mastra-cloud' | 'oss';\n\nlet analyticsInstance: PosthogAnalytics | null = null;\n\nexport function getAnalytics(): PosthogAnalytics | null {\n return analyticsInstance;\n}\n\nexport function setAnalytics(instance: PosthogAnalytics): void {\n analyticsInstance = instance;\n}\n\nexport class PosthogAnalytics {\n private sessionId: string;\n private client?: PostHog;\n private distinctId: string;\n private version: string;\n private packageManager: string;\n\n constructor({\n version,\n apiKey,\n host = 'https://app.posthog.com',\n }: {\n version: string;\n apiKey: string;\n host: string;\n }) {\n this.version = version;\n this.packageManager = getPackageManager();\n const cliConfigPath = path.join(__dirname, 'mastra-cli.json');\n if (existsSync(cliConfigPath)) {\n try {\n const { distinctId, sessionId } = JSON.parse(readFileSync(cliConfigPath, 'utf-8'));\n this.distinctId = distinctId;\n this.sessionId = sessionId;\n } catch {\n this.sessionId = randomUUID();\n this.distinctId = this.getDistinctId();\n }\n\n this.writeCliConfig({\n distinctId: this.distinctId,\n sessionId: this.sessionId,\n });\n } else {\n this.sessionId = randomUUID();\n this.distinctId = this.getDistinctId();\n this.writeCliConfig({\n distinctId: this.distinctId,\n sessionId: this.sessionId,\n });\n }\n\n if (this.isTelemetryEnabled()) {\n this.initializePostHog(apiKey, host);\n }\n }\n\n private writeCliConfig({ distinctId, sessionId }: { distinctId: string; sessionId: string }): void {\n try {\n writeFileSync(path.join(__dirname, 'mastra-cli.json'), JSON.stringify({ distinctId, sessionId }));\n } catch {\n //swallow\n }\n }\n\n private initializePostHog(apiKey: string, host: string): void {\n this.client = new PostHog(apiKey, {\n host,\n flushAt: 1,\n flushInterval: 0,\n disableGeoip: false,\n });\n\n this.captureSessionStart();\n\n process.on('exit', () => {\n this.client?.flush().catch(() => {});\n });\n }\n\n private isTelemetryEnabled(): boolean {\n // Check environment variable first\n if (process.env.MASTRA_TELEMETRY_DISABLED) {\n return false;\n }\n // Default to enabled\n return true;\n }\n\n private getDistinctId(): string {\n // Use machine-id or generate a persistent ID\n // This helps track unique CLI installations\n const machineId = os.hostname();\n return `mastra-${machineId}`;\n }\n\n private getSystemProperties(): Record<string, any> {\n return {\n os: process.platform,\n os_version: os.release(),\n node_version: process.version,\n platform: process.arch,\n session_id: this.sessionId,\n cli_version: this.version || 'unknown',\n machine_id: os.hostname(),\n package_manager: this.packageManager,\n };\n }\n private getDurationMs(startTime: [number, number]): number {\n const [seconds, nanoseconds] = process.hrtime(startTime);\n return seconds * 1000 + nanoseconds / 1_000_000;\n }\n\n private captureSessionStart(): void {\n if (!this.client) {\n return;\n }\n\n this.client.capture({\n distinctId: this.distinctId,\n event: 'cli_session_start',\n properties: {\n ...this.getSystemProperties(),\n },\n });\n }\n\n trackEvent(eventName: string, properties?: Record<string, any>): void {\n try {\n if (!this.client) {\n return;\n }\n\n this.client.capture({\n distinctId: this.distinctId,\n event: eventName,\n properties: {\n ...this.getSystemProperties(),\n ...properties,\n },\n });\n } catch {\n //swallow\n }\n }\n\n trackCommand(options: {\n command: string;\n args?: Record<string, unknown>;\n durationMs?: number;\n status?: 'success' | 'error';\n error?: string;\n origin?: CLI_ORIGIN;\n }): void {\n try {\n if (!this.client) {\n return;\n }\n\n const commandData: CommandData = {\n command: options.command,\n status: options.status || 'success',\n };\n\n if (options.args) {\n commandData.args = options.args;\n }\n\n if (options.durationMs) {\n commandData.durationMs = options.durationMs;\n }\n\n if (options.error) {\n commandData.error = options.error;\n }\n\n this.client.capture({\n distinctId: this.distinctId,\n event: 'cli_command',\n properties: {\n ...this.getSystemProperties(),\n ...commandData,\n origin: options?.origin || 'oss',\n },\n });\n } catch {\n //swallow\n }\n }\n\n // Helper method to wrap command execution with timing\n async trackCommandExecution<T>({\n command,\n args,\n execution,\n origin,\n }: {\n command: string;\n args: Record<string, unknown>;\n execution: () => Promise<T>;\n origin?: CLI_ORIGIN;\n }): Promise<T> {\n const startTime = process.hrtime();\n\n try {\n const result = await execution();\n const durationMs = this.getDurationMs(startTime);\n this.trackCommand({\n command,\n args,\n durationMs,\n status: 'success',\n origin,\n });\n\n return result;\n } catch (error) {\n const durationMs = this.getDurationMs(startTime);\n this.trackCommand({\n command,\n args,\n durationMs,\n status: 'error',\n error: error instanceof Error ? error.message : String(error),\n origin,\n });\n\n throw error;\n }\n }\n\n // Ensure PostHog client is shutdown properly\n async shutdown(): Promise<void> {\n if (!this.client) {\n return;\n }\n try {\n await this.client.shutdown();\n } catch {\n //swallow\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMastraDir, writeIndexFile, createComponentsDir, writeAPIKey, writeCodeSample, DepsService, getAPIKey, installMastraDocsMCPServer, writeAgentsMarkdown, writeClaudeMarkdown, gitInit, getAnalytics, getPackageManager, LLM_PROVIDERS, isGitInitialized, interactivePrompt, getPackageManagerAddCommand, getModelIdentifier } from './chunk-
|
|
1
|
+
import { createMastraDir, writeIndexFile, createComponentsDir, writeAPIKey, writeCodeSample, DepsService, getAPIKey, installMastraDocsMCPServer, writeAgentsMarkdown, writeClaudeMarkdown, gitInit, getAnalytics, getPackageManager, LLM_PROVIDERS, isGitInitialized, interactivePrompt, getPackageManagerAddCommand, getModelIdentifier } from './chunk-45TLE2K2.js';
|
|
2
2
|
import fsSync from 'fs';
|
|
3
3
|
import fs from 'fs/promises';
|
|
4
4
|
import * as p4 from '@clack/prompts';
|
|
@@ -10,12 +10,11 @@ import shellQuote from 'shell-quote';
|
|
|
10
10
|
import yoctoSpinner from 'yocto-spinner';
|
|
11
11
|
import { PinoLogger } from '@mastra/loggers';
|
|
12
12
|
import { execa } from 'execa';
|
|
13
|
-
import prettier from 'prettier';
|
|
14
13
|
|
|
15
14
|
// package.json
|
|
16
15
|
var package_default = {
|
|
17
16
|
name: "mastra",
|
|
18
|
-
version: "1.6.
|
|
17
|
+
version: "1.6.4-alpha.0",
|
|
19
18
|
license: "Apache-2.0",
|
|
20
19
|
description: "cli for mastra",
|
|
21
20
|
type: "module",
|
|
@@ -79,7 +78,6 @@ var package_default = {
|
|
|
79
78
|
"openapi-fetch": "^0.17.0",
|
|
80
79
|
picocolors: "^1.1.1",
|
|
81
80
|
"posthog-node": "5.17.2",
|
|
82
|
-
prettier: "^3.8.3",
|
|
83
81
|
semver: "^7.7.4",
|
|
84
82
|
serve: "^14.2.6",
|
|
85
83
|
"serve-handler": "^6.1.7",
|
|
@@ -558,30 +556,28 @@ The [Mastra platform](https://projects.mastra.ai) provides two products for depl
|
|
|
558
556
|
- **Server**: A production deployment target that runs your Mastra application as an API server
|
|
559
557
|
|
|
560
558
|
Learn more in the [Mastra platform documentation](https://mastra.ai/docs/mastra-platform/overview).`;
|
|
561
|
-
|
|
562
|
-
parser: "markdown",
|
|
563
|
-
singleQuote: true
|
|
564
|
-
});
|
|
565
|
-
await fs.writeFile(readmePath, formattedContent);
|
|
559
|
+
await fs.writeFile(readmePath, content);
|
|
566
560
|
};
|
|
567
|
-
async function
|
|
561
|
+
async function installMastraDependencies(pm, dependencies, versionTag, isDev, timeout) {
|
|
568
562
|
let installCommand = getPackageManagerAddCommand(pm);
|
|
569
563
|
if (isDev) {
|
|
570
564
|
installCommand = `${installCommand} -D`;
|
|
571
565
|
}
|
|
566
|
+
const dependenciesWithVersion = dependencies.map((dependency) => `${dependency}${versionTag}`).join(" ");
|
|
572
567
|
try {
|
|
573
|
-
await execWithTimeout(`${pm} ${installCommand} ${
|
|
568
|
+
await execWithTimeout(`${pm} ${installCommand} ${dependenciesWithVersion}`, timeout);
|
|
574
569
|
} catch (err) {
|
|
575
570
|
if (versionTag === "@latest") {
|
|
576
571
|
throw new Error(
|
|
577
|
-
`Failed to install ${
|
|
572
|
+
`Failed to install ${dependenciesWithVersion}: ${err instanceof Error ? err.message : "Unknown error"}`
|
|
578
573
|
);
|
|
579
574
|
}
|
|
575
|
+
const latestDependencies = dependencies.map((dependency) => `${dependency}@latest`).join(" ");
|
|
580
576
|
try {
|
|
581
|
-
await execWithTimeout(`${pm} ${installCommand} ${
|
|
577
|
+
await execWithTimeout(`${pm} ${installCommand} ${latestDependencies}`, timeout);
|
|
582
578
|
} catch (fallbackErr) {
|
|
583
579
|
throw new Error(
|
|
584
|
-
`Failed to install ${
|
|
580
|
+
`Failed to install ${dependencies.join(", ")} (tried ${versionTag} and @latest): ${fallbackErr instanceof Error ? fallbackErr.message : "Unknown error"}`
|
|
585
581
|
);
|
|
586
582
|
}
|
|
587
583
|
}
|
|
@@ -691,16 +687,20 @@ var createMastraProject = async ({
|
|
|
691
687
|
s2.start("Installing Mastra CLI");
|
|
692
688
|
const versionTag = createVersionTag ? `@${createVersionTag}` : "@latest";
|
|
693
689
|
try {
|
|
694
|
-
await
|
|
690
|
+
await installMastraDependencies(pm, ["mastra"], versionTag, true, timeout);
|
|
695
691
|
} catch (error) {
|
|
696
692
|
throw new Error(`Failed to install Mastra CLI: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
697
693
|
}
|
|
698
694
|
s2.stop("Mastra CLI installed");
|
|
699
695
|
s2.start("Installing Mastra dependencies");
|
|
700
696
|
try {
|
|
701
|
-
await
|
|
702
|
-
|
|
703
|
-
|
|
697
|
+
await installMastraDependencies(
|
|
698
|
+
pm,
|
|
699
|
+
["@mastra/core", "@mastra/libsql", "@mastra/memory"],
|
|
700
|
+
versionTag,
|
|
701
|
+
false,
|
|
702
|
+
timeout
|
|
703
|
+
);
|
|
704
704
|
} catch (error) {
|
|
705
705
|
throw new Error(
|
|
706
706
|
`Failed to install Mastra dependencies: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
@@ -1042,5 +1042,5 @@ async function createFromTemplate(args) {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
|
|
1044
1044
|
export { create, createLogger, init, logger, package_default };
|
|
1045
|
-
//# sourceMappingURL=chunk-
|
|
1046
|
-
//# sourceMappingURL=chunk-
|
|
1045
|
+
//# sourceMappingURL=chunk-TE2X4TLK.js.map
|
|
1046
|
+
//# sourceMappingURL=chunk-TE2X4TLK.js.map
|