boxcli: fix VS Code binary path resolution on macOS by joshgodsiff · Pull Request #2806 · jetify-com/devbox

@claude

The WSL fix in 4ba6fce constructs the editor binary path as
$VSCODE_CWD/bin/code. On WSL, VSCODE_CWD points to the VS Code
installation directory, so this works. On macOS however, VSCODE_CWD
is set to the workspace directory, producing a bogus path like
/Users/user/my-project/bin/code which does not exist.

Add an os.Stat check so the constructed path is only used when the
binary actually exists there, falling back to the bare command name
(resolved via PATH) otherwise. Extract the logic into a standalone
resolveEditorBinary function with tests covering both cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>