ast-grep
⚡A fast and polyglot tool for code structrual search, lint and rewriting at large scale.
FreeCLI19,188 impressions#4 of its week2 comments
Comments
>log in to comment- Alexander Isora· 3y ago
excited to see what this can do 🤗congrats on the launch 🎉
- Ghulam Abbas· 3y ago
Congratulations on the launch!
ast-grep is a fast, polyglot tool for structural code search, linting, and rewriting using AST patterns.
- for
- Developers needing syntax-aware search, custom lint rules, or large-scale refactoring.
- pricing
- open source
- license
- MIT
Key features
- Structural Search & Replace — Locate and modify code across thousands of files using AST patterns instead of plain text.
- Custom Linting — Define and run lint rules with intuitive syntax and get pretty error reports out of the box.
- Node.js API — Access syntax trees programmatically via a npm package with jQuery-like utilities and optional type safety.
- Polyglot Support — Built-in support for 20+ languages and ability to load custom tree-sitter parsers.
- High Performance — Parallel Rust engine provides blazing-fast searches and rewrites.
- Interactive Tools — Includes an interactive codemod, language server, and testing utilities.
Use cases
- Batch refactoring of legacy codebases.
- Enforcing project-specific coding standards via custom lint rules.
- Automating code modifications in CI pipelines.
- Building language-aware search tools for IDE extensions.
- Integrating AST-based analysis into AI-assisted coding workflows.
ast-grep FAQ
What is ast-grep?+
It is a command-line and programmatic tool that searches, lints, and rewrites code by matching abstract syntax tree (AST) nodes.
How does it differ from traditional grep?+
Unlike grep, which matches raw text, ast-grep matches structural code elements via the AST, enabling language-aware queries.
Can I use ast-grep as a linter?+
Yes, you can write custom AST patterns as lint rules and run them with `ast-grep scan` for pretty error reporting.
Is there a programmatic interface?+
Yes, a Node.js binding (`@ast-grep/napi`) provides jQuery-like methods to traverse syntax trees with optional type safety.
What languages are supported?+
ast-grep ships with support for over 20 languages and allows you to load additional tree-sitter parsers dynamically.
Summarized by DevHunt from ast-grep.github.io · Sep 27, 2026. Details may change; check the official site.