dsh-config-manager 0.4.3 → 0.6.0
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.md +10 -0
- package/README.zh-CN.md +10 -0
- package/lib/adapters/mcp.d.ts +9 -0
- package/lib/adapters/mcp.js +37 -0
- package/lib/adapters/plugins.js +10 -2
- package/lib/adapters/pnpm-workspace.js +1 -1
- package/lib/adapters/self.d.ts +2 -0
- package/lib/adapters/self.js +18 -2
- package/lib/adapters/workspaces.js +1 -1
- package/lib/cli/restore-resume.js +1 -1
- package/lib/cli/web/page.js +2 -2
- package/lib/client.d.ts +17 -41
- package/lib/client.js +946 -761
- package/lib/core/backup.d.ts +11 -0
- package/lib/core/backup.js +27 -0
- package/lib/core/env-lock-lifecycle.d.ts +17 -3
- package/lib/core/env-lock-lifecycle.js +38 -0
- package/lib/core/external-failure.d.ts +9 -0
- package/lib/core/external-failure.js +50 -0
- package/lib/core/local-plugin-host.d.ts +9 -7
- package/lib/core/local-plugin-host.js +109 -15
- package/lib/core/local-plugin-pack.d.ts +20 -0
- package/lib/core/local-plugin-pack.js +18 -3
- package/lib/core/mcp-connector-store.d.ts +13 -0
- package/lib/core/mcp-connector-store.js +16 -1
- package/lib/core/messages-core.d.ts +45 -0
- package/lib/core/messages-core.js +92 -0
- package/lib/core/messages.d.ts +5 -0
- package/lib/core/messages.js +14 -0
- package/lib/core/migration-history.d.ts +40 -0
- package/lib/core/migration-history.js +55 -0
- package/lib/core/model-tool-plans.d.ts +66 -0
- package/lib/core/model-tool-plans.js +128 -0
- package/lib/core/model-tools.d.ts +96 -8
- package/lib/core/model-tools.js +568 -31
- package/lib/core/phase3-host.js +10 -2
- package/lib/core/plugin-cli.d.ts +5 -0
- package/lib/core/plugin-cli.js +11 -3
- package/lib/core/plugin-data-registry.d.ts +1 -1
- package/lib/core/plugin-data-registry.js +1 -1
- package/lib/core/restore-plan-fingerprint.d.ts +2 -0
- package/lib/core/restore-plan-fingerprint.js +18 -0
- package/lib/core/restore-resume.d.ts +1 -1
- package/lib/core/restore-resume.js +1 -1
- package/lib/core/restore.d.ts +5 -0
- package/lib/core/restore.js +4 -1
- package/lib/core/types.d.ts +12 -0
- package/lib/foreign/claude-sessions.d.ts +1 -1
- package/lib/foreign/claude-sessions.js +1 -1
- package/lib/foreign/registry.js +1 -1
- package/lib/foreign/types.d.ts +1 -1
- package/lib/index.d.ts +19 -15
- package/lib/index.js +72 -80
- package/lib/market/git-file-writer.js +1 -1
- package/lib/market/github-repos.js +1 -1
- package/lib/market/market-config.js +1 -1
- package/lib/market/messages-market.js +1 -1
- package/lib/market/my-repo.js +1 -1
- package/lib/market/prepare.js +1 -1
- package/lib/market/reader.js +2 -2
- package/lib/market/repo-url.d.ts +1 -1
- package/lib/market/security.js +2 -2
- package/lib/market/star-cache.d.ts +1 -1
- package/lib/market/types.d.ts +1 -1
- package/lib/market/types.js +1 -1
- package/lib/market/url.js +1 -1
- package/lib/profiles/dsh-profile-manager.d.ts +1 -1
- package/lib/profiles/dsh-profile-manager.js +26 -7
- package/lib/profiles/dsh-profile-shared.d.ts +3 -1
- package/lib/routes/backup.js +17 -9
- package/lib/routes/index.d.ts +1 -1
- package/lib/routes/kit.d.ts +2 -2
- package/lib/routes/market.d.ts +1 -1
- package/lib/routes/market.js +3 -60
- package/lib/routes/model-tools-deps.d.ts +41 -0
- package/lib/routes/model-tools-deps.js +18 -0
- package/lib/routes/recovery.js +5 -3
- package/lib/routes/route-support.d.ts +18 -26
- package/lib/routes/route-support.js +19 -32
- package/lib/routes/snapshots.d.ts +1 -1
- package/lib/routes/snapshots.js +4 -40
- package/lib/routes/sync.js +40 -28
- package/lib/schema/index.d.ts +2 -2
- package/lib/schema/index.js +2 -2
- package/lib/schema/section-registry.d.ts +5 -3
- package/lib/schema/section-registry.js +7 -3
- package/lib/security/secret-scanner.js +1 -1
- package/lib/sync/apply-bundle.d.ts +50 -0
- package/lib/sync/apply-bundle.js +60 -0
- package/lib/sync/autosync-scheduler.d.ts +9 -0
- package/lib/sync/autosync-scheduler.js +118 -89
- package/lib/sync/backup-scheduler.js +5 -4
- package/lib/sync/blob-store.d.ts +2 -2
- package/lib/sync/git/git-transport.d.ts +12 -0
- package/lib/sync/git/git-transport.js +50 -2
- package/lib/sync/merge.d.ts +2 -0
- package/lib/sync/merge.js +28 -0
- package/lib/sync/messages.d.ts +4 -0
- package/lib/sync/messages.js +9 -2
- package/lib/sync/s3/s3-transport.d.ts +1 -1
- package/lib/sync/s3/s3-transport.js +1 -1
- package/lib/sync/sync-engine.d.ts +4 -4
- package/lib/sync/sync-engine.js +25 -26
- package/lib/sync/sync-scope-boot.d.ts +34 -0
- package/lib/sync/sync-scope-boot.js +71 -0
- package/lib/sync/sync-scope.d.ts +103 -0
- package/lib/sync/sync-scope.js +229 -0
- package/lib/sync/sync-selection.d.ts +17 -4
- package/lib/sync/sync-selection.js +40 -14
- package/lib/sync/transport.d.ts +4 -1
- package/lib/sync/transport.js +6 -0
- package/lib/sync/webdav/webdav-transport.js +1 -1
- package/lib/sync/workspace-merge.d.ts +36 -0
- package/lib/sync/workspace-merge.js +152 -0
- package/lib/ui/backup-schedule.d.ts +13 -2
- package/lib/ui/backup-schedule.js +3 -0
- package/lib/ui/snapshots-view.d.ts +16 -0
- package/lib/ui/snapshots-view.js +21 -0
- package/lib/ui/sync-repository-picker.d.ts +21 -0
- package/lib/ui/sync-repository-picker.js +18 -0
- package/lib/utils/env-lock.d.ts +96 -0
- package/lib/utils/env-lock.js +332 -111
- package/lib/utils/messages-utils.d.ts +6 -0
- package/lib/utils/messages-utils.js +17 -1
- package/lib/utils/patch-yaml.js +1 -1
- package/lib/utils/remove-tree.d.ts +7 -0
- package/lib/utils/remove-tree.js +265 -0
- package/lib/utils/zip.js +1 -1
- package/package.json +3 -2
- package/src/adapters/mcp.test.ts +28 -0
- package/src/adapters/mcp.ts +33 -0
- package/src/adapters/plugins.test.ts +49 -0
- package/src/adapters/plugins.ts +9 -1
- package/src/adapters/pnpm-workspace.ts +1 -1
- package/src/adapters/self.test.ts +39 -1
- package/src/adapters/self.ts +20 -2
- package/src/adapters/workspaces.ts +1 -1
- package/src/cli/restore-resume.ts +1 -1
- package/src/cli/web/page.ts +2 -2
- package/src/client/about/AboutPanel.tsx +1 -1
- package/src/client/about/about-view.test.ts +1 -1
- package/src/client/about/about-view.ts +1 -1
- package/src/client/api.ts +1 -6
- package/src/client/chat/chat-entry-view.test.ts +1 -1
- package/src/client/chat/chat-slots.ts +1 -1
- package/src/client/chat/rollback-diff-tab.ts +1 -1
- package/src/client/client-types.ts +1 -1
- package/src/client/common/routes.ts +1 -5
- package/src/client/config-manager.module.css +21 -1
- package/src/client/css-scale-guard.test.ts +1 -1
- package/src/client/environment/EnvironmentPanel.tsx +2 -2
- package/src/client/home/HomePanel.tsx +3 -0
- package/src/client/library/ArtifactRow.tsx +14 -2
- package/src/client/library/LibraryPanel.tsx +44 -0
- package/src/client/locales/overview.ts +10 -2
- package/src/client/locales/profiles.ts +2 -0
- package/src/client/locales/sessions.ts +3 -0
- package/src/client/market/MyConfigsView.tsx +1 -1
- package/src/client/market/market-api.ts +2 -14
- package/src/client/market/market-locales.ts +1 -1
- package/src/client/market/market-view.ts +3 -3
- package/src/client/market/my-configs-api.ts +1 -1
- package/src/client/market/my-configs-view.ts +1 -1
- package/src/client/recovery/recovery-locales.test.ts +1 -1
- package/src/client/run-store.ts +1 -1
- package/src/client/sync/ChannelConfigDialog.tsx +32 -1
- package/src/client/sync/SyncPanel.tsx +11 -30
- package/src/client/sync/SyncRepositoryPicker.tsx +34 -13
- package/src/client/sync/SyncSectionPickerDialog.tsx +0 -5
- package/src/client/sync/SyncSettingsView.test.ts +32 -0
- package/src/client/sync/config-save-state.test.ts +99 -0
- package/src/client/sync/config-save-state.ts +69 -0
- package/src/client/sync/history-model.test.ts +28 -7
- package/src/client/sync/history-model.ts +6 -3
- package/src/client/sync/sync-locales.ts +14 -4
- package/src/client/sync/sync-view.ts +1 -1
- package/src/core/analyzer-cache.test.ts +1 -1
- package/src/core/backup.test.ts +45 -1
- package/src/core/backup.ts +25 -0
- package/src/core/disk-usage.test.ts +2 -0
- package/src/core/engine-locale.test.ts +4 -0
- package/src/core/env-lock-lifecycle.ts +33 -3
- package/src/core/external-failure.test.ts +60 -0
- package/src/core/external-failure.ts +54 -0
- package/src/core/integrity-extra-entries.test.ts +1 -1
- package/src/core/local-plugin-host.test.ts +134 -0
- package/src/core/local-plugin-host.ts +122 -17
- package/src/core/local-plugin-pack.ts +39 -3
- package/src/core/mcp-connector-store.ts +26 -1
- package/src/core/messages-core.ts +94 -0
- package/src/core/messages.ts +14 -0
- package/src/core/migration-history.test.ts +65 -0
- package/src/core/migration-history.ts +70 -0
- package/src/core/model-tool-plans.test.ts +111 -0
- package/src/core/model-tool-plans.ts +170 -0
- package/src/core/model-tools.test.ts +212 -12
- package/src/core/model-tools.ts +710 -38
- package/src/core/phase3-host.ts +10 -2
- package/src/core/phase3-production-integration.test.ts +43 -0
- package/src/core/plugin-cli.fs.test.ts +30 -3
- package/src/core/plugin-cli.ts +11 -3
- package/src/core/plugin-data-registry.ts +1 -1
- package/src/core/restore-plan-fingerprint.ts +19 -0
- package/src/core/restore-resume.ts +1 -1
- package/src/core/restore.ts +9 -1
- package/src/core/types.ts +12 -0
- package/src/foreign/claude-sessions.ts +3 -3
- package/src/foreign/registry.ts +1 -1
- package/src/foreign/types.ts +1 -1
- package/src/index.ts +102 -111
- package/src/market/git-file-writer.ts +1 -1
- package/src/market/github-repos.test.ts +1 -1
- package/src/market/github-repos.ts +1 -1
- package/src/market/market-config.ts +1 -1
- package/src/market/messages-market.ts +1 -1
- package/src/market/my-repo.test.ts +1 -1
- package/src/market/my-repo.ts +1 -1
- package/src/market/prepare.test.ts +1 -1
- package/src/market/prepare.ts +1 -1
- package/src/market/reader.ts +2 -2
- package/src/market/repo-url.ts +1 -1
- package/src/market/security.ts +2 -2
- package/src/market/star-cache.ts +1 -1
- package/src/market/types.ts +1 -1
- package/src/market/url.test.ts +1 -1
- package/src/market/url.ts +1 -1
- package/src/profiles/dsh-profile-copy-rollback.test.ts +1 -1
- package/src/profiles/dsh-profile-manager.test.ts +20 -0
- package/src/profiles/dsh-profile-manager.ts +25 -7
- package/src/profiles/dsh-profile-shared.ts +2 -0
- package/src/routes/backup.ts +16 -9
- package/src/routes/index.ts +1 -1
- package/src/routes/kit.ts +2 -2
- package/src/routes/market.ts +2 -59
- package/src/routes/model-tools-deps.ts +56 -0
- package/src/routes/recovery.ts +5 -3
- package/src/routes/route-support.ts +49 -36
- package/src/routes/snapshots.ts +4 -40
- package/src/routes/sync.ts +39 -27
- package/src/schema/index.ts +2 -2
- package/src/schema/manifest-schema.test.ts +2 -2
- package/src/schema/registry.test.ts +1 -1
- package/src/schema/section-registry.ts +9 -4
- package/src/security/redaction.test.ts +1 -1
- package/src/security/secret-scanner.test.ts +2 -2
- package/src/security/secret-scanner.ts +1 -1
- package/src/sync/apply-bundle.ts +104 -0
- package/src/sync/autosync-scheduler.test.ts +180 -6
- package/src/sync/autosync-scheduler.ts +132 -92
- package/src/sync/backup-scheduler.test.ts +11 -4
- package/src/sync/backup-scheduler.ts +5 -4
- package/src/sync/blob-store.ts +2 -2
- package/src/sync/git/git-transport.test.ts +62 -0
- package/src/sync/git/git-transport.ts +54 -3
- package/src/sync/merge.ts +29 -0
- package/src/sync/messages.ts +9 -2
- package/src/sync/s3/s3-transport.ts +1 -1
- package/src/sync/sync-engine.test.ts +238 -2
- package/src/sync/sync-engine.ts +25 -26
- package/src/sync/sync-preview-push.test.ts +2 -1
- package/src/sync/sync-scope-boot.ts +87 -0
- package/src/sync/sync-scope.test.ts +154 -0
- package/src/sync/sync-scope.ts +256 -0
- package/src/sync/sync-selection.test.ts +76 -2
- package/src/sync/sync-selection.ts +40 -13
- package/src/sync/transport.test.ts +21 -1
- package/src/sync/transport.ts +12 -0
- package/src/sync/webdav/webdav-delete-index-unreadable.test.ts +2 -2
- package/src/sync/webdav/webdav-transport.ts +1 -1
- package/src/sync/workspace-merge.test.ts +110 -0
- package/src/sync/workspace-merge.ts +180 -0
- package/src/ui/backup-schedule.test.ts +5 -0
- package/src/ui/backup-schedule.ts +21 -2
- package/src/ui/session-issue-labels.ts +1 -1
- package/src/ui/snapshots-view.test.ts +32 -0
- package/src/ui/snapshots-view.ts +34 -0
- package/src/ui/sync-repository-picker.test.ts +34 -1
- package/src/ui/sync-repository-picker.ts +24 -0
- package/src/utils/env-lock.test.ts +242 -9
- package/src/utils/env-lock.ts +247 -13
- package/src/utils/messages-utils.ts +17 -1
- package/src/utils/patch-yaml.ts +1 -1
- package/src/utils/remove-tree.test.ts +120 -0
- package/src/utils/remove-tree.ts +239 -0
- package/src/utils/zip.ts +1 -1
- package/src/client/CLIENT_DEPENDENCIES.md +0 -94
package/README.md
CHANGED
|
@@ -794,6 +794,16 @@ Found a bug, a misaligned panel, a button that does nothing — or just have an
|
|
|
794
794
|
|
|
795
795
|
> Maintainers & developers: start at the [documentation index](docs/index.md) — architecture, module docs, ADRs and known tech debt; [DEVELOPERS.md](DEVELOPERS.md) covers build, testing, auto-publishing and full technical notes.
|
|
796
796
|
|
|
797
|
+
## ⭐ Star History
|
|
798
|
+
|
|
799
|
+
<a href="https://github.com/xiajiajun516/dsh-config-manager/stargazers">
|
|
800
|
+
<picture>
|
|
801
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/star-history-dark.svg" />
|
|
802
|
+
<source media="(prefers-color-scheme: light)" srcset="assets/star-history-light.svg" />
|
|
803
|
+
<img alt="Star history: total stars over time and new stars per day" src="assets/star-history-dark.svg" width="860" />
|
|
804
|
+
</picture>
|
|
805
|
+
</a>
|
|
806
|
+
|
|
797
807
|
---
|
|
798
808
|
|
|
799
809
|
**Product principles**: better to migrate one config less than to break your existing config. Every import follows `Analyze → Preview → Backup → Apply → Validate → Rollback(if needed)`; every secret follows `never export by default / never log / never expose / never silently transfer`.
|
package/README.zh-CN.md
CHANGED
|
@@ -778,6 +778,16 @@ $env:HTTPS_PROXY='http://127.0.0.1:7897'; dsh web
|
|
|
778
778
|
|
|
779
779
|
> 维护者与开发者:从[文档总索引](docs/index.md)开始(架构、模块文档、ADR、已知技术债);构建、测试、自动发布与完整技术说明见 [DEVELOPERS.md](DEVELOPERS.md)。
|
|
780
780
|
|
|
781
|
+
## ⭐ 星标历史
|
|
782
|
+
|
|
783
|
+
<a href="https://github.com/xiajiajun516/dsh-config-manager/stargazers">
|
|
784
|
+
<picture>
|
|
785
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/star-history-dark.svg" />
|
|
786
|
+
<source media="(prefers-color-scheme: light)" srcset="assets/star-history-light.svg" />
|
|
787
|
+
<img alt="星标历史:累计星标与每日新增" src="assets/star-history-dark.svg" width="860" />
|
|
788
|
+
</picture>
|
|
789
|
+
</a>
|
|
790
|
+
|
|
781
791
|
---
|
|
782
792
|
|
|
783
793
|
**产品原则**:宁可少迁移一个配置,也不要破坏你现有的配置。任何导入都遵循 `分析 → 预览 → 备份 → 修改 → 验证 → 回滚(如需要)`;任何密钥都遵循 `不默认导出 / 不记日志 / 不暴露 / 不静默转移`。
|
package/lib/adapters/mcp.d.ts
CHANGED
|
@@ -32,6 +32,15 @@ export declare function extractMcpServers(lines: {
|
|
|
32
32
|
raw: unknown;
|
|
33
33
|
file?: string;
|
|
34
34
|
}[]): McpExportEntry[];
|
|
35
|
+
/**
|
|
36
|
+
* 反向操作:从一行 patch 里剔除 MCP 服务器条目(plugins 分区导出时用,2026-11「C8」)。
|
|
37
|
+
*
|
|
38
|
+
* 为什么需要:`cordis.patch.yml` 是一本**清单**,plugins 分区导出整本带走,于是「没勾 MCP
|
|
39
|
+
* 连接器」也会把 dsh-mcp-client 行(command/args/env + 本机 cwd)推到远端 —— 违反
|
|
40
|
+
* 「未勾选分区的数据不进推送」。判定必须与 extractMcpServers 完全同口径(config.serverName
|
|
41
|
+
* 为非空字符串),否则两边会漂。返回 undefined = 该行只剩 MCP 条目,整行丢弃。
|
|
42
|
+
*/
|
|
43
|
+
export declare function stripMcpEntries(raw: unknown): unknown | undefined;
|
|
35
44
|
/** 由导出条目构造写回 patch 行 raw(单行形态,与 dsh-mcp-client 组合 config 语义一致) */
|
|
36
45
|
export declare function buildMcpPatchLine(lineId: string, server: McpServerEntry): Record<string, unknown>;
|
|
37
46
|
/**
|
package/lib/adapters/mcp.js
CHANGED
|
@@ -50,6 +50,43 @@ export function extractMcpServers(lines) {
|
|
|
50
50
|
}
|
|
51
51
|
return servers;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* 反向操作:从一行 patch 里剔除 MCP 服务器条目(plugins 分区导出时用,2026-11「C8」)。
|
|
55
|
+
*
|
|
56
|
+
* 为什么需要:`cordis.patch.yml` 是一本**清单**,plugins 分区导出整本带走,于是「没勾 MCP
|
|
57
|
+
* 连接器」也会把 dsh-mcp-client 行(command/args/env + 本机 cwd)推到远端 —— 违反
|
|
58
|
+
* 「未勾选分区的数据不进推送」。判定必须与 extractMcpServers 完全同口径(config.serverName
|
|
59
|
+
* 为非空字符串),否则两边会漂。返回 undefined = 该行只剩 MCP 条目,整行丢弃。
|
|
60
|
+
*/
|
|
61
|
+
export function stripMcpEntries(raw) {
|
|
62
|
+
if (raw === null || typeof raw !== 'object')
|
|
63
|
+
return raw;
|
|
64
|
+
const obj = raw;
|
|
65
|
+
if (Array.isArray(obj['insert'])) {
|
|
66
|
+
const before = obj['insert'];
|
|
67
|
+
const kept = before.filter((e) => !isMcpEntry(e));
|
|
68
|
+
if (kept.length === before.length)
|
|
69
|
+
return raw;
|
|
70
|
+
if (kept.length === 0)
|
|
71
|
+
return undefined;
|
|
72
|
+
return { ...obj, insert: kept };
|
|
73
|
+
}
|
|
74
|
+
// 非 entry 形态(插件配置行 / 禁用行等)原样保留:只有 entriesOf 认得的行才可能是 MCP 行
|
|
75
|
+
const single = entriesOf(raw);
|
|
76
|
+
if (single.length === 0)
|
|
77
|
+
return raw;
|
|
78
|
+
return isMcpEntry(single[0]) ? undefined : raw;
|
|
79
|
+
}
|
|
80
|
+
/** 单个 patch entry 是否是 MCP 服务器行(与 extractMcpServers 的判定同口径) */
|
|
81
|
+
function isMcpEntry(entry) {
|
|
82
|
+
if (entry === null || typeof entry !== 'object')
|
|
83
|
+
return false;
|
|
84
|
+
const config = entry['config'];
|
|
85
|
+
if (config === null || typeof config !== 'object')
|
|
86
|
+
return false;
|
|
87
|
+
const serverName = config['serverName'];
|
|
88
|
+
return typeof serverName === 'string' && serverName !== '';
|
|
89
|
+
}
|
|
53
90
|
/** patch 行 → 可枚举的 entry 列表(兼容单行与 insert 块) */
|
|
54
91
|
function entriesOf(raw) {
|
|
55
92
|
if (raw === null || typeof raw !== 'object')
|
package/lib/adapters/plugins.js
CHANGED
|
@@ -22,6 +22,7 @@ import { isPathSafe, normalizePath } from '../utils/paths.js';
|
|
|
22
22
|
import { isENOENT } from '../utils/guards.js';
|
|
23
23
|
import { PLUGIN_PATCH_REF_PREFIX, PLUGIN_PROFILE_MANIFEST_REF } from '../core/backup.js';
|
|
24
24
|
import { readEffectivePatchLines, resolveWriteLayer, USER_PATCH_FILE } from '../core/patch-layers.js';
|
|
25
|
+
import { stripMcpEntries } from './mcp.js';
|
|
25
26
|
import { parsePnpmPatchedDependencies, restorePnpmMachinePaths, sanitizePnpmWorkspacePatches, stripPnpmMachinePaths, } from './pnpm-workspace.js';
|
|
26
27
|
import { BUILTIN_PLUGIN_DATA_SOURCES, areasForSection } from '../core/plugin-data-registry.js';
|
|
27
28
|
import { declaredProfileName, scanDeclaredDataSources } from './plugin-data-declared.js';
|
|
@@ -380,8 +381,15 @@ export class PluginsAdapter {
|
|
|
380
381
|
// issue #71:patch 有两层(home 层 + profile 层),只读 home 层会漏掉 DSH 工具与 marketplace
|
|
381
382
|
// 写入 profile 层的激活行 —— 导出少了它们,导入到新机就少一批插件加载项。
|
|
382
383
|
const patchRead = await readEffectivePatchLines(ctx.patchFile, ctx.profile);
|
|
383
|
-
for (const l of patchRead.lines)
|
|
384
|
-
|
|
384
|
+
for (const l of patchRead.lines) {
|
|
385
|
+
// MCP 行不进 plugins 载荷(2026-11「C8」,用户选择「只带非 MCP 行」):它是 mcp 分区的
|
|
386
|
+
// 数据源,随 plugins 整本带走会让「没勾 MCP 连接器」也把服务器定义与本机 cwd 推到远端。
|
|
387
|
+
// 判定与 mcp 适配器同口径(stripMcpEntries);勾了 mcp 时这些行仍由 mcp 分区带走。
|
|
388
|
+
const raw = stripMcpEntries(l.raw);
|
|
389
|
+
if (raw === undefined)
|
|
390
|
+
continue;
|
|
391
|
+
patch.push({ file: l.file, lineId: l.lineId, raw });
|
|
392
|
+
}
|
|
385
393
|
for (const f of patchRead.failures) {
|
|
386
394
|
warnings.push(msgOf(ctx)('adapter.patchReadFailed', { reason: `${f.file}: ${f.reason}` }));
|
|
387
395
|
}
|
|
@@ -157,7 +157,7 @@ export function sanitizePnpmWorkspacePatches(text, available) {
|
|
|
157
157
|
* 2. 写回时把**目标机自己原有的**那几行接回去:不搬运来源机的路径,也不清掉本机自己的设置。
|
|
158
158
|
*
|
|
159
159
|
* `.npmrc` 刻意**不进同步面**(见 plugins.ts 的说明):纳入它会改变 bundle 载荷形态
|
|
160
|
-
* (docs/
|
|
160
|
+
* (docs/contracts/bundle-format-v1.md + conformance),而本机 .npmrc 从来就不由本插件写 ——
|
|
161
161
|
* 「不碰 = 本机保留」。
|
|
162
162
|
* ------------------------------------------------------------------ */
|
|
163
163
|
/**
|
package/lib/adapters/self.d.ts
CHANGED
|
@@ -69,6 +69,8 @@ export declare const SELF_CONFIG_FILES: readonly string[];
|
|
|
69
69
|
* 数组 —— 白名单将来若因别的理由重新收进某个文件,也不该连带解除导入侧的保护。
|
|
70
70
|
*/
|
|
71
71
|
export declare const SELF_IMPORT_BLOCKED_RELS: readonly string[];
|
|
72
|
+
/** SEC-01 判据(单一入口):精确 rel 或分档案作用域里的同语义文件,一律不落地。 */
|
|
73
|
+
export declare function isSelfImportBlocked(rel: string): boolean;
|
|
72
74
|
/**
|
|
73
75
|
* 拦截报告项里的**稳定机器码**前缀(`self-import-blocked:<rel>`)。
|
|
74
76
|
*
|
package/lib/adapters/self.js
CHANGED
|
@@ -26,6 +26,22 @@ export const SELF_IMPORT_BLOCKED_RELS = [
|
|
|
26
26
|
'sync/sync-config.json',
|
|
27
27
|
'sync/sync-autosync.json',
|
|
28
28
|
];
|
|
29
|
+
/**
|
|
30
|
+
* 分档案作用域(`sync-profiles/<profile>/`)里**同一类**文件:SEC-01 必须按模式挡。
|
|
31
|
+
*
|
|
32
|
+
* 档案名是运行时集合(用户随时能建新档案),无法列举成数组;而这些文件与 `sync/` 下那两份
|
|
33
|
+
* 语义完全相同 —— 都是「同步目标 / 自动同步开关」,导入一个指向攻击者仓库的包后,用户下次
|
|
34
|
+
* 同步就会把该档案的配置推过去。`SELF_CONFIG_FILES` 白名单本就不含 `sync-profiles/`(导出侧
|
|
35
|
+
* 从不搬别人的档案作用域),这里补的是导入侧的纵深防御。
|
|
36
|
+
*/
|
|
37
|
+
const SELF_IMPORT_BLOCKED_PATTERNS = [
|
|
38
|
+
/^sync-profiles\/[A-Za-z0-9][A-Za-z0-9._-]*\/sync-config\.json$/,
|
|
39
|
+
/^sync-profiles\/[A-Za-z0-9][A-Za-z0-9._-]*\/sync-autosync\.json$/,
|
|
40
|
+
];
|
|
41
|
+
/** SEC-01 判据(单一入口):精确 rel 或分档案作用域里的同语义文件,一律不落地。 */
|
|
42
|
+
export function isSelfImportBlocked(rel) {
|
|
43
|
+
return SELF_IMPORT_BLOCKED_RELS.includes(rel) || SELF_IMPORT_BLOCKED_PATTERNS.some((pattern) => pattern.test(rel));
|
|
44
|
+
}
|
|
29
45
|
/**
|
|
30
46
|
* 拦截报告项里的**稳定机器码**前缀(`self-import-blocked:<rel>`)。
|
|
31
47
|
*
|
|
@@ -183,7 +199,7 @@ export class SelfAdapter extends FileCollectionAdapter {
|
|
|
183
199
|
const items = await super.analyzeImport(data, ctx);
|
|
184
200
|
return items.map((item) => {
|
|
185
201
|
const rel = item.target?.ref;
|
|
186
|
-
if (rel === undefined || !
|
|
202
|
+
if (rel === undefined || !isSelfImportBlocked(rel))
|
|
187
203
|
return item;
|
|
188
204
|
const blocked = {
|
|
189
205
|
id: item.id,
|
|
@@ -204,7 +220,7 @@ export class SelfAdapter extends FileCollectionAdapter {
|
|
|
204
220
|
*/
|
|
205
221
|
async applyItem(item, ctx) {
|
|
206
222
|
const ref = item.target?.ref;
|
|
207
|
-
if (ref !== undefined &&
|
|
223
|
+
if (ref !== undefined && isSelfImportBlocked(ref)) {
|
|
208
224
|
return { ok: false, message: ctx.msg('adapter.selfImportBlocked', { path: ref }), warning: true };
|
|
209
225
|
}
|
|
210
226
|
return super.applyItem(item, ctx);
|
|
@@ -272,7 +272,7 @@ export class WorkspacesAdapter {
|
|
|
272
272
|
issues.push({ path: 'workspaces[]', message: msg('adapter.validate.workspaceIdentity'), severity: 'error' });
|
|
273
273
|
continue;
|
|
274
274
|
}
|
|
275
|
-
// ui-F3:sessionIds 是会话可见性的必需字段(docs/
|
|
275
|
+
// ui-F3:sessionIds 是会话可见性的必需字段(docs/contracts/bundle-format-v1.md §6),
|
|
276
276
|
// 而 analyzeImport / finalizeImport 直接读 rec.sessionIds.length —— 缺它有两条后果:
|
|
277
277
|
// ① validate 放过后 analyzeImport 抛内部 TypeError → 整包被拦下且文案不可行动;
|
|
278
278
|
// ② 即便绕过,工作区记录也失去会话归属。这里按「必需数组」显式报出字段名。
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* 注意:CLI 只续跑 `cli-restore` 自己创建的 journal。别的入口(GUI restore / model-restore)
|
|
11
11
|
* 崩掉的记录在这里仍是「需要恢复面板处理」的事故 —— 三者的执行器与参数来源不同,
|
|
12
|
-
* 跨入口续跑没有证据支撑(详见 docs/
|
|
12
|
+
* 跨入口续跑没有证据支撑(详见 docs/adr/0004)。
|
|
13
13
|
*/
|
|
14
14
|
import { resolveSafeModeMarker } from '../core/recovery-orchestrator.js';
|
|
15
15
|
import { probeRestoreResume, runRestoreWithResume } from '../core/restore-resume.js';
|
package/lib/cli/web/page.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* HTML:**零脚本、零外部资源、零构建产物**,配合 http.ts 里收紧的 CSP。
|
|
6
6
|
* 样式内联在 <style> 里(独立于插件 UI 的 CSS Modules;该新 pattern 已登记进 DESIGN.md)。
|
|
7
7
|
* 这套样式表**有一份外部出处**(亮色 IBM Carbon / 暗色 Raycast 阶梯)与逐条对照表:
|
|
8
|
-
* docs/
|
|
8
|
+
* docs/architecture/cli-rescue-console.md —— 改 STYLE 前先读它,改完跑 web.test.ts 的 R3-02。
|
|
9
9
|
*
|
|
10
10
|
* 呈现纪律:每个数字都要能回答「你怎么知道的」—— 离线拿不到的(结构化分区/凭据/同步令牌)
|
|
11
11
|
* 一律显式列出并说明原因,绝不显示为 0 或留空。
|
|
@@ -17,7 +17,7 @@ import { redact } from '../../security/redaction.js';
|
|
|
17
17
|
import { CONSOLE_SCRIPT } from './client-script.js';
|
|
18
18
|
const STYLE = [
|
|
19
19
|
// ---- 设计 token:IBM Carbon(亮色语义四色)+ Raycast(暗色 surface 阶梯)----
|
|
20
|
-
// 映射表、取的章节与全部偏离记录:docs/
|
|
20
|
+
// 映射表、取的章节与全部偏离记录:docs/architecture/cli-rescue-console.md
|
|
21
21
|
// 文字色一律取「能读」的那一档:Carbon 的 #24a148 / #f1c21b 只做填充,正文用 #198038 / #8e6a00
|
|
22
22
|
// (AA 对比度由 web.test.ts 的 R3-02 逐对钉住,改色先过那条测试)。
|
|
23
23
|
':root{color-scheme:light dark;--font:system-ui,-apple-system,"Segoe UI",Roboto,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",sans-serif;--mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;--fg:#161616;--muted:#525252;--bg:#f4f4f4;--card:#fff;--surface:#f4f4f4;--line:#e0e0e0;--accent:#0f62fe;--accent-hover:#0043ce;--on-accent:#fff;--ok:#198038;--warn:#8e6a00;--bad:#da1e28;--scrim:rgba(22,22,22,.45)}',
|
package/lib/client.d.ts
CHANGED
|
@@ -690,6 +690,11 @@ interface SnapshotMeta {
|
|
|
690
690
|
entryCount: number;
|
|
691
691
|
hostFileBackupCount: number;
|
|
692
692
|
beforePluginCount: number;
|
|
693
|
+
/**
|
|
694
|
+
* 来源档案(originProfile):拍这份快照的进程所属 profile 名。
|
|
695
|
+
* 旧快照 / 宿主不暴露 profile 时缺省 —— 界面按「未标注」展示,绝不写 'unknown' 占位。
|
|
696
|
+
*/
|
|
697
|
+
originProfile?: string;
|
|
693
698
|
/** 置顶标记(P1-⑧):置顶快照不参与自动保留清理(最多保留 N 个时的淘汰豁免) */
|
|
694
699
|
pinned?: boolean;
|
|
695
700
|
}
|
|
@@ -2781,10 +2786,6 @@ declare class ConfigManagerApi {
|
|
|
2781
2786
|
deleteSnapshot(snapshotId: string): Promise<{
|
|
2782
2787
|
removed: boolean;
|
|
2783
2788
|
}>;
|
|
2784
|
-
/** P1-⑧:置顶/取消置顶快照(置顶快照豁免自动保留清理,只能手动删除)。 */
|
|
2785
|
-
setSnapshotPinned(snapshotId: string, pinned: boolean): Promise<{
|
|
2786
|
-
pinned: boolean;
|
|
2787
|
-
}>;
|
|
2788
2789
|
/** 列出 DSH profile:列表 + 当前运行 + 在跑的实例(台账 ∪ 心跳)+ 起步模板。 */
|
|
2789
2790
|
profilesList(): Promise<DshProfilesSnapshot>;
|
|
2790
2791
|
/** 单个档案详情(package.json / cordis.patch.yml 原文;大文件原文截断为 null)。 */
|
|
@@ -3970,35 +3971,6 @@ interface MarketBrowseResponse {
|
|
|
3970
3971
|
ok: boolean;
|
|
3971
3972
|
items: MarketListItem[];
|
|
3972
3973
|
}
|
|
3973
|
-
/** POST /market/prepare 请求体:由上传 zip + 用户填写元数据生成市场条目包(发布向导) */
|
|
3974
|
-
interface MarketPreparePayload {
|
|
3975
|
-
/** 受控临时区中的配置 zip 路径(upload 端点返回;必须引用 staged upload) */
|
|
3976
|
-
zipPath: string;
|
|
3977
|
-
itemId: string;
|
|
3978
|
-
name: string;
|
|
3979
|
-
version?: string;
|
|
3980
|
-
description?: string;
|
|
3981
|
-
author?: string;
|
|
3982
|
-
/** 作者托管仓库 URL(可选;非空须过 validateRepoUrl) */
|
|
3983
|
-
repoUrl?: string;
|
|
3984
|
-
categories?: string[];
|
|
3985
|
-
/** 发布模式:'migrate'(缺省,迁移全带)| 'share'(分享:自动排除敏感分区 + 强制隐私拦截) */
|
|
3986
|
-
mode?: MarketPublishMode;
|
|
3987
|
-
}
|
|
3988
|
-
/** POST /market/prepare 响应:条目包生成结果(manifest 文本 + 校验摘要) */
|
|
3989
|
-
interface MarketPrepareResponse {
|
|
3990
|
-
ok: boolean;
|
|
3991
|
-
/** 发布目录打包 zip 路径(受控临时区,供 /download 端点下载;懒 GC 清理) */
|
|
3992
|
-
zipPath: string;
|
|
3993
|
-
/** items/<id>/manifest.json 内容(pretty JSON,可直接复制/写入) */
|
|
3994
|
-
manifestText: string;
|
|
3995
|
-
/** config.zip 的 SHA-256(与 manifest.checksums.zip 一致) */
|
|
3996
|
-
sha256: string;
|
|
3997
|
-
/** zip 内启用的分区(与 manifest.sections 一致) */
|
|
3998
|
-
sections: SectionId[];
|
|
3999
|
-
/** 供应链警示(恒生成:发布即公开、未经审核) */
|
|
4000
|
-
warnings: string[];
|
|
4001
|
-
}
|
|
4002
3974
|
/** 配置市场浏览器半数据入口(备份与迁移页第 5 个 tab 的注入业务面) */
|
|
4003
3975
|
declare class MarketApi {
|
|
4004
3976
|
readonly t: UiT;
|
|
@@ -4015,11 +3987,6 @@ declare class MarketApi {
|
|
|
4015
3987
|
* 缺省 = 市场仓库(官方同仓条目)。
|
|
4016
3988
|
* 真正落盘由用户对预览确认后走现有 executeImportPlan(confirm:true 安全阀 + 回滚)。 */
|
|
4017
3989
|
download(itemId: string, repo?: string): Promise<MarketDownloadResult>;
|
|
4018
|
-
/** 发布向导:由「上传 zip + 用户填写元数据」生成市场条目包(L2 manifest + SHA-256 + sections),
|
|
4019
|
-
* 供 UI 展示/复制与引导推送。零写入配置(发布目录在受控临时区);不含任何凭据字段。 */
|
|
4020
|
-
prepare(payload: MarketPreparePayload): Promise<MarketPrepareResponse>;
|
|
4021
|
-
/** 发布包下载 URL(受控临时区 zip;经宿主 /download 端点,无凭据、无写操作) */
|
|
4022
|
-
downloadPublishUrl(zipPath: string): string;
|
|
4023
3990
|
}
|
|
4024
3991
|
/** 条目收录状态:未收录(本地独有)| PR 待审核(带 PR 链接)| 已收录(官方市场 index 含该 id) */
|
|
4025
3992
|
type MyItemStatus = 'not-listed' | 'pr-pending' | 'listed';
|
|
@@ -5089,7 +5056,10 @@ declare const zh$4: {
|
|
|
5089
5056
|
readonly 'overview.quick.backupSkippedDisabled': '已跳过:定时备份未启用(没有生成任何备份文件)';
|
|
5090
5057
|
readonly 'overview.quick.backupSkippedRunning': '已跳过:上一次备份仍在进行中';
|
|
5091
5058
|
readonly 'overview.quick.backupSkippedConflict': '已跳过:另一项任务正在执行(防重)';
|
|
5092
|
-
readonly 'overview.quick.backupSkippedLocked': '
|
|
5059
|
+
readonly 'overview.quick.backupSkippedLocked': '已跳过:另一个任务正在使用环境锁,稍后重试即可';
|
|
5060
|
+
readonly 'overview.quick.backupSkippedLockStale': '已跳过:存在残留环境锁(上次任务异常退出留下,重试与重启都不会自愈)——请到「事故恢复」回收';
|
|
5061
|
+
readonly 'overview.quick.backupSkippedLockUnavailable': '已跳过:环境锁暂时不可用(锁目录读写失败或状态未知),请稍后重试并查看宿主日志';
|
|
5062
|
+
readonly 'overview.quick.backupSkippedSafeMode': '已跳过:插件处于 SAFE MODE(外部操作失败后自动阻断写入)——请到「事故恢复」处理后重试';
|
|
5093
5063
|
readonly 'overview.quick.backupSkippedOther': '已跳过:备份服务当前无法执行(详情见宿主日志)';
|
|
5094
5064
|
readonly 'overview.quick.backupFailed': '备份失败:{message}';
|
|
5095
5065
|
readonly 'overview.activity.title': '最近活动';
|
|
@@ -5580,6 +5550,7 @@ declare const zh$4: {
|
|
|
5580
5550
|
readonly 'profiles.error.notRunning': '该档案没有正在运行的实例(可能已被手动关闭)';
|
|
5581
5551
|
readonly 'profiles.error.stopFailed': '停止实例失败';
|
|
5582
5552
|
readonly 'profiles.error.instanceRunning': '该档案的实例正在运行,请先停止再删除';
|
|
5553
|
+
readonly 'profiles.error.deleteFailed': '删除失败:档案目录被占用或权限不足,档案仍在磁盘上';
|
|
5583
5554
|
readonly 'profiles.error.generic': '操作失败:{message}';
|
|
5584
5555
|
readonly 'import.compatibility.sections': '{count} 个分区';
|
|
5585
5556
|
readonly 'import.compatibility.plugins': '已装 {installed} · 待装 {toInstall}';
|
|
@@ -5748,6 +5719,7 @@ declare const zh$4: {
|
|
|
5748
5719
|
readonly 'library.moreActions': '更多操作';
|
|
5749
5720
|
readonly 'backupFiles.inspectEncrypted': '这是整包加密的备份,无法直接查看内容:请点「导入」——向导会先让你输入备份密码解锁,解锁后即可看到包含的分区与差异。';
|
|
5750
5721
|
readonly 'library.source.all': '全部';
|
|
5722
|
+
readonly 'library.origin.foreign': '来自他人档案';
|
|
5751
5723
|
readonly 'library.kind.snapshot': '本机快照';
|
|
5752
5724
|
readonly 'library.kind.backupFile': '备份文件';
|
|
5753
5725
|
readonly 'library.kind.remote': '远端快照';
|
|
@@ -5881,6 +5853,7 @@ declare const zh$3: {
|
|
|
5881
5853
|
readonly 'config.tokenPlaceholder': 'ghp_…(可选)';
|
|
5882
5854
|
readonly 'config.save': '立即保存';
|
|
5883
5855
|
readonly 'config.saveHint': '表单改动会自动保存:密码/token 安全写入 DSH credentials,不会写入同步文件或日志。';
|
|
5856
|
+
readonly 'config.savedTick': '已保存';
|
|
5884
5857
|
readonly 'channel.title': '同步通道';
|
|
5885
5858
|
readonly 'channel.git': 'Git 私有仓库';
|
|
5886
5859
|
readonly 'channel.webdav': 'WebDAV 服务器';
|
|
@@ -5950,6 +5923,7 @@ declare const zh$3: {
|
|
|
5950
5923
|
readonly 'repoPicker.hint': '列出你 GitHub 账号下已有的私有仓库(按最近更新排序),选中即填入下方仓库地址;也可以直接在下方手填地址(ssh / 本地路径 / 不在列表里的仓库)。列表需要先登录 GitHub;新建的仓库一律为私有 —— 公开仓库会公开你的配置内容。';
|
|
5951
5924
|
readonly 'repoPicker.placeholder': '手动填写地址(或从上方选择)';
|
|
5952
5925
|
readonly 'repoPicker.refresh': '刷新列表';
|
|
5926
|
+
readonly 'repoPicker.refreshed': '已刷新:{count} 个私有仓库';
|
|
5953
5927
|
readonly 'repoPicker.forkBadge': 'Fork';
|
|
5954
5928
|
readonly 'repoPicker.empty': '没有可用的私有仓库';
|
|
5955
5929
|
readonly 'repoPicker.loadFailed': '仓库列表加载失败,可重试或直接手填地址。';
|
|
@@ -6031,7 +6005,6 @@ declare const zh$3: {
|
|
|
6031
6005
|
readonly 'mode.sessionsPickTitle': '选择要同步的历史对话';
|
|
6032
6006
|
readonly 'mode.sessionsPickHint': '点名后只同步勾中的对话(优先于上面的数量上限);一个都不勾 = 回到「最近 N 个」模式。';
|
|
6033
6007
|
readonly 'mode.sessionsPickReset': '改为「最近 N 个」';
|
|
6034
|
-
readonly 'mode.sessionsWorkspaceWarn': '已勾选历史对话,但没有勾选「工作区」分区:目标机上这些对话可能归属不到任何工作区而显示不出来。建议一并勾选「工作区」。';
|
|
6035
6008
|
readonly 'mode.gistSessionsWarn': '当前通道是 GitHub Gist,且勾选了「历史会话」:gist 会一次取回全部文件内容、单文件超限即截断、文件数还有上限,大分区同步可能失败或内容被截断。建议改用 Git / WebDAV / 对象存储通道同步历史会话,或取消勾选该分区。';
|
|
6036
6009
|
readonly 'mode.persistHint': '分区选择已保存到本机:自动同步和手动推送都会使用此配置(重启后仍生效)。';
|
|
6037
6010
|
readonly 'mode.choose': '选择';
|
|
@@ -6106,7 +6079,10 @@ declare const zh$3: {
|
|
|
6106
6079
|
readonly 'history.autosyncReasonNotConfigured': '未配置仓库';
|
|
6107
6080
|
readonly 'history.autosyncReasonNetwork': '网络问题';
|
|
6108
6081
|
readonly 'history.autosyncReasonEncrypted': '远端快照已加密,自动同步跳过(请手动同步)';
|
|
6109
|
-
readonly 'history.autosyncReasonMutationLocked': '
|
|
6082
|
+
readonly 'history.autosyncReasonMutationLocked': '环境锁被另一个任务占用(稍后重试即可)';
|
|
6083
|
+
readonly 'history.autosyncReasonLockStale': '存在残留环境锁(上次任务异常退出留下,重试与重启都不会自愈)——请到「事故恢复」回收';
|
|
6084
|
+
readonly 'history.autosyncReasonLockUnavailable': '环境锁暂时不可用(锁目录读写失败或状态未知),稍后重试';
|
|
6085
|
+
readonly 'history.autosyncReasonSafeMode': '处于 SAFE MODE(外部操作失败后自动阻断写入)——请到「事故恢复」处理后重试';
|
|
6110
6086
|
readonly 'history.autosyncReasonUnknown': '未知';
|
|
6111
6087
|
readonly 'history.autosyncReasonConflictKeptLocal': '已按策略保留本机并覆盖远端';
|
|
6112
6088
|
readonly 'history.autosyncReasonUpToDate': '无变化(本地与远端一致)';
|