Command Safety
Delta CLI's Command Safety feature protects you from accidentally running dangerous commands, providing intelligent warnings and safer alternatives before potential disasters occur.
How It Works
Real-time Analysis
Every command is analyzed in milliseconds before execution:
- Command parsing and intent detection
- Risk assessment based on context and patterns
- Comparison against known dangerous patterns
- Generation of safer alternatives when needed
Risk Levels
Low Risk (Score: 0-3)
Safe commands that pose minimal risk. Executed without warnings.
ls -la
pwd
echo "Hello World"
git status
Medium Risk (Score: 4-6)
Commands that could cause issues. Shows a warning but allows execution.
rm file.txt
git reset HEAD~1
sudo service nginx restart
High Risk (Score: 7-8)
Dangerous commands. Requires confirmation with explanation of risks.
rm -rf important_directory/
chmod -R 777 /
git push --force origin main
Critical Risk (Score: 9-10)
Extremely dangerous commands. Blocked by default unless explicitly overridden.
rm -rf / --no-preserve-root
dd if=/dev/random of=/dev/sda
:(){ :|:& };:
Safety in Action
File Deletion Protection
When you run:
delta rm -rf *
Delta CLI warns:
Permission Changes
When you run:
delta chmod -R 777 .
Delta CLI warns:
Git Force Push Protection
When you run:
delta git push --force origin main
Delta CLI warns:
Configuration
Customize Command Safety to match your risk tolerance and workflow:
Safety Levels
# Set overall safety level
delta :config safety.level strict # Block dangerous commands
delta :config safety.level normal # Warn but allow (default)
delta :config safety.level relaxed # Minimal warnings
# Check current setting
delta :config safety.level
Custom Rules
# Add custom dangerous patterns
delta :safety add-pattern "rm -rf /important/*"
# Whitelist safe commands
delta :safety whitelist "rm -rf node_modules"
# Set risk score for specific commands
delta :safety set-risk "docker system prune -a" 5
Directory-Specific Settings
# Extra protection for important directories
delta :safety protect ~/Documents --level=strict
delta :safety protect /etc --level=strict
# Relaxed rules for temporary directories
delta :safety protect /tmp --level=relaxed
Bypassing Safety Checks
Force Execution
# Force a single command
delta --force rm -rf important_file
# Or use the shorthand
delta -f rm -rf important_file
Temporary Disable
# Disable for current session
delta :safety off
# Re-enable
delta :safety on
API Integration
Integrate Delta CLI's Command Safety into your own tools and applications:
Command Safety API
Our API allows you to add the same safety checks to your AI assistants, automation tools, and command-line applications.
Learn about the Command Safety API →Best Practices
- Read safety warnings carefully
- Use suggested alternatives when provided
- Configure safety levels for your workflow
- Test dangerous commands in safe environments first
- Habitually bypass safety warnings
- Disable safety in production environments
- Ignore context in safety warnings
- Run unfamiliar commands without understanding
Next Steps
Command Safety is just one way Delta CLI protects and assists you. Explore more features:
- Learn about Error Recovery for automatic fixes when commands fail
- Explore the AI Assistant for intelligent command suggestions
- Configure Delta CLI to match your preferences