From ca368e64d3e6772548f6e45ef1a0d37709b2f90e Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Tue, 3 Feb 2026 06:56:40 +0000 Subject: [PATCH] Add CLI commands and output renderer --- vibeguard/cli/commands/report.py | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 vibeguard/cli/commands/report.py diff --git a/vibeguard/cli/commands/report.py b/vibeguard/cli/commands/report.py new file mode 100644 index 0000000..4623726 --- /dev/null +++ b/vibeguard/cli/commands/report.py @@ -0,0 +1,44 @@ +"""Report command for VibeGuard CLI.""" + +from pathlib import Path +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.""" + config = ctx["config"] + 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: + import 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]")