diff --git a/docs/building-with-codegen/dot-codegen.mdx b/docs/building-with-codegen/dot-codegen.mdx
index b46028752..b4b493fde 100644
--- a/docs/building-with-codegen/dot-codegen.mdx
+++ b/docs/building-with-codegen/dot-codegen.mdx
@@ -78,7 +78,7 @@ Codegen automatically adds appropriate entries to your `.gitignore`:
The `codemods/` directory is where your transformation functions live. You can create new codemods using:
```bash
-codegen create my-codemod [--description "what it does"]
+codegen create my-codemod PATH [--description "what it does"]
```
This will:
@@ -115,7 +115,7 @@ After initializing your `.codegen` directory:
1. Create your first codemod:
```bash
-codegen create my-codemod -d "describe what you want to do"
+codegen create my-codemod . -d "describe what you want to do"
```
2. Run it:
diff --git a/docs/building-with-codegen/reusable-codemods.mdx b/docs/building-with-codegen/reusable-codemods.mdx
index 549d58df9..0768e1a0d 100644
--- a/docs/building-with-codegen/reusable-codemods.mdx
+++ b/docs/building-with-codegen/reusable-codemods.mdx
@@ -12,7 +12,7 @@ Codegen enables you to create reusable code transformations using Python functio
The easiest way to create a new codemod is using the CLI [create](/cli/create) command:
```bash
-codegen create rename-function
+codegen create rename-function .
```
This creates a new codemod in your `.codegen/codemods` directory:
@@ -37,7 +37,7 @@ def run(codebase: Codebase):
You can use AI to generate an initial implementation by providing a description:
```bash
-codegen create rename-function -d "Rename the getUserData function to fetchUserProfile"
+codegen create rename-function . -d "Rename the getUserData function to fetchUserProfile"
```
This will:
diff --git a/docs/cli/create.mdx b/docs/cli/create.mdx
index 4a6e14b7d..938e974e3 100644
--- a/docs/cli/create.mdx
+++ b/docs/cli/create.mdx
@@ -8,18 +8,19 @@ iconType: "solid"
The `create` command generates a new codemod function with the necessary boilerplate.
```bash
-codegen create rename-function
+codegen create rename-function .
```
## Usage
```bash
-codegen create NAME [OPTIONS]
+codegen create NAME PATH [OPTIONS]
```
## Arguments
- `NAME`: The name of the codemod to create (e.g., "rename-function")
+- `PATH`: The path where the codemod should be created (e.g., "." for current directory)
## Options
@@ -27,7 +28,7 @@ codegen create NAME [OPTIONS]
## Generated Files
-When you run `codegen create rename-function`, it creates:
+When you run `codegen create rename-function .`, it creates:
```
.codegen/
@@ -63,12 +64,12 @@ if __name__ == "__main__":
Create a basic codemod:
```bash
-codegen create rename-function
+codegen create rename-function .
```
Create with an AI-powered implementation:
```bash
-codegen create rename-function -d "Rename the getUserData function to fetchUserProfile"
+codegen create rename-function . -d "Rename the getUserData function to fetchUserProfile"
```
## Next Steps
diff --git a/docs/cli/init.mdx b/docs/cli/init.mdx
index ee72657ea..5c37df415 100644
--- a/docs/cli/init.mdx
+++ b/docs/cli/init.mdx
@@ -92,9 +92,11 @@ After initializing:
1. Create your first codemod:
```bash
-codegen create my-function -d "describe what you want to do"
+codegen create my-function . -d "describe what you want to do"
```
+Note: The second parameter (`.`) specifies the path where the codemod should be created. This is required.
+
2. Run it:
```bash
diff --git a/docs/introduction/work-with-ai.mdx b/docs/introduction/work-with-ai.mdx
index 5a0da095c..c826aad75 100644
--- a/docs/introduction/work-with-ai.mdx
+++ b/docs/introduction/work-with-ai.mdx
@@ -28,7 +28,7 @@ The [Codegen CLI](/cli/about) provides commands to generate `.md` files that can
When you create a new codemod via [codegen create](/cli/create):
```bash
-codegen create delete-dead-imports --description "Delete unused imports"
+codegen create delete-dead-imports . --description "Delete unused imports"
```
Codegen automatically generates an optimized ["system prompt"](https://news.ycombinator.com/item?id=37880023) that includes:
@@ -52,7 +52,7 @@ This `.md` file can be used with any AI assistant (Claude, GPT-4, etc.) to get m
Use the [create command](/cli/create) with a detailed description of what you want to accomplish:
```bash
- codegen create modernize-components --description "Convert class components to functional components with hooks"
+ codegen create modernize-components . --description "Convert class components to functional components with hooks"
```
diff --git a/src/codegen/cli/commands/init/main.py b/src/codegen/cli/commands/init/main.py
index b10d6ca23..5cc203f38 100644
--- a/src/codegen/cli/commands/init/main.py
+++ b/src/codegen/cli/commands/init/main.py
@@ -46,6 +46,6 @@ def init_command(path: str | None = None, token: str | None = None, language: st
# Print next steps
rich.print("\n[bold]What's next?[/bold]\n")
rich.print("1. Create a function:")
- rich.print(format_command('codegen create my-function -d "describe what you want to do"'))
+ rich.print(format_command('codegen create my-function . -d "describe what you want to do"'))
rich.print("2. Run it:")
rich.print(format_command("codegen run my-function --apply-local"))