create-mastra 1.0.0-beta.4 → 1.0.0-beta.6

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,5 +1,19 @@
1
1
  # create-mastra
2
2
 
3
+ ## 1.0.0-beta.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix select options overflow when list is long by adding maximum height ([#10813](https://github.com/mastra-ai/mastra/pull/10813))
8
+
9
+ ## 1.0.0-beta.5
10
+
11
+ ### Patch Changes
12
+
13
+ - Fix discriminatedUnion schema information lost when json schema is converted to zod ([#10500](https://github.com/mastra-ai/mastra/pull/10500))
14
+
15
+ - Hide time travel on map steps in Studio ([#10631](https://github.com/mastra-ai/mastra/pull/10631))
16
+
3
17
  ## 1.0.0-beta.4
4
18
 
5
19
  ### 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({
@@ -1173,6 +1183,38 @@ var PinoLogger = class extends MastraLogger {
1173
1183
  ])
1174
1184
  );
1175
1185
  }
1186
+ /**
1187
+ * Creates a child logger with additional bound context.
1188
+ * All logs from the child logger will include the bound context.
1189
+ *
1190
+ * @param bindings - Key-value pairs to include in all logs from this child logger
1191
+ * @returns A new PinoLogger instance with the bound context
1192
+ *
1193
+ * @example
1194
+ * ```typescript
1195
+ * const baseLogger = new PinoLogger({ name: 'MyApp' });
1196
+ *
1197
+ * // Create module-scoped logger
1198
+ * const serviceLogger = baseLogger.child({ module: 'UserService' });
1199
+ * serviceLogger.info('User created', { userId: '123' });
1200
+ * // Output includes: { module: 'UserService', userId: '123', msg: 'User created' }
1201
+ *
1202
+ * // Create request-scoped logger
1203
+ * const requestLogger = baseLogger.child({ requestId: req.id });
1204
+ * requestLogger.error('Request failed', { err: error });
1205
+ * // Output includes: { requestId: 'abc', msg: 'Request failed', err: {...} }
1206
+ * ```
1207
+ */
1208
+ child(bindings) {
1209
+ const childPino = this.logger.child(bindings);
1210
+ const childOptions = {
1211
+ name: this.name,
1212
+ level: this.level,
1213
+ transports: Object.fromEntries(this.transports),
1214
+ _logger: childPino
1215
+ };
1216
+ return new _PinoLogger(childOptions);
1217
+ }
1176
1218
  debug(message, args = {}) {
1177
1219
  this.logger.debug(args, message);
1178
1220
  }
@@ -1188,7 +1230,7 @@ var PinoLogger = class extends MastraLogger {
1188
1230
  };
1189
1231
 
1190
1232
  var package_default = {
1191
- version: "1.0.0-beta.4"};
1233
+ version: "1.0.0-beta.6"};
1192
1234
  function getPackageManagerAddCommand(pm) {
1193
1235
  switch (pm) {
1194
1236
  case "npm":
@@ -2089,19 +2131,19 @@ Note: you will need to go into Cursor Settings -> MCP Settings and manually enab
2089
2131
  );
2090
2132
  }
