Repository navigation
Description
Context & Rationale
v0.2.22 built the join point -- emit_serialized renders a payload in any supported format, YAML output is portable rather than Python-tagged, and the console wrapper no longer defeats Rich's colour negotiation. Adoption is the remainder. Of 306 registered commands, 53 expose --json, 17 expose --format, and the 10 that route through the join point get YAML at no cost. The rest each emit their own json.dumps, so a new format still means editing every one of them.
Scope & Deliverables
- Context & Rationale*: v0.2.22 built the join point --
emit_serializedrenders a payload in any supported format, YAML output is portable rather than Python-tagged, and the console wrapper no longer defeats Rich's colour negotiation. Adoption is the remainder. Of 306 registered commands, 53 expose--json, 17 expose--format, and the 10 that route through the join point get YAML at no cost. The rest each emit their ownjson.dumps, so a new format still means editing every one of them. - Deliverable*: Move the remaining
--jsoncommands onto the join point, then add--formatwhere a command has a serialisable result. - Constraint*: "100% of subcommands" is the wrong target and was the original framing. An interactive chat, a port-forward daemon and a TUI have no result to serialise, and giving them a
--formatflag that emits an empty object is worse than not offering one. The deliverable is every command whose output is a value, which has to be enumerated rather than assumed.
Strategic Alignment
- Milestone:
v0.2.23(Foundational Architectural Guardrails & Project Hygiene) - Roadmap Reference:
docs/ROADMAP.md
Update 2026-10-08: refinement
emit_serialized (output/serialization.py:71) is used by 7 modules; 24 declare --json, 21 --format, and 18 still call json.dumps.
- The task file classifies every leaf command as a value command or one with no result, with a reason.
- Every value command declares
--formatand writes throughemit_serialized; a Click-tree test fails otherwise. - Offline tests add at most 1 s;
changelog.d/411.md;uv run devops cipasses.
Proposed design
Problem statement
The CLI has a serialization join point (emit_serialized in output/serialization.py) that renders payloads in any supported format, but most commands that produce serializable output still emit their own json.dumps calls. Adding a new output format therefore requires editing every command individually. The task is to enumerate every leaf command, classify it as value-producing or result-less, move all value-producing commands onto the join point, and give them a --format flag, enforced by a Click-tree test.
Acceptance criteria
- Criterion 1: The task file classifies every leaf command as a value command or one with no result, with a stated reason for each.
Verification: Read the task file (docs/agent/tasks/task-411-*.md) and confirm every registered leaf command appears in the classification table with a reason column filled in. - Criterion 2: Every value command declares --format and writes its output through emit_serialized; a Click-tree test fails if any value command bypasses the join point.
Verification: Run the new Click-tree test (e.g. uv run pytest tests/test_cli_format_adoption.py -v) and confirm it passes; then temporarily remove --format from one value command and confirm the test fails. - Criterion 3: Offline tests add at most 1 second to the suite runtime.
Verification: Run uv run pytest --durations=10 and compare the total offline test duration against the pre-change baseline; the delta must be ≤ 1 s. - Criterion 4: A changelog fragment exists at changelog.d/411.md describing the change.
Verification: Confirm the file changelog.d/411.md exists and contains a meaningful entry. - Criterion 5: uv run devops ci passes with all checks green.
Verification: Run uv run devops ci and confirm exit code 0 with no failing checks.
Key questions
- What is the target scope: 100% of subcommands or only value-producing commands?: Only commands whose output is a serializable value. Interactive chat, port-forward daemons and TUIs have no result to serialise and must not receive a --format flag that emits an empty object. The deliverable is every command whose output is a value, enumerated rather than assumed. (proposed) [sources: docs/agent/tasks/task-411-output-format-adoption-across-the-command-surface.md]
- Where is the serialization join point defined and what does it accept?: emit_serialized is defined at output/serialization.py:71. It accepts a Pydantic model, an object exposing to_dict(), or a plain structure, and writes it in the requested format (JSON or YAML). [sources: docs/agent/tasks/task-326-rich-renderables-architecture-terminal-capability-negotiatio.md:30]
- How many commands currently use emit_serialized, declare --json, declare --format, or still call json.dumps?: As of the 2026-10-08 refinement: 7 modules use emit_serialized, 24 declare --json, 21 declare --format, and 18 still call json.dumps directly. [sources: docs/agent/tasks/task-411-output-format-adoption-across-the-command-surface.md]
- Is there a global --format option or does each command declare its own?: There is no global --format option. Each command that offers machine-readable output declares its own --format (table/json/yaml) or --json flag, per the architecture document. [sources: ARCHITECTURE.md:169]
- Does this item depend on any other open issue?: No. The join point (emit_serialized) was delivered in v0.2.22 via issue feat(cli): add the output format join point and restore colour negotiation #391 and is already merged. The remaining work is purely adoption within this repository. [sources: CHANGELOG.md:1609]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Sep 30, 2026
Moved from v0.2.25 to the backlog. v0.2.25 is capped at 12 items (#740), and only the next two planned releases keep a milestone (#739), so P2 items wait in the backlog until reprioritization pulls them in.
dan-petty-bot commentedon Oct 10, 2026
Status set to Ready at 69c99cf (see proposed design in issue body).
feat(cli): output format adoption across the command surface (#411) (#…
feat(release): v0.2.35 (#1581)