Menu

#144 Add `--json` output to status, list, and validate

open
nobody
None
2026-07-15
2026-07-15
Anonymous
No

Originally created by: riki137

What

Adds a --json flag to the three read commands so an AI agent or script can drive RunWisp headless without scraping column-aligned text.

  • runwisp status --json — live snapshot: daemon health, a system summary, and every task with its last run (exit code, timing, duration_ms, and precomputed failed/missed flags). Unreachable daemon → {"healthy": false, "error": …} + exit 1.
  • runwisp list --json — offline JSON mirror of the config table (stays config-only, like the human view).
  • runwisp validate --jsonvalid flag + counts + errors/warnings arrays. A broken config still exits non-zero and emits the JSON error document to stdout (human copy goes to stderr).

Every document carries "schema_version": 1 as an additive-only compatibility promise. Default (flagless) output is byte-for-byte unchanged.

Notes / decisions

  • Last-run state lives in status --json (the daemon-connected command); list stays offline by design (local-first invariant), so it carries config only — not last-run exit codes.
  • validate --json errors expose message only. location is reserved-but-empty: the config layer bakes task/field/line into the message string, and surfacing structured locations would need an internal/config error-type refactor (out of scope).

Tests

  • Golden tests (-update harness + testdata/*.golden.json) lock all three JSON shapes; the status golden is made deterministic via a fake daemon with fixed data.
  • Failure-path tests assert non-zero exit + valid JSON for bad-config validate and unreachable status.
  • bun run ci passes (unit + e2e). Manually verified end-to-end against a live daemon.

Docs

  • New "Machine-readable output" section in operations/cli.mdx with an example response per command.
  • CHANGELOG.md entry under Unreleased → Added.

Discussion


Log in to post a comment.