18 skills · 52 min
Medusa Cloud
Skill 6 of 18
Execute mcloud local build to reproduce a Cloud build on the local machine.
1 minute · 304 words · 6 sections
Install
npx skills add medusajs/medusa-agent-skills --skill mcloud-localnpx skills add medusajs/medusa-agent-skills/plugin marketplace add medusajs/medusa-agent-skillsThe first command installs just this skill, by the name in its SKILL.md; the second installs the whole repository.
Execute mcloud local build to run a Cloud build on the local machine, mirroring how Cloud builds the project. Use it to debug build-failed deployments without pushing changes and waiting for a full Cloud build.
--json flag. local build streams plaintext build output and signals the result through its exit code (0 = success). Do not parse its output as JSON.build-failed (build) failures only — not deployment-failed (runtime) failures. For runtime failures, use mcloud logs --deployment <id>.--docker-cache to enable it.Run a Cloud build locally. Infers the root path and build variables from the linked Cloud project and environment. Builds the backend by default; pass --type storefront for the storefront.
mcloud local build \
--organization <org-id> \
--project <project-id-or-handle> \
--environment <environment-handle>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)-e/--environment <handle> — Environment whose variables are used (falls back to active context)-t/--type <backend|storefront> — Build type (default: backend)--root-path <path> — Backend root path relative to the repo root (inferred if omitted; . if no Cloud project found)--storefront-path <path> — Storefront path relative to the repo root, for --type storefront (inferred if omitted)--env-file <path> — Use a local .env file instead of the Cloud environment’s variables-v/--var <KEY=VALUE> — Override a single build variable; repeatable--docker-cache — Enable the Docker build cache (default: false)Output:
0), the backend image is tagged <repository-name>:cloud-local-build-<commit-hash>; a storefront build writes its output directory and prints the path.Check out the same commit the failed deployment built so the local build matches, then route on the exit code:
# Identify the failing deployment and the commit it built
DEPLOYMENT_ID=$(
mcloud deployments list --json \
| jq -r '[.[] | select(.backend_status == "build-failed")][0].id'
)
COMMIT=$(mcloud deployments get "$DEPLOYMENT_ID" --json | jq -r '.commit_hash')
git
Once the local build exits 0, push the fix to the tracked branch and start a fresh Cloud build with mcloud environments trigger-build <env>.
# Reproduce the backend build for the active context
mcloud local build
# Reproduce the storefront build
mcloud local build --type storefront --storefront-path apps/storefront
# Test a build-variable fix without editing code
mcloud local build --var NODE_ENV=production
# Build against a local .env file
mcloud local build --env-file .env
# Reuse the Docker cache for a faster rebuild
mcloudExecute mcloud local build to reproduce a Cloud build on the local machine. Use when debugging a build-failed deployment without pushing to the tracked branch, iterating on a build fix, or testing build-variable changes locally. Requires Docker and must run inside the project's Git repo.
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
Bash(mcloud local*)Bash(mcloud deployments*)Bash(mcloud use*)Bash(git*)Bash(jq*)plugins/medusa-cloud/skills/mcloud-local/SKILL.mdmain, last pushed 22 September 2026.SKILL.md, not by matching a directory convention. 4 distinct layouts observed: plugins/ecommerce-storefront/skills/*/SKILL.md, plugins/learn-medusa/skills/*/SKILL.md, plugins/medusa-cloud/skills/*/SKILL.md, plugins/medusa-dev/skills/*/SKILL.md.h1 and no skipped levels:.claude-plugin/marketplace.json by Medusa, declaring 4 plugins. It is read for editorial metadata only — never as the skill index, which is always the repository tree./medusajs/medusa-agent-skills.md, and each skill at its own .md URL.