tui

package
v1.37.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const NumTabs = 5

NumTabs is the total number of detail tabs.

Variables

View Source
var (
	ColorCritical = lipgloss.Color("#FF0000")
	ColorHigh     = lipgloss.Color("#FF8800")
	ColorMedium   = lipgloss.Color("#FFCC00")
	ColorLow      = lipgloss.Color("#0088FF")
	ColorInfo     = lipgloss.Color("#888888")
	ColorSuccess  = lipgloss.Color("#00CC00")
	ColorError    = lipgloss.Color("#FF4444")
	ColorMalware  = lipgloss.Color("#FF00FF")
	ColorMuted    = lipgloss.Color("#666666")
	ColorAccent   = lipgloss.Color("#00CCFF")
	ColorTeal     = lipgloss.Color("#00B4B4")
	ColorWhite    = lipgloss.Color("#FFFFFF")
)

Exported color constants for use by other packages (e.g., internal/display).

Functions

func Run

func Run(client *vdb.Client, files []scan.DetectedFile, pollInterval int, outputFormat string, gitCtx *gitctx.GitContext, repoRoot string) error

Run starts the TUI program. This is the main entry point called from cmd/scan.go.

func RunTriage added in v1.21.0

func RunTriage(alerts []triage.EnrichedAlert, opts TriageOptions) error

RunTriage starts the triage TUI program.

func SeverityColor

func SeverityColor(severity string) lipgloss.Color

SeverityColor returns the color for a severity level.

func SeverityStyle

func SeverityStyle(severity string) lipgloss.Style

SeverityStyle returns the lipgloss style for a severity level.

Types

type AllPollsCompleteMsg

type AllPollsCompleteMsg struct {
	Tasks []*scan.ScanTask
}

AllPollsCompleteMsg is sent when all polls have finished.

type AllUploadsCompleteMsg

type AllUploadsCompleteMsg struct {
	Tasks []*scan.ScanTask
}

AllUploadsCompleteMsg is sent when all uploads have finished.

type DetailLoadedMsg

type DetailLoadedMsg struct {
	VulnID string
	Tab    DetailTab
	Data   map[string]interface{}
	Err    error
}

DetailLoadedMsg is sent when lazy-loaded detail data arrives.

type DetailTab

type DetailTab int

DetailTab identifies which detail tab to display.

const (
	TabScores DetailTab = iota
	TabExploits
	TabTimeline
	TabFixes
	TabRemediation
)

func (DetailTab) TabName

func (t DetailTab) TabName() string

TabName returns the display name for a detail tab.

type KeyMap

type KeyMap struct {
	Quit       key.Binding
	Up         key.Binding
	Down       key.Binding
	Enter      key.Binding
	Tab        key.Binding
	TabScores  key.Binding
	TabExploit key.Binding
	TabTime    key.Binding
	TabFixes   key.Binding
	TabRemed   key.Binding
	Output     key.Binding
	Help       key.Binding
	Escape     key.Binding
	PageUp     key.Binding
	PageDown   key.Binding
	Resolve    key.Binding
}

KeyMap defines all keybindings for the TUI.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the main bubbletea model for the scan TUI.

func NewModel

func NewModel(client *vdb.Client, files []scan.DetectedFile, pollInterval int, outputFormat string, gitCtx *gitctx.GitContext, repoRoot string) *Model

NewModel creates a new TUI model.

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init starts the TUI. Implements tea.Model.

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages. Implements tea.Model.

func (*Model) View

func (m *Model) View() string

View renders the TUI. Implements tea.Model.

type OutputSavedMsg

type OutputSavedMsg struct {
	Path string
	Err  error
}

OutputSavedMsg is sent when output has been written to a file.

type Phase

type Phase int

Phase represents the current phase of the scan TUI.

const (
	PhaseUploading Phase = iota
	PhasePolling
	PhaseResults
)

type ResolveCompleteMsg added in v1.27.2

type ResolveCompleteMsg struct {
	// AlertNumber is the provider alert number that was resolved.
	AlertNumber string
	// VEXStatus is the chosen VEX status (for updating the in-memory list).
	VEXStatus string
	// GitHubUpdated is true when a GitHub PATCH call was made successfully.
	GitHubUpdated bool
	// MemorySaved is true when memory.yaml was updated successfully.
	MemorySaved bool
	// VexFile is the path to the generated VEX document, if any.
	VexFile string
	// Err is non-nil if either operation failed.
	Err error
}

ResolveCompleteMsg is sent when a triage resolution attempt finishes.

type ResolveModal added in v1.27.2

type ResolveModal struct {
	// contains filtered or unexported fields
}

ResolveModal is the full-screen modal overlay for resolving an alert.

func (*ResolveModal) Init added in v1.27.2

func (m *ResolveModal) Init() tea.Cmd

Init returns the spinner tick so the spinner animates during submission.

func (*ResolveModal) Update added in v1.27.2

func (m *ResolveModal) Update(msg tea.Msg) (*ResolveModal, tea.Cmd, bool)

Update handles key/message events for the modal. Returns (updatedModal, cmd, closeModal).

func (*ResolveModal) View added in v1.27.2

func (m *ResolveModal) View(width, height int) string

View renders the resolve screen as a full-screen view.

type TaskUpdatedMsg

type TaskUpdatedMsg struct {
	Task *scan.ScanTask
}

TaskUpdatedMsg is sent when a scan task's status changes.

type TriageModel added in v1.21.0

type TriageModel struct {
	// contains filtered or unexported fields
}

TriageModel is the bubbletea model for the triage TUI.

func NewTriageModel added in v1.21.0

func NewTriageModel(alerts []triage.EnrichedAlert, opts TriageOptions) *TriageModel

NewTriageModel creates a new triage TUI model.

func (*TriageModel) Init added in v1.21.0

func (m *TriageModel) Init() tea.Cmd

Init implements tea.Model.

func (*TriageModel) Update added in v1.21.0

func (m *TriageModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (*TriageModel) View added in v1.21.0

func (m *TriageModel) View() string

View implements tea.Model.

type TriageOptions added in v1.27.2

type TriageOptions struct {
	// GHClient is the GitHub API client used to apply resolutions.
	// May be nil when GitHub integration is unavailable.
	GHClient *triage.GitHubClient
	// Repo is the "owner/repo" string for GitHub API calls.
	Repo string
	// VulnetixDir is the path to the .vulnetix directory for memory persistence.
	// Defaults to ".vulnetix" in the current working directory when empty.
	VulnetixDir string
	// VexFormat controls the VEX document format written on resolve: openvex, cdx, or json.
	// Defaults to "openvex" when empty.
	VexFormat string
	// InitialSeverity sets the starting severity filter (empty means no filter).
	// Valid values: "low", "medium", "high", "critical".
	InitialSeverity string
}

TriageOptions configures the triage TUI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL