Skip to content

PlutoLei/paperbanana-skill / plugins/paperbanana-slide-deck

paperbanana-slide-deck

Unverified

Create or revise a complete PaperBanana slide deck, including image slides and native editable PowerPoint text, tables, charts and diagrams. Use for PaperBanana deck requests; preserve the user's selected presentation tool and existing deck mode.

FileKindSize
.claude-plugin/plugin.jsonconfig396 B
.gitignoreother22 B
SKILL.mdskill md6.4 KB
bun.lockother4.5 KB
package.jsonmanifest424 B
references/editable-slide-spec.mdmarkdown9.0 KB
references/outline-format.mdmarkdown927 B
references/style-guide.mdmarkdown1.3 KB
references/styles/3d-model.mdmarkdown2.7 KB
references/styles/abstract.mdmarkdown2.5 KB
references/styles/academia.mdmarkdown2.5 KB
references/styles/adorable-3d-character.mdmarkdown2.5 KB
references/styles/afrofuturism.mdmarkdown2.8 KB
references/styles/alcohol-ink.mdmarkdown2.4 KB
references/styles/analog-film.mdmarkdown2.6 KB
references/styles/architectural.mdmarkdown2.4 KB
references/styles/art-deco.mdmarkdown2.5 KB
references/styles/art-nouveau.mdmarkdown2.5 KB
references/styles/artistic-vision.mdmarkdown2.7 KB
references/styles/avant-garde.mdmarkdown2.6 KB
references/styles/baroque.mdmarkdown2.4 KB
references/styles/bauhaus-style-poster.mdmarkdown2.5 KB
references/styles/bauhaus-style.mdmarkdown2.6 KB
references/styles/blueprint-schematic-drawing.mdmarkdown2.5 KB
references/styles/cel-shaded-art.mdmarkdown2.5 KB
references/styles/chromolithography.mdmarkdown2.4 KB
references/styles/cinematic-dynamic.mdmarkdown2.6 KB
references/styles/cinematic.mdmarkdown2.6 KB
references/styles/classicism-art.mdmarkdown2.5 KB
references/styles/collage.mdmarkdown2.4 KB
references/styles/color-field-painting.mdmarkdown2.6 KB
references/styles/color-sketchnote.mdmarkdown2.4 KB
references/styles/colored-pencil-art.mdmarkdown2.6 KB
references/styles/conceptual-art.mdmarkdown2.5 KB
references/styles/constructivism.mdmarkdown2.5 KB
references/styles/constructivist.mdmarkdown2.5 KB
references/styles/craft-clay.mdmarkdown2.7 KB
references/styles/cubism.mdmarkdown2.6 KB
references/styles/cubist.mdmarkdown2.5 KB
references/styles/cyanotype.mdmarkdown2.5 KB
references/styles/cyberpunk-cityscape.mdmarkdown2.4 KB
references/styles/de-stijl.mdmarkdown2.5 KB
references/styles/digital-art.mdmarkdown2.8 KB
references/styles/double-exposure.mdmarkdown2.6 KB
references/styles/dreamscape.mdmarkdown2.4 KB
references/styles/dynamic-illustration.mdmarkdown2.6 KB
references/styles/embroidery.mdmarkdown2.6 KB
references/styles/encaustic.mdmarkdown2.4 KB
references/styles/expressionism.mdmarkdown2.6 KB
references/styles/expressionist.mdmarkdown2.4 KB
references/styles/fairy-tale.mdmarkdown2.4 KB
references/styles/fashion-editorial.mdmarkdown2.3 KB
references/styles/film-noir.mdmarkdown2.4 KB
references/styles/flat-2d-art.mdmarkdown2.6 KB
references/styles/flat-papercut.mdmarkdown2.4 KB
references/styles/futurism.mdmarkdown2.6 KB
references/styles/futuristic.mdmarkdown2.4 KB
references/styles/glamour.mdmarkdown2.4 KB
references/styles/glitchcore.mdmarkdown2.6 KB
references/styles/gothic.mdmarkdown2.5 KB
references/styles/halftone.mdmarkdown2.4 KB
references/styles/hdr.mdmarkdown2.5 KB
references/styles/high-fashion.mdmarkdown2.6 KB
references/styles/hyperrealism.mdmarkdown2.5 KB
references/styles/idyllic.mdmarkdown2.6 KB
references/styles/illuminated-manuscript.mdmarkdown2.9 KB
references/styles/impressionism.mdmarkdown2.7 KB
references/styles/impressionist.mdmarkdown2.5 KB
references/styles/infographic-drawing.mdmarkdown2.6 KB
references/styles/isometric.mdmarkdown2.6 KB
references/styles/japanese-ink-drawing.mdmarkdown2.7 KB
references/styles/kawaii.mdmarkdown2.5 KB
references/styles/kirigami.mdmarkdown2.5 KB
references/styles/knolling-photography.mdmarkdown2.6 KB
references/styles/light-cheery-atmosphere.mdmarkdown2.5 KB
references/styles/line-art.mdmarkdown2.6 KB
references/styles/logo-design.mdmarkdown2.6 KB
references/styles/long-exposure.mdmarkdown2.4 KB
references/styles/lowpoly.mdmarkdown2.6 KB
references/styles/luxurious-elegance.mdmarkdown2.6 KB
references/styles/luxury.mdmarkdown2.3 KB
references/styles/lyrical-geometry.mdmarkdown2.7 KB
references/styles/macro-photography.mdmarkdown2.8 KB
references/styles/marker-drawing.mdmarkdown2.6 KB
references/styles/minimalism.mdmarkdown2.5 KB
references/styles/minimalist.mdmarkdown2.3 KB
references/styles/monochrome.mdmarkdown2.4 KB
references/styles/mosaic.mdmarkdown2.5 KB
references/styles/nautical.mdmarkdown2.4 KB
references/styles/neo-futurism.mdmarkdown2.3 KB
references/styles/neo-impressionism.mdmarkdown2.3 KB
references/styles/neon-noir.mdmarkdown2.5 KB
references/styles/neonpunk.mdmarkdown2.7 KB
references/styles/one-line-art.mdmarkdown2.5 KB
references/styles/op-art.mdmarkdown2.5 KB
references/styles/origami.mdmarkdown2.7 KB
references/styles/ornate-intricate.mdmarkdown2.4 KB
references/styles/paper-quilling.mdmarkdown2.5 KB
references/styles/pencil-sketch.mdmarkdown2.4 KB
references/styles/pop-art.mdmarkdown2.2 KB
references/styles/real-estate.mdmarkdown2.2 KB
references/styles/renaissance.mdmarkdown2.4 KB
references/styles/retail.mdmarkdown2.3 KB
references/styles/retro-futurism.mdmarkdown2.5 KB
references/styles/sci-fi.mdmarkdown2.4 KB
references/styles/shepard-fairey-style.mdmarkdown2.5 KB
references/styles/silhouette-art.mdmarkdown2.5 KB
references/styles/silhouette.mdmarkdown2.4 KB
references/styles/simple-vector-art.mdmarkdown2.4 KB
references/styles/space-art.mdmarkdown2.8 KB
references/styles/space.mdmarkdown2.4 KB
references/styles/stacked-papercut.mdmarkdown2.5 KB
references/styles/stained-glass.mdmarkdown2.5 KB
references/styles/steampunk.mdmarkdown2.4 KB
references/styles/sumi-e-detailed.mdmarkdown2.7 KB
references/styles/sumi-e-symbolic.mdmarkdown2.7 KB
references/styles/suminagashi.mdmarkdown2.5 KB
references/styles/surrealism.mdmarkdown2.4 KB
references/styles/surrealist.mdmarkdown2.4 KB
references/styles/tilt-shift.mdmarkdown2.5 KB
references/styles/tranquil.mdmarkdown2.4 KB
references/styles/typography.mdmarkdown2.5 KB
references/styles/ukiyo-e.mdmarkdown2.5 KB
references/styles/van-gogh.mdmarkdown2.5 KB
references/styles/vaporwave.mdmarkdown2.5 KB
references/styles/vibrant-rim-light.mdmarkdown2.4 KB
references/styles/vintage-airline-poster.mdmarkdown2.5 KB
references/styles/vintage-travel-poster.mdmarkdown2.6 KB
references/styles/volumetric-lighting.mdmarkdown2.4 KB
references/styles/whimsical.mdmarkdown2.2 KB
references/styles/zentangle.mdmarkdown2.4 KB
scripts/build-deck.tsscript2.5 KB
scripts/editable/render-editable-pptx.tsscript4.6 KB
scripts/editable/render-previews.pyscript6.6 KB
scripts/editable/render_inputs.pyscript2.2 KB
scripts/editable/review-editable.pyscript16.3 KB
scripts/editable/slide-spec.schema.jsonconfig2.6 KB
scripts/editable/validate-slide-spec.tsscript5.5 KB
scripts/merge-to-pptx.tsscript4.0 KB
tests/editable-mode.test.tsscript2.5 KB
tests/fixtures/editable/slide-spec.jsonconfig1.4 KB
tests/image-mode.test.tsscript1.4 KB
tests/mode-router.test.tsscript528 B
tests/test_critic_core_integration.pyscript4.4 KB
tests/test_render_previews.pyscript8.6 KB
tests/test_review_editable.pyscript15.7 KB

