dsh-skill-importer 0.1.0 → 0.1.2

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
@@ -1,98 +1,132 @@
1
- # dsh-skill-importer
1
+ <div align="center">
2
+ <img src="assets/hero.svg" alt="dsh-skill-importer — Skills, right where you need them" width="100%" />
2
3
 
3
- DeepSeek Harness 的插件:**直接写盘的技能导入器**。在设置页新增「技能」分区,选中本地 `SKILL.md` 后点击导入,文件**立即写入**目标技能目录——不经过 agent、不需要会话、不需要模型、不消耗 token、无审批。
4
+ <br />
4
5
 
5
- ## 功能
6
+ <strong>Bring skill management into the DeepSeek Harness Web UI.</strong><br />
7
+ Import, discover, and invoke skills without a session, model tokens, or approval round-trips.
6
8
 
7
- - **技能入口(`/` 菜单不再直接列技能)**:① 输入框工具行技能下拉(权限选择旁边,常驻);② `/skills` 命令(弹出技能列表,同 `/model` 交互);③ 手输 `/<名称> `。三者都填入 `/名称 ` 并高亮,发送即注入技能正文:`/` 菜单隐藏技能,输入框工具行出现技能下拉框,选中后自动填入 `/<名称> `,发送即使用对应技能
8
- - **已安装列表**:扫描全部已注册工作区的项目技能根(`.dsh/skills`、`.agents/skills`)加用户技能根(`~/.dsh/skills`),**按安装位置分组展示全部副本**(不按 rank 去重,管理面能看到每一处),每项显示调用策略标记并可直接删除
9
- - **工作区感知**:项目目标写入「当前工作区」(最近活跃的已注册工作区)而非 dsh 进程的启动目录——与 `/` 斜杠菜单的解析一致,导入后立即可见
10
- - **从文件导入**:选择本地 Markdown → 浏览器内解析 frontmatter 并校验(`name` kebab-case、`description` 必填)→ 预览确认 → 直接写入 `<目标>/<name>/SKILL.md`
11
- - **从 URL 导入**:host 进程抓取 URL(`.md` 原样写入;HTML 粗略提取正文),整理为技能文件
12
- - **目标目录选择**:当前工作区 `.agents/skills` / `.dsh/skills` / 用户技能目录 `~/.dsh/skills`
9
+ <br /><br />
13
10
 
