GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dreamariner/create-dsh-plugin

BranchesTags
Open more actions menu

Latest commit

 

History

56 Commits
56 Commits

Folders and files

NameName
Last commit message
Last commit date
packages/dsh-ctl
packages/dsh-ctl
 
 
skills/create-dsh-plugin
skills/create-dsh-plugin
 
 
src
src
 
 
templates
templates
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
pnpm-workspace.yaml
pnpm-workspace.yaml
 
 
tsconfig.json
tsconfig.json
 
 
tsdown.config.ts
tsdown.config.ts
 
 
vitest.config.ts
vitest.config.ts
 
 

Repository files navigation

@dreamariner/create-dsh-plugin

DeepSeek Harness(DSH)插件脚手架:一键创建可发布、可安装、可热重载的插件项目, 并支持在同一仓里持续追加插件(一仓多插件)。

npx @dreamariner/create-dsh-plugin
# 或带参数:
npx @dreamariner/create-dsh-plugin @dreamariner/dsh-foo --type full
# 项目名与包名解耦(目录名 / 根壳 manifest 名跟项目名,缺省 = 插件 id):
npx @dreamariner/create-dsh-plugin @dreamariner/dsh-foo --type full --project-name my-otter-pack

Agent 技能

skills/create-dsh-plugin/SKILL.md:给 Agent 用的 脚手架使用技能(形态选型判据、生成后清单、安装验收、红线与坑)。把本仓挂进你的 skills 目录(如 zero 层 .agents/skills/)即可被发现。

追加插件(add)

workspace 仓(full 生成仓)默认带一个插件;之后在仓根执行 add 继续追加, 无需迁移结构:

npx @dreamariner/create-dsh-plugin add @dreamariner/dsh-bar --type client
npx @dreamariner/create-dsh-plugin add @dreamariner/dsh-panel --type full
  • add 只写新插件包(packages/<id>/),根壳按 pnpm -r / 通配自动收编
  • 重排既有仓(create 对非空 --dir):自动把本机 DSH profile($DSH_HOME/profiles/, 默认 ~/.dsh)里 link:<仓根> 形态的旧安装迁到 packages/<id> 子路径并跑 pnpm install;包名变了就连 dependencies 键与 dsh.profile.bundles 名单一起改。 背景:重排会把根 manifest 换成根壳(无 dsh.bundle),旧装法静默失效且无任何 报错日志,实例不重启不暴露。npm 发布版与 github 克隆是快照、不受重排影响,无需迁
  • 重排不动你的代码:重排模式下模板只补缺失的文件,不覆盖你已有的 src/ tests/ locale/ icon.svg;旧布局的插件内容会搬进新布局的插件包(与新形态模板同名的文件, 模板版备份成 <文件>.template,两边都留),搬完删掉旧路径,仓根只剩新布局的结构。 workspace → single 方向若仓里还有别的插件包,则不清理(不替你决定删哪个)并给出告警
  • 项目名与包名是两回事:目录名与根壳 manifest 名跟项目名(缺省 = 首个插件 id, 根壳名 <id>-workspace;显式 --project-name 且 ≠ 插件 id 时根壳名 = 裸项目名); 发布与安装只认包名。多插件项目建议起一个不被第一个插件绑架的项目名
  • 根壳脚本全部 pnpm -r 递归转发(build / dev / test / typecheck),加包不改根; 根 vitest 与根 tsconfig 按 packages/* 通配,新包自动被收编
  • 追加 full 形态时自动补协议声明源 submodule 与 tsconfig.host.json 的 face 引用 (仓里第一个 full 插件则按模板现生成聚合配置)
  • 每个插件包独立构建、独立发布:pnpm --filter <包名> publish

三种插件形态

形态 产物 宿主半边 浏览器半边 典型例子
host lib/index.js(ESM) tool / systemPrompt / provider / listener 无 联网搜索 provider
client lib/client.js(CJS + __ModuleLoader__ 包装) 装载壳(空 apply,官方 decoration 形态) 槽位 / 面板 / 装饰(React) 输入框装饰、UI 扩展
full 两份产物一次构建 + typert codegen 完整宿主能力 + Typert Remote 完整 UI 记忆面板、排版预览

workspace 布局不是 full 的权宜:typert 生成器结构性要求被分析的包位于 <root>/packages/ 下(loadRegistrations 的 isWithin 检查),三种形态统一成同一种结构后,add 才能对任何 形态生效。full 生成时自动挂载协议声明源 submodule(私有仓,需相应访问权限;可用 --protocol-url 换 URL)。

交互只问三个问题(包名 / 形态 / 目录),其余从包名推导,--help 看全部参数。

生成内容(每项都有依据)

  • pnpm workspace:packageManager 固定 [email protected],根壳 prepare 递归构建全部插件包 (lib/ 构建产物不入库;本地安装走生成项目自带 profile:add 装前构建,见生成项目 README 的安装节)
  • 发布自包含:prepare 把仓根 README / LICENSE 同步进包目录(npm 只自动 收录包目录内的这两件),产物 gitignore 保持仓根单真源
  • typert codegen 全链路(full):packages/protocol submodule(协议声明源)+ tsconfig.host.json 聚合(registration + paths 重定向)+ 插件级 tsconfig.typert.json face program + typertPlugin(生成 lib/typert.host.* 与 lib/typert.remote-client.*)+ manifest 四件套(peer / 裸精确 pin / 生成器 devDep / files 显式产物清单,生成器硬性校验)+ preinstall submodule 守卫 + 消费端护栏 spec;升级流程与 client 侧 $mount 接法见生成项目 README
  • tsdown 构建:host 段 deps 三件套从 manifest 派生(不变式 I1/I2:peer 外置宿主供给、 dependencies 内联、devDependencies 只许 import type);client 段 CJS + banner/footer 包装,EXTERNALS(react 系)走宿主渲染进程模块表,onlyImport 把模块表 miss 前移成构建期红
  • 自挂载 bundle:cordis.patch.yml(- insert: 自挂载)+ manifest 的 dsh.bundle.patch 声明,dsh plugin add 即装即挂(CLI = 装包 + 登记 profile 的 dsh.profile.bundles 名单;裸 pnpm add 只装包,需手动补名单,见生成项目 README 的安装节)
  • 展示元数据:locale/{en,zh}.json + icon.svg(官方 checklist 要求项,Plugin Manager 与 Settings 在不激活插件时就读它们)
  • 开发循环:pnpm dev(watch 重建全部插件包,full 形态数组配置同时 watch 两端)+ pnpm dev:hmr(host 半边注册进本机 home patch 的 hmr watch 根;client 半边由 DSH 的 client-hmr 自动热替换)
  • 发布配置:files 白名单 + publishConfig.access=public + engines.dsh 版本范围
  • 市场展示字段:author / homepage / repository 按需写入(官方 plugin-market-generator 收录时读取且无兜底,缺失则 Discover 卡片留白)。来源链:--author / --homepage / --repository flag > git origin remote(目标为仓库顶层时)> 包名 scope 推 github 地址; URL 一律先归一化成 https 网页 URL(未知主机的 scp 形式生成器解析不了); workspace 布局自动带 repository.directory。都没有则省略,manifest 不写空值
  • 自守护栏:bundle 形态(dsh.bundle 声明 / files 白名单 / 自挂载行写法)、client 边界 (不 import node:、不 import 任何 @deepseek-ai/dsh-client-* 包)

设计依据

  • DSH 官方 skill cordis-plugin-development(templates/decoration + references 的 ui-plugin / host-plugin / practices:client 模块形态、dsh.client 三字段、槽位选择、 「不 require Harness Client 包」等硬规则)
  • dreamariner/dsh-web-search-minimax:已验证 npm 可发布的完整 host 先例
  • 双端插件的构建与护栏形态:同代 DSH 外部插件仓的实战沉淀
  • DSH 版本锚:0.2.2-rc.5(src/manifest.ts 的 DSH_VERSION)

脚本副本边界(工具面全部包化)

0.6.0 起所有跨仓标准面脚本全部包化进 packages/dsh-ctl(目标:生成仓零脚本副本, 升级 = pnpm update @dreamariner/dsh-ctl,不再逐仓覆盖文件):

工具 调用形态 职责 每仓差异的消解方式
实例管理 dsh-ctl start/restart/stop/status/url/probe/record 五步重启(含 --detached 回合外托管)/ 装载探针 / 状态记录 仓库根与探针目标运行时发现
profile 安装 dsh-ctl profile-add 装前构建 + 装包 + 登记 bundles + 自检 安装目标 = bundle 持有者 ∪ bundle patch - insert: 行挂载的插件包(聚合拓扑原生支持:一个 bundle 挂多个插件,patch 即安装清单真源,只登记 bundle、自检按角色分叉;自动派生顺带修掉旧模板「多插件仓只装第一个」的缺口);--plugin 可选子集
hmr 接线 dsh-ctl dev-hmr 本仓 lib/ 注册进 home patch 的 hmr watch 根 仓库根运行时发现;!!js 方言由 dsh-ctl 自身依赖的 js-yaml 4 处理(0.7.0 起不再从宿主仓借用)
包文档同步 dsh-ctl sync-pack-docs prepare 把仓根 README / LICENSE 同步进包目录 workspace 根向上发现
构建依赖策略 @dreamariner/dsh-ctl/manifest-deps(子路径导出) tsdown 配置引用的 hostDeps / runtimeAllowed(依赖决策表单一来源) 纯函数,manifest 由调用方传入

唯一留仓的脚本:scripts/ensure-protocol.mjs(full 形态):它挂在 preinstall,先于 依赖安装执行(bin 尚不可用),鸡生蛋约束决定了它必须住仓。

仓自有脚本不算副本:聚合仓的装载拓扑各不相同,其自有 profile-add 是刻意分叉的仓代码,不随模板升级。

历史判定记录(0.6.0 定稿前曾评估为「仅 dsh-ctl 包化」,后被「消灭一切模板副本」的 目标推翻):dev-hmr / manifest-deps 当时以「零漂移、低频、重排兜底」留仓;profile-add 以「每仓差异是设计使然」留仓。最终全部包化的关键差异:运行时发现把每仓差异消解在 包内,模板占位符(__PACKAGE_NAME__ / __SELF_LINK_SUFFIX__ / __PACKAGE_MANAGER__ / __MANIFEST_DEPS_REL__)全部退役。

⚠️ 发布前不要对子仓跑重排:模板现在写入 ^DSH_CTL_VERSION(未发布的版本号), install 会 404。npm 发布后,子仓升级 SOP = 重排(刷新全部 config/doc face)+ 把 devDependency 范围改成 ^0.7.0 再 pnpm install(pnpm update 单独不够:caret 不跨 0.x minor,^0.6.0 解析不到 0.7.0)。

发布

pnpm --filter @dreamariner/dsh-ctl publish && pnpm publish
# 一行连跑,顺序不变:① ctl(@dreamariner/dsh-ctl)② 根包(@dreamariner/create-dsh-plugin,prepare 构建后打包)
# 注意:--dir / -C 会被 pnpm publish 原样透传给 npm 而报 EUSAGE,选目录用 --filter 或先 cd

顺序必须 ctl 先行:脚手架渲染的生成仓 devDependencies 写 ^<锁步版本>(当前 ^0.7.0),消费者 pnpm install 时会从 npm 解析 dsh-ctl,ctl 没上线就是 404。两包各发 一次(npm 没有原子多包发布,2FA 各提示一次,可 --otp=<码> 显式带),&& 保证顺序, ctl 先上线后任何人 install 都解析得到。bin 写裸相对路径(npm 规范口径):npm 11 的发布 归一化会剥掉 ./ 前缀,目录态直发甚至会整条摘除 bin。

锁步版本:两个包永远同号(内容耦合高,分开编号只制造漂移认知)。发布 = 三处一起改 版本:根 package.json、src/manifest.ts 的 DSH_CTL_VERSION、 packages/dsh-ctl/package.json(tests/render.spec.ts 有机械校验),然后按上面顺序两个 包各自 pnpm publish。CHANGELOG 各记各的:根包记在 CHANGELOG.md,dsh-ctl 记在 packages/dsh-ctl/CHANGELOG.md(仅脚手架侧变更的版本, ctl 侧可记「无 ctl 变更」)。发布前记版本条目(含日期),随发布 commit 一起上;发布后打 git tag <版本> 并推送,GitHub 的 compare 链接与 Releases 页都靠 tag。

发布后收尾(消费仓换轨,SOP):各插件仓把 devDependencies 的 link:../create-dsh-plugin/packages/dsh-ctl 换成 ^0.7.0,pnpm install;存量仓再跑 一次 rearrange(老布局收口)。跨 0.x minor 升级要手改范围:caret 不跨 minor, ^0.6.0 不会解析到 0.7.0,pnpm update 无效。在换轨前,rearrange 会写出 404 的版本号,勿跑。

发布后:npx @dreamariner/create-dsh-plugin。

About

No description, website, or topics provided.

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.