elements

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BoolValueYes = "yes"
	BoolValueNo  = "no"
)
View Source
const (
	FilterOverlayIndent    = "  "
	FilterOverlayCursorOn  = "▸ "
	FilterOverlayCursorOff = "  "
	FilterOverlayCheckOff  = "  "
)
View Source
const (
	FramedFooterRows   = 2
	FramedChromeHeight = 4 // top border + bottom border + footer rows
)
View Source
const (
	HelpOverlayIndent    = "  "
	HelpOverlayColumnGap = "  "
)
View Source
const NoDataLabel = "No data"

Variables

This section is empty.

Functions

func AppendCmd

func AppendCmd(cmds *[]tea.Cmd, cmd tea.Cmd)

func ApplyStructuredFilters

func ApplyStructuredFilters(
	conversations []conv.Conversation,
	dims [FilterDimCount]DimensionFilter,
) []conv.Conversation

func BlankDailyRateCells

func BlankDailyRateCells(plotWidth int) []string

func ClaudeTurnChartPoints

func ClaudeTurnChartPoints(
	metrics []statspkg.PositionTokenMetrics,
	value func(statspkg.PositionTokenMetrics) float64,
) []canvas.Float64Point

func ClaudeTurnChartRange

func ClaudeTurnChartRange(metrics []statspkg.PositionTokenMetrics) (float64, float64)

func ClearNotificationAfter

func ClearNotificationAfter(kind NotificationKind) tea.Cmd

func Commit

func Commit() string

func ComposeFooterRow

func ComposeFooterRow(width int, left, right string) string

func DailyRateChartDimensions

func DailyRateChartDimensions(height int) (int, bool)

func DailyRatePlotWidth

func DailyRatePlotWidth(slots []DailyRateBarSlot) int

func ExtractFilterValues

func ExtractFilterValues(conversations []conv.Conversation) [FilterDimCount][]string

func FilterBadges

func FilterBadges(dims [FilterDimCount]DimensionFilter) []string

func FilterDimensionIsBool

func FilterDimensionIsBool(dim FilterDimension) bool

func FilterDimensionLabel

func FilterDimensionLabel(dim FilterDimension) string

func FilterFooterStatusParts

func FilterFooterStatusParts(
	conversations []conv.Conversation,
	filter FilterState,
) []string

func FitToWidth

func FitToWidth(s string, width int) string

func FormatFloat

func FormatFloat(value float64) string

func FramedBodyHeight

func FramedBodyHeight(totalHeight int) int

func FramedFooterContentWidth

func FramedFooterContentWidth(width int) int

func GroupedDailyValueBarSlots

func GroupedDailyValueBarSlots(
	buckets []groupedDailyValueBucket,
	plotWidth int,
) []groupedDailyValueBarSlot

func HeatmapCellWidth

func HeatmapCellWidth(width int) int

func HeatmapIntervalCells

func HeatmapIntervalCells(cells [7][24]int) [7][heatmapIntervalCount]int

func HelpItemKeyText

func HelpItemKeyText(item HelpItem) string

func HistogramValueLabelPlacement

func HistogramValueLabelPlacement(scaledHeight, maxHeight int) (int, bool)

func JoinNonEmpty

func JoinNonEmpty(items []string, sep string) string

func MonotonicScaledHeight

func MonotonicScaledHeight(value, maxValue float64, height int) int

MonotonicScaledHeight maps a positive value into a 1..height integer slot using a ceiling, so that distinct non-zero values map to distinct heights whenever the chart resolution allows. Used by stacked histogram and stacked turn renderers where round-to-nearest would otherwise collapse adjacent small values onto the same row.

func NotificationCmd

func NotificationCmd(msg NotificationMsg) tea.Cmd

func NotificationDuration

func NotificationDuration(kind NotificationKind) time.Duration

func RenderDailyRateLabelLine

func RenderDailyRateLabelLine(buckets []DailyRateBucket, plotWidth int, slots []DailyRateBarSlot) string

func RenderFramedBody

func RenderFramedBody(width, bodyHeight int, borderColor color.Color, content string) string

func RenderFramedFooter

func RenderFramedFooter(width int, topRow, statusRow string) string

func RenderHorizontalStackedBarsBody

func RenderHorizontalStackedBarsBody(items []StackedRowItem, width int) string

func RenderInsetBox

func RenderInsetBox(width int, borderColor color.Color, content string) string

func RenderSparkline

