検証済みのメタデータ(Salesforce内の設定情報)を本番環境に展開し、テストの再実行をスキップします。 **次のような場合に使用:** - ユーザーが本番環境への展開を希望している - 「クイックデプロイ」「プロモート」「本番環境に送出」などの指示がある - 検証済みの状態で、その変更をすぐに反映させたい **必須条件:** 最近実行した `sf project deploy validate` コマンドのジョブID(10日以内、または `--use-most-recent` オプション使用時は3日以内)が必要です。 **使用してはいけない場合:** - サンドボックス環境やスクラッチ環境への展開(代わりに platform-metadata-deploy を使用) - 未検証の状態での展開(事前に platform-deploy-validate を使用してください)
Deploy validated metadata to a Production Salesforce org without re-running tests. TRIGGER when the user wants to deploy to production, says 'quick deploy', 'promote', 'ship to prod', or has just validated and wants to push the change live. REQUIRES a recent `sf project deploy validate` job ID (≤10 days old, ≤3 days for --use-most-recent). DO NOT TRIGGER for sandbox/scratch deploys (use platform-metadata-deploy) or unvalidated deploys (use platform-deploy-validate first).
事前に検証済みのデプロイを、sf project deploy validate コマンドで得たジョブIDを使って、本番環境(プロダクション)の組織に昇格させます。テストの再実行や コンポーネント(ソフトウェアの構成要素)の再検証は行わず、昇格のみを実施します。
何よりもまず、以下の4つすべてを確認してください:
対象が本番環境であること
sf org display --target-org <alias> --json
対象が確実に本番環境かを確認します。確実な判定方法は、ゲート(アクセス制御)の分類機能を使うことです(production|sandbox|scratch|trial|devhub|unknown を返します):
sf org display --target-org <alias> --json | "${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate" classify
本番環境とは、isSandbox=false かつ isScratch=false で、インスタンスのURLに --(サンドボックスの標識)や test.salesforce.com がなく、かつ試用版・Developer Edition(開発者向け無料環境)のホストではない(orgfarm-*、*.develop.my.salesforce.com、*.pc-rnd.* のようなホスト、または trialExpirationDate フィールドがある場合は、isSandbox/isScratch が null と報告されるため本番環境とみなしてはいけません)ことを意味します。
対象が本番環境でない場合(分類機能が production 以外を返す場合)→ 処理を中止し、platform-metadata-deploy(非本番環境に対応)にリダイレクトしてください。
検証済みのデプロイが存在すること
.sfdx/last-validation.json を読み込む(存在する場合は、platform-deploy-validate で作成されたもの)--use-most-recent(過去3日以内の検証)にフォールバック検証が十分に新しいこと
--job-id の場合:Salesforceの迅速デプロイウィンドウ(10日以内)を満たすこと--use-most-recent の場合:3日以内であることcreatedAt がウィンドウを超えている場合 → 処理を中止し、先に platform-deploy-validate を実行してくださいユーザーの明示的な確認
以下の形式で表示します:
┌─ PRODUCTION DEPLOY ─────────────────────────────┐
│ Org alias: <alias> │
│ Instance: <instanceUrl> │
│ Edition: <edition> │
│ Validation ID: <jobId> │
│ Validated: <createdAt> (X days ago) │
│ Components: <componentCount> queued │
│ Tests: <run>/<passed>/<failed> │
└─────────────────────────────────────────────────┘
本番環境へのデプロイを確認しますか?(yes/no)
「yes」と答えた後:
sf project deploy quick --job-id <id> --target-org <alias> --wait 30 --json
ユーザーが選択した場合は --use-most-recent を使用します。
迅速なデプロイは以下を行います:
完了後、監査証跡のため以下を実行して保存します:
mkdir -p .sfdx/deploy-history
sf project deploy report --job-id <id> --target-org <alias> --json > ".sfdx/deploy-history/<id>.json"
ユーザーに以下を表示します:
本番環境でのデプロイが成功した後は、以下を提案してください:
sf project deploy start を実行してはいけません(必ず検証してから迅速デプロイを使用)--ignore-errors や --ignore-warnings を使ってはいけません.sfdx/deploy-history/ に保存し、監査証跡を残してくださいplatform-deploy-validate を実施するよう勧めてくださいPromote a validated deploy to a Production org using the job ID from a prior sf project deploy validate. No tests re-run, no components re-validated — just the promotion.
Before doing ANYTHING, verify all four:
Target is Production
sf org display --target-org <alias> --json
Confirm the target really is production. The reliable check is the gate's classifier (returns production|sandbox|scratch|trial|devhub|unknown):
sf org display --target-org <alias> --json | "${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate" classify
Production means isSandbox=false AND isScratch=false AND instance URL has no -- (sandbox marker) AND no test.salesforce.com AND it is not a trial/Developer Edition host (orgfarm-*, *.develop.my.salesforce.com, *.pc-rnd.*, or a trialExpirationDate in the response — these report isSandbox/isScratch as null and must not be taken for production).
If target is NOT production (classifier returns anything other than production) → STOP and redirect to platform-metadata-deploy (which handles non-prod natively).
A validation exists
.sfdx/last-validation.json if it exists (left there by platform-deploy-validate)--use-most-recent (validates within last 3 days)Validation is fresh enough
--job-id: must be ≤10 days old per Salesforce's quick-deploy window--use-most-recent: must be ≤3 days oldcreatedAt exceeds the window → STOP and run platform-deploy-validate firstExplicit user confirmation
Format exactly:
┌─ PRODUCTION DEPLOY ─────────────────────────────┐
│ Org alias: <alias> │
│ Instance: <instanceUrl> │
│ Edition: <edition> │
│ Validation ID: <jobId> │
│ Validated: <createdAt> (X days ago) │
│ Components: <componentCount> queued │
│ Tests: <run>/<passed>/<failed> │
└─────────────────────────────────────────────────┘
Confirm deploy to PRODUCTION? (yes/no)
After "yes":
sf project deploy quick --job-id <id> --target-org <alias> --wait 30 --json
Or with --use-most-recent if the user opted in.
The quick deploy will:
After completion, persist for audit:
mkdir -p .sfdx/deploy-history
sf project deploy report --job-id <id> --target-org <alias> --json > ".sfdx/deploy-history/<id>.json"
Surface to the user:
After a successful prod deploy, suggest:
sf project deploy start against a Production target (always validate then quick-deploy)--ignore-errors or --ignore-warnings on production.sfdx/deploy-history/ for the audit trailplatform-deploy-validate first原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。