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.4
0.40.3
0.40.2
0.40.1
0.40.0
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

Jan 5, 2026 at 14:36

License

MIT

Total Downloads

69.1K

Supported Platforms

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

Unsupported Platforms

linux-ppc64le Last supported version: 0.40.3