# ast-grep/ast-grep

⚡A CLI tool for code structural search, lint and rewriting. Written in Rust

Repository: https://github.com/ast-grep/ast-grep
Canonical: https://ross.abutalabs.com/products/ast-grep
Homepage: https://ast-grep.github.io/
Language: Rust
License: MIT
License Family: permissive
Topics: codemod, linter, ast, babel, command-line, command-line-tool, grep, tree-sitter, codereview, rust, static-analysis, typescript, refactoring, search, structural-search
Last push: 2026-08-24T14:09:23+00:00

## Health v2 (maintenance only)
Score: 95/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 99, release rhythm 87, longevity 100
- inputs: {"age_days": 1524, "days_push": 9, "days_rel": 10, "gap_med": 9.5, "n_releases_24m": 63}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 15652, forks 437 (observed 2026-08-28T04:11:13.336458+00:00)

## What it is
ast-grep is a fast Rust-based CLI tool for structural search, linting, and rewriting of code using AST patterns instead of plain text matching. It supports 20+ languages via tree-sitter, offers interactive codemods, custom lint rules, and a Node.js API for programmatic use.

## Use cases
- find all calls to a function across a codebase by syntax pattern
- rewrite deprecated API calls to new ones at scale
- write custom lint rules using AST patterns
- run interactive codemods over thousands of files
- search code structurally instead of with regex
- enforce code patterns in CI as a linter

## When to choose
- you need syntax-aware search or replace across many languages
- regex grep is too imprecise for code refactoring
- you want custom lint rules without writing a full linter plugin
- you need fast, parallel large-scale codemods

## When to avoid
- you only need simple text search where regex suffices
- your language has no tree-sitter grammar and you cannot write one
- you need full compiler-grade semantic analysis like type-aware refactoring

## Facets
- artifact type: cli-tool
- maturity: active
- function: search-engine, linter, parser, developer-tools, cli
- domain: developer-tools, parsers, version-control
- platform: windows, cli, rust, python
- tags: ast, tree-sitter, structural-search, codemod, code-rewriting, static-analysis, refactoring, command-line, linux, macos, nodejs

## Member repositories
- ast-grep/ast-grep (main) score 95

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:13.336458+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:05:35.527091+00:00, confidence not recorded.
  - readme: https://github.com/ast-grep/ast-grep (fetched 2026-08-28T04:11:13.336458+00:00, sha 063ee2604e6f)
  - homepage: https://ast-grep.github.io/ (fetched 2026-08-29T08:03:34.610071+00:00, sha 01cf7f87d3c8)
  - registry_crates: https://crates.io/api/v1/crates/ast-grep (fetched 2026-08-29T08:03:34.612748+00:00, sha 15bda2a1c239)
- Data as of 2026-08-30T08:39:29.467469+00:00.
