dsh-config-manager 0.4.1 → 0.4.2

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.
Files changed (122) hide show
  1. package/lib/cli/actions.js +2 -3
  2. package/lib/cli/import-source.js +2 -6
  3. package/lib/cli/index.js +2 -3
  4. package/lib/client.d.ts +0 -5
  5. package/lib/client.js +26116 -25801
  6. package/lib/core/exporter.js +2 -4
  7. package/lib/core/host-schedulers/cache-cleanup.d.ts +41 -0
  8. package/lib/core/host-schedulers/cache-cleanup.js +45 -0
  9. package/lib/core/host-schedulers/lifecycle-hooks.d.ts +51 -0
  10. package/lib/core/host-schedulers/lifecycle-hooks.js +78 -0
  11. package/lib/core/host-schedulers/market-cache.d.ts +40 -0
  12. package/lib/core/host-schedulers/market-cache.js +92 -0
  13. package/lib/core/model-tools.js +2 -6
  14. package/lib/core/restore.d.ts +0 -2
  15. package/lib/core/restore.js +16 -18
  16. package/lib/core/verify-recovery.js +4 -7
  17. package/lib/index.d.ts +3 -22
  18. package/lib/index.js +69 -325
  19. package/lib/profiles/dsh-profile-manager.d.ts +23 -1
  20. package/lib/profiles/dsh-profile-manager.js +70 -2
  21. package/lib/routes/kit.d.ts +21 -0
  22. package/lib/routes/kit.js +29 -0
  23. package/lib/routes/prefs.js +6 -6
  24. package/lib/routes/recovery.js +25 -41
  25. package/lib/routes/route-support.d.ts +23 -1
  26. package/lib/routes/route-support.js +185 -0
  27. package/lib/routes/snapshots.js +4 -11
  28. package/lib/routes/sync.js +5 -7
  29. package/lib/security/redaction.d.ts +5 -1
  30. package/lib/security/redaction.js +26 -23
  31. package/lib/sync/backup-scheduler.js +2 -6
  32. package/lib/ui/backup-inspect.d.ts +1 -1
  33. package/lib/ui/dsh-profiles-view.d.ts +0 -10
  34. package/lib/ui/dsh-profiles-view.js +3 -7
  35. package/lib/ui/snapshots-view.d.ts +0 -14
  36. package/lib/ui/snapshots-view.js +16 -2
  37. package/lib/utils/paths.d.ts +20 -4
  38. package/lib/utils/paths.js +22 -6
  39. package/lib/utils/time.d.ts +31 -0
  40. package/lib/utils/time.js +54 -0
  41. package/package.json +1 -1
  42. package/src/cli/actions.ts +2 -3
  43. package/src/cli/import-source.ts +2 -7
  44. package/src/cli/index.ts +2 -3
  45. package/src/client/about/AboutPanel.tsx +1 -1
  46. package/src/client/about/ReleaseBody.tsx +22 -52
  47. package/src/client/about/ReleaseNotesDialog.tsx +15 -69
  48. package/src/client/about/release-notes-view.ts +4 -11
  49. package/src/client/common/info-hint-guard.test.ts +11 -5
  50. package/src/client/common/ui.tsx +23 -0
  51. package/src/client/config-manager.module.css +201 -32
  52. package/src/client/css-token-guard.test.ts +135 -1
  53. package/src/client/import/ConflictList.tsx +3 -3
  54. package/src/client/import/ImportWizardView.tsx +1 -1
  55. package/src/client/library/ArtifactRow.tsx +2 -2
  56. package/src/client/library/RestorePlanView.tsx +21 -9
  57. package/src/client/library/report-dismiss.test.ts +5 -3
  58. package/src/client/locales/about.ts +97 -0
  59. package/src/client/locales/backup.ts +141 -0
  60. package/src/client/locales/common.ts +113 -0
  61. package/src/client/locales/export.ts +184 -0
  62. package/src/client/locales/foreign.ts +184 -0
  63. package/src/client/locales/import-compat.ts +32 -0
  64. package/src/client/locales/import.ts +192 -0
  65. package/src/client/locales/next-steps.ts +25 -0
  66. package/src/client/locales/overview-control.ts +32 -0
  67. package/src/client/locales/overview.ts +145 -0
  68. package/src/client/locales/profiles.ts +263 -0
  69. package/src/client/locales/report.ts +17 -0
  70. package/src/client/locales/restore.ts +132 -0
  71. package/src/client/locales/sessions.ts +257 -0
  72. package/src/client/locales/shell.ts +149 -0
  73. package/src/client/locales.ts +49 -1783
  74. package/src/client/market/MarketImportReview.tsx +2 -2
  75. package/src/client/market/MarketPanel.tsx +1 -1
  76. package/src/client/market/market-view.ts +3 -5
  77. package/src/client/recovery/RecoveryPanel.tsx +62 -1054
  78. package/src/client/recovery/SessionHealthCard.tsx +134 -0
  79. package/src/client/recovery/SessionHealthDialog.tsx +665 -0
  80. package/src/client/recovery/SessionLayoutSection.tsx +284 -0
  81. package/src/client/recovery/recovery-api.ts +10 -1
  82. package/src/client/recovery/recovery-panel-layout.test.ts +20 -5
  83. package/src/client/recovery/session-dialog-mount.test.ts +16 -9
  84. package/src/client/recovery/use-recovery-write.test.ts +90 -0
  85. package/src/client/recovery/use-recovery-write.ts +53 -0
  86. package/src/client/run-store.ts +57 -2
  87. package/src/client/sync/PushPreviewCard.tsx +2 -2
  88. package/src/client/sync/SyncConfirmView.tsx +5 -5
  89. package/src/client/sync/SyncLogList.tsx +2 -2
  90. package/src/client/sync/history-model.ts +4 -5
  91. package/src/client/sync/sync-view.ts +3 -4
  92. package/src/core/exporter.ts +2 -4
  93. package/src/core/host-schedulers/cache-cleanup.test.ts +84 -0
  94. package/src/core/host-schedulers/cache-cleanup.ts +74 -0
  95. package/src/core/host-schedulers/lifecycle-hooks.test.ts +111 -0
  96. package/src/core/host-schedulers/lifecycle-hooks.ts +118 -0
  97. package/src/core/host-schedulers/market-cache.test.ts +93 -0
  98. package/src/core/host-schedulers/market-cache.ts +116 -0
  99. package/src/core/model-tools.ts +2 -7
  100. package/src/core/restore-failure-state.test.ts +210 -0
  101. package/src/core/restore.ts +16 -18
  102. package/src/core/verify-recovery.ts +4 -7
  103. package/src/index.ts +76 -330
  104. package/src/profiles/dsh-profile-copy-rollback.test.ts +156 -0
  105. package/src/profiles/dsh-profile-manager.ts +71 -3
  106. package/src/routes/kit.ts +37 -0
  107. package/src/routes/prefs.ts +6 -6
  108. package/src/routes/recovery.ts +25 -42
  109. package/src/routes/route-support.ts +208 -1
  110. package/src/routes/snapshots.ts +4 -9
  111. package/src/routes/sync.ts +4 -7
  112. package/src/security/redaction.ts +29 -23
  113. package/src/sync/backup-scheduler.ts +3 -6
  114. package/src/sync/sync-config.test.ts +24 -13
  115. package/src/ui/backup-inspect.ts +1 -1
  116. package/src/ui/dsh-profiles-view.ts +3 -5
  117. package/src/ui/i18n.test.ts +8 -3
  118. package/src/ui/snapshots-view.ts +2 -2
  119. package/src/utils/paths.test.ts +36 -1
  120. package/src/utils/paths.ts +30 -6
  121. package/src/utils/time.test.ts +46 -0
  122. package/src/utils/time.ts +55 -0
