CMD + K

ast-grep

Community

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

Installation

To install this package, run one of the following:

Conda
$conda install conda-forge::ast-grep

Usage Tracking

0.40.3
0.40.2
0.40.1
0.40.0
0.39.9
5 / 8 versions selected
Downloads (Last 6 months): 0

Description

ast-grep is an AST-based tool to search code by pattern code. Think it as your old-friend grep but it matches 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 wildcard, e.g. $MATCH, to match any single AST node. Think it as REGEX dot ., except it is not textual.

About

Summary

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

Last Updated

Dec 15, 2025 at 16:38

License

MIT

Total Downloads

66.6K

Supported Platforms

macOS-arm64
macOS-64
linux-aarch64
linux-ppc64le
linux-64