41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
"""Report command for VibeGuard CLI."""
|
|
|
|
from typing import Any
|
|
|
|
import click
|
|
|
|
from vibeguard.reports.generator import ReportGenerator
|
|
|
|
|
|
@click.command(name="report")
|
|
@click.argument("input_file", type=click.Path(exists=True))
|
|
@click.option("--json", "output_json", is_flag=True, help="Convert to JSON")
|
|
@click.option("--html", "output_html", type=click.Path(), help="Output HTML report to file")
|
|
@click.option("--sarif", "output_sarif", type=click.Path(), help="Output SARIF report to file")
|
|
@click.pass_obj
|
|
def report(
|
|
ctx: dict[str, Any],
|
|
input_file: str,
|
|
output_json: bool,
|
|
output_html: str | None,
|
|
output_sarif: str | None,
|
|
) -> None:
|
|
"""Generate reports from VibeGuard analysis results."""
|
|
console = ctx["console"]
|
|
|
|
generator = ReportGenerator()
|
|
issues = generator.load_json(input_file)
|
|
|
|
if not issues:
|
|
console.print("[warning]No issues found in input file[/warning]")
|
|
return
|
|
|
|
if output_json:
|
|
console.print_json(data=issues)
|
|
elif output_html:
|
|
generator.generate_html(issues, output_html)
|
|
console.print(f"[success]HTML report saved to: {output_html}[/success]")
|
|
elif output_sarif:
|
|
generator.generate_sarif(issues, output_sarif)
|
|
console.print(f"[success]SARIF report saved to: {output_sarif}[/success]")
|