Tools
AST operations
AST operations match language structure rather than byte sequences.
Search
ast_search uses parseable syntax patterns and metavariables to locate constructs across supported files. Repeated metavariables require identical matched nodes.
Rewrite
ast_rewrite substitutes captured nodes one-for-one. Use it for codemods where text replacement would hit comments, strings, shadowed names, or unrelated syntax.
Boundaries
A rewrite operates in one language at a time and must parse as a valid node. Cross-file symbol renames require semantic references when a language service is available.