@hirokisakabe/pom-cli
v0.10.0
Published
CLI tool for pom — preview, build, and render presentations
Readme
Features
- Browser Editor + Live Preview —
pom previewopens the sharedPomEditor, with XML / AST editing, unsaved previews, and explicit conflict-safe saves for.pom.xmlfiles. - PPTX Build —
pom buildconverts.pom.xml/.pom.mdto a.pptxfile, with optional--watchmode for incremental rebuilds. - PNG / SVG Render —
pom renderrasterizes each slide to PNG (default) or SVG without LibreOffice, useful for slide-image previews in docs. - Theme Extraction —
pom theme extractreads an existing.pptxand prints its theme colors as pomThemeTokensJSON, for onboarding brand assets. - Diagnostic Surfacing — Layout, image, master, and auto-fit diagnostics from
buildPptxfail the run on stderr with a non-zero exit (pom build/pom render), whilepom previewkeeps updating so issues can be fixed interactively. - Bundled Fonts — Carlito and Noto Sans CJK JP are bundled for SVG / PNG rendering, so output looks the same on machines without those fonts installed.
- Configurable Output — Choose port, target slides, output format, text rendering mode (
pathoutlines vs native<text>), and verbose per-step timing.
Installation
Requires Node.js 22+
npm install -g @hirokisakabe/pom-cliQuick Start
One command is all it takes — no global install required:
npx @hirokisakabe/pom-cli preview slides.pom.xmlThis starts a local editor and preview server and opens your browser automatically. The editor client is bundled with pom-cli, so it does not need a CDN or an internet connection. This also works well when invoked from agent skills or scripts.
Usage
Preview
Starts the browser editor and live preview server.
pom preview slides.pom.xml
pom preview slides.pom.mdThe browser opens http://localhost:3000 automatically. For .pom.xml files, XML and AST edits are kept in the browser and immediately reflected in the preview. Use Download to generate a PPTX from the current browser contents, or choose PNG / SVG and the current / all slides before selecting Export Images. All-slide image exports are downloaded as a ZIP. These exports include unsaved edits and are also available for .pom.md inputs. Progress, success, and build diagnostics are shown in the editor.
Use Save to write the current XML back to a .pom.xml input file. If another editor changed the file after it was loaded, Save is rejected instead of overwriting that change. Successful saves replace the file atomically.
External file changes continue to update the browser when there are no unsaved browser edits. When unsaved edits exist, they are preserved and the toolbar reports the external change. .pom.md input remains preview-only because writing generated XML back to Markdown is outside the editor's scope.
To suppress the automatic browser open (e.g. in CI or headless environments):
pom preview slides.pom.xml --no-openTo use a different port (e.g. when 3000 is already in use):
pom preview slides.pom.xml --port 3001To print per-step timing on stderr when each rebuild completes:
pom preview slides.pom.xml --verboseBuild
Converts a pom file to a PPTX file.
pom build slides.pom.xml -o output.pptx
pom build slides.pom.md -o output.pptxTo watch for file changes and rebuild automatically:
pom build slides.pom.xml -o output.pptx --watchThe process stays running and rebuilds every time the input file is saved. Build progress is printed to stderr:
[pom] Watching: slides.pom.xml
[pom] Built: output.pptx (367ms)
[pom] File changed, rebuilding...
[pom] Built: output.pptx (342ms)If a build fails, the error is printed but the process continues watching for the next change. Press Ctrl+C to stop.
To print per-step timing on stderr:
pom build slides.pom.xml -o output.pptx --verboseRender
Renders each slide to a PNG (default) or SVG image — no LibreOffice or other external tools required.
pom render slides.pom.xml -o ./images
pom render slides.pom.md -o ./imagesThe images are written to the output directory as slide-01.png, slide-02.png, ... The directory is created if it does not exist. The rendering pipeline is the same as the preview server, so the images match what you see in pom preview.
LibreOffice fallback caveat: Current
pom renderusespptx-glimpsedirectly and does not require LibreOffice. If you are using an olderpom-cli/pptx-glimpseversion or a fallback workflow that converts PPTX through LibreOffice before PNG output, pure numeric text with leading zeros (for example01/001) may be displayed without those zeros in the PNG (01->1). The generated PPTX keeps the original text (<a:t>01</a:t>), so it displays as intended when opened in PowerPoint. For decorative numbering that must survive both paths, mix in one non-numeric character such as01.or#01.
To output SVG instead of PNG:
pom render slides.pom.xml -o ./images --format svgBy default, SVG output converts text to <path> outlines so it renders identically in any environment. Pass --text-output text to emit native <text> elements with subsetted fonts embedded as @font-face data URIs instead — text becomes selectable and renders with browser font hinting, but may not display correctly when the SVG is referenced via <img src="..."> or sanitized:
pom render slides.pom.xml -o ./images --format svg --text-output textTo render only specific slides (1-based, comma-separated) — useful when re-checking just the slides you edited:
pom render slides.pom.xml -o ./images --slides 2,5To print per-step timing on stderr:
pom render slides.pom.xml -o ./images --verboseTheme Extract
Extracts PowerPoint theme colors from an existing .pptx as pom ThemeTokens JSON — useful for onboarding brand assets (e.g. the pom-theme agent skill).
pom theme extract brand-master.pptxPrints a JSON array to stdout with one entry per visible slide layout (text / background / primary / secondary / accent3–accent6, all 6-digit uppercase hex prefixed with #), preserving the source master/layout order.
Diagnostics
pom build and pom render invoke buildPptx with strict: true, so any diagnostic collected during the build — layout problems (NODE_OUT_OF_BOUNDS, NODE_OVERLAP, ARROW_REF_NOT_FOUND), image / master issues (IMAGE_MEASURE_FAILED, IMAGE_NOT_PREFETCHED, MASTER_PPTX_PARSE_FAILED), or AUTOFIT_OVERFLOW — fails the run with a non-zero exit code and prints the diagnostic codes / messages to stderr. Fix the offending XML or input and re-run to proceed. The pom preview server continues to update even when diagnostics are emitted, so you can iterate on the file interactively.
Fonts
This package bundles Carlito and Noto Sans CJK JP fonts for image rendering. These fonts are used when converting slides to SVG in the preview server and to PNG / SVG in pom render. System fonts are not scanned.
License
MIT
