baoyu-slide-deck
Generates professional slide deck images from content. Creates outlines with style instructions, then generates individual slide images. Use when user asks to "create slides", "make a presentation", "generate deck", "slide deck", or "PPT".
1How It Works & Mechanism
It operates as a phased pipeline: Analysis → Mandatory Confirmation → Outline → Prompts → Image Generation → PPTX/PDF Merging. Artifacts at each stage are saved to disk, supporting resumable execution via flags like --outline-only / --prompts-only / --images-only.
- [ ] Step 7: Generate images
Image generation backends are not implemented directly in this repository, but resolved by priority: Current request specification > EXTEND.md preferences > Runtime native tools (Codex imagegen / Cursor GenerateImage / Hermes image_generate) > Only installed non-native backend (baoyu-image-gen) > Prompt the user.
If a skill named `imagegen` is listed, you are running inside Codex and MUST use it
When following the codex-imagegen branch, it prioritizes routing via the repository's sibling baoyu-image-gen skill script rather than calling the wrapper directly.
route through `baoyu-image-gen --provider codex-cli` (preferred)
Prompt files serve as rigid, reproducible records: Before invoking any backend, the complete final prompt for each slide must first be saved to prompts/NN-slide-[slug].md.
**Prompt file requirement (hard)**: write each image's full, final prompt to a standalone file under `prompts/`
Merging is the only executable code in this repository and is strictly local: merge-to-pdf.ts embeds images page-by-page using pdf-lib, while merge-to-pptx.ts uses pptxgenjs to output 16:9 slides with base-prompt + per-page prompts embedded into the notes.
pptx.layout = "LAYOUT_16x9";
Confirmation is a hard gate: Step 3 and subsequent steps must not be entered if Step 2 is incomplete, unless the user explicitly stated 'generate directly / no confirmation needed' in the current turn.
Do **not** start Step 3 or later until the user completes Step 2.
Style system = 17 presets × 4 dimensions (texture/mood/typography/density) with free combination; automatically selected when content signals match the keyword table, otherwise falling back to blueprint.
17 presets covering technical / educational / lifestyle / editorial use cases.
Batch image generation follows a strict priority: Backend native batch > Runtime parallel tool calls (default 4, overridable via --batch-size) > Serial; furthermore, 'all prompt files must be saved to disk' before the first batch may begin.
- Never start the first batch until all selected slide prompt files exist on disk.
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| api | 运行时图像生成后端(Codex imagegen Skill / Cursor GenerateImage / Hermes image_generate)——用户内容与提示词由此出网 |
| cli | codex CLI(无原生 imagegen 时的 codex exec 后端,需 codex login) |
| cli | baoyu-image-gen 技能脚本(--provider codex-cli,首选路径) |
| cli | bun / npx -y bun(跑合并脚本与包装器) |
| package | pdf-lib ^1.17.1(PDF 合并) |
| package | pptxgenjs ^4.0.1(PPTX 合并,声明于仓库根 package.json) |
| package | sharp ^0.34.5(根依赖,两个合并脚本均未 import) |
| network | homepage 元数据 URL(静态 frontmatter,任何步骤都不抓取) |
4Recommended Governance & Evidence
- scripts/: Execute local script or command: ${BUN_X} {baseDir}/scripts/merge-to-pptx.ts <slide-deck-dir> (bun or npx -y b
- 网络端点: Declare external network access: The skill's own scripts make zero network calls (both merge scripts only import fs/path + pdf-lib / pptxgenjs)
- 本地工作目录: File read/write and artifact output: slide-deck/{topic-slug}/source-*.{ext} and analysis.md
5Second-Pass Verification
- [ok] 两个合并脚本无网络、无 env、无 spawn — merge-to-pdf.ts 只 import fs/path + pdf-lib,merge-to-pptx.ts 只 import fs/path + pptxgenjs;全目录 grep process.env/fetch/http/child_process 零命中。
- [ok] 出图后端解析阶梯与 SKILL.md 一致 — 阶梯为 当前请求 > EXTEND.md preferred_image_backend > 运行时原生(imagegen/GenerateImage/image_generate)> 唯一非原生后端 > 问用户;codex-imagegen 分支的调用契约在 references/codex-imagegen.md。
- [ok] 不读 API key(认证走用户订阅) — codex-imagegen.md 明写 'no `OPENAI_API_KEY` is read or sent';脚本零 env 读取,唯一的 env 覆盖是 $BAOYU_CODEX_IMAGEGEN_BIN(后端可执行文件路径)。
- [ok] prompt 文件先行是硬要求 — SKILL.md 标注 (hard),且合并脚本把 base-prompt + 每页 prompt 写进 PPTX 备注,形成可复现双通道。
- [ok] 依赖与声明一致性 — pdf-lib/pptxgenjs 由仓库根 package.json 提供(skill 内无 package.json);根依赖 sharp 未被这两个脚本 import(属未使用依赖)。
- [ok] EXTEND.md 路径文档不一致(轻微) — SKILL.md 列三条路径(含 XDG),references/config/preferences-schema.md 只列项目与家目录两条;另 slide-deck 的首次设置明确不阻塞(与 translate/xhs-images 相反),已在正文引用中如实标注。
- [ok] base-prompt.md 的模型定向指令 — 文件结尾确有 'Please use nano banana pro to generate the slide image based on the content provided above.' 与 'DO NOT refuse to generate' 类措辞;因它把用户文本与模型指令混在同一通道,已写入 injection_surface 与 risks。
- [ok] 档位复核(批4 终裁) — 按 Main『生成後端類先例=orange』与点名后端+素材出网的判法落 orange;自身脚本仅有本地 pdf/pptx 合并与写盘,不升红。
6Verdict & Scenarios
9867805610b81b26…