CLI
Run Command
The run
command executes a codemod against your local codebase, showing you the changes and applying them to your filesystem.
Usage
Arguments
LABEL
: The name of the codemod to run (e.g., “rename-function”)
Options
--diff-preview N
: Show a preview of the first N lines of the diff--arguments JSON
: Pass arguments to the codemod as a JSON string (required if the codemod expects arguments)
Examples
Run a codemod:
Run with a diff preview limited to 50 lines:
Run with arguments (for codemods that require them):
Output
The command will:
- Parse your codebase
- Run the codemod
- Show a diff preview (if requested)
- Apply changes to your filesystem
Execution Flow
When you run a codemod:
- Codegen parses your entire codebase into a graph representation
- The codemod function is executed against this graph
- Any changes made by the codemod are tracked
- Changes are automatically applied to your local files
- A summary of changes is displayed
The codebase parsing step may take a few moments for larger codebases. Learn more in How it Works