mastra 0.2.0-alpha.141 → 0.2.0-alpha.146

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
@@ -1,34 +1,28 @@
1
1
  #! /usr/bin/env node
2
2
  import { PosthogAnalytics } from './chunk-K5HPNH5H.js';
3
3
  export { PosthogAnalytics } from './chunk-K5HPNH5H.js';
4
- import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, logger, FileService } from './chunk-EY6ROB2P.js';
5
- export { create } from './chunk-EY6ROB2P.js';
4
+ import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, FileService, logger } from './chunk-AKW5JN32.js';
5
+ export { create } from './chunk-AKW5JN32.js';
6
6
  import { Command } from 'commander';
7
- import color from 'picocolors';
8
- import path4, { join, dirname } from 'node:path';
9
- import { MastraBundler } from '@mastra/core/bundler';
10
- import { getDeployer, FileService as FileService$1, getBundler, getWatcher } from '@mastra/deployer';
11
- import virtual from '@rollup/plugin-virtual';
12
- import * as fsExtra from 'fs-extra';
7
+ import 'picocolors';
8
+ import { join, dirname } from 'node:path';
9
+ import { FileService as FileService$1, getWatcherInputOptions, createWatcher } from '@mastra/deployer/build';
10
+ import { Bundler } from '@mastra/deployer/bundler';
11
+ import * as fsExtra2 from 'fs-extra';
13
12
  import { readFileSync } from 'node:fs';
14
13
  import { fileURLToPath as fileURLToPath$1 } from 'node:url';
15
- import path2, { join as join$1 } from 'path';
14
+ import { getDeployer, FileService as FileService$2 } from '@mastra/deployer';
15
+ import { join as join$1 } from 'path';
16
16
  import 'child_process';
17
- import { execa, ExecaError } from 'execa';
18
- import fs, { writeFileSync } from 'fs';
17
+ import { execa } from 'execa';
18
+ import { writeFileSync } from 'fs';
19
19
  import { fileURLToPath } from 'url';
20
- import * as p from '@clack/prompts';
21
- import { spinner as spinner$1, intro, note } from '@clack/prompts';
22
- import yoctoSpinner from 'yocto-spinner';
23
- import { check } from 'tcp-port-used';
24
- import dotenv from 'dotenv';
20
+ import { MastraBundler } from '@mastra/core/bundler';
21
+ import 'dotenv';
25
22
 
