diff --git a/robot/tui_commands_integration.robot b/robot/tui_commands_integration.robot new file mode 100644 index 000000000..02d6907e0 --- /dev/null +++ b/robot/tui_commands_integration.robot @@ -0,0 +1,48 @@ +*** Settings *** +Library Process +Library String + +*** Test Cases *** +TUI Commands Module Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.commands import TuiCommandRouter + ... assert callable(TuiCommandRouter), "TuiCommandRouter should be a callable class" + ... print("command-handler-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} command-handler-ok + +TUI Slash Catalog Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.slash_catalog import SLASH_COMMAND_SPECS, slash_command_names + ... names = slash_command_names() + ... assert len(names) > 0, "Slash catalog should have commands" + ... assert len(SLASH_COMMAND_SPECS) > 0, "SLASH_COMMAND_SPECS should be non-empty" + ... print("slash-catalog-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} slash-catalog-ok + +TUI First Run Module Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.first_run import is_first_run, create_default_persona_for_actor + ... assert callable(is_first_run), "is_first_run should be callable" + ... assert callable(create_default_persona_for_actor), "create_default_persona_for_actor should be callable" + ... print("first-run-handler-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} first-run-handler-ok + +TUI Quotes Module Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.quotes import THROBBER_QUOTES + ... assert isinstance(THROBBER_QUOTES, tuple), "THROBBER_QUOTES should be a tuple" + ... assert len(THROBBER_QUOTES) > 0, "THROBBER_QUOTES should be non-empty" + ... print("quote-provider-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} quote-provider-ok diff --git a/robot/tui_input_integration.robot b/robot/tui_input_integration.robot new file mode 100644 index 000000000..a00aca592 --- /dev/null +++ b/robot/tui_input_integration.robot @@ -0,0 +1,40 @@ +*** 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 diff --git a/robot/tui_permissions_integration.robot b/robot/tui_permissions_integration.robot new file mode 100644 index 000000000..e99bb5654 --- /dev/null +++ b/robot/tui_permissions_integration.robot @@ -0,0 +1,38 @@ +*** Settings *** +Library Process +Library String + +*** Test Cases *** +TUI Permissions Service Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.permissions.service import PermissionRequestService + ... service = PermissionRequestService() + ... assert service is not None, "PermissionRequestService should be initialized" + ... print("permission-service-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} permission-service-ok + +TUI Permissions Models Validation + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.permissions.models import PermissionDecision, FileChangeType, PermissionRequest + ... assert PermissionDecision.ALLOW_ONCE == "allow_once", "PermissionDecision.ALLOW_ONCE should equal allow_once" + ... assert FileChangeType.MODIFIED == "M", "FileChangeType.MODIFIED should equal M" + ... req = PermissionRequest(path="/test/file.py", change_type=FileChangeType.MODIFIED) + ... assert req.path == "/test/file.py", "PermissionRequest path should be set" + ... print("permission-models-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} permission-models-ok + +TUI Permissions Screen Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.permissions.screen import PermissionsScreen + ... assert callable(PermissionsScreen), "PermissionsScreen should be a callable class" + ... print("permission-screen-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} permission-screen-ok diff --git a/robot/tui_persona_integration.robot b/robot/tui_persona_integration.robot new file mode 100644 index 000000000..352c746d3 --- /dev/null +++ b/robot/tui_persona_integration.robot @@ -0,0 +1,41 @@ +*** Settings *** +Library Process +Library String + +*** Test Cases *** +TUI Persona Registry Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.persona.registry import PersonaRegistry + ... registry = PersonaRegistry() + ... assert registry is not None, "PersonaRegistry should be initialized" + ... print("persona-registry-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} persona-registry-ok + +TUI Persona Schema Validation + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.persona.schema import Persona + ... persona = Persona(name="test", actor="local/test-actor", description="Test persona") + ... assert persona.name == "test", "Persona name should be set" + ... assert persona.actor == "local/test-actor", "Persona actor should be set" + ... print("persona-schema-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} persona-schema-ok + +TUI Persona State Management + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.persona.registry import PersonaRegistry + ... from cleveragents.tui.persona.state import PersonaState + ... registry = PersonaRegistry() + ... state = PersonaState(registry=registry) + ... assert state is not None, "PersonaState should be initialized" + ... assert state.registry is registry, "PersonaState registry should be the one passed in" + ... print("persona-state-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} persona-state-ok diff --git a/robot/tui_search_integration.robot b/robot/tui_search_integration.robot new file mode 100644 index 000000000..64878093f --- /dev/null +++ b/robot/tui_search_integration.robot @@ -0,0 +1,29 @@ +*** Settings *** +Library Process +Library String + +*** Test Cases *** +TUI Search Fuzzy Matcher Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.search.fuzzy import rank_candidates, FuzzyCandidate + ... assert callable(rank_candidates), "rank_candidates should be callable" + ... assert callable(FuzzyCandidate), "FuzzyCandidate should be a callable class" + ... print("fuzzy-matcher-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} fuzzy-matcher-ok + +TUI Search Fuzzy Matching Functionality + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.search.fuzzy import rank_candidates + ... items = ["hello", "world", "help"] + ... results = rank_candidates("hel", items) + ... assert results is not None, "rank_candidates should return results" + ... assert len(results) > 0, "rank_candidates should match at least one item" + ... assert results[0].value in ("hello", "help"), f"Top match should be hello or help, got {results[0].value}" + ... print("fuzzy-matching-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} fuzzy-matching-ok diff --git a/robot/tui_shell_safety_integration.robot b/robot/tui_shell_safety_integration.robot new file mode 100644 index 000000000..e33625784 --- /dev/null +++ b/robot/tui_shell_safety_integration.robot @@ -0,0 +1,80 @@ +*** Settings *** +Library Process +Library String + +*** Test Cases *** +TUI Shell Safety Service Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.shell_safety.safety_service import ShellSafetyService + ... service = ShellSafetyService() + ... assert service is not None, "ShellSafetyService should be initialized" + ... result = service.check_command("echo hello") + ... assert result.allowed, "Safe command should be allowed" + ... print("safety-service-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} safety-service-ok + +TUI Shell Safety Danger Level Detection + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.shell_safety.danger_level import ShellDangerLevel + ... assert ShellDangerLevel.HIGH is not None, "ShellDangerLevel.HIGH should be defined" + ... assert ShellDangerLevel.CRITICAL > ShellDangerLevel.LOW, "CRITICAL should be greater than LOW" + ... print("danger-level-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} danger-level-ok + +TUI Shell Safety Pattern Detector + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.shell_safety.pattern_detector import DangerousPatternDetector + ... detector = DangerousPatternDetector() + ... assert detector is not None, "DangerousPatternDetector should be initialized" + ... warning = detector.check_first("rm -rf /") + ... assert warning is not None, "Dangerous command should produce a warning" + ... print("pattern-detector-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} pattern-detector-ok + +TUI Shell Safety Pattern Registry + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.shell_safety.pattern_registry import DEFAULT_PATTERNS + ... assert len(DEFAULT_PATTERNS) > 0, "DEFAULT_PATTERNS should be non-empty" + ... assert all(hasattr(p, "name") for p in DEFAULT_PATTERNS), "Each pattern should have a name" + ... print("pattern-registry-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} pattern-registry-ok + +TUI Shell Safety Dangerous Pattern Models + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.shell_safety.dangerous_pattern import DangerousPattern + ... from cleveragents.tui.shell_safety.danger_level import ShellDangerLevel + ... pattern = DangerousPattern(name="test", pattern=r".*test.*", level=ShellDangerLevel.LOW, description="Test pattern") + ... assert pattern.name == "test", "Pattern name should be set" + ... assert pattern.matches("this is a test"), "Pattern should match 'test'" + ... print("dangerous-pattern-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} dangerous-pattern-ok + +TUI Shell Safety Warning Models + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.shell_safety.warning import DangerousCommandWarning + ... from cleveragents.tui.shell_safety.dangerous_pattern import DangerousPattern + ... from cleveragents.tui.shell_safety.danger_level import ShellDangerLevel + ... pattern = DangerousPattern(name="rm_root", pattern=r"rm -rf /", level=ShellDangerLevel.CRITICAL, description="Deletes root") + ... warning = DangerousCommandWarning.from_pattern("rm -rf /", pattern) + ... assert warning.message is not None, "Warning message should be set" + ... assert warning.danger_level == ShellDangerLevel.CRITICAL, "Danger level should match pattern" + ... print("warning-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} warning-ok diff --git a/robot/tui_widgets_integration.robot b/robot/tui_widgets_integration.robot new file mode 100644 index 000000000..1ae755156 --- /dev/null +++ b/robot/tui_widgets_integration.robot @@ -0,0 +1,94 @@ +*** Settings *** +Library Process +Library String + +*** Test Cases *** +TUI Widgets Actor Selection Overlay Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.widgets.actor_selection_overlay import ActorSelectionOverlay + ... assert callable(ActorSelectionOverlay), "ActorSelectionOverlay should be a callable class" + ... print("actor-selection-overlay-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} actor-selection-overlay-ok + +TUI Widgets Persona Bar Rendering + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.widgets.persona_bar import PersonaBar + ... assert callable(PersonaBar), "PersonaBar should be a callable class" + ... print("persona-bar-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} persona-bar-ok + +TUI Widgets Prompt Input Submission + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.widgets.prompt import PromptInput + ... assert callable(PromptInput), "PromptInput should be a callable class" + ... print("prompt-input-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} prompt-input-ok + +TUI Widgets Reference Picker Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.widgets.reference_picker import ReferencePickerOverlay + ... assert callable(ReferencePickerOverlay), "ReferencePickerOverlay should be a callable class" + ... print("reference-picker-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} reference-picker-ok + +TUI Widgets Slash Command Overlay Initialization + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.widgets.slash_command_overlay import SlashCommandOverlay + ... assert callable(SlashCommandOverlay), "SlashCommandOverlay should be a callable class" + ... print("slash-command-overlay-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} slash-command-overlay-ok + +TUI Widgets Thought Block Rendering + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.widgets.thought_block import ThoughtBlockWidget + ... assert callable(ThoughtBlockWidget), "ThoughtBlockWidget should be a callable class" + ... print("thought-block-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} thought-block-ok + +TUI Widgets Throbber Animation + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.widgets.throbber import LoadingThrobber + ... assert callable(LoadingThrobber), "LoadingThrobber should be a callable class" + ... print("throbber-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} throbber-ok + +TUI Widgets Permission Question Widget + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.widgets.permission_question import PermissionQuestionWidget + ... assert callable(PermissionQuestionWidget), "PermissionQuestionWidget should be a callable class" + ... print("permission-question-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} permission-question-ok + +TUI Widgets Help Panel Overlay + [Tags] tdd_issue tdd_issue_1928 + ${script}= Catenate SEPARATOR=\n + ... from cleveragents.tui.widgets.help_panel_overlay import HelpPanelOverlay + ... assert callable(HelpPanelOverlay), "HelpPanelOverlay should be a callable class" + ... print("help-panel-overlay-ok") + ${result}= Run Process ${PYTHON} -c ${script} shell=False + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} help-panel-overlay-ok