Skip to content

CLI JSON Output

OpenLogos CLI supports --format json on five command families — status, next, verify, smoke, detect, and module list — producing structured JSON for programmatic consumption by external tools like RunLogos.

  • Trigger: Append --format json to any supported command
  • Output target: JSON goes to stdout; errors go to stderr
  • Format: Compact single-line JSON (no indentation), suitable for piping
  • Exit codes: Same as human-readable mode
  • Encoding: UTF-8
  • Field naming: snake_case

All commands share a common envelope:

{
"command": "<command-name>",
"version": "<cli-version>",
"timestamp": "<ISO-8601>",
"data": { ... }
}

Where command is one of: "status", "next", "verify", "smoke", "detect", "module list".

Terminal window
openlogos detect --format json

Returns CLI version, Node.js version, and project detection information:

{
"cli": {
"version": "0.10.3",
"node_version": "v22.0.0"
},
"project": {
"name": "my-project",
"locale": "zh",
"lifecycle": "launched",
"modules": [
{ "id": "core", "name": "核心功能", "lifecycle": "launched" }
],
"description": "项目描述",
"source_roots": { "src": ["src"], "test": ["test"] }
},
"yaml_diagnostics": null
}

project is null when run outside an OpenLogos project.

Terminal window
openlogos status --format json

Returns phase progress, module state, active proposals, and suggestions:

Key fieldDescription
phases[]All 13 phases with key, label, done, skipped, files
modules[]Per-module lifecycle, current phase, phase progress, active change, suggestion
modules[].active_changeProposal step, task progress, deployment decision, conflict detection
current_phaseFirst incomplete phase key (or null if all done)
lifecycleProject lifecycle derived from module states
yaml_diagnosticsParse recovery status if YAML has issues

The proposal_step field tracks change proposal lifecycle:

StepMeaning
writingProposal/tasks still has template placeholders
delta-writingProposal filled; delta tasks not all checked
ready-to-mergeAll delta tasks checked
merge-generatedopenlogos merge has run
codingSpecs merged; code tasks not all checked
ready-to-verifyAll code tasks checked
verify-passedopenlogos verify passed
verify-failedopenlogos verify failed
ready-to-deployVerify passed, deployment pending
deploy-doneDeployment executed
ready-to-smokeDeployment done, smoke pending
smoke-passedopenlogos smoke passed
smoke-failedopenlogos smoke failed
Terminal window
openlogos verify --format json

Returns test verification results with three-layer validation:

Key fieldDescription
summaryDefined/executed/passed/failed/skipped/uncovered counts and percentages
gateresult (“PASS”/“FAIL”) and reason
failed_cases[]ID and error for each failure
checklistDesign-time coverage validation status
ac_traceAcceptance criteria traceability status
pre_runPre-run execution mode, commands, result paths, diagnostics
sandboxSandbox isolation mode, status, diagnostics
ModeDescription
noneNo pre-run command configured
pre_run_commandSingle verify.pre_run_command executed
two_phaseregression_command + incremental_command with last-write-wins merge
ReasonDescription
failed_casesOne or more test cases failed
incomplete_coverageSome defined cases have no result
checklist_incompleteDesign-time coverage checklist not fully checked
ac_trace_incompleteAcceptance criteria traceability not fully passed
Terminal window
openlogos smoke --format json
openlogos smoke --env staging --format json

Returns post-deployment smoke verification results:

Key fieldDescription
environmentTarget environment (from --env flag, or null)
summarySame structure as verify summary
gateGate 3.8 result and reason
sandboxSandbox execution status
report_pathGenerated smoke report path
result_pathSmoke results JSONL path
Terminal window
openlogos module list --format json

Returns the module registry:

{
"modules": [
{ "id": "core", "name": "核心功能", "lifecycle": "launched" },
{ "id": "payment", "name": "支付模块", "lifecycle": "initial" }
]
}

When a command fails, JSON mode outputs an error envelope to stderr:

{
"command": "<command-name>",
"version": "<cli-version>",
"timestamp": "<ISO-8601>",
"error": {
"code": "PROJECT_NOT_INITIALIZED",
"message": "logos/logos.config.json not found."
}
}
Error codeDescription
PROJECT_NOT_INITIALIZEDNot in an OpenLogos project
NO_TEST_RESULTSTest results JSONL file not found
NO_TEST_CASESNo test case spec files found
NO_SMOKE_RESULTSSmoke results JSONL file not found
NO_SMOKE_CASESNo smoke case spec files found
Terminal window
# Check gate result in scripts
openlogos verify --format json | jq '.data.gate.result'
# Get current phase
openlogos status --format json | jq '.data.current_phase'
# List module lifecycles
openlogos module list --format json | jq '.data.modules[] | {id, lifecycle}'
# Conditional check
if openlogos verify --format json 2>/dev/null | jq -e '.data.gate.result == "PASS"' > /dev/null; then
echo "All tests passed!"
fi