dsh-skill-hub 0.3.7 → 0.3.8

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 (109) hide show
  1. package/README.md +40 -50
  2. package/README.zh.md +38 -48
  3. package/lib/client.js +2209 -1820
  4. package/lib/client.js.map +1 -1
  5. package/lib/index.js +653 -419
  6. package/lib/types/client/SkillHubSettingsCard.d.ts +1 -0
  7. package/lib/types/client/api.d.ts +12 -6
  8. package/lib/types/client/helpers.d.ts +0 -1
  9. package/lib/types/client/locales/common.d.ts +52 -0
  10. package/lib/types/client/locales/detail.d.ts +16 -0
  11. package/lib/types/client/locales/market.d.ts +73 -0
  12. package/lib/types/client/locales/settings.d.ts +41 -0
  13. package/lib/types/client/locales/skills.d.ts +65 -0
  14. package/lib/types/client/locales/sources.d.ts +35 -0
  15. package/lib/types/client/locales.d.ts +124 -118
  16. package/lib/types/client/panel/MarketSourceRow.d.ts +12 -0
  17. package/lib/types/client/panel/MarketView.d.ts +1 -0
  18. package/lib/types/client/panel/RepoScanCard.d.ts +10 -0
  19. package/lib/types/client/panel/hooks/shared.d.ts +72 -0
  20. package/lib/types/client/panel/hooks/useCatalogFlow.d.ts +62 -0
  21. package/lib/types/client/panel/hooks/useGroupFlow.d.ts +41 -0
  22. package/lib/types/client/panel/hooks/useMarketFlow.d.ts +73 -0
  23. package/lib/types/client/panel/hooks/useMetaFlow.d.ts +18 -0
  24. package/lib/types/client/panel/hooks/useSourceFlow.d.ts +44 -0
  25. package/lib/types/client/panel/market-format.d.ts +6 -0
  26. package/lib/types/client/panel/useSkillHub.d.ts +45 -73
  27. package/lib/types/client/settings-card.d.ts +20 -0
  28. package/lib/types/client/settings-form.d.ts +6 -0
  29. package/lib/types/protocol/api.d.ts +38 -0
  30. package/lib/types/protocol/catalog.d.ts +155 -0
  31. package/lib/types/protocol/config.d.ts +113 -0
  32. package/lib/types/protocol/groups.d.ts +95 -0
  33. package/lib/types/protocol/market.d.ts +94 -0
  34. package/lib/types/protocol/repo.d.ts +107 -0
  35. package/lib/types/protocol/sources.d.ts +139 -0
  36. package/lib/types/protocol/stats.d.ts +46 -0
  37. package/lib/types/protocol.d.ts +13 -743
  38. package/lib/types/repo/github-client.d.ts +42 -0
  39. package/lib/types/repo.d.ts +6 -17
  40. package/lib/types/routes/catalog.d.ts +7 -0
  41. package/lib/types/routes/config.d.ts +7 -0
  42. package/lib/types/routes/groups.d.ts +7 -0
  43. package/lib/types/routes/helpers.d.ts +145 -0
  44. package/lib/types/routes/market.d.ts +8 -0
  45. package/lib/types/routes/repo-import.d.ts +7 -0
  46. package/lib/types/routes/route-state.d.ts +55 -0
  47. package/lib/types/routes/sources.d.ts +8 -0
  48. package/lib/types/routes.d.ts +5 -34
  49. package/lib/types/stats.d.ts +3 -2
  50. package/lib/types/store/errors.d.ts +10 -0
  51. package/lib/types/store/migrate.d.ts +44 -0
  52. package/lib/types/store/paths.d.ts +32 -0
  53. package/lib/types/store/store.d.ts +133 -0
  54. package/lib/types/store.d.ts +7 -146
  55. package/package.json +28 -27
  56. package/src/client/SkillHubSettingsCard.tsx +17 -3
  57. package/src/client/api.ts +101 -195
  58. package/src/client/helpers.ts +10 -1
  59. package/src/client/locales/common.ts +102 -0
  60. package/src/client/locales/detail.ts +30 -0
  61. package/src/client/locales/market.ts +144 -0
  62. package/src/client/locales/settings.ts +80 -0
  63. package/src/client/locales/skills.ts +128 -0
  64. package/src/client/locales/sources.ts +68 -0
  65. package/src/client/locales.ts +26 -512
  66. package/src/client/panel/MarketSourceRow.tsx +108 -0
  67. package/src/client/panel/MarketView.tsx +12 -253
  68. package/src/client/panel/RepoScanCard.tsx +171 -0
  69. package/src/client/panel/hooks/shared.ts +81 -0
  70. package/src/client/panel/hooks/useCatalogFlow.ts +211 -0
  71. package/src/client/panel/hooks/useGroupFlow.ts +240 -0
  72. package/src/client/panel/hooks/useMarketFlow.ts +421 -0
  73. package/src/client/panel/hooks/useMetaFlow.ts +58 -0
  74. package/src/client/panel/hooks/useSourceFlow.ts +193 -0
  75. package/src/client/panel/market-format.ts +22 -0
  76. package/src/client/panel/useSkillHub.ts +141 -1032
  77. package/src/client/settings-card.tsx +51 -0
  78. package/src/client/settings-form.ts +18 -0
  79. package/src/index.ts +14 -4
  80. package/src/protocol/api.ts +38 -0
  81. package/src/protocol/catalog.ts +168 -0
  82. package/src/protocol/config.ts +145 -0
  83. package/src/protocol/groups.ts +106 -0
  84. package/src/protocol/market.ts +100 -0
  85. package/src/protocol/repo.ts +104 -0
  86. package/src/protocol/sources.ts +146 -0
  87. package/src/protocol/stats.ts +42 -0
  88. package/src/protocol.ts +83 -809
  89. package/src/repo/github-client.ts +131 -0
  90. package/src/repo.test.ts +24 -1
  91. package/src/repo.ts +50 -170
  92. package/src/routes/catalog.ts +309 -0
  93. package/src/routes/config.ts +119 -0
  94. package/src/routes/groups.ts +133 -0
  95. package/src/routes/helpers.ts +489 -0
  96. package/src/routes/market.ts +255 -0
  97. package/src/routes/repo-import.ts +267 -0
  98. package/src/routes/route-state.ts +89 -0
  99. package/src/routes/sources.ts +318 -0
  100. package/src/routes.test.ts +20 -0
  101. package/src/routes.ts +21 -1699
  102. package/src/stats.test.ts +58 -3
  103. package/src/stats.ts +45 -16
  104. package/src/store/errors.ts +14 -0
  105. package/src/store/migrate.ts +272 -0
  106. package/src/store/paths.ts +43 -0
  107. package/src/store/store.ts +532 -0
  108. package/src/store.test.ts +18 -0
  109. package/src/store.ts +7 -737
package/README.md CHANGED
@@ -13,38 +13,45 @@
13
13
  <img src="https://raw.githubusercontent.com/cheshireez/dsh-skill-hub/main/promo/real-skill-hub.png" alt="dsh-skill-hub panel" width="640">
14
14
  </p>
15
15
 
16
- In-GUI skill hub for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) — browse the full `ctx.skills` catalog, toggle skills, inspect bodies, diagnose missing skills, install from the market, and scaffold new ones.
16
+ In-GUI skill hub for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) — browse the full `ctx.skills` catalog, toggle skills, inspect bodies, fix discovery issues, install from the market, and scaffold new ones.
17
17
 
18
18
  > Host runs in the dsh process via official SDKs only; browser renders through official slots. No dsh source changes.
19
19
 
20
- ## Why not just the read-only browser?
20
+ ## Quick start
21
21
 
22
- [dsh-skill-manager](https://www.npmjs.com/package/dsh-skill-manager) browses, [dsh-skill-importer](https://github.com/saitamahang/dsh-skill-importer) / [dsh-find-skill](https://github.com/Moximxxx/dsh-find-skill) import. **This plugin is the manager in between.**
22
+ ```bash
23
+ dsh plugin --profile web add dsh-skill-hub
24
+ # restart dsh web → Settings → 技能 → Market → scan → import
25
+ ```
23
26
 
24
- | Capability | read-only browser | **dsh-skill-hub** |
25
- | --- | --- | --- |
26
- | Catalog | user roots, self-scanned | `ctx.skills` registry: project / custom / user / bundled + third-party |
27
- | Workspace | ❌ | ✅ `.dsh/skills` & `.agents/skills` (read-only, merged by default) |
28
- | Toggle | ❌ | ✅ rename `SKILL.md` (never delete), tri-state group switches + drag reorder |
29
- | Diagnostics / scaffold | ❌ | ✅ missing frontmatter checks / `~/.dsh/skills` wizard |
30
- | Source tracking | ❌ | ✅ repo + commit, check/sync/trash (restores source & scene) |
31
- | Market | ❌ | ✅ built-in + custom repos, any top-level root, badges + update-all |
32
- | Stats | ❌ | ✅ call counts from session logs (14-day window, incremental cache) |
27
+ Requires `Node ^22.19 || >=24` + dsh web (`0.1.2-alpha.5`, `0.1.x` forward compatible).
33
28
 
34
29
  ## Features
35
30
 
36
- - **Catalog**search + source filter + flat/grouped in one row; groups = scenes (tags) + source collections; workspace tree merged by default.
37
- - **Switches** — per-skill and per-group toggles; conflict dialog (close all / keep on) → mixed state; only `~/.dsh/skills` & `~/.agents/skills` are writable.
38
- - **Reorder & edit** — drag handle on every group header (persists in `~/.dsh/dsh-skill-hub.json`); Edit toggle reveals reorder/delete without cluttering the read view.
39
- - **Market** — unified list (built-in Add → becomes source row); scan any root with `SKILL.md` (no allowlist), async import with `{jobId, totalBytes}` progress & cancel; Check all / Update all (failures non-fatal, daily auto-check).
40
- - **Stats** — per-skill `count` + `lastUsed`, group summaries; configurable window/interval live from the settings card.
31
+ **Settings → 技能** 3 tabs: **Sources** (skills, flat/grouped + project tree), **Scenes** (custom tag groups), **Market** (install + update).
41
32
 
42
- ## Quick start
33
+ - **Browse** — every root of the `ctx.skills` registry: project / user / bundled + third-party providers. Search across name, description, `displayName`; filter by source and invocation (model / user); sort by name, added time, or usage. Same-name skills from different sources get a duplicate badge instead of silently hiding.
34
+ - **Toggle** — per-skill switches and per-group tri-state switches with a conflict dialog (close all / keep on). Disabling renames the discovery file (never deletes); disabled skills stay inspectable and re-enableable from their detail page. Only `~/.dsh/skills` & `~/.agents/skills` are writable; everything else is read-only.
35
+ - **Organize** — scenes (tags) plus auto-aggregated source collections, all drag-reorderable and persisted in `~/.dsh/dsh-skill-hub.json`. Edit mode reveals delete/reorder without cluttering the read view.
36
+ - **Diagnose & fix** — files the provider skips (missing frontmatter, bad YAML, name mismatch, short description) show up with reasons; auto-fixable ones (e.g. unquoted `:` in descriptions) get a one-click Fix button.
37
+ - **Scaffold** — new-skill wizard writing to `~/.dsh/skills` or `~/.agents/skills` (`SKILL.md` template below).
38
+ - **Market** — built-in curated repos plus custom `owner/repo` sources. Any top-level directory containing `SKILL.md` scans as a root (no allowlist). Async import with byte-level progress and cancel. Each source pins a version — click the ref badge to switch between releases, branches, or a custom ref.
39
+ - **Track updates** — imported skills record a repo + commit snapshot. Check all / update-all, per-source badges (installed / updatable / deleted upstream / new release). Sync overwrites local edits (with confirm); upstream deletions move into a restorable trash that keeps source and scene membership.
40
+ - **Stats** — per-skill call counts + last-used times from session logs (incremental cache), group summaries; window and scan interval live-configurable from the settings card.
41
+ - **Settings card** — master switch, announce-to-agent, invocation dot colors, usage display toggles, stats window/interval; plus a self-update check against GitHub releases.
43
42
 
44
- ```bash
45
- dsh plugin --profile web add dsh-skill-hub
46
- # restart dsh web Settings 技能 → Market → scan → import
47
- ```
43
+ ## Why not just the read-only browser?
44
+
45
+ [dsh-skill-manager](https://www.npmjs.com/package/dsh-skill-manager) browses, [dsh-skill-importer](https://github.com/saitamahang/dsh-skill-importer) / [dsh-find-skill](https://github.com/Moximxxx/dsh-find-skill) import. **This plugin manages.**
46
+
47
+ | Capability | read-only browser | **dsh-skill-hub** |
48
+ | --- | --- | --- |
49
+ | Catalog | user roots, self-scanned | `ctx.skills` registry, all roots + third-party |
50
+ | Toggle | ❌ | ✅ per-skill + per-group, never deletes |
51
+ | Diagnostics | ❌ | ✅ reasons + one-click fix |
52
+ | Market | ❌ | ✅ built-in + custom, version pins, update-all |
53
+ | Source tracking | ❌ | ✅ check/sync/trash with restore |
54
+ | Stats | ❌ | ✅ counts + last-used |
48
55
 
49
56
  Scaffold format (`SKILL.md`):
50
57
 
@@ -57,8 +64,6 @@ description: One line when the agent should use this skill.
57
64
  Body...
58
65
  ```
59
66
 
60
- Requires `Node ^22.19 || >=24` + dsh web (`0.1.0-rc.7` / `0.1.1-rc.2`, `0.1.x` forward compatible).
61
-
62
67
  ## How it works
63
68
 
64
69
  ```text
@@ -70,40 +75,25 @@ GitHub repo ──scan/import──▶ ~/.dsh/skills
70
75
  /api/skill-hub/* ──▶ Panel (Settings → 技能)
71
76
  ```
72
77
 
73
- | File | Role |
74
- | --- | --- |
75
- | `src/index.ts` | inject `[webServer, skills, systemPrompt, settings]`, settings namespace, announcement |
76
- | `src/routes.ts` | `/api/skill-hub/*` fences + handlers (async import, reorder) |
77
- | `src/store.ts` | `~/.dsh/dsh-skill-hub.json` v4 (disabled/tags/sources/market/trash/stats/order) |
78
- | `src/repo.ts` | discovery / import / diff (any top-level `SKILL.md`) |
79
- | `src/skillfs.ts` | toggle/trash/scaffold/diagnostics |
80
- | `src/client/` | panel (`useSkillHub` + thin views), CSS Modules |
81
-
82
- Host uses only `ctx.skills.snapshot/get`, `ctx.webServer.register`, `ctx.systemPrompt.section`.
83
-
84
- ## Usage
85
-
86
- **Settings → 技能** — 3 tabs: **Sources** (flat/grouped + project tree + drag), **Scenes** (tags, drag), **Market** (unified list). Header workspace field pins to one cwd; trash & diagnostics are always visible.
87
-
88
- **Settings → 插件 → Skill Hub** — master switch, announce to agent, dot colors, `showUseCount/showUseTime/showGroupSummary`, stats window (days, default 14, `0`=all) & interval (min, default 5).
78
+ Host uses only `ctx.skills.snapshot/get`, `ctx.webServer.register`, `ctx.systemPrompt.section`. Loopback-only routes (`127.0.0.1`/`localhost`), JSON.
89
79
 
90
80
  ## HTTP API
91
81
 
92
- Loopback-only (`127.0.0.1`/`localhost`), JSON.
93
-
94
82
  | Endpoint | Method | Purpose |
95
83
  | --- | --- | --- |
96
- | `/api/skill-hub/catalog?cwd=` | GET | catalog + disabled + diagnostics |
97
- | `/api/skill-hub/skill?name=&cwd=` | GET | skill body |
84
+ | `/api/skill-hub/catalog?cwd=` | GET | skills + disabled + diagnostics + duplicates |
85
+ | `/api/skill-hub/skill?name=&cwd=` | GET | skill body (works for disabled too) |
98
86
  | `/api/skill-hub/skill/delete` | POST | move to trash (snapshots source+scenes) |
99
87
  | `/api/skill-hub/toggle` | POST | `{name, enabled}` |
100
88
  | `/api/skill-hub/toggle-batch` | POST | `{names, enabled}` |
101
89
  | `/api/skill-hub/create` | POST | `{name, description?, root?}` |
90
+ | `/api/skill-hub/diagnostic/fix` | POST | `{path}` auto-fix frontmatter |
102
91
  | `/api/skill-hub/stats` | GET | invocation counts |
103
92
  | `/api/skill-hub/config` | GET/POST | runtime config (`null` clears) |
104
93
  | `/api/skill-hub/groups` | GET | tags + collections + orders |
105
- | `/api/skill-hub/tag` etc. | POST | create/rename, delete, set members, reorder (`/tag/reorder`, `/collections/reorder`, `/source-groups/reorder`) |
106
- | `/api/skill-hub/market` etc. | GET/POST | list/add/delete/pin/check/sync market sources |
94
+ | `/api/skill-hub/tag` etc. | POST | create/rename, delete, set members, reorder |
95
+ | `/api/skill-hub/market` etc. | GET/POST | list/add/delete/pin/check/sync sources |
96
+ | `/api/skill-hub/market/source/versions?repo=` | GET | releases + branches for the version picker |
107
97
  | `/api/skill-hub/repo?repo=` | GET | discover (any root) |
108
98
  | `/api/skill-hub/repo/import` | POST | async job `{jobId, total, totalBytes}` |
109
99
  | `/api/skill-hub/repo/import/progress?jobId=` | GET | poll job |
@@ -115,16 +105,16 @@ Loopback-only (`127.0.0.1`/`localhost`), JSON.
115
105
 
116
106
  ```bash
117
107
  npm run typecheck # tsc --noEmit
118
- npm test # 174 tests, 9 suites
108
+ npm test # 176 tests, 9 suites
119
109
  npm run build # tsc + tsdown → lib/index.js + lib/client.js
120
110
  ```
121
111
 
122
- > Don't run two `dsh web` on the same `$DSH_HOME` + cwd — rc has no session-log lock (`seq gap` corruption). Use separate `DSH_HOME`.
112
+ > Don't run two `dsh web` on the same `$DSH_HOME` + cwd — no session-log lock (`seq gap` corruption). Use separate `DSH_HOME`.
123
113
 
124
114
  ## Troubleshooting
125
115
 
126
- - `duplicate loader entry id: skill-hub` — remove duplicate install (keep one `dsh plugin add` method).
127
- - Skill missing — check diagnostics (frontmatter / name mismatch / short description).
116
+ - `duplicate loader entry id: skill-hub` — remove the duplicate install (keep one `dsh plugin add` method).
117
+ - Skill missing — check the diagnostics section (frontmatter / name mismatch / short description).
128
118
  - Dots missing in `/` menu — dsh internals changed; catalog still works.
129
119
 
130
120
  ## Community
package/README.zh.md CHANGED
@@ -13,38 +13,45 @@
13
13
  <img src="https://raw.githubusercontent.com/cheshireez/dsh-skill-hub/main/promo/real-skill-hub.png" alt="dsh-skill-hub 面板" width="640">
14
14
  </p>
15
15
 
16
- 面向 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的图形化技能中枢 — 在 Web GUI 里浏览 `ctx.skills` 全量目录,开关技能、查看正文、诊断缺失、从市场安装、一键新建。
16
+ 面向 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的图形化技能中枢 — 在 Web GUI 里浏览 `ctx.skills` 全量目录,开关技能、查看正文、修复发现问题、从市场安装、一键新建。
17
17
 
18
18
  > 宿主只用官方 SDK,浏览器通过官方槽位渲染,不改 dsh 源码。
19
19
 
20
- ## 为什么还需要一个管理器?
20
+ ## 快速开始
21
21
 
22
- [dsh-skill-manager](https://www.npmjs.com/package/dsh-skill-manager) 只读浏览,[dsh-skill-importer](https://github.com/saitamahang/dsh-skill-importer) / [dsh-find-skill](https://github.com/Moximxxx/dsh-find-skill) 只做导入。**本插件是可管理的全量目录。**
22
+ ```bash
23
+ dsh plugin --profile web add dsh-skill-hub
24
+ # 重启 dsh web → 设置 → 技能 → 市场 → 扫描 → 导入
25
+ ```
23
26
 
24
- | 能力 | 只读浏览器 | **dsh-skill-hub** |
25
- | --- | --- | --- |
26
- | 目录 | 自扫盘、仅用户根 | `ctx.skills`:项目/自定义/用户/内置 + 第三方 |
27
- | 工作区 | ❌ | ✅ `.dsh/skills` & `.agents/skills`(默认合并,只读) |
28
- | 开关 | ❌ | ✅ 重命名 `SKILL.md`(不删除),分组三态开关 + 拖拽排序 |
29
- | 诊断/新建 | ❌ | ✅ frontmatter 诊断 / `~/.dsh/skills` 向导 |
30
- | 来源跟踪 | ❌ | ✅ repo+commit,检查/同步/回收站(恢复保留来源与场景) |
31
- | 市场 | ❌ | ✅ 内置+自定义,任意顶层根目录,徽章+一键全更 |
32
- | 统计 | ❌ | ✅ 会话日志调用次数(14 天窗口,增量缓存) |
27
+ 要求 `Node ^22.19 || >=24` + dsh web(`0.1.2-alpha.5`,兼容后续 `0.1.x`)。
33
28
 
34
29
  ## 功能
35
30
 
36
- - **目录**搜索+来源筛选+平铺/分组一行完成;分组=场景(tag)+ 来源集合;工作区默认合并为项目树。
37
- - **开关** — 单技能/整组开关;冲突弹窗(全部关闭/保留开启→半开态);仅 `~/.dsh/skills` & `~/.agents/skills` 可写。
38
- - **排序与编辑** — 分组头拖拽手柄(持久化到 `~/.dsh/dsh-skill-hub.json`);编辑开关收敛排序/删除控件。
39
- - **市场** — 统一列表(内置 Add → 变来源行);任意含 `SKILL.md` 的顶层目录视为根(无白名单),异步导入 `{jobId, totalBytes}` 轮询+取消;检查全部/全部更新(单源失败不影响全局,每日自动检查一次)。
40
- - **统计** — 每技能 `count` + `lastUsed`,分组头汇总;窗口/间隔在设置卡片实时可调。
31
+ **设置 技能** 3 个 tab:**来源**(技能,平铺/分组+项目树)、**场景**(自定义分组)、**市场**(安装与更新)。
41
32
 
42
- ## 快速开始
33
+ - **浏览** — `ctx.skills` 注册表全量:项目/用户/内置+第三方。按名称、描述、`displayName` 搜索;按来源、按调用方式(模型/用户)筛选;按名称/添加时间/调用次数排序。不同来源的同名技能挂重名徽标,不再静默隐藏。
34
+ - **开关** — 单技能开关 + 整组三态开关,跨组冲突弹窗(全部关闭/保留开启)。禁用只重命名发现文件(不删除);禁用的技能仍可查看正文、可一键重新启用。仅 `~/.dsh/skills` 与 `~/.agents/skills` 可写,其余只读。
35
+ - **整理** — 场景(tag)+ 自动聚合的来源集合,全部可拖拽排序并持久化到 `~/.dsh/dsh-skill-hub.json`。编辑模式收敛删除/排序控件,阅读视图保持干净。
36
+ - **诊断与修复** — provider 跳过的文件给出原因(缺 frontmatter、YAML 非法、名称不一致、描述过短);可自动修复的(如描述里未加引号的 `:`)一键 Fix 落盘。
37
+ - **新建** — 新技能向导,写入 `~/.dsh/skills` 或 `~/.agents/skills`(`SKILL.md` 模板见下)。
38
+ - **市场** — 内置精选仓库 + 自定义 `owner/repo`。任何含 `SKILL.md` 的顶层目录都可扫描(无白名单)。异步导入,字节级进度+取消。每个源钉一个版本 —— 点 ref 徽标可在发布版/分支/手输之间切换。
39
+ - **跟踪更新** — 导入的技能记录 repo+commit 快照。检查全部/一键全更;每源徽章(已装/可更新/上游已删/新版本)。同步覆盖本地修改(先确认);上游删除跟进移入回收站,恢复保留来源与场景归属。
40
+ - **统计** — 会话日志的调用次数+最近使用,分组头汇总;窗口与扫描间隔在设置卡片实时可调。
41
+ - **设置卡片** — 总开关、向 Agent 公告、调用圆点颜色、用量显示开关、统计窗口/间隔;附带插件自更新检查(对 GitHub releases)。
43
42
 
44
- ```bash
45
- dsh plugin --profile web add dsh-skill-hub
46
- # 重启 dsh web 设置 → 技能 → 市场 → 扫描 → 导入
47
- ```
43
+ ## 为什么还需要一个管理器?
44
+
45
+ [dsh-skill-manager](https://www.npmjs.com/package/dsh-skill-manager) 只读浏览,[dsh-skill-importer](https://github.com/saitamahang/dsh-skill-importer) / [dsh-find-skill](https://github.com/Moximxxx/dsh-find-skill) 只做导入。**本插件负责管理。**
46
+
47
+ | 能力 | 只读浏览器 | **dsh-skill-hub** |
48
+ | --- | --- | --- |
49
+ | 目录 | 自扫盘、仅用户根 | `ctx.skills` 全量+第三方 |
50
+ | 开关 | ❌ | ✅ 单技能+整组,从不删除 |
51
+ | 诊断 | ❌ | ✅ 原因+一键修复 |
52
+ | 市场 | ❌ | ✅ 内置+自定义,版本钉选,一键全更 |
53
+ | 来源跟踪 | ❌ | ✅ 检查/同步/回收站可恢复 |
54
+ | 统计 | ❌ | ✅ 次数+最近使用 |
48
55
 
49
56
  `SKILL.md` 模板:
50
57
 
@@ -57,8 +64,6 @@ description: 一句话说明何时使用。
57
64
  正文...
58
65
  ```
59
66
 
60
- 要求 `Node ^22.19 || >=24` + dsh web(`0.1.0-rc.7` / `0.1.1-rc.2`,兼容后续 `0.1.x`)。
61
-
62
67
  ## 工作原理
63
68
 
64
69
  ```text
@@ -70,40 +75,25 @@ GitHub 仓库 ──扫描/导入──▶ ~/.dsh/skills
70
75
  /api/skill-hub/* ──▶ 面板(设置 → 技能)
71
76
  ```
72
77
 
73
- | 文件 | 职责 |
74
- | --- | --- |
75
- | `src/index.ts` | inject `[webServer, skills, systemPrompt, settings]`,设置命名空间,公告 |
76
- | `src/routes.ts` | `/api/skill-hub/*` 围栏+处理(异步导入、拖拽排序) |
77
- | `src/store.ts` | `~/.dsh/dsh-skill-hub.json` v4(禁用/tags/sources/market/trash/统计/排序) |
78
- | `src/repo.ts` | 发现/导入/比对(任意顶层 `SKILL.md`) |
79
- | `src/skillfs.ts` | 开关/回收站/脚手架/诊断 |
80
- | `src/client/` | 面板(`useSkillHub` + 薄视图),CSS Modules |
81
-
82
- 宿主仅用 `ctx.skills.snapshot/get`、`ctx.webServer.register`、`ctx.systemPrompt.section`。
83
-
84
- ## 使用
85
-
86
- **设置 → 技能** — 三个 tab:**来源**(平铺/分组+项目树+拖拽)、**场景**(tag,分组开关+拖拽)、**市场**(统一列表)。顶部工作区路径可固定到单个 cwd;回收站与诊断常驻。
87
-
88
- **设置 → 插件 → Skill Hub** — 总开关、向 Agent 公告、圆点颜色、`show*` 三开关、统计窗口(天,默认 14,`0`=全部)与间隔(分钟,默认 5)。
78
+ 宿主仅用 `ctx.skills.snapshot/get`、`ctx.webServer.register`、`ctx.systemPrompt.section`。路由仅回环(`127.0.0.1`/`localhost`),JSON。
89
79
 
90
80
  ## HTTP API
91
81
 
92
- 仅回环(`127.0.0.1`/`localhost`),JSON。
93
-
94
82
  | 端点 | 方法 | 用途 |
95
83
  | --- | --- | --- |
96
- | `/api/skill-hub/catalog?cwd=` | GET | 目录+禁用+诊断 |
97
- | `/api/skill-hub/skill?name=&cwd=` | GET | 技能正文 |
84
+ | `/api/skill-hub/catalog?cwd=` | GET | 技能+禁用+诊断+重名 |
85
+ | `/api/skill-hub/skill?name=&cwd=` | GET | 技能正文(禁用的也可) |
98
86
  | `/api/skill-hub/skill/delete` | POST | 移入回收站(快照来源+场景) |
99
87
  | `/api/skill-hub/toggle` | POST | `{name, enabled}` |
100
88
  | `/api/skill-hub/toggle-batch` | POST | `{names, enabled}` |
101
89
  | `/api/skill-hub/create` | POST | `{name, description?, root?}` |
90
+ | `/api/skill-hub/diagnostic/fix` | POST | `{path}` 自动修 frontmatter |
102
91
  | `/api/skill-hub/stats` | GET | 调用次数 |
103
92
  | `/api/skill-hub/config` | GET/POST | 运行时配置(`null` 清除) |
104
93
  | `/api/skill-hub/groups` | GET | tags+集合+排序 |
105
- | `/api/skill-hub/tag` 等 | POST | 新建/重命名、删除、设成员、排序(`/tag/reorder`、`/collections/reorder`、`/source-groups/reorder`) |
94
+ | `/api/skill-hub/tag` 等 | POST | 新建/重命名、删除、设成员、排序 |
106
95
  | `/api/skill-hub/market` 等 | GET/POST | 市场源 列表/添加/删除/钉 ref/检查/同步 |
96
+ | `/api/skill-hub/market/source/versions?repo=` | GET | 版本选择器的 releases+branches |
107
97
  | `/api/skill-hub/repo?repo=` | GET | 发现(任意根) |
108
98
  | `/api/skill-hub/repo/import` | POST | 异步任务 `{jobId, total, totalBytes}` |
109
99
  | `/api/skill-hub/repo/import/progress?jobId=` | GET | 轮询进度 |
@@ -115,16 +105,16 @@ GitHub 仓库 ──扫描/导入──▶ ~/.dsh/skills
115
105
 
116
106
  ```bash
117
107
  npm run typecheck # tsc --noEmit
118
- npm test # 174 tests, 9 suites
108
+ npm test # 176 tests, 9 suites
119
109
  npm run build # tsc + tsdown → lib/index.js + lib/client.js
120
110
  ```
121
111
 
122
- > 同一 `$DSH_HOME` + cwd 下勿开两个 `dsh web` — rc 无会话日志锁,会 `seq gap` 损坏。换 `DSH_HOME` 或先关旧实例。
112
+ > 同一 `$DSH_HOME` + cwd 下勿开两个 `dsh web` — 无会话日志锁,会 `seq gap` 损坏。换 `DSH_HOME` 或先关旧实例。
123
113
 
124
114
  ## 故障排查
125
115
 
126
116
  - `duplicate loader entry id: skill-hub` — 删掉重复安装(只留一种 `dsh plugin add`)。
127
- - 技能不出现 — 看诊断(缺 frontmatter / 名称不一致 / 描述过短)。
117
+ - 技能不出现 — 看诊断区(缺 frontmatter / 名称不一致 / 描述过短)。
128
118
  - `/` 菜单圆点消失 — dsh 内部触发源变更,目录功能不受影响。
129
119
 
130
120
  ## 社区