@max-null/dsh-skill-mcp-center 0.5.4 → 0.6.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/README.md CHANGED
@@ -10,7 +10,7 @@ Skill 与 MCP 管理中心:在设置里管理 skills 与 MCP 服务器,右
10
10
 
11
11
  ## Features / 功能
12
12
 
13
- - **Skill management / Skill 管理** — browse every skill grouped by source (Global / Workspace / Built-in DSH official, plus one group per plugin that ships skills), toggle model invocation via the `disable-model-invocation` frontmatter (disk-backed skills only). Covers skills shipped **inside plugin packages** (e.g. `@max-null/dsh-skills`), not just the user-level roots — the host-level skill filesystem is disabled in web-app, so a plugin's own `skills/` directory would otherwise be invisible while its skills are loaded and in effect. Also covers a plugin that mounts `@deepseek-ai/dsh-skill-filesystem` under an id of its own and points `bundledSkillDir` at its skills (e.g. `dsh-plugin-zhihu-search`), including when the patch computes that path with a `!!js` expression — such a path is read from the entry's fiber, where the Loader has already evaluated it.
13
+ - **Skill management / Skill 管理** — browse every skill grouped by source (Global / Workspace / Built-in DSH official, plus one group per plugin that ships skills), toggle model invocation via the `disable-model-invocation` frontmatter (disk-backed skills only). Covers skills shipped **inside plugin packages** (e.g. `@max-null/dsh-skills`), not just the user-level roots — the host-level skill filesystem is disabled in web-app, so a plugin's own `skills/` directory would otherwise be invisible while its skills are loaded and in effect. Also covers a plugin that mounts `@deepseek-ai/dsh-skill-filesystem` under an id of its own and points `bundledSkillDir` at its skills (e.g. `dsh-plugin-zhihu-search`), including when the patch computes that path with a `!!js` expression — such a path is read from the entry's fiber, where the Loader has already evaluated it. **Deleting** a user-level or project-level skill is offered on the same rows, behind a confirmation that names the skill and its path; the entry is *moved* to `~/.dsh/.skill-trash/` rather than destroyed, so a mistaken deletion stays recoverable. Plugin and built-in skills stay read-only.
14
14
  - **MCP management / MCP 管理** — add / edit / remove `mcp-client` servers, enable/disable without deleting config, all **hot-applied** through `ctx.loader` (no restart).
15
15
  - **Live status / 实时状态** — a sidebar "MCP" tab (via `dsh-better-sidebar`) showing per-server connection state; **click a server row to expand its tools' names and descriptions** (collapsed by default — a server can expose dozens of them). Names come from `tools.schemas()`; the redundant `mcp__<server>__` prefix is hidden while the full name stays on hover. Polled while visible and following the session.
16
16
  - **Skin-compatible / 皮肤兼容** — every color uses `var(--dsw-*)` tokens.
package/client.js CHANGED
@@ -248,7 +248,11 @@ var zhDict = {
248
248
  viewMd: "\u67E5\u770B SKILL.md",
249
249
  hideMd: "\u6536\u8D77",
250
250
  mdLoadFailed: "\u8BFB\u53D6\u5931\u8D25\uFF1A{e}",
251
- refOpen: "\u6253\u5F00\u6587\u4EF6\u5F15\u7528"
251
+ refOpen: "\u6253\u5F00\u6587\u4EF6\u5F15\u7528",
252
+ deleteSkill: "\u5220\u9664\u6280\u80FD",
253
+ deleteConfirm: "\u5220\u9664\u6280\u80FD\u300C{name}\u300D\uFF1F\n\n{path}\n\n\u5B83\u4F1A\u88AB\u79FB\u5230\u56DE\u6536\u76EE\u5F55\uFF08~/.dsh/.skill-trash\uFF09\uFF0C\u9700\u8981\u65F6\u53EF\u4EE5\u624B\u52A8\u79FB\u56DE\u53BB\u3002",
254
+ skillDeleted: "\u5DF2\u5220\u9664 {name}\uFF0C\u79FB\u5230 {path}",
255
+ deleteFailed: "\u5220\u9664\u5931\u8D25\uFF1A{e}"
252
256
  };
253
257
  var enDict = {
254
258
  loading: "Loading\u2026",
@@ -303,7 +307,11 @@ var enDict = {
303
307
  viewMd: "View SKILL.md",
304
308
  hideMd: "Hide",
305
309
  mdLoadFailed: "Failed to read: {e}",
306
- refOpen: "Open file reference"
310
+ refOpen: "Open file reference",
311
+ deleteSkill: "Delete skill",
312
+ deleteConfirm: 'Delete skill "{name}"?\n\n{path}\n\nIt will be moved to ~/.dsh/.skill-trash and can be moved back manually if needed.',
313
+ skillDeleted: "Deleted {name}, moved to {path}",
314
+ deleteFailed: "Delete failed: {e}"
307
315
  };
308
316
  var rpc = async () => {
309
317
  throw new Error("skill-mcp-center: rpc not wired");
@@ -432,6 +440,21 @@ function SkillView() {
432
440
  }
433
441
  );
434
442
  };
