feat(tui): list the run's targets in the sidebar stats panel

This commit is contained in:
Ian 2026-10-09 14:24:14 -04:00
parent 62b496430d
commit 0265487b48
3 changed files with 23 additions and 3 deletions

View file

@ -355,3 +355,17 @@ func TestLonePanelHasNoControls(t *testing.T) {
t.Fatalf("controls should return once a second panel exists")
}
}
func TestStatsPanelListsTargets(t *testing.T) {
m := panelsModel(t)
m.snapshot.Targets = []string{"https://example.com", "./app"}
m.snapshot.TargetCount = 2
m.resizeViewport()
_, sidebarWidth, _, _ := m.layout()
view := ansi.Strip(m.sidebarView(sidebarWidth, m.height))
for _, want := range []string{"Targets 2", "▸ https://example.com", "▸ ./app"} {
if !strings.Contains(view, want) {
t.Fatalf("sidebar missing %q:\n%s", want, view)
}
}
}

View file

@ -421,7 +421,7 @@ func (m Model) setupComposer(width int) string {
inner := max(1, width-4)
body := m.highlightInputSelection(m.input.View())
body += "\n\n" + m.setupSummaryView(inner)
if targets := m.setupTargetsView(inner); targets != "" {
if targets := m.targetsView(inner); targets != "" {
body += "\n" + targets
}
return lipgloss.NewStyle().Width(max(1, width-2)).Padding(0, 1).
@ -454,8 +454,8 @@ func (m Model) setupSummaryView(width int) string {
return truncate(strings.Join(chips, render.Dim().Render(" · ")), max(1, width))
}
// setupTargetsView lists what the scan is pointed at, once anything is queued.
func (m Model) setupTargetsView(width int) string {
// targetsView lists what the scan is pointed at, once anything is queued.
func (m Model) targetsView(width int) string {
if len(m.snapshot.Targets) == 0 {
return ""
}

View file

@ -694,6 +694,12 @@ func (m Model) statsView() string {
b.WriteString(w.Render(fmt.Sprintf(" · $%.2f", cost)))
}
}
if targets := m.targetsView(m.sidebarInnerWidth()); targets != "" {
if b.Len() > 0 {
b.WriteString("\n")
}
b.WriteString(targets)
}
if caido := m.snapshot.CaidoURL; caido != "" {
if b.Len() > 0 {
b.WriteString("\n")