Files
cleveragents-core/features/cli/error_handling.feature
T
HAL9000 cf9ec83374 fix(cli): add CLIOutputManager and helper functions to output module
Resolves ImportError in cli_error_handling_steps.py by implementing the CLIOutputManager class and display_* helper functions that were referenced in BDD tests but missing from the output package.

Also fixes duplicate step definitions that conflicted with existing cli_output_formats_steps.py by renaming the ambiguous steps.
2026-06-06 00:56:05 -04:00

89 lines
3.4 KiB
Gherkin

Feature: Unified CLI Error Handling and User Feedback
As a CLI user
I want consistent error messages and user feedback across all commands
So that I have a predictable and professional experience
Background:
Given the CLI output manager is initialized
And the output format is set to "rich"
Scenario: Display success message
When I display a success message "Operation completed successfully"
Then the message should be displayed in green
And the message should contain a checkmark symbol
Scenario: Display warning message
When I display a warning message "This action may have side effects"
Then the message should be displayed in yellow
And the message should contain a warning indicator
Scenario: Display error message without debug
When I display an error with label "Validation Error" and message "Invalid input"
And debug mode is disabled
Then the error should be displayed in red
And no stack trace should be shown
Scenario: Display error message with debug
When I display an error with label "Validation Error" and message "Invalid input"
And debug mode is enabled
Then the error should be displayed in red
And the stack trace should be shown
Scenario: Display success panel
When I display a success panel with title "Success" and content "All operations completed"
Then a green panel should be displayed
And the panel should contain the title "Success"
Scenario: Display error panel
When I display an error panel with title "Error" and content "Operation failed"
Then a red panel should be displayed
And the panel should contain the title "Error"
Scenario: Display table with rich format
When I display a table with columns "Name, Status, Created"
And the table contains 2 rows of data
And the output format is "rich"
Then a formatted table should be displayed
And the table should have 3 columns
Scenario: Display table with JSON format
When I display a table with columns "Name, Status, Created"
And the table contains 2 rows of data
And the output format is "json"
Then JSON output should be displayed
And the CLI output should be valid JSON
Scenario: Display table with YAML format
When I display a table with columns "Name, Status, Created"
And the table contains 2 rows of data
And the output format is "yaml"
Then YAML output should be displayed
And the CLI output should be valid YAML
Scenario: Handle CleverAgentsError exception
When a CleverAgentsError is raised with message "Resource not found"
And the error is handled by the CLI output manager
Then a user-friendly error message should be displayed
And the application should exit with code 1
Scenario: Handle unexpected exception
When an unexpected exception is raised with message "Something went wrong"
And the error is handled by the CLI output manager
Then a generic error message should be displayed
And the application should exit with code 1
Scenario: Display info message
When I display an info message "Processing started"
Then the message should be displayed
And the message should be readable
Scenario: Error output goes to stderr
When an error is displayed
Then the error should be written to stderr
And not to stdout
Scenario: Success output goes to stdout
When a success message is displayed
Then the message should be written to stdout
And not to stderr