dsh-skill-hub 0.3.27 → 0.3.28
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/CONTRIBUTING.md +1 -1
- package/README.md +10 -2
- package/README.zh.md +10 -2
- package/lib/client.js +310 -39
- package/lib/client.js.map +1 -1
- package/lib/index.js +790 -15
- package/lib/types/client/api.d.ts +8 -1
- package/lib/types/client/locales/common.d.ts +4 -0
- package/lib/types/client/locales/market.d.ts +10 -0
- package/lib/types/client/locales/sources.d.ts +3 -0
- package/lib/types/client/locales.d.ts +17 -0
- package/lib/types/client/panel/ForeignImportDialog.d.ts +15 -0
- package/lib/types/client/panel/PanelDialogs.d.ts +2 -0
- package/lib/types/client/panel/dialogs.d.ts +11 -1
- package/lib/types/client/panel/useSkillHub.d.ts +1 -0
- package/lib/types/protocol/api.d.ts +2 -0
- package/lib/types/protocol/catalog.d.ts +39 -1
- package/lib/types/protocol/foreign.d.ts +51 -0
- package/lib/types/protocol/sources.d.ts +13 -0
- package/lib/types/protocol.d.ts +3 -1
- package/lib/types/repo/install.d.ts +4 -0
- package/lib/types/routes/deps.d.ts +11 -0
- package/lib/types/routes/foreign.d.ts +10 -0
- package/lib/types/routes/helpers.d.ts +1 -1
- package/lib/types/skillfs/audit.d.ts +58 -0
- package/lib/types/skillfs/foreign.d.ts +51 -0
- package/lib/types/skillfs/hash.d.ts +24 -0
- package/lib/types/skillfs.d.ts +2 -0
- package/lib/types/store/store.d.ts +6 -0
- package/package.json +2 -2
- package/src/client/api.ts +14 -0
- package/src/client/locales/common.ts +8 -0
- package/src/client/locales/market.ts +20 -0
- package/src/client/locales/sources.ts +6 -0
- package/src/client/panel/ForeignImportDialog.tsx +130 -0
- package/src/client/panel/PanelDialogs.tsx +4 -1
- package/src/client/panel/SkillHubPanel.tsx +34 -4
- package/src/client/panel/SourceStatusBadge.tsx +23 -13
- package/src/client/panel/dialogs.tsx +14 -3
- package/src/client/panel/panel.module.css +6 -0
- package/src/client/panel/useSkillHub.ts +1 -1
- package/src/index.ts +2 -2
- package/src/protocol/api.ts +2 -0
- package/src/protocol/catalog.ts +56 -0
- package/src/protocol/foreign.ts +47 -0
- package/src/protocol/sources.ts +13 -0
- package/src/protocol.test.ts +59 -0
- package/src/protocol.ts +3 -0
- package/src/repo/install.ts +34 -0
- package/src/repo.test.ts +55 -0
- package/src/routes/catalog-data.ts +2 -0
- package/src/routes/deps.ts +15 -0
- package/src/routes/foreign.ts +127 -0
- package/src/routes/helpers.ts +1 -0
- package/src/routes/repo-import.ts +4 -1
- package/src/routes/sources.ts +53 -3
- package/src/routes.test.ts +162 -3
- package/src/routes.ts +2 -0
- package/src/skillfs/audit.test.ts +182 -0
- package/src/skillfs/audit.ts +229 -0
- package/src/skillfs/foreign.test.ts +121 -0
- package/src/skillfs/foreign.ts +198 -0
- package/src/skillfs/hash.test.ts +129 -0
- package/src/skillfs/hash.ts +112 -0
- package/src/skillfs/scan.ts +17 -0
- package/src/skillfs.test.ts +37 -0
- package/src/skillfs.ts +2 -0
- package/src/store/migrate.ts +7 -1
- package/src/store/store.ts +36 -3
- package/src/store.test.ts +24 -0
package/CONTRIBUTING.md
CHANGED
|
@@ -39,7 +39,7 @@ src/client/locales/ dictionaries by view (common/skills/market/sources/detai
|
|
|
39
39
|
```bash
|
|
40
40
|
npm install
|
|
41
41
|
npm run typecheck # tsc --noEmit
|
|
42
|
-
npm test # vitest (
|
|
42
|
+
npm test # vitest (366 tests across 20 suites)
|
|
43
43
|
npm run build # tsc declarations + tsdown bundles (lib/index.js + lib/client.js)
|
|
44
44
|
```
|
|
45
45
|
|
package/README.md
CHANGED
|
@@ -36,9 +36,13 @@ Two surfaces — the hub panel lives at **Settings → 技能**, and this plugin
|
|
|
36
36
|
- **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.
|
|
37
37
|
- **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.
|
|
38
38
|
- **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.
|
|
39
|
+
- **Content audit** — enabled skills' bodies (`SKILL.md`) are checked too: raw ESC control characters, Unicode tag characters, and bidirectional controls (these three make "reviewed" not equal "seen" — a market import carrying them is refused outright), zero-width characters, `curl … | sh` remote execution, SSH/cloud-credential/keychain paths, over-long descriptions, and the 2 MiB per-file / 10 MiB per-skill / 500-file limits. Pure local static matching: no model call, no network. A market import scans the whole bundle (including `scripts/`); the standing check only reads `SKILL.md` — it runs on every 5-second poll, and walking every directory would slow the panel down.
|
|
40
|
+
- **Announcement budget** — the name + description total that the first progressive-disclosure layer injects comes back with the catalog, so the panel can show characters and an estimated token count; past 8000 characters it turns red (clients truncate the tail there, which shows up as "installed but never triggers").
|
|
39
41
|
- **Scaffold** — new-skill wizard writing to `~/.dsh/skills` or `~/.agents/skills` (`SKILL.md` template below).
|
|
40
|
-
- **Market** — built-in curated repos plus custom `owner/repo` sources. Any top-level directory containing `SKILL.md` scans as a root (no allowlist), and a `SKILL.md` at the repo root itself scans as a single skill named after the repo (minus repo tooling such as `.github/`). 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.
|
|
42
|
+
- **Market** — built-in curated repos plus custom `owner/repo` sources. Any top-level directory containing `SKILL.md` scans as a root (no allowlist), and a `SKILL.md` at the repo root itself scans as a single skill named after the repo (minus repo tooling such as `.github/`). 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. Every import passes the content audit first: a skill with a blocking finding is refused as a whole and its temp directory is removed (nothing left on disk).
|
|
41
43
|
- **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.
|
|
44
|
+
- **Local-edit detection** — a content hash of the whole skill (path + size + body) is sampled right after the bytes land and compared on every check: skills that no longer match get an "edited locally" badge, and the sync dialog marks exactly which ones the overwrite will discard. Records without a hash are treated as unknown, never as edited.
|
|
45
|
+
- **Import from another agent** — read-only scan of the user-level skill folders of Claude Code / Codex / Cursor / Gemini CLI / Copilot / OpenCode / Goose, then copy the selected ones into `~/.dsh/skills`. The originals are untouched; flat skills land as directory bundles; the same content audit and size caps apply.
|
|
42
46
|
- **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.
|
|
43
47
|
- **Settings card** — registered on the plugin's own page in the **Plugins manager** (sidebar → 插件 → dsh-skill-hub; collapsed until you expand the title): master switch, announce-to-agent, invocation dot colors, usage display toggles, stats window/interval.
|
|
44
48
|
|
|
@@ -51,6 +55,8 @@ Two surfaces — the hub panel lives at **Settings → 技能**, and this plugin
|
|
|
51
55
|
| Catalog | user roots, self-scanned | `ctx.skills` registry, all roots + third-party |
|
|
52
56
|
| Toggle | ❌ | ✅ per-skill + per-group, never deletes |
|
|
53
57
|
| Diagnostics | ❌ | ✅ reasons + one-click fix |
|
|
58
|
+
| Content audit | ❌ | ✅ hidden characters / dangerous commands / credential paths, blocked at import |
|
|
59
|
+
| Cross-agent import | ❌ | ✅ read-only scan of 7 tool folders, pick and adopt |
|
|
54
60
|
| Market | ❌ | ✅ built-in + custom, version pins, update-all |
|
|
55
61
|
| Source tracking | ❌ | ✅ check/sync/trash with restore |
|
|
56
62
|
| Stats | ❌ | ✅ counts + last-used |
|
|
@@ -101,6 +107,8 @@ Host uses only `ctx.skills.snapshot/get`, `ctx.webServer.register`, `ctx.systemP
|
|
|
101
107
|
| `/api/skill-hub/repo/import/progress?jobId=` | GET | poll job |
|
|
102
108
|
| `/api/skill-hub/repo/import/cancel` | POST | cancel job |
|
|
103
109
|
| `/api/skill-hub/sources` etc. | GET/POST | list/check/sync/delete/restore/clear trash |
|
|
110
|
+
| `/api/skill-hub/foreign` | GET | read-only scan of other agents' user-level skill folders |
|
|
111
|
+
| `/api/skill-hub/foreign/import` | POST | `{items:[{agent,name}]}` copied into `~/.dsh/skills` |
|
|
104
112
|
| `/api/skill-hub/update` | GET | plugin latest release |
|
|
105
113
|
| unknown `/api/skill-hub/*` | GET/POST | `404 {error}` naming the path — a typo must not read as an auth failure (the SPA fallback answers 401 for `/api/*` it does not own) |
|
|
106
114
|
|
|
@@ -108,7 +116,7 @@ Host uses only `ctx.skills.snapshot/get`, `ctx.webServer.register`, `ctx.systemP
|
|
|
108
116
|
|
|
109
117
|
```bash
|
|
110
118
|
npm run typecheck # tsc --noEmit
|
|
111
|
-
npm test #
|
|
119
|
+
npm test # 366 tests, 20 suites
|
|
112
120
|
npm run build # tsc + tsdown → lib/index.js + lib/client.js
|
|
113
121
|
```
|
|
114
122
|
|
package/README.zh.md
CHANGED
|
@@ -36,9 +36,13 @@ dsh plugin --profile web add dsh-skill-hub
|
|
|
36
36
|
- **开关** — 单技能开关 + 整组三态开关,跨组冲突弹窗(全部关闭/保留开启)。禁用只重命名发现文件(不删除);禁用的技能仍可查看正文、可一键重新启用。仅 `~/.dsh/skills` 与 `~/.agents/skills` 可写,其余只读。
|
|
37
37
|
- **整理** — 场景(tag)+ 自动聚合的来源集合,全部可拖拽排序并持久化到 `~/.dsh/dsh-skill-hub.json`。编辑模式收敛删除/排序控件,阅读视图保持干净。
|
|
38
38
|
- **诊断与修复** — provider 跳过的文件给出原因(缺 frontmatter、YAML 非法、名称不一致、描述过短);可自动修复的(如描述里未加引号的 `:`)一键 Fix 落盘。
|
|
39
|
+
- **内容审计** — 已启用技能的正文(`SKILL.md`)也体检:裸 ESC 控制字符、Unicode 标签字符、双向控制符(这三类会让「看过」不等于「看见」,市场导入时直接拒绝落盘)、零宽字符、`curl … | sh` 式远程执行、SSH/云凭据/钥匙串路径、超长 description,以及单文件 2 MiB / 单技能 10 MiB / 500 文件上限。规则是纯本地静态匹配,不跑模型、不出网。市场导入会扫整包(含 `scripts/`),常驻体检只扫 `SKILL.md`(每 5 秒轮询,扫全目录会拖慢面板)。
|
|
40
|
+
- **公告预算** — 一层渐进加载注入的 name + description 总量随目录一起返回,面板显示字符数与 token 估算;超过 8000 字符变红提示(超出后客户端会截断尾部条目,表现为「装了却不触发」)。
|
|
39
41
|
- **新建** — 新技能向导,写入 `~/.dsh/skills` 或 `~/.agents/skills`(`SKILL.md` 模板见下)。
|
|
40
|
-
- **市场** — 内置精选仓库 + 自定义 `owner/repo`。任何含 `SKILL.md` 的顶层目录都可扫描(无白名单);`SKILL.md` 直接放在仓库根时,整个仓库算一个技能,技能名取仓库名(`.github/` 等仓库基建不计入)。异步导入,字节级进度+取消。每个源钉一个版本 —— 点 ref
|
|
42
|
+
- **市场** — 内置精选仓库 + 自定义 `owner/repo`。任何含 `SKILL.md` 的顶层目录都可扫描(无白名单);`SKILL.md` 直接放在仓库根时,整个仓库算一个技能,技能名取仓库名(`.github/` 等仓库基建不计入)。异步导入,字节级进度+取消。每个源钉一个版本 —— 点 ref 徽标可在发布版/分支/手输之间切换。导入前先过内容审计,命中阻断级规则的技能整包拒绝,临时目录一并清掉(磁盘不留痕)。
|
|
41
43
|
- **跟踪更新** — 导入的技能记录 repo+commit 快照。检查全部/一键全更;每源徽章(已装/可更新/上游已删/新版本)。同步覆盖本地修改(先确认);上游删除跟进移入回收站,恢复保留来源与场景归属。
|
|
44
|
+
- **本地改动检测** — 落盘后立刻采集整个技能的内容哈希(路径+大小+内容),检查时与记录比对:不一致的技能挂「本地改动 N 个」徽章,同步确认弹窗里逐个标出会被覆盖的那几个。旧记录没有哈希时按「未知」处理,不误报。
|
|
45
|
+
- **从其他 Agent 导入** — 只读扫描 Claude Code / Codex / Cursor / Gemini CLI / Copilot / OpenCode / Goose 的用户级技能目录,勾选后复制到 `~/.dsh/skills`。原目录不受影响;扁平技能统一落成目录包;同样过内容审计与体积上限。
|
|
42
46
|
- **统计** — 会话日志的调用次数+最近使用,分组头汇总;窗口与扫描间隔在设置卡片实时可调。
|
|
43
47
|
- **设置卡片** — 注册在 **插件管理页** 的插件自有页面上(侧边栏「插件」→ dsh-skill-hub,默认折叠,点标题展开):总开关、向 Agent 公告、调用圆点颜色、用量显示开关、统计窗口/间隔。
|
|
44
48
|
|
|
@@ -51,6 +55,8 @@ dsh plugin --profile web add dsh-skill-hub
|
|
|
51
55
|
| 目录 | 自扫盘、仅用户根 | `ctx.skills` 全量+第三方 |
|
|
52
56
|
| 开关 | ❌ | ✅ 单技能+整组,从不删除 |
|
|
53
57
|
| 诊断 | ❌ | ✅ 原因+一键修复 |
|
|
58
|
+
| 内容审计 | ❌ | ✅ 隐藏字符/危险命令/凭据路径,导入即拦 |
|
|
59
|
+
| 跨 agent 导入 | ❌ | ✅ 只读扫描 7 家目录,勾选收编 |
|
|
54
60
|
| 市场 | ❌ | ✅ 内置+自定义,版本钉选,一键全更 |
|
|
55
61
|
| 来源跟踪 | ❌ | ✅ 检查/同步/回收站可恢复 |
|
|
56
62
|
| 统计 | ❌ | ✅ 次数+最近使用 |
|
|
@@ -101,6 +107,8 @@ GitHub 仓库 ──扫描/导入──▶ ~/.dsh/skills
|
|
|
101
107
|
| `/api/skill-hub/repo/import/progress?jobId=` | GET | 轮询进度 |
|
|
102
108
|
| `/api/skill-hub/repo/import/cancel` | POST | 取消任务 |
|
|
103
109
|
| `/api/skill-hub/sources` 等 | GET/POST | 来源 列表/检查/同步/删除/恢复/清空回收站 |
|
|
110
|
+
| `/api/skill-hub/foreign` | GET | 其他 agent 用户级技能目录的只读扫描 |
|
|
111
|
+
| `/api/skill-hub/foreign/import` | POST | `{items:[{agent,name}]}` 收编到 `~/.dsh/skills` |
|
|
104
112
|
| `/api/skill-hub/update` | GET | 插件最新发布 |
|
|
105
113
|
| 未知的 `/api/skill-hub/*` | GET/POST | `404 {error}` 且写明路径 —— 拼错路径不该被读成鉴权失败(宿主 SPA fallback 对自己不拥有的 `/api/*` 一律回 401) |
|
|
106
114
|
|
|
@@ -108,7 +116,7 @@ GitHub 仓库 ──扫描/导入──▶ ~/.dsh/skills
|
|
|
108
116
|
|
|
109
117
|
```bash
|
|
110
118
|
npm run typecheck # tsc --noEmit
|
|
111
|
-
npm test #
|
|
119
|
+
npm test # 366 tests, 20 suites
|
|
112
120
|
npm run build # tsc + tsdown → lib/index.js + lib/client.js
|
|
113
121
|
```
|
|
114
122
|
|