mastra 0.4.5-alpha.2 → 0.4.5-alpha.5

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.js CHANGED
@@ -6,7 +6,7 @@ export { create } from './chunk-4QQ2IFQI.js';
6
6
  import { Command } from 'commander';
7
7
  import { config } from 'dotenv';
8
8
  import { join as join$1, dirname, basename } from 'node:path';
9
- import { getWatcherInputOptions, writeTelemetryConfig, createWatcher, FileService as FileService$2 } from '@mastra/deployer/build';
9
+ import { getServerOptions, getWatcherInputOptions, writeTelemetryConfig, createWatcher, FileService as FileService$2 } from '@mastra/deployer/build';
10
10
  import { Bundler } from '@mastra/deployer/bundler';
11
11
  import * as fsExtra2 from 'fs-extra';
12
12
  import { readFileSync } from 'node:fs';
@@ -59,7 +59,6 @@ async function build({ dir }) {
59
59
  join$1(mastraDir, "src", "mastra", "index.ts"),
60
60
  join$1(mastraDir, "src", "mastra", "index.js")
61
61
  ]);
62
- console.log(join$1(mastraDir, "index.ts"), join$1(mastraDir, "index.js"));
63
62
  await deployer.prepare(outputDirectory);
64
63
  await deployer.bundle(mastraEntryFile, outputDirectory);
65
64
  }
@@ -319,7 +318,12 @@ async function rebundleAndRestart(dotMastraPath, port, bundler) {
319
318
  isRestarting = false;
320
319
  }
321
320
  }
322
- async function dev({ port, dir, root, tools }) {
321
+ async function dev({
322
+ port,
323
+ dir,
324
+ root,
325
+ tools
326
+ }) {
323
327
  const rootDir = root || process.cwd();
324
328
  const mastraDir = join(rootDir, dir || "src/mastra");
325
329
  const dotMastraPath = join(rootDir, ".mastra");
@@ -331,11 +335,13 @@ async function dev({ port, dir, root, tools }) {
331
335
  await bundler.prepare(dotMastraPath);
332
336
  const watcher = await bundler.watch(entryFile, dotMastraPath, discoveredTools);
333
337
  const env = await bundler.loadEnvVars();
334
- await startServer(join(dotMastraPath, "output"), port, env);
338
+ const serverOptions = await getServerOptions(entryFile, join(dotMastraPath, "output"));
339
+ const startPort = port ?? serverOptions?.port ?? 4111;
340
+ await startServer(join(dotMastraPath, "output"), startPort, env);
335
341
  watcher.on("event", (event) => {
336
342
  if (event.code === "BUNDLE_END") {
337
343
  logger.info("[Mastra Dev] - Bundling finished, restarting server...");
338
- rebundleAndRestart(dotMastraPath, port, bundler);
344
+ rebundleAndRestart(dotMastraPath, startPort, bundler);
339
345
  }
340
346
  });
341
347
  process.on("SIGINT", () => {
@@ -437,13 +443,16 @@ program.command("init").description("Initialize Mastra in your project").option(
437
443
  origin
438
444
  });
439
445
  });
440
- program.command("dev").description("Start mastra server").option("-d, --dir <dir>", "Path to your mastra folder").option("-r, --root <root>", "Path to your root folder").option("-t, --tools <toolsDirs>", "Comma-separated list of paths to tool files to include").option("-p, --port <port>", "Port number for the development server (defaults to 4111)").action((args) => {
446
+ program.command("dev").description("Start mastra server").option("-d, --dir <dir>", "Path to your mastra folder").option("-r, --root <root>", "Path to your root folder").option("-t, --tools <toolsDirs>", "Comma-separated list of paths to tool files to include").option("-p, --port <port>", "deprecated: Port number for the development server (defaults to 4111)").action((args) => {
441
447
  analytics.trackCommand({
442
448
  command: "dev",
443
449
  origin
444
450
  });
451
+ if (args?.port) {
452
+ logger.warn("The --port option is deprecated. Use the server key in the Mastra instance instead.");
453
+ }
445
454
  dev({
446
- port: args?.port ? parseInt(args.port) : 4111,
455
+ port: args?.port ? parseInt(args.port) : null,
447
456
  dir: args?.dir,
448
457
  root: args?.root,
449
458
  tools: args?.tools ? args.tools.split(",") : []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mastra",
3
- "version": "0.4.5-alpha.2",
3
+ "version": "0.4.5-alpha.5",
4
4
  "license": "ISC",
5
5
  "description": "cli for mastra",
6
6
  "type": "module",
@@ -53,8 +53,8 @@
53
53
  "yocto-spinner": "^0.1.2",
54
54
  "zod": "^3.24.2",
55
55
  "zod-to-json-schema": "^3.24.3",
56
- "@mastra/core": "^0.8.0-alpha.2",
57
- "@mastra/deployer": "^0.2.6-alpha.2"
56
+ "@mastra/core": "^0.8.0-alpha.3",
57
+ "@mastra/deployer": "^0.2.6-alpha.5"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@microsoft/api-extractor": "^7.52.1",
@@ -71,9 +71,9 @@
71
71
  "type-fest": "^4.37.0",
72
72
  "typescript": "^5.8.2",
73
73
  "vitest": "^3.0.9",
74
- "@internal/lint": "0.0.1",
75
- "@mastra/client-js": "0.1.14-alpha.2",
76
- "@mastra/playground-ui": "4.0.0-alpha.2"
74
+ "@mastra/client-js": "0.1.14-alpha.3",
75
+ "@mastra/playground-ui": "4.0.0-alpha.3",
76
+ "@internal/lint": "0.0.1"
77
77
  },
78
78
  "scripts": {
79
79
  "build": "npm-run-all --serial build:lib copy-starter-files copy-templates build:playground",