dsh-plugin-template

by bugmaker2

13 开发与运行时github收录于 08-23

deepseek-harness 插件开发模板

Template for deepseek-harness plugin development.

安装

dsh plugin --profile web add github:bugmaker2/dsh-plugin-template

GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试

安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗

安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。

README

目录

English | 中文

这是一个使用 TypeScript + tsdown 开发的最小 DeepSeek Harness 插件 bundle。Harness 加载它时会输出 hello world。

从 fork 开始

git clone https://github.com/YOUR-USER/dsh-plugin-template.git
cd dsh-plugin-template

pnpm install
pnpm run check
dsh plugin --profile hello add .
dsh --profile hello --dump-config | grep dsh-plugin-template
dsh --profile hello

Harness 输出中出现下面一行,就表示插件已经加载:

[dsh-plugin-template] hello world

开发时编辑 src/index.ts,执行 pnpm run build,然后重启 profile。生成的 lib/ 会包含在 package 中,因此直接从 Git 安装时可以加载已经构建好的 JavaScript 入口。

如果要改插件名,以下位置必须保持一致:

  • package.json → name
  • src/index.ts → name
  • cordis.patch.yml → id 和 name

卸载:

dsh plugin --profile hello remove dsh-plugin-template

插件全部内容

package.json       # 声明 dsh.bundle patch 和构建入口
src/index.ts       # TypeScript Cordis 插件入口
lib/index.js       # 自动生成的 Harness 入口
cordis.patch.yml   # 把 package 注册进 profile
tsconfig.json      # TypeScript 类型检查配置
pnpm-lock.yaml     # 依赖锁定

Harness 唯一需要的 manifest 是 package.json 中的 dsh.bundle.patch:它让 package 成为可安装的 profile bundle。cordis.patch.yml 插入插件行,src/index.ts 编译后导出普通 Cordis name/apply 入口。

当前模板只升级到 TypeScript + tsdown,仍然保持 Host-only,不加入 React Client、Remote contract 或测试框架。只有实际需要 Web UI、远程调用或复杂测试时,再引入对应方案。

被发现

给 fork 添加 GitHub topic dsh-plugin。topic 是 GitHub 仓库元数据,不是仓库文件:

gh api --method PUT repos/YOUR-USER/dsh-plugin-template/topics \
  -H 'Accept: application/vnd.github+json' \
  -f 'names[]=dsh-plugin'

许可证

MIT

原始 README: https://github.com/bugmaker2/dsh-plugin-template/blob/main/README.zh.md ↗