feat(cli): standardize --json output format across all tools #241

Closed
opened 2026-05-31 14:21:27 +00:00 by jmiller · 1 comment
Owner

Problem

Only ~33% of tools support --json output. Those that do use inconsistent schemas — some return flat objects, others nested, some include metadata, others do not.

Current State

  • validate/ tools: mostly support --json with status/errors/warnings structure
  • cli/ tools: rarely support --json
  • automation/maintenance/deploy/fix: no --json support

Proposal

Standard JSON envelope for all tools:

{
  "command": "check:syntax",
  "version": "09.01.00",
  "status": "pass|fail|error",
  "exit_code": 0,
  "data": { ... },
  "errors": [],
  "warnings": [],
  "metadata": {
    "duration_ms": 1234,
    "timestamp": "2026-05-31T12:00:00Z"
  }
}

CliFramework should provide a jsonOutput() method that wraps results in this envelope.

Acceptance Criteria

  • Standard JSON envelope defined in CliFramework
  • jsonOutput() method added to CliFramework
  • All CliFramework-based tools emit consistent JSON
  • --json flag documented in bin/moko --help
## Problem Only ~33% of tools support --json output. Those that do use inconsistent schemas — some return flat objects, others nested, some include metadata, others do not. ## Current State - validate/ tools: mostly support --json with status/errors/warnings structure - cli/ tools: rarely support --json - automation/maintenance/deploy/fix: no --json support ## Proposal Standard JSON envelope for all tools: ```json { "command": "check:syntax", "version": "09.01.00", "status": "pass|fail|error", "exit_code": 0, "data": { ... }, "errors": [], "warnings": [], "metadata": { "duration_ms": 1234, "timestamp": "2026-05-31T12:00:00Z" } } ``` CliFramework should provide a jsonOutput() method that wraps results in this envelope. ## Acceptance Criteria - [ ] Standard JSON envelope defined in CliFramework - [ ] jsonOutput() method added to CliFramework - [ ] All CliFramework-based tools emit consistent JSON - [ ] --json flag documented in bin/moko --help
jmiller added the phppriority: medium labels 2026-05-31 14:21:28 +00:00
Author
Owner

Branch created: feature/241-feat-cli-standardize-json-output-format-

git fetch origin
git checkout feature/241-feat-cli-standardize-json-output-format-
Branch created: [`feature/241-feat-cli-standardize-json-output-format-`](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/src/branch/feature/241-feat-cli-standardize-json-output-format-) ```bash git fetch origin git checkout feature/241-feat-cli-standardize-json-output-format- ```
Sign in to join this conversation.
No labels php priority: medium
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/moko-platform#241