@@ -5,131 +5,142 @@ icon: "terminal"
55iconType : " solid"
66---
77
8- The Codegen CLI provides a command-line interface for interacting with [ Codegen ] ( https://codegen.com ) SWE agents directly from your terminal.
8+ # Codegen CLI Manual
99
10- <Tip >
11- Go to [ developer settings] ( https://codegen.sh/token ) to generate an API token for CLI authentication
12- </Tip >
10+ Welcome to the Codegen CLI documentation. This guide covers all available commands and their usage patterns.
1311
1412## Installation
1513
16- Install the Codegen CLI using pip or uv:
17-
1814``` bash
19- pip install codegen
20- # or
21- uv pip install codegen
22- # or
2315uv tool install codegen
2416```
2517
26- ## Authentication
27-
28- Before using the CLI, you need to authenticate with your Codegen API token:
18+ ## Initialization
2919
3020``` bash
31- # Login with your API token
32- codegen login --token YOUR_API_TOKEN
33-
34- # Alternatively, you can set the CODEGEN_API_TOKEN environment variable
35- export CODEGEN_API_TOKEN=YOUR_API_TOKEN
21+ codegen login
3622```
3723
38- ## Basic Usage
24+ ## CLI Reference
3925
40- Once authenticated, you can use the CLI to interact with Codegen:
26+ ### ` codegen ` (root)
4127
42- ``` bash
43- # Get CLI help
44- codegen --help
28+ ** Description:** Launches the interactive TUI if no subcommand is provided.
4529
46- # View version information
47- codegen --version
30+ ---
4831
49- # Launch the interactive TUI interface
50- codegen
51- # or
52- codegen tui
53- ```
32+ ### ` codegen agent `
5433
55- ## Available Commands
34+ ** Description: ** Create a new agent run with a prompt, fetch an existing agent run by ID, or pull PR branch.
5635
57- The Codegen CLI offers several commands for different functionalities:
36+ ** Usage Patterns:**
37+ - ** Create run:** ` codegen agent --prompt "Your prompt" `
38+ - ** Get run JSON:** ` codegen agent --id 123 --json `
39+ - ** Pull PR branch:** ` codegen agent --id 123 pull `
5840
59- | Command | Description |
60- | ------- | ----------- |
61- | ` agent ` | Create a new agent run with a prompt, fetch an existing agent run by ID, or pull PR branch |
62- | ` agents ` | Manage and interact with your agents |
63- | ` claude ` | Run Claude Code with OpenTelemetry monitoring and logging |
64- | ` config ` | Manage configuration settings |
65- | ` init ` | Initialize or update the Codegen folder |
66- | ` integrations ` | Manage integrations with external services |
67- | ` login ` | Store authentication token |
68- | ` logout ` | Clear stored authentication token |
69- | ` org ` | Manage and switch between organizations |
70- | ` profile ` | Manage your Codegen profile |
71- | ` repo ` | Manage repository configuration and environment variables |
72- | ` tools ` | List available tools from the Codegen API |
73- | ` tui ` | Launch the interactive TUI interface |
74- | ` update ` | Update Codegen to the latest or specified version |
41+ ** Options:**
42+ - ` --prompt, -p TEXT ` The prompt to send to the agent (mutually exclusive with --id unless using create)
43+ - ` --id INT ` Agent run ID to fetch or pull
44+ - ` --json ` Output raw JSON response when fetching (flag)
45+ - ` --org-id INT ` Organization ID (defaults to CODEGEN_API_TOKEN/REPOSITORY_ORG_ID or auto-detect)
46+ - ` --model TEXT ` Model to use for this agent run (optional)
47+ - ` --repo-id INT ` Repository ID to use for this agent run (optional)
7548
76- ## Common Workflows
49+ ** Positional Actions:**
50+ - ` pull ` Pull the PR branch associated with an agent run (requires --id)
7751
78- ### Creating an Agent Run
52+ ---
7953
80- To create a new agent run with a prompt:
54+ ### ` codegen agents `
8155
82- ``` bash
83- codegen agent --prompt " Implement a function to calculate Fibonacci numbers in Python"
84- ```
56+ ** Description:** List and manage agent runs.
8557
86- You can also fetch an existing agent run by ID or pull a PR branch:
58+ ** Usage Patterns:**
59+ - ** List runs:** ` codegen agents list `
60+ - ** Get run details:** ` codegen agents get 123 `
8761
88- ``` bash
89- # Get run details in JSON format
90- codegen agent --id 123 --json
62+ ** Options:**
63+ - ` --org-id INT ` Organization ID (defaults to CODEGEN_ORG_ID/REPOSITORY_ORG_ID or auto-detect)
64+ - ` --limit INT ` Maximum number of runs to return (default: 10)
65+ - ` --json ` Output raw JSON response (flag)
9166
92- # Pull PR branch from an agent run
93- codegen agent --id 123 pull
94- ```
67+ ---
9568
96- ### Managing Organizations
69+ ### ` codegen login `
9770
98- To list and switch between organizations:
71+ ** Description: ** Store authentication token.
9972
100- ``` bash
101- # List available organizations
102- codegen org list
73+ ** Usage Patterns: **
74+ - ** Interactive login: ** ` codegen login `
75+ - ** Token login: ** ` codegen login --token YOUR_API_TOKEN `
10376
104- # Switch to a specific organization
105- codegen org switch ORG_ID
106- ```
77+ ** Options: **
78+ - ` --token TEXT ` API token to store
79+ - ` --no-verify ` Skip token verification (flag)
10780
108- ### Managing Repositories
81+ ---
10982
110- To configure repositories:
83+ ### ` codegen logout `
11184
112- ``` bash
113- # List repositories
114- codegen repo list
85+ ** Description:** Clear stored authentication token.
11586
116- # Configure a repository
117- codegen repo config REPO_NAME
118- ```
87+ ** Usage Pattern:**
88+ - ` codegen logout `
11989
120- ### Using the TUI (Terminal User Interface)
90+ ---
12191
122- The Codegen CLI includes a rich terminal user interface for interactive use:
92+ ### ` codegen org `
12393
124- ``` bash
125- codegen tui
126- ```
94+ ** Description:** Manage and switch between organizations.
95+
96+ ** Usage Patterns:**
97+ - ** List organizations:** ` codegen org list `
98+ - ** Switch organization:** ` codegen org switch ORG_ID `
99+ - ** Get current organization:** ` codegen org current `
127100
128- This launches an interactive interface where you can:
129- - Create and manage agent runs
130- - View agent run status and results
131- - Configure settings
132- - Manage organizations and repositories
101+ ** Options:**
102+ - ` --json ` Output raw JSON response (flag)
103+
104+ ---
105+
106+ ### ` codegen repo `
107+
108+ ** Description:** Manage repository configuration and environment variables.
109+
110+ ** Usage Patterns:**
111+ - ** List repositories:** ` codegen repo list `
112+ - ** Configure repository:** ` codegen repo config REPO_NAME `
113+ - ** Get repository details:** ` codegen repo get REPO_ID `
114+
115+ ** Options:**
116+ - ` --org-id INT ` Organization ID (defaults to CODEGEN_ORG_ID or auto-detect)
117+ - ` --json ` Output raw JSON response (flag)
118+
119+ ---
120+
121+ ### ` codegen tui `
122+
123+ ** Description:** Launch the interactive TUI interface.
124+
125+ ** Usage Pattern:**
126+ - ` codegen tui `
127+
128+ ---
129+
130+ ### ` codegen update `
131+
132+ ** Description:** Update Codegen to the latest or specified version.
133+
134+ ** Usage Patterns:**
135+ - ** Update to latest:** ` codegen update `
136+ - ** Update to specific version:** ` codegen update --version X.Y.Z `
137+
138+ ** Options:**
139+ - ` --version TEXT ` Specific version to update to
140+ - ` --check ` Only check for updates, don't install (flag)
141+ - ` --force ` Force update even if already at latest version (flag)
142+
143+ ---
133144
134145## Environment Variables
135146
@@ -142,17 +153,6 @@ The CLI respects the following environment variables:
142153| ` CODEGEN_ORG_ID ` | Default organization ID |
143154| ` REPOSITORY_ORG_ID ` | Organization ID for repository-specific operations |
144155
145- ## What can I do with the Codegen CLI?
146-
147- The Codegen CLI is your terminal gateway to interacting with your AI Software Engineer. You can use it to:
148-
149- - ** Run agents from your terminal** : Create agent runs with custom prompts directly from your command line
150- - ** Manage your Codegen resources** : Configure organizations, repositories, and integrations
151- - ** Integrate into scripts and workflows** : Incorporate Codegen capabilities into your shell scripts and automation workflows
152- - ** Interactive TUI experience** : Use the rich terminal interface for a more visual interaction with Codegen
153-
154- Essentially, the CLI allows you to leverage Codegen's AI capabilities directly from your terminal or in automated scripts.
155-
156156## Get Started
157157
158158import {
@@ -174,3 +174,4 @@ import {
174174 Star us on GitHub and contribute to the project.
175175 </Card >
176176</CardGroup >
177+
0 commit comments