dsh-pick 0.4.4 → 0.5.0

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/README.md CHANGED
@@ -84,6 +84,20 @@ dsh plugin --profile web add dsh-pick
84
84
 
85
85
  装不了的不给「安装」按钮,AI 工具的结果里也带着同样的提醒。
86
86
 
87
+ **一键加入监控**:搜索结果和各个榜单里,GitHub、npm 图标前面都有彩色的 **+**,点一下加入「我的监控」,变成 ✓;再点移出。只在 GitHub、没发到 npm 的插件也能加。
88
+
89
+ **5 个榜单**(排行榜顶部切换):
90
+
91
+ | 榜单 | 数据来源 | 排序 |
92
+ |---|---|---|
93
+ | npm 榜 | npm 下载统计,去噪后 | 日常基线 / 周下载 / 增速 / 健康度 |
94
+ | GitHub 榜 | 插件仓库,一个仓库一行 | 星标 / 最近提交 / Fork / 讨论 |
95
+ | 官方榜 | DeepSeek 官方包 `@deepseek-ai/dsh-official-bundles` | 周下载 |
96
+ | 社区榜 | [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)(非官方,dshmarket 也用它) | 星标 / 30 天下载 / 新上架 |
97
+ | 商店榜 | [dsh-plugin-shop](https://github.com/LivXue/dsh-plugin-shop)(第三方,非官方,没有下载量) | 星标 / 新上架 |
98
+
99
+ 社区榜、商店榜每个指标只保留前 100 名。AI 工具 `pick_rank` 加 `board` 参数也能查这三个榜。
100
+
87
101
  **数据每天自动更新**:GitHub Actions 每天重建一次目录,推到本仓库的 `catalog` 分支。插件启动时、之后每 6 小时检查一次,有新的就下载到 `~/.dsh/dsh-pick/`(先走 jsDelivr,再走 raw.githubusercontent.com)。取不到就用包里自带的那份,不影响使用;设置页会写明当前用的是哪份。
88
102
 
89
103
  ### 作为命令行 / 独立网页
@@ -127,6 +141,8 @@ dsh-pick/
127
141
  ├── lib/
128
142
  │ ├── engine.js 数据引擎:抓目录、算指标、查询(一个引擎,多个入口)
129
143
  │ ├── remote.js 每日更新的目录:检查、下载、校验、换上
144
+ │ ├── github.js 插件仓库的 GitHub 数据(构建时批量查、刷新时实时查)
145
+ │ ├── boards.js 官方榜、社区榜、商店榜的数据(构建时抓,只解析不执行)
130
146
  │ ├── classify.js 13 类 + 其他,关键词加权分类
131
147
  │ ├── metrics.js 去噪指标:基线 / 增速 / 节奏 / 新鲜度 / 健康度
132
148
  │ ├── words.js 需求 → 搜索词(同义词 + 中文二元切分),CLI 与面板共用
@@ -153,12 +169,15 @@ dsh-pick/
153
169
 
154
170
  ## 数据口径
155
171
 
156
- - **来源**:`registry.npmjs.org`(元数据、版本发布历史)+ `api.npmjs.org/downloads`(下载量)
157
- - **滞后**:npm 统计约滞后 5 天,页面显示的「数据截止」是最后一个已汇总的完整日
172
+ - **来源**:`registry.npmjs.org`(元数据、版本发布历史)+ `api.npmjs.org/downloads`(下载量)+ GitHub(星标、Fork、未关闭 issue / PR、最近提交、是否归档)
173
+ - **滞后**:npm 的每日下载只在一天结束后汇总,最近常晚好几天;页面上的「数据截止」是 npm 真实有数据的最后一天。任何工具都拿不到当天的下载量
174
+ - **npm 缺数据的日子**:npm 偶尔整天没出统计(全 npm 都是 0,比如 2026-10-13~15)。这些天记为缺失,不参与日常基线和环比的计算,页面底部会列出来
175
+ - **「我的监控」刷新**:版本号、发版时间、GitHub 数据是即时的;周下载取 npm 搜索接口(大约一天更新一次,和目录同一口径)
158
176
  - **覆盖**:npm 上带 `dsh-plugin` 关键字的 2,250 个包(search 接口深分页上限约 2,250)
159
177
  - **去噪范围**:只有周下载 Top 332 会抓 30 天日序列和发布历史,其余只有周/月下载量
160
178
  - **安装信息**:全部包都会读 npm 上最新版本的 manifest,记下有没有 `dsh.bundle`、客户端平台、声明的 DSH 版本要求
161
179
  - **更新频率**:每天一次(GitHub Actions,北京时间 10:30 左右)
180
+ - **GitHub 数据**:每日构建时用 GraphQL 批量查(Actions 自带的令牌);几个插件共用一个仓库时数据相同。排行榜里分「npm 榜」和「GitHub 榜」
162
181
  - **下载量口径**:含 CI、镜像源、爬虫、缓存回源等非人类流量,**不等于用户数**
163
182
 
164
183
  ---
package/bin/dsh-pick.js CHANGED
@@ -11,7 +11,7 @@ import { createServer } from 'node:http'
11
11
  import { readFile } from 'node:fs/promises'
12
12
  import { join, extname } from 'node:path'
13
13
  import { fileURLToPath } from 'node:url'
14
- import { buildCatalog, loadCatalog, searchByNeed, rank, stats, liveStats, normalize } from '../lib/engine.js'
14
+ import { buildCatalog, loadCatalog, searchByNeed, rank, stats, liveStats, parseWatchNames, normalize } from '../lib/engine.js'
15
15
 
16
16
  const PKG_ROOT = fileURLToPath(new URL('..', import.meta.url))
17
17
  const [, , cmd = 'help', ...rest] = process.argv
@@ -119,8 +119,7 @@ async function main() {
119
119
  if (p === '/') p = '/web/panel.html'
120
120
  // 「我的监控」的刷新:实时查 npm(和插件里的 /api-dsh-pick/live 一样)
121
121
  if (p === '/live') {
122
- const names = [...new Set((new URL(req.url, 'http://x').searchParams.get('names') || '').split(',')
123
- .map(s => s.trim()).filter(s => /^(@[a-z0-9._-]+\/)?[a-z0-9._-]+$/i.test(s)))].slice(0, 30)
122
+ const names = parseWatchNames(req.url)
124
123
  res.writeHead(names.length ? 200 : 400, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' })
125
124
  res.end(JSON.stringify(names.length ? await liveStats(names) : { error: '没有合法的包名' }))
126
125
  return