renamify rename
The rename
command is the fastest way to rename terms in your codebase.
It combines planning and applying in a single interactive command with preview and confirmation.
renamify rename <OLD> <NEW> [PATHS]... [OPTIONS]
Arguments
Section titled “Arguments”<OLD>
- Old identifier to replace<NEW>
- New identifier to replace with[PATHS]...
- Search paths (files or directories)
Options
Section titled “Options”Preview and Confirmation
Section titled “Preview and Confirmation”--preview <FORMAT>
- Show preview before confirmation (table, diff, json, none) [default: table]--dry-run
- Show preview only, don’t apply changes--large
- Acknowledge large changes (>500 files or >100 renames)
File Processing
Section titled “File Processing”--include <PATTERNS>
- Only process files matching these glob patterns--exclude <PATTERNS>
- Skip files matching these glob patterns--no-rename-files
- Don’t rename matching files--no-rename-dirs
- Don’t rename matching directories
Root Directory
Section titled “Root Directory”--rename-root
- Allow renaming the root project directory (requires confirmation)--no-rename-root
- Never rename the root project directory
Case Styles
Section titled “Case Styles”--exclude-styles <STYLES>
- Exclude specific case styles from the default set--include-styles <STYLES>
- Add additional case styles to the active set--only-styles <STYLES>
- Use only these case styles, ignoring defaults
Match Control
Section titled “Match Control”--exclude-match <PATTERNS>
- Skip specific matches (e.g., compound words to ignore)--exclude-matching-lines <REGEX>
- Skip matches on lines matching this regex pattern
Acronym Handling
Section titled “Acronym Handling”--no-acronyms
- Disable acronym detection and transformation--include-acronyms <ACRONYMS>
- Add custom acronyms to detect (e.g., “API,URL”)--exclude-acronyms <ACRONYMS>
- Exclude specific acronyms from detection--only-acronyms <ACRONYMS>
- Only use these acronyms, ignore defaults
Display Options
Section titled “Display Options”--fixed-table-width
- Use fixed column widths in table output for consistent formatting
Safety and Git
Section titled “Safety and Git”--commit
- Create a git commit after applying changes--force-with-conflicts
- Force apply even with conflicts--confirm-collisions
- Confirm case-insensitive or collision renames
Unrestricted Mode
Section titled “Unrestricted Mode”-u
- Disable .gitignore files-uu
- Disable all ignore files, include hidden files-uuu
- Disable all ignore files, include hidden files, process binary files
Examples
Section titled “Examples”Basic Rename
Section titled “Basic Rename”# Rename with automatic preview and confirmationrenamify rename getUserName fetchUserProfile
# Or specify specific pathsrenamify rename getUserName fetchUserProfile src/ tests/
Specific File Types
Section titled “Specific File Types”# Only process TypeScript files using patternsrenamify rename oldName newName --include "**/*.{ts,tsx}"
# Or use specific pathsrenamify rename oldName newName src/components/ src/utils/
Exclude Certain Areas
Section titled “Exclude Certain Areas”# Skip test files and node_modulesrenamify rename oldApi newApi \ --exclude "**/*test*,node_modules/**"
Case Style Control
Section titled “Case Style Control”# Only handle camelCase and PascalCase (common in React projects)renamify rename oldComponent newComponent \ --only-styles camel,pascal
With Git Commit
Section titled “With Git Commit”# Automatically commit changes after applyingrenamify rename old_function new_function --commit
Project-Wide Rename
Section titled “Project-Wide Rename”# Rename entire project including root directoryrenamify rename myproject awesome_project \ --rename-root \ --commit
Exclude Specific Matches
Section titled “Exclude Specific Matches”# Skip compound words that contain your patternrenamify rename config settings \ --exclude-match ConfigurationManager,ConfigService
Interactive Flow
Section titled “Interactive Flow”When you run rename
, this is what happens:
- Scanning: Renamify scans your codebase for matches
- Preview: Shows a table/diff of all planned changes
- Confirmation: Prompts “Apply these changes? [y/N]:”
- Apply: If confirmed, applies changes atomically
- Results: Shows operation ID for potential undo
Example Session
Section titled “Example Session”$ renamify rename getUserName fetchUserProfile
Files to modify: 12┌─────────────────────────────────────┬──────────┬────────────────────┬─────────────────────┐│ File │ Lines │ Old │ New │├─────────────────────────────────────┼──────────┼────────────────────┼─────────────────────┤│ src/auth.js │ 23, 45 │ getUserName │ fetchUserProfile ││ src/auth.js │ 12 │ get_user_name │ fetch_user_profile ││ components/UserProfile.tsx │ 89 │ GetUserName │ FetchUserProfile │└─────────────────────────────────────┴──────────┴────────────────────┴─────────────────────┘
Files to rename: 2┌─────────────────────────────────────┬─────────────────────────────────────┐│ Current Path │ New Path │├─────────────────────────────────────┼─────────────────────────────────────┤│ utils/get-user-name.js │ utils/fetch-user-profile.js ││ tests/getUserName.test.js │ tests/fetchUserProfile.test.js │└─────────────────────────────────────┴─────────────────────────────────────┘
Apply these changes? [y/N]: y✅ Applied successfully! Operation ID: abc123-20241201-143022
When to Use rename vs plan/apply
Section titled “When to Use rename vs plan/apply”Use rename
when:
- Making smaller, focused changes
- You want immediate feedback and confirmation
- Working interactively and want speed
- The preview looks correct and you’re confident
Use plan
/apply
when:
- Making large, complex renaming operations
- You need time to review the plan thoroughly
- Working with teammates who need to review changes
- You want to save and potentially modify the plan
Safety Features
Section titled “Safety Features”The rename
command includes all of Renamify’s safety features:
- Atomic operations: All changes succeed or none do
- Automatic backups: Created before applying changes
- Conflict detection: Warns about potential issues
- Undo support: Use
renamify undo <id>
to revert
Exit Codes
Section titled “Exit Codes”0
- Success1
- Conflicts detected (use--force-with-conflicts
to override)2
- Invalid input or arguments3
- Internal error or system issue