# ast-grep

> MIT structural AST search and rewrite (sg)

**Category:** Rust  
**Pricing:** open-source  
**URL:** https://ast-grep.github.io/  
**GitHub:** https://github.com/ast-grep/ast-grep  
**Added:** 2026-09-12

---

## The Hook

ast-grep is syntax-aware search/rewrite when ripgrep matches text and Semgrep is the heavier AppSec product.

## 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.
