dsh.bundle这个包贡献什么?
作者编写并分发的 npm 包,携带一个插入或覆盖插件行的 patch 配置层。
从本地 overlay 到可安装组合包
声明 bundle manifest,把配置层安装进 profile,先检查组合结果,再启动或回滚。
{
"name": "dsh-hello-plugin",
"version": "0.1.0",
"type": "module",
"main": "index.js",
"files": [
"index.js",
"cordis.patch.yml"
],
"dsh": {
"bundle": {
"patch": "./cordis.patch.yml"
}
}
}
两者都写在 package.json 的 dsh 键下,但职责不能重叠。
dsh.bundle作者编写并分发的 npm 包,携带一个插入或覆盖插件行的 patch 配置层。
dsh.profile位于 $DSH_HOME/profiles 下的可启动组合,记录有序 bundles 和用户 patch。
bundle 是你分发的东西,profile 是用户启动的东西。没有东西同时是两者。
package.json 声明配置层,cordis.patch.yml 按包名挂载插件,index.js 提供插件模块。安装后由 Node 从 profile 依赖中解析包名。
mkdir -p hello-pluginexport const name = 'hello-plugin'
export function apply() {
console.log('[hello-plugin] plugin loaded!')
}- insert:
- id: hello
name: dsh-hello-plugin如果包没有 dsh.bundle 声明,它仍会作为普通依赖安装,但不会激活任何配置层。
dsh plugin 在 profile 目录中转发 pnpm,并维护 dsh.profile.bundles。profile manifest 不需要手写。
dsh plugin --profile demo add ./hello-plugindsh --profile demo --dump-configdsh --profile demodsh plugin --profile demo remove dsh-hello-plugin{
"name": "dsh-profile-demo",
"private": true,
"dependencies": {
"dsh-hello-plugin": "link:/path/to/hello-plugin"
},
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"dsh-hello-plugin"
]
}
}
}组合从空根开始,按固定顺序应用。覆盖某一行时,config 整体替换,不会按键深度合并。
dsh-base 在前,随后按安装顺序应用外部 bundle
当前 profile 的用户覆盖
所有 profile 共享的机器本地偏好
按命令行出现顺序应用的临时 overlay
按 id 覆盖前一层的行时,必须重述该行需要的所有 config 键。用户仍可在 profile patch 中覆盖你的默认行,而无需修改包。
Git 安装拉取源码,不会自动得到 TypeScript 的 lib 产物。作者需要 prepare,用户需要显式 allowBuilds。
提供自包含的 prepare 脚本,从源码构建发布入口,不能依赖旁边存在 monorepo checkout。
把 pnpm 打印的确切包键加入 profile 的 pnpm-workspace.yaml,然后重新 add。
allowBuilds:
dsh-hello-plugin: trueprepare 在 Agent 沙箱之外运行。只允许源码可信的包,并锁定 commit:github:you/hello-plugin#<sha>。