dsh-config-sync-plugin 0.3.62 → 0.3.63

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
@@ -1,4 +1,4 @@
1
- # dsh-config-sync-plugin
1
+ # dsh-config-sync-plugin
2
2
  [中文](README.md) | English
3
3
 
4
4
  A DSH plugin: it adds a **"Config Sync"** row to the sidebar (opening a full-page health-check panel), plus a summary row under **Settings → General**. It only **inspects and prepares commands** — the sync actions never run inside the app (except the automatic sync that relaunches the client).
@@ -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.62"` 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.63"` 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
 
@@ -589,6 +589,10 @@ The log shows which path ran: `文件比较(快筛):比对 N 个,深哈
589
589
 
590
590
  ## Test log (2026-11-11, isolated environment)
591
591
 
592
+ ### 2026-11-18: push speed release 0.3.63 (Get-RelPath ~10x faster)
593
+
594
+ The shared `Get-RelPath` used by push and pull ran two `-split` + `Where-Object` per file; on a 49k-file workspace push comparison alone cost 11.7s. Now a `StartsWith` + `Substring` fast path, falling back to the original segment-count logic when case or 8.3 short paths disagree. 49,138 files compared with 0 output differences; microbench 5.08s -> 0.51s (~9.9x). All three `dsh-sync-common.ps1` copies (source / config repo / plugin runtime) updated.
595
+
592
596
  ### 2026-11-18: pull speed release 0.3.62 (341s → 109s, ~3.1×)
593
597
 
594
598
  One machine had 49,110 files in a workspace and 101,097 orphan files piled up in another workspace slot; "pull" stalled at "workspace restored" for minutes. Segment tracing found four avoidable costs, all in `runtime\apply.ps1`. Behaviour is unchanged (files committed to the repo, config results and decisions are byte-identical); only "how it computes" changed:
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.62"` 后 `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.63"` 后 `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
 
@@ -565,6 +565,10 @@ pwsh -File sync.ps1 push -ScanHistory
565
565
 
566
566
  ## 实测记录
567
567
 
568
+ ### 2026-11-18:推送提速发版 0.3.63(Get-RelPath 快 10 倍)
569
+
570
+ 推送/拉取共用的 `Get-RelPath` 原来对每个文件做两次 `-split` + `Where-Object`;5 万文件工作区下,推送比对单独占 11.7s。改为 `StartsWith` + `Substring` 快路径,大小写或 8.3 短路径不一致时回退原段数比对逻辑。49138 文件全量比对与老版输出 0 差异,微基准 5.08s → 0.51s(约 9.9 倍)。三处 `dsh-sync-common.ps1`(源码 / 配置仓库 / 插件副本)同步。
571
+
568
572
  ### 2026-11-18:拉取提速发版 0.3.62(341s → 109s,约 3.1×)
569
573
 
570
574
  一台机器上工作区有 49110 个文件、另一个工作区槽位堆积了 101097 个孤儿文件,点「拉取」时卡在「已还原工作区」好几分钟。逐段打点后定位到 4 个浪费点,全部在 `runtime\apply.ps1`,行为不变(落到仓库的文件、提交内容、配置结果逐字节一致),只改「怎么算」:
