ast-grep Structural Code Search and Rewrite
Use ast-grep (sg) to search, lint, and rewrite code across large codebases using AST pattern matching. A blazing-fast alternative to regex-based code transformations that understands syntax structure.
What it does
ast-grep Structural Code Search and Rewrite
Use ast-grep (sg) to search, lint, and rewrite code across large codebases using AST pattern matching. A blazing-fast alternative to regex-based code transformations that understands syntax structure.
Installation
Use the upstream install or setup path that matches your environment:
- npm install --global @ast-grep/cli
- pip install ast-grep-cli
- brew install ast-grep
- cargo install ast-grep --locked
Requirements and caveats from upstream:
- 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](https://regexone.com/lesson...
- You can install it from npm, pip, cargo, [cargo-binstall](...
Basic usage or getting-started notes:
-
bash
-
pnpm approve-builds may be needed
- <details>
-
Extracted from upstream docs: https://raw.githubusercontent.com/ast-grep/ast-grep/HEAD/README.md
Source
Capabilities
Install
Quality
deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 8 github stars · SKILL.md body (1,304 chars)