monitor

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package monitor provides the TUI monitor for td.

Index

Constants

View Source
const (
	MinWidth  = 40
	MinHeight = 15
)

Minimum dimensions for the monitor

Variables

View Source
var DimStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("242"))

DimStyle applies a dim gray color to background content behind modals. We strip existing ANSI codes and apply gray because SGR 2 (faint) doesn't reliably combine with existing color codes in most terminals.

Functions

func ComputeBoardIssueCategories added in v0.10.0

func ComputeBoardIssueCategories(database *db.DB, issues []models.BoardIssueView, sessionID string, precomputedRejectedIDs map[string]bool)

ComputeBoardIssueCategories sets the Category field on each BoardIssueView. This is the single source of truth for issue categorization, considering dependency blocking, rejection status, and reviewability. If precomputedRejectedIDs is non-nil, it's used instead of querying the DB.

func DefaultBoardStatusFilter added in v0.10.0

func DefaultBoardStatusFilter() map[models.Status]bool

DefaultBoardStatusFilter returns the default status filter (closed hidden)

func OverlayModal added in v0.4.20

func OverlayModal(background, modal string, width, height int) string

OverlayModal composites a modal on top of a dimmed background. The modal is centered, with dimmed background visible on all sides.

func StatusFilterMapToSlice added in v0.10.0

func StatusFilterMapToSlice(filter map[models.Status]bool) []models.Status

StatusFilterMapToSlice converts a map[Status]bool to []Status for DB calls

Types

type ActivityItem

type ActivityItem struct {
	Timestamp  time.Time
	SessionID  string
	Type       string // "log", "action", "comment"
	IssueID    string
	IssueTitle string // title of the associated issue
	Message    string
	LogType    models.LogType    // for logs
	Action     models.ActionType // for actions
}

ActivityItem represents a unified activity item (log, action, or comment)

type BoardIssuesMsg added in v0.10.0

type BoardIssuesMsg struct {
	BoardID     string
	Issues      []models.BoardIssueView
	RejectedIDs map[string]bool // pre-computed to avoid sync query in Update
	Error       error
}

BoardIssuesMsg carries issues for the current board

type BoardMode added in v0.10.0

type BoardMode struct {
	Board        *models.Board           // Currently active board
	Issues       []models.BoardIssueView // Issues in the board (for backlog view)
	Cursor       int                     // Selected issue index (backlog view)
	ScrollOffset int                     // Scroll offset for long lists (backlog view)
	StatusFilter map[models.Status]bool  // Status filter (true = visible)

	// View mode toggle (swimlanes vs backlog)
	ViewMode BoardViewMode // Current view mode

	// Swimlanes view state (separate cursor/scroll from backlog)
	SwimlaneData   TaskListData  // Categorized data for swimlanes view
	SwimlaneRows   []TaskListRow // Flattened rows for swimlanes view
	SwimlaneCursor int           // Cursor position in swimlanes view
	SwimlaneScroll int           // Scroll offset in swimlanes view

	// Selection restoration after move operations
	PendingSelectionID string // Issue ID to select after refresh (cleared after use)
}

BoardMode holds state for board mode view (when Task List is in board mode)

type BoardViewMode added in v0.10.0

type BoardViewMode int

BoardViewMode represents the display mode within a board

const (
	BoardViewSwimlanes BoardViewMode = iota // Default: grouped by status categories
	BoardViewBacklog                        // Flat list with position ordering
)

func BoardViewModeFromString added in v0.10.0

func BoardViewModeFromString(s string) BoardViewMode

FromString parses a view mode string (from database)

func (BoardViewMode) String added in v0.10.0

func (v BoardViewMode) String() string

String returns the display name for the view mode

type BoardsDataMsg added in v0.10.0

type BoardsDataMsg struct {
	Boards []models.Board
	Error  error
}

BoardsDataMsg carries fetched boards data

type ClearStatusMsg added in v0.4.12

type ClearStatusMsg struct{}

ClearStatusMsg clears the status message

type EditorField added in v0.4.16

type EditorField int

EditorField identifies which form field is being edited externally

const (
	EditorFieldDescription EditorField = iota
	EditorFieldAcceptance
)

type EditorFinishedMsg added in v0.4.16

type EditorFinishedMsg struct {
	Field   EditorField
	Content string
	Error   error
}

EditorFinishedMsg carries the result from external editor

type EmbeddedOptions added in v0.11.0

type EmbeddedOptions struct {
	BaseDir       string        // Base directory for database and config
	Interval      time.Duration // Refresh interval
	Version       string        // Version string for display
	PanelRenderer PanelRenderer // Custom panel border renderer (nil = default lipgloss)
	ModalRenderer ModalRenderer // Custom modal border renderer (nil = default lipgloss)

	// MarkdownTheme configures markdown rendering to share themes with embedder.
	// Pass colors from your theme to get consistent syntax highlighting.
	// If nil, uses td's default ANSI 256 color palette.
	MarkdownTheme *MarkdownThemeConfig
}

EmbeddedOptions configures an embedded monitor model.

type FirstRunCheckMsg added in v0.22.0

type FirstRunCheckMsg struct {
	IsFirstRun      bool   // true if should show getting started modal
	AgentFilePath   string // detected file path (may be empty)
	HasInstructions bool   // true if agent file already has td instructions
}

FirstRunCheckMsg carries the result of checking for first-time user setup.

type FormMode added in v0.4.14

type FormMode string

FormMode represents the mode of the form

const (
	FormModeCreate FormMode = "create"
	FormModeEdit   FormMode = "edit"
)

type FormState added in v0.4.14

type FormState struct {
	Mode     FormMode
	Form     *huh.Form
	IssueID  string // For edit mode - the issue being edited
	ParentID string // For create mode - auto-populated parent epic

	// Bound form values (standard fields)
	Title       string
	Type        string
	Priority    string
	Description string
	Labels      string // Comma-separated

	// Extended fields (toggled with Tab)
	ShowExtended bool
	Parent       string // Parent epic ID
	Points       string // String for select options
	Acceptance   string
	Minor        bool
	Dependencies string // Comma-separated issue IDs

	// Button focus: -1 = form fields focused, 0 = submit, 1 = cancel
	ButtonFocus int
	ButtonHover int // 0 = none, 1 = submit, 2 = cancel
}

FormState holds the state for the issue form modal

func NewFormState added in v0.4.14

func NewFormState(mode FormMode, parentID string) *FormState

NewFormState creates a new form state for creating an issue

func NewFormStateForEdit added in v0.4.14

func NewFormStateForEdit(issue *models.Issue) *FormState

NewFormStateForEdit creates a form state populated with existing issue data

func (*FormState) GetDependencies added in v0.4.14

func (fs *FormState) GetDependencies() []string

GetDependencies returns parsed dependency IDs

func (*FormState) ToIssue added in v0.4.14

func (fs *FormState) ToIssue() *models.Issue

ToIssue converts form values to an Issue model

func (*FormState) ToggleExtended added in v0.4.14

func (fs *FormState) ToggleExtended()

ToggleExtended toggles the extended fields visibility and rebuilds the form

type HandoffsDataMsg added in v0.4.12

type HandoffsDataMsg struct {
	Data  []models.Handoff
	Error error
}

HandoffsDataMsg carries fetched handoffs data for the modal

type InstallInstructionsResultMsg added in v0.22.0

type InstallInstructionsResultMsg struct {
	Success bool
	Message string // e.g. "Added td instructions to AGENTS.md"
}

InstallInstructionsResultMsg carries the result of installing agent instructions.

type IssueDetailsMsg

type IssueDetailsMsg struct {
	IssueID    string
	Issue      *models.Issue
	Handoff    *models.Handoff
	Logs       []models.Log
	Comments   []models.Comment
	BlockedBy  []models.Issue // Dependencies (issues blocking this one)
	Blocks     []models.Issue // Dependents (issues blocked by this one)
	EpicTasks  []models.Issue // Child tasks (when issue is an epic)
	ParentEpic *models.Issue  // Parent epic (when issue.ParentID is set)
	Error      error
}

IssueDetailsMsg carries fetched issue details for the modal

type MarkdownColorPalette added in v0.14.0

type MarkdownColorPalette struct {
	Primary   string // Keywords, functions, links - e.g., "#7C3AED"
	Secondary string // Strings, secondary headers - e.g., "#3B82F6"
	Success   string // Comments - e.g., "#10B981"
	Warning   string // Numbers, literals, inline code - e.g., "#F59E0B"
	Error     string // Errors, deleted - e.g., "#EF4444"
	Muted     string // Punctuation, subtle text - e.g., "#6B7280"
	Text      string // Primary text - e.g., "#F9FAFB"
	BgCode    string // Code block background - e.g., "#374151"
}

MarkdownColorPalette holds hex colors for markdown styling. Colors should be in #RRGGBB format.

type MarkdownRenderedMsg

type MarkdownRenderedMsg struct {
	IssueID      string
	DescRender   string
	AcceptRender string
}

MarkdownRenderedMsg carries pre-rendered markdown for the modal

type MarkdownThemeConfig added in v0.14.0

type MarkdownThemeConfig struct {
	// SyntaxTheme is a Chroma theme name (e.g., "monokai", "dracula", "github-dark").
	// When set, uses glamour's built-in style with this syntax theme.
	// See https://xyproto.github.io/splash/docs/ for available themes.
	SyntaxTheme string

	// MarkdownTheme is a glamour base theme ("dark" or "light").
	// Only used when SyntaxTheme is set.
	MarkdownTheme string

	// Colors provides explicit hex colors for custom styling.
	// When set (Primary != ""), builds a custom style from these colors.
	// Takes precedence over SyntaxTheme/MarkdownTheme.
	Colors *MarkdownColorPalette
}

MarkdownThemeConfig configures markdown rendering theme. Used by embedders (like sidecar) to share their theme with td.

type ModalEntry added in v0.4.9

type ModalEntry struct {
	// Core
	IssueID     string
	SourcePanel Panel // Only meaningful for base entry (depth 1)

	// Display
	Scroll       int
	ContentLines int // Cached content line count for scroll clamping

	// Async data
	Loading      bool
	Error        error
	Issue        *models.Issue
	Handoff      *models.Handoff
	Logs         []models.Log
	Comments     []models.Comment
	BlockedBy    []models.Issue
	Blocks       []models.Issue
	DescRender   string
	AcceptRender string

	// Epic-specific (when Issue.Type == "epic")
	EpicTasks          []models.Issue
	EpicTasksCursor    int
	TaskSectionFocused bool

	// Parent epic (when issue has ParentID pointing to an epic)
	ParentEpic        *models.Issue
	ParentEpicFocused bool

	// Navigation scope - when set, l/r navigates within this list instead of source panel
	// Used when opening issues from within an epic to scope navigation to siblings
	NavigationScope []models.Issue

	// Blocked-by section (dependencies blocking this issue)
	BlockedBySectionFocused bool
	BlockedByCursor         int

	// Blocks section (issues blocked by this one)
	BlocksSectionFocused bool
	BlocksCursor         int

	// Line tracking for mouse click support (set during render)
	BlockedByStartLine int // Line index where blocked-by section starts
	BlockedByEndLine   int // Line index where blocked-by section ends
	BlocksStartLine    int // Line index where blocks section starts
	BlocksEndLine      int // Line index where blocks section ends
}

ModalEntry represents a single modal in the stack

type ModalRenderer added in v0.11.0

type ModalRenderer func(content string, width, height int, modalType ModalType, depth int) string

ModalRenderer renders content in a modal box Used by embedders to inject custom modal styling (e.g., gradient borders)

type ModalType added in v0.11.0

type ModalType int

ModalType represents the type of modal for styling

const (
	ModalTypeIssue ModalType = iota
	ModalTypeHandoffs
	ModalTypeBoardPicker
	ModalTypeForm
	ModalTypeConfirmation
	ModalTypeStats
)

type Model

type Model struct {
	// Database and session
	DB        *db.DB
	SessionID string

	// Window dimensions
	Width  int
	Height int

	// Panel data
	FocusedIssue   *models.Issue
	InProgress     []models.Issue
	Activity       []ActivityItem
	TaskList       TaskListData
	RecentHandoffs []RecentHandoff // Handoffs since monitor started
	ActiveSessions []string        // Sessions with recent activity

	// UI state
	ActivePanel         Panel
	ScrollOffset        map[Panel]int
	Cursor              map[Panel]int    // Per-panel cursor position (selected row)
	SelectedID          map[Panel]string // Per-panel selected issue ID (preserved across refresh)
	ScrollIndependent   map[Panel]bool   // True when user scrolled viewport away from cursor
	HelpOpen            bool             // Whether help modal is open
	HelpScroll          int              // Current scroll position in help
	HelpTotalLines      int              // Cached total line count in help
	ShowTDQHelp         bool             // Show TDQ query syntax help (when in search mode)
	TDQHelpModal        *modal.Modal     // Declarative modal instance for TDQ help
	TDQHelpMouseHandler *mouse.Handler   // Mouse handler for TDQ help modal
	LastRefresh         time.Time
	StartedAt           time.Time // When monitor started, to track new handoffs
	Err                 error     // Last error, if any
	Embedded            bool      // When true, skip footer (embedded in sidecar)

	// Flattened rows for selection
	TaskListRows    []TaskListRow // Flattened task list for selection
	CurrentWorkRows []string      // Issue IDs for current work panel (focused + in-progress)

	// Modal stack for stacking modals (empty = no modal open)
	ModalStack []ModalEntry

	// Search state
	SearchMode     bool            // Whether search mode is active
	SearchQuery    string          // Current search query
	SearchInput    textinput.Model // Text input for search (cursor support)
	IncludeClosed  bool            // Whether to include closed tasks
	SortMode       SortMode        // Task list sort order
	TypeFilterMode TypeFilterMode  // Type filter (epic, task, bug, etc.)

	// Confirmation dialog state (delete confirmation)
	ConfirmOpen        bool
	ConfirmAction      string // "delete"
	ConfirmIssueID     string
	ConfirmTitle       string
	ConfirmButtonFocus int // 0=Yes, 1=No (for delete confirmation) - legacy, kept for compatibility
	ConfirmButtonHover int // 0=none, 1=Yes, 2=No - legacy, kept for compatibility

	// Declarative delete confirmation modal
	DeleteConfirmModal        *modal.Modal   // Declarative modal instance
	DeleteConfirmMouseHandler *mouse.Handler // Mouse handler for delete confirmation modal

	// Close confirmation dialog state
	CloseConfirmOpen        bool
	CloseConfirmIssueID     string
	CloseConfirmTitle       string
	CloseConfirmInput       textinput.Model
	CloseConfirmButtonFocus int // 0=input, 1=Confirm, 2=Cancel - legacy, kept for compatibility
	CloseConfirmButtonHover int // 0=none, 1=Confirm, 2=Cancel - legacy, kept for compatibility

	// Declarative close confirmation modal
	CloseConfirmModal        *modal.Modal   // Declarative modal instance
	CloseConfirmMouseHandler *mouse.Handler // Mouse handler for close confirmation modal

	// Stats modal state
	StatsOpen         bool
	StatsLoading      bool
	StatsData         *StatsData
	StatsScroll       int
	StatsError        error
	StatsModal        *modal.Modal   // Declarative modal instance
	StatsMouseHandler *mouse.Handler // Mouse handler for stats modal

	// Handoffs modal state
	HandoffsOpen         bool
	HandoffsLoading      bool
	HandoffsData         []models.Handoff
	HandoffsCursor       int
	HandoffsScroll       int
	HandoffsError        error
	HandoffsModal        *modal.Modal   // Declarative modal instance
	HandoffsMouseHandler *mouse.Handler // Mouse handler for handoffs modal

	// Form modal state
	FormOpen  bool
	FormState *FormState

	// Getting Started modal state
	GettingStartedOpen         bool           // Whether getting started modal is open
	GettingStartedModal        *modal.Modal   // Declarative modal instance
	GettingStartedMouseHandler *mouse.Handler // Mouse handler for getting started modal
	AgentFilePath              string         // Detected agent file path (may be empty)
	AgentFileHasTD             bool           // Whether agent file already has td instructions

	// Board picker state
	BoardPickerOpen         bool
	BoardPickerCursor       int
	BoardPickerHover        int // -1=none, 0+=hovered board index (legacy, used by modal)
	AllBoards               []models.Board
	BoardPickerModal        *modal.Modal   // Declarative modal instance
	BoardPickerMouseHandler *mouse.Handler // Mouse handler for board picker modal

	// Board mode state
	TaskListMode      TaskListMode       // Whether Task List shows categorized or board view
	BoardMode         BoardMode          // Active board mode state
	BoardStatusPreset StatusFilterPreset // Current status filter preset for cycling

	// Configuration
	RefreshInterval time.Duration

	// Keymap registry for keyboard shortcuts
	Keymap *keymap.Registry

	// Status message (temporary feedback, e.g., "Copied to clipboard")
	StatusMessage string
	StatusIsError bool // true for error messages, false for success

	// Version checking
	Version     string // Current version
	UpdateAvail *version.UpdateAvailableMsg

	// Mouse support - panel bounds for hit-testing
	PanelBounds    map[Panel]Rect
	HoverPanel     Panel     // Panel currently under mouse cursor (-1 for none)
	LastClickTime  time.Time // For double-click detection
	LastClickPanel Panel     // Panel of last click
	LastClickRow   int       // Row of last click

	// Pane resizing (drag-to-resize)
	PaneHeights      [3]float64 // Height ratios (sum=1.0)
	DividerBounds    [2]Rect    // Hit regions for the 2 dividers between 3 panes
	DraggingDivider  int        // -1 = not dragging, 0 = first divider, 1 = second
	DividerHover     int        // -1 = none, 0 or 1 = which divider is hovered
	DragStartY       int        // Y position when drag started
	DragStartHeights [3]float64 // Pane heights when drag started
	BaseDir          string     // Base directory for config persistence

	// Custom renderers (for embedding with custom theming)
	PanelRenderer PanelRenderer // Custom panel border renderer (nil = default lipgloss)
	ModalRenderer ModalRenderer // Custom modal border renderer (nil = default lipgloss)

	// Markdown theme (for embedding with shared theme)
	MarkdownTheme *MarkdownThemeConfig // Custom markdown/syntax theme (nil = default td colors)
}

Model is the main Bubble Tea model for the monitor TUI

func NewEmbedded

func NewEmbedded(baseDir string, interval time.Duration, ver string) (*Model, error)

NewEmbedded creates a monitor model for embedding in external applications. It uses a shared database connection pool to prevent connection leaks when Model values are copied in Update(). The caller must call Close() when done to release resources.

func NewEmbeddedWithOptions added in v0.11.0

func NewEmbeddedWithOptions(opts EmbeddedOptions) (*Model, error)

NewEmbeddedWithOptions creates a monitor model with custom options. It uses a shared database connection pool to prevent connection leaks when Model values are copied in Update(). The caller must call Close() when done to release resources.

func NewModel

func NewModel(database *db.DB, sessionID string, interval time.Duration, ver string, baseDir string) Model

NewModel creates a new monitor model

func (*Model) Close

func (m *Model) Close() error

Close releases resources held by an embedded monitor. Only call this if the model was created with NewEmbedded or NewEmbeddedWithOptions. For embedded monitors, this releases the reference to the shared database pool. The actual connection is only closed when all references are released.

func (Model) CurrentContextString added in v0.4.14

func (m Model) CurrentContextString() string

CurrentContextString returns the current keymap context as a sidecar-formatted string. This is used by sidecar's TD plugin to determine which shortcuts to display.

func (*Model) CurrentModal added in v0.4.9

func (m *Model) CurrentModal() *ModalEntry

CurrentModal returns a pointer to the current (top) modal entry, or nil if none

func (Model) HitTestDivider added in v0.4.16

func (m Model) HitTestDivider(x, y int) int

HitTestDivider returns which divider (0 or 1) contains the point, or -1 if none

func (Model) HitTestPanel added in v0.4.14

func (m Model) HitTestPanel(x, y int) Panel

HitTestPanel returns which panel contains the point (x, y), or -1 if none

func (Model) HitTestRow added in v0.4.14

func (m Model) HitTestRow(panel Panel, y int) int

HitTestRow returns the row index within a panel for a given y coordinate, or -1 if none. Accounts for scroll indicators, category headers, and separator lines.

func (Model) Init

func (m Model) Init() tea.Cmd

Init implements tea.Model

func (Model) ModalBreadcrumb added in v0.4.9

func (m Model) ModalBreadcrumb() string

ModalBreadcrumb returns a breadcrumb string for the modal stack

func (Model) ModalDepth added in v0.4.9

func (m Model) ModalDepth() int

