Bundle
@zhangqingyu/dsh-editor-launcher
DeepSeek Harness plugin: open the current workspace in a detected editor (VS Code, GoLand, PhpStorm, HBuilderX, …) from a header dropdown
- Source
- 904915452
- License
- MIT
- Updated
- Updated 14 days ago
Readme
# @zhangqingyu/dsh-editor-launcher
DeepSeek Harness 插件:**在会话头部加一个「在编辑器中打开」下拉框**,自动扫描本机已安装的编辑器(VS Code、Cursor、Windsurf、GoLand、PhpStorm、WebStorm、IntelliJ IDEA、PyCharm、CLion、Rider、HBuilderX、Sublime Text、Atom),一键用选中的编辑器打开**当前会话所在的工作区**。
## 功能
- 打开下拉框,列出本机实际检测到的编辑器(带彩色标识与类型标签)。
- 点选后立即用该编辑器打开当前工作区(会话所属 Workspace → 最近 Workspace → 启动目录 依次回退)。
- 下拉框头部显示将要打开的工作区路径,可「重新扫描」刷新列表。
- 支持键盘操作(`↑` / `↓` / `Enter` / `Esc`、点击外部关闭)。
- 自动跟随 DeepSeek Harness 的明暗主题(使用内置 `--dsw-alias-*` 设计 token)。
## 工作原理
这是一个**双面(dual-face)插件**:
| 半部 | 文件 | 职责 |
|---|---|---|
| host | `lib/index.js` | 扫描本机编辑器;在 Web server 上注册 `/editor-launcher/list`、`/editor-launcher/refresh`、`/editor-launcher/open` 三个路由;由 host 侧 `spawn` 拉起编辑器(浏览器无法起进程)。 |
| client | `lib/client.js` | 在 `conversation.session.header.actions` 槽位注册下拉按钮,通过 `fetch` 调用上面的路由。 |
### 编辑器检测与启动策略
- 检测顺序:命令行工具(PATH / JetBrains Toolbox scripts)→ macOS `.app`(`/Applications`、`~/Applications`、JetBrains Toolbox apps 树)→ Windows / Linux 常见安装路径。
- 启动策略按「族」区分:
- **vscode 族**(VS Code / Cursor / Windsurf):`open -a "<名字>" <路径>`(复用已开窗口);
- **jetbrains 族**(GoLand / PhpStorm 等):`open -na "<名字>" --args <路径>`(新开实例并传入项目);
- **命令行**:`<命令> <路径>`(如 `code`、`subl`)。
- 打开前会校验 `path` 为真实可读目录,且 `editorId` 必须来自本次扫描结果——不做命令拼接,无 shell 注入面。
> 仅 Web 界面有意义:host 半部注入 `webServer` 服务,headless / TUI profile 中不存在该服务,插件不会激活。
## 安装
```bash
# 任选一个镜像仓库克隆
git clone https://gitee.com/zqy-904915452/dsh-editor-launcher.git
# git clone https://github.com/904915452/dsh-editor-launcher.git
cd dsh-editor-launcher
dsh plugin --profile web add "file:$(pwd)"
dsh plugin --profile web install
```
`file:` 后要写 clone 下来的**绝对路径**;如果你用的是自定义 profile,把 `web` 换成你的 profile 名。
也可以直接用仓库地址装:`dsh plugin --profile web add git+https://gitee.com/zqy-904915452/dsh-editor-launcher.git`
(或 GitHub 镜像 `git+https://github.com/904915452/dsh-editor-launcher.git`)。
安装后**刷新页面**让新的 client bundle 生效,然后进入任一会话,在标题栏动作区即可看到「在编辑器中打开」按钮。
卸载:
```bash
dsh plugin --profile web remove @zhangqingyu/dsh-editor-launcher
```
## 目录结构
```
dsh-editor-launcher/
├── cordis.patch.yml # bundle patch:插入 editor-launcher 行
├── package.json # dsh.bundle.patch + dsh.client 声明
└── lib/
├── index.js # host 半部:扫描 + 启动路由
└── client.js # browser 半部:头部下拉框
```
## 说明 / 限制
- 检测是**尽力而为**:只覆盖了常见编辑器的常见安装位置;从 JetBrains Toolbox 安装的 IDE 会被 Toolbox 树扫描到,但若命令行工具不在 PATH 里,则以 `.app` 方式通过 `open` 拉起。
- 插件在**加载时扫描一次**;编辑器的增删可点下拉框里的「重新扫描」刷新(内存态,重启后重新扫描)。
- 打开失败(例如编辑器刚被卸载)会在按钮旁给出错误提示,不会影响会话。
Install
dsh plugin --profile web add github:904915452/dsh-editor-launcher
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install zhangqingyu-dsh-editor-launcher from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.