dsh-config-manager 0.4.1 → 0.4.3
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 +14 -0
- package/lib/cli/actions.js +2 -3
- package/lib/cli/import-source.js +2 -6
- package/lib/cli/index.js +2 -3
- package/lib/client.d.ts +5 -5
- package/lib/client.js +26250 -25872
- package/lib/core/access-mode.d.ts +25 -0
- package/lib/core/access-mode.js +28 -0
- package/lib/core/exporter.js +2 -4
- package/lib/core/host-schedulers/cache-cleanup.d.ts +41 -0
- package/lib/core/host-schedulers/cache-cleanup.js +45 -0
- package/lib/core/host-schedulers/lifecycle-hooks.d.ts +51 -0
- package/lib/core/host-schedulers/lifecycle-hooks.js +78 -0
- package/lib/core/host-schedulers/market-cache.d.ts +40 -0
- package/lib/core/host-schedulers/market-cache.js +92 -0
- package/lib/core/model-tools.js +2 -6
- package/lib/core/restore.d.ts +0 -2
- package/lib/core/restore.js +16 -18
- package/lib/core/verify-recovery.js +4 -7
- package/lib/index.d.ts +3 -22
- package/lib/index.js +74 -330
- package/lib/profiles/dsh-profile-manager.d.ts +23 -1
- package/lib/profiles/dsh-profile-manager.js +70 -2
- package/lib/routes/kit.d.ts +61 -1
- package/lib/routes/kit.js +72 -3
- package/lib/routes/prefs.js +6 -6
- package/lib/routes/recovery.js +25 -41
- package/lib/routes/request-trust.d.ts +28 -0
- package/lib/routes/request-trust.js +65 -0
- package/lib/routes/route-support.d.ts +23 -1
- package/lib/routes/route-support.js +185 -0
- package/lib/routes/snapshots.js +4 -11
- package/lib/routes/sync.js +5 -7
- package/lib/security/redaction.d.ts +5 -1
- package/lib/security/redaction.js +26 -23
- package/lib/sync/backup-scheduler.js +2 -6
- package/lib/ui/backup-inspect.d.ts +1 -1
- package/lib/ui/dsh-profiles-view.d.ts +0 -10
- package/lib/ui/dsh-profiles-view.js +3 -7
- package/lib/ui/snapshots-view.d.ts +0 -14
- package/lib/ui/snapshots-view.js +16 -2
- package/lib/utils/paths.d.ts +20 -4
- package/lib/utils/paths.js +22 -6
- package/lib/utils/time.d.ts +31 -0
- package/lib/utils/time.js +54 -0
- package/package.json +1 -1
- package/src/cli/actions.ts +2 -3
- package/src/cli/import-source.ts +2 -7
- package/src/cli/index.ts +2 -3
- package/src/client/about/AboutPanel.tsx +8 -1
- package/src/client/about/ReleaseBody.tsx +22 -52
- package/src/client/about/ReleaseNotesDialog.tsx +15 -69
- package/src/client/about/release-notes-view.ts +4 -11
- package/src/client/common/access-mode.ts +21 -0
- package/src/client/common/info-hint-guard.test.ts +11 -5
- package/src/client/common/ui.tsx +23 -0
- package/src/client/config-manager.module.css +201 -32
- package/src/client/css-token-guard.test.ts +135 -1
- package/src/client/home/HomePanel.tsx +31 -6
- package/src/client/import/ConflictList.tsx +3 -3
- package/src/client/import/ImportWizardView.tsx +1 -1
- package/src/client/library/ArtifactRow.tsx +2 -2
- package/src/client/library/RestorePlanView.tsx +21 -9
- package/src/client/library/report-dismiss.test.ts +5 -3
- package/src/client/locales/about.ts +103 -0
- package/src/client/locales/backup.ts +141 -0
- package/src/client/locales/common.ts +113 -0
- package/src/client/locales/export.ts +184 -0
- package/src/client/locales/foreign.ts +184 -0
- package/src/client/locales/import-compat.ts +32 -0
- package/src/client/locales/import.ts +192 -0
- package/src/client/locales/next-steps.ts +25 -0
- package/src/client/locales/overview-control.ts +32 -0
- package/src/client/locales/overview.ts +153 -0
- package/src/client/locales/profiles.ts +263 -0
- package/src/client/locales/report.ts +17 -0
- package/src/client/locales/restore.ts +132 -0
- package/src/client/locales/sessions.ts +257 -0
- package/src/client/locales/shell.ts +149 -0
- package/src/client/locales.ts +49 -1783
- package/src/client/market/MarketImportReview.tsx +2 -2
- package/src/client/market/MarketPanel.tsx +1 -1
- package/src/client/market/market-view.ts +3 -5
- package/src/client/recovery/RecoveryPanel.tsx +62 -1054
- package/src/client/recovery/SessionHealthCard.tsx +134 -0
- package/src/client/recovery/SessionHealthDialog.tsx +665 -0
- package/src/client/recovery/SessionLayoutSection.tsx +284 -0
- package/src/client/recovery/recovery-api.ts +10 -1
- package/src/client/recovery/recovery-panel-layout.test.ts +20 -5
- package/src/client/recovery/session-dialog-mount.test.ts +16 -9
- package/src/client/recovery/use-recovery-write.test.ts +90 -0
- package/src/client/recovery/use-recovery-write.ts +53 -0
- package/src/client/run-store.ts +57 -2
- package/src/client/sync/PushPreviewCard.tsx +2 -2
- package/src/client/sync/SyncConfirmView.tsx +5 -5
- package/src/client/sync/SyncLogList.tsx +2 -2
- package/src/client/sync/history-model.ts +4 -5
- package/src/client/sync/sync-view.ts +3 -4
- package/src/core/access-mode.ts +37 -0
- package/src/core/exporter.ts +2 -4
- package/src/core/host-schedulers/cache-cleanup.test.ts +84 -0
- package/src/core/host-schedulers/cache-cleanup.ts +74 -0
- package/src/core/host-schedulers/lifecycle-hooks.test.ts +111 -0
- package/src/core/host-schedulers/lifecycle-hooks.ts +118 -0
- package/src/core/host-schedulers/market-cache.test.ts +93 -0
- package/src/core/host-schedulers/market-cache.ts +116 -0
- package/src/core/model-tools.ts +2 -7
- package/src/core/restore-failure-state.test.ts +210 -0
- package/src/core/restore.ts +16 -18
- package/src/core/verify-recovery.ts +4 -7
- package/src/index.ts +81 -335
- package/src/profiles/dsh-profile-copy-rollback.test.ts +156 -0
- package/src/profiles/dsh-profile-manager.ts +71 -3
- package/src/routes/kit.ts +106 -3
- package/src/routes/prefs.ts +6 -6
- package/src/routes/recovery.ts +25 -42
- package/src/routes/request-trust.ts +97 -0
- package/src/routes/route-support.ts +208 -1
- package/src/routes/snapshots.ts +4 -9
- package/src/routes/sync.ts +4 -7
- package/src/security/redaction.ts +29 -23
- package/src/sync/backup-scheduler.ts +3 -6
- package/src/sync/sync-config.test.ts +24 -13
- package/src/ui/backup-inspect.ts +1 -1
- package/src/ui/dsh-profiles-view.ts +3 -5
- package/src/ui/i18n.test.ts +8 -3
- package/src/ui/snapshots-view.ts +2 -2
- package/src/utils/paths.test.ts +36 -1
- package/src/utils/paths.ts +30 -6
- package/src/utils/time.test.ts +46 -0
- package/src/utils/time.ts +55 -0
|
@@ -230,6 +230,13 @@ body {
|
|
|
230
230
|
font-variant-numeric: tabular-nums;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
/* 同步日志的时间列:等宽 + 最小档字号 + 单行(此前两个组件各写一次内联 fontSize: '11px')。
|
|
234
|
+
单行的理由:表格列宽固定,时间是行内锚点,折行会把它从「一列」变成两行噪声。 */
|
|
235
|
+
.syncLogTime {
|
|
236
|
+
font-size: var(--cm-fs-meta);
|
|
237
|
+
white-space: nowrap;
|
|
238
|
+
}
|
|
239
|
+
|
|
233
240
|
/* Lucide 图标统一行为:继承文字色(跟随 --dsw-* token / data-danger / hover),
|
|
234
241
|
在 flex 容器(按钮/行)内不收缩、垂直居中,描边与正文视觉重量匹配。 */
|
|
235
242
|
.section svg {
|
|
@@ -1574,6 +1581,26 @@ body {
|
|
|
1574
1581
|
align-items: center;
|
|
1575
1582
|
}
|
|
1576
1583
|
|
|
1584
|
+
/* —— 中性分类片(Chip,tech-debt #10 / 2026-11) ——
|
|
1585
|
+
职责划分:**Badge = 状态语义**(四态只由 src/ui/badge-tone.ts 的 BadgeKind 定义);
|
|
1586
|
+
**Chip = 中性分类**(来源 / 形态 / 适配器 / 分区数 —— 没有轻重缓急,也不该有颜色)。
|
|
1587
|
+
此前这条是第二套徽章 .kindTag(16px / r-1 / weight 600),与 .badge(19px / pill / 500)
|
|
1588
|
+
并存 ⇒ 同屏两套「小片子」,用户读不出差别。现在两者盒模型逐字对齐,只有色调与职责不同:
|
|
1589
|
+
分类片用中性灰底 + 次级文字色,状态片用四态 color-mix 淡底(见上方 .badge[data-kind])。 */
|
|
1590
|
+
.chip {
|
|
1591
|
+
display: inline-flex;
|
|
1592
|
+
align-items: center;
|
|
1593
|
+
height: 19px;
|
|
1594
|
+
padding: 0 8px;
|
|
1595
|
+
border-radius: var(--cm-r-pill);
|
|
1596
|
+
background: var(--cm-hover);
|
|
1597
|
+
font-size: var(--cm-fs-meta);
|
|
1598
|
+
font-weight: 500;
|
|
1599
|
+
line-height: 1.25;
|
|
1600
|
+
color: var(--cm-text-2);
|
|
1601
|
+
white-space: nowrap;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1577
1604
|
/* —— 横幅(四态;紧凑) —— */
|
|
1578
1605
|
.banner {
|
|
1579
1606
|
animation: itemEnter var(--cm-motion-base) var(--cm-motion-ease-out);
|
|
@@ -3008,6 +3035,12 @@ body {
|
|
|
3008
3035
|
margin: 0 0 10px;
|
|
3009
3036
|
}
|
|
3010
3037
|
|
|
3038
|
+
/* 紧跟说明/错误条的动作行:上边补 8px,否则按钮贴着 Banner 下沿。
|
|
3039
|
+
必须定义在 .actionRow 之后:两者同为单类选择器,靠顺序取胜(margin 简写会覆盖 margin-top)。 */
|
|
3040
|
+
.actionRowSpaced {
|
|
3041
|
+
margin-top: var(--cm-sp-4);
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3011
3044
|
/* 平分整行的动作行(2026-11-01 同步页):两个方向按钮各占一半,右边缘与卡内其余行齐平 ——
|
|
3012
3045
|
宽度各随文案时,三个按钮排一行会形成左对齐锯齿,且窄的那个看起来更次要(显得随意)。
|
|
3013
3046
|
主次靠 primary 底色表达,不靠宽度。 */
|
|
@@ -4892,38 +4925,9 @@ body {
|
|
|
4892
4925
|
margin-bottom: 10px;
|
|
4893
4926
|
}
|
|
4894
4927
|
|
|
4895
|
-
.kindTag
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
height: 16px;
|
|
4899
|
-
padding: 0 6px;
|
|
4900
|
-
border-radius: var(--cm-r-1);
|
|
4901
|
-
background: var(--dsw-alias-interactive-bg-hover);
|
|
4902
|
-
font-size: var(--cm-fs-meta);
|
|
4903
|
-
font-weight: 600;
|
|
4904
|
-
color: var(--dsw-alias-label-secondary);
|
|
4905
|
-
white-space: nowrap;
|
|
4906
|
-
}
|
|
4907
|
-
|
|
4908
|
-
.kindTagOk {
|
|
4909
|
-
background: color-mix(in srgb, var(--cm-ok) 13%, transparent);
|
|
4910
|
-
color: var(--cm-ok);
|
|
4911
|
-
}
|
|
4912
|
-
|
|
4913
|
-
.kindTagInfo {
|
|
4914
|
-
background: color-mix(in srgb, var(--cm-accent) 13%, transparent);
|
|
4915
|
-
color: var(--cm-accent);
|
|
4916
|
-
}
|
|
4917
|
-
|
|
4918
|
-
.kindTagWarn {
|
|
4919
|
-
background: color-mix(in srgb, var(--cm-warn) 13%, transparent);
|
|
4920
|
-
color: var(--cm-warn);
|
|
4921
|
-
}
|
|
4922
|
-
|
|
4923
|
-
.kindTagError {
|
|
4924
|
-
background: color-mix(in srgb, var(--cm-error) 13%, transparent);
|
|
4925
|
-
color: var(--cm-error);
|
|
4926
|
-
}
|
|
4928
|
+
/* 注:此处原有第二套徽章 .kindTag / .kindTagOk/Info/Warn/Error(2026-11 删除,tech-debt #10)。
|
|
4929
|
+
四态语义现在只有 .badge[data-kind] 一套(由 src/ui/badge-tone.ts 派生),
|
|
4930
|
+
中性分类改用 .chip —— 见 §3 徽章段。 */
|
|
4927
4931
|
|
|
4928
4932
|
/* —— git 风格恢复预览:分组行 + 左右双栏逐行对照(2026-09) ——
|
|
4929
4933
|
颜色一律走 --dsw-* token + color-mix(绿=success / 红=error 的 12% 淡底),零硬编码。 */
|
|
@@ -5260,6 +5264,30 @@ body {
|
|
|
5260
5264
|
margin-bottom: 10px;
|
|
5261
5265
|
}
|
|
5262
5266
|
|
|
5267
|
+
/* 竖排变体(关于页统计位:大数字一行、说明一行)。间距取 4 档而非行的 8 档:
|
|
5268
|
+
这里是「同一条事实数字 + 它的注脚」,不是彼此独立的徽章。 */
|
|
5269
|
+
.statRowStack {
|
|
5270
|
+
flex-direction: column;
|
|
5271
|
+
align-items: flex-start;
|
|
5272
|
+
flex-wrap: nowrap;
|
|
5273
|
+
gap: var(--cm-sp-2);
|
|
5274
|
+
}
|
|
5275
|
+
|
|
5276
|
+
/* 折行变体(导入页来源徽章行:条目数不定,窄栏里必须折行而不是溢出卡片)。
|
|
5277
|
+
间距取 8px —— 折行后的行距同样必须在 9 档里。 */
|
|
5278
|
+
.statRowWrap {
|
|
5279
|
+
flex-wrap: wrap;
|
|
5280
|
+
gap: var(--cm-sp-4);
|
|
5281
|
+
}
|
|
5282
|
+
|
|
5283
|
+
/* 块级纵向堆叠:一屏里的若干独立块(Banner / 徽章行 / 动作行)之间的统一节奏。
|
|
5284
|
+
与 .statRowStack 的分工:那是「同一条事实的多个字段」(4px),这里是彼此独立的块(12px)。 */
|
|
5285
|
+
.blockStack {
|
|
5286
|
+
display: flex;
|
|
5287
|
+
flex-direction: column;
|
|
5288
|
+
gap: var(--cm-sp-6);
|
|
5289
|
+
}
|
|
5290
|
+
|
|
5263
5291
|
/* 咨询卡内的徽章行:与上方小节标题拉开一点距离(原先与标题贴在一起) */
|
|
5264
5292
|
.consultSection {
|
|
5265
5293
|
margin-top: 10px;
|
|
@@ -5490,6 +5518,147 @@ button.profileRowMain:hover {
|
|
|
5490
5518
|
border-radius: var(--cm-r-1);
|
|
5491
5519
|
}
|
|
5492
5520
|
|
|
5521
|
+
/* —— 更新日志(ReleaseBody 结构化 Markdown 块 / ReleaseNotesDialog 卡片流) ——
|
|
5522
|
+
2026-11(tech-debt #11):此前这些样式全写在组件的 style={{…}} 里(11 处裸 var(--dsw-*) +
|
|
5523
|
+
一排字面量 px),CSS 侧的 token/scale 守卫完全看不见。现在逐条迁到类,
|
|
5524
|
+
颜色只走 --cm-text-* / --cm-line-*,字号只走 --cm-fs-*,间距只取 9 档。 */
|
|
5525
|
+
.releaseBody {
|
|
5526
|
+
display: flex;
|
|
5527
|
+
flex-direction: column;
|
|
5528
|
+
gap: var(--cm-sp-3);
|
|
5529
|
+
font-size: var(--cm-fs-title);
|
|
5530
|
+
line-height: 1.5;
|
|
5531
|
+
color: var(--cm-text-1);
|
|
5532
|
+
}
|
|
5533
|
+
|
|
5534
|
+
/* 标题层级:块级 Markdown 的 h1/h2/h3 —— 只有边距与一级标题的字号差,
|
|
5535
|
+
其余层级共用一条规则(三级标题层级再细分就是给 changelog 做排版了,不值得)。 */
|
|
5536
|
+
.releaseHeading {
|
|
5537
|
+
margin-top: var(--cm-sp-4);
|
|
5538
|
+
margin-bottom: var(--cm-sp-2);
|
|
5539
|
+
font-weight: 600;
|
|
5540
|
+
color: var(--cm-text-1);
|
|
5541
|
+
}
|
|
5542
|
+
|
|
5543
|
+
.releaseHeading[data-level='1'] {
|
|
5544
|
+
margin-top: var(--cm-sp-6);
|
|
5545
|
+
}
|
|
5546
|
+
|
|
5547
|
+
/* 列表项:项目符号列 + 正文列(flex,符号不参与折行) */
|
|
5548
|
+
.releaseListItem {
|
|
5549
|
+
display: flex;
|
|
5550
|
+
align-items: flex-start;
|
|
5551
|
+
gap: var(--cm-sp-3);
|
|
5552
|
+
padding-left: var(--cm-sp-2);
|
|
5553
|
+
}
|
|
5554
|
+
|
|
5555
|
+
.releaseBullet {
|
|
5556
|
+
color: var(--cm-text-3);
|
|
5557
|
+
user-select: none;
|
|
5558
|
+
}
|
|
5559
|
+
|
|
5560
|
+
.releaseItemBody {
|
|
5561
|
+
flex: 1;
|
|
5562
|
+
}
|
|
5563
|
+
|
|
5564
|
+
/* 引用块:左侧 3px 竖线(发丝线用 3px 是为了在淡色下仍可辨,--cm-line-1 已是最浅档) */
|
|
5565
|
+
.releaseQuote {
|
|
5566
|
+
border-left: 3px solid var(--cm-line-1);
|
|
5567
|
+
padding-left: var(--cm-sp-4);
|
|
5568
|
+
color: var(--cm-text-2);
|
|
5569
|
+
font-style: italic;
|
|
5570
|
+
}
|
|
5571
|
+
|
|
5572
|
+
/* 代码块:复用 .cliCommand(等宽 + 折行),这里只补块级留白与表格档字号 */
|
|
5573
|
+
.releaseCode {
|
|
5574
|
+
margin: var(--cm-sp-2) 0;
|
|
5575
|
+
padding: var(--cm-sp-4);
|
|
5576
|
+
font-size: var(--cm-fs-table);
|
|
5577
|
+
}
|
|
5578
|
+
|
|
5579
|
+
/* 分隔线:Markdown 的 --- 是「段落级断点」,不承担信息 */
|
|
5580
|
+
.releaseRule {
|
|
5581
|
+
margin: var(--cm-sp-4) 0;
|
|
5582
|
+
border-bottom: 1px solid var(--cm-line-2);
|
|
5583
|
+
}
|
|
5584
|
+
|
|
5585
|
+
.releaseEmpty {
|
|
5586
|
+
color: var(--cm-text-3);
|
|
5587
|
+
font-style: italic;
|
|
5588
|
+
}
|
|
5589
|
+
|
|
5590
|
+
/* 版本卡片流(ReleaseNotesDialog):卡片 = 表面 + 描边 + 12px 内距 */
|
|
5591
|
+
.releaseCard {
|
|
5592
|
+
display: flex;
|
|
5593
|
+
flex-direction: column;
|
|
5594
|
+
gap: var(--cm-sp-4);
|
|
5595
|
+
padding: var(--cm-sp-6);
|
|
5596
|
+
background: var(--cm-surface-1);
|
|
5597
|
+
border: 1px solid var(--cm-line-1);
|
|
5598
|
+
border-radius: var(--cm-r-2);
|
|
5599
|
+
}
|
|
5600
|
+
|
|
5601
|
+
.releaseCardHead {
|
|
5602
|
+
display: flex;
|
|
5603
|
+
align-items: flex-start;
|
|
5604
|
+
justify-content: space-between;
|
|
5605
|
+
gap: var(--cm-sp-4);
|
|
5606
|
+
flex-wrap: wrap;
|
|
5607
|
+
}
|
|
5608
|
+
|
|
5609
|
+
.releaseTitleRow {
|
|
5610
|
+
display: flex;
|
|
5611
|
+
align-items: center;
|
|
5612
|
+
gap: var(--cm-sp-4);
|
|
5613
|
+
flex-wrap: wrap;
|
|
5614
|
+
}
|
|
5615
|
+
|
|
5616
|
+
.releaseTitle {
|
|
5617
|
+
font-size: var(--cm-fs-title);
|
|
5618
|
+
font-weight: 600;
|
|
5619
|
+
color: var(--cm-text-1);
|
|
5620
|
+
}
|
|
5621
|
+
|
|
5622
|
+
.releaseDate {
|
|
5623
|
+
font-size: var(--cm-fs-table);
|
|
5624
|
+
color: var(--cm-text-3);
|
|
5625
|
+
}
|
|
5626
|
+
|
|
5627
|
+
.releaseNotesEmpty {
|
|
5628
|
+
padding: var(--cm-sp-9) 0;
|
|
5629
|
+
text-align: center;
|
|
5630
|
+
color: var(--cm-text-2);
|
|
5631
|
+
}
|
|
5632
|
+
|
|
5633
|
+
.releaseNotesLoadingMore {
|
|
5634
|
+
display: flex;
|
|
5635
|
+
justify-content: center;
|
|
5636
|
+
padding: var(--cm-sp-6) 0;
|
|
5637
|
+
}
|
|
5638
|
+
|
|
5639
|
+
.releaseNotesAllLoaded {
|
|
5640
|
+
padding: var(--cm-sp-4) 0;
|
|
5641
|
+
text-align: center;
|
|
5642
|
+
font-size: var(--cm-fs-table);
|
|
5643
|
+
color: var(--cm-text-3);
|
|
5644
|
+
}
|
|
5645
|
+
|
|
5646
|
+
/* 底部操作条:沿用 .actionRow,只补与正文区的分隔与内距 */
|
|
5647
|
+
.releaseNotesFoot {
|
|
5648
|
+
justify-content: space-between;
|
|
5649
|
+
align-items: center;
|
|
5650
|
+
flex-wrap: wrap;
|
|
5651
|
+
gap: var(--cm-sp-4);
|
|
5652
|
+
border-top: 1px solid var(--cm-line-1);
|
|
5653
|
+
padding: var(--cm-sp-5) var(--cm-sp-8) var(--cm-sp-7);
|
|
5654
|
+
}
|
|
5655
|
+
|
|
5656
|
+
.releaseNotesFootActions {
|
|
5657
|
+
display: flex;
|
|
5658
|
+
align-items: center;
|
|
5659
|
+
gap: var(--cm-sp-4);
|
|
5660
|
+
}
|
|
5661
|
+
|
|
5493
5662
|
.consultDimension {
|
|
5494
5663
|
padding: 6px 0;
|
|
5495
5664
|
border-bottom: 0.5px solid var(--dsw-alias-border-l2);
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 规则:四态与主色**只能**在 \`--cm-*\` 定义行里引用 \`--dsw-*\`;组件规则一律消费 \`--cm-*\`。
|
|
5
5
|
* 为什么需要它:v2 里 140 处 \`--dsw-alias-state-*\` / \`--dsw-alias-button-info-*\` 直接散落在
|
|
6
|
-
* 4957 行样式里,四态语义各写各的(Badge / Banner / StatusDot /
|
|
6
|
+
* 4957 行样式里,四态语义各写各的(Badge / Banner / StatusDot / 第二套徽章 / choiceCard 五份实现)——
|
|
7
7
|
* 改一次语义要扫全文件。中间层建立后必须有人守着它不被绕过。
|
|
8
8
|
*
|
|
9
9
|
* 结构类 token(label / border / bg / hover / input / font)**不受约束**:它们语义稳定、直用更短。
|
|
10
|
+
*
|
|
11
|
+
* 2026-11(tech-debt #11):覆盖面从 `*.module.css` 扩到 **TSX 内联样式** —— 此前把样式写进
|
|
12
|
+
* `style={{ … }}` 就绕开了全部守卫(裸 `var(--dsw-*)`、越界字号、硬编码间距都写在 TSX 里)。
|
|
13
|
+
* 现由 tsx-01 扫 src/client 下全部 TSX;豁免表 `TSX_STYLE_WHITELIST` 逐条登记「哪个文件、哪条规则、
|
|
14
|
+
* 还剩几处、为什么留下」—— 数量只许减不许增,清干净后条目必须一起删(tsx-02 反向自检抓死条目)。
|
|
10
15
|
*/
|
|
11
16
|
import test from 'node:test'
|
|
12
17
|
import assert from 'node:assert/strict'
|
|
@@ -86,3 +91,132 @@ test('token-05 反自检:定义行之外的裸用必须被抓到', () => {
|
|
|
86
91
|
const hit = mutated.split('\n').some((line) => line.includes('--dsw-alias-state-error-primary') && !DEF_LINE.test(line))
|
|
87
92
|
assert.ok(hit, '注入的裸用必须被 token-01 的判据命中')
|
|
88
93
|
})
|
|
94
|
+
|
|
95
|
+
/* ================================================================
|
|
96
|
+
* TSX 内联样式扫描(tech-debt #11)
|
|
97
|
+
*
|
|
98
|
+
* 为什么必须扫 TSX:本文件的 token-01/02 与 css-scale-guard 的 scale-01/05 都只读
|
|
99
|
+
* `config-manager.module.css` —— 把同一条违规写进 React 的 `style={{ … }}` 就完全看不见。
|
|
100
|
+
* 真机后果不比 CSS 里轻:`var(--dsw-alias-state-warn-primary)` 直接把四态语义钉进组件,
|
|
101
|
+
* 换主题/改语义时 CSS 侧已收敛、TSX 侧照旧。
|
|
102
|
+
*
|
|
103
|
+
* 只认「可判定」的四类形状,不试图解析 JSX:
|
|
104
|
+
* ① `var(--dsw-…)` —— 组件层必须消费 `--cm-*`(结构色走定义行)
|
|
105
|
+
* ② `fontSize: '<n>px'` —— 字号只有 4 档(DESIGN.md §4)
|
|
106
|
+
* ③ `color/background: '#…'/rgb(…)` —— 零硬编码颜色(DESIGN.md §3)
|
|
107
|
+
* ④ `padding/margin/gap: '…px'` —— 间距只有 9 档(DESIGN.md §5)
|
|
108
|
+
* ================================================================ */
|
|
109
|
+
|
|
110
|
+
const CLIENT_DIR = path.join(ROOT, 'src/client')
|
|
111
|
+
|
|
112
|
+
/** 递归收集 src/client 下全部 TSX,跳过 `*.test.tsx`(测试夹具里允许写字面量)。 */
|
|
113
|
+
function collectTsx(dir: string, out: string[] = []): string[] {
|
|
114
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
115
|
+
const full = path.join(dir, entry.name)
|
|
116
|
+
if (entry.isDirectory()) collectTsx(full, out)
|
|
117
|
+
else if (entry.name.endsWith('.tsx') && !entry.name.endsWith('.test.tsx')) out.push(full)
|
|
118
|
+
}
|
|
119
|
+
return out
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 去掉注释但保留行结构(替换为等长空白)。
|
|
124
|
+
* 理由:注释里常**引用**违规写法当反例(「不要写 `gap: '5px'`」),那是文档不是代码。
|
|
125
|
+
*/
|
|
126
|
+
function stripTsComments(src: string): string {
|
|
127
|
+
return src
|
|
128
|
+
.replace(/\/\*[\s\S]*?\*\//g, (m) => m.replace(/[^\n]/g, ' '))
|
|
129
|
+
// `//` 前一个字符是冒号时是 URL(https://、file://),不当作注释
|
|
130
|
+
.replace(/(^|[^:])\/\/[^\n]*/g, (m, p1: string) => p1 + ' '.repeat(m.length - p1.length))
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface TsxRule { id: string; why: string; re: RegExp }
|
|
134
|
+
|
|
135
|
+
const TSX_RULES: TsxRule[] = [
|
|
136
|
+
{ id: 'dsw-var', why: '组件层直接引用 --dsw-* token(应消费 --cm-*)', re: /var\(\s*--dsw-/g },
|
|
137
|
+
// 到「同一 style 条目」为止(不在逗号处越界),这样三元/拼接里的 px 也算:
|
|
138
|
+
// fontSize: lv === 1 ? '15px' : '13px' 是字面量,不能因为没紧跟引号就漏掉。
|
|
139
|
+
{ id: 'font-px', why: 'fontSize 字面量 px(字号只有 4 档,走 var(--cm-fs-*))', re: /fontSize\s*:[^,}\n]*?\d(?:\.\d+)?px/g },
|
|
140
|
+
{ id: 'color-literal', why: '硬编码颜色(#hex / rgb())', re: /(?:color|background(?:Color)?)\s*:\s*['"`]\s*(?:#[0-9a-fA-F]{3,8}\b|rgba?\()/g },
|
|
141
|
+
{ id: 'space-px', why: 'padding/margin/gap 字面量 px(间距只有 9 档)', re: /(?:padding|margin|gap)(?:Top|Right|Bottom|Left|Inline|InlineStart|InlineEnd|Block|BlockStart|BlockEnd)?\s*:\s*['"`][^'"`]*\d(?:\.\d+)?px/g },
|
|
142
|
+
]
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 豁免表:每条 = 「这个文件的这条规则还剩几处、为什么留下」。
|
|
146
|
+
*
|
|
147
|
+
* 判据(照抄 css-scale-guard 的 SPACING_EXEMPT 惯例):`max` 是**上限**,只许减不许增;
|
|
148
|
+
* 一处都不剩时条目必须删除(tsx-02 抓死条目)。
|
|
149
|
+
*/
|
|
150
|
+
const TSX_STYLE_WHITELIST: { file: string; rule: string; max: number; why: string }[] = [
|
|
151
|
+
{
|
|
152
|
+
file: 'src/client/about/ReleaseBody.tsx',
|
|
153
|
+
rule: 'font-px',
|
|
154
|
+
max: 1,
|
|
155
|
+
why: 'Markdown 标题三级要 15/14/13px 区分;14/15px 不在 DESIGN.md §4 四档内,写进 CSS 会让 scale-01 直接变红。',
|
|
156
|
+
},
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
interface TsxHit { file: string; rule: string; line: number; text: string }
|
|
160
|
+
|
|
161
|
+
const TSX_FILES = collectTsx(CLIENT_DIR)
|
|
162
|
+
const TSX_HITS: TsxHit[] = []
|
|
163
|
+
for (const full of TSX_FILES) {
|
|
164
|
+
const rel = path.relative(ROOT, full).split(path.sep).join('/')
|
|
165
|
+
const lines = stripTsComments(fs.readFileSync(full, 'utf8')).split('\n')
|
|
166
|
+
lines.forEach((line, i) => {
|
|
167
|
+
for (const rule of TSX_RULES) {
|
|
168
|
+
rule.re.lastIndex = 0
|
|
169
|
+
if (rule.re.test(line)) TSX_HITS.push({ file: rel, rule: rule.id, line: i + 1, text: line.trim().slice(0, 100) })
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
test('tsx-01 TSX 内联样式不得绕过 token 层与 scale(var(--dsw-) / 字号·颜色·间距字面量)', () => {
|
|
175
|
+
const violations: string[] = []
|
|
176
|
+
for (const hit of TSX_HITS) {
|
|
177
|
+
const allow = TSX_STYLE_WHITELIST.find((a) => a.file === hit.file && a.rule === hit.rule)
|
|
178
|
+
if (allow === undefined) {
|
|
179
|
+
const rule = TSX_RULES.find((r) => r.id === hit.rule)
|
|
180
|
+
violations.push(hit.file + ':' + String(hit.line) + ' [' + hit.rule + '] ' + (rule?.why ?? '') + ' — ' + hit.text)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
assert.deepEqual(violations, [], '这些内联样式必须迁进 config-manager.module.css(或复用已有类):\n' + violations.join('\n'))
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
test('tsx-02 豁免表的每一条都必须仍然命中(删干净后条目要一起删)', () => {
|
|
187
|
+
const counts = new Map<string, number>()
|
|
188
|
+
for (const hit of TSX_HITS) {
|
|
189
|
+
const key = hit.file + '|' + hit.rule
|
|
190
|
+
counts.set(key, (counts.get(key) ?? 0) + 1)
|
|
191
|
+
}
|
|
192
|
+
const dead: string[] = []
|
|
193
|
+
const grown: string[] = []
|
|
194
|
+
for (const allow of TSX_STYLE_WHITELIST) {
|
|
195
|
+
const n = counts.get(allow.file + '|' + allow.rule) ?? 0
|
|
196
|
+
if (n === 0) dead.push(allow.file + ' [' + allow.rule + ']')
|
|
197
|
+
else if (n > allow.max) grown.push(allow.file + ' [' + allow.rule + '] 现有 ' + String(n) + ' 处 > 登记上限 ' + String(allow.max))
|
|
198
|
+
}
|
|
199
|
+
assert.deepEqual(dead, [], '这些豁免已经没有对应违规(已迁干净 ⇒ 请删除条目):' + JSON.stringify(dead))
|
|
200
|
+
assert.deepEqual(grown, [], '豁免数量增长(新写的内联样式必须迁走):' + JSON.stringify(grown))
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
test('tsx-03 反自检:四类形状必须真的被抓到(防止正则失效后永远绿灯)', () => {
|
|
204
|
+
const sample = [
|
|
205
|
+
'<li style={{ color: warn ? \'var(--dsw-alias-state-warn-primary)\' : undefined }} />',
|
|
206
|
+
"<span style={{ fontSize: '11px' }} />",
|
|
207
|
+
"<div style={{ color: '#ff0000', background: 'rgb(1,2,3)' }} />",
|
|
208
|
+
"<div style={{ padding: '4px', marginTop: '8px', gap: '6px' }} />",
|
|
209
|
+
].join('\n')
|
|
210
|
+
const caught = new Set<string>()
|
|
211
|
+
for (const rule of TSX_RULES) {
|
|
212
|
+
rule.re.lastIndex = 0
|
|
213
|
+
if (rule.re.test(sample)) caught.add(rule.id)
|
|
214
|
+
}
|
|
215
|
+
assert.deepEqual(TSX_RULES.map((r) => r.id).filter((id) => !caught.has(id)), [], '注入的违规形状必须被对应规则命中')
|
|
216
|
+
// 注释里的示例不是违规(否则没人敢在注释里写反例)
|
|
217
|
+
const commented = stripTsComments("// 反例:style={{ gap: '5px' }}\nconst x = 1")
|
|
218
|
+
for (const rule of TSX_RULES) {
|
|
219
|
+
rule.re.lastIndex = 0
|
|
220
|
+
assert.equal(rule.re.test(commented), false, '注释内容不得被扫描(会逼人删掉注释里的反例)')
|
|
221
|
+
}
|
|
222
|
+
})
|
|
@@ -37,6 +37,7 @@ import { redact } from '../../security/redaction.ts'
|
|
|
37
37
|
import { runStore } from '../run-store.ts'
|
|
38
38
|
import type { ArtifactKind } from '../../ui/artifact-view.ts'
|
|
39
39
|
import { toast } from '../common/toast-store.ts'
|
|
40
|
+
import { isAccessModeError } from '../common/access-mode.ts'
|
|
40
41
|
import { toRecoveryView } from '../recovery/recovery-view.ts'
|
|
41
42
|
import {
|
|
42
43
|
buildOverviewMetrics,
|
|
@@ -61,6 +62,12 @@ const HOME_SYNC_TIMEOUT_MS = 30_000
|
|
|
61
62
|
* 服务端按文件名尾部只读最近 N 个文件 —— 不再把 2360 条历史全量读出来返给首屏。 */
|
|
62
63
|
const HOME_ACTIVITY_LIMIT = 100
|
|
63
64
|
|
|
65
|
+
/** 当前页面的来源地址(issue #126):访问方式被拒时必须让用户看到「你是从哪个地址打开的」。
|
|
66
|
+
* 非浏览器环境(SSR / 单测)没有 location,退回 'unknown' 而不是空串 —— 文案是拼句。 */
|
|
67
|
+
function pageOrigin(): string {
|
|
68
|
+
return typeof location === 'undefined' ? 'unknown' : location.origin
|
|
69
|
+
}
|
|
70
|
+
|
|
64
71
|
/** issue #43:立即备份跳过原因 → 文案键(文案统一走 locale 字典;未知 token 走 other)。 */
|
|
65
72
|
const BACKUP_SKIP_KEY: Record<BackupSkipReason, ConfigManagerKey> = {
|
|
66
73
|
disabled: 'overview.quick.backupSkippedDisabled',
|
|
@@ -161,7 +168,10 @@ export function HomePanel({ api, syncApi, historyApi, t, syncT, openForeignImpor
|
|
|
161
168
|
* 为什么必须有它:此前 allSettled 把失败一律吞成 null,而健康判定对 null 不降级 ——
|
|
162
169
|
* 宿主接口整体不可达时,用户看到的是绿色「配置健康」+「暂无操作记录」,
|
|
163
170
|
* 读起来像「一切正常只是没操作过」,真实原因与重试入口都不可见。 */
|
|
164
|
-
|
|
171
|
+
/** accessMode:这轮失败里**至少一条**是「当前访问方式不受支持」(issue #126)——
|
|
172
|
+
* 围栏对全部路由同一口径,一条被访问面拒绝就说明整页都在围栏外;其余失败(超时/连带 500)
|
|
173
|
+
* 只是连带现象,此时横幅必须换成解释 + 下一步,绝不能再给一个点了也没用的「重试」。 */
|
|
174
|
+
const [loadError, setLoadError] = useState<{ count: number; message: string; accessMode: boolean } | null>(null)
|
|
165
175
|
const [backupRunning, setBackupRunning] = useState(false)
|
|
166
176
|
/** 卸载后不再 setState(异步回调竞态防护) */
|
|
167
177
|
const aliveRef = useRef(true)
|
|
@@ -175,6 +185,7 @@ export function HomePanel({ api, syncApi, historyApi, t, syncT, openForeignImpor
|
|
|
175
185
|
setLoadError(list.length === 0 ? null : {
|
|
176
186
|
count: list.length,
|
|
177
187
|
message: first instanceof Error ? first.message : String(first),
|
|
188
|
+
accessMode: list.some(isAccessModeError),
|
|
178
189
|
})
|
|
179
190
|
}, [])
|
|
180
191
|
|
|
@@ -389,11 +400,25 @@ export function HomePanel({ api, syncApi, historyApi, t, syncT, openForeignImpor
|
|
|
389
400
|
{/* 0. 读取失败横幅:必须排在状态条之前 —— 数据没拿到时,绿色健康点是假的。
|
|
390
401
|
重试复用同一条 load()(不新增刷新路径)。 */}
|
|
391
402
|
{loadError !== null && (
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
403
|
+
loadError.accessMode
|
|
404
|
+
/* issue #126:访问方式问题不是读取失败 —— 说清「为什么」与「怎么改」,且不给重试
|
|
405
|
+
(同一个地址重试必然再被拒;换隧道或换 --host 启动都要整页重开)。 */
|
|
406
|
+
? (
|
|
407
|
+
<Banner kind="warn">
|
|
408
|
+
{t('overview.accessMode.title')}
|
|
409
|
+
{' '}
|
|
410
|
+
{t('overview.accessMode.origin', { origin: pageOrigin() })}
|
|
411
|
+
{' '}
|
|
412
|
+
{t('overview.accessMode.hint')}
|
|
413
|
+
</Banner>
|
|
414
|
+
)
|
|
415
|
+
: (
|
|
416
|
+
<Banner kind="error">
|
|
417
|
+
{t('overview.loadFailed', { count: String(loadError.count), message: redact(loadError.message) })}
|
|
418
|
+
{' '}
|
|
419
|
+
<Button size="sm" loading={loading} onClick={() => { void load() }}>{t('common.retry')}</Button>
|
|
420
|
+
</Banner>
|
|
421
|
+
)
|
|
397
422
|
)}
|
|
398
423
|
{/* 1. 状态条:健康点 + 指标段(可点击,名词在前) */}
|
|
399
424
|
<div className={css.statStrip} data-tone={health.kind === 'ok' ? undefined : health.kind}>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Workbench Rebuild(2026-09):
|
|
5
5
|
* - 每个冲突渲染为「选边卡片」:保留当前 / 使用备份 两个并排可点选块,
|
|
6
6
|
* 选中侧高亮描边 + 淡底(radio 语义保留:label 包裹原生 input,键盘可操作);
|
|
7
|
-
* -
|
|
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
|
-
<
|
|
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
|
|
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
|
-
<
|
|
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
|
-
/**
|
|
57
|
-
function
|
|
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
|
|
60
|
-
case 'added': return
|
|
61
|
-
case 'deleted': return
|
|
71
|
+
case 'modified': return 'info'
|
|
72
|
+
case 'added': return 'ok'
|
|
73
|
+
case 'deleted': return 'error'
|
|
62
74
|
case 'plugin':
|
|
63
|
-
case 'hint': return
|
|
64
|
-
default: return
|
|
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
|
-
<
|
|
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
|
-
|
|
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
|
|
65
|
-
|
|
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
|
|