ui

package
v0.0.0-...-c2d8862 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 23 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var ErrUserCancelled = fmt.Errorf("cancelled by user")

ErrUserCancelled is returned when the user cancels the wizard

Functions

func Confirm

func Confirm(prompt string) (bool, error)

Confirm shows a yes/no confirmation dialog using huh

func CreatePaneStyle

func CreatePaneStyle(isActive bool, accentColor, mutedColor color.Color, contentWidth int) lipgloss.Style

CreatePaneStyle creates a styled pane based on active state Uses ThickBorder for active, NormalBorder for inactive (both 2 chars wide)

func FillTerminal

func FillTerminal(content string, width, height int) string

FillTerminal uses lipgloss.Place to fill terminal dimensions and eliminate gaps

func PasswordInput

func PasswordInput(title, placeholder string) (string, error)

PasswordInput prompts for a single password with masked input If stdin is piped, reads from stdin. Otherwise shows TUI.

func PasswordInputConfirm

func PasswordInputConfirm(title, confirmTitle string) (string, error)

PasswordInputConfirm prompts for a password twice and validates they match Returns the password if both entries match, error otherwise If stdin is piped, only reads one line (no confirmation needed for programmatic input)

func RenderCenteredModal

func RenderCenteredModal(content string, width, height int, borderColor color.Color, modalWidth int) string

RenderCenteredModal renders a modal overlay centered in the terminal

func RenderProgressModal

func RenderProgressModal(title, statusMessage, indicator, helpText string, width, height, modalWidth int, theme config.Theme) string

RenderProgressModal renders a progress modal with title, status, indicator, and help text

func RenderTabContent

func RenderTabContent(content string, width, height int, theme config.Theme) string

RenderTabContent renders the content pane for the active tab. width is the desired total rendered width (borders are included inside this value in lipgloss v2).

func RenderTabs

func RenderTabs(tabs []Tab, cfg TabsConfig, theme config.Theme) string

RenderTabs renders a set of tabs with the cyberpunk aesthetic

func RunBuildKernelWizard

func RunBuildKernelWizard(theme config.Theme, callbacks BuildKernelCallbacks, arch, verificationLevel, configFile string, forceRebuild bool) error

RunBuildKernelWizard runs the kernel build wizard This handles the ENTIRE build process: selection + build + progress

func RunVersionSelector

func RunVersionSelector(
	theme config.Theme,
	target string,
	downloaded, available []string,
	downloadFn func(string, func(float64), func(string)) error,
	setDefaultFn, deleteFn func(string) error,
	reloadFn func() ([]string, []string, error),
	getDefaultVerFn func() string,
) error

RunVersionSelector runs the version selector with the provided callbacks

func TypedConfirm

func TypedConfirm(prompt, expectedInput string) (bool, error)

TypedConfirm shows a confirmation that requires typing a specific phrase

Types

type ActionCompleteMsg

type ActionCompleteMsg struct{}

type BuildCompleteMsg

type BuildCompleteMsg struct {
	Success bool
	Error   error
	Stats   kernel.BuildStats
}

BuildCompleteMsg signals the entire build is complete

type BuildKernelCallbacks

type BuildKernelCallbacks struct {
	// BuildFn starts a kernel build with the given options.
	BuildFn func(opts kernel.BuildOptions) error
	// CheckCachedFn checks for a cached build. Returns (hasCached, statsFile, error).
	CheckCachedFn func(version string) (bool, string, error)
	// ReadStatsFn reads build statistics from a stats file.
	ReadStatsFn func(path string) (kernel.BuildStats, error)
	// CheckInstalledFn checks if a build is already installed. Returns (isInstalled, version, error).
	CheckInstalledFn func(stats kernel.BuildStats) (bool, string, error)
	// InstallFn installs a built kernel. Returns (installedVersion, error).
	InstallFn func(stats kernel.BuildStats, setAsDefault bool) (string, error)
	// ArchiveFn archives an installed kernel to the given directory.
	ArchiveFn func(stats kernel.BuildStats, archiveDir string) error
	// ClearBuildCacheFn clears the build cache directories.
	ClearBuildCacheFn func() error
	// GetArchiveLocationFn returns the archive directory, or "" if not configured.
	GetArchiveLocationFn func() string
}

