Skip to content

dsh-publish-plugin

Verified

dsh-publish-plugin · v0.1.4 · MIT

Publish a DeepSeek Harness plugin to npm and GitHub in one flow: /publish-dsh-plugin command + publish_plugin tool. 一键把 DSH 插件发布到 npm 与 GitHub(双平台必发)。

Install

dsh plugin add dsh-publish-plugin

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Published to npm without a public repository. Inspect the package contents before installing.

Tags

Creators

Readme

dsh-publish-plugin

English | 简体中文

把 DeepSeek Harness 插件一键发布到 npm + GitHub(双平台必发)的 DSH 插件:/publish-dsh-plugin 命令(人在 Web GUI / TUI 里直接操作)+ publish_plugin 工具(模型驱动)。两者共享同一个发布域,且都是 fail-closed:没有显式确认绝不执行。

安装

# 从 npm(推荐——已发布的包)
dsh plugin --profile web add dsh-publish-plugin
# 或从 git
dsh plugin --profile web add github:liulei237136/dsh-publish-plugin

安装后 /publish-dsh-plugin 命令与 publish_plugin 工具同时可用(组合里有命令注册表时命令才注册,有工具注册表时工具才注册)。

命令面用法

① /publish-dsh-plugin                  → 发现当前会话目录(及向上/直接子目录)的插件候选
② /publish-dsh-plugin <插件名>          → 校验 manifest + 冲突检查 + 动作汇总
③ /publish-dsh-plugin <插件名> yes      → 执行(npm publish + GitHub 建仓/推送 + tag + topic)
  • 不带 yes 永远只汇总不执行(fail-closed);
  • 版本冲突(npm 上该版本已存在)时报错提示提升版本;包名/仓库已存在视为升级发布(发新版本、推已有仓库);
  • 执行前会再查一遍冲突。

工具面用法

对模型说"把这个插件发了"即可。模型调用 publish_plugin(参数 plugin_path 可选,默认当前会话目录),工具校验后展示动作汇总并经 ctx.approval 请求一次性确认——只有 allowed-once 才执行。发布完成后结果回到模型,可继续验证安装、写 CHANGELOG、处理失败。

前置条件

  • Node.js + npm(发布机器)
  • gh CLI 已安装并登录(gh auth login;gh 在 host 启动之后安装的需要重启 host——PATH 是启动时快照)
  • npm 发布认证——npm 现在要求 2FA 或 bypass token(具体命令见下方 Troubleshooting):
    • 在 npm 账号上启用 2FA(auth-only 模式即可,发布不需要 OTP);
    • 创建带 Bypass 2FA 的 Granular Access Token 并配置为认证 token

Troubleshooting(踩坑记录)

症状 原因与解决
npm error 403 Forbidden - PUT ... - Two-factor authentication or granular access token with bypass 2fa enabled is required to publish packages npm 要求启用 2FA 才能发布。在账号启用 2FA(npm profile enable-2fa auth-only,发布无需每次 OTP),https://www.npmjs.com/settings/<你的账号>/tokens 创建带 Bypass 2FA 的 Granular Access Token,然后 npm config set //registry.npmjs.org/:_authToken=<token>
npm error ENEEDAUTH: need auth ... You need to authorize this machine using npm adduser 未登录:执行 npm login,或设置 NPM_TOKEN(环境变量;新设环境变量需要重启 host)
GitHub 仓库:gh 未登录(检查失败) 执行 gh auth login;如果 gh 是在 host 启动之后安装的,需要重启 host(PATH 是启动时快照)
命令/工具不可见,或改动不生效 bundle 层不热重载(只有用户 profile 的 cordis.patch.yml 热重载)。安装或修改 bundle 后请重启 web profile
从 git 安装时 pnpm 拦截 prepare pnpm ≥10 需要在 profile 的 pnpm-workspace.yaml 放行构建脚本(pnpm 会打印具体 key,dsh plugin 也有提示)

说明

  • 发布是同步等待子进程(npm publish / gh 可能耗时较长),期间 UI 等待结果,可用取消信号中断;Windows 上取消信号只终止 npm/gh 的 cmd 包装进程,其子进程可能残留,必要时手动清理;
  • 部分失败会明确报告"已完成哪些步骤",剩余步骤需手动收尾(例如 npm 已发布但 GitHub 失败);
  • 发布前会先做 git 预检(脏工作树 / remote 不匹配直接拒绝),因此这类失败不会产生任何副作用——插件绝不改 remote、绝不自动提交;
  • 工具面在无 ctx.approval 的组合中拒绝执行(fail-closed);
  • 发布后给出的安装命令使用 --profile web,因为 dsh plugin 必须指定 profile;读者按自己的 profile(如 tui)替换即可。

维护者请看 CONTRIBUTING.md(本地开发、测试与自举发布流程),固定决策与实现说明在 docs/design.md