config.yaml, and wxctl validates, plans, and executes it. This guide is the runbook for driving the full loop from an agent with only the binary. The same runbook ships in the repository as AGENTS.md.
The canonical loop
Run these in order; each step is safe to repeat.Discover
wxctl resources lists every kind (no credentials). wxctl explain <kind> shows fields, dependencies, and endpoints; wxctl explain with no kind prints the config model plus the full kind list.Author
Write
config.yaml: separate resources with ---, give each a top-level kind and ref_name, and wire them with ${kind.ref_name} references. Keep secrets out of YAML with ${env:VAR}.Validate and plan
wxctl validate -f config.yaml runs schema and reference checks offline. wxctl plan -f config.yaml previews the create/update/delete plan. Non-blocking advisories, when any apply, appear in the JSON warnings[] array and a ▌ Advisories section; they never change valid or the exit code.Credential-free discovery
wxctl resources, wxctl explain, and wxctl validate need no profile and make no network calls. Learn the catalog and the config model before you author anything.
Machine-readable output
Add--output json to validate, plan, apply, test, or destroy (and -o json to resources or explain) to emit exactly one JSON document on stdout; logs stay on stderr.
| Command | JSON top-level keys |
|---|---|
plan | summary, operations[] |
apply, destroy | run_id, summary, succeeded[], failed[], skipped[] |
test | run_id, passed, failed, tests[] |
validate | valid, errors[], warnings[], fix_prompt |
failed[] or errors[] populated) before a nonzero exit, so you always get structured detail. The wxctl mcp serve MCP server exposes the same operations as tools with identical JSON shapes.
Exit codes
See the Commands reference for the full table. In short:0 success, 1 error, 2 usage error. plan returns 0 for any valid plan, including one with pending changes.
Profiles
Endpoints and auth live in a profile at~/.wxctl/profiles.yaml. Create one with wxctl init, select it with -p <name> or WXCTL_PROFILE, and see Profiles and credentials for details.
Error recovery
Fix a bad config
Run
wxctl validate --fix-prompt, or read fix_prompt from the --output json document, for a ready-to-apply correction.Diagnose a failed run
wxctl debug prints an agent-ready diagnosis of the latest failed run (-o json for a bundle).
