tui

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotATerminal = errors.New("--interactive requires a terminal stdin and stderr")

ErrNotATerminal is returned by Run when stdin or stderr is not an attached terminal. Callers (the CLI) typically translate this into an invalid-input exit code.

Functions

func Run

func Run(stdin io.Reader, stderr io.Writer, model Model) error

Types

type DiffModel

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

DiffModel renders the interactive `bomly diff` TUI. Tab cycling, the tab strip, and the top bar are owned by the embedded *shellModel; this struct holds diff payload data and per-tab state (filters, expansion maps).

func NewDiff

func NewDiff(payload output.DiffResponse, baseGraph, headGraph sdk.ConsolidatedGraph) *DiffModel

NewDiff constructs the diff TUI model. baseGraph and headGraph are the consolidated graphs from the two pipeline runs; they feed the Source tab.

func (DiffModel) ActiveTabID

func (s DiffModel) ActiveTabID() string

ActiveTabID returns the ID string of the active tab, or "" if there are no tabs. Embedding models use it to branch View() or specialize behavior.

func (DiffModel) AppendSearch

func (s DiffModel) AppendSearch(value string)

func (DiffModel) BackspaceSearch

func (s DiffModel) BackspaceSearch()

func (DiffModel) BeginSearch

func (s DiffModel) BeginSearch()

func (DiffModel) BlurDetails

func (s DiffModel) BlurDetails()

func (DiffModel) CancelSearch

func (s DiffModel) CancelSearch()

func (*DiffModel) CollapseAll

func (m *DiffModel) CollapseAll()

CollapseAll closes every expandable node in the active tab.

func (*DiffModel) CollapseSelected

func (m *DiffModel) CollapseSelected()

CollapseSelected forces the focused node closed.

func (DiffModel) ConfirmSearch

func (s DiffModel) ConfirmSearch()

func (*DiffModel) CycleEcosystemFilter

func (m *DiffModel) CycleEcosystemFilter()

CycleEcosystemFilter advances the ecosystem filter, drawn from the distinct ecosystems present across changed manifests.

func (*DiffModel) CycleGroup

func (m *DiffModel) CycleGroup()

CycleGroup is the per-tab "g" key handler. Each tab interprets it differently (grouping axis, source-side focus).

func (*DiffModel) CycleRelationshipFilter

func (m *DiffModel) CycleRelationshipFilter()

CycleRelationshipFilter advances the relationship filter on the Components tab (None → root → direct → transitive → None).

func (*DiffModel) CycleScopeFilter

func (m *DiffModel) CycleScopeFilter()

CycleScopeFilter advances the scope filter (None → runtime → development → unset → None).

func (*DiffModel) CycleSeverityFilter

func (m *DiffModel) CycleSeverityFilter()

CycleSeverityFilter advances the severity filter on the Components tab (driven by attached PackageRef.Vulnerabilities).

func (DiffModel) CycleView

func (s DiffModel) CycleView()

CycleView advances to the next tab.

func (DiffModel) End

func (s DiffModel) End()

func (*DiffModel) ExpandAll

func (m *DiffModel) ExpandAll()

ExpandAll opens every expandable node in the active tab.

func (*DiffModel) ExpandSelected

func (m *DiffModel) ExpandSelected()

ExpandSelected forces the focused node open.

func (DiffModel) FocusDetails

func (s DiffModel) FocusDetails()

func (DiffModel) Home

func (s DiffModel) Home()

func (DiffModel) IsDetailsFocused

func (s DiffModel) IsDetailsFocused() bool

IsDetailsFocused / FocusDetails / BlurDetails delegate to the active listModel so the teaModel keyboard handler can drive focus uniformly regardless of which command owns the embedding model.

func (DiffModel) IsSearching

func (s DiffModel) IsSearching() bool

func (DiffModel) List

func (s DiffModel) List() *listModel

List exposes the active listModel so the embedding command can poke at it (e.g. preserve selected index across rebuilds).

func (DiffModel) Move

func (s DiffModel) Move(delta int)

func (DiffModel) Rebuild

func (s DiffModel) Rebuild()

Rebuild re-invokes the active tab's Build func. Call after the embedding model mutates any state that the tab reads (filters, expansion maps, ...).

func (DiffModel) ScrollDetails

func (s DiffModel) ScrollDetails(delta int)

func (DiffModel) SelectView

func (s DiffModel) SelectView(index int)

SelectView jumps to the 1-indexed tab.

func (DiffModel) TabLine

func (s DiffModel) TabLine() string

TabLine renders the active-tab-highlighted "[1] Foo | [2] Bar" strip.

func (*DiffModel) ToggleSelected

func (m *DiffModel) ToggleSelected()

ToggleSelected toggles the expansion of the currently-focused tree node.

func (*DiffModel) View

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

View overrides the embedded shellModel.View so the Overview tab can render its custom dashboard layout. All other tabs (including Source, which uses listModel.bodyOverride for its two-pane body) fall through to the shared shellModel renderer so the chrome stays identical.

func (*DiffModel) WithEnrichEnabled

func (m *DiffModel) WithEnrichEnabled(enabled bool) *DiffModel

WithEnrichEnabled records whether enrichment ran, so empty Vuln/Findings tabs can distinguish "not requested" from "no matches".

func (*DiffModel) WithRegistry

func (m *DiffModel) WithRegistry(base, head *sdk.PackageRegistry) *DiffModel

WithRegistry attaches the base/head package registries so source-tree package details can show matcher and analyzer enrichment by PURL.

type Model

type Model interface {
	View(width, height int) string
	Move(delta int)
	Home()
	End()
}

type ScanModel

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

func NewExplain

func NewExplain(project output.ProjectDescriptor, query string, consolidated sdk.ConsolidatedGraph, graphValue *sdk.Graph, findings []sdk.Finding) *ScanModel

func NewScan

func NewScan(project output.ProjectDescriptor, consolidated sdk.ConsolidatedGraph, graphValue *sdk.Graph, findings []sdk.Finding) *ScanModel

func NewScanNavigator

func NewScanNavigator(titlePrefix string, project output.ProjectDescriptor, consolidated sdk.ConsolidatedGraph, graphValue *sdk.Graph, findings []sdk.Finding) *ScanModel

func (ScanModel) ActiveTabID

func (s ScanModel) ActiveTabID() string

ActiveTabID returns the ID string of the active tab, or "" if there are no tabs. Embedding models use it to branch View() or specialize behavior.

func (ScanModel) AppendSearch

func (s ScanModel) AppendSearch(value string)

func (ScanModel) BackspaceSearch

func (s ScanModel) BackspaceSearch()

func (ScanModel) BeginSearch

func (s ScanModel) BeginSearch()

func (ScanModel) BlurDetails

func (s ScanModel) BlurDetails()

func (*ScanModel) CanGoBack

func (m *ScanModel) CanGoBack() bool

func (ScanModel) CancelSearch

func (s ScanModel) CancelSearch()

func (*ScanModel) CollapseAll

func (m *ScanModel) CollapseAll()

func (*ScanModel) CollapseSelected

func (m *ScanModel) CollapseSelected()

func (ScanModel) ConfirmSearch

func (s ScanModel) ConfirmSearch()

func (*ScanModel) CycleEcosystemFilter

func (m *ScanModel) CycleEcosystemFilter()

func (*ScanModel) CycleGroup

func (m *ScanModel) CycleGroup()

func (*ScanModel) CycleReachabilityFilter

func (m *ScanModel) CycleReachabilityFilter()

func (*ScanModel) CycleRelationshipFilter

func (m *ScanModel) CycleRelationshipFilter()

func (*ScanModel) CycleScopeFilter

