dsh-github-hot 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +84 -2
- package/assets/icon.svg +7 -0
- package/cordis.patch.yml +12 -0
- package/lib/client.js +1857 -0
- package/lib/index.js +1750 -0
- package/package.json +54 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-github-hot contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-github-hot
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
给 DeepSeek Harness 的 **GitHub 涨星榜**插件:日/周/月三榜切换,展示每期涨星 **TOP20**,主打可视化。
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
|
|
7
|
+
- **日榜 / 周榜 / 月榜** 顶部一键切换,无需刷新页面
|
|
8
|
+
- **榜单视图**:每个项目一张卡片,含涨星数、名次徽章、语言与许可证标签、涨星曲线缩略图
|
|
9
|
+
- **详情**:点开任意项目,展示项目简介、星数历史曲线、期间涨星 / 起点星数 / 最新星数
|
|
10
|
+
- **统计视图**:把选中的多个项目曲线叠在一起对比(对数纵轴),勾选列表可切换对比对象
|
|
11
|
+
- **双主题**:深色(融入 DSH)与纸感贴纸风,右上角切换
|
|
12
|
+
|
|
13
|
+
## 数据来源
|
|
14
|
+
|
|
15
|
+
榜单数据来自 [Hysen Labs](https://hysenlabs.com) 的公开页面,无需 API key:
|
|
16
|
+
|
|
17
|
+
| 用途 | 地址 | 形式 |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| 日榜 / 月榜 | `/data/star-growth-24h.csv`、`/data/star-growth-30d.csv` | CSV |
|
|
20
|
+
| 周榜 TOP10 | `/weekly/{YYYY-MM-DD}` | HTML 解析 |
|
|
21
|
+
| 星数曲线 | `/chart/{slug}.svg` | SVG 路径解析 |
|
|
22
|
+
| 项目简介 | `/projects/{slug}` | HTML 解析 |
|
|
23
|
+
|
|
24
|
+
数据按 [CC BY 4.0](https://hysenlabs.com/ranking-methodology) 授权使用,界面底部与详情页均保留署名与外链。
|
|
25
|
+
|
|
26
|
+
## 安装
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
dsh plugin --profile desktop add dsh-github-hot
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
或从本地目录安装:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
dsh plugin --profile desktop add /path/to/dsh-github-hot
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
安装后重启 DeepSeek Harness,左侧栏出现「GitHub Hot」入口。
|
|
39
|
+
|
|
40
|
+
## 行为说明
|
|
41
|
+
|
|
42
|
+
1. **取数失败不编造**:某榜单取不到时明确显示失败原因与快照时间,不会用旧数据冒充新数据。
|
|
43
|
+
2. **简介不编造**:没有对应分析时显示「暂无简介」,不使用模型生成内容替代原文。
|
|
44
|
+
3. **解析失败即报错**:周榜 HTML 或曲线 SVG 无法解析时整段标记失败,不做模糊推断。
|
|
45
|
+
4. **周榜依赖页面结构**:上游页面改版可能导致周榜失效,此时更新 `parseWeeklyHtml` 即可;日榜与月榜走 CSV,稳定性更高。
|
|
46
|
+
|
|
47
|
+
## 缓存与请求频率
|
|
48
|
+
|
|
49
|
+
上游数据每天更新一次,因此缓存按自然日而非分钟设计:
|
|
50
|
+
|
|
51
|
+
| 内容 | 缓存位置 | 有效期 |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| 榜单 | 磁盘 `$DSH_HOME/dsh-github-hot/cache.json` | 跨自然日失效 |
|
|
54
|
+
| 项目详情与曲线 | 同上 | 跨自然日失效 |
|
|
55
|
+
| 简介中译 | 磁盘 `zh.json` | 原文变更时才重译 |
|
|
56
|
+
| 项目头像 | 磁盘 `avatars/`(上限 400) | 7 天 |
|
|
57
|
+
| 前端详情 | 浏览器 localStorage | 跨自然日失效 |
|
|
58
|
+
|
|
59
|
+
界面不做分钟级轮询,仅在页面跨过零点时静默刷新。出网请求按 host 分队列、限制并发,同一 URL 在途去重。
|
|
60
|
+
|
|
61
|
+
## 开发
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm test # 运行全部测试(部分用例会访问上游站点)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| 测试 | 覆盖内容 |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `parsers` | CSV / 周榜 HTML / 曲线 SVG 解析(对线上真实响应) |
|
|
70
|
+
| `detail` | 项目页简介提取 |
|
|
71
|
+
| `client` / `render` | 浏览器半侧注册契约与首帧渲染 |
|
|
72
|
+
| `visual` | 真实组件 + 真实数据的同构渲染 |
|
|
73
|
+
| `baseline` | 多曲线对比的基准日计算 |
|
|
74
|
+
| `avatar` | 头像 CDN 获取与磁盘缓存 |
|
|
75
|
+
| `cache` / `uicache` / `persist` | 缓存命中、前端缓存与跨重启持久化 |
|
|
76
|
+
| `smooth` | 曲线平滑算法 |
|
|
77
|
+
| `timezone` | 多时区日期一致性 |
|
|
78
|
+
| `lang` | 语言切换行为 |
|
|
79
|
+
| `concurrency` | 按 host 的并发调度 |
|
|
80
|
+
| `hardening` | 路径穿越、CSV 边界、缓存结构校验 |
|
|
81
|
+
| `resilience` | 畸形输入下的降级行为 |
|
|
82
|
+
|
|
83
|
+
## 许可
|
|
84
|
+
|
|
85
|
+
MIT
|
package/assets/icon.svg
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none">
|
|
2
|
+
<!-- 一条折线 + 末端箭头,和侧栏图标同款 -->
|
|
3
|
+
<path d="M3 17.5 L8.5 12 L12 15.5 L21 6.5" stroke="currentColor" stroke-width="2.2"
|
|
4
|
+
stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path d="M15.5 6.5 L21 6.5 L21 12" stroke="currentColor" stroke-width="2.2"
|
|
6
|
+
stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
+
</svg>
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# dsh-github-hot 的 bundle patch —— 把插件挂进 DSH 配置树
|
|
3
|
+
# ============================================================================
|
|
4
|
+
#
|
|
5
|
+
# 【约定】
|
|
6
|
+
# - id 必须全局唯一且与包名一致:宿主按它比对 entryId,裸名会与其它插件冲突。
|
|
7
|
+
# - 声明 id 的那一行不能写行尾注释,否则解析器无法取到值。
|
|
8
|
+
# ============================================================================
|
|
9
|
+
|
|
10
|
+
- insert:
|
|
11
|
+
- id: dsh-github-hot
|
|
12
|
+
name: 'dsh-github-hot'
|