443
+ const remove = (s) => {
444
+ if (!window.confirm(t("deleteConfirm", { name: s.name, path: s.path }))) return;
445
+ setBusy(s.path);
446
+ void rpc("deleteSkill", { path: s.path }).then(
447
+ (v) => {
448
+ setBusy(null);
449
+ load();
450
+ showToast(t("skillDeleted", { name: s.name, path: v.trashPath }));
451
+ },
452
+ (e) => {
453
+ setBusy(null);
454
+ showToast(t("deleteFailed", { e: e instanceof Error ? e.message : String(e) }), "error");
455
+ }
456
+ );
457
+ };
435
458
  const openMd = (s) => {
436
459
  if (mdPath === s.path) {
437
460
  setMdPath(null);
@@ -508,7 +531,19 @@ function SkillView() {
508
531
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "smc-spacer" }),
509
532
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "smc-btn", onClick: () => {
510
533
  openMd(s);
511
- }, children: mdPath === s.path ? t("hideMd") : t("viewMd") })
534
+ }, children: mdPath === s.path ? t("hideMd") : t("viewMd") }),
535
+ s.writable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
536
+ "button",
537
+ {
538
+ type: "button",
539
+ className: "smc-btn danger",
540
+ disabled: busy === s.path,
541
+ onClick: () => {
542
+ remove(s);
543
+ },
544
+ children: t("deleteSkill")
545
+ }
546
+ )
512
547
  ] }),
513
548
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "smc-detail-row", children: [
514
549
  t("detailPath"),
@@ -829,6 +864,18 @@ function SidebarSkillTab({ visible, cwd }) {
829
864
  if (!visible) return;
830
865
  load();
831
866
  }, [visible, load]);
