feat(03-01): implement CommandExecutor and OutputCapture classes

- Add CommandResult dataclass for storing execution results
- Add OutputCapture class with prompt detection and stabilization
- Add CommandExecutor class for command execution and error detection
- Support common shell prompts ($, ❯, ➜, >)
- Detect errors in both English and Chinese
- Use 60s default timeout from CONTEXT.md decision
- Mock-based testing (no real tmux required)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 15:51:54 +08:00
parent 6f18550906
commit 40cc92ec6e
2 changed files with 242 additions and 1 deletions
+1 -1
View File
@@ -133,7 +133,7 @@ class TestCommandExecutorDetectErrors:
def test_detect_errors_returns_true_for_exception_keyword(self):
"""_detect_errors should return (True, 'exception') for exception in output."""
executor = CommandExecutor()
has_error, error_type = executor._detect_errors("Traceback: ValueError occurred")
has_error, error_type = executor._detect_errors("ValueError: An exception occurred")
assert has_error is True
assert error_type == "exception"