report

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

DOCX report renderer. Consultancies live in Word, so the report ships as a real OOXML.docx – hand-built (no third-party DOCX dependency, matching the "light pure-Go" preference) so we fully control the bytes.

Determinism (reproducible-report / chain-of-custody): the document content is a pure function of ports.ReportDocument, every ZIP entry uses a FIXED modification time, and the parts are written in a FIXED order – so identical engagement data yields byte-identical output and a reproducible SHA-256 seal. All dynamic text is XML-escaped (operator-authored finding text is untrusted).

HTML report renderer. It turns the format-agnostic ports.ReportDocument into a standalone, self-contained HTML document via html/template (auto-escaping closes the injection surface – finding titles/descriptions are untrusted operator text). Output is deterministic: html/template emits identical bytes for identical input, so the SHA-256 seal is reproducible (chain-of-custody).

Package report renders engagement PDF reports with maroto v2. The output is deterministic – the PDF creation-date metadata is pinned to the caller-supplied generatedAt and the content is a pure function of the stored engagement + findings (no LLM in the report path).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DOCXRenderer

type DOCXRenderer struct{}

DOCXRenderer implements ports.DocRenderer for Word (.docx) output.

func NewDOCXRenderer

func NewDOCXRenderer() *DOCXRenderer

NewDOCXRenderer returns a Word report renderer.

func (DOCXRenderer) Render

Render builds a minimal but valid OOXML.docx package for the document, embedding any image exhibits as inline pictures.

type HTMLRenderer

type HTMLRenderer struct {
	// contains filtered or unexported fields
}

HTMLRenderer implements ports.DocRenderer for HTML output.

func NewHTMLRenderer

func NewHTMLRenderer() *HTMLRenderer

NewHTMLRenderer compiles the report template once. It panics only on a programmer error (a malformed constant template), never on input.

func (*HTMLRenderer) Render

func (h *HTMLRenderer) Render(_ context.Context, doc ports.ReportDocument) ([]byte, error)

Render writes the document as a self-contained HTML page.

type Renderer

type Renderer struct{}

Renderer implements ports.ReportRenderer using maroto v2.

func NewRenderer

func NewRenderer() *Renderer

NewRenderer returns a PDF report renderer.

func (Renderer) Render

func (Renderer) Render(_ context.Context, eng *engagement.Engagement, findings []finding.Finding, insight ports.ReportInsight, generatedAt time.Time, version string) ([]byte, error)

Render builds the engagement report PDF. It never calls an LLM or external service – the document is derived solely from eng + findings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL