fastmod
Fast, interactive codebase-wide find and replace
TLDR
SYNOPSIS
fastmod [options] pattern [replacement] [paths...]
DESCRIPTION
fastmod performs fast, interactive codemod operations across files. It searches for regex patterns and prompts for confirmation before each replacement, making bulk code changes safer.The tool uses the same regex engine as ripgrep for fast searching combined with interactive review of changes. By default, patterns are treated as regular expressions. If no replacement is given, fastmod deletes the matched text. If no paths are given, it searches the current directory recursively.During interactive mode, press y to accept, n to skip, e to edit the replacement, a to accept all remaining, or q to quit.
PARAMETERS
-m, --multiline
Enable multiline regex matching (dot matches newlines).-i, --ignore-case
Case insensitive matching.-e, --extensions exts
Comma-separated list of file extensions to process (e.g., py,js,ts).--accept-all
Apply all replacements without interactive prompting.--print-only
Show matches without modifying files.-d, --dir path
Set the root search directory (default: current directory).--glob pattern
Include/exclude files by glob pattern (prefix with ! to exclude).--hidden
Include hidden files and directories in the search.--fixed-strings, -F
Treat the pattern as a literal string, not a regex.--count
Display the total number of matches/replacements.
CAVEATS
Uses Rust's regex syntax, which may differ from PCRE or POSIX regex in some edge cases. Interactive mode requires a terminal. When using --accept-all, changes are applied without confirmation -- use --print-only first to preview.
HISTORY
fastmod was developed at Facebook (Meta) as a tool for large-scale code modifications. It addresses the need for interactive, safe refactoring across massive codebases. Released as open source, it is written in Rust for performance.
