dsh-crate 0.0.0-stage → 0.5.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.
Files changed (132) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +288 -2
  3. package/README.zh.md +263 -0
  4. package/UPDATE-API-V1.md +207 -0
  5. package/assets/logo.svg +37 -0
  6. package/client/client.js +18964 -0
  7. package/cordis.patch.yml +4 -0
  8. package/lib/accelerate.js +194 -0
  9. package/lib/agents.js +67 -0
  10. package/lib/backup.js +688 -0
  11. package/lib/body-progress.js +173 -0
  12. package/lib/catalog-local-match.js +160 -0
  13. package/lib/catalog-npm.js +180 -0
  14. package/lib/changelog.js +462 -0
  15. package/lib/channels.js +64 -0
  16. package/lib/check.js +1557 -0
  17. package/lib/compatibility.js +265 -0
  18. package/lib/crate-catalog.js +179 -0
  19. package/lib/diagnostics.js +49 -0
  20. package/lib/discovery-compatibility.js +476 -0
  21. package/lib/drain-journal.js +164 -0
  22. package/lib/drain.js +1043 -0
  23. package/lib/dsh-cli.js +1373 -0
  24. package/lib/dsh-install.js +259 -0
  25. package/lib/entry-identity.js +85 -0
  26. package/lib/gist.js +369 -0
  27. package/lib/groups.js +108 -0
  28. package/lib/home-paths.js +29 -0
  29. package/lib/host-recovery.js +187 -0
  30. package/lib/hot.js +918 -0
  31. package/lib/http.js +252 -0
  32. package/lib/index.js +394 -0
  33. package/lib/install.js +1147 -0
  34. package/lib/lifecycle.js +37 -0
  35. package/lib/log-redaction.js +24 -0
  36. package/lib/log.js +204 -0
  37. package/lib/ndjson.js +154 -0
  38. package/lib/net.js +174 -0
  39. package/lib/official-desktop.js +619 -0
  40. package/lib/order.js +284 -0
  41. package/lib/patch.js +943 -0
  42. package/lib/pending-rows.js +142 -0
  43. package/lib/pending-updates.js +346 -0
  44. package/lib/pnpm-compat.js +972 -0
  45. package/lib/presets.js +282 -0
  46. package/lib/probe-context.js +20 -0
  47. package/lib/proc-text.js +69 -0
  48. package/lib/profile.js +1989 -0
  49. package/lib/recovery.js +1059 -0
  50. package/lib/region-probe.js +93 -0
  51. package/lib/regions.js +283 -0
  52. package/lib/registry.js +308 -0
  53. package/lib/release-candidates.js +115 -0
  54. package/lib/release-updates.js +70 -0
  55. package/lib/restart.js +688 -0
  56. package/lib/routes.js +7960 -0
  57. package/lib/settings.js +164 -0
  58. package/lib/shelfry-catalog.js +179 -0
  59. package/lib/snapshot.js +506 -0
  60. package/lib/source-migration.js +164 -0
  61. package/lib/sources.js +1005 -0
  62. package/lib/state.js +38 -0
  63. package/lib/store.js +163 -0
  64. package/lib/themes.js +350 -0
  65. package/lib/trial.js +125 -0
  66. package/lib/types/accelerate.d.ts +85 -0
  67. package/lib/types/agents.d.ts +52 -0
  68. package/lib/types/backup.d.ts +171 -0
  69. package/lib/types/body-progress.d.ts +94 -0
  70. package/lib/types/catalog-local-match.d.ts +39 -0
  71. package/lib/types/catalog-npm.d.ts +77 -0
  72. package/lib/types/changelog.d.ts +131 -0
  73. package/lib/types/channels.d.ts +56 -0
  74. package/lib/types/check.d.ts +381 -0
  75. package/lib/types/compatibility.d.ts +83 -0
  76. package/lib/types/crate-catalog.d.ts +48 -0
  77. package/lib/types/diagnostics.d.ts +29 -0
  78. package/lib/types/discovery-compatibility.d.ts +145 -0
  79. package/lib/types/drain-journal.d.ts +25 -0
  80. package/lib/types/drain.d.ts +306 -0
  81. package/lib/types/dsh-cli.d.ts +481 -0
  82. package/lib/types/dsh-install.d.ts +106 -0
  83. package/lib/types/entry-identity.d.ts +68 -0
  84. package/lib/types/gist.d.ts +79 -0
  85. package/lib/types/groups.d.ts +34 -0
  86. package/lib/types/home-paths.d.ts +13 -0
  87. package/lib/types/host-recovery.d.ts +95 -0
  88. package/lib/types/hot.d.ts +434 -0
  89. package/lib/types/http.d.ts +114 -0
  90. package/lib/types/index.d.ts +52 -0
  91. package/lib/types/install.d.ts +463 -0
  92. package/lib/types/lifecycle.d.ts +14 -0
  93. package/lib/types/log-redaction.d.ts +2 -0
  94. package/lib/types/log.d.ts +43 -0
  95. package/lib/types/ndjson.d.ts +52 -0
  96. package/lib/types/net.d.ts +94 -0
  97. package/lib/types/official-desktop.d.ts +59 -0
  98. package/lib/types/order.d.ts +100 -0
  99. package/lib/types/patch.d.ts +218 -0
  100. package/lib/types/pending-rows.d.ts +81 -0
  101. package/lib/types/pending-updates.d.ts +161 -0
  102. package/lib/types/pnpm-compat.d.ts +102 -0
  103. package/lib/types/presets.d.ts +94 -0
  104. package/lib/types/probe-context.d.ts +14 -0
  105. package/lib/types/proc-text.d.ts +29 -0
  106. package/lib/types/profile.d.ts +551 -0
  107. package/lib/types/recovery.d.ts +342 -0
  108. package/lib/types/region-probe.d.ts +50 -0
  109. package/lib/types/regions.d.ts +134 -0
  110. package/lib/types/registry.d.ts +160 -0
  111. package/lib/types/release-candidates.d.ts +42 -0
  112. package/lib/types/release-updates.d.ts +15 -0
  113. package/lib/types/restart.d.ts +279 -0
  114. package/lib/types/routes.d.ts +130 -0
  115. package/lib/types/settings.d.ts +112 -0
  116. package/lib/types/shelfry-catalog.d.ts +48 -0
  117. package/lib/types/snapshot.d.ts +93 -0
  118. package/lib/types/source-migration.d.ts +100 -0
  119. package/lib/types/sources.d.ts +391 -0
  120. package/lib/types/state.d.ts +20 -0
  121. package/lib/types/store.d.ts +47 -0
  122. package/lib/types/themes.d.ts +46 -0
  123. package/lib/types/trial.d.ts +61 -0
  124. package/lib/types/update-api-v1.d.ts +83 -0
  125. package/lib/types/updates.d.ts +273 -0
  126. package/lib/types/verify.d.ts +277 -0
  127. package/lib/update-api-v1.js +273 -0
  128. package/lib/updates.js +981 -0
  129. package/lib/verify.js +930 -0
  130. package/locale/en.json +5 -0
  131. package/locale/zh.json +6 -0
  132. package/package.json +113 -4
