@lemonppt/cli 0.1.8 → 0.2.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/SKILL.md CHANGED
@@ -1,87 +1,169 @@
1
1
  # lemonPPT
2
2
 
3
- 根据一句话主题或需求,自动生成精美 PPT(goal.json/HTML/PPTX/PDF)。
3
+ 根据一句话主题、结构化需求或已有的 `goal.json`,生成精美、可编辑的 PPT(HTML/PPTX/PDF)。
4
4
 
5
- > **协议声明**:lemonPPT 采用 AGPL-3.0 开源协议。若你通过 AI Agent 向第三方提供基于 lemonPPT 的服务,请遵守 AGPL-3.0 的源代码公开义务。lemonPPT 与 Dashi PPT 无代码或资产依赖关系。详见项目根目录 `LICENSE` 与 `docs/LEGAL.md`。
5
+ > **协议声明**:lemonPPT 采用 AGPL-3.0-or-later 开源协议。若你通过 AI Agent 向第三方提供基于 lemonPPT 的服务,请遵守 AGPL-3.0 的源代码公开义务。详见项目根目录 `LICENSE` 与 `docs/LEGAL.md`。
6
6
 
7
- ## 能力
7
+ ---
8
8
 
9
- - 接受用户输入(主题、目标页数、主题风格、语言)
10
- - 生成结构化演示文稿规划(goal.json)
11
- - 渲染为可浏览的 HTML
12
- - 导出为 PPTX 或 PDF
9
+ ## 能力边界
10
+
11
+ lemonPPT 是**结构化 goal.json → 视觉 PPT** 的渲染与导出引擎:
12
+
13
+ - ✅ 将 `goal.json` 渲染为可离线打开的 HTML deck(支持浏览器内编辑)
14
+ - ✅ 导出可编辑 PPTX 或截图 PDF
15
+ - ✅ 根据 `role` 自动挑选合适版式
16
+ - ✅ 内置自然语言 → `goal.json` 生成(`lemonppt generate`)
17
+ - ❌ **不直接解析外部文档**(Word/PDF/Markdown);如需“上传文档生成 PPT”,外层 Agent 需先提取文本/结构,再交给 lemonPPT
18
+ - ❌ 不联网抓取网页;不生成图片/图表数据本身,但可渲染你提供的数据
19
+
20
+ ---
13
21
 
14
22
  ## 使用流程
15
23
 
16
- 用户说"帮我做一份 PPT"时,按以下步骤执行:
24
+ ### 方式一:一句话端到端生成(最简单)
25
+
26
+ ```bash
27
+ # 1. 生成 goal.json
28
+ lemonppt generate "面向企业客户的 AI 助手产品发布会,强调效率提升 10 倍、支持私有化部署、已有 50 家客户" \
29
+ --pages 8 --theme theme01 --language zh --out ./goal.json
17
30
 
18
- ### 0. 收集关键信息(可选但强烈建议)
31
+ # 2. 导出 PPTX / PDF
32
+ lemonppt export ./goal.json --pptx ./deck.pptx --pdf ./deck.pdf
19
33
 
20
- 如果用户只给了一句话主题,先追问以下信息,让最终 PPT 更贴合:
34
+ # 3. (可选)渲染可编辑 HTML 预览
35
+ lemonppt render ./goal.json --out ./output --editable
36
+ ```
21
37
 
22
- - **演示目标**(goal):这场 PPT 希望达成什么?(如融资路演、产品发布、内部汇报)
23
- - **目标受众**(audience):听众是谁?(如投资人、客户、内部团队)
24
- - **核心卖点/关键数据**:有没有必须突出的指标、功能或案例?
25
- - **页数**:建议 6~20 页
26
- - **主题风格**:`base`(极简商务)、`dark-tech`(深色科技)、`warm-business`(温暖商务)
27
- - **语言**:`zh` 或 `en`
28
- - **API Key**:如果有 OpenAI 兼容 API Key,生成内容会更贴合主题;没有则使用内置 fallback 示例
38
+ 参数说明:
29
39
 
