create-mastra 1.2.0-alpha.0 → 1.2.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 +4 -0
- package/dist/index.js +161 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1245,7 +1245,7 @@ var PinoLogger = class _PinoLogger extends MastraLogger {
|
|
|
1245
1245
|
};
|
|
1246
1246
|
|
|
1247
1247
|
var package_default = {
|
|
1248
|
-
version: "1.2.0
|
|
1248
|
+
version: "1.2.0"};
|
|
1249
1249
|
function getPackageManagerAddCommand(pm) {
|
|
1250
1250
|
switch (pm) {
|
|
1251
1251
|
case "npm":
|
|
@@ -2146,12 +2146,13 @@ var interactivePrompt = async (args = {}) => {
|
|
|
2146
2146
|
const POPULAR_AGENTS = [
|
|
2147
2147
|
{ value: "claude-code", label: "Claude Code" },
|
|
2148
2148
|
{ value: "cursor", label: "Cursor" },
|
|
2149
|
+
{ value: "codex", label: "Codex" },
|
|
2150
|
+
{ value: "opencode", label: "OpenCode" },
|
|
2149
2151
|
{ value: "windsurf", label: "Windsurf" },
|
|
2150
2152
|
{ value: "github-copilot", label: "GitHub Copilot" },
|
|
2151
2153
|
{ value: "cline", label: "Cline" },
|
|
2152
2154
|
{ value: "continue", label: "Continue" },
|
|
2153
2155
|
{ value: "gemini-cli", label: "Gemini CLI" },
|
|
2154
|
-
{ value: "opencode", label: "OpenCode" },
|
|
2155
2156
|
{ value: "replit", label: "Replit" },
|
|
2156
2157
|
{ value: "roo", label: "Roo Code" }
|
|
2157
2158
|
];
|
|
@@ -2162,7 +2163,6 @@ var interactivePrompt = async (args = {}) => {
|
|
|
2162
2163
|
{ value: "antigravity", label: "Antigravity" },
|
|
2163
2164
|
{ value: "augment", label: "Augment" },
|
|
2164
2165
|
{ value: "codebuddy", label: "CodeBuddy" },
|
|
2165
|
-
{ value: "codex", label: "Codex" },
|
|
2166
2166
|
{ value: "command-code", label: "Command Code" },
|
|
2167
2167
|
{ value: "crush", label: "Crush" },
|
|
2168
2168
|
{ value: "droid", label: "Droid" },
|
|
@@ -2190,7 +2190,8 @@ var interactivePrompt = async (args = {}) => {
|
|
|
2190
2190
|
];
|
|
2191
2191
|
const initialSelection = await fe({
|
|
2192
2192
|
message: "Select agent(s) to install skills for:",
|
|
2193
|
-
options: [...POPULAR_AGENTS, { value: "__show_all__", label: "+ Show all agents (
|
|
2193
|
+
options: [...POPULAR_AGENTS, { value: "__show_all__", label: "+ Show all agents (29 more)" }],
|
|
2194
|
+
initialValues: ["claude-code", "codex", "opencode", "cursor"],
|
|
2194
2195
|
required: true
|
|
2195
2196
|
});
|
|
2196
2197
|
if (pD(initialSelection)) {
|
|
@@ -2312,6 +2313,146 @@ This will make the Mastra docs MCP server available in all Antigravity projects.
|
|
|
2312
2313
|
mcpServer: configureMastraToolingForAgents?.mcpServer
|
|
2313
2314
|
};
|
|
2314
2315
|
};
|
|
2316
|
+
function generateAgentsMarkdown({ skills, mcpServer }) {
|
|
2317
|
+
const hasSkills = skills && skills.length > 0;
|
|
2318
|
+
const hasMcp = !!mcpServer;
|
|
2319
|
+
let content = `# AGENTS.md
|
|
2320
|
+
|
|
2321
|
+
This document provides guidance for AI coding agents working in this repository.
|
|
2322
|
+
|
|
2323
|
+
## Project Overview
|
|
2324
|
+
|
|
2325
|
+
This is a **Mastra** project written in TypeScript. Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
|
|
2326
|
+
|
|
2327
|
+
## Commands
|
|
2328
|
+
|
|
2329
|
+
Use these commands to interact with the project.
|
|
2330
|
+
|
|
2331
|
+
### Installation
|
|
2332
|
+
|
|
2333
|
+
\`\`\`bash
|
|
2334
|
+
npm install
|
|
2335
|
+
\`\`\`
|
|
2336
|
+
|
|
2337
|
+
### Development
|
|
2338
|
+
|
|
2339
|
+
Start the Mastra Studio at localhost:4111 by running the \`dev\` script:
|
|
2340
|
+
|
|
2341
|
+
\`\`\`bash
|
|
2342
|
+
npm run dev
|
|
2343
|
+
\`\`\`
|
|
2344
|
+
|
|
2345
|
+
### Build
|
|
2346
|
+
|
|
2347
|
+
In order to build a production-ready server, run the \`build\` script:
|
|
2348
|
+
|
|
2349
|
+
\`\`\`bash
|
|
2350
|
+
npm run build
|
|
2351
|
+
\`\`\`
|
|
2352
|
+
|
|
2353
|
+
## Project Structure
|
|
2354
|
+
|
|
2355
|
+
Folders organize your agent's resources, like agents, tools, and workflows.
|
|
2356
|
+
|
|
2357
|
+
| Folder | Description |
|
|
2358
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2359
|
+
| \`src/mastra\` | Entry point for all Mastra-related code and configuration. |
|
|
2360
|
+
| \`src/mastra/agents\` | Define and configure your agents - their behavior, goals, and tools. |
|
|
2361
|
+
| \`src/mastra/workflows\` | Define multi-step workflows that orchestrate agents and tools together. |
|
|
2362
|
+
| \`src/mastra/tools\` | Create reusable tools that your agents can call |
|
|
2363
|
+
| \`src/mastra/mcp\` | (Optional) Implement custom MCP servers to share your tools with external agents |
|
|
2364
|
+
| \`src/mastra/scorers\` | (Optional) Define scorers for evaluating agent performance over time |
|
|
2365
|
+
| \`src/mastra/public\` | (Optional) Contents are copied into the \`.build/output\` directory during the build process, making them available for serving at runtime |
|
|
2366
|
+
|
|
2367
|
+
### Top-level files
|
|
2368
|
+
|
|
2369
|
+
Top-level files define how your Mastra project is configured, built, and connected to its environment.
|
|
2370
|
+
|
|
2371
|
+
| File | Description |
|
|
2372
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
2373
|
+
| \`src/mastra/index.ts\` | Central entry point where you configure and initialize Mastra. |
|
|
2374
|
+
| \`.env.example\` | Template for environment variables - copy and rename to \`.env\` to add your secret [model provider](/models) keys. |
|
|
2375
|
+
| \`package.json\` | Defines project metadata, dependencies, and available npm scripts. |
|
|
2376
|
+
| \`tsconfig.json\` | Configures TypeScript options such as path aliases, compiler settings, and build output. |
|
|
2377
|
+
|
|
2378
|
+
`;
|
|
2379
|
+
if (hasSkills) {
|
|
2380
|
+
content += `## Mastra Skills
|
|
2381
|
+
|
|
2382
|
+
Skills are modular capabilities that extend agent functionalities. They provide pre-built tools, integrations, and workflows that agents can leverage to accomplish tasks more effectively.
|
|
2383
|
+
|
|
2384
|
+
This project has skills installed for the following agents:
|
|
2385
|
+
|
|
2386
|
+
${skills.map(
|
|
2387
|
+
(agent) => `- ${agent.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ")}`
|
|
2388
|
+
).join("\n")}
|
|
2389
|
+
|
|
2390
|
+
### Using Skills
|
|
2391
|
+
|
|
2392
|
+
Skills are automatically available to agents in your project once installed. Agents can access and use these skills without additional configuration.
|
|
2393
|
+
|
|
2394
|
+
`;
|
|
2395
|
+
}
|
|
2396
|
+
if (hasMcp) {
|
|
2397
|
+
const editorName = mcpServer === "cursor-global" ? "Cursor (global)" : mcpServer.charAt(0).toUpperCase() + mcpServer.slice(1);
|
|
2398
|
+
content += `## MCP Docs Server
|
|
2399
|
+
|
|
2400
|
+
This project has the Mastra MCP Docs Server configured for ${editorName}.
|
|
2401
|
+
|
|
2402
|
+
### Using MCP Docs
|
|
2403
|
+
|
|
2404
|
+
The MCP server provides embedded documentation access within your editor:
|
|
2405
|
+
|
|
2406
|
+
1. The server was automatically configured during project creation
|
|
2407
|
+
2. Restart your editor to load the MCP server
|
|
2408
|
+
3. Use the Mastra docs tools in your editor to access:
|
|
2409
|
+
- API references
|
|
2410
|
+
- Code examples
|
|
2411
|
+
- Integration guides
|
|
2412
|
+
|
|
2413
|
+
Learn more in the [MCP Documentation](https://mastra.ai/docs/mcp/overview).
|
|
2414
|
+
|
|
2415
|
+
`;
|
|
2416
|
+
}
|
|
2417
|
+
content += `## Resources
|
|
2418
|
+
|
|
2419
|
+
- [Mastra Documentation](https://mastra.ai/llms.txt)
|
|
2420
|
+
- [Mastra .well-known skills discovery](https://mastra.ai/.well-known/skills/index.json)
|
|
2421
|
+
`;
|
|
2422
|
+
return content;
|
|
2423
|
+
}
|
|
2424
|
+
function generateClaudeMarkdown({ mcpServer }) {
|
|
2425
|
+
return `# CLAUDE.md
|
|
2426
|
+
|
|
2427
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
2428
|
+
|
|
2429
|
+
This is a Mastra project - an AI framework for building agents, workflows, and tools. The project structure follows Mastra conventions with agents, tools, and workflows organized in the \`src/mastra/\` directory.
|
|
2430
|
+
|
|
2431
|
+
For complete setup and usage instructions, see [AGENTS.md](./AGENTS.md), which includes:
|
|
2432
|
+
- Quick start commands
|
|
2433
|
+
- Project structure details
|
|
2434
|
+
- Mastra skills usage${mcpServer ? "\n- MCP Docs Server configuration" : ""}
|
|
2435
|
+
- Links to relevant documentation
|
|
2436
|
+
`;
|
|
2437
|
+
}
|
|
2438
|
+
async function writeAgentsMarkdown(options) {
|
|
2439
|
+
const content = generateAgentsMarkdown(options);
|
|
2440
|
+
const formattedContent = await prettier.format(content, {
|
|
2441
|
+
parser: "markdown",
|
|
2442
|
+
singleQuote: true
|
|
2443
|
+
});
|
|
2444
|
+
const filePath = path3.join(process.cwd(), "AGENTS.md");
|
|
2445
|
+
await fs4.writeFile(filePath, formattedContent);
|
|
2446
|
+
}
|
|
2447
|
+
async function writeClaudeMarkdown(options) {
|
|
2448
|
+
const content = generateClaudeMarkdown(options);
|
|
2449
|
+
const formattedContent = await prettier.format(content, {
|
|
2450
|
+
parser: "markdown",
|
|
2451
|
+
singleQuote: true
|
|
2452
|
+
});
|
|
2453
|
+
const filePath = path3.join(process.cwd(), "CLAUDE.md");
|
|
2454
|
+
await fs4.writeFile(filePath, formattedContent);
|
|
2455
|
+
}
|
|
2315
2456
|
function getPackageManager() {
|
|
2316
2457
|
const userAgent = process.env.npm_config_user_agent || "";
|
|
2317
2458
|
const execPath = process.env.npm_execpath || "";
|
|
@@ -2650,6 +2791,22 @@ Warning: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
|
2650
2791
|
versionTag
|
|
2651
2792
|
});
|
|
2652
2793
|
}
|
|
2794
|
+
if (skills && skills.length > 0 || mcpServer) {
|
|
2795
|
+
try {
|
|
2796
|
+
await writeAgentsMarkdown({ skills, mcpServer });
|
|
2797
|
+
const shouldWriteClaudeMd = skills?.includes("claude-code");
|
|
2798
|
+
if (shouldWriteClaudeMd) {
|
|
2799
|
+
await writeClaudeMarkdown({ skills, mcpServer });
|
|
2800
|
+
}
|
|
2801
|
+
} catch (error) {
|
|
2802
|
+
console.warn(
|
|
2803
|
+
color2.yellow(
|
|
2804
|
+
`
|
|
2805
|
+
Warning: Failed to create agent guide files: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
2806
|
+
)
|
|
2807
|
+
);
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2653
2810
|
if (initGit) {
|
|
2654
2811
|
s.start("Initializing git repository");
|
|
2655
2812
|
try {
|