$npx -y skills add hiyeshu/codeck --skill codeck-exportInternal publisher module for /codeck. Exports deck to PDF or PPTX with post-export QA. User-facing export requests should enter through /codeck; this skill defines the export behavior.
| 1 | <!-- |
| 2 | [INPUT]: Depends on latest assembled HTML, MEMORY.md, tasks/tasks.md, and threads/threads.md. |
| 3 | [OUTPUT]: Provides PDF/PPTX exports and export QA notes. |
| 4 | [POS]: skills/codeck-export lane; publishes the reviewed deck from room state to final artifacts. |
| 5 | [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md |
| 6 | --> |
| 7 | |
| 8 | # codeck export — @export lane |
| 9 | |
| 10 | Minimum conversation, maximum output. Export the deck to the user's format. |
| 11 | |
| 12 | `@export` owns PDF/PPTX output and export QA. |
| 13 | |
| 14 | Write boundaries: |
| 15 | |
| 16 | - May write final PDF/PPTX files in the user's project directory |
| 17 | - May write export QA notes to `$DECK_DIR/review.md` or `$DECK_DIR/MEMORY.md` |
| 18 | - May update `$DECK_DIR/roles/export.md`, `$DECK_DIR/tasks/tasks.md`, and `$DECK_DIR/channel/YYYY-MM-DD.md` |
| 19 | - Must not edit `deck.md`, `DESIGN.md`, `custom.css`, `slides.html`, or `speech.md` |
| 20 | - Export defects that require source changes become proposals in `$DECK_DIR/threads/threads.md` |
| 21 | |
| 22 | ## Step 1: Status |
| 23 | |
| 24 | ```bash |
| 25 | DECK_DIR="$HOME/.codeck/projects/$(basename "$(pwd)")" |
| 26 | CODECK_SKILL_DIR="${CODECK_SKILL_DIR:-}" |
| 27 | if [ -z "$CODECK_SKILL_DIR" ]; then |
| 28 | for d in "$HOME/.agents/skills/codeck" "$HOME/.codex/skills/codeck" "$HOME/.claude/skills/codeck"; do |
| 29 | if [ -d "$d/scripts" ]; then CODECK_SKILL_DIR="$d"; break; fi |
| 30 | done |
| 31 | fi |
| 32 | [ -n "$CODECK_SKILL_DIR" ] || { echo "codeck skill scripts not found" >&2; exit 1; } |
| 33 | mkdir -p "$DECK_DIR" |
| 34 | mkdir -p "$DECK_DIR/channel" "$DECK_DIR/tasks" "$DECK_DIR/threads" "$DECK_DIR/roles" |
| 35 | bash "$CODECK_SKILL_DIR/scripts/init-room.sh" "$DECK_DIR" |
| 36 | bash "$CODECK_SKILL_DIR/scripts/status.sh" "$DECK_DIR" |
| 37 | ``` |
| 38 | |
| 39 | Read `$DECK_DIR/MEMORY.md`, active rows in `$DECK_DIR/tasks/tasks.md`, and open rows in `$DECK_DIR/threads/threads.md`. Do not read `channel/YYYY-MM-DD.md` unless debugging history. |
| 40 | |
| 41 | Gate check: if no assembled HTML exists (`./*-r*.html`), run `/codeck` to generate/rebuild the deck first. |
| 42 | |
| 43 | Before export, claim the work ticket: |
| 44 | |
| 45 | ```markdown |
| 46 | @orchestrator |
| 47 | Owner: @export. Task: export latest HTML and run export QA. |
| 48 | |
| 49 | @export |
| 50 | I claim the export pass. I will write PDF/PPTX outputs and record any source defects as threads. |
| 51 | ``` |
| 52 | |
| 53 | Append the exchange to today's channel file and update `tasks/tasks.md`. |
| 54 | |
| 55 | ## Step 2: Format |
| 56 | |
| 57 | Export Format is one allowed Decision Ask moment under `/codeck`. |
| 58 | |
| 59 | Use the shared `/codeck` Decision Ask Policy. Skip Decision Ask when the user names a target: |
| 60 | |
| 61 | - `PDF`, `print`, `save as PDF` → export PDF |
| 62 | - `PPTX`, `PowerPoint`, `slides file` → export PPTX |
| 63 | - `all`, `both` → export PDF and PPTX |
| 64 | |
| 65 | If the user only says "export", create a non-blocking `D-YYYYMMDD-NN` decision in `threads/threads.md` and render once: |
| 66 | |
| 67 | ```text |
| 68 | codeck needs the export format. |
| 69 | |
| 70 | Current read: HTML already exists as the audience preview. |
| 71 | |
| 72 | I suggest PDF because it preserves the visual layout and is easiest to share. |
| 73 | |
| 74 | A) PDF (recommended) |
| 75 | B) PPTX |
| 76 | C) PDF + PPTX |
| 77 | ``` |
| 78 | |
| 79 | If the user does not answer or structured AskUser UI is unavailable, export PDF and write `assumed default` to `MEMORY.md`. |
| 80 | |
| 81 | Do not offer HTML as an export choice. HTML is the preview/source artifact. |
| 82 | |
| 83 | ## Step 3: Export |
| 84 | |
| 85 | Find the HTML file (`./*-r*.html` in the user's project directory), derive baseName. |
| 86 | |
| 87 | ### HTML |
| 88 | |
| 89 | Already exists. Open in browser, F for fullscreen, arrows to navigate. |
| 90 | |
| 91 | ### PDF — print from HTML |
| 92 | |
| 93 | Use Playwright for WYSIWYG PDF: |
| 94 | |
| 95 | ```bash |
| 96 | npx playwright install chromium 2>/dev/null || true |
| 97 | ``` |
| 98 | |
| 99 | ```javascript |
| 100 | import { chromium } from 'playwright'; |
| 101 | import { resolve } from 'path'; |
| 102 | import { readdirSync } from 'fs'; |
| 103 | import { pathToFileURL } from 'url'; |
| 104 | |
| 105 | const html = readdirSync('.').find(f => /-r\d+\.html$/.test(f)); |
| 106 | const baseName = html.replace('.html', ''); |
| 107 | const browser = await chromium.launch(); |
| 108 | const page = await browser.newPage(); |
| 109 | await page.goto(pathToFileURL(resolve(html)).toString(), { waitUntil: 'networkidle' }); |
| 110 | await page.emulateMedia({ media: 'screen' }); |
| 111 | await page.pdf({ |
| 112 | path: `${baseName}.pdf`, |
| 113 | printBackground: true, |
| 114 | preferCSSPageSize: true, |
| 115 | margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' } |
| 116 | }); |
| 117 | await browser.close(); |
| 118 | console.log(`done: ${baseName}.pdf`); |
| 119 | ``` |
| 120 | |
| 121 | ### Poster assets |
| 122 | |
| 123 | `.media-poster` elements in slides.html are video/audio placeholders. Original file paths are in the caption and `deck.md` asset manifest. |
| 124 | |
| 125 | Default: keep placeholders in export. If user says "embed video", extract path from caption, use `slide.addMedia({ path: "..." })` for PPTX. |
| 126 | |
| 127 | ### PPTX — from HTML |
| 128 | |
| 129 | **Option A (recommended): LibreOffice** |
| 130 | |
| 131 | ```bash |
| 132 | CODECK_EXPORT_DIR="${CODECK_EXPORT_DIR:-}" |
| 133 | if [ -z "$CODECK_EXPORT_DIR" ]; then |
| 134 | for d in "$HOME/.agents/skills/codeck-export" "$HOME/.codex/skills/codeck-export" "$HOME/.claude/skills/codeck-export"; do |
| 135 | if [ -d "$d/pptx/scripts" ]; then CODECK_EXPORT_DIR="$d"; break; fi |
| 136 | done |
| 137 | fi |
| 138 | [ -n "$CODECK_EXPORT_DIR" ] || { echo "code |