ModalDepth returns the current modal stack depth (0 = no modal)

func (Model) ModalOpen

func (m Model) ModalOpen() bool

ModalOpen returns true if any modal is open

func (Model) ModalSourcePanel

func (m Model) ModalSourcePanel() Panel

ModalSourcePanel returns the source panel of the base modal (depth 1)

func (Model) SelectedIssueID

func (m Model) SelectedIssueID(panel Panel) string

SelectedIssueID returns the issue ID of the currently selected row in a panel

func (Model) Update

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

Update implements tea.Model

func (Model) View

func (m Model) View() string

View implements tea.Model

type PaneHeightsSavedMsg added in v0.4.16

type PaneHeightsSavedMsg struct {
	Error error
}

PaneHeightsSavedMsg is sent after pane heights are persisted to config

type Panel

type Panel int

Panel represents which panel is active

const (
	PanelCurrentWork Panel = iota
	PanelTaskList
	PanelActivity
)

type PanelRenderer added in v0.11.0

type PanelRenderer func(content string, width, height int, state PanelState) string

PanelRenderer renders content in a bordered panel Used by embedders to inject custom panel styling (e.g., gradient borders)

type PanelState added in v0.11.0

type PanelState int

PanelState represents the visual state of a panel for theming

const (
	PanelStateNormal PanelState = iota
	PanelStateActive
	PanelStateHover
	PanelStateDividerHover
	PanelStateDividerActive
)

type RecentHandoff

type RecentHandoff struct {
	IssueID   string
	SessionID string
	Timestamp time.Time
}

RecentHandoff represents a recent handoff for display

type Rect added in v0.4.14

type Rect struct {
	X, Y, W, H int
}

Rect represents a rectangular region for hit-testing

func (Rect) Contains added in v0.4.14

func (r Rect) Contains(x, y int) bool

Contains returns true if the point (x, y) is within the rectangle

type RefreshDataMsg

type RefreshDataMsg struct {
	FocusedIssue   *models.Issue
	InProgress     []models.Issue
	Activity       []ActivityItem
	TaskList       TaskListData
	RecentHandoffs []RecentHandoff
	ActiveSessions []string
	Timestamp      time.Time
}

RefreshDataMsg carries refreshed data

func FetchData

func FetchData(database *db.DB, sessionID string, startedAt time.Time, searchQuery string, includeClosed bool, sortMode SortMode) RefreshDataMsg

FetchData retrieves all data needed for the monitor display

type RestoreFilterMsg added in v0.12.3

type RestoreFilterMsg struct {
	SearchQuery    string
	SortMode       SortMode
	TypeFilterMode TypeFilterMode
	IncludeClosed  bool
}

RestoreFilterMsg is sent when restoring saved filter state on launch

type RestoreLastBoardMsg added in v0.10.0

type RestoreLastBoardMsg struct {
	Board *models.Board
}

RestoreLastBoardMsg is sent when restoring the last viewed board on launch

type SendTaskToWorktreeMsg added in v0.13.0

type SendTaskToWorktreeMsg struct {
	TaskID    string
	TaskTitle string
}

SendTaskToWorktreeMsg is emitted for embedding contexts to intercept. Contains minimal data needed for worktree creation.

type SortMode added in v0.4.9

type SortMode int

SortMode represents task list sorting

const (
	SortByPriority    SortMode = iota // Default: priority ASC
	SortByCreatedDesc                 // created_at DESC (newest first)
	SortByUpdatedDesc                 // updated_at DESC (recently changed first)
)

func SortModeFromString added in v0.12.3

func SortModeFromString(s string) SortMode

SortModeFromString parses a sort mode string

func (SortMode) String added in v0.4.9

func (s SortMode) String() string

String returns display name for sort mode

func (SortMode) ToDBOptions added in v0.4.9

func (s SortMode) ToDBOptions() (sortBy string, sortDesc bool)

ToDBOptions returns SortBy and SortDesc for ListIssuesOptions

func (SortMode) ToSortClause added in v0.4.15

func (s SortMode) ToSortClause() string

ToSortClause returns the TDQ sort clause string for this mode

type StatsData

type StatsData struct {
	ExtendedStats *models.ExtendedStats
	Error         error
}

StatsData holds statistics for the stats modal

