@cli Feature: CLI JSON/YAML output envelope structure As a programmatic consumer of the CleverAgents CLI I want all --format json and --format yaml outputs to include the spec-required envelope So that I can reliably parse command, status, exit_code, data, timing, and messages fields Background: Given a CLI output format test runner And a mocked lifecycle service for format tests # ── Envelope field presence ────────────────────────────────────────────── Scenario: JSON output includes all required envelope fields Given there are actions for format testing When I run action list with --format json Then the JSON envelope should contain field "command" And the JSON envelope should contain field "status" And the JSON envelope should contain field "exit_code" And the JSON envelope should contain field "data" And the JSON envelope should contain field "timing" And the JSON envelope should contain field "messages" @tdd_issue @tdd_issue_4369 @tdd_expected_fail Scenario: YAML output includes all required envelope fields Given there are actions for format testing When I run action list with --format yaml Then the YAML envelope should contain field "command" And the YAML envelope should contain field "status" And the YAML envelope should contain field "exit_code" And the YAML envelope should contain field "data" And the YAML envelope should contain field "timing" And the YAML envelope should contain field "messages" # ── Envelope field values ──────────────────────────────────────────────── Scenario: JSON envelope status is "ok" for successful commands Given there are actions for format testing When I run action list with --format json Then the JSON envelope status should be "ok" Scenario: JSON envelope exit_code is 0 for successful commands Given there are actions for format testing When I run action list with --format json Then the JSON envelope exit_code should be 0 Scenario: JSON envelope timing contains duration_ms Given there are actions for format testing When I run action list with --format json Then the JSON envelope timing should contain "duration_ms" Scenario: JSON envelope messages is a non-empty list Given there are actions for format testing When I run action list with --format json Then the JSON envelope messages should be a non-empty list # ── Data field contains actual payload ────────────────────────────────── Scenario: JSON envelope data field contains actor list payload Given there are actions for format testing When I run action list with --format json Then the JSON envelope data should contain actor records @tdd_issue @tdd_issue_4370 @tdd_expected_fail Scenario: YAML envelope data field contains actor list payload Given there are actions for format testing When I run action list with --format yaml Then the YAML envelope data should contain actor records # ── format_output() direct call envelope ──────────────────────────────── Scenario: Direct format_output call with json wraps data in envelope When I call format_output with a dict and format json Then the format result should be valid JSON dict And the JSON result data field should contain original keys Scenario: Direct format_output call with yaml wraps data in envelope When I call format_output with a dict and format yaml Then the format result should be valid YAML dict And the YAML result data field should contain original keys Scenario: Direct format_output call with command name sets envelope command When I call format_output with command name "agents actor list" and format json Then the JSON envelope command should be "agents actor list" Scenario: Plain format does not wrap in envelope When I call format_output with a dict and format plain Then the format result should contain plain key-value pairs And the plain result should not contain envelope keys