dsh-config-sync-plugin 0.3.89 → 0.3.91

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
@@ -253,9 +253,25 @@ 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
- ### Plugin update falls back to npm download (0.3.89)
256
+ ### Plugin update falls back to two npm sources (0.3.89)
257
257
 
258
- The "Plugin update" card now shows an **npm download URL** line with the actual fallback address (`https://registry.npmmirror.com/dsh-config-sync-plugin/-/dsh-config-sync-plugin-<ver>.tgz`). When the GitHub release download is unreachable (common in mainland China), the update package automatically falls back to the npm mirror. It is still verified against the authoritative sha256 in `version.json` — switching source never relaxes verification. The npm tarball is byte-identical to the GitHub release tgz (same sha256).
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
+
260
+ ### Settings → General → Config Sync: live remote info + Pull/Push now buttons (0.3.91)
261
+
262
+ Two adjustments to the "Settings → General → Config Sync" summary row:
263
+
264
+ 1. **Remote info no longer stale**: expanding the row first requests the `check` action on `/config-sync/auto` (triggering `git fetch` to refresh `@{upstream}`) and then refreshes status, so "behind X · ahead Y · uncommitted Z" shows the latest cloud figures instead of stale ones; it refreshes every 30 seconds while expanded and stops when collapsed. Root cause: the behind/ahead counts from `@{upstream}` only update after a fetch — a plain status read never triggers one.
265
+ 2. **Buttons replaced with Pull/Push now**: the four "Generate scripts / push only / pull only / restore only" buttons are replaced by two — **Pull now (closes DSH)** and **Push now (closes DSH)** — sharing the same `pull-now` / `push-now` queue as the main panel's Automation card: clicking queues the action, which runs after DSH exits. Buttons are gated by backend permissions (`pullAllowed` / `pushAllowed`) with hints (empty repo → push first; empty cloud → pull first), and queued/result states give Chinese feedback. The script-generation entry remains on the main panel and is no longer duplicated in the summary row.
266
+
267
+ ### To-do and jump-tab display cleanup (0.3.90)
268
+
269
+ Four display adjustments to the panel:
270
+
271
+ 1. **Jump tabs highlight the current position**: the quick-jump tabs now auto-highlight the topmost visible section in the scroll region (primary fill + primary text), so "where am I" is obvious at a glance; clicking a tab also lights it up immediately.
272
+ 2. **"Local data" label removed from To-do**: the old subheading-like "Local data / 本机数据" row is gone; the To-do card presents its stats and details directly without the redundant title.
273
+ 3. **To-do expands to concrete names**: each group (Conversations / Local profile / Skills …) is one row; click it to reveal the concrete names — sessions show the session title (or `<sessionId> (session)` when unavailable), and the local profile shows file names like `package.json`, `cordis.patch.yml`; each group is de-duplicated and capped at 50 items. The To-do card title row has an Expand / Collapse toggle, expanded by default so details are visible on entry.
274
+ 4. **Overview description synced**: changed to "Versions, dependencies, snapshots and to-do at a glance".
259
275
 
260
276
  ### Local data moved into To-do, grouped by sync content, sessions shown by name (0.3.86)
261
277
 
@@ -681,7 +697,9 @@ The log shows which path ran: `文件比较(快筛):比对 N 个,深哈
681
697
 
682
698
  | Date | Version | Summary |
683
699
  |---|---|---|
684
- | 2026-11-24 | 0.3.89 | Plugin update card shows an "npm download URL"; falls back to the npm mirror when GitHub release is unreachable, still verified against the authoritative sha256 |
700
+ | 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
+ | 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
+ | 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 |
685
703
  | 2026-11-23 | 0.3.86 | Moved "Local data" into Overview / To-do, grouped pending files by the twelve sync-content groups, and show session names instead of session ids in the sample |
686
704
  | 2026-11-23 | 0.3.85 | Removed the tinted banner above the workspace list in edit mode; edit state is read from the Edit/Done button in the header |
687
705
  | 2026-11-23 | 0.3.84 | Workspace visibility card uses one Edit button for the whole card; each session row carries its own toggle with a background and divider, hidden names struck through |
package/README.md CHANGED
@@ -273,9 +273,25 @@ pwsh -File runtime\sync.ps1 pull `
273
273
  1. **跳转顺序对齐卡片**:快捷标签顺序改为与分区实际渲染顺序完全一致(概览 / 同步冲突[有冲突时] / 本机路径[展开时] / 同步目标 / 自动化与插件更新 / 生成脚本 / 还原备份 / 同步内容 / 插件数据 / 工作区显示 / 问题反馈)。同步冲突、本机路径两个条件分区只在卡片存在时才出现在标签里。
