Skip to content

Commit 2dea8f0

Browse files
committed
docs: add tui doc
1 parent 446ce48 commit 2dea8f0

File tree

6 files changed

+309
-140
lines changed

6 files changed

+309
-140
lines changed

.opencode/agent/docs.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
---
2-
model: openai/gpt-5
3-
reasoningEffort: medium
42
description: ALWAYS use this when writing docs
53
---
64

75
You are an expert technical documentation writer
86

97
You are not verbose
108

11-
Every chunk of text should be followed by an example or something besides text
12-
to look at.
9+
The title of the page should be a word or a 2-3 word phrase
1310

14-
Chunks of text should not be more than 2 sentences long.
11+
The description should be one short line, should not start with "The", should
12+
avoid repeating the title of the page, should be 5-10 words long
13+
14+
Chunks of text should not be more than 2 sentences long
15+
16+
Each section is spearated by a divider of 3 dashes
17+
18+
The section titles are short with only the first letter of the word capitalized
19+
20+
The section titles are in the imperative mood
21+
22+
The section titles should not repeat the term used in the page title, for
23+
example, if the page title is "Models", avoid using a section title like "Add
24+
new models". This might be unavoidable in some cases, but try to avoid it.
25+
26+
Check out the /packages/web/src/content/docs/docs/index.mdx as an example.

