dsh-profile-doctor — 插件生态自诊(DSH 插件)
你的 DSH 配置里有设置项在静默失效,你的 node_modules 里有链接在悄悄断裂,你的 .dsh 目录里躺着没人引用的备份。这个插件把那些事一件件找出来,并告诉你怎么修。
两类检查合一:配置树七检(config-clobber / dead-patch / tool-collision / plugin-not-mounted / plugin-stale / entry diff / explain)+ 生态八检(pnpm store 冲突 / patch 名不可解析 / 链接断裂 / 重复能力 / 孤儿备份 / GitHub 源 / 发布权限 / release-age 豁免)。
安装
dsh plugin --profile desktop add @bushizhanghan/dsh-profile-doctor
重启 DSH 后生效。只读:这个插件从不写你的 profile。
Agent 工具
检查清单
配置树(与 dsh-doctor 同源的七检)
生态(本插件的增量,全部来自真实踩坑)
它抓到的真实问题(这台机器上)
! "backup-workmate-lib-20261023-1252" is a backup directory nothing references (329 KB, 6 files)
! "backup-workmate-lib-20261023-1245" is a backup directory nothing references (324 KB, 6 files)
! "backup-workmate-lib-20261023-1242" is a backup directory nothing references (322 KB, 6 files)
! "backup-plugin-upgrade-20261022" is a backup directory nothing references (96 KB, 7 files)
! "dsh-md-export" installs from github: instead of the npm registry
! "dsh-workbuddy" installs from github: instead of the npm registry
以及 profile_doctor_release_age 报出的 4 条豁免与冷却缺口。
设计取舍
- dump 解析用缩进不用 YAML 库:dump 里嵌
!!js 表达式,严格加载器会拒绝、宽松的会求值。我们只要「有哪些键」,直接读结构更安全也更零依赖。
- 网络检查尽力而为:registry 超时把 staleness 降级成 unknown,而不是让体检失败——一个在防火墙后面跑不起来的医生,比一个报得少的医生更糟。
- 修不修由你定:每条 finding 都带
fix 文案,但插件只读。改配置是人来决定的事(dsh-doctor 的 --fix 也刻意只留在 CLI,同理)。
- 重复能力是 warn 不是 error:关键词重叠是启发式,你可能就是故意两个都用。
开发
node --test test/ # 16 个单测:dump 解析、七检、生态八检
License
MIT