@dsh-plugins/dsh-llm-hub 1.9.7 → 1.9.9
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/CHANGELOG.md +19 -0
- package/README.md +4 -4
- package/assets/01-family-dock.svg +19 -41
- package/lib/client.js +40 -80
- package/package.json +2 -2
- package/scripts/version-sync-gate.mjs +197 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
|
|
4
4
|
|
|
5
|
+
## [1.9.9](https://github.com/webkubor/dsh-llm-hub/compare/v1.9.8...v1.9.9) (2026-10-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### 🐛 Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **ui:** restore model overview styles and retire obsolete suite cards ([15b1c23](https://github.com/webkubor/dsh-llm-hub/commit/15b1c2345a6c3bc9a02c2ac68b97b7789442f9da))
|
|
11
|
+
|
|
12
|
+
## [1.9.8](https://github.com/webkubor/dsh-llm-hub/compare/v1.9.7...v1.9.8) (2026-10-28)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **test:** README 旧包名守卫误报 CDN 图片地址 ([1709d25](https://github.com/webkubor/dsh-llm-hub/commit/1709d257904b8ad0caabd479ccc2af88cc7cd3e6))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### 📝 Documentation
|
|
21
|
+
|
|
22
|
+
* README 素材迁入 free-imgbed 图床(本地相对路径 → CDN 直链) ([34c7aad](https://github.com/webkubor/dsh-llm-hub/commit/34c7aad183c3c2f942cf1a17452a1fecfcc3cbeb))
|
|
23
|
+
|
|
5
24
|
## [1.9.7](https://github.com/webkubor/dsh-llm-hub/compare/v1.9.6...v1.9.7) (2026-10-25)
|
|
6
25
|
|
|
7
26
|
|
package/README.md
CHANGED
|
@@ -71,14 +71,14 @@ npx @deepseek-ai/dsh plugin --profile <你的 profile> add @dsh-plugins/dsh-llm-
|
|
|
71
71
|
1. **套餐 vs 按量付费**:每个 provider 卡片新增 billing capsule,左边"按量付费"右边"套餐",
|
|
72
72
|
自动按 5 层 fallback 识别云端账单类型(settings → `/status` → `/token_plan/remains`
|
|
73
73
|
→ `/usage/quota/limit` → `/user/balance`),手动点另一边切模式即写回 settings。
|
|
74
|
-

|
|
75
75
|
2. **LLM 下拉套餐优先**:composer 模型选择器按当前 provider 的 billingMode 把套餐模型
|
|
76
76
|
置顶(绿色「套餐」徽章段),按量模型跟在后面。**不**自动改路由、不隐藏按量。
|
|
77
|
-

|
|
78
78
|
3. **家族面板真实激活探测(修 bug)**:设置 → 模型 → 底部「Webkubor DSH 扩展家族」,
|
|
79
79
|
之前的版本不管装几个插件永远只亮自己。改读 `window.__DSH_BOOT__.entries`
|
|
80
80
|
做真实激活探测,读不到时显示「判定不可用」而非谎报「没装」。
|
|
81
|
-

|
|
82
82
|
|
|
83
83
|
升级:
|
|
84
84
|
|
|
@@ -502,7 +502,7 @@ publish。Release 的存在性单独探测,所以「npm 发成功但 Release
|
|
|
502
502
|
|
|
503
503
|
```bash
|
|
504
504
|
PROFILE=<你的 profile>
|
|
505
|
-
npx -y @deepseek-ai/dsh plugin --profile "$PROFILE" add dsh-bloom-theme @dsh-plugins/dsh-llm-hub
|
|
505
|
+
npx -y @deepseek-ai/dsh plugin --profile "$PROFILE" add dsh-bloom-theme @dsh-plugins/dsh-llm-hub && PROFILE="$PROFILE" node -e 'const f=(process.env.DSH_HOME||require("os").homedir()+"/.dsh")+"/profiles/"+process.env.PROFILE+"/package.json",p=require(f),b=p.dsh.profile.bundles;for(const n of Object.keys(p.dependencies))if(/^(dsh-bloom-theme|@dsh-plugins\/)/.test(n)&&!b.includes(n))b.push(n);require("fs").writeFileSync(f,JSON.stringify(p,null,2)+"\n")'
|
|
506
506
|
```
|
|
507
507
|
|
|
508
508
|
> **桌面端用户**:官方 Electron 端独占 `desktop` profile,命令行对它做插件操作会被拒
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="230" viewBox="0 0 640 230" font-family="-apple-system, 'SF Pro Text', 'PingFang SC', system-ui, sans-serif">
|
|
2
2
|
<defs>
|
|
3
3
|
<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">
|
|
4
4
|
<stop offset="0%" stop-color="#1f1d2b"/>
|
|
@@ -15,65 +15,43 @@
|
|
|
15
15
|
<filter id="blur"><feGaussianBlur stdDeviation="6"/></filter>
|
|
16
16
|
</defs>
|
|
17
17
|
|
|
18
|
-
<rect width="640" height="
|
|
19
|
-
<rect x="0" y="0" width="640" height="
|
|
18
|
+
<rect width="640" height="230" fill="url(#bg)"/>
|
|
19
|
+
<rect x="0" y="0" width="640" height="230" fill="#000" opacity="0.0"/>
|
|
20
20
|
<circle cx="80" cy="60" r="120" fill="#7c3aed" opacity="0.10" filter="url(#blur)"/>
|
|
21
|
-
<circle cx="560" cy="
|
|
21
|
+
<circle cx="560" cy="180" r="140" fill="#3b82f6" opacity="0.10" filter="url(#blur)"/>
|
|
22
22
|
|
|
23
23
|
<!-- panel container -->
|
|
24
|
-
<rect x="32" y="22" width="576" height="
|
|
24
|
+
<rect x="32" y="22" width="576" height="176" rx="12" fill="#1a1825" stroke="#2d2b3a" stroke-width="1"/>
|
|
25
25
|
|
|
26
26
|
<!-- head -->
|
|
27
27
|
<g transform="translate(48,46)">
|
|
28
28
|
<text x="0" y="14" font-size="14" font-weight="650" fill="#e5e7eb">🌟 Webkubor DSH 扩展家族</text>
|
|
29
|
-
<text x="
|
|
29
|
+
<text x="544" y="14" font-size="10" fill="#9ca3af" text-anchor="end">一键构建完整智能体开发环境</text>
|
|
30
30
|
</g>
|
|
31
31
|
|
|
32
|
-
<!--
|
|
32
|
+
<!-- 2 cards in 1 row, each 266x100 -->
|
|
33
33
|
<!-- card 1: Bloom Theme -->
|
|
34
|
-
<g transform="translate(48,
|
|
35
|
-
<rect width="266" height="
|
|
34
|
+
<g transform="translate(48,80)">
|
|
35
|
+
<rect width="266" height="100" rx="8" fill="url(#card)" stroke="#2d2b3a"/>
|
|
36
36
|
<text x="14" y="24" font-size="14">🌸</text>
|
|
37
37
|
<text x="34" y="26" font-size="12" font-weight="600" fill="#e5e7eb">Bloom Theme</text>
|
|
38
38
|
<text x="14" y="50" font-size="10.5" fill="#9ca3af">落霞 Bloom 极客质感毛玻璃主题与代码高亮</text>
|
|
39
|
-
<circle cx="14" cy="
|
|
40
|
-
<text x="24" y="
|
|
41
|
-
<text x="252" y="
|
|
39
|
+
<circle cx="14" cy="76" r="3.5" fill="url(#dot)"/>
|
|
40
|
+
<text x="24" y="80" font-size="10.5" font-weight="600" fill="#10b981">已激活</text>
|
|
41
|
+
<text x="252" y="80" font-size="10" fill="#6b7280" text-anchor="end">GitHub ↗</text>
|
|
42
42
|
</g>
|
|
43
43
|
|
|
44
44
|
<!-- card 2: LLM Hub -->
|
|
45
|
-
<g transform="translate(326,
|
|
46
|
-
<rect width="266" height="
|
|
45
|
+
<g transform="translate(326,80)">
|
|
46
|
+
<rect width="266" height="100" rx="8" fill="url(#card)" stroke="#2d2b3a"/>
|
|
47
47
|
<text x="14" y="24" font-size="14">🎛️</text>
|
|
48
48
|
<text x="34" y="26" font-size="12" font-weight="600" fill="#e5e7eb">LLM Hub</text>
|
|
49
49
|
<text x="14" y="50" font-size="10.5" fill="#9ca3af">多模型网关、余额配额、多 Key 轮换与极客大屏</text>
|
|
50
|
-
<circle cx="14" cy="
|
|
51
|
-
<text x="24" y="
|
|
52
|
-
<text x="252" y="
|
|
53
|
-
</g>
|
|
54
|
-
|
|
55
|
-
<!-- card 3: User Mirror -->
|
|
56
|
-
<g transform="translate(48,196)">
|
|
57
|
-
<rect width="266" height="104" rx="8" fill="url(#card)" stroke="#2d2b3a"/>
|
|
58
|
-
<text x="14" y="24" font-size="14">🪞</text>
|
|
59
|
-
<text x="34" y="26" font-size="12" font-weight="600" fill="#e5e7eb">User Mirror</text>
|
|
60
|
-
<text x="14" y="50" font-size="10.5" fill="#9ca3af">用户角色数字画像、习惯偏好与记忆网络</text>
|
|
61
|
-
<circle cx="14" cy="78" r="3.5" fill="url(#dot)"/>
|
|
62
|
-
<text x="24" y="82" font-size="10.5" font-weight="600" fill="#10b981">已激活</text>
|
|
63
|
-
<text x="252" y="82" font-size="10" fill="#6b7280" text-anchor="end">GitHub ↗</text>
|
|
64
|
-
</g>
|
|
65
|
-
|
|
66
|
-
<!-- card 4: Env Inspector -->
|
|
67
|
-
<g transform="translate(326,196)">
|
|
68
|
-
<rect width="266" height="104" rx="8" fill="url(#card)" stroke="#2d2b3a"/>
|
|
69
|
-
<text x="14" y="24" font-size="14">🖥️</text>
|
|
70
|
-
<text x="34" y="26" font-size="12" font-weight="600" fill="#e5e7eb">Env Inspector</text>
|
|
71
|
-
<text x="14" y="50" font-size="10.5" fill="#9ca3af">端口监听释放、CLI 工具链与环境大屏</text>
|
|
72
|
-
<circle cx="14" cy="78" r="3.5" fill="url(#dot)"/>
|
|
73
|
-
<text x="24" y="82" font-size="10.5" font-weight="600" fill="#10b981">已激活</text>
|
|
74
|
-
<text x="252" y="82" font-size="10" fill="#6b7280" text-anchor="end">GitHub ↗</text>
|
|
50
|
+
<circle cx="14" cy="76" r="3.5" fill="url(#dot)"/>
|
|
51
|
+
<text x="24" y="80" font-size="10.5" font-weight="600" fill="#10b981">已激活</text>
|
|
52
|
+
<text x="252" y="80" font-size="10" fill="#6b7280" text-anchor="end">GitHub ↗</text>
|
|
75
53
|
</g>
|
|
76
54
|
|
|
77
55
|
<!-- caption hint -->
|
|
78
|
-
<text x="320" y="
|
|
79
|
-
</svg>
|
|
56
|
+
<text x="320" y="218" font-size="9" fill="#6b7280" text-anchor="middle">设置 → 模型 → 底部「Webkubor DSH 扩展家族」</text>
|
|
57
|
+
</svg>
|
package/lib/client.js
CHANGED
|
@@ -548,16 +548,20 @@ window.__ModuleLoader__.load({
|
|
|
548
548
|
'box-shadow:0 0 5px rgba(239,68,68,.5)}',
|
|
549
549
|
'.dsh-llm-hub-dot-sep{opacity:.35;margin:0 1px}',
|
|
550
550
|
// harness
|
|
551
|
-
'.dsh-llm-hub-harness{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:
|
|
551
|
+
'.dsh-llm-hub-harness{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px;',
|
|
552
|
+
'padding:8px 12px;border-radius:8px;border:1px solid var(--bloom-hairline,rgba(255,255,255,.06));',
|
|
553
|
+
'background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.02));backdrop-filter:blur(8px);',
|
|
552
554
|
'font-size:11.5px;line-height:16px;color:var(--dsw-alias-label-secondary)}',
|
|
553
|
-
'.dsh-llm-hub-
|
|
554
|
-
'
|
|
555
|
-
'
|
|
555
|
+
'.dsh-llm-hub-harness__title{font-size:11px;font-weight:600;color:var(--dsw-alias-label-tertiary);letter-spacing:.2px;margin-right:2px}',
|
|
556
|
+
'.dsh-llm-hub-harness__chip{display:inline-flex;align-items:center;gap:5px;',
|
|
557
|
+
'padding:3px 9px;border-radius:6px;border:1px solid var(--dsw-alias-border-l1,rgba(255,255,255,.08));',
|
|
558
|
+
'background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.03));transition:all .15s ease}',
|
|
559
|
+
'.dsh-llm-hub-harness__chip:hover{border-color:var(--bloom-accent,#5fa8b2);background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}',
|
|
556
560
|
'.dsh-llm-hub-harness__chip--missing{opacity:.45}',
|
|
557
561
|
'.dsh-llm-hub-harness__dot{width:5px;height:5px;border-radius:50%;',
|
|
558
562
|
'background:var(--dsw-alias-label-secondary);flex:none}',
|
|
559
|
-
'.dsh-llm-hub-harness__dot--ready{background:var(--dsw-alias-state-success-primary,#10b981)}',
|
|
560
|
-
'.dsh-llm-hub-harness__name{color:var(--dsw-alias-label-primary)}',
|
|
563
|
+
'.dsh-llm-hub-harness__dot--ready{background:var(--dsw-alias-state-success-primary,#10b981);box-shadow:0 0 6px rgba(16,185,129,.6)}',
|
|
564
|
+
'.dsh-llm-hub-harness__name{color:var(--dsw-alias-label-primary);font-weight:550}',
|
|
561
565
|
'.dsh-llm-hub-harness__state{opacity:.75}',
|
|
562
566
|
// 目录选择器 Drawer
|
|
563
567
|
'.dsh-llm-hub-picker{margin-top:6px;padding:8px 10px;border-radius:6px;',
|
|
@@ -572,12 +576,13 @@ window.__ModuleLoader__.load({
|
|
|
572
576
|
'.dsh-llm-hub-picker__tag{font-size:10.5px;padding:0 4px;border-radius:3px;',
|
|
573
577
|
'color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-3)}',
|
|
574
578
|
// 页脚
|
|
575
|
-
'.dsh-llm-hub-foot{display:flex;align-items:center;gap:
|
|
576
|
-
'padding:2px 2px;font-size:11px;color:var(--dsw-alias-label-secondary)
|
|
577
|
-
'.dsh-llm-hub-foot__name{font-variant-numeric:tabular-nums;opacity:.
|
|
578
|
-
'.dsh-llm-hub-foot__link{color:var(--dsw-alias-label-
|
|
579
|
-
'border:
|
|
580
|
-
'
|
|
579
|
+
'.dsh-llm-hub-foot{display:flex;align-items:center;gap:8px;margin-top:10px;flex-wrap:wrap;',
|
|
580
|
+
'padding:2px 2px;font-size:11px;color:var(--dsw-alias-label-secondary)}',
|
|
581
|
+
'.dsh-llm-hub-foot__name{font-variant-numeric:tabular-nums;opacity:.85;font-family:ui-monospace,monospace;font-size:10.5px}',
|
|
582
|
+
'.dsh-llm-hub-foot__link{color:var(--dsw-alias-label-secondary);text-decoration:none;',
|
|
583
|
+
'border:1px solid var(--dsw-alias-border-l1,rgba(255,255,255,.08));background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.02));',
|
|
584
|
+
'padding:3px 8px;border-radius:5px;font:inherit;font-size:10.5px;cursor:pointer;display:inline-flex;align-items:center;gap:4px;transition:all .15s ease}',
|
|
585
|
+
'.dsh-llm-hub-foot__link:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--bloom-accent,#5fa8b2);background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08));text-decoration:none}',
|
|
581
586
|
'.dsh-llm-hub-chip{box-sizing:border-box;display:inline-flex;align-items:center;height:20px;padding:0 6px;',
|
|
582
587
|
'border-radius:10px;font-size:10.5px;line-height:14px;white-space:nowrap;',
|
|
583
588
|
'border:.5px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary)}',
|
|
@@ -654,51 +659,22 @@ window.__ModuleLoader__.load({
|
|
|
654
659
|
'.dsh-llm-hub-route__hint{font-size:10px;color:var(--dsw-alias-label-tertiary)}',
|
|
655
660
|
'.dsh-llm-hub-route__order{font-size:10px;color:var(--dsw-alias-label-secondary);',
|
|
656
661
|
'font-family:ui-monospace,SFMono-Regular,monospace;word-break:break-all;line-height:1.4}',
|
|
657
|
-
// 智能路由编辑器(设置页路由卡)
|
|
658
|
-
// 规则说明:去掉盒子背景,只留淡灰单行注脚,视觉权重要低于第 2 行「将路由到…」
|
|
659
|
-
'color:var(--dsw-alias-label-tertiary);padding:0}',
|
|
660
|
-
// 当前组:边框降一档 + 顶部 brand 细线高亮,替代原本的 warn 四边描边
|
|
661
|
-
'border:.5px solid var(--dsw-alias-border-l1);border-radius:4px;background:transparent;cursor:pointer;',
|
|
662
|
-
'font:inherit;font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);white-space:nowrap;transition:all .15s ease}',
|
|
663
|
-
'border:0;background:transparent;padding:0;cursor:pointer;font:inherit;font-size:12px;line-height:1;',
|
|
664
|
-
'color:var(--dsw-alias-label-tertiary);border-radius:3px;transition:all .15s ease}',
|
|
665
|
-
// 折叠行(1.6.2):组名 + 「将路由到 X」+ 主力 + 兜底条数,一行读完。
|
|
666
|
-
// 组名给固定宽度,与下面展开态的 label 输入框同宽 —— 收起/展开时这一列不跳。
|
|
667
|
-
'white-space:nowrap;font-size:11.5px;font-weight:600;color:var(--dsw-alias-label-primary)}',
|
|
668
|
-
'border:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);',
|
|
669
|
-
'font:inherit;font-size:11px;outline:none;transition:border-color .15s ease}',
|
|
670
|
-
// 允许换行,不允许截断(1.6.2 浏览器实测后改的)。设置内容区只有 564px,
|
|
671
|
-
// 扣掉序号/组名/两个按钮,摘要只剩 ~210px;而真实数据的 provider/model
|
|
672
|
-
// 要 200-215px —— 差的这几十像素,省不掉,只能换行。之前用 nowrap+ellipsis
|
|
673
|
-
// 把「→ modelgo-gateway/claude-sonnet-5」砍成「→ modelgo-gatewa…」,
|
|
674
|
-
// 砍掉的正好是判断路由结果最需要的那段:看不出是 sonnet-5 还是别的。
|
|
675
|
-
// 组头因此高一行,是「读得全」该付的代价。
|
|
676
|
-
'color:var(--dsw-alias-label-secondary);display:flex;flex-wrap:wrap;align-items:center;gap:2px 8px}',
|
|
677
|
-
// 断行点放在 provider 与 model 之间的斜杠上:读起来是两条完整信息,
|
|
678
|
-
// 而不是把一个词从中间劈开。break-all 是兜底 —— provider id 里也有长词。
|
|
679
|
-
'min-width:0;word-break:break-word;overflow-wrap:anywhere}',
|
|
680
|
-
// 可用/总:紧跟在「将路由到」后面,且**不参与压缩** —— 压它等于把
|
|
681
|
-
// 「还剩几个能兜」这个答案藏掉,而它只要 30px。
|
|
682
|
-
'color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}',
|
|
683
|
-
// 1.7.0 路由编辑器:序号徽标、编辑按钮、原地下拉、备注、放大的操作按钮、自动保存状态
|
|
684
|
-
'padding:0 6px;font-size:10.5px;font-weight:600;background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.08));color:var(--dsw-alias-label-secondary)}',
|
|
685
|
-
// 全组共用一张网格:行与 pick 都是 display:contents,列宽由整组一起决定 ——
|
|
686
|
-
// 各行自成网格时,右侧标签列按本行内容伸缩,模型下拉的右边缘每行都不一样(浏览器实测 908 vs 845px)。
|
|
687
|
-
// 标签区给固定宽度并靠右:有无「思考/图像」标签的行,备注框都一样宽,右边缘对齐。
|
|
688
|
-
// 半可用单独一色:全绿和全红之间还有「还剩几个」这个状态,
|
|
689
|
-
// 混成全绿会让人以为不用管,混成全红会误报故障。
|
|
690
|
-
// 同理固定宽度:主力行没有「设为主力」,按钮区只有 77px(其余 141px),备注右边缘会错开 64px。
|
|
691
|
-
'border:.5px solid var(--dsw-alias-border-l1);background:transparent;color:var(--dsw-alias-label-secondary);',
|
|
692
|
-
'font:inherit;font-size:10.5px;flex:1 1 120px;min-width:90px;max-width:260px;outline:none;transition:border-color .15s ease}',
|
|
693
|
-
// 候选区是纵向 flex:note 的 flex-basis 120px 在这里会变成「高 120px」,组备注必须脱离 flex 伸缩。
|
|
694
|
-
'background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:11px;max-width:170px;outline:none;',
|
|
695
|
-
'transition:border-color .15s ease;cursor:pointer}',
|
|
696
|
-
'color:var(--dsw-alias-state-success-primary,#10b981)}',
|
|
697
662
|
// Hero 全景统计大横条
|
|
698
|
-
'.dsh-llm-hub-hero{display:grid;grid-template-columns:repeat(auto-fit,minmax(
|
|
699
|
-
'.dsh-llm-hub-hero__card{display:flex;flex-direction:column;gap:
|
|
700
|
-
'
|
|
701
|
-
'.
|
|
663
|
+
'.dsh-llm-hub-hero{display:grid;grid-template-columns:repeat(auto-fit,minmax(115px,1fr));gap:8px;margin:16px 0 10px 0}',
|
|
664
|
+
'.dsh-llm-hub-hero__card{position:relative;display:flex;flex-direction:column;justify-content:space-between;gap:4px;padding:10px 12px;',
|
|
665
|
+
'border-radius:9px;border:1px solid var(--bloom-hairline,rgba(255,255,255,.08));background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.03));',
|
|
666
|
+
'backdrop-filter:blur(14px) saturate(1.2);-webkit-backdrop-filter:blur(14px) saturate(1.2);box-shadow:0 2px 10px rgba(0,0,0,.08);',
|
|
667
|
+
'transition:all .2s cubic-bezier(0.16,1,0.3,1);overflow:hidden}',
|
|
668
|
+
'.dsh-llm-hub-hero__card:hover{transform:translateY(-1px);border-color:var(--bloom-accent,var(--dsw-alias-brand-primary,#5fa8b2));box-shadow:0 4px 16px rgba(0,0,0,.16)}',
|
|
669
|
+
'.dsh-llm-hub-hero__card::before{content:"";position:absolute;top:0;left:0;right:0;height:1.5px;',
|
|
670
|
+
'background:linear-gradient(90deg,transparent,var(--bloom-accent,rgba(255,255,255,.2)),transparent);opacity:.65}',
|
|
671
|
+
'.dsh-llm-hub-hero__num{font-size:16px;font-weight:750;color:var(--dsw-alias-label-primary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:-0.3px;line-height:1.2;display:flex;align-items:center;gap:4px}',
|
|
672
|
+
'.dsh-llm-hub-hero__card--providers .dsh-llm-hub-hero__num{color:var(--bloom-accent,var(--dsw-alias-brand-primary,#5fa8b2))}',
|
|
673
|
+
'.dsh-llm-hub-hero__card--latency.is-fast .dsh-llm-hub-hero__num{color:var(--dsw-alias-state-success-primary,#10b981)}',
|
|
674
|
+
'.dsh-llm-hub-hero__card--latency.is-normal .dsh-llm-hub-hero__num{color:var(--dsw-alias-state-warn-primary,#eab308)}',
|
|
675
|
+
'.dsh-llm-hub-hero__card--latency.is-slow .dsh-llm-hub-hero__num{color:var(--dsw-alias-state-error-primary,#ef4444)}',
|
|
676
|
+
'.dsh-llm-hub-hero__card--security .dsh-llm-hub-hero__num{color:var(--dsw-alias-state-success-primary,#10b981)}',
|
|
677
|
+
'.dsh-llm-hub-hero__label{font-size:10.5px;font-weight:550;color:var(--dsw-alias-label-secondary);opacity:.85;letter-spacing:.2px}',
|
|
702
678
|
// 添加提供方草稿卡上的匹配提示(1.6.0)
|
|
703
679
|
'.dsh-llm-hub-preset-hint{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 8px;margin:0 0 8px;padding:6px 10px;border-radius:6px;',
|
|
704
680
|
'border:.5px solid var(--dsw-alias-border-l1);font-size:11px;line-height:1.5}',
|
|
@@ -727,7 +703,7 @@ window.__ModuleLoader__.load({
|
|
|
727
703
|
'.dsh-suite-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;flex-wrap:wrap;gap:8px}',
|
|
728
704
|
'.dsh-suite-title{font-size:12px;font-weight:650;color:var(--dsw-alias-label-primary);margin:0;display:flex;align-items:center;gap:6px}',
|
|
729
705
|
'.dsh-suite-desc{font-size:10.5px;color:var(--dsw-alias-label-tertiary);letter-spacing:.2px}',
|
|
730
|
-
'.dsh-suite-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(
|
|
706
|
+
'.dsh-suite-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px}',
|
|
731
707
|
'.dsh-suite-card{display:flex;flex-direction:column;justify-content:space-between;padding:10px 12px;border-radius:8px;background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,0.02));border:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,0.05));transition:all .2s cubic-bezier(0.16,1,0.3,1)}',
|
|
732
708
|
'.dsh-suite-card:hover{transform:translateY(-1px);border-color:var(--dsw-alias-brand-primary,#3b82f6);box-shadow:0 4px 14px rgba(0,0,0,0.15)}',
|
|
733
709
|
'.dsh-suite-card-top{display:flex;align-items:center;gap:6px;margin-bottom:4px}',
|
|
@@ -1523,7 +1499,7 @@ window.__ModuleLoader__.load({
|
|
|
1523
1499
|
if (list.length === 0) return null
|
|
1524
1500
|
ensureStyle()
|
|
1525
1501
|
return h('div', { className: 'dsh-llm-hub-harness' },
|
|
1526
|
-
h('span', { className: 'dsh-llm-hub-
|
|
1502
|
+
h('span', { className: 'dsh-llm-hub-harness__title' }, t('harnessTitle')),
|
|
1527
1503
|
list.map((item) => {
|
|
1528
1504
|
const state = item.registered === true
|
|
1529
1505
|
? { text: t('harnessReady'), hint: t('harnessHintReady').replace('%s', String(item.id).replace(/-/g, '_')), ready: true }
|
|
@@ -1633,17 +1609,19 @@ window.__ModuleLoader__.load({
|
|
|
1633
1609
|
|
|
1634
1610
|
ensureStyle()
|
|
1635
1611
|
|
|
1612
|
+
const latencyClass = minLatency === null ? '' : (minLatency < 300 ? ' is-fast' : (minLatency < 800 ? ' is-normal' : ' is-slow'))
|
|
1613
|
+
|
|
1636
1614
|
return h('div', { className: 'dsh-llm-hub-hero' },
|
|
1637
|
-
h('div', { className: 'dsh-llm-hub-hero__card' },
|
|
1615
|
+
h('div', { className: 'dsh-llm-hub-hero__card dsh-llm-hub-hero__card--providers' },
|
|
1638
1616
|
h('span', { className: 'dsh-llm-hub-hero__num' }, totalProviders > 0 ? `${readyProviders} / ${totalProviders}` : '—'),
|
|
1639
1617
|
h('span', { className: 'dsh-llm-hub-hero__label' }, t('heroProviders'))),
|
|
1640
|
-
h('div', { className: 'dsh-llm-hub-hero__card' },
|
|
1618
|
+
h('div', { className: 'dsh-llm-hub-hero__card dsh-llm-hub-hero__card--models' },
|
|
1641
1619
|
h('span', { className: 'dsh-llm-hub-hero__num' }, totalModels > 0 ? `${totalModels}` : '—'),
|
|
1642
1620
|
h('span', { className: 'dsh-llm-hub-hero__label' }, t('heroModels'))),
|
|
1643
|
-
h('div', { className: 'dsh-llm-hub-hero__card' },
|
|
1621
|
+
h('div', { className: 'dsh-llm-hub-hero__card dsh-llm-hub-hero__card--latency' + latencyClass },
|
|
1644
1622
|
h('span', { className: 'dsh-llm-hub-hero__num' }, minLatency !== null ? `${minLatency}ms` : '—'),
|
|
1645
1623
|
h('span', { className: 'dsh-llm-hub-hero__label' }, t('heroFastest'))),
|
|
1646
|
-
h('div', { className: 'dsh-llm-hub-hero__card' },
|
|
1624
|
+
h('div', { className: 'dsh-llm-hub-hero__card dsh-llm-hub-hero__card--security' },
|
|
1647
1625
|
h('span', { className: 'dsh-llm-hub-hero__num' }, '🛡️ 100%'),
|
|
1648
1626
|
h('span', { className: 'dsh-llm-hub-hero__label' }, t('heroSecSafe'))))
|
|
1649
1627
|
}
|
|
@@ -2138,24 +2116,6 @@ window.__ModuleLoader__.load({
|
|
|
2138
2116
|
desc: '多模型网关、余额配额、多Key轮换与极客大屏',
|
|
2139
2117
|
repo: 'https://github.com/webkubor/dsh-llm-hub',
|
|
2140
2118
|
pkg: '@dsh-plugins/dsh-llm-hub'
|
|
2141
|
-
},
|
|
2142
|
-
{
|
|
2143
|
-
id: '@dsh-plugins/dsh-user-mirror',
|
|
2144
|
-
aliases: ['dsh-user-mirror', 'dsh-mirror', '@dsh-plugins/dsh-user-mirror'],
|
|
2145
|
-
name: 'User Mirror',
|
|
2146
|
-
icon: '🪞',
|
|
2147
|
-
desc: '用户角色数字画像、习惯偏好与记忆网络',
|
|
2148
|
-
repo: 'https://github.com/webkubor/dsh-mirror',
|
|
2149
|
-
pkg: '@dsh-plugins/dsh-user-mirror'
|
|
2150
|
-
},
|
|
2151
|
-
{
|
|
2152
|
-
id: '@dsh-plugins/dsh-env-inspector',
|
|
2153
|
-
aliases: ['dsh-env-inspector', '@dsh-plugins/dsh-env-inspector'],
|
|
2154
|
-
name: 'Env Inspector',
|
|
2155
|
-
icon: '🖥️',
|
|
2156
|
-
desc: '端口监听释放、CLI工具链与环境大屏',
|
|
2157
|
-
repo: 'https://github.com/webkubor/dsh-env-inspector',
|
|
2158
|
-
pkg: '@dsh-plugins/dsh-env-inspector'
|
|
2159
2119
|
}
|
|
2160
2120
|
]
|
|
2161
2121
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-plugins/dsh-llm-hub",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.9",
|
|
4
4
|
"description": "DSH 模型管理层:网关可达性探测、模型目录拉取、DeepSeek + MiniMax/智谱/Moonshot/StepFun 余额与配额、本月用量统计、余额预警、Provider 健康看板,再把本机装好的 codex / claude / agy 注册成子代理(装了才出现)。零运行时依赖,不改动 DSH 安装。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"preview": "npm run deploy && echo '部署完成 —— 到桌面端应用里重载页面(它不是浏览器,没有可 open 的 URL)'",
|
|
33
33
|
"check": "for f in lib/*.js; do node --check \"$f\" || exit 1; done",
|
|
34
34
|
"test": "node --test",
|
|
35
|
-
"prepublishOnly": "npm run check && npm test && node scripts/prepublish-gate.mjs && node scripts/readme-gate.mjs"
|
|
35
|
+
"prepublishOnly": "npm run check && npm test && node scripts/prepublish-gate.mjs && node scripts/readme-gate.mjs && node scripts/version-sync-gate.mjs"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
38
38
|
"dsh",
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* version-sync-gate —— 发版时的「版本号 → 文档」同步门禁
|
|
4
|
+
*
|
|
5
|
+
* 🔴 本文件是真源,只在这里改。各仓的拷贝用同步脚本下发:
|
|
6
|
+
* node $CORTEXOS_ROOT/scripts/check-release-gate-sync.mjs --fix
|
|
7
|
+
*
|
|
8
|
+
* ## 为什么需要它
|
|
9
|
+
*
|
|
10
|
+
* prepublish-gate 保证 CHANGELOG 有当前版本段、README 首屏合规,但**没有一条门禁
|
|
11
|
+
* 在发新版时把版本号同步进「记录当前版本」的文档**。于是出现最常见的老化:
|
|
12
|
+
* · 工作区台账 `vite-plugins/README.md` 版本列停在上个版本
|
|
13
|
+
* · 包自带的 SKILL.md frontmatter `version` 停在更早的版本(`cs skill validate` 会
|
|
14
|
+
* 因此标红 —— 仓打 tag 时 SKILL.md version 必须同步,这是 SKILL_SPEC 的强同步规则)
|
|
15
|
+
*
|
|
16
|
+
* 这与 prepublish-gate 的出发点相同:**约定没做成门禁,就会烂。**
|
|
17
|
+
*
|
|
18
|
+
* ## 设计取舍
|
|
19
|
+
*
|
|
20
|
+
* 仓库文档里有两类「版本相关的数字」,语义完全不同,必须分开对待:
|
|
21
|
+
*
|
|
22
|
+
* ① **台账版本列 + SKILL.md version** ——「这个插件当前是几版 / 这个 skill 是几版」,
|
|
23
|
+
* 语义就是 package.json 的 version,随发版**必须**同步。→ 自动改写。
|
|
24
|
+
* ② **功能引入版本**(文档站里 `0.10.0+` / `0.14.0+` 这类标记)——「这个功能
|
|
25
|
+
* 是哪个版本引入的」,语义是历史事实,**不随新版本变**。→ 绝不改写。
|
|
26
|
+
*
|
|
27
|
+
* ## 契约
|
|
28
|
+
* 契约 A 台账同步 —— 若 `<pkgRoot>/../README.md`(工作区台账)里有一行以该包名开头、
|
|
29
|
+
* 内嵌包名的表格行,则把该行尾部的版本号改写为 `package.json#version`。
|
|
30
|
+
* 找不到包对应行 → 拦(该插件没登记进分类台账)。
|
|
31
|
+
* 契约 B SKILL.md 同步 —— 若包根存在 `SKILL.md`,把其 frontmatter 的 `version:` 改写为
|
|
32
|
+
* `package.json#version`(版本号`## 如何同步 SKILL.md`)。缺 SKILL.md 时跳过(非必填)。
|
|
33
|
+
* 契约 C 可重复 —— A/B 改写后立即重复(同样的 version)仍为幂等,不产生 diff。
|
|
34
|
+
*
|
|
35
|
+
* 逃生舱:VERSION_SYNC_OFF=1 全跳过;VERSION_SYNC_DRY_RUN=1 只报告不改写(用于首次接入审计)。
|
|
36
|
+
*/
|
|
37
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs'
|
|
38
|
+
import { dirname, join } from 'node:path'
|
|
39
|
+
import { fileURLToPath } from 'node:url'
|
|
40
|
+
|
|
41
|
+
const GATE_VERSION = 4
|
|
42
|
+
const NAME = 'version-sync-gate'
|
|
43
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
44
|
+
// 目标包目录:可显式传参(多仓批处理/CI 用),默认取脚本所在目录的上一层(本脚本拷贝在 <pkg>/scripts/ 下)。
|
|
45
|
+
const targetArg = process.argv[2]
|
|
46
|
+
const pkgRoot = targetArg
|
|
47
|
+
? (targetArg.startsWith('/') || targetArg.startsWith('~') ? targetArg : join(process.cwd(), targetArg))
|
|
48
|
+
: dirname(here)
|
|
49
|
+
|
|
50
|
+
const errors = []
|
|
51
|
+
const notes = []
|
|
52
|
+
|
|
53
|
+
if (String(process.env.VERSION_SYNC_OFF).toLowerCase() === '1' ||
|
|
54
|
+
String(process.env.VERSION_SYNC_OFF).toLowerCase() === 'true') {
|
|
55
|
+
console.log(`[${NAME}] ↩ VERSION_SYNC_OFF=1 —— 跳过所有检查`)
|
|
56
|
+
process.exit(0)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const DRY_RUN = String(process.env.VERSION_SYNC_DRY_RUN).toLowerCase() === '1' ||
|
|
60
|
+
String(process.env.VERSION_SYNC_DRY_RUN).toLowerCase() === 'true'
|
|
61
|
+
|
|
62
|
+
const pkg = JSON.parse(readFileSync(join(pkgRoot, 'package.json'), 'utf8'))
|
|
63
|
+
const version = String(pkg.version ?? '')
|
|
64
|
+
if (!/^\d+\.\d+\.\d+$/.test(version)) {
|
|
65
|
+
console.error(`[${NAME}] ✖ package.json version 不是合法 SemVer: ${version}`)
|
|
66
|
+
process.exit(1)
|
|
67
|
+
}
|
|
68
|
+
const fileName = (pkg.name.split('/').pop() ?? '')
|
|
69
|
+
// 台账里包名可能以两种形式出现:去 scope 的目录名(`pkg/`)或完整 scope 名(`@scope/pkg`)。
|
|
70
|
+
const pkgNames = new Set([fileName, pkg.name])
|
|
71
|
+
|
|
72
|
+
// ── 契约 A:父目录台账版本列 ────────────────────────────────────────────────
|
|
73
|
+
const ledger = join(pkgRoot, '..', 'README.md')
|
|
74
|
+
if (existsSync(ledger)) {
|
|
75
|
+
const raw = readFileSync(ledger, 'utf8')
|
|
76
|
+
const lines = raw.split(/\r?\n/)
|
|
77
|
+
// 定位含 `[<包名>` 的表格行。行首链接可能用去 scope 的目录名 `[pkg/`,也可能用完整 scope 名 `[@scope/pkg/`。
|
|
78
|
+
const escFull = pkg.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
79
|
+
const rowLead = new Set([fileName, pkg.name])
|
|
80
|
+
const rowLeadAlt = [...rowLead].map(s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/\//g, '\\/')).join('|')
|
|
81
|
+
const rowRe = new RegExp(`^\\|\\s*\\[\\s*[\`](?:${rowLeadAlt})\\/?[\`]?`, 'i')
|
|
82
|
+
let idx = -1
|
|
83
|
+
for (let i = 0; i < lines.length; i++) { if (rowRe.test(lines[i])) { idx = i; break } }
|
|
84
|
+
if (idx < 0) {
|
|
85
|
+
// 台账整体是不是「版本表格」?不是的话,契约 A 对这个仓**不适用** ——
|
|
86
|
+
// 那种台账是组件清单(`- **\`pkg/\`**:说明」),本来就没有版本列可同步。
|
|
87
|
+
// 2026-10-28 之前这里一律报「没登记 → 拦」,于是 museav-cli 这种仓一装这道门禁
|
|
88
|
+
// 就永久 exit 1、发版直接卡死 —— 实际它压根没有需要同步的版本号
|
|
89
|
+
// (无 SKILL.md、台账行不带版本)。
|
|
90
|
+
// 「台账没有版本列」与「该仓漏登记进台账」是两回事,必须分开判。
|
|
91
|
+
const tableRows = lines.filter(l => /^\|.*\|/.test(l.trim()) && l.trim().length > 2)
|
|
92
|
+
if (tableRows.length === 0) {
|
|
93
|
+
// 台账不是表格格式 → 契约 A 不适用,跳过(不算失败)
|
|
94
|
+
console.log(`[${NAME}] · 台账 ${ledger} 不是版本表格格式(无表格行)—— 契约 A 不适用,跳过`)
|
|
95
|
+
} else {
|
|
96
|
+
errors.push(
|
|
97
|
+
`台账 ${ledger} 里没有 ${pkg.name} 对应行(判据:以 | [\`${fileName}/` + '` 开头的表格行)。\n' +
|
|
98
|
+
` → 该插件未登记进分类台账,或台账是老式 markdown 列表而非表格。发版后台账仍会是空的/旧的,先补登记。`
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
const row = lines[idx]
|
|
103
|
+
// 按表格单元拆分:| a | b | ... | → ["a","b",...]。单元内可能含 `code`、加粗、链接。
|
|
104
|
+
// 版本号不总是最后一行 token —— dsh 台账在第 4 列版本后面还有「谁在用」列。
|
|
105
|
+
// 判据:找到「剔除非字符后与包名一致」的那个单元,把它后面第一个纯 semver 单元当作版本列改写。
|
|
106
|
+
const cells = row.split('|').slice(1, -1).map(c => c.trim())
|
|
107
|
+
// 查找包名单元:该单元格以 Markdown 链接或裸名开头,且**不含 `]`**(链接单元格里 `](` 后是相对路径,
|
|
108
|
+
// 若把整格剥到只剩屏显文本再判,会把 `](new/` 当成分隔 —— 所以这里只看单元格前缀是否命中包名)。
|
|
109
|
+
const pkgNameEsc = (pkg.name.match(/[^/]+\/?$/) ?? [fileName])[0].replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
110
|
+
const nameRe = new RegExp(`^(?:${fileName}\\b|${pkgNameEsc}\\b|\\[\\s*[\`]?(?:${fileName}|${pkgNameEsc}))`, 'i')
|
|
111
|
+
let pkgCol = -1
|
|
112
|
+
for (let i = 0; i < cells.length; i++) {
|
|
113
|
+
if (nameRe.test(cells[i])) { pkgCol = i; break }
|
|
114
|
+
}
|
|
115
|
+
if (pkgCol < 0) {
|
|
116
|
+
errors.push(`台账行(第 ${idx + 1} 行)里没找到包名单元 ${pkg.name}: ${row}`)
|
|
117
|
+
} else {
|
|
118
|
+
// 从包名后面找「纯 semver」单元格(版本列)。版本号后面可能还有其它列(如「谁在用」),
|
|
119
|
+
// 也可能嵌在备注里(`0.14.0 起`/`1.5.3` 这种)——它必然带后续文字。
|
|
120
|
+
let verCol = -1
|
|
121
|
+
for (let i = pkgCol + 1; i < cells.length; i++) {
|
|
122
|
+
const c = cells[i]
|
|
123
|
+
// 剥掉反引号围栏后必须是纯 semver(`0.1.0` / 0.1.0 都认);museav` 这类带尾注的忽略
|
|
124
|
+
const verMatch = c.match(/^`?(\d+\.\d+\.\d+)`?$/)
|
|
125
|
+
if (verMatch) { verCol = i; break }
|
|
126
|
+
if (/^\d+\.\d+\.\d+/.test(c)) {
|
|
127
|
+
// 带后续文字/括号 → 不是版本列
|
|
128
|
+
const rest = c.replace(/^\d+\.\d+\.\d+/, '').trim()
|
|
129
|
+
if (rest === '' || /^[-_!#?]/.test(rest)) { verCol = i; break }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (verCol < 0) {
|
|
133
|
+
errors.push(`台账行(第 ${idx + 1} 行)里找不到版本列(${pkg.name} 包名后没有纯 semver 单元): ${row}`)
|
|
134
|
+
} else {
|
|
135
|
+
const oldV = cells[verCol]
|
|
136
|
+
// 按列改写而不是重组整行:cells 已经去了 trim 和围栏,重组会丢掉单元格内的反引号/链接。
|
|
137
|
+
// 逐步定位到目标单元格,只替换其内部版本号。
|
|
138
|
+
const segs = row.split('|')
|
|
139
|
+
let cellIdx = 0
|
|
140
|
+
for (let i = 1; i < segs.length - 1; i++) {
|
|
141
|
+
// 跳过边框(空)段;行为与 cells 的切分一一对应
|
|
142
|
+
if (i === 1 && segs[i].trim() === '') continue
|
|
143
|
+
if (cellIdx === verCol) {
|
|
144
|
+
segs[i] = segs[i].replace(/\d+\.\d+\.\d+/, version)
|
|
145
|
+
break
|
|
146
|
+
}
|
|
147
|
+
cellIdx++
|
|
148
|
+
}
|
|
149
|
+
const newRow = segs.join('|')
|
|
150
|
+
if (row !== newRow) {
|
|
151
|
+
notes.push(`台账行版本 ${oldV} → ${version}`)
|
|
152
|
+
if (!DRY_RUN) { lines[idx] = newRow; writeFileSync(ledger, lines.join('\n'), 'utf8') }
|
|
153
|
+
else notes.push(`(DRY_RUN:台账第 ${idx + 1} 行未落盘)`)
|
|
154
|
+
} else {
|
|
155
|
+
notes.push(`台账行已是 ${version},幂等无改动`)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
notes.push(`未发现父目录台账 ${ledger}(此包可能不在归类目录下)——跳过台账同步`)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ── 契约 B:包内 SKILL.md frontmatter version ──────────────────────────────
|
|
165
|
+
// SKILL_SPEC 强同步规则:仓打 tag 时 SKILL.md version 必须等于包版本,否则 cs skill validate 标红。
|
|
166
|
+
const skillPath = join(pkgRoot, 'SKILL.md')
|
|
167
|
+
if (existsSync(skillPath)) {
|
|
168
|
+
const skillText = readFileSync(skillPath, 'utf8')
|
|
169
|
+
const fmRe = /^(\s*version\s*:\s*)[^\s]+(\s*)$/m
|
|
170
|
+
if (fmRe.test(skillText)) {
|
|
171
|
+
const newText = skillText.replace(fmRe, (_, pre, post) => pre + version + post)
|
|
172
|
+
if (newText !== skillText) {
|
|
173
|
+
const oldV = skillText.match(fmRe)?.[0].trim()
|
|
174
|
+
notes.push(`SKILL.md frontmatter version ${oldV?.split(':').pop()?.trim()} → ${version}`)
|
|
175
|
+
if (!DRY_RUN) writeFileSync(skillPath, newText, 'utf8')
|
|
176
|
+
else notes.push(`(DRY_RUN:SKILL.md version 未落盘)`)
|
|
177
|
+
} else {
|
|
178
|
+
notes.push(`SKILL.md version 已是 ${version},幂等无改动`)
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
notes.push(`SKILL.md 没有 version 字段——SKILL_SPEC 要求必填,建议补充(本次不拦)`)
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
notes.push(`包根无 SKILL.md——跳过 SKILL version 同步(非必填)`)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ── 报告 ──────────────────────────────────────────────────────────────────
|
|
188
|
+
if (errors.length > 0) {
|
|
189
|
+
console.error(`\n[${NAME}] ${errors.length} 条契约不满足:\n`)
|
|
190
|
+
for (const e of errors) console.error(' ✖', e)
|
|
191
|
+
console.error(`\n[${NAME}] exit 1 → 发布中止。修完再推。`)
|
|
192
|
+
process.exit(1)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
console.log(`[${NAME}] ✓ ${pkg.name}@${version} 版本同步通过(gate v${GATE_VERSION})`)
|
|
196
|
+
if (DRY_RUN) console.log(`[${NAME}] · DRY_RUN 模式:只报告,未改写`)
|
|
197
|
+
for (const n of notes) console.log(`[${NAME}] · ${n}`)
|