Files
cleveragents-core/features/cli_main_shortcuts.feature
T

55 lines
2.9 KiB
Gherkin

Feature: CLI main shortcuts and exit handling coverage
As a developer
I want to ensure CLI shortcuts delegate correctly and main handles Typer results
So that uncovered branches in cleveragents.cli.main are exercised
Scenario: Shortcut "tell" delegates to plan tell with provided prompt and name
When I execute the CLI shortcut "tell" with argument list ["Draft spec", "--name", "alpha"]
Then the shortcut should exit with code 0
And the shortcut should forward keyword arguments {"prompt": "Draft spec", "name": "alpha", "stream": False}
Scenario: Shortcut "build" delegates to plan build with verbose flag
When I execute the CLI shortcut "build" with argument list ["--verbose"]
Then the shortcut should exit with code 0
And the shortcut should forward keyword arguments {"verbose": True}
Scenario: Shortcut "apply" delegates to plan apply with yes confirmation
When I execute the CLI shortcut "apply" with argument list ["-y"]
Then the shortcut should exit with code 0
And the shortcut should forward keyword arguments {"yes": True}
Scenario: Shortcut "context-load" delegates to context add with explicit paths
When I execute the CLI shortcut "context-load" with argument list ["readme.md", "src/main.py", "--no-recursive"]
Then the shortcut should exit with code 0
And the shortcut should forward keyword arguments {"paths": ["readme.md", "src/main.py"], "recursive": False}
Scenario: Shortcut "context-add" reuses context add shortcut logic
When I execute the CLI shortcut "context-add" with argument list ["notes.txt"]
Then the shortcut should exit with code 0
And the shortcut should forward keyword arguments {"paths": ["notes.txt"], "recursive": True}
Scenario: main converts Typer Exit return into exit code
When I execute main with stubbed return "exit" and value 7
Then main should return 7
And the Typer app should have received ["--help"] with standalone mode disabled
Scenario: main treats Typer Abort return as failure
When I execute main with stubbed return "abort" and value 0
Then main should return 1
And the Typer app should have received ["--help"] with standalone mode disabled
Scenario: main converts integer return to exit code
When I execute main with stubbed return "integer" and value 42
Then main should return 42
And the Typer app should have received ["--help"] with standalone mode disabled
Scenario: main defaults to success when Typer returns None
When I execute main with stubbed return "none" and value 0
Then main should return 0
And the Typer app should have received ["--help"] with standalone mode disabled
Scenario: main handles Typer abort exception
When I execute main with stubbed return "raise_abort" and value 0
Then main should return 1
And the Typer app should have received ["--help"] with standalone mode disabled