ast-grep

rust
mit

A CLI tool for code structural search, lint and rewriting.

image preview of ast-grep

ast-grep is a CLI tool for structural code search, linting and rewriting using abstract syntax tree patterns.

 

It lets you search code with structural patterns, reuse patterns across many languages, define metavariables on nodes, run bulk refactors with --rewrite, apply fixes in interactive modes, turn patterns into lint rules in YAML, organize rules in a project config, scan stdin or directories, and also export matches as JSON for piping into jq or other tools. Additionally, you can plug it into CI using the GitHub Action so rules include templates or transforms to migrate APIs, rename symbols or adjust call sites.

 

This tool helps developers, maintainers, library authors and anyone automating repetitive code rewrites or enforcing project-specific patterns in large repositories.

Get Updates On Terminal Trove.

No spam, just updates on Terminal Trove. See an example update.