Skip to content

Safety Features

Renamify is built with safety as a core principle. Multiple layers of protection ensure your code remains intact during renaming operations.

  1. Plan: Generate a detailed preview of all changes without modifying anything
  2. Apply: Execute the plan atomically after review
Terminal window
# Step 1: Create and review the plan
renamify plan old_name new_name --preview table
# Step 2: Apply when satisfied
renamify apply

The rename command combines planning and applying with confirmation:

Terminal window
renamify rename old_name new_name --preview table
# Shows preview → asks for confirmation → applies atomically

All file modifications are atomic by default:

  1. Temporary files: Changes are written to temporary files first
  2. Atomic rename: Files are atomically renamed into place
  3. Directory sync: Parent directories are synced (on Unix systems)
  4. Rollback on failure: If any operation fails, all changes are rolled back
  • No partial states: Your codebase never exists in a half-modified state
  • Interruption safety: Safe to interrupt (Ctrl+C) during operations
  • Consistency: All changes succeed together or none at all

Before applying changes, Renamify creates backups of all affected files:

.renamify/
├── backups/
│ └── abc123-20241201-143022/
│ ├── src/
│ │ └── auth.js
│ └── components/
│ └── UserProfile.tsx
└── history.json
  • Each backup includes SHA-256 checksums
  • Checksums are verified during restore operations
  • Corrupted backups are detected and reported
Terminal window
# See all operations
renamify history
# Undo any operation by ID
renamify undo abc123
# Redo if you change your mind
renamify redo abc123

Renamify detects various types of conflicts before making changes:

Multiple-to-One: When multiple files would rename to the same destination

❌ Conflict detected: Multiple files would be renamed to 'utils.js':
- old_utils.js
- oldUtils.js
Use --exclude or --include patterns to resolve this conflict.

Case-Insensitive Filesystems: On macOS/Windows

⚠️ Case-insensitive rename detected: 'OldName.js' → 'oldName.js'
This will be handled with a two-step rename process.

Windows Reserved Names: Prevents creating invalid files

❌ Cannot create 'CON.js' - reserved filename on Windows
  • Overlapping matches: When the same text would be replaced multiple times
  • Boundary violations: When matches don’t respect word boundaries (with warnings)

Renamify prevents concurrent operations that could corrupt your workspace:

  • Lock file created at .renamify/renamify.lock during operations
  • Contains process ID and timestamp for tracking
  • Automatically cleaned up when operations complete
  • Stale locks (older than 5 minutes) are automatically removed
  • Manual cleanup if needed: rm .renamify/renamify.lock
Terminal window
# If you see this error:
Another renamify operation is in progress (PID: 12345)
# Check if the process is actually running:
ps 12345
# If not, remove the stale lock:
rm .renamify/renamify.lock

Renamify can check git status before operations:

Terminal window
# Apply with automatic git commit
renamify apply --commit
  • Commit before large rename operations: Makes git-based rollback possible
  • Clean working directory: Start with committed changes when possible
  • Branch for experiments: Use git branches for exploratory renaming

Preview changes without creating plan files:

Terminal window
# See what would change without any file creation
renamify dry-run old_name new_name --preview table

Perfect for:

  • Exploring potential changes
  • Testing include/exclude patterns
  • Understanding scope before committing to a plan
  • Permission errors: Clear reporting with suggested fixes
  • Disk space: Checks available space before large operations
  • Filesystem errors: Detailed error messages with context

When operations fail, Renamify provides:

  • Clear error messages: What went wrong and why
  • Recovery steps: How to fix the issue
  • Safe cleanup: How to return to a clean state
Terminal window
Error: Permission denied writing to 'src/readonly.js'
Suggestions:
1. Check file permissions: ls -la src/readonly.js
2. Make writable: chmod +w src/readonly.js
3. Or exclude from renaming: --exclude "src/readonly.js"

For advanced users who understand the risks:

Terminal window
# Apply even if conflicts are detected
renamify apply --force-with-conflicts
# Confirm case-insensitive or collision renames
renamify rename old new --confirm-collisions

⚠️ Warning: Force options bypass safety checks. Use only when you understand the implications and have backups.