func (m *ScanModel) CycleScopeFilter()

func (*ScanModel) CycleSeverityFilter

func (m *ScanModel) CycleSeverityFilter()

func (ScanModel) CycleView

func (s ScanModel) CycleView()

CycleView advances to the next tab.

func (ScanModel) End

func (s ScanModel) End()

func (*ScanModel) ExpandAll

func (m *ScanModel) ExpandAll()

func (*ScanModel) ExpandSelected

func (m *ScanModel) ExpandSelected()

func (ScanModel) FocusDetails

func (s ScanModel) FocusDetails()

func (*ScanModel) GoBack

func (m *ScanModel) GoBack()

func (ScanModel) Home

func (s ScanModel) Home()

func (ScanModel) IsDetailsFocused

func (s ScanModel) IsDetailsFocused() bool

IsDetailsFocused / FocusDetails / BlurDetails delegate to the active listModel so the teaModel keyboard handler can drive focus uniformly regardless of which command owns the embedding model.

func (ScanModel) IsSearching

func (s ScanModel) IsSearching() bool

func (ScanModel) List

func (s ScanModel) List() *listModel

List exposes the active listModel so the embedding command can poke at it (e.g. preserve selected index across rebuilds).

func (ScanModel) Move

func (s ScanModel) Move(delta int)

func (*ScanModel) OpenSelected

func (m *ScanModel) OpenSelected()

func (ScanModel) Rebuild

func (s ScanModel) Rebuild()

Rebuild re-invokes the active tab's Build func. Call after the embedding model mutates any state that the tab reads (filters, expansion maps, ...).

func (ScanModel) ScrollDetails

func (s ScanModel) ScrollDetails(delta int)

func (ScanModel) SelectView

func (s ScanModel) SelectView(index int)

SelectView jumps to the 1-indexed tab.

func (ScanModel) TabLine

func (s ScanModel) TabLine() string

TabLine renders the active-tab-highlighted "[1] Foo | [2] Bar" strip.

func (*ScanModel) ToggleSelected

func (m *ScanModel) ToggleSelected()

func (*ScanModel) View

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

View overrides shellModel.View so the Overview tab can render its custom dashboard layout. All other tabs fall through to the embedded shellModel's listModel rendering.

func (*ScanModel) WithEnrichEnabled

func (m *ScanModel) WithEnrichEnabled(enabled bool) *ScanModel

WithEnrichEnabled records whether the scan requested enrichment so empty vulnerability states can distinguish "not requested" from "no matches".

func (*ScanModel) WithReachabilityEnabled

func (m *ScanModel) WithReachabilityEnabled(enabled bool) *ScanModel

WithReachabilityEnabled records whether the scan requested reachability analysis so the conditional interactive filter is only exposed for an explicitly enabled scan.

func (*ScanModel) WithRegistry

func (m *ScanModel) WithRegistry(registry *sdk.PackageRegistry) *ScanModel

WithRegistry attaches the PURL-keyed package registry so the TUI can resolve vulnerabilities, licenses, and scorecards by reference. Must be called before the model is rendered for the first time when matching- stage data should be visible. Safe to pass nil.

type ShellSpec

type ShellSpec struct {
	TopBar func() string
	Tabs   []TabSpec
	Footer func() (summary, legend string)
}

ShellSpec configures a shellModel: a top-bar line, a list of tabs, and optional footer lines. Commands (scan, diff, explain) construct one and embed *shellModel to inherit tab cycling, the tab strip, and listModel delegation.

type TabBuild

type TabBuild func() *listModel

TabBuild produces the listModel that backs a single tab. The shell calls it whenever the active tab is (re)rendered so the tab can read fresh state from the embedding command model.

type TabSpec

type TabSpec struct {
	ID    string
	Label string
	Build TabBuild
}

TabSpec describes one tab in the shared TUI shell.

Jump to

Keyboard shortcuts

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