Skip to content

Commit c5cd7a8

Browse files
author
codegen-bot
committed
.
1 parent 3120021 commit c5cd7a8

File tree

1 file changed

+15
-54
lines changed

1 file changed

+15
-54
lines changed

docs/cli/run.mdx

Lines changed: 15 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ icon: "play"
55
iconType: "solid"
66
---
77

8-
The `run` command executes a codemod and manages its output, whether viewing changes in the web UI, applying them locally, or creating pull requests.
8+
The `run` command executes a codemod against your local codebase, showing you the changes and applying them to your filesystem.
99

1010
```bash
1111
codegen run rename-function
@@ -23,23 +23,16 @@ codegen run LABEL [OPTIONS]
2323

2424
## Options
2525

26-
- `--web`: Automatically open the diff in the web app
27-
- `--apply-local`: Apply the generated changes to your local filesystem
2826
- `--diff-preview N`: Show a preview of the first N lines of the diff
2927
- `--arguments JSON`: Pass arguments to the codemod as a JSON string (required if the codemod expects arguments)
3028

3129
## Examples
3230

33-
Run a codemod and view results in terminal:
31+
Run a codemod:
3432
```bash
3533
codegen run rename-function
3634
```
3735

38-
Run and automatically apply changes locally:
39-
```bash
40-
codegen run rename-function --apply-local
41-
```
42-
4336
Run with a diff preview limited to 50 lines:
4437
```bash
4538
codegen run rename-function --diff-preview 50
@@ -52,53 +45,21 @@ codegen run rename-function --arguments '{"old_name": "getUserData", "new_name":
5245

5346
## Output
5447

55-
The command provides:
56-
1. A web link to view changes in the Codegen UI
57-
2. Run details and logs
58-
3. A diff preview (if requested)
59-
4. Instructions for applying changes locally
48+
The command will:
49+
1. Parse your codebase
50+
2. Run the codemod
51+
3. Show a diff preview (if requested)
52+
4. Apply changes to your filesystem
6053

61-
## Applying Changes
54+
## Execution Flow
6255

63-
When using `--apply-local`, Codegen will:
64-
1. Generate a patch from the codemod's changes
65-
2. Apply it to your local filesystem
66-
3. Provide git commands to commit the changes
56+
When you run a codemod:
57+
1. Codegen parses your entire codebase into a graph representation
58+
2. The codemod function is executed against this graph
59+
3. Any changes made by the codemod are tracked
60+
4. Changes are automatically applied to your local files
61+
5. A summary of changes is displayed
6762

6863
<Note>
69-
Your working directory must be clean (no uncommitted changes) when using `--apply-local`. If you have uncommitted changes, the command will provide instructions for resolving the situation.
64+
The codebase parsing step may take a few moments for larger codebases. Learn more in [How it Works](/introduction/how-it-works.mdx)
7065
</Note>
71-
72-
## Common Issues
73-
74-
### Uncommitted Changes
75-
If `--apply-local` fails due to uncommitted changes, you have two options:
76-
77-
1. Save your changes:
78-
```bash
79-
git status # Check working directory
80-
git add . # Stage changes
81-
git commit -m 'msg' # Commit changes
82-
codegen run ... # Run command again
83-
```
84-
85-
2. Discard changes (⚠️ destructive):
86-
```bash
87-
git reset --hard HEAD # Discard uncommitted changes
88-
git clean -fd # Remove untracked files
89-
codegen run ... # Run command again
90-
```
91-
92-
### Multiple Codemods
93-
If multiple codemods share the same name, specify the exact file path:
94-
```bash
95-
codegen run ./path/to/specific/codemod.py
96-
```
97-
98-
## Next Steps
99-
100-
After running a codemod:
101-
1. Review the changes in the web UI or diff preview
102-
2. Apply changes locally with `--apply-local`
103-
3. Commit the changes to your repository
104-
4. Create a pull request if needed

0 commit comments

Comments
 (0)