30
- ### 1. 生成 goal.json
40
+ - `--pages`:页数,建议 5~20
41
+ - `--theme`:主题 ID,见下方「可用主题」
42
+ - `--language`:`zh` 或 `en`
43
+ - `--api-key` / `--base-url` / `--model`:可选,OpenAI 兼容 API;不传则使用内置 fallback 示例
44
+
45
+ ### 方式二:Agent 精细编排
46
+
47
+ 当外层 Agent 需要控制每一页的结构、版式、数据时:
31
48
 
32
49
  ```bash
33
- lemonppt generate "<主题>" --pages <页数> --theme <主题> --language zh --out ./goal.json
50
+ # 1. 查看可用主题
51
+ lemonppt list-themes
52
+
53
+ # 2. 按角色查询候选版式
54
+ lemonppt layout-query --theme theme06 --role metric --limit 5
55
+
56
+ # 3. 查看版式字段契约
57
+ lemonppt inspect-layout theme06_metric_hero_v1
58
+
59
+ # 4. 生成只含 role 的骨架
60
+ lemonppt goal-scaffold --title "AI 产业投资图谱" --goal "..." --theme theme06 --pages 10 --out ./goal.json
61
+
62
+ # 5. 外层 Agent 填充 props 后,规范化默认值并校验未知字段
63
+ lemonppt write-safe-props ./goal.json --write
64
+
65
+ # 6. 校验 goal.json 规范
66
+ lemonppt validate-goal-spec ./goal.json
67
+
68
+ # 7. 渲染与导出
69
+ lemonppt render ./goal.json --out ./output
70
+ lemonppt export ./goal.json --pptx ./deck.pptx
34
71
  ```
35
72
 
36
- - `--pages`:页数,建议 6~20
37
- - `--theme`:主题 ID,可选 `base`、`dark-tech`、`warm-business`
38
- - `--language`:`zh` 或 `en`
39
- - `--api-key`:可选,OpenAI 兼容 API Key;不传则使用内置 fallback 示例
73
+ ### 方式三:HTTP API 服务
40
74
 
41
- **生成前,把收集到的信息组织成更具体的主题描述**。例如:
75
+ 先确保已构建:`corepack pnpm -r build`(若系统未全局安装 pnpm,corepack 会自动提供)。
42
76
 
43
77
  ```bash
44
- lemonppt generate "面向企业客户的 AI 助手产品发布会,强调效率提升 10 倍、支持私有化部署、已有 50 家客户" --pages 8 --theme base --language zh --out ./goal.json
78
+ # 启动真正的 lemonPPT API 服务(默认 3456 端口)
79
+ lemonppt serve --port 3456
80
+
81
+ # 等价的 server 别名
82
+ lemonppt server --port 3456
45
83
  ```
46
84
 
47
- ### 2. 导出 PPTX / PDF
85
+ 底层启动 `apps/server/dist/index.js`,输出目录默认 `./output`。
86
+
87
+ 接口:
88
+
89
+ - `POST /api/generate-goal`:自然语言 → `goal.json`
90
+ - `POST /api/render`:`goal.json` → HTML
91
+ - `POST /api/render-editor`:`goal.json` → 单页编辑器渲染数据(`EditorData` JSON),不再生成静态文件
92
+ - `POST /api/export/pptx`:`goal.json` → PPTX
93
+ - `POST /api/export/pdf`:`goal.json` → PDF
94
+ - `POST /api/layout-query`:候选版式查询
95
+ - `POST /api/inspect-layout`:版式字段契约
96
+ - `POST /api/goal-scaffold`:生成骨架
97
+ - `POST /api/write-safe-props`:规范化 props
98
+ - `POST /api/validate-goal-spec`:校验 goal.json
99
+ - `POST /api/stage-media`:上传 base64 图片到服务目录,返回可在 `goal.json` 中引用的 URL
100
+ - `GET /editor`:打开单页编辑器(所有主题共享同一页面,通过 `?theme=theme01` 切换主题)
101
+ - `GET /api/render-editor?theme=theme01`:基于示例 goal 返回指定主题的 `EditorData`
102
+
103
+ 调用示例:
48
104
 
