# /// script # requires-python = ">=3.9" # /// #!/usr/bin/env python3 """ Generate an interactive HTML quality analysis report for a BMad agent. Reads report-data.json produced by the report creator and renders a self-contained HTML report with: - BMad Method branding - Agent portrait (icon, name, title, personality description) - Capability dashboard with expandable per-capability findings - Opportunity themes with "Fix This Theme" prompt generation - Expandable strengths and detailed analysis Usage: python3 generate-html-report.py {quality-report-dir} [--open] """ from __future__ import annotations import argparse import json import platform import subprocess import sys from pathlib import Path def load_report_data(report_dir: Path) -> dict: """Load report-data.json from the report directory.""" data_file = report_dir / 'report-data.json' if not data_file.exists(): print(f'Error: {data_file} not found', file=sys.stderr) sys.exit(2) return json.loads(data_file.read_text(encoding='utf-8')) HTML_TEMPLATE = r"""