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 jsonSchema
| Field | Notes |
|---|---|
| apiVersion | always kprompt.io/v1 |
| kind | always PlanResult |
| schemaVersion | "1" — bump only on breaking changes |
| plan.intent | scale, deploy, get, … |
| plan.actions | ops without YAML manifests |
| risk.level | low / medium / high / denied |
| risk.denied | hard deny |
| applied | whether a mutation ran |
| result | optional 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 --waitjq 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"'