Codemod — AI-Powered Code Migration Platform
The Problem
Upgrading frameworks (Next.js 12→13, React class→hooks, Express→Fastify) across hundreds of files is tedious and error-prone. Manual find-and-replace misses edge cases. AI chat can't handle 500-file refactors consistently.
The Solution
Codemod provides deterministic AST-based transformations enhanced with AI. Define migration rules once, run them across your entire codebase with confidence.
Key Features
- Codemod CLI — execute migrations from terminal or CI
- YAML Workflows — coordinate multi-step migrations with matrix strategies and approval gates
- ast-grep support — powerful AST pattern matching for precise code transformations
- Community Registry — discover and share codemods for popular migrations
- MCP Integration — use codemods from AI coding assistants
- Validation — dry-run mode, diff preview, and rollback support
Quick Start
# Run a community codemod (e.g., Next.js App Router migration)
npx codemod @codemod/next/13/app-router
# Initialize a new custom codemod
npx codemod init my-codemod
# Define a multi-step workflow
npx codemod workflow run -w my-codemod/workflow.yaml
# Publish your codemod to the registry
npx codemod publish my-codemod
# Search the registry
npx codemod search "react hooks"Example: YAML Workflow
name: upgrade-nextjs-13
steps:
- name: app-router
codemod: @codemod/next/13/app-router
- name: metadata
codemod: @codemod/next/13/metadata
- name: image-component
codemod: @codemod/next/13/next-imagePopular Community Codemods
- Next.js App Router migration
- React class components → hooks
- Security patch automations
- TypeScript strict mode upgrades
FAQ
Q: What is Codemod? A: Codemod is an open-source CLI and platform for running AI-powered code migrations at scale. It uses AST-based transformations to safely refactor large codebases.
Q: Is Codemod free? A: Yes, fully open-source under Apache-2.0. The CLI and community registry are free.
Q: What languages does Codemod support? A: Any language supported by ast-grep, including JavaScript, TypeScript, Python, Go, Rust, Java, C, and more.