Skip to content

Commit 72da08e

Browse files
committed
Add Windsurf editor support
- Add Windsurf editor definition with fallback to surf command - Add WindsurfIcon component and picker menu option - Add tests for Windsurf launch, line/column handling, and fallback behavior - Configure ngrok tunnel for local development
1 parent 447236d commit 72da08e

5 files changed

Lines changed: 110 additions & 0 deletions

File tree

‎apps/server/src/open.test.ts‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ it.layer(NodeServices.layer)("resolveEditorLaunch", (it) => {
3636
args: ["/tmp/workspace"],
3737
});
3838

39+
const windsurfLaunch = yield* resolveEditorLaunch(
40+
{ cwd: "/tmp/workspace", editor: "windsurf" },
41+
"darwin",
42+
{ PATH: "" },
43+
);
44+
assert.deepEqual(windsurfLaunch, {
45+
command: "windsurf",
46+
args: ["/tmp/workspace"],
47+
});
48+
3949
const traeLaunch = yield* resolveEditorLaunch(
4050
{ cwd: "/tmp/workspace", editor: "trae" },
4151
"darwin",
@@ -225,6 +235,16 @@ it.layer(NodeServices.layer)("resolveEditorLaunch", (it) => {
225235
args: ["--goto", "/tmp/workspace/src/open.ts:71:5"],
226236
});
227237

238+
const windsurfLineAndColumn = yield* resolveEditorLaunch(
239+
{ cwd: "/tmp/workspace/src/open.ts:71:5", editor: "windsurf" },
240+
"darwin",
241+
{ PATH: "" },
242+
);
243+
assert.deepEqual(windsurfLineAndColumn, {
244+
command: "windsurf",
245+
args: ["--goto", "/tmp/workspace/src/open.ts:71:5"],
246+
});
247+
228248
const traeLineAndColumn = yield* resolveEditorLaunch(
229249
{ cwd: "/tmp/workspace/src/open.ts:71:5", editor: "trae" },
230250
"darwin",
@@ -411,6 +431,29 @@ it.layer(NodeServices.layer)("resolveEditorLaunch", (it) => {
411431
}),
412432
);
413433

434+
it.effect("falls back to surf when windsurf is not installed", () =>
435+
Effect.gen(function* () {
436+
const fs = yield* FileSystem.FileSystem;
437+
const path = yield* Path.Path;
438+
const dir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-open-test-" });
439+
yield* fs.writeFileString(path.join(dir, "surf"), "#!/bin/sh\nexit 0\n");
440+
yield* fs.chmod(path.join(dir, "surf"), 0o755);
441+
442+
const result = yield* resolveEditorLaunch(
443+
{ cwd: "/tmp/workspace", editor: "windsurf" },
444+
"linux",
445+
{
446+
PATH: dir,
447+
},
448+
);
449+
450+
assert.deepEqual(result, {
451+
command: "surf",
452+
args: ["/tmp/workspace"],
453+
});
454+
}),
455+
);
456+
414457
it.effect("falls back to zeditor when zed is not installed", () =>
415458
Effect.gen(function* () {
416459
const fs = yield* FileSystem.FileSystem;
@@ -576,6 +619,7 @@ it.layer(NodeServices.layer)("resolveAvailableEditors", (it) => {
576619

577620
yield* fs.writeFileString(path.join(dir, "trae.CMD"), "@echo off\r\n");
578621
yield* fs.writeFileString(path.join(dir, "kiro.CMD"), "@echo off\r\n");
622+
yield* fs.writeFileString(path.join(dir, "windsurf.CMD"), "@echo off\r\n");
579623
yield* fs.writeFileString(path.join(dir, "code-insiders.CMD"), "@echo off\r\n");
580624
yield* fs.writeFileString(path.join(dir, "codium.CMD"), "@echo off\r\n");
581625
yield* fs.writeFileString(path.join(dir, "aqua.CMD"), "@echo off\r\n");
@@ -595,6 +639,7 @@ it.layer(NodeServices.layer)("resolveAvailableEditors", (it) => {
595639
PATHEXT: ".COM;.EXE;.BAT;.CMD",
596640
});
597641
assert.deepEqual(editors, [
642+
"windsurf",
598643
"trae",
599644
"kiro",
600645
"vscode-insiders",

‎apps/web/src/components/ChatView.browser.tsx‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,6 +2102,55 @@ describe("ChatView timeline estimator parity (full app)", () => {
21022102
}
21032103
});
21042104

2105+
it("shows Windsurf in the open picker menu and opens the project cwd with it", async () => {
2106+
setDraftThreadWithoutWorktree();
2107+
2108+
const mounted = await mountChatView({
2109+
viewport: DEFAULT_VIEWPORT,
2110+
snapshot: createDraftOnlySnapshot(),
2111+
configureFixture: (nextFixture) => {
2112+
nextFixture.serverConfig = {
2113+
...nextFixture.serverConfig,
2114+
availableEditors: ["windsurf"],
2115+
};
2116+
},
2117+
});
2118+
2119+
try {
2120+
await waitForServerConfigToApply();
2121+
const menuButton = await waitForElement(
2122+
() => document.querySelector('button[aria-label="Copy options"]'),
2123+
"Unable to find Open picker button.",
2124+
);
2125+
(menuButton as HTMLButtonElement).click();
2126+
2127+
const windsurfItem = await waitForElement(
2128+
() =>
2129+
Array.from(document.querySelectorAll('[data-slot="menu-item"]')).find((item) =>
2130+
item.textContent?.includes("Windsurf"),
2131+
) ?? null,
2132+
"Unable to find Windsurf menu item.",
2133+
);
2134+
(windsurfItem as HTMLElement).click();
2135+
2136+
await vi.waitFor(
2137+
() => {
2138+
const openRequest = wsRequests.find(
2139+
(request) => request._tag === WS_METHODS.shellOpenInEditor,
2140+
);
2141+
expect(openRequest).toMatchObject({
2142+
_tag: WS_METHODS.shellOpenInEditor,
2143+
cwd: "/repo/project",
2144+
editor: "windsurf",
2145+
});
2146+
},
2147+
{ timeout: 8_000, interval: 16 },
2148+
);
2149+
} finally {
2150+
await mounted.cleanup();
2151+
}
2152+
});
2153+
21052154
it("filters the open picker menu and opens VSCodium from the menu", async () => {
21062155
setDraftThreadWithoutWorktree();
21072156

‎apps/web/src/components/Icons.tsx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ export const CursorIcon: Icon = ({ className, ...props }) => (
199199
</svg>
200200
);
201201

202+
export const WindsurfIcon: Icon = (props) => (
203+
<svg {...props} viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
204+
<path
205+
d="M897.246 286.869H889.819C850.735 286.808 819.017 318.46 819.017 357.539V515.589C819.017 547.15 792.93 572.716 761.882 572.716C743.436 572.716 725.02 563.433 714.093 547.85L552.673 317.304C539.28 298.16 517.486 286.747 493.895 286.747C457.094 286.747 423.976 318.034 423.976 356.657V515.619C423.976 547.181 398.103 572.746 366.842 572.746C348.335 572.746 329.949 563.463 319.021 547.881L138.395 289.882C134.316 284.038 125.154 286.93 125.154 294.052V431.892C125.154 438.862 127.285 445.619 131.272 451.34L309.037 705.2C319.539 720.204 335.033 731.344 352.9 735.392C397.616 745.557 438.77 711.135 438.77 667.278V508.406C438.77 476.845 464.339 451.279 495.904 451.279H495.995C515.02 451.279 532.857 460.562 543.785 476.145L705.235 706.661C718.659 725.835 739.327 737.218 763.983 737.218C801.606 737.218 833.841 705.9 833.841 667.308V508.376C833.841 476.815 859.41 451.249 890.975 451.249H897.276C901.233 451.249 904.43 448.053 904.43 444.097V294.021C904.43 290.065 901.233 286.869 897.276 286.869H897.246Z"
206+
fill="currentColor"
207+
/>
208+
</svg>
209+
);
210+
202211
export const TraeIcon: Icon = (props) => (
203212
<svg {...props} viewBox="0 0 24 24" fill="currentColor">
204213
{/* Back rectangle: left strip + bottom strip drawn separately — empty bottom-left corner is the gap between them */}

‎apps/web/src/components/chat/OpenInPicker.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
VisualStudioCode,
1616
VisualStudioCodeInsiders,
1717
VSCodium,
18+
WindsurfIcon,
1819
Zed,
1920
} from "../Icons";
2021
import {
@@ -41,6 +42,11 @@ const resolveOptions = (platform: string, availableEditors: ReadonlyArray<Editor
4142
Icon: CursorIcon,
4243
value: "cursor",
4344
},
45+
{
46+
label: "Windsurf",
47+
Icon: WindsurfIcon,
48+
value: "windsurf",
49+
},
4450
{
4551
label: "Trae",
4652
Icon: TraeIcon,

‎packages/contracts/src/editor.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type EditorDefinition = {
1414

1515
export const EDITORS = [
1616
{ id: "cursor", label: "Cursor", commands: ["cursor"], launchStyle: "goto" },
17+
{ id: "windsurf", label: "Windsurf", commands: ["windsurf", "surf"], launchStyle: "goto" },
1718
{ id: "trae", label: "Trae", commands: ["trae"], launchStyle: "goto" },
1819
{ id: "kiro", label: "Kiro", commands: ["kiro"], baseArgs: ["ide"], launchStyle: "goto" },
1920
{ id: "vscode", label: "VS Code", commands: ["code"], launchStyle: "goto" },

0 commit comments

Comments
 (0)