dsh-plugin 1.6.11 → 2.0.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.
Files changed (128) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/client/client.js +705 -803
  4. package/client/client.js.map +1 -1
  5. package/lib/http/catalog.js +2 -3
  6. package/lib/http/diagnostics.js +6 -7
  7. package/lib/http/install.js +47 -213
  8. package/lib/http/logs.js +1 -2
  9. package/lib/http/npm-release-age.js +42 -0
  10. package/lib/http/routes.js +8 -7
  11. package/lib/http/settings.js +2 -2
  12. package/lib/http/shared.js +2 -2
  13. package/lib/http/task.js +1 -2
  14. package/lib/index.js +5 -6
  15. package/lib/services/install/install-types.js +4 -4
  16. package/lib/services/install/install.js +1 -1
  17. package/lib/services/install/npm-check.js +3 -2
  18. package/lib/services/install/npm-resolve.js +9 -96
  19. package/lib/services/install/package-entry.js +6 -11
  20. package/lib/services/install/registry-check.js +5 -16
  21. package/lib/services/install/release-target.js +8 -9
  22. package/lib/services/install/task-queue.js +74 -57
  23. package/lib/services/npm-release-age.js +119 -0
  24. package/lib/services/probe.js +4 -4
  25. package/lib/services/profile/installed-versions.js +15 -21
  26. package/lib/services/profile/profile.js +16 -44
  27. package/lib/services/profile/progress.js +8 -11
  28. package/lib/services/settings.js +2 -5
  29. package/lib/types/http/catalog.d.ts +1 -1
  30. package/lib/types/http/install.d.ts +2 -2
  31. package/lib/types/http/npm-release-age.d.ts +2 -0
  32. package/lib/types/http/routes.d.ts +10 -12
  33. package/lib/types/http/shared.d.ts +5 -6
  34. package/lib/types/index.d.ts +7 -8
  35. package/lib/types/services/install/install-types.d.ts +12 -13
  36. package/lib/types/services/install/install.d.ts +1 -1
  37. package/lib/types/services/install/npm-resolve.d.ts +4 -16
  38. package/lib/types/services/install/package-entry.d.ts +6 -11
  39. package/lib/types/services/install/release-target.d.ts +7 -8
  40. package/lib/types/services/install/task-queue.d.ts +32 -31
  41. package/lib/types/services/npm-release-age.d.ts +15 -0
  42. package/lib/types/services/probe.d.ts +4 -4
  43. package/lib/types/services/profile/installed-versions.d.ts +5 -7
  44. package/lib/types/services/profile/profile.d.ts +14 -18
  45. package/lib/types/services/profile/progress.d.ts +7 -10
  46. package/lib/types/services/settings.d.ts +0 -4
  47. package/package.json +1 -1
  48. package/src/client/components/PluginHubSection.tsx +23 -27
  49. package/src/client/components/catalog/CatalogList.tsx +2 -4
  50. package/src/client/components/catalog/PluginCard.tsx +2 -3
  51. package/src/client/components/layout/CatalogControls.tsx +5 -6
  52. package/src/client/components/layout/CatalogHeader.tsx +1 -2
  53. package/src/client/components/layout/CategoryTabs.tsx +2 -3
  54. package/src/client/components/layout/SectionTabs.tsx +3 -5
  55. package/src/client/components/modals/ConfirmDialog.tsx +4 -6
  56. package/src/client/components/modals/InstalledDetailModal.tsx +3 -6
  57. package/src/client/components/modals/LogsModal.tsx +7 -12
  58. package/src/client/components/modals/NotificationsModal.tsx +52 -24
  59. package/src/client/components/modals/ProgressView.tsx +3 -4
  60. package/src/client/components/modals/modals.tsx +58 -30
  61. package/src/client/components/ui/Dropdown.tsx +4 -6
  62. package/src/client/components/ui/Toggle.tsx +2 -3
  63. package/src/client/components/ui/icons.tsx +1 -2
  64. package/src/client/components/views/CustomInstallView.tsx +20 -178
  65. package/src/client/components/views/DiagnosticsView.tsx +3 -6
  66. package/src/client/components/views/InstalledView.tsx +6 -11
  67. package/src/client/components/views/MarketView.tsx +2 -4
  68. package/src/client/components/views/SettingsView.tsx +9 -32
  69. package/src/client/css-modules.d.ts +1 -1
  70. package/src/client/data/catalog.ts +2 -3
  71. package/src/client/data/host.ts +26 -3
  72. package/src/client/data/hub.ts +2 -3
  73. package/src/client/hooks/useCatalog.ts +79 -24
  74. package/src/client/hooks/useIncrementalList.ts +3 -5
  75. package/src/client/hooks/useLanguage.ts +4 -6
  76. package/src/client/hooks/useSettings.ts +4 -11
  77. package/src/client/hooks/useTaskQueue.ts +36 -42
  78. package/src/client/index.tsx +2 -3
  79. package/src/client/locales.ts +96 -123
  80. package/src/client/logic/constants.ts +1 -2
  81. package/src/client/logic/ensure-plugin-css.ts +8 -12
  82. package/src/client/logic/failures.ts +41 -28
  83. package/src/client/logic/format.ts +1 -1
  84. package/src/client/logic/install-command.ts +14 -35
  85. package/src/client/logic/installed.ts +15 -10
  86. package/src/client/logic/normalize.ts +3 -3
  87. package/src/client/logic/release-age.ts +19 -0
  88. package/src/client/logic/urls.ts +55 -50
  89. package/src/client/styles/CustomInstallView.module.css +3 -30
  90. package/src/client/styles/DiagnosticsView.module.css +3 -5
  91. package/src/client/styles/Dropdown.module.css +2 -4
  92. package/src/client/styles/Header.module.css +6 -7
  93. package/src/client/styles/InstalledView.module.css +4 -7
  94. package/src/client/styles/List.module.css +4 -5
  95. package/src/client/styles/LogsView.module.css +2 -3
  96. package/src/client/styles/Modal.module.css +4 -5
  97. package/src/client/styles/SectionTabs.module.css +2 -4
  98. package/src/client/styles/SettingsView.module.css +3 -5
  99. package/src/client/styles/Toggle.module.css +2 -4
  100. package/src/client/styles/tokens.module.css +14 -18
  101. package/src/client/types.ts +11 -11
  102. package/src/server/http/catalog.ts +2 -3
  103. package/src/server/http/diagnostics.ts +6 -7
  104. package/src/server/http/install.ts +47 -208
  105. package/src/server/http/logs.ts +1 -2
  106. package/src/server/http/npm-release-age.ts +42 -0
  107. package/src/server/http/routes.ts +12 -12
  108. package/src/server/http/settings.ts +2 -2
  109. package/src/server/http/shared.ts +5 -6
  110. package/src/server/http/task.ts +1 -2
  111. package/src/server/index.ts +7 -8
  112. package/src/server/services/install/install-types.ts +12 -13
  113. package/src/server/services/install/install.ts +0 -1
  114. package/src/server/services/install/npm-check.ts +3 -2
  115. package/src/server/services/install/npm-resolve.ts +9 -99
  116. package/src/server/services/install/package-entry.ts +6 -11
  117. package/src/server/services/install/registry-check.ts +5 -16
  118. package/src/server/services/install/release-target.ts +8 -9
  119. package/src/server/services/install/task-queue.ts +79 -63
  120. package/src/server/services/npm-release-age.ts +107 -0
  121. package/src/server/services/probe.ts +4 -4
  122. package/src/server/services/profile/installed-versions.ts +16 -22
  123. package/src/server/services/profile/profile.ts +16 -42
  124. package/src/server/services/profile/progress.ts +8 -11
  125. package/src/server/services/settings.ts +2 -9
  126. package/lib/services/install/preflight.js +0 -178
  127. package/lib/types/services/install/preflight.d.ts +0 -23
  128. package/src/server/services/install/preflight.ts +0 -184
