Skip to content

CLI

compile-pdf is a Click-based console-script. The same code path the HTTP API uses runs in-process when COMPILE_API_BASE is unset, so local-mode output is byte-identical to the deployed surface.

  • Local mode (default). No COMPILE_API_BASE env var set; the CLI invokes producer engines in-process.
  • HTTP mode. Set COMPILE_API_BASE=https://compile.example.com and the CLI POSTs to the configured central or sidecar URL.
Terminal window
compile-pdf rewrite --plan plan.json input.pdf output.pdf

Apply the 15 rewrite mutations described in docs/rewrite.md. Plan documents validate against the rewrite-plan schema (compile-pdf schema rewrite).

Terminal window
compile-pdf marks --template tmpl.json input.pdf output.pdf

Stamp register / crop / color-bar / fold / proofing marks. Templates support both programmatic (JSON-declared) and external (PDF / PNG / SVG) ingestion.

Terminal window
compile-pdf impose --layout layout.json input.pdf output.pdf

Sheet-level step-and-repeat. Layout documents drive codex_pdf.geom.tile_grid directly — no Compile-side layout math.

Terminal window
compile-pdf trap --policy policy.json input.pdf output.pdf

Ink-pair spread / choke. Engine selected via COMPILE_TRAP_ENGINE env (pure_python | ghostscript | external).

Prints package version, every producer schema version, the codex-document schema version Compile is pinned to, the CJD schema version, plus the Codex section versions Compile was built against:

Terminal window
$ compile-pdf version
{
"compile_version": "0.5.1",
"producer_schema_versions": { "rewrite": "1.0.0", },
"compile_document_schema_version": "1.0.0",
"cjd_schema_version": "1.0.0",
"codex_section_versions": { "color": "1.1.0", "geom": "1.1.0", },
"codex_pdf_package_version": "1.15.0"
}

Mirrors GET /v1/contract. Use it as a single source of truth for what the local Compile install can do.

Mirrors GET /v1/healthz (instance_id, queue_depth, version_skew, ghostscript availability, …). Pair with --api-base (planned) to probe a remote instance.

compile-pdf schema {rewrite|marks|impose|trap|cjd}

Section titled “compile-pdf schema {rewrite|marks|impose|trap|cjd}”

Dumps the JSON Schema document for the named producer (or for the CJD envelope). Schemas live under compile_pdf.schemas.v1.*.

Submits a Compile Job Definition — a multi-producer envelope that chains rewrite → marks → impose → trap in one call. JSON and XML (JDF / PJTF style) bodies are both accepted.

Reads a lineage record from the configured backend (memory / Redis / S3). --chain walks every producer step that contributed to the final artifact, including the retained_for_training flag per step.

  • 0 — success
  • 2 — invalid arguments
  • 3 — schema validation failed
  • 4 — engine failed (look at stderr / lineage)
  • 5 — health / contract probe failed (used by health, contract)