dsh-plugin-feishu-prompt-library 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +358 -2
- package/cordis.patch.yml +5 -0
- package/docs/DETAIL.en.md +55 -0
- package/docs/DETAIL.zh.md +89 -0
- package/docs/images/cloud-sync-flow.png +0 -0
- package/docs/images/feishu-prompt-library-preview.png +0 -0
- package/docs/images/smart-import-flow.png +0 -0
- package/docs/superpowers/plans/2026-11-29-production-hardening.md +180 -0
- package/docs/superpowers/plans/2026-11-29-smart-prompt-import.md +125 -0
- package/docs/superpowers/specs/2026-11-29-smart-prompt-import-design.md +263 -0
- package/icon.svg +4 -0
- package/lib/client.js +2882 -0
- package/lib/import-analysis.js +160 -0
- package/lib/import-drafts.js +84 -0
- package/lib/import-sources.js +384 -0
- package/lib/index.js +1882 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/market/index.example.json +32 -0
- package/package.json +73 -4
- package/scripts/check-syntax.mjs +57 -0
- package/scripts/run-tests.mjs +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Feishu Prompt Library contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,359 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 飞书云词库
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 云端保存,随时随地管理查看使用你的提示词
|
|
4
|
+
|
|
5
|
+
**新增、编辑或删除提示词后,自动更新飞书多维表格。**
|
|
6
|
+
本地页面立即生效,同步在后台完成,不需要手动导入、导出或等待。
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
## 一键自动整理各种网页、视频中的提示词到你的词库
|
|
11
|
+
|
|
12
|
+
**不用自己想提示词结构。** 粘贴网页、视频或图片链接后,「飞书云词库」会识别内容、生成标题、分组、标签和提示词正文;你先检查修改,确认后才会保存并同步。
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
> 当前已支持文字、网页、图片链接和视频页面分析;视频字幕需要本机可选安装 `yt-dlp`。
|
|
17
|
+
> 设计详情见 [智能导入设计文档](docs/superpowers/specs/2026-11-29-smart-prompt-import-design.md)。
|
|
18
|
+
|
|
19
|
+
## 精准触发与智能整理
|
|
20
|
+
|
|
21
|
+
完整提示词本身不等于“要保存到词库”。为了避免误存普通聊天,插件使用明确指令区分两种模式:
|
|
22
|
+
|
|
23
|
+
| 输入方式 | 插件行为 |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `/save-prompt` + 元数据 + 正文 | 精确解析,正文原样带入,等待确认 |
|
|
26
|
+
| `/organize-prompt` + 文字或链接 | AI 分析数据源并生成提示词草稿 |
|
|
27
|
+
| 自然语言“保存到飞书云词库” | 尚未实现 |
|
|
28
|
+
| 普通完整提示词,无触发指令 | 作为正常聊天发送,不自动保存 |
|
|
29
|
+
| `/save-prompt` | 确定性触发,不依赖模型判断 |
|
|
30
|
+
|
|
31
|
+
无论哪种方式,都需要你确认后才会写入本地词库和飞书。
|
|
32
|
+
|
|
33
|
+
### 精确保存:完整提示词原样加入词库
|
|
34
|
+
|
|
35
|
+
在 DSH 底部输入:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
/save-prompt
|
|
39
|
+
标题:代码变更风险审查
|
|
40
|
+
分组:研发效率
|
|
41
|
+
标签:代码评审, 研发
|
|
42
|
+
---
|
|
43
|
+
你是一名资深代码审查工程师。输入是一段代码 diff。
|
|
44
|
+
|
|
45
|
+
请按以下顺序输出:
|
|
46
|
+
1. 阻塞问题:可能导致故障、数据损坏或安全风险的问题。
|
|
47
|
+
2. 非阻塞建议:可维护性、性能和可读性改进。
|
|
48
|
+
3. 测试缺口:缺少的关键测试场景。
|
|
49
|
+
4. 总体判断:可以合并、修改后合并或拒绝合并。
|
|
50
|
+
|
|
51
|
+
要求:
|
|
52
|
+
- 只评价输入中实际存在的代码。
|
|
53
|
+
- 每个问题说明原因和影响范围。
|
|
54
|
+
- 不讨论与 diff 无关的重构。
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
插件会解析标题、分组和标签,把 `---` 后的正文原样带入确认面板。精确模式不会调用 AI 改写正文。
|
|
58
|
+
|
|
59
|
+
### 智能整理:从模糊内容生成提示词草稿
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
/organize-prompt https://example.com/article
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
或者:
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
把下面这段内容整理成提示词并保存到飞书云词库:
|
|
69
|
+
……
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
插件会识别网页、文字、图片或视频内容,生成标题、分组、标签和提示词正文,再等待你确认。
|
|
73
|
+
|
|
74
|
+
### 适合沉淀的场景
|
|
75
|
+
|
|
76
|
+
| 场景 | 推荐触发方式 | 建议保存为 |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| 网页、公众号、长文 | `/organize-prompt <链接>` | 文章分析、观点提炼、事实核查提示词 |
|
|
79
|
+
| 视频、访谈、课程 | `/organize-prompt <视频链接>`,安装 `yt-dlp` 可读取公开字幕 | 字幕总结、访谈洞察、行动项提取 |
|
|
80
|
+
| 周报、会议、产品文档 | `/organize-prompt` + 原始文字 | 固定格式写作、会议纪要、决策分析模板 |
|
|
81
|
+
| 代码评审、SQL、事故复盘 | `/save-prompt` + 已写好的正文 | 团队研发规范与审查模板 |
|
|
82
|
+
|
|
83
|
+
> `/save-prompt` 和 `/organize-prompt` 执行后会自动打开「飞书云词库」确认面板。只有确认后才会保存。
|
|
84
|
+
|
|
85
|
+
## 它解决什么问题
|
|
86
|
+
|
|
87
|
+
普通收藏夹只能把提示词“存起来”。真正困难的是:
|
|
88
|
+
|
|
89
|
+
- 找到之后能不能立即打开并复制。
|
|
90
|
+
- 复制回模型时,换行、Tab、空行和缩进会不会丢失。
|
|
91
|
+
- 换设备后,提示词是否仍然可用。
|
|
92
|
+
- 看到一篇好文章、一个视频或一张图片时,能不能快速沉淀成自己的提示词。
|
|
93
|
+
|
|
94
|
+
「飞书云词库」分别处理这四件事:
|
|
95
|
+
|
|
96
|
+
| 你的问题 | 飞书云词库的做法 |
|
|
97
|
+
|---|---|
|
|
98
|
+
| 打开插件太慢 | 本地状态立即展示,飞书检测和同步在后台执行 |
|
|
99
|
+
| 提示词格式容易坏 | 正文原样保存,支持换行、空行、空格和 Tab |
|
|
100
|
+
| 提示词只存在一台电脑 | 本地优先,自动镜像到飞书 Base |
|
|
101
|
+
| 只有原文,没有提示词 | 识别文字、网页、图片和视频内容,生成可编辑草稿,确认后才保存 |
|
|
102
|
+
|
|
103
|
+
## 现有核心能力
|
|
104
|
+
|
|
105
|
+
- **即时打开**:点击侧栏后先读本地数据,实测约 100ms 显示页面。
|
|
106
|
+
- **格式保真**:编辑、新建和快速收藏都不改写正文格式。
|
|
107
|
+
- **低误触编辑**:复制直接可见,编辑收在右下角 `⋯` 菜单,也可双击卡片进入;删除菜单项会二次确认。
|
|
108
|
+
- **快速收藏**:打开后直接聚焦正文;空白内容点击其他区域会自动收起。
|
|
109
|
+
- **本地优先**:本地 `store.json` 是主要工作副本,离线也能完整使用。
|
|
110
|
+
- **飞书同步**:支持已有 Base 或新建并切换同步表,检测与同步不阻塞页面。
|
|
111
|
+
- **GitHub 反馈**:左侧栏底部提供反馈入口,直接打开项目的新建 Issue 页面。
|
|
112
|
+
- **可靠存储**:写入前创建按时间命名的本地备份,最多保留 3 份;主文件损坏时自动尝试恢复最新有效备份。
|
|
113
|
+
- **跨平台与自适应布局**:支持 macOS、Windows、Linux、深浅色、窄面板和系统字体放大;菜单、表单和弹窗会随可用空间重排,目录列表在低高度窗口中独立滚动。
|
|
114
|
+
|
|
115
|
+
## 安装
|
|
116
|
+
|
|
117
|
+
### 从 npm 安装
|
|
118
|
+
|
|
119
|
+
macOS:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
"/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh" \
|
|
123
|
+
plugin --profile desktop \
|
|
124
|
+
add dsh-plugin-feishu-prompt-library
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Linux:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
dsh plugin --profile desktop add dsh-plugin-feishu-prompt-library
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Windows PowerShell:
|
|
134
|
+
|
|
135
|
+
```powershell
|
|
136
|
+
dsh plugin --profile desktop add dsh-plugin-feishu-prompt-library
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 从本地源码安装
|
|
140
|
+
|
|
141
|
+
先把当前源码目录安装到 DSH:
|
|
142
|
+
|
|
143
|
+
macOS:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
"/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh" \
|
|
147
|
+
plugin --profile desktop \
|
|
148
|
+
add link:/absolute/path/to/dsh-plugin-feishu-prompt-library
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Linux:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
dsh plugin --profile desktop \
|
|
155
|
+
add link:/absolute/path/to/dsh-plugin-feishu-prompt-library
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Windows PowerShell:
|
|
159
|
+
|
|
160
|
+
```powershell
|
|
161
|
+
dsh plugin --profile desktop add "link:C:\absolute\path\to\dsh-plugin-feishu-prompt-library"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
安装后重启 DSH,左侧栏会出现「飞书云词库」。
|
|
165
|
+
|
|
166
|
+
如果已安装旧版 `dsh-plugin-prompt-vault`,请先停用旧版,避免两个入口同时修改同一份数据或远程表。新版首次启动会自动迁移旧数据。
|
|
167
|
+
|
|
168
|
+
### 环境要求
|
|
169
|
+
|
|
170
|
+
- DSH `>= 0.2.2-rc.1`
|
|
171
|
+
- Node.js `^22.19.0 || >=24.0.0`
|
|
172
|
+
- 飞书同步需要 `lark-cli`,并支持 `base` 命令
|
|
173
|
+
|
|
174
|
+
未安装 `lark-cli` 时,本地词库功能仍可完整使用。
|
|
175
|
+
|
|
176
|
+
## 配置飞书
|
|
177
|
+
|
|
178
|
+
安装并登录飞书 CLI:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npm install -g @larksuite/cli
|
|
182
|
+
lark-cli auth login --recommend
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
在插件设置中:
|
|
186
|
+
|
|
187
|
+
1. 粘贴已有飞书 Base 链接,点击「关联」。
|
|
188
|
+
2. 或点击「新建并切换同步表」,创建新的远程 Base 并切换后续同步目标。
|
|
189
|
+
|
|
190
|
+
同步采用「一个目录一张表」的结构:每个提示词目录会对应 Base 中的一张同名数据表;没有目录的提示词进入「未分类」表。目录改名时表名会同步修改,目录删除后其中的提示词会先迁移到「未分类」表,再删除原目录表。
|
|
191
|
+
|
|
192
|
+
远程表字段会自动检查并补齐:
|
|
193
|
+
|
|
194
|
+
| 字段 | 类型 |
|
|
195
|
+
|---|---|
|
|
196
|
+
| 标题 | 文本 |
|
|
197
|
+
| 正文 | 文本 |
|
|
198
|
+
| 分类 | 文本 |
|
|
199
|
+
| 标签 | 文本 |
|
|
200
|
+
| 提示词ID | 文本 |
|
|
201
|
+
| 更新时间 | 文本 |
|
|
202
|
+
| 已删除 | 复选框 |
|
|
203
|
+
|
|
204
|
+
自定义 `lark-cli` 路径:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
export FEISHU_PROMPT_LIBRARY_CLI=/absolute/path/to/lark-cli
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Windows PowerShell:
|
|
211
|
+
|
|
212
|
+
```powershell
|
|
213
|
+
$env:FEISHU_PROMPT_LIBRARY_CLI = "C:\path\to\lark-cli.exe"
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
插件也兼容 `FEISHU_PROMPT_VAULT_CLI`、`PROMPT_VAULT_PRO_CLI` 和 `PROMPT_VAULT_CLI`。
|
|
217
|
+
|
|
218
|
+
## 数据与同步
|
|
219
|
+
|
|
220
|
+
本地数据目录:
|
|
221
|
+
|
|
222
|
+
```text
|
|
223
|
+
~/.dsh/feishu-prompt-library/store.json
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Windows:
|
|
227
|
+
|
|
228
|
+
```text
|
|
229
|
+
%USERPROFILE%\.dsh\feishu-prompt-library\store.json
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
备份目录:
|
|
233
|
+
|
|
234
|
+
```text
|
|
235
|
+
~/.dsh/feishu-prompt-library/backups/store.<时间>.json
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
可在插件「设置 → 偏好 → 备份目录」中改为任意可写的绝对路径。已有备份会迁移到新目录,继续最多保留 3 份;点击「打开目录」可直接用系统文件管理器查看实际生效的备份目录。
|
|
239
|
+
|
|
240
|
+
同步规则:
|
|
241
|
+
|
|
242
|
+
- 本地 `store.json` 是主要工作副本。
|
|
243
|
+
- 每次写入前保存上一版本,备份按时间排序,最多保留 3 份。
|
|
244
|
+
- `store.json` 无法解析时,会先隔离损坏文件,再从最新有效备份恢复。
|
|
245
|
+
- 使用「提示词ID」对齐本地与远程记录。
|
|
246
|
+
- 每个目录独立写入一张同名的飞书数据表,未分类内容写入「未分类」表。
|
|
247
|
+
- 首次关联旧的单表 Base 时,会先创建各目录表并迁移记录;迁移成功后自动删除旧的「提示词」混合表。
|
|
248
|
+
- 更新时间较新的版本获胜。
|
|
249
|
+
- 新建、编辑和删除后,如果仍停留在插件页面,就按偏好自动同步。
|
|
250
|
+
- 只有插件页面可见且窗口处于焦点、同时开启自动同步时,才执行自动同步;离开或失焦后,延迟中的自动同步也会停止。
|
|
251
|
+
- 如果远程记录被全部删除,下次打开插件会自动把当前本地词库重新同步到远程。
|
|
252
|
+
- 如果远程表还有其他记录,而某条已同步记录被单独删除,该删除会同步回本地,不会重新创建。
|
|
253
|
+
- 如果只有某个目录的数据表被删除,会自动重建该目录表并从本地恢复提示词,不会删除本地目录内容。
|
|
254
|
+
- 远端记录会分页读取到 `has_more=false`;分页信息、数据版本或 NDJSON 内容不完整时会中止同步,不执行删除推断。
|
|
255
|
+
- 如果整个远程飞书 Base 已被删除,下次打开插件会自动新建 Base、切换同步目标,并把本地词库全量写入新 Base。
|
|
256
|
+
- 创建和更新会按 200 条一批执行,超过 200 条也不会静默遗漏。
|
|
257
|
+
- pending 导入草稿只保存在内存中,用户确认前不落盘,也不触发飞书同步。
|
|
258
|
+
|
|
259
|
+
## 快捷键
|
|
260
|
+
|
|
261
|
+
| 操作 | macOS | Windows / Linux |
|
|
262
|
+
|---|---|---|
|
|
263
|
+
| 搜索 | `⌘ K` | `Ctrl K` |
|
|
264
|
+
| 快速收藏保存 | `⌘ Enter` | `Ctrl Enter` |
|
|
265
|
+
| 编辑抽屉保存 | `⌘ S` | `Ctrl S` |
|
|
266
|
+
| 关闭弹层 | `Esc` | `Esc` |
|
|
267
|
+
|
|
268
|
+
## 跨平台
|
|
269
|
+
|
|
270
|
+
- 使用 `node:path` 和平台路径分隔符。
|
|
271
|
+
- Windows 查找原生 `lark-cli.exe` 和 npm 包内二进制,不通过 shell 执行 `.cmd` shim。
|
|
272
|
+
- macOS 支持 Homebrew 常见路径。
|
|
273
|
+
- Linux 支持 `~/.local/bin`、`~/.larksuite/bin` 和 `PATH`。
|
|
274
|
+
- 鼠标、键盘和触摸均可使用。
|
|
275
|
+
- 支持系统深色模式和 `prefers-reduced-motion`。
|
|
276
|
+
- CI 会在 Ubuntu、macOS 和 Windows 上执行单元测试、语法检查、打包检查与依赖审计。
|
|
277
|
+
|
|
278
|
+
## DSH 插件声明
|
|
279
|
+
|
|
280
|
+
| 项目 | 声明 |
|
|
281
|
+
|---|---|
|
|
282
|
+
| npm 包 | `dsh-plugin-feishu-prompt-library` |
|
|
283
|
+
| DSH Bundle | `dsh.bundle.patch = ./cordis.patch.yml` |
|
|
284
|
+
| Manifest | `dsh.manifestVersion = 1` |
|
|
285
|
+
| Host 插件 | `lib/index.js`,导出 `name`、`inject`、`apply` |
|
|
286
|
+
| Web Client | `./client` 导出,`dsh.client.platform = web` |
|
|
287
|
+
| 左侧栏入口 | `sidebar.panellist` |
|
|
288
|
+
| 主页面 | `main` slot |
|
|
289
|
+
| Bundle 行 | `feishu-prompt-library` |
|
|
290
|
+
| Host API | `/feishu-prompt-library/api` |
|
|
291
|
+
| 支持平台 | macOS、Windows、Linux |
|
|
292
|
+
|
|
293
|
+
插件详情见 [中文 DETAIL](docs/DETAIL.zh.md) 和 [English DETAIL](docs/DETAIL.en.md)。
|
|
294
|
+
|
|
295
|
+
## 开发
|
|
296
|
+
|
|
297
|
+
插件使用原生 ESM Host 和 classic-script Web Client,无需构建步骤。
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
npm test
|
|
301
|
+
npm run check
|
|
302
|
+
npm pack --dry-run
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
真实 DSH 浏览器测试需要本地 DSH 实例:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
PLAYWRIGHT_MODULE=/path/to/playwright/package.json \
|
|
309
|
+
DSH_WEB_URL=http://127.0.0.1:3100/?token=... \
|
|
310
|
+
node test/e2e-live.mjs
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
真实 Chromium 布局回归覆盖紧凑窗口、窄面板和 200% 字体放大:
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
CHROMIUM_PATH=/path/to/chromium \
|
|
317
|
+
node --test test/responsive-layout.test.js
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
未设置 `CHROMIUM_PATH` 时,普通 `npm test` 会跳过该项,其他单元与渲染测试仍会执行。
|
|
321
|
+
|
|
322
|
+
目录结构:
|
|
323
|
+
|
|
324
|
+
```text
|
|
325
|
+
dsh-plugin-feishu-prompt-library/
|
|
326
|
+
├── lib/index.js # Host:本地存储、CLI、飞书 Base API
|
|
327
|
+
├── lib/client.js # Web:React 页面与交互
|
|
328
|
+
├── lib/import-*.js # 智能导入:草稿、数据源与模型整理
|
|
329
|
+
├── scripts/ # 跨平台测试与语法扫描
|
|
330
|
+
├── locale/ # 中英文元数据
|
|
331
|
+
├── docs/ # 插件详情、交互图和设计文档
|
|
332
|
+
├── test/ # 回归测试
|
|
333
|
+
├── market/index.example.json # 自托管插件索引模板
|
|
334
|
+
├── cordis.patch.yml # DSH bundle patch
|
|
335
|
+
├── icon.svg
|
|
336
|
+
├── LICENSE
|
|
337
|
+
└── README.md
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
发布到 npm:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
npm publish --access public
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
发布前 `prepack` 会运行测试和语法检查。自定义插件索引格式见 [market/index.example.json](market/index.example.json)。
|
|
347
|
+
|
|
348
|
+
## 已知限制
|
|
349
|
+
|
|
350
|
+
- 飞书同步依赖本机 `lark-cli` 的权限和网络状态。
|
|
351
|
+
- 多人同时编辑同一条记录时,以较新的更新时间为准。
|
|
352
|
+
- 删除会同时删除本地和对应远程记录,并要求二次确认。
|
|
353
|
+
- 视频字幕依赖可选的 `yt-dlp`;未安装时会退化为视频标题和简介,并在确认页提示。
|
|
354
|
+
- 自然语言 skill 自动触发尚未实现,目前请使用 `/save-prompt` 或 `/organize-prompt`。
|
|
355
|
+
- 真实飞书权限、网络状态和模型质量依赖用户本机环境,CI 使用模拟 CLI 覆盖协议行为。
|
|
356
|
+
|
|
357
|
+
## License
|
|
358
|
+
|
|
359
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Feishu Cloud Library DSH Plugin
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
`dsh-plugin-feishu-prompt-library` is a DSH bundle that ships both a Host plugin and a Web Client plugin.
|
|
6
|
+
|
|
7
|
+
It contributes:
|
|
8
|
+
|
|
9
|
+
- A Feishu Cloud Library entry in the DSH sidebar.
|
|
10
|
+
- A full prompt-library page.
|
|
11
|
+
- Local prompt storage, folders, tags, editing, and deletion.
|
|
12
|
+
- Optional two-way Feishu Base sync through the local `lark-cli`.
|
|
13
|
+
- Exact prompt import through `/save-prompt`.
|
|
14
|
+
- Source analysis and draft generation through `/organize-prompt`.
|
|
15
|
+
|
|
16
|
+
## DSH declarations
|
|
17
|
+
|
|
18
|
+
| Declaration | Location | Purpose |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| DSH Bundle | `package.json` → `dsh.bundle` | Makes the package a composable DSH profile bundle |
|
|
21
|
+
| Manifest version | `package.json` → `dsh.manifestVersion` | Declares DSH manifest format version 1 |
|
|
22
|
+
| Host entry | `main` / `exports["."]` | Loads `lib/index.js` |
|
|
23
|
+
| Web Client entry | `exports["./client"]` + `dsh.client` | Loads `lib/client.js` in the DSH Web client |
|
|
24
|
+
| Bundle patch | `cordis.patch.yml` | Registers the `feishu-prompt-library` Host row |
|
|
25
|
+
| Platforms | `dsh.bundle.platforms` | macOS, Linux, and Windows |
|
|
26
|
+
| Market metadata | `locale/zh.json`, `locale/en.json` | Provides marketplace title, summary, and detail files |
|
|
27
|
+
|
|
28
|
+
## Host plugin
|
|
29
|
+
|
|
30
|
+
The Host exports:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
export const name = 'feishu-prompt-library'
|
|
34
|
+
export const inject = ['webServer']
|
|
35
|
+
export function apply(ctx, config)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
It owns the local store, serves the same-origin JSON API, detects `lark-cli`, manages Feishu Base records, migrates legacy local data, registers import commands, resolves public sources, and produces reviewed prompt drafts.
|
|
39
|
+
|
|
40
|
+
## Web Client plugin
|
|
41
|
+
|
|
42
|
+
The Client registers the sidebar entry and main page through DSH slots. It provides search, folder navigation, prompt cards, editing, copying, confirmed deletion, quick capture, import review, sync settings, and responsive desktop UI. Settings and feedback remain in the sidebar footer; feedback opens the repository's GitHub new-issue page in a new window.
|
|
43
|
+
|
|
44
|
+
Automatic Feishu sync runs only while the Feishu Cloud Library panel is visible, the window is focused, and `autoSync` is enabled. Leaving, hiding, or unfocusing the panel clears its activity lease and cancels any delayed automatic sync.
|
|
45
|
+
|
|
46
|
+
If the linked Feishu Base has been deleted, the Host creates a replacement Base, switches the saved remote target, and restores the local library into it.
|
|
47
|
+
|
|
48
|
+
The Host keeps three timestamped backup files at most, restores the newest valid backup when `store.json` is corrupt, and allows the backup directory to be changed to any writable absolute path. Existing backups are migrated to the new directory. The settings panel can open the effective backup directory in the platform file manager.
|
|
49
|
+
|
|
50
|
+
## Compatibility
|
|
51
|
+
|
|
52
|
+
- DSH `>= 0.2.2-rc.1`
|
|
53
|
+
- Node.js `^22.19.0 || >=24.0.0`
|
|
54
|
+
- macOS, Windows, and Linux, including opening backup directories in Finder, Explorer, and the Linux default file manager
|
|
55
|
+
- Optional `@larksuite/cli`
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# 飞书云词库 DSH 插件
|
|
2
|
+
|
|
3
|
+
## 插件定位
|
|
4
|
+
|
|
5
|
+
`dsh-plugin-feishu-prompt-library` 是一个同时提供 Host 与 Web Client 的 DSH 插件包。
|
|
6
|
+
|
|
7
|
+
它向 DSH 增加:
|
|
8
|
+
|
|
9
|
+
- 左侧栏「飞书云词库」入口。
|
|
10
|
+
- 一个完整的提示词库主面板。
|
|
11
|
+
- 本地提示词存储、目录、标签和编辑能力。
|
|
12
|
+
- 通过本机 `lark-cli` 与飞书多维表格双向同步的能力。
|
|
13
|
+
- 通过 `/save-prompt` 精确保存提示词。
|
|
14
|
+
- 通过 `/organize-prompt` 分析文字、网页、图片和视频链接并生成提示词草稿。
|
|
15
|
+
|
|
16
|
+
## DSH 声明
|
|
17
|
+
|
|
18
|
+
| 声明 | 文件 | 作用 |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| DSH Bundle | `package.json` → `dsh.bundle` | 让 DSH 将包视为可组合的 profile bundle |
|
|
21
|
+
| Manifest Version | `package.json` → `dsh.manifestVersion` | 使用 DSH manifest 格式版本 1 |
|
|
22
|
+
| Host 入口 | `main` / `exports["."]` | 加载 `lib/index.js` |
|
|
23
|
+
| Web Client 入口 | `exports["./client"]` + `dsh.client` | 在 Web 客户端加载 `lib/client.js` |
|
|
24
|
+
| Bundle Patch | `cordis.patch.yml` | 注册 Host 插件行 `feishu-prompt-library` |
|
|
25
|
+
| 支持平台 | `dsh.bundle.platforms` | macOS、Linux、Windows |
|
|
26
|
+
| 插件市场元数据 | `locale/zh.json`、`locale/en.json` | 提供市场标题、简介和详情文件 |
|
|
27
|
+
|
|
28
|
+
## Host 能力
|
|
29
|
+
|
|
30
|
+
Host 入口导出:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
export const name = 'feishu-prompt-library'
|
|
34
|
+
export const inject = ['webServer']
|
|
35
|
+
export function apply(ctx, config)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Host 负责:
|
|
39
|
+
|
|
40
|
+
- 读取和原子写入 `~/.dsh/feishu-prompt-library/store.json`。
|
|
41
|
+
- 注册 `/feishu-prompt-library/api` 同源 JSON API。
|
|
42
|
+
- 检测 `lark-cli`、登录状态和飞书 Base 链接。
|
|
43
|
+
- 关联已有 Base,或创建并切换到新的 Base。
|
|
44
|
+
- 拉取、创建、更新和删除远程记录。
|
|
45
|
+
- 自动迁移旧版 `~/.dsh/prompt-vault/store.json`。
|
|
46
|
+
- 注册 pending draft、分析和活动租约 API。
|
|
47
|
+
- 注册 `/save-prompt` 与 `/organize-prompt` 聊天命令。
|
|
48
|
+
- 抓取公共网页、图片和可选视频字幕,并生成可编辑提示词草稿。
|
|
49
|
+
|
|
50
|
+
## Web Client 能力
|
|
51
|
+
|
|
52
|
+
Client 入口使用 DSH 的 `window.__ModuleLoader__` classic-script 格式,导出:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
exports.apply = apply
|
|
56
|
+
exports.inject = ['slots', 'layout']
|
|
57
|
+
exports.name = 'feishu-prompt-library'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Client 向 DSH 注册:
|
|
61
|
+
|
|
62
|
+
- `sidebar.panellist`:左侧栏入口。
|
|
63
|
+
- `main`:完整提示词库页面。
|
|
64
|
+
|
|
65
|
+
页面提供搜索、目录、排序、卡片编辑、复制、删除确认、快速收藏、设置和同步状态。设置与反馈入口固定在左侧栏底部,反馈会在新窗口打开项目 GitHub 新建 Issue 页面。
|
|
66
|
+
它还负责接收聊天命令产生的 pending draft,自动切换至主面板,并展示输入、分析、确认三个状态。
|
|
67
|
+
|
|
68
|
+
## 数据与隐私
|
|
69
|
+
|
|
70
|
+
- 提示词默认保存在本机。
|
|
71
|
+
- 只有用户安装并登录 `lark-cli`,且关联 Base 后,内容才会同步到飞书。
|
|
72
|
+
- 外部链接只允许 `http:` 和 `https:`。
|
|
73
|
+
- 删除操作需要二次确认。
|
|
74
|
+
- 本地 API 只接受同源请求。
|
|
75
|
+
- 网页抓取阻止 localhost、内网、链路本地地址和恶意重定向。
|
|
76
|
+
- 网页抓取会把 DNS 检查结果固定到实际连接地址,降低 DNS rebinding 风险。
|
|
77
|
+
- 导入草稿在确认前只保存在 Host 内存中。
|
|
78
|
+
- 自动同步只在插件页面可见、窗口聚焦且 `autoSync` 开启时运行;离开、失焦或隐藏后,待执行的自动同步会取消。
|
|
79
|
+
- 检测到已关联的飞书 Base 被删除时,Host 会新建替代 Base、更新本地远端配置,并把当前本地词库同步回去。
|
|
80
|
+
- 本地 `store.json` 每次写入前按时间备份,最多保留 3 份;文件损坏时优先恢复最新有效备份。
|
|
81
|
+
- 备份目录可在设置中修改为任意可写绝对路径,已有最多 3 份备份会迁移到新目录;也可以点击「打开目录」,用系统文件管理器直接查看实际生效的目录。
|
|
82
|
+
- 同步按 200 条一批执行;远端仍有其他记录时,单条远端删除会同步到本地。
|
|
83
|
+
|
|
84
|
+
## 兼容性
|
|
85
|
+
|
|
86
|
+
- DSH `>= 0.2.2-rc.1`
|
|
87
|
+
- Node.js `^22.19.0 || >=24.0.0`
|
|
88
|
+
- macOS、Windows、Linux;备份目录可分别在访达、资源管理器和 Linux 默认文件管理器中打开
|
|
89
|
+
- 可选的 `@larksuite/cli`
|
|
Binary file
|
|
Binary file
|
|
Binary file
|