
Who Grit is for#
Platform engineers migrating APIs
Use Grit to rewrite repeated API patterns across many repositories while keeping the transformation rule reviewable.
Skip if:
The migration requires full runtime behavior analysis rather than source pattern changes.
Tech leads removing deprecated patterns
Use Grit to find and fix old imports, function calls, and framework idioms across a codebase.
Skip if:
The affected code appears in only a few files and a manual edit is faster.
Teams building reusable codemod libraries
Use Grit when migration patterns recur and should be stored, shared, and composed across future upgrades.
Skip if:
Your organization already has mature language-specific codemod tooling and no cross-language needs.
The problem it solves#
Large code migrations rarely fit simple search and replace. Regex misses syntax, AST codemods take time to write, and language-specific frameworks force teams to rebuild similar transformations for each stack. The result is slow migration work, hard-to-review scripts, and repeated manual fixes across many repositories.
How it solves it#
Declarative GritQL patterns
Any code snippet can become a GritQL query with metavariables for the parts that change. This makes many migrations easier to read than imperative AST traversal code.
Search and rewrite in one language
GritQL can find patterns, add side conditions, and rewrite matches with `=>`. Teams can move from exploration to automated remediation without changing tools.
Multi-language target support
JavaScript, TypeScript, Python, JSON, Java, Terraform, Solidity, CSS, Markdown, YAML, Rust, Go, and SQL support makes Grit useful across mixed codebases.
Standard pattern reuse
Grit links to a standard library with 200+ patterns, which helps teams reuse migration logic instead of writing every transformation from scratch.
Strengths and trade-offs#
Strengths
- Better than regex for code shapeGritQL matches source structure rather than raw text, so it can handle code patterns that include imports, method calls, and side conditions.
- Readable migration rulesDeclarative patterns are easier for reviewers to audit than long traversal scripts, especially when non-specialists need to approve broad code changes.
- MIT-licensed coreGritQL uses the MIT license, which keeps the core query language usable in commercial code migration workflows.
Trade-offs
- -Requires learning a new query languageGritQL is more approachable than many AST APIs, but teams still need to learn its pattern syntax before trusting it for broad rewrites.
- -Not a replacement for deep semantic analysisGrit is strong for structural rewrites. Some migrations still need compiler-aware checks, test suites, or human review to catch behavioral changes.
Install and self-host#
npm install --location=global @getgrit/cliWhat it's built on#
- Languages
- JavaScriptRustTypeScript
- Frameworks
- Next.jsReact
FAQ#
What is GritQL?
GritQL is a declarative query language for searching, linting, and modifying source code.
How is Grit different from regex?
Grit matches code structure with metavariables and side conditions, while regex matches text. That makes Grit safer for many syntax-aware migrations.
Which languages does Grit support?
Grit supports JavaScript, TypeScript, Python, JSON, Java, Terraform, Solidity, CSS, Markdown, YAML, Rust, Go, and SQL.
Similar open-source tools#
react-doctor
Diagnose and fix your React code effortlessly
DeepSeek TUI
A coding agent that lives in your terminal.
Goose
Run repeatable multi-step coding workflows from CLI or desktop
Octrafic
AI-powered CLI for automated API testing with natural language
Maestro
Simple end-to-end testing for iOS, Android, and web apps
Languine
Keep translations in sync with code changes via AI-powered CLI

