mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 20:34:19 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user