From 27ab7c41e476d26bc0ae520ef3c4efbe21fa43d0 Mon Sep 17 00:00:00 2001 From: Darshit Patel Date: Fri, 19 Jun 2026 16:31:22 +0530 Subject: [PATCH 1/4] Update CLI reference documentation with accurate OpenCode CLI information --- opencode/references/cli-opencode.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/opencode/references/cli-opencode.md b/opencode/references/cli-opencode.md index 0f3546a..65d91be 100644 --- a/opencode/references/cli-opencode.md +++ b/opencode/references/cli-opencode.md @@ -4,8 +4,8 @@ - **Command:** `opencode` - **Non-interactive subcommand:** `opencode run` (auto-approves tool use in non-interactive mode) -- **Output format flag:** `--format default|json` (`default` outputs plain text to stdout; ANSI/session header goes to stderr) -- **Model flag:** `-m` / `--model` (format: `provider/model`, e.g. `opencode/big-model-name`, `anthropic/claude-sonnet-4-6`) +- **Output format flag:** `--format default|json` (`default` outputs formatted text to stdout; ANSI/session header goes to stderr, `json` outputs raw JSON events) +- **Model flag:** `-m` / `--model` (format: `provider/model`, e.g. `anthropic/claude-sonnet-4`, `openai/gpt-4o`) - **List models command:** `opencode models` (requires configured provider credentials) - **Self-call detection:** Check for `OPENCODE` environment variable (set to `1` inside OpenCode sessions), or `opencode` in process ancestry @@ -13,19 +13,20 @@ - **Default model (fallback):** OpenCode's default model (confirm via `opencode models`) - **Aliases:** None — use full `provider/model` IDs -- **Quirks:** OpenCode is multi-provider (OpenAI, Anthropic, Google, AWS Bedrock, Groq, Azure, OpenRouter). Model IDs use `provider/model` format. The `run` subcommand auto-approves all tool use in non-interactive mode — there is no separate `--yolo` or `--trust` flag. The `--format default` output sends ANSI codes and session header to stderr; stdout is clean text. +- **Quirks:** OpenCode is multi-provider (OpenAI, Anthropic, Google, AWS Bedrock, Groq, Azure, OpenRouter). Model IDs use `provider/model` format. The `run` subcommand auto-approves all tool use in non-interactive mode. The `--format default` output sends ANSI codes and session header to stderr; stdout is clean text. The `--format json` option outputs raw JSON events for programmatic consumption. ## 3. Invocation Template | Mode | Command | |----------------|-------------------------------------------------------------------------------| -| **Validation** | `cat "$PROMPT_FILE" \| opencode run -m --format default 2>/dev/null` | +| **Validation** | `cat "$PROMPT_FILE" \| opencode run -m --format json 2>/dev/null` | | **Delegation** | `cat "$PROMPT_FILE" \| opencode run -m --format default 2>/dev/null` | -Note: Both modes use the same command because OpenCode auto-approves all actions in non-interactive `run` mode. Prompt is piped via stdin. OpenCode does not expose an internal `--timeout` flag; enforce the 120-second limit per `references/shared-procedure.md` Step 6 (kill the process if it does not exit). Stderr is suppressed (`2>/dev/null`) to remove ANSI codes and session header from output. +Note: Validation mode uses `--format json` to get structured output for parsing, while Delegation mode uses `--format default` for human-readable output. Both modes use the `run` subcommand because OpenCode auto-approves all actions in non-interactive mode. Prompt is piped via stdin. OpenCode does not expose an internal `--timeout` flag; enforce the 120-second limit per `references/shared-procedure.md` Step 6 (kill the process if it does not exit). Stderr is suppressed (`2>/dev/null`) to remove ANSI codes and session header from output. ## 4. Version Compatibility Matrix | Version | Model Flag | Run Subcommand | Format Flag | Notes | |---------|--------------------|----------------|--------------------------|--------------------------------| | 1.3.10 | `-m` / `--model` | `run` | `--format default\|json` | Verified; stdin piping works | +| 1.17.8 | `-m` / `--model` | `run` | `--format default\|json` | Current version; full feature set available | From 08d7d4e1d3040eafc0bd32213cc5dd7efc8c86e2 Mon Sep 17 00:00:00 2001 From: Darshit Patel Date: Fri, 19 Jun 2026 16:32:25 +0530 Subject: [PATCH 2/4] docs: update OpenCode CLI information in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85c773c..00f0e1a 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ adds a round-trip to another CLI, so use it when the extra signal is worth the t | Gemini CLI | `gemini` | `gemini-2.5-pro` | Google models, auto-routing | | Junie | `junie` | Junie default | LLM-agnostic, BYOK support | | Qwen Code | `qwen` | Qwen default | Qwen model family, `--yolo` for auto-approve | -| OpenCode | `opencode` | OpenCode default | Multi-provider, uses `run` subcommand | +| OpenCode | `opencode` | OpenCode default | Multi-provider, uses `run` subcommand with auto-approval | ## How to use it From ee06167e8bf088763b81bf85694103dc5fd230c9 Mon Sep 17 00:00:00 2001 From: Darshit Patel Date: Fri, 19 Jun 2026 16:35:54 +0530 Subject: [PATCH 3/4] fix: resolve CLI reference drift by copying canonical version --- opencode/references/cli-opencode.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/opencode/references/cli-opencode.md b/opencode/references/cli-opencode.md index 65d91be..0f3546a 100644 --- a/opencode/references/cli-opencode.md +++ b/opencode/references/cli-opencode.md @@ -4,8 +4,8 @@ - **Command:** `opencode` - **Non-interactive subcommand:** `opencode run` (auto-approves tool use in non-interactive mode) -- **Output format flag:** `--format default|json` (`default` outputs formatted text to stdout; ANSI/session header goes to stderr, `json` outputs raw JSON events) -- **Model flag:** `-m` / `--model` (format: `provider/model`, e.g. `anthropic/claude-sonnet-4`, `openai/gpt-4o`) +- **Output format flag:** `--format default|json` (`default` outputs plain text to stdout; ANSI/session header goes to stderr) +- **Model flag:** `-m` / `--model` (format: `provider/model`, e.g. `opencode/big-model-name`, `anthropic/claude-sonnet-4-6`) - **List models command:** `opencode models` (requires configured provider credentials) - **Self-call detection:** Check for `OPENCODE` environment variable (set to `1` inside OpenCode sessions), or `opencode` in process ancestry @@ -13,20 +13,19 @@ - **Default model (fallback):** OpenCode's default model (confirm via `opencode models`) - **Aliases:** None — use full `provider/model` IDs -- **Quirks:** OpenCode is multi-provider (OpenAI, Anthropic, Google, AWS Bedrock, Groq, Azure, OpenRouter). Model IDs use `provider/model` format. The `run` subcommand auto-approves all tool use in non-interactive mode. The `--format default` output sends ANSI codes and session header to stderr; stdout is clean text. The `--format json` option outputs raw JSON events for programmatic consumption. +- **Quirks:** OpenCode is multi-provider (OpenAI, Anthropic, Google, AWS Bedrock, Groq, Azure, OpenRouter). Model IDs use `provider/model` format. The `run` subcommand auto-approves all tool use in non-interactive mode — there is no separate `--yolo` or `--trust` flag. The `--format default` output sends ANSI codes and session header to stderr; stdout is clean text. ## 3. Invocation Template | Mode | Command | |----------------|-------------------------------------------------------------------------------| -| **Validation** | `cat "$PROMPT_FILE" \| opencode run -m --format json 2>/dev/null` | +| **Validation** | `cat "$PROMPT_FILE" \| opencode run -m --format default 2>/dev/null` | | **Delegation** | `cat "$PROMPT_FILE" \| opencode run -m --format default 2>/dev/null` | -Note: Validation mode uses `--format json` to get structured output for parsing, while Delegation mode uses `--format default` for human-readable output. Both modes use the `run` subcommand because OpenCode auto-approves all actions in non-interactive mode. Prompt is piped via stdin. OpenCode does not expose an internal `--timeout` flag; enforce the 120-second limit per `references/shared-procedure.md` Step 6 (kill the process if it does not exit). Stderr is suppressed (`2>/dev/null`) to remove ANSI codes and session header from output. +Note: Both modes use the same command because OpenCode auto-approves all actions in non-interactive `run` mode. Prompt is piped via stdin. OpenCode does not expose an internal `--timeout` flag; enforce the 120-second limit per `references/shared-procedure.md` Step 6 (kill the process if it does not exit). Stderr is suppressed (`2>/dev/null`) to remove ANSI codes and session header from output. ## 4. Version Compatibility Matrix | Version | Model Flag | Run Subcommand | Format Flag | Notes | |---------|--------------------|----------------|--------------------------|--------------------------------| | 1.3.10 | `-m` / `--model` | `run` | `--format default\|json` | Verified; stdin piping works | -| 1.17.8 | `-m` / `--model` | `run` | `--format default\|json` | Current version; full feature set available | From d1accadc921e8a222c8dec03f5361996a119d322 Mon Sep 17 00:00:00 2001 From: Darshit Patel Date: Fri, 19 Jun 2026 16:37:58 +0530 Subject: [PATCH 4/4] feat: update canonical OpenCode CLI reference with improved documentation --- opencode/references/cli-opencode.md | 11 ++++++----- references/cli-opencode.md | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/opencode/references/cli-opencode.md b/opencode/references/cli-opencode.md index 0f3546a..65d91be 100644 --- a/opencode/references/cli-opencode.md +++ b/opencode/references/cli-opencode.md @@ -4,8 +4,8 @@ - **Command:** `opencode` - **Non-interactive subcommand:** `opencode run` (auto-approves tool use in non-interactive mode) -- **Output format flag:** `--format default|json` (`default` outputs plain text to stdout; ANSI/session header goes to stderr) -- **Model flag:** `-m` / `--model` (format: `provider/model`, e.g. `opencode/big-model-name`, `anthropic/claude-sonnet-4-6`) +- **Output format flag:** `--format default|json` (`default` outputs formatted text to stdout; ANSI/session header goes to stderr, `json` outputs raw JSON events) +- **Model flag:** `-m` / `--model` (format: `provider/model`, e.g. `anthropic/claude-sonnet-4`, `openai/gpt-4o`) - **List models command:** `opencode models` (requires configured provider credentials) - **Self-call detection:** Check for `OPENCODE` environment variable (set to `1` inside OpenCode sessions), or `opencode` in process ancestry @@ -13,19 +13,20 @@ - **Default model (fallback):** OpenCode's default model (confirm via `opencode models`) - **Aliases:** None — use full `provider/model` IDs -- **Quirks:** OpenCode is multi-provider (OpenAI, Anthropic, Google, AWS Bedrock, Groq, Azure, OpenRouter). Model IDs use `provider/model` format. The `run` subcommand auto-approves all tool use in non-interactive mode — there is no separate `--yolo` or `--trust` flag. The `--format default` output sends ANSI codes and session header to stderr; stdout is clean text. +- **Quirks:** OpenCode is multi-provider (OpenAI, Anthropic, Google, AWS Bedrock, Groq, Azure, OpenRouter). Model IDs use `provider/model` format. The `run` subcommand auto-approves all tool use in non-interactive mode. The `--format default` output sends ANSI codes and session header to stderr; stdout is clean text. The `--format json` option outputs raw JSON events for programmatic consumption. ## 3. Invocation Template | Mode | Command | |----------------|-------------------------------------------------------------------------------| -| **Validation** | `cat "$PROMPT_FILE" \| opencode run -m --format default 2>/dev/null` | +| **Validation** | `cat "$PROMPT_FILE" \| opencode run -m --format json 2>/dev/null` | | **Delegation** | `cat "$PROMPT_FILE" \| opencode run -m --format default 2>/dev/null` | -Note: Both modes use the same command because OpenCode auto-approves all actions in non-interactive `run` mode. Prompt is piped via stdin. OpenCode does not expose an internal `--timeout` flag; enforce the 120-second limit per `references/shared-procedure.md` Step 6 (kill the process if it does not exit). Stderr is suppressed (`2>/dev/null`) to remove ANSI codes and session header from output. +Note: Validation mode uses `--format json` to get structured output for parsing, while Delegation mode uses `--format default` for human-readable output. Both modes use the `run` subcommand because OpenCode auto-approves all actions in non-interactive mode. Prompt is piped via stdin. OpenCode does not expose an internal `--timeout` flag; enforce the 120-second limit per `references/shared-procedure.md` Step 6 (kill the process if it does not exit). Stderr is suppressed (`2>/dev/null`) to remove ANSI codes and session header from output. ## 4. Version Compatibility Matrix | Version | Model Flag | Run Subcommand | Format Flag | Notes | |---------|--------------------|----------------|--------------------------|--------------------------------| | 1.3.10 | `-m` / `--model` | `run` | `--format default\|json` | Verified; stdin piping works | +| 1.17.8 | `-m` / `--model` | `run` | `--format default\|json` | Current version; full feature set available | diff --git a/references/cli-opencode.md b/references/cli-opencode.md index 0f3546a..65d91be 100644 --- a/references/cli-opencode.md +++ b/references/cli-opencode.md @@ -4,8 +4,8 @@ - **Command:** `opencode` - **Non-interactive subcommand:** `opencode run` (auto-approves tool use in non-interactive mode) -- **Output format flag:** `--format default|json` (`default` outputs plain text to stdout; ANSI/session header goes to stderr) -- **Model flag:** `-m` / `--model` (format: `provider/model`, e.g. `opencode/big-model-name`, `anthropic/claude-sonnet-4-6`) +- **Output format flag:** `--format default|json` (`default` outputs formatted text to stdout; ANSI/session header goes to stderr, `json` outputs raw JSON events) +- **Model flag:** `-m` / `--model` (format: `provider/model`, e.g. `anthropic/claude-sonnet-4`, `openai/gpt-4o`) - **List models command:** `opencode models` (requires configured provider credentials) - **Self-call detection:** Check for `OPENCODE` environment variable (set to `1` inside OpenCode sessions), or `opencode` in process ancestry @@ -13,19 +13,20 @@ - **Default model (fallback):** OpenCode's default model (confirm via `opencode models`) - **Aliases:** None — use full `provider/model` IDs -- **Quirks:** OpenCode is multi-provider (OpenAI, Anthropic, Google, AWS Bedrock, Groq, Azure, OpenRouter). Model IDs use `provider/model` format. The `run` subcommand auto-approves all tool use in non-interactive mode — there is no separate `--yolo` or `--trust` flag. The `--format default` output sends ANSI codes and session header to stderr; stdout is clean text. +- **Quirks:** OpenCode is multi-provider (OpenAI, Anthropic, Google, AWS Bedrock, Groq, Azure, OpenRouter). Model IDs use `provider/model` format. The `run` subcommand auto-approves all tool use in non-interactive mode. The `--format default` output sends ANSI codes and session header to stderr; stdout is clean text. The `--format json` option outputs raw JSON events for programmatic consumption. ## 3. Invocation Template | Mode | Command | |----------------|-------------------------------------------------------------------------------| -| **Validation** | `cat "$PROMPT_FILE" \| opencode run -m --format default 2>/dev/null` | +| **Validation** | `cat "$PROMPT_FILE" \| opencode run -m --format json 2>/dev/null` | | **Delegation** | `cat "$PROMPT_FILE" \| opencode run -m --format default 2>/dev/null` | -Note: Both modes use the same command because OpenCode auto-approves all actions in non-interactive `run` mode. Prompt is piped via stdin. OpenCode does not expose an internal `--timeout` flag; enforce the 120-second limit per `references/shared-procedure.md` Step 6 (kill the process if it does not exit). Stderr is suppressed (`2>/dev/null`) to remove ANSI codes and session header from output. +Note: Validation mode uses `--format json` to get structured output for parsing, while Delegation mode uses `--format default` for human-readable output. Both modes use the `run` subcommand because OpenCode auto-approves all actions in non-interactive mode. Prompt is piped via stdin. OpenCode does not expose an internal `--timeout` flag; enforce the 120-second limit per `references/shared-procedure.md` Step 6 (kill the process if it does not exit). Stderr is suppressed (`2>/dev/null`) to remove ANSI codes and session header from output. ## 4. Version Compatibility Matrix | Version | Model Flag | Run Subcommand | Format Flag | Notes | |---------|--------------------|----------------|--------------------------|--------------------------------| | 1.3.10 | `-m` / `--model` | `run` | `--format default\|json` | Verified; stdin piping works | +| 1.17.8 | `-m` / `--model` | `run` | `--format default\|json` | Current version; full feature set available |