A CLI tool that searches, lints, and rewrites code by matching abstract syntax tree patterns instead of plain text.
openrewrite/rewrite
Open-source automated refactoring engine that applies recipes to source code across many repositories, covering framework migrations and security fixes.
- Stars
- 3,955
- Forks
- 601
- Open issues
- 307
- Last commit
- 18 hours ago
What is it?
OpenRewrite is an automated refactoring ecosystem that runs prepackaged recipes against source code to handle framework migrations, security fixes, and stylistic consistency changes. It works on a type-aware model of the code called the Lossless Semantic Tree (LST), which preserves formatting while letting recipes make precise edits.
Parsers and base recipes are available for Java, Kotlin, Groovy, JavaScript/TypeScript, Python, and C#. For Java projects, Gradle and Maven plugins let you run a single recipe against one repository. Recipes can be customized or written from scratch.
The project is maintained by Moderne, which offers a commercial platform for running the same recipes across many repositories at once, along with a multi-repo CLI and tools for coding agents.
Key features
- 01Runs prepackaged refactoring recipes for framework migrations and security fixes.
- 02Parses code into a type-aware Lossless Semantic Tree that preserves formatting.
- 03Supports Java, Kotlin, Groovy, JavaScript/TypeScript, Python, and C#.
- 04Provides Gradle and Maven plugins for running recipes on Java projects.
- 05Lets you customize existing recipes or write your own.
Use cases
- Upgrading a Java codebase to a newer framework version with automated edits.
- Applying the same security fix or style change across a repository.
- Removing technical debt in bulk without manual file-by-file edits.
Quick start
- 1
Read the official quickstart guide
- 2
Add the OpenRewrite Gradle or Maven plugin to your Java project and run a recipe
Things to know
- Some recipes and the additional language parsers require a Moderne commercial license or fall under the Moderne Source Available License.
- The Gradle and Maven plugins run one recipe at a time against a single repository.
Topics
FAQ
- What is rewrite?
- Open-source automated refactoring engine that applies recipes to source code across many repositories, covering framework migrations and security fixes. OpenRewrite is an automated refactoring ecosystem that runs prepackaged recipes against source code to handle framework migrations, security fixes, and stylistic consistency changes. It works on a type-aware model of the code called the Lossless Semantic Tree (LST), which preserves formatting while letting recipes make precise edits.
- Is rewrite free to use? What license does it have?
- rewrite is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is rewrite still maintained?
- Actively maintained. The last commit to rewrite was on Nov 6, 2026.
- What can I use rewrite for?
- Upgrading a Java codebase to a newer framework version with automated edits. Applying the same security fix or style change across a repository. Removing technical debt in bulk without manual file-by-file edits.
- How do I install rewrite?
- Read the official quickstart guide Add the OpenRewrite Gradle or Maven plugin to your Java project and run a recipe
- Where can I get rewrite?
- The source code and installation instructions are on GitHub: https://github.com/openrewrite/rewrite
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Python refactoring library that performs safe code transformations such as renaming, moving, and extracting code across a project.
A Java 1 to Java 25 parser that builds an abstract syntax tree, plus a symbol solver for resolving declarations and types.
A PHP parser written in PHP that turns PHP source code into an abstract syntax tree for static analysis and code manipulation.
A Python static analysis library for autocompletion, go-to-definition, refactoring and code search, mainly used by editor plugins.
Turns a codebase, its docs, schemas and PDFs into a queryable knowledge graph for AI coding assistants, built locally with tree-sitter AST parsing.