mcloud-local

tarafından 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 tarafından daha fazla skill

mcloud-variables
medusajs
mcloud değişkenleri komutlarını çalıştırarak bir Cloud ortamındaki ortam değişkenlerini listeleme ve alma işlemlerini gerçekleştirin. Ortam değişkenlerini inceleme, okuma veya dışa aktarma durumlarında kullanın…
official
building-storefronts
medusajs
Medusa mağaza ön yüzleri için SDK öncelikli ön uç entegrasyonu, React Query desenleri ve kritik API çağrı kuralları. Tüm API istekleri için her zaman Medusa JS SDK'sını kullanın—asla normal fetch() kullanmayın, çünkü gerekli başlıkları (mağaza rotaları için yayınlanabilir API anahtarı, admin rotaları için kimlik doğrulama) içermez. SDK yöntemlerine düz JavaScript nesneleri iletin; gövde parametrelerinde asla JSON.stringify() kullanmayın, çünkü SDK serileştirmeyi otomatik olarak halleder. GET istekleri için useQuery, POST/DELETE istekleri için useMutation kullanın,...
official
building-admin-dashboard-customizations
medusajs
Medusa Admin panosu için Admin SDK ve Medusa UI bileşenlerini kullanan özel UI uzantıları. Herhangi bir admin UI çalışması (planlama, uygulama, keşif) için bu yeteneği ÖNCE yükleyin; MCP sunucuları yalnızca API referansı sağlar, tasarım desenleri veya veri yükleme stratejileri sağlamaz KRİTİK: Tüm API istekleri için her zaman Medusa JS SDK kullanın (asla normal fetch kullanmayın); görüntüleme sorgularını modal sorgularından ayırın ve mutasyonlardan sonra görüntüleme verilerini geçersiz kılın Mevcut sayfalara widget'lar uygulayın veya özel UI rotaları oluşturun;...
official
learning-medusa
medusajs
Medusa geliştirme bootcamp'i: markalar özelliği oluştururken mimari kalıpları öğreneceğiniz etkileşimli, adım adım ilerleyen bir eğitim. Modüller, iş akışları, API yolları, modül bağlantıları, iş akışı kancaları ve admin arayüzü özelleştirmesini kapsayan üç aşamalı ders (toplam 2-3 saat). Her ana bileşenden sonra yapılan kontrol noktası doğrulaması, kavramsal anlayışı, kod kalitesini ve işlevselliği test eder. Hataları öğrenme fırsatı olarak ele alır; tanı soruları ve temel neden analiziyle birlikte hata ayıklama yapar.
official
db-migrate
medusajs
Bekleyen Medusa veritabanı geçişlerini çalıştırır ve sonuçları raporlar. Tüm bekleyen geçişleri Medusa veritabanınıza uygulamak için Bash üzerinden npx medusa db:migrate komutunu çalıştırır. Uygulanan geçiş sayısı, karşılaşılan hatalar ve başarı onayı dahil olmak üzere geçiş sonuçlarını raporlar. Standart npm/npx kurulumuna sahip Medusa projeleri için tasarlanmıştır.
official
mcloud-environments
medusajs
mcloud environments komutlarını çalıştırarak Cloud ortamlarını listeleme, alma, oluşturma, silme, yeniden dağıtma veya derleme tetikleme işlemlerini gerçekleştirin. Ortam yaşam döngüsünü yönetirken kullanın,…
official
db-generate
medusajs
Tek bir komutla Medusa modülleri için veritabanı migrasyonları oluşturur. Belirtilen Medusa modülleri için migrasyon dosyaları oluşturmak üzere npx medusa db:generate CLI komutunu sarar. Argüman olarak modül adını alır ve migrasyon dosyası konumunu, hataları ve sonraki adımları raporlar. Migrasyonları uygulamak için oluşturma işleminden sonra otomatik olarak npx medusa db:migrate çalıştırmayı önerir.
official
mcloud-deployments
medusajs
Dağıtımları listelemek, dağıtım ayrıntılarını almak ve derleme günlüklerini getirmek için mcloud deployments komutlarını çalıştırın. Dağıtımları listelerken, dağıtım kontrol ederken kullanın…
official