@@ -4,7 +4,7 @@
4
4
  * Workbench Rebuild(2026-09):
5
5
  * - 每个冲突渲染为「选边卡片」:保留当前 / 使用备份 两个并排可点选块,
6
6
  * 选中侧高亮描边 + 淡底(radio 语义保留:label 包裹原生 input,键盘可操作);
7
- * - 适配器标签(kindTag)+ 描述(路径等宽字体)组成卡片头;
7
+ * - 适配器标签(中性 Chip)+ 描述(路径等宽字体)组成卡片头;
8
8
  * - 配置更改明细(detail)不再用 <pre>(white-space:pre 不换行 → 长 JSON 横向溢出),
9
9
  * 改为切分后 prefix / current / imported 各自成行、长值自动换行(见 splitConflictDetail);
10
10
  * - 批量决策按钮置于列表顶部工具行。
@@ -25,7 +25,7 @@ import { ConflictCollector } from '../../ui/conflict-view.ts'
25
25
  import type { ItemResolution } from '../../core/types.ts'
26
26
  import type { TranslateNS } from '../client-types.ts'
27
27
  import { redact } from '../../security/redaction.ts'
28
- import { Banner } from '../common/ui.tsx'
28
+ import { Banner, Chip } from '../common/ui.tsx'
29
29
  import css from '../config-manager.module.css'
30
30
 
