feat: add PDF export for slide-deck and comic skills

This commit is contained in:
Jim Liu 宝玉
2026-01-17 12:08:08 -06:00
parent c731faea8f
commit bb4f0dc52c
7 changed files with 334 additions and 15 deletions
+33 -6
View File
@@ -36,6 +36,20 @@ Style × Layout can be freely combined.
| Wine, food, business, lifestyle, professional | realistic | cinematic |
| Biography, balanced | classic | mixed |
## Script Directory
**Important**: All scripts are located in the `scripts/` subdirectory of this skill.
**Agent Execution Instructions**:
1. Determine this SKILL.md file's directory path as `SKILL_DIR`
2. Script path = `${SKILL_DIR}/scripts/<script-name>.ts`
3. Replace all `${SKILL_DIR}` in this document with the actual path
**Script Reference**:
| Script | Purpose |
|--------|---------|
| `scripts/merge-to-pdf.ts` | Merge comic pages into PDF |
## File Structure
```
@@ -48,7 +62,8 @@ Style × Layout can be freely combined.
│ ├── 00-cover.md
│ └── XX-page.md
├── 00-cover.png
── XX-page.png
── XX-page.png
└── {topic-slug}.pdf
```
**Target directory**:
@@ -99,12 +114,13 @@ For each page (cover + pages):
**Image Generation Skill Selection**:
- Check available image generation skills in the environment
- Adapt parameters based on skill capabilities:
- If supports `--promptfiles`: pass prompt files
- If supports reference image: pass `characters/characters.png`
- If text-only: concatenate prompts into single text
- If multiple skills available, ask user preference
**Character Reference Handling**:
- If skill supports reference image: pass `characters/characters.png` as reference image
- If skill does NOT support reference image: include `characters/characters.md` content in the prompt
- This ensures character visual consistency across all pages
**Session Management**:
If the image generation skill supports `--sessionId`:
1. Generate a unique session ID at the start (e.g., `comic-{topic-slug}-{timestamp}`)
@@ -113,7 +129,17 @@ If the image generation skill supports `--sessionId`:
3. Report progress after each generation
### Step 5: Completion Report
### Step 5: Merge to PDF
After all images are generated, merge them into a PDF file:
```bash
npx -y bun ${SKILL_DIR}/scripts/merge-to-pdf.ts <comic-dir>
```
This creates `{topic-slug}.pdf` in the comic directory with all pages as full-page images.
### Step 6: Completion Report
```
Comic Complete!
@@ -121,6 +147,7 @@ Title: [title] | Style: [style] | Pages: [count]
Location: [path]
✓ characters.png
✓ 00-cover.png ... XX-page.png
✓ {topic-slug}.pdf
```
## Style-Specific Guidelines