dsh-reveal-in-folder
界面增强 活跃维护

dsh-reveal-in-folder

haruri03/dsh-reveal-in-folder

提供网页界面内的文件路径右键菜单,覆盖聊天文件链接、编辑器标签页与路径栏,点击即可在操作系统文件管理器中定位并高亮对应文件,省去手动逐层翻找目录的步骤。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
17 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:haruri03/dsh-reveal-in-folder
git clone https://github.com/haruri03/dsh-reveal-in-folder.git
git clone git@github.com:haruri03/dsh-reveal-in-folder.git
README.md main

dsh-reveal-in-folder

English | 中文

Repository: https://github.com/haruri03/dsh-reveal-in-folder

Right-click a file path, an editor tab, or an image in the DSH Web UI and get the actions that are
actually available:

  • Reveal in file manager: chat file references, editor path bars, right-sidebar tabs, local images;
  • Open image in browser: remote or in-page images (for example a host media route);
  • Copy image: inline chat images, the enlarged preview, and sidebar image previews.

Unavailable actions are not shown, and a failed action closes silently.

Image coverage: images the agent posts in chat, the enlarged view, and sidebar image previews. When
an image has no DOM path, the client hashes its bytes with SHA-256 and matches the content-addressed
attachment object; that enables "Reveal in file manager". Remote images do not get that item.

Text coverage

  • File references in chat replies (the chat renderer stores the path in the element's title,
    usually relative to the workspace);
  • Editor / document preview path bars (the value of an input, or a path in title);
  • Right-sidebar file tabs (data-dockkit-tab / data-sidebar-right-tab, preferring the
    dsh-resource address found in React props).

Path resolution

Chat references and path bars often carry relative paths. If they are handed straight to the host,
path.resolve resolves them against the process cwd and opens the wrong directory. This plugin
resolves paths on the host instead:

  1. The client sends path / name / address / image to GET /reveal-in-folder;
  2. The host uses the live session's header.cwd as the root:
    • relative paths are joined with each root and checked for existence;
    • a bare file name triggers a bounded recursive search under the root (skipping
      node_modules/.git and similar; at most 20k entries and 8 levels), and multiple matches are
      returned as a candidate list;
  3. The result is opened with explorer.exe /select,<path> (macOS open -R, Linux xdg-open),
    without going through a shell.

Add ?dry=1 to resolve without opening:

curl "http://127.0.0.1:<port>/reveal-in-folder?path=<relative-path>&dry=1"

Client behavior

  • A capture-phase contextmenu listener takes over only when the value looks like a file: a single
    line with an extension; a value with a separator is treated as a path, a bare name as a tab label.
  • The menu renders in shell.overlay, follows the cursor, and closes on Escape, an outside click, or
    scroll. Clicking an item closes the menu immediately and runs the action; unavailable actions are
    not shown, and failures close silently.
  • Host routes use the Node (req, res) signature; DSH webServer routes are not Fetch handlers.
  • Menu labels ship in Chinese and English and follow the host UI language; any other language shows
    English. Without the host client locale service the plugin reads <html lang>, and anything outside
    zh* shows English.

Install (manual)

Choose one:

Human: copy this directory to $HOME/.dsh/profiles/<profile>/node_modules/dsh-reveal-in-folder,
then append this row to the profile's cordis.patch.yml:

- insert:
    - id: reveal-in-folder
      name: './index.js'

Agent: run plugin_manager install_bundle --target "<path-to-plugin>".

Install from Git

When the repository root is the package (it contains package.json and dsh.bundle), install it
directly from its Git URL:

plugin_manager install_bundle --target "git+https://github.com/haruri03/dsh-reveal-in-folder.git"

The same operation is available to humans through the Web plugin page ("Add plugin") or the CLI:

dsh plugin --profile <profile> add "git+https://github.com/haruri03/dsh-reveal-in-folder.git"

npm package names and tarball URLs are also accepted. To update, remove and reinstall, or wait for an
upstream release.

After installing or changing the client, refresh the page once (the browser caches client
modules).

Known limits

  • Only files (with an extension) are recognized; right-clicking a directory does not open a menu.
  • When a tab exposes only a file name and the repository contains several files with that name, the
    menu lists the candidates to choose from (sorted by path depth, up to 100 entries, scrollable).
    Right-sidebar tabs that carry data-sidebar-right-session are searched inside that session's
    workspace first.
  • Tab-only filenames use a bounded search (20k entries / 8 levels); in very large repositories the
    action may fail and is then not shown.