sky state public patch
Update a single public-state path or replace the root object.
Synopsis
bash
sky state public patch <path> <value> --project <slug> [--env <slug>] [--op <add|replace|auto>] [--expect-version <version>] [--string] [--comment <message>] [--yes]
sky state public patch --root <json-object> --project <slug> [--env <slug>] [--expect-version <version>] [--comment <message>] [--yes]Description
patch builds a JSON Patch request against the current public-state version. Use it for small application config, feature flag, public setting, or inventory-style updates. In default auto mode, it fetches the current state, chooses add or replace, and synthesizes missing parent objects when possible.
--expect-version skips the preflight GET and uses the supplied version for If-Match. For path patches, that requires --op add or --op replace because the CLI cannot infer the operation without the current state.
Options
| Option | Description |
|---|---|
--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 non-negative integer for If-Match. |
--op <op> | add, replace, or auto. auto is the default and requires preflight. |
--root | Replace the whole state document. Mutually exclusive with <path>. |
--string | Treat <value> as a literal string instead of trying JSON.parse first. |
--comment <message> | Commit message for the new version. |
--yes | Skip type-change confirmation prompts. |
--format <format> | Global format, supported values for this command: plain, json. |
Examples
bash
sky state public patch /banner/text "Holiday sale" --project my-app --env production
sky state public patch /banner/enabled true --project my-app --env staging
sky state public patch /limits/maxItems 50 --project my-app --env production
sky state public patch /banner '{"text":"Sale","enabled":true}' --project my-app --env production
sky state public patch --root '{"banner":{"text":"Hi"}}' --project my-app --env development
sky state public patch /label true --string --project my-app --env production
sky state public patch /banner/text "New" --expect-version 7 --op replace --project my-app --env productionOutput
Plain output goes to stderr:
text
Patched
Environment production
Path /banner/text
Operation replace
Version v8JSON output goes to stdout:
json
{
"version": 8,
"path": "/banner/text",
"op": "replace"
}