BuildKernelCallbacks provides domain operations for the build wizard. This decouples the UI from direct kernel package function calls.

type BuildKernelPhase

type BuildKernelPhase int

BuildKernelPhase represents a phase in the kernel build process

const (
	PhaseSelectVersion BuildKernelPhase = iota
	PhaseDownload
	PhaseVerify
	PhaseExtract
	PhaseConfigure
	PhaseCompile
	PhasePackage
	PhaseComplete
)

type BuildKernelWizard

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

BuildKernelWizard is the unified tabbed wizard for kernel building

func NewBuildKernelWizard

func NewBuildKernelWizard(theme config.Theme, callbacks BuildKernelCallbacks, arch, verificationLevel, configFile string, forceRebuild bool) *BuildKernelWizard

NewBuildKernelWizard creates a new kernel build wizard with tabs

func (*BuildKernelWizard) Init

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

Init initializes the wizard

func (*BuildKernelWizard) Update

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

Update handles messages

func (*BuildKernelWizard) View

func (m *BuildKernelWizard) View() tea.View

View renders the wizard

type BuildOutputMsg

type BuildOutputMsg struct {
	Output string
}

BuildOutputMsg contains output from a build phase

type BuildPhaseTransitionMsg

type BuildPhaseTransitionMsg struct {
	Phase kernel.BuildPhase
}

BuildPhaseTransitionMsg signals a phase transition

type BuildStats

type BuildStats struct {
	TotalDuration     time.Duration
	DownloadDuration  time.Duration
	ExtractDuration   time.Duration
	ConfigureDuration time.Duration
	CompileDuration   time.Duration
	PackageDuration   time.Duration
	UncompressedSize  int64
	CompressedSize    int64
	UncompressedHash  string
	CompressedHash    string
	KernelVersion     string
	OutputPath        string
	CompressedPath    string
	BuildTimestamp    time.Time // Timestamp when build completed
}

BuildStats contains statistics about the build

type BuildStreamMsg

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

BuildStreamMsg contains channels for streaming build output

type CachedBuildLoadedMsg

type CachedBuildLoadedMsg struct {
	Stats kernel.BuildStats
	Error error
}

CachedBuildLoadedMsg signals a cached build was loaded

type ConfirmationForm

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

ConfirmationForm provides a simple Y/N confirmation prompt for bubbletea v2.

func NewConfirmationForm

func NewConfirmationForm(theme config.Theme, _, title, description, affirmative, negative string) *ConfirmationForm

NewConfirmationForm creates a new confirmation form with Y/N quick keys. The key parameter is kept for API compatibility but unused in the v2 implementation.

func (*ConfirmationForm) Init

func (cf *ConfirmationForm) Init() tea.Cmd

Init returns nil — no async initialization needed.

func (*ConfirmationForm) Update

func (cf *ConfirmationForm) Update(msg tea.Msg) (bool, bool, tea.Cmd)

Update handles Y/N/ESC keypresses. Returns: (confirmed bool, shouldProceed bool, cmd)

func (*ConfirmationForm) View

func (cf *ConfirmationForm) View() string

View renders the confirmation prompt with theme styling.

type DownloadProgressMsg

type DownloadProgressMsg struct {
	Percent float64
}

DownloadProgressMsg contains download progress updates

type FetchVersionsMsg

type FetchVersionsMsg struct {
	Versions []string
	Error    error
}

FetchVersionsMsg contains available kernel versions

type InstallKernelMsg

type InstallKernelMsg struct {
	Success          bool
	InstalledVersion string
	SetAsDefault     bool
	Error            error
}

InstallKernelMsg signals kernel installation has completed

type KeyBinding

type KeyBinding struct {
	Key         string   // Display name: "ENTER", "TAB", "DEL"
	Keys        []string // Actual keys to match: ["enter"], ["tab"], ["delete", "backspace"]
	Description string   // What it does
}

KeyBinding represents a single key action

type KeyBindingSet

type KeyBindingSet struct {
	Bindings []KeyBinding
}

