Skip to content

WeasyPrint report generation: vajra report command #11

Description

@zuub-don

Problem

The culmination of any vajra analysis session is a report. Currently this requires building an HTML template externally, running multiple vajra commands to collect data, and rendering with WeasyPrint. The report generation pipeline is ~500 lines of Python.

Evidence

The Effect-TS deep analysis report required:

  1. 50+ vajra command invocations
  2. A 500-line Python script to build HTML
  3. Manual CSS design for tables, bars, callouts
  4. WeasyPrint rendering
  5. Iterative layout fixes for page breaks

Proposal

New command: vajra report

vajra report data.json --title "Effect-TS Deep Analysis" \
    --sections "inspect,stats,anomalies,drift,essence" \
    --format pdf \
    --output report.pdf

Architecture:

  1. Data collection: Run specified analysis commands internally
  2. Template engine: Built-in HTML/CSS templates (the design system from our report)
  3. PDF rendering: Either bundle WeasyPrint via PyO3, or output HTML for external rendering
  4. Customization: --template custom.html for user templates, --logo logo.svg

Built-in sections:

  • Executive summary (auto-generated from scorecard)
  • Statistical overview (from stats)
  • Anomaly report (from anomalies)
  • Drift analysis (from drift if two inputs)
  • Methodology (auto-generated — algorithms used, data sources)

Design Principle Alignment

  • Composable: Uses existing commands internally — report is a compositor, not a new analysis.
  • Deterministic: Same data → same report. PDF byte-identical with same template.
  • Fast: Runs all analysis once, templates are static, no external API calls.

Complexity

High. New crate (vajra-report), HTML/CSS template system, PDF dependency management. Could be a separate binary or feature-gated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions