跳到主要内容
非官方简体中文翻译,内容版权归 Mastra 所有,遵循 Apache-2.0 许可。

CLI

The CLI has been simplified by removing deployment commands, configuration flags, and starter files. A new migration command has been added to help with database schema upgrades.

Added
Added的直接链接

mastra migrate command
mastra-migrate-command的直接链接

A new mastra migrate command helps run database migrations when upgrading Mastra versions. This is particularly useful when upgrading from older versions that may have data incompatibilities.

npx mastra migrate

The command bundles your project and connects to your configured storage before running any necessary migrations. It currently supports migrating duplicate span entries that may prevent unique constraint creation.

See the Storage migration guide for details on when this migration is needed.

Removed
Removed的直接链接

mastra deploy command
mastra-deploy-command的直接链接

The mastra deploy command has been removed from the CLI. This change simplifies the CLI by removing vendor-specific deployment logic.

To migrate, choose one of the deployment platforms of your choice.

--env flag from mastra build
--env-flag-from-mastra-build的直接链接

The --env flag has been removed from the mastra build command. This change simplifies the build command.

To migrate, use mastra start --env <env> to start the build output with a custom environment.

- mastra build --env production
+ mastra build
+ mastra start --env production

--port flag from mastra dev
--port-flag-from-mastra-dev的直接链接

The --port flag has been removed from the mastra dev command. Port configuration is now handled through the Mastra instance configuration. This change centralizes port configuration.

To migrate, use server.port on the Mastra instance instead of the CLI flag.

const mastra = new Mastra({
server: {
port: 3001,
},
})

Telemetry options from CLI
Telemetry options from CLI的直接链接

The telemetry option has been removed from CLI commands including the --no-telemetry / -nt flag. Telemetry configuration has been removed from the CLI. This change reflects the move of telemetry features to the observability package.

To migrate, remove telemetry flags from CLI commands. Use @mastra/observability for tracing features.