ast-grep
ast-grep/ast-grep · Public GitHub repository
⚡A CLI tool for code structural search, lint and rewriting. Written in Rust
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.

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.
- ast-grep's core is an algorithm to search and replace code based on abstract syntax tree produced by tree-sitter. It can help you to do lightweight static analysis and massive scale code manipulation in an intuitive way.
- An intuitive pattern to find and replace AST.
- ast-grep's pattern looks like ordinary code you would write every day (you could say the pattern is isomorphic to code).
- jQuery like API for AST traversal and manipulation.
- YAML configuration to write new linting rules or code modification.
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
More projects to explore
awesome-selfhosted
awesome-selfhosted/awesome-selfhosted
A list of Free Software network services and web applications which can be hosted on your own servers
awesome-go
avelino/awesome-go
A curated list of awesome Go frameworks, libraries and software
NextChat
ChatGPTNextWeb/NextChat
✨ Zero-config AI chat assistant. No API key needed — sign up and instantly chat with GPT-5, Claude 4, Gemini 2.5, DeepSeek & 100+ top models. Pay-as-you-go saves you more. Available on Web, iOS, macOS, Android, Linux, Windows.
vue-element-admin
PanJiaChen/vue-element-admin
A magical vue admin https://panjiachen.github.io/vue-element-admin