dsh-profile-config-sync 0.5.0 → 0.6.41

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/cordis.patch.yml CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # dsh.profile.bundles 里出现 dsh-profile-config-sync 后,启动时会把这一行插进插件树:
4
4
  # 宿主半身挂 /config-sync/status 与 /config-sync/prepare 两个路由,
5
- # 浏览器半身(package.json 的 dsh.client)在左侧栏注册「配置同步」一行 + 配对面板,并在 设置 → 通用 留一行摘要。
5
+ # 浏览器半身(package.json 的 dsh.client)在左侧栏注册「配置备份与同步」一行 + 配对面板,并在 设置 → 通用 留一行摘要。
6
6
  #
7
7
  # repoPath 留空时按常见位置自动探测(D:\dsh-config、G:\dsh-config、C:\dsh-config、~\dsh-config),
8
8
  # 判据是同时存在 apply.ps1 与 profile/package.json;换机不用改这里。
@@ -0,0 +1,28 @@
1
+ # Test log (newest first, 22 entries)
2
+
3
+ > `README.en.md` keeps the most recent 8; the full English log lives here. The Chinese log (`docs/CHANGELOG.md`) has more recent entries and is the reference.
4
+
5
+ | Date | Version | Highlights |
6
+ |---|---|---|
7
+ | 2026-11-24 | 0.3.93 | Clicking × to close DSH now checks once for auto pull/push and queues the watcher immediately (no more waiting for the 2-minute window); autoRestart semantics unified to !== false |
8
+ | 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" |
9
+ | 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 |
10
+ | 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 |
11
+ | 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 |
12
+ | 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 |
13
+ | 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 |
14
+ | 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 |
15
+ | 2026-11-23 | 0.3.83 | Workspace visibility card also collapses blank sessions and Mnemon idle-review parents; default view on this machine 99 → 10 |
16
+ | 2026-11-23 | 0.3.82 | Workspace visibility card collapses agent sessions by default; hide/show goes through workspaceRegistry and applies instantly (no restart) |
17
+ | 2026-11-21 | 0.3.75 | Sync hidden/archived workspaces across machines (workspace-archives.v1.json into settings); hidden workspaces and sessions stay hidden on B after pull |
18
+ | 2026-11-19 | 0.3.69 | Carry billion-context compaction state across machines (bili-state.mjs); two new notice kinds (plugin-missing / context-state) |
19
+ | 2026-11-19 | 0.3.68 | Session projection-cache guard (fixes agent-busy session creation) |
20
+ | 2026-11-19 | 0.3.67 | Session log seq reconciliation guard (merge by seq, no more whole-file overwrite) |
21
+ | 2026-11-19 | 0.3.66 | .gitattributes silences LF/CRLF warnings |
22
+ | 2026-11-18 | 0.3.65 | Refresh button feedback (text changes to "Refreshing…") |
23
+ | 2026-11-18 | 0.3.64 | Backup restore fix (write back to original location) + failure summary + auto-close |
24
+ | 2026-11-18 | 0.3.63 | Push speed: Get-RelPath ~10x faster |
25
+ | 2026-11-18 | 0.3.62 | Pull speed: 341s → 109s (3.1×) |
26
+ | 2026-11-15 | 0.3.54 | Three speedups (fast-screen / history cache / single fetch), zero behaviour change |
27
+ | 2026-11-14 | — | Two machines from scratch (isolated); session log first-frame 4-byte leftover fix |
28
+ | 2026-11-11 | — | Single-machine isolated end-to-end (install → pull → push → restore) |
@@ -0,0 +1,81 @@
1
+ # 实测记录(按版本倒叙,共 75 条)
2
+
3
+ > README 只留最新 8 条;这里是完整记录。每条都是真跑出来的数字,不是估算;标 `—` 的是早期还没有版本号时的验证。
4
+
5
+ | 日期 | 版本 | 要点 |
6
+ |---|---|---|
7
+ | 2026-11-26 | 0.6.41 | WebDAV 模式下不再渲染 `? @ ?`:无 .git 的仓库目录改为「WebDAV 模式:这个目录不是 git 仓库,没有分支」/「不比提交前后」,未提交数照常;元信息尾巴只在有分支时追加。市场图标换 180×180、撤 3 张旧截图、README 加 6 枚徽章。 |
8
+ | 2026-11-26 | 0.6.40 | 只修工具链:clientcheck 里一条按实现细节写的断言(`missing ? null :`)在 0.6.36 合并云端卡后失效,使 CI publish 门禁变红;改为盯实际那道门。插件行为与 0.6.39 一致。 |
9
+ | 2026-11-26 | 0.6.39 | 更名与文档:面板 / 侧栏 / 设置摘要行统一改成「**配置备份与同步**」(Config Backup & Sync),副标题改成「多端配置备份、同步与还原:本机 → 仓库 → 云端 → 另一台机器」,包描述改成多端备份/同步/还原口径并补 `backup` / `restore` / `webdav` / `multi-device` 关键词,退出后同步窗口标题一起改名(`== DSH 配置同步 / x ==` 这类日志 banner 不动——面板靠它解析结果;历史小标题保留当时的叫法)。README 重写头部:定位段、四件事表(配置 / 备份 / 同步 / 还原)、一张流程线、目录锚点、发布状态压成一张表、「已知限制」单独列;新增「来源与版权」(上游 QcWyGm/dsh-config-sync-plugin,MIT,LICENSE 同步列出两行版权);**实测记录改成版本倒叙**(同日期按版本号数值倒序);并修掉头部停在 0.6.14 的陈旧数字。验收:63 套隔离夹具共 1043 条断言全绿(不含检查这份 README 的文档对账套件本身;另有 1 条权限断言在 Windows 上标 SKIP,不会假装通过) |
10
+ | 2026-11-26 | 0.6.38 | 安全必需项在 JS 侧补齐:`config-sync-extra.json` 的 exclude/skipDirs 是「整份替换」语义,本机存的是 50 条旧快照,0.6.12 新增的 browser-profiles 规则因此在面板与待推送里整条失效——capture 有 `Test-BlockedProfilePath` 硬拦(3,696 个文件 / 268MB 含密码库照样不进仓库),但待推送会把浏览器剖面里几千次 mtime 变动数成「待推送」,面板永远消不掉、退出自动推送每次白跑。现在 JS 也补同一份必需项(读时补、保存前再补一次,否则用户点一次保存又删掉),补齐会在插件数据卡片里明说,并加 PS↔JS 名单对拍。另外「会话记录」组在 capture 里是四块(sessions / attachments / projcache / policies),待推送以前只数 sessions:往附件里丢张图、某个会话的 projcache 更新,面板照样说「仓库与本机一致」,现已补齐(跳过名单里那条 `attachments` 一并去掉)。非 Windows 的待推送口径也改了:macOS/Linux 走 `runtime\sync-engine.mjs`,它只抓 profile / 提示 / Skills / 预设,面板以前却把会话记录、插件数据、额外路径也算成「待推送」(永远不会被推送的东西)。现在按执行体实际能力统计,并在状态里带上 `engineGroups` 让面板写明「这台机器只同步这四组」。剔除被拦的剖面与被排除文件后,本机 `status` 从 470ms 降到 220ms。验收:63 套隔离夹具共 1043 条断言全绿(不含检查这份 README 的文档对账套件本身;另有 1 条权限断言在 Windows 上标 SKIP,不会假装通过) |
11
+ | 2026-11-26 | 0.6.37 | 待推送口径与 capture 对齐:补上插件数据 / 额外路径 / 本地插件包 / 技能市场台账 / 插件设置 / 记忆数据六组(原先只算 7 组,插件数据变了面板仍说「仓库与本机一致」);「插件设置与工作流」面板只列 4 条而 capture 抓 14 条 → 补齐 14 条并加对拍;post-exit 结果窗口改成可配置停留(验收不必等 6 分钟);`.ps1` 增加 BOM 断言(5.1 无 BOM 会把中文按 ANSI 解成乱码)。验收:63 套隔离夹具共 1045 条断言全绿(另有 1 条权限断言在 Windows 上标 SKIP,不会假装通过) |
12
+ | 2026-11-26 | 0.6.36 | 取消勾选真的挡住待推送与自动推送;删除云端副本对 WebDAV 生效;两张云端卡合并 |
13
+ | 2026-11-26 | 0.6.35 | cordis.yml / package.json 等改原子写;7 份脚本行尾统一 CRLF(LF-only 会把下一行吞进注释) |
14
+ | 2026-11-26 | 0.6.34 | post-exit 的 workspace.json 等四处改原子写(半截写入会让 DSH 读不出工作区) |
15
+ | 2026-11-26 | 0.6.33 | 原子写与读重试铺满 common.ps1;读失败不许变成「静默用默认值」 |
16
+ | 2026-11-26 | 0.6.32 | PS 侧也原子化 + 读设置带重试(不再「临时读失败 → 静默改 git」) |
17
+ | 2026-11-26 | 0.6.31 | 原子写保留/设置权限位:含 WebDAV 密码的设置文件按 0600 落盘(POSIX) |
18
+ | 2026-11-26 | 0.6.30 | settings/roots/state/冲突清单改原子写:裸写实测让读者读到空文件 3919/4000 次 |
19
+ | 2026-11-26 | 0.6.29 | 验收计数对齐实测(891 → 893),代码与 0.6.28 相同 |
20
+ | 2026-11-26 | 0.6.28 | 拉取动手前先探测互斥(Test-SyncRunBusy),避免「仓库已更新、配置没落地」的半截状态 |
21
+ | 2026-11-26 | 0.6.27 | 真跑验证「持锁进程被强杀后仍能继续」(Mutex 相对锁文件的核心优势) |
22
+ | 2026-11-26 | 0.6.26 | README 说明 tools/version.json/releases 只在源码仓库、不随安装包发布 |
23
+ | 2026-11-26 | 0.6.25 | selftest 的 settings 检查改盯单源清单(原检查在 0.6.18 后永远数 0)+ README 记录跨平台缺口 |
24
+ | 2026-11-26 | 0.6.24 | 面板 -EncodedCommand 包装实测透出退出码 3 + README 写明非 Windows 侧无互斥 |
25
+ | 2026-11-26 | 0.6.23 | 退出码 3 直通 sync.ps1(不再被 Die 压成 1)+ post-exit 输出兜底识别 |
26
+ | 2026-11-26 | 0.6.22 | post-exit 把退出码 3 当跳过:否则一次并发会让 pull 自动 git reset 回滚 |
27
+ | 2026-11-26 | 0.6.21 | 面板接住退出码 3:显示「跳过:另一个同步正在进行(不是故障)」,不再挑日志尾巴当原因 |
28
+ | 2026-11-26 | 0.6.20 | 并发互斥(命名 Mutex,退出码 3 不假绿)+ 坏配置容错(坏 JSON 按默认规则继续) |
29
+ | 2026-11-26 | 0.6.19+ | 真实载荷 git pull 全链路(A 推 → B 克隆 → pull → 73 文件铺开、零占位符) |
30
+ | 2026-11-26 | 0.6.19+ | 真实抓取幂等(连抓两次零变化,1.6s / 73 文件) |
31
+ | 2026-11-26 | 0.6.19 | apply 补上 {{DSH_HOME}} / {{ROOT:*}} 展开(真实载荷实测:cordis.patch.yml 残留占位符) |
32
+ | 2026-11-26 | 0.6.18+ | 真实载荷 WebDAV 往返(73 个文件逐个 sha256 一致,73 次 PUT) |
33
+ | 2026-11-26 | 0.6.18 | 「把同步仓库当快照还原」修通:settings 按映射表落位 + 展开占位符 + prompt/AGENTS.md 回退 |
34
+ | 2026-11-26 | 0.6.17 | package.json 里 userHome 下的本地插件 link: 也归一(真实数据:@local/dsh-personal) |
35
+ | 2026-11-26 | 0.6.16 | profile 的 yml/json 里本机绝对路径改为占位符(真实数据:cordis.patch.yml 的 pwsh7.cmd 路径) |
36
+ | 2026-11-26 | 0.6.15 | 安全必需项不可被用户规则文件覆盖(本机旧名单曾让 browser-profiles 规则整条失效) |
37
+ | 2026-11-26 | 0.6.14 | git 模式补上剖面门禁(提交前撤回索引 + 写 exclude);webdav 清扫同名单;git 模式首次端到端真跑 |
38
+ | 2026-11-26 | 0.6.13 | 修正拦截措辞:超 32MB 的文件不再被说成「含令牌」,三种原因(secret / profile / too-big)分开报 |
39
+ | 2026-11-26 | 0.6.12 | **安全**:拦住浏览器剖面泄漏——`browser-profiles` / `Login Data` / `Cookies` 等路径一律不抓、不传,并清掉仓库里历史遗留的 297MB |
40
+ | 2026-11-26 | 0.6.11 | Windows 侧 prompt 文件改成「入库换占位符、落地再展开」,与引擎一致:不再把 A 机的绝对路径带到 B 机 |
41
+ | 2026-11-26 | 0.6.10 | 自选目录支持三种形状(映射 / `[{name,path}]` / 纯路径数组),不再因为数组文件报 `[object Object]` 而挡住保存 |
42
+ | 2026-11-26 | 0.6.9 | 冲突清单损坏时不再「既看不见也清不掉」:GET 标 `broken`、`reset` 提前处理且幂等、坏文件保留不覆盖 |
43
+ | 2026-11-25 | 0.6.8 | JS 引擎开始读 `config-sync-roots.json`:自选目录与用户主目录都变成占位符(换机不再串路径),中文根的 `{{ROOT:资料}}` 也能被识别,目标机缺根时跳过并报「待确认路径」而不是写坏配置 |
44
+ | 2026-11-25 | 0.6.7 | JS 引擎开始真正执行「同步内容勾选」:`sync-engine.mjs` 的 capture/apply 读 `config-sync-scope.json`(必需组钉死、单项排除、坏文件按全勾),macOS / Linux 上排除项不再形同虚设 |
45
+ | 2026-11-25 | 0.6.6 | 自选同步目录在 macOS / Linux 上不再被静默丢弃(校验按平台分档进 `normalizeSyncExtraPaths`,非法路径整批 400 并点名) |
46
+ | 2026-11-25 | 0.6.5 | 保存任何设置都不再抹掉 WebDAV 配置(原先只写白名单字段,`webdav*`/`syncMode` 被清空、模式静默退回 git);WebDAV「立即下载」允许填进空目录(新机器首次拉取)(含 git 模式单机推送 + 第二台机器 clone/pull + 从提交还原的完整往返)(新增「文档 ↔ 代码一致性」守卫:README 声明的排除名单条数、skipDirs 逐项、版本三元组、套数都对着代码与产物核对)(含真跑 post-exit.ps1「退出后自动推送/拉取」:云端确实收到 14 个文件、日志写着退出码 0、第二台机器按本机路径展开)(含真跑 restore.ps1 的回退验收:DryRun 不写盘、坏快照被拒且不动本机、删掉的文件能回来、快照缺的文件不被抹掉)(含真跑 sync.ps1 推送→假 NAS→拉取的完整 WebDAV 跨机往返)(含「上传时凭据文件一个字节都不外发」「状态接口不回吐密码」「中文+空格路径往返与脚本引号」「反馈仓库只指向自己的仓库」「每条待办都真有跳转按钮且目标区存在」的实时核对)(含破坏性路由只读性、越界写入、设置字段保留、更新清单解析与包校验、排队状态机、跨平台路径归一、工作区归档原子写、投影缓存守卫的「宁可不动」判定)|
47
+ | 2026-11-25 | 0.6.4 | 越界写入防护:WebDAV 下载逐段校验服务端 href(`..`/空段/绝对路径/盘符一律拒收并记账,先判路径再发请求);冲突还原遇到会写出仓库的 path 直接 400 |
48
+ | 2026-11-25 | 0.6.3 | 推送/拉取先验「目录自己就是仓库根」(否则 git 会改到外层仓库);`restore` 拒绝拼错的 `-SnapshotKind`,也不再拿空目录当平铺快照(原先会先建无用备份、打印「已还原 0 个文件」才报错) |
49
+ | 2026-11-25 | 0.6.1 | WebDAV 列子目录的解析基准改用「请求 URL 真实路径」(原来用配置里的目录名):带 `/dav` 前缀的服务器(Nextcloud/坚果云/Alist)此前一个子目录都列不出来,推送全量重传、拉取只看到根目录文件 |
50
+ | 2026-11-25 | 0.6.0 | 带令牌下载在「模块被抢」的环境下不再静默 401:直接说明原因与办法(HttpWebRequest 兜底会吞掉 Authorization 头,实测确认) |
51
+ | 2026-11-25 | 0.5.9 | 下载兜底加固:`Invoke-WebRequest` 可能「命令在、调用崩」,改为 try/catch 后落 .NET;本机 HTTP 服务实测 URL→下载→sha256→安装 全链路 |
52
+ | 2026-11-25 | 0.5.8 | 模块路径自愈下沉到公共脚本:`Compress-Archive`/`Expand-Archive`(插件快照打包与解包)在同一坏环境下也恢复;回归测试用「PS7 目录在前」的 PSModulePath 复现故障并验证修复 |
53
+ | 2026-11-25 | 0.5.7 | 从 pwsh 启动的 DSH 里「更新插件」永远失败:子进程 5.1 继承 PS7 的 PSModulePath,`Get-FileHash`/`Invoke-WebRequest` 变「无法识别」,空 hash 被报成「安装包被改动」。脚本自愈模块路径 + .NET sha256/下载兜底 + 准确错误 |
54
+ | 2026-11-25 | 0.5.6 | 跨平台引擎补齐 git 动作:推送真的 add/commit/push、拉取真的 fetch+快进合并(之前两者都不碰 git,非 Windows 上等于同步不了);契约判定搬进引擎;还原两种快照布局互认 |
55
+ | 2026-11-25 | 0.5.5 | 后台守护进程不再「窗口看不见就强杀客户端」:强杀只在插件自己请求过关闭时才授权(立即推送/拉取、确认自动拉取、更新、还原),被动等待只等并写清原因——把客户端收进托盘不会被静默杀掉 |
56
+ | 2026-11-25 | 0.5.4 | 版本契约改按「客户端 app 版本」写:首次推送以前会退回 `<AppRoot>\version`,那其实是 Electron 版本(实测 44.7.0),把契约污染成永远对不上;老格式契约在 JS / PowerShell 两侧都只提示一次并忽略,不再永久拦住拉取;`Resolve-AppRoot` 探测不存在的盘符时不再抛 DriveNotFoundException(restore 曾在第一步就崩) |
57
+ | 2026-11-25 | 0.5.3 | 在线推送日志只留正文:PowerShell `-EncodedCommand` 的 CLIXML 进度流以前会原样写进日志(实测单次 4.95 MB / 5069 行),现在按 `<S S="Error">`/Message/ToString 提取、去重、最多留 40 行,并加 8 MB 上限;stdout 与 stderr 重复的同一行不再写两遍;WebDAV 读响应体加独立超时(fetch 超时只管到响应头);CLI 参数打错字会提示而不是静默用默认目录 |
58
+ | 2026-11-25 | 0.5.2 | 还原按快照类型分流(profile / plugin / session),插件快照能真正回滚插件目录;可展开 `{{DSH_HOME}}` 之类占位符的文件不再被「含未配置占位符」误跳过;legacy 契约(缺 electronVersion)不参与版本校验;自检的 sha256 窗口、镜像副本、SSH 断言改成环境自适应 |
59
+ | 2026-11-25 | 0.5.1 | 面板「清空同步范围」必须显式传 `groups: {}`:POST 空对象以前会把整份范围文件删掉(HTTP 400 挡住) |
60
+ | 2026-11-24 | 0.3.93 | 点 × 关闭 DSH 时立即判一次自动拉取/推送并排队 watcher,不再等 2 分钟复查窗口;autoRestart 语义统一为 !== false |
61
+ | 2026-11-24 | 0.3.92 | 远端「未提交」纳入本机待同步数据(pending),刷新按钮真正触发 git fetch;解决「远端数字一直是 0」 |
62
+ | 2026-11-24 | 0.3.91 | 设置-通用-配置同步摘要行展开时先 fetch 再刷新远端信息(不再陈旧、每 30 秒自动刷新);四个生成脚本按钮换成「立即拉取/推送(会关闭 DSH)」两个,走自动同步同一队列 |
63
+ | 2026-11-24 | 0.3.90 | 顶部跳转按钮跟随当前位置高亮;待办去掉「本机数据」字眼、可展开看具体会话记录名与本机 profile |
64
+ | 2026-11-24 | 0.3.89 | 插件更新卡新增「npm 下载路径」;npm 双源(镜像+官方)兜底下载,仍按权威 sha256 校验 |
65
+ | 2026-11-23 | 0.3.86 | 「本机数据」挪进概览-待办,按同步内容的 12 组口径分类统计,会话样本显示会话标题而非 session id |
66
+ | 2026-11-23 | 0.3.85 | 去掉工作区显示卡片编辑态的强调色说明条,编辑与否只看标题行「修改」/「完成」按钮 |
67
+ | 2026-11-23 | 0.3.84 | 工作区显示卡片改成整卡一个「修改」按钮;会话行自带开关、加底色与分隔线,隐藏态删除线 |
68
+ | 2026-11-23 | 0.3.83 | 工作区显示卡片再折叠空会话与 Mnemon 空闲审查父容器;本机默认视图 99 → 10 条 |
69
+ | 2026-11-23 | 0.3.82 | 工作区显示卡片默认折叠智能体会话;隐藏/显示改走 workspaceRegistry,切完即时生效(不再需要重启) |
70
+ | 2026-11-21 | 0.3.75 | 隐藏/归档的工作区跨机同步(workspace-archives.v1.json 纳入 settings),B 机拉取后不再显示已隐藏的工作区与会话 |
71
+ | 2026-11-19 | 0.3.69 | 跨机搬运 billion-context 压缩状态(bili-state.mjs);同步清单新增 plugin-missing / context-state 两类提示 |
72
+ | 2026-11-19 | 0.3.68 | 会话投影缓存守卫,治 agent-busy 建会话失败 |
73
+ | 2026-11-19 | 0.3.67 | 会话日志 seq 对账护栏(跨机写同一会话按 seq 求并集,不再整文件覆盖);.gitattributes 钉 binary;capture hoist |
74
+ | 2026-11-19 | 0.3.66 | .gitattributes 消除 LF/CRLF 警告 |
75
+ | 2026-11-18 | 0.3.65 | 刷新按钮反馈(文字变「刷新中…」) |
76
+ | 2026-11-18 | 0.3.64 | 还原备份修复(写回原位)+ 失败原因集中展示 + 6 分钟自动关窗 |
77
+ | 2026-11-18 | 0.3.63 | 推送提速:Get-RelPath 快 10 倍 |
78
+ | 2026-11-18 | 0.3.62 | 拉取提速:341s → 109s(3.1×) |
79
+ | 2026-11-15 | 0.3.54 | 三处提速(快筛/历史缓存/单次 fetch),行为不变 |
80
+ | 2026-11-14 | — | 两台机器从零跑通(隔离环境);会话日志首帧 4 字节残留修复 |
81
+ | 2026-11-11 | — | 单机隔离环境全链路验证(装插件 → 拉取 → 推送 → 还原) |
@@ -0,0 +1,221 @@
1
+ # Historical detail (0.2 – 0.6)
2
+
3
+ > `README.md` / `README.en.md` document **current behaviour only**. This file keeps the per-version evolution notes.
4
+ > The full verification log is in [CHANGELOG.md](CHANGELOG.md).
5
+
6
+ ## The 0.3.x panel / workspace evolution
7
+
8
+ ### Hidden/archived workspaces no longer reappear on the other machine (0.3.75)
9
+
10
+ Workspaces and sessions you hide/archive from the config-sync panel used to show up again on machine B after a pull. Cause: DSH stores that state separately in `<DshHome>\dsh-session-manager\workspace-archives.v1.json` (`archived:true` plus the related `sessionIds`), which was never part of the sync set; the workspace registry is merged by ID (union), so a locally hidden record gets merged back in.
11
+
12
+ Since 0.3.75 this file is part of the `settings` sync: a push writes it to the repo as `settings\workspace-archives.json`, and a pull restores it to the same path on B. When B starts, DSH reads `archived:true` workspaces and filters them out of the workspace list; their sessions move to the archived group and stop showing. This is whole-file replace semantics — machine A is authoritative. Hiding is not deletion: the workspace/session files remain and can be restored by un-hiding in DSH.
13
+
14
+ ### New "Workspace visibility" card in the panel (0.3.76)
15
+
16
+ A new **Workspace visibility** section brings both native DSH hiding mechanisms into one card:
17
+
18
+ | Action | Effect | Backing file |
19
+ |---|---|---|
20
+ | Visible | Workspace shown normally, all sessions visible | Drop the archive record; remove sessions from `archivedSessionIds` |
21
+ | Hide sessions | Workspace stays in the list, its sessions go to Archived | Sessions written to `global.archivedSessionIds` in `<DshHome>\storages\workspace.json` |
22
+ | Archive workspace | Workspace disappears from the list, sessions kept | `<DshHome>\dsh-session-manager\workspace-archives.v1.json` gets `archived:true` and its sessions hidden too |
23
+
24
+ Each workspace switches between the three states independently; expanding it lets you hide/show a single session without touching others (a session toggle changes only that one `archivedSessionIds` entry, never the workspace archive record). Changes do not call the session-manager Web API (it needs a DSH connection-owner credential the plugin route does not have) — they go through the host `workspaceRegistry`, which persists and pushes the session-list update, so toggles apply immediately (see 0.3.82). Since 0.3.75 the archive file is synced, so these states travel with push/pull too.
25
+
26
+ ### Panel: session names, Edit button, click-to-expand and quick jump (0.3.77)
27
+
28
+ Five interaction refinements on top of the 0.3.76 "Workspace visibility" card:
29
+
30
+ 1. **Session names**: each expanded session shows a readable title (from the `session/title` event, falling back to the first user message text); hover for the full session ID. Titles are cached and rebuilt from the local logs on each machine.
31
+ 2. **Edit button**: the state dropdown and per-session Hide/Show buttons stay hidden until you click Edit on that workspace; click Done to leave edit mode, so states cannot be changed by accident. (From 0.3.84 there is a single Edit button for the whole card — see below.)
32
+ 3. **Click to expand**: click anywhere on a workspace row to expand/collapse its sessions; no separate expand button.
33
+ 4. **Card position**: the Workspace visibility card moved just above Feedback, as the last configuration step.
34
+ 5. **Sticky title + quick jump**: the panel title bar is sticky, with shortcut tabs below it (Overview / Workspaces / Targets / Automation / Scripts / Restore / Content / Plugin data / Feedback); clicking one smoothly scrolls to that section.
35
+
36
+ Title reading and state changes stay self-contained in this plugin and do not call the session-manager Web API.
37
+
38
+ ### Quick-jump order matches the cards; scrolling no longer hides behind the title (0.3.78)
39
+
40
+ Two display fixes on top of 0.3.77:
41
+
42
+ 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.
43
+ 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.
44
+
45
+ ### Plugin update falls back to two npm sources (0.3.89)
46
+
47
+ 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).
48
+
49
+ ### Clicking × to close DSH now checks once for auto pull/push immediately (0.3.93)
50
+
51
+ With "Pull on startup" or "Push on exit" enabled, the only queues used to be the 8-second startup check and the 2-minute re-check. If you made changes between two re-checks and then clicked the top-right × to close DSH, no watcher was waiting for the exit at that moment, so nothing ran after closing. A quit hook now covers it: when the last visible window closes (the × click), the plugin checks once and queues the watcher **before** the client exits; once the DSH processes are gone the watcher runs the pull/push immediately.
52
+
53
+ 1. **Check once on exit**: when no visible windows remain, call `triggerAutoSyncOnClose(config)`, which reads the `autoPull`/`autoPush` switches; an in-flight watcher is reused rather than relaunched; with an empty local repo only autoPull can queue (first clone).
54
+ 2. **Same criteria as the re-check**: pull takes priority (behind > 0 → queue pull, no confirmation dialog on the close path); push queues when any of "commits ahead / uncommitted changes / local data newer than last sync" hits; `autoRestart` semantics unified to `!== false` (relaunch by default).
55
+ 3. **Queue before quit**: the queue must be awaited **before** `app.quit()` — the plugin dies with the main process, so checking after quit is too late. With both switches off / nothing to sync the function returns quickly and does not slow down closing; a successful queue logs "queued pull/push before exit …: runs right after DSH exits".
56
+
57
+ ### Remote "uncommitted" now includes local pending changes + Refresh really fetches (0.3.92)
58
+
59
+ 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:
60
+
61
+ 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.
62
+ 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.
63
+
64
+ ### Settings → General → Config Sync: live remote info + Pull/Push now buttons (0.3.91)
65
+
66
+ Two adjustments to the "Settings → General → Config Sync" summary row:
67
+
68
+ 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.
69
+ 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.
70
+
71
+ ### To-do and jump-tab display cleanup (0.3.90)
72
+
73
+ Four display adjustments to the panel:
74
+
75
+ 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.
76
+ 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.
77
+ 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.
78
+ 4. **Overview description synced**: changed to "Versions, dependencies, snapshots and to-do at a glance".
79
+
80
+ ### Local data moved into To-do, grouped by sync content, sessions shown by name (0.3.86)
81
+
82
+ The "Local data" row in the "Local repo" card moved into "Overview → To-do", with its presentation reorganised:
83
+
84
+ 1. **Location**: the old "Local data" line at the bottom of the "Local repo" card is gone. The To-do card now shows even when nothing else is wrong — it starts with local data (last sync time / pending count / mode) and then the existing to-do suggestions. "How much is still unsynced" and "what to do about it" sit together.
85
+ 2. **Grouped by sync content**: pending files are counted by the same twelve groups as "Sync content" — Conversations / Skills / Plugin data / Memory data / Local profile / Global prompts / Agent presets / Plugin settings & workflows / Workspace files / Extra paths, etc. Each group is a chip with a count, sorted by count descending; no more bare single total.
86
+ 3. **Sessions shown by name**: in the "Recently changed" sample, session files show the projected session title (matching the DSH panel, e.g. "列出工作区下的文件夹") instead of a `session-xxx/session.v4.jsonl.zstd` directory id; non-session items with no title still show their parent directory / file name.
87
+
88
+ ### Workspace visibility card: one Edit button for the whole card, sessions paired with their toggles (0.3.84 / 0.3.85)
89
+
90
+ The edit interaction of the "Workspace visibility" card was rebuilt:
91
+
92
+ 1. **A single Edit button for the entire card** (0.3.84): previously every workspace row carried its own Edit/Done button, and once there were several rows the buttons no longer lined up with the sessions. Now there is one button on the right of the header row — "Edit" when idle, switching to "Done" (primary colour, same position) once you are editing — and it unlocks every workspace tri-state plus every session toggle at once; clicking again leaves edit mode. The per-row button is gone.
93
+ 2. **Session/button pairing made concrete** (0.3.84): each session gets its own row with a divider between rows; in edit mode the whole row gets a background and rounded corners, framing "this session" together with "its button". The toggle sits at the end of that row with a fixed width, so a wrap never puts it next to a different session. The word and colour distinguish Hide (red) from Show (green), the `title` carries the session name, and hidden sessions get a struck-through, dimmed name (the separate "Hidden" label was dropped).
94
+ 3. **No tinted explanation banner** (0.3.85): edit mode no longer inserts a yellow-bordered hint row above the list; whether you are editing is read from the header button alone.
95
+
96
+ ### Workspace visibility card: blank sessions and idle-review parents are collapsed too (0.3.83)
97
+
98
+ On top of 0.3.82's "collapse agent child sessions by default", two more kinds of noise are folded away:
99
+
100
+ 1. **Blank sessions**: entries that were created but never used — no message, no turn (empty `origin` in the session header, and the log only holds permission / sandbox / approval / session-end-seed events, no `turn/start` and no `user/message`).
101
+ 2. **Mnemon idle-review parents**: `mnemon-review-owner-v1-*`, which carry only a `subagent/catalog` event — the actual content lives in the `mnemon-review-v1-*` child session they point at.
102
+
103
+ Both naturally satisfy the same "blank" test, so one rule folds them away; no name matching is needed. A "Show blank" checkbox in the header row brings them back, and the footer reports how many blank and how many agent sessions were collapsed. On this machine the default view drops from 99 entries to 10.
104
+
105
+ ### Workspace visibility card: agent sessions collapsed by default + instant hide/show (0.3.82)
106
+
107
+ Two changes to the "Workspace visibility" card:
108
+
109
+ 1. **Agent (subagent) sessions are collapsed by default**: the card lists only your own sessions. A "Show agents" checkbox in the header row reveals agent child sessions and reports how many were folded away. 80 of the 99 registered sessions on this machine were agent sessions (mnemon reviews and delegated tasks each leave one behind), flooding the list so you could not find your own.
110
+ 2. **Hide/show takes effect immediately**: toggling the workspace tri-state or a single session used to only rewrite the on-disk state file, leaving the host's in-memory `archivedSessionIds` stale — a client restart or session-list refresh was required. It now goes through the host `workspaceRegistry` (`archiveSession` / `unarchiveSession`), which persists and pushes the session-list update, so toggles apply the moment you click. If the host service is unavailable it falls back to the previous file-based write and the card hint says which path was used.
111
+
112
+ Reading the owning workspace and the session title stays self-contained; the session-manager Web API is not used.
113
+
114
+ ### Workspace visibility card session names now match the DSH panel (0.3.81)
115
+
116
+ Fixes session names in the "Workspace visibility" card differing from the DSH session panel.
117
+
118
+ DSH session titles evolve: a fallback title (truncated first message) is created first, then a provider title is generated by the model. The card previously stopped at the first fallback; it now picks the latest title by priority — provider > fallback > untagged title > first user message — matching the DSH panel exactly.
119
+
120
+ ### Fix cross-machine sync downgrading the installed plugin and rolling back pulls (0.3.80)
121
+
122
+ 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.
123
+
124
+ | Problem | Fix |
125
+ |---|---|
126
+ | 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 |
127
+ | 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 |
128
+ | Stale plugin keys caused repeated plugin-missing notices | Removed invalid legacy keys from localPluginMap and cleared stale notices |
129
+
130
+ The corrupted archive in the config repo was also repacked with correct 0.3.79 content.
131
+
132
+ ### The panel is now a fixed header plus an independently scrolling body (0.3.79)
133
+
134
+ 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.
135
+
136
+ 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:
137
+
138
+ 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.
139
+ 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.
140
+ 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.
141
+
142
+ The change touches only the panel itself (`S.page` / `pageInner` are used nowhere else); the sidebar row and the settings summary row are unaffected.
143
+
144
+ ### The non-ASCII path trap (0.3.48)
145
+
146
+ `git` keeps `core.quotepath=true` by default, so non-ASCII paths come back octal-escaped and wrapped in quotes (`"workspace/DSH\347\240\264\347\224\262/..."`). The 0.3.47 index precheck read that straight from `& $git ... diff --cached --name-only`, so `Test-Path -LiteralPath` hit the `"` and threw `路径中具有非法字符` (illegal characters in path) — the whole sync died before committing.
147
+
148
+ Fix: every path-consuming git query now goes through `Read-GitLines` (`-c core.quotepath=false` + cmd byte redirect + UTF-8 read), and each per-file `stat` sits inside `try/catch` so one bad name only skips the size check instead of killing the run. Measured on the real repo: 918 staged paths, 0 quoted and 0 stat failures; the history precheck parsed all 3222 `ls-tree -r -l` lines into path plus size.
149
+
150
+ Measured (2026-11-14, isolated repo + local bare remote + fake `pre-receive` hook): a 96 MB file was unstaged while the rest pushed fine and `sync-notices.json` recorded `too-large=1`; after the same file went into history the precheck reported `history=1`; a hook replaying GitHub's message (`File big.bin is 96.00 MB; this exceeds ...`) was classified as "1 file over the cap", not as a network problem; the window summary and the panel block read the same file.
151
+
152
+ ## Using this repo as a market index source
153
+
154
+ The root `market-index.json` is a ready-to-use DSH market index (`format: 1`, `source.type: git` with a 40-character commit; installing fetches the package from this repo, no build). Index URL:
155
+
156
+ ```
157
+ https://raw.githubusercontent.com/huanyu-a/dsh-profile-config-sync/main/market-index.json
158
+ ```
159
+
160
+ In DSH go to **Plugins → Discover → Index sources**, paste the URL above, and "Config Sync" shows up in the list; installing pulls this repo at that commit.
161
+
162
+ - **Prerequisite**: this is an index source for the **official Discover page** (`@deepseek-ai/dsh-plugin-market`), which needs the official `@deepseek-ai/dsh-experimental-plugin-market-bundle` enabled in the profile. Without it, neither the Discover page nor the index-source entry exists.
163
+ - **Not found in dshmarket is expected**: the third-party market plugin dshmarket lists only its own curated catalog (`awesome-dsh-plugin.com/plugins.json`, or the `dsh-plugin-catalog` npm package in China). Its source has no path for user-supplied indexes (`lib/registry.js` reads that single catalog per region on every call, `lib/sources.js` only parses entries of that catalog), and its installs are restricted to sources listed there — anything else is rejected. So a self-hosted index, however valid, never shows up in dshmarket's search. To appear there, open a PR against [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) (its README says plainly: don't PR plugin entries against the market repo).
164
+ - **Fetching the index from China**: `raw.githubusercontent.com` comes and goes; prefix it with `https://gh-proxy.com/` or `https://ghfast.top/`, or use jsDelivr's `https://cdn.jsdelivr.net/gh/huanyu-a/dsh-profile-config-sync@main/market-index.json` — but jsDelivr caches branch aliases like `@main`, so a new release may take hours to appear there.
165
+ - **Just want it on your own machine**: no market needed — `dsh plugin add` with the tgz from the install section above is the shortest path.
166
+
167
+ Release flow: change code → `pwsh -File tools\pack-plugin.ps1` to pack `releases/dsh-profile-config-sync-<version>.tgz` (it collects files from `package.json`'s `files` and writes the sha256 back into `version.json`) → bump `version` (and `notes`) in `version.json` → replace `version` and `commit` of the entry in `market-index.json` → push. The index only references a commit, so older versions stay installable. Run `node tools\selftest.mjs <repo path>` and `node tools\clientcheck.mjs` before releasing.
168
+
169
+ ## Pitfalls already closed in the generator
170
+
171
+ All of them surfaced only by **actually running on a new machine**:
172
+
173
+ | Pitfall | Handling |
174
+ |---|---|
175
+ | cmd's `echo` swallows `< > \| & ^ %`, so `echo ... config-<timestamp>` became a redirect and printed nothing | every dynamic line goes through `echoSafe()`: `%`→`%%`, special characters prefixed with `^` |
176
+ | after `chcp 65001`, `set /p` cannot read redirected input: automation feeding `y` left `GO` empty, "finished" printed while nothing happened, exit code still 0 | `--yes` skips confirmation + an explicit receipt when there is none |
177
+ | a fresh machine has no upstream, `git pull --ff-only` says *There is no tracking information…*, PowerShell 5.1 wraps it as NativeCommandError and the script carried on | `sync.ps1` probes upstream first; since 0.3.54 a pull is `fetch` + `merge --ff-only origin/<branch>` (one network round trip), and a missing upstream is fixed with `set-upstream-to`; push uses `-u` |
178
+ | `GIT_SSH_COMMAND` without the ssh.exe program → `/usr/bin/sh: - : invalid option` | four branches: use `core.sshCommand` if set; write a full command when `ssh.exe` is found; **unset the variable** when only a key exists; hand it to `.ssh\config` when there is no key |
179
+ | with an asar build, AppRoot lookups by path all miss and every bundle is reported missing | `isAppRoot` accepts `app\package.json` **or** `app.asar`; version and bundle existence are read straight out of the asar (PowerShell 5.1 `ConvertFrom-Json` caps at 2 MB, a 5.7 MB header has to be read by entry offset), and anything undecidable is reported as "unknown" |
180
+ | plugin directory already present skips deployment, so a newer tgz leaves old code running | `apply.ps1` compares the tgz with the newest deployed file and, when newer, renames to `.bak-<timestamp>` and redeploys |
181
+ | "push on exit" was enabled yet nothing happened (no log, no result file) | two causes stacked: ① the queue predicate only looked at `ahead > 0`, which stays 0 until new sessions are captured → count all three sources + re-check every 2 minutes; ② `spawn` faked success (`detached` PowerShell exiting immediately / failures only on the `error` event) → start a separate process with `Start-Process`, await the launcher's exit code, and write `auto-sync-launch.log` |
182
+ | an empty folder was treated as "the repo is broken": red text plus an enabled push button that would always fail | since 0.3.26 `repo.phase` splits it into four states; an empty folder allows pull only, blocked at three layers: `prepare(push)`, `push-now`, and `sync.ps1 push` |
183
+ | "does the cloud have anything to pull" was answered by branch count → a remote whose `main` still exists but whose tree was emptied still read as "has content, pull only": pulling produced an empty folder, the state never changed and the initialize-push entry never appeared (a dead loop; verified on Gitee: 98 commits, the last 12 all "delete file", the newest tree has 0 files) | since 0.3.36 the criterion is **the file count inside the branch tree**: `ls-remote --heads` counts branches first (0 branches = empty, no fetch), and only when branches exist does it create a temporary bare repo, `fetch --depth 1 --filter=blob:none` and `ls-tree -r`, then delete it; `remoteFiles===0` always means "both sides empty" → push only, and `sync.ps1` overwrites that empty branch with `--force-with-lease` (the tree is empty, nothing is lost) |
184
+ | a pull rewrote settings wholesale: edit a path, pull before pushing and the edit was silently replaced (only a backup folder, no notice) | since 0.3.36 the overwrite is compared first (roots → placeholders, CRLF flattened, the three timestamp fields in `our-free-model.json` zeroed); every difference lands in `config-sync-overwrite.json` and the panel/console say "N files were overwritten, local edits backed up first" |
185
+ | after a sync, **creating a session failed outright**: `failed to create session … corrupt Zstandard session log: invalid frame magic at byte 186` | the first frame DSH writes carries a **4-byte content checksum** (frame header descriptor FHD bit2), and the decompressor happily succeeds on the prefix with that checksum trimmed, so the binary search for the "shortest decodable prefix" ended 4 bytes early; the rewritten file then kept the old checksum as garbage and DSH blew up on the second frame. Now: add 4 bytes per FHD bit2 → correct against "the next frame magic" → self-check before writing (cwd applied + new first frame is followed by a frame magic), refuse to write otherwise; leftover tails in already-broken files are dropped (self-healing) |
186
+
187
+ Session header `cwd`, empty-snapshot fallback and missing `Get-FileHash` are handled by `apply.ps1` / `restore.ps1` / `dsh-sync-common.ps1` in the config repo; see sections 5 and 10 of its root `README.md`.
188
+
189
+ ## Performance (0.3.54): three speedups, zero behaviour change
190
+
191
+ All three change *how* things are computed, not *what* is computed: the files written to the repo, the commit contents and the failure decisions stay byte-identical to 0.3.53 — it just runs faster. Numbers come from a same-size synthetic repo (50,889 files / 416 MB) and against real Gitee:
192
+
193
+ | Step | Before | After | Why |
194
+ |---|---|---|---|
195
+ | capture deciding "does this file need rewriting" | two `Get-FileHash` per file (source + repo): 1.2 ms each → ~**120 s** for 50k files | two `Get-ChildItem` passes, one `FileInfo` each (Length / LastWriteTimeUtc already read by the enumeration) + an in-memory dictionary diff: **3.9 s**; hashes only for the few whose size or mtime differs | per-file `Test-Path` / `Get-Item` is *slower* (measured **37.8 s**, ~0.7 ms per cmdlet call), so bulk enumeration is the only sane way |
196
+ | push scanning history for oversized blobs | `git ls-tree -r -l HEAD` on every push: **20–23 s** on a 50k-file repo, for a history that barely changes | cached per commit in `.dsh\sync-history-scan.json` (`{commit, oversized, at}`): skipped when the commit matches or is an ancestor of HEAD; a full scan only on first push, after a remote rejection, or with `-ScanHistory` | newly added files are already caught by the index pre-check; the history scan only covers "an old commit already carries a huge blob" |
197
+ | pull | `git pull --ff-only` is fetch + merge internally, while the script had already fetched → **two network round trips** (SSH handshake measured ≈0.95 s) | `fetch origin --prune`, then `merge --ff-only origin/<branch>` → **one round trip**; `merge --ff-only` still refuses anything but a fast-forward, so a dirty tree or divergence fails exactly as before | when the run starts from a pending conflict list the earlier fetch was skipped, so one fetch is issued first to make the merge use fresh refs |
198
+
199
+ Two new switches on `sync.ps1`, both **off by default** — the default path behaves exactly like 0.3.53:
200
+
201
+ - `-DeepVerify`: forwarded to `capture.ps1`, ignoring the size/mtime fast path and **hashing every file**. Use it when you suspect drift where size and mtime both look unchanged (cost: back to 1.2 ms per file).
202
+ - `-ScanHistory`: ignores the history-scan cache and **always does a full** `ls-tree -r -l HEAD`. Use it after switching remotes, when the cache looks stale, or for a manual re-check.
203
+
204
+ ```powershell
205
+ pwsh -File sync.ps1 push -DeepVerify
206
+ pwsh -File sync.ps1 push -ScanHistory
207
+ ```
208
+
209
+ The log shows which path ran: `文件比较(快筛):比对 N 个,深哈希 M 个` versus `文件比较(深校验开):比对 N 个,深哈希 N 个`.
210
+
211
+ ## Contents
212
+
213
+ | Path | Purpose |
214
+ |---|---|
215
+ | `index.js` | Host half: `/config-sync/status`, `/prepare`, `/settings`, `/auto`, `/update` routes |
216
+ | `client.js` | Browser half: sidebar row, panel, settings summary row |
217
+ | `cordis.patch.yml` | Bundle patch layer (`id: config-sync`) |
218
+ | `runtime/` | The six post-exit PowerShell scripts plus `fix-session-cwd.mjs`, shipped with the package so scripts can be generated right after install without cloning the config repo first |
219
+ | `tools/` | Self-test `selftest.mjs`, client structure check `clientcheck.mjs` |
220
+ | `version.json` / `releases/` | Self-update manifest and package |
221
+