Generated from
folio-assistant-sci/skills/content/folio-paper-adapter/build-pdf.md— do not edit here.
/build-pdf
Builds the PDF locally to save CI minutes: the monolithic main.pdf and
the split per-chapter PDFs.
Resolve the paper and the folio-assistant path first
Content-agnostic — take these as inputs rather than assuming a layout:
# The folio's papers (each has <paper>/<paper>.ts)
ls content/*/[!.]*.ts | xargs -n1 dirname | sort -u
PAPER— the paper directory undercontent/. Never hardcode one; if the folio has several, ask which to build.FA— path to the folio-assistant checkout. It is a sibling (../folio-assistant) in the common layout, but do not assume: resolve it and fail loudly if it is missing, rather than emitting a path that silently does not exist.BUILDER_IMAGE— the folio’s LaTeX builder image, from the folio’s own CI config. There is no platform default; a folio that has not published one must installlatexmknatively.
Behavior
Generate
main.texand the per-chapter.texfiles:bun run --preload ../scripts/preload-registry.ts "$FA/cat-harness-tools/pipeline/build.ts" \ "content/$PAPER/$PAPER.ts" \ --out-dir chapters/ \ --generate-main \ --main-out main.tex \ --preamble "$FA/latex/preamble.tex"Compile with
latexmk, falling back to the folio’s builder image whenlatexmkis not available natively:latexmk -pdf main.tex \ || docker run --rm --entrypoint "" -v "$(pwd)":/work -w /work \ "$BUILDER_IMAGE" latexmk -pdf main.texIf neither is available, say so — do not report a PDF that was not built.
Split into per-chapter PDFs:
mkdir -p chapters-pdf/ python3 "$FA/scripts/split-pdf-by-chapter.py" \ --input main.pdf \ --output-dir chapters-pdf/Report the output paths (
main.pdf,chapters-pdf/).
Related
docs-generation covers the builder-image fallback in more detail;
latex-preflight and latex-validation catch source problems before a
compile is attempted.