docs: centralize environment variables into a dedicated section
This commit is contained in:
parent
78a4f42bc0
commit
053e34d350
41
README.md
41
README.md
@ -146,6 +146,30 @@ global config (`baseURL`/`ccVersion` are read from there too).
|
|||||||
`options.headers` (with a leading `Bearer ` stripped). If neither is present, requests are sent
|
`options.headers` (with a leading `Bearer ` stripped). If neither is present, requests are sent
|
||||||
unauthenticated and CommandCode will reject them.
|
unauthenticated and CommandCode will reject them.
|
||||||
|
|
||||||
|
## Environment variables
|
||||||
|
|
||||||
|
All environment variables read by the provider, its scripts, and its TUI plugin. String values in
|
||||||
|
`options` also accept `{env:NAME}`, which opencode/the TUI expand generically (not a fixed set).
|
||||||
|
|
||||||
|
CommandCode-specific:
|
||||||
|
|
||||||
|
| Name | Purpose | Default |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `COMMANDCODE_API_KEY` | CommandCode API key for `smoke`/`quota`/`sync-models` and the TUI's key resolution; referenced from config as `{env:COMMANDCODE_API_KEY}`. | — |
|
||||||
|
| `COMMANDCODE_DEBUG` | Enables request/stream tracing (`1`/`true`/`yes`); the toggle file wins when its `debug` key is set. | unset |
|
||||||
|
| `COMMANDCODE_DEBUG_FILE` | Path the trace is appended to. | `<os tempdir>/commandcode-debug.log` |
|
||||||
|
| `COMMANDCODE_ZDR` | Enables the `x-cmd-zdr: 1` header (`1`/`true`/`yes`); the toggle file wins when its `zdr` key is set. | unset |
|
||||||
|
| `COMMANDCODE_TOGGLES_FILE` | Overrides the shared toggle-file path. | `$XDG_CONFIG_HOME/opencode/commandcode-toggles.json` |
|
||||||
|
| `COMMANDCODE_QUOTA_INTERVAL_MS` | Sidebar fallback quota refresh interval in ms. | `300000` (floor `120000`) |
|
||||||
|
|
||||||
|
Standard:
|
||||||
|
|
||||||
|
| Name | Purpose | Default |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `XDG_CONFIG_HOME` | Base config dir for the toggle file. | `~/.config` |
|
||||||
|
| `NO_COLOR` | Disables ANSI colors in the `sync-models` picker (any value). | unset |
|
||||||
|
| `TERM` | `dumb` disables ANSI colors in the `sync-models` picker. | — |
|
||||||
|
|
||||||
## Debug tracing
|
## Debug tracing
|
||||||
|
|
||||||
Set `COMMANDCODE_DEBUG=1` to write a trace of every request and stream event to a log file.
|
Set `COMMANDCODE_DEBUG=1` to write a trace of every request and stream event to a log file.
|
||||||
@ -158,10 +182,8 @@ $env:COMMANDCODE_DEBUG = "1"
|
|||||||
opencode run "Reply with exactly: pong" -m commandcode/deepseek/deepseek-v4.1-flash
|
opencode run "Reply with exactly: pong" -m commandcode/deepseek/deepseek-v4.1-flash
|
||||||
```
|
```
|
||||||
|
|
||||||
| Env var | Default | Description |
|
`COMMANDCODE_DEBUG` and `COMMANDCODE_DEBUG_FILE` are described in
|
||||||
| --- | --- | --- |
|
[Environment variables](#environment-variables).
|
||||||
| `COMMANDCODE_DEBUG` | unset | `1`/`true`/`yes` enables tracing. |
|
|
||||||
| `COMMANDCODE_DEBUG_FILE` | `<os tempdir>/commandcode-debug.log` | Where the trace is appended. |
|
|
||||||
|
|
||||||
The log captures the request (model id, body byte length), each HTTP attempt (status, retry
|
The log captures the request (model id, body byte length), each HTTP attempt (status, retry
|
||||||
wait, elapsed ms), every stream event payload, and the terminal finish reason + usage. It is
|
wait, elapsed ms), every stream event payload, and the terminal finish reason + usage. It is
|
||||||
@ -170,8 +192,9 @@ useful for diagnosing model selection, retry, tool-call, and finish-reason issue
|
|||||||
## ZDR header toggle
|
## ZDR header toggle
|
||||||
|
|
||||||
The `x-cmd-zdr: 1` request header is **omitted by default** because it is rejected by some
|
The `x-cmd-zdr: 1` request header is **omitted by default** because it is rejected by some
|
||||||
models. It can be enabled with the `COMMANDCODE_ZDR` environment variable, the `/cc-zdr` slash
|
models. It can be enabled with the `COMMANDCODE_ZDR` environment variable (see
|
||||||
command, or `providerOptions.commandcode.zdr`. The value is resolved per request, so toggling it
|
[Environment variables](#environment-variables)), the `/cc-zdr` slash command, or
|
||||||
|
`providerOptions.commandcode.zdr`. The value is resolved per request, so toggling it
|
||||||
does not require restarting opencode.
|
does not require restarting opencode.
|
||||||
|
|
||||||
Precedence, highest first:
|
Precedence, highest first:
|
||||||
@ -189,7 +212,8 @@ observable.
|
|||||||
`/cc-zdr` and `/cc-debug` flip the `zdr` and `debug` values in a small JSON file the provider
|
`/cc-zdr` and `/cc-debug` flip the `zdr` and `debug` values in a small JSON file the provider
|
||||||
reads on every request, so both settings change without restarting opencode. `/cc-status` shows
|
reads on every request, so both settings change without restarting opencode. `/cc-status` shows
|
||||||
the current state. The file is `~/.config/opencode/commandcode-toggles.json` (overridable with
|
the current state. The file is `~/.config/opencode/commandcode-toggles.json` (overridable with
|
||||||
`COMMANDCODE_TOGGLES_FILE`); the environment variables above are used when a key is absent.
|
`COMMANDCODE_TOGGLES_FILE` — see [Environment variables](#environment-variables)); the environment
|
||||||
|
variables above are used when a key is absent.
|
||||||
|
|
||||||
These commands come from a small TUI plugin shipped in this package (`src/tui.tsx`). It is loaded
|
These commands come from a small TUI plugin shipped in this package (`src/tui.tsx`). It is loaded
|
||||||
from **source** — opencode compiles the TSX and provides the Solid runtime itself — so there is no
|
from **source** — opencode compiles the TSX and provides the Solid runtime itself — so there is no
|
||||||
@ -244,7 +268,8 @@ The sidebar refreshes after each completed turn (`session.idle`, plus `session.s
|
|||||||
`session.updated`, and `message.updated` as fallbacks since `session.idle` is a server-plugin
|
`session.updated`, and `message.updated` as fallbacks since `session.idle` is a server-plugin
|
||||||
event that may never reach the TUI bus — all debounced) and when the active session changes,
|
event that may never reach the TUI bus — all debounced) and when the active session changes,
|
||||||
but never more than once every 2 minutes; every 5 minutes as a fallback
|
but never more than once every 2 minutes; every 5 minutes as a fallback
|
||||||
(`COMMANDCODE_QUOTA_INTERVAL_MS` overrides the fallback interval) and the
|
(`COMMANDCODE_QUOTA_INTERVAL_MS` overrides the fallback interval — see
|
||||||
|
[Environment variables](#environment-variables)) and the
|
||||||
countdown ticks every 30 seconds. Key resolution and fetch failures are redacted and shown
|
countdown ticks every 30 seconds. Key resolution and fetch failures are redacted and shown
|
||||||
inline; the panel never stays on `loading…` and never blocks the provider. Extra trace lines
|
inline; the panel never stays on `loading…` and never blocks the provider. Extra trace lines
|
||||||
(`tui-quota`) are appended to the debug log only when debug tracing is on.
|
(`tui-quota`) are appended to the debug log only when debug tracing is on.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user