ui

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BacklogColor   = lipgloss.Color("#6c757d") // Gray
	PlannedColor   = lipgloss.Color("#ffffff") // White
	DoingColor     = lipgloss.Color("#198754") // Green
	BlockedColor   = lipgloss.Color("#dc3545") // Red
	DoneColor      = lipgloss.Color("#adb5bd") // Light Gray
	CanceledColor  = lipgloss.Color("#8b8b8b") // Medium Gray
	DuplicateColor = lipgloss.Color("#8b8b8b") // Medium Gray

	AccentColor = lipgloss.Color("#b392f0") // Purple
	MutedColor  = lipgloss.Color("#6c757d") // Gray
	WhiteColor  = lipgloss.Color("#ffffff")
)

--- Color Constants ---

View Source
var (
	WhiteStyle  = lipgloss.NewStyle().Foreground(WhiteColor)
	AccentStyle = lipgloss.NewStyle().Foreground(AccentColor)
	MutedStyle  = lipgloss.NewStyle().Foreground(MutedColor)
	BoldStyle   = lipgloss.NewStyle().Bold(true)
)

--- Base Styles ---

View Source
var (
	ErrorPrefix = errStyle.Render("✗")
	OKPrefix    = okStyle.Render("✓")
	NotePrefix  = warnStyle.Render("!")
)
View Source
var HeaderStyle = lipgloss.NewStyle().
	Bold(true).
	Border(lipgloss.NormalBorder(), false, false, true, false).
	BorderForeground(lipgloss.Color("240"))

HeaderStyle matches the list command header style

View Source
var WarningStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#ffc107")).Bold(true)

WarningStyle is used for warning messages.

Functions

func CalculateColumnWidths

func CalculateColumnWidths(totalWidth int, columns []Column) []int

CalculateColumnWidths helper

func DescribeEvent added in v1.2.0

func DescribeEvent(evt model.Event) string

DescribeEvent returns a human-readable description for an event. Returns empty string for unrecognized or empty updates (caller should skip).

func EditInteractive

func EditInteractive(template string) (string, error)

EditInteractive opens the user's EDITOR to edit the given template. Returns the content or an empty string if aborted/unchanged.

func ExtractEmail

func ExtractEmail(user string) string

ExtractEmail extracts the email from a "Name <email>" formatted string.

func ExtractName

func ExtractName(user string) string

ExtractName extracts the name from a "Name <email>" formatted string.

func FormatActor added in v1.2.0

func FormatActor(createdBy, onBehalfOf string) string

FormatActor returns a display name, appending "(via Principal)" when on_behalf_of is set.

func FormatBranchStats

func FormatBranchStats(stats *model.BranchStats) string

FormatBranchStats renders a compact commit count badge like "⊙ 3". Returns empty string if stats is nil or the branch has no commits.

func FormatID

func FormatID(id string, maxWidth int) string

FormatID formats an issue ID for display.

func FormatLabels

func FormatLabels(labels []string) string

FormatLabels renders a list of labels as styled tags.

func FormatLabelsBadge

func FormatLabelsBadge(labels []string) string

FormatLabelsBadge renders a list of labels as [label] badges.

func GetRecentDoneIDs

func GetRecentDoneIDs(issues []*model.Issue, count int) map[string]bool

GetRecentDoneIDs returns a map of the most recently updated DONE issue IDs

func GetRecentDoneIDsFromMap

func GetRecentDoneIDsFromMap(issuesMap map[string]*model.Issue, count int) map[string]bool

GetRecentDoneIDsFromMap is a convenience wrapper for map-based issue collections

func Indent

func Indent(level int) string

Indent returns a string with the given indentation level.

func LabelColor

func LabelColor(label string) lipgloss.Color

LabelColor returns a color for a label, checking config colors first, then falling back to a deterministic hash-based color.

func RenderCell

func RenderCell(content string, width int, style lipgloss.Style) string

