REMOVE THIS SECTION ONCE THE REPO IS SET UP.
Framework/SDK maintainers: This template includes setup guides, utilities, and a GitHub Action to help you and your community build and publish codemods with ease.
NOTE: You need repo creation privileges in your org and permission to install GitHub apps on repos. If you don’t, you can request access from your org admin during setup.
- Use this template and create a codemods repo in your org.
- Sign up at Codemod with your GitHub account.
- Install the Codemod GitHub app:
- Click your profile photo (top left) and select "Add organization"
- Pick GitHub, choose your org and the new codemods repo. This installs the Codemod GitHub App and reserves a scope with your org name.
- Benefit: Only members of your org can publish codemods with a name that starts wihh your scope.
- Important: In
codemod.yaml
, the name must start with your scope, otherwise it won’t appear when users filter for your scope in the registry.- In Codemod, switch from personal account to org account and generate a Codemod API key.
- In your GitHub repo: Settings → Secrets & variables → actions
- Create a repository secret.
- Name:
CODEMOD_API_KEY
- Value: the key from step 1.
✅ Done! After a codemod PR is merged, you can trigger the GitHub Action to auto-publish it to the Codemod Registry under your org scope. See Node.js codemods for an example.
To build a codemod, clone your new repo locally and use Codemod MCP in your IDE to replace the boilerplate with a codemod generated using AI. You can also run
npx codemod@latest init
for the initial scaffolding, or use Codemod Studio for its live codemod runner and AST viewer.
Official <FRAMEWORK_OR_SDK_OR_ORG> codemods to help users adopt new features and handle breaking changes with ease.
Community contributions are welcome and appreciated! Check open issues for codemods to build, or open a new one if something’s missing. See the contribution guide for details.
Caution
Codemods modify code! Run them only on Git-tracked files, and commit or stash changes first.
Recommended for the best UX. This downloads the package from the Registry.
npx codemod@latest <codemod-name>
For example:
npx codemod@latest @nodejs/tmpDir-to-tmpdir
npx codemod workflow run -w /path/to/folder/containing/workflow.yaml
Note
By default, codemods run in the current folder. Add -t /target/path
to change it.
See the Codemod docs for all CLI commands and options.
MIT