274
274
  2. **滚动落点在标题下方**:标题栏改为不透明背景(面板卡片同色),滚动时内容不再从标题背后透出;点标签跳转时按标题栏实际高度设置滚动落点,目标分区完整显示在标题下方,不再被遮住。
275
275
 
276
- ### 插件更新支持 npm 兜底下载(0.3.89)
276
+ ### 插件更新支持 npm 双源兜底下载(0.3.89)
277
277
 
278
- 「插件更新」卡新增一行 **npm 下载路径**,直接显示实际兜底地址(`https://registry.npmmirror.com/dsh-config-sync-plugin/-/dsh-config-sync-plugin-<ver>.tgz`)。GitHub release 整段不通时(国内常见),更新包会自动兜底从 npm 镜像下载;仍按 `version.json` 里的权威 sha256 校验,换源不放宽校验。实测 npm tarball 与 GitHub release tgz 是同一份产物、sha256 完全一致。
278
+ 「插件更新」卡新增一行 **npm 下载路径**,直接显示实际兜底地址(国内镜像 `registry.npmmirror.com` + 官方 `registry.npmjs.org` 两个源)。GitHub release 整段不通时(国内常见),更新包会自动兜底从 npm 下载;仍按 `version.json` 里的权威 sha256 校验,换源不放宽校验。两个源互为备份:镜像首发同步窗口期会短暂 404,官方源随即兜上。实测 npm tarball 与 GitHub release tgz 是同一份产物、sha256 完全一致。
279
+
280
+ ### 设置-通用-配置同步:远端信息自动刷新 + 立即拉取/推送按钮(0.3.91)
281
+
282
+ 「设置 → 通用设置 → 配置同步」摘要行两处调整:
283
+
284
+ 1. **远端信息不再陈旧**:展开这一行时会先请求 `/config-sync/auto` 的 `check` 动作(触发 `git fetch` 更新 `@{upstream}`),再刷新状态,远端「落后 X · 领先 Y · 未提交 Z」显示的是云端最新值而非旧值;展开期间每 30 秒自动刷新一次,收起即停。根因是 `@{upstream}` 的落后/领先数只在 fetch 后才更新,单纯读 status 不会触发 fetch。
285
+ 2. **按钮换成「立即拉取 / 立即推送」**:原来四个「生成脚本 / 只生成推送 / 只生成拉取 / 只生成还原」按钮换成两个 —— **立即拉取(会关闭 DSH)** 与 **立即推送(会关闭 DSH)**,和主面板「自动同步」卡走同一条 `pull-now` / `push-now` 队列:点击即排队、退出 DSH 后执行。按钮按后端门禁(`pullAllowed` / `pushAllowed`)置灰并给出提示(空仓库先推 / 云端为空先拉),排队中与结果都有中文反馈。原「生成脚本」入口保留在主面板,摘要行不再重复。
286
+
287
+ ### 待办与跳转按钮的显示梳理(0.3.90)
288
+
289
+ 面板的四处显示调整:
290
+
291
+ 1. **跳转按钮跟随当前位置高亮**:顶部快捷标签现在会按滚动区里最靠上的可见分区自动高亮(主色底 + 主色字),一眼看出「现在在哪一区」;点按钮跳转也会立即点亮对应标签。
292
+ 2. **待办去掉「本机数据」字眼**:原本地位等同小标题的「本机数据 / Local data」行删掉,待办卡直接以统计与明细呈现,不再重复冠名。
293
+ 3. **待办可展开具体名称**:每个分组(会话记录 / 本机 profile / Skills …)一行,点它展开看该组的具体名称 —— 会话显示会话记录标题(读不到时显示 `<sessionId>(会话)`),本机 profile 显示 `package.json`、`cordis.patch.yml` 等文件名,每项按组去重、最多列 50 条。待办卡标题行有「展开 / 收起」总开关,默认展开,进来即可见明细。
294
+ 4. **概览说明同步**:分区说明改为「版本、依赖、快照与待办一眼看完」。
279
295
 
280
296
  ### 本机数据挪进待办 + 按同步内容分组 + 会话显示会话名(0.3.86)
281
297
 
@@ -663,7 +679,9 @@ pwsh -File sync.ps1 push -ScanHistory
663
679
 
664
680
  | 日期 | 版本 | 要点 |
665
681
  |---|---|---|
