#!/usr/bin/env python3 """ Generate comprehensive launch readiness report Combines all verification checks into a single PDF/HTML report """ import asyncio import json import subprocess import sys from datetime import datetime from pathlib import Path from typing import Dict, List, Any try: from jinja2 import Template import markdown except ImportError: print("Installing required packages...") subprocess.run([sys.executable, "-m", "pip", "install", "jinja2", "markdown"], check=True) from jinja2 import Template import markdown HTML_TEMPLATE = """ AudioForge Launch Report - {{ timestamp }}

šŸŽµ AudioForge Launch Report

Production Readiness Verification
Generated: {{ timestamp }}

Executive Summary

{{ overall_success_rate }}% Ready
Passed
{{ total_passed }}
Failed
{{ total_failed }}
Warnings
{{ total_warned }}
Total Checks
{{ total_checks }}
{% if overall_success_rate == 100 %}

šŸŽ‰ READY TO LAUNCH!

All systems are go. You're cleared for production deployment.

{% elif overall_success_rate >= 90 %}

āš ļø ALMOST READY

Minor issues to address before launch.

{% else %}

āŒ NOT READY

Critical issues must be resolved before launch.

{% endif %}
{% for section_name, section_data in sections.items() %}

{{ section_name }}

{% if section_data.success_rate == 100 %} āœ… {{ section_data.passed }}/{{ section_data.total }} {% elif section_data.failed > 0 %} āŒ {{ section_data.failed }} Failed {% else %} āš ļø {{ section_data.warned }} Warnings {% endif %}
{% for check in section_data.checks %} {% endfor %}
Status Check Message
{{ check.status_icon }} {{ check.name }} {{ check.message }} {% if check.details %}
{{ check.details }}
{% endif %} {% if check.fix_command %}
Fix: {{ check.fix_command }}
{% endif %}
{% endfor %} {% if action_items %}

⚔ Action Items

    {% for item in action_items %}
  • {{ item }}
  • {% endfor %}
{% endif %}
""" async def generate_report(): """Generate comprehensive launch report.""" print("šŸŽµ Generating AudioForge Launch Report...") print("=" * 60) # Run verification script print("\nšŸ“Š Running verification checks...") result = subprocess.run( [sys.executable, "scripts/launch_verification.py", "--json", "launch-results.json"], capture_output=True, text=True ) # Load results results_file = Path("launch-results.json") if not results_file.exists(): print("āŒ Verification results not found!") sys.exit(1) with open(results_file) as f: data = json.load(f) # Calculate totals total_passed = sum(section["passed"] for section in data.values()) total_failed = sum(section["failed"] for section in data.values()) total_warned = sum(section["warned"] for section in data.values()) total_checks = sum(section["total"] for section in data.values()) overall_success_rate = round((total_passed / total_checks * 100) if total_checks > 0 else 0, 1) # Collect action items action_items = [] for section_name, section_data in data.items(): for check in section_data["checks"]: if check.get("details") and ("fix" in check["details"].lower() or "missing" in check["details"].lower()): action_items.append(f"{section_name}: {check['name']} - {check['message']}") # Prepare template data template_data = { "timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"), "total_passed": total_passed, "total_failed": total_failed, "total_warned": total_warned, "total_checks": total_checks, "overall_success_rate": overall_success_rate, "sections": data, "action_items": action_items[:10], # Top 10 action items } # Add status icons status_icons = { "PASS": "āœ…", "FAIL": "āŒ", "WARN": "āš ļø", "SKIP": "ā­ļø", "INFO": "ā„¹ļø", } for section_data in template_data["sections"].values(): for check in section_data["checks"]: check["status_icon"] = status_icons.get(check["status"], "ā“") # Generate HTML report template = Template(HTML_TEMPLATE) html_content = template.render(**template_data) # Save report report_path = Path("LAUNCH_REPORT.html") report_path.write_text(html_content, encoding="utf-8") print(f"\nāœ… Report generated: {report_path.absolute()}") print(f"šŸ“Š Overall Success Rate: {overall_success_rate}%") print(f"āœ… Passed: {total_passed}") print(f"āŒ Failed: {total_failed}") print(f"āš ļø Warnings: {total_warned}") # Print status if overall_success_rate == 100: print("\nšŸŽ‰ READY TO LAUNCH!") elif overall_success_rate >= 90: print("\nāš ļø ALMOST READY - Minor issues to fix") else: print("\nāŒ NOT READY - Critical issues found") # Open report in browser (optional) try: import webbrowser webbrowser.open(f"file://{report_path.absolute()}") print(f"\n🌐 Opening report in browser...") except Exception: pass return overall_success_rate >= 90 if __name__ == "__main__": success = asyncio.run(generate_report()) sys.exit(0 if success else 1)