2091
2133
  if (editor === `cursor-global`) {
2092
- const confirm = await ve({
2134
+ const confirm3 = await ve({
2093
2135
  message: `Global install will add/update ${cursorGlobalMCPConfigPath} and make the Mastra docs MCP server available in all your Cursor projects. Continue?`,
2094
2136
  options: [
2095
2137
  { value: "yes", label: "Yes, I understand" },
2096
2138
  { value: "skip", label: "No, skip for now" }
2097
2139
  ]
2098
2140
  });
2099
- if (confirm !== `yes`) {
2141
+ if (confirm3 !== `yes`) {
2100
2142
  return void 0;
2101
2143
  }
2102
2144
  }
2103
2145
  if (editor === `windsurf`) {
2104
- const confirm = await ve({
2146
+ const confirm3 = await ve({
2105
2147
  message: `Windsurf only supports a global MCP config (at ${windsurfGlobalMCPConfigPath}) is it ok to add/update that global config?
2106
2148
  This means the Mastra docs MCP server will be available in all your Windsurf projects.`,
2107
2149
  options: [
@@ -2109,11 +2151,17 @@ This means the Mastra docs MCP server will be available in all your Windsurf pro
2109
2151
  { value: "skip", label: "No, skip for now" }
2110
2152
  ]
2111
2153
  });
2112
- if (confirm !== `yes`) {
2154
+ if (confirm3 !== `yes`) {
2113
2155
  return void 0;
2114
2156
  }
2115
2157
  }
2116
2158
  return editor;
2159
+ },
2160
+ initGit: async () => {
2161
+ return ye({
2162
+ message: "Initialize a new git repository?",
2163
+ initialValue: true
2164
+ });
2117
2165
  }
2118
2166
  },
2119
2167
  {
@@ -2154,6 +2202,20 @@ function getPackageManager() {
2154
2202
  }
2155
2203
  return "npm";
2156
2204
  }
2205
+ async function gitInit({ cwd }) {
2206
+ await execa("git", ["init"], { cwd, stdio: "ignore" });
2207
+ await execa("git", ["add", "-A"], { cwd, stdio: "ignore" });
2208
+ await execa(
2209
+ "git",
2210
+ [
2211
+ "commit",
2212
+ "-m",
2213
+ '"Initial commit from Mastra"',
2214
+ '--author="dane-ai-mastra[bot] <dane-ai-mastra[bot]@users.noreply.github.com>"'
2215
+ ],
2216
+ { cwd, stdio: "ignore" }
2217
+ );
2218
+ }
2157
2219
  var logger = createLogger(false);
2158
2220
  function createLogger(debug = false) {
2159
2221
  return new PinoLogger({
@@ -2345,7 +2407,8 @@ var init = async ({
2345
2407
  llmApiKey,
2346
2408
  addExample = false,
2347
2409
  configureEditorWithDocsMCP,
2348
- versionTag
2410
+ versionTag,
2411
+ initGit = false
2349
2412
  }) => {
2350
2413
  s.start("Initializing Mastra");
2351
2414
  const packageVersionTag = versionTag ? `@${versionTag}` : "";
@@ -2404,6 +2467,16 @@ var init = async ({
2404
2467
  });
2405
2468
  }
2406
2469
  s.stop();
2470
+ if (initGit) {
2471
+ const s2 = Y();
2472
+ try {
2473
+ s2.start("Initializing git repository");
2474
+ await gitInit({ cwd: process.cwd() });
2475
+ s2.stop("Git repository initialized");
2476
+ } catch {
2477
+ s2.stop();
2478
+ }
2479
+ }
2407
2480
  if (!llmApiKey) {
2408
2481
  Me(`
2409
2482
  ${color2.green("Mastra initialized successfully!")}
@@ -2521,7 +2594,7 @@ var createMastraProject = async ({
2521
2594
  xe("Operation cancelled");
2522
2595
  process.exit(0);
2523
2596
  }
2524
- let result;
2597
+ let result = void 0;
2525
2598
  if (needsInteractive) {
2526
2599
  result = await interactivePrompt({
2527
2600
  options: { showBanner: false },
@@ -2837,6 +2910,14 @@ async function createFromTemplate(args) {
2837
2910
  }
2838
2911
  llmProvider = providerResponse;
2839
2912
  }
2913
+ let initGit = false;
2914
+ const gitConfirmResult = await ye({
2915
+ message: "Initialize a new git repository?",
2916
+ initialValue: true
2917
+ });
2918
+ if (!pD(gitConfirmResult)) {
2919
+ initGit = gitConfirmResult;
2920
+ }
2840
2921
  let projectPath = null;
2841
2922
  try {
2842
2923
  const analytics = args.injectedAnalytics || getAnalytics();
@@ -2862,6 +2943,16 @@ async function createFromTemplate(args) {
2862
2943
  llmProvider
2863
2944
  });
2864
2945
  await installDependencies(projectPath);
2946
+ if (initGit) {
2947
+ const s2 = Y();
2948
+ try {
2949
+ s2.start("Initializing git repository");
2950
+ await gitInit({ cwd: projectPath });
2951
+ s2.stop("Git repository initialized");
2952
+ } catch {
2953
+ s2.stop();
2954
+ }
2955
+ }
2865
2956
  Me(`
2866
2957
  ${color2.green("Mastra template installed!")}
2867
2958