666
- | 2026-11-24 | 0.3.89 | 插件更新卡新增「npm 下载路径」;GitHub release 不通时兜底 npm 镜像下载,仍按权威 sha256 校验 |
682
+ | 2026-11-24 | 0.3.91 | 设置-通用-配置同步摘要行展开时先 fetch 再刷新远端信息(不再陈旧、每 30 秒自动刷新);四个生成脚本按钮换成「立即拉取/推送(会关闭 DSH)」两个,走自动同步同一队列 |
683
+ | 2026-11-24 | 0.3.90 | 顶部跳转按钮跟随当前位置高亮;待办去掉「本机数据」字眼、可展开看具体会话记录名与本机 profile |
684
+ | 2026-11-24 | 0.3.89 | 插件更新卡新增「npm 下载路径」;npm 双源(镜像+官方)兜底下载,仍按权威 sha256 校验 |
667
685
  | 2026-11-23 | 0.3.86 | 「本机数据」挪进概览-待办,按同步内容的 12 组口径分类统计,会话样本显示会话标题而非 session id |
668
686
  | 2026-11-23 | 0.3.85 | 去掉工作区显示卡片编辑态的强调色说明条,编辑与否只看标题行「修改」/「完成」按钮 |
669
687
  | 2026-11-23 | 0.3.84 | 工作区显示卡片改成整卡一个「修改」按钮;会话行自带开关、加底色与分隔线,隐藏态删除线 |
