This pull request enhances the safety of shell command execution by introducing a check for dangerous commands and updating the notification messages accordingly. The most important changes include adding a utility function to identify dangerous commands, modifying the shell command execution logic to incorporate this check, and adding tests to validate the new functionality.
Safety Enhancements:
src/goose/utils/check_shell_command.py: Added a new utility function is_dangerous_command to identify potentially dangerous shell commands based on predefined patterns.
src/goose/toolkit/developer.py: Updated the shell method to use the is_dangerous_command function to check for dangerous commands before execution.
Notification Improvements:
src/goose/toolkit/developer.py: Changed the status message from "running shell command" to "planning to run shell command" before the danger check, and moved the "running shell command" message to after the check. [1][2]
Testing:
tests/utils/test_check_shell_command.py: Added tests to verify that the is_dangerous_command function correctly identifies dangerous commands and does not flag safe commands.
This pull request enhances the safety of shell command execution by introducing a check for dangerous commands and updating the notification messages accordingly. The most important changes include adding a utility function to identify dangerous commands, modifying the shell command execution logic to incorporate this check, and adding tests to validate the new functionality.
Safety Enhancements:
src/goose/utils/check_shell_command.py
: Added a new utility functionis_dangerous_command
to identify potentially dangerous shell commands based on predefined patterns.src/goose/toolkit/developer.py
: Updated theshell
method to use theis_dangerous_command
function to check for dangerous commands before execution.Notification Improvements:
src/goose/toolkit/developer.py
: Changed the status message from "running shell command" to "planning to run shell command" before the danger check, and moved the "running shell command" message to after the check. [1] [2]Testing:
tests/utils/test_check_shell_command.py
: Added tests to verify that theis_dangerous_command
function correctly identifies dangerous commands and does not flag safe commands.Import Adjustments:
src/goose/toolkit/developer.py
: Added an import statement for theis_dangerous_command
function.