What problem does it solve?
AST-based code search enables precise structural matching that textual searches often miss, accelerating code exploration and safer refactoring by focusing on syntax and node relationships rather than just text.
Core Features & Use Cases
- SG-search: structural pattern matching using ASTs to find code constructs.
- RG-search: text search fallback for broad coverage.
- SG-rewrite: safe, previewable code rewriting to apply structural changes.
- Language support: sg-langs and sg-check coordinate language support and tooling readiness.
- Use Case: locate function-call patterns, identify refactor opportunities, audit legacy code across large codebases.
Quick Start
Start by running sg-search with a query to locate code patterns across your codebase and review results before optionally applying sg-rewrite changes with --apply.