Pyra supports --json as a global flag on every command. When enabled, output is a single JSON object with a deterministic envelope structure.
| Field | Type | Description |
|---|
status | "success" | "warn" | "fail" | Result category |
exit.code | integer | Process exit code |
exit.category | string | Exit code classification |
output | object | null | Command-specific output tree |
error | object | null | Error payload on failure |
| Status | Meaning |
|---|
success | Command completed with exit code 0, no warnings |
warn | Command completed with exit code 0, includes warnings |
fail | Command returned a non-zero exit code or error |
When status is "fail", the error field contains:
"summary": "No managed Python found for version 3.14",
"detail": "Pyra searched the Python store but found no installation matching '3.14'.",
"suggestion": "Run 'pyra python install 3.14' to install this version first."
| Field | Description |
|---|
summary | Short error description |
detail | Extended explanation |
suggestion | Actionable next step for the user |
| Code | Category | Meaning |
|---|
0 | success | Successful completion |
2 | user | User or input error |
3 | system | IO or system error |
4 | internal | Internal invariant violation |
| varies | external | Child process exit code (from pyra run) |
JSON output is deterministic. Given the same inputs, the same envelope structure and field ordering is produced. This makes JSON output suitable for:
- CI assertion scripts
- Dashboard integrations
- Automated dependency management
- Health monitoring
"exit": { "code": 0, "category": "success" },
"exit": { "code": 0, "category": "success" },
"message": "Lock file does not match current project inputs.",
"suggestion": "Run 'pyra sync' to update the lock."
pyra sync --locked --json
"exit": { "code": 2, "category": "user" },
"summary": "Lock file not found",
"detail": "pyra sync --locked requires an existing pylock.toml.",
"suggestion": "Run 'pyra sync' first to generate the lock file."
# Fail the build if lock is out of date
pyra sync --locked --json | jq -e '.status == "success"'
# Check for outdated packages
pyra outdated --json | jq '.output.packages[]'
pyra doctor --json | jq '.output.findings'