What problem does it solve? Text-based search tools like grep and regex fail when the question depends on code structure rather than raw bytes, leading to false positives, missed matches, and unsafe bulk rewrites across large codebases. ## Core Features & Use Cases - Structural Code Search: Find functions, calls, imports, and control-flow patterns by AST shape using meta-variables like $VAR and $$$ across 25 languages. - Pattern-Driven Rewrites: Perform codemods such as migrating console.log to logger.info or Optional[X] to X | None, with mandatory dry-run previews before applying changes. - YAML Rule Scanning: Run reusable lint rules with auto-fixes via sg scan, including CI-friendly GitHub and SARIF output formats. - Use Case: When refactoring a TypeScript monorepo, use the helper to find every console.log call, preview the replacement with logger.info across all affected files, then apply the rewrite in a second pass and review with git diff. ## Quick Start Ask the agent to find every console.log call in the src directory and rewrite them to logger.info using the ast-grep helper with a dry-run preview first.