dsh-config-sync-plugin 0.3.91 → 0.3.92

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
+ ### Remote "uncommitted" now includes local pending changes + Refresh really fetches (0.3.92)
261
+
262
+ Root cause found by measurement for "remote info still not updating": the git-level behind/ahead really is 0 (local HEAD matches the gitee cloud), while what the user means by "not updated" is the runtime-generated changes on this machine not yet captured into the repo. Two substantive fixes:
263
+
264
+ 1. **"Uncommitted" = git work-tree changes + local pending**: the status `repo` object gains `pending` (local session/config changes not yet synced) and `uncommitted` (`dirty + pending`). Both "Remote" Kv rows in the panel use `uncommitted` for the uncommitted figure and append "(N pending on this machine)" when there are pending items. New local sessions/config changes show up immediately without waiting for DSH exit + capture.
265
+ 2. **"Refresh" button actually fetches**: the summary-row "Refresh" button previously only re-read status (no git fetch, so behind/ahead stayed the same). It now runs `refreshRemoteNow`: first `/config-sync/auto {action:'check'}` to trigger `git fetch` and refresh remote refs, then refresh the snapshot. The 30-second auto-refresh while expanded shares the same chain.
266
+
260
267
  ### Settings → General → Config Sync: live remote info + Pull/Push now buttons (0.3.91)
261
268
 
262
269
  Two adjustments to the "Settings → General → Config Sync" summary row:
