Skip to content

skystate promote

Promote config changes from one environment to another.

Synopsis

skystate promote --from <env> --to <env> [--yes] [--keys <keys>] [--dry-run]

Description

Compares the source and target environments, presents the differences as hunks, and lets you selectively stage which changes to apply. Staged changes are written to the target environment as a new config version.

promote uses optimistic concurrency: the target config version is recorded when the diff is fetched. If another push modifies the target between fetching the diff and applying it, the API returns a 409 Conflict and you are asked to run promote again.

The repo must already be linked via skystate init.

Options

OptionDescription
--from <env>(Required) Source environment. Accepts development, staging, production, or aliases dev, stg, prod.
--to <env>(Required) Target environment. Same values as --from.
--yesStage all changes without prompting. Required in non-interactive (non-TTY) mode.
--keys <keys>Comma-separated list of top-level keys to include in the promotion. Other keys are ignored.
--dry-runShow the diff without applying any changes. Exits after printing the diff.

Global options (--format, --quiet, --verbose, --api-url) are also accepted. See global options.

Environment aliases

AliasFull name
devdevelopment
stgstaging
prodproduction

Interactive mode (default)

Without --yes, promote enters an interactive hunk-by-hunk review:

[1/3] featureFlags (replace)
  source (development v1.5.0):
    darkMode: true
    newCheckout: true
  target (staging v1.3.0):
    darkMode: false
    newCheckout: false

Stage this change? [y/n/d/a/q]

Hunk review keys

KeyAction
yStage this hunk (include in promotion)
n or EnterSkip this hunk (keep the target value)
dEnter a custom value for the target key
aStage this hunk and all remaining hunks
qAbort the entire promotion without applying any changes

After reviewing all hunks, a confirmation summary is shown:

Staged changes:
  featureFlags  replace  -> { darkMode: true, newCheckout: true }
  limits        add      -> { maxRetries: 5 }

Apply these changes? [y/N]

Non-interactive mode (--yes)

All hunks are staged without prompting. The confirmation summary is skipped. Use this in CI pipelines.

sh
skystate promote --from staging --to production --yes

Running without --yes in a non-TTY environment raises an error:

Error: Non-interactive mode requires --yes flag.

--dry-run mode

Prints the diff (identical to skystate diff output) without applying any changes. Exits with code 0 even if differences exist.

Default output:

[1/2] featureFlags (replace)
  source (development v1.5.0):
    darkMode: true
  target (staging v1.3.0):
    darkMode: false

[2/2] limits (add)
  source (development v1.5.0): { maxRetries: 5 }

With --format json:

json
[
  {
    "key": "featureFlags",
    "type": "replace",
    "sourceValue": { "darkMode": true },
    "targetValue": { "darkMode": false }
  }
]

--keys filtering

When --keys is provided, only the listed top-level keys are included in the diff and promotion. Keys not present in the diff produce a warning:

Warning: key "nonexistent" not found in diff.

Examples

sh
# Interactive promotion from development to staging
skystate promote --from development --to staging

# Promote all changes non-interactively (CI)
skystate promote --from staging --to production --yes

# Preview what would be promoted
skystate promote --from dev --to prod --dry-run

# Promote only specific keys
skystate promote --from dev --to staging --keys featureFlags,limits

# Non-interactive partial promotion
skystate promote --from dev --to prod --keys featureFlags --yes

# Dry-run with JSON output
skystate promote --from dev --to staging --dry-run --format json

Output (success)

Promoted 2 change(s) to staging (v1.4.0).

Errors

SituationExit CodeMessage
--from or --to not specifiederrorCommander required option error
Invalid environment value1Error: Invalid source/target environment "xyz". Must be one of: dev, stg, prod (or development, staging, production)
--from equals --to1Error: Source and target environments must be different.
Non-TTY without --yes1Error: Non-interactive mode requires --yes flag. with hint Run: skystate promote --from dev --to prod --yes
Source environment has no config1Error: No config found in source environment "development". with hint Push config to development first via the dashboard.
No differences foundNo differences found between development and staging. (exits 0)
Nothing stagedNothing staged. No changes applied. (exits 0)
Conflict (target modified concurrently)1Conflict: the target environment was modified since you fetched the diff. Run promote again to get a fresh diff.
Aborted by userAborted. (exits 0)
No project linked1Error: No project linked. with hint Run: skystate init
Not authenticated2Not authenticated. Run: skystate login
Network error1Error: Network error -- check your connection and try again

Troubleshooting

  • Conflict error — another push happened between your diff and your apply. Run promote again to fetch a fresh diff.
  • Nothing staged — you skipped all hunks. No changes were made.
  • Target missing — if the target environment has never had config pushed, promote treats it as an empty config ({}), so all source keys appear as add hunks.

Dashboard equivalent

The Remote Config tab in the dashboard at https://app.skystate.io includes a visual promote workflow with per-key selection.

Built with VitePress