VibeHunt
Back to browse

ast-grep

A tool for code structural search, linting and rewriting.

The tool operates on abstract syntax trees, allowing users to search code by structural patterns rather than plain text. Patterns are written in a syntax similar to the target language, with `$`‑prefixed placeholders acting as wildcards that match any single AST node. This enables precise matching of code fragments that share the same syntactic shape, and the same mechanism can be used to rewrite matched code according to a supplied template.

It is useful for developers who need to perform large‑scale codebase refactoring, enforce custom linting rules, or locate specific programming constructs across multiple languages. The command‑line interface accepts a pattern, an optional rewrite template, and a language identifier, and can apply changes in‑place or output results for review.

The utility is distributed as a stable CLI package and can be installed via common package managers such as npm, pip, Cargo, Homebrew, Scoop, and others, or built from source with Rust. It provides a lightweight alternative to text‑based search tools, focusing on structural code analysis.

Reviews

Sign in to leave a review.

Loading reviews…

Similar apps