@@ -2,9 +2,8 @@
2
2
  * Website: https://dsh-plugin.org
3
3
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
4
4
  *
5
- * Plugin Hub section header: brand row, tagline, ad banner, search input,
6
- * filter toolbar (installed / not installed, failures entry) and category
7
- * tabs. Colors resolve through the --hub-* design tokens. */
5
+ * 插件中心板块头部:品牌行、副标题、广告条、搜索框、筛选工具栏
6
+ * (已安装/未安装、失败入口)与分类 tab。颜色经 --hub-* 设计变量解析。 */
8
7
 
9
8
  .root {
10
9
  height: 100%;
@@ -15,7 +14,7 @@
15
14
  color: var(--hub-text-primary);
16
15
  }
17
16
 
18
- /* —— header —— */
17
+ /* —— 头部 —— */
19
18
 
20
19
  .header {
21
20
  display: flex;
@@ -241,7 +240,7 @@
241
240
  text-align: center;
242
241
  }
243
242
 
244
- /* —— result count —— */
243
+ /* —— 筛选结果数 —— */
245
244
 
246
245
  /* 筛选结果数:弱化灰字信息「结果 N 条插件」,位于工具栏行最左侧 */
247
246
  .resultSeg {
@@ -324,7 +323,7 @@
324
323
  background: var(--hub-brand);
325
324
  }
