Surface withdrawn reports in headless CLI output and refresh TUI on delete

This commit is contained in:
Alex Schapiro 2026-09-22 19:23:40 +00:00
parent dcdaafae7f
commit 1ac6fe740c
2 changed files with 25 additions and 0 deletions

View file

@ -122,10 +122,32 @@ async def run_cli(args: Any) -> None: # noqa: PLR0915
console.print(vuln_panel)
console.print()
def display_vulnerability_deleted(report: dict[str, Any]) -> None:
report_id = str(report.get("id", "unknown"))
deletion = report.get("deletion")
deletion = deletion if isinstance(deletion, dict) else {}
deleted_by = deletion.get("agent_name") or deletion.get("agent_id") or "agent"
text = Text()
text.append("Withdrawn: ", style="bold")
text.append(f"{report.get('title', '')}\n\n")
text.append(f"Deleted by {deleted_by}. ", style="dim")
text.append(str(deletion.get("reason") or ""))
console.print(
Panel(
text,
title=f"[bold yellow]{report_id.upper()} (withdrawn)",
title_align="left",
border_style="yellow",
padding=(1, 2),
)
)
console.print()
report_state.vulnerability_found_callback = display_vulnerability
report_state.vulnerability_updated_callback = lambda report: display_vulnerability(
report, updated=True
)
report_state.vulnerability_deleted_callback = display_vulnerability_deleted
def cleanup_on_exit() -> None:
report_state.cleanup()

View file

@ -114,6 +114,9 @@ class GoTuiRuntime:
self.report_state.vulnerability_updated_callback = lambda _report: (
self.controller.notify_changed()
)
self.report_state.vulnerability_deleted_callback = lambda _report: (
self.controller.notify_changed()
)
self.controller.notify_changed()
async def check_setup_model(self) -> None: