Skip to content

JSON Output

Pyra supports --json as a global flag on every command. When enabled, output is a single JSON object with a deterministic envelope structure.

{
"status": "success",
"exit": {
"code": 0,
"category": "success"
},
"output": { ... },
"error": null
}
FieldTypeDescription
status"success" | "warn" | "fail"Result category
exit.codeintegerProcess exit code
exit.categorystringExit code classification
outputobject | nullCommand-specific output tree
errorobject | nullError payload on failure
StatusMeaning
successCommand completed with exit code 0, no warnings
warnCommand completed with exit code 0, includes warnings
failCommand returned a non-zero exit code or error

When status is "fail", the error field contains:

{
"error": {
"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."
}
}
FieldDescription
summaryShort error description
detailExtended explanation
suggestionActionable next step for the user
CodeCategoryMeaning
0successSuccessful completion
2userUser or input error
3systemIO or system error
4internalInternal invariant violation
variesexternalChild 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
Terminal window
pyra sync --json
{
"status": "success",
"exit": { "code": 0, "category": "success" },
"output": { ... },
"error": null
}
Terminal window
pyra doctor --json
{
"status": "warn",
"exit": { "code": 0, "category": "success" },
"output": {
"findings": [
{
"kind": "stale_lock",
"message": "Lock file does not match current project inputs.",
"suggestion": "Run 'pyra sync' to update the lock."
}
]
},
"error": null
}
Terminal window
pyra sync --locked --json
# (when lock is missing)
{
"status": "fail",
"exit": { "code": 2, "category": "user" },
"output": null,
"error": {
"summary": "Lock file not found",
"detail": "pyra sync --locked requires an existing pylock.toml.",
"suggestion": "Run 'pyra sync' first to generate the lock file."
}
}
Terminal window
# 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[]'
# Health check
pyra doctor --json | jq '.output.findings'