func RenderSparkline(points []statspkg.PerformancePoint, width int) string

func RenderTurnBarXAxisRows

func RenderTurnBarXAxisRows(
	columns []TurnBarColumn,
	axisLabelWidth, graphWidth int,
) []string

func RenderWrappedTokens

func RenderWrappedTokens(tokens []string, width int) string

func ResolveFloatSegmentHeights

func ResolveFloatSegmentHeights(totalHeight int, values []float64) []int

func ResolveStackedBarWidths

func ResolveStackedBarWidths(totalWidth int, values []int) []int

func ScaledFloatWidth

func ScaledFloatWidth(value, maxValue float64, width int) int

func ScaledWidth

func ScaledWidth(value, maxValue, width int) int

func SetVersionDetails

func SetVersionDetails(versionValue, commitValue, dateValue string)

func ShortenPath

func ShortenPath(path string) string

func SplitAndFitLines

func SplitAndFitLines(content string, width int) []string

func SplitTurnSeriesKeys

func SplitTurnSeriesKeys(series []statspkg.SplitTurnSeries) []string

func StatsColumnWidths

func StatsColumnWidths(
	width, leftWeight, rightWeight, minColumnWidth int,
) (int, int, bool)

func TrimFooterRow

func TrimFooterRow(row string, width int) string

func TruncateFooterText

func TruncateFooterText(row string, width int) string

func TurnBarAxisLabelWidth

func TurnBarAxisLabelWidth(maxY float64) int

func TurnBarLevelLabel

func TurnBarLevelLabel(level, plotHeight int, maxY float64) string

func TurnBarScaledHeight

func TurnBarScaledHeight(current, maxY float64, plotHeight int) int

func Version

func Version() string

func VersionInfo

func VersionInfo() string

VersionInfo returns a formatted version string for CLI output.

Types

type BarItem

type BarItem struct {
	Label string
	Value int
}

type BoolFilterState

type BoolFilterState int
const (
	BoolFilterAny BoolFilterState = iota
	BoolFilterYes
	BoolFilterNo
)

func CycleBoolFilter

func CycleBoolFilter(state BoolFilterState) BoolFilterState

type Chip

type Chip struct {
	Label string
	Value string
}

type ClearNotificationMsg

type ClearNotificationMsg struct{}

type DailyRateBarSlot

type DailyRateBarSlot struct {
	Start  int
	End    int
	Anchor int
}

func DailyRateBarSlots

func DailyRateBarSlots(bucketCount, plotWidth int) []DailyRateBarSlot

type DailyRateBucket

type DailyRateBucket = DailyValueBucket

func BucketDailyRates

func BucketDailyRates(rates []statspkg.DailyRate, columnCount int) []DailyRateBucket

type DailyValueBucket

type DailyValueBucket struct {
	Start    time.Time
	End      time.Time
	Value    float64
	HasValue bool
}

type DimensionFilter

type DimensionFilter struct {
	Selected   map[string]bool
	Regex      string
	CompiledRe *regexp.Regexp
	UseRegex   bool
	BoolState  BoolFilterState
}

func (DimensionFilter) IsActive

func (f DimensionFilter) IsActive() bool

type FilterDimension

type FilterDimension int
const (
	FilterDimProvider FilterDimension = iota
	FilterDimProject
	FilterDimModel
	FilterDimVersion
	FilterDimGitBranch
	FilterDimHasPlans
	FilterDimMultiPart
	FilterDimCount
)

type FilterState

type FilterState struct {
	Active         bool
	Cursor         int
	Expanded       int
	ExpandedScroll int
	ExpandedCursor int
	RegexEditing   bool
	RegexInput     textinput.Model
	Dimensions     [FilterDimCount]DimensionFilter
	Values         [FilterDimCount][]string
}

func CopyFilterState

func CopyFilterState(filter FilterState) FilterState

func NewFilterState

func NewFilterState() FilterState

func (FilterState) HasActiveFilters

func (f FilterState) HasActiveFilters() bool

func (FilterState) MatchCount

func (f FilterState) MatchCount(conversations []conv.Conversation) int

type HelpItem

type HelpItem struct {
	Key      string
	Desc     string
	Detail   string
	Toggle   bool
	On       bool
	Glow     bool
	Priority HelpPriority
}

func FilterDimensionFooterItems

func FilterDimensionFooterItems(filter FilterState) []HelpItem

func FilterFooterItems

func FilterFooterItems(filter FilterState) []HelpItem

func WithHelpDetail

func WithHelpDetail(item HelpItem, detail string) HelpItem

type HelpPriority

type HelpPriority int
const (
	HelpPriorityLow HelpPriority = iota
	HelpPriorityNormal
	HelpPriorityHigh
	HelpPriorityEssential
)

type HelpSection

type HelpSection struct {
	Title string
	Items []HelpItem
}

func LogInfoSection

func LogInfoSection(logFilePath string) HelpSection

func VersionInfoSection

func VersionInfoSection() HelpSection

type HistBucket

type HistBucket struct {
	Label   string
	Count   int
	Display string
}

type HistogramLayout

type HistogramLayout struct {
	BucketWidths []int
	GapWidth     int
	GraphWidth   int
}

func ResolveHistogramLayout

func ResolveHistogramLayout(graphWidth, bucketCount int) HistogramLayout

type Notification

type Notification struct {
	Kind NotificationKind
	Text string
}

type NotificationKind

type NotificationKind string
const (
	NotificationInfo    NotificationKind = "info"
	NotificationSuccess NotificationKind = "success"
	NotificationError   NotificationKind = "error"
)

type NotificationMsg

type NotificationMsg struct {
	Notification Notification
}

func ErrorNotification

func ErrorNotification(text string) NotificationMsg

func FormatResumeErrorNotification

func FormatResumeErrorNotification(err error, cwd string, providerUnavailable error) NotificationMsg

func InfoNotification

func InfoNotification(text string) NotificationMsg

func NewNotification

func NewNotification(kind NotificationKind, text string) NotificationMsg

func SuccessNotification

func SuccessNotification(text string) NotificationMsg

type StackedHistBucket

type StackedHistBucket struct {
	Label    string
	Total    int
	Segments []StackedHistSegment
}

type StackedHistSegment

type StackedHistSegment struct {
	Value int
	Color color.Color
}

type StackedRowItem

type StackedRowItem struct {
	Label    string
	Scale    float64
	Value    string
	Segments []StackedRowSegment
}

type StackedRowSegment

type StackedRowSegment struct {
	Value int
	Color color.Color
}

type TableRow

type TableRow struct {
	Columns []string
}

type Theme

type Theme struct {
	ColorPrimary     color.Color
	ColorSecondary   color.Color
	ColorAccent      color.Color
	ColorHighlight   color.Color
	ColorSelectedFg  color.Color
	ColorDiffRemove  color.Color
	ColorDiffHunk    color.Color
	ColorToolBg      color.Color
	ColorFgOnBg      color.Color
	ColorStatusFg    color.Color
	ColorNormalTitle color.Color
	ColorNormalDesc  color.Color
	ColorTitleFg     color.Color
	ColorChartBar    color.Color
	ColorChartToken  color.Color
	ColorChartTime   color.Color
	ColorChartError  color.Color
	ColorHeatmap0    color.Color
	ColorHeatmap1    color.Color
	ColorHeatmap2    color.Color
	ColorHeatmap3    color.Color
	ColorHeatmap4    color.Color

	StyleSubtitle             lipgloss.Style
	StyleToolCall             lipgloss.Style
	StyleToolCallItalic       lipgloss.Style
	StyleMetaLabel            lipgloss.Style
	StyleMetaValue            lipgloss.Style
	StyleSearchMatch          lipgloss.Style
	StyleCurrentMatch         lipgloss.Style
	StyleRuleHR               lipgloss.Style
	StyleHistogramAxisLabel   lipgloss.Style
	StyleHistogramAxisLine    lipgloss.Style
	StyleHistogramValueLabel  lipgloss.Style
	StyleBadgeUser            lipgloss.Style
	StyleBadgeAssistant       lipgloss.Style
	StyleBadgeSystem          lipgloss.Style
	StyleThinkLabel           lipgloss.Style
	StyleThinkBorder          lipgloss.Style
	StyleThinkLine            lipgloss.Style
	StyleSelectedPreview      lipgloss.Style
	StyleNormalPreview        lipgloss.Style
	StyleDimmedPreview        lipgloss.Style
	StyleDiffBg               lipgloss.Style
	StyleDiffAdd              lipgloss.Style
	StyleDiffRemoveLine       lipgloss.Style
	StyleDiffHunkLine         lipgloss.Style
	StyleToolResultBadge      lipgloss.Style
	StyleToolResultErrorBadge lipgloss.Style
	StylePaneTitle            lipgloss.Style
	StyleHeatmapCells         [5]lipgloss.Style
}

func NewTheme

func NewTheme(hasDarkBG bool) *Theme

func (*Theme) HistogramAxisLabel

func (t *Theme) HistogramAxisLabel(text string) string

func (*Theme) HistogramAxisLine

func (t *Theme) HistogramAxisLine(text string) string

func (*Theme) RenderActivityHeatmap

func (t *Theme) RenderActivityHeatmap(title string, cells [7][24]int, width int) string

func (*Theme) RenderActivityHeatmapBody

func (t *Theme) RenderActivityHeatmapBody(cells [7][24]int, width int) string

func (*Theme) RenderBoolSummary

func (t *Theme) RenderBoolSummary(state BoolFilterState, maxWidth int) string

func (*Theme) RenderBorderTop

func (t *Theme) RenderBorderTop(title string, width int, fg, bg color.Color) string

RenderBorderTop builds a custom top border line with an embedded title badge: ╭─ Title ──────────────────────╮

func (*Theme) RenderColumns

func (t *Theme) RenderColumns(left, right string, leftWidth, rightWidth int, stacked bool) string

func (*Theme) RenderDailyRateColumnChart

func (t *Theme) RenderDailyRateColumnChart(
	rates []statspkg.DailyRate,
	width, height int,
	barColor color.Color,
	yFormatter linechart.LabelFormatter,
) string

func (*Theme) RenderFilterDimensionRow

func (t *Theme) RenderFilterDimensionRow(filter FilterState, dim FilterDimension, width int) string

func (*Theme) RenderFilterDimensionSummary

func (t *Theme) RenderFilterDimensionSummary(filter FilterState, dim FilterDimension, maxWidth int) string

func (*Theme) RenderFilterExpandedValues

func (t *Theme) RenderFilterExpandedValues(filter FilterState, dim FilterDimension, width int) []string

func (*Theme) RenderFilterOverlayWithConversations

func (t *Theme) RenderFilterOverlayWithConversations(
	conversations []conv.Conversation,
	filter FilterState,
	width, height int,
) string

func (*Theme) RenderFittedHelpItems

func (t *Theme) RenderFittedHelpItems(items []HelpItem, width int) string

func (*Theme) RenderFramedBox

func (t *Theme) RenderFramedBox(title string, width int, borderColor color.Color, content string) string

func (*Theme) RenderFramedPane

func (t *Theme) RenderFramedPane(
	title string,
	width, bodyHeight int,
	borderColor color.Color,
	content string,
) string

func (*Theme) RenderHelpFooter

func (t *Theme) RenderHelpFooter(width int, items []HelpItem, rightParts []string, n Notification) string

func (*Theme) RenderHelpItem

func (t *Theme) RenderHelpItem(item HelpItem) string

func (*Theme) RenderHelpItems

func (t *Theme) RenderHelpItems(items []HelpItem) string

func (*Theme) RenderHelpOverlay

func (t *Theme) RenderHelpOverlay(width, height int, title string, sections []HelpSection) string

func (*Theme) RenderHistogramAxis

func (t *Theme) RenderHistogramAxis(axisLabelWidth, graphWidth, width int) string

func (*Theme) RenderHistogramLabels

func (t *Theme) RenderHistogramLabels(
	buckets []HistBucket,
	axisLabelWidth int,
	bucketWidths []int,
	gapWidth, width int,
) string

func (*Theme) RenderHorizontalBars

func (t *Theme) RenderHorizontalBars(title string, items []BarItem, width int, barColor color.Color) string

func (*Theme) RenderHorizontalBarsBody

func (t *Theme) RenderHorizontalBarsBody(items []BarItem, width int, barColor color.Color) string

func (*Theme) RenderInlineTitledRule

func (t *Theme) RenderInlineTitledRule(title, rightMeta string, width int, titleColor color.Color) string

RenderInlineTitledRule renders a horizontal rule with an inline title, like "─── Title ────────────". When rightMeta is non-empty it is embedded on the right side, like "─── Title ─── rightMeta ───"; the caller owns its styling. If the width cannot fit the full layout with rightMeta, the meta segment is dropped and the rule falls back to a title-only render. The title is foregrounded in titleColor, and the dashes use the theme's StyleRuleHR styling.

func (*Theme) RenderNotification

func (t *Theme) RenderNotification(n Notification) string