RenderCell renders a table cell padded to a given width.

func RenderHeader

func RenderHeader(title string) string

RenderHeader renders a section header.

func RenderIssueDetails

func RenderIssueDetails(issue *model.Issue, children []*model.Issue, isArchived bool, termWidth int) string

RenderIssueDetails renders a detailed view of an issue.

func RenderIssueList

func RenderIssueList(issues []*model.Issue, termWidth int, prefix string) string

RenderIssueList renders a formatted issue list for the terminal. The prefix parameter is the configured issue ID prefix (e.g. "xpo-"); it determines the width of the ID column.

func RenderPulse added in v1.2.0

func RenderPulse(d PulseData, width int) string

func RenderRationale added in v1.2.0

func RenderRationale(data RationaleData, termWidth int) string

RenderRationale renders search results with colors, labels, fragments, and file paths.

func RenderReview

func RenderReview(data ReviewData, termWidth int) string

RenderReview renders the review summary for an issue with a matching branch.

func RenderTimeline added in v1.2.0

func RenderTimeline(w io.Writer, entries []model.TimelineEntry, termWidth int)

RenderTimeline renders a human-readable activity timeline to w. Accepts TimelineEntry slices that may contain both issue events and commits.

func RenderTimelineJSON added in v1.2.0

func RenderTimelineJSON(entries []model.TimelineEntry, w io.Writer)

RenderTimelineJSON writes timeline entries as JSONL (one JSON object per line).

func ScreenWidth

func ScreenWidth() int

ScreenWidth is an alias for TerminalWidth.

func SetLabelColors

func SetLabelColors(labels map[string]string)

SetLabelColors sets the label color map from config. Call this once after loading config to enable config-driven label colors in CLI output.

func StatusIcon

func StatusIcon(status model.IssueStatus) string

StatusIcon returns the icon for a given status.

func StatusIconForIssue

func StatusIconForIssue(issue *model.Issue) string

StatusIconForIssue returns the status icon, using a distinct icon for issues whose DOING status was inferred from a remote git branch.

func StatusStyle

func StatusStyle(status model.IssueStatus) lipgloss.Style

StatusStyle returns the style for a given status.

func TerminalWidth

func TerminalWidth() int

TerminalWidth returns the current terminal width with a default fallback.

func Truncate

func Truncate(s string, maxWidth int) string

Truncate truncates a string to a given visual width, preserving ANSI escape sequences and handling wide characters correctly.

Types

type Column

type Column struct {
	Title string
	Width int  // Fixed width or minimum width if Flex is true
	Flex  bool // If true, expands to fill available space
}

Column defines a table column

type PulseData added in v1.2.0

type PulseData struct {
	ProjectName     string
	VelocityPts     int
	VelocityDelta   int
	CycleTimeHrs    float64
	CycleCount      int
	LeadTimeHrs     float64
	LeadCount       int
	WIPTotal        int
	WIPStale        int
	BlockersTotal   int
	BlockersOldest  int
	ThroughputWk    int
	ThroughputDelta int
}

type RationaleData added in v1.2.0

type RationaleData struct {
	Results      []RationaleHit
	Query        string
	TotalMatches int
}

RationaleData is the input for rendering rationale search results.

type RationaleHit added in v1.2.0

type RationaleHit struct {
	IssueID      string
	Title        string
	Status       string
	Labels       []string
	Document     string
	Fragment     string
	Score        float64
	ArtifactPath string
}

RationaleHit is the UI-facing data for a single search result.

type ReviewCommit

type ReviewCommit struct {
	SHA     string
	Message string
}

type ReviewData

type ReviewData struct {
	Issue   *model.Issue
	Base    string
	Commits []ReviewCommit
	Files   []ReviewFile
}

type ReviewFile

type ReviewFile struct {
	Status     string
	Path       string
	Insertions int
	Deletions  int
}

Jump to

Keyboard shortcuts

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