)
}
diff --git a/packages/web/src/components/share/copy-button.module.css b/packages/web/src/components/share/copy-button.module.css
index 9da67a1ba..31013fc08 100644
--- a/packages/web/src/components/share/copy-button.module.css
+++ b/packages/web/src/components/share/copy-button.module.css
@@ -9,7 +9,6 @@
background: none;
border: none;
padding: 0.125rem;
- background-color: var(--sl-color-bg);
color: var(--sl-color-text-secondary);
svg {
diff --git a/packages/web/src/components/share/part.module.css b/packages/web/src/components/share/part.module.css
index 85c3cc9b9..45310a0b2 100644
--- a/packages/web/src/components/share/part.module.css
+++ b/packages/web/src/components/share/part.module.css
@@ -126,6 +126,12 @@
gap: 1rem;
flex-grow: 1;
max-width: var(--md-tool-width);
+ position: relative;
+
+ [data-component="copy-button"] {
+ top: 0.5rem;
+ right: calc(0.5rem - 1px);
+ }
}
[data-component="assistant-reasoning"] {
diff --git a/packages/web/src/content/docs/docs/agents.mdx b/packages/web/src/content/docs/docs/agents.mdx
index 51d835a6d..1527a1b08 100644
--- a/packages/web/src/content/docs/docs/agents.mdx
+++ b/packages/web/src/content/docs/docs/agents.mdx
@@ -58,12 +58,11 @@ Build is the **default** primary agent with all tools enabled. This is the stand
_Mode_: `primary`
-A restricted agent designed for planning and analysis. In the plan agent, the following tools are disabled by default:
+A restricted agent designed for planning and analysis. We use a permission system to give you more control and prevent unintended changes.
+By default, all of the following are set to `ask`:
-- `write` - Cannot create new files
-- `edit` - Cannot modify existing files
-- `patch` - Cannot apply patches
-- `bash` - Cannot execute shell commands
+- `file edits`: All writes, patches, and edits
+- `bash`: All bash commands
This agent is useful when you want the LLM to analyze code, suggest changes, or create plans without making any actual modifications to your codebase.
diff --git a/packages/web/src/content/docs/docs/commands.mdx b/packages/web/src/content/docs/docs/commands.mdx
index 3869ea8a4..59c9536ac 100644
--- a/packages/web/src/content/docs/docs/commands.mdx
+++ b/packages/web/src/content/docs/docs/commands.mdx
@@ -3,7 +3,13 @@ title: Commands
description: Create custom commands for repetitive tasks.
---
-Define custom commands to automate repetitive coding tasks.
+Custom commands let you specify a prompt you want to run when that command is executed in the TUI.
+
+```bash frame="none"
+/my-command
+```
+
+Custom commands are in addition to the built-in commands like `/init`, `/undo`, `/redo`, `/share`, `/help`. [Learn more](/docs/tui#commands).
---
@@ -34,12 +40,78 @@ Use the command by typing `/` followed by the command name.
---
-## Use arguments
+## Configure
+
+You can add custom commands through the opencode config or by creating markdown files in the `command/` directory.
+
+---
+
+### JSON
+
+Use the `command` option in your opencode [config](/docs/config):
+
+```json title="opencode.jsonc" {4-12}
+{
+ "$schema": "https://opencode.ai/config.json",
+ "command": {
+ // This becomes the name of the command
+ "test": {
+ // This is the prompt that will be sent to the LLM
+ "template": "Run the full test suite with coverage report and show any failures.\nFocus on the failing tests and suggest fixes.",
+ // This is show as the description in the TUI
+ "description": "Run tests with coverage",
+ "agent": "build",
+ "model": "anthropic/claude-3-5-sonnet-20241022"
+ },
+ }
+}
+```
+
+Now you can run this command in the TUI:
+
+```bash frame="none"
+/test
+```
+
+---
+
+### Markdown
+
+You can also define commands using markdown files. Place them in:
+
+- Global: `~/.config/opencode/command/`
+- Per-project: `.opencode/command/`
+
+```markdown title="~/.config/opencode/command/test.md"
+---
+description: Run tests with coverage
+agent: build
+model: anthropic/claude-3-5-sonnet-20241022
+---
+
+Run the full test suite with coverage report and show any failures.
+Focus on the failing tests and suggest fixes.
+```
+
+The markdown file name becomes the command name. For example, `test.md` lets
+you run:
+
+```bash frame="none"
+/test
+```
+
+---
+
+## Prompt config
+
+The prompts for the custom commands support several special placeholders and syntax.
+
+---
+
+### Arguments
Pass arguments to commands using the `$ARGUMENTS` placeholder.
-Create `.opencode/command/component.md`:
-
```md title=".opencode/command/component.md"
---
description: Create a new component
@@ -52,16 +124,18 @@ Include proper typing and basic structure.
Run the command with arguments:
```bash frame="none"
-"/component Button"
+/component Button
```
+And `$ARGUMENTS` will be replaced with `Button`.
+
---
-## Inject shell output
+### Shell output
-Use `!command` to inject shell command output into your prompt.
+Use _!`command`_ to inject [bash command](/docs/tui#bash-commands) output into your prompt.
-Create `.opencode/command/analyze-coverage.md`:
+For example, to create a custom command that analyzes test coverage:
```md title=".opencode/command/analyze-coverage.md"
---
@@ -69,12 +143,12 @@ description: Analyze test coverage
---
Here are the current test results:
-`!npm test`
+!`npm test`
Based on these results, suggest improvements to increase coverage.
```
-Create `.opencode/command/review-changes.md`:
+Or to review recent changes:
```md title=".opencode/command/review-changes.md"
---
@@ -82,7 +156,7 @@ description: Review recent changes
---
Recent git commits:
-`!git log --oneline -10`
+!`git log --oneline -10`
Review these changes and suggest any improvements.
```
@@ -91,12 +165,10 @@ Commands run in your project's root directory and their output becomes part of t
---
-## Reference files
+### File references
Include files in your command using `@` followed by the filename.
-Create `.opencode/command/review-component.md`:
-
```md title=".opencode/command/review-component.md"
---
description: Review component
@@ -110,47 +182,90 @@ The file content gets included in the prompt automatically.
---
-## Command properties
+## Options
-Configure commands with these optional frontmatter properties:
+Let's look at the configuration options in detail.
-- **description**: Brief explanation of what the command does
-- **agent**: Agent to use (defaults to "build")
-- **model**: Specific model to use for this command
-
-Create `.opencode/command/code-review.md`:
-
-```md title=".opencode/command/code-review.md"
----
-description: Code review assistant
-agent: build
-model: anthropic/claude-3-5-sonnet-20241022
---
-Review the code for best practices and suggest improvements.
+### Template
+
+The `template` option defines the prompt that will be sent to the LLM when the command is executed.
+
+```json title="opencode.json"
+{
+ "command": {
+ "test": {
+ "template": "Run the full test suite with coverage report and show any failures.\nFocus on the failing tests and suggest fixes."
+ }
+ }
+}
```
----
-
-## Command directory
-
-Store command files in these locations:
-
-- `.opencode/command/` - Project-specific commands
-- `command/` - Global commands in config directory
-
-Project commands take precedence over global ones.
+This is a **required** config option.
---
-## Built-in commands
+### Description
-opencode includes several built-in commands:
+Use the `description` option to provide a brief description of what the command does.
-- `/init` - Initialize project and create AGENTS.md
-- `/undo` - Revert the last changes
-- `/redo` - Restore reverted changes
-- `/share` - Share the current conversation
-- `/help` - Show available commands and keybinds
+```json title="opencode.json"
+{
+ "command": {
+ "test": {
+ "description": "Run tests with coverage"
+ }
+ }
+}
+```
-Use `/help` to see all available commands in your setup.
+This is shown as the description in the TUI when you type in the command.
+
+---
+
+### Agent
+
+Use the `agent` config to optionally specify which [agent](/docs/agents) should execute this command.
+
+```json title="opencode.json"
+{
+ "command": {
+ "review": {
+ "agent": "plan"
+ }
+ }
+}
+```
+
+This is an **optional** config option. If not specified, defaults to "build".
+
+---
+
+### Model
+
+Use the `model` config to override the default model for this command.
+
+```json title="opencode.json"
+{
+ "command": {
+ "analyze": {
+ "model": "anthropic/claude-3-5-sonnet-20241022"
+ }
+ }
+}
+```
+
+This is an **optional** config option.
+
+---
+
+## Built-in
+
+opencode includes several built-in commands like `/init`, `/undo`, `/redo`, `/share`, `/help`; [learn more](/docs/tui#commands).
+
+:::note
+Custom commands can override built-in commands.
+:::
+
+If you define a custom command with the same name, it will override the built-in command.
diff --git a/packages/web/src/content/docs/docs/config.mdx b/packages/web/src/content/docs/docs/config.mdx
index 06eb6ee7d..045bc596c 100644
--- a/packages/web/src/content/docs/docs/config.mdx
+++ b/packages/web/src/content/docs/docs/config.mdx
@@ -152,6 +152,32 @@ By default, sharing is set to manual mode where you need to explicitly share con
---
+### Commands
+
+You can configure custom commands for repetitive tasks through the `command` option.
+
+```jsonc title="opencode.jsonc"
+{
+ "$schema": "https://opencode.ai/config.json",
+ "command": {
+ "test": {
+ "template": "Run the full test suite with coverage report and show any failures.\nFocus on the failing tests and suggest fixes.",
+ "description": "Run tests with coverage",
+ "agent": "build",
+ "model": "anthropic/claude-3-5-sonnet-20241022"
+ },
+ "component": {
+ "template": "Create a new React component named $ARGUMENTS with TypeScript support.\nInclude proper typing and basic structure.",
+ "description": "Create a new component"
+ }
+ }
+}
+```
+
+You can also define commands using markdown files in `~/.config/opencode/command/` or `.opencode/command/`. [Learn more here](/docs/commands).
+
+---
+
### Keybinds
You can customize your keybinds through the `keybinds` option.
@@ -220,6 +246,11 @@ You can configure permissions to control what AI agents can do in your codebase
}
```
+This allows you to configure explicit approval requirements for sensitive operations:
+
+- `edit` - Controls whether file editing operations require user approval (`"ask"` or `"allow"`)
+- `bash` - Controls whether bash commands require user approval (can be `"ask"`/`"allow"` or a pattern map)
+
[Learn more about permissions here](/docs/permissions).
---
@@ -259,13 +290,6 @@ about rules here](/docs/rules).
You can disable providers that are loaded automatically through the `disabled_providers` option. This is useful when you want to prevent certain providers from being loaded even if their credentials are available.
-The `disabled_providers` option accepts an array of provider IDs. When a provider is disabled:
-
-- It won't be loaded even if environment variables are set
-- It won't be loaded even if API keys are configured through `opencode auth login`
-- The provider's models won't appear in the model selection list
-
-
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
@@ -273,12 +297,11 @@ The `disabled_providers` option accepts an array of provider IDs. When a provide
}
```
-The permissions system allows you to configure explicit approval requirements for sensitive operations:
+The `disabled_providers` option accepts an array of provider IDs. When a provider is disabled:
-- `edit` - Controls whether file editing operations require user approval (`"ask"` or `"allow"`)
-- `bash` - Controls whether bash commands require user approval (can be `"ask"`/`"allow"` or a pattern map)
-
-[Learn more about permissions here](/docs/permissions).
+- It won't be loaded even if environment variables are set.
+- It won't be loaded even if API keys are configured through `opencode auth login`.
+- The provider's models won't appear in the model selection list.
---
diff --git a/packages/web/src/content/docs/docs/enterprise.mdx b/packages/web/src/content/docs/docs/enterprise.mdx
index d73d1d3a4..ad6b47f92 100644
--- a/packages/web/src/content/docs/docs/enterprise.mdx
+++ b/packages/web/src/content/docs/docs/enterprise.mdx
@@ -9,7 +9,7 @@ you to use opencode at your organization.
To get started, we recommend:
1. Do a trial internally with your team.
-2. [**Contact us**](mailto:hello@sst.dev) to discuss pricing and implementation options.
+2. [**Contact us**](mailto:hello@anoma.ly) to discuss pricing and implementation options.
---
@@ -55,7 +55,7 @@ We recommend you disable this for your trial.
## Deployment
Once you have completed your trial and you are ready to self-host opencode at
-your organization, you can [**contact us**](mailto:hello@sst.dev) to discuss
+your organization, you can [**contact us**](mailto:hello@anoma.ly) to discuss
pricing and implementation options.
---
diff --git a/packages/web/src/content/docs/docs/lsp.mdx b/packages/web/src/content/docs/docs/lsp.mdx
index d674cc70d..6a661521c 100644
--- a/packages/web/src/content/docs/docs/lsp.mdx
+++ b/packages/web/src/content/docs/docs/lsp.mdx
@@ -11,19 +11,26 @@ opencode integrates with your Language Server Protocol (LSP) to help the LLM int
opencode comes with several built-in LSP servers for popular languages:
-| LSP Server | Extensions | Requirements |
-| ---------- | -------------------------------------------- | ----------------------------------- |
-| typescript | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts | `typescript` dependency in project |
-| eslint | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts | `eslint` dependency in project |
-| gopls | .go | `go` command available |
-| ruby-lsp | .rb, .rake, .gemspec, .ru | `ruby` and `gem` commands available |
-| pyright | .py, .pyi | `pyright` dependency installed |
-| elixir-ls | .ex, .exs | `elixir` command available |
-| zls | .zig, .zon | `zig` command available |
-| csharp | .cs | `.NET SDK` installed |
+| LSP Server | Extensions | Requirements |
+| ---------- | ---------------------------------------------------- | ----------------------------------- |
+| typescript | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts | `typescript` dependency in project |
+| eslint | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts, .vue | `eslint` dependency in project |
+| gopls | .go | `go` command available |
+| ruby-lsp | .rb, .rake, .gemspec, .ru | `ruby` and `gem` commands available |
+| pyright | .py, .pyi | `pyright` dependency installed |
+| elixir-ls | .ex, .exs | `elixir` command available |
+| zls | .zig, .zon | `zig` command available |
+| csharp | .cs | `.NET SDK` installed |
+| vue | .vue | Auto-installs for Vue projects |
+| rust | .rs | `rust-analyzer` command available |
+| clangd | .c, .cpp, .cc, .cxx, .c++, .h, .hpp, .hh, .hxx, .h++ | Auto-installs for C/C++ projects |
LSP servers are automatically enabled when one of the above file extensions are detected and the requirements are met.
+:::note
+You can disable automatic LSP server downloads by setting the `OPENCODE_DISABLE_LSP_DOWNLOAD` environment variable to `true`.
+:::
+
---
## How It Works
diff --git a/packages/web/src/content/docs/docs/mcp-servers.mdx b/packages/web/src/content/docs/docs/mcp-servers.mdx
index 861efc6cd..0ceeb47a3 100644
--- a/packages/web/src/content/docs/docs/mcp-servers.mdx
+++ b/packages/web/src/content/docs/docs/mcp-servers.mdx
@@ -91,3 +91,38 @@ Local and remote servers can be used together within the same `mcp` config objec
}
}
}
+```
+
+---
+
+## Per agent
+
+If you have a large number of MCP servers you may want to only enable them per
+agent and disable them globally. To do this:
+
+1. Configure the MCP server.
+2. Disable it as a tool globally.
+3. In your [agent config](/docs/agents#tools) enable the MCP server as a tool.
+
+```json title="opencode.json" {11, 14-17}
+{
+ "$schema": "https://opencode.ai/config.json",
+ "mcp": {
+ "my-mcp": {
+ "type": "local",
+ "command": ["bun", "x", "my-mcp-command"],
+ "enabled": true
+ }
+ },
+ "tools": {
+ "my-mcp*": false
+ },
+ "agent": {
+ "my-agent": {
+ "tools": {
+ "my-mcp*": true
+ }
+ }
+ }
+}
+```
diff --git a/packages/web/src/content/docs/docs/models.mdx b/packages/web/src/content/docs/docs/models.mdx
index e06ab0eab..efebc5cb4 100644
--- a/packages/web/src/content/docs/docs/models.mdx
+++ b/packages/web/src/content/docs/docs/models.mdx
@@ -68,7 +68,7 @@ If you've configured a [custom provider](/docs/providers#custom), the `provider_
You can globally configure a model's options through the config.
-```jsonc title="opencode.jsonc" {7-11}
+```jsonc title="opencode.jsonc" {7-12,19-24}
{
"$schema": "https://opencode.ai/config.json",
"provider": {
@@ -79,16 +79,28 @@ You can globally configure a model's options through the config.
"reasoningEffort": "high",
"textVerbosity": "low",
"reasoningSummary": "auto",
- "include": ["reasoning.encrypted_content"]
- }
- }
- }
- }
- }
+ "include": ["reasoning.encrypted_content"],
+ },
+ },
+ },
+ },
+ "anthropic": {
+ "models": {
+ "claude-sonnet-4-20250514": {
+ "options": {
+ "thinking": {
+ "type": "enabled",
+ "budgetTokens": 16000,
+ },
+ },
+ },
+ },
+ },
+ },
}
```
-Here we are setting global options for the `gpt-5` model when used through the `openai` provider.
+Here we're configuring global settings for two models: `gpt-5` when accessed via the `openai` provider, and `claude-sonnet-4-20250514` when accessed via the `anthropic` provider.
You can also configure these options for any agents that you are using. The agent config overrides any global options here. [Learn more](/docs/agents/#additional).
diff --git a/packages/web/src/content/docs/docs/providers.mdx b/packages/web/src/content/docs/docs/providers.mdx
index 9d7b808c8..de1cf8b39 100644
--- a/packages/web/src/content/docs/docs/providers.mdx
+++ b/packages/web/src/content/docs/docs/providers.mdx
@@ -759,6 +759,23 @@ In this example:
---
+### xAI
+
+For a limited time, you can use xAI's Grok Code for free with opencode.
+
+:::tip
+Grok Code is available for free for a limited time on opencode.
+:::
+
+1. Make sure you are on the latest version of opencode.
+
+2. Run the `/models` command and select **Grok Code Free**.
+
+As a part of the trial period, the xAI team will be using the request logs to
+monitor and improve Grok Code.
+
+---
+
### Z.AI
1. Head over to the [Z.AI API console](https://z.ai/manage-apikey/apikey-list), create an account, and click **Create a new API key**.
diff --git a/packages/web/src/content/docs/docs/sdk.mdx b/packages/web/src/content/docs/docs/sdk.mdx
index 6002d135a..3b4353d82 100644
--- a/packages/web/src/content/docs/docs/sdk.mdx
+++ b/packages/web/src/content/docs/docs/sdk.mdx
@@ -50,7 +50,7 @@ const client = createOpencodeClient({
You can also programmatically start an opencode server:
-````javascript
+```javascript
import { createOpencodeServer } from "@opencode-ai/sdk"
const server = await createOpencodeServer({
@@ -61,7 +61,7 @@ const server = await createOpencodeServer({
console.log(`Server running at ${server.url}`)
server.close()
-}
+```
#### Options
@@ -307,8 +307,8 @@ await client.auth.set({
```javascript
// Listen to real-time events
-const eventStream = await client.event.subscribe()
-for await (const event of eventStream) {
+const events = await client.event.subscribe()
+for await (const event of events.stream) {
console.log("Event:", event.type, event.properties)
}
```
diff --git a/packages/web/src/content/docs/docs/tui.mdx b/packages/web/src/content/docs/docs/tui.mdx
index e6ad10162..113bad697 100644
--- a/packages/web/src/content/docs/docs/tui.mdx
+++ b/packages/web/src/content/docs/docs/tui.mdx
@@ -25,6 +25,12 @@ Once you're in the TUI, you can prompt it with a message.
Give me a quick summary of the codebase.
```
+---
+
+## File references
+
+You can reference files in your messages using `@`. This does a fuzzy file search in the current working directory.
+
:::tip
You can also use `@` to reference files in your messages.
:::
@@ -33,6 +39,20 @@ You can also use `@` to reference files in your messages.
How is auth handled in @packages/functions/src/api/index.ts?
```
+The content of the file is added to the conversation automatically.
+
+---
+
+## Bash commands
+
+Start a message with `!` to run a shell command.
+
+```bash frame="none"
+!ls -la
+```
+
+The output of the command is added to the conversation as a tool result.
+
---
## Commands
@@ -235,18 +255,6 @@ Unshare current session. [Learn more](/docs/share#un-sharing).
---
-## Bash commands
-
-Start a message with `!` to run a shell command.
-
-```bash frame="none"
-!ls -la
-```
-
-The output of the command is added to the conversation as a tool result.
-
----
-
## Editor setup
Both the `/editor` and `/export` commands use the editor specified in your `EDITOR` environment variable.
@@ -254,37 +262,54 @@ Both the `/editor` and `/export` commands use the editor specified in your `EDIT
```bash
- export EDITOR=nano # or vim, code, etc.
+ # Example for nano or vim
+ export EDITOR=nano
+ export EDITOR=vim
+
+ # For GUI editors (VS Code, Cursor, VSCodium, Windsurf, Zed, etc.) include --wait
+ export EDITOR="code --wait"
```
To make it permanent, add this to your shell profile;
`~/.bashrc`, `~/.zshrc`, etc.
-
+
```bash
- set EDITOR=notepad # or code, vim, etc.
+ set EDITOR=notepad
+
+ # For GUI editors (VS Code, Cursor, VSCodium, Windsurf, Zed, etc.) include --wait
+ set EDITOR=code --wait
```
To make it permanent, use **System Properties** > **Environment
Variables**.
-
+
- ```bash
- $env:EDITOR = "notepad" # or "code", "vim", etc.
+ ```powershell
+ $env:EDITOR = "notepad"
+
+ # For GUI editors (VS Code, Cursor, VSCodium, Windsurf, Zed, etc.) include --wait
+ $env:EDITOR = "code --wait"
```
- To make it permanent, add this to your PowerShell
- profile.
-
+ To make it permanent, add this to your PowerShell profile.
Popular editor options include:
- `code` - Visual Studio Code
+- `cursor` - Cursor
+- `windsurf` - Windsurf
- `vim` - Vim editor
- `nano` - Nano editor
- `notepad` - Windows Notepad
- `subl` - Sublime Text
+
+:::note
+Some editors like VS Code need to be started with the `--wait` flag.
+:::
+
+Some editors need command-line arguments to run in blocking mode. The `--wait` flag makes the editor process block until closed.
diff --git a/sdks/vscode/package.json b/sdks/vscode/package.json
index e69839c88..636f3f4d0 100644
--- a/sdks/vscode/package.json
+++ b/sdks/vscode/package.json
@@ -2,7 +2,7 @@
"name": "opencode",
"displayName": "opencode",
"description": "opencode for VS Code",
- "version": "0.5.18",
+ "version": "0.5.29",
"publisher": "sst-dev",
"repository": {
"type": "git",
diff --git a/sst-env.d.ts b/sst-env.d.ts
index 358891fdf..8725b4568 100644
--- a/sst-env.d.ts
+++ b/sst-env.d.ts
@@ -25,8 +25,13 @@ declare module "sst" {
"type": "sst.cloudflare.Kv"
}
"Bucket": {
+ "name": string
"type": "sst.cloudflare.Bucket"
}
+ "Console": {
+ "type": "sst.cloudflare.SolidStart"
+ "url": string
+ }
"DATABASE_PASSWORD": {
"type": "sst.sst.Secret"
"value": string