ast-grep logo

ast-grep

ast-grep — CLI tool for AST-based structural code search, linting, and rewriting across multiple languages.

-

Our Verdict

The best open-source structural search tool right now, worth the learning curve for any serious refactor.

Pros

  • AST-based matching avoids regex false positives
  • Fast Rust implementation scales to large monorepos
  • Supports structural rewrites across many languages
  • YAML rule files are readable and shareable

Cons

  • Pattern syntax has a real learning curve
  • Language support varies in completeness
  • Less IDE integration than semgrep or comby
  • Debugging non-matching rules is frustrating
Best for: Engineers doing codemods, lint rules, or codebase-wide refactors across languages Not for: Users who just need simple text search or one-off find-and-replace

When to Use ast-grep

Good fit if you need

  • Searching code by structure rather than text patterns across repos
  • Running AST-based lint rules for custom code style enforcement
  • Automating large-scale structural refactors with rewrite rules
  • Finding all usages of a code pattern across multi-language repos

Lock-in Assessment

High 5/5
Lock-in Score
5/5

ast-grep Pricing

Pricing Model
free
Free Tier
Yes
Entry Price
Enterprise Available
No
Transparency Score

Beta — estimates may differ from actual pricing

1,000
1001K10K100K1M

Estimated Monthly Cost

$25

Estimated Annual Cost

$300

Estimates are approximate and may not reflect current pricing. Always check the official pricing page.

Used in these stacks

Curated setups that include ast-grep.

Community Discussion

Comments powered by Giscus (GitHub Discussions). You need a GitHub account to comment.