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

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.

Lock-in Assessment

High 5/5
Lock-in Score
5/5

🔄 Thinking about migrating off ast-grep?

Get an AI-drafted migration plan + a copy-paste email to ast-grep support requesting a data export. Pick where you're moving to and tell us your context.

Used in these stacks

Curated setups that include ast-grep.

Looking for alternatives to ast-grep?

Answer 4 quick questions — get an AI-ranked shortlist of tools that match your stack and requirements.

Open AI Tool Finder

Community Discussion

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