95d3e09925
CI / build (push) Successful in 19s
CI / lint (push) Successful in 3m21s
CI / quality (push) Successful in 3m43s
CI / typecheck (push) Successful in 4m13s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 4m17s
CI / unit_tests (push) Successful in 5m45s
CI / docker (push) Successful in 1m3s
CI / integration_tests (push) Successful in 6m49s
CI / e2e_tests (push) Successful in 9m8s
CI / coverage (push) Failing after 13m47s
CI / benchmark-publish (push) Successful in 19m43s
CI / status-check (push) Failing after 1s
## Summary Final CLI polish and UX consistency pass: shared constants, centralized error formatting, shell completion, and standardized help text. ### New Modules - **`cli/constants.py`** (70 lines): Exit codes (`EXIT_SUCCESS`=0 through `EXIT_CONFLICT`=4), format defaults (`FORMAT_TEXT`, `FORMAT_JSON`, `FORMAT_TABLE`) - **`cli/errors.py`** (105 lines): `cli_error()` with hint support, `cli_warning()`, `cli_not_found()` with resource-type-aware hint ### CLI Changes - Shell `completion` command generating scripts for bash/zsh/fish/powershell - Standardized help text across command modules - Error functions exported from `cli/__init__.py` ### Tests - **17 Behave scenarios**: Exit codes, error formatting, cli_not_found, format constants, help text, completion - **15 Robot integration tests**: All subcommands respond to --help, invalid commands return non-zero, completion generation works ### Quality Gates | Session | Result | |---|---| | `nox -s lint` | PASS | | `nox -s typecheck` | PASS (0 errors) | | `nox -s unit_tests` | PASS (10,912 scenarios) | | `nox -s coverage_report` | 97% (>= 97%) | Closes #861 Reviewed-on: #1018 Co-authored-by: Brent E. Edwards <brent.edwards@cleverthis.com> Co-committed-by: Brent E. Edwards <brent.edwards@cleverthis.com>
136 lines
6.3 KiB
Plaintext
136 lines
6.3 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] version --format json should produce valid JSON
|
|
${result}= Run Process ${PYTHON} -m cleveragents version --format json
|
|
... 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] version --format yaml should produce YAML with version key
|
|
${result}= Run Process ${PYTHON} -m cleveragents version --format yaml
|
|
... timeout=120s on_timeout=kill
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} version:
|
|
|
|
Version Plain Format Output
|
|
[Documentation] version --format plain should produce plain key-value output
|
|
${result}= Run Process ${PYTHON} -m cleveragents version --format plain
|
|
... 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] info --format json should produce valid JSON
|
|
${result}= Run Process ${PYTHON} -m cleveragents info --format json
|
|
... 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
|