forked from cleveragents/cleveragents-core
f48eb5a05f
Implement `agents repl` command providing an interactive read-eval-print loop that dispatches to existing CLI commands without the `agents` prefix. Features: - Command dispatch via existing Typer app - readline history with --no-history opt-out (default: ~/.cleveragents/history) - Tab-completion for all CLI commands and built-in commands - !! last-command repetition - Prompt context from CLEVERAGENTS_PROJECT / CLEVERAGENTS_PLAN env vars - Ctrl+C (continue) and Ctrl+D (exit) signal handling - Multi-line input with \ continuation - :help and :exit/:quit built-in commands Test coverage: - 15 Behave scenarios (features/repl.feature) - 10 Robot Framework smoke tests (robot/repl_smoke.robot) - ASV benchmark suite (benchmarks/repl_bench.py) - All nox sessions pass: lint, typecheck, unit_tests, integration_tests - Coverage: 97.2% (threshold: 97%)
86 lines
2.9 KiB
Gherkin
86 lines
2.9 KiB
Gherkin
Feature: Interactive REPL
|
|
The `agents repl` command provides an interactive session for dispatching
|
|
CLI commands without the leading `agents` prefix.
|
|
|
|
Scenario: REPL dispatches version command
|
|
Given the REPL is started
|
|
When I send the input "version"
|
|
Then the REPL output should contain "CleverAgents"
|
|
And the REPL exit code should be 0
|
|
|
|
Scenario: REPL handles :exit command
|
|
Given the REPL is started
|
|
When I send the input ":exit"
|
|
Then the REPL should exit cleanly
|
|
|
|
Scenario: REPL handles :quit command
|
|
Given the REPL is started
|
|
When I send the input ":quit"
|
|
Then the REPL should exit cleanly
|
|
|
|
Scenario: REPL handles :help command
|
|
Given the REPL is started
|
|
When I send the input ":help"
|
|
Then the REPL output should contain "Built-in commands"
|
|
And the REPL output should contain ":exit"
|
|
|
|
Scenario: REPL handles unknown command gracefully
|
|
Given the REPL is started
|
|
When I send the input "nonexistent-cmd"
|
|
Then the REPL output should contain "Error"
|
|
|
|
Scenario: REPL repeats last command with !!
|
|
Given the REPL is started
|
|
When I send the input "version"
|
|
And I send the input "!!"
|
|
Then the REPL output should contain "CleverAgents"
|
|
|
|
Scenario: REPL reports no previous command for !!
|
|
Given the REPL is started
|
|
When I send the input "!!"
|
|
Then the REPL output should contain "No previous command"
|
|
|
|
Scenario: REPL supports multi-line input
|
|
Given the REPL is started
|
|
When I send a multi-line version command
|
|
Then the REPL output should contain "CleverAgents"
|
|
|
|
Scenario: REPL with history disabled
|
|
Given the REPL is started with --no-history
|
|
When I send the input "version"
|
|
Then the REPL output should contain "CleverAgents"
|
|
And no history file should be written
|
|
|
|
Scenario: REPL with history enabled writes history file
|
|
Given the REPL is started with a custom history path
|
|
When I send the input "version"
|
|
And the REPL exits
|
|
Then the history file should exist
|
|
|
|
Scenario: REPL shows prompt context from environment
|
|
Given the environment variable "CLEVERAGENTS_PROJECT" is set to "myproj"
|
|
And the environment variable "CLEVERAGENTS_PLAN" is set to "myplan"
|
|
When I query the REPL prompt context
|
|
Then the prompt should contain "myproj"
|
|
And the prompt should contain "myplan"
|
|
|
|
Scenario: REPL handles Ctrl-C gracefully
|
|
Given the REPL is started
|
|
When I simulate a KeyboardInterrupt during input
|
|
Then the REPL should continue running
|
|
|
|
Scenario: REPL handles Ctrl-D for clean exit
|
|
Given the REPL is started
|
|
When I simulate an EOFError during input
|
|
Then the REPL should exit cleanly
|
|
|
|
Scenario: REPL handles empty input
|
|
Given the REPL is started
|
|
When I send an empty input line
|
|
Then the REPL should continue without error
|
|
|
|
Scenario: REPL dispatches config list command
|
|
Given the REPL is started
|
|
When I send the input "config list --format json"
|
|
Then the REPL exit code should be 0
|