package/client.js CHANGED
@@ -2231,6 +2231,13 @@ window.__ModuleLoader__.load({
2231
2231
  // 「本机路径」平时不占版面:只在标题行按钮被点开时才渲染;按钮本身在
2232
2232
  // 「根外路径 / 被覆盖的配置」两类告警下变橙并带数字(待确认路径不算告警)。
2233
2233
  const [showRoots, setShowRoots] = react.useState(false)
2234
+ // 待办明细展开态:按分组 id 记,点分组标题即展开/收起该组的具体名称(会话记录名 / 本机 profile 文件)
2235
+ const [pendingOpen, setPendingOpen] = react.useState({})
2236
+ // 待办卡总开关:默认展开,让具体会话记录名 / 本机 profile 一进来就可见
2237
+ const [pendingDetailOpen, setPendingDetailOpen] = react.useState(true)
2238
+ // 顶部跳转按钮的当前位置高亮:跟随滚动区里最靠上的可见分区
2239
+ const [activeSection, setActiveSection] = react.useState('overview')
2240
+ const bodyRef = react.useRef(null)
2234
2241
  // 定时器放 ref 里:数据每刷新一次 effect 就会重跑,若在 effect 里 return 清理函数,
2235
2242
  // 会把还没到点的"5 秒后消失"定时器一起清掉,提示就一直挂在屏幕上。
2236
2243
  const toastTimer = react.useRef(null)
@@ -2263,6 +2270,29 @@ window.__ModuleLoader__.load({
2263
2270
  return () => { alive = false; clearInterval(timer) }
2264
2271
  }, [])
2265
2272
 
2273
+ // 滚动时找出最靠近滚动区顶部的分区,作为顶部跳转按钮的高亮目标。
2274
+ // 分区是动态的(冲突/本机路径卡可能不渲染),所以直接查 DOM 而不是维护一份 id 表。
2275
+ react.useEffect(() => {
2276
+ const body = bodyRef.current
2277
+ if (!body) return
2278
+ let raf = 0
2279
+ const update = () => {
2280
+ raf = 0
2281
+ const top = body.getBoundingClientRect().top
2282
+ const nodes = body.querySelectorAll('[id^="sync-section-"]')
2283
+ let current = ''
2284
+ for (const el of nodes) {
2285
+ if (el.getBoundingClientRect().top - top <= 28) current = el.id.slice('sync-section-'.length)
2286
+ else break
2287
+ }
2288
+ if (current) setActiveSection((prev) => (prev === current ? prev : current))
2289
+ }
2290
+ const onScroll = () => { if (!raf) raf = requestAnimationFrame(update) }
2291
+ body.addEventListener('scroll', onScroll, { passive: true })
2292
+ const t = setTimeout(update, 0) // 数据变化、DOM 重排后再算一次
2293
+ return () => { body.removeEventListener('scroll', onScroll); if (raf) cancelAnimationFrame(raf); clearTimeout(t) }
2294
+ }, [data])
2295
+
2266
2296
  const showToast = (text) => {
2267
2297
  setToast(text)
2268
2298
  if (toastTimer.current) clearTimeout(toastTimer.current)
@@ -2626,38 +2656,67 @@ window.__ModuleLoader__.load({
2626
2656
  return local.pending > 0 ? M(`${base}(+${local.pending})`, `${base} (+${local.pending})`) : base
2627
2657
  })(), data && data.local && data.local.pending > 0 ? 'warn' : 'ok'),
2628
2658
  )
2629
- // 本机数据(原「本机仓库」卡里的一行)挪进待办:按「同步内容」分组列出待推送项,会话显示会话名
2659
+ // 待办:按「同步内容」分组列出待推送项,点分组展开看具体名称(会话记录名 / 本机 profile 文件)
2630
2660
  const localBlock = data && data.local && data.local.known ? (() => {
2631
2661
  const local = data.local
2632
2662
  const when = local.lastSyncAt ? new Date(local.lastSyncAt).toLocaleString(localeNow(), { hour12: false }) : '?'
2633
2663
  const groups = Array.isArray(local.groups) ? local.groups : []
2634
- const head = h('div', { style: { ...S.cardTitle, marginBottom: '4px' } }, M('本机数据', 'Local data'))
2635
2664
  const meta = h('div', { style: S.footnote }, M(
2636
2665
  `上次同步 ${when} · ${local.pending > 0 ? `有 ${local.pending} 个文件待推送` : '没有新写入'}${local.mode ? `(${local.mode})` : ''}`,
2637
2666
  `Last sync ${when} · ${local.pending > 0 ? `${local.pending} file(s) to push` : 'nothing new'}${local.mode ? ` (${local.mode})` : ''}`,
2638
2667
  ))
2668
+ // 每组一行:分组名 + 数量 + 展开箭头;展开后列出该组的具体名称
2639
2669
  const groupRows = groups.length
2640
- ? h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: '6px' } }, groups.map((g, i) =>
2641
- h('div', {
2642
- key: i,
2643
- style: { ...S.chip, background: 'var(--dsw-alias-fill-l1, var(--dsw-alias-border-l1))' },
2644
- }, `${langIsZh() ? g.zh : g.en} · ${g.count}`)))
2645
- : null
2646
- const sampleRow = Array.isArray(local.sample) && local.sample.length
2647
- ? h('div', { style: S.footnote }, M(
2648
- `最近写入:${local.sample.join('、')}`,
2649
- `Recently changed: ${local.sample.join(', ')}`,
2650
- ))
2670
+ ? h('div', { style: { display: 'flex', flexDirection: 'column', gap: '4px' } }, groups.map((g, i) => {
2671
+ const open = pendingOpen[g.id] === true
2672
+ const items = Array.isArray(g.items) ? g.items : []
2673
+ const canExpand = items.length > 0
2674
+ return h('div', { key: g.id || i, style: { display: 'flex', flexDirection: 'column', gap: '2px' } },
2675
+ h('div', {
2676
+ style: { display: 'flex', alignItems: 'center', gap: '6px', cursor: canExpand ? 'pointer' : 'default', borderRadius: '6px', padding: '2px 4px' },
2677
+ title: canExpand ? (open ? M('点击收起明细', 'Click to collapse') : M('点击展开明细', 'Click to expand')) : undefined,
2678
+ onClick: canExpand ? () => setPendingOpen((prev) => ({ ...prev, [g.id]: !open })) : undefined,
2679
+ },
2680
+ h('span', { style: { flexShrink: 0, width: '10px', fontSize: '11px', color: 'var(--dsw-alias-label-tertiary)' } }, canExpand ? (open ? '▾' : '▸') : ''),
2681
+ h('span', { style: { ...S.chip, background: 'var(--dsw-alias-fill-l1, var(--dsw-alias-border-l1))' } }, langIsZh() ? g.zh : g.en),
2682
+ h('span', { style: { ...S.footnote, color: 'var(--dsw-alias-label-tertiary)' } }, `×${g.count}`),
2683
+ ),
2684
+ open && canExpand
2685
+ ? h('div', { style: { display: 'flex', flexDirection: 'column', gap: '2px', padding: '2px 0 2px 20px' } },
2686
+ items.map((name, j) => h('div', {
2687
+ key: j,
2688
+ style: { ...S.footnote, fontFamily: 'Consolas, ui-monospace, monospace', wordBreak: 'break-all' },
2689
+ }, name)),
2690
+ g.count > items.length
2691
+ ? h('div', { style: { ...S.footnote, opacity: 0.7 } }, M(`还有 ${g.count - items.length} 项未列出`, `${g.count - items.length} more not listed`))
2692
+ : null,
2693
+ )
2694
+ : null,
2695
+ )
2696
+ }))
2651
2697
  : null
2652
- return h('div', { style: { display: 'flex', flexDirection: 'column', gap: '4px' } }, head, meta, groupRows, sampleRow)
2698
+ return h('div', { style: { display: 'flex', flexDirection: 'column', gap: '4px' } }, meta, groupRows)
2653
2699
  })() : null
2654
2700
 
