ast-grep
MIT structural AST search and rewrite (sg)
Rust / Terminal · OSS/MIT · 16.3k
Reviewed 2026-09-12 · last push 2026-10-15 · repo checked 2026-10-19
What's Good
MIT. ast-grep/ast-grep (`sg`). Pattern-based structural search, lint (`scan`), and codemod rewrite across many languages via tree-sitter. Interactive rewrite, LSP, and Node API (`@ast-grep/napi`). Homepage ast-grep.github.io; source github.com/ast-grep/ast-grep.
The Catch
Vs Semgrep (SAST/SCA product with Free Edition caps) and ripgrep (text search): ast-grep is the *structural AST CLI/codemod*, not a hosted AppSec platform and not byte/regex grep. You author AST patterns; text-only hunts still belong to rg. Slug is `ast-grep` (binary often `sg`).
Verdict
MIT AST search/rewrite. Free forever; match syntax trees, not just strings.
Embed
Maintainer? Add the badge to your README. It is free, links to this review, and there is no paid version.
Markdown
[](https://stackgems.com/gems/ast-grep)
HTML
<a href="https://stackgems.com/gems/ast-grep"><img src="https://stackgems.com/badge/ast-grep.svg" alt="ast-grep reviewed on Stack Gems" height="20"></a>
Related
Rust →- ZellijMIT Rust terminal workspace with layouts and plugins
- ripgrepUnlicense/MIT recursive grep that respects .gitignore
- batMIT/Apache-2.0 cat clone with syntax highlighting and Git integration
- fdMIT/Apache-2.0 ignore-aware parallel filename find
- gumMIT scriptable prompts, filters, and spinners for shell UX