*** 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