2655
2701
  const overview = h('div', { style: { gridColumn: '1 / -1', display: 'flex', flexDirection: 'column', gap: '8px' } },
2656
2702
  metrics,
2657
2703
  (localBlock || (data && Array.isArray(data.advice) && data.advice.length))
2658
2704
  ? h('div', { style: { ...S.card, gap: '6px', padding: '10px 13px' } },
2659
- h('div', { style: S.cardTitle }, M('待办', 'To-do')),
2660
- localBlock,
2705
+ h('div', { style: S.cardHead },
2706
+ h('div', { style: S.cardTitle }, M('待办', 'To-do')),
2707
+ localBlock
2708
+ ? h('button', {
2709
+ type: 'button',
2710
+ style: { marginLeft: 'auto', fontSize: '11px', lineHeight: '16px', padding: '1px 8px', borderRadius: '6px', cursor: 'pointer', border: '1px solid var(--dsw-alias-border-l2)', background: 'var(--dsw-alias-bg-base)', color: 'var(--dsw-alias-label-secondary)' },
2711
+ title: pendingDetailOpen ? M('收起待办明细', 'Collapse details') : M('展开待办明细', 'Expand details'),
2712
+ onClick: () => setPendingDetailOpen((v) => !v),
2713
+ }, pendingDetailOpen ? M('收起', 'Collapse') : M('展开', 'Expand'))
2714
+ : null,
2715
+ ),
2716
+ pendingDetailOpen ? localBlock : (localBlock ? h('div', { style: S.footnote }, M(
2717
+ `${data.local.pending > 0 ? `有 ${data.local.pending} 个文件待推送` : '没有新写入'} · 点「展开」看具体会话记录与本机 profile`,
2718
+ `${data.local.pending > 0 ? `${data.local.pending} file(s) to push` : 'nothing new'} · click Expand for session names and local profile`,
2719
+ )) : null),
2661
2720
  data && Array.isArray(data.advice) && data.advice.length ? h(Advice, { items: data.advice }) : null)
2662
2721
  : null,
2663
2722
  )
@@ -2815,18 +2874,31 @@ window.__ModuleLoader__.load({
2815
2874
  ['feedback', M('问题反馈', 'Feedback')],
2816
2875
  ].map((pair) => {
2817
2876
  const sid = pair[0], label = pair[1]
2877
+ // 当前所处的分区:主色底 + 主色字,和概览区标题竖条同一套视觉锚点
2878
+ const active = activeSection === sid
2818
2879
  return h('button', {
2819
2880
  key: sid, type: 'button',
2820
- style: { fontSize: '12px', lineHeight: '18px', padding: '3px 10px', borderRadius: '6px', border: '1px solid transparent', background: 'transparent', color: 'var(--dsw-alias-label-secondary)', cursor: 'pointer' },
2821
- title: M('跳转到此区', 'Jump to section'),
2822
- onClick: () => { const el = document.getElementById('sync-section-' + sid); if (!el || !el.scrollIntoView) return; el.scrollIntoView({ behavior: 'smooth', block: 'start' }) },
2881
+ style: {
2882
+ fontSize: '12px', lineHeight: '18px', padding: '3px 10px', borderRadius: '6px', cursor: 'pointer',
2883
+ border: '1px solid ' + (active ? 'var(--dsw-alias-toast-action)' : 'transparent'),
2884
+ background: active ? 'var(--dsw-alias-toast-action)' : 'transparent',
2885
+ color: active ? 'var(--dsw-alias-label-primary-foreground, var(--dsw-alias-label-primary))' : 'var(--dsw-alias-label-secondary)',
2886
+ fontWeight: active ? 600 : 400,
2887
+ },
2888
+ title: active ? M('当前所在区', 'Current section') : M('跳转到此区', 'Jump to section'),
2889
+ onClick: () => {
2890
+ setActiveSection(sid)
2891
+ const el = document.getElementById('sync-section-' + sid)
2892
+ if (!el || !el.scrollIntoView) return
2893
+ el.scrollIntoView({ behavior: 'smooth', block: 'start' })
2894
+ },
2823
2895
  }, label)
2824
2896
  }),
2825
2897
  ),
2826
2898
  ),
2827
2899
  ),
2828
2900
  ),
