Skip to content

sky state public remove

Remove one public-state path idempotently.

Synopsis

bash
sky state public remove <path> --project <slug> [--env <slug>] [--expect-version <version>] [--comment <message>] [--yes] [--format <plain|json>]

Description

remove deletes a single JSON Pointer path from the latest public state. If the path is already absent, the command succeeds without writing a new version.

Without --expect-version, the CLI fetches the current state first to obtain the If-Match version; if that preflight reports no state at all, the command is a local no-op. With --expect-version, it skips the preflight. On both paths, a missing target path is reported by the API as patch_path_not_found and treated as the same idempotent no-op.

Only the API's patch_path_not_found error becomes this no-op. Removing an array element by index is not idempotent: a non-numeric or out-of-range index (e.g. /tags/x, /tags/9) fails with exit code 1.

Options

OptionDescription
--project <slug>Required. Project slug.
--env <slug>Target environment. Resolved from SKYSTATE_ENV or default_env when omitted.
--expect-version <version>Skip preflight GET and use this positive integer for If-Match.
--comment <message>Commit message for the new version.
--yesSkip the confirmation prompt.
--format <format>Global format, supported values for this command: plain, json.

Examples

bash
sky state public remove /experiments/oldFlag --project my-app --env development
sky state public remove /banner/text --project my-app --env production --yes
sky state public remove /limits/maxItems --project my-app --env staging --expect-version 12 --format json

Output

Plain success output goes to stderr:

text
Removed
Environment: development
Path: /experiments/oldFlag
Operation: remove
Version: v9

No-op plain output is:

text
Already absent: /experiments/oldFlag

JSON no-op output is:

json
{
  "version": null,
  "path": "/experiments/oldFlag",
  "op": "remove",
  "noop": true
}