scripts/editable/render-previews.py

View on GitHub
#!/usr/bin/env python3
"""Build an editable spec and render its PPTX into verifiable local previews.

Requires Bun plus the plugin dependencies, LibreOffice and Poppler. No model
service is called. The manifest records which spec, PPTX and pages belong to
one render; it is an integrity record, not scientific or security attestation.
"""

import argparse
import hashlib
import importlib.util
import json
import os
from pathlib import Path
import re
import shutil
import subprocess
import sys
import tempfile
from datetime import datetime, timezone
from uuid import uuid4

_INPUT_SPEC = importlib.util.spec_from_file_location(
    "paperbanana_render_inputs", Path(__file__).resolve().with_name("render_inputs.py"))
_INPUTS = importlib.util.module_from_spec(_INPUT_SPEC)
_INPUT_SPEC.loader.exec_module(_INPUTS)


def sha256(path: Path) -> str:
    return hashlib.sha256(path.read_bytes()).hexdigest()


def generated_name(name: str) -> bool:
    return name in {"deck.pptx", "deck.pdf", "render-manifest.json"} or bool(
        re.fullmatch(r"slide-\d+\.png", name))


def check_destination(output: Path) -> None:
    if output.is_symlink():
        raise ValueError("output directory must not be a symlink")
    if output.exists():
        if not output.is_dir():
            raise ValueError("output path is not a directory")
        for item in output.iterdir():
            if item.is_symlink() or not item.is_file() or not generated_name(item.name):
                raise ValueError(f"output directory contains an unrelated item: {item.name}")


def run(command: list[str]) -> None:
    subprocess.run(command, check=True, capture_output=True, text=True, timeout=120)


def publish_bundle(stage: Path, output: Path, names: list[str]) -> None:
    """Swap complete generations; retain a recovery copy if rollback itself fails."""
    bundle = stage / "bundle"
    bundle.mkdir()
    for name in names:
        (stage / name).rename(bundle / name)
    check_destination(output)
    backup = output.with_name(f".{output.name}.backup-{uuid4().hex}")
    previous = output.exists()
    if previous:
        os.replace(output, backup)
    try:
        os.replace(bundle, output)
    except BaseException:
        if previous:
            try:
                os.replace(backup, output)
            except OSError as exc:
                # This directory is outside TemporaryDirectory, so cleanup
                # cannot erase the only complete copy after an I/O failure.
                raise RuntimeError(f"Publication and rollback failed; previous output is at {backup}") from exc
        raise
    if previous:
        try:
            shutil.rmtree(backup)
        except OSError:
            print(f"Render published; previous-output backup remains at {backup}", file=sys.stderr)


def render(spec_path: Path, output: Path) -> dict:
    check_destination(output)
    spec_path = spec_path.resolve()
    spec_bytes = spec_path.read_bytes()
    spec_hash = hashlib.sha256(spec_bytes).hexdigest()
    spec = json.loads(spec_bytes)
    for source in [spec_path, *_INPUTS.source_image_paths(spec, spec_path)]:
        if source.resolve().is_relative_to(output.resolve()):
            raise ValueError("output directory must not contain the spec or any source image")
    assets = _INPUTS.collect_assets(spec, spec_path)
    slide_ids = [slide["id"] for slide in spec["slides"]]
    if not slide_ids or len(set(slide_ids)) != len(slide_ids):
        raise ValueError("spec must contain nonempty slides with unique IDs")
    output.parent.mkdir(parents=True, exist_ok=True)
    # Work beside the destination so publishing uses same-filesystem replaces.
    # An isolated LibreOffice profile avoids another open Office process.
    with tempfile.TemporaryDirectory(prefix=".paperbanana-render-", dir=output.parent) as temp:
        stage = Path(temp)
        deck = stage / "deck.pptx"
        renderer = Path(__file__).resolve().with_name("render-editable-pptx.ts")
        run(["bun", str(renderer), str(spec_path), str(deck)])
        profile = (stage / "office-profile").as_uri()
        run(["soffice", f"-env:UserInstallation={profile}", "--headless", "--convert-to", "pdf",
             "--outdir", str(stage), str(deck)])
        pdf = stage / "deck.pdf"
        if not pdf.is_file():
            raise ValueError("LibreOffice produced no deck.pdf")
        run(["pdftoppm", "-png", "-r", "150", str(pdf), str(stage / "page")])
        raw_pages = sorted(stage.glob("page-*.png"), key=lambda p: int(p.stem.split("-")[-1]))
        page_numbers = [int(p.stem.split("-")[-1]) for p in raw_pages]
        if page_numbers != list(range(1, len(slide_ids) + 1)):
            raise ValueError("rendered page count/order does not match the spec")
        pages = []
        for index, (slide_id, page) in enumerate(zip(slide_ids, raw_pages), 1):
            normalized = stage / f"slide-{index:02d}.png"
            page.rename(normalized)
            pages.append({"slide_id": slide_id, "index": index,
                          "file": normalized.name, "sha256": sha256(normalized)})
        if sha256(spec_path) != spec_hash:
            raise ValueError("spec changed while rendering; previous output was preserved")
        if _INPUTS.collect_assets(spec, spec_path) != assets:
            raise ValueError("image assets changed while rendering; previous output was preserved")
        manifest = {
            "schema_version": 2, "rendered_at": datetime.now(timezone.utc).isoformat(),
            "spec_sha256": spec_hash,
            "assets": assets,
            "pptx": {"file": "deck.pptx", "sha256": sha256(deck)},
            "slides": pages,
        }
        (stage / "render-manifest.json").write_text(
            json.dumps(manifest, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
        names = ["deck.pptx", "deck.pdf", *[p["file"] for p in pages], "render-manifest.json"]
        publish_bundle(stage, output, names)
        return manifest


def main(argv=None) -> int:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--spec", required=True, help="Path to slide-spec.json")
    parser.add_argument("--output-dir", required=True, help="Dedicated generated-preview directory")
    args = parser.parse_args(argv)
    try:
        # Keep the final component unresolved so symlinks are rejected.
        output = Path(args.output_dir).absolute()
        manifest = render(Path(args.spec), output)
    except Exception as exc:
        print(f"Render failed ({type(exc).__name__}): {exc}", file=sys.stderr)
        return 1
    print(f"Rendered {len(manifest['slides'])} slides: {output / 'render-manifest.json'}")
    return 0


if __name__ == "__main__":
    sys.exit(main())
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall