@morehao/dsh-github-trending 0.8.22 → 0.8.23
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/client.js +48 -2
- package/lib/{chunk-SLY2RKCZ.js → chunk-DGEO5BHK.js} +21 -0
- package/lib/index.js +1 -1
- package/lib/internal.d.ts +23 -1
- package/lib/internal.js +1 -1
- package/package.json +2 -2
package/client.js
CHANGED
|
@@ -457,6 +457,14 @@ var DICT = {
|
|
|
457
457
|
"summarize.readmeChars": "README 摘录长度",
|
|
458
458
|
"summarize.readmeChars.help": "enrich 为 readme 时,每个仓库 README 摘录的最大字符数(超出截断)。",
|
|
459
459
|
"summarize.enrichNote": "外部增强需要只读 token:enrich=repo/readme 建议配置 GITHUB_READ_TOKEN(独立只读);readme 模式在网络慢时可能因预算耗尽跳过部分仓库(自动降级,不影响运行)。",
|
|
460
|
+
"card.observe.title": "本地观测库",
|
|
461
|
+
"observe.enabled": "启用观测库",
|
|
462
|
+
"observe.enabled.help": "每日记录候选仓库的 star 快照,用本地差分算出「今日新增」,不再依赖趋势页那行数字;关闭即回到「增量只来自趋势页」的旧行为。数据存在本机 $DSH_HOME,不进归档仓库。",
|
|
463
|
+
"observe.backfillDays": "回填天数",
|
|
464
|
+
"observe.backfillDays.help": "首次见到的仓库从 GitHub 历史接口回填多少天(0=不回填,从今天开始攒;上限 365)。",
|
|
465
|
+
"observe.maxCandidates": "候选上限",
|
|
466
|
+
"observe.maxCandidates.help": "单次运行最多记多少个候选仓库(越多覆盖越广、请求越多;建议 300,约 3 个批量请求/天)。",
|
|
467
|
+
"observe.disabledNote": "观测库已关闭:本次运行的「今日新增」仍来自趋势页/搜索,可能为 0。",
|
|
460
468
|
"card.releases.title": "订阅",
|
|
461
469
|
"card.releases.hint": "对应核心 releases.*(core 0.5.0+)",
|
|
462
470
|
"releases.includePrerelease": "含预发布",
|
|
@@ -1013,6 +1021,14 @@ var DICT = {
|
|
|
1013
1021
|
"summarize.readmeChars": "README excerpt chars",
|
|
1014
1022
|
"summarize.readmeChars.help": "Max README characters excerpted per repo when enrich=readme (longer text is truncated).",
|
|
1015
1023
|
"summarize.enrichNote": "Enrich needs a read-only token: enrich=repo/readme is best paired with GITHUB_READ_TOKEN (separate, read-only). In readme mode slow networks may skip some repos when the budget runs out (auto-degrades; the run is unaffected).",
|
|
1024
|
+
"card.observe.title": "Local observation store",
|
|
1025
|
+
"observe.enabled": "Enable observation store",
|
|
1026
|
+
"observe.enabled.help": 'Records a daily star snapshot of candidate repos and derives "stars today" from local diffs instead of the trending-page number; turn it off to fall back to the old "increment only from the trending page" behaviour. Data lives in $DSH_HOME, never in the archive repo.',
|
|
1027
|
+
"observe.backfillDays": "Backfill days",
|
|
1028
|
+
"observe.backfillDays.help": "How many days to backfill a first-seen repo from GitHub history (0 = no backfill, accumulate from today; max 365).",
|
|
1029
|
+
"observe.maxCandidates": "Candidate cap",
|
|
1030
|
+
"observe.maxCandidates.help": "Max candidate repos recorded per run (more = broader coverage and more requests; 300 ≈ 3 batch requests/day is recommended).",
|
|
1031
|
+
"observe.disabledNote": `Observation store is off: this run's "stars today" still comes from the trending page/search and may be 0.`,
|
|
1016
1032
|
"card.releases.title": "Subscriptions",
|
|
1017
1033
|
"card.releases.hint": "Maps to core releases.* (core 0.5.0+)",
|
|
1018
1034
|
"releases.includePrerelease": "Include pre-releases",
|
|
@@ -2242,7 +2258,7 @@ function sectionSlice(settings, section) {
|
|
|
2242
2258
|
case "auth":
|
|
2243
2259
|
return { github: settings.github };
|
|
2244
2260
|
case "scope":
|
|
2245
|
-
return { trending: settings.trending, schedule: settings.schedule, summarize: settings.summarize };
|
|
2261
|
+
return { trending: settings.trending, schedule: settings.schedule, summarize: settings.summarize, observe: settings.observe };
|
|
2246
2262
|
case "releases":
|
|
2247
2263
|
return { releases: settings.releases };
|
|
2248
2264
|
}
|
|
@@ -2730,6 +2746,8 @@ function SettingsView(props) {
|
|
|
2730
2746
|
)
|
|
2731
2747
|
)
|
|
2732
2748
|
);
|
|
2749
|
+
const observeOf = (s) => s.observe ?? { enabled: true, backfillDays: 30, maxCandidates: 300 };
|
|
2750
|
+
const observe = observeOf(draft);
|
|
2733
2751
|
const scopeCard = h(
|
|
2734
2752
|
Card,
|
|
2735
2753
|
{
|
|
@@ -2822,7 +2840,35 @@ function SettingsView(props) {
|
|
|
2822
2840
|
next.summarize.readmeChars = Math.round(Number(value) || 0);
|
|
2823
2841
|
}) })
|
|
2824
2842
|
),
|
|
2825
|
-
draft.summarize.enrich === "none" ? null : h(Alert, { kind: "warn" }, h("div", null, t("summarize.enrichNote")))
|
|
2843
|
+
draft.summarize.enrich === "none" ? null : h(Alert, { kind: "warn" }, h("div", null, t("summarize.enrichNote"))),
|
|
2844
|
+
// 本地 star 观测库(核心 observe.*):旧设置里可能还没有该字段,先取默认再编辑。
|
|
2845
|
+
// 观测库让「今日新增」来自本地每日快照的差分;关闭即回到「增量只来自趋势页」的旧行为。
|
|
2846
|
+
h("h4", { className: "dshgt-subhead" }, t("card.observe.title")),
|
|
2847
|
+
h(
|
|
2848
|
+
Row,
|
|
2849
|
+
{ label: t("observe.enabled"), help: t("observe.enabled.help") },
|
|
2850
|
+
h(Toggle, {
|
|
2851
|
+
checked: observe.enabled,
|
|
2852
|
+
onChange: (value) => update((next) => {
|
|
2853
|
+
next.observe = { ...observeOf(next), enabled: value };
|
|
2854
|
+
})
|
|
2855
|
+
})
|
|
2856
|
+
),
|
|
2857
|
+
h(
|
|
2858
|
+
Row,
|
|
2859
|
+
{ label: t("observe.backfillDays"), help: t("observe.backfillDays.help") },
|
|
2860
|
+
h(Input, { mono: true, width: 90, value: String(observe.backfillDays), onInput: (value) => update((next) => {
|
|
2861
|
+
next.observe = { ...observeOf(next), backfillDays: Math.round(Number(value) || 0) };
|
|
2862
|
+
}) })
|
|
2863
|
+
),
|
|
2864
|
+
h(
|
|
2865
|
+
Row,
|
|
2866
|
+
{ label: t("observe.maxCandidates"), help: t("observe.maxCandidates.help") },
|
|
2867
|
+
h(Input, { mono: true, width: 90, value: String(observe.maxCandidates), onInput: (value) => update((next) => {
|
|
2868
|
+
next.observe = { ...observeOf(next), maxCandidates: Math.round(Number(value) || 0) };
|
|
2869
|
+
}) })
|
|
2870
|
+
),
|
|
2871
|
+
observe.enabled ? null : h(Alert, { kind: "info" }, h("div", null, t("observe.disabledNote")))
|
|
2826
2872
|
);
|
|
2827
2873
|
const releaseSchedule = draft.releases.schedule ?? { enabled: false, weekday: 1, time: "08:00:00", timezone: "Asia/Shanghai" };
|
|
2828
2874
|
const releaseConcurrency = draft.releases.concurrency ?? "auto";
|
|
@@ -69,6 +69,7 @@ var DEFAULT_SETTINGS = {
|
|
|
69
69
|
enrichTimeoutSeconds: 5,
|
|
70
70
|
enrichBudgetSeconds: 8
|
|
71
71
|
},
|
|
72
|
+
observe: { enabled: true, backfillDays: 30, maxCandidates: 300 },
|
|
72
73
|
releases: {
|
|
73
74
|
includePrerelease: false,
|
|
74
75
|
includeDrafts: false,
|
|
@@ -102,6 +103,7 @@ function sectionOfField(field) {
|
|
|
102
103
|
if (field.startsWith("github.")) return "auth";
|
|
103
104
|
if (field.startsWith("trending.")) return "scope";
|
|
104
105
|
if (field.startsWith("summarize.")) return "summarize";
|
|
106
|
+
if (field.startsWith("observe.")) return "scope";
|
|
105
107
|
if (field.startsWith("releases.")) return "releases";
|
|
106
108
|
if (field.startsWith("schedule.")) return "schedule";
|
|
107
109
|
if (field === "corePath" || field === "coreAutoDownload" || field === "network.proxy") return "source";
|
|
@@ -128,6 +130,7 @@ function mergeSettingsSection(stored, incoming, section) {
|
|
|
128
130
|
break;
|
|
129
131
|
case "scope":
|
|
130
132
|
next.trending = incoming.trending;
|
|
133
|
+
next.observe = incoming.observe;
|
|
131
134
|
break;
|
|
132
135
|
case "summarize":
|
|
133
136
|
next.summarize = incoming.summarize;
|
|
@@ -171,6 +174,7 @@ function normalizeSettings(input) {
|
|
|
171
174
|
const github = raw.github ?? {};
|
|
172
175
|
const trending = raw.trending ?? {};
|
|
173
176
|
const summarize = raw.summarize ?? {};
|
|
177
|
+
const observe = raw.observe ?? {};
|
|
174
178
|
const releases = raw.releases ?? {};
|
|
175
179
|
const releasesSchedule = releases.schedule ?? {};
|
|
176
180
|
const output = raw.output ?? {};
|
|
@@ -225,6 +229,11 @@ function normalizeSettings(input) {
|
|
|
225
229
|
enrichTimeoutSeconds: Math.round(num(summarize.enrichTimeoutSeconds, DEFAULT_SETTINGS.summarize.enrichTimeoutSeconds)),
|
|
226
230
|
enrichBudgetSeconds: Math.round(num(summarize.enrichBudgetSeconds, DEFAULT_SETTINGS.summarize.enrichBudgetSeconds))
|
|
227
231
|
},
|
|
232
|
+
observe: {
|
|
233
|
+
enabled: bool(observe.enabled, DEFAULT_SETTINGS.observe.enabled),
|
|
234
|
+
backfillDays: Math.round(num(observe.backfillDays, DEFAULT_SETTINGS.observe.backfillDays)),
|
|
235
|
+
maxCandidates: Math.round(num(observe.maxCandidates, DEFAULT_SETTINGS.observe.maxCandidates))
|
|
236
|
+
},
|
|
228
237
|
releases: {
|
|
229
238
|
includePrerelease: bool(releases.includePrerelease, DEFAULT_SETTINGS.releases.includePrerelease),
|
|
230
239
|
includeDrafts: bool(releases.includeDrafts, DEFAULT_SETTINGS.releases.includeDrafts),
|
|
@@ -332,6 +341,13 @@ function validateSettings(settings, providers = CORE_PROVIDERS) {
|
|
|
332
341
|
if (!Number.isInteger(summarize.readmeChars) || summarize.readmeChars <= 0) {
|
|
333
342
|
problems.push({ field: "summarize.readmeChars", code: "CONFIG_INVALID", message: "readmeChars \u5FC5\u987B\u662F\u6B63\u6574\u6570" });
|
|
334
343
|
}
|
|
344
|
+
const { observe } = settings;
|
|
345
|
+
if (!Number.isInteger(observe.backfillDays) || observe.backfillDays < 0 || observe.backfillDays > 365) {
|
|
346
|
+
problems.push({ field: "observe.backfillDays", code: "CONFIG_INVALID", message: "backfillDays \u5FC5\u987B\u662F 0\u2013365 \u7684\u6574\u6570" });
|
|
347
|
+
}
|
|
348
|
+
if (!Number.isInteger(observe.maxCandidates) || observe.maxCandidates < 1 || observe.maxCandidates > 1e3) {
|
|
349
|
+
problems.push({ field: "observe.maxCandidates", code: "CONFIG_INVALID", message: "maxCandidates \u5FC5\u987B\u662F 1\u20131000 \u7684\u6574\u6570" });
|
|
350
|
+
}
|
|
335
351
|
if (releases.period !== "weekly") {
|
|
336
352
|
problems.push({
|
|
337
353
|
field: "releases.period",
|
|
@@ -422,6 +438,11 @@ function toCoreConfig(settings, apiKey, baseURLOverride, period, repoCount = 0)
|
|
|
422
438
|
enrichTimeoutSeconds: settings.summarize.enrichTimeoutSeconds,
|
|
423
439
|
enrichBudgetSeconds: settings.summarize.enrichBudgetSeconds
|
|
424
440
|
},
|
|
441
|
+
observe: {
|
|
442
|
+
enabled: settings.observe.enabled,
|
|
443
|
+
backfillDays: settings.observe.backfillDays,
|
|
444
|
+
maxCandidates: settings.observe.maxCandidates
|
|
445
|
+
},
|
|
425
446
|
releases: {
|
|
426
447
|
// 发版订阅常开:插件侧不再提供开关,是否产出由订阅列表决定。
|
|
427
448
|
enabled: true,
|
package/lib/index.js
CHANGED
package/lib/internal.d.ts
CHANGED
|
@@ -282,6 +282,21 @@ interface SummarizeSettings {
|
|
|
282
282
|
enrichTimeoutSeconds: number;
|
|
283
283
|
enrichBudgetSeconds: number;
|
|
284
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* 本地 star 观测库(核心 `observe.*`,core ≥ 0.8.8)。
|
|
287
|
+
* 观测库让「今日新增」来自本地每日快照的差分,而不是趋势页上的一行字;
|
|
288
|
+
* 默认开启,`enabled=false` 是回滚开关(回到「增量只来自趋势页」的旧行为)。
|
|
289
|
+
* 存储位置由核心自己解析到 `$DSH_HOME`(计划 D4),**不**在这里暴露,避免用户
|
|
290
|
+
* 把观测库指进归档仓库。
|
|
291
|
+
*/
|
|
292
|
+
interface ObserveSettings {
|
|
293
|
+
/** 是否启用观测库;关闭即回到旧行为(`starsInPeriod` 只来自趋势页/搜索)。 */
|
|
294
|
+
enabled: boolean;
|
|
295
|
+
/** 首次见到的仓库从历史接口回填多少天(0=不回填,从今天开始攒)。 */
|
|
296
|
+
backfillDays: number;
|
|
297
|
+
/** 单次运行最多记多少个候选仓库(上限 300,约 3 个 GraphQL 批量/天)。 */
|
|
298
|
+
maxCandidates: number;
|
|
299
|
+
}
|
|
285
300
|
/**
|
|
286
301
|
* 每周发版运行的插件侧节奏(核心没有这个字段,**绝不**写进核心 YAML)。
|
|
287
302
|
* 与榜单调度(`schedule.*`)完全独立:两者各有自己的开关与时间点。
|
|
@@ -345,6 +360,7 @@ interface Settings {
|
|
|
345
360
|
github: GithubSettings;
|
|
346
361
|
trending: TrendingSettings;
|
|
347
362
|
summarize: SummarizeSettings;
|
|
363
|
+
observe: ObserveSettings;
|
|
348
364
|
releases: ReleasesSettings;
|
|
349
365
|
output: OutputSettings;
|
|
350
366
|
schedule: ScheduleSettings;
|
|
@@ -432,6 +448,11 @@ interface CoreConfig {
|
|
|
432
448
|
enrichTimeoutSeconds: number;
|
|
433
449
|
enrichBudgetSeconds: number;
|
|
434
450
|
};
|
|
451
|
+
observe: {
|
|
452
|
+
enabled: boolean;
|
|
453
|
+
backfillDays: number;
|
|
454
|
+
maxCandidates: number;
|
|
455
|
+
};
|
|
435
456
|
releases: {
|
|
436
457
|
enabled: boolean;
|
|
437
458
|
includePrerelease: boolean;
|
|
@@ -480,6 +501,7 @@ type config_Enrich = Enrich;
|
|
|
480
501
|
type config_GithubSettings = GithubSettings;
|
|
481
502
|
type config_ModelSettings = ModelSettings;
|
|
482
503
|
type config_NetworkSettings = NetworkSettings;
|
|
504
|
+
type config_ObserveSettings = ObserveSettings;
|
|
483
505
|
type config_OutputSettings = OutputSettings;
|
|
484
506
|
declare const config_PERIODS: typeof PERIODS;
|
|
485
507
|
declare const config_PROVIDER_BASE_URLS: typeof PROVIDER_BASE_URLS;
|
|
@@ -508,7 +530,7 @@ declare const config_toCoreConfig: typeof toCoreConfig;
|
|
|
508
530
|
declare const config_toYaml: typeof toYaml;
|
|
509
531
|
declare const config_validateSettings: typeof validateSettings;
|
|
510
532
|
declare namespace config {
|
|
511
|
-
export { type config_AuthMode as AuthMode, config_CORE_PROVIDERS as CORE_PROVIDERS, type config_CommitMode as CommitMode, type config_CoreConfig as CoreConfig, config_DEFAULT_SETTINGS as DEFAULT_SETTINGS, type config_Enrich as Enrich, type config_GithubSettings as GithubSettings, type config_ModelSettings as ModelSettings, type config_NetworkSettings as NetworkSettings, type config_OutputSettings as OutputSettings, config_PERIODS as PERIODS, config_PROVIDER_BASE_URLS as PROVIDER_BASE_URLS, type config_PRSettings as PRSettings, type config_Period as Period, type config_Problem as Problem, type config_Provider as Provider, type config_ReleaseScheduleSettings as ReleaseScheduleSettings, type config_ReleasesSettings as ReleasesSettings, type config_RepoSettings as RepoSettings, config_SETTINGS_SECTIONS as SETTINGS_SECTIONS, type config_ScheduleSettings as ScheduleSettings, type config_Settings as Settings, type config_SettingsSection as SettingsSection, type config_Since as Since, type config_SummarizeSettings as SummarizeSettings, type config_TrendingSettings as TrendingSettings, config_effectiveBaseURL as effectiveBaseURL, config_isEnrich as isEnrich, config_isPeriod as isPeriod, config_isValidTimezone as isValidTimezone, config_mergeSettingsSection as mergeSettingsSection, config_normalizeSettings as normalizeSettings, config_sectionOfField as sectionOfField, config_toCoreConfig as toCoreConfig, config_toYaml as toYaml, config_validateSettings as validateSettings };
|
|
533
|
+
export { type config_AuthMode as AuthMode, config_CORE_PROVIDERS as CORE_PROVIDERS, type config_CommitMode as CommitMode, type config_CoreConfig as CoreConfig, config_DEFAULT_SETTINGS as DEFAULT_SETTINGS, type config_Enrich as Enrich, type config_GithubSettings as GithubSettings, type config_ModelSettings as ModelSettings, type config_NetworkSettings as NetworkSettings, type config_ObserveSettings as ObserveSettings, type config_OutputSettings as OutputSettings, config_PERIODS as PERIODS, config_PROVIDER_BASE_URLS as PROVIDER_BASE_URLS, type config_PRSettings as PRSettings, type config_Period as Period, type config_Problem as Problem, type config_Provider as Provider, type config_ReleaseScheduleSettings as ReleaseScheduleSettings, type config_ReleasesSettings as ReleasesSettings, type config_RepoSettings as RepoSettings, config_SETTINGS_SECTIONS as SETTINGS_SECTIONS, type config_ScheduleSettings as ScheduleSettings, type config_Settings as Settings, type config_SettingsSection as SettingsSection, type config_Since as Since, type config_SummarizeSettings as SummarizeSettings, type config_TrendingSettings as TrendingSettings, config_effectiveBaseURL as effectiveBaseURL, config_isEnrich as isEnrich, config_isPeriod as isPeriod, config_isValidTimezone as isValidTimezone, config_mergeSettingsSection as mergeSettingsSection, config_normalizeSettings as normalizeSettings, config_sectionOfField as sectionOfField, config_toCoreConfig as toCoreConfig, config_toYaml as toYaml, config_validateSettings as validateSettings };
|
|
512
534
|
}
|
|
513
535
|
|
|
514
536
|
declare const PLUGIN_DIR_NAME = "github-trending";
|
package/lib/internal.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morehao/dsh-github-trending",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.23",
|
|
4
4
|
"description": "GitHub 趋势日报的 DeepSeek Harness 插件:按日 / 周 / 月周期定时 spawn 本地 trendradar 核心,抓取 Trending、生成中文简介与周期总结,并可选把订阅仓库的新 Release 合成中文摘要,一起提交到你的仓库、自动开 PR 合并;内置概览 / 榜单 / 运行记录 / 订阅 / 设置工作台。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"core": {
|
|
62
62
|
"repo": "morehao/trendradar",
|
|
63
|
-
"version": "0.8.
|
|
63
|
+
"version": "0.8.8"
|
|
64
64
|
},
|
|
65
65
|
"client": {
|
|
66
66
|
"platform": "web",
|