867
+ const removeSkill = (s) => {
868
+ if (!window.confirm(t("deleteConfirm", { name: s.name, path: s.path }))) return;
869
+ void rpc("deleteSkill", { path: s.path, cwd }).then(
870
+ (v) => {
871
+ load();
872
+ showToast(t("skillDeleted", { name: s.name, path: v.trashPath }));
873
+ },
874
+ (e) => {
875
+ showToast(t("deleteFailed", { e: e instanceof Error ? e.message : String(e) }), "error");
876
+ }
877
+ );
878
+ };
832
879
  const openMd = (path) => {
833
880
  if (mdPath === path) {
834
881
  setMdPath(null);
@@ -900,6 +947,19 @@ ${s.path}`, children: [
900
947
  children: mdPath === s.path ? t("hideMd") : "MD"
901
948
  }
902
949
  ),
950
+ s.writable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
951
+ "button",
952
+ {
953
+ type: "button",
954
+ className: "smc-btn danger",
955
+ style: { height: 20, padding: "0 6px", fontSize: 11 },
956
+ onClick: () => {
957
+ removeSkill(s);
958
+ },
959
+ "aria-label": t("deleteSkill"),
960
+ children: t("remove")
961
+ }
962
+ ),
903
963
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
904
964
  "button",
905
965
  {
package/dist/rpc.js CHANGED
@@ -100,6 +100,13 @@ async function dispatch(ctx, body) {
100
100
  const cwd = p.cwd;
101
101
  return { ok: true, value: await ctx.skillMcp.readSkill(path, typeof cwd === 'string' ? cwd : undefined) };
102
102
  }
103
+ case 'deleteSkill': {
104
+ const path = p.path;
105
+ if (typeof path !== 'string' || path === '')
106
+ return internal('deleteSkill: path is required');
107
+ const cwd = p.cwd;
108
+ return { ok: true, value: await ctx.skillMcp.deleteSkill(path, typeof cwd === 'string' ? cwd : undefined) };
109
+ }
103
110
  case 'listMcpServers':
104
111
  return { ok: true, value: await ctx.skillMcp.listMcpServers() };
105
112
  case 'createMcpServer':
package/dist/service.d.ts CHANGED
@@ -126,6 +126,23 @@ export declare function pluginSkillRoots(entries: Iterable<SkillRootEntry>, node
126
126
  dir: string;
127
127
  label: string;
128
128
  }[];
129
+ /**
130
+ * Resolve the entry one deletion removes, or reject the request.
131
+ *
132
+ * `path` is a SKILL.md path as `listSkills` reported it. A bundle
133
+ * (`<root>/<name>/SKILL.md`) is removed as its directory; a flat file
134
+ * (`<root>/<name>.md`) as itself.
135
+ *
136
+ * The entry must be a **direct child** of one of `roots`. Direct-child
137
+ * placement, rather than a prefix check, is what keeps this from being aimed
138
+ * at a root itself, at a nested reference file inside a skill, or at anything
139
+ * under a plugin package — those roots are not in the list to begin with.
140
+ * @param path - candidate SKILL.md path.
141
+ * @param roots - roots a deletion may target.
142
+ * @returns the absolute entry to remove.
143
+ * @throws {Error} `skill-not-found` when the path is not a skill entry sitting directly under an allowed root.
144
+ */
145
+ export declare function deleteTargetOf(path: string, roots: readonly string[]): string;
129
146
  export declare class SkillMcpService extends Service {
130
147
  static inject: string[];
131
148
  private readonly officialSkillDirs;
@@ -154,6 +171,22 @@ export declare class SkillMcpService extends Service {
154
171
  * scans, so the RPC cannot be used to read arbitrary files.
155
172
  */
156
173
  readSkill(path: string, cwd?: string): Promise<string>;
174
+ /**
175
+ * Delete one user-level or project-level skill.
176
+ *
177
+ * The entry is **moved**, not unlinked: a mistaken deletion lands in
178
+ * `<home>/.dsh/.skill-trash/` and stays recoverable, and the destination is
179
+ * returned so the surface can tell the user where it went. Plugin packages
180
+ * and the official bundled roots are not candidates — see
181
+ * {@link deletableRoots}.
182
+ * @param path - absolute SKILL.md path, as `listSkills` reported it.
183
+ * @param cwd - session workspace, when the caller has one.
184
+ * @returns the trash path the skill was moved to.
185
+ * @throws {Error} `skill-not-found` when the path is not deletable; `skill-delete-failed` when the move fails.
186
+ */
187
+ deleteSkill(path: string, cwd?: string): Promise<{
188
+ trashPath: string;
189
+ }>;
157
190
  /** Every `mcp-client` loader entry as a server card. */
158
191
  listMcpServers(): Promise<McpServer[]>;
159
192
  /** Add one mcp-client entry — hot-connects (create → init) and persists. */
package/dist/service.js CHANGED
@@ -8,9 +8,9 @@
8
8
  */
9
9
  import { Service } from '@deepseek-ai/cordis';
10
10
  import { existsSync } from 'node:fs';
11
- import { readdir, readFile, stat, writeFile } from 'node:fs/promises';
11
+ import { cp, mkdir, readdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';
12
12
  import { homedir } from 'node:os';
13
- import { join, sep } from 'node:path';
13
+ import { basename, dirname, join, sep } from 'node:path';
14
14
  import { fileURLToPath } from 'node:url';
15
15
  import { parseSkillFrontmatter, setDisableModelInvocation } from "./frontmatter.js";
16
16
  /** Runtime mirror of cordis FiberState (a cross-package const enum). */
@@ -190,6 +190,45 @@ export function pluginSkillRoots(entries, nodeModules) {
190
190
  }
191
191
  return out;
192
192
  }
193
+ /**
194
+ * Skill roots a deletion may target: the user-level roots plus the given
195
+ * workspace's, and nothing else.
196
+ *
197
+ * Deliberately narrower than the set `readSkill` accepts: plugin packages and
198
+ * the official bundled roots stay read-only by contract, so they are not
199
+ * candidates even though the surface lists them.
200
+ * @param cwd - session workspace, when the caller has one.
201
+ * @returns the roots a deletion may target.
202
+ */
203
+ function deletableRoots(cwd) {
204
+ const roots = SKILL_ROOTS.map(root => root.path);
205
+ if (cwd !== undefined && cwd !== '') {
206
+ roots.push(join(cwd, '.agents', 'skills'), join(cwd, '.dsh', 'skills'));
207
+ }
208
+ return roots;
209
+ }
210
+ /**
211
+ * Resolve the entry one deletion removes, or reject the request.
212
+ *
213
+ * `path` is a SKILL.md path as `listSkills` reported it. A bundle
214
+ * (`<root>/<name>/SKILL.md`) is removed as its directory; a flat file
215
+ * (`<root>/<name>.md`) as itself.
216
+ *
217
+ * The entry must be a **direct child** of one of `roots`. Direct-child
218
+ * placement, rather than a prefix check, is what keeps this from being aimed
219
+ * at a root itself, at a nested reference file inside a skill, or at anything
220
+ * under a plugin package — those roots are not in the list to begin with.
221
+ * @param path - candidate SKILL.md path.
222
+ * @param roots - roots a deletion may target.
223
+ * @returns the absolute entry to remove.
224
+ * @throws {Error} `skill-not-found` when the path is not a skill entry sitting directly under an allowed root.
225
+ */
226
+ export function deleteTargetOf(path, roots) {
227
+ const entry = basename(path) === 'SKILL.md' ? dirname(path) : path;
228
+ if (!roots.some(root => dirname(entry) === root))
229
+ throw new Error('skill-not-found');
230
+ return entry;
231
+ }
193
232
  export class SkillMcpService extends Service {
194
233
  static inject = ['loader', 'tools'];
195
234
  officialSkillDirs;
@@ -282,6 +321,41 @@ export class SkillMcpService extends Service {
282
321
  }
283
322
  return text;
284
323
  }
324
+ /**
325
+ * Delete one user-level or project-level skill.
326
+ *
327
+ * The entry is **moved**, not unlinked: a mistaken deletion lands in
328
+ * `<home>/.dsh/.skill-trash/` and stays recoverable, and the destination is
329
+ * returned so the surface can tell the user where it went. Plugin packages
330
+ * and the official bundled roots are not candidates — see
331
+ * {@link deletableRoots}.
332
+ * @param path - absolute SKILL.md path, as `listSkills` reported it.
333
+ * @param cwd - session workspace, when the caller has one.
334
+ * @returns the trash path the skill was moved to.
335
+ * @throws {Error} `skill-not-found` when the path is not deletable; `skill-delete-failed` when the move fails.
336
+ */
337
+ async deleteSkill(path, cwd) {
338
+ const entry = deleteTargetOf(path, deletableRoots(cwd));
339
+ const trashRoot = join(homedir(), '.dsh', '.skill-trash');
340
+ const trashPath = join(trashRoot, `${Date.now()}-${basename(entry)}`);
341
+ try {
342
+ await mkdir(trashRoot, { recursive: true });
343
+ try {
344
+ await rename(entry, trashPath);
345
+ }
346
+ catch (error) {
347
+ // Renaming across volumes fails with EXDEV; copy then remove instead.
348
+ if (error.code !== 'EXDEV')
349
+ throw error;
350
+ await cp(entry, trashPath, { recursive: true });
351
+ await rm(entry, { recursive: true, force: true });
352
+ }
353
+ }
354
+ catch {
355
+ throw new Error('skill-delete-failed');
356
+ }
357
+ return { trashPath };
358
+ }
285
359
  /** Every `mcp-client` loader entry as a server card. */
286
360
  async listMcpServers() {
287
361
  const servers = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@max-null/dsh-skill-mcp-center",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "description": "Skill & MCP management center for DeepSeek Harness — manage skills and MCP servers in Settings, live MCP status in the sidebar",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
package/release-notes.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Release Notes — @max-null/dsh-skill-mcp-center
2
2
 
3
+ ## 0.6.0 (2026-10-06)
4
+
5
+ ### 新增
6
+
7
+ - **删除用户级 / 项目级技能**。设置页与侧栏的技能行都多了一个「删除」按钮,只出现在
8
+ `writable` 的技能上 —— 也就是 `~/.dsh/skills`、`~/.agents/skills`,以及当前工作区的
9
+ `<cwd>/.agents/skills` 与 `<cwd>/.dsh/skills`。插件技能与 DSH 官方内置技能(`plugin:` /
10
+ `bundled` / `dsh-official`)保持只读,不出现该按钮。
11
+
12
+ 点删除先弹确认,写明技能名与完整路径;确认后该技能从磁盘移除 —— 目录形态
13
+ (`<name>/SKILL.md`)删整个目录,平铺形态(`<name>.md`)删那个文件。
14
+
15
+ **不直接销毁**:条目被移到 `~/.dsh/.skill-trash/`,成功提示里给出具体位置,误删可手动
16
+ 移回去。
17
+
18
+ ### 兼容性
19
+
20
+ - 新增一个 RPC 端点 `deleteSkill`(`{ path, cwd? }`);现有端点与请求信封不变。
21
+ - 删除面**刻意窄于**查看面:`readSkill` 接受插件与内置根,删除只接受用户级与项目级根,
22
+ 并且要求目标**正好是某个允许根的直接子项** —— 根自身、技能内部的嵌套文件、名字相近的
23
+ 兄弟目录一律拒绝(`skill-not-found`)。
24
+ - 新增 10 条测试:7 条覆盖删除目标的解析与拒绝面,3 条做真实文件操作(整目录 / 平铺 /
25
+ 拒绝后文件原样不动)。
26
+
3
27
  ## 0.5.4 (2026-10-04)
4
28
 
5
29
  ### 修复