mcloud-local

作成者: medusajs

mcloud local build を実行して、Cloud build をローカルマシン上で再現します。追跡ブランチにプッシュせずに、ビルドに失敗したデプロイメントをデバッグする際に使用します、…

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
Medusaストアフロント向けのSDKファーストなフロントエンド統合で、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
Medusa Adminダッシュボード向けのカスタムUI拡張機能。Admin SDKとMedusa UIコンポーネントを使用。管理UIの作業(計画、実装、調査)では、このスキルを最初に読み込むこと。MCPサーバーはAPIリファレンスのみを提供し、デザインパターンやデータ読み込み戦略は提供しない。重要:すべてのAPIリクエストにはMedusa JS SDKを使用すること(通常のfetchは不可)。表示クエリとモーダルクエリを分離し、ミューテーション後は表示データを無効化すること。既存ページにウィジェットを実装するか、カスタムUIルートを作成すること。...
official
learning-medusa
medusajs
対話形式で段階的に進むMedusa開発ブートキャンプ。ブランド機能を構築しながらアーキテクチャパターンを学びます。モジュール、ワークフロー、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