package/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 fkysly and dsh-market contributors
4
+ Copyright (c) 2026 dsh-crate contributors
5
+
6
+ This project is a modified derivative of dsh-market
7
+ (https://github.com/dsh-market/dsh-market), with its catalog source
8
+ replaced by dshcrate. The original MIT notice above is retained as the
9
+ license requires.
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,289 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img src="assets/logo.svg" width="96" alt="dsh-crate logo">
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ # dsh-crate
6
+
7
+ English | [中文](README.zh.md)
8
+
9
+ **Plugin Crate**: a plugin market that lives inside DeepSeek Harness. No more
10
+ digging through GitHub topics, guessing which repos actually install, and
11
+ copy-pasting commands into a terminal — open the Plugins page, browse, read, and
12
+ install in one click.
13
+
14
+ On dsh 0.2.1+ it is a tab on the **Plugins** page next to **Installed**; older
15
+ hosts reach it from Settings → **Crate Market**.
16
+
17
+ Prefer not to install another plugin? Add `https://dshcrate.com/data/index.json`
18
+ under Plugins → Discover → Index sources and the same catalog shows up in the
19
+ official Discover tab; just want to look around? Open
20
+ [dshcrate.com](https://dshcrate.com).
21
+
22
+ ![Plugin Crate](assets/demo-en.png)
23
+
24
+ ## Why install it
25
+
26
+ The DSH plugin ecosystem grows fast, but finding plugins still means "search a
27
+ repo, read the README, copy the command". Plugin Crate folds that into one
28
+ screen:
29
+
30
+ - **One place to browse**: 30k+ entries covering plugins, skills, themes and
31
+ standalone tools;
32
+ - **Understand before installing**: every entry has a description, stars,
33
+ last-updated date and install method, with screenshots and comments on the card;
34
+ - **Manage it where you install it**: install, update, uninstall, enable/disable
35
+ and group plugins on the same page, without bouncing back to a terminal.
36
+
37
+ ## Features
38
+
39
+ **Browse and search**
40
+
41
+ - Full-catalog search with category filters and star sorting
42
+ - Descriptions follow your UI language (Chinese or English)
43
+ - Cards carry screenshots and comments; theme entries show what they look like
44
+
45
+ **Install and manage**
46
+
47
+ - One-click install with live download and build progress
48
+ - Per-plugin update checks with a "What changed" link
49
+ - Favorites, groups, and a one-line note per plugin; groups switch as a unit
50
+ - Uninstall, hot enable/disable, and a one-click restart when a change cannot
51
+ hot-load
52
+
53
+ **Stability and recovery**
54
+
55
+ - Selectable GitHub download routes for the China region
56
+ - An "Adjust plugins" recovery page when a bad config keeps the UI from booting
57
+ - A diagnostics page for load order and conflicts, plus sanitized log export
58
+ - Backup and restore: local JSON, WebDAV, or a private GitHub Gist
59
+
60
+ **Settings**
61
+
62
+ - Download region, GitHub acceleration, release channel, entry point and build
63
+ environment are all editable in the UI
64
+ - A dedicated settings card manages the market itself; `allowRestart` and
65
+ `buildEnv` can also live in the profile config
66
+
67
+ ## Inside Settings
68
+
69
+ The market also opens from Settings: pick **Plugin Crate** on the left and the
70
+ full Discover page shows up on the right. Plugins, skills and themes all live in
71
+ the same catalog, and installed themes apply without a restart.
72
+
73
+ ![Plugin Crate inside Settings](assets/themes-en.png)
74
+
75
+ ## Upstream and attribution
76
+
77
+ This project is **not original work**. It is a modified derivative of
78
+ [dsh-market](https://github.com/dsh-market/dsh-market) by fkysly and its
79
+ contributors. The catalog is maintained independently by **dshcrate**; its size
80
+ and coverage are not the same data as upstream.
81
+
82
+ What we changed on top of upstream:
83
+
84
+ - The catalog now comes from dshcrate: more entries (30k+, refreshed daily), plus
85
+ categories, themes, scores, and bilingual descriptions;
86
+ - Catalog parsing and mapping were rewritten for dshcrate's own data shape, with
87
+ matching UI and interaction adjustments;
88
+ - Theme entries and score/category fields were added;
89
+ - Everything else largely follows upstream.
90
+
91
+ Upstream is released under the MIT license, and its original copyright notice is
92
+ retained in [LICENSE](LICENSE) as the license requires. Thanks to the upstream
93
+ author and contributors — without their work this plugin would not exist. If the
94
+ upstream author objects to this derivative use, please open an issue and we will
95
+ sort it out.
96
+
97
+ ## Three ways to use it
98
+
99
+ | Way | Best for | What you do | What you get |
100
+ | --- | --- | --- | --- |
101
+ | **Install the plugin** (recommended) | The full market experience | Install `dsh-crate`, restart `dsh web` | Details, screenshots, favorites and groups, update checks, one-click install |
102
+ | **Add the index source** | Not adding another plugin | Add this catalog under Discover → Index sources | Search, inspect and install in the official Discover tab (npm-installable entries only) |
103
+ | **Use the website** | Browsing first | Open [dshcrate.com](https://dshcrate.com) | Browse, search and read details; installs still happen inside DSH |
104
+
105
+ ## Install
106
+
107
+ ### Option 1: npm (recommended)
108
+
109
+ ```sh
110
+ dsh plugin --profile web add dsh-crate
111
+ ```
112
+
113
+ Package page: [npmjs.com/package/dsh-crate](https://www.npmjs.com/package/dsh-crate).
114
+
115
+ ### Option 2: from the repository
116
+
117
+ Changes that have not been released yet land here first:
118
+
119
+ ```sh
120
+ dsh plugin --profile web add github:dshcrate/dsh-crate
121
+ ```
122
+
123
+ Installing from a git source makes pnpm ask before running build scripts. The
124
+ `client/client.js` bundle is committed, so the market itself needs no build
125
+ step; a prebuilt tarball can be attached to a release if you prefer that route.
126
+
127
+ For a profile other than `web`, swap the name — the same applies to both
128
+ commands:
129
+
130
+ ```sh
131
+ dsh plugin --profile <profile> add dsh-crate
132
+ dsh plugin --profile <profile> add github:dshcrate/dsh-crate
133
+ ```
134
+
135
+ ### Verify the install
136
+
137
+ Restart `dsh web`. A Crate tab appears next to **Installed** on the Plugins
138
+ page, or a Crate Market card shows up in Settings.
139
+
140
+ ### Uninstall
141
+
142
+ ```sh
143
+ dsh plugin --profile web remove dsh-crate
144
+ ```
145
+
146
+ ### Desktop note
147
+
148
+ On a machine with DSH Desktop, `dsh plugin --profile web` installs into
149
+ `profiles/web`, **not** the profile the desktop app uses. Install through the
150
+ app's **Settings → Plugins** instead.
151
+
152
+ ### Install order
153
+
154
+ A repo-verified npm package first, then a prebuilt GitHub Release tarball, then
155
+ the full repository source. Build scripts stay blocked by default (pnpm ≥10);
156
+ allowing one is an explicit per-package choice.
157
+
158
+ ## Use Crate in the official Discover tab
159
+
160
+ Since DSH 0.2.1, the built-in **Plugins → Discover** page accepts third-party
161
+ index sources. If you would rather not install another plugin, add Crate's
162
+ official index and Discover reads the same catalog directly.
163
+
164
+ ### Add the index source
165
+
166
+ 1. Check the host version:
167
+
168
+ ```sh
169
+ dsh --version
170
+ ```
171
+
172
+ Versions below 0.2.1 have no Discover page; install this plugin instead.
173
+
174
+ 2. Open DSH and go to **Plugins → Discover**.
175
+ 3. With no sources yet, click **Add index source**. With sources already listed,
176
+ open the market menu and choose **Manage index sources…**.
177
+ 4. Paste this address and confirm:
178
+
179
+ ```text
180
+ https://dshcrate.com/data/index.json
181
+ ```
182
+
183
+ 5. Back on **Discover**, the catalog appears — search it, open an entry, and
184
+ click **Install**.
185
+
186
+ ### What success looks like
187
+
188
+ - The index-source list shows Crate with the exact URL above.
189
+ - **Discover** renders entry cards with category, tag and sort controls.
190
+ - Opening a card shows the detail page with version, author and publish time.
191
+
192
+ ### How it differs from installing the plugin
193
+
194
+ | Capability | Plugin | Index source only |
195
+ | --- | :-: | :-: |
196
+ | Browse, search, filter by category | ✓ | ✓ |
197
+ | Open details and install | ✓ | ✓ |
198
+ | Screenshots and comments | ✓ | — |
199
+ | Favorites, groups, per-entry notes | ✓ | — |
200
+ | Update checks and release notes | ✓ | — |
201
+ | Theme previews | ✓ | — |
202
+ | Diagnostics page and log export | ✓ | — |
203
+ | Restore and backup | ✓ | — |
204
+
205
+ ### Why the two catalogs differ in size
206
+
207
+ The official index only accepts entries with an npm package, a version and a
208
+ publish time — about 5,000 today. The plugin shows the full catalog, including
209
+ entries installable only from GitHub source. Different inclusion rules, not
210
+ missing data.
211
+
212
+ ## FAQ
213
+
214
+ **An index source is rejected?**
215
+ The URL must be a complete `http`/`https` address, with no `#` fragment and no
216
+ credentials. Copy `https://dshcrate.com/data/index.json` verbatim.
217
+
218
+ **The Discover page is still empty after adding it?**
219
+ Check that `dsh --version` is 0.2.1 or newer, hit refresh, and reopen DSH if it
220
+ stays empty. A failed fetch shows a reason under that row in the index-source
221
+ list.
222
+
223
+ **Installed the plugin on Desktop but cannot find the entry?**
224
+ `dsh plugin --profile web` targets `profiles/web`, not the profile the desktop
225
+ app runs. Install from **Settings → Plugins** inside the app.
226
+
227
+ **Nothing happened after installing from npm?**
228
+ Restart `dsh web`. `client/client.js` ships with the package; you do not need
229
+ to build it yourself.
230
+
231
+ **How often does the catalog update?**
232
+ Once a day. The client caches for about 10 minutes, so give it a moment or
233
+ refresh.
234
+
235
+ **Does adding the index source upload my data?**
236
+ No. It only fetches a public read-only JSON file.
237
+
238
+ ## Configuration
239
+
240
+ All settings live under `config:` in the profile's `cordis.patch.yml` — the
241
+ loader passes only that sub-object to a plugin, so a top-level key is silently
242
+ ignored:
243
+
244
+ ```yaml
245
+ - id: dsh-crate
246
+ name: 'dsh-crate'
247
+ config:
248
+ allowRestart: false # hide the restart button (systemd/pm2/launchd)
249
+ buildEnv:
250
+ CC: /usr/bin/gcc-11
251
+ CXX: /usr/bin/g++-11
252
+ ```
253
+
254
+ - `allowRestart` — one-click restart is hidden automatically when this process
255
+ is systemd's own service process; pm2 and launchd are not detected, so those
256
+ deployments set this by hand.
257
+ - `buildEnv` — environment for the processes the market spawns (installs,
258
+ compiles, git). `PATH` and `CI` stay managed by the market.
259
+ - `DSHM_GITHUB_PROXY` — operator-owned GitHub acceleration prefix; disables the
260
+ matching field in the UI when set.
261
+
262
+ Most of the rest is edited in the UI: download region, GitHub acceleration,
263
+ release channel, entries (sidebar / Settings / Plugins tab), build environment,
264
+ favorites, groups and per-plugin notes.
265
+
266
+ ## Development
267
+
268
+ ```sh
269
+ npm install
270
+ npm run typecheck # host, client, tests
271
+ npm test # vitest, 3000+ specs
272
+ npm run build # lib/ + client/client.js
273
+ ```
274
+
275
+ `client/client.js` is a committed artifact: rebuild it and commit the result
276
+ with the source change. `scripts/preflight.mjs` (run by `prepack`) checks that
277
+ the loader id in that file matches `package.json`, that
278
+ `cordis.patch.yml` inserts by the same name, and that the declared icon ships.
279
+
280
+ The browser bundle registers itself as `window.__ModuleLoader__.load({ id })`,
281
+ where the id must equal the package name — a mismatch loads no UI at all.
282
+
283
+ See [TESTING.md](TESTING.md) for code conventions and [SECURITY.md](SECURITY.md)
284
+ for the security boundary.
285
+
286
+ ## License
287
+
288
+ MIT. This is a derivative of dsh-market; the original copyright notice is
289
+ retained in [LICENSE](LICENSE).
package/README.zh.md ADDED
@@ -0,0 +1,263 @@
1
+ <p align="center">
2
+ <img src="assets/logo.svg" width="96" alt="dsh-crate logo">
3
+ </p>
4
+
5
+ # dsh-crate
6
+
7
+ [English](README.md) | 中文
8
+
9
+ **插件箱子**:装在 DeepSeek Harness 里的插件市场。不用离开 DSH,也不用去翻
10
+ GitHub 话题、辨认哪些仓库真能装、把安装命令手抄到终端——打开插件页,逛目录、
11
+ 看简介,点一下装好。
12
+
13
+ dsh 0.2.1 起它是 **插件** 页上紧挨着 **已安装** 的一个页签;更早的宿主从
14
+ 设置 → **插件箱子** 进入。
15
+
16
+ 不想装插件也能用:把 `https://dshcrate.com/data/index.json` 加进官方
17
+ 「插件 → 发现 → 索引源」,一样能在官方发现页浏览和安装这份目录;只想先看看,
18
+ 直接打开 [dshcrate.com](https://dshcrate.com)。
19
+
20
+ ![插件箱子界面](assets/demo-zh.png)
21
+
22
+ ## 为什么装它
23
+
24
+ DSH 的插件生态长得很快,找插件的方式却还停在「搜仓库 + 读 README + 抄命令」。
25
+ 插件箱子把这段路收进一个界面:
26
+
27
+ - **一处浏览**:3 万+ 条收录,插件、Skill、主题、独立工具都在里面;
28
+ - **看得懂再装**:每条有简介、星标、更新时间与安装方式,卡片上能看截图和讨论;
29
+ - **装完就在手边**:安装、更新、卸载、启停、分组都在同一页完成,不用来回切终端。
30
+
31
+ ## 功能
32
+
33
+ **逛与找**
34
+
35
+ - 全量目录搜索,可按分类筛选、按星标排序
36
+ - 简介跟随界面语言,中英文都能读
37
+ - 卡片带截图与讨论区,主题类条目能看到实际效果
38
+
39
+ **装与管**
40
+
41
+ - 一键安装,实时显示下载与构建进度
42
+ - 逐插件检查更新,附「更新内容」链接直达变更说明
43
+ - 收藏、分组、每个插件一行备注;分组可以整体开关
44
+ - 卸载、热启用/停用;改动不能热加载时提供一键重启
45
+
46
+ **稳与恢复**
47
+
48
+ - 中国大陆地区可切换 GitHub 下载线路
49
+ - 启动失败后的「调整插件」恢复页,一次坏配置不至于把界面锁死
50
+ - 查看加载顺序与冲突的诊断页、脱敏日志导出
51
+ - 备份与恢复:本地 JSON、WebDAV、私有 GitHub Gist
52
+
53
+ **设置**
54
+
55
+ - 下载地区、GitHub 加速、更新通道、入口位置、构建环境都在界面里改
56
+ - 有专门的设置卡片管理市场自身;`allowRestart`、`buildEnv` 也可写进 profile 配置
57
+
58
+ ## 设置入口
59
+
60
+ 除了插件页的页签,也能从设置进入:左侧选中「插件箱子」,右侧就是完整的发现页。
61
+ 插件、Skill、主题都在这份目录里,装好的主题不用重启就能生效。
62
+
63
+ ![设置页中的插件箱子](assets/themes-zh.png)
64
+
65
+ ## 来源与声明
66
+
67
+ 本项目**不是原创**,而是 dsh-market 的衍生修改版:
68
+ [dsh-market](https://github.com/dsh-market/dsh-market),作者 fkysly 及其贡献者。
69
+ 目录数据由本站 **插件箱子** 独立维护,规模与覆盖范围跟原版不是同一份数据。
70
+
71
+ 我们在上游基础上做的改动:
72
+
73
+ - 目录数据换成本站插件箱子的收录结果:条目更多(当前 3 万+,每日自动更新),
74
+ 并补充了分类、主题、评分与中英文简介;
75
+ - 按本站的数据结构重写了目录读取与映射,界面与交互随之调整;
76
+ - 新增了主题类目,并适配评分、分类等字段;
77
+ - 其余功能基本沿用上游实现。
78
+
79
+ 上游以 MIT 许可发布,原始版权声明已按许可要求保留在 [LICENSE](LICENSE)。
80
+ 在此向上游作者与贡献者致谢——没有他们的工作,就没有这个插件。若上游作者对
81
+ 本次衍生使用有异议,请在 issue 中说明,我们会配合处理。
82
+
83
+ ## 三种用法
84
+
85
+ | 用法 | 适合谁 | 需要做什么 | 得到什么 |
86
+ | --- | --- | --- | --- |
87
+ | **装插件**(推荐) | 想要完整市场体验 | 安装 `dsh-crate`,重启 `dsh web` | 详情、截图、收藏分组、更新检查、一键安装 |
88
+ | **只加索引源** | 不想再装一个插件 | 在官方「发现 → 索引源」添加本目录地址 | 官方发现页里搜索、查看、安装(只收 npm 可安装条目) |
89
+ | **只用网页** | 想先逛一逛 | 打开 [dshcrate.com](https://dshcrate.com) | 网页浏览、搜索、看详情;安装仍需在 DSH 内完成 |
90
+
91
+ ## 安装
92
+
93
+ ### 方式一:从 npm 安装(推荐)
94
+
95
+ ```sh
96
+ dsh plugin --profile web add dsh-crate
97
+ ```
98
+
99
+ 包页面:[npmjs.com/package/dsh-crate](https://www.npmjs.com/package/dsh-crate)。
100
+
101
+ ### 方式二:从仓库安装
102
+
103
+ 未正式发布的改动会先出现在这里:
104
+
105
+ ```sh
106
+ dsh plugin --profile web add github:dshcrate/dsh-crate
107
+ ```
108
+
109
+ 从 git 源安装时,pnpm 会先问是否允许运行构建脚本。`client/client.js` 已经
110
+ 随仓库提交,所以市场本身不需要构建;也可以把预构建的 tarball 挂到 release
111
+ 上走那条路。
112
+
113
+ profile 不是 `web` 的话换个名字,两条命令同理:
114
+
115
+ ```sh
116
+ dsh plugin --profile <profile> add dsh-crate
117
+ dsh plugin --profile <profile> add github:dshcrate/dsh-crate
118
+ ```
119
+
120
+ ### 装完确认
121
+
122
+ 重启 `dsh web`。插件页「已安装」旁出现插件箱子页签,或设置里出现插件箱子
123
+ 市场卡片,就说明装好了。
124
+
125
+ ### 卸载
126
+
127
+ ```sh
128
+ dsh plugin --profile web remove dsh-crate
129
+ ```
130
+
131
+ ### 桌面端说明
132
+
133
+ 装了 DSH 桌面端的机器上,`dsh plugin --profile web` 装进的是
134
+ `profiles/web`,**不是**桌面端在用的那个 profile。这种情况请用应用里的
135
+ **设置 → 插件** 安装。
136
+
137
+ ### 安装顺序
138
+
139
+ 仓库校验过的 npm 包优先,其次是作者预构建的 GitHub Release tarball,最后才是
140
+ 整仓库源码。构建脚本默认被拦住(pnpm ≥10),放行需要你针对单个包明确同意。
141
+
142
+ ## 在官方发现页使用插件箱子目录
143
+
144
+ DSH 0.2.1 起,官方「插件 → 发现」页支持添加第三方索引源。不想装本插件,也可以
145
+ 只加插件箱子的官方索引,让官方发现页直接读取这份目录。
146
+
147
+ ### 添加索引源
148
+
149
+ 1. 确认版本:
150
+
151
+ ```sh
152
+ dsh --version
153
+ ```
154
+
155
+ 低于 0.2.1 没有「发现」页,直接装本插件即可。
156
+
157
+ 2. 打开 DSH,进入 **插件 → 发现**。
158
+ 3. 还没有索引源时点 **添加索引源**;已有索引源时点市场菜单,选
159
+ **管理索引源…**。
160
+ 4. 粘贴下面的地址并确认:
161
+
162
+ ```text
163
+ https://dshcrate.com/data/index.json
164
+ ```
165
+
166
+ 5. 回到 **发现** 页,目录出现后就能搜索、进详情、点 **安装**。
167
+
168
+ ### 添加成功的标志
169
+
170
+ - 「索引源」列表里出现插件箱子,URL 与上面完全一致;
171
+ - 「发现」页出现条目卡片,可以按分类、标签筛选和排序;
172
+ - 点卡片能进详情页,看到版本、作者和发布时间。
173
+
174
+ ### 和装插件有什么差别
175
+
176
+ | 能力 | 装插件 | 只加索引源 |
177
+ | --- | :-: | :-: |
178
+ | 浏览、搜索、分类筛选 | ✓ | ✓ |
179
+ | 进入详情页并安装 | ✓ | ✓ |
180
+ | 截图与讨论区 | ✓ | — |
181
+ | 收藏、分组、逐条备注 | ✓ | — |
182
+ | 更新检查与「更新内容」 | ✓ | — |
183
+ | 主题效果预览 | ✓ | — |
184
+ | 诊断页与日志导出 | ✓ | — |
185
+ | 备份与恢复 | ✓ | — |
186
+
187
+ ### 为什么两个界面数量不一样
188
+
189
+ 官方索引只收「有 npm 包、有版本号、有发布时间」的条目,当前约 5000 条;插件
190
+ 市场展示全量收录,其中不少只能从 GitHub 源码安装。两个数字不同是收录口径不同,
191
+ 不是数据缺失。
192
+
193
+ ## 常见问题
194
+
195
+ **加索引源时提示 URL 被拒绝?**
196
+ 地址必须是完整的 `http`/`https`,不能带 `#` 片段,也不能带账号密码。直接复制
197
+ `https://dshcrate.com/data/index.json`。
198
+
199
+ **加完「发现」页还是空的?**
200
+ 先确认 `dsh --version` 不低于 0.2.1;点刷新;仍然空就重开 DSH。读取失败时,
201
+ 「索引源」里对应那一行下面会给出原因。
202
+
203
+ **桌面端装了插件却找不到入口?**
204
+ `dsh plugin --profile web` 装进的是 `profiles/web`,桌面端用的是另一个 profile。
205
+ 请用应用里的 **设置 → 插件** 安装。
206
+
207
+ **npm 装完没反应?**
208
+ 重启 `dsh web`。`client/client.js` 已随包提交,不需要自己构建。
209
+
210
+ **目录多久更新一次?**
211
+ 每天构建一次;客户端有约 10 分钟缓存,刚更新时稍等或刷新。
212
+
213
+ **加索引源会上传我的数据吗?**
214
+ 不会。它只是拉取一个公开只读的 JSON。
215
+
216
+ ## 配置
217
+
218
+ 所有设置都在 profile 的 `cordis.patch.yml` 的 `config:` 下面——加载器只把
219
+ 这个子对象传给插件,写在顶层的键会被静默忽略:
220
+
221
+ ```yaml
222
+ - id: dsh-crate
223
+ name: 'dsh-crate'
224
+ config:
225
+ allowRestart: false # 隐藏重启按钮(systemd / pm2 / launchd)
226
+ buildEnv:
227
+ CC: /usr/bin/gcc-11
228
+ CXX: /usr/bin/g++-11
229
+ ```
230
+
231
+ - `allowRestart` —— 本进程是 systemd 的服务主进程时,重启按钮会自动隐藏;
232
+ pm2 和 launchd 检测不到,这些部署要手动设这一项。
233
+ - `buildEnv` —— 市场拉起的每个进程(安装、编译、git)的环境变量。`PATH` 和
234
+ `CI` 由市场自己管理,不能覆盖。
235
+ - `DSHM_GITHUB_PROXY` —— 运营方持有的 GitHub 加速前缀;设了它,界面里的对应
236
+ 输入框会变成只读。
237
+
238
+ 其余大部分在界面里改:下载地区、GitHub 加速、更新通道、入口(侧栏 / 设置 /
239
+ 插件页签)、构建环境、收藏、分组,以及每个插件的一行备注。
240
+
241
+ ## 开发
242
+
243
+ ```sh
244
+ npm install
245
+ npm run typecheck # 宿主、客户端、测试三份
246
+ npm test # vitest,3000+ 用例
247
+ npm run build # lib/ 与 client/client.js
248
+ ```
249
+
250
+ `client/client.js` 是提交进仓库的产物:改了源码要重新构建并一起提交。
251
+ `scripts/preflight.mjs`(由 `prepack` 触发)会检查这个文件里的 loader id 与
252
+ `package.json` 一致、`cordis.patch.yml` 按同一个名字插入,以及声明的图标有没有
253
+ 打进去。
254
+
255
+ 浏览器产物以 `window.__ModuleLoader__.load({ id })` 注册自己,id 必须等于包名
256
+ ——不一致就一个界面都加载不出来。
257
+
258
+ 代码规范见 [TESTING.md](TESTING.md),安全边界见 [SECURITY.md](SECURITY.md)。
259
+
260
+ ## 许可
261
+
262
+ MIT。本项目是 dsh-market 的衍生修改版,原始版权声明保留在
263
+ [LICENSE](LICENSE)。