🎁 福利专区全网大模型免费应用 + 新用户福利 + 注册活动入口,低成本玩转 AI

插件去重守护 Jiaoyc224/dsh-plugin-dedupe

DeepSeek 客户端
Jiaoyc22477 天前有提交已提供中文文档扫描:含敏感能力兼容 / 相关生态

扫描 profile 依赖,拦截重复安装的插件

26.4/100
综合分
1
GitHub 星标
—
npm 周下载
—/5
用户评分

数据截至 2026/10/2 · 周下载取自 npm 全网(含 CI / 镜像),非本站安装数;综合分由星标、活跃度与兼容性检查合成。

相关生态插件(非 dsh 原生,按其对应运行时安装)
git clone https://github.com/Jiaoyc224/dsh-plugin-dedupe.git

状态速览

判定依据:实装验证 · 静态安装检查 · 自动扫描 · 仓库维护状态
信任档位:待复验
是什么
生态应用
桌面端 / Web 外壳,不以 dsh plugin add 安装
装得上吗
曾在 dsh 0.2.0-rc.2 下真实安装成功,但当前 dsh 已更新至 0.2.1-rc.5,本站尚未在新版下复验
L4 · 真实安装等级说明 →
安全吗
本站尚未对该插件做风险分级
暂未覆盖,不等同于无风险
还在维护吗
更新放缓:最近一次提交在 77 天前
档位由哪些信号合成

本站实装验证(真实安装 L4 覆盖全站;L5 为运行时冒烟或实机截图,覆盖范围小于 L4) · 验证所用 dsh 版本 · 静态安装检查 · 风险分级 · 仓库维护状态。 下方各区块是它的证据明细。

验证判据与等级说明 →
社区实装还没有人打卡 · 装过的第一个就是你
安全扫描自动 · 静态分析源码
v2.7.0
🔵 扫描:含敏感能力尚无人工评估
展开查看扫描说明与证据 ↓

静态扫描发现插件具备触达本地系统的能力:执行外部命令、读写/删除本地文件、读取剪贴板或密钥类环境变量(至少其一)。这是能力清单,不是危险判定——具体能力项与证据见下方,安装前请自行判断是否需要。

