dsh-kbar 0.3.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,11 @@
1
1
  # 更新记录
2
2
 
3
+ ## 0.3.1
4
+
5
+ - 需要参数的斜杠命令改为「选中复制 `/name `」,不再直接执行,避免参数缺失报错;
6
+ - 技能与斜杠命令共用同一个剪贴板工具函数;
7
+ - 增加 GitHub Actions 语法与清单检查。
8
+
3
9
  ## 0.3.0
4
10
 
5
11
  - 新增**斜杠命令搜索与执行**:读取当前会话的命令目录,选中即通过 `commands.execute` 执行 `/name`;
package/client.js CHANGED
@@ -98,6 +98,17 @@ window.__ModuleLoader__.load({
98
98
  return 50 - Math.min(40, gaps)
99
99
  }
100
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
+
101
112
  function createStore(ctx) {
102
113
  let state = { open: false, query: '', index: 0, rows: [] }
103
114
  let models = []
@@ -290,25 +301,30 @@ window.__ModuleLoader__.load({
290
301
  try {
291
302
  const result = await ctx.remote.commands.list(row.id)
292
303
  if (!result || !result.ok || !Array.isArray(result.value)) return
293
- slashCommands = result.value.map((command) => ({
294
- kind: 'slash',
295
- id: 'slash:' + command.name,
296
- title: '/' + command.name,
297
- secondary: String(command.description || (command.input && command.input.hint) || ''),
298
- keywords: String(command.description || '') + ' 命令 command 斜杠 slash',
299
- updatedAt: 0,
300
- run: () => {
301
- const pending = ctx.remote.commands.execute(row.id, '/' + command.name, [])
302
- if (pending && typeof pending.then === 'function') {
303
- return pending.then((outcome) => {
304
- if (!outcome || outcome.ok !== true) {
305
- throw new Error((outcome && outcome.error && outcome.error.message) || 'command execution failed')
306
- }
307
- })
308
- }
309
- return undefined
310
- },
311
- }))
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
+ })
312
328
  if (state.open) refreshRows()
313
329
  } catch {
314
330
  /* command catalog unavailable */
@@ -328,13 +344,7 @@ window.__ModuleLoader__.load({
328
344
  secondary: String(skill.description || '') + ' · 复制调用命令',
329
345
  keywords: String(skill.description || '') + ' 技能 skill 斜杠 slash',
330
346
  updatedAt: 0,
331
- run: () => {
332
- const text = '/' + skill.name
333
- if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
334
- return navigator.clipboard.writeText(text)
335
- }
336
- return undefined
337
- },
347
+ run: () => copyText('/' + skill.name),
338
348
  }))
339
349
  if (state.open) refreshRows()
340
350
  } catch {
package/docs/DETAIL.md CHANGED
@@ -30,7 +30,7 @@ KBar 在 DSH 界面之上加一个命令面板:按一次快捷键,输入几
30
30
  ## 已知限制
31
31
 
32
32
  - 快捷键命令只包含带快捷键定义的应用命令;斜杠命令与技能来自当前会话,需要会话处于打开状态。
33
- - 需要参数的斜杠命令直接执行可能提示参数缺失,请改用输入框补全参数。
33
+ - 需要参数的斜杠命令不会直接执行,选中后把 `/name ` 复制到剪贴板,由你补参数再发送。
34
34
  - 技能只提供“复制 /技能名”,不直接替用户发送,避免误触模型调用。
35
35
  - 模型列表只在存在当前会话时加载;没有会话时该分组为空。
36
36
  - 插件列表来自插件管理器的 bundle 列表,选中后打开插件详情页,不在面板内直接启停。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-kbar",
3
- "version": "0.3.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",