Safety System
DotClaude prioritizes safety with comprehensive backup, testing, and rollback systems.
Safety Philosophy
Non-Destructive Development: All changes are designed to coexist with your existing setup, never replacing anything without explicit confirmation and automatic backups.
Backup System
Automatic Backups
Every operation automatically creates timestamped backups:
# Backup all dotfiles
./scripts/backup.sh
# Backup specific component
./scripts/backup.sh git
./scripts/backup.sh zshBackup Structure
backups/
├── 20250618_131638/ # Timestamp directory
│ ├── MANIFEST # List of backed up files
│ ├── .zshrc # Original zshrc
│ ├── .gitconfig # Original gitconfig
│ └── .config/nvim/ # Original neovim config
└── 20250618_142305/ # Another backup sessionWhat Gets Backed Up
- Shell configs:
.zshrc,.bashrc,.bash_profile - Git configs:
.gitconfig,.gitignore_global - Editor configs:
.vimrc,.vim/,.config/nvim/ - Terminal configs:
.tmux.conf - Custom configs:
.aliases,.exports
Testing System
Pre-Deployment Testing
Never apply configurations without testing:
# Test all configurations
./scripts/test-config.sh all
# Test specific component
./scripts/test-config.sh git
./scripts/test-config.sh tmux
./scripts/test-config.sh stowWhat Gets Tested
- Syntax validation: Shell scripts, git configs, tmux configs
- Stow dry-runs: See what would be linked without actually linking
- Dependency checks: Ensure required tools are available
- Conflict detection: Identify potential file conflicts
Test Output
$ ./scripts/test-config.sh git
[INFO] Starting configuration tests...
[INFO] Component: git
[TEST] Testing Stow package: git
[TEST] Running Stow dry-run for git...
[INFO] Stow dry-run successful for git
[TEST] Testing Git configuration...
[INFO] Git configuration syntax is valid
[INFO] Configuration test completed successfullyRollback System
Interactive Restore
# Interactive restore with backup selection
./scripts/restore.sh
# Output:
Available backups:
20250618_142305
20250618_131638
Enter backup timestamp to restore (or 'latest' for most recent): latest
Enter component to restore (or 'all' for everything): gitQuick Restore
# Restore latest backup
./scripts/restore.sh latest
# Restore specific component from latest
./scripts/restore.sh latest git
# Restore specific backup
./scripts/restore.sh 20250618_131638 allSafety Confirmations
All destructive operations require explicit confirmation:
WARNING: This will overwrite existing files!
Continue with restore? (y/N):Safe Deployment
Package Management
Apply configurations incrementally:
# See what would be applied (dry-run)
./scripts/stow-package.sh git status
# Apply configuration
./scripts/stow-package.sh git
# Remove configuration
./scripts/stow-package.sh git removeCoexisting Tools
Modern tools are installed with safe aliases:
| Tool | Safe Alias | Original |
|---|---|---|
| exa/eza | ll2 | ls |
| bat | cat2 | cat |
| fd | find2 | find |
| ripgrep | grep2 | grep |
Your original commands continue working unchanged.
Emergency Procedures
Quick Rollback
If something breaks:
# 1. Restore from latest backup
./scripts/restore.sh latest
# 2. Remove problematic package
./scripts/stow-package.sh PACKAGE remove
# 3. Reload shell
exec $SHELLNuclear Option
Complete reset to original state:
# Remove all stow packages
for pkg in git tmux aliases environment; do
./scripts/stow-package.sh $pkg remove 2>/dev/null || true
done
# Restore from earliest backup
./scripts/restore.shSafety Best Practices
Before Making Changes
- Backup:
./scripts/backup.sh - Test:
./scripts/test-config.sh COMPONENT - Apply:
./scripts/stow-package.sh COMPONENT - Verify: Test functionality in new shell session
During Development
- Keep existing terminal sessions open
- Test new configurations in separate sessions
- Use
exec $SHELLto test shell configs safely - Document any changes or customizations
Regular Maintenance
# Weekly backup
./scripts/backup.sh
# Clean old backups (keep recent ones)
find backups/ -name "2024*" -type d | head -n -5 | xargs rm -rf
# Test all configurations
./scripts/test-config.sh allRecovery Examples
Git Configuration Issues
# Problem: git log looks wrong
# Solution: Restore git config
./scripts/restore.sh latest gitShell Issues
# Problem: shell won't load
# Solution: Open new terminal, restore shell config
./scripts/restore.sh latest zsh
exec $SHELLTmux Issues
# Problem: tmux keybindings broken
# Solution: Remove tmux config, restart tmux
./scripts/stow-package.sh tmux remove
tmux kill-server
tmuxConfidence Building
The safety system is designed to give you confidence to experiment:
- ✅ Nothing is permanent - everything can be rolled back
- ✅ Gradual adoption - use new tools when ready
- ✅ Coexistence - old and new tools work together
- ✅ Testing first - verify before applying
- ✅ Automatic backups - never lose your original setup
With these safety nets in place, you can confidently explore modern development tools while knowing your working environment is protected.
Next Steps
- Quick Setup - Apply your first configurations safely
- Modern Tools - Learn about the new CLI tools available
- Troubleshooting - Common issues and solutions