KeyBindingSet is a collection of related key bindings

func AvailablePaneKeyBindings

func AvailablePaneKeyBindings() KeyBindingSet

AvailablePaneKeyBindings returns key bindings for the available pane

func DownloadedPaneKeyBindings

func DownloadedPaneKeyBindings() KeyBindingSet

DownloadedPaneKeyBindings returns key bindings for the downloaded pane

func GlobalKeyBindings

func GlobalKeyBindings() KeyBindingSet

GlobalKeyBindings returns the global key bindings (work in any pane)

func (KeyBindingSet) Contains

func (kbs KeyBindingSet) Contains(key string) *KeyBinding

Contains checks if a key press matches any binding in the set

func (KeyBindingSet) Render

func (kbs KeyBindingSet) Render(style lipgloss.Style) string

Render formats key bindings for display Format: "[KEY] Action • [KEY] Action"

func (KeyBindingSet) RenderInline

func (kbs KeyBindingSet) RenderInline(style lipgloss.Style) string

RenderInline formats key bindings for inline display (more compact) Format: "Key: action | Key: action"

type LayoutDimensions

type LayoutDimensions struct {
	Width             int
	Height            int
	PaneContentWidth  int
	PaneRenderedWidth int
	ShowInstructions  bool
	BlankLineCount    int
	ContentHeight     int
}

LayoutDimensions holds calculated dimensions for a TUI layout

func CalculateContentHeight

func CalculateContentHeight(terminalHeight int, required, optional map[string]int, minContentHeight int) LayoutDimensions

CalculateContentHeight calculates available content height with graceful degradation Uses named constants pattern from cli/AGENTS.md to avoid magic numbers

func CalculateSplitPaneDimensions

func CalculateSplitPaneDimensions(terminalWidth, terminalHeight int) LayoutDimensions

CalculateSplitPaneDimensions calculates dimensions for a 50/50 split-pane layout following the width calculation pattern from cli/AGENTS.md

CRITICAL: Lipgloss width behavior (as of v1.1.1): - Style.Width(w) sets content width INCLUDING padding (padding is inside) - Border is rendered OUTSIDE of Style.Width() (adds to final render) - Actual rendered width = Style.Width() + border width

Example for terminal width 130: - Gap between panes: 2 chars - Target per pane: (130 - 2) / 2 = 64 chars rendered - Border overhead: 2 chars (RoundedBorder = 1 char per side) - Content width to set: 64 - 2 = 62 chars - Rendered: 62 content + 2 border = 64 chars ✓

type NewBuildStartedMsg

type NewBuildStartedMsg struct {
	Error error
}

NewBuildStartedMsg signals the cache was cleared and a new build can start

type StatusUpdateMsg

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

type Tab

type Tab struct {
	Title   string
	State   TabState
	Content string
	Spinner spinner.Model
}

Tab represents a single tab with state and content

type TabState

type TabState int

TabState represents the state of a tab

const (
	TabPending TabState = iota
	TabActive
	TabComplete
	TabError
)

type TabsConfig

type TabsConfig struct {
	ActiveIndex int
	Width       int // Total width available for all tabs
}

TabsConfig holds configuration for tab rendering

type VersionItem

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

func (VersionItem) Description

func (v VersionItem) Description() string

func (VersionItem) FilterValue

func (v VersionItem) FilterValue() string

func (VersionItem) Title

func (v VersionItem) Title() string

type VersionSelectedMsg

type VersionSelectedMsg struct {
	Version string
}

VersionSelectedMsg indicates user selected a version

type VersionSelectorModel

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

func NewVersionSelector

func NewVersionSelector(theme config.Theme, target string, downloaded, available []string, downloadFn func(string, func(float64), func(string)) error, setDefaultFn, deleteFn func(string) error, reloadFn func() ([]string, []string, error), getDefaultVerFn func() string) VersionSelectorModel

func (VersionSelectorModel) Init

func (m VersionSelectorModel) Init() tea.Cmd

func (VersionSelectorModel) Update

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

func (VersionSelectorModel) View

func (m VersionSelectorModel) View() tea.View

Jump to

Keyboard shortcuts

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