Skip to main content

check_command_safety

Check if a command (potentially with chaining) is safe to execute. Parameters:
  • command (str): The command string to check
  • allowed_commands (Optional[Set[str]]): Set of allowed commands (whitelist mode)
Returns: Tuple[bool, str]: (is_safe, reason)

sanitize_command

A comprehensive command sanitizer for both local and Docker backends. Parameters:
  • command (str): The command to sanitize
  • use_docker_backend (bool): Whether using Docker backend
  • safe_mode (bool): Whether to apply security checks
  • working_dir (Optional[str]): Working directory for path validation
  • allowed_commands (Optional[Set[str]]): Set of allowed commands
Returns: Tuple[bool, str]: (is_safe, message_or_command)

is_uv_environment

Detect whether the current Python runtime is managed by uv.

ensure_uv_available

Ensure uv is available, installing it if necessary. Parameters:
  • update_callback: Optional callback function to receive status updates
Returns: Tuple[bool, Optional[str]]: (success, uv_path)

setup_initial_env_with_uv

Set up initial environment using uv.

setup_initial_env_with_venv

Set up initial environment using standard venv.

clone_current_environment

Clone the current Python environment to a new virtual environment. This function creates a new virtual environment with the same Python version as the current environment and installs all packages from the current environment. Parameters:
  • env_path: Path where the new environment will be created.
  • working_dir: Working directory for subprocess commands.
  • update_callback: Optional callback for status updates.
Returns: True if the environment was created successfully, False otherwise.

check_nodejs_availability

Check if Node.js is available without modifying the system.