如何快速安装 dsh-ops:npm 一键部署 3 种 Profile + 市场安装完整教程
如何快速安装 dsh-ops:npm 一键部署 3 种 Profile + 市场安装完整教程
dsh-ops 是面向 Windows 的 DSH 底层操作工具插件,提供独立 bash 5.3、PowerShell 7 与高性能 Rust 文件工具,用于减少 Token 消耗与任务耗时。本教程带你用插件市场、npm 一键安装、dsh CLI 三种方式完成 dsh-ops 安装,并覆盖更新、卸载与常见问题排查。注意:0.3.0 正式版仅支持 Windows x64。
安装 dsh-ops 前的 3 个准备 📋
| 准备项 | 说明 |
|---|---|
| 系统 | Windows x64(0.3.0 仅此平台;Linux/macOS/ARM64 不在发布范围) |
| Node.js | 命令行方式依赖 Node 环境(推荐 Node 22.19+ / 24+) |
| 目标应用已初始化 | 安装命令要求目标 profile 下已存在 package.json(如 %USERPROFILE%\.dsh\profiles\<profile>\) |
💡 Profile 是什么? 每个 DSH 产品都有独立的运行环境:
desktop(桌面端)、web(Web 端)、tui(终端 TUI 产品)。所有安装命令都必须显式指定要装进哪个 Profile。
方式一:官方插件市场安装(新手首选)🛒
最简单的安装路径,全程点选:
- 打开目标 DSH 应用的插件市场
- 搜索 npm 包名
dsh-ops - 点击安装,完成后选择启用
安装归属于当前运行的 profile(桌面端即 desktop)。发布包已携带完整的 FastCtx、bash 和 PowerShell 7 载荷,不通过安装脚本下载、不修改系统 PATH,装完即用,无需任何编译。
方式二:npm 一键安装 3 种 Profile 🚀
打开命令行,按目标产品选择对应命令:
npx --yes dsh-ops@latest install --profile desktop
npx --yes dsh-ops@latest install --profile web
npx --yes dsh-ops@latest install --profile tui
三个要点:
- 必须显式选择目标 profile,命令不接受缺省;
tui参数实际映射到 dsh-TUI 产品的dsh-tuiprofile(而非旧的tui目录),映射逻辑见 lib/profile-install.js#L11-L22;- 该入口会委托官方 DSH CLI 执行安装,不另写一套 profile 锁与回滚逻辑,行为与官方管理器一致。
desktop Profile 安装要点 ⚠️
桌面端必须使用桌面应用自带的 CLI,安装器默认探测:
%LOCALAPPDATA%\Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd
如果桌面应用装在其它位置,用 --dsh-cli 显式指定(自动探测逻辑见 lib/profile-install.js#L25-L28):
npx --yes dsh-ops@latest install --profile desktop --dsh-cli "<安装目录>\resources\runtime\cli\bin\dsh.cmd"
⚠️ 普通 dsh CLI 不能管理保留的
desktopprofile,不要把它和桌面自带入口混淆。
方式三:官方 dsh CLI 直接安装
如果你习惯命令行管理插件,也可以直接执行官方命令:
dsh plugin --profile web add dsh-ops
dsh plugin --profile dsh-tui add dsh-ops
"<桌面安装目录>\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add dsh-ops
一条命令核对安装结果 🔍
安装后执行:
npx --yes dsh-ops@latest status --profile desktop
命令会输出该 profile 的依赖版本与启用状态,看到 "enabled": true 即代表安装并挂载成功。把 desktop 换成 web 或 tui 即可核对另外两个 Profile。
更新与卸载 dsh-ops 🔄
更新:重新运行相同的安装命令即可,或执行 dsh plugin --profile <profile> add dsh-ops@latest。按应用提示重载;替换已加载代码时重启应用。
卸载:
npx --yes dsh-ops@latest uninstall --profile desktop
也可以在市场中直接卸载,或执行 dsh plugin --profile <profile> remove dsh-ops。卸载只会移除该 profile 的依赖引用,不会误删系统 shell、其它 profile 的副本或包管理器共享缓存。
常见安装问题排查 ❓
Q:node_modules/@dsh-ops/ 下没有 bash-win32-x64,是安装损坏吗?
不是。三个 Windows 载荷都是精确钉版的可选依赖——如果你的 npm registry(尤其是镜像源)没有同步对应版本,包管理器会静默跳过它,安装依然以退出码 0 结束且不打印警告。推荐的兜底方式是绕过 registry,直接取上游钉版资产并校验 sha256:
npx --yes dsh-ops@latest provision-shells --bash
之后用 profile 自己那份副本核对可用梯级(npx … ladder 检查的是 npx 缓存副本,与你的 profile 无关):
node "%USERPROFILE%\.dsh\profiles\<profile>\node_modules\dsh-ops\bin\dsh-ops.mjs" ladder
Q:装完要不要改配置?
不用。Shell 组件(dsh-ops-shell)与文件组件(dsh-ops-file)默认开启,会直接发布 ops_bash 和四个 Rust 文件工具(ops_grep、ops_glob、ops_inspect_local_file、ops_replace)。后台组件(dsh-ops-background)与 PTC 组件(dsh-ops-ptc)默认关闭,需要时在配置编辑器或市场中显式启用;PTC 设计与用法详见 docs/native-ptc.md。
三种安装方式对比总结 🏁
| 安装方式 | 适合人群 | 核心命令 |
|---|---|---|
| 插件市场 | 纯新手、GUI 用户 | 搜索 dsh-ops 安装并启用 |
| npx 一键安装 | 脚本化、多 Profile 批量部署 | npx --yes dsh-ops@latest install --profile <profile> |
| dsh CLI | DSH 重度命令行用户 | dsh plugin --profile <profile> add dsh-ops |
延伸阅读:完整安装/更新/卸载说明见中文文档 README.zh.md;0.3.0 发布范围与主要变化见 docs/release-0.3.0.md;三个 Windows 平台载荷包的构成说明见 packages/README.md。