*** Settings ***
Library    Process
Library    String

*** Test Cases ***
TUI Input Modes Router Initialization
    [Tags]    tdd_issue    tdd_issue_1928
    ${script}=    Catenate    SEPARATOR=\n
    ...    from cleveragents.tui.input.modes import InputModeRouter, InputMode
    ...    router = InputModeRouter(command_handler=lambda cmd: "ok")
    ...    mode = router.detect_mode("hello world")
    ...    assert mode == InputMode.NORMAL, f"Expected NORMAL mode, got {mode}"
    ...    print("input-mode-router-ok")
    ${result}=    Run Process    ${PYTHON}    -c    ${script}    shell=False
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    input-mode-router-ok

TUI Input Reference Parser Functionality
    [Tags]    tdd_issue    tdd_issue_1928
    ${script}=    Catenate    SEPARATOR=\n
    ...    from cleveragents.tui.input.reference_parser import parse_references, ReferenceParseResult
    ...    text = "check @README and @config.yaml"
    ...    result = parse_references(text)
    ...    assert isinstance(result, ReferenceParseResult), "parse_references should return ReferenceParseResult"
    ...    print("reference-parser-ok")
    ${result}=    Run Process    ${PYTHON}    -c    ${script}    shell=False
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    reference-parser-ok

TUI Input Shell Executor Initialization
    [Tags]    tdd_issue    tdd_issue_1928
    ${script}=    Catenate    SEPARATOR=\n
    ...    from cleveragents.tui.input.shell_exec import run_shell_command, ShellResult
    ...    assert callable(run_shell_command), "run_shell_command should be callable"
    ...    result = run_shell_command("echo ok")
    ...    assert isinstance(result, ShellResult), "run_shell_command should return ShellResult"
    ...    print("shell-executor-ok")
    ${result}=    Run Process    ${PYTHON}    -c    ${script}    shell=False
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    shell-executor-ok
