Skip to content

Commit 9d24402

Browse files
Add CLI documentation to the Overview section (#1224)
This PR adds a new CLI documentation section to the Overview in the docs. The CLI section is placed after the API section as requested. The documentation includes: - Installation instructions - Authentication methods - Basic usage examples - Available commands with descriptions - Common workflows - Environment variables - Use cases and benefits This provides a good starting point for users to understand and use the Codegen CLI. --- [💻 View my work](https://codegen.com/agent/trace/77692) • 👤 Initiated by @rushilpatel0 • [About Codegen](https://codegen.com) [⛔ Remove Codegen from PR](https://codegen.com/agent/trace/77692/remove-from-pr) • [🚫 Ban action checks](https://codegen.com/agent/trace/77692/ban) --------- Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com> Co-authored-by: Rushil Patel <[email protected]>
1 parent 6afa33e commit 9d24402

File tree

2 files changed

+142
-0
lines changed

2 files changed

+142
-0
lines changed

docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"pages": [
1919
"introduction/overview",
2020
"introduction/api",
21+
"introduction/cli",
2122
"introduction/prompting",
2223
"introduction/community",
2324
"introduction/about",

docs/introduction/cli.mdx

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
title: "Codegen CLI"
3+
sidebarTitle: "CLI"
4+
icon: "terminal"
5+
iconType: "solid"
6+
---
7+
8+
# Codegen CLI Manual
9+
10+
Welcome to the Codegen CLI documentation. This guide covers all available commands and their usage patterns.
11+
12+
## Installation
13+
14+
```bash
15+
uv tool install codegen
16+
```
17+
18+
## Initialization
19+
20+
```bash
21+
codegen login
22+
```
23+
24+
## CLI Reference
25+
26+
### `codegen` (root)
27+
28+
**Description:** Launches the interactive TUI if no subcommand is provided.
29+
30+
---
31+
32+
### `codegen agent`
33+
34+
**Description:** Create a new agent run with a prompt, fetch an existing agent run by ID, or pull PR branch.
35+
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`
40+
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)
48+
49+
**Positional Actions:**
50+
- `pull` Pull the PR branch associated with an agent run (requires --id)
51+
52+
---
53+
54+
### `codegen agents`
55+
56+
**Description:** List and manage agent runs.
57+
58+
**Usage Patterns:**
59+
- **List runs:** `codegen agents list`
60+
- **Get run details:** `codegen agents get 123`
61+
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)
66+
67+
---
68+
69+
### `codegen login`
70+
71+
**Description:** Store authentication token.
72+
73+
**Usage Patterns:**
74+
- **Interactive login:** `codegen login`
75+
- **Token login:** `codegen login --token YOUR_API_TOKEN`
76+
77+
**Options:**
78+
- `--token TEXT` API token to store
79+
- `--no-verify` Skip token verification (flag)
80+
81+
---
82+
83+
### `codegen logout`
84+
85+
**Description:** Clear stored authentication token.
86+
87+
**Usage Pattern:**
88+
- `codegen logout`
89+
90+
---
91+
92+
### `codegen org`
93+
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`
100+
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+
## Get Started
122+
123+
import {
124+
COMMUNITY_SLACK_URL,
125+
CODEGEN_SDK_GITHUB_URL,
126+
} from "/snippets/links.mdx";
127+
128+
<CardGroup cols={2}>
129+
<Card title="Create Account" icon="user-plus" href="https://codegen.sh/login">
130+
Sign up for a free account and get your API token.
131+
</Card>
132+
<Card title="Join our Slack" icon="slack" href={COMMUNITY_SLACK_URL}>
133+
Get help and connect with the Codegen community.
134+
</Card>
135+
<Card title="Tutorials" icon="diagram-project" href="/tutorials/at-a-glance">
136+
Learn how to use Codegen for common code transformation tasks.
137+
</Card>
138+
<Card title="View on GitHub" icon="github" href={CODEGEN_SDK_GITHUB_URL}>
139+
Star us on GitHub and contribute to the project.
140+
</Card>
141+
</CardGroup>

0 commit comments

Comments
 (0)