@@ -697,6 +704,7 @@ The log shows which path ran: `文件比较(快筛):比对 N 个,深哈
697
704
 
698
705
  | Date | Version | Summary |
699
706
  |---|---|---|
707
+ | 2026-11-24 | 0.3.92 | Remote "uncommitted" now includes local pending data (pending); Refresh button really triggers git fetch; fixes "remote figures always 0" |
700
708
  | 2026-11-24 | 0.3.91 | Settings summary row fetches before refreshing remote info (no longer stale, auto-refresh every 30s); four generate-script buttons replaced with Pull/Push now (closes DSH) sharing the automation queue |
701
709
  | 2026-11-24 | 0.3.90 | Jump tabs highlight the current section; "Local data" label removed from To-do; To-do expands to concrete session names and local profile files |
702
710
  | 2026-11-24 | 0.3.89 | Plugin update card shows an "npm download URL"; falls back to two npm sources (mirror + official) when GitHub release is unreachable, still verified against the authoritative sha256 |
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
+ ### 远端「未提交」纳入本机待同步 + 刷新按钮真正 fetch(0.3.92)
281
+
282
+ 针对「远端信息还是没更新」的实测根因:git 层的「落后/领先」确实是 0(本机 HEAD 与云端 gitee 一致),用户说的「没更新」其实是本机运行期新产生、还没 capture 进仓库的待同步数据。这次做两处实质性改动:
283
+
284
+ 1. **「未提交」= git 工作树改动 + 本机待同步**:后端 status 的 `repo` 对象新增 `pending`(本机还没同步的会话/配置改动数)与 `uncommitted`(`dirty + pending`)两个字段。面板两处「远端」Kv 的「未提交」改用 `uncommitted`,并在有待同步项时追加「(本机待同步 N)」。这样本机有新会话/配置改动时数字立刻可见,不用等退出 DSH capture。
285
+ 2. **「刷新」按钮真正 fetch**:原来摘要行的「刷新」只重读 status(不触发 git fetch,落后/领先数照旧)。现在刷新按钮走 `refreshRemoteNow`:先 `/config-sync/auto {action:'check'}` 触发 `git fetch` 更新远端引用,再刷新快照;展开时的 30 秒自动刷新统一复用这条链。
286
+
280
287
  ### 设置-通用-配置同步:远端信息自动刷新 + 立即拉取/推送按钮(0.3.91)
281
288
 
282
289
  「设置 → 通用设置 → 配置同步」摘要行两处调整:
@@ -679,6 +686,7 @@ pwsh -File sync.ps1 push -ScanHistory
679
686
 
680
687
  | 日期 | 版本 | 要点 |
681
688
  |---|---|---|
689
+ | 2026-11-24 | 0.3.92 | 远端「未提交」纳入本机待同步数据(pending),刷新按钮真正触发 git fetch;解决「远端数字一直是 0」 |
682
690
  | 2026-11-24 | 0.3.91 | 设置-通用-配置同步摘要行展开时先 fetch 再刷新远端信息(不再陈旧、每 30 秒自动刷新);四个生成脚本按钮换成「立即拉取/推送(会关闭 DSH)」两个,走自动同步同一队列 |
683
691
  | 2026-11-24 | 0.3.90 | 顶部跳转按钮跟随当前位置高亮;待办去掉「本机数据」字眼、可展开看具体会话记录名与本机 profile |
684
692
  | 2026-11-24 | 0.3.89 | 插件更新卡新增「npm 下载路径」;npm 双源(镜像+官方)兜底下载,仍按权威 sha256 校验 |
package/client.js CHANGED
@@ -696,8 +696,8 @@ window.__ModuleLoader__.load({
696
696
  k: M('远端', 'Remote'),
697
697
  v: repo.exists
698
698
  ? M(
699
- `落后 ${repo.behind ?? '?'} · 领先 ${repo.ahead ?? '?'} · 未提交 ${repo.dirty ?? '?'}`,
700
- `behind ${repo.behind ?? '?'} · ahead ${repo.ahead ?? '?'} · dirty ${repo.dirty ?? '?'}`,
699
+ `落后 ${repo.behind ?? '?'} · 领先 ${repo.ahead ?? '?'} · 未提交 ${repo.uncommitted ?? repo.dirty ?? '?'}` + (repo.pending ? `(本机待同步 ${repo.pending})` : ''),
700
+ `behind ${repo.behind ?? '?'} · ahead ${repo.ahead ?? '?'} · uncommitted ${repo.uncommitted ?? repo.dirty ?? '?'}` + (repo.pending ? ` (${repo.pending} pending on this machine)` : ''),
701
701
  )
702
702
  : (repo.empty ? M('(拉取之后才有得比)', '(available after the first pull)') : M('(不可用)', '(unavailable)')),
703
703
  }),
@@ -3466,21 +3466,20 @@ window.__ModuleLoader__.load({
3466
3466
  const canPull = repo.pullAllowed === true
3467
3467
  const canPush = repo.pushAllowed === true
3468
3468
 
3469
- // 远端信息不更新的根因:inspect() 的落后/领先数来自 git rev-list HEAD...@{upstream},
3470
- // 而 @{upstream} 只有 git fetch 之后才反映云端最新,光 refresh() 拿到的还是旧引用。
3471
- // 所以展开这里先打一次 /config-sync/auto {action:'check'}(它会 fetch 云端更新远端引用),
3472
- // 再 refresh() 拉新快照;展开期间每 30 秒重复一次。
3469
+ // 远端数字不刷新的根因有两层:
3470
+ // 1) 落后/领先来自 git tracking ref,必须 fetch 才更新 —— check 动作会 fetch;
3471
+ // 2) 用户说的「没更新」还包括本机还没 capture 进仓库的待同步数据 —— 后端已并进 repo.uncommitted/pending。
3472
+ // 「刷新」按钮与展开时的自动刷新都走这条链:先 check(fetch),再 refresh 拉新快照。
3473
+ const refreshRemoteNow = react.useCallback(async () => {
3474
+ try { await callAuto({ action: 'check' }) } catch { /* 离线就按本机缓存显示,不打扰 */ }
3475
+ refresh()
3476
+ }, [refresh])
3473
3477
  react.useEffect(() => {
3474
3478
  if (!open) return
3475
- let alive = true
3476
- const refreshRemoteNow = async () => {
3477
- try { await callAuto({ action: 'check' }) } catch { /* 离线就按本机缓存显示,不打扰 */ }
3478
- if (alive) refresh()
3479
- }
3480
3479
  refreshRemoteNow()
3481
3480
  const timer = setInterval(refreshRemoteNow, 30000)
3482
- return () => { alive = false; clearInterval(timer) }
3483
- }, [open, refresh])
3481
+ return () => { clearInterval(timer) }
3482
+ }, [open, refreshRemoteNow])
3484
3483
 
3485
3484
  // 立即拉取 / 立即推送:和大面板「自动同步」卡同一条 /config-sync/auto 队列,
3486
3485
  // 点完排队、关掉 DSH 后由 post-exit.ps1 真正执行(本进程不自己动手)。
@@ -3504,7 +3503,7 @@ window.__ModuleLoader__.load({
3504
3503
  h('div', { style: { display: 'flex', gap: '8px', alignItems: 'center', flexShrink: 0 } },
3505
3504
  h('span', { style: chipStyle(summary.kind) }, chipLabel(summary.kind)),
3506
3505
  h('button', { type: 'button', style: S.btn, onClick: () => setOpen((v) => !v) }, open ? M('收起', 'Collapse') : M('查看', 'View')),
3507
- h('button', { type: 'button', style: S.btn, disabled: busy, onClick: refresh }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
3506
+ h('button', { type: 'button', style: S.btn, disabled: busy, onClick: refreshRemoteNow }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
3508
3507
  ),
3509
3508
  )
3510
3509
 
@@ -3528,8 +3527,8 @@ window.__ModuleLoader__.load({
3528
3527
  v: data.repo.behind === null
3529
3528
  ? M('读不到', 'Unavailable')
3530
3529
  : M(
3531
- `落后 ${data.repo.behind} · 领先 ${data.repo.ahead} · 未提交 ${data.repo.dirty}`,
3532
- `behind ${data.repo.behind} · ahead ${data.repo.ahead} · dirty ${data.repo.dirty}`,
3530
+ `落后 ${data.repo.behind} · 领先 ${data.repo.ahead} · 未提交 ${data.repo.uncommitted ?? data.repo.dirty}` + (data.repo.pending ? `(本机待同步 ${data.repo.pending})` : ''),
3531
+ `behind ${data.repo.behind} · ahead ${data.repo.ahead} · uncommitted ${data.repo.uncommitted ?? data.repo.dirty}` + (data.repo.pending ? ` (${data.repo.pending} pending on this machine)` : ''),
3533
3532
  ),
3534
3533
  }) : null,
3535
3534
  data ? h(Kv, {
package/index.js CHANGED
@@ -1119,6 +1119,10 @@ async function inspect(config) {
1119
1119
  dirty,
1120
1120
  ahead,
1121
1121
  behind,
1122
+ // 本机待同步(还没 capture 进仓库的会话/配置改动),与 git 工作树 dirty 是两件事。
1123
+ pending: (local && local.pending) || 0,
1124
+ // 面板上用户理解的「未提交」= git 工作树改动 + 本机还没同步的改动,反映「还没进云端的本机改动总数」。
1125
+ uncommitted: (dirty || 0) + ((local && local.pending) || 0),
1122
1126
  },
1123
1127
  version: { local: localVersion, contract: contractVersion, electron: electronVersion, match: versionMatch },
1124
1128
  // 本机数据侧:上次同步时间 + 「之后又写过多少文件」,与 repo.dirty 是两件事
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.3.91",
3
+ "version": "0.3.92",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",
@@ -118,9 +118,14 @@ check('面板有「提交说明」输入(生成推送脚本时带上)', sour
118
118
  check('按钮文案用中文(推送 / 拉取)', source.includes("'只生成推送'") && source.includes("'只生成拉取'"))
119
119
  // 0.3.91:设置 → 通用 摘要行的远端信息会刷新,按钮换成「立即拉取/推送(会关闭 DSH)」
120
120
  check('设置摘要行展开时 fetch 远端再刷新(远端信息不陈旧)',
121
- source.includes('const refreshRemoteNow = async () =>')
121
+ source.includes('const refreshRemoteNow = react.useCallback(async () =>')
122
122
  && source.includes("callAuto({ action: 'check' })")
123
- && source.includes('setInterval(refreshRemoteNow, 30000)'))
123
+ && source.includes('setInterval(refreshRemoteNow, 30000)')
124
+ && source.includes('onClick: refreshRemoteNow'))
125
+ check('远端「未提交」纳入本机待同步、刷新按钮触发 fetch(0.3.92)',
126
+ source.includes('repo.uncommitted ?? repo.dirty')
127
+ && source.includes('data.repo.uncommitted ?? data.repo.dirty')
128
+ && source.includes('本机待同步 ${data.repo.pending}'))
124
129
  check('设置摘要行两个立即按钮走 pull-now / push-now 队列',
125
130
  source.includes("actNow('pull-now')")
126
131
  && source.includes("actNow('push-now')")