create-mastra 0.1.0-alpha.10

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/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # Create Mastra
2
+
3
+ The easiest way to get started with Mastra is by using `create-mastra`. This CLI tool enables you to quickly start building a new Mastra application, with everything set up for you.
4
+
5
+ ## Usage
6
+
7
+ Using npx:
8
+
9
+ ```bash
10
+ npx create-mastra@latest
11
+ ```
12
+
13
+ Using npm:
14
+
15
+ ```bash
16
+ npm create mastra@latest
17
+ ```
18
+
19
+ Using yarn:
20
+
21
+ ```bash
22
+ yarn create mastra
23
+ ```
24
+
25
+ Using pnpm:
26
+
27
+ ```bash
28
+ pnpm create mastra
29
+ ```
30
+
31
+ ## Options
32
+
33
+ - `--default` - Quick start with defaults (src directory, OpenAI, no examples)
34
+ - `-c, --components <components>` - Comma-separated list of components (agents, tools, workflows)
35
+ - `-l, --llm <model-provider>` - Default model provider (openai, anthropic, or groq)
36
+ - `-e, --example` - Include example code
37
+
38
+ ## Examples
39
+
40
+ bash:packages/create-mastra/README.md
41
+ Create a new project with default settings
42
+ npx create-mastra@latest --default
43
+ Create a project with specific components and LLM provider
44
+ npx create-mastra@latest -c agents,tools -l anthropic
45
+ Create a project with example code
46
+ npx create-mastra@latest --example
47
+
48
+ ## What's included?
49
+
50
+ The generated project will have:
51
+
52
+ - A configured Mastra setup in the src directory
53
+ - Selected components (agents, tools, workflows)
54
+ - Environment configuration for your chosen LLM provider
55
+ - TypeScript configuration
56
+ - Example code (if selected)
57
+
58
+ ## System Requirements
59
+
60
+ - Node.js 20 or later
61
+ - MacOS, Windows, and Linux are supported
@@ -0,0 +1,2 @@
1
+ #! /usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { PosthogAnalytics } from 'mastra';
4
+ import { create } from 'mastra';
5
+ import { getPackageVersion } from './utils.js';
6
+ const version = await getPackageVersion();
7
+ const analytics = new PosthogAnalytics({
8
+ apiKey: 'phc_SBLpZVAB6jmHOct9CABq3PF0Yn5FU3G2FgT4xUr2XrT',
9
+ host: 'https://us.posthog.com',
10
+ version: version,
11
+ });
12
+ const program = new Command();
13
+ program
14
+ .version(`${version}`, '-v, --version')
15
+ .description(`create-mastra ${version}`)
16
+ .action(async () => {
17
+ try {
18
+ analytics.trackCommand({
19
+ command: 'version',
20
+ });
21
+ console.log(`create-mastra ${version}`);
22
+ }
23
+ catch (e) { }
24
+ });
25
+ program
26
+ .name('create-mastra')
27
+ .description('Create a new Mastra project')
28
+ .option('--default', 'Quick start with defaults(src, OpenAI, no examples)')
29
+ .option('-c, --components <components>', 'Comma-separated list of components (agents, tools, workflows)')
30
+ .option('-l, --llm <model-provider>', 'Default model provider (openai, anthropic, or groq)')
31
+ .option('-k, --llm-api-key <api-key>', 'API key for the model provider')
32
+ .option('-e, --example', 'Include example code')
33
+ .action(async (args) => {
34
+ if (args.default) {
35
+ await create({
36
+ components: ['agents', 'tools', 'workflows'],
37
+ llmProvider: 'openai',
38
+ addExample: false,
39
+ });
40
+ return;
41
+ }
42
+ await create({
43
+ components: args.components,
44
+ llmProvider: args.llm,
45
+ addExample: args.example,
46
+ llmApiKey: args['llm-api-key'],
47
+ });
48
+ });
49
+ program.parse(process.argv);
@@ -0,0 +1 @@
1
+ export declare function getPackageVersion(): Promise<any>;
package/dist/utils.js ADDED
@@ -0,0 +1,11 @@
1
+ import fsExtra from 'fs-extra';
2
+ import { dirname } from 'path';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ export async function getPackageVersion() {
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = dirname(__filename);
8
+ const pkgJsonPath = path.join(__dirname, '..', 'package.json');
9
+ const content = await fsExtra.readJSON(pkgJsonPath);
10
+ return content.version;
11
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "create-mastra",
3
+ "version": "0.1.0-alpha.10",
4
+ "description": "Create Mastra apps with one command",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "create-mastra": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "keywords": [
14
+ "mastra",
15
+ "cli",
16
+ "ai"
17
+ ],
18
+ "dependencies": {
19
+ "commander": "^12.0.0",
20
+ "fs-extra": "^11.2.0",
21
+ "mastra": "0.1.57-alpha.77"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^22.1.0",
25
+ "typescript": "^5.5.4",
26
+ "@types/fs-extra": "^11.0.4"
27
+ },
28
+ "engines": {
29
+ "node": ">=20"
30
+ },
31
+ "scripts": {
32
+ "build": "tsc",
33
+ "clean": "rm -rf dist && rm -rf node_modules"
34
+ }
35
+ }