@liangjiehappy/dsh-plugin-doctor
v0.1.4
Published
DSH 插件开发检测工具:静态符合性检查(manifest/patch/代码/依赖四层)、失败原因解释、沙箱提交
Maintainers
Readme
@liangjiehappy/dsh-plugin-doctor
DSH 插件开发检测工具。在提交沙箱之前,先在本地把装不上的原因找出来。
为什么有这个
2026-11-10,我自己写的一个插件在沙箱里报 install_failed,但错误信息只有一行:
dsh: initialized profile web at /home/node/.dsh/profiles/web那是最后一行日志,不是错误。真实原因是:
Error: cannot get property "config" without injectinject 只写了 ["tools","skills"],代码却读了 ctx.config。Cordis 在未声明时禁止访问,entry 直接不激活。
这一类错误完全可以静态检测出来。 这个插件就是干这个的。
安装
dsh plugin --profile web add @liangjiehappy/dsh-plugin-doctor三个工具
plugin_check — 静态符合性检查
plugin_check(dir="/path/to/my-plugin")四层逐项判定:
| 层 | 查什么 |
|---|---|
| L1 manifest | name / version / main / dsh.bundle.patch / files / engines.dsh |
| L2 patch | YAML 合法性、顶层数组、insert、entry 的 id+name、@ 引号 |
| L3 代码 | ESM、apply 函数、ctx 属性访问 vs inject 声明、相对 import 存在性、硬编码路径 |
| L4 依赖 | file: 路径、peerDependencies 版本范围 |
输出示例:
[L3 代码]
✓ 有 export function apply
✓ 有 export const name
✓ 是 ESM 模块
✗ 访问了未在 inject 里声明的 ctx 属性 — config
→ export const inject = [...现有, "config"]
→ 或改用 try/catch 包住访问。
→ 注意:Cordis 会直接抛 "cannot get property \"X\" without inject",
→ 导致 entry 激活失败,沙箱表现为 install_failed。plugin_explain — 解释失败原因
plugin_explain(key="code.inject")可解释的类型:
code.inject— ctx 属性未声明 injectpatch.at— YAML 里@没引号manifest.engines.upper— 版本写了上界manifest.files.patch— files 漏 patch 文件deps.file—file:依赖code.apply— 缺 apply 函数
每个都给出:原因、症状、修法。
plugin_submit — 提交沙箱
plugin_submit(plugin="@scope/name")
plugin_submit(plugin="@scope/name", mode="result") # 查结果提交到 deepseekbase 沙箱做四阶段测试(安装/列装/挂载/启动)。
一个技能
plugin-dev-guide —— 完整的插件开发指南,含:
- 最小可安装插件模板
- manifest 必填字段
cordis.patch.yml写法(含@引号陷阱)engines.dsh为什么只写下界- ctx 访问契约(2026-11 新增)
- 五个最常见的失败模式
- 发 npm 之前的自检清单
它自己就是例子
本插件严格遵守它自己检查的东西:
package.json有dsh.bundle.patchfiles含lib与 patch 文件- patch 里
@已加引号 engines.dsh只写下界inject只声明真正用到的(["tools","skills"])- 完全不碰
ctx.config—— 这正是 2026-11-10 那个 bug 的来源
限制
- 只做静态检查,不做运行时验证。真正能不能装,要提交沙箱。
- 不写任何文件、不执行命令,只读目录 + 发 HTTPS 请求。
- YAML 解析是手写的极简版,覆盖插件需要的子集,不是完整 YAML 解析器。
许可
MIT
相关
- DSHIO 标准:https://dshio.org/
- 插件市场:https://deepseekbase.com/
- 官方文档:https://github.com/deepseek-ai/deepseek-harness/tree/master/docs
本插件是第三方项目,与 DeepSeek 无隶属关系。
