mastra 0.4.3 → 0.4.4-alpha.1

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.
@@ -1,3 +1,4 @@
1
+ type CLI_ORIGIN = 'mastra-cloud' | 'oss';
1
2
  declare class PosthogAnalytics {
2
3
  private sessionId;
3
4
  private client?;
@@ -20,13 +21,15 @@ declare class PosthogAnalytics {
20
21
  durationMs?: number;
21
22
  status?: 'success' | 'error';
22
23
  error?: string;
24
+ origin?: CLI_ORIGIN;
23
25
  }): void;
24
- trackCommandExecution<T>({ command, args, execution, }: {
26
+ trackCommandExecution<T>({ command, args, execution, origin, }: {
25
27
  command: string;
26
28
  args: Record<string, unknown>;
27
29
  execution: () => Promise<T>;
30
+ origin?: CLI_ORIGIN;
28
31
  }): Promise<T>;
29
32
  shutdown(): Promise<void>;
30
33
  }
31
34
 
32
- export { PosthogAnalytics };
35
+ export { type CLI_ORIGIN, PosthogAnalytics };
@@ -1 +1 @@
1
- export { PosthogAnalytics } from '../chunk-SLGHDOYI.js';
1
+ export { PosthogAnalytics } from '../chunk-SDQ6DRUS.js';
@@ -119,7 +119,8 @@ var PosthogAnalytics = class {
119
119
  event: "cli_command",
120
120
  properties: {
121
121
  ...this.getSystemProperties(),
122
- ...commandData
122
+ ...commandData,
123
+ origin: options?.origin || "oss"
123
124
  }
124
125
  });
125
126
  } catch {
@@ -129,7 +130,8 @@ var PosthogAnalytics = class {
129
130
  async trackCommandExecution({
130
131
  command,
131
132
  args,
132
- execution
133
+ execution,
134
+ origin
133
135
  }) {
134
136
  const startTime = process.hrtime();
135
137
  try {
@@ -140,7 +142,8 @@ var PosthogAnalytics = class {
140
142
  command,
141
143
  args,
142
144
  durationMs,
143
- status: "success"
145
+ status: "success",
146
+ origin
144
147
  });
145
148
  return result;
146
149
  } catch (error) {
@@ -151,7 +154,8 @@ var PosthogAnalytics = class {
151
154
  args,
152
155
  durationMs,
153
156
  status: "error",
154
- error: error instanceof Error ? error.message : String(error)
157
+ error: error instanceof Error ? error.message : String(error),
158
+ origin
155
159
  });
156
160
  throw error;
157
161
  }
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #! /usr/bin/env node
2
- import { PosthogAnalytics } from './chunk-SLGHDOYI.js';
3
- export { PosthogAnalytics } from './chunk-SLGHDOYI.js';
2
+ import { PosthogAnalytics } from './chunk-SDQ6DRUS.js';
3
+ export { PosthogAnalytics } from './chunk-SDQ6DRUS.js';
4
4
  import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, logger, FileService as FileService$1 } from './chunk-4QQ2IFQI.js';
5
5
  export { create } from './chunk-4QQ2IFQI.js';
6
6
  import { Command } from 'commander';
@@ -14,6 +14,7 @@ import { join } from 'path';
14
14
  import { FileService, getDeployer } from '@mastra/deployer';
15
15
  import { execa } from 'execa';
16
16
  import { stat } from 'node:fs/promises';
17
+ import { config } from 'dotenv';
17
18
 
18
19
  var BuildBundler = class extends Bundler {
19
20
  constructor() {
@@ -346,8 +347,6 @@ async function dev({ port, dir, root, tools }) {
346
347
  process.exit(0);
347
348
  });
348
349
  }
349
-
350
- // src/index.ts
351
350
  var depsService = new DepsService();
352
351
  var version = await depsService.getPackageVersion();
353
352
  var analytics = new PosthogAnalytics({
@@ -356,10 +355,12 @@ var analytics = new PosthogAnalytics({
356
355
  version
357
356
  });
358
357
  var program = new Command();
358
+ var origin = process.env.MASTRA_ANALYTICS_ORIGIN;
359
359
  program.version(`${version}`, "-v, --version").description(`Mastra CLI ${version}`).action(() => {
360
360
  try {
361
361
  analytics.trackCommand({
362
- command: "version"
362
+ command: "version",
363
+ origin
363
364
  });
364
365
  console.log(`Mastra CLI: ${version}`);
365
366
  } catch {
@@ -391,7 +392,8 @@ program.command("create").description("Create a new Mastra project").option("--d
391
392
  timeout,
392
393
  projectName: args.projectName
393
394
  });
394
- }
395
+ },
396
+ origin
395
397
  });
