mcloud-environments

作者: medusajs

Execute mcloud environments commands to list, get, create, delete, redeploy, or trigger builds for Cloud environments. Use when managing environment lifecycle,…

npx skills add https://github.com/medusajs/medusa-agent-skills --skill mcloud-environments

Cloud CLI: Environments Commands

Execute mcloud environments commands to manage environment lifecycle and deployments.

Constraints

  • Production environments cannot be deleted. Always check type via environments get --json before attempting delete in automation.
  • Use --yes for destructive operations (delete) in non-interactive contexts.
  • redeploy vs trigger-build are not interchangeable — choose the right one based on where the fix is.

Commands

environments list

List all environments in a project.

mcloud environments list --organization <org-id> --project <project-id-or-handle> --json

Options:

  • -o/--organization <id> — Organization ID (falls back to active context)
  • -p/--project <id-or-handle> — Project ID or handle (falls back to active context)
  • --json — Output as JSON

environments get

Retrieve a single environment by its ID or handle.

mcloud environments get <environment-id-or-handle> --organization <org-id> --project <project-id-or-handle> --json

Arguments:

  • environment — Environment ID or handle (required)

Options:

  • -o/--organization <id>, -p/--project <id-or-handle>, --json

environments create

Create a new long-lived environment.

mcloud environments create \
  --organization <org-id> \
  --project <project-id-or-handle> \
  --name "Staging" \
  --branch develop \
  --json

Options:

  • -o/--organization <id>, -p/--project <id-or-handle>
  • -n/--name <name> — Environment name (required)
  • -b/--branch <branch> — Git branch to track (required)
  • --custom-subdomain <subdomain> — Optional custom subdomain
  • --json — Output as JSON

environments delete

Delete an environment. Cannot delete production environments.

mcloud environments delete <environment-id-or-handle> \
  --organization <org-id> \
  --project <project-id-or-handle> \
  --yes

Arguments:

  • environment — Environment ID or handle (required)

Options:

  • -o/--organization <id>, -p/--project <id-or-handle>
  • -y/--yes — Skip confirmation prompt (required in non-interactive mode)
  • --json — Output as JSON

environments redeploy

Re-run an existing build for the active deployment. Use when the fix is environment-side (variable change, infra issue) — does NOT start a new build.

mcloud environments redeploy <environment-id-or-handle> \
  --organization <org-id> \
  --project <project-id-or-handle> \
  --json

Arguments:

  • environment — Environment ID or handle (required)

Options:

  • -o/--organization <id>, -p/--project <id-or-handle>, --json

Requires the environment to have an active deployment. If it doesn't, use trigger-build first.

environments trigger-build

Start a new build from the tracked branch. Use when the fix is committed code — creates a new deployment.

mcloud environments trigger-build <environment-id-or-handle> \
  --organization <org-id> \
  --project <project-id-or-handle> \
  --json

Arguments:

  • environment — Environment ID or handle (required)

Options:

  • -o/--organization <id>, -p/--project <id-or-handle>, --json

Redeploy vs Trigger-Build Decision

CommandWhen to use
redeployFix is environment-side (variable change, infra config) — reruns existing build
trigger-buildFix is in source code on the tracked branch — starts a new build

Examples

# List all environments
mcloud environments list --json

# Get environment details and check type before deleting
mcloud environments get staging --json | jq '{id, name, type, status}'

# Create a new environment tracking the develop branch
mcloud environments create --name "Staging" --branch develop --json

# Delete a non-production environment
mcloud environments delete staging --yes

# Redeploy after a variable change
mcloud environments redeploy production --json

# Trigger a fresh build from source
mcloud environments trigger-build production --json

# Find environment handles by name
mcloud environments list --json \
  | jq -r '.[] | select(.name == "Production") | .handle'

# Verify new build started
mcloud deployments list --environment production --limit 5 --json \
  | jq '.[] | {id, backend_status, updated_at}'

来自 medusajs 的更多技能

mcloud-variables
medusajs
执行mcloud变量命令,列出并获取云环境的环境变量。用于检查、读取或导出环境…
official
building-storefronts
medusajs
以SDK为先的前端集成方案,适用于Medusa商店前端,采用React Query模式并遵循关键API调用规则。所有API请求必须使用Medusa JS SDK——禁止使用常规fetch(),因其缺少必要请求头(商店路由需可发布API密钥,管理路由需认证信息)。向SDK方法传递纯JavaScript对象,切勿对请求体参数使用JSON.stringify(),SDK会自动处理序列化。GET请求使用useQuery,POST/DELETE请求使用useMutation,...
official
building-admin-dashboard-customizations
medusajs
使用管理SDK和Medusa UI组件为Medusa管理后台定制的UI扩展。对于任何管理后台UI工作(规划、实施、探索),请优先加载此技能;MCP服务器仅提供API参考,不包含设计模式或数据加载策略。关键:始终使用Medusa JS SDK进行所有API请求(切勿使用常规fetch);将显示查询与模态查询分离,并在变更后使显示数据失效。在现有页面上实现小部件或创建自定义UI路由;...
official
learning-medusa
medusajs
交互式逐步Medusa开发训练营,在构建品牌功能的同时学习架构模式。包含三个渐进式课程(总计2-3小时),涵盖模块、工作流、API路由、模块链接、工作流钩子及管理界面自定义。每个主要组件完成后进行检查点验证,测试概念理解、代码质量和功能实现。将错误视为教学机会,通过诊断性问题共同调试并定位根本原因……
official
db-migrate
medusajs
执行待处理的Medusa数据库迁移并报告结果。通过Bash运行npx medusa db:migrate,将所有待处理的迁移应用到Medusa数据库。报告迁移结果,包括已应用的迁移数量、遇到的任何错误以及成功确认。专为具有标准npm/npx设置的Medusa项目设计。
official
mcloud-environments
medusajs
执行mcloud environments命令,列出、获取、创建、删除、重新部署或触发云环境的构建。用于管理环境生命周期时使用…
official
db-generate
medusajs
通过单个命令为Medusa模块生成数据库迁移。封装了npx medusa db:generate CLI命令,用于为指定的Medusa模块创建迁移文件。接受模块名称作为参数,并报告迁移文件位置、错误及后续步骤。生成后自动建议运行npx medusa db:migrate以应用迁移。
official
mcloud-deployments
medusajs
执行 mcloud deployments 命令以列出部署、获取部署详情并获取构建日志。在列出部署、检查部署…时使用
official