ast-grep is a Rust-based command-line utility designed for structural code searching, static analysis, linting, and automated source code rewriting. It uses Tree-sitter to parse source files into abstract syntax trees instead of relying exclusively on textual pattern matching. Developers can construct search patterns using familiar programming syntax and metavariables representing code structures. Declarative YAML rules support complex matching conditions, customized diagnostics, and automated fixes. Integrated rewriting functionality facilitates large-scale refactoring and library migration workflows. Multithreaded processing enables efficient analysis across extensive software repositories. Programmable interfaces are available for JavaScript, Python, and WebAssembly. Supported languages include JavaScript, TypeScript, Python, Rust, Go, Java, and C++.

Features

  • Abstract syntax tree-based structural code searching through Tree-sitter parsing and language-aware pattern matching
  • Intuitive code patterns with reusable metavariables for matching and capturing complex syntactic structures
  • Automated source code rewriting for large-scale refactoring, API migrations, and repetitive code transformations
  • Declarative YAML linting rules with relational matching conditions, customized diagnostics, and automated fixes
  • Multithreaded repository scanning with extensive programming language compatibility and custom parser integration
  • Programmable JavaScript, Python, and WebAssembly APIs with structured JSON reporting and rule testing tools

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow ast-grep

ast-grep Web Site

Other Useful Business Software
Ship Agents Faster Icon
Ship Agents Faster

Transform your applications and workflows into powerful agentic systems at global scale.

Gemini platform lets you rapidly build, scale, govern and optimize production-ready agents grounded in your organization's data. The platform enables developers to build custom or pre-built agents for virtually any use case. Developers get access to both Gemini and third-party models.
Get started
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of ast-grep!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

Rust

Related Categories

Rust Source Code Analysis Tool, Rust Linters

Registered

2 hours ago