Add Zed support to Open actions via editor command aliases#1303
Add Zed support to Open actions via editor command aliases#1303AdemBenAbdallah wants to merge 1 commit intopingdotgg:mainfrom
Conversation
- Resolve editor launches against multiple command aliases - Include zeditor as a fallback for Zed and update availability checks - Refresh MSW worker version
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment Tip You can enable review details to help with troubleshooting, context usage and more.Enable the |
There was a problem hiding this comment.
🟡 Medium
t3code/apps/server/src/open.ts
Lines 176 to 192 in eca6618
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)
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
zedandzeditorWhy
Some Zed installs expose the CLI as
zeditorinstead ofzed. 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 fmtbun lintbun typecheckbun run --cwd apps/server test src/open.test.tsNote
Add
zeditoras a fallback command alias for Zed in editor open actionscommandfield on editor definitions inpackages/contracts/src/editor.tswith acommandsarray;zednow includes['zed', 'zeditor']as candidates.resolveAvailableCommandhelper inapps/server/src/open.tsthat returns the first installed command from an ordered list.resolveEditorLaunchandresolveAvailableEditorsnow use this helper so that, for example,zeditoris used on Linux whenzedis not inPATH.file-managerusescommands: nulland is always considered available regardless of OS command presence.📊 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
editorDef.commandsis an empty array[], the conditionif (editorDef.commands)at line 231 is truthy, butresolveAvailableCommand([])returnsnull, causing the fallbackeditorDef.commands[0]to beundefined. This would result incommand: undefinedbeing returned, which violates theEditorLaunchinterface expectingcommand: string. Downstream,launchDetachedwould passundefinedtoisCommandAvailable(launch.command), andcommand.includes("/")at line 153 would throw aTypeError. This depends on whether theEDITORScontract can have emptycommandsarrays. [ Out of scope (triage) ]