49
105
  ```bash
50
- lemonppt export ./goal.json --pptx ./deck.pptx --pdf ./deck.pdf
106
+ curl -X POST http://localhost:3456/api/render \
107
+ -H "Content-Type: application/json" \
108
+ -d @goal.json
109
+
110
+ curl -X POST http://localhost:3456/api/export/pptx \
111
+ -H "Content-Type: application/json" \
112
+ -d @goal.json \
113
+ --output deck.pptx
114
+
115
+ curl -X POST "http://localhost:3456/api/render-editor?theme=theme02" \
116
+ -H "Content-Type: application/json" \
117
+ -d @goal.json
118
+
119
+ # 上传本地图片(base64)
120
+ curl -X POST http://localhost:3456/api/stage-media \
121
+ -H "Content-Type: application/json" \
122
+ -d '{"filename":"logo.png","data":"iVBORw0KGgoAAAANSUhEUg..."}'
51
123
  ```
52
124
 
53
- 至少传 `--pptx` 或 `--pdf` 之一。
125
+ ---
54
126
 
55
- ### 3. 交付文件
127
+ ## 可用主题
56
128
 
57
- 把生成的 `goal.json`、`deck.pptx`、`deck.pdf` 以及 `output/index.html` 展示给用户。
129
+ | 主题 ID | 风格 | 配色/外观 |
130
+ |---|---|---|
131
+ | `theme01` | 浅色玻璃质感 | light / dark |
132
+ | `theme02` | 深色霓虹科技 | scheme-a / scheme-b |
133
+ | `theme03` | 代码编辑器风 | scheme-a / scheme-b + light / dark |
134
+ | `theme04` | 玻璃糖果风 | green / yellow / blue / pink + light / dark |
135
+ | `theme05` | 光谱报告风 | coral / amber / teal / indigo / violet + light / dark |
136
+ | `theme06` | 深色图谱风 | volt / magma / nebula / nova + light / dark |
137
+ | `theme07` | 冷白金融投资风 | cold-white / warm-gray / ink / navy + light / dark |
138
+ | `theme08` | 曜金黑金机构风 | obsidian-gold / midnight-silver / graphite-rose / forest-gold |
139
+ | `theme09` | 墨韵杂志印刷风 | paper / ink 双基底 + primary / muted |
140
+ | `theme10` | 金指数据指数风 | gold-index / blue-index / green-index |
58
141
 
59
- 如果用户只需要文件,交付 PPTX/PDF;如果用户想在线预览,交付 HTML。
142
+ 默认主题:`theme01`。
60
143
 
61
- **交付时说明内容来源**:
62
- - 如果使用了 API Key:"内容已根据你的主题自动生成,可进一步编辑。"
63
- - 如果没有 API Key:"当前使用内置示例内容生成,结构和版式完整。如需更贴合主题的文案,请提供 OpenAI 兼容 API Key 后重新生成。"
144
+ ---
64
145
 
65
146
  ## goal.json 格式
66
147
 
67
148
  ```json
68
149
  {
69
150
  "title": "演示文稿标题",
70
- "goal": "演示目标",
151
+ "goal": "这场 PPT 希望达成什么?",
71
152
  "audience": "目标受众",
72
153
  "owner": "汇报人",
73
- "theme": "base",
154
+ "theme": "theme01",
155
+ "colorScheme": "light",
156
+ "appearance": "light",
74
157
  "language": "zh",
75
158
  "pageCount": 8,
76
159
  "randomSeed": "可选种子",
77
160
  "slides": [
78
161
  {
79
162
  "role": "cover",
80
- "layout": "cover_v1",
163
+ "layout": "theme01_cover_v1",
81
164
  "props": {
82
165
  "title": "标题",
83
- "subtitle": "副标题",
84
- "date": "2026-07-18"
166
+ "subtitle": "副标题"
85
167
  }
86
168
  }
87
169
  ]
@@ -96,97 +178,177 @@ lemonppt export ./goal.json --pptx ./deck.pptx --pdf ./deck.pdf
96
178
  | `goal` | 是 | 演示目标/背景 |
97
179
  | `audience` | 是 | 受众描述 |
98
180
  | `owner` | 否 | 汇报人 |
99
- | `theme` | 是 | 主题 ID |
181
+ | `theme` | 是 | 主题 ID;也兼容 `themePack` 作为别名 |
182
+ | `colorScheme` | 否 | 主题专用配色方案,见「可用主题」 |
183
+ | `appearance` | 否 | `light` / `dark`,部分主题支持 |
100
184
  | `language` | 否 | `zh` 或 `en`,默认 `zh` |
101
- | `pageCount` | | 总页数,必须等于 `slides.length` |
102
- | `randomSeed` | 否 | 随机种子,保证结果可复现 |
185
+ | `pageCount` | | 总页数;留空时自动等于 `slides.length` |
186
+ | `randomSeed` | 否 | 随机种子,保证选页可复现 |
103
187
  | `slides` | 是 | 幻灯片数组 |
104
188
 
105
189
  每个 slide:
106
190
 
107
191
  | 字段 | 必填 | 说明 |
108
192
  |---|---|---|
109
- | `role` | | 页面角色,见下方角色表 |
193
+ | `role` | | 页面角色,见下方「页面角色」;留空时尝试从 `layout` 推断 |
110
194
  | `layout` | 否 | 具体版式 ID;留空时系统按 role 自动选择 |
111
195
  | `props` | 是 | 该版式所需数据 |
112
196
 
113
- ## 可用主题
197
+ > **外部 Agent 友好**:HTTP API 与 CLI 均支持 `themePack` 替代 `theme`、`pageCount` 省略、`role` 省略(系统从 `layout` ID 推断),方便被其他 Agent 调用。未提供的必填字段将自动补全。
114
198
 
115
- | 主题 ID | 风格 |
116
- |---|---|
117
- | `base` | 极简商务 |
118
- | `dark-tech` | 深色科技 |
119
- | `warm-business` | 温暖商务 |
199
+ ---
120
200
 
121
- ## 页面角色与版式
201
+ ## 页面角色
122
202
 
123
- Agent 选页时只需指定 `role`,系统会根据角色自动挑选合适版式。只有在明确需要某一款版式时才填 `layout`。
203
+ Agent 选页时优先只指定 `role`,由系统根据当前主题自动挑选合适版式。只有在明确需要某一款版式时才填 `layout`。
124
204
 
125
- | role | 用途 | 可用版式 |
126
- |---|---|---|
127
- | `cover` | 封面 | `cover_v1`, `cover_v2` |
128
- | `tableOfContents` | 目录 | `table_of_contents_v1` |
129
- | `metric` | 关键指标 | `metric_v1`, `metric_v2`, `metric_v3` |
130
- | `stats` | 统计 | `stats_v1`, `stats_v2` |
131
- | `chart` | 数据图表 | `chart_v1`, `chart_v2` |
132
- | `comparison` | 对比 | `comparison_v1`, `comparison_v2`, `comparison_v3` |
133
- | `pricing` | 价格方案 | `pricing_v1`, `pricing_v2` |
134
- | `process` | 流程步骤 | `process_v1`, `process_v2`, `process_v3` |
135
- | `timeline` | 时间线 | `timeline_v1`, `timeline_v2`, `timeline_v3` |
136
- | `roadmap` | 路线图 | `roadmap_v1`, `roadmap_v2` |
137
- | `quote` | 金句引用 | `quote_v1`, `quote_v2`, `quote_v3` |
138
- | `testimonial` | 客户评价 | `testimonial_v1`, `testimonial_v2`, `testimonial_v3` |
139
- | `content` | 内容页 | `content_v1`, `content_v2`, `content_v3`, `content_v4`, `split_v1` |
140
- | `faq` | 问答 | `faq_v1` |
141
- | `feature` | 产品特性 | `feature_v1`, `feature_v2`, `feature_v3` |
142
- | `team` | 团队介绍 | `team_v1`, `team_v2` |
143
- | `partners` | 合作伙伴墙 | `partners_v1` |
144
- | `image` | 图片 | `image_v1`, `image_v2` |
145
- | `gallery` | 图片画廊 | `gallery_v1`, `gallery_v2`, `gallery_v3` |
146
- | `swot` | SWOT 分析 | `swot_v1` |
147
- | `pest` | PEST 分析 | `pest_v1` |
148
- | `closing` | 结尾页 | `closing_v1`, `closing_v2` |
205
+ | role | 用途 |
206
+ |---|---|
207
+ | `cover` | 封面 |
208
+ | `tableOfContents` | 目录 |
209
+ | `metric` | 关键数字/指标 |
210
+ | `stats` | 统计摘要 |
211
+ | `chart` | 数据图表 |
212
+ | `comparison` | 对比页 |
213
+ | `pricing` | 价格方案 |
214
+ | `process` | 流程步骤 |
215
+ | `timeline` | 时间线 |
216
+ | `roadmap` | 路线图 |
217
+ | `quote` | 金句引用 |
218
+ | `testimonial` | 客户评价 |
219
+ | `content` | 图文内容 |
220
+ | `faq` | 问答 |
221
+ | `feature` | 产品特性 |
222
+ | `team` | 团队介绍 |
223
+ | `partners` | 合作伙伴墙 |
224
+ | `image` | 单图页 |
225
+ | `gallery` | 图片画廊 |
226
+ | `bento` | 模块化概览 |
227
+ | `table` | 表格 |
228
+ | `tags` | 标签云 |
229
+ | `filmstrip` | 胶片条 |
230
+ | `swot` | SWOT 分析 |
231
+ | `pest` | PEST 分析 |
232
+ | `closing` | 结尾/感谢 |
233
+
234
+ ---
149
235
 
150
236
  ## 常见 props 字段
151
237
 
152
238
  - `title`:页面主标题
153
239
  - `kicker`:小标题/标签
154
240
  - `subtitle`:副标题
155
- - `items`:列表项数组
156
- - `points`:要点数组
157
- - `stats`:指标数组,元素含 `label`、`value`、`unit`、`change`
158
- - `image` / `imageUrl`:图片 URL(远程 URL 在 PPTX 中可能显示占位符)
241
+ - `items` / `points` / `bullets`:列表项数组
242
+ - `stats` / `metrics`:指标数组,元素通常含 `label`、`value`、`unit`、`change`
243
+ - `image` / `imageUrl`:图片 URL(远程 URL 在 PPTX 中可能显示占位符,建议用本地图片或 base64)
159
244
  - `cta` / `contact` / `email` / `link`:结尾页联系方式
245
+ - `showInsight` + `insight`:图表/数据页的重点强调面板
160
246
 
161
- ## 常见错误处理
247
+ 具体字段请用 `lemonppt inspect-layout <layoutId>` 查看。
162
248
 
163
- 1. **没有 API Key**:`lemonppt generate` 会 fallback 到内置示例内容,仍可生成完整文件。但示例内容可能偏通用,无法紧密贴合你的主题。建议提供 `--api-key` 以获得更专业的文案。
164
- 2. **生成内容偏离主题**:把主题描述写得更具体,补充目标受众、核心卖点、关键数据。例如不要只写 `"AI 助手"`,而是写 `"面向企业客户的 AI 助手产品发布会,强调效率提升 10 倍、支持私有化部署"`。
165
- 3. **页数太少**:建议封面 + 目录 + 3~5 页内容 + 结尾,最少 5 页。
166
- 4. **远程图片在 PPTX 中不显示**:PPTX 导出优先使用本地图片或 base64;远程 URL 会显示占位符。
167
- 5. **生成失败**:检查 JSON 是否合法、`slides.length` 是否等于 `pageCount`。
249
+ ---
168
250
 
169
- ## 完整示例
170
-
171
- ### 示例 1:有 API Key(推荐)
251
+ ## CLI 命令速查
172
252
 
173
253
  ```bash
