dsh-config-sync-plugin 0.3.78 → 0.3.80

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
@@ -19,7 +19,7 @@ The package name is **`dsh-config-sync-plugin`** (the `dsh-config-sync` name on
19
19
 
20
20
  | Way | Command / entry | Notes |
21
21
  |---|---|---|
22
- | npm | `npm i dsh-config-sync-plugin` | Use it as a dependency, or add `"dsh-config-sync-plugin": "^0.3.78"` to the profile's `package.json` and run `pnpm i`. The name matches the `cordis.patch.yml` insert name and the install folder `dsh-config-sync-plugin-<ver>` |
22
+ | npm | `npm i dsh-config-sync-plugin` | Use it as a dependency, or add `"dsh-config-sync-plugin": "^0.3.80"` to the profile's `package.json` and run `pnpm i`. The name matches the `cordis.patch.yml` insert name and the install folder `dsh-config-sync-plugin-<ver>` |
23
23
  | Marketplace | client → Plugins → Discover → “Config Sync” | Installs from the git commit registered in `market-index.json` |
24
24
  | Offline tgz | `releases\dsh-config-sync-plugin-<ver>.tgz` | GitHub Release asset for air-gapped machines; the panel's Update button downloads the same file |
25
25
 
@@ -253,6 +253,30 @@ Two display fixes on top of 0.3.77:
253
253
  1. **Jump order matches section order**: the quick-jump tabs now follow the exact render order of the sections (Overview / Sync conflicts [when present] / Local paths [when expanded] / Targets / Automation & updates / Scripts / Restore / Content / Plugin data / Workspace visibility / Feedback). The two conditional sections (conflicts, local paths) appear in the tabs only when their cards are shown.
254
254
  2. **Scroll lands below the title**: the sticky title bar now uses an opaque background (same fill as panel cards), so content no longer shows through it; jumping to a tab sets the scroll offset from the title bar's actual height, so the target section lands fully below the title instead of being covered.
255
255
 
256
+ ### Fix cross-machine sync downgrading the installed plugin and rolling back pulls (0.3.80)
257
+
258
+ Fixes an issue where pulling on another machine replaced a newer locally installed plugin with an older archive from the config repo, turning the link into 0.0.0, failing bundle resolution, and rolling the pull back.
259
+
260
+ | Problem | Fix |
261
+ |---|---|
262
+ | An older archive was still deployed because versions merely differed | Version comparison is now semantic upgrade-only: the archive is deployed only when its version is higher than the installed one |
263
+ | Archive top-level folder mismatched the file name (e.g. a 0.3.70 package wrapping a 0.3.56 folder), producing nested folders and a broken link | capture now validates the archive top-level folder and version after packing; bad archives are deleted with a warning instead of being synced |
264
+ | Stale plugin keys caused repeated plugin-missing notices | Removed invalid legacy keys from localPluginMap and cleared stale notices |
265
+
266
+ The corrupted archive in the config repo was also repacked with correct 0.3.79 content.
267
+
268
+ ### The panel is now a fixed header plus an independently scrolling body (0.3.79)
269
+
270
+ 0.3.78 still kept the sticky header inside the same scroll container, so two cases leaked through: with a shorter panel, or with a header that wraps onto more lines, content brushed past the header's divider and even showed up in the padding above it; and the jump offset was computed from the header height, so it shifted whenever conditional sections appeared or disappeared.
271
+
272
+ 0.3.79 splits the panel in two: the header (title, badges, meta line and section tabs) now sits **outside** the scroll area, pinned at the top of the panel; below it a separate `overflow-y:auto` region holds the notices and every section card. Three direct results:
273
+
274
+ 1. **Structurally impossible to leak through**: the scrolling region starts 20px under the header divider, so however far you scroll, content stays inside it — never in the header area or above it.
275
+ 2. **Jump targets are fixed**: a section tab now just scrolls to the top of the scrolling region plus 8px, with no header-height math, so header wrapping and conditional sections no longer move the landing point.
276
+ 3. **No more header jitter**: the header does not scroll at all, so the shadow, translucent background and padding patches are gone; a single divider line is all that is left.
277
+
278
+ The change touches only the panel itself (`S.page` / `pageInner` are used nowhere else); the sidebar row and the settings summary row are unaffected.
279
+
256
280
 
257
281
  ## New sessions land in the default workspace (since 0.3.28)
258
282
 
package/README.md CHANGED
@@ -15,7 +15,7 @@ DSH 插件:左侧栏多一行「配置同步」,点开是整页体检面板
15
15
 
16
16
  | 方式 | 命令 / 入口 | 说明 |
17
17
  |---|---|---|
18
- | npm | `npm i dsh-config-sync-plugin` | 适合把它当依赖管理,或在 profile 的 `package.json` 里写 `"dsh-config-sync-plugin": "^0.3.78"` 后 `pnpm i`;包名与 `cordis.patch.yml` 里注册的名字、插件目录 `dsh-config-sync-plugin-<ver>` 一致 |
18
+ | npm | `npm i dsh-config-sync-plugin` | 适合把它当依赖管理,或在 profile 的 `package.json` 里写 `"dsh-config-sync-plugin": "^0.3.80"` 后 `pnpm i`;包名与 `cordis.patch.yml` 里注册的名字、插件目录 `dsh-config-sync-plugin-<ver>` 一致 |
19
19
  | 插件市场 | 客户端「插件市场 → 发现」搜「配置同步」 | 走 `market-index.json` 登记的 git 提交,版本与 README 对齐 |
20
20
  | 离线 tgz | `releases\dsh-config-sync-plugin-<ver>.tgz` | GitHub Release 附件,适合内网机器;面板「更新」按钮下载的也是它 |
21
21
 
@@ -273,6 +273,30 @@ pwsh -File runtime\sync.ps1 pull `
273
273
  1. **跳转顺序对齐卡片**:快捷标签顺序改为与分区实际渲染顺序完全一致(概览 / 同步冲突[有冲突时] / 本机路径[展开时] / 同步目标 / 自动化与插件更新 / 生成脚本 / 还原备份 / 同步内容 / 插件数据 / 工作区显示 / 问题反馈)。同步冲突、本机路径两个条件分区只在卡片存在时才出现在标签里。
274
274
  2. **滚动落点在标题下方**:标题栏改为不透明背景(面板卡片同色),滚动时内容不再从标题背后透出;点标签跳转时按标题栏实际高度设置滚动落点,目标分区完整显示在标题下方,不再被遮住。
275
275
 
276
+ ### 修复跨机同步把新插件降级覆盖、拉取后被回滚(0.3.80)
277
+
278
+ 修复跨机拉取时本地已安装的新版插件被配置仓库里的旧归档反向覆盖,进而导致 link 变成 0.0.0、插件 bundle 自检失败、拉取自动回滚的问题。
279
+
280
+ | 问题 | 修复 |
281
+ |---|---|
282
+ | 归档版本比本机旧时仍被当作新版本覆盖 | 版本比对由「不等即覆盖」改为语义化「只升不降」:只有归档版本高于本机版本才重新部署 |
283
+ | 归档内顶层目录名与文件名不符(如 0.3.70 包里套着 0.3.56 目录),解压出嵌套目录导致 link 失效 | capture 打包后强校验归档内顶层目录名与 version,异常归档直接删除并告警,不再同步到本机 |
284
+ | 残留的旧插件键导致每次拉取报 plugin-missing | 清理 localPluginMap 中的无效历史键与历史通知 |
285
+
286
+ 同时修正配置仓库中损坏的插件归档,用正确的 0.3.79 内容重打包。
287
+
288
+ ### 面板改成「页头固定 + 内容区独立滚动」的两段式布局(0.3.79)
289
+
290
+ 0.3.78 仍是一个滚动容器里塞一个吸顶页头,遇到两种情况还是会露:面板变矮、或页头换行变高时,内容会擦着标题分隔线上沿过去,甚至从标题上方那圈留白里露出来;跳转落点按页头高度动态算,条件分区出现/消失时也会忽高忽低。
291
+
292
+ 0.3.79 换成两段式:页头(标题 + 徽标 + 元信息 + 区标签)**整体移出滚动区**,固定在面板顶部;下方另起一块带 `overflow-y:auto` 的内容区,只装提示条和各分区卡片。带来三个直接效果:
293
+
294
+ 1. **结构上不可能再穿过去**:内容区边界就在标题分隔线下方 20px,滚动再多也只在内容区里,不会出现在标题区或标题上方。
295
+ 2. **跳转落点固定**:区标签跳转直接滚到内容区顶部 + 8px,不再按页头高度算偏移,页头怎么换行、条件分区在不在都不影响。
296
+ 3. **页头不再抖动**:页头不参与滚动,滚动条、阴影、半透明背景那套补丁全部去掉,只留一条分隔线。
297
+
298
+ 改造只动面板自己(`S.page` / `pageInner` 只在这一处用),侧栏行、设置页摘要行不受影响。
299
+
276
300
 
277
301
  ## 同步后新会话落在默认工作区
278
302
 
package/client.js CHANGED
@@ -93,12 +93,22 @@ window.__ModuleLoader__.load({
93
93
  color: 'var(--dsw-alias-label-primary-foreground)', fontWeight: 600,
94
94
  transition: 'background .15s ease, border-color .15s ease',
95
95
  },
96
- // 面板整页
96
+ // 面板整页:竖向两段式 —— 页头固定在上、下面这段才是滚动区
97
+ // 只有这样内容才不会滚过标题,跳转后分区标题也一定落在主标题下方
97
98
  page: {
98
- height: '100%', overflowY: 'auto', boxSizing: 'border-box',
99
- padding: '24px 28px 36px', background: 'var(--dsw-alias-bg-base)',
99
+ height: '100%', display: 'flex', flexDirection: 'column', overflow: 'hidden',
100
+ boxSizing: 'border-box', background: 'var(--dsw-alias-bg-base)',
100
101
  color: 'var(--dsw-alias-label-primary)',
101
102
  },
103
+ pageHeaderWrap: {
104
+ flex: '0 0 auto', zIndex: 50, padding: '24px 28px 0',
105
+ background: 'var(--dsw-alias-bg-base)',
106
+ },
107
+ pageHeaderInner: { maxWidth: '1140px', margin: '0 auto' },
108
+ pageBody: {
109
+ flex: '1 1 auto', minHeight: 0, overflowY: 'auto', overflowX: 'hidden',
110
+ padding: '20px 28px 36px', boxSizing: 'border-box',
111
+ },
102
112
  pageInner: { maxWidth: '1140px', margin: '0 auto', display: 'flex', flexDirection: 'column', gap: '20px' },
103
113
  pageTitle: { fontSize: '20px', lineHeight: '28px', fontWeight: 700, letterSpacing: '0.3px', color: 'var(--dsw-alias-label-primary)' },
104
114
  pageLead: { fontSize: '12px', lineHeight: '19px', color: 'var(--dsw-alias-label-tertiary)', margin: 0, maxWidth: '820px' },
@@ -2636,8 +2646,10 @@ window.__ModuleLoader__.load({
2636
2646
  : null
2637
2647
 
2638
2648
  return h('div', { style: S.page },
2639
- h('div', { style: S.pageInner },
2640
- h('div', { ref: headerRef, style: { ...S.pageHeader, position: 'sticky', top: '0', zIndex: 50, background: 'var(--dsw-alias-settings-card-fill, #fff)', boxShadow: '0 2px 8px var(--dsw-alias-border-l1)' } },
2649
+ // 页头在滚动区之外:内容滚不到它上面,区标签跳转后的标题也只出现在它下面
2650
+ h('div', { style: S.pageHeaderWrap },
2651
+ h('div', { style: S.pageHeaderInner },
2652
+ h('div', { ref: headerRef, style: S.pageHeader },
2641
2653
  h('div', { style: S.pageHeaderMain },
2642
2654
  h('div', { style: S.pageTitleRow },
2643
2655
  h('div', { style: S.pageTitle }, M('配置同步', 'Config Sync')),
@@ -2706,11 +2718,15 @@ window.__ModuleLoader__.load({
2706
2718
  key: sid, type: 'button',
2707
2719
  style: { fontSize: '12px', lineHeight: '18px', padding: '3px 10px', borderRadius: '6px', border: '1px solid transparent', background: 'transparent', color: 'var(--dsw-alias-label-secondary)', cursor: 'pointer' },
2708
2720
  title: M('跳转到此区', 'Jump to section'),
2709
- onClick: () => { const el = document.getElementById('sync-section-' + sid); if (!el || !el.scrollIntoView) return; const hh = headerRef.current ? headerRef.current.offsetHeight : 160; el.style.scrollMarginTop = (hh + 8) + 'px'; el.scrollIntoView({ behavior: 'smooth', block: 'start' }) },
2721
+ onClick: () => { const el = document.getElementById('sync-section-' + sid); if (!el || !el.scrollIntoView) return; el.scrollIntoView({ behavior: 'smooth', block: 'start' }) },
2710
2722
  }, label)
2711
2723
  }),
2712
2724
  ),
2713
2725
  ),
2726
+ ),
2727
+ ),
2728
+ h('div', { style: S.pageBody },
2729
+ h('div', { style: S.pageInner },
2714
2730
  toast
2715
2731
  ? h('div', {
2716
2732
  style: {
@@ -2741,6 +2757,7 @@ window.__ModuleLoader__.load({
2741
2757
  Section(M('工作区显示', 'Workspace visibility'), M('点工作区展开会话,点「修改」后才可切换状态;工作区与会话独立操作', 'Click a workspace to expand; click Edit to change states; workspaces and sections are independent'), [workspaceViewCard], 'workspace'),
2742
2758
  // 反馈放在最后一区
2743
2759
  Section(M('问题反馈', 'Feedback'), M('提交即建 GitHub Issue,跨机器共用;离线先排队', 'Each report becomes a GitHub Issue, shared across machines; offline reports queue locally'), [feedbackCard], 'feedback'),
2760
+ ),
2744
2761
  ),
2745
2762
  )
2746
2763
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.3.78",
3
+ "version": "0.3.80",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",
package/runtime/apply.ps1 CHANGED
@@ -900,6 +900,8 @@ $localPluginMap = [ordered]@{
900
900
  'dsh-our-free-model-2.8.0' = 'dsh-our-free-model'
901
901
  'dsh-purge-1.4.0' = 'dsh-purge'
902
902
  'dsh-config-sync-plugin-0.3.69' = 'dsh-config-sync-plugin'
903
+ 'dsh-config-sync-plugin-0.3.80' = 'dsh-config-sync-plugin'
904
+ 'dsh-config-sync-plugin-0.3.79' = 'dsh-config-sync-plugin'
903
905
  'dsh-config-sync-plugin-0.3.78' = 'dsh-config-sync-plugin'
904
906
  'dsh-config-sync-plugin-0.3.77' = 'dsh-config-sync-plugin'
905
907
  'dsh-config-sync-plugin-0.3.76' = 'dsh-config-sync-plugin'
@@ -919,7 +921,6 @@ $localPluginMap = [ordered]@{
919
921
  'dsh-config-sync-plugin-0.3.58' = 'dsh-config-sync-plugin'
920
922
  'dsh-config-sync-plugin-0.3.57' = 'dsh-config-sync-plugin'
921
923
  'dsh-config-sync-plugin-0.3.56' = 'dsh-config-sync-plugin'
922
- 'dsh-config-sync-0.1.0' = 'dsh-config-sync'
923
924
  }
924
925
  foreach ($dirName in $localPluginMap.Keys) {
925
926
  $pattern = 'link:[^"]*' + [regex]::Escape($dirName)
@@ -1245,6 +1246,15 @@ if (-not (Test-SyncGroupEnabled $Scope 'extra')) {
1245
1246
 
1246
1247
  # 读归档里的插件版本:tgz 里是 package/package.json,zip 里是 <目录名>/package.json 或根 package.json。
1247
1248
  # 读不出来返回 $null,调用方回退到 mtime 判据(不因为读不到就盲目重铺)。
1249
+ function Compare-PluginVersion([string]$a, [string]$b) {
1250
+ $pa = $null; $pb = $null
1251
+ if ($a -match '^v?(\d+)\.(\d+)\.(\d+)') { $pa = @([int]$matches[1], [int]$matches[2], [int]$matches[3]) }
1252
+ if ($b -match '^v?(\d+)\.(\d+)\.(\d+)') { $pb = @([int]$matches[1], [int]$matches[2], [int]$matches[3]) }
1253
+ if ((-not $pa) -or (-not $pb)) { return $null }
1254
+ for ($i = 0; $i -lt 3; $i++) { if ($pa[$i] -gt $pb[$i]) { return 1 }; if ($pa[$i] -lt $pb[$i]) { return -1 } }
1255
+ return 0
1256
+ }
1257
+
1248
1258
  function Get-ArchivePluginVersion([string]$archPath, [string]$dirName) {
1249
1259
  try {
1250
1260
  if ($archPath -like '*.tgz' -or $archPath -like '*.tar.gz') {
@@ -1310,7 +1320,8 @@ foreach ($dirName in $localPluginMap.Keys) {
1310
1320
  }
1311
1321
  $hasNewVersion = $false
1312
1322
  if ((Test-Path -LiteralPath $arch) -and $archVer -and $depVer) {
1313
- $hasNewVersion = ($archVer -ne $depVer)
1323
+ $cmpVer = Compare-PluginVersion $archVer $depVer
1324
+ if ($null -ne $cmpVer) { $hasNewVersion = ($cmpVer -gt 0) } else { $hasNewVersion = ($archVer -ne $depVer) }
1314
1325
  } elseif (Test-Path -LiteralPath $arch) {
1315
1326
  # 读不到版本(老归档、结构异常)时退回 mtime,但要求比已部署目录新 10 秒以上,避免每轮误判
1316
1327
  $archTime = (Get-Item -LiteralPath $arch).LastWriteTime
@@ -921,10 +921,29 @@ if ($PackLocalPlugins) {
921
921
  $p = Join-Path $linkPath 'package.json'
922
922
  if (Test-Path -LiteralPath $p) { $ver = (Get-Content -LiteralPath $p -Raw -Encoding utf8 | ConvertFrom-Json).version }
923
923
  Ok ("已打包 " + $dirName + "(version " + $ver + ",{0:N1} MB)" -f ((Get-Item -LiteralPath $zipPath).Length / 1MB))
924
- # 路径里若有版本号,和 package.json 的 version 对不上就提醒改名
925
- if ($dirName -match '([0-9]+\.[0-9]+\.[0-9]+)$' -and $ver -ne $Matches[1]) {
926
- Warn "目录名版本($($Matches[1])) 与插件实际版本($ver) 不一致,建议核对是否换了新版本"
927
- }
924
+ # 打包后强校验:归档内 package.json 必须在 dirName 第一层,其 version 必须与目录名版本号一致;不满足就删掉坏归档,避免同步到本机后解出嵌套旧目录
925
+ try {
926
+ Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction SilentlyContinue
927
+ $z = [IO.Compression.ZipFile]::OpenRead($zipPath)
928
+ $badZip = $false
929
+ try {
930
+ $pe = $z.Entries | Where-Object { $_.FullName -match ('^' + [regex]::Escape($dirName) + '[\\/]package\.json$') } | Select-Object -First 1
931
+ if (-not $pe) {
932
+ Warn ("打包校验失败:归档里缺 " + $dirName + " 顶层 package.json(可能多套了一层旧目录),删除坏归档")
933
+ $badZip = $true
934
+ } else {
935
+ $sr = New-Object IO.StreamReader($pe.Open())
936
+ try { $iv = [string](($sr.ReadToEnd()) | ConvertFrom-Json).version } finally { $sr.Dispose() }
937
+ if ($dirName -match '([0-9]+\.[0-9]+\.[0-9]+)$' -and $iv -ne $Matches[1]) {
938
+ Warn ("打包校验失败:目录名版本(" + $Matches[1] + ") 与归档内 version(" + $iv + ") 不一致,删除坏归档")
939
+ $badZip = $true
940
+ } else {
941
+ Ok ("打包校验通过:" + $dirName + "(version " + $iv + ",顶层目录名一致)")
942
+ }
943
+ }
944
+ } finally { try { $z.Dispose() } catch {} }
945
+ if ($badZip) { Remove-Item -LiteralPath $zipPath -Force -ErrorAction SilentlyContinue }
946
+ } catch { Warn ("无法校验归档结构:" + $_.Exception.Message + ",请人工核对 zip 内顶层目录名") }
928
947
  }
929
948
  }
930
949
 
@@ -1644,8 +1644,10 @@ console.log('== 配置同步页面 5 点调整 ==')
1644
1644
  const wvPos = cliSrc.indexOf("Section(M('工作区显示', 'Workspace visibility')")
1645
1645
  const fbPos = cliSrc.indexOf("Section(M('问题反馈', 'Feedback')")
1646
1646
  check('工作区显示卡片移到问题反馈前', wvPos > 0 && fbPos > 0 && wvPos < fbPos, '分区顺序')
1647
- // 5) 标题固定 + 快速跳转 tab:Section 支持 id 锚点、pageHeader sticky、tab 点击 scrollIntoView
1648
- check('标题固定:pageHeader sticky', cliSrc.includes("position: 'sticky'") && cliSrc.includes('zIndex: 50'), 'pageHeader sticky')
1647
+ // 5) 标题固定 + 快速跳转 tab:Section 支持 id 锚点、页头在滚动区之外、tab 点击 scrollIntoView
1648
+ check('标题固定:页头在滚动区之外(两段式布局,不再 sticky)',
1649
+ cliSrc.includes('pageHeaderWrap:') && cliSrc.includes('pageBody:')
1650
+ && !cliSrc.includes("position: 'sticky'"), 'pageHeader 两段式')
1649
1651
  check('快速跳转 tab:Section 带锚点 id', cliSrc.includes('function Section(title, hint, cards, id)') && cliSrc.includes("sync-section-' + id"), 'Section id')
1650
1652
  check('快速跳转 tab:点击后平滑滚动到对应卡片',
1651
1653
  cliSrc.includes("getElementById('sync-section-' + sid)")
@@ -1663,11 +1665,12 @@ console.log('== 配置同步页面 5 点调整 ==')
1663
1665
  // 7) 条件区(同步冲突/本机路径)按卡片是否存在动态出现在 tab
1664
1666
  check('快速跳转 tab:条件区 conflict/roots 动态过滤',
1665
1667
  cliSrc.includes('...(conflictCard ?') && cliSrc.includes('...(showRoots ?'), 'tab 条件区')
1666
- // 8) 内容不在标题背后显示:sticky 头部不透明背景 + 跳转按头部高度设 scrollMarginTop
1667
- check('滚动落点在标题下方:sticky 不透明背景 + 动态 scrollMarginTop',
1668
- cliSrc.includes('background: \'var(--dsw-alias-settings-card-fill, #fff)\'')
1669
- && cliSrc.includes('el.style.scrollMarginTop = (hh + 8)')
1670
- && cliSrc.includes('headerRef.current ? headerRef.current.offsetHeight'), '滚动遮挡')
1668
+ // 8) 滚动区从标题下方开始:页头不滚动、内容区独立 overflow 且落点是固定 8px
1669
+ check('滚动落点在标题下方:内容区独立滚动 + 固定 scrollMarginTop',
1670
+ /pageBody:\s*\{[^}]*overflowY: 'auto'/.test(cliSrc)
1671
+ && /pageBody:\s*\{[^}]*minHeight: 0/.test(cliSrc)
1672
+ && cliSrc.includes("scrollMarginTop: '8px'")
1673
+ && !cliSrc.includes('headerRef.current ? headerRef.current.offsetHeight'), '滚动遮挡')
1671
1674
  }
1672
1675
  process.exit(failures === 0 ? 0 : 1)
1673
1676