Back to home

apbigking-cell

dsh-plugin-square

DeepSeek Harness 插件广场:实时同步 GitHub dsh-plugin topic,星标/最新/默认排序,搜索,英文简介自动翻译中文,事务化一键安装与启停/卸载。

Stars
0
Language
JavaScript
Created
Aug 15, 2026
Updated
Aug 15, 2026

Introduction

dsh-plugin-square(插件广场)

GitHub License

一个 DeepSeek Harness 插件:把 GitHub dsh-plugin topic(3300+ 插件)变成设置 → 插件 → 插件广场里的可搜索、可排序、中文化的卡片式插件市场,并提供可靠的安装器与启停管理

功能

浏览

  • 实时同步 — GitHub Search API topic:dsh-plugin,分页 + 10 分钟缓存 + 定期刷新,新插件自动出现。
  • 三种排序 — ⭐ 星标排序 / 🕐 最近更新 / 默认排序(GitHub best match)。
  • 搜索 — 关键词走 GitHub 自己的 q,在整个 topic 里搜。
  • 英文自动翻译中文 — 英文简介经 DeepSeek API 翻译成中文并持久化缓存;已含中文的跳过;翻译失败保留英文。

安装(事务化,杜绝假成功)

  • 安装目标解析owner/repo 先验证根 package.jsondsh.bundle.patch; 无则递归查 packages/*;都不是 → 明确拒绝"不是 DSH 插件"(普通仓库/文档/普通 npm 包都不会被安装)。
  • monorepo 选择:仓库含多个 bundle 时展开候选列表(含聚合包识别),用户选定后按 github:owner/repo#path:subdir 精确安装。
  • 事务安装:profile 快照 → 互斥锁 → 安装 → 权威验证(node_modules 里 package.json 声明 dsh.bundle.patch 且 patch 文件存在 + 包名进 dsh.profile.bundles)→ 失败自动回滚并清理。
  • 构建脚本授权:pnpm 拦截 build scripts 时列出精确包名,用户确认后仅授权这些包名。
  • profile 安全:只操作当前进程的 DSH_HOME,找不到当前安装的 CLI 就报错, 绝不回退到 PATH 全局 dsh(不会把依赖写进错误的 profile)。
  • 命令安全shell:false + 参数数组,spec/包名拒绝 shell 元字符。

管理

  • 已安装页:只显示真正的 DSH bundle(含 patch 文件验证);显示真实包名/版本/启用状态。
  • 一键启停:停用只从 dsh.profile.bundles 移除包名(保留依赖),启用加回;幂等; 插件广场自身不可停用/卸载(防丢失恢复入口)。
  • 卸载:二次确认,dependencies + bundles 同步移除 + pnpm 清理,失败回滚。
  • 权威状态刷新:卡片安装态一律来自 profile 重新读取,不用前端内存假状态。

Agent 工具

square_search / square_resolve / square_install / square_installed / square_toggle — 让 agent 也能自己搜、验证、安装、启停插件。

安装

dsh plugin --profile web add github:apbigking-cell/dsh-plugin-square

或本地路径:

dsh plugin --profile web add D:\ap\dsh-plugin-square

装完重启 harness,打开 设置 → 插件 → 插件广场

结构

部件文件作用
Bundle 清单package.json声明 dsh.bundle.patch + dsh.client(web)
Patch 层cordis.patch.yml把 host 半插入 Loader 树
Host 半lib/index.js端点 + 工具 + 同步 + 翻译(cordis 入口)
核心逻辑lib/core.jsprofile 定位 / CLI 解析 / resolver / 事务 / 启停 / 卸载(纯函数,可单测)
Client 半lib/client.js设置页「插件广场 / 已安装」标签页
测试test/run-tests.mjs20 项单元测试(node test/run-tests.mjs

翻译说明

翻译用 DeepSeek API(deepseek-chat),密钥读取顺序:DEEPSEEK_API_KEY 环境变量 → DSH_HOME/.credentials.yaml。缓存写入 DSH_HOME/profiles/web/dsh-plugin-square-translations.json。没有密钥时插件仍可用,只是英文简介保留原文。

License

MIT