dsh-prompt-snippets 1.4.1 → 1.5.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/CHANGELOG.md +98 -86
- package/README.md +4 -1
- package/README.zh-CN.md +4 -1
- package/client.js +4079 -3637
- package/index.js +2487 -2335
- package/package.json +78 -78
package/CHANGELOG.md
CHANGED
|
@@ -1,86 +1,98 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
本文件记录 `dsh-prompt-snippets` 每个发布版本的用户可见变更。格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
|
|
4
|
-
|
|
5
|
-
## [1.
|
|
6
|
-
|
|
7
|
-
###
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- **
|
|
41
|
-
- **
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
本文件记录 `dsh-prompt-snippets` 每个发布版本的用户可见变更。格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
|
|
4
|
+
|
|
5
|
+
## [1.5.0] - 2026-11-12
|
|
6
|
+
|
|
7
|
+
### 新增
|
|
8
|
+
|
|
9
|
+
- 导入改为通过文件选择器选择 JSON,无需手动输入路径;仍会先预演影响范围再确认。
|
|
10
|
+
- 可克隆已有片段为独立草稿,并导出当前搜索或视图中可见的片段;筛选导出使用独立文件,避免覆盖全量备份。
|
|
11
|
+
- 面板可查看并恢复经过校验的本地备份;恢复前会把当前片段库保存在轮换备份中。
|
|
12
|
+
- 导入前预演影响数量与同名冲突,确认后才写入;源文件发生变化时要求重新预演。
|
|
13
|
+
- 改进导入表单的键盘焦点和取消后的焦点返回。
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## [1.4.1] - 2026-11-10
|
|
18
|
+
|
|
19
|
+
### 修复
|
|
20
|
+
|
|
21
|
+
- 修复历史记录路径穿越:迁移会重建不安全 ID,读取与写入都会校验路径边界,历史文件采用原子写入。
|
|
22
|
+
- 限制面板导入和文件管理器打开仅访问 exports 目录,并拒绝通过符号链接逃逸;命令行导入仍支持用户指定路径。
|
|
23
|
+
- 限制普通与流式 AI 优化的输入长度;修正文件管理器启动失败时的成功状态。
|
|
24
|
+
- 拒绝 Windows 保留设备名作为导出文件名。
|
|
25
|
+
- 加入 host/client 占位符解析一致性回归测试,并让 ESLint 实际检查测试文件。
|
|
26
|
+
- 占位符表单会预选有效默认值;必填下拉框没有默认值时自动选择首项,且允许用户清空可选默认值。
|
|
27
|
+
- exports 目录内不存在的导入文件会返回文件读取错误,避免误报为路径越界。
|
|
28
|
+
- AI 流式优化检查 HTTP 状态;流式路由返回 404/405 时回退到 RPC 优化接口,其他 HTTP 错误显示明确状态。
|
|
29
|
+
- 补齐客户端提示的中英文 locale 文案。
|
|
30
|
+
- 修正中英文 README 的快捷键说明,并删除重复的操作说明。
|
|
31
|
+
|
|
32
|
+
### 工程化
|
|
33
|
+
|
|
34
|
+
- 增加枚举默认值、流式回退及 HTTP 错误的回归测试;清理 ESLint 重复配置并同步 lockfile 版本。
|
|
35
|
+
|
|
36
|
+
## [1.4.0] - 2026-11-06
|
|
37
|
+
|
|
38
|
+
### 新增
|
|
39
|
+
|
|
40
|
+
- **AI 优化流式透传**:点击 ✨ 优化后,对比视图会实时显示模型逐段生成的内容,不再全程静止、最后一次性蹦出。底层从一次性的 RPC 调用改为走 `/api/prompt-snippets/optimize-stream` 流式接口(NDJSON),生成进度即时可见。
|
|
41
|
+
- **AI 优化提速(maxTokens 自适应)**:优化请求的 `maxTokens` 从固定 2000 改为按输入长度自适应(短输入 600 / 中等 900 / 长输入 1200 封顶),减少模型扩写冗长输出的倾向,明显加快生成。
|
|
42
|
+
|
|
43
|
+
### 修复
|
|
44
|
+
|
|
45
|
+
- **片段库按钮位置**:按钮从输入框卡片下方的独立一行(`conversation.composer.dock`)改挂到输入框工具条(`conversation.input.right`,与权限控件、模型选择器同排),修复 Claude 样式等主题下按钮消失或孤行的问题(#5、#6)。
|
|
46
|
+
- **窄窗口按钮撑高**:工具条按钮加 `flex: none` + 文字不折行,窄窗口下不再被压缩折行撑高。
|
|
47
|
+
- **收藏置顶复选框字号**:显式声明字号,不再继承会话字体放大一号(#2)。
|
|
48
|
+
|
|
49
|
+
### 工程化
|
|
50
|
+
|
|
51
|
+
- **i18n 接入平台 locale 服务**:client 端全部硬编码文案接入 DSH 官方 locale(`ctx.locale.register/bind/subscribe`),随平台语言切换。
|
|
52
|
+
- **ESLint 门禁**:新增 ESLint 8 配置与 `npm run lint`,并在 CI 中强制执行。
|
|
53
|
+
- **CI Windows 矩阵**:GitHub Actions 增加 `windows-latest` runner,覆盖目标用户主平台。
|
|
54
|
+
- **README 徽章与措辞**:补充 npm version / downloads / License 徽章,同步按钮位置描述。
|
|
55
|
+
|
|
56
|
+
## [1.3.1] - 2026-11-04
|
|
57
|
+
|
|
58
|
+
### 修复
|
|
59
|
+
|
|
60
|
+
- Gemini review 8 处问题修复。
|
|
61
|
+
- 命令面板快捷键、滚动跟随、插入并发送等细节修正。
|
|
62
|
+
|
|
63
|
+
## [1.3.0] - 2026-11-03
|
|
64
|
+
|
|
65
|
+
### 新增
|
|
66
|
+
|
|
67
|
+
- 标签 / 收藏 / 最近使用。
|
|
68
|
+
- 版本历史(每片段保留最近 20 版)。
|
|
69
|
+
- 命令面板(Ctrl+Shift+K)。
|
|
70
|
+
- 动态变量(date / time / datetime)。
|
|
71
|
+
- 内置模板包冷启动。
|
|
72
|
+
- README 功能示意图。
|
|
73
|
+
|
|
74
|
+
## [1.2.0] - 2026-11-03
|
|
75
|
+
|
|
76
|
+
### 新增
|
|
77
|
+
|
|
78
|
+
- AI 优化闭环(三态对比视图:原文 / 优化后 / 覆盖或插入)。
|
|
79
|
+
- 搜索增强。
|
|
80
|
+
- 导入导出。
|
|
81
|
+
- 数据可靠性补丁。
|
|
82
|
+
- 窗口缩放。
|
|
83
|
+
|
|
84
|
+
## [1.1.0] - 2026-11-02
|
|
85
|
+
|
|
86
|
+
### 新增
|
|
87
|
+
|
|
88
|
+
- 数据可靠性(原子写 / .bak 轮换 / 损坏自愈 / 旧版本迁移)。
|
|
89
|
+
- 面板内编辑。
|
|
90
|
+
- 占位符表单(必填 / 默认值 / 枚举下拉)。
|
|
91
|
+
- 主题适配(浅色 / 深色)。
|
|
92
|
+
|
|
93
|
+
## [1.0.0] - 2026-10-27
|
|
94
|
+
|
|
95
|
+
### 新增
|
|
96
|
+
|
|
97
|
+
- `/snippet` 命令(保存 / 列出 / 查看 / 删除 / 恢复 / 改名)。
|
|
98
|
+
- 侧栏一键插入。
|
package/README.md
CHANGED
|
@@ -78,6 +78,7 @@ Commands that treat the remaining input as a name accept spaces. `/snippet add`
|
|
|
78
78
|
- **Get to the prompt quickly.** Search by name, category, tag, or content. Use the floating library or the global keyboard palette; favorites appear first.
|
|
79
79
|
- **Reuse a template without editing it every time.** Add `{{variables}}` and fill them in when inserting. Optional defaults, required fields, dropdown choices, and `{{date}}`, `{{time}}`, and `{{datetime}}` are supported.
|
|
80
80
|
- **Keep useful prompts organized.** Add categories and tags, pin favorites, sort by recent use, and revisit earlier versions.
|
|
81
|
+
- **Create variations and portable subsets.** Duplicate a snippet with its variables and tags, or export only the snippets in the current search or view.
|
|
81
82
|
- **Stay in control of AI rewrites.** Compare the original with the generated draft, edit the draft, then choose whether to insert it or replace the saved snippet. Rewrites never overwrite a snippet automatically.
|
|
82
83
|
- **Keep your library portable.** Import and export JSON backups. Data is stored locally, with atomic writes and recoverable backups.
|
|
83
84
|
|
|
@@ -95,7 +96,9 @@ The selected snippet is sent to your configured model service only when you star
|
|
|
95
96
|
|
|
96
97
|
The library is stored at `<DSH_HOME>/data/prompt-snippets/snippets.json`. If `DSH_HOME` is unset, DSH uses `~/.dsh`.
|
|
97
98
|
|
|
98
|
-
Writes use a temporary file and atomic replacement.
|
|
99
|
+
Writes use a temporary file and atomic replacement. Rotating `.bak` files can be viewed and restored from **Backups** in the panel; the current library is saved to the rotation before a restore. Malformed data is preserved as a recovery copy. Deletion is reversible, and each snippet keeps up to 20 prior versions.
|
|
100
|
+
|
|
101
|
+
Import first previews the number of items to add, update, skip, or move to trash, and lists name conflicts. Nothing is written until you confirm. If the source file changes after preview, preview it again.
|
|
99
102
|
|
|
100
103
|
## Contributing
|
|
101
104
|
|
package/README.zh-CN.md
CHANGED
|
@@ -76,6 +76,7 @@ GitHub 安装跟随仓库版本;npm 安装跟随已发布的 npm 版本。本
|
|
|
76
76
|
- **更快找到提示词。** 按名称、分类、标签或正文搜索;使用片段库面板或全局快捷面板;收藏项优先显示。
|
|
77
77
|
- **用模板填入变化内容。** 使用 `{{变量}}`,插入时填写内容;支持默认值、必填项、下拉选项,以及 `{{date}}`、`{{time}}`、`{{datetime}}`。
|
|
78
78
|
- **整理并复用好用的提示词。** 添加分类和标签、收藏置顶、按最近使用排序,并查看旧版本。
|
|
79
|
+
- **快速创建变体并导出子集。** 克隆片段时保留变量和标签,也可以只导出当前搜索或视图中的片段。
|
|
79
80
|
- **由你决定是否采用 AI 改写。** 查看原文和改写稿、编辑结果,再选择插入或替换保存内容;不会自动覆盖原文。
|
|
80
81
|
- **备份和迁移自己的片段库。** 支持 JSON 导入导出;数据在本机保存,并带原子写入与备份恢复。
|
|
81
82
|
|
|
@@ -93,7 +94,9 @@ GitHub 安装跟随仓库版本;npm 安装跟随已发布的 npm 版本。本
|
|
|
93
94
|
|
|
94
95
|
片段库存放在 `<DSH_HOME>/data/prompt-snippets/snippets.json`。未设置 `DSH_HOME` 时使用 `~/.dsh`。
|
|
95
96
|
|
|
96
|
-
写入通过临时文件和原子替换完成,并轮换保留 `.bak`
|
|
97
|
+
写入通过临时文件和原子替换完成,并轮换保留 `.bak` 备份;在面板的「备份恢复」中可以查看并恢复可用备份。恢复前会先把当前库保存到轮换备份。损坏的数据会另存恢复副本。删除可以撤销,每条片段最多保留 20 个旧版本。
|
|
98
|
+
|
|
99
|
+
导入会先预演新增、更新、跳过和移入垃圾桶的数量,并列出同名冲突;确认后才写入。如果预演后源文件发生变化,需要重新预演。
|
|
97
100
|
|
|
98
101
|
## 参与项目
|
|
99
102
|
|