读写/删除本地文件
查看扫描证据(共 22 处,展示前 12 条)
  • 读取本地文件
    lib/index.js:29
    if (existsSync(pkgPath)) {
  • 读取本地文件
    lib/index.js:30
    const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
  • 读取本地文件
    lib/index.js:46
    if (!existsSync(path)) {
  • 读取本地文件
    lib/index.js:51
    return JSON.parse(readFileSync(join(profileRoot, 'package.json'), 'utf-8'));
  • 读取本地文件
    lib/index.js:61
    if (!existsSync(nmDir)) return result;
  • 读取本地文件
    lib/index.js:63
    const entries = readdirSync(nmDir, { withFileTypes: true });
  • 读取本地文件
    scripts/check-duplicates.mjs:26
    if (existsSync(pkgPath)) {
  • 读取本地文件
    scripts/check-duplicates.mjs:27
    const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
  • 读取本地文件
    scripts/check-duplicates.mjs:41
    if (!existsSync(path)) return null;
  • 读取本地文件
    scripts/check-duplicates.mjs:43
    return JSON.parse(readFileSync(path, 'utf-8'));
  • 读取本地文件
    scripts/check-duplicates.mjs:53
    if (!existsSync(nmDir)) return result;
  • 读取本地文件
    scripts/check-duplicates.mjs:55
    const entries = readdirSync(nmDir, { withFileTypes: true });
扫描于 2026/11/2(1 天前) · 范围 入口闭包 + 发布文件清单 · 来源 GitHub 仓库

静态扫描只反映源码中出现的调用,不构成安全背书;人工评估与自动扫描相互独立、互不覆盖。

依赖的 DSH / Cordis 模块
@deepseek-ai/cordis
给这个插件打分还没有人投票↓
用户评分
还没有人投票,来当第一个

功能亮点

  • 扫描profile依赖
  • 拦截重复安装插件

README

由 DeepSeek 最新模型翻译生成
dsh-plugin-dedupe English · 简体中文 DSH 插件去重守护 — 防止在 DSH profile 中重复安装同一插件。 运行效果 [dsh-plugin-dedupe] 扫描 profile: C:\Users\<your-user>\.dsh\profiles\web ❌ 检测到重复声明: "dsh-agent-teams" 在 package.json 中有多个来源: github:NanmiCoder/dsh-agent-teams file:E:/fake/dsh-agent-teams [dsh-plugin-dedupe] 检测到 1 个重复插件错误,已阻断安装。
展开完整文档(README 剩余 1 节)
dsh-plugin-dedupe

English · 简体中文

DSH 插件去重守护 — 防止在 DSH profile 中重复安装同一插件。

运行效果

[dsh-plugin-dedupe] 扫描 profile: C:\Users\<your-user>\.dsh\profiles\web ❌ 检测到重复声明: "dsh-agent-teams" 在 package.json 中有多个来源: github:NanmiCoder/dsh-agent-teams file:E:/fake/dsh-agent-teams [dsh-plugin-dedupe] 检测到 1 个重复插件错误,已阻断安装。

功能

1. 启动时扫描:作为 DSH 插件加载时,自动扫描当前 profile 的 package.json 依赖和 node_modules 实际安装,检测:
- 同名插件在 package.json 中多次声明(不同来源:npm / github / file / link)
- node_modules 中同名包出现多次(不同版本/来源并存)
- 未声明但已安装的 dsh- 残留插件
- 同一包在 dependencies/devDependencies 中声明且来源协议相同(降级为警告,非错误)

2. preinstall 钩子:作为 pnpm install 的 preinstall 钩子,安装前自动检查,发现错误时返回非零退出码,阻断安装,防止重复插件被下载。

安装

1. 通过 GitHub 安装(推荐)

在 DSH profile 目录下:

cd <your-dsh-profile-dir> # 例如: C:\Users\<user>\.dsh\profiles\web
pnpm add github:Jiaoyc224/dsh-plugin-dedupe

或使用 dsh plugin 命令:

dsh plugin --profile web add github:Jiaoyc224/dsh-plugin-dedupe

2. 启用 preinstall 钩子(推荐)

编辑 profile 的 package.json,在 scripts 中添加 preinstall 钩子:

{
"scripts": {
"preinstall": "node node_modules/dsh-plugin-dedupe/scripts/check-duplicates.mjs"
}
}

注意:首次安装插件后需先运行一次 pnpm install 才能生成 node_modules/dsh-plugin-dedupe,随后的 pnpm install 才会触发 preinstall 钩子。可用 pnpm install --prefer-offline 避免首次死循环。

这样每次运行 pnpm install 前,都会自动运行去重检查,发现重复插件会返回非零退出码,阻断安装。

使用示例

独立运行检查

在 profile 根目录下
node node_modules/dsh-plugin-dedupe/scripts/check-duplicates.mjs

或指定 profile 目录
node node_modules/dsh-plugin-dedupe/scripts/check-duplicates.mjs --profile /path/to/profile

作为 preinstall 钩子

{
"scripts": {
"preinstall": "node node_modules/dsh-plugin-dedupe/scripts/check-duplicates.mjs"
}
}

然后运行 pnpm install,如果有重复插件会报错并阻断:

❌ 检测到重复声明: "dsh-agent-teams" 在 package.json 中有多个来源: github:NanmiCoder/dsh-agent-teams, link:... [ERROR] preinstall script failed with exit code 1

配置选项

插件支持通过环境变量配置:

| 环境变量 | 说明 | 默认值 |
| DSH_DEDUPE_WARN_ORPHANS | 设为 true 时也警告非插件类的未声明依赖 | false |
| DSH_PROFILE_DIR | 手动指定 profile 根目录 | 自动向上查找 |

检测规则

| 类型 | 行为 | 说明 |
| package.json 同名依赖重复(不同来源) | ❌ 错误 | 同一包名在 package.json 中出现多个不同来源(如 github + file) |
| package.json 同名依赖多字段声明(同一来源) | ⚠️ 警告 | 同一包在 dependencies/devDependencies 中声明且来源协议相同 |
| node_modules 同名包多次 | ⚠️ 警告 | 同名包在 node_modules 中出现多次(不同版本/来源) |
| 未声明但已安装的 dsh- 插件 | ⚠️ 警告 | 可能是旧残留或手动复制 |

核心文件

dsh-plugin-dedupe/
├── package.json # 插件元数据、入口、脚本 ├── lib/index.js # Cordis 插件入口,启动时扫描 ├── scripts/ │ └── check-duplicates.mjs # 独立检查脚本,可作 preinstall ├── cordis.patch.yml # Cordis patch 注册插件 ├── docs/ │ └── screenshot.txt # 运行效果文本截图 ├── examples/ │ └── README.md # 详细示例配置 ├── README.md # 中文文档 ├── README.en.md # 英文文档 └── LICENSE

详细示例

更多完整示例请查看 examples/README.md。

原理

1. Cordis 插件:lib/index.js 作为 DSH bundle 加载,在 apply 阶段扫描当前 profile,把警告/错误输出到 logger。
2. preinstall 钩子:scripts/check-duplicates.mjs 可独立运行,返回非零码阻断 pnpm install。
3. 检测逻辑:
- 解析 package.json 的 dependencies / devDependencies / optionalDependencies / peerDependencies
- 扫描 node_modules 实际安装的包名计数
- 检测同名多源声明、node_modules 重复目录、未声明的 dsh-* 残留

许可证

MIT License

快速开始

1. 从 GitHub 安装
cd <your-dsh-profile-dir> # 你的 DSH profile 目录
pnpm add github:Jiaoyc224/dsh-plugin-dedupe

2. 添加 preinstall 钩子(编辑 package.json)在 scripts 中添加: "preinstall": "node node_modules/dsh-plugin-dedupe/scripts/check-duplicates.mjs"

3. 测试
pnpm install

以后每次 pnpm install 前,都会自动检查并阻断重复插件安装。
预览分享卡片长什么样 ↓Jiaoyc224/dsh-plugin-dedupe
分享 · DeepSeek Harness Hub
Jiaoyc224/dsh-plugin-dedupe

扫描 profile 依赖,拦截重复安装的插件

这是你的仓库?认领条目

回到顶部