create-mastra 0.0.0-netlify-no-bundle-20251127120354 → 0.0.0-new-button-export-20251219133013

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # create-mastra
2
2
 
3
- ## 0.0.0-netlify-no-bundle-20251127120354
3
+ ## 0.0.0-new-button-export-20251219133013
4
4
 
5
5
  ### Major Changes
6
6
 
@@ -12,6 +12,8 @@
12
12
 
13
13
  ### Patch Changes
14
14
 
15
+ - Fix select options overflow when list is long by adding maximum height ([#10813](https://github.com/mastra-ai/mastra/pull/10813))
16
+
15
17
  - dependencies updates: ([#10111](https://github.com/mastra-ai/mastra/pull/10111))
16
18
  - Updated dependency [`pino@^10.1.0` ↗︎](https://www.npmjs.com/package/pino/v/10.1.0) (from `^9.7.0`, in `dependencies`)
17
19
 
@@ -20,18 +22,126 @@
20
22
 
21
23
  - Update MainSidebar component to fit required changes in Cloud CTA link ([#9318](https://github.com/mastra-ai/mastra/pull/9318))
22
24
 
25
+ - Fix default value showing on workflow form after user submits ([#10983](https://github.com/mastra-ai/mastra/pull/10983))
26
+
27
+ - Auto resume suspended tools if `autoResumeSuspendedTools: true` ([#11157](https://github.com/mastra-ai/mastra/pull/11157))
28
+
29
+ The flag can be added to `defaultAgentOptions` when creating the agent or to options in `agent.stream` or `agent.generate`
30
+
31
+ ```typescript
32
+ const agent = new Agent({
33
+ //...agent information,
34
+ defaultAgentOptions: {
35
+ autoResumeSuspendedTools: true,
36
+ },
37
+ });
38
+ ```
39
+
23
40
  - Make MainSidebar toggle button sticky to bottom, always visible ([#9682](https://github.com/mastra-ai/mastra/pull/9682))
24
41
 
25
- - fix: detect bun runtime and cleanup on failure ([#10242](https://github.com/mastra-ai/mastra/pull/10242))
42
+ - Detect bun runtime and cleanup on failure ([#10242](https://github.com/mastra-ai/mastra/pull/10242))
43
+
44
+ - Add `Run` instance to client-js. `workflow.createRun` returns the `Run` instance which can be used for the different run methods. ([#11207](https://github.com/mastra-ai/mastra/pull/11207))
45
+ With this change, run methods cannot be called directly on workflow instance anymore
46
+
47
+ ```diff
48
+ - const result = await workflow.stream({ runId: '123', inputData: { ... } });
49
+ + const run = await workflow.createRun({ runId: '123' });
50
+ + const stream = await run.stream({ inputData: { ... } });
51
+ ```
26
52
 
27
53
  - Add timeTravel APIs and add timeTravel feature to studio ([#10361](https://github.com/mastra-ai/mastra/pull/10361))
28
54
 
55
+ - Add delete workflow run API ([#10991](https://github.com/mastra-ai/mastra/pull/10991))
56
+
57
+ ```typescript
58
+ await workflow.deleteWorkflowRunById(runId);
59
+ ```
60
+
29
61
  - Fix discriminatedUnion schema information lost when json schema is converted to zod ([#10500](https://github.com/mastra-ai/mastra/pull/10500))
30
62
 
63
+ - Move useScorers down to trace page to trigger it once for all trace spans ([#10985](https://github.com/mastra-ai/mastra/pull/10985))
64
+
65
+ - Update Observability Trace Spans list UI, so a user can expand/collapse span children/descendants and can filter the list by span type or name ([#10378](https://github.com/mastra-ai/mastra/pull/10378))
66
+
67
+ - Fix workflow trigger form overflow ([#10986](https://github.com/mastra-ai/mastra/pull/10986))
68
+
31
69
  - Fix scorer filtering for SpanScoring, add error and info message for user ([#10160](https://github.com/mastra-ai/mastra/pull/10160))
32
70
 
71
+ - Hide time travel on map steps in Studio ([#10631](https://github.com/mastra-ai/mastra/pull/10631))
72
+
33
73
  - Fix double scroll on agent chat container ([#10253](https://github.com/mastra-ai/mastra/pull/10253))
34
74
 
75
+ - fix isTopLevelSpan value definition on SpanScoring to properly recognize lack of span?.parentSpanId value (null or empty string) ([#11083](https://github.com/mastra-ai/mastra/pull/11083))
76
+
77
+ ## 1.0.0-beta.11
78
+
79
+ ## 1.0.0-beta.10
80
+
81
+ ### Patch Changes
82
+
83
+ - Auto resume suspended tools if `autoResumeSuspendedTools: true` ([#11157](https://github.com/mastra-ai/mastra/pull/11157))
84
+
85
+ The flag can be added to `defaultAgentOptions` when creating the agent or to options in `agent.stream` or `agent.generate`
86
+
87
+ ```typescript
88
+ const agent = new Agent({
89
+ //...agent information,
90
+ defaultAgentOptions: {
91
+ autoResumeSuspendedTools: true,
92
+ },
93
+ });
94
+ ```
95
+
96
+ - Add `Run` instance to client-js. `workflow.createRun` returns the `Run` instance which can be used for the different run methods. ([#11207](https://github.com/mastra-ai/mastra/pull/11207))
97
+ With this change, run methods cannot be called directly on workflow instance anymore
98
+
99
+ ```diff
100
+ - const result = await workflow.stream({ runId: '123', inputData: { ... } });
101
+ + const run = await workflow.createRun({ runId: '123' });
102
+ + const stream = await run.stream({ inputData: { ... } });
103
+ ```
104
+
105
+ - fix isTopLevelSpan value definition on SpanScoring to properly recognize lack of span?.parentSpanId value (null or empty string) ([#11083](https://github.com/mastra-ai/mastra/pull/11083))
106
+
107
+ ## 1.0.0-beta.9
108
+
109
+ ## 1.0.0-beta.8
110
+
111
+ ### Patch Changes
112
+
113
+ - Add delete workflow run API ([#10991](https://github.com/mastra-ai/mastra/pull/10991))
114
+
115
+ ```typescript
116
+ await workflow.deleteWorkflowRunById(runId);
117
+ ```
118
+
119
+ ## 1.0.0-beta.7
120
+
121
+ ### Patch Changes
122
+
123
+ - Fix default value showing on workflow form after user submits ([#10983](https://github.com/mastra-ai/mastra/pull/10983))
124
+
125
+ - Move useScorers down to trace page to trigger it once for all trace spans ([#10985](https://github.com/mastra-ai/mastra/pull/10985))
126
+
127
+ - Update Observability Trace Spans list UI, so a user can expand/collapse span children/descendants and can filter the list by span type or name ([#10378](https://github.com/mastra-ai/mastra/pull/10378))
128
+
129
+ - Fix workflow trigger form overflow ([#10986](https://github.com/mastra-ai/mastra/pull/10986))
130
+
131
+ ## 1.0.0-beta.6
132
+
133
+ ### Patch Changes
134
+
135
+ - Fix select options overflow when list is long by adding maximum height ([#10813](https://github.com/mastra-ai/mastra/pull/10813))
136
+
137
+ ## 1.0.0-beta.5
138
+
139
+ ### Patch Changes
140
+
141
+ - Fix discriminatedUnion schema information lost when json schema is converted to zod ([#10500](https://github.com/mastra-ai/mastra/pull/10500))
142
+
143
+ - Hide time travel on map steps in Studio ([#10631](https://github.com/mastra-ai/mastra/pull/10631))
144
+
35
145
  ## 1.0.0-beta.4
36
146
 
37
147
  ### Patch Changes
package/dist/index.js CHANGED
@@ -18,9 +18,9 @@ import tty from 'node:tty';
18
18
  import fsExtra, { readJSON, ensureFile, writeJSON } from 'fs-extra/esm';
19
19
  import prettier from 'prettier';
20
20
  import { execa } from 'execa';
21
+ import fsExtra$1 from 'fs-extra';
21
22
  import pino from 'pino';
22
23
  import pretty from 'pino-pretty';
23
- import fsExtra$1 from 'fs-extra';
24
24
 
25
25
  var __filename = fileURLToPath(import.meta.url);
26
26
  var __dirname = path3.dirname(__filename);
@@ -382,7 +382,7 @@ function DD({onlyFirst:e=false}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:
382
382
  `).length-1;this.output.write(srcExports.cursor.move(-999,u*-1));}render(){const u=Y$1(this._render(this)??"",process.stdout.columns,{hard:true});if(u!==this._prevFrame){if(this.state==="initial")this.output.write(srcExports.cursor.hide);else {const t=BD(this._prevFrame,u);if(this.restoreCursor(),t&&t?.length===1){const F=t[0];this.output.write(srcExports.cursor.move(0,F)),this.output.write(srcExports.erase.lines(1));const s=u.split(`
383
383
  `);this.output.write(s[F]),this._prevFrame=u,this.output.write(srcExports.cursor.move(0,s.length-F-1));return}if(t&&t?.length>1){const F=t[0];this.output.write(srcExports.cursor.move(0,F)),this.output.write(srcExports.erase.down());const s=u.split(`
384
384
  `).slice(F);this.output.write(s.join(`
385
- `)),this._prevFrame=u;return}this.output.write(srcExports.erase.down());}this.output.write(u),this.state==="initial"&&(this.state="active"),this._prevFrame=u;}}}var OD=Object.defineProperty,PD=(e,u,t)=>u in e?OD(e,u,{enumerable:true,configurable:true,writable:true,value:t}):e[u]=t,J=(e,u,t)=>(PD(e,typeof u!="symbol"?u+"":u,t),t);class LD extends x{constructor(u){super(u,false),J(this,"options"),J(this,"cursor",0),this.options=u.options,this.cursor=this.options.findIndex(({value:t})=>t===u.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){case "left":case "up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case "down":case "right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue();});}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value;}}class RD extends x{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return `${this.value}\u2588`;const u=this.value.slice(0,this.cursor),[t,...F]=this.value.slice(this.cursor);return `${u}${color2.inverse(t)}${F.join("")}`}get cursor(){return this._cursor}constructor(u){super(u),this.on("finalize",()=>{this.value||(this.value=u.defaultValue);});}}
385
+ `)),this._prevFrame=u;return}this.output.write(srcExports.erase.down());}this.output.write(u),this.state==="initial"&&(this.state="active"),this._prevFrame=u;}}}class dD extends x{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(u){super(u,false),this.value=!!u.initialValue,this.on("value",()=>{this.value=this._value;}),this.on("confirm",t=>{this.output.write(srcExports.cursor.move(0,-1)),this.value=t,this.state="submit",this.close();}),this.on("cursor",()=>{this.value=!this.value;});}}var OD=Object.defineProperty,PD=(e,u,t)=>u in e?OD(e,u,{enumerable:true,configurable:true,writable:true,value:t}):e[u]=t,J=(e,u,t)=>(PD(e,typeof u!="symbol"?u+"":u,t),t);class LD extends x{constructor(u){super(u,false),J(this,"options"),J(this,"cursor",0),this.options=u.options,this.cursor=this.options.findIndex(({value:t})=>t===u.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){case "left":case "up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case "down":case "right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue();});}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value;}}class RD extends x{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return `${this.value}\u2588`;const u=this.value.slice(0,this.cursor),[t,...F]=this.value.slice(this.cursor);return `${u}${color2.inverse(t)}${F.join("")}`}get cursor(){return this._cursor}constructor(u){super(u),this.on("finalize",()=>{this.value||(this.value=u.defaultValue);});}}
386
386
 
387
387
  function ce(){return y$1.platform!=="win32"?y$1.env.TERM!=="linux":!!y$1.env.CI||!!y$1.env.WT_SESSION||!!y$1.env.TERMINUS_SUBLIME||y$1.env.ConEmuTask==="{cmd::Cmder}"||y$1.env.TERM_PROGRAM==="Terminus-Sublime"||y$1.env.TERM_PROGRAM==="vscode"||y$1.env.TERM==="xterm-256color"||y$1.env.TERM==="alacritty"||y$1.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const V=ce(),u=(t,n)=>V?t:n,le=u("\u25C6","*"),L=u("\u25A0","x"),W=u("\u25B2","x"),C=u("\u25C7","o"),ue=u("\u250C","T"),o=u("\u2502","|"),d=u("\u2514","\u2014"),k=u("\u25CF",">"),P=u("\u25CB"," "),_=u("\u2500","-"),me=u("\u256E","+"),de=u("\u251C","+"),pe=u("\u256F","+"),q=u("\u25CF","\u2022"),D=u("\u25C6","*"),U=u("\u25B2","!"),K=u("\u25A0","x"),b=t=>{switch(t){case "initial":case "active":return color2.cyan(le);case "cancel":return color2.red(L);case "error":return color2.yellow(W);case "submit":return color2.green(C)}},G=t=>{const{cursor:n,options:r,style:i}=t,s=t.maxItems??Number.POSITIVE_INFINITY,c=Math.max(process.stdout.rows-4,0),a=Math.min(c,Math.max(s,5));let l=0;n>=l+a-3?l=Math.max(Math.min(n-a+3,r.length-a),0):n<l+2&&(l=Math.max(n-2,0));const $=a<r.length&&l>0,g=a<r.length&&l+a<r.length;return r.slice(l,l+a).map((p,v,f)=>{const j=v===0&&$,E=v===f.length-1&&g;return j||E?color2.dim("..."):i(p,v+l===n)})},he=t=>new RD({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){const n=`${color2.gray(o)}
388
388
  ${b(this.state)} ${t.message}
@@ -392,7 +392,12 @@ ${color2.yellow(d)} ${color2.yellow(this.error)}
392
392
  `;case "submit":return `${n}${color2.gray(o)} ${color2.dim(this.value||t.placeholder)}`;case "cancel":return `${n}${color2.gray(o)} ${color2.strikethrough(color2.dim(this.value??""))}${this.value?.trim()?`
393
393
  ${color2.gray(o)}`:""}`;default:return `${n}${color2.cyan(o)} ${i}
394
394
  ${color2.cyan(d)}
395
- `}}}).prompt(),ve=t=>{const n=(r,i)=>{const s=r.label??String(r.value);switch(i){case "selected":return `${color2.dim(s)}`;case "active":return `${color2.green(k)} ${s} ${r.hint?color2.dim(`(${r.hint})`):""}`;case "cancelled":return `${color2.strikethrough(color2.dim(s))}`;default:return `${color2.dim(P)} ${color2.dim(s)}`}};return new LD({options:t.options,initialValue:t.initialValue,render(){const r=`${color2.gray(o)}
395
+ `}}}).prompt(),ye=t=>{const n=t.active??"Yes",r=t.inactive??"No";return new dD({active:n,inactive:r,initialValue:t.initialValue??true,render(){const i=`${color2.gray(o)}
396
+ ${b(this.state)} ${t.message}
397
+ `,s=this.value?n:r;switch(this.state){case "submit":return `${i}${color2.gray(o)} ${color2.dim(s)}`;case "cancel":return `${i}${color2.gray(o)} ${color2.strikethrough(color2.dim(s))}
398
+ ${color2.gray(o)}`;default:return `${i}${color2.cyan(o)} ${this.value?`${color2.green(k)} ${n}`:`${color2.dim(P)} ${color2.dim(n)}`} ${color2.dim("/")} ${this.value?`${color2.dim(P)} ${color2.dim(r)}`:`${color2.green(k)} ${r}`}
399
+ ${color2.cyan(d)}
400
+ `}}}).prompt()},ve=t=>{const n=(r,i)=>{const s=r.label??String(r.value);switch(i){case "selected":return `${color2.dim(s)}`;case "active":return `${color2.green(k)} ${s} ${r.hint?color2.dim(`(${r.hint})`):""}`;case "cancelled":return `${color2.strikethrough(color2.dim(s))}`;default:return `${color2.dim(P)} ${color2.dim(s)}`}};return new LD({options:t.options,initialValue:t.initialValue,render(){const r=`${color2.gray(o)}
396
401
  ${b(this.state)} ${t.message}
397
402
  `;switch(this.state){case "submit":return `${r}${color2.gray(o)} ${n(this.options[this.cursor],"selected")}`;case "cancel":return `${r}${color2.gray(o)} ${n(this.options[this.cursor],"cancelled")}
398
403
  ${color2.gray(o)}`;default:return `${r}${color2.cyan(o)} ${G({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(i,s)=>n(i,s?"active":"inactive")}).join(`
@@ -1139,10 +1144,15 @@ var MastraLogger = class {
1139
1144
  }
1140
1145
  };
1141
1146
 
1142
- var PinoLogger = class extends MastraLogger {
1147
+ var PinoLogger = class _PinoLogger extends MastraLogger {
1143
1148
  logger;
1144
1149
  constructor(options = {}) {
1145
1150
  super(options);
1151
+ const internalOptions = options;
1152
+ if (internalOptions._logger) {
1153
+ this.logger = internalOptions._logger;
1154
+ return;
1155
+ }
1146
1156
  let prettyStream = void 0;
1147
1157
  if (!options.overrideDefaultTransports) {
1148
1158
  prettyStream = pretty({
@@ -1159,7 +1169,8 @@ var PinoLogger = class extends MastraLogger {
1159
1169
  {
1160
1170
  name: options.name || "app",
1161
1171
  level: options.level || LogLevel.INFO,
1162
- formatters: options.formatters
1172
+ formatters: options.formatters,
1173
+ redact: options.redact
1163
1174
  },
1164
1175
  options.overrideDefaultTransports ? options?.transports?.default : transportsAry.length === 0 ? prettyStream : pino.multistream([
1165
1176
  ...transportsAry.map(([, transport]) => ({
@@ -1173,6 +1184,38 @@ var PinoLogger = class extends MastraLogger {
1173
1184
  ])
1174
1185
  );
1175
1186
  }
1187
+ /**
1188
+ * Creates a child logger with additional bound context.
1189
+ * All logs from the child logger will include the bound context.
1190
+ *
1191
+ * @param bindings - Key-value pairs to include in all logs from this child logger
1192
+ * @returns A new PinoLogger instance with the bound context
1193
+ *
1194
+ * @example
1195
+ * ```typescript
1196
+ * const baseLogger = new PinoLogger({ name: 'MyApp' });
1197
+ *
1198
+ * // Create module-scoped logger
1199
+ * const serviceLogger = baseLogger.child({ module: 'UserService' });
1200
+ * serviceLogger.info('User created', { userId: '123' });
1201
+ * // Output includes: { module: 'UserService', userId: '123', msg: 'User created' }
1202
+ *
1203
+ * // Create request-scoped logger
1204
+ * const requestLogger = baseLogger.child({ requestId: req.id });
1205
+ * requestLogger.error('Request failed', { err: error });
1206
+ * // Output includes: { requestId: 'abc', msg: 'Request failed', err: {...} }
1207
+ * ```
1208
+ */
1209
+ child(bindings) {
1210
+ const childPino = this.logger.child(bindings);
1211
+ const childOptions = {
1212
+ name: this.name,
1213
+ level: this.level,
1214
+ transports: Object.fromEntries(this.transports),
1215
+ _logger: childPino
1216
+ };
1217
+ return new _PinoLogger(childOptions);
1218
+ }
1176
1219
  debug(message, args = {}) {
1177
1220
  this.logger.debug(args, message);
1178
1221
  }
@@ -1188,7 +1231,7 @@ var PinoLogger = class extends MastraLogger {
1188
1231
  };
1189
1232
 
1190
1233
  var package_default = {
1191
- version: "1.0.0-beta.4"};
1234
+ version: "1.0.0-beta.11"};
1192
1235
  function getPackageManagerAddCommand(pm) {
1193
1236
  switch (pm) {
1194
1237
  case "npm":
@@ -1547,7 +1590,6 @@ async function writeAgentSample(llmProvider, destPath, addExampleTool, addScorer
1547
1590
  const content = `
1548
1591
  import { Agent } from '@mastra/core/agent';
1549
1592
  import { Memory } from '@mastra/memory';
1550
- import { LibSQLStore } from '@mastra/libsql';
1551
1593
  ${addExampleTool ? `import { weatherTool } from '../tools/weather-tool';` : ""}
1552
1594
  ${addScorers ? `import { scorers } from '../scorers/weather-scorer';` : ""}
1553
1595
 
@@ -1580,12 +1622,7 @@ export const weatherAgent = new Agent({
1580
1622
  },
1581
1623
  },
1582
1624
  },` : ""}
1583
- memory: new Memory({
1584
- storage: new LibSQLStore({
1585
- id: "memory-storage",
1586
- url: "file:../mastra.db", // path is relative to the .mastra/output directory
1587
- })
1588
- })
1625
+ memory: new Memory()
1589
1626
  });
1590
1627
  `;
1591
1628
  const formattedContent = await prettier.format(content, {
@@ -1955,7 +1992,7 @@ export const mastra = new Mastra({
1955
1992
  observability: new Observability({
1956
1993
  // Enables DefaultExporter and CloudExporter for tracing
1957
1994
  default: { enabled: true },
1958
- }),
1995
+ }),
1959
1996
  });
1960
1997
  `
1961
1998
  );
@@ -2089,19 +2126,19 @@ Note: you will need to go into Cursor Settings -> MCP Settings and manually enab
2089
2126
  );
2090
2127
  }
2091
2128
  if (editor === `cursor-global`) {
2092
- const confirm = await ve({
2129
+ const confirm3 = await ve({
2093
2130
  message: `Global install will add/update ${cursorGlobalMCPConfigPath} and make the Mastra docs MCP server available in all your Cursor projects. Continue?`,
2094
2131
  options: [
2095
2132
  { value: "yes", label: "Yes, I understand" },
2096
2133
  { value: "skip", label: "No, skip for now" }
2097
2134
  ]
2098
2135
  });
2099
- if (confirm !== `yes`) {
2136
+ if (confirm3 !== `yes`) {
2100
2137
  return void 0;
2101
2138
  }
2102
2139
  }
2103
2140
  if (editor === `windsurf`) {
2104
- const confirm = await ve({
2141
+ const confirm3 = await ve({
2105
2142
  message: `Windsurf only supports a global MCP config (at ${windsurfGlobalMCPConfigPath}) is it ok to add/update that global config?
2106
2143
  This means the Mastra docs MCP server will be available in all your Windsurf projects.`,
2107
2144
  options: [
@@ -2109,11 +2146,18 @@ This means the Mastra docs MCP server will be available in all your Windsurf pro
2109
2146
  { value: "skip", label: "No, skip for now" }
2110
2147
  ]
2111
2148
  });
2112
- if (confirm !== `yes`) {
2149
+ if (confirm3 !== `yes`) {
2113
2150
  return void 0;
2114
2151
  }
2115
2152
  }
2116
2153
  return editor;
2154
+ },
2155
+ initGit: async () => {
2156
+ if (skip?.gitInit) return false;
2157
+ return ye({
2158
+ message: "Initialize a new git repository?",
2159
+ initialValue: true
2160
+ });
2117
2161
  }
2118
2162
  },
2119
2163
  {
@@ -2154,6 +2198,20 @@ function getPackageManager() {
2154
2198
  }
2155
2199
  return "npm";
2156
2200
  }
2201
+ async function gitInit({ cwd }) {
2202
+ await execa("git", ["init"], { cwd, stdio: "ignore" });
2203
+ await execa("git", ["add", "-A"], { cwd, stdio: "ignore" });
2204
+ await execa(
2205
+ "git",
2206
+ [
2207
+ "commit",
2208
+ "-m",
2209
+ '"Initial commit from Mastra"',
2210
+ '--author="dane-ai-mastra[bot] <dane-ai-mastra[bot]@users.noreply.github.com>"'
2211
+ ],
2212
+ { cwd, stdio: "ignore" }
2213
+ );
2214
+ }
2157
2215
  var logger = createLogger(false);
2158
2216
  function createLogger(debug = false) {
2159
2217
  return new PinoLogger({
@@ -2345,7 +2403,8 @@ var init = async ({
2345
2403
  llmApiKey,
2346
2404
  addExample = false,
2347
2405
  configureEditorWithDocsMCP,
2348
- versionTag
2406
+ versionTag,
2407
+ initGit = false
2349
2408
  }) => {
2350
2409
  s.start("Initializing Mastra");
2351
2410
  const packageVersionTag = versionTag ? `@${versionTag}` : "";
@@ -2404,6 +2463,16 @@ var init = async ({
2404
2463
  });
2405
2464
  }
2406
2465
  s.stop();
2466
+ if (initGit) {
2467
+ const s2 = Y();
2468
+ try {
2469
+ s2.start("Initializing git repository");
2470
+ await gitInit({ cwd: process.cwd() });
2471
+ s2.stop("Git repository initialized");
2472
+ } catch {
2473
+ s2.stop();
2474
+ }
2475
+ }
2407
2476
  if (!llmApiKey) {
2408
2477
  Me(`
2409
2478
  ${color2.green("Mastra initialized successfully!")}
@@ -2521,7 +2590,7 @@ var createMastraProject = async ({
2521
2590
  xe("Operation cancelled");
2522
2591
  process.exit(0);
2523
2592
  }
2524
- let result;
2593
+ let result = void 0;
2525
2594
  if (needsInteractive) {
2526
2595
  result = await interactivePrompt({
2527
2596
  options: { showBanner: false },
@@ -2837,6 +2906,14 @@ async function createFromTemplate(args) {
2837
2906
  }
2838
2907
  llmProvider = providerResponse;
2839
2908
  }
2909
+ let initGit = false;
2910
+ const gitConfirmResult = await ye({
2911
+ message: "Initialize a new git repository?",
2912
+ initialValue: true
2913
+ });
2914
+ if (!pD(gitConfirmResult)) {
2915
+ initGit = gitConfirmResult;
2916
+ }
2840
2917
  let projectPath = null;
2841
2918
  try {
2842
2919
  const analytics = args.injectedAnalytics || getAnalytics();
@@ -2862,6 +2939,16 @@ async function createFromTemplate(args) {
2862
2939
  llmProvider
2863
2940
  });
2864
2941
  await installDependencies(projectPath);
2942
+ if (initGit) {
2943
+ const s2 = Y();
2944
+ try {
2945
+ s2.start("Initializing git repository");
2946
+ await gitInit({ cwd: projectPath });
2947
+ s2.stop("Git repository initialized");
2948
+ } catch {
2949
+ s2.stop();
2950
+ }
2951
+ }
2865
2952
  Me(`
2866
2953
  ${color2.green("Mastra template installed!")}
2867
2954