2829
- h('div', { style: S.pageBody },
2901
+ h('div', { ref: bodyRef, style: S.pageBody },
2830
2902
  h('div', { style: S.pageInner },
2831
2903
  toast
2832
2904
  ? h('div', {
@@ -2843,7 +2915,7 @@ window.__ModuleLoader__.load({
2843
2915
  : null,
2844
2916
  err ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-error-primary)' } }, M(`读取失败:${err}`, `Read failed: ${err}`)) : null,
2845
2917
  // 按内容分区:状态在上、配置居中、动作在下;每区内部网格并排(宽屏两列)
2846
- Section(M('概览', 'Overview'), M('版本、依赖、快照一眼看完', 'Versions, dependencies and snapshots at a glance'), [overview], 'overview'),
2918
+ Section(M('概览', 'Overview'), M('版本、依赖、快照与待办一眼看完', 'Versions, dependencies, snapshots and to-do at a glance'), [overview], 'overview'),
2847
2919
  conflictCard
2848
2920
  ? Section(M('同步冲突', 'Sync conflicts'), M('这些文件挡住了拉取:逐项选完保存,再点「立即拉取」', 'These files block the pull: pick per file, save, then pull'), [conflictCard], 'conflict')
2849
2921
  : null,
@@ -3384,9 +3456,44 @@ window.__ModuleLoader__.load({
3384
3456
 
3385
3457
  /** 设置 → 通用 里的一行摘要(保留入口,不重复大面板)。 */
3386
3458
  function ConfigSyncRow() {
3387
- const { data, err, busy, made, refresh, prepare } = useSync()
3459
+ const { data, err, busy, refresh } = useSync()
3388
3460
  const [open, setOpen] = react.useState(false)
3461
+ const [actBusy, setActBusy] = react.useState('')
3462
+ const [actMsg, setActMsg] = react.useState('')
3463
+ const [actErr, setActErr] = react.useState('')
3389
3464
  const summary = summarize(data)
3465
+ const repo = (data && data.repo) || {}
3466
+ const canPull = repo.pullAllowed === true
3467
+ const canPush = repo.pushAllowed === true
3468
+
3469
+ // 远端信息不更新的根因:inspect() 的落后/领先数来自 git rev-list HEAD...@{upstream},
3470
+ // 而 @{upstream} 只有 git fetch 之后才反映云端最新,光 refresh() 拿到的还是旧引用。
3471
+ // 所以展开这里先打一次 /config-sync/auto {action:'check'}(它会 fetch 云端更新远端引用),
3472
+ // 再 refresh() 拉新快照;展开期间每 30 秒重复一次。
3473
+ react.useEffect(() => {
3474
+ if (!open) return
3475
+ let alive = true
3476
+ const refreshRemoteNow = async () => {
3477
+ try { await callAuto({ action: 'check' }) } catch { /* 离线就按本机缓存显示,不打扰 */ }
3478
+ if (alive) refresh()
3479
+ }
3480
+ refreshRemoteNow()
3481
+ const timer = setInterval(refreshRemoteNow, 30000)
3482
+ return () => { alive = false; clearInterval(timer) }
3483
+ }, [open, refresh])
3484
+
3485
+ // 立即拉取 / 立即推送:和大面板「自动同步」卡同一条 /config-sync/auto 队列,
3486
+ // 点完排队、关掉 DSH 后由 post-exit.ps1 真正执行(本进程不自己动手)。
3487
+ const actNow = async (action) => {
3488
+ setActBusy(action); setActErr(''); setActMsg('')
3489
+ try {
3490
+ const res = await callAuto({ action })
3491
+ setActMsg(res.closeRequested
3492
+ ? M('已排队:客户端马上关闭,退出后执行;拉取完成后按设置自动重开', 'Queued: the client closes now and the sync runs after exit; it relaunches per your settings when pulling finishes')
3493
+ : M('已排队:退出 DSH 后自动执行', 'Queued: runs automatically after DSH exits'))
3494
+ refresh()
3495
+ } catch (e) { setActErr(String((e && e.message) || e)) } finally { setActBusy('') }
3496
+ }
3390
3497
 
3391
3498
  const head = h('div', { style: S.head },
3392
3499
  h('div', { style: S.headText },
@@ -3436,12 +3543,23 @@ window.__ModuleLoader__.load({
3436
3543
  data && data.remote ? h(Kv, { k: M('SSH 私钥', 'SSH key'), v: data.remote.sshKey || M('(未配置)', '(not set)') }) : null,
3437
3544
  data ? h(Advice, { items: data.advice }) : null,
3438
3545
  h('div', { style: S.actions },
3439
- h('button', { type: 'button', style: S.btnPrimary, disabled: busy || !data || !data.repo.exists, onClick: () => prepare('all') }, M('一键生成 推送 / 拉取 / 还原', 'Generate push / pull / restore')),
3440
- h('button', { type: 'button', style: S.btn, disabled: busy || !data || !data.repo.exists, onClick: () => prepare('push') }, M('只生成推送', 'Push only')),
3441
- h('button', { type: 'button', style: S.btn, disabled: busy || !data || !data.repo.exists, onClick: () => prepare('pull') }, M('只生成拉取', 'Pull only')),
3442
- h('button', { type: 'button', style: S.btn, disabled: busy || !data || !data.repo.exists, onClick: () => prepare('restore') }, M('只生成还原', 'Restore only')),
3546
+ h('button', {
3547
+ type: 'button',
3548
+ style: canPull ? S.btnPrimary : { ...S.btnPrimary, opacity: 0.5, cursor: 'not-allowed' },
3549
+ disabled: Boolean(actBusy) || !canPull,
3550
+ title: canPull ? '' : M('云端还是空的:没有内容可拉,先「立即推送」', 'The cloud is still empty — nothing to pull, push first'),
3551
+ onClick: () => actNow('pull-now'),
3552
+ }, actBusy === 'pull-now' ? M('排队中…', 'Queueing…') : M('立即拉取(会关闭 DSH)', 'Pull now (closes DSH)')),
3553
+ h('button', {
3554
+ type: 'button',
3555
+ style: canPush ? S.btnPrimary : { ...S.btnPrimary, opacity: 0.5, cursor: 'not-allowed' },
3556
+ disabled: Boolean(actBusy) || !canPush,
3557
+ title: canPush ? '' : M('本机还是空的、云端已有内容:先「立即拉取」', 'The local repo is empty while the cloud has content — pull first'),
3558
+ onClick: () => actNow('push-now'),
3559
+ }, actBusy === 'push-now' ? M('排队中…', 'Queueing…') : M('立即推送(会关闭 DSH)', 'Push now (closes DSH)')),
3443
3560
  ),
3444
- h(MadeNote, { made }),
3561
+ actErr ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-error-primary)' } }, actErr) : null,
3562
+ actMsg ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-success-primary)' } }, actMsg) : null,
3445
3563
  ),
3446
3564
  )
3447
3565
  }
package/index.js CHANGED
@@ -1851,6 +1851,9 @@ function localPending(dshHome, lastSyncAt, profileName, ctx = {}) {
1851
1851
  let newest = 0
1852
1852
  const sample = []
1853
1853
  const groupCount = new Map()
1854
+ // 每组保留具体明细名称(会话记录名 / 本机 profile 文件名 …),供面板展开查看
1855
+ const groupItems = new Map()
1856
+ const DETAIL_CAP = 50
1854
1857
  while (stack.length && scanned < 20000 && Date.now() < deadline) {
1855
1858
  const cur = stack.pop()
1856
1859
  let st
@@ -1881,12 +1884,25 @@ function localPending(dshHome, lastSyncAt, profileName, ctx = {}) {
1881
1884
  const sid = basename(dirname(cur)) // sessions/<workspace>/<sessionId>/session.v4.jsonl.zstd
1882
1885
  const title = sessionTitleOf(dshHome, sid)
1883
1886
  if (title) label = title
1887
+ else label = `${sid}(会话)`
1888
+ } else if (gid === 'profile') {
1889
+ label = basename(cur) // 本机 profile 文件:package.json / cordis.patch.yml …
1884
1890
  }
1885
1891
  if (sample.length < 3) sample.push(label)
1892
+ // 按组收集明细名(去重、限量):面板展开可看具体会话记录名 / 本机 profile 文件
1893
+ let items = groupItems.get(gid)
1894
+ if (!items) { items = []; groupItems.set(gid, items) }
1895
+ if (items.length < DETAIL_CAP && !items.includes(label)) items.push(label)
1886
1896
  }
1887
1897
  }
1888
1898
  const groups = [...groupCount.entries()]
1889
- .map(([id, count]) => ({ id, zh: PENDING_GROUP_LABEL[id]?.[0] || id, en: PENDING_GROUP_LABEL[id]?.[1] || id, count }))
1899
+ .map(([id, count]) => ({
1900
+ id,
1901
+ zh: PENDING_GROUP_LABEL[id]?.[0] || id,
1902
+ en: PENDING_GROUP_LABEL[id]?.[1] || id,
1903
+ count,
1904
+ items: groupItems.get(id) || [],
1905
+ }))
1890
1906
  .sort((a, b) => b.count - a.count)
1891
1907
  return {
1892
1908
  known: true,
@@ -1894,6 +1910,7 @@ function localPending(dshHome, lastSyncAt, profileName, ctx = {}) {
1894
1910
  newestAt: newest ? new Date(newest).toISOString() : '',
1895
1911
  sample,
1896
1912
  groups,
1913
+ profileName: profileName || 'desktop',
1897
1914
  truncated: scanned >= 20000 || Date.now() >= deadline,
1898
1915
  }
1899
1916
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.3.89",
3
+ "version": "0.3.91",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",
@@ -116,6 +116,16 @@ check('云端仓库没配时推送/拉取禁用、还原仍可用',
116
116
  && source.includes("disabled: busy || !hasRepoPath, onClick: () => prepare('restore')"))
117
117
  check('面板有「提交说明」输入(生成推送脚本时带上)', source.includes('提交说明') && source.includes('prepare(\'push\', note)'))
118
118
  check('按钮文案用中文(推送 / 拉取)', source.includes("'只生成推送'") && source.includes("'只生成拉取'"))
119
+ // 0.3.91:设置 → 通用 摘要行的远端信息会刷新,按钮换成「立即拉取/推送(会关闭 DSH)」
120
+ check('设置摘要行展开时 fetch 远端再刷新(远端信息不陈旧)',
121
+ source.includes('const refreshRemoteNow = async () =>')
122
+ && source.includes("callAuto({ action: 'check' })")
123
+ && source.includes('setInterval(refreshRemoteNow, 30000)'))
124
+ check('设置摘要行两个立即按钮走 pull-now / push-now 队列',
125
+ source.includes("actNow('pull-now')")
126
+ && source.includes("actNow('push-now')")
127
+ && source.includes("M('立即拉取(会关闭 DSH)', 'Pull now (closes DSH)')")
128
+ && source.includes("M('立即推送(会关闭 DSH)', 'Push now (closes DSH)')"))
119
129
  check('每个 inject 回调都返回了回收函数', recycle.length === 3 && recycle.every((r) => typeof r.stop === 'function'), `实际 ${recycle.length} 个`)
120
130
 
121
131
  // 关键契约:sidebar.panellist 必须先被 inject,再往里 register(只 inject main 是无效的)
@@ -1749,17 +1749,27 @@ console.log('== 0.3.86:本机数据挪进待办 + 会话显示会话名 + 按
1749
1749
  && idxSrc.includes('zh: PENDING_GROUP_LABEL[id]?.[0]')
1750
1750
  && idxSrc.includes('groups,')
1751
1751
  && idxSrc.includes('sample: [], groups: []'), 'index.js localPending 返回值')
1752
- // 2) 客户端:本机数据从「本机仓库」卡挪进「待办」
1752
+ // 2) 客户端:待办去掉「本机数据」字眼,按分组可展开看具体名称
1753
1753
  const localDataHits = cliSrc.split("M('本机数据', 'Local data')").length - 1
1754
- check('本机数据只出现在待办卡(从本机仓库卡移除)',
1755
- localDataHits === 1
1756
- && cliSrc.includes('const localBlock = data && data.local && data.local.known')
1757
- && cliSrc.includes('localBlock,'), 'client.js 待办装配')
1758
- check('待办里按同步内容分组显示,并列出会话名样本',
1754
+ check('待办去掉「本机数据」字眼(0.3.90)',
1755
+ localDataHits === 0, 'client.js 无 Local data 文案')
1756
+ check('待办装配:localBlock 挂到待办卡',
1757
+ cliSrc.includes('const localBlock = data && data.local && data.local.known')
1758
+ && cliSrc.includes('pendingDetailOpen ? localBlock'), 'client.js 待办装配')
1759
+ check('待办按同步内容分组、点分组展开具体名称(会话名/profile 文件)',
1759
1760
  cliSrc.includes('langIsZh() ? g.zh : g.en')
1760
1761
  && cliSrc.includes('g.count')
1761
- && cliSrc.includes('最近写入:')
1762
- && cliSrc.includes('local.sample.join'), 'client.js 分组展示')
1762
+ && cliSrc.includes('const items = Array.isArray(g.items) ? g.items : []')
1763
+ && cliSrc.includes('setPendingOpen')
1764
+ && cliSrc.includes('还有 ${g.count - items.length} 项未列出'), 'client.js 分组展开')
1765
+ check('待办卡有展开/收起总开关(默认展开)',
1766
+ cliSrc.includes('const [pendingDetailOpen, setPendingDetailOpen] = react.useState(true)')
1767
+ && cliSrc.includes('pendingDetailOpen ? localBlock'), 'client.js 待办总开关')
1768
+ check('顶部跳转按钮跟随当前分区高亮(0.3.90)',
1769
+ cliSrc.includes('const [activeSection, setActiveSection] = react.useState')
1770
+ && cliSrc.includes('const active = activeSection === sid')
1771
+ && cliSrc.includes("querySelectorAll('[id^=\"sync-section-\"]')")
1772
+ && cliSrc.includes('ref: bodyRef'), 'client.js 跳转高亮')
1763
1773
  check('分组标签与同步内容一致(会话记录/技能/插件数据/记忆数据)',
1764
1774
  idxSrc.includes("conversations: ['会话记录', 'Conversations']")
1765
1775
  && idxSrc.includes("skills: ['Skills', 'Skills']")