dsh-kbar 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # 更新记录
2
2
 
3
+ ## 0.3.1
4
+
5
+ - 需要参数的斜杠命令改为「选中复制 `/name `」,不再直接执行,避免参数缺失报错;
6
+ - 技能与斜杠命令共用同一个剪贴板工具函数;
7
+ - 增加 GitHub Actions 语法与清单检查。
8
+
9
+ ## 0.3.0
10
+
11
+ - 新增**斜杠命令搜索与执行**:读取当前会话的命令目录,选中即通过 `commands.execute` 执行 `/name`;
12
+ - 新增**技能搜索**:读取当前会话的可用技能,选中把 `/技能名` 复制到剪贴板,粘到输入框即可调用;
13
+ - 分类标签(模型/插件/命令/技能)与中文提示。
14
+
3
15
  ## 0.2.0
4
16
 
5
17
  - 新增**模型搜索与切换**:列出当前会话可用的全部模型(按厂商分组),选中即切换,沿用模型默认推理强度;
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  A command palette for DeepSeek Harness. One shortcut to search sessions and run common actions.
4
4
 
5
5
  - Default shortcut: `Ctrl+Shift+P` on Windows/Linux, `Cmd+Shift+P` on macOS.
6
- - Searches sessions by title and working directory, runs any registered DSH shortcut command, switches the session model, and opens any installed bundle's detail page from the palette.
6
+ - Searches sessions, slash commands, skills, models and installed bundles, and runs any registered DSH shortcut command from one palette.
7
7
  - `↑`/`↓` to select, `Enter` to run, `Esc` to close.
8
8
 
9
9
  > `Ctrl+K` is already DSH's own session search, so KBar uses `Ctrl+Shift+P` to avoid a shortcut conflict. Rebind it in Settings → Shortcuts if you prefer.
