Codegen CLI Manual

Welcome to the Codegen CLI documentation. This guide covers all available commands and their usage patterns.

Installation

uv tool install codegen

Initialization

codegen login

CLI Reference

codegen (root)

Description: Launches the interactive TUI if no subcommand is provided.

codegen agent

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 TEXT The prompt to send to the agent (mutually exclusive with —id unless using create)
  • --id INT Agent run ID to fetch or pull
  • --json Output raw JSON response when fetching (flag)
  • --org-id INT Organization ID (defaults to CODEGEN_API_TOKEN/REPOSITORY_ORG_ID or auto-detect)
  • --model TEXT Model to use for this agent run (optional)
  • --repo-id INT Repository ID to use for this agent run (optional)
Positional Actions:
  • pull Pull the PR branch associated with an agent run (requires —id)

codegen agents

Description: List and manage agent runs. Usage Patterns:
  • List runs: codegen agents list
  • Get run details: codegen agents get 123
Options:
  • --org-id INT Organization ID (defaults to CODEGEN_ORG_ID/REPOSITORY_ORG_ID or auto-detect)
  • --limit INT Maximum number of runs to return (default: 10)
  • --json Output raw JSON response (flag)

codegen login

Description: Store authentication token. Usage Patterns:
  • Interactive login: codegen login
  • Token login: codegen login --token YOUR_API_TOKEN
Options:
  • --token TEXT API token to store
  • --no-verify Skip token verification (flag)

codegen logout

Description: Clear stored authentication token. Usage Pattern:
  • codegen logout

codegen org

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:
  • --json Output raw JSON response (flag)

codegen repo

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 INT Organization ID (defaults to CODEGEN_ORG_ID or auto-detect)
  • --json Output raw JSON response (flag)

Get Started