@lijian-ui/dsh-skill-manage 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 lijian-ui
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,181 @@
1
+ # dsh-skill-manage · Skill Management Plugin
2
+
3
+ **English** | [中文](./README.zh-CN.md)
4
+
5
+ > A skill management plugin for DeepSeek Harness (dsh) desktop: list / enable / disable / delete / add / migrate skills, filling the gap in dsh's official skill toggle control.
6
+
7
+ ## Features
8
+
9
+ | Feature | Description |
10
+ |---|---|
11
+ | Skill List | Display all skills grouped by scope (global / workspace), with search |
12
+ | Enable / Disable | Toggle switch for hot enable/disable, no restart required |
13
+ | Delete Skill | Permanently remove skill files with a custom confirmation dialog |
14
+ | Add Skill | Upload new skills from local files (directory bundle or single file) |
15
+ | Skill Details | Render skill content as Markdown, display frontmatter metadata table |
16
+ | Batch Migrate | Copy or move skills between global / workspace scopes |
17
+
18
+ ## Background
19
+
20
+ dsh officially has **no** skill enable/disable control — no CLI command, no settings UI, no slash command, no config file field, no API method. The only official "control" is via frontmatter fields `disable-model-invocation` and `user-invocable`, which require manual file editing and don't truly disable the skill (it's still discovered and loaded, just hidden from certain interfaces).
21
+
22
+ This plugin implements true toggle control via a `.disabled` file rename mechanism: renaming `SKILL.md` to `SKILL.md.disabled` causes dsh's official provider to ignore the file (it only recognizes `.md` extensions), effectively "disabling" the skill.
23
+
24
+ ## Installation
25
+
26
+ ### Prerequisites
27
+
28
+ - DeepSeek Harness (dsh) desktop
29
+ - Node.js >= 18
30
+
31
+ ### Integration in dsh-desktop
32
+
33
+ 1. Add the plugin as a project dependency:
34
+
35
+ ```bash
36
+ npm install @lijian-ui/dsh-skill-manage
37
+ ```
38
+
39
+ 2. Register the plugin in dsh desktop's plugin configuration (typically in `src/main/profile-init.ts`).
40
+
41
+ 3. Restart the desktop app.
42
+
43
+ ### Local Development
44
+
45
+ ```bash
46
+ # Enter the plugin directory
47
+ cd extensions/dsh-skill-manage
48
+
49
+ # Install dependencies
50
+ npm install
51
+
52
+ # Build
53
+ npm run build
54
+
55
+ # Watch mode
56
+ npm run watch
57
+
58
+ # Type check
59
+ npm run typecheck
60
+ ```
61
+
62
+ Build output goes to `lib/` and is automatically synced to `node_modules/@lijian-ui/dsh-skill-manage` via junction. Restart the desktop app after each build to load the new bundle.
63
+
64
+ ## Usage
65
+
66
+ 1. Open dsh desktop
67
+ 2. Navigate to **Settings** → **Skill Manage**
68
+ 3. In the skill list:
69
+ - Click the toggle switch to enable/disable a skill
70
+ - Click the delete button to permanently remove a skill
71
+ - Click a skill card to view details
72
+ - Use the search box to filter skills
73
+ - Click "Add skill" to upload a new skill
74
+ - Click "Batch migrate" to move skills between scopes
75
+
76
+ ### Skill File Convention
77
+
78
+ | State | Directory Bundle | Flat File |
79
+ |---|---|---|
80
+ | Enabled | `<name>/SKILL.md` | `<name>.md` |
81
+ | Disabled | `<name>/SKILL.md.disabled` | `<name>.md.disabled` |
82
+
83
+ ### Skill Scopes
84
+
85
+ | Scope | Path | Description |
86
+ |---|---|---|
87
+ | Global dsh | `~/.dsh/skills/` | User global skills |
88
+ | Global agents | `~/.agents/skills/` | Agents global skills |
89
+ | Workspace | `<workspace>/.dsh/skills/` | Project-level skills |
90
+ | Bundled | `DSH_BUNDLED_SKILL_DIR` | Deployment-bundled, read-only |
91
+
92
+ ## Technical Architecture
93
+
94
+ ### Directory Structure
95
+
96
+ ```
97
+ extensions/dsh-skill-manage/
98
+ ├── src/
99
+ │ ├── index.ts # Host entry
100
+ │ ├── remote.ts # Host RPC methods (list/setEnabled/deleteSkill/migrate etc.)
101
+ │ ├── skill-files.ts # File conventions (DISABLED_SUFFIX, collectSkillEntries)
102
+ │ ├── scope.ts # Migration engine
103
+ │ └── client/
104
+ │ ├── index.ts # Client entry (SECTION_ID, RPC registration, inject)
105
+ │ ├── SkillManageSection.tsx # Main settings component (card list + toggle + detail dialog)
106
+ │ └── client-i18n.ts # Client i18n (zh/en)
107
+ ├── lib/ # Build output
108
+ ├── docs/
109
+ │ └── troubleshooting-and-bugs.md # Troubleshooting & official bug analysis
110
+ ├── package.json
111
+ └── tsdown.config.ts
112
+ ```
113
+
114
+ ### Host Side (`src/remote.ts`)
115
+
116
+ Provides the following RPC methods:
117
+
118
+ | Method | Function |
119
+ |---|---|
120
+ | `list(sessionId)` | List all skills with enabled status |
121
+ | `content(name, sessionId)` | Get full skill content |
122
+ | `setEnabled(name, sessionId, enabled)` | Enable/disable skill (file rename) |
123
+ | `deleteSkill(name, sessionId)` | Delete skill |
124
+ | `addSkill(sessionId, payload)` | Add new skill |
125
+ | `workspaces()` | List available workspaces |
126
+ | `migrate(name, sessionId, payload)` | Migrate a single skill |
127
+ | `batchMigrate(sessionId, payload)` | Batch migrate skills |
128
+
129
+ ### Client Side (`src/client/`)
130
+
131
+ - **`index.ts`**: Registers the settings section via `ctx.slots.inject`
132
+ - **`SkillManageSection.tsx`**: React component rendering skill cards, toggle switches, detail dialog, delete confirmation, and migration dialog
133
+ - **`client-i18n.ts`**: Chinese/English translations
134
+
135
+ ### Toggle Mechanism
136
+
137
+ ```
138
+ User clicks toggle
139
+ → Client optimistically updates UI (immediate switch state change)
140
+ → RPC call to host setEnabled
141
+ → Host: rename(SKILL.md ↔ SKILL.md.disabled)
142
+ → dsh chokidar watcher detects file change
143
+ → Registry cache invalidated (revision++)
144
+ → After 800ms delay, ctx.emit('connection/reset')
145
+ → Client fetches Map cleared
146
+ → Next / completion re-queries → gets latest skill list
147
+ ```
148
+
149
+ ## Known Issues & Solutions
150
+
151
+ ### Slash command completion not refreshing after enabling a skill
152
+
153
+ **Issue**: After enabling a skill, the `/` slash command completion menu in the chat doesn't show the newly enabled skill.
154
+
155
+ **Root Cause**: dsh's official `dsh-client-ui-skill` package is missing a subscription to the `skills/change` event, causing the client-side skill list cache to never be invalidated when skill files change.
156
+
157
+ **Our Solution**: In `reloadAfterHot`, after an 800ms delay, call `ctx.emit('connection/reset')` to silently refresh all module caches. Since the user is in the settings panel, they won't perceive the cache refresh in the chat interface.
158
+
159
+ See [Troubleshooting & Bug Analysis](./docs/troubleshooting-and-bugs.md) for details.
160
+
161
+ ## Internationalization
162
+
163
+ Supports Chinese and English. Translation files are in `src/client/client-i18n.ts`. Language follows the dsh desktop language setting.
164
+
165
+ ## Tech Stack
166
+
167
+ - **Language**: TypeScript
168
+ - **Build**: tsdown (rolldown)
169
+ - **Frontend**: React 18
170
+ - **Markdown Rendering**: `MarkdownText` component from `@deepseek-ai/dsh-client-ui-primitives`
171
+ - **YAML Parsing**: yaml (frontmatter parsing)
172
+ - **File Watching**: dsh's official chokidar watcher (auto-detects skill file changes)
173
+
174
+ ## License
175
+
176
+ MIT
177
+
178
+ ## Related Links
179
+
180
+ - [Troubleshooting & Bug Analysis](./docs/troubleshooting-and-bugs.md)
181
+ - [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/dsh)
@@ -0,0 +1,181 @@
1
+ # dsh-skill-manage · 技能管理插件
2
+
3
+ [English](./README.md) | **中文**
4
+
5
+ > 为 DeepSeek Harness (dsh) 桌面端提供技能管理功能:列表 / 启用 / 停用 / 删除 / 添加 / 迁移,填补 dsh 官方在 skill 开关控制方面的空白。
6
+
7
+ ## 功能概览
8
+
9
+ | 功能 | 说明 |
10
+ |---|---|
11
+ | 技能列表 | 按作用域(全局 / 工作区)分组展示所有技能,支持搜索 |
12
+ | 启用 / 停用 | 滑块按钮热切换,无需重启即可生效 |
13
+ | 删除技能 | 永久删除技能文件,带自定义确认弹窗 |
14
+ | 添加技能 | 从本地文件上传新技能(目录束或单文件) |
15
+ | 技能详情 | Markdown 渲染技能内容,展示 frontmatter 元数据表格 |
16
+ | 批量迁移 | 在全局 / 工作区作用域之间复制或移动技能 |
17
+
18
+ ## 背景
19
+
20
+ dsh 官方目前**没有** skill 启用/停用控制功能——无 CLI 命令、无设置页 UI、无 slash 命令、无配置文件字段、无 API 方法。官方仅提供 frontmatter 的 `disable-model-invocation` 和 `user-invocable` 两个静态字段,需手动编辑文件,且 skill 仍被发现加载,只是从特定接口隐藏。
21
+
22
+ 本插件通过 `.disabled` 文件重命名机制实现真正的开关控制:将 `SKILL.md` 重命名为 `SKILL.md.disabled`,dsh 官方 provider 只识别 `.md` 结尾的文件,`.disabled` 文件会被忽略,从而实现"停用"。
23
+
24
+ ## 安装
25
+
26
+ ### 前置条件
27
+
28
+ - DeepSeek Harness (dsh) 桌面端
29
+ - Node.js >= 18
30
+
31
+ ### 在 dsh-desktop 项目中集成
32
+
33
+ 1. 将插件添加为项目依赖:
34
+
35
+ ```bash
36
+ npm install @lijian-ui/dsh-skill-manage
37
+ ```
38
+
39
+ 2. 在 dsh 桌面端的插件注册配置中添加本插件(通常在 `src/main/profile-init.ts` 中)。
40
+
41
+ 3. 重启桌面端。
42
+
43
+ ### 本地开发
44
+
45
+ ```bash
46
+ # 进入插件目录
47
+ cd extensions/dsh-skill-manage
48
+
49
+ # 安装依赖
50
+ npm install
51
+
52
+ # 构建
53
+ npm run build
54
+
55
+ # 监听模式
56
+ npm run watch
57
+
58
+ # 类型检查
59
+ npm run typecheck
60
+ ```
61
+
62
+ 构建产物在 `lib/` 目录下,通过 junction 自动同步到 `node_modules/@lijian-ui/dsh-skill-manage`。每次构建后需重启桌面端加载新 bundle。
63
+
64
+ ## 使用方式
65
+
66
+ 1. 打开 dsh 桌面端
67
+ 2. 进入 **设置** → **技能管理**
68
+ 3. 在技能列表中:
69
+ - 点击滑块按钮启用/停用技能
70
+ - 点击删除按钮永久删除技能
71
+ - 点击技能卡片查看详情
72
+ - 使用搜索框过滤技能
73
+ - 点击"添加技能"上传新技能
74
+ - 点击"批量迁移"在作用域之间移动技能
75
+
76
+ ### 技能文件约定
77
+
78
+ | 状态 | 目录型技能 | 平铺型技能 |
79
+ |---|---|---|
80
+ | 启用 | `<name>/SKILL.md` | `<name>.md` |
81
+ | 停用 | `<name>/SKILL.md.disabled` | `<name>.md.disabled` |
82
+
83
+ ### 技能作用域
84
+
85
+ | 作用域 | 路径 | 说明 |
86
+ |---|---|---|
87
+ | 全局 dsh | `~/.dsh/skills/` | 用户全局技能 |
88
+ | 全局 agents | `~/.agents/skills/` | agents 全局技能 |
89
+ | 工作区 | `<workspace>/.dsh/skills/` | 项目级技能 |
90
+ | 内置 | `DSH_BUNDLED_SKILL_DIR` | 随部署附带,不可修改 |
91
+
92
+ ## 技术架构
93
+
94
+ ### 目录结构
95
+
96
+ ```
97
+ extensions/dsh-skill-manage/
98
+ ├── src/
99
+ │ ├── index.ts # Host 端入口
100
+ │ ├── remote.ts # Host 端 RPC 方法(list/setEnabled/deleteSkill/migrate 等)
101
+ │ ├── skill-files.ts # 文件约定(DISABLED_SUFFIX、collectSkillEntries)
102
+ │ ├── scope.ts # 迁移引擎
103
+ │ └── client/
104
+ │ ├── index.ts # Client 端入口(SECTION_ID、RPC 注册、inject)
105
+ │ ├── SkillManageSection.tsx # 主设置页组件(卡片列表 + 滑块 + 详情弹窗)
106
+ │ └── client-i18n.ts # 客户端国际化(中/英)
107
+ ├── lib/ # 构建产物
108
+ ├── docs/
109
+ │ └── troubleshooting-and-bugs.md # 踩坑记录与官方 Bug 分析
110
+ ├── package.json
111
+ └── tsdown.config.ts
112
+ ```
113
+
114
+ ### Host 端(`src/remote.ts`)
115
+
116
+ 提供以下 RPC 方法:
117
+
118
+ | 方法 | 功能 |
119
+ |---|---|
120
+ | `list(sessionId)` | 列出所有技能(含启用状态) |
121
+ | `content(name, sessionId)` | 获取技能完整内容 |
122
+ | `setEnabled(name, sessionId, enabled)` | 启用/停用技能(文件重命名) |
123
+ | `deleteSkill(name, sessionId)` | 删除技能 |
124
+ | `addSkill(sessionId, payload)` | 添加新技能 |
125
+ | `workspaces()` | 列出可用工作区 |
126
+ | `migrate(name, sessionId, payload)` | 迁移单个技能 |
127
+ | `batchMigrate(sessionId, payload)` | 批量迁移技能 |
128
+
129
+ ### Client 端(`src/client/`)
130
+
131
+ - **`index.ts`**:注册设置页 section,通过 `ctx.slots.inject` 注入到 dsh 设置面板
132
+ - **`SkillManageSection.tsx`**:React 组件,渲染技能卡片列表、滑块按钮、详情弹窗、删除确认弹窗、迁移弹窗
133
+ - **`client-i18n.ts`**:中英文翻译
134
+
135
+ ### 开关机制
136
+
137
+ ```
138
+ 用户点击滑块
139
+ → client 乐观更新 UI(立即切换开关状态)
140
+ → RPC 调用 host 端 setEnabled
141
+ → host: rename(SKILL.md ↔ SKILL.md.disabled)
142
+ → dsh chokidar watcher 检测到文件变化
143
+ → registry 缓存失效(revision++)
144
+ → 延迟 800ms 后 ctx.emit('connection/reset')
145
+ → client 端 fetches Map 清除
146
+ → 下次 / 补全重新查询 → 获取最新技能列表
147
+ ```
148
+
149
+ ## 已知问题与解决方案
150
+
151
+ ### 启用技能后 / 命令补全不刷新
152
+
153
+ **问题**:启用技能后,聊天页面的 `/` 斜杠命令补全不显示新启用的技能。
154
+
155
+ **根因**:dsh 官方包 `dsh-client-ui-skill` 漏订阅了 `skills/change` 事件,导致 client 端技能列表缓存不会在技能文件变化时自动失效。
156
+
157
+ **我们的解决**:在 `reloadAfterHot` 中延迟 800ms 后调用 `ctx.emit('connection/reset')`,触发所有模块静默刷新缓存。用户在设置页中操作,不会感知到聊天界面的缓存刷新。
158
+
159
+ 详见 [踩坑记录与官方 Bug 分析](./docs/troubleshooting-and-bugs.md)。
160
+
161
+ ## 国际化
162
+
163
+ 支持中文和英文两种语言,翻译文件在 `src/client/client-i18n.ts` 中。语言切换跟随 dsh 桌面端的语言设置。
164
+
165
+ ## 技术栈
166
+
167
+ - **语言**:TypeScript
168
+ - **构建**:tsdown (rolldown)
169
+ - **前端**:React 18
170
+ - **Markdown 渲染**:`@deepseek-ai/dsh-client-ui-primitives` 的 `MarkdownText` 组件
171
+ - **YAML 解析**:yaml (frontmatter 解析)
172
+ - **文件监听**:dsh 官方的 chokidar watcher(自动检测技能文件变化)
173
+
174
+ ## 许可证
175
+
176
+ MIT
177
+
178
+ ## 相关链接
179
+
180
+ - [踩坑记录与官方 Bug 分析](./docs/troubleshooting-and-bugs.md)
181
+ - [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/dsh)
@@ -0,0 +1,5 @@
1
+ # @lijian-ui/dsh-skill-manage bundle patch.
2
+ - insert:
3
+ - id: skill-manage
4
+ name: '@lijian-ui/dsh-skill-manage'
5
+ config: {}