package/client.js CHANGED
@@ -16,6 +16,10 @@ window.__ModuleLoader__.load({
16
16
  sessionTag: '会话',
17
17
  actionTag: '动作',
18
18
  commandTag: '命令',
19
+ modelTag: '模型',
20
+ pluginTag: '插件',
21
+ slashTag: '命令',
22
+ skillTag: '技能',
19
23
  newSession: '新建会话',
20
24
  pluginsPage: '打开插件页',
21
25
  hintNavigate: '↑↓ 选择',
@@ -32,6 +36,10 @@ window.__ModuleLoader__.load({
32
36
  sessionTag: 'session',
33
37
  actionTag: 'action',
34
38
  commandTag: 'command',
39
+ modelTag: 'model',
40
+ pluginTag: 'plugin',
41
+ slashTag: 'command',
42
+ skillTag: 'skill',
35
43
  newSession: 'New session',
36
44
  pluginsPage: 'Open the plugins page',
37
45
  hintNavigate: '↑↓ select',
@@ -40,6 +48,25 @@ window.__ModuleLoader__.load({
40
48
  results: '{n} results',
41
49
  }
42
50
 
51
+ function kindLabel(kind) {
52
+ switch (kind) {
53
+ case 'session':
54
+ return TEXT.sessionTag
55
+ case 'command':
56
+ return TEXT.commandTag
57
+ case 'model':
58
+ return TEXT.modelTag
59
+ case 'plugin':
60
+ return TEXT.pluginTag
61
+ case 'slash':
62
+ return TEXT.slashTag
63
+ case 'skill':
64
+ return TEXT.skillTag
65
+ default:
66
+ return TEXT.actionTag
67
+ }
68
+ }
69
+
43
70
  const IS_MAC = (() => {
44
71
  try {
45
72
  const p = (navigator.platform || '') + ' ' + (navigator.userAgent || '')
@@ -71,10 +98,23 @@ window.__ModuleLoader__.load({
71
98
  return 50 - Math.min(40, gaps)
72
99
  }
73
100
 
101
+ function copyText(text) {
102
+ try {
103
+ if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
104
+ return navigator.clipboard.writeText(text)
105
+ }
106
+ } catch {
107
+ /* clipboard unavailable */
108
+ }
109
+ return undefined
110
+ }
111
+
74
112
  function createStore(ctx) {
75
113
  let state = { open: false, query: '', index: 0, rows: [] }
76
114
  let models = []
77
115
  let plugins = null
116
+ let slashCommands = []
117
+ let skills = []
78
118
  let loading = false
79
119
  const listeners = new Set()
80
120
  let lastFocus = null
@@ -255,6 +295,63 @@ window.__ModuleLoader__.load({
255
295
  if (state.open) refreshRows()
256
296
  }
257
297
 
298
+ async function loadSlashCommands() {
299
+ const row = currentSession()
300
+ if (!row) return
301
+ try {
302
+ const result = await ctx.remote.commands.list(row.id)
303
+ if (!result || !result.ok || !Array.isArray(result.value)) return
304
+ slashCommands = result.value.map((command) => {
305
+ const needsInput = command.input !== undefined
306
+ const hint = needsInput ? String((command.input && command.input.hint) || '') : ''
307
+ return {
308
+ kind: 'slash',
309
+ id: 'slash:' + command.name,
310
+ title: '/' + command.name,
311
+ secondary: String(command.description || hint || '') + (needsInput ? ' · 需要参数,选中复制' : ''),
312
+ keywords: String(command.description || '') + ' ' + hint + ' 命令 command 斜杠 slash',
313
+ updatedAt: 0,
314
+ run: () => {
315
+ if (needsInput) return copyText('/' + command.name + ' ')
316
+ const pending = ctx.remote.commands.execute(row.id, '/' + command.name, [])
317
+ if (pending && typeof pending.then === 'function') {
318
+ return pending.then((outcome) => {
319
+ if (!outcome || outcome.ok !== true) {
320
+ throw new Error((outcome && outcome.error && outcome.error.message) || 'command execution failed')
321
+ }
322
+ })
323
+ }
324
+ return undefined
325
+ },
326
+ }
327
+ })
328
+ if (state.open) refreshRows()
329
+ } catch {
330
+ /* command catalog unavailable */
331
+ }
332
+ }
333
+
334
+ async function loadSkills() {
335
+ const row = currentSession()
336
+ if (!row) return
337
+ try {
338
+ const result = await ctx.remote.skills.list({ sessionId: row.id })
339
+ if (!result || !result.ok || !result.value || !Array.isArray(result.value.skills)) return
340
+ skills = result.value.skills.map((skill) => ({
341
+ kind: 'skill',
342
+ id: 'skill:' + skill.name,
343
+ title: '/' + skill.name,
344
+ secondary: String(skill.description || '') + ' · 复制调用命令',
345
+ keywords: String(skill.description || '') + ' 技能 skill 斜杠 slash',
346
+ updatedAt: 0,
347
+ run: () => copyText('/' + skill.name),
348
+ }))
349
+ if (state.open) refreshRows()
350
+ } catch {
351
+ /* skill catalog unavailable */
352
+ }
353
+ }
354
+
258
355
  function compute() {
259
356
  const query = state.query.trim().toLowerCase()
260
357
  const actions = actionItems()
@@ -265,12 +362,14 @@ window.__ModuleLoader__.load({
265
362
  if (!query) {
266
363
  return actions
267
364
  .concat(models.slice(0, 6))
268
- .concat(commands.slice(0, 8))
365
+ .concat(slashCommands.slice(0, 8))
366
+ .concat(skills.slice(0, 8))
367
+ .concat(commands.slice(0, 6))
269
368
  .concat(sessions.slice(0, 8))
270
369
  .concat((plugins || []).slice(0, 8))
271
370
  }
272
371
  const scored = []
273
- for (const item of actions.concat(models, commands, sessions, plugins || [])) {
372
+ for (const item of actions.concat(models, slashCommands, skills, commands, sessions, plugins || [])) {
274
373
  const value = score(query, item)
275
374
  if (value > 0) scored.push({ item, value: value + boost(item) })
276
375
  }
@@ -302,6 +401,8 @@ window.__ModuleLoader__.load({
302
401
  set({ open: true, query: '', index: 0, rows: compute() })
303
402
  loadModels()
304
403
  loadPlugins()
404
+ loadSlashCommands()
405
+ loadSkills()
305
406
  },
306
407
  close() {
307
408
  if (!state.open || closing) return
@@ -589,7 +690,7 @@ window.__ModuleLoader__.load({
589
690
  h('div', { style: styles.rowTitle }, item.title),
590
691
  item.secondary ? h('div', { style: styles.rowSecondary }, item.secondary) : null,
591
692
  ),
592
- h('span', { style: styles.badge }, item.kind === 'session' ? TEXT.sessionTag : item.kind === 'command' ? TEXT.commandTag : TEXT.actionTag),
693
+ h('span', { style: styles.badge }, kindLabel(item.kind)),
593
694
  ),
594
695
  ),
595
696
  ),
package/docs/DETAIL.md CHANGED
@@ -15,6 +15,8 @@ KBar 在 DSH 界面之上加一个命令面板:按一次快捷键,输入几
15
15
  | --- | --- |
16
16
  | 会话 | 当前会话目录里列出的所有会话(标题、工作目录),按最近更新排序,选中即切换 |
17
17
  | 命令 | DSH 里所有已注册的快捷键命令(新建会话、设置、侧栏、终端、文件等),选中即执行 |
18
+ | 斜杠命令 | 当前会话的命令目录(`/compact` 等),选中即执行 |
19
+ | 技能 | 当前会话可用的技能,选中把 `/技能名` 复制到剪贴板(粘到输入框即可调用) |
18
20
  | 模型 | 当前会话可用的模型(按厂商分组),选中即切换,并沿用该模型的默认推理强度 |
19
21
  | 插件 | 插件管理器里的 bundle(名称、版本),选中打开对应的插件详情页 |
20
22
  | 动作 | 新建会话;打开插件页 |
@@ -27,7 +29,9 @@ KBar 在 DSH 界面之上加一个命令面板:按一次快捷键,输入几
27
29
 
28
30
  ## 已知限制
29
31
 
30
- - 命令来自 DSH 的快捷键注册表,只包含带快捷键定义的应用命令;斜杠命令与技能尚未进入搜索范围(后续版本计划)。
32
+ - 快捷键命令只包含带快捷键定义的应用命令;斜杠命令与技能来自当前会话,需要会话处于打开状态。
33
+ - 需要参数的斜杠命令不会直接执行,选中后把 `/name ` 复制到剪贴板,由你补参数再发送。
34
+ - 技能只提供“复制 /技能名”,不直接替用户发送,避免误触模型调用。
31
35
  - 模型列表只在存在当前会话时加载;没有会话时该分组为空。
32
36
  - 插件列表来自插件管理器的 bundle 列表,选中后打开插件详情页,不在面板内直接启停。
33
37
  - 部分命令依赖当前焦点所在的控件,通过面板执行时可能提示“不可用”(例如需要选中某个侧栏标签的命令)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-kbar",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "KBar: a command palette for DeepSeek Harness — one shortcut to search sessions and run common actions.",
5
5
  "type": "module",
6
6
  "main": "index.js",