Files
cleveragents-core/robot/repl_smoke.robot
brent.edwards f48eb5a05f
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 19s
CI / build (pull_request) Successful in 24s
CI / security (pull_request) Successful in 34s
CI / typecheck (pull_request) Successful in 43s
CI / integration_tests (pull_request) Successful in 2m37s
CI / unit_tests (pull_request) Successful in 6m12s
CI / docker (pull_request) Successful in 1m1s
CI / benchmark-regression (pull_request) Successful in 15m33s
CI / coverage (pull_request) Successful in 21m54s
feat(cli): add interactive repl
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%)
2026-02-23 03:11:12 +00:00

68 lines
2.6 KiB
Plaintext

*** Settings ***
Documentation REPL command smoke tests for CleverAgents
Resource ${CURDIR}/common.resource
Library Process
Library OperatingSystem
Library String
Library Collections
Library ${CURDIR}/helper_repl_smoke.py
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
*** Variables ***
${PYTHON} python
*** Test Cases ***
REPL Help Flag Displays Usage
[Documentation] ``agents repl --help`` shows the REPL help text
${result}= Run Process ${PYTHON} -m cleveragents repl --help timeout=60s
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} interactive REPL session
REPL Module Is Importable
[Documentation] The repl module can be imported without errors
${result}= Run Process ${PYTHON} -c from cleveragents.cli.commands.repl import run_repl, dispatch_command timeout=60s
Should Be Equal As Integers ${result.rc} 0
REPL Prompt Context Without Env Vars
[Documentation] Default prompt context is ``agents> ``
${prompt}= Get Default Prompt
Should Be Equal ${prompt} agents>${{' '}}
REPL Prompt Context With Project
[Documentation] Prompt contains the project name from env var
${prompt}= Get Prompt With Project myproj
Should Contain ${prompt} myproj
REPL Prompt Context With Project And Plan
[Documentation] Prompt contains project/plan from env vars
${prompt}= Get Prompt With Project And Plan myproj myplan
Should Contain ${prompt} myproj
Should Contain ${prompt} myplan
REPL Dispatch Version Command
[Documentation] dispatch_command(["--version"]) returns 0
${rc}= Dispatch Argv --version
Should Be Equal As Integers ${rc} 0
REPL Run With Immediate EOF Exits Cleanly
[Documentation] REPL with no input (immediate EOF) exits with code 0
${rc}= Run Repl With Eof
Should Be Equal As Integers ${rc} 0
REPL Help Builtin Shows Commands
[Documentation] ``:help`` built-in prints available commands
${output}= Run Repl With Help
Should Contain ${output} Built-in commands
Should Contain ${output} :exit
REPL No Previous Command Warning
[Documentation] ``!!`` with no prior command shows a warning
${output}= Run Repl With Bang Bang
Should Contain ${output} No previous command
REPL Completer Is Installed
[Documentation] Tab completer recognises known REPL commands
${ok}= Verify Completer
Should Be True ${ok}