ast-grep/ast-grep
⚡A CLI tool for code structural search, lint and rewriting. Written in Rust
Build with Backblaze B2
SDKs, agent skills, IDE extensions, and reference pipelines from Backblaze Labs. All open source.
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.
Daily snapshots
Stars gained per day, and how forks and open issues moved, from GStars' daily snapshots
+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
| Repository | Stars | +7d | Health | Last release |
|---|---|---|---|---|
| morluto/rea | 450.0K | +22.9K | 75 | 16 days ago |
| mattpocock/skills | 320.9K | +9.5K | 75 | 12 days ago |
| vercel-labs/agent-desktop | 21.4K | +8.7K | 75 | 5 days ago |
| stablyai/orca | 121.4K | +6.7K | 75 | today |
| vercel-labs/agent-browser | 49.2K | +3.8K | 75 | 1 day ago |
| ast-grep/ast-grep | 16.5K | — | 60 | 4 days ago |
| Category median | 121.4K | +8.7K | 75 | — |
Discover Repositories
Search across tracked repositories by name or description