326
325
 
327
- /* —— ad banner —— */
326
+ /* —— 广告条 —— */
328
327
 
329
328
  /* 广告条:固定蓝紫渐变 + 白字,不随主题变量漂移,两种主题下都醒目。
330
329
  与 toast 相同思路:固定颜色保证可读性。 */
@@ -411,7 +410,7 @@
411
410
  border-color: var(--hub-brand);
412
411
  }
413
412
 
414
- /* —— category chips —— */
413
+ /* —— 分类 chips —— */
415
414
 
416
415
  .tabs {
417
416
  display: flex;
@@ -2,13 +2,10 @@
2
2
  * Website: https://dsh-plugin.org
3
3
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
4
4
  *
5
- * Installed view: searchable, sortable list of installed plugins mixing
6
- * catalog plugins (full metadata) and custom installs (runtime info only,
7
- * amber custom badge). The toolbar holds a search box plus two segmented
8
- * radio-button groups (source filter + sort). Each row has three tidy
9
- * lines: title line (running-status dot + name + version/update badges +
10
- * fixed action buttons on the right), meta line (repo · category), and a
11
- * one-line description. Colors resolve through the --hub-* tokens. */
5
+ * 已安装视图:可搜索、可排序的已安装插件清单,混排目录插件(完整元数据)与自定义安装
6
+ * (仅运行时信息,琥珀色自定义徽标)。工具栏含搜索框与两组分段单选(来源筛选 + 排序)。
7
+ * 每行三行整洁内容:标题行(运行状态点 + 名称 + 版本/更新徽标 + 右侧固定操作按钮)、
8
+ * 元信息行(仓库 · 分类)与单行描述。颜色经 --hub-* 变量解析。 */
12
9
 
13
10
  .root {
14
11
  display: flex;
@@ -2,9 +2,8 @@
2
2
  * Website: https://dsh-plugin.org
3
3
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
4
4
  *
5
- * Plugin Hub catalog list: the scrollable body, plugin cards (name, badges,
6
- * description, topics, stats, actions), loading / empty states and the
7
- * browse-all footer. Colors resolve through the --hub-* design tokens. */
5
+ * 插件中心目录列表:可滚动主体、插件卡片(名称、徽标、描述、标签、统计、动作)、
6
+ * 加载/空态与「浏览全部」页脚。颜色经 --hub-* 设计变量解析。 */
8
7
 
9
8
  .body {
10
9
  flex: 1;
@@ -273,7 +272,7 @@ body[data-ds-dark-theme] .uninstallBtn:hover {
273
272
  user-select: none;
274
273
  }
275
274
 
276
- /* —— states —— */
275
+ /* —— 状态 —— */
277
276
 
278
277
  .state {
279
278
  flex: 1;
@@ -341,7 +340,7 @@ body[data-ds-dark-theme] .uninstallBtn:hover {
341
340
  background: var(--hub-brand-hover);
342
341
  }
343
342
 
344
- /* —— footer —— */
343
+ /* —— 页脚 —— */
345
344
 
346
345
  .footer {
347
346
  flex-shrink: 0;
@@ -2,9 +2,8 @@
2
2
  * Website: https://dsh-plugin.org
3
3
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
4
4
  *
5
- * System logs: one row per entry — time, level badge (OK green / FAIL red /
6
- * WARN amber / INFO grey), event code and the message. Header holds the
7
- * refresh / copy-all / export (.log download) actions. */
5
+ * 系统日志:每条一行 —— 时间、级别徽标(OK 绿 / FAIL 红 / WARN 琥珀 / INFO 灰)、
6
+ * 事件码与消息。头部含 刷新 / 全部复制 / 导出(.log 下载)动作。 */
8
7
 
9
8
  .panel {
10
9
  display: flex;
@@ -2,11 +2,10 @@
2
2
  * Website: https://dsh-plugin.org
3
3
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
4
4
  *
5
- * Plugin Hub dialogs and overlays: install / uninstall modals, error dialog,
6
- * failure-record dialog, task-queue dialog, progress strip, inline progress
7
- * and the global toast. Colors resolve through the --hub-* design tokens. */
5
+ * 插件中心弹窗与遮罩:安装/卸载弹窗、错误弹窗、失败记录弹窗、任务队列弹窗、进度条、
6
+ * 内联进度与全局 Toast。颜色经 --hub-* 设计变量解析。 */
8
7
 
9
- /* —— modal base —— */
8
+ /* —— 弹窗基座 —— */
10
9
 
11
10
  .overlay {
12
11
  position: fixed;
@@ -364,7 +363,7 @@
364
363
  overflow-y: auto;
365
364
  }
366
365
 
367
- /* —— toast —— */
366
+ /* —— Toast 提示条 —— */
368
367
 
369
368
  /* 复制成功提示条:窗口正中央浮出,无遮罩无图标。采用反色浮层——亮色模式
370
369
  黑底白字、暗色模式白底深字(复用主按钮 token:primary-fill 与
@@ -2,10 +2,8 @@
2
2
  * Website: https://dsh-plugin.org
3
3
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
4
4
  *
5
- * Primary navigation (section tabs): an underline tab bar under the header
6
- * switching between Market / Installed / Settings. The active tab carries a
7
- * brand-colored underline; the bar itself draws a hairline bottom border so
8
- * the selected state reads clearly without extra chrome. */
5
+ * 一级导航(section tabs):头部下方的下划线 tab 栏,在 市场 / 已安装 / 设置 间切换。
6
+ * 激活 tab 带品牌色下划线;栏本身画一条细底边,让选中态清晰、不多余装饰。 */
9
7
 
10
8
  .root {
11
9
  display: flex;
@@ -2,11 +2,9 @@
2
2
  * Website: https://dsh-plugin.org
3
3
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
4
4
  *
5
- * Settings view: desktop-settings navigation — a fixed left sidebar lists
6
- * the sections (icon + label, click to switch), the right pane shows one
7
- * card per active section (rows: label left, control right, hairline
8
- * separators). High density, no whitespace waste: rows are 12px padding,
9
- * 28px controls, 11px descriptions. */
5
+ * 设置视图:桌面设置式导航 —— 固定左侧栏列出各分组(图标 + 名称,点击切换),
6
+ * 右侧面板每个分组一张卡片(行:标签左、控件右,细线分隔)。高密度、不浪费留白:
7
+ * 行内边距 12px、控件 28px、说明 11px。 */
10
8
 
11
9
  /* 整体:占满剩余高度,左导航右内容两栏 */
12
10
  .root {
@@ -2,10 +2,8 @@
2
2
  * Website: https://dsh-plugin.org
3
3
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
4
4
  *
5
- * Toggle switch for settings rows: a small 34×18 track with a sliding
6
- * knob. Off = neutral hairline track; on = brand fill. Sized for the
7
- * compact settings row height (18px vs the 28px input rows), so labels
8
- * stay vertically centered without extra whitespace. */
5
+ * 设置行用的开关:小号 34×18 轨道 + 滑动圆钮。关 = 中性细线轨道;开 = 品牌填充。
6
+ * 尺寸贴合紧凑的设置行高(18px,输入行是 28px),让标签垂直居中且无多余留白。 */
9
7
 
10
8
  .toggle,
11
9
  .toggleOn {
@@ -2,26 +2,22 @@
2
2
  * Website: https://dsh-plugin.org
3
3
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
4
4
  *
5
- * Plugin Hub design tokens.
5
+ * 插件中心设计变量。
6
6
  *
7
- * Semantic aliases over the host's --dsw-alias-* theme tokens, each with the
8
- * original light-mode literal as fallback for hosts that do not define the
9
- * underlying token. Declared on :root and on the dark body so every theme
10
- * re-resolves the aliases against its own token set; the custom property is
11
- * then inherited by all section elements.
7
+ * 对宿主 --dsw-alias-* 主题变量的语义别名,各带原始浅色字面量,供未定义底层变量的宿主兜底。
8
+ * 声明在 :root 与暗色 body 上,让每种主题都按自己的变量集重新解析别名,再由所有板块元素继承。
12
9
  *
13
- * Keep raw colors out of the per-area stylesheets: reference --hub-* here so
14
- * new styles pick up the theme automatically. */
10
+ * 各区域样式表不要写颜色字面量:在此引用 --hub-*,新样式即可自动跟随主题。 */
15
11
  :root,
16
12
  body[data-ds-dark-theme] {
17
- /* text */
13
+ /* 文本 */
18
14
  --hub-text-primary: var(--dsw-alias-label-primary, #1f2328);
19
15
  --hub-text-secondary: var(--dsw-alias-label-secondary, #6b7280);
20
16
  --hub-text-tertiary: var(--dsw-alias-label-tertiary, #8b93a1);
21
17
  --hub-text-disabled: var(--dsw-alias-label-disabled, #aab1bd);
22
18
  --hub-text-on-fill: var(--dsw-alias-label-primary-foreground, #ffffff);
23
19
 
24
- /* surfaces */
20
+ /* 表面/背景 */
25
21
  --hub-bg-1: var(--dsw-alias-bg-layer-1, #ffffff);
26
22
  --hub-bg-2: var(--dsw-alias-bg-layer-2, rgba(128, 128, 128, 0.08));
27
23
  --hub-bg-3: rgba(128, 128, 128, 0.1);
@@ -30,13 +26,13 @@ body[data-ds-dark-theme] {
30
26
  --hub-bg-hover: var(--dsw-alias-interactive-bg-hover, rgba(128, 128, 128, 0.16));
31
27
  --hub-bg-on-fill: rgba(128, 128, 128, 0.22);
32
28
 
33
- /* borders */
29
+ /* 边框 */
34
30
  --hub-border-1: var(--dsw-alias-border-l1, #eceef1);
35
31
  --hub-border-2: var(--dsw-alias-border-l2, #e5e7eb);
36
32
  --hub-border-ghost: var(--dsw-alias-button-ghost-active-border, rgba(79, 110, 247, 0.25));
37
33
  --hub-border-input: var(--dsw-alias-input-border, rgba(107, 114, 128, 0.25));
38
34
 
39
- /* brand (fixed in both themes) */
35
+ /* 品牌色(两种主题固定) */
40
36
  --hub-brand: var(--dsw-alias-state-business-primary, #4f6ef7);
41
37
  --hub-brand-hover: #3b5bdb;
42
38
  --hub-brand-tint: rgba(79, 110, 247, 0.06);
@@ -44,7 +40,7 @@ body[data-ds-dark-theme] {
44
40
  --hub-brand-border: rgba(79, 110, 247, 0.35);
45
41
  --hub-brand-border-soft: rgba(79, 110, 247, 0.22);
46
42
 
47
- /* purple brand accents (fixed in both themes) */
43
+ /* 紫色品牌点缀(两种主题固定) */
48
44
  --hub-purple-1: #4f46e5;
49
45
  --hub-purple-2: #7c3aed;
50
46
  --hub-purple-border: rgba(139, 92, 246, 0.55);
@@ -52,28 +48,28 @@ body[data-ds-dark-theme] {
52
48
  --hub-purple-shadow: rgba(79, 70, 229, 0.28);
53
49
  --hub-purple-shadow-strong: rgba(124, 58, 237, 0.42);
54
50
 
55
- /* primary action button */
51
+ /* 主操作按钮 */
56
52
  --hub-btn-fill: var(--dsw-alias-button-primary-fill, #1f2328);
57
53
  --hub-btn-hover: var(--dsw-alias-button-primary-hover, #43454a);
58
54
 
59
- /* success */
55
+ /* 成功 */
60
56
  --hub-success: #16a34a;
61
57
  --hub-success-tint: rgba(22, 163, 74, 0.12);
62
58
  --hub-success-border: rgba(22, 163, 74, 0.3);
63
59
 
64
- /* warning (amber) */
60
+ /* 警告(琥珀) */
65
61
  --hub-warn: var(--dsw-alias-state-warn-primary, #b8860b);
66
62
  --hub-warn-tint: rgba(184, 134, 11, 0.08);
67
63
  --hub-warn-border: rgba(184, 134, 11, 0.35);
68
64
  --hub-warn-strong: rgba(184, 134, 11, 0.85);
69
65
 
70
- /* warning (deep amber) */
66
+ /* 警告(深琥珀) */
71
67
  --hub-warning: var(--dsw-alias-state-warning-primary, #b45309);
72
68
  --hub-warning-hover: #92400e;
73
69
  --hub-warning-tint: rgba(180, 83, 9, 0.08);
74
70
  --hub-warning-border: rgba(180, 83, 9, 0.3);
75
71
 
76
- /* danger */
72
+ /* 危险 */
77
73
  --hub-danger: var(--dsw-alias-state-danger-primary, #d1242f);
78
74
  --hub-danger-hover: var(--dsw-alias-state-danger-hover, #b91c1c);
79
75
  --hub-danger-strong: #b0202a;
@@ -3,20 +3,20 @@
3
3
  * Website: https://dsh-plugin.org
4
4
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
5
5
  *
6
- * Shared types for the dsh-plugin browser client. Kept dependency-free so
7
- * any client module can import them without pulling in components or styles.
6
+ * dsh-plugin 浏览器客户端的共享类型。保持零依赖,任何客户端模块都能直接引入,
7
+ * 而不会连带拉入组件或样式。
8
8
  */
9
9
 
10
10
  export type LocaleId = 'zh' | 'en'
11
11
 
12
- /** 自定义安装入口渠道:三张卡片(NPM 包 / GitHub 源码 / DSH 命令)。
13
- * 客户端提交时显式上报,服务端落日志/报错提示据此溯源「从哪个入口发起」。 */
14
- export type InstallChannel = 'npm' | 'git' | 'dsh'
12
+ /** 自定义安装入口渠道:仅 NPM 包。
13
+ * 客户端提交时显式上报,服务端落日志/报错提示据此溯源「从哪个入口发起」。 */
14
+ export type InstallChannel = 'npm'
15
15
 
16
- /** Translation function signature shared by the host binder and the in-component dictionary. */
16
+ /** 宿主绑定与组件内字典共用的翻译函数签名。 */
17
17
  export type Translate = (key: string, params?: Record<string, string | number>) => string
18
18
 
19
- /** The subset of the locale service this plugin touches. */
19
+ /** 本插件用到的 locale 服务子集。 */
20
20
  export interface LocaleService {
21
21
  register(namespace: string, dicts: { zh: Record<string, string>; en: Record<string, string> }): unknown
22
22
  bind(namespace: string): (key: string, params?: Record<string, string | number>) => string
@@ -27,13 +27,13 @@ export interface LocaleService {
27
27
  setLocale(id: string): void
28
28
  }
29
29
 
30
- /** The subset of the slots service this plugin touches. */
30
+ /** 本插件用到的 slots 服务子集。 */
31
31
  export interface SlotsService {
32
32
  inject(slot: string, register: () => unknown): void
33
33
  register(meta: Record<string, unknown>, component: () => unknown): unknown
34
34
  }
35
35
 
36
- /** The client cordis context shape this plugin relies on (structural). */
36
+ /** 本插件依赖的客户端 cordis 上下文形态(结构化)。 */
37
37
  export interface HubClientContext {
38
38
  effect(callback: () => unknown, label?: string): void
39
39
  slots: SlotsService
@@ -45,7 +45,7 @@ export interface SectionProps {
45
45
  locale: LocaleService
46
46
  }
47
47
 
48
- /** Slim projection of the site's DirectoryPlugin entries. */
48
+ /** 官网 DirectoryPlugin 条目的精简投影。 */
49
49
  export interface HubPlugin {
50
50
  /** 作者小写 key,与 slug 共同构成唯一身份(两级路径 /plugins/{ownerSlug}/{slug});可能缺省 */
51
51
  ownerSlug?: string
@@ -60,7 +60,7 @@ export interface HubPlugin {
60
60
  source?: { repo?: string; npmPackage?: string }
61
61
  /** 安装信息:能否网页一键安装(false = 仅支持命令行/专属 profile,缺省视为 true);
62
62
  * manualInstall = 人工干预标记(网页端一键安装替代不了终端的构建/装配,必须用户自己去终端装);
63
- * command/githubCommand = 目录下发的权威安装命令(npm/git 通道各一条),
63
+ * command/githubCommand = 目录下发的权威安装命令,
64
64
  * 仅供展示/复制 —— CLI-only 插件(如 dsh-tui)需专属 profile(--profile dsh-tui),
65
65
  * 无法从 repo/npm 包名推断,必须用目录命令。 */
66
66
  install?: { webInstallable?: boolean; manualInstall?: boolean; command?: string; githubCommand?: string }
@@ -3,8 +3,7 @@
3
3
  * Website: https://dsh-plugin.org
4
4
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
5
5
  *
6
- * Catalog proxy routes: server-side caching of the directory/stats payloads
7
- * and profile-level installed-package reads shared with the install/task modules.
6
+ * 目录代理路由:目录/统计载荷的服务端缓存,以及与安装/任务模块共享的 profile 级已装包读取。
8
7
  */
9
8
  import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
10
9
  import { homedir } from 'node:os'
@@ -53,7 +52,7 @@ export function profileDirectory(profile: string): string {
53
52
  return join(process.env.DSH_HOME ?? join(homedir(), '.dsh'), 'profiles', profile)
54
53
  }
55
54
 
56
- /** Read non-official dependencies installed into one profile. */
55
+ /** 读取安装进某 profile 的非官方依赖。 */
57
56
  export function readInstalled(profile: string): Record<string, string> {
58
57
  try {
59
58
  const manifest = JSON.parse(readFileSync(join(profileDirectory(profile), 'package.json'), 'utf8')) as {
@@ -3,8 +3,7 @@
3
3
  * Website: https://dsh-plugin.org
4
4
  * GitHub: https://github.com/dshplugin/dsh-plugin-hub
5
5
  *
6
- * Diagnostics routes: streaming connectivity self-check, proxy verification,
7
- * and the host environment snapshot shared with the task module's /env route.
6
+ * 诊断路由:流式连通性自检、代理校验,以及与任务模块 /env 路由共享的宿主环境快照。
8
7
  */
9
8
  import { readFileSync } from 'node:fs'
10
9
  import { homedir, release } from 'node:os'
@@ -31,7 +30,7 @@ function hostDshVersion(): string | null {
31
30
  return manifest.version
32
31
  }
33
32
  } catch {
34
- /* not a package root — keep walking up */
33
+ /* 不是包根,继续向上查找 */
35
34
  }
36
35
  const parent = dirname(dir)
37
36
  if (parent === dir) break
@@ -95,8 +94,8 @@ export function registerDiagnosticsRoutes(webServer: WebServerService, profile:
95
94
  path: '/dsh-plugin-hub/diagnostics',
96
95
  handler: async (request, response) => {
97
96
  if (!requireTrustedPost(request, response)) return
98
- // 连通性自检:npm registry(镜像/官方)/ GitHub API / 目录站点,逐路探测并测速。
99
- // 与安装通道一一对应 —— npm 反查与 npm 安装走 registry、git 源走 github、目录数据走 dsh-plugin.org。
97
+ // 连通性自检:npm registry(镜像/官方)/ GitHub / 目录站点,逐路探测并测速。
98
+ // npm 安装走 registry、目录数据走 dsh-plugin.org、GitHub 那一行用于反映插件运行时对 github.com 的可达性。
100
99
  // 流式(NDJSON)逐条上报:每个探测先发命令行,完成后发结果行,客户端以黑窗口终端实时展示。
101
100
  // 可选 body { key }:只重测指定通道(页面列表「重测」单项时用),缺省全量串行探测。
102
101
  let onlyKey = ''
@@ -112,8 +111,8 @@ export function registerDiagnosticsRoutes(webServer: WebServerService, profile:
112
111
  // npm 通道:设置里配置了镜像源就探测该镜像(安装通道吃同一个 registry);
113
112
  // 未配置(空串)时探测官方源作为「跟随本机 npm 配置」的基础连通性参考。
114
113
  const registry = settings.npmRegistry.replace(/\/+$/, '') || 'https://registry.npmjs.org'
115
- // 连通性自检直接打安装通道真实访问的轻量资源:npm 源拉包元数据、git 通道探
116
- // 仓库主页、目录站探 badge 小文件,避免拉取目录全量 JSON。
114
+ // 连通性自检打各通道的轻量资源:npm 源拉包元数据、GitHub 行探小仓库、目录站探
115
+ // 小文件,避免拉取目录全量 JSON。
117
116
  // npm 行 display:配置了镜像就显示镜像地址;未配置置空 —— 客户端显示「未配置(跟随本机 npm 配置)」。
118
117
  const allChecks: Array<{ key: string; url: string; display: string; cmd: string; proxy?: string; git?: boolean }> = [
119
118
  { key: 'npm', url: `${registry}/dsh-plugin`, display: settings.npmRegistry !== '' ? registry : '', cmd: `npm view dsh-plugin version --registry ${registry}` },