Skip to content

Add Zed support to Open actions via editor command aliases#1303

Open
AdemBenAbdallah wants to merge 1 commit intopingdotgg:mainfrom
AdemBenAbdallah:feat/open-in-zed
Open

Add Zed support to Open actions via editor command aliases#1303
AdemBenAbdallah wants to merge 1 commit intopingdotgg:mainfrom
AdemBenAbdallah:feat/open-in-zed

Conversation

@AdemBenAbdallah
Copy link

@AdemBenAbdallah AdemBenAbdallah commented Mar 22, 2026

Summary

Add Zed support to the existing "Open" editor flow.

This keeps the current architecture intact by extending the shared editor definition and server open service to support multiple command aliases per editor.

Changes

  • add command alias support to the shared editor registry
  • support Zed via zed and zeditor
  • keep existing VS Code/Cursor behavior unchanged
  • add server tests for Zed resolution and fallback behavior

Why

Some Zed installs expose the CLI as zeditor instead of zed. Before this change, Zed could be modeled in the UI but still fail to appear or launch depending on the installed command name.

Verification

  • bun fmt
  • bun lint
  • bun typecheck
  • bun run --cwd apps/server test src/open.test.ts
screenshot-2026-03-22_13-03-58

Note

Add zeditor as a fallback command alias for Zed in editor open actions

  • Replaces the single command field on editor definitions in packages/contracts/src/editor.ts with a commands array; zed now includes ['zed', 'zeditor'] as candidates.
  • Adds a resolveAvailableCommand helper in apps/server/src/open.ts that returns the first installed command from an ordered list.
  • resolveEditorLaunch and resolveAvailableEditors now use this helper so that, for example, zeditor is used on Linux when zed is not in PATH.
  • file-manager uses commands: null and is always considered available regardless of OS command presence.
  • Behavioral Change: editor availability and launch now depend on the first available command in a list rather than a single fixed command name.
📊 Macroscope summarized eca6618. 2 files reviewed, 2 issues evaluated, 1 issue filtered, 1 comment posted

🗂️ Filtered Issues

apps/server/src/open.ts — 1 comment posted, 2 evaluated, 1 filtered
  • line 232: If editorDef.commands is an empty array [], the condition if (editorDef.commands) at line 231 is truthy, but resolveAvailableCommand([]) returns null, causing the fallback editorDef.commands[0] to be undefined. This would result in command: undefined being returned, which violates the EditorLaunch interface expecting command: string. Downstream, launchDetached would pass undefined to isCommandAvailable(launch.command), and command.includes("/") at line 153 would throw a TypeError. This depends on whether the EDITORS contract can have empty commands arrays. [ Out of scope (triage) ]

- Resolve editor launches against multiple command aliases
- Include zeditor as a fallback for Zed and update availability checks
- Refresh MSW worker version
@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 53871314-bdbe-42b5-82b2-98d833084e50

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can enable review details to help with troubleshooting, context usage and more.

Enable the reviews.review_details setting to include review details such as the model used, the time taken for each step and more in the review comments.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 22, 2026
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium

export function resolveAvailableEditors(
platform: NodeJS.Platform = process.platform,
env: NodeJS.ProcessEnv = process.env,
): ReadonlyArray<EditorId> {
const available: EditorId[] = [];
for (const editor of EDITORS) {
const command =
editor.commands === null
? fileManagerCommandForPlatform(platform)
: resolveAvailableCommand(editor.commands, { platform, env });
if (command !== null) {
available.push(editor.id);
}
}
return available;

For the file-manager editor, fileManagerCommandForPlatform always returns a command string (open, explorer, or xdg-open) without checking if it actually exists on the system. On Linux without xdg-open, isCommandAvailable would have returned false, but the new command !== null check always passes, causing file-manager to appear available when it isn't.

  for (const editor of EDITORS) {
-    const command =
-      editor.commands === null
-        ? fileManagerCommandForPlatform(platform)
-        : resolveAvailableCommand(editor.commands, { platform, env });
-    if (command !== null) {
-      available.push(editor.id);
+    if (editor.commands === null) {
+      const command = fileManagerCommandForPlatform(platform);
+      if (isCommandAvailable(command, { platform, env })) {
+        available.push(editor.id);
+      }
+    } else {
+      const command = resolveAvailableCommand(editor.commands, { platform, env });
+      if (command !== null) {
+        available.push(editor.id);
+      }
     }
   }
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/server/src/open.ts around lines 176-192:

For the `file-manager` editor, `fileManagerCommandForPlatform` always returns a command string (`open`, `explorer`, or `xdg-open`) without checking if it actually exists on the system. On Linux without `xdg-open`, `isCommandAvailable` would have returned `false`, but the new `command !== null` check always passes, causing `file-manager` to appear available when it isn't.

Evidence trail:
apps/server/src/open.ts lines 60-69 (fileManagerCommandForPlatform always returns string), lines 176-193 (resolveAvailableEditors logic), lines 144-174 (isCommandAvailable implementation); packages/contracts/src/editor.ts line 9 (file-manager has commands: null); apps/server/src/open.test.ts lines 271 and 289 (tests expect file-manager without validating underlying command)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant