Loading...
Loading...
Use this skill to drive the full DevOps Center promotion workflow for work items and pipeline stages — validate preconditions, prepare work items, optionally combine work items that share metadata, promote one or more work items or an entire stage to a target pipeline stage, and complete the promotion to finalize the deployment. TRIGGER when the user wants to promote a work item, advance changes to the next environment or stage, combine work items for a single promotion, or move metadata through the release pipeline. The mandatory validate step runs automatically at the start. DO NOT TRIGGER for work item creation or status updates (use dx-devops-work-item-manage), for conflict detection, or for polling an existing promotion's status.
npx skill4agent add forcedotcom/sf-skills dx-devops-promote--jsondx-devops-work-item-manage--target-stage-idsf devops promote--work-item-id--stage-id--target-org <alias>target-org--json--test-levelNoTestRunRunLocalTestssf devops--jsonsf org display --jsonsf org login web --set-default --alias <alias>--target-org <alias>target-orgsf devops promotion validate-t/--target-stage-id-i/--work-item-id# Capture the output — Phase 2 derives the combine decision from it deterministically.
VALIDATE_JSON=$(sf devops promotion validate --work-item-id <id> --target-stage-id <target-stage-id> --target-org <alias> --json)--work-item-idstatus == 0.result.success == trueVCS_ERROR: No pull request exists….result.errorType.result.errorDetails.result.combineDetailssuggestions.result.combineDetailsVALIDATE_JSONsf devops work-item prepare --work-item-id <id> --target-stage-id <target-stage-id> --target-org <alias> --json--target-stage-id.result.combineDetailsVALIDATE_JSON# COMBINE == "true" only when validate returned a combineDetails block.
COMBINE=$(printf '%s' "$VALIDATE_JSON" | jq -r '(.result.combineDetails != null)')
if [ "$COMBINE" = "true" ]; then
PARENT_ID=$(printf '%s' "$VALIDATE_JSON" | jq -r '.result.combineDetails.parentWorkitemId')
# one --child-work-item-id arg per child, safe for use as a flag array
CHILD_ARGS=()
while IFS= read -r cid; do CHILD_ARGS+=(--child-work-item-id "$cid"); done < <(
printf '%s' "$VALIDATE_JSON" | jq -r '.result.combineDetails.childWorkitemsId[]')
fiCOMBINE"true"sf devops work-item combine \
--parent-work-item-id "$PARENT_ID" \
"${CHILD_ARGS[@]}" \
--target-stage-id <stage-id> \
--target-org <alias> \
--jsonCHILD_ARGS--child-work-item-id <id>--work-item-id--stage-id--target-stage-id--skip-validation--work-item-id--skip-validationsf devops promote \
--work-item-id <id> \
--target-stage-id <target-stage-id> \
--skip-validation \
--target-org <alias> \
--json--skip-validationsf devops promote \
--stage-id <source-stage-id> \
--target-stage-id <target-stage-id> \
--skip-validation \
--target-org <alias> \
--jsonsf devops promotesf devops promotion validate--skip-validation--skip-validation--deploy-all--test-level RunLocalTestsRunSpecifiedTests --tests <names>.resultsf devops promotion complete --target-stage-id <target-stage-id> --target-org <alias> --json--target-stage-id| Constraint | Rationale |
|---|---|
| Validate ALWAYS runs first | Guarantees preconditions are met before any mutation; skipping it can corrupt pipeline state |
All | Structured output is required for headless consumption; human-readable output is unreliable to parse |
| Commands are keyed on record IDs, not names | |
| The target stage is mandatory; the promotion has no destination without it |
Exactly one of | These flags are mutually exclusive; promote either specific items or a whole source stage |
Pass | The CLI's built-in pre-promote validation runs the same checks (including the associated-PR requirement) as the Phase 1 |
| Deploy runs async — capture and report the identifier | The promote deploy does not complete synchronously; completion is tracked separately |
| Do NOT busy-wait for deploy completion in this skill | Polling is a separate concern; blocking here wastes turns and risks timeouts |
| Combine only when work items share metadata/dependencies | Combining is for conflict-prone or dependent items, not a default for every multi-item promotion |
| Prepare is idempotent | Retry-safe for CI; re-running a completed prepare is a no-op |
| Never use interactive prompts | Skills run headless; all inputs must be CLI flags |
| Pass IDs as CLI flags, never interpolate into shell strings | Prevents prompt/command injection via crafted identifiers |
| Issue | Resolution |
|---|---|
| Validation fails | STOP — do not prepare/combine/promote. Report the non-zero status / error message; if metadata overlap, resolve the conflict before retrying |
| No default org set | Run |
| Passing a work item name instead of an ID | Promotion commands need record IDs; resolve names via |
Both | They are mutually exclusive; pick specific work items OR a source stage, not both |
Missing | Required on every promotion command (validate, prepare, combine, promote, complete); obtain the target stage ID from the pipeline configuration |
| Combined promotion promotes the wrong item | After |
| Treating the deploy as synchronous | The promote deploy is async; capture the identifier and confirm completion before running |
| Production deploy fails on Apex coverage | Set |
| Deploy fails with conflict | A conflict slipped past validate; resolve the metadata conflict, then re-validate and retry |
.result.success.result.combineDetails.result.suggestions.result.errorType.result.errorDetailssf devops work-itemsf devops promotesf devops promotion complete| When | Action |
|---|---|
| Work item must be created or moved to a promotable status first | Delegate to |
| Validation reports metadata overlap / conflict | Resolve the metadata conflict before retrying |
| The promote deploy identifier must be polled to confirm completion | Poll the returned identifier separately, then run |
| File | When to read |
|---|---|
| When you need detailed CLI flag documentation, JSON output schemas, or error-handling patterns for validate/prepare/combine/promote/complete |
| When the user's request matches a common pattern (single work item promotion, combined promotion, whole-stage promotion, validate-first gate) |