Expand description
Stable, machine-readable JSON surface shared by the --format=json
CLI flags (issue #38, phase 1) and the daemon’s JSON-RPC methods
(phase 2).
The DTOs here are deliberately decoupled from the internal
crate::worktree::WorktreeInfo / crate::doctor::DoctorReport
types. Those structs carry TUI-runtime baggage (loaded GitHub issue /
PR state, cached branch age as a Duration, the BranchLink graph)
whose shape churns as the TUI evolves. Pinning the documented schema
(see docs/schema/) to a dedicated set of Serialize DTOs means a
refactor of WorktreeInfo can’t silently break a downstream editor
plugin. Conversions are one-directional (From<&Internal>); the JSON
surface is output-only.
Key convention: snake_case, matching the hand-built
print_status_json in crate::cli.
Structs§
- Json
Check - One diagnostic check, the stable projection of
crate::doctor::Check. - Json
Doctor Report - A full doctor run, carrying the per-check list plus the aggregate
severityand the processexit_code(0/1/2) so a consumer doesn’t have to re-derive them. - Json
Path - The
{ name, path, branch }triple returned bygwm path --format=json. - Json
Status - Working-tree + upstream status, the stable projection of
BranchStatus. - Json
Worktree - One worktree as exposed to scripting / editor integrations. Mirrors
the columns of
gwm listplus the machine-only fields a consumer needs (absolutepath, rawage_seconds, linked issue/PR numbers).
Functions§
- check_
status_ str - Stable lowercase string for a
CheckStatus, used as thestatusfield ofJsonCheckand theseverityofJsonDoctorReport. - worktrees
- Build the stable JSON worktree list for
repo. Shared bygwm list --format=jsonand the daemon’slistRPC method so both surfaces stay byte-identical.