sky state public push
Replace public state from a file, inline JSON, or stdin.
Synopsis
bash
sky state public push --project <slug> --file <path> [--env <slug>] [--expect-version <version>] [--comment <message>] [--yes]
sky state public push --project <slug> --json <json> [--env <slug>] [--expect-version <version>] [--comment <message>] [--yes]
sky state public push --project <slug> --json - [--env <slug>] [--expect-version <version>] [--comment <message>] [--yes]Description
Reads a JSON object and uploads it as the full public-state document for the specified environment. Use public state for application config, feature flags, public settings, and client-visible catalog or inventory values. --file and --json are mutually exclusive, and exactly one is required.
Versions are integers. A first write uses If-Match: "0", and each successful write increments the version.
Without --expect-version, push fetches the current version first and checks for removals or type changes before writing. With --expect-version, it skips that preflight and uses the supplied version for If-Match.
You can authenticate with a developer bearer session from sky login or a project API key from SKYSTATE_API_KEY / .env.local.
Options
| Option | Description |
|---|---|
--project <slug> | Required. Project slug. |
--file <path> | Read JSON from a file. Mutually exclusive with --json. |
--json <string> | Inline JSON string, or - to read from stdin. Mutually exclusive with --file. |
--env <slug> | Target environment. Resolved from SKYSTATE_ENV or default_env when omitted. |
--expect-version <version> | Skip preflight GET and use this version in If-Match. |
--comment <message> | Commit message for the new version. |
--yes | Skip confirmation prompts for breaking changes. |
--format <format> | Global format. json prints { "version": number } to stdout. |
Examples
bash
sky state public push --project my-app --file state.json --env development
cat state.json | sky state public push --project my-app --json - --env production
sky state public push --project my-app --json '{"banner":{"enabled":true}}' --env staging
sky state public push --project my-app --file state.json --env production --comment "release v2"
sky state public push --project my-app --file state.json --env production --expect-version 7 --yesOutput
Plain success output goes to stderr:
text
Pushed
Environment development
Version v2JSON output goes to stdout:
json
{
"version": 2
}Errors
| Situation | Message |
|---|---|
Neither --file nor --json is provided | One of --file or --json is required. |
Both --file and --json are provided | --file and --json are mutually exclusive. Provide exactly one. |
--env cannot be resolved | Missing required option: --env |
| JSON is invalid | Invalid JSON: ... |
| JSON is not an object | Config must be a JSON object, not an array or primitive. |
Breaking changes in non-TTY without --yes | Non-interactive mode: breaking changes require --yes to confirm. |
| Version conflict | Conflict: environment was updated while editing. |