Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI flags

recast [OPTIONS] <PATTERN> <REPLACEMENT> [PATHS]...

Modes

FlagEffect
(default)Diff preview to stdout
--applyAtomic two-phase commit
--checkExit 1 if any file would change; no output, no writes
--stdinRead one buffer from stdin → stdout
--recoverReconcile leftover .recast.bak.* / .recast.tmp.* siblings

Match guards

FlagDefaultEffect
--at-least N1Require at least N matches across all files
--at-most NRequire at most N matches
--allow-non-convergentoffSkip the idempotency check
--allow-syntax-errorsoffSkip the syntax-regression guard (see Safety)

Filters

FlagEffect
-t LANG, --type LANGInclude only files of this type (rust, js, py, …)
-T LANG, --type-not LANGExclude this file type
-g PAT, --glob PATInclude / exclude glob (!pat to exclude)
--hiddenInclude dot-files
--no-ignoreBypass .gitignore filtering
--max-bytes NRefuse files larger than N bytes (default 10 MiB)
--max-files NRefuse runs touching more than N files (default 1000)

Regex options

FlagEffect
-L, --literalTreat pattern + replacement as literal text
-i, --ignore-caseCase-insensitive
-s, --single-lineDisable implicit (?s). no longer matches \n

Script mode

FlagEffect
--script PATHRhai script file run per match; return value = replacement

Structural mode

FlagEffect
--lang LANGTree-sitter grammar (rust, ts, python, …)
--query QUERYRaw tree-sitter S-expression query
--ast PATTERNFriendly source-shaped pattern with $NAME metavars
--include-leading-attrsExtend each match backward over leading #[attr] / doc-comment lines (see Structural mode)

Output

FlagEffect
--jsonEmit single-line JSON on stdout
--quietSuppress diff body; print only the summary
-v, --verbosePer-file timing and counters

Misc

FlagEffect
--threads NWorker threads (default = num CPUs)
--forceBypass the workspace lock check
--completions SHELLPrint shell completion script to stdout
--helpHelp summary
--versionVersion string