31
31
  export interface ConflictListProps {
@@ -136,7 +136,7 @@ export function ConflictList({ collector, t, onChanged }: ConflictListProps) {
136
136
  return (
137
137
  <div key={item.id} className={css.conflictItem}>
138
138
  <div className={css.conflictHead}>
139
- <span className={css.kindTag}>{item.adapter}</span>
139
+ <Chip>{item.adapter}</Chip>
140
140
  <span className={`${css.conflictId} ${css.mono}`} title={safeDescription}>{safeDescription}</span>
141
141
  {item.severity === 'error' && <span className={css.severityError}>{t('import.conflicts.severityError')}</span>}
142
142
  </div>
@@ -175,7 +175,7 @@ function CompatibilityStep(props: {
175
175
  <span className={css.groupLabel}>{t('import.source.title')}</span>
176
176
  <span className={css.statusSpacer} />
177
177
  </div>
178
- <div className={css.statRow} style={{ flexWrap: 'wrap', gap: '8px' }}>
178
+ <div className={css.statRow + ' ' + css.statRowWrap}>
179
179
  {analysis.source !== undefined && (
180
180
  <Badge kind="info">
181
181
  {t('import.source.dsh', {
@@ -19,7 +19,7 @@ import {
19
19
  import type { UiT } from '../../ui/i18n.ts'
20
20
  import type { TranslateNS } from '../client-types.ts'
21
21
  import { midEllipsis } from '../../ui/mid-ellipsis.ts'
22
- import { Badge, Button, Spinner } from '../common/ui.tsx'
22
+ import { Badge, Button, Chip, Spinner } from '../common/ui.tsx'
23
23
  import { ExpandChevron } from '../common/Icon.tsx'
24
24
  import { MoreMenu } from '../common/MoreMenu.tsx'
25
25
  import { ArtifactDetail } from './ArtifactDetail.tsx'
@@ -104,7 +104,7 @@ export function ArtifactRowView({
104
104
  <div className={css.artifactMain}>
105
105
  <div className={css.artifactTitle}>
106
106
  {/* 来源标签上标题行(定案 B):来源已由此表达,再放一个 kind 图标属重复表达 */}
107
- <span className={css.kindTag}>{uiT(ARTIFACT_KIND_LABEL_KEY[row.kind])}</span>
107
+ <Chip>{uiT(ARTIFACT_KIND_LABEL_KEY[row.kind])}</Chip>
108
108
  {/* 文件名走等宽栈 + 中段省略(DESIGN.md:93 / §9-5):尾部才是区分信息
109
109
  (同一分钟导出的两份备份只差尾部时间戳),尾部截断会让两行看起来一样。 */}
110
110
  <span
@@ -19,7 +19,8 @@ import type { TranslateNS } from '../client-types.ts'
19
19
  import { toRestorePlanView, withLoadedStatus, type RestorePlanRow } from '../../ui/restore-plan-view.ts'
20
20
  import { DiffTable } from '../common/DiffTable.tsx'
21
21
  import { formatBytes } from '../../ui/report.ts'
22
- import { Badge, Banner } from '../common/ui.tsx'
22
+ import { Badge, Banner, Chip } from '../common/ui.tsx'
23
+ import type { BadgeKind } from '../../ui/badge-tone.ts'
23
24
  import { SkeletonTable } from '../common/Skeleton.tsx'
24
25
  import { ExpandChevron } from '../common/Icon.tsx'
25
26
  import { Collapse } from '../common/Motion.tsx'
@@ -53,15 +54,26 @@ function statusLabel(t: TranslateNS<'config-manager'>, status: RestorePlanRow['s
53
54
  }
54
55
  }
55
56
 
56
- /** 状态语义色彩(复用既有 kindTag 四态)。 */
57
- function statusTagClass(status: RestorePlanRow['status']): string {
57
+ /** 状态标签:有语义的走四态 Badge,纯分类(skip / 无动作)走中性 Chip。 */
58
+ function StatusTag({ status, label }: { status: RestorePlanRow['status']; label: string }) {
59
+ const kind = statusBadgeKind(status)
60
+ return kind === null ? <Chip>{label}</Chip> : <Badge kind={kind}>{label}</Badge>
61
+ }
62
+
63
+ /**
64
+ * 状态 → 四态语义(tech-debt #10)。
65
+ *
66
+ * 返回 `null` 表示「这条只是分类、不是状态」(skip/无动作):渲染成中性 Chip,
67
+ * 而不是硬塞进四态表里凑第五档。四态本身仍由 src/ui/badge-tone.ts 唯一定义。
68
+ */
69
+ function statusBadgeKind(status: RestorePlanRow['status']): BadgeKind | null {
58
70
  switch (status) {
59
- case 'modified': return `${css.kindTag} ${css.kindTagInfo}`
60
- case 'added': return `${css.kindTag} ${css.kindTagOk}`
61
- case 'deleted': return `${css.kindTag} ${css.kindTagError}`
71
+ case 'modified': return 'info'
72
+ case 'added': return 'ok'
73
+ case 'deleted': return 'error'
62
74
  case 'plugin':
63
- case 'hint': return `${css.kindTag} ${css.kindTagWarn}`
64
- default: return css.kindTag ?? ''
75
+ case 'hint': return 'warn'
76
+ default: return null
65
77
  }
66
78
  }
67
79
 
@@ -224,7 +236,7 @@ export function RestorePlanView({ api, t, snapshotId, plan, changeSummary }: Res
224
236
  /** 行头(可展开行是 button,纯信息行是 div —— 不让屏幕阅读器把内容吞进 disabled 按钮) */
225
237
  const head = (
226
238
  <>
227
- <span className={statusTagClass(row.status)}>{statusLabel(t, row.status)}</span>
239
+ <StatusTag status={row.status} label={statusLabel(t, row.status)} />
228
240
  <span className={css.restorePlanPath} title={safeTarget ?? ''}>
229
241
  {safeTarget ?? safeDescription}
230
242
  </span>
@@ -23,7 +23,8 @@ const ROOT = fileURLToPath(new URL('../../../', import.meta.url))
23
23
  // UI v2:旧的 snapshots 面板已解散,恢复报告改由产物库的动作层以 Modal 呈递 ——
24
24
  // 退出入口从「报告块内的按钮」变成「Modal.Footer 的完成按钮」,语义不变(必须显式退出)。
25
25
  const PANEL = path.join(ROOT, 'src', 'client', 'library', 'LibraryActions.tsx')
26
- const LOCALES = path.join(ROOT, 'src', 'client', 'locales.ts')
26
+ // 字典已按页面域拆成 src/client/locales/*.ts(聚合器只剩 import/展开,没有字面量)——守卫跟着扫目录。
27
+ const LOCALES_DIR = path.join(ROOT, 'src', 'client', 'locales')
27
28
 
28
29
  /** 剥掉块注释与行注释(注释里的同名文字会造成假阳性,见 AGENTS.md 的 bundle 扫描教训)。 */
29
30
  function stripComments(src: string): string {
@@ -61,8 +62,9 @@ test('恢复报告:默认不渲染(report 为 null),退出即清空 —
61
62
  })
62
63
 
63
64
  test('恢复报告:snapshots.reportDone 在 zh / en 两套字典中都必须存在', () => {
64
- const locales = fs.readFileSync(LOCALES, 'utf8')
65
- const hits = [...locales.matchAll(/'snapshots\.reportDone':/g)]
65
+ const files = fs.readdirSync(LOCALES_DIR).filter((name) => name.endsWith('.ts'))
66
+ assert.ok(files.length > 0, '字典目录为空:拆分子文件找错位置了')
67
+ const hits = files.flatMap((name) => [...fs.readFileSync(path.join(LOCALES_DIR, name), 'utf8').matchAll(/'snapshots\.reportDone':/g)])
66
68
  assert.equal(hits.length, 2, `snapshots.reportDone 必须 zh/en 各一条(实际 ${hits.length} 条)`)
67
69
  })
68
70
 
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Config Manager 字典分域 · Star 引导弹窗与关于页。
3
+ *
4
+ * tech-debt #22(2026-11 拆分):本文件只承载该域键值;聚合与键顺序由 ../locales.ts 编排。
5
+ * 约束:zh 文案逐字保留、en 一键一镜像(`Record<keyof typeof zh, string>` 编译期校验),
6
+ * 键集合由 src/core/engine-locale.test.ts 的既有键冻结指纹兜底。本文件零依赖、零 import。
7
+ */
8
+ export const zh = {
9
+ // —— 错误 ——
10
+ // —— Star 引导弹窗 ——
11
+ 'starPrompt.title': '喜欢 Config Manager 吗?',
12
+ 'starPrompt.body': '如果你觉得这个插件有用,欢迎到 GitHub 点个 ⭐ Star 支持一下——你的支持是持续维护的最大动力!',
13
+ 'starPrompt.star': '去点 Star',
14
+ 'starPrompt.dismiss': '不再提示',
15
+ // —— 关于 ——
16
+ 'about.official': '官方',
17
+ 'about.version': '版本 {version}',
18
+ 'about.dshVersion': 'DSH {version}',
19
+ 'about.links': '相关链接',
20
+ 'about.star': '⭐ 在 GitHub 上点赞',
21
+ 'about.repo': 'GitHub 仓库',
22
+ 'about.docs': '使用文档',
23
+ 'about.issues': '反馈问题',
24
+ 'about.feedbackHint': '遇到界面问题?复制环境信息,粘进 issue 就行',
25
+ 'about.copyEnv': '复制环境信息',
26
+ 'about.authorLabel': '作者',
27
+ 'about.loading': '正在获取版本信息…',
28
+ 'about.retryStatus': '重新获取',
29
+ 'about.releaseNotes': '更新内容',
30
+ 'about.diag.label': '插件清单来源',
31
+ 'about.diag.profileDir': '目录:{path}',
32
+ 'about.diag.profile': 'profile:{profile}',
33
+ 'about.diag.pluginCount': '已识别插件:{count} 个',
34
+ 'about.diag.manifestUnreadable': '读不到 package.json:插件清单为空(核对 profile 与 DSH_HOME)',
35
+ 'about.diag.hint': '若与实际不符,请据此检查当前档案的启动方式(宿主 profileContext / 启动参数 --profile / 环境变量 DSH_PROFILE)与 DSH_HOME 环境变量。',
36
+ 'about.releaseNotes.title': '版本更新内容',
37
+ 'about.releaseNotes.loading': '正在获取更新内容…',
38
+ 'about.releaseNotes.loadingMore': '正在加载更多版本…',
39
+ 'about.releaseNotes.empty': '暂无发布记录',
40
+ 'about.releaseNotes.retry': '重试',
41
+ 'about.releaseNotes.viewOnGithub': '在 GitHub 上查看全部 Releases',
42
+ 'about.releaseNotes.viewSingleOnGithub': '在 GitHub 上查看此版本',
43
+ 'about.releaseNotes.allLoaded': '已加载全部版本记录',
44
+ 'about.releaseNotes.prerelease': '预发布',
45
+ 'about.releaseNotes.latest': '最新',
46
+ 'about.releaseNotes.noBody': '该版本暂无详细更新说明。',
47
+ 'about.releaseNotes.confirm': '确认',
48
+ 'about.releaseNotes.neverShow': '永不提示',
49
+ 'about.cli.title': 'CLI 救援工具',
50
+ 'about.cli.hint': 'GUI 运行在 DSH 内部——DSH 无法启动时,独立安装的 CLI(dsh-config-manager)是第一救援手段:列快照 / 离线恢复 / 一键重装 DSH,全程无需 DSH 运行。安装一次即可在任何机器上用:',
51
+ 'about.cli.docs': 'CLI 使用文档',
52
+ } as const;
53
+
54
+ export const en: Record<keyof typeof zh, string> = {
55
+ // —— Star prompt dialog ——
56
+ 'starPrompt.title': 'Enjoying Config Manager?',
57
+ 'starPrompt.body': 'If you find this plugin useful, please give it a ⭐ on GitHub — your support keeps it maintained!',
58
+ 'starPrompt.star': 'Star on GitHub',
59
+ 'starPrompt.dismiss': "Don't ask again",
60
+ // —— About ——
61
+ 'about.official': 'Official',
62
+ 'about.version': 'Version {version}',
63
+ 'about.dshVersion': 'DSH {version}',
64
+ 'about.links': 'Links',
65
+ 'about.star': '⭐ Star on GitHub',
66
+ 'about.repo': 'GitHub Repository',
67
+ 'about.docs': 'Documentation',
68
+ 'about.issues': 'Report an issue',
69
+ 'about.feedbackHint': 'Hit a UI problem? Copy the environment info and paste it into your issue.',
70
+ 'about.copyEnv': 'Copy environment info',
71
+ 'about.authorLabel': 'Author',
72
+ 'about.loading': 'Loading version info…',
73
+ 'about.retryStatus': 'Retry',
74
+ 'about.releaseNotes': 'Release Notes',
75
+ 'about.diag.label': 'Plugin list source',
76
+ 'about.diag.profileDir': 'Directory: {path}',
77
+ 'about.diag.profile': 'profile: {profile}',
78
+ 'about.diag.pluginCount': 'Plugins detected: {count}',
79
+ 'about.diag.manifestUnreadable': 'package.json unreadable: plugin list is empty (check profile and DSH_HOME)',
80
+ 'about.diag.hint': 'If this does not match your setup, check how the profile was launched (host profileContext / --profile argument / DSH_PROFILE environment variable) and the DSH_HOME environment variable.',
81
+ 'about.releaseNotes.title': 'Release Notes',
82
+ 'about.releaseNotes.loading': 'Loading release notes…',
83
+ 'about.releaseNotes.loadingMore': 'Loading more releases…',
84
+ 'about.releaseNotes.empty': 'No releases',
85
+ 'about.releaseNotes.retry': 'Retry',
86
+ 'about.releaseNotes.viewOnGithub': 'View all releases on GitHub',
87
+ 'about.releaseNotes.viewSingleOnGithub': 'View on GitHub',
88
+ 'about.releaseNotes.allLoaded': 'All releases loaded',
89
+ 'about.releaseNotes.prerelease': 'Pre-release',
90
+ 'about.releaseNotes.latest': 'Latest',
91
+ 'about.releaseNotes.noBody': 'No description provided for this release.',
92
+ 'about.releaseNotes.confirm': 'Confirm',
93
+ 'about.releaseNotes.neverShow': "Don't show again",
94
+ 'about.cli.title': 'CLI Rescue Tool',
95
+ 'about.cli.hint': 'The GUI lives inside DSH — when DSH cannot start, the separately installed CLI (dsh-config-manager) is your first rescue tool: list snapshots / offline restore / one-click DSH reinstall, no DSH runtime needed. Install once and use it on any machine:',
96
+ 'about.cli.docs': 'CLI documentation',
97
+ };
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Config Manager 字典分域 · 定时全量备份与保留策略(GFS 分层)。
3
+ *
4
+ * tech-debt #22(2026-11 拆分):本文件只承载该域键值;聚合与键顺序由 ../locales.ts 编排。
5
+ * 约束:zh 文案逐字保留、en 一键一镜像(`Record<keyof typeof zh, string>` 编译期校验),
6
+ * 键集合由 src/core/engine-locale.test.ts 的既有键冻结指纹兜底。本文件零依赖、零 import。
7
+ */
8
+ export const zh = {
9
+ // —— 定时全量备份(快照 tab)——
10
+ 'backupSchedule.title': '定时全量备份',
11
+ 'backupSchedule.hint': '按固定间隔在后台自动导出全量备份 ZIP(恒不含 secret、不加密;要加密请手动导出)。配置存 sync/backup-schedule.json,随 self 分区备份 / 远程同步迁移。',
12
+ 'backupSchedule.enabled': '启用定时备份',
13
+ 'backupSchedule.enabledHint': '开启后 DSH 在后台按间隔自动备份;每次启动时立即执行一次(距上次运行不足 1 小时则跳过启动触发)。',
14
+ 'backupSchedule.interval': '备份间隔',
15
+ 'backupSchedule.interval.6h': '每 6 小时',
16
+ 'backupSchedule.interval.12h': '每 12 小时',
17
+ 'backupSchedule.interval.24h': '每 24 小时',
18
+ 'backupSchedule.interval.7d': '每 7 天',
19
+ 'backupSchedule.interval.custom': '自定义(每周固定时刻)',
20
+ 'backupSchedule.customHint': '每周在选定星期与时刻各执行一次全量备份(错过的时间点不补跑)',
21
+ // 自定义档三个下拉的无障碍名(无可见 label:它们与「启用定时备份」复选框同排)
22
+ 'backupSchedule.weekday': '星期',
23
+ 'backupSchedule.hour': '小时',
24
+ 'backupSchedule.minute': '分钟',
25
+ 'backupSchedule.weekday.sunday': '周日',
26
+ 'backupSchedule.weekday.monday': '周一',
27
+ 'backupSchedule.weekday.tuesday': '周二',
28
+ 'backupSchedule.weekday.wednesday': '周三',
29
+ 'backupSchedule.weekday.thursday': '周四',
30
+ 'backupSchedule.weekday.friday': '周五',
31
+ 'backupSchedule.weekday.saturday': '周六',
32
+ 'backupSchedule.save': '保存设置',
33
+ 'backupSchedule.saved': '设置已保存',
34
+ 'backupSchedule.runNow': '立即备份',
35
+ 'backupSchedule.lastRun': '上次运行',
36
+ 'backupSchedule.never': '从未运行',
37
+ 'backupSchedule.status.success': '成功',
38
+ 'backupSchedule.status.skipped': '已跳过',
39
+ 'backupSchedule.status.failed': '失败',
40
+ 'backupSchedule.consecutiveFailures': '定时备份连续失败 {count} 次,请检查配置(磁盘空间 / 权限 / 分区导出错误)',
41
+ 'backupSchedule.loading': '加载定时备份设置…',
42
+ 'backupSchedule.error': '定时备份设置加载失败',
43
+ // —— 保留策略(m-retention:GFS 分层)——
44
+ 'retention.title': '保留策略',
45
+ 'retention.hint': '控制自动清理保留多少份(快照与定时备份共用)。置顶的快照与未收敛恢复点恒豁免自动清理。',
46
+ 'retention.keepLast': '最近保留',
47
+ 'retention.keepLastHint': '按时间保留最近 N 份;0 = 不按「最近」保留',
48
+ 'retention.keepMonthly': '每月保留',
49
+ 'retention.keepMonthlyHint': '每月额外保留最新 1 份,最多覆盖 N 个月;0 = 关闭',
50
+ 'retention.keepYearly': '每年保留',
51
+ 'retention.keepYearlyHint': '每年额外保留最新 1 份,最多覆盖 N 年;0 = 关闭',
52
+ 'retention.unit': '份',
53
+ 'retention.months': '个月',
54
+ 'retention.years': '年',
55
+ 'retention.tiersOff': '仅保留最近 N 份',
56
+ 'retention.appliesTo': '生效于:导入前快照 + 定时备份产物',
57
+ 'backupFiles.hint': '导出产物(手动导出与定时备份)统一在此管理:可下载到本机、直接导入恢复,或删除。定时备份自动保留最近 10 个。',
58
+ 'backupFiles.empty': '暂无备份文件',
59
+ 'backupFiles.delete': '删除',
60
+ 'backupFiles.deleteConfirmTitle': '删除备份文件',
61
+ 'backupFiles.deleteConfirm': '确认删除备份文件「{name}」?此操作不可恢复。',
62
+ 'backupFiles.deleted': '已删除备份文件「{name}」',
63
+ 'backupFiles.inspect': '查看 / 对比',
64
+ 'backupFiles.inspectLoading': '正在分析备份内容…',
65
+ 'backupFiles.inspectEmpty': '该备份无法分析(文件损坏或格式不支持)',
66
+ 'backupFiles.inspectSections': '包含的分区',
67
+ 'backupFiles.inspectDiff': '与此备份的差异(只读预览)',
68
+ 'backupFiles.inspectItems': '变更明细',
69
+ 'backupFiles.inspectGroup.conflicts': '冲突(需决策)',
70
+ 'backupFiles.inspectGroup.changes': '变更(将写入)',
71
+ 'backupFiles.inspectGroup.paths': '路径映射(需处理)',
72
+ 'backupFiles.inspectGroup.skipped': '已一致(无需处理)',
73
+ 'backupFiles.inspectGroup.others': '其他',
74
+ } as const;
75
+
76
+ export const en: Record<keyof typeof zh, string> = {
77
+ // —— Scheduled full backups (snapshots tab) ——
78
+ 'backupSchedule.title': 'Scheduled Full Backups',
79
+ 'backupSchedule.hint': 'Automatically export a full backup ZIP in the background on a fixed cadence (secrets are never included, never encrypted — use manual export for encryption). Config lives in sync/backup-schedule.json and migrates with the self section.',
80
+ 'backupSchedule.enabled': 'Enable scheduled backups',
81
+ 'backupSchedule.enabledHint': 'When on, DSH backs up automatically on the cadence below; one run fires on every startup (skipped if less than 1h since the last run).',
82
+ 'backupSchedule.interval': 'Backup interval',
83
+ 'backupSchedule.interval.6h': 'Every 6 hours',
84
+ 'backupSchedule.interval.12h': 'Every 12 hours',
85
+ 'backupSchedule.interval.24h': 'Every 24 hours',
86
+ 'backupSchedule.interval.7d': 'Every 7 days',
87
+ 'backupSchedule.interval.custom': 'Custom (weekly at a fixed time)',
88
+ 'backupSchedule.customHint': 'Runs a full backup once a week at the selected weekday and time (missed triggers are not backfilled)',
89
+ 'backupSchedule.weekday': 'Weekday',
90
+ 'backupSchedule.hour': 'Hour',
91
+ 'backupSchedule.minute': 'Minute',
92
+ 'backupSchedule.weekday.sunday': 'Sunday',
93
+ 'backupSchedule.weekday.monday': 'Monday',
94
+ 'backupSchedule.weekday.tuesday': 'Tuesday',
95
+ 'backupSchedule.weekday.wednesday': 'Wednesday',
96
+ 'backupSchedule.weekday.thursday': 'Thursday',
97
+ 'backupSchedule.weekday.friday': 'Friday',
98
+ 'backupSchedule.weekday.saturday': 'Saturday',
99
+ 'backupSchedule.save': 'Save settings',
100
+ 'backupSchedule.saved': 'Settings saved',
101
+ 'backupSchedule.runNow': 'Back up now',
102
+ 'backupSchedule.lastRun': 'Last run',
103
+ 'backupSchedule.never': 'Never run',
104
+ 'backupSchedule.status.success': 'Success',
105
+ 'backupSchedule.status.skipped': 'Skipped',
106
+ 'backupSchedule.status.failed': 'Failed',
107
+ 'backupSchedule.consecutiveFailures': 'Scheduled backups failed {count} {count, plural, time|times} in a row — check the configuration (disk space / permissions / section export errors)',
108
+ 'backupSchedule.loading': 'Loading scheduled backup settings…',
109
+ 'backupSchedule.error': 'Failed to load scheduled backup settings',
110
+ // —— Retention policy (m-retention: GFS tiers) ——
111
+ 'retention.title': 'Retention policy',
112
+ 'retention.hint': 'Controls how many copies auto-cleanup keeps (shared by snapshots and scheduled backups). Pinned snapshots and unsettled recovery points are always exempt.',
113
+ 'retention.keepLast': 'Keep last',
114
+ 'retention.keepLastHint': 'Keep the newest N by time; 0 disables the "recent" tier',
115
+ 'retention.keepMonthly': 'Keep monthly',
116
+ 'retention.keepMonthlyHint': 'Additionally keep the newest copy of each month, for at most N months; 0 disables',
117
+ 'retention.keepYearly': 'Keep yearly',
118
+ 'retention.keepYearlyHint': 'Additionally keep the newest copy of each year, for at most N years; 0 disables',
119
+ 'retention.unit': 'copies',
120
+ 'retention.months': 'months',
121
+ 'retention.years': 'years',
122
+ 'retention.tiersOff': 'Newest N copies only',
123
+ 'retention.appliesTo': 'Applies to: pre-import snapshots + scheduled backup artifacts',
124
+ 'backupFiles.hint': 'All export artifacts (manual exports and scheduled backups) are managed here: download to your machine, import to restore, or delete. Scheduled backups auto-keep the latest 10.',
125
+ 'backupFiles.empty': 'No backup files yet',
126
+ 'backupFiles.delete': 'Delete',
127
+ 'backupFiles.deleteConfirmTitle': 'Delete backup file',
128
+ 'backupFiles.deleteConfirm': 'Delete backup file "{name}"? This cannot be undone.',
129
+ 'backupFiles.deleted': 'Deleted backup file “{name}”',
130
+ 'backupFiles.inspect': 'Inspect / Compare',
131
+ 'backupFiles.inspectLoading': 'Analyzing backup contents…',
132
+ 'backupFiles.inspectEmpty': 'This backup could not be analyzed (corrupt or unsupported format)',
133
+ 'backupFiles.inspectSections': 'Sections included',
134
+ 'backupFiles.inspectDiff': 'Diff against this backup (read-only preview)',
135
+ 'backupFiles.inspectItems': 'Change details',
136
+ 'backupFiles.inspectGroup.conflicts': 'Conflicts (need decision)',
137
+ 'backupFiles.inspectGroup.changes': 'Changes (will apply)',
138
+ 'backupFiles.inspectGroup.paths': 'Path mappings (need handling)',
139
+ 'backupFiles.inspectGroup.skipped': 'Identical (nothing to do)',
140
+ 'backupFiles.inspectGroup.others': 'Others',
141
+ };
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Config Manager 字典分域 · 入口与公共(分区显示名、关于片段、公共标点、Toast)。
3
+ *
4
+ * tech-debt #22(2026-11 拆分):本文件只承载该域键值;聚合与键顺序由 ../locales.ts 编排。
5
+ * 约束:zh 文案逐字保留、en 一键一镜像(`Record<keyof typeof zh, string>` 编译期校验),
6
+ * 键集合由 src/core/engine-locale.test.ts 的既有键冻结指纹兜底。本文件零依赖、零 import。
7
+ */
8
+ export const zh = {
9
+ // 入口
10
+ 'section.label': '备份与迁移',
11
+ 'section.description': '导出 / 导入 / 迁移 DSH 配置(备份不含密钥,加密备份可选)',
12
+ // 分区显示名(SectionId → 文案;唯一映射见 common/section-labels.ts。UI-08)
13
+ 'section.settings': '设置',
14
+ 'section.ui': 'UI 偏好',
15
+ 'section.providers': 'Provider 与模型',
16
+ 'section.plugins': '插件清单',
17
+ 'section.mcp': 'MCP 服务器',
18
+ 'section.prompts': '提示词',
19
+ 'section.skills': '技能',
20
+ 'section.agentPresets': 'Agent 预设',
21
+ 'section.agentInstructions': '全局指令',
22
+ 'section.workspaces': '工作区',
23
+ 'section.pluginFiles': '插件散落配置',
24
+ 'section.credentialsStatus': '凭据状态',
25
+ 'section.secrets': '密钥',
26
+ 'section.sessions': '历史会话',
27
+ 'section.self': '配置管理器设置',
28
+ 'section.pluginData': '插件数据目录',
29
+ 'section.pluginAssets': '插件大文件',
30
+ // 视图切换
31
+ 'view.about': '关于',
32
+ // 关于页「一键复制环境信息」片段(提 issue 用):zh 保留双语标题(维护者可读),en 纯英文
33
+ 'about.snippet.environment': '### 环境 / Environment',
34
+ // 更新内容拉取失败(GitHub API):错误对象里也必须是当前语言
35
+ 'about.releaseNotes.rateLimited': 'GitHub API 速率限制(Rate limit exceeded),请稍后再试或直接在 GitHub 上查看。',
36
+ 'about.releaseNotes.fetchFailed': 'GitHub API 请求失败 ({status} {statusText})',
37
+ 'about.snippet.plugin': '- 插件版本 / Plugin: {version}',
38
+ 'about.snippet.dsh': '- DSH 版本 / DSH: {version}',
39
+ 'about.snippet.platform': '- 平台 / Platform: {platform}',
40
+ 'about.snippet.pluginDir': '- 插件清单目录 / Plugin dir: {dir}',
41
+ // 公共
42
+ 'common.close': '关闭',
43
+ 'common.cancel': '取消',
44
+ // 标点也属界面文案:英文界面不得出现全角冒号(label:value 形态的分隔符走这个词条)
45
+ 'common.labelSeparator': ':',
46
+ 'common.back': '上一步',
47
+ 'common.next': '下一步',
48
+ 'common.retry': '重试',
49
+ // 落盘失败(sessionStorage 配额满/不可用):状态还在内存里,但刷新即丢 —— 必须说清
50
+ 'common.saveFailed': '浏览器存储写入失败:当前进度仍在本页内存中,刷新会丢失',
51
+ 'common.loading': '加载中…',
52
+ 'common.unknownError': '未知错误',
53
+ // client-F6:拼接类标点走字典(英文界面不得出现全角括号 / 顿号)
54
+ 'common.parens': '({text})',
55
+ // client-F5:关于页 CLI 命令说明(此前硬编码中文)
56
+ 'about.cli.help': '列出全部 CLI 命令与用法(离线可用)',
57
+ 'about.cli.snapshots': '列出本机回滚快照(无需 DSH 运行)',
58
+ 'about.cli.restore': '恢复到导入前状态(离线)',
59
+ 'about.cli.reinstall': '一键重装 DSH(救援)',
60
+ 'common.listSeparator': '、',
61
+ // 全局通知(右下角 Toast)的通用文案
62
+ 'toast.copied': '已复制到剪贴板',
63
+ 'toast.copyFailed': '复制失败,请手动选择文本复制',
64
+ } as const;
65
+
66
+ export const en: Record<keyof typeof zh, string> = {
67
+ 'section.label': 'Backup & Migration',
68
+ 'section.description': 'Export / import / migrate DSH configuration (backups exclude secrets; encrypted backups optional)',
69
+ // Section display names (SectionId → text; the single mapping lives in common/section-labels.ts, UI-08)
70
+ 'section.settings': 'Settings',
71
+ 'section.ui': 'UI Preferences',
72
+ 'section.providers': 'Providers & Models',
73
+ 'section.plugins': 'Plugin list',
74
+ 'section.mcp': 'MCP Servers',
75
+ 'section.prompts': 'Prompts',
76
+ 'section.skills': 'Skills',
77
+ 'section.agentPresets': 'Agent Presets',
78
+ 'section.agentInstructions': 'Agent Instructions',
79
+ 'section.workspaces': 'Workspaces',
80
+ 'section.pluginFiles': 'Plugin config files',
81
+ 'section.credentialsStatus': 'Credentials Status',
82
+ 'section.secrets': 'Secrets',
83
+ 'section.sessions': 'Sessions',
84
+ 'section.self': 'Config Manager settings',
85
+ 'section.pluginData': 'Plugin data dirs',
86
+ 'section.pluginAssets': 'Plugin large files',
87
+ 'view.about': 'About',
88
+ 'about.snippet.environment': '### Environment',
89
+ 'about.releaseNotes.rateLimited': 'GitHub API rate limit exceeded — please try again later, or view the release notes directly on GitHub.',
90
+ 'about.releaseNotes.fetchFailed': 'GitHub API request failed ({status} {statusText})',
91
+ 'about.snippet.plugin': '- Plugin version: {version}',
92
+ 'about.snippet.dsh': '- DSH version: {version}',
93
+ 'about.snippet.platform': '- Platform: {platform}',
94
+ 'about.snippet.pluginDir': '- Plugin directory: {dir}',
95
+ 'common.close': 'Close',
96
+ 'common.cancel': 'Cancel',
97
+ 'common.labelSeparator': ': ',
98
+ 'common.back': 'Back',
99
+ 'common.next': 'Next',
100
+ 'common.retry': 'Retry',
101
+ // Persist failure (sessionStorage quota / unavailable): state is in memory but a refresh loses it
102
+ 'common.saveFailed': 'Could not write browser storage: the current progress stays in this page only and is lost on refresh',
103
+ 'common.loading': 'Loading…',
104
+ 'common.unknownError': 'Unknown error',
105
+ 'common.parens': '({text})',
106
+ 'about.cli.help': 'List every CLI command and its usage (works offline)',
107
+ 'about.cli.snapshots': 'List local rollback snapshots (no running DSH needed)',
108
+ 'about.cli.restore': 'Restore to the pre-import state (offline)',
109
+ 'about.cli.reinstall': 'One-shot DSH reinstall (rescue)',
110
+ 'common.listSeparator': ', ',
111
+ 'toast.copied': 'Copied to clipboard',
112
+ 'toast.copyFailed': 'Copy failed — select the text and copy manually',
113
+ };