Skip to report

One mastra deploy command targets named environments

Follow Mastra’s unified deploy command into new environment commands, the Studio deploy code it reuses, and CLI telemetry that buckets target API hosts.

mastra-ai/mastra #18752 · PR by rphansen91 · Merged

mastra-ai/mastra 3b0e6167..5ecd3d62

base and head as given

  • A top-level deployment command now targets named environments.
  • Environment management entered the command-line interface.
  • Deployment telemetry now categorizes target API hosts.
  • Unified deployment now depends on environment management.
files changed
11
in a component
8
lines in components
1,261
components
6
public routes changed
0
schema statements
0
new dependencies
0
excluded by role
3
Based on 8 of 8 eligible changed files

Environment deployments

Added
Before
Top-level deploy did not exist
After
Top-level deploy targets environments

Teams can deploy to a named environment through one command. The command selects or creates the project and environment, validates build output and environment values, uploads the artifact, streams logs, and prints Studio and Server URLs.

In favour

  • In favour: Reuses existing build validation and environment-file selection

Against

  • Against: Unified deployment adds three imports from Studio

Deployment telemetry

Modified
Before
Prior behavior not established
After
Deploy telemetry buckets API hosts

Studio and Server deployments now record command outcomes, options, timing, and a coarse target API category. Target hosts are mapped to cloud, staging, localhost, custom, or unknown categories.

In favour

  • In favour: Target API telemetry uses categories, not raw hosts

The model found nothing to weigh against this.

Files changed in 6 components. Dependencies shown: 7 new, 4 unchanged
unchanged · 4new · 72 components added

7 new dependencies between components — Deploy Command → Studio Command · CLI Source → Env Commands · CLI Source → Deploy Command · Deploy Command → Analytics · Deploy Command → Env Commands · Server Command → Analytics · Studio Command → Analytics

What else could behave differently

9 components · 23 files

These components import changed code, directly or through other files. A traced dependency is a place to review, not a confirmed runtime failure.

Reached 3

ComponentSymbolCited atFilesReached by
CLI Sourcepackages/cli/src/Added 1 of 10 changed symbols reaching itpackages/cli/src/commands/deploy/index.ts:529-55211 direct
Trace path

Shortest component path from the changed symbol:

  1. Deploy Command
  2. CLI Source

Later steps follow file imports; they do not prove this symbol is called.

packages/cli/src/utils/Added 1 of 10 changed symbols reaching itpackages/cli/src/commands/deploy/index.ts:529-5521none direct · 1 at two steps
Trace path

Shortest component path from the changed symbol:

  1. Deploy Command
  2. CLI Source
  3. packages/cli/src/utils/

Later steps follow file imports; they do not prove this symbol is called.

Studio Commandpackages/cli/src/commands/studio/Added packages/cli/src/analytics/index.ts:27-3711 direct
Trace path

Shortest component path from the changed symbol:

  1. Analytics
  2. Studio Command

Later steps follow file imports; they do not prove this symbol is called.

Held back 1

ComponentFilesReached byResolution
packages/cli/src/commands/dev/2none direct · 2 at three stepsprecise

Ranked lower 5

ComponentFilesReached by
packages/cli/src/commands/server/41 direct · 1 at two steps · 2 at three steps
packages/cli/src/commands/env/22 direct
packages/cli/src/commands/deploy/11 direct
packages/cli/src/commands/actions/10none direct · 10 at two steps
packages/cli/src/commands/lint/1none direct · 1 at two steps

Statements 3

The added unifiedDeployAction was traced to 1 file in CLI source, with 17 of 17 names in its file changed. 1
packages/cli/src/commands/deploy/index.ts:529-552
The added unifiedDeployAction was traced to 1 file in CLI utilities, with 17 of 17 names in its file changed. 1
packages/cli/src/commands/deploy/index.ts:529-552
The added bucketApiHost was traced to 1 file in the studio command, with 1 of 8 names in its file changed. 1
packages/cli/src/analytics/index.ts:27-37

2 reached files belong to no component — tests, docs and config.

Routes, schema, dependencies

No public URL, no migration and no new package.

Not stated

  • 36 database accesses were found on files whose role excludes them, and no data claim states them.

Inspect components, files and symbols

Component

CLI SourceModified
packages/cli/src/

1 file · 25 lines

2 dependents

Environment deployments, added

AnalyticsModified
packages/cli/src/analytics/

1 file · 19 lines

9 dependents

The analysis found that analytics added the bucketApiHost export.

Deployment telemetry, modified

Studio CommandModified
packages/cli/src/commands/studio/

1 file · 54 lines

6 dependents

Deployment telemetry, modified

Env CommandsAdded
packages/cli/src/commands/env/

3 files · 297 lines

2 dependents

