dsh-config-sync-plugin 0.4.20 → 0.4.22
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 +8 -0
- package/README.md +8 -0
- package/package.json +1 -1
- package/runtime/apply.ps1 +39 -1
- package/runtime/install-plugin.ps1 +10 -1
- package/runtime/post-exit.ps1 +10 -1
- package/tools/selftest.mjs +13 -0
package/README.en.md
CHANGED
|
@@ -257,6 +257,14 @@ 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
|
+
### 0.4.22 (2026-11-28)
|
|
261
|
+
|
|
262
|
+
- **Cross-machine default-workspace convergence**: fixes "after pulling on the other machine, the registry contains two default-workspace entries, one a ghost pointing to C:\Users\...\Documents\deepseek-harness\default-workspace which does not exist locally, with its 2 sessions having no landing directory". Legacy repo snapshots carry the default-workspace entry expanded from the obsolete `{{ROOT:userHome}}` token; when the local Documents folder is redirected (e.g. `D:\Backup\Documents\...`) the two paths differ, so the existing same-path convergence misses it. apply now merges the repo entry's session id sets into the local default-workspace entry by slot/title semantics and drops the ghost; the repo entry is kept when the machine has no default-workspace entry yet (first migration unaffected). After upgrading, click "Pull now" once and the ghost entry disappears automatically.
|
|
263
|
+
|
|
264
|
+
### 0.4.21 (2026-11-27)
|
|
265
|
+
|
|
266
|
+
- Fix plugin update installation: 0.4.20 switched to pnpm publish, whose repacked tarball has a top-level <name>/ directory instead of npm's standard package/. The installer only accepted package/ and failed with 'unexpected package structure'. The updater now accepts both layouts (post-exit / install-plugin / apply extraction points).
|
|
267
|
+
|
|
260
268
|
### Pull-crash fix: int+string concatenation replaced with -f formatting (0.4.20)
|
|
261
269
|
|
|
262
270
|
This release fixes a crash on the other machine when pulling with 0.4.19, followed by an automatic rollback that left "pull succeeded but workspace/sessions are empty":
|
package/README.md
CHANGED
|
@@ -277,6 +277,14 @@ 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
|
+
### 0.4.22(2026-11-28)
|
|
281
|
+
|
|
282
|
+
- **默认工作区跨机收敛**:修复「另一台机器拉取后登记表里出现两个 default-workspace(幽灵条目指向本机不存在的 C:\Users\... 路径,其 2 个会话没有落点目录)」。老仓库快照里 default-workspace 条目带着已废弃的 `{{ROOT:userHome}}` 展开产物,而本机 Documents 重定向后默认工作区实际在别处(如 `D:\Backup\Documents\...`),两条 path 不同 → 原有的同路径收敛认不出来。apply 现按 slot/title=default-workspace 语义把仓库条目的三组会话 id 并入本机默认工作区条目后丢弃仓库条目;本机没有默认工作区条目时保留仓库条目(首次迁移不受影响)。升级后重新点「立即拉取」即自动收敛,幽灵条目消失、默认工作区会话数变为「本机 + 仓库」之和。
|
|
283
|
+
|
|
284
|
+
### 0.4.21(2026-11-27)
|
|
285
|
+
|
|
286
|
+
- 修复插件更新安装失败:0.4.20 起改用 pnpm publish 发包,npm 兜底源下到的包顶层是「包名/」目录,旧安装器只认 npm 标准的「package/」,报「安装包结构不对」。更新器现兼容两种结构(post-exit / install-plugin / apply 三处解包点)。
|
|
287
|
+
|
|
280
288
|
### 拉取崩溃修复:int+字符串拼接改 -f 格式化(0.4.20)
|
|
281
289
|
|
|
282
290
|
本版修复 0.4.19 在另一台机器上拉取崩溃、随后自动回滚导致「拉取成功但工作区/会话是空的」的问题:
|
package/package.json
CHANGED
package/runtime/apply.ps1
CHANGED
|
@@ -351,6 +351,40 @@ function Sync-WorkspaceApply {
|
|
|
351
351
|
$localTable.Remove($other)
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
+
# 默认工作区跨机收敛(0.4.22):老仓库快照里 default-workspace 条目可能带着
|
|
355
|
+
# 已废弃的 {{ROOT:userHome}} 展开产物(如 C:\Users\<user>\Documents\...),而本机
|
|
356
|
+
# Documents 重定向后默认工作区实际在别处(如 D:\Backup\Documents\...)。两条 path
|
|
357
|
+
# 不同 → 上面的同路径收敛认不出来 → 本机出现两个「default-workspace」,其中一条
|
|
358
|
+
# 指向本机不存在的目录(幽灵条目,会话落点也缺失)。这里按 slot/title=default-workspace
|
|
359
|
+
# 语义收敛:仓库条目并入本机已有的默认工作区条目后丢弃;本机没有任何
|
|
360
|
+
# default-workspace 条目时保留仓库条目(首次迁移场景)。
|
|
361
|
+
$isDefaultWsPath = {
|
|
362
|
+
param($p)
|
|
363
|
+
if (-not $p) { return $false }
|
|
364
|
+
$leaf = ($p -replace '/', '\').TrimEnd('\') -split '\\' | Select-Object -Last 1
|
|
365
|
+
return ([string]$leaf -ieq 'default-workspace')
|
|
366
|
+
}
|
|
367
|
+
$repoDefaultIds = @()
|
|
368
|
+
foreach ($e in $plan) {
|
|
369
|
+
if (([string]$e.Slot -ieq 'default-workspace') -or ([string]$e.Title -ieq 'default-workspace')) { $repoDefaultIds += $e.Id }
|
|
370
|
+
}
|
|
371
|
+
$localDefaultCands = @()
|
|
372
|
+
foreach ($id in @($localTable.Keys)) {
|
|
373
|
+
if ($localIdSet.ContainsKey([string]$id) -and (& $isDefaultWsPath ([string]$localTable[$id]['path'])) -and -not $mfIdSet.ContainsKey([string]$id)) {
|
|
374
|
+
$localDefaultCands += [string]$id
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
foreach ($rid in $repoDefaultIds) {
|
|
378
|
+
if (-not $localTable.Contains($rid)) { continue }
|
|
379
|
+
$target = @($localDefaultCands | Where-Object { $_ -ne $rid }) | Select-Object -First 1
|
|
380
|
+
if (-not $target) { continue } # 本机没有自己的默认工作区 → 保留仓库条目(首次迁移)
|
|
381
|
+
$localTable[$target]['sessionIds'] = @(@($localTable[$target]['sessionIds']) + @($localTable[$rid]['sessionIds']) | Where-Object { $_ -ne '' } | Sort-Object -Unique)
|
|
382
|
+
$localTable[$target]['archivedSessionIds'] = @(@($localTable[$target]['archivedSessionIds']) + @($localTable[$rid]['archivedSessionIds']) | Where-Object { $_ -ne '' } | Sort-Object -Unique)
|
|
383
|
+
$localTable[$target]['pinnedSessionIds'] = @(@($localTable[$target]['pinnedSessionIds']) + @($localTable[$rid]['pinnedSessionIds']) | Where-Object { $_ -ne '' } | Sort-Object -Unique)
|
|
384
|
+
Warn ('默认工作区跨机收敛:仓库条目 {0}(path {1},本机不存在)已并入本机默认工作区 {2}(path {3}),丢弃仓库条目' -f $rid, $localTable[$rid]['path'], $target, $localTable[$target]['path'])
|
|
385
|
+
$dropped[$rid] = $true
|
|
386
|
+
$localTable.Remove($rid)
|
|
387
|
+
}
|
|
354
388
|
$ids = @($localTable.Keys | ForEach-Object { [string]$_ } | Where-Object { -not $dropped.ContainsKey($_) })
|
|
355
389
|
$mfDefault = if ($mf.global) { [string]$mf.global.defaultWorkspaceId } else { '' }
|
|
356
390
|
$localDefault = if ($localGlobal.Contains('defaultWorkspaceId')) { [string]$localGlobal['defaultWorkspaceId'] } else { '' }
|
|
@@ -1470,8 +1504,12 @@ if ($needExtract.Count -gt 0) {
|
|
|
1470
1504
|
New-Item -ItemType Directory -Path $out -Force | Out-Null
|
|
1471
1505
|
& $tarExe -xzf $tgz -C $out
|
|
1472
1506
|
if ($LASTEXITCODE -ne 0) { Die "解压失败:$tgz(tar 退出码 $LASTEXITCODE)" }
|
|
1473
|
-
# npm tgz 的根目录是 package
|
|
1507
|
+
# npm tgz 的根目录是 package/;pnpm publish 重打包的根目录是 包名/ —— 两种都摊平(0.4.21)
|
|
1474
1508
|
$pkgDir = Join-Path $out 'package'
|
|
1509
|
+
if (-not (Test-Path -LiteralPath $pkgDir)) {
|
|
1510
|
+
$altDir = Get-ChildItem -LiteralPath $out -Directory | Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'package.json') } | Select-Object -First 1
|
|
1511
|
+
if ($altDir) { $pkgDir = $altDir.FullName }
|
|
1512
|
+
}
|
|
1475
1513
|
if (Test-Path -LiteralPath $pkgDir) {
|
|
1476
1514
|
$final = Join-Path $AppRoot $dirName
|
|
1477
1515
|
if (Test-Path -LiteralPath $final) { Remove-Item -LiteralPath $final -Recurse -Force }
|
|
@@ -130,7 +130,16 @@ try {
|
|
|
130
130
|
& $tar -xzf $pkgPath -C $stage *> $null
|
|
131
131
|
if ($LASTEXITCODE -ne 0) { throw ("解包失败,退出码 {0}" -f $LASTEXITCODE) }
|
|
132
132
|
$payload = Join-Path $stage 'package'
|
|
133
|
-
if (-not (Test-Path -LiteralPath $payload)) {
|
|
133
|
+
if (-not (Test-Path -LiteralPath $payload)) {
|
|
134
|
+
# 0.4.21 兼容 pnpm publish 重打包形态:顶层是 包名/ 目录(如 dsh-config-sync-plugin/)
|
|
135
|
+
$alt = Get-ChildItem -LiteralPath $stage -Directory | Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'package.json') } | Select-Object -First 1
|
|
136
|
+
if ($alt) {
|
|
137
|
+
$payload = $alt.FullName
|
|
138
|
+
Log ("包顶层是 {0}/(pnpm 重打包形态),按它安装" -f $alt.Name)
|
|
139
|
+
} else {
|
|
140
|
+
throw '安装包结构不对(里面没有 package 目录)'
|
|
141
|
+
}
|
|
142
|
+
}
|
|
134
143
|
$newVersion = (Get-Content -LiteralPath (Join-Path $payload 'package.json') -Raw -Encoding utf8 | ConvertFrom-Json).version
|
|
135
144
|
Log ("包内版本:{0}" -f $newVersion)
|
|
136
145
|
if ($Version -and $newVersion -ne $Version) { throw ("安装包里的版本是 {0},与清单 {1} 不一致" -f $newVersion, $Version) }
|
package/runtime/post-exit.ps1
CHANGED
|
@@ -615,7 +615,16 @@ if ($Mode -eq 'update') {
|
|
|
615
615
|
& $tar -xzf $tmp -C $stage *>&1 | ForEach-Object { Log ([string]$_) }
|
|
616
616
|
if ($LASTEXITCODE -ne 0) { throw ("解包失败,退出码 {0}" -f $LASTEXITCODE) }
|
|
617
617
|
$payload = Join-Path $stage 'package'
|
|
618
|
-
if (-not (Test-Path -LiteralPath $payload)) {
|
|
618
|
+
if (-not (Test-Path -LiteralPath $payload)) {
|
|
619
|
+
# 0.4.21 兼容 pnpm publish 重打包形态:顶层是 包名/ 目录(如 dsh-config-sync-plugin/)
|
|
620
|
+
$alt = Get-ChildItem -LiteralPath $stage -Directory | Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'package.json') } | Select-Object -First 1
|
|
621
|
+
if ($alt) {
|
|
622
|
+
$payload = $alt.FullName
|
|
623
|
+
Log ("包顶层是 {0}/(pnpm 重打包形态),按它安装" -f $alt.Name)
|
|
624
|
+
} else {
|
|
625
|
+
throw '安装包结构不对(里面没有 package 目录)'
|
|
626
|
+
}
|
|
627
|
+
}
|
|
619
628
|
$newVersion = (Get-Content -LiteralPath (Join-Path $payload 'package.json') -Raw -Encoding utf8 | ConvertFrom-Json).version
|
|
620
629
|
if ($UpdateVersion -and $newVersion -ne $UpdateVersion) { throw ("安装包里的版本是 {0},与清单 {1} 不一致" -f $newVersion, $UpdateVersion) }
|
|
621
630
|
} catch { $stageError = $_.Exception.Message }
|
package/tools/selftest.mjs
CHANGED
|
@@ -2148,5 +2148,18 @@ console.log('== 0.4.17:拉取落地加固(前置检查 + 自愈 + 落地验
|
|
|
2148
2148
|
cliS.includes("landing: M('落地检查', 'Landing check')"), 'client.js')
|
|
2149
2149
|
}
|
|
2150
2150
|
|
|
2151
|
+
console.log('== 0.4.21:更新安装兼容 pnpm 重打包结构(顶层 包名/ 而非 package/)==')
|
|
2152
|
+
{
|
|
2153
|
+
const peS = readFileSync(join(pluginRootSelf, 'runtime', 'post-exit.ps1'), 'utf8')
|
|
2154
|
+
const ipS = readFileSync(join(pluginRootSelf, 'runtime', 'install-plugin.ps1'), 'utf8')
|
|
2155
|
+
const apS2 = readFileSync(join(pluginRootSelf, 'runtime', 'apply.ps1'), 'utf8')
|
|
2156
|
+
// 三个解包点都有「package/ 不存在时按 包名/ 兜底」的兼容分支(0.4.21 标志注释)
|
|
2157
|
+
const compat = (s) => s.includes('pnpm 重打包形态') && s.includes("Join-Path $_.FullName 'package.json'")
|
|
2158
|
+
check('post-exit 解包兼容 pnpm 重打包(包名/ 顶层)', compat(peS), 'post-exit.ps1')
|
|
2159
|
+
check('install-plugin 解包兼容 pnpm 重打包(包名/ 顶层)', compat(ipS), 'install-plugin.ps1')
|
|
2160
|
+
check('apply local-plugins 解压兼容 pnpm 重打包(包名/ 顶层)',
|
|
2161
|
+
apS2.includes('pnpm publish 重打包') && apS2.includes("Join-Path $_.FullName 'package.json'"), 'apply.ps1')
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2151
2164
|
process.exit(failures === 0 ? 0 : 1)
|
|
2152
2165
|
|