| title | Codegen CLI |
|---|---|
| sidebarTitle | CLI |
| icon | terminal |
| iconType | solid |
The codegen CLI allows users to run and interact with agents from the terminal.
uv tool install codegencodegen loginDescription: Launches the interactive TUI if no subcommand is provided.
Description: Create a new agent run with a prompt, fetch an existing agent run by ID, or pull PR branch.
Usage Patterns:
- Create run:
codegen agent --prompt "Your prompt" - Get run JSON:
codegen agent --id 123 --json - Pull PR branch:
codegen agent --id 123 pull
Options:
--prompt, -p TEXTThe prompt to send to the agent (mutually exclusive with --id unless using create)--id INTAgent run ID to fetch or pull--jsonOutput raw JSON response when fetching (flag)--org-id INTOrganization ID (defaults to CODEGEN_API_TOKEN/REPOSITORY_ORG_ID or auto-detect)--model TEXTModel to use for this agent run (optional)--repo-id INTRepository ID to use for this agent run (optional)
Positional Actions:
pullPull the PR branch associated with an agent run (requires --id)
Description: List and manage agent runs.
Usage Patterns:
- List runs:
codegen agents list - Get run details:
codegen agents get 123
Options:
--org-id INTOrganization ID (defaults to CODEGEN_ORG_ID/REPOSITORY_ORG_ID or auto-detect)--limit INTMaximum number of runs to return (default: 10)--jsonOutput raw JSON response (flag)
Description: Store authentication token.
Usage Patterns:
- Interactive login:
codegen login - Token login:
codegen login --token YOUR_API_TOKEN
Options:
--token TEXTAPI token to store--no-verifySkip token verification (flag)
Description: Clear stored authentication token.
Usage Pattern:
codegen logout
Description: Manage and switch between organizations.
Usage Patterns:
- List organizations:
codegen org list - Switch organization:
codegen org switch ORG_ID - Get current organization:
codegen org current
Options:
--jsonOutput raw JSON response (flag)
Description: Manage repository configuration and environment variables.
Usage Patterns:
- List repositories:
codegen repo list - Configure repository:
codegen repo config REPO_NAME - Get repository details:
codegen repo get REPO_ID
Options:
--org-id INTOrganization ID (defaults to CODEGEN_ORG_ID or auto-detect)--jsonOutput raw JSON response (flag)
import { COMMUNITY_SLACK_URL, CODEGEN_SDK_GITHUB_URL, } from "/snippets/links.mdx";
Sign up for a free account and get your API token. Get help and connect with the Codegen community. Learn how to use Codegen for common code transformation tasks. Star us on GitHub and contribute to the project.