dsh-config-manager 0.7.0 → 0.8.1
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/lib/adapters/mcp.d.ts +6 -1
- package/lib/adapters/mcp.js +22 -4
- package/lib/adapters/test-helpers.d.ts +7 -0
- package/lib/adapters/test-helpers.js +11 -0
- package/lib/cli/actions.js +1 -1
- package/lib/client.d.ts +9 -2
- package/lib/client.js +683 -647
- package/lib/core/backup.d.ts +9 -1
- package/lib/core/backup.js +21 -0
- package/lib/core/messages-core.d.ts +3 -0
- package/lib/core/messages-core.js +6 -0
- package/lib/core/messages.d.ts +7 -0
- package/lib/core/messages.js +14 -0
- package/lib/core/model-tools.js +2 -0
- package/lib/core/patch-document.d.ts +65 -0
- package/lib/core/patch-document.js +161 -0
- package/lib/core/phase4-crash-child.js +1 -1
- package/lib/core/plugin-cli.d.ts +11 -0
- package/lib/core/plugin-cli.js +30 -0
- package/lib/core/restore-wal.d.ts +2 -0
- package/lib/core/restore-wal.js +11 -6
- package/lib/core/restore.d.ts +15 -2
- package/lib/core/restore.js +65 -3
- package/lib/core/snapshot-diff.js +2 -1
- package/lib/core/types.d.ts +32 -0
- package/lib/index.d.ts +8 -1
- package/lib/index.js +51 -68
- package/lib/routes/route-support.d.ts +5 -0
- package/lib/routes/route-support.js +28 -2
- package/lib/routes/sync.js +3 -0
- package/lib/sync/merge-preview-view.d.ts +78 -0
- package/lib/sync/merge-preview-view.js +46 -0
- package/lib/sync/merge.d.ts +2 -1
- package/lib/sync/merge.js +9 -4
- package/lib/sync/plugin-removal-apply.d.ts +95 -0
- package/lib/sync/plugin-removal-apply.js +158 -0
- package/lib/sync/plugin-removals.d.ts +90 -0
- package/lib/sync/plugin-removals.js +167 -0
- package/lib/sync/sync-engine.d.ts +34 -43
- package/lib/sync/sync-engine.js +50 -42
- package/lib/sync/sync-selection.d.ts +8 -0
- package/lib/sync/sync-selection.js +6 -0
- package/lib/sync/workspace-merge.d.ts +8 -1
- package/lib/ui/restore-plan-view.js +1 -0
- package/lib/ui/sync-settings-view.d.ts +10 -0
- package/lib/ui/sync-settings-view.js +2 -0
- package/package.json +1 -1
- package/src/adapters/mcp.test.ts +23 -3
- package/src/adapters/mcp.ts +24 -4
- package/src/adapters/test-helpers.ts +10 -0
- package/src/cli/actions.ts +1 -1
- package/src/client/common/info-hint-guard.test.ts +2 -1
- package/src/client/run-store.test.ts +7 -5
- package/src/client/run-store.ts +4 -5
- package/src/client/sync/SyncPanel.tsx +10 -0
- package/src/client/sync/SyncSectionPickerDialog.tsx +17 -1
- package/src/client/sync/sync-locales.ts +4 -0
- package/src/client/sync/sync-view.ts +6 -0
- package/src/core/backup.ts +21 -1
- package/src/core/messages-core.ts +6 -0
- package/src/core/messages.ts +14 -0
- package/src/core/model-tools.ts +2 -0
- package/src/core/patch-document.test.ts +107 -0
- package/src/core/patch-document.ts +194 -0
- package/src/core/phase4-crash-child.ts +1 -1
- package/src/core/plugin-cli.ts +37 -0
- package/src/core/restore-plugin-install.test.ts +116 -0
- package/src/core/restore-wal.ts +12 -6
- package/src/core/restore.ts +79 -4
- package/src/core/smoke.test.ts +5 -0
- package/src/core/snapshot-diff.test.ts +1 -1
- package/src/core/snapshot-diff.ts +2 -1
- package/src/core/types.ts +31 -0
- package/src/index.facade.test.ts +83 -1
- package/src/index.ts +57 -67
- package/src/routes/route-support.ts +27 -2
- package/src/routes/sync.ts +3 -0
- package/src/security/security.test.ts +1 -0
- package/src/sync/merge-preview-view.ts +97 -0
- package/src/sync/merge.test.ts +17 -15
- package/src/sync/merge.ts +10 -3
- package/src/sync/plugin-removal-apply.ts +198 -0
- package/src/sync/plugin-removals.test.ts +221 -0
- package/src/sync/plugin-removals.ts +208 -0
- package/src/sync/sync-engine.test.ts +251 -1
- package/src/sync/sync-engine.ts +84 -83
- package/src/sync/sync-selection.test.ts +29 -7
- package/src/sync/sync-selection.ts +13 -0
- package/src/sync/workspace-merge.ts +9 -0
- package/src/ui/restore-plan-view.test.ts +1 -1
- package/src/ui/restore-plan-view.ts +1 -0
- package/src/ui/snapshots-view.test.ts +1 -1
- package/src/ui/sync-settings-view.test.ts +20 -0
- package/src/ui/sync-settings-view.ts +12 -0
- package/src/utils/patch-yaml.test.ts +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 合并预览的**可渲染视图**(分区结果 → 界面结构),与「预览产物能否与基线比对」的判定。
|
|
3
|
+
*
|
|
4
|
+
* 为什么独立成文件:sync-engine 已顶到文件体量棘轮(tests/file-size-ratchet.test.ts),
|
|
5
|
+
* 而这两件事都只依赖 merge.ts 的结果类型与预览文本工具,不碰引擎实例状态;放这里可单测,
|
|
6
|
+
* 也让引擎只管编排。类型经 sync-engine 再导出,既有导入方(model-tools 等)无需改动。
|
|
7
|
+
*/
|
|
8
|
+
import { isLocalPluginSpec } from '../core/local-plugin-pack.js';
|
|
9
|
+
import { previewTextOf } from './merge-preview-text.js';
|
|
10
|
+
/** plan 的单个分区结果 → 预览视图(三侧都只回传可读文本,绝不回传原始值)。 */
|
|
11
|
+
export function mergePreviewSectionView(result) {
|
|
12
|
+
const conflicts = result.conflicts.map((c) => ({
|
|
13
|
+
path: c.path,
|
|
14
|
+
kind: c.kind,
|
|
15
|
+
...(c.reason !== undefined ? { reason: c.reason } : {}),
|
|
16
|
+
localPreview: previewTextOf(c.local),
|
|
17
|
+
remotePreview: previewTextOf(c.remote),
|
|
18
|
+
ancestorPreview: previewTextOf(c.ancestor),
|
|
19
|
+
}));
|
|
20
|
+
return {
|
|
21
|
+
id: result.id,
|
|
22
|
+
decision: result.decision,
|
|
23
|
+
...(result.autoMerged !== undefined ? { autoMerged: result.autoMerged } : {}),
|
|
24
|
+
conflictCount: result.conflicts.length,
|
|
25
|
+
conflicts,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* issue #91:走只读 `preview()` 拿到的产物,能否直接与该分区**基线 hash**(push 时按 export() 产物记录)比对。
|
|
30
|
+
*
|
|
31
|
+
* 为什么需要这个判定:`plugins` 适配器的 `preview()` 走 `collect(…, pack=false)` —— 刻意**不做**
|
|
32
|
+
* 本地源(`link:` / `file:`)插件的 `npm pack`。于是当 profile 里存在本地源插件时,预览产物既没有
|
|
33
|
+
* `localTarballs`、插件 spec 也保持原样(export() 会改写成 `file:<tarball>`),与基线**不同口径**:
|
|
34
|
+
* 此时既不能断言「无变化」(本地插件源码改了体积/内容,预览看不见),也不该为了比对去打包
|
|
35
|
+
* (那正是本 issue 的缺陷本身)。
|
|
36
|
+
*
|
|
37
|
+
* 返回 true = 该分区本趟**不可比** ⇒ 调用方只能保守报「有变化」并如实说明原因。
|
|
38
|
+
* 其余分区的 preview() 产物与 export() 逐字节相同(文件类分区不走 preview(),见 previewPush)。
|
|
39
|
+
*/
|
|
40
|
+
export function previewCaliberDiffersFromExport(sectionId, data) {
|
|
41
|
+
if (sectionId !== 'plugins')
|
|
42
|
+
return false;
|
|
43
|
+
const plugins = data.plugins;
|
|
44
|
+
return Array.isArray(plugins) && plugins.some((p) => isLocalPluginSpec(p?.spec));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=merge-preview-view.js.map
|
package/lib/sync/merge.d.ts
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* 文件级(FilesSection 内的 relativePath)才是真正的删除语义,那里按 modify/delete 判冲突。
|
|
31
31
|
*/
|
|
32
32
|
import type { SectionData, SectionId } from '../schema/types.ts';
|
|
33
|
+
import type { GranularMergeHooks } from './workspace-merge.ts';
|
|
33
34
|
/**
|
|
34
35
|
* 分区级决胜结果(三方合并,2026-10 收口):
|
|
35
36
|
* - 'skip' :双侧相对祖先都未改(或本就无变化)—— 不产生任何写入;
|
|
@@ -74,4 +75,4 @@ export interface MergePlan {
|
|
|
74
75
|
sections: MergeSectionResult[];
|
|
75
76
|
}
|
|
76
77
|
/** 主入口:三方合并。纯函数,无副作用。 */
|
|
77
|
-
export declare function merge(local: Partial<Record<SectionId, SectionData>>, remote: Partial<Record<SectionId, SectionData>>, ancestor?: Partial<Record<SectionId, SectionData
|
|
78
|
+
export declare function merge(local: Partial<Record<SectionId, SectionData>>, remote: Partial<Record<SectionId, SectionData>>, ancestor?: Partial<Record<SectionId, SectionData>>, hooks?: GranularMergeHooks): MergePlan;
|
package/lib/sync/merge.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { hashSection } from './sync-state.js';
|
|
2
2
|
import { mergeBytesThreeWay, mergeJsonValues } from './text-merge.js';
|
|
3
|
+
import { mergePluginsSection } from './plugin-removals.js';
|
|
3
4
|
import { mergeWorkspacesSection } from './workspace-merge.js';
|
|
4
5
|
/** 收集 local/remote/ancestor 三个快照中出现过的所有分区 id。 */
|
|
5
6
|
function unionSectionIds(local, remote, ancestor) {
|
|
@@ -223,9 +224,13 @@ function mergeFilesSectionGranular(local, remote, ancestor) {
|
|
|
223
224
|
*/
|
|
224
225
|
const GRANULAR_MERGES = {
|
|
225
226
|
workspaces: mergeWorkspacesSection,
|
|
227
|
+
// plugins(issue #132):plugins 是**数组**,通用 JSON 合并对「两侧各自改过」一律判冲突 ——
|
|
228
|
+
// 本机装了 Y、远端删了 X 就会整分区冲突,X 永远删不掉、Y 也永远同步不出去。
|
|
229
|
+
// 钩子按包名做三方逐条判定(本地新增保留 / 远端删除跟随 / 版本冲突交人工)。
|
|
230
|
+
plugins: mergePluginsSection,
|
|
226
231
|
};
|
|
227
232
|
/** 单分区三方合并(决策链见文件头注释)。 */
|
|
228
|
-
function mergeSectionTriple(id, lData, rData, aData, h) {
|
|
233
|
+
function mergeSectionTriple(id, lData, rData, aData, h, hooks) {
|
|
229
234
|
// ⓪ 形状闸门(先于一切取舍):远端载荷来自不可信输入(解析层只保证整体是合法 JSON,
|
|
230
235
|
// 不保证每个分区的值形状正确)。值形状不对时**绝不原样采用** —— 那等于把畸形数据
|
|
231
236
|
// 写进本机配置;一律按 conflict(reason='format') 交用户裁决。
|
|
@@ -288,7 +293,7 @@ function mergeSectionTriple(id, lData, rData, aData, h) {
|
|
|
288
293
|
// 没有祖先时也应并集(否则首轮同步就整分区冲突),字段取值分歧由钩子逐键如实报冲突。
|
|
289
294
|
const granular = GRANULAR_MERGES[id];
|
|
290
295
|
if (granular !== undefined) {
|
|
291
|
-
const res = granular(local, remote, aData);
|
|
296
|
+
const res = granular(local, remote, aData, hooks);
|
|
292
297
|
if (res !== undefined) {
|
|
293
298
|
if (res.conflicts.length > 0)
|
|
294
299
|
return { id, decision: 'conflict', conflicts: res.conflicts };
|
|
@@ -358,7 +363,7 @@ function mergeSectionTriple(id, lData, rData, aData, h) {
|
|
|
358
363
|
};
|
|
359
364
|
}
|
|
360
365
|
/** 主入口:三方合并。纯函数,无副作用。 */
|
|
361
|
-
export function merge(local, remote, ancestor) {
|
|
366
|
+
export function merge(local, remote, ancestor, hooks = {}) {
|
|
362
367
|
const l = local;
|
|
363
368
|
const r = remote;
|
|
364
369
|
const a = ancestor;
|
|
@@ -366,7 +371,7 @@ export function merge(local, remote, ancestor) {
|
|
|
366
371
|
const hashes = computeHashes(l, r, a, ids);
|
|
367
372
|
const results = [];
|
|
368
373
|
for (const id of ids) {
|
|
369
|
-
results.push(mergeSectionTriple(id, l[id], r[id], a ? a[id] : undefined, hashes.get(id)));
|
|
374
|
+
results.push(mergeSectionTriple(id, l[id], r[id], a ? a[id] : undefined, hashes.get(id), hooks));
|
|
370
375
|
}
|
|
371
376
|
return { sections: results };
|
|
372
377
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { MsgFunc } from '../core/messages.ts';
|
|
2
|
+
import type { SnapshotPluginRemoval } from '../core/types.ts';
|
|
3
|
+
import type { SectionData, SectionId } from '../schema/types.ts';
|
|
4
|
+
import type { PluginRemovalEntry, PluginRemovalPlan } from './plugin-removals.ts';
|
|
5
|
+
/** 一条插件卸载结果(reinstallTarget 供 undo 与人工补装使用)。 */
|
|
6
|
+
export interface PluginRemovalReportItem {
|
|
7
|
+
name: string;
|
|
8
|
+
version: string;
|
|
9
|
+
/** 重装目标:`name@version`(版本未知时退回裸包名) */
|
|
10
|
+
reinstallTarget: string;
|
|
11
|
+
ok: boolean;
|
|
12
|
+
/** 失败原因(已由 CLI 分类器给出可操作文案);ok=true 时缺省 */
|
|
13
|
+
message?: string;
|
|
14
|
+
}
|
|
15
|
+
/** 预览侧的删除视图(确认页据此单列「将删除:X@1.2.3」,用户可整轮取消)。 */
|
|
16
|
+
export interface PluginRemovalPreviewView {
|
|
17
|
+
pluginRemovals: {
|
|
18
|
+
name: string;
|
|
19
|
+
version: string;
|
|
20
|
+
}[];
|
|
21
|
+
pluginRemovalConflicts: {
|
|
22
|
+
name: string;
|
|
23
|
+
ancestorVersion: string;
|
|
24
|
+
localVersion: string;
|
|
25
|
+
}[];
|
|
26
|
+
pluginRemovalSkipped: {
|
|
27
|
+
name: string;
|
|
28
|
+
reason: string;
|
|
29
|
+
}[];
|
|
30
|
+
}
|
|
31
|
+
/** 判据输入侧的「已装插件」最小形状(PluginInfo 与 PluginEntry 都能直接传)。 */
|
|
32
|
+
type InstalledPlugin = {
|
|
33
|
+
name: string;
|
|
34
|
+
version: string;
|
|
35
|
+
enabled?: boolean;
|
|
36
|
+
spec?: string;
|
|
37
|
+
bundlesOnly?: boolean;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* 把某个分区载荷里的插件清单抽成判据要的形状(不认识 = undefined)。
|
|
41
|
+
*
|
|
42
|
+
* 为什么直接从「本轮合并的三方输入」读而不是再 export 一次:那三个载荷就是本轮合并的真实输入,
|
|
43
|
+
* 再 export 会拿到「已经写了一半」的状态,判据与合并结论就会打架。
|
|
44
|
+
*/
|
|
45
|
+
export declare function pluginEntriesOf(data: SectionData | undefined): PluginRemovalEntry[] | undefined;
|
|
46
|
+
/** 三方输入 + 本机已装 → 删除计划(预览与执行共用同一份判据)。 */
|
|
47
|
+
export declare function pluginRemovalPlanOf(args: {
|
|
48
|
+
ancestor?: SectionData;
|
|
49
|
+
remote?: SectionData;
|
|
50
|
+
installed: readonly InstalledPlugin[];
|
|
51
|
+
enabled: boolean;
|
|
52
|
+
selfName?: string;
|
|
53
|
+
}): PluginRemovalPlan;
|
|
54
|
+
/**
|
|
55
|
+
* 执行删除(逐项失败不阻断)。
|
|
56
|
+
*
|
|
57
|
+
* 为什么只在 plugins 分区真的被应用时才动:分区冲突/跳过 = 本轮还没确定「远端删了它」,
|
|
58
|
+
* 此时删本机插件等于拿未裁决的远端差异动用户机器。
|
|
59
|
+
*/
|
|
60
|
+
export declare function applyPluginRemovalStep(args: {
|
|
61
|
+
appliedIds: readonly SectionId[];
|
|
62
|
+
plan: PluginRemovalPlan | undefined;
|
|
63
|
+
enabled: boolean;
|
|
64
|
+
uninstall: (name: string) => Promise<unknown>;
|
|
65
|
+
msg: MsgFunc;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
removals: PluginRemovalReportItem[];
|
|
68
|
+
warnings: string[];
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* 把「本轮删掉哪些插件」写进本次回滚快照(undo 线索)。
|
|
72
|
+
*
|
|
73
|
+
* 写不进去不中止同步(分区已落地且已重导出),但必须留一条可见告警 ——
|
|
74
|
+
* 报告里的 reinstallTarget 仍可人工执行,静默丢失 undo 线索才是真问题。
|
|
75
|
+
*/
|
|
76
|
+
export declare function recordPluginRemovalUndo(args: {
|
|
77
|
+
removals: readonly PluginRemovalReportItem[];
|
|
78
|
+
snapshotId: string;
|
|
79
|
+
record?: (id: string, entries: SnapshotPluginRemoval[]) => Promise<void>;
|
|
80
|
+
msg: MsgFunc;
|
|
81
|
+
}): Promise<string[]>;
|
|
82
|
+
/**
|
|
83
|
+
* 预览侧的删除视图:确认页必须能单列「将删除:X@1.2.3」让用户整轮取消,
|
|
84
|
+
* 也必须如实说明「开关关着,所以没删」与「远端删了但本机改过」两种不删的原因。
|
|
85
|
+
*
|
|
86
|
+
* plugins 分区本轮不可应用(conflict / skip)时不列删除项:那时「远端删了它」还没被用户确认。
|
|
87
|
+
*/
|
|
88
|
+
export declare function pluginRemovalPreviewOf(args: {
|
|
89
|
+
plan: PluginRemovalPlan | undefined;
|
|
90
|
+
sections: readonly {
|
|
91
|
+
id: SectionId;
|
|
92
|
+
decision: string;
|
|
93
|
+
}[];
|
|
94
|
+
}): PluginRemovalPreviewView | undefined;
|
|
95
|
+
export {};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* issue #132:跟随远端删除插件的**编排层**(判据 → 卸载 → 告警 → undo 线索)。
|
|
3
|
+
*
|
|
4
|
+
* 为什么从 sync-engine 下沉:引擎已顶到文件体量棘轮(tests/file-size-ratchet.test.ts),
|
|
5
|
+
* 而这部分只依赖「三方载荷 + 本机已装清单 + 卸载函数 + msg」,不碰引擎内部状态;
|
|
6
|
+
* 独立成模块后可单独测,也不会把引擎继续堆高。判据本体仍留在 ./plugin-removals.ts(纯函数、零 IO)。
|
|
7
|
+
*
|
|
8
|
+
* 三条语义在此定型,改之前先读 issue #132 的裁决:
|
|
9
|
+
* 1. 开关关闭 = **不删但也绝不装作没有候选**:逐项发 warning 说明「开着会删谁」;
|
|
10
|
+
* 2. 卸载失败(含 desktop 保留档案被 CLI 拒)逐项进报告 + warning,不阻断其余项、不回滚整轮;
|
|
11
|
+
* 3. undo 线索只写「真的删成功」的那些,写不进去只告警(报告里的 reinstallTarget 仍是人工兜底)。
|
|
12
|
+
*/
|
|
13
|
+
import { registerMessageCatalog } from '../core/engine-locale.js';
|
|
14
|
+
import { pluginInstallTarget } from '../core/plugin-cli.js';
|
|
15
|
+
import { planPluginRemovals } from './plugin-removals.js';
|
|
16
|
+
const zh = {
|
|
17
|
+
'sync.pluginRemoveDone': '已跟随远端删除插件 {name}@{version}(可随时用 "{name}@{version}" 重装)',
|
|
18
|
+
'sync.pluginRemoveFailed': '删除插件 {name} 失败:{reason}(其余项继续,失败项下一轮会重新判定)',
|
|
19
|
+
'sync.pluginRemoveConflict': '插件 {name} 远端已删除,但本机改过(本机 {local},共同祖先 {ancestor}):未删除,请人工确认',
|
|
20
|
+
'sync.pluginRemoveSkipped': '插件 {name} 在远端已删除,但"跟随删除插件"未开启:已保留(开启后会删除)',
|
|
21
|
+
'sync.pluginRemoveUndoUnrecorded': '插件已经删除,但没能写进本次回滚快照的 undo 记录({names}):恢复这份快照不会自动装回它们,需要时请手动执行 dsh plugin add',
|
|
22
|
+
};
|
|
23
|
+
const en = {
|
|
24
|
+
'sync.pluginRemoveDone': 'Removed plugin {name}@{version} to follow the remote (reinstall anytime with "{name}@{version}")',
|
|
25
|
+
'sync.pluginRemoveFailed': 'Could not remove plugin {name}: {reason} (the remaining items continue; this one is re-evaluated next round)',
|
|
26
|
+
'sync.pluginRemoveConflict': 'Plugin {name} was deleted remotely but changed locally (local {local}, common ancestor {ancestor}): not removed, needs a human decision',
|
|
27
|
+
'sync.pluginRemoveSkipped': 'Plugin {name} was deleted remotely, but "delete plugins to follow the remote" is off: kept (it will be removed once enabled)',
|
|
28
|
+
'sync.pluginRemoveUndoUnrecorded': 'The plugin(s) were removed, but the undo record could not be written into this rollback snapshot ({names}): restoring that snapshot will not reinstall them — run dsh plugin add manually if needed',
|
|
29
|
+
};
|
|
30
|
+
registerMessageCatalog({ id: 'sync-plugin-removal', zh, en });
|
|
31
|
+
/**
|
|
32
|
+
* 把某个分区载荷里的插件清单抽成判据要的形状(不认识 = undefined)。
|
|
33
|
+
*
|
|
34
|
+
* 为什么直接从「本轮合并的三方输入」读而不是再 export 一次:那三个载荷就是本轮合并的真实输入,
|
|
35
|
+
* 再 export 会拿到「已经写了一半」的状态,判据与合并结论就会打架。
|
|
36
|
+
*/
|
|
37
|
+
export function pluginEntriesOf(data) {
|
|
38
|
+
if (data === null || typeof data !== 'object')
|
|
39
|
+
return undefined;
|
|
40
|
+
const obj = data;
|
|
41
|
+
if (obj.version !== 1 || !Array.isArray(obj.plugins))
|
|
42
|
+
return undefined;
|
|
43
|
+
const out = [];
|
|
44
|
+
for (const raw of obj.plugins) {
|
|
45
|
+
if (raw === null || typeof raw !== 'object')
|
|
46
|
+
continue;
|
|
47
|
+
const p = raw;
|
|
48
|
+
if (typeof p.name !== 'string' || p.name === '')
|
|
49
|
+
continue;
|
|
50
|
+
out.push({
|
|
51
|
+
name: p.name,
|
|
52
|
+
version: typeof p.version === 'string' ? p.version : '',
|
|
53
|
+
...(typeof p.spec === 'string' ? { spec: p.spec } : {}),
|
|
54
|
+
...(p.bundlesOnly === true ? { bundlesOnly: true } : {}),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
/** 三方输入 + 本机已装 → 删除计划(预览与执行共用同一份判据)。 */
|
|
60
|
+
export function pluginRemovalPlanOf(args) {
|
|
61
|
+
return planPluginRemovals({
|
|
62
|
+
enabled: args.enabled,
|
|
63
|
+
ancestor: pluginEntriesOf(args.ancestor),
|
|
64
|
+
remote: pluginEntriesOf(args.remote),
|
|
65
|
+
local: args.installed,
|
|
66
|
+
selfName: args.selfName ?? '',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 执行删除(逐项失败不阻断)。
|
|
71
|
+
*
|
|
72
|
+
* 为什么只在 plugins 分区真的被应用时才动:分区冲突/跳过 = 本轮还没确定「远端删了它」,
|
|
73
|
+
* 此时删本机插件等于拿未裁决的远端差异动用户机器。
|
|
74
|
+
*/
|
|
75
|
+
export async function applyPluginRemovalStep(args) {
|
|
76
|
+
const removals = [];
|
|
77
|
+
const warnings = [];
|
|
78
|
+
if (!args.appliedIds.includes('plugins'))
|
|
79
|
+
return { removals, warnings };
|
|
80
|
+
const plan = args.plan;
|
|
81
|
+
if (plan === undefined)
|
|
82
|
+
return { removals, warnings };
|
|
83
|
+
for (const c of plan.conflicts) {
|
|
84
|
+
warnings.push(args.msg('sync.pluginRemoveConflict', {
|
|
85
|
+
name: c.name, local: c.localVersion, ancestor: c.ancestorVersion,
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
if (!args.enabled) {
|
|
89
|
+
// 开关关:把「打开后会删什么」如实说出来(不删,但也绝不装作没有候选)
|
|
90
|
+
for (const k of plan.kept) {
|
|
91
|
+
if (k.reason === 'switch-off')
|
|
92
|
+
warnings.push(args.msg('sync.pluginRemoveSkipped', { name: k.name }));
|
|
93
|
+
}
|
|
94
|
+
return { removals, warnings };
|
|
95
|
+
}
|
|
96
|
+
for (const r of plan.removals) {
|
|
97
|
+
// 重装目标与导入侧同一决策(core/plugin-cli.ts 的 pluginInstallTarget):github:/git+/file:/link:
|
|
98
|
+
// 这类来源只靠 name@version 装不回同一份代码,必须带祖先记录的 spec。
|
|
99
|
+
const reinstallTarget = pluginInstallTarget(r.name, {
|
|
100
|
+
...(r.version === '' ? {} : { version: r.version }),
|
|
101
|
+
...(r.spec === undefined ? {} : { spec: r.spec }),
|
|
102
|
+
});
|
|
103
|
+
try {
|
|
104
|
+
await args.uninstall(r.name);
|
|
105
|
+
removals.push({ name: r.name, version: r.version, reinstallTarget, ok: true });
|
|
106
|
+
warnings.push(args.msg('sync.pluginRemoveDone', { name: r.name, version: r.version }));
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
110
|
+
removals.push({ name: r.name, version: r.version, reinstallTarget, ok: false, message: reason });
|
|
111
|
+
warnings.push(args.msg('sync.pluginRemoveFailed', { name: r.name, reason }));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return { removals, warnings };
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 把「本轮删掉哪些插件」写进本次回滚快照(undo 线索)。
|
|
118
|
+
*
|
|
119
|
+
* 写不进去不中止同步(分区已落地且已重导出),但必须留一条可见告警 ——
|
|
120
|
+
* 报告里的 reinstallTarget 仍可人工执行,静默丢失 undo 线索才是真问题。
|
|
121
|
+
*/
|
|
122
|
+
export async function recordPluginRemovalUndo(args) {
|
|
123
|
+
const removed = args.removals.filter((r) => r.ok);
|
|
124
|
+
if (removed.length === 0)
|
|
125
|
+
return [];
|
|
126
|
+
const names = removed.map((r) => r.reinstallTarget).join(', ');
|
|
127
|
+
const entries = removed.map((r) => ({ name: r.name, version: r.version, target: r.reinstallTarget }));
|
|
128
|
+
if (args.record === undefined)
|
|
129
|
+
return [args.msg('sync.pluginRemoveUndoUnrecorded', { names })];
|
|
130
|
+
try {
|
|
131
|
+
await args.record(args.snapshotId, entries);
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
136
|
+
return [args.msg('sync.pluginRemoveUndoUnrecorded', { names }), reason];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* 预览侧的删除视图:确认页必须能单列「将删除:X@1.2.3」让用户整轮取消,
|
|
141
|
+
* 也必须如实说明「开关关着,所以没删」与「远端删了但本机改过」两种不删的原因。
|
|
142
|
+
*
|
|
143
|
+
* plugins 分区本轮不可应用(conflict / skip)时不列删除项:那时「远端删了它」还没被用户确认。
|
|
144
|
+
*/
|
|
145
|
+
export function pluginRemovalPreviewOf(args) {
|
|
146
|
+
if (args.plan === undefined)
|
|
147
|
+
return undefined;
|
|
148
|
+
const section = args.sections.find((s) => s.id === 'plugins');
|
|
149
|
+
const applied = section !== undefined && section.decision !== 'conflict' && section.decision !== 'skip';
|
|
150
|
+
return {
|
|
151
|
+
pluginRemovals: applied ? args.plan.removals.map((r) => ({ name: r.name, version: r.version })) : [],
|
|
152
|
+
pluginRemovalConflicts: args.plan.conflicts.map((c) => ({
|
|
153
|
+
name: c.name, ancestorVersion: c.ancestorVersion, localVersion: c.localVersion,
|
|
154
|
+
})),
|
|
155
|
+
pluginRemovalSkipped: args.plan.kept.map((k) => ({ name: k.name, reason: k.reason })),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=plugin-removal-apply.js.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #132:同步「跟随远端删除插件」的**唯一判据**与 plugins 分区的按名三方合并。
|
|
3
|
+
*
|
|
4
|
+
* 为什么必须单独一个模块:
|
|
5
|
+
* 1. 删除判定是纯逻辑(开关 × 祖先 × 远端 × 本机),散进引擎里既测不了也说不清;
|
|
6
|
+
* 2. plugins 分区不能走通用 JSON 合并 —— `merge.ts` 的 `mergeJsonValues` 对数组一律「两侧都改
|
|
7
|
+
* 且不逐字相等 → 冲突」,而本分区的日常形态恰恰是「A 机卸载了 X、B 机新装了 Y」,通用路径
|
|
8
|
+
* 会把它报成整分区冲突,于是删除永远进不了自动应用(issue #132 的行为表 A→B 走不通)。
|
|
9
|
+
*
|
|
10
|
+
* 删除判据(缺一不可,全部满足才删):
|
|
11
|
+
* - 开关打开(`SyncSelection.deletePlugins`,缺省关);
|
|
12
|
+
* - **祖先**里有它(A 机那轮同步见过的状态)——没有祖先就没有「谁删了它」的证据;
|
|
13
|
+
* - **远端**没有它(= 有人在另一台机器上卸载了);
|
|
14
|
+
* - **本机装着**(卸载才有意义);
|
|
15
|
+
* - 本机版本**仍等于祖先版本**(本地改过 = 用户在自己这台机器上动过它,绝不替用户做决定,
|
|
16
|
+
* 报 `version-changed` 冲突交人裁决);
|
|
17
|
+
* - 不是本插件自己、不是 bundlesOnly 条目(后者由 DSH 自身安装位置解析,`dsh plugin remove`
|
|
18
|
+
* 对它无意义,见 `core/plugin-cli.ts` 的 `isBundlesOnlyEntry`)。
|
|
19
|
+
*
|
|
20
|
+
* 纯函数、零 I/O:引擎调用它拿计划,UI 调用它拿「将删除」清单。
|
|
21
|
+
*/
|
|
22
|
+
import type { SectionData } from '../schema/types.ts';
|
|
23
|
+
import type { GranularMergeOutcome } from './workspace-merge.ts';
|
|
24
|
+
/** 一条「该卸载」的结论(version = 祖先/本机一致的版本,用于报告与回滚重装目标)。 */
|
|
25
|
+
export interface PluginRemoval {
|
|
26
|
+
name: string;
|
|
27
|
+
version: string;
|
|
28
|
+
/** 祖先条目里的安装源(github:/git+/file:/link: 等);重装目标要用它,否则装不回同一来源 */
|
|
29
|
+
spec?: string;
|
|
30
|
+
}
|
|
31
|
+
/** 未删的原因:每一条都要能对用户解释(报告里逐项列出,绝不静默跳过)。 */
|
|
32
|
+
export type PluginRemovalKeptReason = 'still-in-remote' | 'self' | 'bundles-only' | 'not-installed' | 'switch-off';
|
|
33
|
+
export interface PluginRemovalConflict {
|
|
34
|
+
name: string;
|
|
35
|
+
reason: 'version-changed';
|
|
36
|
+
ancestorVersion: string;
|
|
37
|
+
localVersion: string;
|
|
38
|
+
}
|
|
39
|
+
export interface PluginRemovalPlan {
|
|
40
|
+
/** 该执行 `dsh plugin remove` 的插件(顺序 = 祖先顺序,便于报告比对) */
|
|
41
|
+
removals: PluginRemoval[];
|
|
42
|
+
/** 本机改过、远端删了 → 交人裁决(不删也不静默保留) */
|
|
43
|
+
conflicts: PluginRemovalConflict[];
|
|
44
|
+
/** 考察过但不删的条目及原因 */
|
|
45
|
+
kept: {
|
|
46
|
+
name: string;
|
|
47
|
+
reason: PluginRemovalKeptReason;
|
|
48
|
+
}[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 判据只需要这几个字段:`PluginEntry` 与宿主的 `PluginInfo`(listInstalled 的返回值)都能直接传入,
|
|
52
|
+
* 不必为了调用它先拼一个完整的分区条目。
|
|
53
|
+
*/
|
|
54
|
+
export interface PluginRemovalEntry {
|
|
55
|
+
name: string;
|
|
56
|
+
version: string;
|
|
57
|
+
spec?: string;
|
|
58
|
+
bundlesOnly?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface PluginRemovalInput {
|
|
61
|
+
/** 同步选择里的开关(缺省关);关 = 一个都不删 */
|
|
62
|
+
enabled: boolean;
|
|
63
|
+
/** 共同祖先快照里的插件清单(undefined = 没有祖先副本) */
|
|
64
|
+
ancestor: readonly PluginRemovalEntry[] | undefined;
|
|
65
|
+
/** 远端快照里的插件清单(undefined = 远端没有该分区) */
|
|
66
|
+
remote: readonly PluginRemovalEntry[] | undefined;
|
|
67
|
+
/** 本机当前已装(plugins 分区导出的口径) */
|
|
68
|
+
local: readonly PluginRemovalEntry[];
|
|
69
|
+
/** 本插件自己的包名(永不删) */
|
|
70
|
+
selfName: string | undefined;
|
|
71
|
+
}
|
|
72
|
+
/** 判定「该不该删」。调用方只在 `applied` 含 plugins 时才真正执行。 */
|
|
73
|
+
export declare function planPluginRemovals(input: PluginRemovalInput): PluginRemovalPlan;
|
|
74
|
+
/**
|
|
75
|
+
* plugins 分区的按名三方合并(`merge.ts` 的 `GRANULAR_MERGES.plugins`)。
|
|
76
|
+
*
|
|
77
|
+
* 逐名规则与 git 同口径,祖先只用于判断「谁动了它」,绝不猜:
|
|
78
|
+
* - 两侧都有:身份相同 → 保留;某一侧与祖先相同 → 取另一侧;两侧都变(或没有祖先)→ both-modified 冲突;
|
|
79
|
+
* - 只有本机:有祖先且与祖先相同 → 跟随远端删除(真删除);无祖先 → 本机独有,保留;有祖先且不同 →
|
|
80
|
+
* modify-delete 冲突(用户在 A 机卸载、B 机却升级过它,不能替用户选);
|
|
81
|
+
* - 只有远端:有祖先且与祖先相同 → 本机删除,跟随(不复活);无祖先 → 远端独有,采纳;有祖先且不同 →
|
|
82
|
+
* delete-modify 冲突;
|
|
83
|
+
* - 两侧都没有:消失。
|
|
84
|
+
*
|
|
85
|
+
* 插件列表以外的字段不一致时返回 `undefined`:patch 行/pnpm-workspace 有各自的既有口径,
|
|
86
|
+
* 在这里再造一套合并只会和通用路径打架(通用路径会整分区处理,其中包含 plugins 数组的旧行为)。
|
|
87
|
+
*/
|
|
88
|
+
export declare function mergePluginsSection(local: SectionData, remote: SectionData, ancestor: SectionData | undefined, hooks?: {
|
|
89
|
+
deletePlugins?: boolean;
|
|
90
|
+
}): GranularMergeOutcome | undefined;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { isBundlesOnlyEntry } from '../core/plugin-cli.js';
|
|
2
|
+
function byName(list) {
|
|
3
|
+
const map = new Map();
|
|
4
|
+
for (const p of list ?? []) {
|
|
5
|
+
if (p !== null && typeof p === 'object' && typeof p.name === 'string' && p.name !== '')
|
|
6
|
+
map.set(p.name, p);
|
|
7
|
+
}
|
|
8
|
+
return map;
|
|
9
|
+
}
|
|
10
|
+
/** 判定「该不该删」。调用方只在 `applied` 含 plugins 时才真正执行。 */
|
|
11
|
+
export function planPluginRemovals(input) {
|
|
12
|
+
const plan = { removals: [], conflicts: [], kept: [] };
|
|
13
|
+
if (input.ancestor === undefined)
|
|
14
|
+
return plan; // 没有祖先:无删除语义(无法区分「对方删了」与「本机独有」)
|
|
15
|
+
const remote = byName(input.remote);
|
|
16
|
+
const local = byName(input.local);
|
|
17
|
+
for (const a of input.ancestor) {
|
|
18
|
+
const name = a.name;
|
|
19
|
+
if (typeof name !== 'string' || name === '')
|
|
20
|
+
continue;
|
|
21
|
+
if (remote.has(name)) {
|
|
22
|
+
plan.kept.push({ name, reason: 'still-in-remote' });
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (input.selfName !== undefined && name === input.selfName) {
|
|
26
|
+
plan.kept.push({ name, reason: 'self' });
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const l = local.get(name);
|
|
30
|
+
if (isBundlesOnlyEntry(a) || (l !== undefined && isBundlesOnlyEntry(l))) {
|
|
31
|
+
plan.kept.push({ name, reason: 'bundles-only' });
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (l === undefined) {
|
|
35
|
+
plan.kept.push({ name, reason: 'not-installed' });
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (!input.enabled) {
|
|
39
|
+
plan.kept.push({ name, reason: 'switch-off' });
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (l.version !== a.version) {
|
|
43
|
+
plan.conflicts.push({ name, reason: 'version-changed', ancestorVersion: a.version, localVersion: l.version });
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
plan.removals.push({ name, version: a.version, ...(a.spec === undefined ? {} : { spec: a.spec }) });
|
|
47
|
+
}
|
|
48
|
+
return plan;
|
|
49
|
+
}
|
|
50
|
+
/* --------------------------------------------------------------- 分区级三方合并 */
|
|
51
|
+
/** 形状闸门:不认识就交回通用路径(畸形数据由通用路径拒绝,这里不另造一套判定)。 */
|
|
52
|
+
function asPlugins(data) {
|
|
53
|
+
if (data === null || typeof data !== 'object')
|
|
54
|
+
return undefined;
|
|
55
|
+
const obj = data;
|
|
56
|
+
if (obj.version !== 1 || !Array.isArray(obj.plugins))
|
|
57
|
+
return undefined;
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
/** 决定「同一个插件是否还是同一个东西」的身份字段(version + 来源 spec + bundlesOnly 形态)。 */
|
|
61
|
+
function entryKey(e) {
|
|
62
|
+
return [e.version ?? '', e.spec ?? '', e.bundlesOnly === true ? '1' : '0'].join('\u0000');
|
|
63
|
+
}
|
|
64
|
+
/** 插件列表以外的字段(patch 行 / pnpm-workspace 原文 / 本地 tarball / patch 文件)必须两侧相等才介入。 */
|
|
65
|
+
function sameShell(l, r) {
|
|
66
|
+
const pick = (s) => JSON.stringify({
|
|
67
|
+
patch: s.patch ?? [],
|
|
68
|
+
pnpmWorkspace: s.pnpmWorkspace ?? null,
|
|
69
|
+
localTarballs: s.localTarballs ?? [],
|
|
70
|
+
patchFiles: s.patchFiles ?? [],
|
|
71
|
+
});
|
|
72
|
+
return pick(l) === pick(r);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* plugins 分区的按名三方合并(`merge.ts` 的 `GRANULAR_MERGES.plugins`)。
|
|
76
|
+
*
|
|
77
|
+
* 逐名规则与 git 同口径,祖先只用于判断「谁动了它」,绝不猜:
|
|
78
|
+
* - 两侧都有:身份相同 → 保留;某一侧与祖先相同 → 取另一侧;两侧都变(或没有祖先)→ both-modified 冲突;
|
|
79
|
+
* - 只有本机:有祖先且与祖先相同 → 跟随远端删除(真删除);无祖先 → 本机独有,保留;有祖先且不同 →
|
|
80
|
+
* modify-delete 冲突(用户在 A 机卸载、B 机却升级过它,不能替用户选);
|
|
81
|
+
* - 只有远端:有祖先且与祖先相同 → 本机删除,跟随(不复活);无祖先 → 远端独有,采纳;有祖先且不同 →
|
|
82
|
+
* delete-modify 冲突;
|
|
83
|
+
* - 两侧都没有:消失。
|
|
84
|
+
*
|
|
85
|
+
* 插件列表以外的字段不一致时返回 `undefined`:patch 行/pnpm-workspace 有各自的既有口径,
|
|
86
|
+
* 在这里再造一套合并只会和通用路径打架(通用路径会整分区处理,其中包含 plugins 数组的旧行为)。
|
|
87
|
+
*/
|
|
88
|
+
export function mergePluginsSection(local, remote, ancestor, hooks = {}) {
|
|
89
|
+
// 开关关着 → 钩子不参与(交回通用合并 = 与 #132 之前逐字一致)。若照常「跟随远端删除」,
|
|
90
|
+
// 合并结果会丢掉本机条目:插件包还在盘上,下一轮导出会把它当「本机独有」推回远端 = 复活。
|
|
91
|
+
if (hooks.deletePlugins !== true)
|
|
92
|
+
return undefined;
|
|
93
|
+
const l = asPlugins(local);
|
|
94
|
+
const r = asPlugins(remote);
|
|
95
|
+
if (l === undefined || r === undefined)
|
|
96
|
+
return undefined;
|
|
97
|
+
const a = ancestor === undefined ? undefined : asPlugins(ancestor);
|
|
98
|
+
if (ancestor !== undefined && a === undefined)
|
|
99
|
+
return undefined;
|
|
100
|
+
if (!sameShell(l, r))
|
|
101
|
+
return undefined;
|
|
102
|
+
const aMap = byName(a?.plugins);
|
|
103
|
+
const rMap = byName(r.plugins);
|
|
104
|
+
const merged = [];
|
|
105
|
+
const conflicts = [];
|
|
106
|
+
let mergePoints = 0;
|
|
107
|
+
const conflict = (path, reason, lp, rp, ap) => {
|
|
108
|
+
conflicts.push({ path, kind: 'key', reason, autoMergeAttempted: false, local: lp, remote: rp, ancestor: ap });
|
|
109
|
+
};
|
|
110
|
+
for (const lp of l.plugins) {
|
|
111
|
+
const name = lp.name;
|
|
112
|
+
const rp = rMap.get(name);
|
|
113
|
+
const ap = aMap.get(name);
|
|
114
|
+
if (rp !== undefined) {
|
|
115
|
+
if (entryKey(lp) === entryKey(rp)) {
|
|
116
|
+
merged.push(lp);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const lChanged = ap === undefined || entryKey(lp) !== entryKey(ap);
|
|
120
|
+
const rChanged = ap === undefined || entryKey(rp) !== entryKey(ap);
|
|
121
|
+
if (lChanged && rChanged) {
|
|
122
|
+
conflict(`plugins.${name}`, 'both-modified', lp, rp, ap);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (lChanged) {
|
|
126
|
+
merged.push(lp);
|
|
127
|
+
mergePoints += 1;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
merged.push(rp);
|
|
131
|
+
mergePoints += 1;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
// 只有本机有
|
|
135
|
+
if (ap === undefined) {
|
|
136
|
+
merged.push(lp);
|
|
137
|
+
mergePoints += 1;
|
|
138
|
+
continue;
|
|
139
|
+
} // 本机独有
|
|
140
|
+
if (entryKey(lp) === entryKey(ap)) {
|
|
141
|
+
mergePoints += 1;
|
|
142
|
+
continue;
|
|
143
|
+
} // 本机未改、远端删 → 跟随删除
|
|
144
|
+
conflict(`plugins.${name}`, 'modify-delete', lp, undefined, ap);
|
|
145
|
+
}
|
|
146
|
+
// 只有远端有的
|
|
147
|
+
for (const rp of r.plugins) {
|
|
148
|
+
const name = rp.name;
|
|
149
|
+
if (l.plugins.some((p) => p.name === name))
|
|
150
|
+
continue;
|
|
151
|
+
const ap = aMap.get(name);
|
|
152
|
+
if (ap === undefined) {
|
|
153
|
+
merged.push(rp);
|
|
154
|
+
mergePoints += 1;
|
|
155
|
+
continue;
|
|
156
|
+
} // 远端独有
|
|
157
|
+
if (entryKey(rp) === entryKey(ap)) {
|
|
158
|
+
mergePoints += 1;
|
|
159
|
+
continue;
|
|
160
|
+
} // 远端未改、本机删 → 跟随删除
|
|
161
|
+
conflict(`plugins.${name}`, 'delete-modify', undefined, rp, ap);
|
|
162
|
+
}
|
|
163
|
+
if (conflicts.length > 0)
|
|
164
|
+
return { merged: l, conflicts, mergePoints };
|
|
165
|
+
return { merged: { ...l, plugins: merged }, conflicts: [], mergePoints };
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=plugin-removals.js.map
|