feat(audit): expand TUI filter to search risk, status, severity, patterns, and files

Previously the audit TUI "/" filter only matched skill names. Now it
also searches risk label, status (blocked/warning/clean), max severity,
finding pattern names, and finding file names — making it easy to narrow
down results like `/critical`, `/exec-command`, or `/blocked`.
This commit is contained in:
Willie
2026-03-02 23:01:30 +08:00
parent 2fe90526f9
commit 28dacd19b8
+25 -1
View File
@@ -51,7 +51,31 @@ func (i auditItem) Title() string {
}
func (i auditItem) Description() string { return "" }
func (i auditItem) FilterValue() string { return i.result.SkillName }
func (i auditItem) FilterValue() string {
// Searchable: skill name, risk label, status, max severity, finding patterns, finding files.
r := i.result
status := "clean"
if r.IsBlocked {
status = "blocked"
} else if len(r.Findings) > 0 {
status = "warning"
}
parts := []string{r.SkillName, r.RiskLabel, status, r.MaxSeverity()}
seen := map[string]bool{}
for _, f := range r.Findings {
if !seen[f.Pattern] {
parts = append(parts, f.Pattern)
seen[f.Pattern] = true
}
if !seen[f.File] {
parts = append(parts, f.File)
seen[f.File] = true
}
}
return strings.Join(parts, " ")
}
// auditTUIModel is the bubbletea model for interactive audit results.
type auditTUIModel struct {