Skip to content

feat: add presentation creation tool #786

Description

@avoidwork

Summary

Add a tool to create PowerPoint presentations (.pptx) from structured content — slides, layouts, formatting, and media.

Motivation

The existing PPTX tool (src/tools/fileExtract/pptx.js) is read-only — it extracts content from existing presentations. Marketing teams live in slide decks: creating pitch decks, status reports, training materials, and client presentations. Currently the agent can only read PPTX files, not create them. Users must fall back to shell commands (python-pptx, libreoffice) or manual creation, which is fragile and loses formatting fidelity.

Proposed Solution

Create a presentation creation tool that accepts structured content and generates .pptx files:

  • Slide creation: Add slides with titles, bullet points, images, charts
  • Layout support: Title slide, content slide, two-column, comparison, quote, image-only layouts
  • Formatting: Font styles, colors, alignment, spacing
  • Media: Embed images, charts, tables
  • Template support: Apply existing PPTX templates or create from scratch
  • Output: Save as .pptx file path

Each tool should follow the existing tool pattern in src/tools/ — a zod schema, an impl function, and registration in index.js with filesystem:write permission.

Alternatives Considered

  • Shell-based tools (python-pptx, libreoffice): fragile, requires user-installed dependencies, no structured input.
  • Read-only PPTX extraction: insufficient for creation workflows.
  • Web-based presentation service: adds infrastructure complexity for a local-first tool.

OpenSpec Note

This project uses OpenSpec for feature development. If this request is approved, I will:

  1. Run /opsx:propose to generate a full proposal with specs and tasks
  2. Iterate on the design before any code is written
  3. Follow the task-driven implementation workflow

Additional Context

This should integrate with the document creation gap (#778) and text processing gap (#784) — e.g., generating marketing copy and then creating a slide deck from it. The existing pptx.js read tool (src/tools/fileExtract/pptx.js) would serve as the input layer for reading existing presentations as templates.

Dependencies

  • Primary library: pptxgenjs (v3.x+) — pure JavaScript, no system dependencies, cross-platform, supports layouts, images, charts, fonts, and templates. Actively maintained with 2M+ weekly npm downloads.
  • Alternative considered: node-pptx — less maintained, fewer features, no chart support.

Testing Strategy

  • Unit tests: Verify slide creation with various layouts, font rendering, image embedding, and chart generation using pptxgenjs API mocks.
  • Integration test: Generate a .pptx file, verify it opens correctly (checksum validation against known-good output).
  • Edge cases: Empty content, very long text (truncation/overflow), unsupported image formats, missing font fallback.
  • No real file needed in CI: Generate to a temp directory and validate structure (zip archive with expected XML parts).

Security Considerations

  • File output path must be validated against the allowed write directory (per AGENTS.md 1.2).
  • Image files must pass MIME whitelist validation before embedding (no executable payloads disguised as images).
  • Template files loaded from disk must be validated as valid PPTX (zip structure check) before use.

Implementation Notes

  • Mirror the existing read tool structure: src/tools/fileCreate/pptx.js (or extend pptx.js if the read/write split is acceptable).
  • Zod schema should accept a structured object: { title, slides: [{ layout, title, content, images, charts }] }.
  • Font handling: use built-in fonts (Arial, Calibri, Helvetica) by default; allow custom font file upload for advanced use.
  • Chart support: start with basic bar/line/pie charts; complex charts can be deferred to a follow-up PR.
  • Template support: accept a path to an existing .pptx file and clone its master slides as the base for new content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions