ast-grep

    ast-grep/ast-grep

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

    16.5K stars
    494 forks
    41 GitHub watchers
    Updated Nov 6, 2026
    View on GitHub

    Build with Backblaze B2

    SDKs, agent skills, IDE extensions, and reference pipelines from Backblaze Labs. All open source.

    Explore Backblaze Labs

    Loading star history...

    Where it stands

    Rank, growth pace and release cadence relative to everything GStars tracks.

    5 releases in the last 90 days, the latest 4 days ago, with 102 contributors on GitHub.

    Peaked at #26 in the weekly ranking the week of Nov 16, its best in the past year.

    Use Cases & Benefits

    • Provides a CLI tool for structural code search, linting, and rewriting using abstract syntax trees.
    • Enables intuitive pattern matching and code transformation based on ASTs with a syntax similar to ordinary code.
    • Use for automating large-scale code refactoring and migration across multiple languages using AST patterns.
    • Use for creating custom linting rules and enforcing team-specific coding standards via YAML configurations.
    • Use for security research by quickly writing and applying static analysis rules to detect code vulnerabilities.

    Should you depend on it?

    License terms, project hygiene and risks, from GitHub metadata and GStars' snapshots.

    License

    MIT

    Permissive: commercial use, modification and redistribution are allowed with attribution.

    Community files

    • README: present
    • Contributing guide: present

    Watch-outs

    No watch-outs from GStars' checks.

    General guidance from repository metadata, not legal advice. How we score

    From the README

    ast-grep(sg) is a CLI tool for code structural search, lint, and rewriting.

    ast-grep is an abstract syntax tree based tool to search code by pattern code. Think of it as your old-friend grep, but matching AST nodes instead of text. You can write patterns as if you are writing ordinary code. It will match all code that has the same syntactical structure. You can use $ sign + upper case letters as a wildcard, e.g. $MATCH, to match any single AST node. Think of it as regular expression dot ., except it is not textual.

    Try the online playground for a taste!

    See more screenshots on the website.

    Excerpt from the ast-grep/ast-grep README on GitHub (MIT license). © its authors.Read the full README on GitHub

    Daily snapshots

    Stars gained per day, and how forks and open issues moved, from GStars' daily snapshots

    Sep 11: +10

    +1,021 stars over 90 days across 8 snapshot days; best day +10 on Sep 11.

    Forks

    494+70

    Open issues

    50+1

    Compared with peers in CLI

    Fastest-growing repositories GStars tracks in this cohort for the week of Nov 8, by 7-day star growth

    ast-grep/ast-grep compared with CLI repositories by stars, 7-day star growth, health score and last release
    RepositoryStars+7dHealthLast release
    morluto/rea450.0K+22.9K7516 days ago
    mattpocock/skills320.9K+9.5K7512 days ago
    vercel-labs/agent-desktop21.4K+8.7K755 days ago
    stablyai/orca121.4K+6.7K75today
    vercel-labs/agent-browser49.2K+3.8K751 day ago
    ast-grep/ast-grep16.5K—604 days ago
    Category median121.4K+8.7K75—

    Discover Repositories

    Search across tracked repositories by name or description