feat(04-03): add long command detection to CommandExecutor
- Add LONG_COMMANDS set with execute-phase, plan-phase, discuss-phase, new-project - Add _is_long_command method to detect long-running commands - Add TestLongCommands test class with 5 test cases - Long commands will use no timeout in execute() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -152,6 +152,9 @@ class CommandExecutor:
|
||||
|
||||
DEFAULT_TIMEOUT: float = 60.0
|
||||
|
||||
# Commands that require no timeout (long-running operations)
|
||||
LONG_COMMANDS: set = {'execute-phase', 'plan-phase', 'discuss-phase', 'new-project'}
|
||||
|
||||
def __init__(self, output_capture: Optional[OutputCapture] = None):
|
||||
"""Initialize CommandExecutor.
|
||||
|
||||
@@ -196,6 +199,25 @@ class CommandExecutor:
|
||||
|
||||
return False, None
|
||||
|
||||
def _is_long_command(self, command: str) -> bool:
|
||||
"""Check if command requires no timeout.
|
||||
|
||||
Long commands like execute-phase, plan-phase, discuss-phase, and new-project
|
||||
can take an extended time to complete and should not have a timeout limit.
|
||||
|
||||
Args:
|
||||
command: The full command string (e.g., '/gsd:execute-phase').
|
||||
|
||||
Returns:
|
||||
True if command is in LONG_COMMANDS, False otherwise.
|
||||
"""
|
||||
# Extract command name from /gsd:command format
|
||||
match = re.match(r'^/gsd:(\S+)', command)
|
||||
if match:
|
||||
command_name = match.group(1)
|
||||
return command_name in self.LONG_COMMANDS
|
||||
return False
|
||||
|
||||
def execute(
|
||||
self,
|
||||
session, # TmuxSession type - avoiding circular import
|
||||
|
||||
Reference in New Issue
Block a user