174
- lemonppt generate "面向企业客户的 AI 助手产品发布会,核心卖点:效率提升 10 倍、支持私有化部署、服务 50+ 标杆客户" --pages 8 --theme base --language zh --api-key $OPENAI_API_KEY --out ./ai-launch.json
175
- lemonppt render ./ai-launch.json --out ./output
176
- lemonppt export ./ai-launch.json --pptx ./ai-launch.pptx --pdf ./ai-launch.pdf
254
+ # 生成
255
+ lemonppt generate "<主题>" [--pages N] [--theme <id>] [--language zh|en] [--out goal.json] [--api-key KEY]
256
+
257
+ # 渲染
258
+ lemonppt render <goal.json> [--out ./output] [--editable]
259
+
260
+ # 导出
261
+ lemonppt export <goal.json> --pptx out.pptx [--pdf out.pdf]
262
+
263
+ # 本地服务(优先启动 API 服务;未构建时回退到静态预览)
264
+ lemonppt serve [<dir>] [--port N]
265
+ lemonppt server [<dir>] [--port N]
266
+
267
+ # 主题/版式查询
268
+ lemonppt list-themes
269
+ lemonppt layout-query --theme <id> --role <role> [--limit N] [--seed S] [--keyword K]
270
+ lemonppt inspect-layout <layoutId> [--compact]
271
+
272
+ # 骨架/校验
273
+ lemonppt goal-scaffold --title T --goal G --theme <id> --pages N --out goal.json
274
+ lemonppt write-safe-props <goal.json> [--write]
275
+ lemonppt validate-goal-spec <goal.json>
276
+
277
+ # 安装到 Agent 技能目录
278
+ lemonppt install-skill [--claude] [--codex] [--cursor] [--all]
279
+ lemonppt install-skill --target ./my-agent/skills/lemonppt
177
280
  ```
178
281
 
179
- ### 示例 2:无 API Key(结构和版式完整,内容偏通用)
282
+ ---
283
+
284
+ ## Skill 包内 npm scripts(Dashi 风格)
285
+
286
+ 将 `skills/lemonppt/` 复制到 Agent 技能目录后,也可以直接进入 skill 目录调用 npm scripts:
180
287
 
181
288
  ```bash
182
- lemonppt generate "AI 助手产品发布会" --pages 8 --theme base --language zh --out ./ai-launch.json
183
- lemonppt render ./ai-launch.json --out ./output
184
- lemonppt export ./ai-launch.json --pptx ./ai-launch.pptx --pdf ./ai-launch.pdf
289
+ cd ~/.claude/skills/lemonppt
290
+
291
+ npm run layout:query -- --theme theme01 --role cover --limit 5
292
+ npm run inspect:layout -- theme01_cover_v1
293
+ npm run goal:scaffold -- --title "AI 报告" --goal "..." --theme theme01 --pages 8 --out ./goal.json
294
+ npm run props:safe -- ./goal.json --write
295
+ npm run validate:goal-spec -- ./goal.json
296
+ npm run render:goal -- ./goal.json --out ./output
297
+ npm run validate:deck -- ./output --goal ./goal.json
298
+ npm run validate:goal-copy -- ./goal.json ./output
299
+ npm run export:pptx -- ./goal.json ./deck.pptx
300
+ npm run export:pdf -- ./goal.json ./deck.pdf
301
+ npm run preview:start -- ./output --port 3456
302
+ npm run media:stage -- ./image.png --out ./output/assets
185
303
  ```
186
304
 
305
+ 这些脚本本质上是调用 `lemonppt` CLI 的薄包装,因此首次使用前需要:
306
+
307
+ - 源码模式:确保项目已构建(`corepack pnpm -r build`),skill 包会被写入本地 CLI 路径;
308
+ - 发布模式:执行过 `npm install -g @lemonppt/cli`,或脚本自动通过 `npx @lemonppt/cli` 调用。
309
+
310
+ ---
311
+
312
+ ## 常见错误处理
313
+
314
+ 1. **没有 API Key**:`lemonppt generate` 会 fallback 到内置示例内容,仍可生成完整文件。如需更贴合主题的文案,提供 `--api-key`。
315
+ 2. **生成内容偏离主题**:把主题描述写得更具体,补充目标受众、核心卖点、关键数据。
316
+ 3. **页数太少**:建议封面 + 目录 + 3~5 页内容 + 结尾,最少 5 页。
317
+ 4. **远程图片在 PPTX 中不显示**:PPTX 导出优先使用本地图片或 base64;远程 URL 会显示占位符。
318
+ 5. **校验失败**:检查 `slides.length === pageCount`、必填字段、未知 props 字段。
319
+ 6. **版式不存在**:使用 `lemonppt layout-query` 查询当前主题下可用版式。
320
+
321
+ ---
322
+
323
+ ## Agent 调用示例
324
+
325
+ ### 例 1:用户说“帮我做一份 PPT”
326
+
327
+ 1. 先追问:主题、目标、受众、页数、主题风格、语言。
328
+ 2. 调用 `lemonppt generate "<完整主题>" --pages N --theme <id> --language zh --out ./goal.json`。
329
+ 3. 调用 `lemonppt export ./goal.json --pptx ./deck.pptx --pdf ./deck.pdf`。
330
+ 4. 交付文件并说明来源。
331
+
332
+ ### 例 2:用户上传了一份文档
333
+
334
+ 1. 外层 Agent 自行解析文档,提取标题、摘要、章节、数据、图片。
335
+ 2. 调用 `lemonppt goal-scaffold` 生成骨架。
336
+ 3. 按 `lemonppt inspect-layout` 的字段契约,将文档内容映射为每页 `props`。
337
+ 4. 调用 `lemonppt write-safe-props` 规范化,`lemonppt validate-goal-spec` 校验。
338
+ 5. 渲染并导出。
339
+
340
+ ### 例 3:用户指定某一页要“团队介绍”
341
+
342
+ 1. 查看候选版式:`lemonppt layout-query --theme <id> --role team --limit 3`。
343
+ 2. 查看契约:`lemonppt inspect-layout theme01_team_v1`。
344
+ 3. 修改 `goal.json` 中对应 slide 的 `role` 为 `team`,按契约填充 `props`。
345
+ 4. 重新渲染/导出。
346
+
347
+ ---
348
+
187
349
  ## 注意事项
188
350
 
189
- - 不要手动指定每个 slide 的 `layout`,优先只写 `role`。
351
+ - 优先只写 `role`,不要手动指定每个 slide 的 `layout`,除非用户明确要求某一款版式。
190
352
  - `goal.json` 是核心协议,生成后可以直接交给用户修改再导出。
191
- - 一句话主题生成的内容可能偏通用;如需专业文案,补充目标受众、核心卖点、关键数据,或传入 `--api-key`。
353
+ - 同一 deck 中建议不要重复使用完全相同的 `layout`。
192
354
  - 所有命令在 lemonPPT 项目根目录执行;CLI 入口为 `packages/cli/dist/cli.js` 或安装后的 `lemonppt`。
@@ -0,0 +1,99 @@
1
+ # lemonPPT - AI-powered presentation generation
2
+ # Copyright (c) 2026 lemonforme
3
+ # SPDX-License-Identifier: AGPL-3.0-or-later
4
+
5
+ name: lemonppt
6
+ description: |
7
+ lemonPPT 结构化 goal.json → 视觉 PPT 渲染与导出引擎。
8
+ 提供端到端生成、版式查询与字段契约查看、goal.json 规范化与校验能力。
9
+
10
+ tools:
11
+ - name: lemonppt-generate-goal
12
+ description: 根据一句话需求生成完整 goal.json
13
+ command: |
14
+ lemonppt generate "{{input}}" --pages {{pageCount}} --theme {{theme}} --language {{language}}
15
+ parameters:
16
+ input:
17
+ type: string
18
+ required: true
19
+ pageCount:
20
+ type: integer
21
+ default: 8
22
+ theme:
23
+ type: string
24
+ default: theme01
25
+ language:
26
+ type: string
27
+ default: zh
28
+
29
+ - name: lemonppt-list-themes
30
+ description: 列出所有可用主题
31
+ command: lemonppt list-themes
32
+
33
+ - name: lemonppt-layout-query
34
+ description: 按主题与角色查询候选版式
35
+ command: |
36
+ lemonppt layout-query --theme {{theme}} --role {{role}} --limit {{limit}}{% if keyword %} --keyword {{keyword}}{% endif %}{% if needsMedia %} --needs-media{% endif %}
37
+ parameters:
38
+ theme:
39
+ type: string
40
+ required: true
41
+ role:
42
+ type: string
43
+ required: true
44
+ keyword:
45
+ type: string
46
+ needsMedia:
47
+ type: boolean
48
+ limit:
49
+ type: integer
50
+ default: 8
51
+
52
+ - name: lemonppt-inspect-layout
53
+ description: 查看指定版式的字段契约
54
+ command: lemonppt inspect-layout {{layoutId}}
55
+ parameters:
56
+ layoutId:
57
+ type: string
58
+ required: true
59
+
60
+ - name: lemonppt-goal-scaffold
61
+ description: 生成只含 role 的 goal.json 骨架
62
+ command: |
63
+ lemonppt goal-scaffold --title "{{title}}" --goal "{{goal}}" --theme {{theme}} --pages {{pages}} --language {{language}} --out ./goal.json
64
+ parameters:
65
+ title:
66
+ type: string
67
+ required: true
68
+ goal:
69
+ type: string
70
+ required: true
71
+ theme:
72
+ type: string
73
+ default: theme01
74
+ pages:
75
+ type: integer
76
+ default: 8
77
+ language:
78
+ type: string
79
+ default: zh
80
+
81
+ - name: lemonppt-write-safe-props
82
+ description: 规范化 goal.json 的 props
83
+ command: lemonppt write-safe-props ./goal.json --write
84
+
85
+ - name: lemonppt-validate-goal-spec
86
+ description: 校验 goal.json 是否符合规范
87
+ command: lemonppt validate-goal-spec ./goal.json
88
+
89
+ - name: lemonppt-export-pptx
90
+ description: 导出 PPTX
91
+ command: lemonppt export ./goal.json --pptx ./deck.pptx
92
+
93
+ - name: lemonppt-export-pdf
94
+ description: 导出 PDF
95
+ command: lemonppt export ./goal.json --pdf ./deck.pdf
96
+
97
+ instructions: |
98
+ 当用户需要生成 PPT 时,优先使用 lemonppt-generate-goal 端到端生成。
99
+ 当用户需要控制每一页版式或查看字段契约时,使用 layout-query、inspect-layout、goal-scaffold 等工具精细编排。
@@ -0,0 +1,47 @@
1
+ # lemonPPT - AI-powered presentation generation
2
+ # Copyright (c) 2026 lemonforme
3
+ # SPDX-License-Identifier: AGPL-3.0-or-later
4
+
5
+ name: lemonppt
6
+ description: |
7
+ Cursor Agent 调用 lemonPPT 的参考配置。
8
+ 建议将以下内容写入项目根目录的 .cursorrules 文件,或作为 Cursor Composer 的 system prompt 片段使用。
9
+
10
+ cursorrules: |
11
+ # lemonPPT Skill 调用规范
12
+
13
+ lemonPPT 是一个结构化 goal.json → 视觉 PPT 的渲染与导出引擎。
14
+
15
+ ## 能力边界
16
+ - ✅ 将 `goal.json` 渲染为可离线打开的 HTML deck(支持浏览器内编辑)
17
+ - ✅ 导出可编辑 PPTX 或截图 PDF
18
+ - ✅ 根据 `role` 自动挑选合适版式
19
+ - ✅ 内置自然语言 → `goal.json` 生成(`lemonppt generate`)
20
+ - ✅ 程序化选页(`lemonppt layout-query`)、查看版式契约(`lemonppt inspect-layout`)
21
+ - ✅ goal.json 规范化(`lemonppt write-safe-props`)与校验(`lemonppt validate-goal-spec`)
22
+ - ❌ 不直接解析外部文档(Word/PDF/Markdown);如需“上传文档生成 PPT”,外层 Agent 需先提取文本/结构,再交给 lemonPPT
23
+
24
+ ## 推荐调用流程
25
+
26
+ ### 方式 1:一句话端到端
27
+ ```bash
28
+ lemonppt generate "面向企业客户的 AI 助手产品发布会..." --pages 8 --theme theme01 --language zh --out ./goal.json
29
+ lemonppt export ./goal.json --pptx ./deck.pptx --pdf ./deck.pdf
30
+ ```
31
+
32
+ ### 方式 2:精细编排
33
+ ```bash
34
+ lemonppt list-themes
35
+ lemonppt layout-query --theme theme06 --role metric --limit 5
36
+ lemonppt inspect-layout theme06_metric_hero_v1
37
+ lemonppt goal-scaffold --title "AI 产业投资图谱" --goal "..." --theme theme06 --pages 10 --out ./goal.json
38
+ # 外层 Agent 填充 props 后
39
+ lemonppt write-safe-props ./goal.json --write
40
+ lemonppt validate-goal-spec ./goal.json
41
+ lemonppt export ./goal.json --pptx ./deck.pptx
42
+ ```
43
+
44
+ ## 关键约束
45
+ - 不要直接为 slide 指定 `layout`;优先只提供 `role` 与 `props`,由系统自动选版式。
46
+ - 所有字符串字段必须非空,数组字段必须非空且元素关键字段非空。
47
+ - theme 默认值是 theme01;如需 theme06 请在 generate 或 goal-scaffold 时显式指定。