Add ast_grep tool: structural code search via ast-grep

AST-level pattern matching — find code by structure, not text.
e.g. find all `if let Some($X) = $Y { $$$BODY }` patterns.
Supports C, Rust, Python, JS/TS, Go, and 20+ languages.

Gracefully errors if sg binary isn't installed.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-09 02:57:02 -04:00 committed by Kent Overstreet
parent c53c4f9071
commit ec7e11db56
5 changed files with 552 additions and 5 deletions

View file

@ -46,6 +46,10 @@ memmap2 = "0.9"
peg = "0.8"
paste = "1"
ast-grep-core = "0.42"
ast-grep-language = { version = "0.42", features = ["builtin-parser"] }
walkdir = "2"
redb = "4"
rkyv = { version = "0.7", features = ["validation", "std"] }