Files
cleveragents-core/tests/features/cli_integration.feature

153 lines
5.1 KiB
Gherkin

Feature: CLI Integration
As a user of CleverAgents
I want to use the command-line interface
So that I can run agent networks from the terminal
Background:
Given I have a working directory for CLI tests
Scenario: Generate example configurations
When I run "cleveragents generate-examples --output ./test-examples"
Then the command should succeed
And example files should be created in "./test-examples"
And the examples should include:
| filename |
| basic_reactive.yaml |
| advanced_reactive.yaml |
| collaboration_reactive.yaml |
Scenario: Run single-shot processing
Given I have a basic configuration file "basic.yaml":
"""
agents:
echo_agent:
type: tool
config:
tools: ["echo"]
safe_mode: true
routes:
echo_stream:
type: stream
stream_type: cold
operators:
- type: map
params:
agent: echo_agent
publications:
- __output__
merges:
- sources: [__input__]
target: echo_stream
"""
When I run "cleveragents run -c basic.yaml -p 'echo Hello CLI'"
Then the command should succeed
And the output should contain "Hello CLI"
Scenario: Visualize stream network
Given I have a complex configuration file "complex.yaml"
When I run "cleveragents visualize -c complex.yaml -f ascii"
Then the command should succeed
And the output should show the stream network structure
And it should display agents and streams
Scenario: Interactive session startup
Given I have a working directory for CLI tests
Given I have a basic configuration file "interactive.yaml"
"""
agents:
echo_agent:
type: tool
config:
tools: ["echo"]
routes:
echo_stream:
type: stream
stream_type: cold
operators:
- type: map
params:
agent: echo_agent
publications:
- __output__
merges:
- sources: [__input__]
target: echo_stream
"""
When I start "cleveragents interactive -c interactive.yaml"
Then the interactive session should start
And I should see the welcome message
And the prompt should be ready for input
Scenario: Verbose output mode
Given I have a working directory for CLI tests
Given I have a configuration file with multiple streams
When I run "cleveragents run -c config.yaml -p 'test message' --verbose"
Then the command should succeed
And the output should include debug information
And it should show stream processing details
Scenario: Configuration validation error
Given I have a working directory for CLI tests
Given I have an invalid configuration file "invalid.yaml":
"""
agents:
bad_agent:
type: nonexistent_type
"""
When I run "cleveragents run -c invalid.yaml -p 'test'"
Then the command should fail
And the error message should mention configuration problems
And the exit code should be 1
Scenario: Missing configuration file
When I run "cleveragents run -c nonexistent.yaml -p 'test'"
Then the command should fail
And the error message should mention the missing file
And the exit code should be 2
Scenario: Unsafe mode requirement
Given I have a working directory for CLI tests
Given I have a configuration requiring unsafe operations
When I run "cleveragents run -c unsafe.yaml -p 'write file'"
Then the command should fail
And the error message should mention the --unsafe flag
Scenario: Unsafe mode enabled
Given I have a working directory for CLI tests
Given I have a configuration requiring unsafe operations
When I run "cleveragents run -c unsafe.yaml -p 'write file' --unsafe"
Then the command should succeed
And unsafe operations should be allowed
Scenario: Multiple configuration files
Given I have a working directory for CLI tests
Given I have configuration files:
| filename | content_type |
| agents.yaml | agents |
| streams.yaml | streams |
| routing.yaml | routing |
When I run "cleveragents run -c agents.yaml -c streams.yaml -c routing.yaml -p 'test'"
Then the command should succeed
And all configuration files should be loaded and merged
Scenario: Help command
When I run "cleveragents --help"
Then the command should succeed
And the output should show available commands
And it should include usage examples
Scenario: Version information
When I run "cleveragents --version"
Then the command should succeed
And the output should show the version number
Scenario: Output to file
Given I have a working configuration file
When I run "cleveragents run -c config.yaml -p 'test message' -o output.txt"
Then the command should succeed
And the file "output.txt" should be created
And it should contain the agent response