Files
cleveragents-core/features/tui_input_modes.feature
T
HAL9000 0050a0ed50 fix: detect dollar prefix as shell mode trigger in InputModeRouter
The spec requires both ! and dollar sign to activate shell mode, but
detect_mode() only recognised ! as the shell mode trigger. This caused
dollar-prefixed inputs like dollar-sign-echo-hello to be routed to NORMAL
mode instead of SHELL mode.

- Add dollar sign to detect_mode() shell prefix check alongside !
- Add BDD tests for dollar prefix shell mode detection
- Add step definitions for detect_mode() direct testing

Closes #10412
2026-04-24 03:01:13 +00:00

60 lines
2.3 KiB
Gherkin

Feature: TUI input modes
TUI prompt supports normal reference mode, slash command mode, and shell mode.
Scenario: Normal mode expands @ references
When I parse TUI references for "inspect @README.md"
Then the parsed line should include "@resource:README.md"
Scenario: Command mode dispatches slash command handler
When I route TUI input "/help"
Then the TUI mode should be "command"
And the TUI command result should be "ok:/help"
Scenario: Shell mode runs host command
When I route TUI input "!echo hello"
Then the TUI mode should be "shell"
And the TUI shell stdout should contain "hello"
Scenario: Shell mode blocks dangerous command by default
When I route TUI input "!rm -rf /"
Then the TUI mode should be "shell"
And the TUI shell stderr should contain "blocked dangerous shell command"
Scenario: Dangerous shell pattern detection helper
When I check shell danger detection for "rm -rf /tmp"
Then shell danger detection result should be "true"
When I check shell danger detection for "echo hello"
Then shell danger detection result should be "false"
Scenario: Reference catalog ignores .git and caches scans
Given a deterministic TUI reference fixture
When I parse and suggest TUI references using fixture
Then TUI walk count should be "1"
And TUI suggestions should not include ".git/secret.txt"
Scenario: TUI app fallback path reports missing textual dependency
When I check TUI app textual availability flag
Then TUI textual availability should be boolean
When I run fallback TUI app
Then fallback TUI app should fail with "Textual dependency missing."
Scenario: Dollar prefix activates shell mode
When I route TUI input "$echo hello"
Then the TUI mode should be "shell"
And the TUI shell stdout should contain "hello"
Scenario: Dollar prefix detect_mode returns shell
When I detect mode for "$echo hello"
Then the detected mode should be "shell"
Scenario: Dollar prefix with leading whitespace activates shell mode
When I detect mode for " $echo hello"
Then the detected mode should be "shell"
Scenario: Dollar prefix blocks dangerous command by default
When I route TUI input "$rm -rf /"
Then the TUI mode should be "shell"
And the TUI shell stderr should contain "blocked dangerous shell command"