package presenter import ( "fmt" "io" "text/tabwriter" "gitea.oblak.solutions/dimitar/gitFlow/internal/ai" ) // Suggestions renders AI suggestions below a scan result, color-coded by // priority. func Suggestions(w io.Writer, opts Options, suggestions []ai.Suggestion) error { if len(suggestions) == 0 { fmt.Fprintln(w, "\nAI: no suggestions — all repositories are healthy.") return nil } r := newRendererTheme(opts.Color, opts.Theme, w) fmt.Fprintln(w, "\nAI SUGGESTIONS") tw := tabwriter.NewWriter(w, 2, 4, 2, ' ', 0) fmt.Fprintln(tw, "REPOSITORY\tACTION\tPRIORITY\tMESSAGE\tCOMMAND") for _, s := range suggestions { prio := priorityLabel(s.Priority) switch s.Priority { case 2: prio = r.red + prio + r.reset case 1: prio = r.yellow + prio + r.reset case 0: prio = r.green + prio + r.reset } fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%s\n", shortPath(s.RepoPath), s.Action, prio, s.Message, s.Command) } return tw.Flush() } func priorityLabel(p int) string { switch { case p >= 2: return "high" case p == 1: return "medium" default: return "low" } }