Skip to content

chore: publish under the @dsh-labs scope - #3

Merged
Rinai-R merged 3 commits into
mainfrom
chore/scope-npm-name
Nov 12, 2026
Merged

Rinai-R merged 3 commits into
mainfrom
chore/scope-npm-name

Conversation

@Rinai-R

@Rinai-R Rinai-R commented Nov 12, 2026

Copy link
Copy Markdown
Member

背景

dsh-code-highlight 这个 npm 包名已被别人的项目占用(v1.1.0,维护者 kxfz,仓库 scientificmaniac/dsh-code-highlight,内容是报告用代码高亮)。推送 v0.1.1 tag 后 npm publish 在 provenance 签名成功之后返回 403(无发布权限)。因此改为 scoped 包 @dsh-labs/dsh-code-highlight 后重新发布;GitHub 仓库名不变。

改了什么(5 个文件,src/ 一行未改,版本仍是 0.1.1)

0.1.1 从未进入 registry,所以不需要再抬版本。

文件 改动 为什么
package.json name → @dsh-labs/dsh-code-highlight npm 包名;repository/homepage/bugs 仍指向 dsh-labs/dsh-code-highlight 仓库(仓库名不变),publishConfig.access: public 已满足 scoped 包的公开发布要求
tsdown.config.ts client bundle 的 __ModuleLoader__.load({ id }) → scoped 名 必须改:id 是模块表 key,DSH 的 boot graph 里「Entry name == package name」(@deepseek-ai/dsh-client-modules 的 WebBootEntry.id / BootModuleRow.id 文档原文),id 与包名不一致会导致 factory 注册 key 对不上、插件无法 materialize。现网 scoped 插件同此约定:@xmanrui/dsh-im 的 bundle 里 id: "@xmanrui/dsh-im",kivotos 里 id: "kivotos"
cordis.patch.yml name → scoped 名 name 是解析插件的模块 specifier,必须等于包名;id 保持 dsh-code-highlight(它是配置树行标识,不是包名,保持稳定可让已有 profile 里的行/覆盖继续命中)
README.md 安装命令 → dsh plugin --profile desktop add @dsh-labs/dsh-code-highlight 用户侧的 spec;标题仍是仓库名
.github/release-notes/v0.1.1.md 新增 scoped 改名说明(Highlights + Compatibility) 发布说明要交代包名来源

scripts/contract.mjs 里的 /tmp/dsh-code-highlight-contract 只是本机临时缓存目录名,不是包引用,未改。pnpm-lock.yaml 不含包名(单包 workspace,importer 只有 .),确认无需改动:pnpm install --frozen-lockfile 直接通过。

验证(全部真跑)

pnpm install --frozen-lockfile   # ✓ Lockfile is up to date; ✓ passes supply-chain policies (214 entries)
pnpm run typecheck               # ✓ 无输出
pnpm run build                   # ✓ dist/client.js 52.59 kB;banner 已是 id: "@dsh-labs/dsh-code-highlight"
pnpm test                        # ✓ 5 files / 35 tests passed
node scripts/contract.mjs        # ✓ 180 ok / 0 fail(0.2.2-rc.2 / 0.2.2-rc.1 / 0.2.1-rc.5 各 60)
scripts/check-reproducible.sh    # ✓ build output reproducible
npm pack --dry-run               # ✓ name: @dsh-labs/dsh-code-highlight, version 0.1.1,
                                 #   filename dsh-labs-dsh-code-highlight-0.1.1.tgz, 14 files, 19.3 kB(文件清单与 0.1.0 完全一致)

发布流程校验(改 scope 后仍然成立)

按 release.yml 逐步模拟:

  1. tag 校验:node -p 'require("./package.json").version' = 0.1.1,与 tag v0.1.1 比对 OK(逻辑只比版本号,与包名无关)。
  2. release notes 校验:node scripts/check-release-notes.mjs v0.1.1 OK(四标题顺序不变)。
  3. pack:npm pack --silent | tail -n 1 → dsh-labs-dsh-code-highlight-0.1.1.tgz,后续 npm publish "$file" 与 gh release create ... "$file" 都用这个文件名,不受 scope 影响(npm 会把 scope 压成 dsh-labs- 前缀)。
  4. publishConfig: {access: public, provenance: true} 已就位;0.1.1 非预发布 → 发布到 latest。

本次未推 tag、未执行 npm publish,合并后由你处理。

合并后需要人工确认的两点

  • npm 上 dsh-labs 组织是否存在、NPM_TOKEN 对应账号是否对其有发布权限(本地无法验证)。
  • 本机 profile 的 spec 需要从 file:.../dsh-code-highlight-0.1.0.tgz 换成 @dsh-labs/dsh-code-highlight@0.1.1(发布之后;在那之前只能继续用本地 tgz)。

Pin devDependencies to the 0.2.2-rc.2 release (npm `next`), add it to the
contract matrix in front of 0.2.2-rc.1 and 0.2.1-rc.5, and record pnpm 11's
version-pinned minimumReleaseAge exemptions so --frozen-lockfile installs
resolve those packages locally and in CI.

No source change: the keyed `tool.call.toolview` slot declaration, its
ToolCallOwnerProps/ToolCallCommonProps fields, ToolResultNode,
useCodeHighlighter and languageForPath are identical in rc.1 and rc.2.
peerDependencies and engines.dsh keep `>=0.2.1-rc.5 <0.3.0-0` so the plugin
still installs on either release.

Bump to 0.1.1 and add release notes for the tag-driven publish.
The unscoped `dsh-code-highlight` name on npm belongs to an unrelated
project, so `npm publish` of v0.1.1 was rejected with 403 after provenance
signing. Publish as `@dsh-labs/dsh-code-highlight` instead; the version
stays 0.1.1 because 0.1.1 never reached the registry.

- package.json: name -> @dsh-labs/dsh-code-highlight (repository URLs keep
  the dsh-labs/dsh-code-highlight GitHub name).
- tsdown.config.ts: the client bundle's `__ModuleLoader__` id is the
  module-table key, which equals the package name, so it carries the scope.
- cordis.patch.yml: `name` is the module specifier and takes the scoped
  package name; the entry `id` stays `dsh-code-highlight` so existing
  profile rows keep resolving.
- README + v0.1.1 release notes: scoped install command and rename note.

No `src/` change. Verified: install --frozen-lockfile, typecheck, build,
35/35 tests, contract 180 checks over three DSH releases, reproducible
build, `npm pack --dry-run` yields @dsh-labs/dsh-code-highlight 0.1.1 with
the same 14 files.
@Rinai-R
Rinai-R merged commit 678888a into main Nov 12, 2026
1 check passed
@Rinai-R
Rinai-R deleted the chore/scope-npm-name branch November 12, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant