tui

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package tui implements the persistent Jira dashboard.

Architecture mirrors pagerduty-client/internal/tui:

  • App is a value-typed Bubble Tea root model owning all sub-models, overlays and the global key map.
  • WindowSizeMsg cascades down a single source of truth (bodyH) to every child so layout never drifts.
  • Update routes overlay keys first (cascade), then global keys, then per-view actions, then forwards unhandled keys to the active view.
  • View composes header / body / footer zones and layers overlays.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyTheme

func ApplyTheme(th *clibtheme.Theme)

func DefaultHelpRenderer

func DefaultHelpRenderer() key.Renderer

func RenderShell

func RenderShell(width, height int, body, footer string) string

func ResolveTheme

func ResolveTheme(name string) *clibtheme.Theme

func Run

func Run(ctx context.Context) (tea.Model, error)

Run starts the program with default options.

func RunWithOptions

func RunWithOptions(ctx context.Context, opts Options) (tea.Model, error)

RunWithOptions starts a Bubble Tea program with the given options.

Types

type App

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

App is the root Bubble Tea model.

func New

func New(ctx context.Context) App

New constructs an App using default options.

func NewWithOptions

func NewWithOptions(ctx context.Context, opts Options) App

NewWithOptions builds an App wired to the supplied provider/services.

func (App) ActiveProfile

func (a App) ActiveProfile() string

ActiveProfile returns the currently selected profile name.

func (App) ActiveTab

func (a App) ActiveTab() string

ActiveTab returns the id of the currently active dashboard tab.

func (App) Cursor

func (a App) Cursor() int

Cursor exposes the list cursor for legacy tests; returns 0 in the new design (cursor is internal to the issuesList view).

func (App) Filter

func (a App) Filter() string

Filter returns the active filter string from the issue list.

func (App) HelpVisible

func (a App) HelpVisible() bool

HelpVisible reports whether the help overlay is currently shown.

func (App) Init

func (a App) Init() tea.Cmd

Init implements tea.Model.

func (App) LastAction

func (a App) LastAction() string

LastAction returns the current view name as a coarse intent label (kept for legacy callers; the prior ad-hoc string field is gone).

func (*App) SetFilter

func (a *App) SetFilter(value string)

SetFilter pre-populates the issue list filter; used by tests.

func (App) Update

func (a App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (App) View

func (a App) View() tea.View

View implements tea.Model.

type Dashboard

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

Dashboard wraps the issues list view and forwards the body region's WindowSizeMsg to it. Mirrors pdc/internal/tui/dashboard.go: the wrapper owns no chrome — header, status bar and overlays live at App level.

func (Dashboard) FilterActive

func (d Dashboard) FilterActive() bool

FilterActive reports whether the list filter input is focused.

func (Dashboard) Init

func (d Dashboard) Init() tea.Cmd

func (Dashboard) SelectedIssue

func (d Dashboard) SelectedIssue() *jira.Issue

SelectedIssue returns the currently highlighted issue, if any.

func (*Dashboard) SetIssues

func (d *Dashboard) SetIssues(issues []*jira.Issue)

SetIssues updates the list with fresh data.

func (Dashboard) Update

func (d Dashboard) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Dashboard) View

func (d Dashboard) View() tea.View

type IssueProvider

type IssueProvider interface {
	ListIssues(context.Context) ([]*jira.Issue, error)
}

IssueProvider supplies issues for the dashboard list. (Preserved from prior API for cmd/jira/tui.go integration.)

type IssueProviderFunc

type IssueProviderFunc func(context.Context) ([]*jira.Issue, error)

IssueProviderFunc adapts a function to IssueProvider.

func (IssueProviderFunc) ListIssues

func (f IssueProviderFunc) ListIssues(ctx context.Context) ([]*jira.Issue, error)

ListIssues calls the wrapped function.

type IssueSelected

type IssueSelected struct {
	Issue jira.Issue
}

IssueSelected is emitted by the issue list when the user opens a row.

type MutationService

MutationService is the seam for issue mutations triggered from the TUI. (Preserved from prior API.)

type Options

type Options struct {
	IssueProvider   IssueProvider
	MutationService MutationService
	InitialError    string
	Profiles        []string
	ActiveProfile   string
	BaseURL         string
	RefreshEvery    time.Duration
	Theme           string
	// Identity used to resolve "me" / "team" filters in the issues tab.
	// Email is matched against assignee.email_address (Jira Cloud).
	// AccountID is matched against assignee.account_id when known.
	// TeamAccountIDs lists teammates whose issues count as "my team".
	Email          string
	AccountID      string
	TeamAccountIDs []string
}

Options configures a TUI run.

type SubmitCloneMsg

type SubmitCloneMsg struct {
	IssueKey string
	Request  *jira.IssueCloneRequest
}

type SubmitCommentMsg

type SubmitCommentMsg struct {
	IssueKey string
	Body     adf.Document
}

type SubmitCreateMsg

type SubmitCreateMsg struct {
	Request *jira.IssueCreateRequest
}

type SubmitDeleteMsg

type SubmitDeleteMsg struct {
	IssueKey string
	Confirm  bool
}

type SubmitEditMsg

type SubmitEditMsg struct {
	IssueKey string
	Fields   map[string]any
}

type SubmitMoveMsg

type SubmitMoveMsg struct {
	IssueKey string
	Request  *jira.IssueMoveRequest
}

type SubmitTransitionMsg

type SubmitTransitionMsg struct {
	IssueKey     string
	TransitionID string
	Fields       map[string]any
}

type SubmitWorklogMsg

type SubmitWorklogMsg struct {
	IssueKey         string
	TimeSpentSeconds int
	Started          string
	Comment          *adf.Document
}

Directories

Path Synopsis
Package components contains reusable Bubble Tea overlays and chrome for the Jira TUI.
Package components contains reusable Bubble Tea overlays and chrome for the Jira TUI.
Package editor is the in-TUI ADF-native rich-text editor.
Package editor is the in-TUI ADF-native rich-text editor.
Package theme defines lipgloss styles shared across the Jira TUI.
Package theme defines lipgloss styles shared across the Jira TUI.

Jump to

Keyboard shortcuts

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