tui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: CC0-1.0 Imports: 28 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tui provides Taskronin's terminal user interface through the client API.

Index

Constants

View Source
const DefaultPollInterval = 5 * time.Second

DefaultPollInterval is the dashboard refresh interval (A§14 D25).

Variables

View Source
var ErrUsage = errors.New("usage")

ErrUsage identifies invalid launch options before the terminal is opened.

Functions

func Run

func Run(ctx context.Context, o RunOptions) error

Run checks server connectivity and launch options, then owns the terminal until the app quits or ctx is canceled.

Types

type API

type API interface {
	Clock(ctx context.Context) (*api.Clock, error)
	Generation(ctx context.Context) (string, error)
	RefreshGeneration(ctx context.Context) (string, error)
	Today(ctx context.Context, ifNoneMatch string) (t *api.Today, etag string, notModified bool, err error)
	Day(ctx context.Context, d civil.Date) (*api.Day, error)
	Upcoming(ctx context.Context) (*api.Upcoming, error)
	Search(ctx context.Context, q client.SearchQuery) (*api.Page[api.SearchHit], error)
	ListTasks(ctx context.Context, q client.TaskQuery) (*api.Page[api.Task], error)
	GetTask(ctx context.Context, id int64) (*api.TaskDetail, error)
	TaskHistory(ctx context.Context, id int64, p client.PageQuery) (*api.Page[api.EventView], error)
	ListEntries(ctx context.Context, q client.EntryQuery) (*api.Page[api.Entry], error)
	ListBlocks(ctx context.Context, q client.BlockQuery) ([]api.Block, error)
	AIChanges(ctx context.Context, all bool, p client.PageQuery) (*api.AIChanges, error)
	AddTask(ctx context.Context, m client.Mut, r api.AddTaskRequest) (*api.OpResponse, error)
	UpdateTask(ctx context.Context, m client.Mut, id int64, r api.UpdateTaskRequest) (*api.OpResponse, error)
	PlaceTask(ctx context.Context, m client.Mut, id int64, r api.PlaceRequest) (*api.OpResponse, error)
	DeferTask(ctx context.Context, m client.Mut, id int64, r api.DeferRequest) (*api.OpResponse, error)
	BlockTask(ctx context.Context, m client.Mut, id int64, r api.BlockRequest) (*api.OpResponse, error)
	CompleteTask(ctx context.Context, m client.Mut, id int64, r api.CompleteRequest) (*api.OpResponse, error)
	DropTask(ctx context.Context, m client.Mut, id int64) (*api.OpResponse, error)
	AcceptNew(ctx context.Context, m client.Mut, r api.AcceptNewRequest) (*api.OpResponse, error)
	AddEntry(ctx context.Context, m client.Mut, r api.AddEntryRequest) (*api.OpResponse, error)
	UpdateEntry(ctx context.Context, m client.Mut, id int64, r api.UpdateEntryRequest) (*api.OpResponse, error)
	RelinkEntry(ctx context.Context, m client.Mut, id int64, r api.RelinkRequest) (*api.OpResponse, error)
	DeleteEntry(ctx context.Context, m client.Mut, id int64) (*api.OpResponse, error)
	Reblock(ctx context.Context, m client.Mut, blockID int64, r api.ReblockRequest) (*api.OpResponse, error)
	Unblock(ctx context.Context, m client.Mut, blockID int64) (*api.OpResponse, error)
	SetOutcome(ctx context.Context, m client.Mut, blockID int64, r api.OutcomeRequest) (*api.OpResponse, error)
	SetFocus(ctx context.Context, m client.Mut, r api.FocusRequest) (*api.OpResponse, error)
	Revert(ctx context.Context, m client.Mut, opID string) (*api.OpResponse, error)
	Undo(ctx context.Context, m client.Mut) (*api.OpResponse, error)
	Redo(ctx context.Context, m client.Mut) (*api.OpResponse, error)
	ReviewAIChanges(ctx context.Context, m client.Mut, r api.ReviewRequest) (*api.OpResponse, error)
}

API is the subset of client.Client used by the terminal user interface.

type App

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

App owns the terminal UI. Only Update and its helpers change model state.

func NewApp

func NewApp(cfg Config) *App

NewApp constructs the app, leaving placeholders for subsequent TUI tasks.

func (*App) Init

func (a *App) Init() tea.Cmd

Init starts the aggregate and visible-screen reads and the polling timer.

func (*App) Update

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

Update handles app messages, then forwards screen-owned data messages.

func (*App) View

func (a *App) View() tea.View

View renders a bounded alternate-screen frame, with prompts above the footer.

type Config

type Config struct {
	API          API
	Ctx          context.Context
	Clock        api.Clock
	StartTab     Tab
	StartMode    Mode
	RecapDate    civil.Date
	PollInterval time.Duration
	Color        bool
	Editor       EditorEnv
}

Config supplies the app's client, server clock and launch options.

type EditorEnv

type EditorEnv struct {
	Setting   string
	Getenv    func(string) string
	DraftsDir string
	Exec      func(*exec.Cmd, tea.ExecCallback) tea.Cmd
}

EditorEnv supplies editor configuration and the process runner.

type Mode

type Mode int

Mode identifies an interactive workflow, or the normal tabbed view.

const (
	ModeTabs Mode = iota
	ModeTriage
	ModePlan
	ModeRecap
)

Interactive workflows available from the tabbed app or at startup.

type RunOptions

type RunOptions struct {
	API       API
	StartTab  Tab
	StartMode Mode
	RecapSpec string // Past-mode date only; empty means today.
	Color     bool
	Editor    EditorEnv
	In        io.Reader
	Out       io.Writer
}

RunOptions supplies the client, initial view and terminal dependencies.

type Styles

type Styles struct {
	Header, TabOn, TabOnBar, TabOff, Selected, Dim, Warn, Err, Info, Current lipgloss.Style
	ID, OK, Bad, Head                                                        lipgloss.Style
	Box                                                                      boxChars
}

Styles contains only trusted presentation; sanitize user text before rendering.

type Tab

type Tab int

Tab identifies one of the five main views.

const (
	TabToday Tab = iota
	TabTriage
	TabBacklog
	TabUpcoming
	TabLog
)

Main tabs, in display order.

func ParseTab

func ParseTab(s string) (Tab, error)

ParseTab accepts the tab names used by the CLI.

Jump to

Keyboard shortcuts

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