26
- var BuildBundler = class extends MastraBundler {
23
+ var BuildBundler = class extends Bundler {
27
24
  constructor() {
28
- super({
29
- name: "Build",
30
- component: "BUNDLER"
31
- });
25
+ super("Build");
32
26
  }
33
27
  getEnvFiles() {
34
28
  const possibleFiles = [".env.production", ".env"];
@@ -41,25 +35,16 @@ var BuildBundler = class extends MastraBundler {
41
35
  return Promise.resolve([]);
42
36
  }
43
37
  async prepare(outputDirectory) {
44
- await fsExtra.ensureDir(outputDirectory);
45
- await fsExtra.emptyDir(outputDirectory);
38
+ await super.prepare(outputDirectory);
46
39
  const __filename2 = fileURLToPath$1(import.meta.url);
47
40
  const __dirname = dirname(__filename2);
48
- const playgroundServePath = join(outputDirectory, "playground");
49
- await fsExtra.copy(join(dirname(__dirname), "src/playground/dist"), playgroundServePath, {
41
+ const playgroundServePath = join(outputDirectory, this.outputDir, "playground");
42
+ await fsExtra2.copy(join(dirname(__dirname), "src/playground/dist"), playgroundServePath, {
50
43
  overwrite: true
51
44
  });
52
45
  }
53
- async bundle(mastraDir, outputDirectory) {
54
- const bundler = await getBundler({
55
- input: "#entry",
56
- plugins: [virtual({ "#entry": this.getEntry() })]
57
- });
58
- await bundler.write({
59
- file: `${outputDirectory}/index.mjs`,
60
- format: "es",
61
- inlineDynamicImports: true
62
- });
46
+ bundle(entryFile, outputDirectory) {
47
+ return this._bundle(this.getEntry(), entryFile, outputDirectory);
63
48
  }
64
49
  getEntry() {
65
50
  const __filename2 = fileURLToPath$1(import.meta.url);
@@ -73,21 +58,29 @@ async function build({ dir }) {
73
58
  const mastraDir = dir ?? process.cwd();
74
59
  const outputDirectory = join(mastraDir, ".mastra");
75
60
  const deployer = new BuildBundler();
61
+ const fs2 = new FileService();
62
+ const mastraEntryFile = fs2.getFirstExistingFile([
63
+ join(mastraDir, "src", "mastra", "index.ts"),
64
+ join(mastraDir, "src", "mastra", "index.js")
65
+ ]);
66
+ console.log(join(mastraDir, "index.ts"), join(mastraDir, "index.js"));
76
67
  await deployer.prepare(outputDirectory);
77
- await deployer.bundle(mastraDir, outputDirectory);
68
+ await deployer.bundle(mastraEntryFile, outputDirectory);
78
69
  }
79
70
  async function deploy({ dir }) {
80
71
  let mastraDir = dir || join$1(process.cwd(), "src/mastra");
81
72
  try {
82
73
  const outputDirectory = join$1(process.cwd(), ".mastra");
83
- const deployer = await getDeployer(mastraDir, outputDirectory);
74
+ const fs2 = new FileService();
75
+ const mastraEntryFile = fs2.getFirstExistingFile([join$1(mastraDir, "index.ts"), join$1(mastraDir, "index.js")]);
76
+ const deployer = await getDeployer(mastraEntryFile, outputDirectory);
84
77
  if (!deployer) {
85
78
  logger.warn("No deployer found.");
86
79
  return;
87
80
  }
88
81
  try {
89
82
  await deployer.prepare(outputDirectory);
90
- await deployer.bundle(mastraDir, outputDirectory);
83
+ await deployer.bundle(mastraEntryFile, outputDirectory);
91
84
  try {
92
85
  await deployer.deploy(outputDirectory);
93
86
  } catch (error) {
@@ -106,45 +99,59 @@ async function deploy({ dir }) {
106
99
  }
107
100
  }
108
101
  var DevBundler = class extends MastraBundler {
109
- constructor() {
102
+ mastraDir;
103
+ constructor(mastraDir) {
110
104
  super({
111
105
  name: "Dev",
112
106
  component: "BUNDLER"
113
107
  });
108
+ this.mastraDir = mastraDir;
114
109
  }
115
110
  getEnvFiles() {
116
111
  const possibleFiles = [".env.development", ".env"];
117
112
  try {
118
- const fileService = new FileService$1();
113
+ const fileService = new FileService$2();
119
114
  const envFile = fileService.getFirstExistingFile(possibleFiles);
120
115
  return Promise.resolve([envFile]);
121
116
  } catch (err) {
122
117
  }
123
118
  return Promise.resolve([]);
124
119
  }
120
+ async writePackageJson() {
121
+ }
125
122
  async prepare(outputDirectory) {
126
- await fsExtra.ensureDir(outputDirectory);
127
- await fsExtra.emptyDir(outputDirectory);
123
+ await fsExtra2.ensureDir(outputDirectory);
124
+ await fsExtra2.emptyDir(outputDirectory);
128
125
  const __filename2 = fileURLToPath$1(import.meta.url);
129
126
  const __dirname = dirname(__filename2);
130
127
  const playgroundServePath = join(outputDirectory, "playground");
131
- await fsExtra.copy(join(dirname(__dirname), "src/playground/dist"), playgroundServePath, {
128
+ await fsExtra2.copy(join(dirname(__dirname), "src/playground/dist"), playgroundServePath, {
132
129
  overwrite: true
133
130
  });
134
131
  }
135
132
  async watch(outputDirectory) {
136
- const watcher = await getWatcher({
137
- ...this.getInputOptions(),
138
- // @ts-ignore
139
- output: {
140
- dir: outputDirectory,
141
- format: "es",
142
- entryFileNames: "[name].mjs"
133
+ const __filename2 = fileURLToPath$1(import.meta.url);
134
+ const __dirname = dirname(__filename2);
135
+ const fileService = new FileService$2();
136
+ const entryFile = fileService.getFirstExistingFile([
137
+ join(this.mastraDir, "index.ts"),
138
+ join(this.mastraDir, "index.js")
139
+ ]);
140
+ const inputOptions = await getWatcherInputOptions(entryFile, "node");
141
+ const watcher = await createWatcher(
142
+ {
143
+ ...inputOptions,
144
+ input: {
145
+ index: join(__dirname, "templates", "dev.entry.js")
146
+ },
147
+ watch: {
148
+ include: await this.getEnvFiles()
149
+ }
143
150
  },
144
- watch: {
145
- include: await this.getEnvFiles()
151
+ {
152
+ dir: outputDirectory
146
153
  }
147
- });
154
+ );
148
155
  this.logger.info("Starting watcher...");
149
156
  return new Promise((resolve, reject) => {
150
157
  const cb = (event) => {
@@ -154,6 +161,7 @@ var DevBundler = class extends MastraBundler {
154
161
  resolve(watcher);
155
162
  }
156
163
  if (event.code === "ERROR") {
164
+ console.log(event);
157
165
  this.logger.error("Bundling failed, stopping watcher...");
158
166
  watcher.off("event", cb);
159
167
  reject(event);
@@ -164,19 +172,6 @@ var DevBundler = class extends MastraBundler {
164
172
  }
165
173
  async bundle() {
166
174
  }
167
- getEntry() {
168
- const __filename2 = fileURLToPath$1(import.meta.url);
169
- const __dirname = dirname(__filename2);
170
- return readFileSync(join(__dirname, "templates", "dev.entry.js"), "utf8");
171
- }
172
- getInputOptions() {
173
- return {
174
- input: {
175
- index: "#entry"
176
- },
177
- plugins: [virtual({ "#entry": this.getEntry() })]
178
- };
179
- }
180
175
  };
181
176
 
182
177
  // src/commands/dev/dev.ts
@@ -250,9 +245,9 @@ async function rebundleAndRestart(dotMastraPath, port, bundler) {
250
245
  }
251
246
  async function dev({ port, dir, root }) {
252
247
  const rootDir = root || process.cwd();
253
- join$1(rootDir, dir || "src/mastra");
248
+ const mastraDir = join$1(rootDir, dir || "src/mastra");
254
249
  const dotMastraPath = join$1(rootDir, ".mastra");
255
- const bundler = new DevBundler();
250
+ const bundler = new DevBundler(mastraDir);
256
251
  const env = await bundler.loadEnvVars();
257
252
  await bundler.prepare(dotMastraPath);
258
253
  writeFileSync(join$1(dotMastraPath, "evals.json"), ``);
@@ -273,357 +268,6 @@ async function dev({ port, dir, root }) {
273
268
  process.exit(0);
274
269
  });
275
270
  }
276
- var DockerService = class {
277
- sanitizeName(name) {
278
- let sanitized = name.toLowerCase();
279
- sanitized = sanitized.replace(/[^a-z0-9-]/g, "-");
280
- sanitized = sanitized.replace(/^-+|-+$/g, "");
281
- if (sanitized.length < 2) {
282
- throw new Error("Name must be at least 2 characters long.");
283
- }
284
- if (sanitized.length > 255) {
285
- sanitized = sanitized.substring(0, 255);
286
- }
287
- return sanitized;
288
- }
289
- async isPortOpen(port) {
290
- return new Promise((resolve) => {
291
- check(port).then((inUse) => {
292
- resolve(!inUse);
293
- });
294
- });
295
- }
296
- async provision(projectName) {
297
- const sanitizedProjectName = this.sanitizeName(projectName);
298
- const { postgresPort } = await this.getInfraPorts();
299
- try {
300
- if (!await this.checkDockerRunning()) {
301
- throw new Error("Docker Daemon is not running. Please start Docker and try again\n");
302
- }
303
- const { dbUrl } = await this.prepareComposeFile({
304
- sanitizedProjectName,
305
- postgresPort
306
- });
307
- return { dbUrl };
308
- } catch (error) {
309
- throw error;
310
- }
311
- }
312
- async getNextOpenPort(startFrom = 2222) {
313
- for (const port of Array.from({ length: 20 }, (_, i) => startFrom + i)) {
314
- const isOpen = await this.isPortOpen(port);
315
- if (isOpen) {
316
- return port;
317
- }
318
- }
319
- throw new Error("No open ports found after 20 attempts");
320
- }
321
- async getInfraPorts({
322
- defaultPostgresPort
323
- } = {}) {
324
- let postgresPort = defaultPostgresPort || 5432;
325
- const dbPortOpen = await this.isPortOpen(postgresPort);
326
- if (!dbPortOpen) {
327
- postgresPort = await this.getNextOpenPort(postgresPort);
328
- }
329
- return { postgresPort };
330
- }
331
- async checkDockerRunning() {
332
- try {
333
- await execa("docker", ["info"], { stdio: "ignore", shell: true });
334
- return true;
335
- } catch (error) {
336
- return false;
337
- }
338
- }
339
- async startDockerContainer(dockerComposeFile) {
340
- try {
341
- await execa("docker", ["compose", "-f", dockerComposeFile, "up", "-d"], { stdio: "inherit" });
342
- return true;
343
- } catch (error) {
344
- return false;
345
- }
346
- }
347
- async stopDockerContainer(dockerComposeFile) {
348
- try {
349
- await execa("docker", ["compose", "-f", dockerComposeFile, "down"], { stdio: "inherit" });
350
- return true;
351
- } catch (error) {
352
- return false;
353
- }
354
- }
355
- async prepareComposeFile({
356
- sanitizedProjectName,
357
- postgresPort
358
- }) {
359
- let dbUrl = `postgresql://postgres:postgres@localhost:${postgresPort}/mastra`;
360
- this.editComposeFile({ sanitizedProjectName, postgresPort });
361
- const fileService = new FileService();
362
- await fileService.copyStarterFile("mastra-pg.docker-compose.yaml", "mastra-pg.docker-compose.yaml");
363
- return { dbUrl: String(dbUrl) };
364
- }
365
- editComposeFile({
366
- sanitizedProjectName,
367
- postgresPort
368
- }) {
369
- const __filename2 = fileURLToPath(import.meta.url);
370
- const __dirname = path2.dirname(__filename2);
371
- const filePath = path2.resolve(__dirname, "starter-files", "mastra-pg.docker-compose.yaml");
372
- const fileService = new FileService();
373
- fileService.replaceValuesInFile({
374
- filePath,
375
- replacements: [
376
- { replace: sanitizedProjectName, search: "REPLACE_PROJECT_NAME" },
377
- { replace: `${postgresPort}`, search: "REPLACE_DB_PORT" }
378
- ]
379
- });
380
- }
381
- getComposeFile(composePath) {
382
- const fileService = new FileService();
383
- let composeFile;
384
- if (composePath) {
385
- if (!fs.existsSync(composePath)) {
386
- throw new Error(`Docker compose file not found: ${composePath}`);
387
- }
388
- composeFile = composePath;
389
- } else {
390
- composeFile = fileService.getFirstExistingFile([
391
- "mastra-pg.docker-compose.yaml",
392
- "mastra-pg.docker-compose.yml",
393
- "docker-compose.yaml",
394
- "docker-compose.yml"
395
- ]);
396
- }
397
- return composeFile;
398
- }
399
- };
400
-
401
- // src/commands/engine/add.ts
402
- var DOCKER_COMPOSE_FILE = "mastra-pg.docker-compose.yaml";
403
- async function add() {
404
- const spinner3 = yoctoSpinner();
405
- try {
406
- await checkAndInstallEngineDeps();
407
- const depsService2 = new DepsService();
408
- const projectName = await depsService2.getProjectName();
409
- const dockerService = new DockerService();
410
- spinner3.start("Provisioning Mastra database");
411
- const { dbUrl } = await dockerService.provision(projectName);
412
- spinner3.success("Mastra database provisioned");
413
- spinner3.start("Starting Mastra engine");
414
- dockerService.startDockerContainer(DOCKER_COMPOSE_FILE);
415
- spinner3.success("Mastra engine started");
416
- const fileService = new FileService();
417
- await fileService.setupEnvFile({ dbUrl });
418
- spinner3.success("Mastra engine setup complete");
419
- } catch (error) {
420
- spinner3.error("Failed to start Mastra engine");
421
- throw error;
422
- }
423
- }
424
- async function checkAndInstallEngineDeps() {
425
- const depsService2 = new DepsService();
426
- const depCheck = await depsService2.checkDependencies(["@mastra/engine", "drizzle-kit"]);
427
- if (depCheck !== "ok") {
428
- await installEngineDeps();
429
- }
430
- }
431
- async function installEngineDeps() {
432
- const spinner3 = yoctoSpinner({ text: "Installing Mastra engine dependencies\n" });
433
- try {
434
- const confirm2 = await p.confirm({
435
- message: "Do you want to install the required dependencies (@mastra/engine and drizzle-kit)?",
436
- initialValue: false
437
- });
438
- if (p.isCancel(confirm2)) {
439
- p.cancel("Installation Cancelled");
440
- process.exit(0);
441
- }
442
- if (!confirm2) {
443
- p.cancel("Installation Cancelled");
444
- process.exit(0);
445
- }
446
- const depsService2 = new DepsService();
447
- spinner3.start();
448
- await depsService2.installPackages(["@mastra/engine@alpha", "drizzle-kit"]);
449
- spinner3.success("Dependencies installed successfully");
450
- } catch (err) {
451
- spinner3.error("Could not install dependencies");
452
- console.error(err);
453
- }
454
- }
455
- async function down(composePath) {
456
- const spinner3 = yoctoSpinner({ text: "Shutting down docker container\n" });
457
- spinner3.start();
458
- try {
459
- const dockerService = new DockerService();
460
- const composeFile = dockerService.getComposeFile(composePath);
461
- await dockerService.stopDockerContainer(composeFile);
462
- spinner3.success("Docker container shut down successfully\n");
463
- } catch (error) {
464
- spinner3.error("Failed to shut down Docker container\n");
465
- throw error;
466
- }
467
- }
468
- function getEnginePath() {
469
- const possibleEnginePaths = [
470
- path2.resolve(process.cwd(), "node_modules", "@mastra/engine"),
471
- path2.resolve(process.cwd(), "..", "node_modules", "@mastra/engine"),
472
- path2.resolve(process.cwd(), "..", "..", "node_modules", "@mastra/engine"),
473
- path2.resolve(process.cwd(), "./packages/engine")
474
- // For CI
475
- ];
476
- const fileService = new FileService();
477
- return fileService.getFirstExistingFile(possibleEnginePaths);
478
- }
479
-
480
- // src/commands/engine/generate.ts
481
- var spinner = yoctoSpinner({ text: "Generating drizzle client\n" });
482
- var checkDrizzleInstallation = async () => {
483
- const depsService2 = new DepsService();
484
- if (await depsService2.checkDependencies(["drizzle-kit"]) === "ok") {
485
- return true;
486
- } else {
487
- return false;
488
- }
489
- };
490
- var installDrizzleKit = async () => {
491
- const depsService2 = new DepsService();
492
- await depsService2.installPackages(["drizzle-kit"]);
493
- };
494
- async function generate(dbUrl) {
495
- try {
496
- spinner.start();
497
- const isDrizzleInstalled = await checkDrizzleInstallation();
498
- if (!isDrizzleInstalled) {
499
- spinner.text = "Installing drizzle kit\n";
500
- await installDrizzleKit();
501
- }
502
- await generateDrizzleClient(dbUrl);
503
- spinner.success("Drizzle client generated\n");
504
- } catch (err) {
505
- spinner.error("Could not generate drizzle client\n");
506
- console.error(err);
507
- }
508
- }
509
- async function generateDrizzleClient(dbUrl) {
510
- const enginePath = getEnginePath();
511
- try {
512
- await execa(
513
- `npx drizzle-kit generate --out=./dist/postgres/drizzle --dialect=postgresql --schema=./dist/postgres/db/schema.js`,
514
- {
515
- env: {
516
- ...process.env,
517
- DB_URL: dbUrl
518
- },
519
- cwd: enginePath,
520
- shell: true,
521
- all: true,
522
- stdio: "inherit"
523
- // inherit will pipe directly to parent process stdout/stderr
524
- }
525
- );
526
- } catch (err) {
527
- throw err;
528
- }
529
- }
530
- var s = spinner$1();
531
- async function migrate(dbUrl) {
532
- intro(`${color.bgCyan(color.black(" Mastra migrate "))}`);
533
- s.start("Migrating Database\n");
534
- try {
535
- await checkPostgresReady(dbUrl);
536
- s.stop();
537
- note("Migration complete! Your project is ready to go.");
538
- process.exit(0);
539
- } catch (error) {
540
- s.stop("Could not migrate database");
541
- if (error instanceof ExecaError) {
542
- console.error("error");
543
- } else {
544
- console.log(`Error: ${error.message}`);
545
- }
546
- process.exit(1);
547
- }
548
- }
549
- async function _migrate(dbUrl, swallow = false) {
550
- const enginePath = getEnginePath();
551
- const stdioMode = swallow ? "pipe" : "inherit";
552
- const newPath = path2.join(enginePath, "dist", "postgres", "migrate.js");
553
- const subprocess = execa(`node`, [`${newPath}`], {
554
- env: {
555
- ...process.env,
556
- DB_URL: dbUrl
557
- },
558
- shell: true,
559
- all: true,
560
- stdio: ["pipe", stdioMode, stdioMode],
561
- timeout: 6e4
562
- });
563
- subprocess.stdout?.pipe(process.stdout);
564
- if (subprocess.stdin) {
565
- subprocess.on("spawn", () => {
566
- const responses = ["y\n", "yes\n"];
567
- const respondToPrompts = setInterval(() => {
568
- if (subprocess.stdin && !subprocess.stdin.destroyed) {
569
- responses.forEach((response) => {
570
- subprocess.stdin.write(response);
571
- });
572
- }
573
- }, 100);
574
- subprocess.on("exit", () => {
575
- clearInterval(respondToPrompts);
576
- subprocess.stdin?.end();
577
- });
578
- });
579
- }
580
- try {
581
- const { stdout, stderr } = await subprocess;
582
- return { stdout: stdout || "", stderr: stderr || "" };
583
- } catch (error) {
584
- if (error.killed && error.timedOut) {
585
- throw new Error(`Command timed out after 60000ms`);
586
- }
587
- throw error;
588
- }
589
- }
590
- async function checkPostgresReady(dbUrl) {
591
- for (let i = 0; i < 10; i++) {
592
- try {
593
- await _migrate(dbUrl);
594
- return true;
595
- } catch (error) {
596
- if (error instanceof Error) {
597
- console.error(error.message);
598
- }
599
- console.log(`Waiting for postgres to be ready, attempt ${i + 1} of 10`);
600
- }
601
- await new Promise((resolve) => setTimeout(resolve, 1e3));
602
- }
603
- throw new Error("Postgres is not ready, aborting");
604
- }
605
- async function up(composePath) {
606
- const spinner3 = yoctoSpinner({ text: "Starting docker container\n" });
607
- spinner3.start();
608
- try {
609
- const dockerService = new DockerService();
610
- const composeFile = dockerService.getComposeFile(composePath);
611
- await dockerService.startDockerContainer(composeFile);
612
- spinner3.success("Docker containers started successfully\n");
613
- } catch (error) {
614
- spinner3.error("Failed to start Docker containers\n");
615
- throw error;
616
- }
617
- }
618
- function getEnv() {
619
- const projectDir = process.cwd();
620
- const dotenvPath = path4.join(projectDir, ".env.development");
621
- if (fs.existsSync(dotenvPath)) {
622
- dotenv.config({ path: dotenvPath });
623
- }
624
- const dbUrl = process.env.DB_URL || "";
625
- return dbUrl;
626
- }
627
271
 
628
272
  // src/index.ts
629
273
  var depsService = new DepsService();
@@ -711,60 +355,6 @@ program.command("dev").description("Start mastra server").option("-d, --dir <dir
711
355
  root: args?.root
712
356
  });
713
357
  });
714
- var engine = program.command("engine").description("Manage the mastra engine");
715
- engine.command("add").description("Add the mastra engine to your application").action(async () => {
716
- await analytics.trackCommandExecution({
717
- command: "engine add",
718
- args: {},
719
- execution: async () => {
720
- await add();
721
- }
722
- });
723
- });
724
- engine.command("generate").description("Generate types and drizzle client").action(async () => {
725
- await analytics.trackCommandExecution({
726
- command: "engine generate",
727
- args: {},
728
- execution: async () => {
729
- await generate(process.env.DB_URL);
730
- }
731
- });
732
- });
733
- engine.command("up").description("Runs docker-compose up to start docker containers").option("-f, --file <path>", "Path to docker-compose file").action(async (args) => {
734
- await analytics.trackCommandExecution({
735
- command: "engine up",
736
- args,
737
- execution: async () => {
738
- await up(args.file);
739
- }
740
- });
741
- });
742
- engine.command("down").description("Runs docker-compose down to shut down docker containers").option("-f, --file <path>", "Path to docker-compose file").action(async (args) => {
743
- await analytics.trackCommandExecution({
744
- command: "engine down",
745
- args: {},
746
- execution: async () => {
747
- await down(args.file);
748
- }
749
- });
750
- });
751
- engine.command("migrate").description("Migrate the Mastra database forward").action(async () => {
752
- await analytics.trackCommandExecution({
753
- command: "engine migrate",
754
- args: {},
755
- execution: async () => {
756
- const dbUrl = getEnv();
757
- if (dbUrl) {
758
- await migrate(dbUrl);
759
- } else {
760
- logger.debug("Please add DB_URL to your .env.development file");
761
- logger.debug(
762
- `Run ${color.blueBright("mastra engine add")} to get started with a Postgres DB in a docker container`
763
- );
764
- }
765
- }
766
- });
767
- });
768
358
  program.command("build").description("Build your Mastra project").option("-d, --dir <path>", "Path to directory").action(async (args) => {
769
359
  await analytics.trackCommandExecution({
770
360
  command: "mastra build",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mastra",
3
- "version": "0.2.0-alpha.141",
3
+ "version": "0.2.0-alpha.146",
4
4
  "license": "MIT",
5
5
  "description": "cli for mastra",
6
6
  "type": "module",
@@ -36,7 +36,6 @@
36
36
  "dependencies": {
37
37
  "@clack/prompts": "^0.8.2",
38
38
  "@dagrejs/dagre": "^1.1.4",
39
- "@rollup/plugin-virtual": "^3.0.2",
40
39
  "@swc/core": "^1.9.3",
41
40
  "chokidar": "^4.0.3",
42
41
  "commander": "^12.1.0",
@@ -56,7 +55,7 @@
56
55
  "yocto-spinner": "^0.1.1",
57
56
  "zod": "^3.24.1",
58
57
  "zod-to-json-schema": "^3.24.1",
59
- "@mastra/core": "^0.2.0-alpha.88",
58
+ "@mastra/core": "^0.2.0-alpha.92",
60
59
  "@mastra/deployer": "^0.1.0-alpha.34"
61
60
  },
62
61
  "devDependencies": {