Merge branch 'dev' into dev
|
|
@ -32,6 +32,34 @@ export default defineConfig({
|
|||
solidJs(),
|
||||
starlight({
|
||||
title: "OpenCode",
|
||||
favicon: "/favicon-v2.svg",
|
||||
head: [
|
||||
{
|
||||
tag: "link",
|
||||
attrs: {
|
||||
rel: "icon",
|
||||
href: "/favicon-v2.ico",
|
||||
sizes: "32x32",
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: "link",
|
||||
attrs: {
|
||||
rel: "icon",
|
||||
type: "image/png",
|
||||
href: "/favicon-96x96-v2.png",
|
||||
sizes: "96x96",
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: "link",
|
||||
attrs: {
|
||||
rel: "apple-touch-icon",
|
||||
href: "/apple-touch-icon-v2.png",
|
||||
sizes: "180x180",
|
||||
},
|
||||
},
|
||||
],
|
||||
lastUpdated: true,
|
||||
expressiveCode: { themes: ["github-light", "github-dark"] },
|
||||
social: [
|
||||
|
|
@ -60,7 +88,7 @@ export default defineConfig({
|
|||
"1-0",
|
||||
{
|
||||
label: "Usage",
|
||||
items: ["tui", "cli", "ide", "zen", "share", "github", "gitlab"],
|
||||
items: ["tui", "cli", "web", "ide", "zen", "share", "github", "gitlab"],
|
||||
},
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "@opencode-ai/web",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "1.1.15",
|
||||
"version": "1.1.26",
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"dev:remote": "VITE_API_URL=https://api.opencode.ai astro dev",
|
||||
|
|
|
|||
1
packages/web/public/apple-touch-icon-v2.png
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../ui/src/assets/favicon/apple-touch-icon-v2.png
|
||||
1
packages/web/public/favicon-96x96-v2.png
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../ui/src/assets/favicon/favicon-96x96-v2.png
|
||||
1
packages/web/public/favicon-v2.ico
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../ui/src/assets/favicon/favicon-v2.ico
|
||||
1
packages/web/public/favicon-v2.svg
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../ui/src/assets/favicon/favicon-v2.svg
|
||||
|
Before Width: | Height: | Size: 456 KiB After Width: | Height: | Size: 360 KiB |
|
Before Width: | Height: | Size: 592 KiB After Width: | Height: | Size: 460 KiB |
BIN
packages/web/src/assets/web/web-homepage-active-session.png
Normal file
|
After Width: | Height: | Size: 730 KiB |
BIN
packages/web/src/assets/web/web-homepage-new-session.png
Normal file
|
After Width: | Height: | Size: 609 KiB |
BIN
packages/web/src/assets/web/web-homepage-see-servers.png
Normal file
|
After Width: | Height: | Size: 664 KiB |
|
|
@ -125,7 +125,7 @@ To use OpenCode as an ACP agent in [CodeCompanion.nvim](https://github.com/olimo
|
|||
|
||||
```lua
|
||||
require("codecompanion").setup({
|
||||
strategies = {
|
||||
interactions = {
|
||||
chat = {
|
||||
adapter = {
|
||||
name = "opencode",
|
||||
|
|
@ -138,7 +138,7 @@ require("codecompanion").setup({
|
|||
|
||||
This config sets up CodeCompanion to use OpenCode as the ACP agent for chat.
|
||||
|
||||
If you need to pass environment variables (like `OPENCODE_API_KEY`), refer to [Configuring Adapters: Environment Variables](https://codecompanion.olimorris.dev/configuration/adapters#environment-variables-setting-an-api-key) in the CodeCompanion.nvim documentation for full details.
|
||||
If you need to pass environment variables (like `OPENCODE_API_KEY`), refer to [Configuring Adapters: Environment Variables](https://codecompanion.olimorris.dev/getting-started#setting-an-api-key) in the CodeCompanion.nvim documentation for full details.
|
||||
|
||||
## Support
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ There are two types of agents in OpenCode; primary agents and subagents.
|
|||
|
||||
### Primary agents
|
||||
|
||||
Primary agents are the main assistants you interact with directly. You can cycle through them using the **Tab** key, or your configured `switch_agent` keybind. These agents handle your main conversation and can access all configured tools.
|
||||
Primary agents are the main assistants you interact with directly. You can cycle through them using the **Tab** key, or your configured `switch_agent` keybind. These agents handle your main conversation. Tool access is configured via permissions — for example, Build has all tools enabled while Plan is restricted.
|
||||
|
||||
:::tip
|
||||
You can use the **Tab** key to switch between primary agents during a session.
|
||||
|
|
@ -72,7 +72,7 @@ This agent is useful when you want the LLM to analyze code, suggest changes, or
|
|||
|
||||
_Mode_: `subagent`
|
||||
|
||||
A general-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. Use when searching for keywords or files and you're not confident you'll find the right match in the first few tries.
|
||||
A general-purpose agent for researching complex questions and executing multi-step tasks. Has full tool access (except todo), so it can make file changes when needed. Use this to run multiple units of work in parallel.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ A general-purpose agent for researching complex questions, searching for code, a
|
|||
|
||||
_Mode_: `subagent`
|
||||
|
||||
A fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns, search code for keywords, or answer questions about the codebase.
|
||||
A fast, read-only agent for exploring codebases. Cannot modify files. Use this when you need to quickly find files by patterns, search code for keywords, or answer questions about the codebase.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -157,10 +157,10 @@ Configure agents in your `opencode.json` config file:
|
|||
|
||||
You can also define agents using markdown files. Place them in:
|
||||
|
||||
- Global: `~/.config/opencode/agent/`
|
||||
- Per-project: `.opencode/agent/`
|
||||
- Global: `~/.config/opencode/agents/`
|
||||
- Per-project: `.opencode/agents/`
|
||||
|
||||
```markdown title="~/.config/opencode/agent/review.md"
|
||||
```markdown title="~/.config/opencode/agents/review.md"
|
||||
---
|
||||
description: Reviews code for quality and best practices
|
||||
mode: subagent
|
||||
|
|
@ -419,7 +419,7 @@ You can override these permissions per agent.
|
|||
|
||||
You can also set permissions in Markdown agents.
|
||||
|
||||
```markdown title="~/.config/opencode/agent/review.md"
|
||||
```markdown title="~/.config/opencode/agents/review.md"
|
||||
---
|
||||
description: Code review without edits
|
||||
mode: subagent
|
||||
|
|
@ -429,6 +429,7 @@ permission:
|
|||
"*": ask
|
||||
"git diff": allow
|
||||
"git log*": allow
|
||||
"grep *": allow
|
||||
webfetch: deny
|
||||
---
|
||||
|
||||
|
|
@ -444,7 +445,8 @@ You can set permissions for specific bash commands.
|
|||
"build": {
|
||||
"permission": {
|
||||
"bash": {
|
||||
"git push": "ask"
|
||||
"git push": "ask",
|
||||
"grep *": "allow"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -480,7 +482,7 @@ Since the last matching rule takes precedence, put the `*` wildcard first and sp
|
|||
"permission": {
|
||||
"bash": {
|
||||
"*": "ask",
|
||||
"git status": "allow"
|
||||
"git status *": "allow"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -625,7 +627,7 @@ Here are some common use cases for different agents.
|
|||
|
||||
## Examples
|
||||
|
||||
Here are some examples agents you might find useful.
|
||||
Here are some example agents you might find useful.
|
||||
|
||||
:::tip
|
||||
Do you have an agent you'd like to share? [Submit a PR](https://github.com/anomalyco/opencode).
|
||||
|
|
@ -635,7 +637,7 @@ Do you have an agent you'd like to share? [Submit a PR](https://github.com/anoma
|
|||
|
||||
### Documentation agent
|
||||
|
||||
```markdown title="~/.config/opencode/agent/docs-writer.md"
|
||||
```markdown title="~/.config/opencode/agents/docs-writer.md"
|
||||
---
|
||||
description: Writes and maintains project documentation
|
||||
mode: subagent
|
||||
|
|
@ -657,7 +659,7 @@ Focus on:
|
|||
|
||||
### Security auditor
|
||||
|
||||
```markdown title="~/.config/opencode/agent/security-auditor.md"
|
||||
```markdown title="~/.config/opencode/agents/security-auditor.md"
|
||||
---
|
||||
description: Performs security audits and identifies vulnerabilities
|
||||
mode: subagent
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ Custom commands are in addition to the built-in commands like `/init`, `/undo`,
|
|||
|
||||
## Create command files
|
||||
|
||||
Create markdown files in the `command/` directory to define custom commands.
|
||||
Create markdown files in the `commands/` directory to define custom commands.
|
||||
|
||||
Create `.opencode/command/test.md`:
|
||||
Create `.opencode/commands/test.md`:
|
||||
|
||||
```md title=".opencode/command/test.md"
|
||||
```md title=".opencode/commands/test.md"
|
||||
---
|
||||
description: Run tests with coverage
|
||||
agent: build
|
||||
|
|
@ -42,7 +42,7 @@ Use the command by typing `/` followed by the command name.
|
|||
|
||||
## Configure
|
||||
|
||||
You can add custom commands through the OpenCode config or by creating markdown files in the `command/` directory.
|
||||
You can add custom commands through the OpenCode config or by creating markdown files in the `commands/` directory.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ Use the `command` option in your OpenCode [config](/docs/config):
|
|||
"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
|
||||
// This is shown as the description in the TUI
|
||||
"description": "Run tests with coverage",
|
||||
"agent": "build",
|
||||
"model": "anthropic/claude-3-5-sonnet-20241022"
|
||||
|
|
@ -79,10 +79,10 @@ Now you can run this command in the TUI:
|
|||
|
||||
You can also define commands using markdown files. Place them in:
|
||||
|
||||
- Global: `~/.config/opencode/command/`
|
||||
- Per-project: `.opencode/command/`
|
||||
- Global: `~/.config/opencode/commands/`
|
||||
- Per-project: `.opencode/commands/`
|
||||
|
||||
```markdown title="~/.config/opencode/command/test.md"
|
||||
```markdown title="~/.config/opencode/commands/test.md"
|
||||
---
|
||||
description: Run tests with coverage
|
||||
agent: build
|
||||
|
|
@ -112,7 +112,7 @@ The prompts for the custom commands support several special placeholders and syn
|
|||
|
||||
Pass arguments to commands using the `$ARGUMENTS` placeholder.
|
||||
|
||||
```md title=".opencode/command/component.md"
|
||||
```md title=".opencode/commands/component.md"
|
||||
---
|
||||
description: Create a new component
|
||||
---
|
||||
|
|
@ -138,7 +138,7 @@ You can also access individual arguments using positional parameters:
|
|||
|
||||
For example:
|
||||
|
||||
```md title=".opencode/command/create-file.md"
|
||||
```md title=".opencode/commands/create-file.md"
|
||||
---
|
||||
description: Create a new file with content
|
||||
---
|
||||
|
|
@ -167,7 +167,7 @@ Use _!`command`_ to inject [bash command](/docs/tui#bash-commands) output into y
|
|||
|
||||
For example, to create a custom command that analyzes test coverage:
|
||||
|
||||
```md title=".opencode/command/analyze-coverage.md"
|
||||
```md title=".opencode/commands/analyze-coverage.md"
|
||||
---
|
||||
description: Analyze test coverage
|
||||
---
|
||||
|
|
@ -180,7 +180,7 @@ Based on these results, suggest improvements to increase coverage.
|
|||
|
||||
Or to review recent changes:
|
||||
|
||||
```md title=".opencode/command/review-changes.md"
|
||||
```md title=".opencode/commands/review-changes.md"
|
||||
---
|
||||
description: Review recent changes
|
||||
---
|
||||
|
|
@ -199,7 +199,7 @@ Commands run in your project's root directory and their output becomes part of t
|
|||
|
||||
Include files in your command using `@` followed by the filename.
|
||||
|
||||
```md title=".opencode/command/review-component.md"
|
||||
```md title=".opencode/commands/review-component.md"
|
||||
---
|
||||
description: Review component
|
||||
---
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ Config sources are loaded in this order (later sources override earlier ones):
|
|||
|
||||
This means project configs can override global defaults, and global configs can override remote organizational defaults.
|
||||
|
||||
:::note
|
||||
The `.opencode` and `~/.config/opencode` directories use **plural names** for subdirectories: `agents/`, `commands/`, `modes/`, `plugins/`, `skills/`, `tools/`, and `themes/`. Singular names (e.g., `agent/`) are also supported for backwards compatibility.
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
### Remote
|
||||
|
|
@ -330,7 +334,7 @@ You can configure specialized agents for specific tasks through the `agent` opti
|
|||
}
|
||||
```
|
||||
|
||||
You can also define agents using markdown files in `~/.config/opencode/agent/` or `.opencode/agent/`. [Learn more here](/docs/agents).
|
||||
You can also define agents using markdown files in `~/.config/opencode/agents/` or `.opencode/agents/`. [Learn more here](/docs/agents).
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -394,7 +398,7 @@ You can configure custom commands for repetitive tasks through the `command` opt
|
|||
}
|
||||
```
|
||||
|
||||
You can also define commands using markdown files in `~/.config/opencode/command/` or `.opencode/command/`. [Learn more here](/docs/commands).
|
||||
You can also define commands using markdown files in `~/.config/opencode/commands/` or `.opencode/commands/`. [Learn more here](/docs/commands).
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -425,6 +429,7 @@ OpenCode will automatically download any new updates when it starts up. You can
|
|||
```
|
||||
|
||||
If you don't want updates but want to be notified when a new version is available, set `autoupdate` to `"notify"`.
|
||||
Notice that this only works if it was not installed using a package manager such as Homebrew.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -529,7 +534,7 @@ You can configure MCP servers you want to use through the `mcp` option.
|
|||
|
||||
[Plugins](/docs/plugins) extend OpenCode with custom tools, hooks, and integrations.
|
||||
|
||||
Place plugin files in `.opencode/plugin/` or `~/.config/opencode/plugin/`. You can also load plugins from npm through the `plugin` option.
|
||||
Place plugin files in `.opencode/plugins/` or `~/.config/opencode/plugins/`. You can also load plugins from npm through the `plugin` option.
|
||||
|
||||
```json title="opencode.json"
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ Tools are defined as **TypeScript** or **JavaScript** files. However, the tool d
|
|||
|
||||
They can be defined:
|
||||
|
||||
- Locally by placing them in the `.opencode/tool/` directory of your project.
|
||||
- Or globally, by placing them in `~/.config/opencode/tool/`.
|
||||
- Locally by placing them in the `.opencode/tools/` directory of your project.
|
||||
- Or globally, by placing them in `~/.config/opencode/tools/`.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ They can be defined:
|
|||
|
||||
The easiest way to create tools is using the `tool()` helper which provides type-safety and validation.
|
||||
|
||||
```ts title=".opencode/tool/database.ts" {1}
|
||||
```ts title=".opencode/tools/database.ts" {1}
|
||||
import { tool } from "@opencode-ai/plugin"
|
||||
|
||||
export default tool({
|
||||
|
|
@ -49,7 +49,7 @@ The **filename** becomes the **tool name**. The above creates a `database` tool.
|
|||
|
||||
You can also export multiple tools from a single file. Each export becomes **a separate tool** with the name **`<filename>_<exportname>`**:
|
||||
|
||||
```ts title=".opencode/tool/math.ts"
|
||||
```ts title=".opencode/tools/math.ts"
|
||||
import { tool } from "@opencode-ai/plugin"
|
||||
|
||||
export const add = tool({
|
||||
|
|
@ -112,7 +112,7 @@ export default {
|
|||
|
||||
Tools receive context about the current session:
|
||||
|
||||
```ts title=".opencode/tool/project.ts" {8}
|
||||
```ts title=".opencode/tools/project.ts" {8}
|
||||
import { tool } from "@opencode-ai/plugin"
|
||||
|
||||
export default tool({
|
||||
|
|
@ -136,7 +136,7 @@ You can write your tools in any language you want. Here's an example that adds t
|
|||
|
||||
First, create the tool as a Python script:
|
||||
|
||||
```python title=".opencode/tool/add.py"
|
||||
```python title=".opencode/tools/add.py"
|
||||
import sys
|
||||
|
||||
a = int(sys.argv[1])
|
||||
|
|
@ -146,7 +146,7 @@ print(a + b)
|
|||
|
||||
Then create the tool definition that invokes it:
|
||||
|
||||
```ts title=".opencode/tool/python-add.ts" {10}
|
||||
```ts title=".opencode/tools/python-add.ts" {10}
|
||||
import { tool } from "@opencode-ai/plugin"
|
||||
|
||||
export default tool({
|
||||
|
|
@ -156,7 +156,7 @@ export default tool({
|
|||
b: tool.schema.number().describe("Second number"),
|
||||
},
|
||||
async execute(args) {
|
||||
const result = await Bun.$`python3 .opencode/tool/add.py ${args.a} ${args.b}`.text()
|
||||
const result = await Bun.$`python3 .opencode/tools/add.py ${args.a} ${args.b}`.text()
|
||||
return result.trim()
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -47,16 +47,17 @@ You can also check out [awesome-opencode](https://github.com/awesome-opencode/aw
|
|||
|
||||
## Projects
|
||||
|
||||
| Name | Description |
|
||||
| ------------------------------------------------------------------------------------------ | --------------------------------------------------------------- |
|
||||
| [kimaki](https://github.com/remorses/kimaki) | Discord bot to control OpenCode sessions, built on the SDK |
|
||||
| [opencode.nvim](https://github.com/NickvanDyke/opencode.nvim) | Neovim plugin for editor-aware prompts, built on the API |
|
||||
| [portal](https://github.com/hosenur/portal) | Mobile-first web UI for OpenCode over Tailscale/VPN |
|
||||
| [opencode plugin template](https://github.com/zenobi-us/opencode-plugin-template/) | Template for building OpenCode plugins |
|
||||
| [opencode.nvim](https://github.com/sudo-tee/opencode.nvim) | Neovim frontend for opencode - a terminal-based AI coding agent |
|
||||
| [ai-sdk-provider-opencode-sdk](https://github.com/ben-vargas/ai-sdk-provider-opencode-sdk) | Vercel AI SDK provider for using OpenCode via @opencode-ai/sdk |
|
||||
| [OpenChamber](https://github.com/btriapitsyn/openchamber) | Web / Desktop App and VS Code Extension for OpenCode |
|
||||
| [OpenCode-Obsidian](https://github.com/mtymek/opencode-obsidian) | Obsidian plugin that embedds OpenCode in Obsidian's UI |
|
||||
| Name | Description |
|
||||
| ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
|
||||
| [kimaki](https://github.com/remorses/kimaki) | Discord bot to control OpenCode sessions, built on the SDK |
|
||||
| [opencode.nvim](https://github.com/NickvanDyke/opencode.nvim) | Neovim plugin for editor-aware prompts, built on the API |
|
||||
| [portal](https://github.com/hosenur/portal) | Mobile-first web UI for OpenCode over Tailscale/VPN |
|
||||
| [opencode plugin template](https://github.com/zenobi-us/opencode-plugin-template/) | Template for building OpenCode plugins |
|
||||
| [opencode.nvim](https://github.com/sudo-tee/opencode.nvim) | Neovim frontend for opencode - a terminal-based AI coding agent |
|
||||
| [ai-sdk-provider-opencode-sdk](https://github.com/ben-vargas/ai-sdk-provider-opencode-sdk) | Vercel AI SDK provider for using OpenCode via @opencode-ai/sdk |
|
||||
| [OpenChamber](https://github.com/btriapitsyn/openchamber) | Web / Desktop App and VS Code Extension for OpenCode |
|
||||
| [OpenCode-Obsidian](https://github.com/mtymek/opencode-obsidian) | Obsidian plugin that embedds OpenCode in Obsidian's UI |
|
||||
| [OpenWork](https://github.com/different-ai/openwork) | An open-source alternative to Claude Cowork, powered by OpenCode |
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -57,12 +57,13 @@ Or you can set it up manually.
|
|||
permissions:
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 1
|
||||
persist-credentials: false
|
||||
|
||||
- name: Run OpenCode
|
||||
- name: Run OpenCode
|
||||
uses: anomalyco/opencode/github@latest
|
||||
env:
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
|
|
@ -135,6 +136,8 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Run OpenCode
|
||||
uses: anomalyco/opencode/github@latest
|
||||
|
|
@ -172,11 +175,15 @@ jobs:
|
|||
issues: read
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: anomalyco/opencode/github@latest
|
||||
env:
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
model: anthropic/claude-sonnet-4-20250514
|
||||
use_github_token: true
|
||||
prompt: |
|
||||
Review this pull request:
|
||||
- Check for code quality issues
|
||||
|
|
@ -223,6 +230,8 @@ jobs:
|
|||
|
||||
- uses: actions/checkout@v6
|
||||
if: steps.check.outputs.result == 'true'
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: anomalyco/opencode/github@latest
|
||||
if: steps.check.outputs.result == 'true'
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ Mention `@opencode` in a comment, and OpenCode will execute tasks within your Gi
|
|||
|
||||
- **Triage issues**: Ask OpenCode to look into an issue and explain it to you.
|
||||
- **Fix and implement**: Ask OpenCode to fix an issue or implement a feature.
|
||||
It will work create a new branch and raised a merge request with the changes.
|
||||
It will create a new branch and raise a merge request with the changes.
|
||||
- **Secure**: OpenCode runs on your GitLab runners.
|
||||
|
||||
---
|
||||
|
|
|
|||
|
|
@ -98,8 +98,7 @@ You can also install it with the following commands:
|
|||
- **Using Scoop**
|
||||
|
||||
```bash
|
||||
scoop bucket add extras
|
||||
scoop install extras/opencode
|
||||
scoop install opencode
|
||||
```
|
||||
|
||||
- **Using NPM**
|
||||
|
|
|
|||
|
|
@ -31,8 +31,10 @@ OpenCode has a list of keybinds that you can customize through the OpenCode conf
|
|||
"session_child_cycle": "<leader>right",
|
||||
"session_child_cycle_reverse": "<leader>left",
|
||||
"session_parent": "<leader>up",
|
||||
"messages_page_up": "pageup",
|
||||
"messages_page_down": "pagedown",
|
||||
"messages_page_up": "pageup,ctrl+alt+b",
|
||||
"messages_page_down": "pagedown,ctrl+alt+f",
|
||||
"messages_line_up": "ctrl+alt+y",
|
||||
"messages_line_down": "ctrl+alt+e",
|
||||
"messages_half_page_up": "ctrl+alt+u",
|
||||
"messages_half_page_down": "ctrl+alt+d",
|
||||
"messages_first": "ctrl+g,home",
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ The glob pattern uses simple regex globbing patterns:
|
|||
- All other characters match literally
|
||||
|
||||
:::note
|
||||
MCP server tools are registered with server name as prefix, so to diable all tools for a server simply use:
|
||||
MCP server tools are registered with server name as prefix, so to disable all tools for a server simply use:
|
||||
|
||||
```
|
||||
"mymcpservername_*": false
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ Build is the **default** mode with all tools enabled. This is the standard mode
|
|||
A restricted mode designed for planning and analysis. In plan mode, the following tools are disabled by default:
|
||||
|
||||
- `write` - Cannot create new files
|
||||
- `edit` - Cannot modify existing files
|
||||
- `edit` - Cannot modify existing files, except for files located at `.opencode/plans/*.md` to detail the plan itself
|
||||
- `patch` - Cannot apply patches
|
||||
- `bash` - Cannot execute shell commands
|
||||
|
||||
|
|
@ -87,10 +87,10 @@ Configure modes in your `opencode.json` config file:
|
|||
|
||||
You can also define modes using markdown files. Place them in:
|
||||
|
||||
- Global: `~/.config/opencode/mode/`
|
||||
- Project: `.opencode/mode/`
|
||||
- Global: `~/.config/opencode/modes/`
|
||||
- Project: `.opencode/modes/`
|
||||
|
||||
```markdown title="~/.config/opencode/mode/review.md"
|
||||
```markdown title="~/.config/opencode/modes/review.md"
|
||||
---
|
||||
model: anthropic/claude-sonnet-4-20250514
|
||||
temperature: 0.1
|
||||
|
|
@ -268,9 +268,9 @@ You can create your own custom modes by adding them to the configuration. Here a
|
|||
|
||||
### Using markdown files
|
||||
|
||||
Create mode files in `.opencode/mode/` for project-specific modes or `~/.config/opencode/mode/` for global modes:
|
||||
Create mode files in `.opencode/modes/` for project-specific modes or `~/.config/opencode/modes/` for global modes:
|
||||
|
||||
```markdown title=".opencode/mode/debug.md"
|
||||
```markdown title=".opencode/modes/debug.md"
|
||||
---
|
||||
temperature: 0.1
|
||||
tools:
|
||||
|
|
@ -294,7 +294,7 @@ Focus on:
|
|||
Do not make any changes to files. Only investigate and report.
|
||||
```
|
||||
|
||||
```markdown title="~/.config/opencode/mode/refactor.md"
|
||||
```markdown title="~/.config/opencode/modes/refactor.md"
|
||||
---
|
||||
model: anthropic/claude-sonnet-4-20250514
|
||||
temperature: 0.2
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ For most permissions, you can use an object to apply different actions based on
|
|||
"*": "ask",
|
||||
"git *": "allow",
|
||||
"npm *": "allow",
|
||||
"rm *": "deny"
|
||||
"rm *": "deny",
|
||||
"grep *": "allow"
|
||||
},
|
||||
"edit": {
|
||||
"*": "deny",
|
||||
|
|
@ -139,13 +140,20 @@ The set of patterns that `always` would approve is provided by the tool (for exa
|
|||
|
||||
You can override permissions per agent. Agent permissions are merged with the global config, and agent rules take precedence. [Learn more](/docs/agents#permissions) about agent permissions.
|
||||
|
||||
:::note
|
||||
Refer to the [Granular Rules (Object Syntax)](#granular-rules-object-syntax) section above for more detailed pattern matching examples.
|
||||
:::
|
||||
|
||||
```json title="opencode.json"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"permission": {
|
||||
"bash": {
|
||||
"*": "ask",
|
||||
"git status": "allow"
|
||||
"git *": "allow",
|
||||
"git commit *": "deny",
|
||||
"git push *": "deny",
|
||||
"grep *": "allow"
|
||||
}
|
||||
},
|
||||
"agent": {
|
||||
|
|
@ -153,8 +161,10 @@ You can override permissions per agent. Agent permissions are merged with the gl
|
|||
"permission": {
|
||||
"bash": {
|
||||
"*": "ask",
|
||||
"git status": "allow",
|
||||
"git push": "allow"
|
||||
"git *": "allow",
|
||||
"git commit *": "ask",
|
||||
"git push *": "deny",
|
||||
"grep *": "allow"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -164,7 +174,7 @@ You can override permissions per agent. Agent permissions are merged with the gl
|
|||
|
||||
You can also configure agent permissions in Markdown:
|
||||
|
||||
```markdown title="~/.config/opencode/agent/review.md"
|
||||
```markdown title="~/.config/opencode/agents/review.md"
|
||||
---
|
||||
description: Code review without edits
|
||||
mode: subagent
|
||||
|
|
@ -176,3 +186,7 @@ permission:
|
|||
|
||||
Only analyze code and suggest changes.
|
||||
```
|
||||
|
||||
:::tip
|
||||
Use pattern matching for commands with arguments. `"grep *"` allows `grep pattern file.txt`, while `"grep"` alone would block it. Commands like `git status` work for default behavior but require explicit permission (like `"git status *"`) when arguments are passed.
|
||||
:::
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ There are two ways to load plugins.
|
|||
|
||||
Place JavaScript or TypeScript files in the plugin directory.
|
||||
|
||||
- `.opencode/plugin/` - Project-level plugins
|
||||
- `~/.config/opencode/plugin/` - Global plugins
|
||||
- `.opencode/plugins/` - Project-level plugins
|
||||
- `~/.config/opencode/plugins/` - Global plugins
|
||||
|
||||
Files in these directories are automatically loaded at startup.
|
||||
|
||||
|
|
@ -57,8 +57,8 @@ Plugins are loaded from all sources and all hooks run in sequence. The load orde
|
|||
|
||||
1. Global config (`~/.config/opencode/opencode.json`)
|
||||
2. Project config (`opencode.json`)
|
||||
3. Global plugin directory (`~/.config/opencode/plugin/`)
|
||||
4. Project plugin directory (`.opencode/plugin/`)
|
||||
3. Global plugin directory (`~/.config/opencode/plugins/`)
|
||||
4. Project plugin directory (`.opencode/plugins/`)
|
||||
|
||||
Duplicate npm packages with the same name and version are loaded once. However, a local plugin and an npm plugin with similar names are both loaded separately.
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ Local plugins and custom tools can use external npm packages. Add a `package.jso
|
|||
|
||||
OpenCode runs `bun install` at startup to install these. Your plugins and tools can then import them.
|
||||
|
||||
```ts title=".opencode/plugin/my-plugin.ts"
|
||||
```ts title=".opencode/plugins/my-plugin.ts"
|
||||
import { escape } from "shescape"
|
||||
|
||||
export const MyPlugin = async (ctx) => {
|
||||
|
|
@ -103,7 +103,7 @@ export const MyPlugin = async (ctx) => {
|
|||
|
||||
### Basic structure
|
||||
|
||||
```js title=".opencode/plugin/example.js"
|
||||
```js title=".opencode/plugins/example.js"
|
||||
export const MyPlugin = async ({ project, client, $, directory, worktree }) => {
|
||||
console.log("Plugin initialized!")
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ Here are some examples of plugins you can use to extend opencode.
|
|||
|
||||
Send notifications when certain events occur:
|
||||
|
||||
```js title=".opencode/plugin/notification.js"
|
||||
```js title=".opencode/plugins/notification.js"
|
||||
export const NotificationPlugin = async ({ project, client, $, directory, worktree }) => {
|
||||
return {
|
||||
event: async ({ event }) => {
|
||||
|
|
@ -240,7 +240,7 @@ If you’re using the OpenCode desktop app, it can send system notifications aut
|
|||
|
||||
Prevent opencode from reading `.env` files:
|
||||
|
||||
```javascript title=".opencode/plugin/env-protection.js"
|
||||
```javascript title=".opencode/plugins/env-protection.js"
|
||||
export const EnvProtection = async ({ project, client, $, directory, worktree }) => {
|
||||
return {
|
||||
"tool.execute.before": async (input, output) => {
|
||||
|
|
@ -258,7 +258,7 @@ export const EnvProtection = async ({ project, client, $, directory, worktree })
|
|||
|
||||
Plugins can also add custom tools to opencode:
|
||||
|
||||
```ts title=".opencode/plugin/custom-tools.ts"
|
||||
```ts title=".opencode/plugins/custom-tools.ts"
|
||||
import { type Plugin, tool } from "@opencode-ai/plugin"
|
||||
|
||||
export const CustomToolsPlugin: Plugin = async (ctx) => {
|
||||
|
|
@ -292,7 +292,7 @@ Your custom tools will be available to opencode alongside built-in tools.
|
|||
|
||||
Use `client.app.log()` instead of `console.log` for structured logging:
|
||||
|
||||
```ts title=".opencode/plugin/my-plugin.ts"
|
||||
```ts title=".opencode/plugins/my-plugin.ts"
|
||||
export const MyPlugin = async ({ client }) => {
|
||||
await client.app.log({
|
||||
service: "my-plugin",
|
||||
|
|
@ -311,7 +311,7 @@ Levels: `debug`, `info`, `warn`, `error`. See [SDK documentation](https://openco
|
|||
|
||||
Customize the context included when a session is compacted:
|
||||
|
||||
```ts title=".opencode/plugin/compaction.ts"
|
||||
```ts title=".opencode/plugins/compaction.ts"
|
||||
import type { Plugin } from "@opencode-ai/plugin"
|
||||
|
||||
export const CompactionPlugin: Plugin = async (ctx) => {
|
||||
|
|
@ -335,7 +335,7 @@ The `experimental.session.compacting` hook fires before the LLM generates a cont
|
|||
|
||||
You can also replace the compaction prompt entirely by setting `output.prompt`:
|
||||
|
||||
```ts title=".opencode/plugin/custom-compaction.ts"
|
||||
```ts title=".opencode/plugins/custom-compaction.ts"
|
||||
import type { Plugin } from "@opencode-ai/plugin"
|
||||
|
||||
export const CustomCompactionPlugin: Plugin = async (ctx) => {
|
||||
|
|
|
|||
|
|
@ -95,6 +95,33 @@ Don't see a provider here? Submit a PR.
|
|||
|
||||
---
|
||||
|
||||
### 302.AI
|
||||
|
||||
1. Head over to the [302.AI console](https://302.ai/), create an account, and generate an API key.
|
||||
|
||||
2. Run the `/connect` command and search for **302.AI**.
|
||||
|
||||
```txt
|
||||
/connect
|
||||
```
|
||||
|
||||
3. Enter your 302.AI API key.
|
||||
|
||||
```txt
|
||||
┌ API key
|
||||
│
|
||||
│
|
||||
└ enter
|
||||
```
|
||||
|
||||
4. Run the `/models` command to select a model.
|
||||
|
||||
```txt
|
||||
/models
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Amazon Bedrock
|
||||
|
||||
To use Amazon Bedrock with OpenCode:
|
||||
|
|
@ -184,12 +211,13 @@ To use Amazon Bedrock with OpenCode:
|
|||
- **`AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY`**: Create an IAM user and generate access keys in the AWS Console
|
||||
- **`AWS_PROFILE`**: Use named profiles from `~/.aws/credentials`. First configure with `aws configure --profile my-profile` or `aws sso login`
|
||||
- **`AWS_BEARER_TOKEN_BEDROCK`**: Generate long-term API keys from the Amazon Bedrock console
|
||||
- **`AWS_WEB_IDENTITY_TOKEN_FILE` / `AWS_ROLE_ARN`**: For EKS IRSA (IAM Roles for Service Accounts) or other Kubernetes environments with OIDC federation. These environment variables are automatically injected by Kubernetes when using service account annotations.
|
||||
|
||||
#### Authentication Precedence
|
||||
|
||||
Amazon Bedrock uses the following authentication priority:
|
||||
1. **Bearer Token** - `AWS_BEARER_TOKEN_BEDROCK` environment variable or token from `/connect` command
|
||||
2. **AWS Credential Chain** - Profile, access keys, shared credentials, IAM roles, instance metadata
|
||||
2. **AWS Credential Chain** - Profile, access keys, shared credentials, IAM roles, Web Identity Tokens (EKS IRSA), instance metadata
|
||||
|
||||
:::note
|
||||
When a bearer token is set (via `/connect` or `AWS_BEARER_TOKEN_BEDROCK`), it takes precedence over all AWS credential methods including configured profiles.
|
||||
|
|
@ -530,6 +558,33 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
|
|||
|
||||
---
|
||||
|
||||
### Firmware
|
||||
|
||||
1. Head over to the [Firmware dashboard](https://app.firmware.ai/signup), create an account, and generate an API key.
|
||||
|
||||
2. Run the `/connect` command and search for **Firmware**.
|
||||
|
||||
```txt
|
||||
/connect
|
||||
```
|
||||
|
||||
3. Enter your Firmware API key.
|
||||
|
||||
```txt
|
||||
┌ API key
|
||||
│
|
||||
│
|
||||
└ enter
|
||||
```
|
||||
|
||||
4. Run the `/models` command to select a model.
|
||||
|
||||
```txt
|
||||
/models
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Fireworks AI
|
||||
|
||||
1. Head over to the [Fireworks AI console](https://app.fireworks.ai/), create an account, and click **Create API Key**.
|
||||
|
|
@ -557,6 +612,155 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
|
|||
|
||||
---
|
||||
|
||||
### GitLab Duo
|
||||
|
||||
GitLab Duo provides AI-powered agentic chat with native tool calling capabilities through GitLab's Anthropic proxy.
|
||||
|
||||
1. Run the `/connect` command and select GitLab.
|
||||
|
||||
```txt
|
||||
/connect
|
||||
```
|
||||
|
||||
2. Choose your authentication method:
|
||||
|
||||
```txt
|
||||
┌ Select auth method
|
||||
│
|
||||
│ OAuth (Recommended)
|
||||
│ Personal Access Token
|
||||
└
|
||||
```
|
||||
|
||||
#### Using OAuth (Recommended)
|
||||
|
||||
Select **OAuth** and your browser will open for authorization.
|
||||
|
||||
#### Using Personal Access Token
|
||||
1. Go to [GitLab User Settings > Access Tokens](https://gitlab.com/-/user_settings/personal_access_tokens)
|
||||
2. Click **Add new token**
|
||||
3. Name: `OpenCode`, Scopes: `api`
|
||||
4. Copy the token (starts with `glpat-`)
|
||||
5. Enter it in the terminal
|
||||
|
||||
3. Run the `/models` command to see available models.
|
||||
|
||||
```txt
|
||||
/models
|
||||
```
|
||||
|
||||
Three Claude-based models are available:
|
||||
- **duo-chat-haiku-4-5** (Default) - Fast responses for quick tasks
|
||||
- **duo-chat-sonnet-4-5** - Balanced performance for most workflows
|
||||
- **duo-chat-opus-4-5** - Most capable for complex analysis
|
||||
|
||||
:::note
|
||||
You can also specify 'GITLAB_TOKEN' environment variable if you don't want
|
||||
to store token in opencode auth storage.
|
||||
:::
|
||||
|
||||
##### Self-Hosted GitLab
|
||||
|
||||
:::note[compliance note]
|
||||
OpenCode uses a small model for some AI tasks like generating the session title.
|
||||
It is configured to use gpt-5-nano by default, hosted by Zen. To lock OpenCode
|
||||
to only use your own GitLab-hosted instance, add the following to your
|
||||
`opencode.json` file. It is also recommended to disable session sharing.
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"small_model": "gitlab/duo-chat-haiku-4-5",
|
||||
"share": "disabled"
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
For self-hosted GitLab instances:
|
||||
|
||||
```bash
|
||||
export GITLAB_INSTANCE_URL=https://gitlab.company.com
|
||||
export GITLAB_TOKEN=glpat-...
|
||||
```
|
||||
|
||||
If your instance runs a custom AI Gateway:
|
||||
|
||||
```bash
|
||||
GITLAB_AI_GATEWAY_URL=https://ai-gateway.company.com
|
||||
```
|
||||
|
||||
Or add to your bash profile:
|
||||
|
||||
```bash title="~/.bash_profile"
|
||||
export GITLAB_INSTANCE_URL=https://gitlab.company.com
|
||||
export GITLAB_AI_GATEWAY_URL=https://ai-gateway.company.com
|
||||
export GITLAB_TOKEN=glpat-...
|
||||
```
|
||||
|
||||
:::note
|
||||
Your GitLab administrator must enable the following:
|
||||
|
||||
1. [Duo Agent Platform](https://docs.gitlab.com/user/gitlab_duo/turn_on_off/) for the user, group, or instance
|
||||
2. Feature flags (via Rails console):
|
||||
- `agent_platform_claude_code`
|
||||
- `third_party_agents_enabled`
|
||||
:::
|
||||
|
||||
##### OAuth for Self-Hosted instances
|
||||
|
||||
In order to make Oauth working for your self-hosted instance, you need to create
|
||||
a new application (Settings → Applications) with the
|
||||
callback URL `http://127.0.0.1:8080/callback` and following scopes:
|
||||
|
||||
- api (Access the API on your behalf)
|
||||
- read_user (Read your personal information)
|
||||
- read_repository (Allows read-only access to the repository)
|
||||
|
||||
Then expose application ID as environment variable:
|
||||
|
||||
```bash
|
||||
export GITLAB_OAUTH_CLIENT_ID=your_application_id_here
|
||||
```
|
||||
|
||||
More documentation on [opencode-gitlab-auth](https://www.npmjs.com/package/@gitlab/opencode-gitlab-auth) homepage.
|
||||
|
||||
##### Configuration
|
||||
|
||||
Customize through `opencode.json`:
|
||||
|
||||
```json title="opencode.json"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"provider": {
|
||||
"gitlab": {
|
||||
"options": {
|
||||
"instanceUrl": "https://gitlab.com",
|
||||
"featureFlags": {
|
||||
"duo_agent_platform_agentic_chat": true,
|
||||
"duo_agent_platform": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### GitLab API Tools (Optional, but highly recommended)
|
||||
|
||||
To access GitLab tools (merge requests, issues, pipelines, CI/CD, etc.):
|
||||
|
||||
```json title="opencode.json"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"plugin": ["@gitlab/opencode-gitlab-plugin"]
|
||||
}
|
||||
```
|
||||
|
||||
This plugin provides comprehensive GitLab repository management capabilities including MR reviews, issue tracking, pipeline monitoring, and more.
|
||||
|
||||
---
|
||||
|
||||
### GitHub Copilot
|
||||
|
||||
To use your GitHub Copilot subscription with opencode:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ title: Rules
|
|||
description: Set custom instructions for opencode.
|
||||
---
|
||||
|
||||
You can provide custom instructions to opencode by creating an `AGENTS.md` file. This is similar to `CLAUDE.md` or Cursor's rules. It contains instructions that will be included in the LLM's context to customize its behavior for your specific project.
|
||||
You can provide custom instructions to opencode by creating an `AGENTS.md` file. This is similar to Cursor's rules. It contains instructions that will be included in the LLM's context to customize its behavior for your specific project.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ opencode also supports reading the `AGENTS.md` file from multiple locations. And
|
|||
|
||||
### Project
|
||||
|
||||
The ones we have seen above, where the `AGENTS.md` is placed in the project root, are project-specific rules. These only apply when you are working in this directory or its sub-directories.
|
||||
Place an `AGENTS.md` in your project root for project-specific rules. These only apply when you are working in this directory or its sub-directories.
|
||||
|
||||
### Global
|
||||
|
||||
|
|
@ -66,16 +66,33 @@ You can also have global rules in a `~/.config/opencode/AGENTS.md` file. This ge
|
|||
|
||||
Since this isn't committed to Git or shared with your team, we recommend using this to specify any personal rules that the LLM should follow.
|
||||
|
||||
### Claude Code Compatibility
|
||||
|
||||
For users migrating from Claude Code, OpenCode supports Claude Code's file conventions as fallbacks:
|
||||
|
||||
- **Project rules**: `CLAUDE.md` in your project directory (used if no `AGENTS.md` exists)
|
||||
- **Global rules**: `~/.claude/CLAUDE.md` (used if no `~/.config/opencode/AGENTS.md` exists)
|
||||
- **Skills**: `~/.claude/skills/` — see [Agent Skills](/docs/skills/) for details
|
||||
|
||||
To disable Claude Code compatibility, set one of these environment variables:
|
||||
|
||||
```bash
|
||||
export OPENCODE_DISABLE_CLAUDE_CODE=1 # Disable all .claude support
|
||||
export OPENCODE_DISABLE_CLAUDE_CODE_PROMPT=1 # Disable only ~/.claude/CLAUDE.md
|
||||
export OPENCODE_DISABLE_CLAUDE_CODE_SKILLS=1 # Disable only .claude/skills
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Precedence
|
||||
|
||||
So when opencode starts, it looks for:
|
||||
When opencode starts, it looks for rule files in this order:
|
||||
|
||||
1. **Local files** by traversing up from the current directory
|
||||
2. **Global file** by checking `~/.config/opencode/AGENTS.md`
|
||||
1. **Local files** by traversing up from the current directory (`AGENTS.md`, `CLAUDE.md`, or `CONTEXT.md`)
|
||||
2. **Global file** at `~/.config/opencode/AGENTS.md`
|
||||
3. **Claude Code file** at `~/.claude/CLAUDE.md` (unless disabled)
|
||||
|
||||
If you have both global and project-specific rules, opencode will combine them together.
|
||||
The first matching file wins in each category. For example, if you have both `AGENTS.md` and `CLAUDE.md`, only `AGENTS.md` is used. Similarly, `~/.config/opencode/AGENTS.md` takes precedence over `~/.claude/CLAUDE.md`.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ Skills are loaded on-demand via the native `skill` tool—agents see available s
|
|||
Create one folder per skill name and put a `SKILL.md` inside it.
|
||||
OpenCode searches these locations:
|
||||
|
||||
- Project config: `.opencode/skill/<name>/SKILL.md`
|
||||
- Global config: `~/.config/opencode/skill/<name>/SKILL.md`
|
||||
- Project config: `.opencode/skills/<name>/SKILL.md`
|
||||
- Global config: `~/.config/opencode/skills/<name>/SKILL.md`
|
||||
- Project Claude-compatible: `.claude/skills/<name>/SKILL.md`
|
||||
- Global Claude-compatible: `~/.claude/skills/<name>/SKILL.md`
|
||||
|
||||
|
|
@ -23,9 +23,9 @@ OpenCode searches these locations:
|
|||
## Understand discovery
|
||||
|
||||
For project-local paths, OpenCode walks up from your current working directory until it reaches the git worktree.
|
||||
It loads any matching `skill/*/SKILL.md` in `.opencode/` and any matching `.claude/skills/*/SKILL.md` along the way.
|
||||
It loads any matching `skills/*/SKILL.md` in `.opencode/` and any matching `.claude/skills/*/SKILL.md` along the way.
|
||||
|
||||
Global definitions are also loaded from `~/.config/opencode/skill/*/SKILL.md` and `~/.claude/skills/*/SKILL.md`.
|
||||
Global definitions are also loaded from `~/.config/opencode/skills/*/SKILL.md` and `~/.claude/skills/*/SKILL.md`.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ Keep it specific enough for the agent to choose correctly.
|
|||
|
||||
## Use an example
|
||||
|
||||
Create `.opencode/skill/git-release/SKILL.md` like this:
|
||||
Create `.opencode/skills/git-release/SKILL.md` like this:
|
||||
|
||||
```markdown
|
||||
---
|
||||
|
|
|
|||
|
|
@ -242,6 +242,20 @@ List available themes.
|
|||
|
||||
---
|
||||
|
||||
### thinking
|
||||
|
||||
Toggle the visibility of thinking/reasoning blocks in the conversation. When enabled, you can see the model's reasoning process for models that support extended thinking.
|
||||
|
||||
:::note
|
||||
This command only controls whether thinking blocks are **displayed** - it does not enable or disable the model's reasoning capabilities. To toggle actual reasoning capabilities, use `ctrl+t` to cycle through model variants.
|
||||
:::
|
||||
|
||||
```bash frame="none"
|
||||
/thinking
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### undo
|
||||
|
||||
Undo last message in the conversation. Removes the most recent user message, all subsequent responses, and any file changes.
|
||||
|
|
|
|||
132
packages/web/src/content/docs/web.mdx
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
---
|
||||
title: Web
|
||||
description: Using OpenCode in your browser.
|
||||
---
|
||||
|
||||
OpenCode can run as a web application in your browser, providing the same powerful AI coding experience without needing a terminal.
|
||||
|
||||

|
||||
|
||||
## Getting Started
|
||||
|
||||
Start the web interface by running:
|
||||
|
||||
```bash
|
||||
opencode web
|
||||
```
|
||||
|
||||
This starts a local server on `127.0.0.1` with a random available port and automatically opens OpenCode in your default browser.
|
||||
|
||||
:::caution
|
||||
If `OPENCODE_SERVER_PASSWORD` is not set, the server will be unsecured. This is fine for local use but should be set for network access.
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
You can configure the web server using command line flags or in your [config file](/docs/config).
|
||||
|
||||
### Port
|
||||
|
||||
By default, OpenCode picks an available port. You can specify a port:
|
||||
|
||||
```bash
|
||||
opencode web --port 4096
|
||||
```
|
||||
|
||||
### Hostname
|
||||
|
||||
By default, the server binds to `127.0.0.1` (localhost only). To make OpenCode accessible on your network:
|
||||
|
||||
```bash
|
||||
opencode web --hostname 0.0.0.0
|
||||
```
|
||||
|
||||
When using `0.0.0.0`, OpenCode will display both local and network addresses:
|
||||
|
||||
```
|
||||
Local access: http://localhost:4096
|
||||
Network access: http://192.168.1.100:4096
|
||||
```
|
||||
|
||||
### mDNS Discovery
|
||||
|
||||
Enable mDNS to make your server discoverable on the local network:
|
||||
|
||||
```bash
|
||||
opencode web --mdns
|
||||
```
|
||||
|
||||
This automatically sets the hostname to `0.0.0.0` and advertises the server as `opencode.local`.
|
||||
|
||||
### CORS
|
||||
|
||||
To allow additional domains for CORS (useful for custom frontends):
|
||||
|
||||
```bash
|
||||
opencode web --cors https://example.com
|
||||
```
|
||||
|
||||
### Authentication
|
||||
|
||||
To protect access, set a password using the `OPENCODE_SERVER_PASSWORD` environment variable:
|
||||
|
||||
```bash
|
||||
OPENCODE_SERVER_PASSWORD=secret opencode web
|
||||
```
|
||||
|
||||
The username defaults to `opencode` but can be changed with `OPENCODE_SERVER_USERNAME`.
|
||||
|
||||
---
|
||||
|
||||
## Using the Web Interface
|
||||
|
||||
Once started, the web interface provides access to your OpenCode sessions.
|
||||
|
||||
### Sessions
|
||||
|
||||
View and manage your sessions from the homepage. You can see active sessions and start new ones.
|
||||
|
||||

|
||||
|
||||
### Server Status
|
||||
|
||||
Click "See Servers" to view connected servers and their status.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Attaching a Terminal
|
||||
|
||||
You can attach a terminal TUI to a running web server:
|
||||
|
||||
```bash
|
||||
# Start the web server
|
||||
opencode web --port 4096
|
||||
|
||||
# In another terminal, attach the TUI
|
||||
opencode attach http://localhost:4096
|
||||
```
|
||||
|
||||
This allows you to use both the web interface and terminal simultaneously, sharing the same sessions and state.
|
||||
|
||||
---
|
||||
|
||||
## Config File
|
||||
|
||||
You can also configure server settings in your `opencode.json` config file:
|
||||
|
||||
```json
|
||||
{
|
||||
"server": {
|
||||
"port": 4096,
|
||||
"hostname": "0.0.0.0",
|
||||
"mdns": true,
|
||||
"cors": ["https://example.com"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Command line flags take precedence over config file settings.
|
||||
|
|
@ -65,6 +65,7 @@ You can also access our models through the following API endpoints.
|
|||
| Model | Model ID | Endpoint | AI SDK Package |
|
||||
| ------------------ | ------------------ | -------------------------------------------------- | --------------------------- |
|
||||
| GPT 5.2 | gpt-5.2 | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
| GPT 5.2 Codex | gpt-5.2-codex | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
| GPT 5.1 | gpt-5.1 | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
| GPT 5.1 Codex | gpt-5.1-codex | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
| GPT 5.1 Codex Max | gpt-5.1-codex-max | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
|
|
@ -90,8 +91,8 @@ You can also access our models through the following API endpoints.
|
|||
| Big Pickle | big-pickle | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
|
||||
|
||||
The [model id](/docs/config/#models) in your OpenCode config
|
||||
uses the format `opencode/<model-id>`. For example, for GPT 5.1 Codex, you would
|
||||
use `opencode/gpt-5.1-codex` in your config.
|
||||
uses the format `opencode/<model-id>`. For example, for GPT 5.2 Codex, you would
|
||||
use `opencode/gpt-5.2-codex` in your config.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -131,6 +132,7 @@ We support a pay-as-you-go model. Below are the prices **per 1M tokens**.
|
|||
| Gemini 3 Pro (> 200K tokens) | $4.00 | $18.00 | $0.40 | - |
|
||||
| Gemini 3 Flash | $0.50 | $3.00 | $0.05 | - |
|
||||
| GPT 5.2 | $1.75 | $14.00 | $0.175 | - |
|
||||
| GPT 5.2 Codex | $1.75 | $14.00 | $0.175 | - |
|
||||
| GPT 5.1 | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5.1 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5.1 Codex Max | $1.25 | $10.00 | $0.125 | - |
|
||||
|
|
|
|||