Files
mopac-pmo/archive/TASK-20260829-1300-pdf.md

49 lines
2.4 KiB
Markdown

# TASK: mopac-pdf v0 — beautiful PDF generation pipeline (Redmine 499)
## Context
Spec docs/SPEC-20260829-charles-brief.md "Workflows": beautifully
formatted PDFs of budgets, travel itineraries, project plans, proposals,
consulting reports, multi-year financial plans, business plans,
engineering docs — with charts/diagrams. This feeds the COS briefing
world (reports) and TSYS client deliverables.
## Constraints
- OUR code: Go only (no python/node/rust — prebuilt engine BINARIES in
digest-pinned docker images are tooling, fine).
- ALL DEV IN DOCKER. AGPLv3. Docs standard.
## Scope
1. New repo `ukrrs/mopac-pdf` (create via Gitea API if absent — PMO
pattern, tea token; clone to ~/projects/meta/MOPAC/pdf). LICENSE
AGPLv3 first commit.
2. Engine decision (document rationale in REPORT): typst (docker image,
typst compile) vs pandoc+latex — evaluate compile speed, chart/table
quality, template ergonomics. Typst expected to win on modern output.
3. Go package + CLI `mopac-pdf`:
- Input: markdown (the composable currency of this whole stack —
Redmine notes, Discourse posts, briefing output) + front-matter
(title, subtitle, date, classification footer, template name).
- Templates dir: 2 shipped v0 — "report" (clean business report:
title page, TOC, headers/footers, page numbers) and "brief"
(1-3 page exec summary, dense tables).
- Charts: pure-Go rendering option (go-chart or similar permissive
lib) embedded as images from fenced code blocks with data blocks;
keep v0 minimal — one chart type proven end-to-end.
- Output: PDF bytes to stdout or -o file; exit codes like harness
(0/1/2 usage/engine).
4. Docker runner: `mopac-pdf` shells the engine container (digest-
pinned); host stays toolchain-free. Makefile/dev.sh per family
pattern.
5. Tests: template rendering golden tests (fixture .md -> PDF, assert
non-empty + page count via a tiny Go PDF header parse or engine
stdout), CLI flags, front-matter parsing. NEVER broad pkill.
## Deliverable
Commits pushed to ukrrs/mopac-pdf main.
`REPORT-20260829-1300-pdf.md` in `~/.coordinate/inbox-pmo/`: engine
decision + rationale, sample outputs listed (paths), how the briefing
pipeline will call it, what's Next (chart types, more templates).
> CLARIFIED (Charles): supply chain MAY include prebuilt Rust tools (typst
> etc.) in digest-pinned images. OUR code: Go/PHP/C/Java only.