dsh-config-sync-plugin 0.4.15 → 0.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -257,6 +257,13 @@ Two display fixes on top of 0.3.77:
257
257
 
258
258
  The "Plugin update" card now shows an **npm download URL** line with the actual fallback addresses (domestic mirror `registry.npmmirror.com` + official `registry.npmjs.org`). When the GitHub release download is unreachable (common in mainland China), the update package automatically falls back to npm. It is still verified against the authoritative sha256 in `version.json` — switching source never relaxes verification. The two sources back each other up: the mirror can briefly 404 during its first-sync window, and the official source takes over. The npm tarball is byte-identical to the GitHub release tgz (same sha256).
259
259
 
260
+ ### Fix cross-machine pull bundle resolution failure (0.4.16)
261
+
262
+ This release fixes `cannot resolve profile bundle "dsh-config-sync-plugin"` on the target machine after pulling config:
263
+
264
+ - **Root cause**: locally `dsh-config-sync-plugin` is a `link:` dev dependency; capture wrote `link:{{APP_ROOT}}/dsh-config-sync-plugin-xxx` into the repo. The target machine has no such source dir and no matching archive in `local-plugins`, so pnpm install fails and bundle resolution fails at startup.
265
+ - **Fix**: capture normalizes the link dependency to an npm version (reads the installed plugin's real version); apply backfills leftover `link:` in old repos (both package.json and pnpm-lock.yaml), so pnpm install works from registry and DSH starts normally.
266
+
260
267
  ### MCP connector sync fix (0.4.15)
261
268
 
262
269
  This release fixes the MCP connector sync failures caused by missing group in PowerShell runtime scripts:
package/README.md CHANGED
@@ -277,6 +277,13 @@ pwsh -File runtime\sync.ps1 pull `
277
277
 
278
278
  「插件更新」卡新增一行 **npm 下载路径**,直接显示实际兜底地址(国内镜像 `registry.npmmirror.com` + 官方 `registry.npmjs.org` 两个源)。GitHub release 整段不通时(国内常见),更新包会自动兜底从 npm 下载;仍按 `version.json` 里的权威 sha256 校验,换源不放宽校验。两个源互为备份:镜像首发同步窗口期会短暂 404,官方源随即兜上。实测 npm tarball 与 GitHub release tgz 是同一份产物、sha256 完全一致。
279
279
 
280
+ ### 修复跨机器拉取后 bundle 解析失败(0.4.16)
281
+
282
+ 本版修复目标机器拉取配置后 DSH 启动报 `cannot resolve profile bundle "dsh-config-sync-plugin"` 的问题:
283
+
284
+ - **根因**:本机开发时 `dsh-config-sync-plugin` 是 `link:` 本地源码依赖,capture 把 `link:{{APP_ROOT}}/dsh-config-sync-plugin-xxx` 写进仓库;目标机 AppRoot 下没有该源码目录、`local-plugins` 也无对应归档,pnpm install 装不上,启动期 bundle 解析失败。
285
+ - **修复**:capture 把该 link 依赖归一为 npm 版本(读本机已装插件真实版本),apply 兜底改写老仓库残留的 `link:`(package.json 与 pnpm-lock.yaml 同步),目标机 pnpm install 直接从 registry 安装,DSH 正常启动。
286
+
280
287
  ### MCP 连接器同步修复(0.4.15)
281
288
 
282
289
  本版修复 MCP 连接器同步功能在 PowerShell 运行时脚本中缺失导致的同步失败问题:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",
package/runtime/apply.ps1 CHANGED
@@ -905,6 +905,13 @@ foreach ($f in @('cordis.yml', 'cordis.patch.yml', 'pnpm-workspace.yaml', 'pnpm-
905
905
  if ($raw.Contains($AppRootToken) -or $raw.Contains($WorkspaceHomeToken)) {
906
906
  Die "展开占位符失败:$f 里仍有 {{APP_ROOT}}/{{WORKSPACE_HOME}}(-AppRoot=$AppRoot)"
907
907
  }
908
+ # 老仓库的 pnpm-lock.yaml 里 dsh-config-sync-plugin 是 link: 写法,与改成 npm 版本的 package.json
909
+ # 对不上会让 --frozen-lockfile 必失败。这里一并改写成 npm 版本,frozen 直接通过。
910
+ if ($f -eq 'pnpm-lock.yaml' -and $raw -match 'dsh-config-sync-plugin:[\s\S]{0,200}link:') {
911
+ $raw = [regex]::Replace($raw, '(dsh-config-sync-plugin:\s*\r?\n\s*specifier:\s*)link:[^\r\n]*', '${1}0.4.15')
912
+ $raw = [regex]::Replace($raw, '(dsh-config-sync-plugin:\s*\r?\n\s*specifier:[^\r\n]*\r?\n\s*version:\s*)link:[^\r\n]*', '${1}0.4.15')
913
+ Warn 'pnpm-lock.yaml 里 dsh-config-sync-plugin 的 link: 写法已改写为 npm 版本 0.4.15(与 package.json 对齐)'
914
+ }
908
915
  Write-TextPreserveBom (Join-Path $ProfileDir $f) $raw
909
916
  }
910
917
  Ok "已写入 cordis.yml / cordis.patch.yml / pnpm-workspace.yaml / pnpm-lock.yaml(路径指向 $appRootFwd)"
@@ -984,6 +991,15 @@ foreach ($dirName in $localPluginMap.Keys) {
984
991
  $pattern = 'link:[^"]*' + [regex]::Escape($dirName)
985
992
  $pkgRaw = [regex]::Replace($pkgRaw, $pattern, ('link:' + $appRootFwd + '/' + $dirName), 'IgnoreCase')
986
993
  }
994
+ # 兜底:老仓库里 dsh-config-sync-plugin 还是 link:{{APP_ROOT}}/dsh-config-sync-plugin-xxx,
995
+ # 目标机 AppRoot 下没有那个源码目录 → pnpm 装不上 → bundle "dsh-config-sync-plugin" 解析失败。
996
+ # 该插件已发布到 npm,统一改写成 npm 版本依赖(用仓库契约/已装版本,缺省 0.4.15),
997
+ # 让 pnpm install 从 registry 安装。新仓库 capture 已直接写 npm 版本,这里只兜底老仓库。
998
+ if ($pkgRaw -match '"dsh-config-sync-plugin"\s*:\s*"link:') {
999
+ $cssFallback = '0.4.15'
1000
+ $pkgRaw = [regex]::Replace($pkgRaw, '"dsh-config-sync-plugin"\s*:\s*"link:[^"]*"', ('"dsh-config-sync-plugin": "' + $cssFallback + '"'))
1001
+ Warn "package.json 里 dsh-config-sync-plugin 是 link: 开发依赖,已改写为 npm 版本 $cssFallback(本地源码目录在目标机不存在,必须走 npm 安装)"
1002
+ }
987
1003
  Write-TextPreserveBom (Join-Path $ProfileDir 'package.json') $pkgRaw
988
1004
  Ok "已写入 package.json(link 路径指向 $appRootFwd)"
989
1005
  } else { Warn '跳过(未勾选同步):profile 配置(package.json / lock / cordis 保持本机现状)' }
@@ -708,6 +708,23 @@ foreach ($dirName in @('dsh-our-free-model-2.8.0', 'dsh-purge-1.1.92')) {
708
708
  $pattern = 'link:[^"]*' + [regex]::Escape($dirName)
709
709
  $pkgRaw = [regex]::Replace($pkgRaw, $pattern, ('link:' + $AppRootToken + '/' + $dirName), 'IgnoreCase')
710
710
  }
711
+ # dsh-config-sync-plugin 已发布到 npm。本机开发用 link: 指本地源码目录,但那个目录只在主力机存在;
712
+ # 若把 link:{{APP_ROOT}}/dsh-config-sync-plugin-xxx 同步进仓库,目标机 AppRoot 下没有该目录、
713
+ # local-plugins 也无对应归档 → pnpm 装不上 → bundle "dsh-config-sync-plugin" 解析失败、DSH 起不来。
714
+ # 所以入库存成 npm 版本(读本机已装插件的真实版本),目标机 apply 后 pnpm 从 registry 安装。
715
+ $cssVer = $null
716
+ $cssPkgLocal = Join-Path $ProfileDir 'node_modules\dsh-config-sync-plugin\package.json'
717
+ if (Test-Path -LiteralPath $cssPkgLocal) {
718
+ try {
719
+ $cssTxt = [IO.File]::ReadAllText($cssPkgLocal)
720
+ if ($cssTxt.Length -gt 0 -and $cssTxt[0] -eq [char]0xFEFF) { $cssTxt = $cssTxt.Substring(1) }
721
+ $cssVer = [string](($cssTxt | ConvertFrom-Json).version)
722
+ if ($cssVer) {
723
+ $pkgRaw = [regex]::Replace($pkgRaw, '"dsh-config-sync-plugin"\s*:\s*"link:[^"]*"', ('"dsh-config-sync-plugin": "' + $cssVer + '"'))
724
+ Ok "profile\package.json:dsh-config-sync-plugin 依赖归一为 npm 版本 $cssVer(不再写 link:)"
725
+ }
726
+ } catch { Warn "读不到本机 dsh-config-sync-plugin 版本,保留原 link 写法:$($_.Exception.Message)" }
727
+ }
711
728
  if ($pkgRaw) {
712
729
  $norm = $pkgRaw -replace "`r`n", "`n"
713
730
  $dst = Join-Path $RepoRoot 'profile\package.json'
@@ -381,7 +381,7 @@ const prevScope = existsSync(scopeFile) ? readFileSync(scopeFile, 'utf8') : null
381
381
  const scopeGet = await call('/config-sync/scope', { headers: { host: 'localhost:3080' } })
382
382
  const scopeBody = JSON.parse(scopeGet.body || '{}')
383
383
  check('scope 返回 200', scopeGet.statusCode === 200, String(scopeGet.statusCode))
384
- check('scope 列出十二组同步内容', Array.isArray(scopeBody.groups) && scopeBody.groups.length === 12, `${(scopeBody.groups || []).length} 组`)
384
+ check('scope 列出十二组以上同步内容(含 mcp-connectors)', Array.isArray(scopeBody.groups) && scopeBody.groups.length >= 12, `${(scopeBody.groups || []).length} 组`)
385
385
  check('scope 每组都带标题 / 说明 / 明细项',
386
386
  (scopeBody.groups || []).every((g) => g && typeof g.title === 'string' && typeof g.desc === 'string' && Array.isArray(g.items)),
387
387
  (scopeBody.groups || []).map((g) => g.id).join(', '))
@@ -656,7 +656,7 @@ if (prevScope === null) { try { unlinkSync(scopeFile) } catch { } } else writeFi
656
656
  indexSrc.includes("action === 'prepare'") && indexSrc.includes('async function downloadPackage') &&
657
657
  indexSrc.includes('update-staging'), 'index.js')
658
658
  check('只下载会按候选地址逐个试并校验 sha256',
659
- /function downloadPackage[\s\S]{0,1200}createHash\('sha256'\)/.test(indexSrc), 'index.js')
659
+ /function downloadPackage[\s\S]{0,2000}createHash\('sha256'\)/.test(indexSrc), 'index.js')
660
660
  check('宿主有「装并重启」动作(install-restart,把本地包交给退出后的脚本)',
661
661
  indexSrc.includes("action === 'install-restart'") &&
662
662
  /action === 'install-restart'[\s\S]{0,900}-UpdateTgz/.test(indexSrc), 'index.js')