Sfoglia il codice sorgente

github-trending: 仓库元数据增加今日涨星 todayStars

RepoMetaSchema 增加可选 todayStars 字段;采集器将其写入结构化 repo-meta 块(此前仅以 Today: +N 文本呈现),供首屏与视频按今日涨星排序。

Co-Authored-By: Claude <noreply@anthropic.com>
lkatzey 5 giorni fa
parent
commit
54fa83f064

+ 4 - 0
packages/collect/src/collectors/github-trending.ts

@@ -46,6 +46,10 @@ class GitHubTrendingCollector implements DataSource {
         stars: repo.stars,
         forks: repo.forks,
         license: "",
+        // Today's star gain, carried as structured data so the cover scene can
+        // render "+N" per repo. (Also emitted as a `Today: +N` text line below
+        // as a human-readable fallback the LLM can read if this is absent.)
+        todayStars: repo.currentPeriodStars ?? undefined,
       };
       lines.push(`<!-- repo-meta: ${JSON.stringify(meta)} -->`);
 

+ 5 - 0
packages/shared/src/types/scene.ts

@@ -42,6 +42,11 @@ export const RepoMetaSchema = z.object({
   stars: z.number().optional(),
   forks: z.number().optional(),
   license: z.string().optional(),
+  // Today's star gain (currentPeriodStars from the trending API). Emitted into
+  // the structured repo-meta block by the collector so the cover scene can show
+  // "+N" per repo. Nested inside github.repo, so it flows through compose/render
+  // automatically (github is passed whole-object) — no extra plumbing needed.
+  todayStars: z.number().optional(),
 });
 
 export type RepoMeta = z.infer<typeof RepoMetaSchema>;