4d31f0ed02
CI / lint (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 34s
CI / typecheck (pull_request) Successful in 51s
CI / security (pull_request) Successful in 1m0s
CI / build (pull_request) Successful in 19s
CI / helm (pull_request) Successful in 24s
CI / unit_tests (pull_request) Failing after 7m5s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 16m51s
CI / integration_tests (pull_request) Successful in 23m16s
CI / coverage (pull_request) Successful in 10m39s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 56m46s
Add `fmt: OutputFormat` parameter to `main_callback()` in
`src/cleveragents/cli/main.py` and store the selected format in
`ctx.obj["format"]` so all subcommands can read it without needing
their own per-command `--format` flag.
Remove per-command `--format` / `fmt` parameters from `version()`,
`info()`, and `diagnostics()` commands. These commands now read the
format from `ctx.obj.get("format", OutputFormat.RICH.value)`.
The specification states: "The framework supports six distinct output
formats, selectable via the global `--format` flag." This change
aligns the implementation with the spec by making `--format` a global
option on the root `agents` command (via the Typer callback).
All six formats (json, yaml, plain, rich, table, color) are supported
via the global flag and the `-f` shorthand.
Add Behave BDD scenarios covering global `--format` flag propagation
to subcommands for all six formats. Update Robot Framework integration
tests to exercise the global `--format` flag. Update existing tests
that used per-command `--format` for version/info/diagnostics to use
the global flag instead.
ISSUES CLOSED: #2908
136 lines
6.4 KiB
Plaintext
136 lines
6.4 KiB
Plaintext
*** Settings ***
|
|
Documentation CLI Consistency and UX Polish Integration Tests
|
|
...
|
|
... Verifies that shared exit-code constants, centralized error
|
|
... formatting, shell completion generation, and uniform
|
|
... --format json|text output switching work end-to-end.
|
|
Resource ${CURDIR}/common.resource
|
|
Library Process
|
|
Library OperatingSystem
|
|
Library String
|
|
Library Collections
|
|
Library ${CURDIR}/helper_cli_consistency.py
|
|
Suite Setup Setup Test Environment
|
|
Suite Teardown Cleanup Test Environment
|
|
|
|
*** Variables ***
|
|
${PYTHON} python
|
|
|
|
*** Test Cases ***
|
|
Exit Code Constants Are Defined Correctly
|
|
[Documentation] Verify all standardized exit codes exist with correct values
|
|
${constants}= Get Exit Code Constants
|
|
Should Be Equal As Integers ${constants}[EXIT_SUCCESS] 0
|
|
Should Be Equal As Integers ${constants}[EXIT_ERROR] 1
|
|
Should Be Equal As Integers ${constants}[EXIT_USAGE] 2
|
|
Should Be Equal As Integers ${constants}[EXIT_NOT_FOUND] 3
|
|
Should Be Equal As Integers ${constants}[EXIT_CONFLICT] 4
|
|
|
|
Format Constants Are Defined Correctly
|
|
[Documentation] Verify format-related constants
|
|
${constants}= Get Format Constants
|
|
Should Contain ${constants}[FORMAT_HELP] json
|
|
Should Contain ${constants}[FORMAT_HELP] yaml
|
|
Should Contain ${constants}[FORMAT_HELP] plain
|
|
Should Be Equal As Strings ${constants}[DEFAULT_FORMAT] rich
|
|
${formats}= Set Variable ${constants}[VALID_FORMATS]
|
|
Should Contain ${formats} json
|
|
Should Contain ${formats} yaml
|
|
Should Contain ${formats} plain
|
|
Should Contain ${formats} table
|
|
Should Contain ${formats} rich
|
|
Should Be Equal As Strings ${constants}[FORMAT_TEXT] plain
|
|
Should Be Equal As Strings ${constants}[FORMAT_JSON] json
|
|
Should Be Equal As Strings ${constants}[FORMAT_TABLE] table
|
|
|
|
CLI Help Output Is Consistent
|
|
[Documentation] Verify --help output mentions key elements
|
|
${result}= Run Process ${PYTHON} -m cleveragents --help
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} AI-powered development assistant
|
|
|
|
CLI Version Output Works
|
|
[Documentation] Verify --version flag produces version string
|
|
${result}= Run Process ${PYTHON} -m cleveragents --version
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} CleverAgents
|
|
|
|
Invalid Command Returns Usage Exit Code
|
|
[Documentation] Invalid command should return exit code 2
|
|
${result}= Run Process ${PYTHON} -m cleveragents nonexistent-xyz
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 2
|
|
Should Contain ${result.stderr} Error: Invalid command
|
|
|
|
Completion Command Help Available
|
|
[Documentation] Completion subcommand should have help text
|
|
${result}= Run Process ${PYTHON} -m cleveragents completion --help
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} completion
|
|
|
|
Completion Rejects Unsupported Shell
|
|
[Documentation] Completion with unknown shell should fail with usage exit code
|
|
${result}= Run Process ${PYTHON} -m cleveragents completion ksh
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 2
|
|
|
|
Version JSON Format Output
|
|
[Documentation] --format json version should produce valid JSON (global flag)
|
|
${result}= Run Process ${PYTHON} -m cleveragents --format json version
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
${valid}= Is Valid Json ${result.stdout}
|
|
Should Be True ${valid} Output is not valid JSON: ${result.stdout}
|
|
|
|
Version YAML Format Output
|
|
[Documentation] --format yaml version should produce YAML with version key (global flag)
|
|
${result}= Run Process ${PYTHON} -m cleveragents --format yaml version
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} version:
|
|
|
|
Version Plain Format Output
|
|
[Documentation] --format plain version should produce plain key-value output (global flag)
|
|
${result}= Run Process ${PYTHON} -m cleveragents --format plain version
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} version:
|
|
|
|
CLI Error Format Is Standardized
|
|
[Documentation] cli_error should output Error: prefix and Hint: line
|
|
${result}= Verify Cli Error Format ${PYTHON}
|
|
Should Be Equal As Integers ${result}[rc] 1
|
|
Should Contain ${result}[stdout] Error:
|
|
Should Contain ${result}[stdout] Hint:
|
|
|
|
CLI Not Found Format Is Standardized
|
|
[Documentation] cli_not_found should output not found message and exit 3
|
|
${result}= Verify Cli Not Found Format ${PYTHON}
|
|
Should Be Equal As Integers ${result}[rc] 3
|
|
Should Contain ${result}[stdout] not found
|
|
Should Contain ${result}[stdout] Hint:
|
|
|
|
Info Command JSON Format
|
|
[Documentation] --format json info should produce valid JSON (global flag)
|
|
${result}= Run Process ${PYTHON} -m cleveragents --format json info
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
${valid}= Is Valid Json ${result.stdout}
|
|
Should Be True ${valid} Output is not valid JSON: ${result.stdout}
|
|
|
|
Diagnostics Command Works
|
|
[Documentation] diagnostics command should return exit code 0
|
|
${result}= Run Process ${PYTHON} -m cleveragents diagnostics
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
Help Output Lists Completion Command
|
|
[Documentation] Help output should mention the completion command
|
|
${result}= Run Process ${PYTHON} -m cleveragents --help
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} completion
|