Files
cleveragents-core/features/cli_json_envelope.feature
T
freemo 8ea00f5185
CI / unit_tests (push) Has been cancelled
CI / benchmark-publish (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / security (push) Has been cancelled
CI / quality (push) Has been cancelled
CI / integration_tests (push) Has been cancelled
CI / e2e_tests (push) Has been cancelled
CI / coverage (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
CI / build (push) Has been cancelled
CI / push-validation (push) Has been cancelled
CI / status-check (push) Has been cancelled
CI / docker (push) Has been cancelled
CI / helm (push) Has been cancelled
fix: restore CI quality tests to passing state (#4175)
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-08 11:02:14 +00:00

90 lines
4.3 KiB
Gherkin

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 @skip
@skip
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 @skip
@skip
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