CLI Tool Utilities & Power Tools ★ 16,637 stars on GitHub

ast-grep

ast-grep is a powerful tool that helps you find and change specific parts of your code using simple patterns instead of complex text searches.

Get Command-Line Tool →
Command-Line Utility (No Graphical Interface): This program runs inside your system terminal or command prompt rather than opening a desktop window. Follow the official installation instructions below.

Guide and Overview

What it does in plain English

ast-grep allows you to search through your project files to find specific code structures rather than just plain text. Once found, you can automatically rewrite or update those sections across your entire project in one go.

Who it’s for

  • Software developers who need to perform large-scale code updates or refactoring across many files.
  • Tech leads who want to enforce consistent coding standards and best practices across a team.

Key features

  • Intuitive Pattern Matching: Search for code using the same syntax you use to write it, making it feel natural and easy to learn.
  • Massive Scale Rewriting: Automatically apply changes to hundreds of files at once, saving hours of manual editing.
  • Customizable Rules: Use simple configuration files to create your own linting rules tailored to your specific project needs.

How to install (Download)

You can install ast-grep using your preferred package manager. For most users, the following commands work:

  • Homebrew (macOS/Linux): brew install ast-grep
  • Node.js (npm): npm install --global @ast-grep/cli
  • Python (pip): pip install ast-grep-cli

For additional installation methods including Cargo or Scoop, visit the official website.

Pros and Cons

  • Pros: Extremely fast, supports multiple programming languages, and uses intuitive pattern matching.
  • Cons: Requires a basic understanding of command-line tools and may take a moment to learn the pattern syntax.

Optional commercial services unrelated to the open-source developer. Clicking an #ad link helps fund HubHum at no extra cost to you.

  • ★ Top Recommended — Systeme.io: Free-forever all-in-one platform to build landing pages, newsletters, and automated workflows with zero monthly fees — Activate Systeme.io → (#ad)
  • AdGuard: Block intrusive ads, tracking scripts, and phishing domains system-wide across all browsers and desktop apps — AdGuard (#ad)
  • InterServer: Launch and host self-hosted web apps 24/7 on managed Linux cloud VPS servers starting at $3/month — InterServer (#ad)

Official Source & Credits: Official Source / Credits

Affiliate transparency (#ad): Some links on this page are affiliate links. If you choose to activate a service through them, we may earn a commission at no extra cost to you.

Your Saved Favorites

Your favorite apps are saved right here in this browser.


Sign in with one click to link your GitHub profile and sync favorites.