CLI Reference Build, watch, and manage Polyester documents

The poly command compiles .poly files to HTML, PDF, and SVG. Supports multi-file builds, theming, and file watching.

Installation

npm install -g polyester

This gives you the poly command. You can also run it directly from a local install:

node dist/cli/index.js build document.poly

Commands

Command
Description
poly buildCompile .poly files to HTML, PDF, or SVG
poly watchWatch a file and recompile on changes
poly helpList all components or show help for one
poly theme importImport a colorscheme as a syntax theme
poly theme listList available themes
poly style listList available style modules
poly spacing listList available spacing presets

poly build

poly build <input.poly...> [-o output] [--format html|pdf|svg] [--theme name]

Compiles one or more .poly files. With a single file, you can specify an output path with -o. With multiple files, each produces an output file with the same name and a new extension.

Single file

poly build report.poly
poly build report.poly -o out.html
poly build report.poly --format pdf -o report.pdf

Output defaults to report.html (or .pdf/.svg based on --format).

Multiple files

poly build docs/*.poly
poly build a.poly b.poly c.poly
poly build docs/badges/*.poly --padding 0

Shell glob expansion handles wildcards. The -o flag is not allowed with multiple inputs.

Build Options

Flag
Description
-o, --output <file>Output file path (single input only)
-f, --format <fmt>Output format: html (default), pdf, svg
-t, --theme <name>Composed theme (style + spacing + syntax)
--style <name>Style module (colors, fonts, borders, shadows)
--spacing <name>Spacing module: compact, default, spacious
--width <px>SVG viewport width (default 800)
--padding <px>SVG padding
--background <color>SVG background color (use none for transparent)

Flags apply to all files in a multi-file build. This is useful for batch operations like building badges with shared settings.

Output Formats

HTML

Default format. Produces a standalone HTML file with embedded CSS, syntax highlighting, and all styles inlined.

poly build doc.poly

PDF

Renders HTML through Chrome via Puppeteer. Supports /page settings for paper size, margins, and pageless mode.

poly build doc.poly --format pdf
🚀

SVG

Renders content as an SVG image. Useful for README badges, social cards, and embeddable graphics.

poly build doc.poly --format svg

Theming

Three composable modules control the look of your documents.

# Use a composed theme
poly build doc.poly --theme gruvbox

# Mix individual modules
poly build doc.poly --style corporate --spacing compact

# Import a terminal colorscheme
poly theme import ~/.Xresources --name my-theme
poly build doc.poly --theme my-theme
Style

Colors, fonts, borders, and shadows. Sets the visual identity of the document.

Spacing

Margins, padding, and gaps. Controls density — compact, default, or spacious.

Syntax

Code block colors. Imported from terminal colorschemes or built-in presets.

poly watch

poly watch <input.poly> [--format html|pdf]

Watches a single file for changes and recompiles automatically. Useful during development alongside a browser with live reload.

poly watch document.poly
poly watch slides.poly --format pdf

poly help

poly help              # List all 27 components
poly help columns      # Show detailed help for /columns
poly help --json       # Output as JSON (for tooling)

Displays component documentation including arguments, flags, descriptions, and examples. The --json flag outputs structured data for editor extensions and the MCP server.

Theme Import

Import colorschemes from terminal emulators and other tools.

poly theme import <file> --name <name> [--format <format>]
Format
Source
xresources~/.Xresources files
pywalpywal color files
base16Base16 YAML schemes
kittyKitty terminal config
alacrittyAlacritty TOML/YAML config

The format is auto-detected from the file when possible. Use --format to override.

Polyester CLI