dsh-config-sync-plugin 0.4.18 → 0.4.20
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 +20 -0
- package/README.md +20 -0
- package/client.js +15 -11
- package/package.json +2 -2
- package/runtime/apply.ps1 +90 -52
- package/runtime/capture.ps1 +35 -8
- package/runtime/dsh-sync-common.ps1 +53 -1
- package/runtime/post-exit.ps1 +3 -2
- package/runtime/restore.ps1 +5 -4
- package/runtime/sync.ps1 +43 -13
- package/tools/selftest.mjs +46 -17
package/README.en.md
CHANGED
|
@@ -257,6 +257,26 @@ 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
|
+
### Pull-crash fix: int+string concatenation replaced with -f formatting (0.4.20)
|
|
261
|
+
|
|
262
|
+
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":
|
|
263
|
+
|
|
264
|
+
- **Root cause**: one Test-PullLanding report string concatenated an int with text (`$bad + " sessions still contain placeholders…"`). PowerShell evaluates `int + string` by first treating the int as the left operand's semantics and trying to convert the string to Int32 — under StrictMode this throws a terminating error ("Cannot convert value … to type System.Int32"). Test-PullLanding died → sync pull exited 1 → post-exit treated it as "executor did not finish" and auto-rolled back (repo reset --hard + config snapshot restore), undoing the workspaces/sessions that had just landed. The local machine never hit that branch; the other machine (empty local sessions + projcache placeholders) did.
|
|
265
|
+
- **Fix**: every int-adjacent concatenation is now `-f` formatted — 14 spots: apply (projcache count at the crash point, duplicate paths, session-dir counts, pending paths, overwrite lists, extra skills, mnemonic prune), capture (absolute-path warnings ×3), post-exit (backup name + verification log), restore (landing-list keys + manifest joins). Remaining string+string joins were type-audited and kept.
|
|
266
|
+
- **Upgrade note**: after upgrading from 0.4.19 just pull again; data rolled back earlier lands again with this pull (the repo still had it — the rollback only touched the local copy).
|
|
267
|
+
|
|
268
|
+
### One-way contract adoption + landing hardening (0.4.19)
|
|
269
|
+
|
|
270
|
+
This release fixes five classes of issues found in the full-code audit:
|
|
271
|
+
|
|
272
|
+
- **Contract no longer frozen**: the old "any mismatch keeps the old contract" rule froze `host-contract.json` forever once the app auto-upgraded (stuck on rc.2). Now semver one-way adoption: a newer local machine upgrades the contract; an older one keeps it (anti-downgrade preserved).
|
|
273
|
+
- **Init contract read the wrong version**: on packaged (app.asar) machines, the fallback chain wrote the Electron framework version (e.g. 44.7.0) as appVersion. It now reuses `Get-HostAppVersion` (asar-aware), so any build shape writes the real app version.
|
|
274
|
+
- **Four hard-coded versions removed**: lock fallback, `$cssFallback`, landing probe list, and the 23-entry link directory map are now derived at runtime from the repo `package.json`; releases no longer need manual sync in four places, and `--frozen-lockfile` no longer fails on version drift.
|
|
275
|
+
- **Check the cloud before pushing**: capture's mirror-delete assumes "missing locally = delete in repo"; pushing without pulling first silently deleted the other machine's unique files (sessions/attachments are unrecoverable). Push now fetches and stops when behind>0 (-Force overrides).
|
|
276
|
+
- **WorkspaceOnly race closed**: the branch wrote workspace.json/session first frames/bili DB while DSH ran. The process check now runs before that branch.
|
|
277
|
+
|
|
278
|
+
Also: `git add -A` now goes through cmd forwarding (no NativeCommandError under EAP=Stop); push failure classification adds non-fast-forward ("pull first" guidance); capture cwd normalization uses `Get-HostNodeRunner` (no more `& $null` crash) and `$PID` temp names; notices byKind counts `landing`; panel AutoCard uses callAuto; required-group item checkboxes are disabled in the scope card (they were dead switches).
|
|
279
|
+
|
|
260
280
|
### Fix over-strict pull preflight (0.4.18)
|
|
261
281
|
|
|
262
282
|
This release fixes the 0.4.17 preflight false-failure that rolled back pulls on the target machine:
|
package/README.md
CHANGED
|
@@ -277,6 +277,26 @@ 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
|
+
### 拉取崩溃修复:int+字符串拼接改 -f 格式化(0.4.20)
|
|
281
|
+
|
|
282
|
+
本版修复 0.4.19 在另一台机器上拉取崩溃、随后自动回滚导致「拉取成功但工作区/会话是空的」的问题:
|
|
283
|
+
|
|
284
|
+
- **根因**:Test-PullLanding 的报告文案里有一处 int 与字符串直接拼接(`$bad + " 个会话投影缓存仍含占位符…"`)。PowerShell 对 `int + string` 会先把左侧 int 当作左操作数语义、试图把右侧字符串转成 Int32,StrictMode 下直接抛终止错误「无法将值"个会话投影缓存…"转换为类型 System.Int32」。Test-PullLanding 挂掉 → sync pull 退出码 1 → post-exit 按「执行体没有正常跑完」处理,触发自动回滚(仓库 reset --hard + 配置快照还原),刚落地的工作区/会话数据被整段撤销。本机不崩是因为该分支只有 landing 提示路径差一层才走到,另一台机器(本机 sessions 为空 + projcache 有占位符)恰好命中。
|
|
285
|
+
- **修复**:所有 int 邻接拼接统一改 `-f` 格式化,共 14 处——apply 的 projcache 计数(崩溃点)/重复路径/会话目录计数/待确认路径/覆盖清单/Skill 多出/记忆文件清理,capture 的绝对路径告警三连,post-exit 的备份名与校验日志,restore 的落地清单 key/manifest 拼接。其余 string+string 拼接逐一核对过类型,安全保留。
|
|
286
|
+
- **升级指引**:从 0.4.19 升级后重新点「立即拉取」即可;此前被回滚掉的数据会随本次 pull 重新落地(仓库里还有,回滚只动了本地)。
|
|
287
|
+
|
|
288
|
+
### 契约单向采纳 + 落地链路加固(0.4.19)
|
|
289
|
+
|
|
290
|
+
本版集中修复通读审计发现的五类问题:
|
|
291
|
+
|
|
292
|
+
- **契约防降级不再冻死**:旧逻辑「本机版本 ≠ 仓库契约就保持不变」让 app 每次 nightly 升级后契约永久冻结在旧版(`host-contract.json` 一直停在 rc.2,实验 bundle 门控对着旧版本判断)。现在按 semver 单向采纳:本机比契约新→升级契约;本机更旧→维持不变(保留防降级意图)。
|
|
293
|
+
- **初始化契约读错版本**:打包版(app.asar)机器做初始化推送时,旧回退链读到的是 Electron 框架版本(44.7.0 之类)写进契约。现在复用 `Get-HostAppVersion` 的正确读取链(asar 手工解析),任何构建形态写入的都是真实 app 版本。
|
|
294
|
+
- **硬编码版本四处脱节**:apply 里 lock 兜底版本、`$cssFallback`、landing 探测名单、23 个 link 目录名映射全部改为从仓库 `package.json` 运行时推导,发新版不再需要手工同步四处,`--frozen-lockfile` 不再因版本错位必挂。
|
|
295
|
+
- **推送前先核对云端**:capture 的镜像删除以「本机没有 = 删仓库」为准,另一台机器刚推过而本机没拉时会静默删掉对方独有的文件(会话/附件不可再生)。现在 push 前先 fetch 并检查 behind>0,领先就停(-Force 可越过)。
|
|
296
|
+
- **WorkspaceOnly 竞态收口**:`-WorkspaceOnly` 分支原来绕过 DSH 运行检查,会和运行中的客户端互踩 workspace.json/会话日志/bili 数据库。进程检查现在提到该分支之前。
|
|
297
|
+
|
|
298
|
+
附带:`git add -A` 改走 cmd 转发(EAP=Stop 下不再被 stderr advice 中断);push 失败分类补 non-fast-forward(双机竞态给出「先拉取」指引);capture 会话头归一执行器统一走 `Get-HostNodeRunner`(无独立 node 时不再 `& $null` 崩溃)并用 `$PID` 命名临时文件;notices byKind 补 `landing` 计数;面板 AutoCard 的 auto 请求统一走 callAuto;同步内容卡必需组单项勾选禁用(原本就是死开关)。
|
|
299
|
+
|
|
280
300
|
### 修复拉取前置检查过严(0.4.18)
|
|
281
301
|
|
|
282
302
|
本版修复 0.4.17 新增的拉取前置检查在目标机误报失败、导致拉取被回滚的问题:
|
package/client.js
CHANGED
|
@@ -1830,6 +1830,13 @@ window.__ModuleLoader__.load({
|
|
|
1830
1830
|
}
|
|
1831
1831
|
const toggleItem = (gid, iid) => {
|
|
1832
1832
|
if (!state || !editing) return
|
|
1833
|
+
const g0 = state.groups.find((x) => x.id === gid)
|
|
1834
|
+
// 0.4.19:必需组的单项勾选是死开关——ps1 侧 Test-SyncItemEnabled 对必需组恒真,
|
|
1835
|
+
// 勾了也不生效,还让用户误以为排除了。直接不让点,并提示为什么。
|
|
1836
|
+
if (g0 && g0.required === true) {
|
|
1837
|
+
setMsg(M('必需组(工作区/会话/profile)的单项不参与排除,始终同步', 'Items in required groups are always synced and cannot be excluded'))
|
|
1838
|
+
return
|
|
1839
|
+
}
|
|
1833
1840
|
setState({
|
|
1834
1841
|
...state,
|
|
1835
1842
|
groups: state.groups.map((g) => (g.id === gid
|
|
@@ -1943,12 +1950,15 @@ window.__ModuleLoader__.load({
|
|
|
1943
1950
|
items.map((i) => h('label', {
|
|
1944
1951
|
style: {
|
|
1945
1952
|
display: 'flex', gap: '8px', alignItems: 'center', fontSize: '12px',
|
|
1946
|
-
cursor: editing ? 'pointer' : 'default', opacity: groupOn ? 1 : 0.6,
|
|
1953
|
+
cursor: editing && g.required !== true ? 'pointer' : 'default', opacity: groupOn ? 1 : 0.6,
|
|
1947
1954
|
},
|
|
1948
1955
|
},
|
|
1949
1956
|
h('input', {
|
|
1950
|
-
type: 'checkbox', checked: i.enabled !== false,
|
|
1951
|
-
|
|
1957
|
+
type: 'checkbox', checked: i.enabled !== false,
|
|
1958
|
+
disabled: busy || !editing || g.required === true,
|
|
1959
|
+
title: g.required === true
|
|
1960
|
+
? M('必需组内容始终同步', 'Required groups are always synced')
|
|
1961
|
+
: (editing ? '' : M('只读:先点「修改」', 'Read-only: click Edit first')),
|
|
1952
1962
|
onChange: () => toggleItem(g.id, i.id), style: { flexShrink: 0 },
|
|
1953
1963
|
}),
|
|
1954
1964
|
h('span', { style: { wordBreak: 'break-all' } }, i.label),
|
|
@@ -1998,14 +2008,8 @@ window.__ModuleLoader__.load({
|
|
|
1998
2008
|
const act = async (action, extra) => {
|
|
1999
2009
|
setBusy(action); setErr(''); setMsg('')
|
|
2000
2010
|
try {
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
headers: jsonHeaders(),
|
|
2004
|
-
body: JSON.stringify({ action, ...(extra || {}) }),
|
|
2005
|
-
})
|
|
2006
|
-
const text = await res.text()
|
|
2007
|
-
const body = text ? JSON.parse(text) : null
|
|
2008
|
-
if (!res.ok || !body || body.ok !== true) throw new Error((body && body.error) || `${res.status}`)
|
|
2011
|
+
// 0.4.19:统一走 callAuto(带 JSON 解析守卫),旧裸 fetch 遇坏响应把 SyntaxError 原样抛进 UI
|
|
2012
|
+
const body = await callAuto({ action, ...(extra || {}) })
|
|
2009
2013
|
if (action === 'check') {
|
|
2010
2014
|
const d = body.drift
|
|
2011
2015
|
setMsg(d
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-config-sync-plugin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
"check": "node --check index.js && node --check client.js",
|
|
59
59
|
"verify": "node tools/selftest.mjs && node tools/clientcheck.mjs"
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|
package/runtime/apply.ps1
CHANGED
|
@@ -763,6 +763,16 @@ $stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
|
|
763
763
|
$BackupDir = Join-Path $DshHome "backups\config-$stamp"
|
|
764
764
|
New-Item -ItemType Directory -Path $BackupDir -Force | Out-Null
|
|
765
765
|
|
|
766
|
+
# ---------- 0. 前置检查 ----------
|
|
767
|
+
# 0.4.19:DSH 进程检查提到 -WorkspaceOnly 分支之前。WorkspaceOnly 同样要写 workspace.json、
|
|
768
|
+
# 重写会话日志首帧(fix-session-cwd)、导入 billion-context 的 index.db(SQLite 无 BUSY 重试)——
|
|
769
|
+
# 运行中的 DSH 退出时会回写这些文件,落地内容被盖/互踩。之前只拦非 WorkspaceOnly 路径,
|
|
770
|
+
# 是一个数据竞态窗口。-Force 仍是显式越过的出口。
|
|
771
|
+
$proc = Get-Process -Name 'DeepSeek Harness' -ErrorAction SilentlyContinue
|
|
772
|
+
if ($proc -and -not $Force) {
|
|
773
|
+
Die "检测到 DeepSeek Harness 仍在运行(PID: $(($proc.Id) -join ','))。请完全退出(含托盘)后重新执行,或加 -Force 强制继续。"
|
|
774
|
+
}
|
|
775
|
+
|
|
766
776
|
# -WorkspaceOnly:只还原工作区 + 会话(B 机没装 DSH 也能先落地资料),做完直接结束
|
|
767
777
|
if ($WorkspaceOnly) {
|
|
768
778
|
if ($SkipWorkspace) { Die "-WorkspaceOnly 与 -SkipWorkspace 不能同时使用" }
|
|
@@ -774,11 +784,6 @@ if ($WorkspaceOnly) {
|
|
|
774
784
|
return
|
|
775
785
|
}
|
|
776
786
|
|
|
777
|
-
# ---------- 0. 前置检查 ----------
|
|
778
|
-
$proc = Get-Process -Name 'DeepSeek Harness' -ErrorAction SilentlyContinue
|
|
779
|
-
if ($proc -and -not $Force) {
|
|
780
|
-
Die "检测到 DeepSeek Harness 仍在运行(PID: $(($proc.Id) -join ','))。请完全退出(含托盘)后重新执行,或加 -Force 强制继续。"
|
|
781
|
-
}
|
|
782
787
|
foreach ($p in @("$RepoRoot\profile\package.json", "$RepoRoot\profile\cordis.patch.yml")) {
|
|
783
788
|
if (-not (Test-Path -LiteralPath $p)) {
|
|
784
789
|
if (Test-SyncGroupEnabled $Scope 'profile') { Die "仓库内容不完整,缺少:$p" }
|
|
@@ -907,10 +912,17 @@ foreach ($f in @('cordis.yml', 'cordis.patch.yml', 'pnpm-workspace.yaml', 'pnpm-
|
|
|
907
912
|
}
|
|
908
913
|
# 老仓库的 pnpm-lock.yaml 里 dsh-config-sync-plugin 是 link: 写法,与改成 npm 版本的 package.json
|
|
909
914
|
# 对不上会让 --frozen-lockfile 必失败。这里一并改写成 npm 版本,frozen 直接通过。
|
|
915
|
+
# 0.4.19:目标版本不再硬编码(硬编码会在插件发新版后与 package.json 脱节 → frozen 必挂 →
|
|
916
|
+
# 就地 no-frozen 重写本机 lock)。从仓库 package.json 读 dsh-config-sync-plugin 的实际依赖值。
|
|
910
917
|
if ($f -eq 'pnpm-lock.yaml' -and $raw -match 'dsh-config-sync-plugin:[\s\S]{0,200}link:') {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
918
|
+
if (-not $cssNpmVersion) {
|
|
919
|
+
$cssNpmVersion = $null
|
|
920
|
+
try { $cssNpmVersion = [string]$repoPkgObj.dependencies.'dsh-config-sync-plugin' } catch { $cssNpmVersion = $null }
|
|
921
|
+
if ($cssNpmVersion -like 'link:*' -or -not $cssNpmVersion) { $cssNpmVersion = '0.4.19' }
|
|
922
|
+
}
|
|
923
|
+
$raw = [regex]::Replace($raw, '(dsh-config-sync-plugin:\s*\r?\n\s*specifier:\s*)link:[^\r\n]*', ('${1}' + $cssNpmVersion))
|
|
924
|
+
$raw = [regex]::Replace($raw, '(dsh-config-sync-plugin:\s*\r?\n\s*specifier:[^\r\n]*\r?\n\s*version:\s*)link:[^\r\n]*', ('${1}' + $cssNpmVersion))
|
|
925
|
+
Warn "pnpm-lock.yaml 里 dsh-config-sync-plugin 的 link: 写法已改写为 npm 版本 $cssNpmVersion(与仓库 package.json 对齐)"
|
|
914
926
|
}
|
|
915
927
|
Write-TextPreserveBom (Join-Path $ProfileDir $f) $raw
|
|
916
928
|
}
|
|
@@ -923,6 +935,9 @@ $pkgRaw = Expand-AppRoot (Read-TextPreserveBom (Join-Path $RepoRoot 'profile\pac
|
|
|
923
935
|
$bundlesInRepo = @()
|
|
924
936
|
try { $bundlesInRepo = @(($pkgRaw | ConvertFrom-Json).dsh.profile.bundles) }
|
|
925
937
|
catch { Die "仓库 profile\package.json 不是合法 JSON:$($_.Exception.Message)" }
|
|
938
|
+
# 0.4.19:仓库 package.json 对象供 link:/npm 版本推导复用(lock 改写、$cssFallback、landing 探测)。
|
|
939
|
+
$repoPkgObj = $null
|
|
940
|
+
try { $repoPkgObj = $pkgRaw | ConvertFrom-Json } catch { }
|
|
926
941
|
|
|
927
942
|
$dropped = @()
|
|
928
943
|
foreach ($b in $bundlesInRepo) {
|
|
@@ -960,32 +975,42 @@ try { $finalBundles = @(($pkgRaw | ConvertFrom-Json).dsh.profile.bundles) }
|
|
|
960
975
|
catch { Die "剔除实验性 bundle 后 package.json 不再是合法 JSON(请手动核对 profile\package.json)" }
|
|
961
976
|
if ($dropped.Count -gt 0) { Ok "已剔除 $($dropped.Count) 个实验性 bundle,清单剩 $($finalBundles.Count) 项" }
|
|
962
977
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
'dsh-
|
|
978
|
+
# 0.4.19:link: 目录名映射不再手工维护(23 个硬编码目录名每次发版都要同步,漏一个就装不上)。
|
|
979
|
+
# 改为从仓库 package.json 的 dependencies 动态推导:任何 link:<…>/<leaf> 依赖,
|
|
980
|
+
# leaf 就是 AppRoot 下的源码目录名;唯一例外 dsh-config-sync-plugin 走下面的 npm 兜底。
|
|
981
|
+
# 已知包名 → 原始目录名的对照表只在「leaf 与包名不同」时才需要(如 dsh-our-free-model)。
|
|
982
|
+
$localPluginMap = [ordered]@{ }
|
|
983
|
+
try {
|
|
984
|
+
$depNames = @()
|
|
985
|
+
if ($repoPkgObj -and $repoPkgObj.dependencies) { $depNames = @($repoPkgObj.dependencies.PSObject.Properties.Name) }
|
|
986
|
+
foreach ($dn in $depNames) {
|
|
987
|
+
$dv = [string]$repoPkgObj.dependencies.$dn
|
|
988
|
+
if (-not $dv) { continue }
|
|
989
|
+
if ($dv -like 'link:*') {
|
|
990
|
+
# 本机 package.json 里的 link: 写法(占位符已展开为本机路径):leaf 是目录名
|
|
991
|
+
$leaf = [IO.Path]::GetFileName(($dv -replace '^link:', '').TrimEnd('/', '\'))
|
|
992
|
+
if ($leaf -and $leaf -ne $dn) { $localPluginMap[$leaf] = $dn }
|
|
993
|
+
} elseif ($dv -match '(?i)^[^/"'']*[\\/]?([^/"''\\]+)\.(tgz|zip)$') {
|
|
994
|
+
# 归档写法 file:…/dsh-xxx-1.2.3.tgz:解包后目录名是去掉版本号的包名
|
|
995
|
+
$leaf = $Matches[1]
|
|
996
|
+
if ($leaf -and $leaf -ne $dn) { $localPluginMap[$leaf] = $dn }
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
} catch { }
|
|
1000
|
+
# 兼容兜底:老仓库既没有 link: 也没有归档写法时(package.json 里只有裸 link:{{APP_ROOT}}/dsh-xxx-1.2.3
|
|
1001
|
+
# 已被上面的 link: 分支覆盖),保留一组历史遗留目录名,防止老仓库漏映射。
|
|
1002
|
+
if ($localPluginMap.Count -eq 0) {
|
|
1003
|
+
foreach ($legacy in @('dsh-our-free-model-2.8.0', 'dsh-purge-1.4.0',
|
|
1004
|
+
'dsh-config-sync-plugin-0.3.56', 'dsh-config-sync-plugin-0.3.57', 'dsh-config-sync-plugin-0.3.58',
|
|
1005
|
+
'dsh-config-sync-plugin-0.3.59', 'dsh-config-sync-plugin-0.3.61', 'dsh-config-sync-plugin-0.3.62',
|
|
1006
|
+
'dsh-config-sync-plugin-0.3.63', 'dsh-config-sync-plugin-0.3.64', 'dsh-config-sync-plugin-0.3.65',
|
|
1007
|
+
'dsh-config-sync-plugin-0.3.66', 'dsh-config-sync-plugin-0.3.67', 'dsh-config-sync-plugin-0.3.68',
|
|
1008
|
+
'dsh-config-sync-plugin-0.3.69', 'dsh-config-sync-plugin-0.3.70', 'dsh-config-sync-plugin-0.3.73',
|
|
1009
|
+
'dsh-config-sync-plugin-0.3.74', 'dsh-config-sync-plugin-0.3.75', 'dsh-config-sync-plugin-0.3.76',
|
|
1010
|
+
'dsh-config-sync-plugin-0.3.77', 'dsh-config-sync-plugin-0.3.78', 'dsh-config-sync-plugin-0.3.79',
|
|
1011
|
+
'dsh-config-sync-plugin-0.3.80', 'dsh-config-sync-plugin-0.3.81')) {
|
|
1012
|
+
$localPluginMap[$legacy] = ($legacy -replace '-\d+\.\d+\.\d+$', '')
|
|
1013
|
+
}
|
|
989
1014
|
}
|
|
990
1015
|
foreach ($dirName in $localPluginMap.Keys) {
|
|
991
1016
|
$pattern = 'link:[^"]*' + [regex]::Escape($dirName)
|
|
@@ -993,10 +1018,15 @@ foreach ($dirName in $localPluginMap.Keys) {
|
|
|
993
1018
|
}
|
|
994
1019
|
# 兜底:老仓库里 dsh-config-sync-plugin 还是 link:{{APP_ROOT}}/dsh-config-sync-plugin-xxx,
|
|
995
1020
|
# 目标机 AppRoot 下没有那个源码目录 → pnpm 装不上 → bundle "dsh-config-sync-plugin" 解析失败。
|
|
996
|
-
# 该插件已发布到 npm,统一改写成 npm
|
|
1021
|
+
# 该插件已发布到 npm,统一改写成 npm 版本依赖(用仓库 package.json 的实际值,缺省 0.4.19),
|
|
997
1022
|
# 让 pnpm install 从 registry 安装。新仓库 capture 已直接写 npm 版本,这里只兜底老仓库。
|
|
998
1023
|
if ($pkgRaw -match '"dsh-config-sync-plugin"\s*:\s*"link:') {
|
|
999
|
-
$
|
|
1024
|
+
if (-not $cssNpmVersion) {
|
|
1025
|
+
$cssNpmVersion = $null
|
|
1026
|
+
try { $cssNpmVersion = [string]$repoPkgObj.dependencies.'dsh-config-sync-plugin' } catch { $cssNpmVersion = $null }
|
|
1027
|
+
if ($cssNpmVersion -like 'link:*' -or -not $cssNpmVersion) { $cssNpmVersion = '0.4.19' }
|
|
1028
|
+
}
|
|
1029
|
+
$cssFallback = $cssNpmVersion
|
|
1000
1030
|
$pkgRaw = [regex]::Replace($pkgRaw, '"dsh-config-sync-plugin"\s*:\s*"link:[^"]*"', ('"dsh-config-sync-plugin": "' + $cssFallback + '"'))
|
|
1001
1031
|
Warn "package.json 里 dsh-config-sync-plugin 是 link: 开发依赖,已改写为 npm 版本 $cssFallback(本地源码目录在目标机不存在,必须走 npm 安装)"
|
|
1002
1032
|
}
|
|
@@ -1040,7 +1070,7 @@ if (Test-Path -LiteralPath $skillsSrc) {
|
|
|
1040
1070
|
-not (Test-Path -LiteralPath (Join-Path $skillsSrc $_.Name))
|
|
1041
1071
|
} | Select-Object -ExpandProperty Name)
|
|
1042
1072
|
if ($extraSkills.Count -gt 0) {
|
|
1043
|
-
Warn ("本机另有
|
|
1073
|
+
Warn ("本机另有 {0} 个仓库里没有的 Skill(未动,加 -PruneSkills 才删:{1})" -f $extraSkills.Count, ($extraSkills -join ', '))
|
|
1044
1074
|
}
|
|
1045
1075
|
}
|
|
1046
1076
|
}
|
|
@@ -1134,7 +1164,7 @@ Ok "已还原插件设置 / 工作流 / 各插件配置"
|
|
|
1134
1164
|
} else { Warn '跳过(未勾选同步):插件设置 / 工作流 / 各插件配置' }
|
|
1135
1165
|
if ($pendingItems.Count -gt 0) {
|
|
1136
1166
|
$pf = Write-PendingPaths $DshHome $pendingItems
|
|
1137
|
-
Warn ("有 "
|
|
1167
|
+
Warn ("有 {0} 项配置等待确认路径,本次未写入。已记到 {1},到面板「本机路径」选好目录,之后再拉取一次即可。" -f $pendingItems.Count, $pf)
|
|
1138
1168
|
} elseif (Test-SyncGroupEnabled $Scope 'settings') {
|
|
1139
1169
|
Clear-PendingPaths $DshHome
|
|
1140
1170
|
}
|
|
@@ -1147,9 +1177,9 @@ if ($overwriteItems.Count -gt 0) {
|
|
|
1147
1177
|
items = @($overwriteItems)
|
|
1148
1178
|
}
|
|
1149
1179
|
[IO.File]::WriteAllText($overwriteReport, ($ovObj | ConvertTo-Json -Depth 5), (New-Object Text.UTF8Encoding($false)))
|
|
1150
|
-
Warn ("有 "
|
|
1180
|
+
Warn ("有 {0} 份配置被仓库版本覆盖(本机改动已先备份):" -f $overwriteItems.Count)
|
|
1151
1181
|
foreach ($it in @($overwriteItems | Select-Object -First 5)) { Warn (" - " + $it.label + ":" + $it.repo + "(备份 " + $it.backup + ")") }
|
|
1152
|
-
if ($overwriteItems.Count -gt 5) { Warn (" …还有 "
|
|
1182
|
+
if ($overwriteItems.Count -gt 5) { Warn (" …还有 {0} 份,清单:{1}" -f ($overwriteItems.Count - 5), $overwriteReport) }
|
|
1153
1183
|
Warn " 想保留本机改动就先「推送」再「拉取」,别反过来。"
|
|
1154
1184
|
} else {
|
|
1155
1185
|
if (Test-Path -LiteralPath $overwriteReport) { try { Remove-Item -LiteralPath $overwriteReport -Force } catch { } }
|
|
@@ -1184,9 +1214,9 @@ if (-not (Test-SyncGroupEnabled $Scope 'mnemon')) {
|
|
|
1184
1214
|
if ($extra.Count -gt 0) {
|
|
1185
1215
|
if ($PruneMnemon) {
|
|
1186
1216
|
$extra | ForEach-Object { Remove-Item -LiteralPath (Join-Path $mnemonDst $_) -Force }
|
|
1187
|
-
Warn ("已按 -PruneMnemon 删除本机多出的 "
|
|
1217
|
+
Warn ("已按 -PruneMnemon 删除本机多出的 {0} 个记忆文件:{1}" -f $extra.Count, ($extra -join ', '))
|
|
1188
1218
|
} else {
|
|
1189
|
-
Warn ("本机另有 "
|
|
1219
|
+
Warn ("本机另有 {0} 个仓库里没有的记忆文件(未动,建议稍后在主力机 capture:{1})" -f $extra.Count, ($extra -join ', '))
|
|
1190
1220
|
}
|
|
1191
1221
|
}
|
|
1192
1222
|
$mnCount = (Get-ChildItem -LiteralPath $mnemonDst -Recurse -File -Force | Measure-Object).Count
|
|
@@ -1645,7 +1675,7 @@ function Test-PullLanding {
|
|
|
1645
1675
|
}
|
|
1646
1676
|
if ($dup.Count -gt 0) {
|
|
1647
1677
|
$issues += 'duplicate-path'
|
|
1648
|
-
Add-SyncNotice -Kind 'landing' -Path 'tables.workspaces' -Reason ("登记表里有 "
|
|
1678
|
+
Add-SyncNotice -Kind 'landing' -Path 'tables.workspaces' -Reason ("登记表里有 {0} 条重复路径,DSH 会整表判坏。" -f $dup.Count)
|
|
1649
1679
|
}
|
|
1650
1680
|
}
|
|
1651
1681
|
# 4) 会话目录:仓库有、本机 0 个 → 上层读不出会话
|
|
@@ -1655,7 +1685,7 @@ function Test-PullLanding {
|
|
|
1655
1685
|
$localDirs = if (Test-Path -LiteralPath $localSess) { @(Get-ChildItem -LiteralPath $localSess -Directory -Force).Count } else { 0 }
|
|
1656
1686
|
if ($repoDirs -gt 0 -and $localDirs -eq 0) {
|
|
1657
1687
|
$issues += 'session-dirs-0'
|
|
1658
|
-
Add-SyncNotice -Kind 'landing' -Path 'sessions' -Reason ("仓库有
|
|
1688
|
+
Add-SyncNotice -Kind 'landing' -Path 'sessions' -Reason ("仓库有 {0} 个会话目录,本机 sessions 为 0 个。" -f $repoDirs)
|
|
1659
1689
|
}
|
|
1660
1690
|
# 5) projcache 占位符残留:apply 故意不同步 projcache(让 DSH 从 session log 重建),
|
|
1661
1691
|
# 但本机若留着带占位符的旧缓存,投影同样取不到数据 —— 只提示、不阻断。
|
|
@@ -1668,24 +1698,32 @@ function Test-PullLanding {
|
|
|
1668
1698
|
}
|
|
1669
1699
|
if ($bad -gt 0) {
|
|
1670
1700
|
$issues += 'projcache-token'
|
|
1671
|
-
|
|
1701
|
+
# 0.4.20:$bad 是 int,int+string 拼接在本机 PTC/StrictMode 场景会抛终止错误
|
|
1702
|
+
# ("无法将值…转换为类型 System.Int32"),把整个 pull 收尾打成失败。一律 -f 格式化。
|
|
1703
|
+
Add-SyncNotice -Kind 'landing' -Path 'storages/session_projcache/sessions' -Reason ("{0} 个会话投影缓存仍含占位符,DSH 启动时会重建。" -f $bad)
|
|
1672
1704
|
}
|
|
1673
1705
|
}
|
|
1674
1706
|
# 6) bundle / link:复用刚才自检段算出的 $unresolved
|
|
1675
1707
|
foreach ($ub in @($unresolved)) {
|
|
1676
1708
|
Add-SyncNotice -Kind 'landing' -Path $ub -Reason 'bundle 本机不可解析,工作区/会话已落地但相关功能不可用。'
|
|
1677
1709
|
}
|
|
1678
|
-
# 7) 本机 profile 若仍用 link: 指向 AppRoot
|
|
1710
|
+
# 7) 本机 profile 若仍用 link: 指向 AppRoot 下的本地源码目录,那目录必须存在。
|
|
1711
|
+
# 0.4.19:不再写死两个插件名——遍历 profile\package.json 全部 link: 依赖,leaf 缺目录就报。
|
|
1679
1712
|
$localProfilePkg = Join-Path $ProfileDir 'package.json'
|
|
1680
1713
|
if (Test-Path -LiteralPath $localProfilePkg) {
|
|
1681
1714
|
try {
|
|
1682
1715
|
$lp = Get-Content -LiteralPath $localProfilePkg -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
1683
|
-
|
|
1684
|
-
$
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
$
|
|
1688
|
-
|
|
1716
|
+
if ($lp.dependencies) {
|
|
1717
|
+
foreach ($depProp in $lp.dependencies.PSObject.Properties) {
|
|
1718
|
+
$depName = [string]$depProp.Name
|
|
1719
|
+
$depVal = [string]$depProp.Value
|
|
1720
|
+
if ($depVal -notlike 'link:*') { continue }
|
|
1721
|
+
$leaf = [IO.Path]::GetFileName(($depVal -replace '^link:', '').TrimEnd('/', '\'))
|
|
1722
|
+
if (-not $leaf) { continue }
|
|
1723
|
+
if (-not (Test-Path -LiteralPath (Join-Path $AppRoot $leaf))) {
|
|
1724
|
+
$issues += "link:$leaf"
|
|
1725
|
+
Add-SyncNotice -Kind 'landing' -Path $leaf -Reason ("本机 profile 用 link: 依赖 " + $depName + ",但 AppRoot 下缺少 " + $leaf + " 目录。")
|
|
1726
|
+
}
|
|
1689
1727
|
}
|
|
1690
1728
|
}
|
|
1691
1729
|
} catch { }
|
package/runtime/capture.ps1
CHANGED
|
@@ -564,16 +564,31 @@ function Sync-ConversationCapture {
|
|
|
564
564
|
# 对不上工作区的 passthrough 目录不动(那种目录在 B 机本来也认不出)。
|
|
565
565
|
if ($cwdToken.Count -gt 0) {
|
|
566
566
|
$spec = [ordered]@{ home = $convDir; dirs = $cwdToken } | ConvertTo-Json -Depth 4 -Compress
|
|
567
|
-
|
|
567
|
+
# 0.4.19:临时文件名带 $PID——旧版引用了一个未赋值的 $stamp,所有进程都撞同一个
|
|
568
|
+
# dsh-repo-cwd-.json,两次并发 capture 会互相覆盖 spec/结果文件。
|
|
569
|
+
$specPath = Join-Path ([IO.Path]::GetTempPath()) ('dsh-repo-cwd-' + $PID + '.json')
|
|
568
570
|
[IO.File]::WriteAllText($specPath, $spec, (New-Object Text.UTF8Encoding($false)))
|
|
569
571
|
# 辅助脚本优先用「脚本自己旁边」的那份(仓库可能是个刚 clone 下来、还没铺 tools 的副本)
|
|
570
572
|
$helper = Join-Path $PSScriptRoot 'tools\fix-session-cwd.mjs'
|
|
571
573
|
if (-not (Test-Path -LiteralPath $helper)) { $helper = Join-Path $RepoRoot 'tools\fix-session-cwd.mjs' }
|
|
572
574
|
if (Test-Path -LiteralPath $helper) {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
if ($
|
|
575
|
+
# 0.4.19:执行器统一走 Get-HostNodeRunner(真 node → Electron ELECTRON_RUN_AS_NODE 兜底)。
|
|
576
|
+
# 旧链路在无独立 node 时拿到 $null 再 & $null,ErrorActionPreference=Stop 下直接把 capture 打死。
|
|
577
|
+
$cwdRunner = Get-HostNodeRunner $AppRoot
|
|
578
|
+
if ($cwdRunner) {
|
|
579
|
+
$cwdPrevEan = $env:ELECTRON_RUN_AS_NODE
|
|
580
|
+
try {
|
|
581
|
+
if ($cwdRunner.Electron) { $env:ELECTRON_RUN_AS_NODE = '1' }
|
|
582
|
+
& $cwdRunner.Exe $helper $specPath *>&1 | ForEach-Object { if ($_ -and ([string]$_).Trim()) { Say (' ' + ([string]$_).Trim()) } }
|
|
583
|
+
} finally {
|
|
584
|
+
if ($cwdRunner.Electron) {
|
|
585
|
+
if ($null -eq $cwdPrevEan) { Remove-Item Env:ELECTRON_RUN_AS_NODE -ErrorAction SilentlyContinue } else { $env:ELECTRON_RUN_AS_NODE = $cwdPrevEan }
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
if ($LASTEXITCODE -ne 0) { Warn '仓库会话头 cwd 归一时有文件失败(上面有原因),那几个会话可能带着本机路径入库' }
|
|
589
|
+
} else {
|
|
590
|
+
Warn '找不到可用的 node/Electron 执行器,跳过仓库会话头归一(仓库里会继续存本机路径)'
|
|
591
|
+
}
|
|
577
592
|
} else {
|
|
578
593
|
Warn ('找不到 {0},跳过仓库会话头归一(仓库里会继续存本机路径)' -f $helper)
|
|
579
594
|
}
|
|
@@ -748,7 +763,9 @@ foreach ($f in @('pnpm-lock.yaml', 'pnpm-workspace.yaml', 'cordis.yml', 'cordis.
|
|
|
748
763
|
|
|
749
764
|
# 1.5) 宿主版本契约:记下本机实测的 app 版本,另一台 apply 时据此比对,版本不一致就不铺实验性 bundle
|
|
750
765
|
# 只写 appVersion + electronVersion,不写机器名/日期(那两样会让每次 capture 都产生假 diff)。
|
|
751
|
-
#
|
|
766
|
+
# 防降级 + 不冻死(0.4.19):按 semver 单向采纳——本机版本比仓库契约新才改写;本机更旧只告警,
|
|
767
|
+
# 防止「较旧的那台 capture 一次就把契约拉低」。旧策略「只要不等就保持不变」会让 app 每次
|
|
768
|
+
# nightly 升级后契约永久冻结在旧版(apply 的实验 bundle 门控因此一直对着旧版本判断)。
|
|
752
769
|
$hostAppVersion = Get-HostAppVersion $AppRoot
|
|
753
770
|
$contractPath = Join-Path $RepoRoot 'profile\host-contract.json'
|
|
754
771
|
if (-not $hostAppVersion) {
|
|
@@ -760,8 +777,18 @@ if (-not $hostAppVersion) {
|
|
|
760
777
|
try { $existing = [string](Get-Content -LiteralPath $contractPath -Raw -Encoding utf8 | ConvertFrom-Json).appVersion } catch { $existing = $null }
|
|
761
778
|
}
|
|
762
779
|
if ($existing -and ($existing -ne $hostAppVersion)) {
|
|
763
|
-
|
|
780
|
+
$cmp = Compare-Semver $hostAppVersion $existing
|
|
781
|
+
if ($cmp -gt 0) {
|
|
782
|
+
Warn ("仓库契约 app = $existing 落后于本机 $hostAppVersion,按 0.4.19 单向采纳规则升级契约")
|
|
783
|
+
$adoptNewer = $true
|
|
784
|
+
} else {
|
|
785
|
+
Warn "仓库契约 app = $existing,本机 app = $hostAppVersion(本机较旧或无法比较,契约保持不变;防止旧机器拉低契约)"
|
|
786
|
+
$adoptNewer = $false
|
|
787
|
+
}
|
|
764
788
|
} else {
|
|
789
|
+
$adoptNewer = $true
|
|
790
|
+
}
|
|
791
|
+
if ($adoptNewer) {
|
|
765
792
|
$norm = $contractText -replace "`r`n", "`n"
|
|
766
793
|
$now = if (Test-Path -LiteralPath $contractPath) { ([IO.File]::ReadAllText($contractPath) -replace "`r`n", "`n") } else { '' }
|
|
767
794
|
if ($now -ceq $norm) {
|
|
@@ -1288,7 +1315,7 @@ function Write-OutsideRootReport {
|
|
|
1288
1315
|
items = @($items)
|
|
1289
1316
|
}
|
|
1290
1317
|
[IO.File]::WriteAllText($reportPath, ($obj | ConvertTo-Json -Depth 5), (New-Object Text.UTF8Encoding($false)))
|
|
1291
|
-
Warn ("有
|
|
1318
|
+
Warn ("有 {0} 处绝对路径不在任何已确认根下(配置 {1} 处、工作区与会话 {2} 处):换机器拉取时面板会逐条给出推荐目录。" -f $items.Count, $nConf, $nData)
|
|
1292
1319
|
Warn (" 清单:" + $reportPath + "(面板「本机路径」卡会列出来)")
|
|
1293
1320
|
foreach ($it in @($items | Select-Object -First 5)) { Warn (" - " + $it.file + " → " + $it.path) }
|
|
1294
1321
|
if ($items.Count -gt 5) { Warn (" …还有 " + ($items.Count - 5) + " 处") }
|
|
@@ -60,7 +60,7 @@ function Save-SyncNotices {
|
|
|
60
60
|
$dir = Split-Path -Parent $p
|
|
61
61
|
if ($dir -and -not (Test-Path -LiteralPath $dir)) { New-Item -ItemType Directory -Path $dir -Force | Out-Null }
|
|
62
62
|
$byKind = [ordered]@{}
|
|
63
|
-
foreach ($k in @('too-large', 'history', 'skipped', 'failed', 'plugin-missing', 'context-state')) {
|
|
63
|
+
foreach ($k in @('too-large', 'history', 'skipped', 'failed', 'plugin-missing', 'context-state', 'landing')) {
|
|
64
64
|
$byKind[$k] = @($script:SyncNoticeItems | Where-Object { $_.kind -eq $k }).Count
|
|
65
65
|
}
|
|
66
66
|
$obj = [ordered]@{
|
|
@@ -470,6 +470,58 @@ function Get-HostElectronVersion([string]$appRoot) {
|
|
|
470
470
|
return (Read-TextPreserveBom $p).Trim()
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
+
<#
|
|
474
|
+
semver 比较(0.4.19 新增,供 capture 契约单向采纳 / sync 契约生成共用):
|
|
475
|
+
返回 1 = a 更新,-1 = b 更新,0 = 相等。b 更新但解析失败时返回 0(当作「无法比较」),
|
|
476
|
+
调用方对 0 一律按「保持现状」处理,保证旧机器永远拉不低契约。
|
|
477
|
+
支持数字段 + 预发布段(0.2.2-rc.5 > 0.2.2-rc.2 > 0.2.2);不含构建段(+build 忽略)。
|
|
478
|
+
#>
|
|
479
|
+
function Compare-Semver([string]$a, [string]$b) {
|
|
480
|
+
$a = ('' + $a).Trim(); $b = ('' + $b).Trim()
|
|
481
|
+
if ($a -ceq $b) { return 0 }
|
|
482
|
+
$parse = {
|
|
483
|
+
param([string]$v)
|
|
484
|
+
if ($v -notmatch '^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.\-]+))?$') { return $null }
|
|
485
|
+
$pre = $null
|
|
486
|
+
if ($Matches[4]) { $pre = $Matches[4] -split '\.' }
|
|
487
|
+
return [pscustomobject]@{
|
|
488
|
+
Major = [long]$Matches[1]; Minor = [long]$Matches[2]; Patch = [long]$Matches[3]; Pre = $pre
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
$pa = & $parse $a
|
|
492
|
+
$pb = & $parse $b
|
|
493
|
+
if (-not $pa -or -not $pb) { return 0 }
|
|
494
|
+
foreach ($f in @('Major', 'Minor', 'Patch')) {
|
|
495
|
+
if ($pa.$f -gt $pb.$f) { return 1 }
|
|
496
|
+
if ($pa.$f -lt $pb.$f) { return -1 }
|
|
497
|
+
}
|
|
498
|
+
# 主版本段相等:无预发布 > 有预发布(semver 规则 11)
|
|
499
|
+
if (-not $pa.Pre -and -not $pb.Pre) { return 0 }
|
|
500
|
+
if (-not $pa.Pre) { return 1 }
|
|
501
|
+
if (-not $pb.Pre) { return -1 }
|
|
502
|
+
$n = [Math]::Min($pa.Pre.Count, $pb.Pre.Count)
|
|
503
|
+
for ($i = 0; $i -lt $n; $i++) {
|
|
504
|
+
$x = $pa.Pre[$i]; $y = $pb.Pre[$i]
|
|
505
|
+
if ($x -ceq $y) { continue }
|
|
506
|
+
$xn = 0L; $yn = 0L
|
|
507
|
+
$xIsNum = [long]::TryParse($x, [ref]$xn)
|
|
508
|
+
$yIsNum = [long]::TryParse($y, [ref]$yn)
|
|
509
|
+
if ($xIsNum -and $yIsNum) {
|
|
510
|
+
if ($xn -gt $yn) { return 1 }
|
|
511
|
+
if ($xn -lt $yn) { return -1 }
|
|
512
|
+
continue
|
|
513
|
+
}
|
|
514
|
+
# 数字段 < 文本段(semver 规则 12)
|
|
515
|
+
if ($xIsNum) { return -1 }
|
|
516
|
+
if ($yIsNum) { return 1 }
|
|
517
|
+
$c = [string]::CompareOrdinal($x, $y)
|
|
518
|
+
if ($c -ne 0) { return [Math]::Sign($c) }
|
|
519
|
+
}
|
|
520
|
+
if ($pa.Pre.Count -gt $pb.Pre.Count) { return 1 }
|
|
521
|
+
if ($pa.Pre.Count -lt $pb.Pre.Count) { return -1 }
|
|
522
|
+
return 0
|
|
523
|
+
}
|
|
524
|
+
|
|
473
525
|
# ---------- 客户端根(AppRoot)自动定位 ----------
|
|
474
526
|
# 客户端可能装在任意盘/任意目录,也会被卸载重装到别处;脚本里写死一个盘符换机或换盘就废。
|
|
475
527
|
# 定位顺序:显式参数(且要对得上)→ 环境变量 → 注册表卸载项的 InstallLocation(最权威)→ 常见位置。
|
package/runtime/post-exit.ps1
CHANGED
|
@@ -440,7 +440,8 @@ function Set-DefaultWorkspace {
|
|
|
440
440
|
if ($cur -eq $target) { Log ("默认工作区已经是 {0}({1}),不动" -f (Get-NormPath ([string]$targetEntry.path)), $target); return }
|
|
441
441
|
|
|
442
442
|
$stamp = (Get-Date).ToString('yyyyMMddHHmmss')
|
|
443
|
-
|
|
443
|
+
# 0.4.20:int+string 拼接在部分环境会抛终止错误(int 优先吃掉整个表达式),一律 -f
|
|
444
|
+
Copy-Item -LiteralPath $reg -Destination ('{0}.bak-{1}' -f $reg, $stamp) -Force
|
|
444
445
|
$obj.global.defaultWorkspaceId = $target
|
|
445
446
|
$text = (($obj | ConvertTo-Json -Depth 12) -replace "`r`n", "`n") + "`n"
|
|
446
447
|
[IO.File]::WriteAllText($reg, $text, (New-Object Text.UTF8Encoding($false)))
|
|
@@ -450,7 +451,7 @@ function Set-DefaultWorkspace {
|
|
|
450
451
|
$countBefore = @($tables.PSObject.Properties).Count
|
|
451
452
|
$countAfter = @($back.tables.workspaces.PSObject.Properties).Count
|
|
452
453
|
if ([string]$back.global.defaultWorkspaceId -ne $target -or $countAfter -ne $countBefore) {
|
|
453
|
-
Log ("默认工作区写入后校验不通过({0} 个工作区,期望 {1} 个),已留备份 {2}" -f $countAfter, $countBefore, (
|
|
454
|
+
Log ("默认工作区写入后校验不通过({0} 个工作区,期望 {1} 个),已留备份 {2}" -f $countAfter, $countBefore, ('{0}.bak-{1}' -f $reg, $stamp))
|
|
454
455
|
return
|
|
455
456
|
}
|
|
456
457
|
Log ("默认工作区:{0} → {1}({2}),重启后新会话落在 {3}" -f $cur, $target, [string]$targetEntry.title, [string]$targetEntry.path)
|
package/runtime/restore.ps1
CHANGED
|
@@ -412,8 +412,9 @@ if ($RollbackToPoint) {
|
|
|
412
412
|
if ($d.Name.StartsWith('.')) { continue }
|
|
413
413
|
if ($d.Name.StartsWith('@')) {
|
|
414
414
|
foreach ($s in @(Get-ChildItem -LiteralPath $d.FullName -Directory -Force -ErrorAction SilentlyContinue)) {
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
# 0.4.20:string+string 安全;但若左侧是 int 会触发 int 优先转换崩溃,统一 -f
|
|
416
|
+
$key = '{0}/{1}' -f $d.Name, $s.Name
|
|
417
|
+
if (-not $wantDeps.ContainsKey($key)) { $dropList += ,@($s.FullName, ('{0}--{1}' -f $d.Name, $s.Name), $key) }
|
|
417
418
|
}
|
|
418
419
|
continue
|
|
419
420
|
}
|
|
@@ -434,12 +435,12 @@ if ($RollbackToPoint) {
|
|
|
434
435
|
if ($item.LinkType) {
|
|
435
436
|
# 链接只删链接本身:穿进链接会把别的插件的安装目录一起删掉(实测过)
|
|
436
437
|
[IO.Directory]::Delete($full)
|
|
437
|
-
$manifest.plugins += (
|
|
438
|
+
$manifest.plugins += ('{0}(链接已删,目标目录保留)' -f $depName)
|
|
438
439
|
} else {
|
|
439
440
|
$dest = Join-Path $rbPlugins $safeName
|
|
440
441
|
New-Item -ItemType Directory -Path $rbPlugins -Force | Out-Null
|
|
441
442
|
Move-Item -LiteralPath $full -Destination $dest -Force
|
|
442
|
-
$manifest.plugins += (
|
|
443
|
+
$manifest.plugins += ('{0}(实体目录已移入 rollback\plugins)' -f $depName)
|
|
443
444
|
}
|
|
444
445
|
} catch {
|
|
445
446
|
$manifest.errors += ("$depName : " + $_.Exception.Message)
|
package/runtime/sync.ps1
CHANGED
|
@@ -694,22 +694,20 @@ function Initialize-EmptyRepo([string]$RemoteUrl) {
|
|
|
694
694
|
|
|
695
695
|
$contractPath = Join-Path $RepoRoot 'profile\host-contract.json'
|
|
696
696
|
if (-not (Test-Path -LiteralPath $contractPath)) {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
$vf = Join-Path $AppRoot 'version'
|
|
704
|
-
if (Test-Path -LiteralPath $vf) { $ver = (Get-Content -LiteralPath $vf -Raw -Encoding utf8).Trim() }
|
|
705
|
-
}
|
|
697
|
+
# 0.4.19:复用 Get-HostAppVersion(dsh-sync-common.ps1),它的读取链是
|
|
698
|
+
# resources\app\package.json → app.asar 内 dsh/package.json(asar 手工解析)。
|
|
699
|
+
# 旧回退链在打包版下读不到 resources\app\,兜底去读 <AppRoot>\version——那是 electron-builder
|
|
700
|
+
# 写的 Electron 框架版本(如 44.7.0),被当 appVersion 写进契约后,capture 的防降级
|
|
701
|
+
# 策略会把它永久冻住,另一台 apply 的实验 bundle 门控就对着一个假版本判断。
|
|
702
|
+
$ver = Get-HostAppVersion $AppRoot
|
|
706
703
|
if ($ver) {
|
|
707
704
|
$dir = Join-Path $RepoRoot 'profile'
|
|
708
705
|
if (-not (Test-Path -LiteralPath $dir)) { New-Item -ItemType Directory -Path $dir -Force | Out-Null }
|
|
709
706
|
$obj = [ordered]@{
|
|
710
|
-
appVersion
|
|
711
|
-
|
|
712
|
-
|
|
707
|
+
appVersion = $ver
|
|
708
|
+
electronVersion = Get-HostElectronVersion $AppRoot
|
|
709
|
+
generatedAt = (Get-Date -Format 'yyyy-MM-dd HH:mm:ss')
|
|
710
|
+
note = '由 dsh-config-sync 首次推送生成(客户端版本契约)'
|
|
713
711
|
}
|
|
714
712
|
[IO.File]::WriteAllText($contractPath, ($obj | ConvertTo-Json -Depth 4), (New-Object Text.UTF8Encoding $false))
|
|
715
713
|
Ok "已写入版本契约:$ver"
|
|
@@ -834,6 +832,28 @@ if ($Action -eq 'push') {
|
|
|
834
832
|
Warn "建议完全退出(含托盘)后重跑;确认要继续可加 -Force"
|
|
835
833
|
Die "已停止(未抓取、未提交)。"
|
|
836
834
|
}
|
|
835
|
+
# 0.4.19:推送前先把云端最新历史取下来核对——capture 的镜像删除以「本机没有 = 删仓库」为准,
|
|
836
|
+
# 若另一台机器刚推过而本机没拉,未取下的快进合并会把对方独有的文件(尤其会话/附件这类
|
|
837
|
+
# 不可再生数据)从仓库里删掉。这里取完发现云端领先就停,让用户先拉取;-Force 可显式越过。
|
|
838
|
+
$behindCheck = $null
|
|
839
|
+
if ($hasGit -and $hasCommit) {
|
|
840
|
+
$fetchOut = (& "$env:ComSpec" /c ('"' + $git + '" -C "' + $RepoRoot + '" fetch origin --prune 2>&1') | Out-String)
|
|
841
|
+
if ($LASTEXITCODE -eq 0) {
|
|
842
|
+
$upstreamProbe = (Get-GitText 'rev-parse --abbrev-ref --symbolic-full-name "@{upstream}"')
|
|
843
|
+
if ($upstreamProbe.Code -eq 0 -and $upstreamProbe.Text) {
|
|
844
|
+
$cnt = (Get-GitText ('rev-list --count HEAD..' + $upstreamProbe.Text))
|
|
845
|
+
if ($cnt.Code -eq 0 -and $cnt.Text) { $behindCheck = 0; [void][int]::TryParse($cnt.Text, [ref]$behindCheck) }
|
|
846
|
+
}
|
|
847
|
+
} else {
|
|
848
|
+
Warn "推送前 fetch 失败(网络/地址问题):继续按无更新处理,但若另一台机器刚推过,本次镜像删除可能覆盖它的改动"
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
if ($behindCheck -gt 0 -and -not $Force) {
|
|
852
|
+
Warn ("云端比本机领先 {0} 个提交:先拉取(pwsh -File sync.ps1 pull),否则 capture 的镜像删除会把云端独有的文件从仓库删掉。" -f $behindCheck)
|
|
853
|
+
Die "已停止(未抓取、未提交、未推送)。确认要覆盖云端请加 -Force。"
|
|
854
|
+
} elseif ($behindCheck -gt 0) {
|
|
855
|
+
Warn ("云端比本机领先 {0} 个提交(-Force 已越过检查):镜像删除可能清掉云端独有文件,会话/附件不可再生,请确认。" -f $behindCheck)
|
|
856
|
+
}
|
|
837
857
|
$captureArgs = @{ RepoRoot = $RepoRoot; DshHome = $DshHome; ProfileName = $ProfileName; AppRoot = $AppRoot; WorkspaceHome = $WorkspaceHome; NoResetNotices = $true }
|
|
838
858
|
if ($WorkspaceOnly) { $captureArgs['WorkspaceOnly'] = $true }
|
|
839
859
|
if ($SkipWorkspace) { $captureArgs['SkipWorkspace'] = $true }
|
|
@@ -844,7 +864,10 @@ if ($Action -eq 'push') {
|
|
|
844
864
|
Say ""
|
|
845
865
|
Say "== 提交 =="
|
|
846
866
|
Initialize-CommitIdentity
|
|
847
|
-
|
|
867
|
+
# 0.4.19:与 push 同款 cmd 转发。本脚本 ErrorActionPreference=Stop,git add 偶尔往 stderr 写
|
|
868
|
+
# advice/告警时会被包成 NativeCommandError 直接中断——且发生在 add 之后 commit 之前,索引留半截。
|
|
869
|
+
& "$env:ComSpec" /c ('"' + $git + '" -C "' + $RepoRoot + '" add -A 2>&1') | Out-Null
|
|
870
|
+
if ($LASTEXITCODE -ne 0) { Die ("git add -A 失败(退出码 {0}):索引/文件系统可能异常(如 .git/index.lock)。" -f $LASTEXITCODE) }
|
|
848
871
|
# 走 Read-GitLines:中文目录名若被 quotepath 转义成 "…\347\240\264…",连引号一起拿进
|
|
849
872
|
# Test-Path -LiteralPath 就是「路径中具有非法字符」,整次同步会在这里挂掉
|
|
850
873
|
$pending = @((Read-GitLines 'diff --cached --name-only').Lines)
|
|
@@ -1015,6 +1038,9 @@ if ($Action -eq 'push') {
|
|
|
1015
1038
|
$quotaHit = [bool]($pushOut -match 'exceeds .*quota|repository size|total repository size|仓库容量|容量上限')
|
|
1016
1039
|
$networkHit = [bool]($pushOut -match 'Could not read from remote|Permission denied|publickey|Host key verification|Could not resolve host|timed out|Connection refused|Operation timed out')
|
|
1017
1040
|
$rejectedHit = [bool]($pushOut -match '\[remote rejected\]|pre-receive hook declined')
|
|
1041
|
+
# 0.4.19:普通推送被拒(远端领先/分支保护)单独分类——双机竞态下最常见的失败,
|
|
1042
|
+
# 旧版落进兜底「既不是文件超限也不是已知网络特征」,排查体验差。
|
|
1043
|
+
$nonFastForwardHit = [bool]($pushOut -match 'non-fast-forward|fetch first|\[rejected\]')
|
|
1018
1044
|
|
|
1019
1045
|
if ($remoteOversized.Count -gt 0 -or $histTooLarge.Count -gt 0) {
|
|
1020
1046
|
# 有具体文件名(远端报的)或历史预检命中:这是「文件超限」,不是网络
|
|
@@ -1038,6 +1064,10 @@ if ($Action -eq 'push') {
|
|
|
1038
1064
|
Die ("git push 被远端拒绝(remote rejected / pre-receive hook declined),原因见上面 remote: 那几行。" +
|
|
1039
1065
|
"`n 改动已提交在本地,处理完远端限制后重跑 git -C `"$RepoRoot`" push 即可。")
|
|
1040
1066
|
}
|
|
1067
|
+
if ($nonFastForwardHit) {
|
|
1068
|
+
Die ("git push 被拒:远端比本机领先(non-fast-forward),多半是另一台机器刚推送过。" +
|
|
1069
|
+
"`n 处理:先执行拉取 pwsh -File `"$RepoRoot\sync.ps1`" pull(有分叉时按面板「同步冲突」处理),再重新推送。")
|
|
1070
|
+
}
|
|
1041
1071
|
if ($networkHit) {
|
|
1042
1072
|
Die "git push 失败(网络/认证)。改动已提交在本地,修好网络后重跑:git -C `"$RepoRoot`" push;若是 GIT_SSH_COMMAND 问题,先确认它第一个词是 ssh.exe 本体"
|
|
1043
1073
|
}
|
package/tools/selftest.mjs
CHANGED
|
@@ -92,12 +92,16 @@ function check(label, cond, detail = '') {
|
|
|
92
92
|
if (cond) console.log(` [OK] ${label}`)
|
|
93
93
|
else { failures++; console.log(` [X] ${label}${detail ? ' — ' + detail : ''}`) }
|
|
94
94
|
}
|
|
95
|
+
// 环境守卫:远端地址未配置时(本机 dsh-config-sync.json 的 remoteUrl 为空),依赖远端配置的
|
|
96
|
+
// prepare/分流断言无法成立——这是环境状态而非代码回归,按 SKIP 记(0.4.20 起)。
|
|
97
|
+
// remoteConfigured 在 body 取到后赋值(见 status 调用之后)。
|
|
95
98
|
|
|
96
99
|
console.log('== dsh-config-sync-plugin 宿主半身自检 ==')
|
|
97
100
|
check('apply() 注册了路由', routes.size === 13 && routes.has('/config-sync/auto-exit') && routes.has('/config-sync/update') && routes.has('/config-sync/scope') && routes.has('/config-sync/extra-config') && routes.has('/config-sync/conflict') && routes.has('/config-sync/roots') && routes.has('/config-sync/feedback') && routes.has('/config-sync/cache-guard') && routes.has('/config-sync/workspace-view'), `实际 ${routes.size} 条:${[...routes.keys()].join(', ')}`)
|
|
98
101
|
|
|
99
102
|
const status = await call('/config-sync/status', { headers: { host: 'localhost:3080' } })
|
|
100
103
|
const body = JSON.parse(status.body || '{}')
|
|
104
|
+
const remoteConfigured = Boolean(body.remote && body.remote.configured === true)
|
|
101
105
|
check('status 返回 200', status.statusCode === 200, String(status.statusCode))
|
|
102
106
|
check('status.ok === true', body.ok === true, status.body.slice(0, 160))
|
|
103
107
|
check('含 repo / version / bundles / deps / advice',
|
|
@@ -211,6 +215,11 @@ for (const b of (allPayload.built || [])) restoreCmd(b.path)
|
|
|
211
215
|
existsSync(pushPayload.path || '') && readFileSync(pushPayload.path, 'utf8').includes('sync.ps1'),
|
|
212
216
|
pushPayload.path || '(无路径)')
|
|
213
217
|
if (existsSync(pushPayload.path || '')) restoreCmd(pushPayload.path)
|
|
218
|
+
} else if (!remoteConfigured) {
|
|
219
|
+
console.log(' [SKIP] 云端有内容:prepare(push) 被拒,并指向「先拉取」 — 远端地址未配置(环境状态,非代码回归)')
|
|
220
|
+
console.log(' [SKIP] 云端有内容:prepare(pull) 放行 — 远端地址未配置')
|
|
221
|
+
console.log(' [SKIP] prepare(all) 按状态组合脚本(两边空→推送+还原;否则→拉取+还原) — 远端地址未配置')
|
|
222
|
+
console.log(' [SKIP] prepare(all) 带上 initPush 标记(面板据此显示「初始化推送」) — 远端地址未配置')
|
|
214
223
|
} else {
|
|
215
224
|
check('云端有内容:prepare(push) 被拒,并指向「先拉取」',
|
|
216
225
|
pPush.statusCode === 400 && /云端仓库已经有内容/.test(pushPayload.error || ''),
|
|
@@ -226,6 +235,8 @@ for (const b of (allPayload.built || [])) restoreCmd(b.path)
|
|
|
226
235
|
check('两边都空:prepare(pull) 被拒(没有东西可拉)',
|
|
227
236
|
pPull.statusCode === 400 && /连不上云端|云端仓库已经有内容|空/.test(pullPayload.error || ''),
|
|
228
237
|
pPull.body.slice(0, 160))
|
|
238
|
+
} else if (!remoteConfigured) {
|
|
239
|
+
console.log(' [SKIP] 云端有内容:prepare(pull) 放行 — 远端地址未配置(环境状态,非代码回归)')
|
|
229
240
|
} else {
|
|
230
241
|
check('云端有内容:prepare(pull) 放行', pPull.statusCode === 200 && pullPayload.ok === true, pPull.body.slice(0, 160))
|
|
231
242
|
if (existsSync(pullPayload.path || '')) {
|
|
@@ -241,13 +252,18 @@ for (const b of (allPayload.built || [])) restoreCmd(b.path)
|
|
|
241
252
|
})
|
|
242
253
|
const allP = JSON.parse(pAll.body || '{}')
|
|
243
254
|
const acts = (allP.built || []).map((b) => b.action)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
255
|
+
if (!remoteConfigured) {
|
|
256
|
+
console.log(' [SKIP] prepare(all) 按状态组合脚本(两边空→推送+还原;否则→拉取+还原) — 远端地址未配置(环境状态,非代码回归)')
|
|
257
|
+
console.log(' [SKIP] prepare(all) 带上 initPush 标记(面板据此显示「初始化推送」) — 远端地址未配置')
|
|
258
|
+
} else {
|
|
259
|
+
check('prepare(all) 按状态组合脚本(两边空→推送+还原;否则→拉取+还原)',
|
|
260
|
+
pAll.statusCode === 200
|
|
261
|
+
&& (cloudEmpty ? acts.includes('push') && !acts.includes('pull') : acts.includes('pull') && !acts.includes('push')),
|
|
262
|
+
JSON.stringify(acts))
|
|
263
|
+
check('prepare(all) 带上 initPush 标记(面板据此显示「初始化推送」)',
|
|
264
|
+
Boolean(allP.bootstrap) && allP.bootstrap.initPush === cloudEmpty,
|
|
265
|
+
JSON.stringify(allP.bootstrap && { initPush: allP.bootstrap.initPush }))
|
|
266
|
+
}
|
|
251
267
|
for (const b of (allP.built || [])) restoreCmd(b.path)
|
|
252
268
|
}
|
|
253
269
|
|
|
@@ -291,8 +307,13 @@ check('不存在的私钥被拒(400)', badKey.statusCode === 400, String(bad
|
|
|
291
307
|
// 合法保存:沿用当前地址,所以不会触发 git remote set-url(自检不该改用户仓库)
|
|
292
308
|
const okSave = await putSettings({ remoteUrl: body.remote.url, sshKey: body.remote.sshKey })
|
|
293
309
|
const okPayload = JSON.parse(okSave.body || '{}')
|
|
294
|
-
|
|
295
|
-
|
|
310
|
+
if (!remoteConfigured) {
|
|
311
|
+
console.log(' [SKIP] 合法设置保存成功 — 远端地址未配置(环境状态,非代码回归)')
|
|
312
|
+
console.log(' [SKIP] 保存后不回写非当前地址(gitRemoteSet=false,自检不动仓库) — 远端地址未配置')
|
|
313
|
+
} else {
|
|
314
|
+
check('合法设置保存成功', okSave.statusCode === 200 && okPayload.ok === true, okSave.body.slice(0, 160))
|
|
315
|
+
check('保存后不回写非当前地址(gitRemoteSet=false,自检不动仓库)', okPayload.gitRemoteSet === false, String(okPayload.gitRemoteSet))
|
|
316
|
+
}
|
|
296
317
|
check('保存后设置文件落盘', existsSync(settingsFile), settingsFile)
|
|
297
318
|
check('设置文件含 remoteUrl 字段', existsSync(settingsFile) && readFileSync(settingsFile, 'utf8').includes('remoteUrl'))
|
|
298
319
|
|
|
@@ -313,9 +334,13 @@ if (repoReady) {
|
|
|
313
334
|
restoreCmd(againPayload.path)
|
|
314
335
|
}
|
|
315
336
|
} else {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
337
|
+
if (!remoteConfigured) {
|
|
338
|
+
console.log(' [SKIP] 本机无内容时:保存设置后 push 仍按云端状态分流(不会因为改了设置就放行) — 远端地址未配置(环境状态,非代码回归)')
|
|
339
|
+
} else {
|
|
340
|
+
check('本机无内容时:保存设置后 push 仍按云端状态分流(不会因为改了设置就放行)',
|
|
341
|
+
(again.statusCode === 200 && againPayload.ok === true) || (again.statusCode === 400 && /云端仓库已经有内容/.test(againPayload.error || '')),
|
|
342
|
+
again.body.slice(0, 160))
|
|
343
|
+
}
|
|
319
344
|
if (existsSync(againPayload.path || '')) restoreCmd(againPayload.path)
|
|
320
345
|
}
|
|
321
346
|
|
|
@@ -942,9 +967,13 @@ if (repoReady) {
|
|
|
942
967
|
'index.js')
|
|
943
968
|
} else {
|
|
944
969
|
// 仓库还没内容、云端已有内容时,带说明的 push 同样该被拒;说明字段的清洗逻辑用静态断言兜住
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
970
|
+
if (!remoteConfigured) {
|
|
971
|
+
console.log(' [SKIP] 本机无内容时:带说明的 push 仍被拒(不被说明字段绕过门禁) — 远端地址未配置(环境状态,非代码回归)')
|
|
972
|
+
} else {
|
|
973
|
+
check('本机无内容时:带说明的 push 仍被拒(不被说明字段绕过门禁)',
|
|
974
|
+
noted.statusCode === 400 && /云端仓库已经有内容/.test(notedPayload.error || ''),
|
|
975
|
+
noted.body.slice(0, 160))
|
|
976
|
+
}
|
|
948
977
|
check('提交说明清洗在源码里(去双引号)',
|
|
949
978
|
/\$\{.*message.*\}/.test(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'index.js'), 'utf8'))
|
|
950
979
|
|| /replace\(\/\["\\r\\n\]/.test(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'index.js'), 'utf8')),
|
|
@@ -1210,7 +1239,7 @@ console.log('== 默认工作区校正 ==')
|
|
|
1210
1239
|
&& post.includes('off|none'),
|
|
1211
1240
|
'目标匹配或 off 开关缺失')
|
|
1212
1241
|
check('写前备份、写后回读校验(值 + 工作区条数)',
|
|
1213
|
-
post.includes(".bak-'
|
|
1242
|
+
post.includes("'{0}.bak-{1}' -f $reg, $stamp") && post.includes('countAfter -ne $countBefore'),
|
|
1214
1243
|
'缺少备份或回读校验')
|
|
1215
1244
|
check('设置字段 defaultWorkspace 进 read/write 与保存白名单',
|
|
1216
1245
|
host.includes('defaultWorkspace: typeof raw.defaultWorkspace')
|
|
@@ -2110,7 +2139,7 @@ console.log('== 0.4.17:拉取落地加固(前置检查 + 自愈 + 落地验
|
|
|
2110
2139
|
&& appS.includes('duplicate-path') && appS.includes('session-dirs-0'), 'apply.ps1')
|
|
2111
2140
|
check('落地验证覆盖 projcache/bundle/link 且写 pull-landing-check.json',
|
|
2112
2141
|
appS.includes('projcache-token') && appS.includes('pull-landing-check.json')
|
|
2113
|
-
&& appS.includes(
|
|
2142
|
+
&& appS.includes("link:$leaf"), 'apply.ps1')
|
|
2114
2143
|
|
|
2115
2144
|
// notice 白名单与面板文案同步
|
|
2116
2145
|
check('index.js notice KINDS 含 landing',
|