dsh-skill-importer 0.1.2 → 0.2.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.
- package/README.md +62 -14
- package/README.zh.md +63 -15
- package/lib/client.js +1147 -308
- package/lib/index.js +385 -23
- package/lib/types/client/index.d.ts +7 -1
- package/lib/types/client/locales.d.ts +56 -8
- package/lib/types/index.d.ts +5 -1
- package/lib/types/server.d.ts +39 -9
- package/lib/types/types.d.ts +48 -3
- package/package.json +7 -2
- package/src/frontmatter.ts +112 -0
- package/src/server.ts +605 -0
- package/src/types.ts +123 -0
- package/tests/batch-import.test.mjs +104 -0
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
| Import | Organize | Invoke |
|
|
28
28
|
| :--- | :--- | :--- |
|
|
29
|
-
| Upload `SKILL.md
|
|
29
|
+
| Upload `SKILL.md`, paste a URL, or migrate a complete skills directory from Claude Code, Codex, and similar agents. | Browse skills grouped across project and global roots. Remove any copy individually. | Use the composer picker, run `/skills`, or type `/skill-name` directly. |
|
|
30
30
|
|
|
31
31
|
### Built for a fast loop
|
|
32
32
|
|
|
@@ -37,6 +37,12 @@
|
|
|
37
37
|
- **Bilingual UI** — English and Chinese copy follows the harness locale.
|
|
38
38
|
- **Safe by design** — fixed skill roots, 256 KB limit, and same-origin POST checks.
|
|
39
39
|
|
|
40
|
+
### Batch migration with a real preflight
|
|
41
|
+
|
|
42
|
+
The third import entry accepts a local skills root such as `~/.claude/skills`, `~/.codex/skills`, or another `.agents/skills` directory. It scans before it writes, validates every `SKILL.md`, preserves each skill's `scripts`, `references`, `assets`, and other resources, and reports invalid entries without touching the destination.
|
|
43
|
+
|
|
44
|
+
Destination name conflicts are skipped by default. Choose **Replace** per skill, review the add/replace/skip summary, then confirm. Each accepted skill is copied through a same-root staging directory; replacements keep a temporary backup and roll back if the swap fails. A preflight is single-use, expires after ten minutes, and verifies source-content fingerprints again at commit time.
|
|
45
|
+
|
|
40
46
|
## Three natural ways to use a skill
|
|
41
47
|
|
|
42
48
|
1. **Composer picker** — open the pill beside the access-mode selector, search by name, and choose.
|
|
@@ -47,26 +53,68 @@ All three fill the composer with the same highlighted `/name ` gesture; sending
|
|
|
47
53
|
|
|
48
54
|
## Installation
|
|
49
55
|
|
|
50
|
-
###
|
|
56
|
+
### First install
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-skill-importer@latest
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The plugin registers itself with the Web profile through `dsh.bundle`; do not edit `cordis.patch.yml` manually.
|
|
63
|
+
|
|
64
|
+
Restart dsh Web after installation:
|
|
51
65
|
|
|
52
66
|
```sh
|
|
53
|
-
dsh
|
|
67
|
+
npx @deepseek-ai/dsh web
|
|
54
68
|
```
|
|
55
69
|
|
|
56
|
-
###
|
|
70
|
+
### Update to the latest version
|
|
57
71
|
|
|
58
|
-
|
|
72
|
+
Existing users can run the same command to update:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-skill-importer@latest
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Updating replaces only the plugin package. It does not remove project skills in `.agents/skills` or global skills in `~/.dsh/skills`. Restart dsh Web after updating.
|
|
79
|
+
|
|
80
|
+
Check the latest published version:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
npm view dsh-skill-importer version
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
List the plugins installed in the Web profile:
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
npx @deepseek-ai/dsh plugin --profile web list
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Supply-chain waiting period for new releases
|
|
93
|
+
|
|
94
|
+
DSH profiles use pnpm to manage plugins. pnpm's `minimumReleaseAge` policy delays newly published versions; during that window, `@latest` may still resolve to the previous mature release. This is an intentional supply-chain safeguard, not a download failure. The recommended path is to wait for the profile's configured window, then rerun the `@latest` command above.
|
|
95
|
+
|
|
96
|
+
Pre-1.0 semver ranges also stop at the next minor: for example, `^0.1.2` does not include `0.2.0`. After the waiting period, specify the target version when crossing a minor:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-skill-importer@X.Y.Z
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
If you have verified the release and must install it immediately, add a temporary exception for that **exact version** to `$DSH_HOME/profiles/web/pnpm-workspace.yaml`, then run the exact-version command:
|
|
59
103
|
|
|
60
104
|
```yaml
|
|
61
|
-
|
|
62
|
-
|
|
105
|
+
minimumReleaseAgeExclude:
|
|
106
|
+
- dsh-skill-importer@X.Y.Z
|
|
63
107
|
```
|
|
64
108
|
|
|
65
|
-
|
|
109
|
+
Replace both `X.Y.Z` placeholders with the same target version. This opts that version out of the supply-chain waiting period. Do not permanently exempt the package name; remove the exact-version exception after the release matures.
|
|
110
|
+
|
|
111
|
+
Open **Settings → Skills**. Import a Markdown file or URL, or choose **Batch import** to migrate another agent's complete skills directory. Choose a target and the imported skills will appear as soon as the filesystem watcher discovers them.
|
|
112
|
+
|
|
113
|
+
> Requires DeepSeek Harness `>= 0.1.0-rc.6`.
|
|
66
114
|
|
|
67
|
-
|
|
115
|
+
### Duplicate plugin after upgrading
|
|
68
116
|
|
|
69
|
-
|
|
117
|
+
If startup fails with `duplicate loader entry id: skill-importer`, the profile still contains the old manual configuration. Remove the manually added `skill-importer` entry from `$DSH_HOME/profiles/web/cordis.patch.yml`, then restart dsh Web. Current releases register automatically and do not need that entry.
|
|
70
118
|
|
|
71
119
|
## How it works
|
|
72
120
|
|
|
@@ -90,7 +138,6 @@ POST routes verify the `Origin` header and only accept loopback sources (`127.0.
|
|
|
90
138
|
| Scope | Directory |
|
|
91
139
|
| :--- | :--- |
|
|
92
140
|
| Project | `.agents/skills` |
|
|
93
|
-
| Legacy project | `.dsh/skills` |
|
|
94
141
|
| Global | `~/.dsh/skills` |
|
|
95
142
|
|
|
96
143
|
## Development
|
|
@@ -109,7 +156,7 @@ npm run build
|
|
|
109
156
|
| Composer picker | `src/client/SkillsPicker.tsx` |
|
|
110
157
|
| Settings experience | `src/client/SkillImporterSection.tsx` |
|
|
111
158
|
|
|
112
|
-
Available routes: `GET /skill-importer/health` · `GET /skill-importer/list` · `POST /skill-importer/import` · `POST /skill-importer/import-url` · `POST /skill-importer/delete`
|
|
159
|
+
Available routes: `GET /skill-importer/health` · `GET /skill-importer/list` · `POST /skill-importer/import` · `POST /skill-importer/import-url` · `POST /skill-importer/delete` · `POST /skill-importer/batch/scan` · `POST /skill-importer/batch/commit`
|
|
113
160
|
|
|
114
161
|
### Local checkout
|
|
115
162
|
|
|
@@ -119,12 +166,13 @@ npm run build
|
|
|
119
166
|
dsh plugin --profile web add /path/to/dsh-skill-importer
|
|
120
167
|
```
|
|
121
168
|
|
|
122
|
-
|
|
169
|
+
If `dsh` is not installed globally, replace the last line with `npx @deepseek-ai/dsh plugin --profile web add /path/to/dsh-skill-importer`. The plugin registers automatically; restart dsh Web afterward.
|
|
123
170
|
|
|
124
171
|
## Notes
|
|
125
172
|
|
|
126
173
|
- A single imported file may be up to 256 KB.
|
|
127
|
-
-
|
|
174
|
+
- Batch import accepts `.claude/skills`, `.codex/skills`, `.agents/skills`, `.dsh/skills`, or one skill directory directly below those roots. A scan accepts up to 200 skills; each skill may contain up to 2,000 files and 10 MB of resources. Symbolic links are refused.
|
|
175
|
+
- URL import is HTTPS-only and refuses loopback, private, link-local, and reserved addresses; every redirect is validated again. `.md` sources are preserved, while HTML pages use lightweight text extraction, so direct Markdown URLs work best.
|
|
128
176
|
- The installed list polls briefly after import (every 2 seconds for up to 20 seconds). **Refresh** syncs external changes immediately.
|
|
129
177
|
|
|
130
178
|
## License
|
package/README.zh.md
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
| 导入 | 管理 | 调用 |
|
|
28
28
|
| :--- | :--- | :--- |
|
|
29
|
-
| 上传 `SKILL.md
|
|
29
|
+
| 上传 `SKILL.md`、粘贴 URL,或从 Claude Code、Codex 等 Agent 的技能目录完整迁移。 | 按项目和全局目录分组查看,每个副本都能独立删除。 | 使用输入框选择器、运行 `/skills`,或直接输入 `/skill-name`。 |
|
|
30
30
|
|
|
31
31
|
### 为高速工作流而生
|
|
32
32
|
|
|
@@ -37,6 +37,12 @@
|
|
|
37
37
|
- **中英双语** — UI 文案自动跟随 harness 语言。
|
|
38
38
|
- **安全边界清晰** — 固定技能目录、256 KB 限制、同源 POST 校验。
|
|
39
39
|
|
|
40
|
+
### 带完整预检的批量迁移
|
|
41
|
+
|
|
42
|
+
第三个导入入口支持选择 `~/.claude/skills`、`~/.codex/skills` 或其他 `.agents/skills` 目录。写入前会扫描并校验每个 `SKILL.md`,同时完整保留技能的 `scripts`、`references`、`assets` 等资源;不合规项只展示错误,绝不会写入目标目录。
|
|
43
|
+
|
|
44
|
+
目标中存在同名技能时默认跳过。用户可逐项勾选「替换」,检查新增、替换和跳过数量后再确认。每个技能先复制到目标根目录下的临时目录;替换时会暂存旧版本,交换失败自动回滚。扫描结果只能提交一次、十分钟后过期,并在提交时重新核对源内容摘要。
|
|
45
|
+
|
|
40
46
|
## 三种自然的技能入口
|
|
41
47
|
|
|
42
48
|
1. **输入框选择器** — 点击权限模式旁边的 pill,按名称搜索并选中。
|
|
@@ -47,26 +53,68 @@
|
|
|
47
53
|
|
|
48
54
|
## 安装
|
|
49
55
|
|
|
50
|
-
###
|
|
56
|
+
### 首次安装
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-skill-importer@latest
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
插件通过 `dsh.bundle` 自动注册到 Web profile,无需手动修改 `cordis.patch.yml`。
|
|
63
|
+
|
|
64
|
+
安装完成后重启 dsh Web:
|
|
51
65
|
|
|
52
66
|
```sh
|
|
53
|
-
dsh
|
|
67
|
+
npx @deepseek-ai/dsh web
|
|
54
68
|
```
|
|
55
69
|
|
|
56
|
-
###
|
|
70
|
+
### 更新到最新版
|
|
57
71
|
|
|
58
|
-
|
|
72
|
+
已安装用户执行同一条命令即可更新:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-skill-importer@latest
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
更新只会替换插件包,不会删除 `.agents/skills` 中的项目技能或 `~/.dsh/skills` 中的全局技能。更新后请重启 dsh Web。
|
|
79
|
+
|
|
80
|
+
查看 npm 上的最新版本:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
npm view dsh-skill-importer version
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
查看 Web profile 中已安装的插件:
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
npx @deepseek-ai/dsh plugin --profile web list
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### 新版本的安全等待期
|
|
93
|
+
|
|
94
|
+
DSH profile 使用 pnpm 管理插件。pnpm 会按 `minimumReleaseAge` 暂缓安装刚发布的版本;在等待期内,`@latest` 可能仍解析到上一个已成熟版本。这是供应链保护机制,不是下载失败。推荐等待 profile 配置的时间窗口结束后,再执行上面的 `@latest` 命令。
|
|
95
|
+
|
|
96
|
+
`0.x` 版本还遵循特殊的 semver 范围:例如 `^0.1.2` 不包含 `0.2.0`。跨 minor 更新时可在等待期结束后明确指定目标版本:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-skill-importer@X.Y.Z
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
如果已经核验该版本并且必须立即安装,可在 `$DSH_HOME/profiles/web/pnpm-workspace.yaml` 中为这个**精确版本**添加临时信任例外,再执行精确版本命令:
|
|
59
103
|
|
|
60
104
|
```yaml
|
|
61
|
-
|
|
62
|
-
|
|
105
|
+
minimumReleaseAgeExclude:
|
|
106
|
+
- dsh-skill-importer@X.Y.Z
|
|
63
107
|
```
|
|
64
108
|
|
|
65
|
-
|
|
109
|
+
将两处 `X.Y.Z` 替换为同一个目标版本。这会绕过该版本的供应链等待期,不建议把包名永久加入例外列表。版本成熟后可以删除这条例外。
|
|
110
|
+
|
|
111
|
+
打开 **设置 → 技能**,选择 Markdown 文件、粘贴 URL,或通过「批量导入」迁移其他 Agent 的完整技能目录,再选择目标范围。文件系统 watcher 发现后,技能会立即出现。
|
|
112
|
+
|
|
113
|
+
> 需要 DeepSeek Harness `>= 0.1.0-rc.6`。
|
|
66
114
|
|
|
67
|
-
|
|
115
|
+
### 旧配置导致重复插件
|
|
68
116
|
|
|
69
|
-
|
|
117
|
+
如果启动时报错 `duplicate loader entry id: skill-importer`,说明 profile 中还保留了旧版手动配置。请从 `$DSH_HOME/profiles/web/cordis.patch.yml` 删除手动添加的 `skill-importer` 条目,再重启 dsh Web。当前版本会自动注册,不需要保留该条目。
|
|
70
118
|
|
|
71
119
|
## 工作原理
|
|
72
120
|
|
|
@@ -85,12 +133,11 @@ Markdown 文件或 URL
|
|
|
85
133
|
skills/change → 热刷新
|
|
86
134
|
```
|
|
87
135
|
|
|
88
|
-
所有 POST 路由都会校验 `Origin`,仅接受 loopback 来源(`127.0.0.1` 或 `localhost
|
|
136
|
+
所有 POST 路由都会校验 `Origin`,仅接受 loopback 来源(`127.0.0.1` 或 `localhost`)。写入范围固定为两个标准目录:
|
|
89
137
|
|
|
90
138
|
| 范围 | 目录 |
|
|
91
139
|
| :--- | :--- |
|
|
92
140
|
| 项目 | `.agents/skills` |
|
|
93
|
-
| 旧版项目 | `.dsh/skills` |
|
|
94
141
|
| 全局 | `~/.dsh/skills` |
|
|
95
142
|
|
|
96
143
|
## 开发
|
|
@@ -109,7 +156,7 @@ npm run build
|
|
|
109
156
|
| 输入框技能选择器 | `src/client/SkillsPicker.tsx` |
|
|
110
157
|
| 设置页 | `src/client/SkillImporterSection.tsx` |
|
|
111
158
|
|
|
112
|
-
路由一览:`GET /skill-importer/health` · `GET /skill-importer/list` · `POST /skill-importer/import` · `POST /skill-importer/import-url` · `POST /skill-importer/delete`
|
|
159
|
+
路由一览:`GET /skill-importer/health` · `GET /skill-importer/list` · `POST /skill-importer/import` · `POST /skill-importer/import-url` · `POST /skill-importer/delete` · `POST /skill-importer/batch/scan` · `POST /skill-importer/batch/commit`
|
|
113
160
|
|
|
114
161
|
### 本地源码安装
|
|
115
162
|
|
|
@@ -119,12 +166,13 @@ npm run build
|
|
|
119
166
|
dsh plugin --profile web add /path/to/dsh-skill-importer
|
|
120
167
|
```
|
|
121
168
|
|
|
122
|
-
|
|
169
|
+
如果没有全局 `dsh` 命令,可将最后一行替换为 `npx @deepseek-ai/dsh plugin --profile web add /path/to/dsh-skill-importer`。插件会自动注册,随后重启 dsh Web 即可。
|
|
123
170
|
|
|
124
171
|
## 注意事项
|
|
125
172
|
|
|
126
173
|
- 单个导入文件最大 256 KB。
|
|
127
|
-
-
|
|
174
|
+
- 批量导入仅接受 `.claude/skills`、`.codex/skills`、`.agents/skills`、`.dsh/skills` 或其中的单个技能目录;每次最多扫描 200 个技能,单个技能最多包含 2,000 个文件和 10 MB 资源,不接受符号链接。
|
|
175
|
+
- URL 导入仅支持 HTTPS,并拒绝本机、私有网络、链路本地和保留地址;每次重定向都会重新校验。`.md` 会原样保留,HTML 页面仅做轻量正文提取,因此推荐使用 Markdown 直链。
|
|
128
176
|
- 导入后列表会短暂轮询(每 2 秒一次,最多 20 秒);外部改动可点击 **刷新** 立即同步。
|
|
129
177
|
|
|
130
178
|
## License
|