packages/web/astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default defineConfig({
6969

7070
{
7171
label: "Usage",
72-
items: ["docs/cli", "docs/ide", "docs/share", "docs/github"],
72+
items: ["docs/tui", "docs/cli", "docs/ide", "docs/share", "docs/github"],
7373
},
7474

7575
{

packages/web/src/content/docs/docs/cli.mdx

Lines changed: 3 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,16 @@
11
---
22
title: CLI
3-
description: The opencode CLI options and commands.
3+
description: opencode CLI options and commands.
44
---
55

66
import { Tabs, TabItem } from "@astrojs/starlight/components"
77

8-
Running the opencode CLI starts it for the current directory.
8+
The opencode CLI accepts commands as documented on this page. You can run any of the available commands to interact with opencode programmatically.
99

1010
```bash
11-
opencode
11+
opencode run "Explain how closures work in JavaScript"
1212
```
1313

14-
Or you can start it for a specific working directory.
15-
16-
```bash
17-
opencode /path/to/project
18-
```
19-
20-
---
21-
22-
## Slash commands
23-
24-
When using the opencode CLI, you can type `/` followed by a command name to quickly execute actions. For example:
25-
26-
:::tip
27-
You can also use `@` to reference files in your messages.
28-
:::
29-
30-
```bash frame="none"
31-
/help
32-
```
33-
34-
Here are all available slash commands:
35-
36-
- **`/help`**
37-
38-
Show the help dialog.
39-
40-
- **`/editor`**
41-
42-
Open external editor for composing messages. Uses the editor set in your `EDITOR` environment variable. [Learn more](#editor-setup).
43-
44-
- **`/export`**
45-
46-
Export current conversation to Markdown and open in your default editor. Uses the editor set in your `EDITOR` environment variable. [Learn more](#editor-setup).
47-
48-
- **`/new`**
49-
50-
Start a new session. _Alias_: `/clear`
51-
52-
- **`/sessions`**
53-
54-
List and switch between sessions. _Aliases_: `/resume`, `/continue`
55-
56-
- **`/share`**
57-
58-
Share current session. [Learn more](/docs/share).
59-
60-
- **`/unshare`**
61-
62-
Unshare current session. [Learn more](/docs/share#un-sharing).
63-
64-
- **`/compact`**
65-
66-
Compact the current session. _Alias_: `/summarize`
67-
68-
- **`/details`**
69-
70-
Toggle tool execution details.
71-
72-
- **`/models`**
73-
74-
List available models.
75-
76-
- **`/themes`**
77-
78-
List available themes.
79-
80-
- **`/init`**
81-
82-
Create or update `AGENTS.md` file. [Learn more](/docs/rules).
83-
84-
- **`/undo`**
85-
86-
Undo last message.
87-
88-
- **`/redo`**
89-
90-
Redo message.
91-
92-
- **`/exit`**
93-
94-
Exit opencode. _Aliases_: `/quit`, `/q`
95-
96-
---
97-
98-
### Bash commands
99-
100-
Start a line with `!` to run a shell command. The output is added to the conversation as a tool result.
101-
102-
```bash frame="none"
103-
!ls -la
104-
```
105-
106-
---
107-
108-
### Editor setup
109-
110-
Both the `/editor` and `/export` commands use the editor specified in your `EDITOR` environment variable.
111-
112-
<Tabs>
113-
<TabItem label="Linux/macOS">
114-
```bash export EDITOR=nano # or vim, code, etc. ``` To make it permanent, add this to your shell profile;
115-
`~/.bashrc`, `~/.zshrc`, etc.
116-
</TabItem>
117-
<TabItem label="Windows (CMD)">
118-
```bash set EDITOR=notepad # or code, vim, etc. ``` To make it permanent, use **System Properties** > **Environment
119-
Variables**.
120-
</TabItem>
121-
<TabItem label="Windows (PowerShell)">
122-
```bash $env:EDITOR = "notepad" # or "code", "vim", etc. ``` To make it permanent, add this to your PowerShell
123-
profile.
124-
</TabItem>
125-
</Tabs>
126-
127-
Popular editor options include:
128-
129-
- `code` - Visual Studio Code
130-
- `vim` - Vim editor
131-
- `nano` - Nano editor
132-
- `notepad` - Windows Notepad
133-
- `subl` - Sublime Text
134-
13514
---
13615

13716
## Commands

packages/web/src/content/docs/docs/index.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,16 @@ help.
157157

158158
You can ask opencode to explain the codebase to you.
159159

160-
```txt frame="none"
160+
:::tip
161+
Use the `@` key to fuzzy search for files in the project.
162+
:::
163+
164+
```txt frame="none" "@packages/functions/src/api/index.ts"
161165
How is authentication handled in @packages/functions/src/api/index.ts
162166
```
163167

164168
This is helpful if there's a part of the codebase that you didn't work on.
165169

166-
:::tip
167-
Use the `@` key to fuzzy search for files in the project.
168-
:::
169-
170170
---
171171

172172
### Add features
@@ -238,7 +238,7 @@ You can ask opencode to add new features to your project. Though we first recomm
238238
For more straightforward changes, you can ask opencode to directly build it
239239
without having to review the plan first.
240240

241-
```txt frame="none"
241+
```txt frame="none" "@packages/functions/src/settings.ts" "@packages/functions/src/notes.ts"
242242
We need to add authentication to the /settings route. Take a look at how this is
243243
handled in the /notes route in @packages/functions/src/notes.ts and implement
244244
the same logic in @packages/functions/src/settings.ts
@@ -253,7 +253,7 @@ changes.
253253

254254
Let's say you ask opencode to make some changes.
255255

256-
```txt frame="none"
256+
```txt frame="none" "@packages/functions/src/api/index.ts"
257257
Can you refactor the function in @packages/functions/src/api/index.ts?
258258
```
259259

@@ -267,7 +267,7 @@ using the `/undo` command.
267267
opencode will now revert the changes you made and show your original message
268268
again.
269269

270-
```txt frame="none"
270+
```txt frame="none" "@packages/functions/src/api/index.ts"
271271
Can you refactor the function in @packages/functions/src/api/index.ts?
272272
```
273273

packages/web/src/content/docs/docs/providers.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,6 @@ In this example:
614614
615615
### OpenAI
616616
617-
https://platform.openai.com/api-keys
618-
619617
1. Head over to the [OpenAI Platform console](https://platform.openai.com/api-keys), click **Create new secret key**, and copy the key.
620618
621619
2. Run `opencode auth login` and select OpenAI.

0 commit comments

Comments
 (0)