Skip to content

--json output can't say which host it came from, and the shape differs per command #29

Closed

Description

@abruption

Backwards from where it should be

The human output says Sessions on web-01:. The machine output doesn't carry the host at all:

{"sessions": [...], "version": "0.4.0", "remoteVersion": "0.4.0"}

Loop over four hosts, collect with jq -s, and there is no way to tell which session belongs to which machine. The one consumer that most needs the field is the one that lacks it.

And the envelope isn't consistent

command success shape
list {sessions, version, remoteVersion?}
send {ok, target, chars, dryRun}
update {host, remoteVersion, current} — the only one with host
any error {ok: false, error}

ok appears in send success and in errors, but not in list or update success. A parser asking "did this work" needs a different rule per subcommand.

Fix

Settle on one envelope — {ok, host, command, ...payload} or similar — and apply it across all three. This is a breaking change for anything parsing the current output, which is why it should happen now: v0.x, and the only known consumer is this repo.

Pairs with #24 (repeatable --host). Multi-host output is where the missing host field actually bites, so doing both together is what makes either worth much.

Acceptance criteria

  • Every --json response names its host and command
  • Success and failure are distinguishable by the same key everywhere
  • Multi-host results are mergeable with jq -s without losing attribution
  • Schema documented in the README, so it's a contract rather than an accident
  • Tests assert the shape

Activity

  1. added
    enhancement
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions