Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SpectraBuild

Standalone Spectra build orchestration, written in Prism.

The executable treats prism and typst as explicit external tools. Deck construction and Typst lowering remain pure package code; this module is the narrow host shell that captures the framed envelope and writes artifacts. The pipeline a spectra build runs, end to end:

prism docs <project> --test     doctest outputs pinned before anything renders
prism run <project>             the deck program prints its framed envelope
(pure lowering)                 the envelope's deck value becomes Typst source
typst compile                   Typst renders the PDF
target/spectra/                 deck.typ and deck.pdf installed atomically

check_project verifies the tools and the deck without writing artifacts; clean_project removes only target/spectra.

Types

DeckEnvelope

type DeckEnvelope = DeckEnvelope {
  source: String,
  logical_slides: Int,
  physical_pages: Int,
  title: String
} deriving (Eq, Show)

The framed value a deck program prints: the Typst source, the logical slide and physical page counts, and the deck title.

Functions and Values

shell_quote

shell_quote : (String) -> String

Quote one opaque argument for the POSIX shell used by system.

parse_envelope

parse_envelope : (String) -> Result((DeckEnvelope, String), String)

Take the framed envelope out of a deck program’s standard output, returning it beside the JSON it was carried in.

check_project

check_project : (String) -> Int ! {IO, Output}

Verify the external tools and the deck without writing any artifact, returning the status to exit with.

build_project

build_project : (String, String, Bool) -> Int ! {FileSystem, IO, Output}

Run the whole pipeline, installing the Typst source and PDF under target/spectra, and return the status to exit with.

clean_project

clean_project : (String) -> Int ! {IO}

Remove a project’s target/spectra and nothing else, returning the status to exit with.