A VSCode sidebar extension for OpenCode - the AI coding agent. Simple chat interface to interact with OpenCode directly from your sidebar.

undefinedNote: This is an independent community project and is not officially affiliated with or maintained by the OpenCode team.
undefinedOpenCode CLI must be installed:
curl -fsSL https://opencode.ai/install | bash
undefinedOpenCode must be configured with API credentials:
opencode auth login
Select your provider (OpenCode Zen, Anthropic, OpenAI, etc.) and add your API key.
pnpm install
pnpm build
This builds both:
dist/extension.jsout/main.js and out/main.cssundefinedStart watch mode (in a terminal):
pnpm watch
undefinedLaunch Extension Development Host:
F5 in VSCode/CursorCmd+Shift+D) and click “Run Extension”undefinedUse the extension:
undefinedExtension code (src/extension.ts, src/OpenCodeService.ts, src/OpenCodeViewProvider.ts):
Cmd+R (Mac) or Ctrl+R (Windows/Linux)undefinedWebview UI (src/webview/App.tsx, src/webview/App.css, src/webview/hooks/):
┌─────────────────────────────────────┐
│ SolidJS Webview (Chat UI) │
│ - Input box │
│ - Message history │
│ - Thinking indicator │
└──────────┬──────────────────────────┘
│ postMessage
▼
┌─────────────────────────────────────┐
│ Extension Host (Node.js) │
│ - OpenCodeService │
│ ├─ Manages OpenCode client │
│ ├─ Creates sessions │
│ └─ Sends prompts │
└──────────┬──────────────────────────┘
│ @opencode-ai/sdk
▼
┌─────────────────────────────────────┐
│ OpenCode Server (Bun process) │
│ - Spawned by extension backend │
│ - Uses workspace opencode.json │
│ - Handles AI interactions │
└─────────────────────────────────────┘
undefinedExtension Side (TypeScript/ESM):undefined
src/extension.ts: Entry point, initializes OpenCodeServicesrc/OpenCodeService.ts: Manages OpenCode client/server, sessions, and promptssrc/OpenCodeViewProvider.ts: Webview provider, handles message passingundefinedWebview Side (SolidJS):undefined
src/webview/App.tsx: Chat UI with input, message history, thinking indicatorsrc/webview/App.css: Styles using VSCode theme variablesundefinedBuild System:undefined
vite.config.extension.ts: Bundles extension (ESM → CJS for VSCode)vite.config.ts: Bundles webview (SolidJS)The extension automatically uses:
opencode.json (if present in project root)~/.config/opencode/opencode.jsonExample workspace config:
{
"model": "anthropic/claude-3-5-sonnet-20241022",
"mcp": {
// MCP server configurations
}
}
opencode-gui/
├── src/
│ ├── extension.ts # Extension entry point
│ ├── OpenCodeService.ts # OpenCode client/server manager
│ ├── OpenCodeViewProvider.ts # Webview provider
│ └── webview/ # SolidJS UI
│ ├── App.tsx # Chat component
│ ├── App.css # Styles
│ ├── hooks/ # SolidJS hooks
│ ├── main.tsx # SolidJS entry point
│ └── vscode.d.ts # VSCode API types
├── media/
│ └── icon.svg # Activity bar icon
├── dist/ # Compiled extension (Vite output)
├── out/ # Compiled webview (Vite output)
├── vite.config.extension.ts # Extension build config
├── vite.config.ts # Webview build config
├── tsconfig.json # TypeScript config
└── package.json
✅ Simple chat interface
✅ Send prompts and get AI responses
✅ Thinking indicator during processing
✅ Message history (user and assistant)
✅ Workspace configuration support
✅ Full TypeScript type safety
✅ VSCode theme integration
To publish a new version:
package.jsonexport OVSX_PAT=your_open_vsx_tokennpx vsce login <publisher>pnpm publishThis publishes to both VS Code Marketplace and Open VSX Registry.
undefinedNote: You’ll need:
OVSX_PAT environment variableundefined“Failed to start OpenCode”undefined
which opencodewhere opencodeopencode auth loginundefined“No response received”undefined