ui

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorReset  = "\033[0m"
	ColorRed    = "\033[31m"
	ColorGreen  = "\033[32m"
	ColorYellow = "\033[33m"
	ColorCyan   = "\033[36m"
	ColorBold   = "\033[1m"
)

Color codes for terminal output

Variables

This section is empty.

Functions

func PrintError

func PrintError(msg string)

PrintError prints an error message

func PrintInfo

func PrintInfo(msg string)

PrintInfo prints an info message

func PrintRunDir

func PrintRunDir(runDir string)

PrintRunDir prints the run directory path

func PrintSkipped

func PrintSkipped(msg string)

PrintSkipped prints a skipped/not applicable message

func PrintStep

func PrintStep(step, total int, title, description string)

PrintStep prints a step header with number and description

func PrintSuccess

func PrintSuccess(msg string)

PrintSuccess prints a success message

func PrintWarning

func PrintWarning(msg string)

PrintWarning prints a warning message

func RenderFailureSummary

func RenderFailureSummary(failures []ScanFailure, totalPackages int)

RenderFailureSummary displays failures at the end of the workflow

func RenderInspectTable

func RenderInspectTable(rows []PostInstallRow)

RenderInspectTable displays inspect results (vulnerability scan only).

func RenderPackageTable

func RenderPackageTable(rows []PackageRow)

RenderPackageTable displays the package status table (Step 2)

func RenderPostInstallTable

func RenderPostInstallTable(rows []PostInstallRow, showLLM bool)

RenderPostInstallTable displays the post-install summary (Step 6). Columns shown: Package, LLM verdict (if enabled), Overall.

func RenderPreInstallTable

func RenderPreInstallTable(rows []PreInstallRow, showLLM bool)

RenderPreInstallTable displays pre-install scan results (Step 4)

func RenderSummary

func RenderSummary(updated, failed int, cvesResolved, cvesRemaining int)

RenderSummary displays the final summary

Types

type InteractiveSelector

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

InteractiveSelector provides an interactive package selection UI

func NewInteractiveSelector

func NewInteractiveSelector(items []PackageItem) *InteractiveSelector

NewInteractiveSelector creates a new interactive selector. Selection state should already be set on items before calling.

func (*InteractiveSelector) Run

func (s *InteractiveSelector) Run() ([]string, error)

Run displays the interactive selector and returns selected package names

type PackageItem

type PackageItem struct {
	Name         string
	Current      string
	Latest       string
	CVECount     int
	Severity     Severity
	Pinned       bool
	Selected     bool
	Dependents   []string // Packages that depend on this one
	Dependencies []string // Packages that this one requires
	LockedAsDep  bool     // True if auto-selected because a selected package depends on it
}

PackageItem represents a package in the interactive selector

type PackageRow

type PackageRow struct {
	Package   string
	Current   string
	Available string
	Pinned    bool
	CVECount  int
	Severity  Severity
	Action    string
}

PackageRow represents a row in the package table (Step 2)

type PostInstallRow

type PostInstallRow struct {
	Package    string
	Version    string
	CVECount   int
	Severity   Severity
	LLMVerdict llm.Verdict
	Overall    string
}

PostInstallRow represents a row in the post-install summary (Step 6) and inspect results

type PreInstallRow

type PreInstallRow struct {
	Package        string
	CVECount       int
	LLMVerdict     llm.Verdict
	Recommendation string
}

PreInstallRow represents a row in the pre-install scan table (Step 4)

type Progress

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

Progress provides a simple progress indicator for long-running operations

func NewProgress

func NewProgress(prefix string, total int) *Progress

NewProgress creates a new progress indicator

func (*Progress) Clear

func (p *Progress) Clear()

Clear clears the progress line

func (*Progress) Done

func (p *Progress) Done()

Done completes the progress and moves to next line

func (*Progress) SetStatus

func (p *Progress) SetStatus(item string)

SetStatus updates the display without incrementing the counter Use this for showing sub-steps within a single item

func (*Progress) Skip

func (p *Progress) Skip()

Skip increments the skipped counter (call when an item fails/is skipped)

func (*Progress) Update

func (p *Progress) Update(item string)

Update increments counter and shows progress for the current item

type Prompter

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

Prompter handles user input

func NewPrompter

func NewPrompter() *Prompter

NewPrompter creates a new prompter

func (*Prompter) Confirm

func (p *Prompter) Confirm(question string, defaultYes bool) (bool, error)

Confirm asks a yes/no question and returns the result

func (*Prompter) ConfirmPackageUpgrade

func (p *Prompter) ConfirmPackageUpgrade(pkg string, verdict llm.Verdict, reason string) (bool, error)

ConfirmPackageUpgrade asks for confirmation before upgrading a specific package

func (*Prompter) SelectPackagesInteractive

func (p *Prompter) SelectPackagesInteractive(items []PackageItem) ([]string, error)

SelectPackagesInteractive shows an interactive package selector

func (*Prompter) WaitForEnterOrEsc

func (p *Prompter) WaitForEnterOrEsc() bool

WaitForEnterOrEsc waits for Enter (returns true) or Esc (returns false)

type ScanFailure

type ScanFailure struct {
	Package string // Package name (empty for non-package-specific failures)
	Step    string // Which step failed (e.g., "OSV Scan", "LLM Code")
	Error   string // Error message
}

ScanFailure represents a failure during the workflow

type Severity

type Severity string

Severity represents CVE severity levels

const (
	SeverityCritical Severity = "CRITICAL"
	SeverityHigh     Severity = "HIGH"
	SeverityMedium   Severity = "MEDIUM"
	SeverityLow      Severity = "LOW"
	SeverityNone     Severity = "NONE"
	SeverityNA       Severity = "UNKNOWN"
)

type SignalHandler

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

SignalHandler manages graceful shutdown on CTRL+C

func NewSignalHandler

func NewSignalHandler() *SignalHandler

NewSignalHandler creates a new signal handler

func (*SignalHandler) SetCleanup

func (s *SignalHandler) SetCleanup(fn func())

SetCleanup sets a cleanup function to call on shutdown

func (*SignalHandler) SetInProgress

func (s *SignalHandler) SetInProgress(inProgress bool)

SetInProgress marks that work is in progress (affects prompt message)

func (*SignalHandler) Start

func (s *SignalHandler) Start()

Start begins listening for interrupt signals

func (*SignalHandler) Stop

func (s *SignalHandler) Stop()

Stop stops the signal handler

Jump to

Keyboard shortcuts

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