Skip to content

sky state public diff

Show public-state differences between two environments.

Synopsis

bash
sky state public diff --project <slug> --from <env> --to <env> [--keys <keys>] [--format <plain|json>]

Description

Compares the latest public-state documents for two environments in one project. If no differences are found, the command exits 0. If differences are found, it prints the diff and sets exit code 3.

The target environment can be empty; the source environment must have state.

Options

OptionDescription
--project <slug>Required. Project slug.
--from <env>Required. Source environment. Accepts development, staging, production, or aliases dev, stg, prod.
--to <env>Required. Target environment. Accepts the same values as --from.
--keys <keys>Comma-separated list of top-level keys to compare.
--format <format>plain (default) or json.

Examples

bash
sky state public diff --project my-app --from development --to staging
sky state public diff --project my-app --from dev --to prod
sky state public diff --project my-app --from dev --to prod --keys featureFlags,limits
sky state public diff --project my-app --from dev --to staging --format json

Exit Codes

CodeMeaning
0No differences
1Error
3Differences found

JSON Output

With --format json, stdout is an array of diff hunks:

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