@morehao/dsh-github-trending 0.5.1 → 0.5.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.
- package/CHANGELOG.md +8 -0
- package/README.md +2 -2
- package/client.js +76 -28
- package/lib/{chunk-R7EUBUTS.js → chunk-6HITSHK6.js} +3 -1
- package/lib/index.js +1 -1
- package/lib/internal.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v0.5.2] - 2026-10-31
|
|
4
|
+
|
|
5
|
+
### 修复
|
|
6
|
+
|
|
7
|
+
- **代理模式下订阅页无法增删仓库**:`mode=proxy` 的设置里 `baseURL` 为空(运行期由回环代理注入),但核心 `config.Load` 仍按必填校验,订阅命令直接报 `config invalid: baseURL为必填字段`。现在生成订阅临时配置时补一个回环占位端点(订阅命令不调用模型),`list` / `add` / `remove` 恢复正常。
|
|
8
|
+
- **概览 Token 用量 / 发版订阅速览块排版错乱**:v0.5.0 新增的 `.dshgt-glance-*` 等类名没有对应样式,标签与数值挤成一行。补齐两张速览卡的布局;无用量 / 无发版数据时整卡隐藏,不再铺一排「—」。
|
|
9
|
+
- **运行记录 token 列错位**:行网格未给 token 列预留宽度,有 token 的记录会把文件数、耗时挤到错误列。按有无 token 切换列模板,窄屏同步适配;顺带补上发版明细与订阅页缺失的样式。
|
|
10
|
+
|
|
3
11
|
## [v0.5.1] - 2026-10-31
|
|
4
12
|
|
|
5
13
|
### 变更
|
package/README.md
CHANGED
|
@@ -48,13 +48,13 @@ dsh plugin --profile <profile> add @morehao/dsh-github-trending
|
|
|
48
48
|
- 「本次任务总量」= 榜单摘要阶段(`usage.totalTokens`)+ 发版订阅阶段(`releases.usage.totalTokens`),**订阅消耗计入总量**。
|
|
49
49
|
- 累计 = 历史里全部运行 `tokens` 之和,**读时求和、不落盘**(`history.json` 只存每次的 `tokens`)。
|
|
50
50
|
- 插件**不做费用估算、不内置定价表**(价格随 provider / 区域变动,易过期):只展示核心回报的 token 真值。
|
|
51
|
-
- 展示位置:概览速览块(本次 / 累计 / 新发版 / 订阅仓库数)、运行记录(每行本次 tokens、展开明细、页脚累计)、历史。数据来自契约 `Usage`。旧核心无 `usage` / `releases`
|
|
51
|
+
- 展示位置:概览速览块(本次 / 累计 / 新发版 / 订阅仓库数)、运行记录(每行本次 tokens、展开明细、页脚累计)、历史。数据来自契约 `Usage`。旧核心无 `usage` / `releases` 时对应速览块整体隐藏(不铺「—」、不伪造 0)。
|
|
52
52
|
|
|
53
53
|
## 发版订阅
|
|
54
54
|
|
|
55
55
|
- 订阅一组仓库,之后每次运行把每个仓库「**新增的 Release**(无 Release 时回退 Tag)」写成中文 changelog,渲染到 `<output.dir>/releases/`,与榜单**同分支、同 PR** 一起提交。发版阶段**常开**;没有订阅时不产出,既有榜单产物逐字节不变。
|
|
56
56
|
- **订阅列表随数据仓版本化**:文件在 `<repo>/<OutputRoot(output.dir)>/subscriptions.yaml`,随产物同一次 commit / PR,可审计、可复现。
|
|
57
|
-
- **插件不直接写仓**:列表经核心 `subscribe` IPC 命令读改——`add` / `remove` 只写 `.git/trendradar-subscriptions.pending`,下一次 `run` 切分支后落盘并随 artifact 提交。插件侧的子进程只做一次 stdin 交互:`RunRequest{command:"subscribe", action, repo?, configPath}`,`list` 的仓库由核心 stdout 逐行返回后插件解析。`configPath` 由插件生成(与 `run` 同源的临时配置),保证 `subscribe` 与 `run`
|
|
57
|
+
- **插件不直接写仓**:列表经核心 `subscribe` IPC 命令读改——`add` / `remove` 只写 `.git/trendradar-subscriptions.pending`,下一次 `run` 切分支后落盘并随 artifact 提交。插件侧的子进程只做一次 stdin 交互:`RunRequest{command:"subscribe", action, repo?, configPath}`,`list` 的仓库由核心 stdout 逐行返回后插件解析。`configPath` 由插件生成(与 `run` 同源的临时配置),保证 `subscribe` 与 `run` 解析到同一个订阅文件;代理模式下 `model.baseURL` 为空,临时配置补一个回环占位端点以通过核心 `config.Load`(订阅命令不调用模型)。
|
|
58
58
|
- 界面:「订阅」页管理列表(增删);「设置 → 发版订阅」分区放行为参数(含预发布 / 含草稿 / notes 截断,字段旁 `?` 悬浮说明),以及「管理订阅列表 →」入口。
|
|
59
59
|
- 周期独立:`releases.period` 默认 `daily`,不与 `trending.since` 联动。
|
|
60
60
|
- 历史里每条运行记录带 `releases` 摘要(仓库数 / 新发版 / 已摘要 / 降级 / 失败 / 跳过)与本次 `tokens`;旧核心没有 `releases` 块时缺省。
|
package/client.js
CHANGED
|
@@ -1058,6 +1058,7 @@ var CSS = `
|
|
|
1058
1058
|
.dshgt-fact-k{font-size:11.5px;color:var(--gt-muted);margin-bottom:2px;}
|
|
1059
1059
|
.dshgt-fact-v{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
|
1060
1060
|
.dshgt-block{display:flex;flex-direction:column;gap:8px;}
|
|
1061
|
+
.dshgt-block > .dshgt-btn{align-self:flex-start;}
|
|
1061
1062
|
.dshgt-section-label{display:flex;align-items:center;gap:9px;font-size:12px;color:var(--gt-muted);letter-spacing:.02em;}
|
|
1062
1063
|
.dshgt-section-label:after{content:"";height:1px;flex:1;background:color-mix(in srgb,var(--gt-border) 70%,transparent);}
|
|
1063
1064
|
.dshgt-section-tail{margin-left:auto;font-size:11.5px;color:var(--gt-muted);}
|
|
@@ -1147,6 +1148,19 @@ var CSS = `
|
|
|
1147
1148
|
.dshgt-overview-seg{margin-bottom:8px;}
|
|
1148
1149
|
.dshgt-overview-empty{padding:14px 2px;}
|
|
1149
1150
|
|
|
1151
|
+
/* 概览用量速览:Token / 发版两张卡,每卡两格;无数据时整卡不渲染。 */
|
|
1152
|
+
.dshgt-usage-glance{gap:8px;}
|
|
1153
|
+
.dshgt-glance-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px;}
|
|
1154
|
+
.dshgt-glance{border:1px solid var(--gt-border);border-radius:12px;padding:14px 16px 13px;background:var(--gt-card);display:flex;flex-direction:column;gap:10px;min-width:0;}
|
|
1155
|
+
.dshgt-glance-k{font-size:12px;color:var(--gt-muted);letter-spacing:.02em;}
|
|
1156
|
+
.dshgt-glance-vs{display:flex;gap:30px;flex-wrap:wrap;}
|
|
1157
|
+
.dshgt-glance-cell{display:flex;flex-direction:column;gap:2px;min-width:0;}
|
|
1158
|
+
.dshgt-glance-label{font-size:12px;color:var(--gt-muted);}
|
|
1159
|
+
.dshgt-glance-val{display:flex;align-items:baseline;gap:5px;min-width:0;}
|
|
1160
|
+
.dshgt-glance-num{font-size:22px;line-height:1.2;font-weight:650;letter-spacing:-.015em;color:var(--gt-fg);font-variant-numeric:tabular-nums;white-space:nowrap;}
|
|
1161
|
+
.dshgt-glance-unit{font-size:11.5px;color:var(--gt-muted);}
|
|
1162
|
+
.dshgt-glance-note{margin:0;}
|
|
1163
|
+
|
|
1150
1164
|
/* ——— 运行记录 ——— */
|
|
1151
1165
|
.dshgt-runs-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
|
|
1152
1166
|
.dshgt-runs-filter{display:flex;gap:4px;margin-left:auto;}
|
|
@@ -1158,6 +1172,8 @@ var CSS = `
|
|
|
1158
1172
|
.dshgt-run-what{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;}
|
|
1159
1173
|
.dshgt-run-muted{color:var(--gt-muted);font-size:12px;margin-left:6px;}
|
|
1160
1174
|
.dshgt-run-files,.dshgt-run-duration{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--gt-muted);text-align:right;}
|
|
1175
|
+
.dshgt-run-tokens{font-size:11.5px;color:var(--gt-muted);text-align:right;white-space:nowrap;}
|
|
1176
|
+
.dshgt-run-item.has-tokens .dshgt-run-row{grid-template-columns:18px 120px 56px minmax(0,1fr) 64px 78px 74px 20px;}
|
|
1161
1177
|
.dshgt-run-chev{color:var(--gt-muted);text-align:center;transition:transform .15s;}
|
|
1162
1178
|
.dshgt-run-item.open .dshgt-run-chev{transform:rotate(90deg);}
|
|
1163
1179
|
.dshgt-run-detail{padding:2px 6px 16px 30px;display:flex;flex-direction:column;gap:10px;}
|
|
@@ -1167,6 +1183,11 @@ var CSS = `
|
|
|
1167
1183
|
.dshgt-detail-v a{color:var(--gt-accent);text-decoration:none;}
|
|
1168
1184
|
.dshgt-detail-v a:hover{text-decoration:underline;}
|
|
1169
1185
|
.dshgt-run-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
|
|
1186
|
+
.dshgt-releases-detail{padding-top:10px;border-top:1px solid color-mix(in srgb,var(--gt-border) 70%,transparent);}
|
|
1187
|
+
.dshgt-releases-stats{display:flex;flex-wrap:wrap;gap:6px 20px;}
|
|
1188
|
+
.dshgt-releases-stat{display:inline-flex;align-items:baseline;gap:6px;}
|
|
1189
|
+
.dshgt-releases-stat .dshgt-hint{font-size:11.5px;}
|
|
1190
|
+
.dshgt-runs-foot{padding:4px 2px 0;text-align:right;}
|
|
1170
1191
|
|
|
1171
1192
|
/* ——— 日志抽屉 / 关于 ——— */
|
|
1172
1193
|
.dshgt-log-modal{max-width:820px;width:calc(100% - 32px);}
|
|
@@ -1199,6 +1220,20 @@ var CSS = `
|
|
|
1199
1220
|
.dshgt-about-status.err{color:var(--gt-err);}
|
|
1200
1221
|
.dshgt-about-actions{display:flex;align-items:center;gap:8px;flex:none;}
|
|
1201
1222
|
|
|
1223
|
+
/* ——— 订阅 ——— */
|
|
1224
|
+
.dshgt-subs-card{gap:10px;}
|
|
1225
|
+
.dshgt-subs-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;}
|
|
1226
|
+
.dshgt-subs-head h2{margin:0;font-size:15px;font-weight:600;}
|
|
1227
|
+
.dshgt-subs-head-actions{margin-left:auto;display:flex;gap:8px;}
|
|
1228
|
+
.dshgt-subs-list{border-top:1px solid var(--gt-border);}
|
|
1229
|
+
.dshgt-subs-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;min-height:44px;padding:0 4px;border-bottom:1px solid color-mix(in srgb,var(--gt-border) 70%,transparent);}
|
|
1230
|
+
.dshgt-subs-row-head{min-height:30px;font-size:11.5px;color:var(--gt-muted);}
|
|
1231
|
+
.dshgt-subs-repo{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;}
|
|
1232
|
+
.dshgt-subs-actions{display:flex;justify-content:flex-end;gap:6px;}
|
|
1233
|
+
.dshgt-subs-add{border:1px dashed var(--gt-border);border-radius:10px;padding:10px 12px;background:color-mix(in srgb,var(--gt-fg) 2%,var(--gt-bg));display:flex;flex-direction:column;gap:7px;}
|
|
1234
|
+
.dshgt-subs-add-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
|
|
1235
|
+
.dshgt-subs-add .dshgt-input{max-width:100%;}
|
|
1236
|
+
|
|
1202
1237
|
@media (max-width:1100px){
|
|
1203
1238
|
.dshgt-app{grid-template-columns:190px minmax(0,1fr);}
|
|
1204
1239
|
.dshgt-page-head{padding:18px 22px 12px;}
|
|
@@ -1208,6 +1243,7 @@ var CSS = `
|
|
|
1208
1243
|
.dshgt-week{flex-wrap:wrap;}
|
|
1209
1244
|
.dshgt-day{flex:1 1 88px;}
|
|
1210
1245
|
.dshgt-run-row{grid-template-columns:18px 104px 52px minmax(0,1fr) 70px 20px;}
|
|
1246
|
+
.dshgt-run-item.has-tokens .dshgt-run-row{grid-template-columns:18px 104px 52px minmax(0,1fr) 58px 70px 20px;}
|
|
1211
1247
|
.dshgt-run-files{display:none;}
|
|
1212
1248
|
.dshgt-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
|
|
1213
1249
|
.dshgt-dateselect{min-width:180px;}
|
|
@@ -2626,6 +2662,28 @@ function readyRows(t, state) {
|
|
|
2626
2662
|
}
|
|
2627
2663
|
];
|
|
2628
2664
|
}
|
|
2665
|
+
function glanceCell(label, value, unit) {
|
|
2666
|
+
return h(
|
|
2667
|
+
"div",
|
|
2668
|
+
{ className: "dshgt-glance-cell" },
|
|
2669
|
+
h("span", { className: "dshgt-glance-label" }, label),
|
|
2670
|
+
h(
|
|
2671
|
+
"span",
|
|
2672
|
+
{ className: "dshgt-glance-val" },
|
|
2673
|
+
h("span", { className: "dshgt-glance-num dshgt-mono" }, value),
|
|
2674
|
+
unit === void 0 ? null : h("span", { className: "dshgt-glance-unit" }, unit)
|
|
2675
|
+
)
|
|
2676
|
+
);
|
|
2677
|
+
}
|
|
2678
|
+
function glanceCard(title, cells) {
|
|
2679
|
+
if (cells.length === 0) return null;
|
|
2680
|
+
return h(
|
|
2681
|
+
"div",
|
|
2682
|
+
{ className: "dshgt-glance" },
|
|
2683
|
+
h("div", { className: "dshgt-glance-k" }, title),
|
|
2684
|
+
h("div", { className: "dshgt-glance-vs" }, cells)
|
|
2685
|
+
);
|
|
2686
|
+
}
|
|
2629
2687
|
function OverviewView(props) {
|
|
2630
2688
|
const { t, lang, store, controller } = props;
|
|
2631
2689
|
const state = store.state;
|
|
@@ -2649,6 +2707,21 @@ function OverviewView(props) {
|
|
|
2649
2707
|
const todayHasDaily = groupMap.get("daily")?.days.some((day) => day.date === today) ?? false;
|
|
2650
2708
|
const showWaiting = period === "daily" && !todayHasDaily && state.schedule.enabled;
|
|
2651
2709
|
const lastTarget = last === null ? void 0 : digestTarget(last, timeZone);
|
|
2710
|
+
const lastTokens = last?.tokens;
|
|
2711
|
+
const releases = last?.releases;
|
|
2712
|
+
const totalTokens = state.status.totalTokens;
|
|
2713
|
+
const tokenCells = [
|
|
2714
|
+
...lastTokens === void 0 ? [] : [glanceCell(t("overview.tokens.thisRun"), formatTokens(lastTokens), "tokens")],
|
|
2715
|
+
...totalTokens === void 0 ? [] : [glanceCell(t("overview.tokens.total"), formatTokens(totalTokens), "tokens")]
|
|
2716
|
+
];
|
|
2717
|
+
const releaseCells = releases === void 0 ? [] : [
|
|
2718
|
+
glanceCell(t("overview.releases.new"), String(releases.newReleases)),
|
|
2719
|
+
glanceCell(t("overview.releases.repos"), String(releases.repos))
|
|
2720
|
+
];
|
|
2721
|
+
const glanceCards = [
|
|
2722
|
+
glanceCard(t("overview.tokens.title"), tokenCells),
|
|
2723
|
+
glanceCard(t("overview.releases.title"), releaseCells)
|
|
2724
|
+
].filter((card) => card !== null);
|
|
2652
2725
|
return h(
|
|
2653
2726
|
"div",
|
|
2654
2727
|
{ className: "dshgt-view dshgt-overview" },
|
|
@@ -2721,35 +2794,10 @@ function OverviewView(props) {
|
|
|
2721
2794
|
h("div", { className: "dshgt-fact" }, h("div", { className: "dshgt-fact-k" }, t("overview.model")), h("div", { className: "dshgt-fact-v" }, last.model?.model ?? "—"))
|
|
2722
2795
|
)
|
|
2723
2796
|
),
|
|
2724
|
-
h(
|
|
2797
|
+
glanceCards.length === 0 ? null : h(
|
|
2725
2798
|
"section",
|
|
2726
2799
|
{ className: "dshgt-block dshgt-usage-glance" },
|
|
2727
|
-
h(
|
|
2728
|
-
"div",
|
|
2729
|
-
{ className: "dshgt-glance-grid" },
|
|
2730
|
-
h(
|
|
2731
|
-
"div",
|
|
2732
|
-
{ className: "dshgt-glance" },
|
|
2733
|
-
h("div", { className: "dshgt-glance-k" }, t("overview.tokens.title")),
|
|
2734
|
-
h(
|
|
2735
|
-
"div",
|
|
2736
|
-
{ className: "dshgt-glance-vs" },
|
|
2737
|
-
h("div", { className: "dshgt-glance-cell" }, h("span", { className: "dshgt-hint" }, t("overview.tokens.thisRun")), h("span", { className: "dshgt-glance-num dshgt-mono" }, last?.tokens === void 0 ? "—" : formatTokens(last.tokens)), h("span", { className: "dshgt-hint" }, "tokens")),
|
|
2738
|
-
h("div", { className: "dshgt-glance-cell" }, h("span", { className: "dshgt-hint" }, t("overview.tokens.total")), h("span", { className: "dshgt-glance-num dshgt-mono" }, state.status.totalTokens === void 0 ? "—" : formatTokens(state.status.totalTokens)), h("span", { className: "dshgt-hint" }, "tokens"))
|
|
2739
|
-
)
|
|
2740
|
-
),
|
|
2741
|
-
h(
|
|
2742
|
-
"div",
|
|
2743
|
-
{ className: "dshgt-glance" },
|
|
2744
|
-
h("div", { className: "dshgt-glance-k" }, t("overview.releases.title")),
|
|
2745
|
-
h(
|
|
2746
|
-
"div",
|
|
2747
|
-
{ className: "dshgt-glance-vs" },
|
|
2748
|
-
h("div", { className: "dshgt-glance-cell" }, h("span", { className: "dshgt-hint" }, t("overview.releases.new")), h("span", { className: "dshgt-glance-num dshgt-mono" }, last?.releases === void 0 ? "—" : String(last.releases.newReleases))),
|
|
2749
|
-
h("div", { className: "dshgt-glance-cell" }, h("span", { className: "dshgt-hint" }, t("overview.releases.repos")), h("span", { className: "dshgt-glance-num dshgt-mono" }, last?.releases === void 0 ? "—" : String(last.releases.repos)))
|
|
2750
|
-
)
|
|
2751
|
-
)
|
|
2752
|
-
),
|
|
2800
|
+
h("div", { className: "dshgt-glance-grid" }, glanceCards),
|
|
2753
2801
|
h("p", { className: "dshgt-hint dshgt-glance-note" }, t("overview.tokens.note"))
|
|
2754
2802
|
),
|
|
2755
2803
|
h(
|
|
@@ -2993,7 +3041,7 @@ function RunsView(props) {
|
|
|
2993
3041
|
const pr = prStatus(t, state, record);
|
|
2994
3042
|
return h(
|
|
2995
3043
|
"div",
|
|
2996
|
-
{ className: `dshgt-run-item${open ? " open" : ""}`, key: record.id },
|
|
3044
|
+
{ className: `dshgt-run-item${open ? " open" : ""}${record.tokens === void 0 ? "" : " has-tokens"}`, key: record.id },
|
|
2997
3045
|
h(
|
|
2998
3046
|
"button",
|
|
2999
3047
|
{
|
|
@@ -3414,10 +3414,12 @@ var REPO_PATTERN2 = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
|
3414
3414
|
function isValidRepo(repo) {
|
|
3415
3415
|
return REPO_PATTERN2.test(repo.trim());
|
|
3416
3416
|
}
|
|
3417
|
+
var SUBSCRIBE_PLACEHOLDER_BASE_URL = "http://127.0.0.1:9/v1";
|
|
3417
3418
|
function writeTempConfig(settings) {
|
|
3418
3419
|
const dir = mkdtempSync2(path11.join(os4.tmpdir(), "dsh-subscribe-"));
|
|
3419
3420
|
const file = path11.join(dir, "config.yml");
|
|
3420
|
-
const
|
|
3421
|
+
const placeholder = effectiveBaseURL(settings.model) === "" ? SUBSCRIBE_PLACEHOLDER_BASE_URL : void 0;
|
|
3422
|
+
const yaml = `${toYaml(toCoreConfig(settings, "", placeholder))}
|
|
3421
3423
|
`;
|
|
3422
3424
|
writeFileSync2(file, yaml, { mode: 384 });
|
|
3423
3425
|
return { file, dir };
|
package/lib/index.js
CHANGED
package/lib/internal.js
CHANGED