mcloud-local

작성자: medusajs

Execute 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,…

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

Cloud CLI: Local Command

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.

Constraints

  • No --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.
  • Requires Docker installed and running, and must run from inside the project's Git repository.
  • Reproduces build-failed (build) failures only — not deployment-failed (runtime) failures. For runtime failures, use mcloud logs --deployment <id>.
  • Available since mcloud CLI v0.1.10.
  • The Docker build cache is disabled by default so variable changes always invalidate the cache; pass --docker-cache to enable it.

Command

local build

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:

  • On success (exit 0), the backend image is tagged <repository-name>:cloud-local-build-<commit-hash>; a storefront build writes its output directory and prints the path.
  • On failure (non-zero exit), the command exits with the failing step's error — debug it as you would a Cloud build.

Reproduce a Build Failure

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 checkout "$COMMIT"

if mcloud local build; then
  echo "Build succeeded locally; failure not reproducible from this commit."
else
  echo "Build failed locally; inspect the streamed output for the failing step."
fi

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>.

Examples

# 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
mcloud local build --docker-cache

medusajs의 다른 스킬

mcloud-variables
medusajs
mcloud variables 명령어를 실행하여 Cloud 환경의 환경 변수를 나열하고 가져옵니다. 환경을 검사하거나 읽거나 내보낼 때 사용합니다.
official
building-storefronts
medusajs
SDK 기반의 Medusa 스토어프론트 통합으로, React Query 패턴과 중요한 API 호출 규칙을 포함합니다. 모든 API 요청에는 항상 Medusa JS SDK를 사용해야 하며, 일반 fetch()는 사용하지 않습니다. fetch()는 필수 헤더(스토어 라우트의 publishable API 키, 관리자 라우트의 인증)가 누락되기 때문입니다. SDK 메서드에는 일반 JavaScript 객체를 전달하며, 본문 매개변수에 JSON.stringify()를 사용하지 않습니다. SDK가 자동으로 직렬화를 처리합니다. GET 요청에는 useQuery를, POST/DELETE 요청에는 useMutation을 사용합니다.
official
building-admin-dashboard-customizations
medusajs
Medusa Admin 대시보드용 맞춤 UI 확장 기능으로, Admin SDK와 Medusa UI 컴포넌트를 사용합니다. 모든 관리자 UI 작업(계획, 구현, 탐색) 시 이 스킬을 먼저 로드하세요. MCP 서버는 API 참조만 제공하며, 디자인 패턴이나 데이터 로딩 전략은 제공하지 않습니다. 중요: 모든 API 요청에는 Medusa JS SDK를 사용하고(일반 fetch 사용 금지), 표시 쿼리와 모달 쿼리를 분리하며, 변형 후에는 표시 데이터를 무효화하세요. 기존 페이지에 위젯을 구현하거나 맞춤 UI 라우트를 생성하세요.
official
learning-medusa
medusajs
대화형 단계별 메두사 개발 부트캠프로, 브랜드 기능을 구축하면서 아키텍처 패턴을 학습합니다. 모듈, 워크플로우, API 라우트, 모듈 링크, 워크플로우 훅, 관리자 UI 커스터마이징을 다루는 3개의 점진적 레슨(총 2~3시간)으로 구성됩니다. 각 주요 구성 요소 이후 체크포인트 검증을 통해 개념 이해도, 코드 품질, 기능성을 확인한 후 진행합니다. 오류를 교육 기회로 활용하며, 진단 질문과 근본 원인 분석을 통해 함께 디버깅합니다...
official
db-migrate
medusajs
보류 중인 Medusa 데이터베이스 마이그레이션을 실행하고 결과를 보고합니다. Bash를 통해 npx medusa db:migrate를 실행하여 보류 중인 모든 마이그레이션을 Medusa 데이터베이스에 적용합니다. 적용된 마이그레이션 수, 발생한 오류, 성공 확인을 포함한 마이그레이션 결과를 보고합니다. 표준 npm/npx 설정을 사용하는 Medusa 프로젝트용으로 설계되었습니다.
official
mcloud-environments
medusajs
mcloud environments 명령을 실행하여 Cloud 환경을 나열, 조회, 생성, 삭제, 재배포 또는 빌드를 트리거합니다. 환경 수명 주기를 관리할 때 사용합니다.
official
db-generate
medusajs
단일 명령어로 Medusa 모듈의 데이터베이스 마이그레이션을 생성합니다. npx medusa db:generate CLI 명령을 래핑하여 지정된 Medusa 모듈의 마이그레이션 파일을 생성합니다. 모듈 이름을 인수로 받아 마이그레이션 파일 위치, 오류 및 다음 단계를 보고합니다. 생성 후 마이그레이션을 적용하기 위해 npx medusa db:migrate를 실행하도록 자동으로 제안합니다.
official
mcloud-deployments
medusajs
Execute mcloud deployments commands to list deployments, retrieve deployment details, and fetch build logs. Use when listing deployments, checking deployment…
official