mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-07 00:24:50 +08:00
`claw agents --output-format json` was still wrapping the text report, which meant automation could not distinguish empty inventories from populated agent definitions. Add a dedicated structured handler in the commands crate, wire the CLI to it, and extend the contracts to cover both empty and populated agent listings. Constraint: Keep text-mode `claw agents` output unchanged while aligning JSON behavior with existing structured inventory handlers Rejected: Parse the text report into JSON in the CLI layer | brittle duplication and no reusable structured handler Confidence: high Scope-risk: narrow Directive: Keep inventory subcommands on dedicated structured handlers instead of serializing human-readable reports Tested: cargo test -p commands renders_agents_reports_as_json; cargo test -p rusty-claude-cli --test output_format_contract; cargo test --workspace; cargo fmt --check; cargo clippy --workspace --all-targets -- -D warnings Not-tested: Manual invocation of `claw agents --output-format json` outside automated tests