14
- ## 设计原理(为什么没有"目标会话"了)
11
+ [![npm](https://img.shields.io/npm/v/dsh-skill-importer?style=flat-square&color=5dd8bd&label=npm)](https://www.npmjs.com/package/dsh-skill-importer)
12
+ [![downloads](https://img.shields.io/npm/dm/dsh-skill-importer?style=flat-square&color=6da8ff)](https://www.npmjs.com/package/dsh-skill-importer)
13
+ [![DeepSeek Harness](https://img.shields.io/badge/DeepSeek_Harness-%E2%89%A50.1.0--rc.6-5965f2?style=flat-square)](https://github.com/deepseek-ai/deepseek-harness)
14
+ [![license](https://img.shields.io/badge/license-MIT-a786ff?style=flat-square)](LICENSE)
15
15
 
16
- 框架的 client→host RPC 是硬编码白名单,没有写文件通道;但 **`dsh-host-webserver` 提供了官方路由注册扩展点**(`ctx.webServer.register`),任何插件都能在 dsh 自己的 Web 服务器(同源)上挂 HTTP 路由:
16
+ <br />
17
17
 
18
- ```
19
- 浏览器读文件 / 输入 URL
20
- │ fetch(同源,无 CORS)
21
- ▼
22
- host 插件路由 /skill-importer/import(注册在 ctx.webServer 上)
23
- │ 直接写文件(host 进程自己的权限,无沙箱、无审批)
24
- ▼
25
- <目标>/<name>/SKILL.md 落地
26
- │
27
- ▼
28
- skill-filesystem 的 watcher 发现 → skills/change → / 菜单、模型目录热刷新
29
- ```
18
+ **English** · [简体中文](README.zh.md) · [Install](#installation) · [How it works](#how-it-works) · [Development](#development)
19
+ </div>
20
+
21
+ ---
22
+
23
+ ## Your skill library, one click away
24
+
25
+ `dsh-skill-importer` is a lightweight plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh`). It turns skills into a first-class part of the Web UI: bring in Markdown from disk or a URL, see every installed copy, and insert a skill into the composer without breaking your flow.
30
26
 
31
- - **无会话**:写盘由 host 进程完成,与任何会话/agent/模型无关
32
- - **无审批**:host 进程拥有用户权限,不像 agent 工具那样受沙箱约束
33
- - **安全**:路由只监听在 dsh 的 loopback 服务器上;`POST` 会校验 `Origin`(仅放行 `127.0.0.1`/`localhost` 来源,其他网页无法调用)
27
+ | Import | Organize | Invoke |
28
+ | :--- | :--- | :--- |
29
+ | Upload `SKILL.md` or paste a URL. Frontmatter is validated and normalized before writing. | Browse skills grouped across project, legacy project, and global roots. Remove any copy individually. | Use the composer picker, run `/skills`, or type `/skill-name` directly. |
34
30
 
35
- ## 安装
31
+ ### Built for a fast loop
36
32
 
37
- 要求 dsh `>= 0.1.0-rc.6`(`npx @deepseek-ai/dsh web` 方式运行)。
33
+ - **No agent or session** — the host writes skill files directly.
34
+ - **Zero model tokens** — imports never enter a model context.
35
+ - **Instant discovery** — the harness watcher hot-refreshes skills after they land.
36
+ - **Workspace-aware** — project skills always target the active registered workspace.
37
+ - **Bilingual UI** — English and Chinese copy follows the harness locale.
38
+ - **Safe by design** — fixed skill roots, 256 KB limit, and same-origin POST checks.
38
39
 
39
- ### 从 npm 安装(已发布后)
40
+ ## Three natural ways to use a skill
41
+
42
+ 1. **Composer picker** — open the pill beside the access-mode selector, search by name, and choose.
43
+ 2. **`/skills` command** — use a familiar command palette, modeled after `/model`.
44
+ 3. **Direct invocation** — type `/skill-name` and keep moving.
45
+
46
+ All three fill the composer with the same highlighted `/name ` gesture; sending injects the skill instructions through dsh's native flow.
47
+
48
+ ## Installation
49
+
50
+ ### 1. Add the plugin to the Web profile
40
51
 
41
52
  ```sh
42
- # 1. 安装插件包(等价于在 profile 里 add)
43
53
  dsh plugin --profile web add dsh-skill-importer
54
+ ```
55
+
56
+ ### 2. Enable it in the profile
44
57
 
45
- # 2. 在 $DSH_HOME/profiles/web/cordis.patch.yml 里追加一行:
46
- # - id: skill-importer
47
- # name: 'dsh-skill-importer'
58
+ Add the following entry to `$DSH_HOME/profiles/web/cordis.patch.yml`:
48
59
 
49
- # 3. 重启 dsh web
60
+ ```yaml
61
+ - id: skill-importer
62
+ name: dsh-skill-importer
50
63
  ```
51
64
 
52
- ### 从本地路径安装(开发中)
65
+ ### 3. Restart dsh Web
53
66
 
54
- ```sh
55
- # 1. 构建
56
- npm install
57
- npm run build
67
+ Open **Settings → Skills**. Import a Markdown file or URL, choose a target, and the skill will appear as soon as the filesystem watcher discovers it.
58
68
 
59
- # 2. 装进 web profile(本地路径)
60
- dsh plugin --profile web add /path/to/dsh-skill-importer
69
+ > Requires DeepSeek Harness `>= 0.1.0-rc.6` via `npx @deepseek-ai/dsh web`.
61
70
 
62
- # 3. 同上在 cordis.patch.yml 追加插件行
71
+ ## How it works
63
72
 
64
- # 4. 重启 dsh web
65
- ```
73
+ The dsh client-to-host RPC is a fixed allowlist with no file-write channel. This plugin uses the official `ctx.webServer.register` extension point exposed by [`dsh-host-webserver`](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/host/webserver) and registers same-origin `/skill-importer/*` routes on the harness server.
66
74
 
67
- 设置页左侧导航出现「技能」分区。
75
+ ```text
76
+ Markdown file or URL
77
+ │ same-origin fetch
78
+ ▼
79
+ /skill-importer/import
80
+ │ host filesystem write
81
+ ▼
82
+ <skill-root>/<name>/SKILL.md
83
+ │ watcher event
84
+ ▼
85
+ skills/change → hot refresh
86
+ ```
68
87
 
69
- ## 使用
88
+ POST routes verify the `Origin` header and only accept loopback sources (`127.0.0.1` or `localhost`). Writes are restricted to these standard roots:
70
89
 
71
- 设置 → 技能 → 导入 → 从文件:选一个 Markdown(带 `name`/`description` frontmatter)→ 预览校验 → 选目标目录 → 点「导入」→ 立即写入并自动刷新列表。之后在会话输入框敲 `/` 即可使用新技能。
90
+ | Scope | Directory |
91
+ | :--- | :--- |
92
+ | Project | `.agents/skills` |
93
+ | Legacy project | `.dsh/skills` |
94
+ | Global | `~/.dsh/skills` |
72
95
 
73
- ## 开发
96
+ ## Development
74
97
 
75
98
  ```sh
76
99
  npm install
77
- npm run build # tsc 产出 lib/types,tsdown 产出 lib/index.js + lib/client.js
100
+ npm run build
78
101
  ```
79
102
 
80
- - `src/index.ts`:host 插件体——把四个路由注册到 `ctx.webServer`(`inject: ['webServer']`)
81
- - `src/server.ts`:纯 Node 逻辑(写盘、扫描、URL 抓取、HTTP 层),无 Cordis 依赖,可直接 `node` 冒烟测试
82
- - `src/types.ts`:host/client 共享的线格式类型
83
- - `src/client/index.ts`:浏览器插件体(`settings.section` 注册 + fetch 同源路由)
84
- - `src/client/SkillImporterSection.tsx`:设置页组件(纯展示)
103
+ | Area | Source |
104
+ | :--- | :--- |
105
+ | Host plugin and route registration | `src/index.ts` |
106
+ | Filesystem, URL import, and HTTP logic | `src/server.ts` |
107
+ | Shared wire types | `src/types.ts` |
108
+ | Browser plugin and `/skills` command | `src/client/index.ts` |
109
+ | Composer picker | `src/client/SkillsPicker.tsx` |
110
+ | Settings experience | `src/client/SkillImporterSection.tsx` |
85
111
 
86
- 路由一览:`GET /skill-importer/health` · `GET /skill-importer/list` · `POST /skill-importer/import` · `POST /skill-importer/import-url` · `POST /skill-importer/delete`
112
+ Available routes: `GET /skill-importer/health` · `GET /skill-importer/list` · `POST /skill-importer/import` · `POST /skill-importer/import-url` · `POST /skill-importer/delete`
113
+
114
+ ### Local checkout
115
+
116
+ ```sh
117
+ npm install
118
+ npm run build
119
+ dsh plugin --profile web add /path/to/dsh-skill-importer
120
+ ```
87
121
 
122
+ Add the profile entry shown above, then restart dsh Web.
88
123
 
89
- ## 已知限制
124
+ ## Notes
90
125
 
91
- - 单文件 ≤ 256 KB
92
- - URL 导入对 HTML 页面只做粗略文本提取,推荐指向 `.md` 文件
93
- - 目标目录固定为三个标准技能根(不支持任意路径,这是安全边界)
94
- - 导入后列表由前端轮询刷新(2 秒间隔,最多 20 秒);如果目录被外部改动,点「刷新」立即同步
126
+ - A single imported file may be up to 256 KB.
127
+ - URL import preserves `.md` sources; HTML pages use lightweight text extraction, so direct Markdown URLs work best.
128
+ - The installed list polls briefly after import (every 2 seconds for up to 20 seconds). **Refresh** syncs external changes immediately.
95
129
 
96
130
  ## License
97
131
 
98
- MIT
132
+ Released under the [MIT License](LICENSE).
package/README.zh.md ADDED
@@ -0,0 +1,132 @@
1
+ <div align="center">
2
+ <img src="assets/hero.svg" alt="dsh-skill-importer — 在需要的地方,调用你的技能" width="100%" />
3
+
4
+ <br />
5
+
6
+ <strong>把技能管理带进 DeepSeek Harness Web UI。</strong><br />
7
+ 无需会话、不耗模型 Token、没有审批往返,导入后立即可用。
8
+
9
+ <br /><br />
10
+
11
+ [![npm](https://img.shields.io/npm/v/dsh-skill-importer?style=flat-square&color=5dd8bd&label=npm)](https://www.npmjs.com/package/dsh-skill-importer)
12
+ [![downloads](https://img.shields.io/npm/dm/dsh-skill-importer?style=flat-square&color=6da8ff)](https://www.npmjs.com/package/dsh-skill-importer)
13
+ [![DeepSeek Harness](https://img.shields.io/badge/DeepSeek_Harness-%E2%89%A50.1.0--rc.6-5965f2?style=flat-square)](https://github.com/deepseek-ai/deepseek-harness)
14
+ [![license](https://img.shields.io/badge/license-MIT-a786ff?style=flat-square)](LICENSE)
15
+
16
+ <br />
17
+
18
+ [English](README.md) · **简体中文** · [安装](#安装) · [工作原理](#工作原理) · [开发](#开发)
19
+ </div>
20
+
21
+ ---
22
+
23
+ ## 你的技能库,一键即达
24
+
25
+ `dsh-skill-importer` 是 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh`)的轻量技能管理插件。它把技能变成 Web UI 的一等公民:从本地或 URL 导入 Markdown、查看每一份已安装副本,并在输入框中自然调用,全程不打断工作流。
26
+
27
+ | 导入 | 管理 | 调用 |
28
+ | :--- | :--- | :--- |
29
+ | 上传 `SKILL.md` 或粘贴 URL,写入前自动校验并规范化 frontmatter。 | 按项目、旧版项目和全局目录分组查看,每个副本都能独立删除。 | 使用输入框选择器、运行 `/skills`,或直接输入 `/skill-name`。 |
30
+
31
+ ### 为高速工作流而生
32
+
33
+ - **无需 Agent 或会话** — host 进程直接写入技能文件。
34
+ - **零模型 Token** — 导入过程不会进入模型上下文。
35
+ - **即时发现** — 文件落盘后由 harness watcher 热刷新。
36
+ - **工作区感知** — 项目技能始终写入当前注册工作区。
37
+ - **中英双语** — UI 文案自动跟随 harness 语言。
38
+ - **安全边界清晰** — 固定技能目录、256 KB 限制、同源 POST 校验。
39
+
40
+ ## 三种自然的技能入口
41
+
42
+ 1. **输入框选择器** — 点击权限模式旁边的 pill,按名称搜索并选中。
43
+ 2. **`/skills` 命令** — 像使用 `/model` 一样打开技能命令面板。
44
+ 3. **直接调用** — 输入 `/skill-name`,继续你的工作。
45
+
46
+ 三种入口最终都会在输入框填入同一个高亮的 `/name ` 手势;发送后由 dsh 原生流程注入技能指令。
47
+
48
+ ## 安装
49
+
50
+ ### 1. 安装到 Web profile
51
+
52
+ ```sh
53
+ dsh plugin --profile web add dsh-skill-importer
54
+ ```
55
+
56
+ ### 2. 在 profile 中启用
57
+
58
+ 向 `$DSH_HOME/profiles/web/cordis.patch.yml` 添加:
59
+
60
+ ```yaml
61
+ - id: skill-importer
62
+ name: dsh-skill-importer
63
+ ```
64
+
65
+ ### 3. 重启 dsh Web
66
+
67
+ 打开 **设置 → 技能**,选择 Markdown 文件或粘贴 URL,再选择目标目录。文件系统 watcher 发现后,技能会立即出现。
68
+
69
+ > 需要 DeepSeek Harness `>= 0.1.0-rc.6`,使用 `npx @deepseek-ai/dsh web` 运行。
70
+
71
+ ## 工作原理
72
+
73
+ dsh 的 client→host RPC 是固定白名单,没有文件写入通道。本插件使用 [`dsh-host-webserver`](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/host/webserver) 提供的官方 `ctx.webServer.register` 扩展点,在 harness 自身服务器上注册同源 `/skill-importer/*` 路由。
74
+
75
+ ```text
76
+ Markdown 文件或 URL
77
+ │ 同源 fetch
78
+ ▼
79
+ /skill-importer/import
80
+ │ host 文件系统写入
81
+ ▼
82
+ <skill-root>/<name>/SKILL.md
83
+ │ watcher 事件
84
+ ▼
85
+ skills/change → 热刷新
86
+ ```
87
+
88
+ 所有 POST 路由都会校验 `Origin`,仅接受 loopback 来源(`127.0.0.1` 或 `localhost`)。写入范围固定为三个标准目录:
89
+
90
+ | 范围 | 目录 |
91
+ | :--- | :--- |
92
+ | 项目 | `.agents/skills` |
93
+ | 旧版项目 | `.dsh/skills` |
94
+ | 全局 | `~/.dsh/skills` |
95
+
96
+ ## 开发
97
+
98
+ ```sh
99
+ npm install
100
+ npm run build
101
+ ```
102
+
103
+ | 模块 | 源码 |
104
+ | :--- | :--- |
105
+ | Host 插件与路由注册 | `src/index.ts` |
106
+ | 文件系统、URL 导入与 HTTP 逻辑 | `src/server.ts` |
107
+ | Host/client 共享类型 | `src/types.ts` |
108
+ | 浏览器插件与 `/skills` 命令 | `src/client/index.ts` |
109
+ | 输入框技能选择器 | `src/client/SkillsPicker.tsx` |
110
+ | 设置页 | `src/client/SkillImporterSection.tsx` |
111
+
112
+ 路由一览:`GET /skill-importer/health` · `GET /skill-importer/list` · `POST /skill-importer/import` · `POST /skill-importer/import-url` · `POST /skill-importer/delete`
113
+
114
+ ### 本地源码安装
115
+
116
+ ```sh
117
+ npm install
118
+ npm run build
119
+ dsh plugin --profile web add /path/to/dsh-skill-importer
120
+ ```
121
+
122
+ 随后添加上文的 profile 配置并重启 dsh Web。
123
+
124
+ ## 注意事项
125
+
126
+ - 单个导入文件最大 256 KB。
127
+ - URL 导入会原样保留 `.md`;HTML 页面仅做轻量正文提取,因此推荐使用 Markdown 直链。
128
+ - 导入后列表会短暂轮询(每 2 秒一次,最多 20 秒);外部改动可点击 **刷新** 立即同步。
129
+
130
+ ## License
131
+
132
+ 基于 [MIT License](LICENSE) 开源。
@@ -0,0 +1,6 @@
1
+ # dsh-skill-importer bundle patch: one plugin row, applied as a bundle layer.
2
+ # Declared by the package's dsh.bundle manifest; `dsh plugin --profile <p> add
3
+ # dsh-skill-importer` appends it to the profile's bundle stack automatically.
4
+ - insert:
5
+ - id: skill-importer
6
+ name: 'dsh-skill-importer'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-skill-importer",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Web UI plugin for DeepSeek Harness: import skills from local Markdown files or URLs into the skill roots the harness discovers automatically",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -27,12 +27,16 @@
27
27
  "@deepseek-ai/dsh-api-remotes"
28
28
  ],
29
29
  "platform": "web"
30
+ },
31
+ "bundle": {
32
+ "patch": "./cordis.patch.yml"
30
33
  }
31
34
  },
32
35
  "files": [
33
36
  "lib/index.js",
34
37
  "lib/client.js",
35
- "lib/types/**/*.d.ts"
38
+ "lib/types/**/*.d.ts",
39
+ "cordis.patch.yml"
36
40
  ],
37
41
  "scripts": {
38
42
  "build": "rm -rf lib && tsc -p tsconfig.json && tsdown",