@maci0/dsh-alias 0.7.4 → 0.7.5
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 +8 -8
- package/lib/client.js +77 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# dsh-alias
|
|
2
2
|
|
|
3
|
-
Define your own slash commands in DeepSeek Harness, from the composer
|
|
4
|
-
the Plugins page.
|
|
3
|
+
Define your own slash commands in DeepSeek Harness, from the composer, the
|
|
4
|
+
**Aliases** panel in the sidebar, or the Alias card on the Plugins page.
|
|
5
5
|
|
|
6
6
|
## What you get
|
|
7
7
|
|
|
@@ -15,7 +15,9 @@ the Plugins page.
|
|
|
15
15
|
|
|
16
16
|
After that, `/gm`, `/rev src/app.ts`, and `/ship` are ordinary commands: they
|
|
17
17
|
show up in the composer's command directory and run without a model turn of
|
|
18
|
-
their own.
|
|
18
|
+
their own. Three surfaces edit the same set: the sidebar's **Aliases** panel,
|
|
19
|
+
the **Alias** card inside the plugin's row on the Plugins page, and `/alias`
|
|
20
|
+
itself.
|
|
19
21
|
|
|
20
22
|
## Install
|
|
21
23
|
|
|
@@ -28,14 +30,12 @@ Requires DeepSeek Harness `>=0.2.2-rc.4 <0.3.0`. Restart DSH and refresh the bro
|
|
|
28
30
|
> would win).
|
|
29
31
|
|
|
30
32
|
```sh
|
|
31
|
-
dsh plugin --profile web add --save-exact @maci0/dsh-alias@0.7.
|
|
33
|
+
dsh plugin --profile web add --save-exact @maci0/dsh-alias@0.7.5
|
|
32
34
|
```
|
|
33
35
|
|
|
34
36
|
Pin an exact npm version. To upgrade, run the same command with the newer
|
|
35
37
|
version, then restart `dsh web` (bundle layers compose at boot).
|
|
36
38
|
|
|
37
|
-
The bundled `cordis.patch.yml` inserts the `alias` row.
|
|
38
|
-
|
|
39
39
|
## Commands
|
|
40
40
|
|
|
41
41
|
`/alias add <name> <text>` registers `/<name>`. What `/<name>` does depends on
|
|
@@ -74,8 +74,8 @@ Aliases live in one settings field, the plugin's own row:
|
|
|
74
74
|
|
|
75
75
|
## How it works
|
|
76
76
|
|
|
77
|
-
The field is `volatile()`, so the Plugins page's **Alias** card, `/alias`, and
|
|
78
|
-
the profile patch are
|
|
77
|
+
The field is `volatile()`, so the sidebar's **Aliases** page, the Plugins page's **Alias** card, `/alias`, and
|
|
78
|
+
the profile patch are four views of one document: a write from any of them
|
|
79
79
|
lands on the running instance with no remount. A deployment whose settings
|
|
80
80
|
document refuses writes still gets working aliases in every current session
|
|
81
81
|
until dsh restarts, and the reply says so. The card reports a write the host refuses.
|
package/lib/client.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-alias: browser half.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Two surfaces over one editor: the Alias card on the Plugins page (the
|
|
5
|
+
* `plugins.row.config` slot) and a global Aliases page behind the sidebar's
|
|
6
|
+
* panel list. Both are keyed on the `alias` settings namespace the host half
|
|
7
|
+
* declares as its row id. The page lists every
|
|
6
8
|
* defined alias with a Remove control and adds one through a name + text pair;
|
|
7
9
|
* every write goes through `ctx.configForms`, the same settings document
|
|
8
10
|
* `/alias` writes on the host, so the two surfaces cannot disagree.
|
|
@@ -40,6 +42,9 @@ window.__ModuleLoader__.load({
|
|
|
40
42
|
/** Locale namespace for this plugin's copy. */
|
|
41
43
|
const LOCALE_NS = 'alias'
|
|
42
44
|
|
|
45
|
+
/** Global panel id shared by the sidebar entry and the page it opens. */
|
|
46
|
+
const PANEL_ID = 'alias'
|
|
47
|
+
|
|
43
48
|
/** The names the command registry accepts, mirroring the host half. */
|
|
44
49
|
const COMMAND_NAME = /^[a-z][a-z0-9_-]*$/u
|
|
45
50
|
|
|
@@ -63,13 +68,18 @@ window.__ModuleLoader__.load({
|
|
|
63
68
|
'.da-button-remove{flex:none;padding:3px 10px;font-size:12px;color:var(--dsw-alias-label-secondary)}',
|
|
64
69
|
'.da-status{font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}',
|
|
65
70
|
'.da-error{font-size:12px;line-height:1.5;color:var(--dsw-alias-label-error)}',
|
|
71
|
+
'.da-panel{display:flex;flex-direction:column;gap:16px;max-width:920px;padding:24px 32px;box-sizing:border-box}',
|
|
72
|
+
'.da-panel-title{font-size:20px;line-height:1.4;font-weight:600;margin:0;color:var(--dsw-alias-label-primary)}',
|
|
73
|
+
'.da-panel-subtitle{font-size:13px;line-height:1.5;margin:0;color:var(--dsw-alias-label-tertiary)}',
|
|
66
74
|
].join('')
|
|
67
75
|
|
|
68
76
|
/** Plugin version, shown in the card header. Kept in lockstep with package.json. */
|
|
69
|
-
const VERSION = '0.7.
|
|
77
|
+
const VERSION = '0.7.5'
|
|
70
78
|
|
|
71
79
|
const en = {
|
|
72
80
|
title: 'Alias',
|
|
81
|
+
panel: 'Aliases',
|
|
82
|
+
panelSubtitle: 'Define slash commands of your own. Each alias is a command like any other, in the composer and in the catalog.',
|
|
73
83
|
summaryEmpty: 'No aliases defined.',
|
|
74
84
|
summary: '{count} alias(es) defined.',
|
|
75
85
|
groupExisting: 'Defined aliases',
|
|
@@ -91,6 +101,8 @@ window.__ModuleLoader__.load({
|
|
|
91
101
|
|
|
92
102
|
const zh = {
|
|
93
103
|
title: '别名',
|
|
104
|
+
panel: '别名',
|
|
105
|
+
panelSubtitle: '定义你自己的斜杠命令。每个别名都和普通命令一样,出现在输入框和命令目录里。',
|
|
94
106
|
summaryEmpty: '未定义别名。',
|
|
95
107
|
summary: '已定义 {count} 个别名。',
|
|
96
108
|
groupExisting: '已定义的别名',
|
|
@@ -305,6 +317,51 @@ window.__ModuleLoader__.load({
|
|
|
305
317
|
}
|
|
306
318
|
}
|
|
307
319
|
|
|
320
|
+
/**
|
|
321
|
+
* Build the global page behind the sidebar entry: the same editor the row
|
|
322
|
+
* card renders, under a page title.
|
|
323
|
+
* @param Card - the row card component.
|
|
324
|
+
* @param t - translate function bound to this plugin's locale namespace.
|
|
325
|
+
* @returns the page component the `main` slot renders.
|
|
326
|
+
*/
|
|
327
|
+
function createPanel(Card, t) {
|
|
328
|
+
return function AliasPanel() {
|
|
329
|
+
return React.createElement(
|
|
330
|
+
'div',
|
|
331
|
+
{ className: 'da-panel' },
|
|
332
|
+
React.createElement('h1', { className: 'da-panel-title' }, t('panel')),
|
|
333
|
+
React.createElement('p', { className: 'da-panel-subtitle' }, t('panelSubtitle')),
|
|
334
|
+
React.createElement(Card, { view: 'page' }),
|
|
335
|
+
)
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Decorative occupant for the sidebar entry; the sidebar owns the
|
|
341
|
+
* accessible label.
|
|
342
|
+
* @param props - the sidebar's icon share: the requested edge size.
|
|
343
|
+
* @returns the alias glyph.
|
|
344
|
+
*/
|
|
345
|
+
function AliasPanelIcon(props) {
|
|
346
|
+
const size = props?.size ?? 16
|
|
347
|
+
return React.createElement(
|
|
348
|
+
'svg',
|
|
349
|
+
{
|
|
350
|
+
width: size,
|
|
351
|
+
height: size,
|
|
352
|
+
viewBox: '0 0 16 16',
|
|
353
|
+
fill: 'none',
|
|
354
|
+
stroke: 'currentColor',
|
|
355
|
+
strokeWidth: 1.5,
|
|
356
|
+
strokeLinecap: 'round',
|
|
357
|
+
strokeLinejoin: 'round',
|
|
358
|
+
'aria-hidden': 'true',
|
|
359
|
+
},
|
|
360
|
+
React.createElement('path', { d: 'M2.5 5.5h9m0 0-2.5-2.5m2.5 2.5L9 8' }),
|
|
361
|
+
React.createElement('path', { d: 'M13.5 10.5h-9m0 0L7 8m-2.5 2.5L7 13' }),
|
|
362
|
+
)
|
|
363
|
+
}
|
|
364
|
+
|
|
308
365
|
/**
|
|
309
366
|
* Mount the browser surface: the Alias card on the Plugins page.
|
|
310
367
|
* @param ctx - the browser plugin context.
|
|
@@ -340,6 +397,23 @@ window.__ModuleLoader__.load({
|
|
|
340
397
|
key: '@maci0/dsh-alias#alias',
|
|
341
398
|
locale: LOCALE_NS,
|
|
342
399
|
}, Card))
|
|
400
|
+
|
|
401
|
+
// The same editor as a global page behind the sidebar's panel list, so
|
|
402
|
+
// the aliases are reachable without opening the Plugins page and the
|
|
403
|
+
// row detail inside it.
|
|
404
|
+
ctx.slots.inject('main', () => ctx.slots.register({
|
|
405
|
+
name: 'main',
|
|
406
|
+
key: PANEL_ID,
|
|
407
|
+
locale: LOCALE_NS,
|
|
408
|
+
}, createPanel(Card, t)))
|
|
409
|
+
|
|
410
|
+
ctx.slots.inject('sidebar.panellist', () => ctx.slots.register({
|
|
411
|
+
name: 'sidebar.panellist',
|
|
412
|
+
id: PANEL_ID,
|
|
413
|
+
order: 20,
|
|
414
|
+
locale: LOCALE_NS,
|
|
415
|
+
label: () => t('panel'),
|
|
416
|
+
}, AliasPanelIcon))
|
|
343
417
|
}
|
|
344
418
|
|
|
345
419
|
exports.apply = apply
|