create-mastra 0.1.0-alpha.6 → 0.1.0-alpha.8
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 +2 -0
- package/dist/index.js +47 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +11 -0
- package/package.json +2 -2
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
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('-e, --example', 'Include example code')
|
|
32
|
+
.action(async (args) => {
|
|
33
|
+
if (args.default) {
|
|
34
|
+
await create({
|
|
35
|
+
components: ['agents', 'tools', 'workflows'],
|
|
36
|
+
llmProvider: 'openai',
|
|
37
|
+
addExample: false,
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
await create({
|
|
42
|
+
components: args.components,
|
|
43
|
+
llmProvider: args.llm,
|
|
44
|
+
addExample: args.example,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
program.parse(process.argv);
|
package/dist/utils.d.ts
ADDED
|
@@ -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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mastra",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.8",
|
|
4
4
|
"description": "Create Mastra apps with one command",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"commander": "^12.0.0",
|
|
20
20
|
"fs-extra": "^11.2.0",
|
|
21
|
-
"mastra": "0.1.57-alpha.
|
|
21
|
+
"mastra": "0.1.57-alpha.75"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^22.1.0",
|