codemod learn
codemod learn
, your codemod package will automatically have the recommended package structure.
If you build a codemod from scratch or a previously built codemod, you will have to scaffold a valid codemod package using Codemod CLI.
codemod learn
codemod learn
to build a codemod from the latest diff made in your current project. This allows you to seamlessly build codemods right from your IDE.
Make a change
Run `codemod learn`
codemod learn
. Codemod AI will use the diff of the latest edited file to automatically generate a codemod.Building the codemod
Export/publish the generated codemod
Verify codemod engine compatibility
Initialize codemod package
Update transform file content
src/index.ts
file with the content of your codemod’s transform file.src/rule.yaml
file with the content of your ast-grep rule.Update package configuration file
.codemodrc.json
configuration file. Refer to .codemodrc.json
reference here.