GritQL is a query language for searching, linting, and modifying source code.
GritQL addresses the friction in large-scale code refactoring and migration work. Rather than forcing developers to choose between simple grep searches and full codemod programs, it offers a declarative middle ground where any code snippet serves as a valid query. The tool uses Rust and query optimization to handle repositories with millions of lines efficiently. It works across multiple target languages including JavaScript, TypeScript, Python, Java, Terraform, Solidity, CSS, Markdown, YAML, Rust, Go, and SQL, eliminating the need to learn language-specific codemod frameworks.
GritQL suits teams conducting large refactors, migrations, or establishing custom linting rules across codebases. It works well for exploratory searches that evolve into complex transformations, since patterns can be saved to configuration files and combined progressively. The tool includes a module system with over two hundred standard patterns available for reuse, and developers can publish their own patterns for sharing. The approach avoids the mental overhead of translating between regex or AST representations and actual source code, since patterns are written in code-like syntax.
The project maintains active development with regular updates to its core language features and standard library. The codebase shows consistent refinement of query optimization and performance characteristics. Documentation and examples are actively maintained, including an interactive tutorial and comprehensive guides for configuration and pattern sharing. The project demonstrates responsiveness to user needs through expansion of supported target languages and the growth of its standard library patterns.