docs(cli): document ! bash commands and session persistence in CLI docs

This commit is contained in:
Dax Raad
2025-08-13 13:37:19 -04:00
parent c6344c5714
commit 21f15f15c1

View File

@@ -95,6 +95,30 @@ Here are all available slash commands:
---
### Bash commands
Start a line with `!` to run a shell command. The output is added to the conversation as a tool result.
```bash frame="none"
!ls -la
```
Commands run in your session's working directory and share state across runs. Environment variables and directory changes persist while the session is open.
```bash frame="none"
!export FOO=bar
!echo $FOO
```
Chain commands with `&&` or `;`, and quote paths with spaces. Use absolute paths when possible for reliability.
```bash frame="none"
!npm install && npm test
!python "/path/with spaces/script.py"
```
---
### Editor setup
Both the `/editor` and `/export` commands use the editor specified in your `EDITOR` environment variable.
@@ -233,7 +257,7 @@ opencode github run
##### Flags
| Flag | Description |
| --------- | ------------------------------------------------ |
| --------- | -------------------------------------- |
| `--event` | GitHub mock event to run the agent for |
| `--token` | GitHub personal access token |
@@ -290,7 +314,7 @@ This starts an HTTP server that provides API access to opencode functionality wi
#### Flags
| Flag | Short | Description |
| ------------ | ----- | ------------------------------------------ |
| ------------ | ----- | --------------------- |
| `--port` | `-p` | Port to listen on |
| `--hostname` | `-h` | Hostname to listen on |
@@ -319,7 +343,7 @@ opencode upgrade v0.1.48
#### Flags
| Flag | Short | Description |
| ---------- | ----- | --------------------------------------------------------- |
| ---------- | ----- | ----------------------------------------------------------------- |
| `--method` | `-m` | The installation method that was used; curl, npm, pnpm, bun, brew |
---