The analysis found that env added Environment, Project, createEnvironment, deleteEnvironment, fetchEnvironments, fetchProjects, and registerEnvCommands exports.

Environment deployments, added

Server CommandModified
packages/cli/src/commands/server/

1 file · 54 lines

2 dependents

Deployment telemetry, modified

Deploy CommandAdded
packages/cli/src/commands/deploy/

1 file · 812 lines

1 dependent

The analysis found that deploy added the DeployOptions and unifiedDeployAction exports.

Environment deployments, added

File

CLI Sourcepackages/cli/src/
packages/cli/src/index.ts

+25 −0

Environment deployments, added

Env Commandspackages/cli/src/commands/env/
packages/cli/src/commands/env/env.ts

+194 −0

Environment deployments, added

Env Commandspackages/cli/src/commands/env/
packages/cli/src/commands/env/platform-api.ts

+102 −0

Environment deployments, added

Env Commandspackages/cli/src/commands/env/
packages/cli/src/commands/env/index.ts

+1 −0

Environment deployments, added

Deploy Commandpackages/cli/src/commands/deploy/
packages/cli/src/commands/deploy/index.ts

+812 −0

Environment deployments, added

Analyticspackages/cli/src/analytics/
packages/cli/src/analytics/index.ts

+19 −0

Deployment telemetry, modified

Studio Commandpackages/cli/src/commands/studio/
packages/cli/src/commands/studio/deploy.ts

+40 −14

Deployment telemetry, modified

Server Commandpackages/cli/src/commands/server/
packages/cli/src/commands/server/deploy.ts

+40 −14

Deployment telemetry, modified

Function

imports what changeddownstream of it, one mark per step

unifiedDeployAction()packages/cli/src/commands/deploy/index.ts

reaches 2 components

The added unifiedDeployAction was traced to 10 files in command actions, with 17 of 17 names in its file changed. 10
packages/cli/src/commands/deploy/index.ts:529-552
The added unifiedDeployAction was traced to 2 files in the dev command, with 17 of 17 names in its file changed. 2
packages/cli/src/commands/deploy/index.ts:529-552

Environment deployments, added

bucketApiHost()packages/cli/src/analytics/index.ts

reaches 3 components

The added bucketApiHost was traced to 4 files in the server command, with 1 of 8 names in its file changed. 112
packages/cli/src/analytics/index.ts:27-37
The added bucketApiHost was traced to 1 file in the deploy command, with 1 of 8 names in its file changed. 1
packages/cli/src/analytics/index.ts:27-37
The added bucketApiHost was traced to 1 file in the lint command, with 1 of 8 names in its file changed. 1
packages/cli/src/analytics/index.ts:27-37

Deployment telemetry, modified

Diff

CLI Sourcepackages/cli/src/
packages/cli/src/index.ts

25–26, 254–272, 367–370

Environment deployments, added

Env Commandspackages/cli/src/commands/env/
packages/cli/src/commands/env/env.ts

1–194

Environment deployments, added

Env Commandspackages/cli/src/commands/env/
packages/cli/src/commands/env/platform-api.ts

1–102

Environment deployments, added

Env Commandspackages/cli/src/commands/env/
packages/cli/src/commands/env/index.ts

1–1

Environment deployments, added

Deploy Commandpackages/cli/src/commands/deploy/
packages/cli/src/commands/deploy/index.ts

1–812

Environment deployments, added

Analyticspackages/cli/src/analytics/
packages/cli/src/analytics/index.ts

20–38

Deployment telemetry, modified

Studio Commandpackages/cli/src/commands/studio/
packages/cli/src/commands/studio/deploy.ts

10–12, 16–16, 365–400

Deployment telemetry, modified

Server Commandpackages/cli/src/commands/server/
packages/cli/src/commands/server/deploy.ts

9–11, 15–15, 328–363

Deployment telemetry, modified

Analysis scope

11651 → 6
  1. 11,651
    files at head
  2. 704
    components
  3. 6
    changed by this change

Where the new files landed

4 new files
New fileBelongs toUsed byCallsServes
packages/cli/src/commands/env/3 new files
Env Commandsnew territory
CLI SourceDeploy Command
packages/cli/src/commands/auth/
packages/cli/src/commands/deploy/index.ts
Deploy Commandnew territory
CLI Source
Analyticspackages/cli/src/commands/packages/cli/src/commands/auth/Env CommandsStudio Commandpackages/cli/src/utils/

1 added file carries no component — 1 docs.

6components changed
4reached, not changed
2components added/removed
11dependencies added between components
0dependencies removed between components
0files moved to another path

11 files changed, 18 claims stated. 9 components reached in total.

naming: “model

narrative: “model

analyzer 0.2.0, config v1.9.0-phase8

Every line above is derived from 3b0e6167..5ecd3d62 and nothing else.