dsh-prompt-trove 0.1.0 → 0.1.2
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 +52 -48
- package/client.js +9 -5
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,31 +1,57 @@
|
|
|
1
1
|
# dsh-prompt-trove
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-prompt-trove)
|
|
4
|
+
[](https://www.npmjs.com/package/dsh-prompt-trove)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+

|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
每次开新会话都要重复一遍「我是谁、在做什么、输出要什么格式」?
|
|
9
|
+
把这段背景存成 Markdown,在输入框点一下或打 `@`,就**追加**进当前草稿——不覆盖你已经写的内容。
|
|
6
10
|
|
|
7
|
-

|
|
8
12
|
|
|
9
|
-
##
|
|
13
|
+
## English
|
|
14
|
+
|
|
15
|
+
A composer prompt library for DeepSeek Harness. Reusable prompts (identity, project background, output preferences) live as plain Markdown — a shared library in `~/.dsh/prompts/` and optional per-project libraries in `<project>/.dsh-prompts/`. Click an entry or type `@` to **append** it to the current draft; nothing you already typed is overwritten. No account, no database, no network requests.
|
|
10
16
|
|
|
11
17
|
```sh
|
|
12
18
|
dsh plugin --profile web add dsh-prompt-trove
|
|
13
19
|
```
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
## 30 秒上手
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
```sh
|
|
24
|
+
dsh plugin --profile web add dsh-prompt-trove
|
|
25
|
+
```
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
重启 `dsh web` → 输入框工具行出现「常用提示词」按钮 → 点开 → 新建一条 → 点它,正文就追加进草稿。
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
## 它解决什么
|
|
22
32
|
|
|
23
33
|
- **一层全局库,零配置可用**:`~/.dsh/prompts/global.md`,放你的身份、行业语汇、输出偏好。
|
|
24
34
|
- **一层项目库,按需开启**:`<项目>/.dsh-prompts/<项目名>.md`,跟着项目走,可以直接提交进 git。
|
|
25
|
-
-
|
|
26
|
-
-
|
|
35
|
+
- **追加而不是替换**:你已经写了半句需求,插入背景后那半句还在,两者之间空一行。
|
|
36
|
+
- **两种入口**:面板里点条目,或在输入框里打 `@` 选条目。
|
|
37
|
+
- **界面里增删改**:新建、编辑、删除、搜索;手改 Markdown 后点「重新读取磁盘」即可生效。
|
|
27
38
|
- **纯本地文件**:没有数据库、没有账号、没有网络请求,数据就是你自己的 Markdown。
|
|
28
39
|
|
|
40
|
+
## 适合谁 / 不适合谁
|
|
41
|
+
|
|
42
|
+
**适合**:同时维护多个项目、每次新会话都要重复交代背景的人;希望提示词跟项目一起进 git 的人;偏好"看得见、改得动"的文本文件而不是黑盒记忆的人。
|
|
43
|
+
|
|
44
|
+
**不适合**:想要"自动记忆 / 自动注入、不用手动插入"的人(本插件只把文本放进当前这条消息);想要 `{{变量}}` 模板、AI 改写、团队共享服务的人——这些不在本插件的范围内。
|
|
45
|
+
|
|
46
|
+
## 和同类插件的区别
|
|
47
|
+
|
|
48
|
+
| 插件 | 存储 | 插入方式 | 适合 |
|
|
49
|
+
| --- | --- | --- | --- |
|
|
50
|
+
| **dsh-prompt-trove** | 两层 Markdown 文件(全局 + 每项目) | 点条目或 `@`,**追加** | 项目多、想进 git、要可手改 |
|
|
51
|
+
| `dsh-prompt-vault` | Host 侧 JSON | 点条目,追加 | 单库、零文件管理 |
|
|
52
|
+
| `dsh-prompt-shortcuts` | Host 侧 JSON | 置顶按钮,替换草稿 | 需要一排常用按钮 |
|
|
53
|
+
| `dsh-prompt-library` | 本地 JSON + 模板 | 插入/追加,支持变量 | 需要模板变量 |
|
|
54
|
+
|
|
29
55
|
## 库放在哪
|
|
30
56
|
|
|
31
57
|
| 层 | 位置 | 放什么 |
|
|
@@ -46,62 +72,39 @@ dsh plugin --profile web add dsh-prompt-trove
|
|
|
46
72
|
|
|
47
73
|
```text
|
|
48
74
|
root = /Users/you/code # 多项目:code 下每个含 .dsh-prompts/ 的一级文件夹是一个分组
|
|
49
|
-
├─ alpha/.dsh-prompts/alpha.md → 分组 alpha
|
|
50
|
-
└─ beta/.dsh-prompts/beta.md → 分组 beta
|
|
51
|
-
|
|
52
75
|
root = /Users/you/code/alpha # 单项目:项目自己含 .dsh-prompts/ 就是一个分组
|
|
53
|
-
└─ .dsh-prompts/alpha.md → 分组 alpha
|
|
54
76
|
```
|
|
55
77
|
|
|
56
|
-
没配 `root`
|
|
78
|
+
没配 `root` 时面板只显示全局库,不会去扫你的磁盘。
|
|
57
79
|
|
|
58
80
|
## 文件格式
|
|
59
81
|
|
|
60
82
|
```markdown
|
|
61
83
|
# 分组名
|
|
62
84
|
|
|
63
|
-
<!-- 一条 = 一个 `## ` 段落;正文原样进入输入框。 -->
|
|
64
|
-
|
|
65
85
|
## 我的工作背景
|
|
66
86
|
> 一句话说明(列表里显示) #身份 #背景
|
|
67
87
|
我在 XX 公司负责 XX,团队 3 人……
|
|
68
|
-
|
|
69
|
-
## 我的输出偏好
|
|
70
|
-
> 标签可以没有
|
|
71
|
-
回答用中文,结论先行……
|
|
72
88
|
```
|
|
73
89
|
|
|
74
|
-
- `## 标题` =
|
|
75
|
-
- `> ` 开头的一行 =
|
|
90
|
+
- `## 标题` = 一个条目,同一文件内标题必须唯一;
|
|
91
|
+
- `> ` 开头的一行 = 列表里显示的说明,写在里面的 `#标签` 会被识别;
|
|
76
92
|
- 标题下面、正文之前的内容都属于正文,插入时原样进入输入框。
|
|
77
|
-
- 文件的 `# 标题` 和注释只是给人看的,插入时不带。
|
|
78
93
|
|
|
79
94
|
示例见 [`examples/`](examples/)。
|
|
80
95
|
|
|
81
96
|
## 局限(诚实说明)
|
|
82
97
|
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
98
|
+
- 插入的是**文本,不是记忆**:和手打一遍等价,只影响当前这条消息;
|
|
99
|
+
- 项目库需要手动指定 `root`(DSH 0.2 的输入槽不向客户端插件暴露 `sessionId`,无法自动跟随当前项目);
|
|
100
|
+
- 条目建议 300–600 字,列表里常显字数就是为了让插入成本可见;
|
|
86
101
|
- 界面文案目前只有中文。
|
|
87
102
|
|
|
88
103
|
## 兼容性
|
|
89
104
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
- `ctx.slots.inject` / `ctx.slots.register` 的注册语义;
|
|
94
|
-
- `ctx.inputTriggers.registerSource` 的候选 / 选取契约;
|
|
95
|
-
- 宿主侧 `ctx.webServer.register` 的路由注册;
|
|
96
|
-
- `@deepseek-ai/dsh-client-ui-primitives` 的 `Button` / `Modal` / `Input` / `Toast` / `Tooltip` 与 `…OutlineMedium` 图标导出名;
|
|
97
|
-
- 主题变量 `--dsw-*` 改名只会影响外观。
|
|
98
|
-
|
|
99
|
-
## 数据与隐私
|
|
100
|
-
|
|
101
|
-
- 只读写两个目录:`$DSH_HOME/prompts/` 和 `config.root` 下各项目的 `.dsh-prompts/`。
|
|
102
|
-
- 宿主半边只注册 6 条本地 HTTP 路由,全部只接受同源 JSON 请求;文件名、分组名都做过路径穿越校验。
|
|
103
|
-
- 没有遥测、没有外部请求、没有账号体系。
|
|
104
|
-
- 删除条目会直接改磁盘上的 Markdown;删掉分组里最后一条时,文件本身也会被删除。
|
|
105
|
+
- 目标:DSH **0.2.x / 0.3.x**(`engines.dsh: >=0.2.0-rc.1 <0.4.0`),实测于 0.2.0-rc.2;
|
|
106
|
+
- 客户端对输入槽做了能力探测:契约变化时插件会降级为“无入口”而不是让页面崩溃;
|
|
107
|
+
- DSH 0.3 尚未正式发布,0.3 上的行为会在发布后回归;遇到问题请开 issue。
|
|
105
108
|
|
|
106
109
|
## 卸载
|
|
107
110
|
|
|
@@ -109,20 +112,21 @@ root = /Users/you/code/alpha # 单项目:项目自己含 .dsh-prompts/
|
|
|
109
112
|
dsh plugin --profile web remove dsh-prompt-trove
|
|
110
113
|
```
|
|
111
114
|
|
|
112
|
-
|
|
115
|
+
Markdown 文件不会被删除。
|
|
116
|
+
|
|
117
|
+
## 同作者的另一款插件
|
|
118
|
+
|
|
119
|
+
如果你也嫌侧边栏工作区是平的:[`dsh-workspace-nest`](https://github.com/CIBUDAYI3906/dsh-workspace-nest) —— 多级子工作区 + 会话置顶到所属文件夹。
|
|
113
120
|
|
|
114
121
|
## 开发
|
|
115
122
|
|
|
116
123
|
```sh
|
|
117
124
|
npm install
|
|
118
125
|
npm run build # client-source.jsx → client.js
|
|
119
|
-
|
|
120
|
-
npm run e2e # 真机:需要一个装好插件的 dsh web 实例 + 系统 Chrome
|
|
126
|
+
node scripts/preflight.mjs
|
|
121
127
|
```
|
|
122
128
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
发布流程见 [PUBLISH.md](PUBLISH.md)。
|
|
129
|
+
发布流程、issue/PR 规范见 [CONTRIBUTING.md](CONTRIBUTING.md),版本变化见 [CHANGELOG.md](CHANGELOG.md)。
|
|
126
130
|
|
|
127
131
|
## License
|
|
128
132
|
|
package/client.js
CHANGED
|
@@ -614,11 +614,15 @@ window.__ModuleLoader__.load({
|
|
|
614
614
|
return candidates;
|
|
615
615
|
}
|
|
616
616
|
function apply(ctx) {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
617
|
+
try {
|
|
618
|
+
ctx.effect(() => ctx.slots.inject("conversation.input.left", () => ctx.slots.register({
|
|
619
|
+
name: "conversation.input.left",
|
|
620
|
+
id: "prompt-trove",
|
|
621
|
+
order: 10
|
|
622
|
+
}, QuickPromptButton)), "prompt-trove: composer button");
|
|
623
|
+
} catch (reason) {
|
|
624
|
+
console.warn("[dsh-prompt-trove] composer slot unavailable:", reason);
|
|
625
|
+
}
|
|
622
626
|
const triggers = ctx.get("inputTriggers");
|
|
623
627
|
if (triggers !== void 0) {
|
|
624
628
|
ctx.effect(() => triggers.registerSource({
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-prompt-trove",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "输入框常用提示词库:全局与项目两层 Markdown,点一下或 @ 追加进草稿",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/CIBUDAYI3906/dsh-prompt-trove#readme",
|
|
8
8
|
"repository": {
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
"deepseek-harness",
|
|
19
19
|
"prompt",
|
|
20
20
|
"prompt-library",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"prompts",
|
|
22
|
+
"markdown",
|
|
23
|
+
"composer",
|
|
24
|
+
"snippet"
|
|
23
25
|
],
|
|
24
26
|
"main": "index.js",
|
|
25
27
|
"exports": {
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
],
|
|
40
42
|
"engines": {
|
|
41
43
|
"node": ">=20",
|
|
42
|
-
"dsh": ">=0.2.0-rc.1 <0.
|
|
44
|
+
"dsh": ">=0.2.0-rc.1 <0.4.0"
|
|
43
45
|
},
|
|
44
46
|
"peerDependencies": {
|
|
45
47
|
"@deepseek-ai/schemastery": "^3.18.1"
|