396
398
  });
397
399
  program.command("init").description("Initialize Mastra in your project").option("--default", "Quick start with defaults(src, OpenAI, no examples)").option("-d, --dir <directory>", "Directory for Mastra files to (defaults to src/)").option("-c, --components <components>", "Comma-separated list of components (agents, tools, workflows)").option("-l, --llm <model-provider>", "Default model provider (openai, anthropic, or groq))").option("-k, --llm-api-key <api-key>", "API key for the model provider").option("-e, --example", "Include example code").action(async (args) => {
@@ -427,12 +429,14 @@ program.command("init").description("Initialize Mastra in your project").option(
427
429
  llmApiKey: args["llm-api-key"]
428
430
  });
429
431
  return;
430
- }
432
+ },
433
+ origin
431
434
  });
432
435
  });
433
436
  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) => {
434
437
  analytics.trackCommand({
435
- command: "dev"
438
+ command: "dev",
439
+ origin
436
440
  });
437
441
  dev({
438
442
  port: args?.port ? parseInt(args.port) : 4111,
@@ -449,16 +453,19 @@ program.command("build").description("Build your Mastra project").option("-d, --
449
453
  args,
450
454
  execution: async () => {
451
455
  await build({ dir: args.dir });
452
- }
456
+ },
457
+ origin
453
458
  });
454
459
  });
455
460
  program.command("deploy").description("Deploy your Mastra project").option("-d, --dir <path>", "Path to directory").action(async (args) => {
461
+ config({ path: [".env", ".env.production"] });
456
462
  await analytics.trackCommandExecution({
457
463
  command: "mastra deploy",
458
464
  args,
459
465
  execution: async () => {
460
466
  await deploy({ dir: args.dir });
461
- }
467
+ },
468
+ origin
462
469
  });
463
470
  });
464
471
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mastra",
3
- "version": "0.4.3",
3
+ "version": "0.4.4-alpha.1",
4
4
  "license": "ISC",
5
5
  "description": "cli for mastra",
6
6
  "type": "module",
@@ -55,28 +55,27 @@
55
55
  "yocto-spinner": "^0.1.2",
56
56
  "zod": "^3.24.2",
57
57
  "zod-to-json-schema": "^3.24.3",
58
- "@mastra/core": "^0.6.4",
59
- "@mastra/deployer": "^0.2.4"
58
+ "@mastra/core": "^0.7.0-alpha.1",
59
+ "@mastra/deployer": "^0.2.5-alpha.1"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@microsoft/api-extractor": "^7.52.1",
63
- "@types/express": "^5.0.0",
64
63
  "@types/fs-extra": "^11.0.4",
65
- "@types/node": "^22.13.10",
64
+ "@types/node": "^20.17.27",
66
65
  "@types/prompt": "^1.1.9",
67
66
  "@types/tcp-port-used": "^1.0.4",
68
67
  "cpy-cli": "^5.0.0",
69
- "eslint": "^9.22.0",
68
+ "eslint": "^9.23.0",
70
69
  "memfs": "^4.17.0",
71
- "npm-run-all2": "^5.0.0",
70
+ "npm-run-all2": "^7.0.2",
72
71
  "rollup": "^4.35.0",
73
72
  "tsup": "^8.4.0",
74
73
  "type-fest": "^4.37.0",
75
74
  "typescript": "^5.8.2",
76
- "vitest": "^3.0.8",
77
- "@mastra/playground-ui": "2.0.4",
78
- "@mastra/client-js": "0.1.12",
79
- "@internal/lint": "0.0.1"
75
+ "vitest": "^3.0.9",
76
+ "@internal/lint": "0.0.1",
77
+ "@mastra/playground-ui": "3.0.0-alpha.1",
78
+ "@mastra/client-js": "0.1.13-alpha.1"
80
79
  },
81
80
  "scripts": {
82
81
  "build": "npm-run-all --serial build:lib copy-starter-files copy-templates build:playground",