Skip to content

Commit 818a3d9

Browse files
ammar-agentammario
andauthored
🤖 feat: add VS Code extension for cmux workspace switching (#553)
## Overview Adds a VS Code/Cursor extension that allows users to quickly open cmux workspaces directly from the editor. ## Features - **Command Palette Integration**: Access cmux workspaces via `cmux: Open Workspace` command - **Local Workspaces**: Opens local cmux workspaces (git worktrees) in new editor windows - **SSH Workspaces**: Opens remote SSH workspaces using Remote-SSH extension - Automatically detects VS Code Remote-SSH (`ms-vscode-remote.remote-ssh`) - Automatically detects Cursor Remote-SSH (`anysphere.remote-ssh`) - **UI-Only Extension**: Runs locally, available in all contexts (local and remote workspaces) - **Smart Detection**: Reads workspace list from `~/.cmux/config.json` - **Error Handling**: Provides clear guidance for SSH setup and missing extensions Co-authored-by: Ammar Bandukwala <ammar@ammar.io>
1 parent a8c2ad5 commit 818a3d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2123
-378
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: "Build VS Code Extension"
2+
description: "Build the cmux VS Code extension"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Build VS Code extension
8+
shell: bash
9+
run: make vscode-ext

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,24 @@ jobs:
8989
path: release/*.AppImage
9090
retention-days: 30
9191
if-no-files-found: error
92+
93+
build-vscode-extension:
94+
name: Build VS Code Extension
95+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
96+
steps:
97+
- name: Checkout code
98+
uses: actions/checkout@v4
99+
with:
100+
fetch-depth: 0 # Required for git describe to find tags
101+
102+
- uses: ./.github/actions/setup-cmux
103+
104+
- uses: ./.github/actions/build-vscode-extension
105+
106+
- name: Upload VS Code extension artifact
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: vscode-extension
110+
path: vscode/cmux-*.vsix
111+
retention-days: 30
112+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,24 @@ jobs:
5858
run: bun x electron-builder --linux --publish always
5959
env:
6060
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
build-vscode-extension:
63+
name: Build and Release VS Code Extension
64+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
65+
steps:
66+
- name: Checkout code
67+
uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0 # Required for git describe to find tags
70+
71+
- uses: ./.github/actions/setup-cmux
72+
73+
- uses: ./.github/actions/build-vscode-extension
74+
75+
- name: Upload VS Code extension to release
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
run: |
79+
gh release upload ${{ github.event.release.tag_name }} \
80+
vscode/cmux-*.vsix \
81+
--clobber

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ include fmt.mk
3737
.PHONY: lint lint-fix typecheck static-check
3838
.PHONY: test test-unit test-integration test-watch test-coverage test-e2e
3939
.PHONY: dist dist-mac dist-win dist-linux
40+
.PHONY: vscode-ext vscode-ext-install
4041
.PHONY: docs docs-build docs-watch
4142
.PHONY: storybook storybook-build test-storybook chromatic
4243
.PHONY: benchmark-terminal
@@ -83,6 +84,10 @@ node_modules/.installed: package.json bun.lock
8384
# Legacy target for backwards compatibility
8485
ensure-deps: node_modules/.installed
8586

87+
88+
89+
90+
8691
## Help
8792
help: ## Show this help message
8893
@echo 'Usage: make [target]'
@@ -267,6 +272,14 @@ dist-win: build ## Build Windows distributable
267272
dist-linux: build ## Build Linux distributable
268273
@bun x electron-builder --linux --publish never
269274

275+
## VS Code Extension (delegates to vscode/Makefile)
276+
277+
vscode-ext: ## Build VS Code extension (.vsix)
278+
@$(MAKE) -C vscode build
279+
280+
vscode-ext-install: ## Build and install VS Code extension locally
281+
@$(MAKE) -C vscode install
282+
270283
## Documentation
271284
docs: ## Serve documentation locally
272285
@./scripts/docs.sh

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Here are some specific use cases we enable:
3636
- Isolated workspaces with central view on git divergence
3737
- **Local**: git worktrees on your local machine ([docs](https://cmux.io/local.html))
3838
- **SSH**: regular git clones on a remote server ([docs](https://cmux.io/ssh.html))
39+
- **VS Code Extension**: Jump into cmux workspaces directly from VS Code ([docs](https://cmux.io/vscode-extension.html))
3940
- Multi-model (`sonnet-4-*`, `gpt-5-*`, `opus-4-*`)
4041
- Ollama supported for local LLMs ([docs](https://cmux.io/models.html#ollama-local))
4142
- OpenRouter supported for long-tail of LLMs ([docs](https://cmux.io/models.html#openrouter-cloud))

bun.lock

Lines changed: 181 additions & 108 deletions
Large diffs are not rendered by default.

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [SSH](./ssh.md)
1414
- [Forking](./fork.md)
1515
- [Init Hooks](./init-hooks.md)
16+
- [VS Code Extension](./vscode-extension.md)
1617
- [Models](./models.md)
1718
- [Keyboard Shortcuts](./keybinds.md)
1819
- [Vim Mode](./vim-mode.md)

docs/img/vscode-ext.webp

240 KB
Loading

docs/vscode-extension.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# VS Code Extension
2+
3+
The cmux VS Code extension allows you to quickly jump into your cmux workspaces directly from Visual Studio Code or Cursor. This enables a more seamless back and forth between a purely agentic workflow and traditional editing. It's
4+
especially useful for completing the "last mile" of a task or establishing the initial architecture.
5+
6+
## Overview
7+
8+
The extension has a small initial surface area: a command to open a workspace.
9+
10+
![cmux VS Code extension screenshot](./img/vscode-ext.webp)
11+
12+
1. Press `Cmd+Shift+P` (or `Ctrl+Shift+P` on Windows/Linux)
13+
2. Type "cmux: Open Workspace"
14+
- Optional: Set a custom keybinding in the Command Palette settings
15+
3. Select your workspace
16+
4. It opens in a new editor window
17+
18+
The extension works seamlessly with both local and SSH workspaces.
19+
20+
## Installation
21+
22+
### Download
23+
24+
Download the latest `.vsix` file from the [GitHub releases page](https://github.com/coder/cmux/releases).
25+
26+
### Install
27+
28+
**Command line:**
29+
30+
```bash
31+
# For VS Code
32+
code --install-extension cmux-*.vsix
33+
34+
# For Cursor
35+
cursor --install-extension cmux-*.vsix
36+
```
37+
38+
**From editor UI:**
39+
40+
1. Open Command Palette (`Cmd+Shift+P`)
41+
2. Type "Extensions: Install from VSIX..."
42+
3. Select the downloaded file
43+
44+
### Workspace Types
45+
46+
The extension displays workspaces differently based on their type:
47+
48+
- **Local**: `📁 [project-name] workspace-name`
49+
- **SSH**: `🔗 [project-name] workspace-name (ssh: hostname)`
50+
51+
## SSH Workspaces
52+
53+
### Requirements
54+
55+
For SSH workspaces to work, you need:
56+
57+
1. **Remote-SSH Extension** installed
58+
- VS Code: `ms-vscode-remote.remote-ssh`
59+
- Cursor: `anysphere.remote-ssh`
60+
- The extension automatically detects which one you have
61+
2. **SSH host configured** in `~/.ssh/config` or in the Remote-SSH extension
62+
63+
### Setup SSH Host
64+
65+
If you haven't configured the SSH host yet:
66+
67+
1. Open `~/.ssh/config` and add:
68+
69+
```ssh
70+
Host myserver
71+
HostName 192.168.1.100
72+
User username
73+
IdentityFile ~/.ssh/id_rsa
74+
```
75+
76+
2. Or use VS Code's Remote-SSH command:
77+
- `Cmd+Shift+P` → "Remote-SSH: Add New SSH Host..."
78+
79+
## Development
80+
81+
For development instructions, see `vscode/README.md` and `vscode/DEVELOPMENT.md` in the
82+
repository.
83+
84+
## Related
85+
86+
- [Workspaces Overview](./workspaces.md)
87+
- [SSH Workspaces](./ssh.md)
88+
- [VS Code Remote-SSH Documentation](https://code.visualstudio.com/docs/remote/ssh)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
"docs:watch": "make docs-watch",
4242
"storybook": "make storybook",
4343
"storybook:build": "make storybook-build",
44-
"test:storybook": "make test-storybook",
45-
"rebuild": "echo \"No native modules to rebuild\""
44+
"test:storybook": "make test-storybook"
4645
},
4746
"dependencies": {
4847
"@ai-sdk/anthropic": "^2.0.29",
@@ -82,6 +81,7 @@
8281
"zod-to-json-schema": "^3.24.6"
8382
},
8483
"devDependencies": {
84+
"@electron/rebuild": "^4.0.1",
8585
"@eslint/js": "^9.36.0",
8686
"@playwright/test": "^1.56.0",
8787
"@storybook/addon-docs": "^10.0.0",

0 commit comments

Comments
 (0)