OpenCode GUI is a powerful Visual Studio Code extension that brings the capabilities of the OpenCode CLI directly into your editor through a sleek, interactive sidebar.
- Interactive AI Chat: Communicate with OpenCode directly from the VS Code sidebar.
- Code Modification: High-level chat-based code editing and generation.
- Diff View: Built-in diff provider to visualize and review changes proposed by the AI before they are applied.
- Session Management: Easily create, view, and switch between different chat sessions.
- Model Selection: Switch between different AI models and variants supported by OpenCode.
- File Attachments: Attach files or images from your clipboard to provide context for your requests.
- Undo/Redo Support: Revert or restore changes made during a session with ease.
- Undo: Revert AI-generated changes back to any previous state using Git-powered tracking
- Restore: Restore previously undone changes within the same session
- Visual Conflict Resolution: Review and resolve conflicts when undoing changes
- Session History: Full history of all changes tracked per session
- OpenCode CLI installation guide. After install, ensure
opencodeis available in yourPATH. - Git 2.30.0 or higher must be installed and available in your
PATH. The extension uses Git to track and manage code changes. - VS Code version 1.80.0 or higher.
If you see an error like "running scripts is disabled on this system", use one of these options:
-
Temporary (current terminal session only, recommended first):
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
-
Persistent for current user:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
Then reopen the terminal and retry opencode --version.
If the extension cannot find OpenCode CLI, add the folder that contains opencode (or opencode.exe) to your PATH, then restart VS Code.
-
Windows (PowerShell):
- Locate the executable path:
Use the parent folder of the returned
where opencodeopencode.exepath as your PATH entry. - Add it to User PATH (example):
[Environment]::SetEnvironmentVariable( "Path", $env:Path + ";C:\\path\\to\\opencode\\bin", "User" )
- Close and reopen VS Code.
- Locate the executable path:
-
macOS/Linux:
- Add the OpenCode bin directory to your shell profile (
~/.zshrc,~/.bashrc, etc.):export PATH="$PATH:/path/to/opencode/bin"
- Reload shell profile and reopen VS Code.
- Add the OpenCode bin directory to your shell profile (
Tip: In VS Code integrated terminal, run opencode --version to verify PATH is correct.
- Download the
opencode-gui-0.0.1.vsixfile. - In VS Code, open the Extensions view (
Ctrl+Shift+X). - Click on the "..." (Views and More Actions) menu and select "Install from VSIX...".
- Select the downloaded file and restart VS Code.
- Open the OpenCode sidebar by clicking on the OpenCode icon in the Activity Bar.
- Use the chat interface to ask questions, request code changes, or explore your project.
- Review changes in the diff view that automatically opens when OpenCode proposes modifications.
- Manage your sessions and settings (model, variant, mode) directly in the sidebar.
OpenCode GUI is provided "AS IS" without warranty of any kind. Always review changes, run tests, and use version control (Git) before applying or merging AI-generated modifications.
OpenCode GUI manages the OpenCode background server per workspace using a lock file.
- Lock path:
.opencode/server.lock.jsonin the workspace root. - Stores: workspace-specific
portandpassword. - Reuses an existing server when the health check succeeds with Basic Auth.
- If the lock port is occupied by a different server, OpenCode GUI migrates to a new port and updates the lock file.
- If model or variant is not shown after loading the extension, run
Developer: Reload Windowonce and wait for initialization to complete.
OpenCode GUI uses Git to track and manage code changes:
- Baseline Tracking: When a session starts, a baseline Git commit is created
- Change Recording: Each AI response is tracked with its own Git commit
- Undo: Reverts workspace files to the baseline commit state
- Restore: Re-applies previously undone changes from history
Note: All changes are stored locally in
.opencode/directory. No data is sent to external servers for undo functionality.
OpenCode: Check Version: Verifies that the OpenCode CLI is correctly installed and accessible.
Contributions are welcome! Please feel free to submit pull requests or open issues on the GitHub repository.
This project is licensed under the MIT License.