fastmod
$ fastmod Community Med Riskfastmod is Meta's Rust replacement for legacy Python codemod, performing fast .gitignore-aware multi-file regex search-and-replace. Headless agents must pass --accept-all (-a) to avoid interactive TTY prompts, which writes changes immediately in-place with no --dry-run flag.
brew install fastmod Direct local regex replacement; prefer sd -p or ast-grep when an agent needs a built-in dry-run preview.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Interactive prompt by default blocks headless shells unless --accept-all is passed; lacks both --dry-run and --json output.
- Interactive confirmation is the default mode
- No
--dry-runor--jsonflags
--accept-all immediately overwrites matched files in-place without a preview/dry-run mode, forcing reliance on Git to revert mistakes.
- Non-interactive
--accept-allmutates files directly with no dry-run flag
Static Rust binary available via brew install fastmod, cargo install fastmod, and GitHub releases.
- Cross-platform Rust binary
Very fast .gitignore-aware regex replacement across large repos, though sd -p or ast-grep offer safer agent ergonomics.
- Parallel Rust traversal respecting
.gitignoreand--extensions
Meta facebookincubator OSS project under Apache-2.0 with minimal recent churn.
- Stable
facebookincubator/fastmodrepository
Concise README and --help documenting Rust regex syntax (${1} captures) and flags.
- README examples and
--helpoutput
Security, Auth & Guardrails
None required; operates directly on local workspace files.
100% free, offline, and open-source (Apache-2.0).
# fastmod Agent Rules - NEVER run `fastmod` without `--accept-all` (`-a`) in headless shells (default interactive mode hangs). - Because `fastmod` has NO `--dry-run` flag, verify matches with `rg` first and only run on a clean Git working tree.
Agent-Ready Command Recipes
Safe Read-Only Queries
rg -n "oldFunction\(" src/ Because fastmod has no --dry-run flag, inspect exact matches with rg before invoking fastmod --accept-all.
Controlled Writes & Previews
fastmod --accept-all --extensions ts,tsx -d src/ 'oldApi\((.*)\)' 'newApi(${1})' Replaces matches across src/ without interactive prompts; ensure git status is clean first so git diff can verify changes.
Strengths for Agents
- + Fast parallel Rust execution respecting
.gitignore,-gglobs, and--extensions. - + Clean
${1}capture group syntax powered by Rustregex.
Caveats & Pitfalls
- ! Default invocation prompts interactively per hunk; requires
--accept-allfor headless runs. - ! Lacks
--dry-runand--json:--accept-allwrites changes straight to disk.