create-mastra 0.0.0-fix-network-silence-20250930164151 → 0.0.0-fix-runtimeContext-passing-chatRoute-20251008220150
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 +195 -1
- package/dist/index.js +69 -37
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,188 @@
|
|
|
1
1
|
# create-mastra
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-runtimeContext-passing-chatRoute-20251008220150
|
|
4
|
+
|
|
5
|
+
## 0.15.1
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- Improve the overall flow of the `create-mastra` CLI by first asking all questions and then creating the project structure. If you skip entering an API key during the wizard, the `your-api-key` placeholder will now be added to an `.env.example` file instead of `.env`. ([#8603](https://github.com/mastra-ai/mastra/pull/8603))
|
|
10
|
+
|
|
11
|
+
## 0.15.1-alpha.1
|
|
12
|
+
|
|
13
|
+
## 0.15.1-alpha.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Improve the overall flow of the `create-mastra` CLI by first asking all questions and then creating the project structure. If you skip entering an API key during the wizard, the `your-api-key` placeholder will now be added to an `.env.example` file instead of `.env`. ([#8603](https://github.com/mastra-ai/mastra/pull/8603))
|
|
18
|
+
|
|
19
|
+
## 0.15.0
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Mutable shared workflow run state ([#8545](https://github.com/mastra-ai/mastra/pull/8545))
|
|
24
|
+
|
|
25
|
+
- streamLegacy/generateLegacy clarification in playground ([#8468](https://github.com/mastra-ai/mastra/pull/8468))
|
|
26
|
+
|
|
27
|
+
- avoid refetching memory threads and messages on window focus ([#8519](https://github.com/mastra-ai/mastra/pull/8519))
|
|
28
|
+
|
|
29
|
+
- add tripwire reason in playground ([#8568](https://github.com/mastra-ai/mastra/pull/8568))
|
|
30
|
+
|
|
31
|
+
- Save waiting step status in snapshot ([#8576](https://github.com/mastra-ai/mastra/pull/8576))
|
|
32
|
+
|
|
33
|
+
- Added AI SDK provider packages to model router for anthropic/google/openai/openrouter/xai ([#8559](https://github.com/mastra-ai/mastra/pull/8559))
|
|
34
|
+
|
|
35
|
+
- Convert WorkflowWatchResult to WorkflowResult in workflow graph ([#8541](https://github.com/mastra-ai/mastra/pull/8541))
|
|
36
|
+
|
|
37
|
+
- Fixed an issue where model router was adding /chat/completions to API urls when it shouldn't. ([#8589](https://github.com/mastra-ai/mastra/pull/8589))
|
|
38
|
+
fixed an issue with provider ID rendering in playground UI
|
|
39
|
+
|
|
40
|
+
- Fix useStreamWorkflow unmounting breaking stream call ([#8449](https://github.com/mastra-ai/mastra/pull/8449))
|
|
41
|
+
|
|
42
|
+
## 0.15.0-alpha.3
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Fixed an issue where model router was adding /chat/completions to API urls when it shouldn't. ([#8589](https://github.com/mastra-ai/mastra/pull/8589))
|
|
47
|
+
fixed an issue with provider ID rendering in playground UI
|
|
48
|
+
|
|
49
|
+
## 0.14.2-alpha.2
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Added AI SDK provider packages to model router for anthropic/google/openai/openrouter/xai ([#8559](https://github.com/mastra-ai/mastra/pull/8559))
|
|
54
|
+
|
|
55
|
+
## 0.14.2-alpha.1
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- Mutable shared workflow run state ([#8545](https://github.com/mastra-ai/mastra/pull/8545))
|
|
60
|
+
|
|
61
|
+
- avoid refetching memory threads and messages on window focus ([#8519](https://github.com/mastra-ai/mastra/pull/8519))
|
|
62
|
+
|
|
63
|
+
- add tripwire reason in playground ([#8568](https://github.com/mastra-ai/mastra/pull/8568))
|
|
64
|
+
|
|
65
|
+
- Save waiting step status in snapshot ([#8576](https://github.com/mastra-ai/mastra/pull/8576))
|
|
66
|
+
|
|
67
|
+
- Convert WorkflowWatchResult to WorkflowResult in workflow graph ([#8541](https://github.com/mastra-ai/mastra/pull/8541))
|
|
68
|
+
|
|
69
|
+
## 0.14.2-alpha.0
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- streamLegacy/generateLegacy clarification in playground ([#8468](https://github.com/mastra-ai/mastra/pull/8468))
|
|
74
|
+
|
|
75
|
+
- Fix useStreamWorkflow unmounting breaking stream call ([#8449](https://github.com/mastra-ai/mastra/pull/8449))
|
|
76
|
+
|
|
77
|
+
## 0.14.1
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Make init versions latest pkgs ([#8434](https://github.com/mastra-ai/mastra/pull/8434))
|
|
82
|
+
|
|
83
|
+
## 0.14.1-alpha.0
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- Make init versions latest pkgs ([#8434](https://github.com/mastra-ai/mastra/pull/8434))
|
|
88
|
+
|
|
89
|
+
## 0.14.0
|
|
90
|
+
|
|
91
|
+
### Minor Changes
|
|
92
|
+
|
|
93
|
+
- Breaking change to move the agent.streamVNext/generateVNext implementation to the default stream/generate. The old stream/generate have now been moved to streamLegacy and generateLegacy ([#8097](https://github.com/mastra-ai/mastra/pull/8097))
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- Remove log drains UI from the playground ([#8379](https://github.com/mastra-ai/mastra/pull/8379))
|
|
98
|
+
|
|
99
|
+
- add refetch interval to traces to make it feel "instant" ([#8386](https://github.com/mastra-ai/mastra/pull/8386))
|
|
100
|
+
|
|
101
|
+
- better memory message ([#8382](https://github.com/mastra-ai/mastra/pull/8382))
|
|
102
|
+
|
|
103
|
+
- fix codeblock line number color contrast for legacy traces ([#8385](https://github.com/mastra-ai/mastra/pull/8385))
|
|
104
|
+
|
|
105
|
+
- Model router documentation and playground UI improvements ([#8372](https://github.com/mastra-ai/mastra/pull/8372))
|
|
106
|
+
|
|
107
|
+
**Documentation generation (`@mastra/core`):**
|
|
108
|
+
- Fixed inverted dynamic model selection logic in provider examples
|
|
109
|
+
- Improved copy: replaced marketing language with action-oriented descriptions
|
|
110
|
+
- Added generated file comments with timestamps to all MDX outputs so maintainers know not to directly edit generated files
|
|
111
|
+
|
|
112
|
+
**Playground UI model picker (`@mastra/playground-ui`):**
|
|
113
|
+
- Fixed provider field clearing when typing in model input
|
|
114
|
+
- Added responsive layout (stacks on mobile, side-by-side on desktop)
|
|
115
|
+
- Improved general styling of provider/model pickers
|
|
116
|
+
|
|
117
|
+
**Environment variables (`@mastra/deployer`):**
|
|
118
|
+
- Properly handle array of env vars (e.g., NETLIFY_TOKEN, NETLIFY_SITE_ID)
|
|
119
|
+
- Added correct singular/plural handling for "environment variable(s)"
|
|
120
|
+
|
|
121
|
+
- show thread list in desc order ([#8381](https://github.com/mastra-ai/mastra/pull/8381))
|
|
122
|
+
|
|
123
|
+
- Fix an issue preventing showing working memory and semantic recall in the playground ([#8358](https://github.com/mastra-ai/mastra/pull/8358))
|
|
124
|
+
|
|
125
|
+
- Add observe strean to get streans after workflow has been interrupted ([#8318](https://github.com/mastra-ai/mastra/pull/8318))
|
|
126
|
+
|
|
127
|
+
## 0.14.0-alpha.0
|
|
128
|
+
|
|
129
|
+
### Minor Changes
|
|
130
|
+
|
|
131
|
+
- Breaking change to move the agent.streamVNext/generateVNext implementation to the default stream/generate. The old stream/generate have now been moved to streamLegacy and generateLegacy ([#8097](https://github.com/mastra-ai/mastra/pull/8097))
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- Remove log drains UI from the playground ([#8379](https://github.com/mastra-ai/mastra/pull/8379))
|
|
136
|
+
|
|
137
|
+
- add refetch interval to traces to make it feel "instant" ([#8386](https://github.com/mastra-ai/mastra/pull/8386))
|
|
138
|
+
|
|
139
|
+
- better memory message ([#8382](https://github.com/mastra-ai/mastra/pull/8382))
|
|
140
|
+
|
|
141
|
+
- fix codeblock line number color contrast for legacy traces ([#8385](https://github.com/mastra-ai/mastra/pull/8385))
|
|
142
|
+
|
|
143
|
+
- Model router documentation and playground UI improvements ([#8372](https://github.com/mastra-ai/mastra/pull/8372))
|
|
144
|
+
|
|
145
|
+
**Documentation generation (`@mastra/core`):**
|
|
146
|
+
- Fixed inverted dynamic model selection logic in provider examples
|
|
147
|
+
- Improved copy: replaced marketing language with action-oriented descriptions
|
|
148
|
+
- Added generated file comments with timestamps to all MDX outputs so maintainers know not to directly edit generated files
|
|
149
|
+
|
|
150
|
+
**Playground UI model picker (`@mastra/playground-ui`):**
|
|
151
|
+
- Fixed provider field clearing when typing in model input
|
|
152
|
+
- Added responsive layout (stacks on mobile, side-by-side on desktop)
|
|
153
|
+
- Improved general styling of provider/model pickers
|
|
154
|
+
|
|
155
|
+
**Environment variables (`@mastra/deployer`):**
|
|
156
|
+
- Properly handle array of env vars (e.g., NETLIFY_TOKEN, NETLIFY_SITE_ID)
|
|
157
|
+
- Added correct singular/plural handling for "environment variable(s)"
|
|
158
|
+
|
|
159
|
+
- show thread list in desc order ([#8381](https://github.com/mastra-ai/mastra/pull/8381))
|
|
160
|
+
|
|
161
|
+
- Fix an issue preventing showing working memory and semantic recall in the playground ([#8358](https://github.com/mastra-ai/mastra/pull/8358))
|
|
162
|
+
|
|
163
|
+
- Add observe strean to get streans after workflow has been interrupted ([#8318](https://github.com/mastra-ai/mastra/pull/8318))
|
|
164
|
+
|
|
165
|
+
## 0.13.4
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- disable network label when memory is not enabled OR the agent has no subagents ([#8341](https://github.com/mastra-ai/mastra/pull/8341))
|
|
170
|
+
|
|
171
|
+
- Added Mastra model router to Playground UI ([#8332](https://github.com/mastra-ai/mastra/pull/8332))
|
|
172
|
+
|
|
173
|
+
## 0.13.4-alpha.1
|
|
174
|
+
|
|
175
|
+
### Patch Changes
|
|
176
|
+
|
|
177
|
+
- disable network label when memory is not enabled OR the agent has no subagents ([#8341](https://github.com/mastra-ai/mastra/pull/8341))
|
|
178
|
+
|
|
179
|
+
## 0.13.4-alpha.0
|
|
180
|
+
|
|
181
|
+
### Patch Changes
|
|
182
|
+
|
|
183
|
+
- Added Mastra model router to Playground UI ([#8332](https://github.com/mastra-ai/mastra/pull/8332))
|
|
184
|
+
|
|
185
|
+
## 0.13.3
|
|
4
186
|
|
|
5
187
|
### Patch Changes
|
|
6
188
|
|
|
@@ -8,10 +190,22 @@
|
|
|
8
190
|
|
|
9
191
|
- Add conditional chaining to scorer.agentNames return ([#8199](https://github.com/mastra-ai/mastra/pull/8199))
|
|
10
192
|
|
|
193
|
+
- Show model that worked when there are model fallbacks ([#8167](https://github.com/mastra-ai/mastra/pull/8167))
|
|
194
|
+
|
|
11
195
|
- Add types in the streamVNext codepath, fixes for various issues across multiple packages surfaced from type issues, align return types. ([#8010](https://github.com/mastra-ai/mastra/pull/8010))
|
|
12
196
|
|
|
13
197
|
- Add model fallbacks to playground ([#7427](https://github.com/mastra-ai/mastra/pull/7427))
|
|
14
198
|
|
|
199
|
+
## 0.13.3-alpha.1
|
|
200
|
+
|
|
201
|
+
### Patch Changes
|
|
202
|
+
|
|
203
|
+
- Fixed an issue in playground where text-start/end parts were ignored in handleStreamChunk and tool ordering vs text wasn't retained ([#8234](https://github.com/mastra-ai/mastra/pull/8234))
|
|
204
|
+
|
|
205
|
+
- Add conditional chaining to scorer.agentNames return ([#8199](https://github.com/mastra-ai/mastra/pull/8199))
|
|
206
|
+
|
|
207
|
+
- Show model that worked when there are model fallbacks ([#8167](https://github.com/mastra-ai/mastra/pull/8167))
|
|
208
|
+
|
|
15
209
|
## 0.13.3-alpha.0
|
|
16
210
|
|
|
17
211
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1667,10 +1667,8 @@ var FileService = class {
|
|
|
1667
1667
|
var exec2 = util.promisify(child_process.exec);
|
|
1668
1668
|
var getAISDKPackageVersion = (llmProvider) => {
|
|
1669
1669
|
switch (llmProvider) {
|
|
1670
|
-
case "cerebras":
|
|
1671
|
-
return "^0.2.14";
|
|
1672
1670
|
default:
|
|
1673
|
-
return "
|
|
1671
|
+
return "latest";
|
|
1674
1672
|
}
|
|
1675
1673
|
};
|
|
1676
1674
|
var getAISDKPackage = (llmProvider) => {
|
|
@@ -2007,13 +2005,21 @@ ${addAgent ? `import { weatherAgent } from './agents/weather-agent';` : ""}
|
|
|
2007
2005
|
export const mastra = new Mastra({
|
|
2008
2006
|
${filteredExports.join("\n ")}
|
|
2009
2007
|
storage: new LibSQLStore({
|
|
2010
|
-
// stores
|
|
2008
|
+
// stores observability, scores, ... into memory storage, if it needs to persist, change to file:../mastra.db
|
|
2011
2009
|
url: ":memory:",
|
|
2012
2010
|
}),
|
|
2013
2011
|
logger: new PinoLogger({
|
|
2014
2012
|
name: 'Mastra',
|
|
2015
2013
|
level: 'info',
|
|
2016
2014
|
}),
|
|
2015
|
+
telemetry: {
|
|
2016
|
+
// Telemetry is deprecated and will be removed in the Nov 4th release
|
|
2017
|
+
enabled: false,
|
|
2018
|
+
},
|
|
2019
|
+
observability: {
|
|
2020
|
+
// Enables DefaultExporter and CloudExporter for AI tracing
|
|
2021
|
+
default: { enabled: true },
|
|
2022
|
+
},
|
|
2017
2023
|
});
|
|
2018
2024
|
`
|
|
2019
2025
|
);
|
|
@@ -2044,14 +2050,12 @@ var getAPIKey = async (provider) => {
|
|
|
2044
2050
|
return key;
|
|
2045
2051
|
}
|
|
2046
2052
|
};
|
|
2047
|
-
var writeAPIKey = async ({
|
|
2048
|
-
|
|
2049
|
-
apiKey = "your-api-key"
|
|
2050
|
-
}) => {
|
|
2053
|
+
var writeAPIKey = async ({ provider, apiKey }) => {
|
|
2054
|
+
const envFileName = apiKey ? ".env" : ".env.example";
|
|
2051
2055
|
const key = await getAPIKey(provider);
|
|
2052
2056
|
const escapedKey = shellQuote.quote([key]);
|
|
2053
|
-
const escapedApiKey = shellQuote.quote([apiKey]);
|
|
2054
|
-
await exec2(`echo ${escapedKey}=${escapedApiKey} >>
|
|
2057
|
+
const escapedApiKey = shellQuote.quote([apiKey ? apiKey : "your-api-key"]);
|
|
2058
|
+
await exec2(`echo ${escapedKey}=${escapedApiKey} >> ${envFileName}`);
|
|
2055
2059
|
};
|
|
2056
2060
|
var createMastraDir = async (directory) => {
|
|
2057
2061
|
let dir = directory.trim().split("/").filter((item) => item !== "");
|
|
@@ -2072,8 +2076,19 @@ var writeCodeSample = async (dirPath, component, llmProvider, importComponents)
|
|
|
2072
2076
|
throw err;
|
|
2073
2077
|
}
|
|
2074
2078
|
};
|
|
2075
|
-
var
|
|
2076
|
-
|
|
2079
|
+
var LLM_PROVIDERS = [
|
|
2080
|
+
{ value: "openai", label: "OpenAI", hint: "recommended" },
|
|
2081
|
+
{ value: "anthropic", label: "Anthropic" },
|
|
2082
|
+
{ value: "groq", label: "Groq" },
|
|
2083
|
+
{ value: "google", label: "Google" },
|
|
2084
|
+
{ value: "cerebras", label: "Cerebras" },
|
|
2085
|
+
{ value: "mistral", label: "Mistral" }
|
|
2086
|
+
];
|
|
2087
|
+
var interactivePrompt = async (args2 = {}) => {
|
|
2088
|
+
const { skip = {}, options: { showBanner = true } = {} } = args2;
|
|
2089
|
+
if (showBanner) {
|
|
2090
|
+
Ie(color2.inverse(" Mastra Init "));
|
|
2091
|
+
}
|
|
2077
2092
|
const mastraProject = await Ce(
|
|
2078
2093
|
{
|
|
2079
2094
|
directory: () => he({
|
|
@@ -2081,20 +2096,15 @@ var interactivePrompt = async () => {
|
|
|
2081
2096
|
placeholder: "src/",
|
|
2082
2097
|
defaultValue: "src/"
|
|
2083
2098
|
}),
|
|
2084
|
-
llmProvider: () => ve({
|
|
2085
|
-
message: "Select default provider:",
|
|
2086
|
-
options:
|
|
2087
|
-
{ value: "openai", label: "OpenAI", hint: "recommended" },
|
|
2088
|
-
{ value: "anthropic", label: "Anthropic" },
|
|
2089
|
-
{ value: "groq", label: "Groq" },
|
|
2090
|
-
{ value: "google", label: "Google" },
|
|
2091
|
-
{ value: "cerebras", label: "Cerebras" },
|
|
2092
|
-
{ value: "mistral", label: "Mistral" }
|
|
2093
|
-
]
|
|
2099
|
+
llmProvider: () => skip?.llmProvider ? void 0 : ve({
|
|
2100
|
+
message: "Select a default provider:",
|
|
2101
|
+
options: LLM_PROVIDERS
|
|
2094
2102
|
}),
|
|
2095
2103
|
llmApiKey: async ({ results: { llmProvider } }) => {
|
|
2104
|
+
if (skip?.llmApiKey) return void 0;
|
|
2105
|
+
const llmName = LLM_PROVIDERS.find((p6) => p6.value === llmProvider)?.label || "provider";
|
|
2096
2106
|
const keyChoice = await ve({
|
|
2097
|
-
message: `Enter your ${
|
|
2107
|
+
message: `Enter your ${llmName} API key?`,
|
|
2098
2108
|
options: [
|
|
2099
2109
|
{ value: "skip", label: "Skip for now", hint: "default" },
|
|
2100
2110
|
{ value: "enter", label: "Enter API key" }
|
|
@@ -2104,7 +2114,10 @@ var interactivePrompt = async () => {
|
|
|
2104
2114
|
if (keyChoice === "enter") {
|
|
2105
2115
|
return he({
|
|
2106
2116
|
message: "Enter your API key:",
|
|
2107
|
-
placeholder: "sk-..."
|
|
2117
|
+
placeholder: "sk-...",
|
|
2118
|
+
validate: (value) => {
|
|
2119
|
+
if (value.length === 0) return "API key cannot be empty";
|
|
2120
|
+
}
|
|
2108
2121
|
});
|
|
2109
2122
|
}
|
|
2110
2123
|
return void 0;
|
|
@@ -2114,7 +2127,7 @@ var interactivePrompt = async () => {
|
|
|
2114
2127
|
const cursorIsAlreadyInstalled = await globalMCPIsAlreadyInstalled(`cursor`);
|
|
2115
2128
|
const vscodeIsAlreadyInstalled = await globalMCPIsAlreadyInstalled(`vscode`);
|
|
2116
2129
|
const editor = await ve({
|
|
2117
|
-
message: `Make your
|
|
2130
|
+
message: `Make your IDE into a Mastra expert? (Installs Mastra's MCP server)`,
|
|
2118
2131
|
options: [
|
|
2119
2132
|
{ value: "skip", label: "Skip for now", hint: "default" },
|
|
2120
2133
|
{
|
|
@@ -2326,18 +2339,34 @@ async function installMastraDependency(pm, dependency, versionTag, isDev, timeou
|
|
|
2326
2339
|
var createMastraProject = async ({
|
|
2327
2340
|
projectName: name,
|
|
2328
2341
|
createVersionTag,
|
|
2329
|
-
timeout
|
|
2342
|
+
timeout,
|
|
2343
|
+
llmProvider,
|
|
2344
|
+
llmApiKey,
|
|
2345
|
+
needsInteractive
|
|
2330
2346
|
}) => {
|
|
2331
2347
|
Ie(color2.inverse(" Mastra Create "));
|
|
2332
2348
|
const projectName = name ?? await he({
|
|
2333
2349
|
message: "What do you want to name your project?",
|
|
2334
2350
|
placeholder: "my-mastra-app",
|
|
2335
|
-
defaultValue: "my-mastra-app"
|
|
2351
|
+
defaultValue: "my-mastra-app",
|
|
2352
|
+
validate: (value) => {
|
|
2353
|
+
if (value.length === 0) return "Project name cannot be empty";
|
|
2354
|
+
if (fs4__default__default.existsSync(value)) {
|
|
2355
|
+
return `A directory named "${value}" already exists. Please choose a different name.`;
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2336
2358
|
});
|
|
2337
2359
|
if (pD(projectName)) {
|
|
2338
2360
|
xe("Operation cancelled");
|
|
2339
2361
|
process.exit(0);
|
|
2340
2362
|
}
|
|
2363
|
+
let result;
|
|
2364
|
+
if (needsInteractive) {
|
|
2365
|
+
result = await interactivePrompt({
|
|
2366
|
+
options: { showBanner: false },
|
|
2367
|
+
skip: { llmProvider: llmProvider !== void 0, llmApiKey: llmApiKey !== void 0 }
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2341
2370
|
const s2 = Y();
|
|
2342
2371
|
try {
|
|
2343
2372
|
s2.start("Creating project");
|
|
@@ -2398,15 +2427,15 @@ var createMastraProject = async ({
|
|
|
2398
2427
|
);
|
|
2399
2428
|
}
|
|
2400
2429
|
s2.stop(`${pm} dependencies installed`);
|
|
2401
|
-
s2.start("Installing
|
|
2430
|
+
s2.start("Installing Mastra CLI");
|
|
2402
2431
|
const versionTag = createVersionTag ? `@${createVersionTag}` : "@latest";
|
|
2403
2432
|
try {
|
|
2404
2433
|
await installMastraDependency(pm, "mastra", versionTag, true, timeout);
|
|
2405
2434
|
} catch (error) {
|
|
2406
2435
|
throw new Error(`Failed to install Mastra CLI: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2407
2436
|
}
|
|
2408
|
-
s2.stop("
|
|
2409
|
-
s2.start("Installing dependencies");
|
|
2437
|
+
s2.stop("Mastra CLI installed");
|
|
2438
|
+
s2.start("Installing Mastra dependencies");
|
|
2410
2439
|
try {
|
|
2411
2440
|
await installMastraDependency(pm, "@mastra/core", versionTag, false, timeout);
|
|
2412
2441
|
await installMastraDependency(pm, "@mastra/libsql", versionTag, false, timeout);
|
|
@@ -2433,7 +2462,7 @@ var createMastraProject = async ({
|
|
|
2433
2462
|
s2.stop(".gitignore added");
|
|
2434
2463
|
Se("Project created successfully");
|
|
2435
2464
|
console.info("");
|
|
2436
|
-
return { projectName };
|
|
2465
|
+
return { projectName, result };
|
|
2437
2466
|
} catch (error) {
|
|
2438
2467
|
s2.stop();
|
|
2439
2468
|
const errorMessage = error instanceof Error ? error.message : "An unexpected error occurred";
|
|
@@ -2446,14 +2475,17 @@ var create = async (args2) => {
|
|
|
2446
2475
|
await createFromTemplate({ ...args2, injectedAnalytics: args2.analytics });
|
|
2447
2476
|
return;
|
|
2448
2477
|
}
|
|
2449
|
-
const
|
|
2478
|
+
const needsInteractive = args2.components === void 0 || args2.llmProvider === void 0 || args2.addExample === void 0;
|
|
2479
|
+
const { projectName, result } = await createMastraProject({
|
|
2450
2480
|
projectName: args2?.projectName,
|
|
2451
2481
|
createVersionTag: args2?.createVersionTag,
|
|
2452
|
-
timeout: args2?.timeout
|
|
2482
|
+
timeout: args2?.timeout,
|
|
2483
|
+
llmProvider: args2?.llmProvider,
|
|
2484
|
+
llmApiKey: args2?.llmApiKey,
|
|
2485
|
+
needsInteractive
|
|
2453
2486
|
});
|
|
2454
2487
|
const directory = args2.directory || "src/";
|
|
2455
|
-
if (
|
|
2456
|
-
const result = await interactivePrompt();
|
|
2488
|
+
if (needsInteractive && result) {
|
|
2457
2489
|
await init({
|
|
2458
2490
|
...result,
|
|
2459
2491
|
llmApiKey: result?.llmApiKey,
|
|
@@ -2679,7 +2711,7 @@ program.version(`${version}`, "-v, --version").description(`create-mastra ${vers
|
|
|
2679
2711
|
program.name("create-mastra").description("Create a new Mastra project").argument("[project-name]", "Directory name of the project").option(
|
|
2680
2712
|
"-p, --project-name <string>",
|
|
2681
2713
|
"Project name that will be used in package.json and as the project directory name."
|
|
2682
|
-
).option("--default", "Quick start with defaults(src, OpenAI, examples)").option("-c, --components <components>", "Comma-separated list of components (agents, tools, workflows)").option("-l, --llm <model-provider>", "Default model provider (openai, anthropic, groq, google, or cerebras)").option("-k, --llm-api-key <api-key>", "API key for the model provider").option("-e, --example", "Include example code").option("-n, --no-example", "Do not include example code").option("-t, --timeout [timeout]", "Configurable timeout for package installation, defaults to 60000 ms").option("-d, --dir <directory>", "Target directory for Mastra source code (default: src/)").option("-m, --mcp <mcp>", "MCP Server for code editor (cursor, cursor-global, windsurf, vscode)").option(
|
|
2714
|
+
).option("--default", "Quick start with defaults (src, OpenAI, examples)").option("-c, --components <components>", "Comma-separated list of components (agents, tools, workflows)").option("-l, --llm <model-provider>", "Default model provider (openai, anthropic, groq, google, or cerebras)").option("-k, --llm-api-key <api-key>", "API key for the model provider").option("-e, --example", "Include example code").option("-n, --no-example", "Do not include example code").option("-t, --timeout [timeout]", "Configurable timeout for package installation, defaults to 60000 ms").option("-d, --dir <directory>", "Target directory for Mastra source code (default: src/)").option("-m, --mcp <mcp>", "MCP Server for code editor (cursor, cursor-global, windsurf, vscode)").option(
|
|
2683
2715
|
"--template [template-name]",
|
|
2684
2716
|
"Create project from a template (use template name, public GitHub URL, or leave blank to select from list)"
|
|
2685
2717
|
).action(async (projectNameArg, args) => {
|
|
@@ -2703,7 +2735,7 @@ program.name("create-mastra").description("Create a new Mastra project").argumen
|
|
|
2703
2735
|
components: args.components ? args.components.split(",") : [],
|
|
2704
2736
|
llmProvider: args.llm,
|
|
2705
2737
|
addExample: args.example,
|
|
2706
|
-
llmApiKey: args
|
|
2738
|
+
llmApiKey: args.llmApiKey,
|
|
2707
2739
|
createVersionTag,
|
|
2708
2740
|
timeout,
|
|
2709
2741
|
projectName,
|