Skip to content
r.

ast-grep

ast-grep/ast-grep · Public GitHub repository

⚡A CLI tool for code structural search, lint and rewriting. Written in Rust

Open project in RepoShelf

Open the project to try its demo, view the repository, or save it to your collection. Repository and demo actions use RepoShelf’s sign-in flow.

ast-grep live demo screenshot
Captured from the live demo · 2026-11-20

About this project

Author-written excerpt from the project README.

ast-grep(sg) is a CLI tool for code structural search, lint, and rewriting.

ast-grep is an abstract syntax tree based tool to search code by pattern code. Think of it as your old-friend grep, but matching AST nodes instead of text. You can write patterns as if you are writing ordinary code. It will match all code that has the same syntactical structure. You can use $ sign + upper case letters as a wildcard, e.g. $MATCH, to match any single AST node. Think of it as regular expression dot ., except it is not textual.

Requirements and intended audience

ast-grep(sg) is a CLI tool for code structural search, lint, and rewriting.

Not recorded: account, external api key, paid service, self-hosting. Missing information does not mean there are no requirements.

Statements extracted from the author’s documentation · Checked 2026-10-21. Source: https://github.com/ast-grep/ast-grep/blob/main/README.md

Recorded maintenance information

Last recorded source update: 2026-11-20. Saved release: 0.45.3 · 2026-08-31. These dates do not guarantee ongoing maintenance.

Technologies
Rust
Licence
MIT. Generally permits modification and commercial use, subject to the licence’s notices and conditions.
Demo check
A public page loaded on 2026-11-20. This does not test every feature.

Browse related categories