pages-cli
Claude Code plugin for full programmatic control over Apple Pages. Create, edit, format, and export Pages documents using slash commands, CLI, or natural language.
Covers 100% of the Pages AppleScript API — every command, class, property, and enum from the Pages scripting definition (sdef).
Features
- Documents — create (100+ templates incl. custom), open, close, save, password protect
- Text — add, replace, style per paragraph/word/character (font, size, color, bold, italic)
- Tables — create, fill, formulas, cell formatting, range styling (alignment, colors, wrap), merge/unmerge/sort/clear, row height, column width, header/footer rows & columns
- Media — images (with alt text), shapes (with text), text boxes, audio clips, movies, lines, groups — rotation, opacity, reflection, lock, position, size
- Export — PDF, Word, EPUB, plain text, RTF, Pages 09 — with password, image quality, comments, annotations, full EPUB metadata
- Templates — list all (incl. custom), create from template, placeholder filling
- Sections & Pages — multi-section/page body text access
- Session — state tracking, history, REPL with prompt_toolkit
- JSON output —
--json flag on all commands for agent integration
Requirements
- macOS with Apple Pages (pre-installed or App Store)
- Python 3.10+
- Claude Code CLI (for plugin usage)
Installation
Via Claude Code
claude plugins marketplace add marcelrgberger/pages-cli
claude plugins install pages-cli
The CLI backend installs automatically on first /pages use.
Manual
git clone https://github.com/marcelrgberger/pages-cli.git
cd pages-cli/agent-harness
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
Quick Start
/pages new Professional Report Create from template
/pages open ~/doc.pages Open existing document
/pages export pdf ~/Desktop/out.pdf Export as PDF
/pages templates Browse 100+ templates
After opening a document, use natural language:
User: Write a title "Q1 Report" in 24pt bold, then add 3 paragraphs about revenue
User: Add a 5x3 table with headers Name, Amount, Date
User: Set the header row background to blue
User: Export as PDF and Word to the Desktop
Command Reference
Document
| Command | Description |
|---|
document new [--template T] [--name N] | Create document |
document open <path> | Open .pages file |
document close [--no-save] | Close document |
document save [--path P] | Save document |
document info | Name, pages, words, characters |
document list | List open documents |
document set-password <pw> [--hint H] | Password protect |
document remove-password <pw> | Remove password |
document placeholders | List template placeholders |
document set-placeholder <idx> <tag> | Set placeholder tag |
document get-placeholder <idx> | Get placeholder tag |
document sections | Section count |
document section-text <idx> | Get section body text |
document page-text <idx> | Get page body text |
document delete <type> <idx> | Delete object on page |
Text
| Command | Description |
|---|
text add <text> | Append text |
text add-paragraph <text> [styling opts] | Add styled paragraph |
text set <text> | Replace all body text |
text get | Get body text |
text set-font [--name F] [--size S] [--paragraph/--word/--char N] | Set font |
text get-font [--paragraph/--word/--char N] | Get font name |
text get-font-size [--paragraph/--word/--char N] | Get font size |
text set-color --r R --g G --b B [--paragraph/--word/--char N] | Set color (0-65535) |
text get-color [--paragraph/--word/--char N] | Get color |
text bold [--paragraph/--word N] | Set bold |
text italic [--paragraph/--word N] | Set italic |
text bold-italic [--paragraph/--word N] | Set bold+italic |
text style-paragraph <idx> [all styling opts] | Style paragraph |
text style-word <idx> [all styling opts] | Style word |
text style-character <idx> [all styling opts] | Style character |
text word-count | Words, characters, paragraphs |