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: Escape removes pending reference trigger from prompt
    Given a TUI prompt value "inspect @reso"
    When I clear pending TUI reference token via escape
    Then the TUI prompt value should be "inspect"

  Scenario: Escape removes pending reference token embedded in text
    Given a TUI prompt value "draft notes about @README.md formatting"
    When I clear pending TUI reference token via escape
    Then the TUI prompt value should be "draft notes about formatting"