package/client.js CHANGED
@@ -921,7 +921,7 @@ window.__ModuleLoader__.load({
921
921
  }
922
922
  // 「手动还原」指引里的目标位置:认不出类型时按内容猜不到,索性把三类常见落点都摆出来
923
923
  const manualTargets = () => [
924
- M('插件本体 → 插件安装目录(如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.62)', 'Plugin files → the plugin install folder (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.62)'),
924
+ M('插件本体 → 插件安装目录(如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.63)', 'Plugin files → the plugin install folder (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.63)'),
925
925
  M('会话目录(--xxx--)→ ~\\.dsh\\sessions', 'Session folders (--xxx--) → ~\\.dsh\\sessions'),
926
926
  M('配置五件套(package.json / pnpm-lock.yaml / cordis.yml…)→ ~\\.dsh\\profiles\\desktop', 'Config files (package.json / pnpm-lock.yaml / cordis.yml…) → ~\\.dsh\\profiles\\desktop'),
927
927
  ]
package/index.js CHANGED
@@ -976,9 +976,9 @@ async function inspect(config) {
976
976
  const remoteFiles = remoteProbe ? remoteProbe.files : null
977
977
  if (!appRoot) {
978
978
  advice.push(t(
979
- '定位不到客户端根目录:插件不在 <客户端根> 下(如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.62),'
979
+ '定位不到客户端根目录:插件不在 <客户端根> 下(如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.63),'
980
980
  + '或客户端是打包版(resources\\app.asar)而这里没认出来 —— 三份同步脚本会因此生成不了',
981
- 'Cannot locate the client root: the plugin is not under <client root> (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.62), '
981
+ 'Cannot locate the client root: the plugin is not under <client root> (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.63), '
982
982
  + 'or this is a packaged build (resources\\app.asar) that was not recognized — the three sync scripts cannot be generated.',
983
983
  ))
984
984
  }
@@ -3477,9 +3477,9 @@ async function handlePrepare(req, res, config) {
3477
3477
  if (!appRoot) {
3478
3478
  throw new Error(t(
3479
3479
  '定位不到客户端根目录(要能找到 resources\\app\\package.json 或 resources\\app.asar):'
3480
- + '请确认插件装在 <客户端根> 下(例如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.62),或在设置里填客户端根 appRoot',
3480
+ + '请确认插件装在 <客户端根> 下(例如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.63),或在设置里填客户端根 appRoot',
3481
3481
  'Cannot locate the client root (needs resources\\app\\package.json or resources\\app.asar): '
3482
- + 'make sure the plugin is installed under <client root> (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.62), or set appRoot in the settings',
3482
+ + 'make sure the plugin is installed under <client root> (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.63), or set appRoot in the settings',
3483
3483
  ))
3484
3484
  }
3485
3485
  const state = {...await repoState(repo), message}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.3.62",
3
+ "version": "0.3.63",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",
package/runtime/apply.ps1 CHANGED
@@ -845,6 +845,7 @@ if ($dropped.Count -gt 0) { Ok "已剔除 $($dropped.Count) 个实验性 bundle
845
845
  $localPluginMap = [ordered]@{
846
846
  'dsh-our-free-model-2.8.0' = 'dsh-our-free-model'
847
847
  'dsh-purge-1.4.0' = 'dsh-purge'
848
+ 'dsh-config-sync-plugin-0.3.63' = 'dsh-config-sync-plugin'
848
849
  'dsh-config-sync-plugin-0.3.62' = 'dsh-config-sync-plugin'
849
850
  'dsh-config-sync-plugin-0.3.61' = 'dsh-config-sync-plugin'
850
851
  'dsh-config-sync-plugin-0.3.59' = 'dsh-config-sync-plugin'
@@ -158,7 +158,18 @@ function Get-GitExe {
158
158
  }
159
159
 
160
160
  # 求 $full 相对 $base 的路径:按路径段数取尾巴,避免 8.3 短路径(ADMINI~1)或大小写差异导致 Substring 算错
161
- function Get-RelPath([string]$base, [string]$full) { $b = @($base -split '\\' | Where-Object { $_ -ne '' })
161
+ function Get-RelPath([string]$base, [string]$full) {
162
+ # Fast path: $full is under $base from the same enumeration (99.9%). Substring avoids two -split + Where-Object.
163
+ if ($full.StartsWith($base, [StringComparison]::OrdinalIgnoreCase)) {
164
+ $tail = $full.Substring($base.Length)
165
+ if ($tail.Length -gt 0 -and ($tail[0] -eq '\' -or $tail[0] -eq '/')) {
166
+ $rel = $tail.TrimStart('\','/')
167
+ if ($rel) { return $rel }
168
+ }
169
+ return $null
170
+ }
171
+ # Fallback: base/full disagree on case or 8.3 short path (ADMINI~1). Count path segments instead.
172
+ $b = @($base -split '\\' | Where-Object { $_ -ne '' })
162
173
  $f = @($full -split '\\' | Where-Object { $_ -ne '' })
163
174
  if ($f.Count -le $b.Count) { return $null }
164
175
  return ($f[$b.Count..($f.Count - 1)] -join '\')