type StatsDataMsg

type StatsDataMsg struct {
	Data  *StatsData
	Error error
}

StatsDataMsg carries fetched stats data

func FetchStats

func FetchStats(database *db.DB) StatsDataMsg

FetchStats retrieves extended statistics for the stats modal

type StatusFilterPreset added in v0.10.0

type StatusFilterPreset int

StatusFilterPreset represents a status filter preset for cycling

const (
	StatusPresetDefault    StatusFilterPreset = iota // open/in_progress/blocked/in_review
	StatusPresetAll                                  // all statuses
	StatusPresetOpen                                 // only open
	StatusPresetInProgress                           // only in_progress
	StatusPresetBlocked                              // only blocked
	StatusPresetInReview                             // only in_review
	StatusPresetClosed                               // only closed
)

func (StatusFilterPreset) Name added in v0.10.0

func (p StatusFilterPreset) Name() string

StatusFilterPresetName returns the display name for a preset

func (StatusFilterPreset) ToFilter added in v0.10.0

func (p StatusFilterPreset) ToFilter() map[models.Status]bool

ToFilter converts a preset to a status filter map

type TaskListCategory

type TaskListCategory string

TaskListCategory represents the category of a task list row

const (
	CategoryReviewable  TaskListCategory = "REVIEW"
	CategoryNeedsRework TaskListCategory = "REWORK"
	CategoryReady       TaskListCategory = "READY"
	CategoryBlocked     TaskListCategory = "BLOCKED"
	CategoryClosed      TaskListCategory = "CLOSED"
)

type TaskListData

type TaskListData struct {
	Ready       []models.Issue
	Reviewable  []models.Issue
	NeedsRework []models.Issue
	Blocked     []models.Issue
	Closed      []models.Issue
}

TaskListData holds categorized issues for the task list panel

func CategorizeBoardIssues added in v0.10.0

func CategorizeBoardIssues(database *db.DB, issues []models.BoardIssueView, sessionID string, sortMode SortMode, rejectedIDs map[string]bool) TaskListData

CategorizeBoardIssues takes board issues and groups them by status category for the swimlanes view. Issues are sorted within each category respecting backlog positions: positioned issues first (by position), then unpositioned (by sortMode). Also sets Category on each BoardIssueView. If rejectedIDs is non-nil, it's passed through to avoid a synchronous DB query.

type TaskListMode added in v0.10.0

type TaskListMode int

TaskListMode represents the display mode of the Task List panel

const (
	TaskListModeCategorized TaskListMode = iota // Default categorized view (Reviewable, Ready, Blocked, etc.)
	TaskListModeBoard                           // Board view with flat list and ordering
)

type TaskListRow

type TaskListRow struct {
	Issue    models.Issue
	Category TaskListCategory
}

TaskListRow represents a single selectable row in the task list panel

func BuildSwimlaneRows added in v0.10.0

func BuildSwimlaneRows(data TaskListData) []TaskListRow

BuildSwimlaneRows flattens categorized TaskListData into TaskListRow slice for cursor navigation in swimlanes view

type TickMsg

type TickMsg time.Time

TickMsg triggers a data refresh

type TypeFilterMode added in v0.4.16

type TypeFilterMode int

TypeFilterMode represents type filtering for the task list

const (
	TypeFilterNone    TypeFilterMode = iota // No type filter
	TypeFilterEpic                          // type=epic
	TypeFilterTask                          // type=task
	TypeFilterBug                           // type=bug
	TypeFilterFeature                       // type=feature
	TypeFilterChore                         // type=chore
)

func TypeFilterModeFromString added in v0.12.3

func TypeFilterModeFromString(s string) TypeFilterMode

TypeFilterModeFromString parses a type filter mode string

func (TypeFilterMode) String added in v0.4.16

func (t TypeFilterMode) String() string

String returns display name for type filter mode

func (TypeFilterMode) ToTypeClause added in v0.4.16

func (t TypeFilterMode) ToTypeClause() string

ToTypeClause returns the TDQ type clause string for this mode

Directories

Path Synopsis
Package modal provides a declarative modal dialog library with automatic hit region management for mouse support.
Package modal provides a declarative modal dialog library with automatic hit region management for mouse support.

Jump to

Keyboard shortcuts

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