Commit graph

9 commits

Author SHA1 Message Date
Daniel Riccio
8b4150e017
Refactor command execution and security handling
- Removed security warning detection from CommandExecution component and related tests.
- Simplified command parsing logic by consolidating command extraction and validation.
- Updated command pattern extraction to handle duplicate patterns gracefully.
- Enhanced command parsing to limit extracted patterns to a maximum of three levels.
- Removed unused security issue detection functions and related tests.
- Improved test coverage for command pattern extraction and validation.
2025-07-24 10:40:08 -05:00
hannesrudolph
38ed84b967 fix: consolidate command parsing logic and integrate security warnings
- Created shared command-parser.ts to eliminate duplicate parsing logic
- Integrated detectSecurityIssues to display warnings in the UI
- Made command suggestions configurable (only show when restrictions are enabled)
- Added comprehensive tests for the new command parser
- Updated existing tests to handle the new behavior
2025-07-23 12:01:09 -06:00
Roo Code
4b257fc628 refactor: simplify command pattern parser using shell-quote library
- Replace custom parsing logic with shell-quote library
- Implement simplified extractPatterns and processCommand functions
- Maintain all existing test compatibility
- Remove dependency on parseCommand from command-validation
2025-07-23 11:55:38 -06:00
hannesrudolph
0a25464cc3 refactor: eliminate code redundancy between extractCommandPatterns and parseCommand
- Refactored extractCommandPatterns to use the existing parseCommand function
- Ensures consistent command parsing behavior across the codebase
- Maintains security by removing subshell contents before parsing
- All existing tests continue to pass
2025-07-23 11:55:37 -06:00
hannesrudolph
f6642f6afe fix: prevent command output from appearing in permissions UI
- Fixed CommandExecution.tsx to only extract patterns from actual commands, not AI suggestions
- Enhanced extractCommandPatterns to filter out numeric patterns and common output words
- Added comprehensive test coverage for the bug scenario
- Ensures 'Manage Command Permissions' only shows actual executed commands

Fixes the issue where output like '0 total' from wc commands was incorrectly shown as a command pattern
2025-07-23 11:55:37 -06:00
hannesrudolph
ebf1b241c1 fix: improve command parsing to handle Output: separator correctly
- Fixed parseCommandAndOutput to properly handle the newline + 'Output:' separator
- Added test cases for commands with numbers at the start of output lines
- Updated existing tests to use template literals for proper newline handling
- Fixed test assertions to handle multiple code blocks when output is present

This resolves the issue where output lines starting with numbers (like 'wc -l' output)
were being incorrectly parsed as the command instead of the actual command text.
2025-07-23 11:55:37 -06:00
Roo Code
b24400b549 fix: address PR review feedback
- Refactored showSuggestions from state variable to constant SHOW_SUGGESTIONS
- Renamed breakingExps to stopPatterns for better clarity
- Added test coverage for edge cases in command parsing
- Fixed test assertion for multiline content handling
2025-07-23 11:55:37 -06:00
hannesrudolph
6fa0a528b9 fix: address PR review feedback
- Fix import error in CommandExecution.tsx (removed undefined parseCommandAndOutput)
- Add security features with detectSecurityIssues function for subshell detection
- Remove hardcoded command descriptions, use dynamic pattern instead
- Add comprehensive security tests for subshell detection
- Add integration tests for CommandExecution + CommandPatternSelector
- Fix Polish translation typo: 'z list' -> 'z listy'
- Simplify commandPatterns.ts by removing unnecessary complexity
2025-07-23 11:55:37 -06:00
hannesrudolph
6fda13643c feat: Add terminal command permissions UI to chat interface (#5480) 2025-07-23 11:55:37 -06:00