dsh-pick 0.4.3 → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AIcivilization
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,5 +1,10 @@
1
1
  # dsh-pick
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/dsh-pick.svg?style=flat-square)](https://www.npmjs.com/package/dsh-pick)
4
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-pick.svg?style=flat-square)](https://www.npmjs.com/package/dsh-pick)
5
+ [![license](https://img.shields.io/npm/l/dsh-pick.svg?style=flat-square)](LICENSE)
6
+ [![Listed on dsh-plugin.org](https://dsh-plugin.org/badges/listed.svg)](https://dsh-plugin.org/plugins/aicivilization/dsh-pick)
7
+
3
8
  **帮你在 DSH 生态里选对插件。**
4
9
 
5
10
  说需求 → 找候选 → 多维比较 → 出结论。下载量只是证据,判断才算数。
@@ -10,6 +15,21 @@
10
15
 
11
16
  ---
12
17
 
18
+ ## 安装
19
+
20
+ ```sh
21
+ dsh plugin --profile web add dsh-pick # DSH 插件(推荐)
22
+ npm i -g dsh-pick # 命令行 / 独立网页
23
+ dsh plugin --profile web add github:AIcivilization/dsh-pick # 源码安装
24
+ ```
25
+
26
+ - **能力分类**:工具与能力(插件选购顾问)
27
+ - **运行要求**:Node.js ≥ 20;DSH web profile(右侧栏面板 + 设置页)
28
+ - **许可证**:[MIT](LICENSE)
29
+ - **数据边界**:只读公开的 npm API 和本仓库的每日目录,不外传任何数据
30
+
31
+ ---
32
+
13
33
  ## 为什么需要它
14
34
 
15
35
  npm 官网和各类 stat 站能看数字,但看数字回答不了「我该装哪个」。
@@ -64,6 +84,20 @@ dsh plugin --profile web add dsh-pick
64
84
 
65
85
  装不了的不给「安装」按钮,AI 工具的结果里也带着同样的提醒。
66
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
+
67
101
  **数据每天自动更新**:GitHub Actions 每天重建一次目录,推到本仓库的 `catalog` 分支。插件启动时、之后每 6 小时检查一次,有新的就下载到 `~/.dsh/dsh-pick/`(先走 jsDelivr,再走 raw.githubusercontent.com)。取不到就用包里自带的那份,不影响使用;设置页会写明当前用的是哪份。
68
102
 
69
103
  ### 作为命令行 / 独立网页
@@ -107,6 +141,8 @@ dsh-pick/
107
141
  ├── lib/
108
142
  │ ├── engine.js 数据引擎:抓目录、算指标、查询(一个引擎,多个入口)
109
143
  │ ├── remote.js 每日更新的目录:检查、下载、校验、换上
144
+ │ ├── github.js 插件仓库的 GitHub 数据(构建时批量查、刷新时实时查)
145
+ │ ├── boards.js 官方榜、社区榜、商店榜的数据(构建时抓,只解析不执行)
110
146
  │ ├── classify.js 13 类 + 其他,关键词加权分类
111
147
  │ ├── metrics.js 去噪指标:基线 / 增速 / 节奏 / 新鲜度 / 健康度
112
148
  │ ├── words.js 需求 → 搜索词(同义词 + 中文二元切分),CLI 与面板共用
@@ -133,12 +169,15 @@ dsh-pick/
133
169
 
134
170
  ## 数据口径
135
171
 
136
- - **来源**:`registry.npmjs.org`(元数据、版本发布历史)+ `api.npmjs.org/downloads`(下载量)
137
- - **滞后**: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 搜索接口(大约一天更新一次,和目录同一口径)
138
176
  - **覆盖**:npm 上带 `dsh-plugin` 关键字的 2,250 个包(search 接口深分页上限约 2,250)
139
177
  - **去噪范围**:只有周下载 Top 332 会抓 30 天日序列和发布历史,其余只有周/月下载量
140
178
  - **安装信息**:全部包都会读 npm 上最新版本的 manifest,记下有没有 `dsh.bundle`、客户端平台、声明的 DSH 版本要求
141
179
  - **更新频率**:每天一次(GitHub Actions,北京时间 10:30 左右)
180
+ - **GitHub 数据**:每日构建时用 GraphQL 批量查(Actions 自带的令牌);几个插件共用一个仓库时数据相同。排行榜里分「npm 榜」和「GitHub 榜」
142
181
  - **下载量口径**:含 CI、镜像源、爬虫、缓存回源等非人类流量,**不等于用户数**
143
182
 
144
183
  ---
@@ -200,4 +239,13 @@ npm run release -- patch -m "改了什么" --dry-run # 演练:只检查、
200
239
 
201
240
  ## 许可
202
241
 
203
- MIT
242
+ [MIT](LICENSE) · Copyright © 2026 AIcivilization
243
+
244
+ ---
245
+
246
+ ## 收录渠道
247
+
248
+ - [DSH Plugin Hub(dsh-plugin.org 社区插件市场)](https://dsh-plugin.org/plugins/aicivilization/dsh-pick)
249
+ - [awesome-dsh-plugin 精选列表](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
250
+ - dsh-plugin-shop 插件商店(每日自动收录)
251
+ - 52DSH / tuofangzhe 插件目录(证据分级收录)
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