前言¶
在 DSH 中,智能体要操作 GitHub issue、Gitea issue 或发布 npm 包时,往往要先处理 CLI 是否安装、登录态是否可用、token 从哪里来、如何发布等前置步骤。@tommyfang/gh-tea-npm-dsh 把这类流程做成插件工具:先检测当前环境,再根据返回的菜单选择安装、导入 token、浏览器 OAuth 或手工 token,最后执行 issue 操作或 npm 发布。
这是什么¶
@tommyfang/gh-tea-npm-dsh 是一个 DeepSeek Harness(dsh)插件,面向 GitHub CLI(gh)、Gitea CLI(tea)和 npm。它提供 CLI 检测/安装、引导认证/配置、issue 操作和 npm 包发布工具。插件由 TommyFang2077 维护,采用 MIT 许可证。
它以 host-only bundle 形式进入 dsh:cordis.patch.yml 插入插件条目,dsh/index.js 注册工具和配套 skill。
核心功能¶
gh / tea¶
- 检测
gh/tea的安装情况、版本、认证状态和 token 环境变量;token 值会被掩码显示。 - 一键安装:优先使用 Homebrew,否则安装不需要 sudo 的二进制到
~/.local/bin。 - 引导认证:支持从环境变量导入、浏览器 OAuth device flow、手工 token。
- issue 操作:支持列表、查看、创建、评论、关闭、重开。
npm¶
- 检测 Node.js、npm、登录状态(
npm whoami)和 registry。 - 引导登录:支持浏览器 OAuth device flow(
npm login --auth-type=web)或使用 automation token。 - 发布 npm 包:使用
npm publish --access public。 - npm access tokens,包括 automation tokens,有 90 天生命周期上限;插件提供到期提醒和轮换引导。
配套 skill¶
插件注册一个 gh-tea-npm 配套 skill,用于说明工作流,并把具体命令参数指向各 CLI 自身的 --help。
安装与启用¶
安装前确认本机满足 npm 工具要求:Node.js >= 18 和 npm。gh 和 tea 是可选组件;如果缺失,插件可以安装。
运行下面命令安装插件:
npx -y @deepseek-ai/dsh plugin add @tommyfang/gh-tea-npm-dsh
安装后,插件会在 dsh 中注册相应工具和 gh-tea-npm skill。
典型用法¶
下面列出插件提供的工具名和常见调用参数。插件不会提出开放式问题,而是返回当前状态和下一步菜单,用户按步骤选择。
配置 gh / tea¶
先查看当前状态和可选操作:
gitclis_configure method=auto
如果 CLI 未安装,可以先安装:
gitclis_install
选择 token 来源时,可以从环境变量导入:
gitclis_configure method=env
也可以走浏览器 OAuth:
gitclis_configure method=web
gitclis_configure method=poll
这里 method=web 会返回 device code,method=poll 用于验证登录状态。
如果已经有手工 token,可以写入:
gitclis_set_token
最后验证 gh / tea 状态:
gitclis_status
配置 npm¶
先查看 npm 环境和下一步菜单:
npm_configure method=auto
走浏览器登录时:
npm_configure method=web
npm_configure method=poll
method=web 返回登录 URL,method=poll 用于验证。
如果使用 automation token:
npm_configure method=token
发布 npm 包¶
可以先做 dry run:
npm_publish dry_run=true
确认无误后再正式发布:
npm_publish
issue 工具需要 provider 参数:github 走 gh,gitea 走 tea。
适用场景与注意¶
适合需要在 DSH 中让智能体处理 gh / tea issue、配置登录态、发布 npm 包的开发者。它比较适合把“检测、安装、认证、发布”串成固定流程的场景。
注意:
- npm 工具需要 Node.js >= 18 和 npm。
gh和tea可选,插件可安装缺失的 CLI。- npm access tokens,包括 automation tokens,有 90 天生命周期上限,需要按引导轮换。
- 插件以当前 dsh 进程权限运行,会调用本机
gh、tea、npm并使用你配置的 token 或浏览器登录态。安装前应检查源码、许可证和将要执行的 CLI 操作。
结尾¶
gh-tea-npm-dsh 的价值在于把 GitHub、Gitea 和 npm 的常见前置操作收敛为 dsh 工具:检测环境、安装 CLI、引导认证、操作 issue、发布 npm 包,并提供 token 轮换提示。仓库地址:https://github.com/TommyFang2077/gh-tea-npm-dsh