ui

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoneMsg

type DoneMsg struct{ Err error }

Message types for updating the model

type GraphModel

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

GraphModel is the bubbletea model for graph visualization

func NewGraphModel

func NewGraphModel(tree *analyzer.Tree, scopes []*analyzer.ContextScope, rootPath string) GraphModel

NewGraphModel creates a new graph visualization model

func (GraphModel) Init

func (m GraphModel) Init() tea.Cmd

Init initializes the model

func (GraphModel) Update

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

Update handles messages

func (GraphModel) View

func (m GraphModel) View() string

View renders the graph

type GraphNode

type GraphNode struct {
	Node       *analyzer.ConfigNode
	Scope      *analyzer.ContextScope
	Depth      int
	Expanded   bool
	IsScope    bool // True if this is a scope header
	Children   []*GraphNode
	Parent     *GraphNode
	RefType    analyzer.RefType // For reference nodes
	IsRef      bool             // True if this is a reference (not a file)
	IsBroken   bool             // True if this is an unresolved/broken reference
	RefValue   string           // The reference value
	RefContext string           // Context around the reference
	RefLine    int              // Line number where the ref appears in parent
	RefColumn  int              // Column number where the ref appears in parent
	RefTarget  string           // Resolved target path (for file refs)
	SourceRefs []RefSource      // Reference sources (merged from parent refs)
}

GraphNode represents a displayable node in the graph

type Model

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

Model is the Bubbletea model for progress display

func NewModel

func NewModel() Model

NewModel creates a new progress model

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model

func (Model) Update

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

Update handles messages and updates the model

func (Model) View

func (m Model) View() string

View renders the model

type OperationMsg

type OperationMsg string

Message types for updating the model

type OutputMode

type OutputMode int

OutputMode determines how output should be formatted

const (
	// OutputModeInteractive enables full colors, spinners, and progress bars
	OutputModeInteractive OutputMode = iota
	// OutputModePlain disables colors and progress (for piped output)
	OutputModePlain
	// OutputModeJSON outputs raw JSON only
	OutputModeJSON
)

type ProgressController

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

ProgressController manages the bubbletea program for progress display

func (*ProgressController) Done

func (pc *ProgressController) Done(err error)

Done signals that all work is complete

func (*ProgressController) RuleDone

func (pc *ProgressController) RuleDone()

RuleDone indicates a rule has completed

func (*ProgressController) RuleStart

func (pc *ProgressController) RuleStart(name string)

RuleStart indicates a rule has started

func (*ProgressController) SetOperation

func (pc *ProgressController) SetOperation(op string)

SetOperation updates the current operation description

func (*ProgressController) SetRuleCount

func (pc *ProgressController) SetRuleCount(count int)

SetRuleCount sets the total number of rules to run

func (*ProgressController) SetStage

func (pc *ProgressController) SetStage(stage Stage)

SetStage updates the current stage

type RefSource

type RefSource struct {
	Line         int    // Line number in parent file
	Column       int    // Column number
	OriginalText string // The markdown text that created this reference
	Context      string // Surrounding lines
	Priority     int    // Priority based on markers
}

RefSource stores metadata about where a file was referenced from

type RuleCountMsg

type RuleCountMsg int

Message types for updating the model

type RuleDoneMsg

type RuleDoneMsg struct{}

Message types for updating the model

type RuleStartMsg

type RuleStartMsg string

Message types for updating the model

type SimpleSpinner

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

SimpleSpinner provides a simple spinner for short operations without the full progress tracking

func (*SimpleSpinner) Stop

func (ss *SimpleSpinner) Stop()

Stop stops the simple spinner

type Stage

type Stage int

Stage represents the current stage of analysis

const (
	StageLoadConfig Stage = iota
	StageBuildTree
	StageRunRules
	StageDone
)

type StageMsg

type StageMsg Stage

Message types for updating the model

type Styles

type Styles struct {

	// Severity styles
	Error      lipgloss.Style
	Warning    lipgloss.Style
	Suggestion lipgloss.Style
	Info       lipgloss.Style
	Success    lipgloss.Style

	// Structural styles
	Header    lipgloss.Style
	Subheader lipgloss.Style
	Path      lipgloss.Style
	Rule      lipgloss.Style
	Separator lipgloss.Style

	// Icons (degraded to ASCII when not interactive)
	IconError      string
	IconWarning    string
	IconSuggestion string
	IconInfo       string
	IconSuccess    string
	// contains filtered or unexported fields
}

Styles contains all lipgloss styles for terminal output

func NewStyles

func NewStyles(enabled bool) *Styles

NewStyles creates a new Styles instance When enabled is false, styles return text unchanged (for non-TTY output)

func (*Styles) Enabled

func (s *Styles) Enabled() bool

Enabled returns whether styling is enabled

type UI

type UI struct {
	Mode      OutputMode
	Writer    io.Writer
	ErrWriter io.Writer
	Styles    *Styles
}

UI provides a unified interface for terminal output with TTY detection

func New

func New(w, errW io.Writer, format string) *UI

New creates a new UI instance with automatic TTY detection

func (*UI) IsInteractive

func (ui *UI) IsInteractive() bool

IsInteractive returns true if the output is interactive (TTY)

func (*UI) IsJSON

func (ui *UI) IsJSON() bool

IsJSON returns true if JSON output mode is enabled

func (*UI) StartProgress

func (ui *UI) StartProgress() *ProgressController

StartProgress starts the progress display if in interactive mode Returns nil if not in interactive mode

func (*UI) StartSimpleSpinner

func (ui *UI) StartSimpleSpinner(w io.Writer, message string) *SimpleSpinner

StartSimpleSpinner starts a simple spinner with a message

Jump to

Keyboard shortcuts

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