CI / JSON

Stable PlanResult output for pipeline gates.

JSON output helps you gate risky plans in CI. It does not remove the need for human judgment — kprompt remains experimental, and auto-approve in pipelines can still apply a bad plan if your checks are too loose.

Pass --output json or -o json to emit a single PlanResult document on stdout. Human confirmations and wait status go to stderr in JSON mode.

kprompt "scale api to 10" -n prod --output json

Schema

FieldNotes
apiVersionalways kprompt.io/v1
kindalways PlanResult
schemaVersion"1" — bump only on breaking changes
plan.intentscale, deploy, get, …
plan.actionsops without YAML manifests
risk.levellow / medium / high / denied
risk.deniedhard deny
appliedwhether a mutation ran
resultoptional get/explain/logs/describe payload

Manifests and API keys are never included.

Gate example

#!/usr/bin/env bash
set -euo pipefail
json="$(kprompt "scale api to 10" -n prod -o json)"
echo "$json" | jq -e '.risk.denied == false' >/dev/null
echo "$json" | jq -e '.plan.intent == "scale"' >/dev/null
kprompt "scale api to 10" -n prod --approve --wait

jq helpers

# Fail if any delete is planned
echo "$json" | jq -e '[.plan.actions[].op] | index("delete") | not'

# High-risk gate
echo "$json" | jq -e '.risk.level != "high"'