func (*Theme) RenderPreformattedColumns

func (t *Theme) RenderPreformattedColumns(left, right string, leftWidth, rightWidth int, stacked bool) string

func (*Theme) RenderRankedTable

func (t *Theme) RenderRankedTable(title string, rows []TableRow, maxWidth int) string

func (*Theme) RenderRankedTableBody

func (t *Theme) RenderRankedTableBody(rows []TableRow, maxWidth int) string

func (*Theme) RenderSearchFooter

func (t *Theme) RenderSearchFooter(width int, prompt, right string, n Notification) string

func (*Theme) RenderSelectionSummary

func (t *Theme) RenderSelectionSummary(f DimensionFilter, values []string, maxWidth int) string

func (*Theme) RenderSideBySide

func (t *Theme) RenderSideBySide(left, right string, width int) string

func (*Theme) RenderSingleChip

func (t *Theme) RenderSingleChip(label, value string) string

func (*Theme) RenderSplitDailyRateChartBody

func (t *Theme) RenderSplitDailyRateChartBody(
	series []statspkg.SplitDailyValueSeries,
	width, height int,
	colorByKey map[string]color.Color,
) string

func (*Theme) RenderSplitDailyShareChartBody

func (t *Theme) RenderSplitDailyShareChartBody(
	shares []statspkg.SplitDailyShare,
	width, height int,
	colorByKey map[string]color.Color,
) string

func (*Theme) RenderSplitDailyValueChartBody

func (t *Theme) RenderSplitDailyValueChartBody(
	series []statspkg.SplitDailyValueSeries,
	width, height int,
	colorByKey map[string]color.Color,
	yFormatter linechart.LabelFormatter,
	minValue float64,
) string

func (*Theme) RenderSplitTurnGroupedChartBody

func (t *Theme) RenderSplitTurnGroupedChartBody(
	series []statspkg.SplitTurnSeries,
	width, height int,
	colorByKey map[string]color.Color,
	mode statspkg.StatisticMode,
	value func(statspkg.PositionTokenMetrics) float64,
	emptyState string,
) string

func (*Theme) RenderStatsTitle

func (t *Theme) RenderStatsTitle(title string) string

func (*Theme) RenderSummaryChips

func (t *Theme) RenderSummaryChips(chips []Chip, width int) string

func (*Theme) RenderTokenValue

func (t *Theme) RenderTokenValue(text string) string

func (*Theme) RenderTurnBarAxis

func (t *Theme) RenderTurnBarAxis(axisLabelWidth, graphWidth, width int) string

func (*Theme) RenderTurnBarChartBody

func (t *Theme) RenderTurnBarChartBody(
	metrics []statspkg.PositionTokenMetrics,
	width, height int,
	barColor color.Color,
	value func(statspkg.PositionTokenMetrics) float64,
	showXAxis bool,
	emptyState string,
) string

func (*Theme) RenderVerticalHistogram

func (t *Theme) RenderVerticalHistogram(title string, buckets []HistBucket, width, maxHeight int) string

func (*Theme) RenderVerticalHistogramBody

func (t *Theme) RenderVerticalHistogramBody(
	buckets []HistBucket,
	width, maxHeight int,
	barColor color.Color,
) string

func (*Theme) RenderVerticalHistogramWithColor

func (t *Theme) RenderVerticalHistogramWithColor(
	title string,
	buckets []HistBucket,
	width, maxHeight int,
	barColor color.Color,
) string

func (*Theme) RenderVerticalStackedHistogramBody

func (t *Theme) RenderVerticalStackedHistogramBody(
	buckets []StackedHistBucket,
	width, maxHeight int,
	yLabel func(int) string,
) string

type TurnBarColumn

type TurnBarColumn struct {
	Start         int
	End           int
	Anchor        int
	Position      int
	StartPosition int
	EndPosition   int
	Height        int
}

func TurnBarColumns

func TurnBarColumns(
	metrics []statspkg.PositionTokenMetrics,
	graphWidth, plotHeight int,
	maxY float64,
	value func(statspkg.PositionTokenMetrics) float64,
) []TurnBarColumn

type UniformTurnBarLayout

type UniformTurnBarLayout struct {
	BarWidth int
	GapWidth int
	LeftPad  int
}

func ResolveUniformTurnBarLayout

func ResolveUniformTurnBarLayout(graphWidth, barCount int) (UniformTurnBarLayout, bool)

Jump to

Keyboard shortcuts

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