Open with Finder / IDE — DSH Workspace Quick Open Plugin

Introduction

The DSH sidebar plugin turns each workspace folder row into a one-click shortcut. Hover to reveal Finder / Zed / Ghostty icons, and click to open that directory in the corresponding local application.

Core Features

  • Inline hover buttons: Three 16px icon buttons are automatically appended to the right of each workspace:<id> sidebar row, sitting side by side with the native ··· menu without obscuring existing operations.
  • Availability awareness: Requests /status on startup and only renders buttons for applications that actually exist on the local machine and are enabled by configuration (the Zed button won’t show if Zed isn’t installed).
  • Chinese/English bilingual: Follows the DSH locale — displays “在访达中打开” in Chinese or “Open in Finder” in English (including title and aria-label accessibility tags).
  • Operation feedback: Success/failure triggers a toast notification in the bottom-right corner (已在 Finder 中打开 / 打开失败:…); buttons are greyed out with a pulse animation during the request to prevent repeated clicks.
  • Server-side path resolution: The browser only sends workspaceId + app; the real directory is resolved by the server-side workspaceRegistry, so the client cannot forge a path to open arbitrary directories.
  • No shell, no PATH search: Uses execFile('open', [...fixed parameters]) uniformly, eliminating any command injection surface.

Installation and Configuration

Installation

dsh plugin --profile web add "github:johnsonspirit/open-with-finder-ide"

After installation, restart DSH (dsh web) for the changes to take effect.

Configuration

Plugin configuration (Config["~standard"] standard schema, optional — if all fields are omitted, all three options are enabled by default):

Field Type Default Description
finder boolean true Whether to enable “Open in Finder”
zed boolean true Whether to enable “Open in Zed”
ghostty boolean true Whether to enable “Open in Ghostty Terminal”

Example — keep only Finder and Zed:

config:
  finder: true
  zed: true
  ghostty: false

Usage

  1. Start DSH and open any sidebar view containing workspace folders.
  2. Hover over a workspace row (e.g., open-folder ~/src/Misc/open-folder).
  3. Three icons appear on the right side of the row: smiley face (Finder) / square Z (Zed) / little ghost (Ghostty), with a Chinese tooltip on hover.
  4. Click an icon → the corresponding application opens that directory → a toast in the bottom-right corner confirms the action.
  5. If an application is not installed, its icon is automatically hidden — no configuration needed.

API Calls

Base URL: /api/dsh-folder-open. All endpoints are loopback-only (127.0.0.1 / ::1 / localhost).

Status

curl http://127.0.0.1:PORT/api/dsh-folder-open/status

Response example:

{
  "ok": true,
  "mac": true,
  "apps": { "finder": true, "zed": true, "ghostty": true },
  "enabled": { "finder": true, "zed": true, "ghostty": true }
}

Open Directory

curl -X POST http://127.0.0.1:PORT/api/dsh-folder-open/open \
  -H 'content-type: application/json' \
  -d '{"workspaceId":"abc123","app":"finder"}'
Field Constraint
workspaceId Non-empty string, length ≤ 80, must be resolvable to a path in workspaceRegistry
app Limited to finder / zed / ghostty
Body limit 16 KiB; exceeding is treated as invalid request

Runtime Requirements and Security

Runtime Requirements

Dependency Version / Description
Node.js ≥ 18
OS macOS (darwin) — directory opening uses the system open command; on non-macOS systems the API returns mac: false and buttons are not rendered
DSH host Provides webServer (route registration) and workspaceRegistry (get(id) → { path }) injection

Security Design

  1. Never trust paths from the client — workspaceId → path only goes through server-side workspaceRegistry.get(); the POST body has no path field available for forgery.
  2. Strict Loopback validation — Quadruple check of remoteAddress + Host + Origin + Sec-Fetch-Site; other machines on the LAN and cross-site pages cannot invoke the endpoints.
  3. Fixed argv — All invocations use execFile('open', [...]); the directory is passed as a single argv element without going through a shell.
  4. Input limits — Body capped at 16 KiB; workspaceId limited to 80 characters.
  5. Capability detection bypasses PATH — Only checks fixed *.app under /Applications and ~/Applications, avoiding false positives from PATH hijacking.

Conclusion

This plugin ensures the security of local invocation through server-side path resolution and Loopback validation. It is suitable for developers who need to frequently switch workspace directories in DeepSeek Harness. For more details, refer to the project homepage or the GitHub repository.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye