Documentation
¶
Overview ¶
Package tui exposes the Tasks terminal UI as an embeddable Bubble Tea v2 component. Tasks continues to own configuration, persistence, rendering, and agent processes; a host owns placement, lifecycle, and any surrounding UI.
Index ¶
- type Binding
- type Command
- type ContextMetadata
- type EmbeddedOptions
- type FocusContext
- type Model
- func (m *Model) ClearQuitRequest()
- func (m *Model) Close() error
- func (m *Model) CommandAvailable(commandID string) (bool, error)
- func (m *Model) ConsumesTextInput() bool
- func (m *Model) Contexts() []string
- func (m *Model) CurrentView() View
- func (m *Model) FocusContext() FocusContext
- func (m *Model) Init() tea.Cmd
- func (m *Model) Invoke(commandID string) (tea.Cmd, error)
- func (m *Model) QuitRequested() bool
- func (m *Model) Update(message tea.Msg) (*Model, tea.Cmd)
- func (m *Model) View(width, height int) string
- func (m *Model) Warnings() []string
- type ThemeOptions
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding struct {
Key string
CommandID string
Context FocusContext
}
Binding is a default Bubble Tea key name mapped to a Tasks command.
func ExportBindings ¶
func ExportBindings() []Binding
ExportBindings projects the single Tasks shortcut registry for host keymaps.
type Command ¶
type Command struct {
ID string
Description string
Context FocusContext
DefaultBindings []string
}
Command is Tasks-owned command metadata for host palettes and footers.
func ExportCommands ¶
func ExportCommands() []Command
ExportCommands projects the same registry for host palettes and footers.
type ContextMetadata ¶
type ContextMetadata struct {
Name FocusContext
ConsumesTextInput bool
}
ContextMetadata describes a host key-routing context. Contexts backed by an input widget may contain only the global shortcut bindings.
func ExportContexts ¶
func ExportContexts() []ContextMetadata
ExportContexts lists every stable Tasks host context, including input-only layers whose keystrokes are interpreted by their owning editor widget.
type EmbeddedOptions ¶
type EmbeddedOptions struct {
SessionNamespace string
InitialView View
InitialContexts []string
SuppressQuit bool
Theme ThemeOptions
Environment map[string]string
}
EmbeddedOptions configures a host-owned Tasks component. SessionNamespace is required so embedding can never overwrite the standalone tasks-tui session. Environment is primarily a deterministic/test seam; nil snapshots os.Environ.
type FocusContext ¶
type FocusContext string
FocusContext names the interaction layer currently consuming keys.
const ( FocusList FocusContext = "tasks-list" FocusDetail FocusContext = "tasks-detail" FocusTaskEdit FocusContext = "tasks-task-edit" FocusModal FocusContext = "tasks-modal" FocusModalFilter FocusContext = "tasks-modal-filter" FocusForm FocusContext = "tasks-form" FocusPicker FocusContext = "tasks-picker" FocusContextPicker FocusContext = "tasks-context-picker" FocusFilter FocusContext = "tasks-filter" FocusPrompt FocusContext = "tasks-prompt" FocusResponse FocusContext = "tasks-response" FocusResponseDetail FocusContext = "tasks-response-detail" FocusAgentActivity FocusContext = "tasks-agent-activity" FocusAgentActivityFilter FocusContext = "tasks-agent-activity-filter" )
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is an embeddable Tasks TUI. It intentionally does not expose the internal model or store; hosts exchange only Bubble Tea messages and strings.
func NewEmbedded ¶
func NewEmbedded(options EmbeddedOptions) (*Model, error)
NewEmbedded resolves the normal Tasks configuration and builds the same application, renderer, provider registry, and agent queue as tasks-tui.
func (*Model) ClearQuitRequest ¶
func (m *Model) ClearQuitRequest()
ClearQuitRequest acknowledges a nested quit request without closing Tasks.
func (*Model) Close ¶
Close saves the host-specific session and shuts down the Tasks agent queue. It is safe to call more than once.
func (*Model) CommandAvailable ¶
CommandAvailable evaluates one exported command against the model's current focus and live selection. It distinguishes conditional commands that share a default key.
func (*Model) ConsumesTextInput ¶
ConsumesTextInput reports whether printable keys belong to Tasks input.
func (*Model) CurrentView ¶
CurrentView reports the active Tasks view.
func (*Model) FocusContext ¶
func (m *Model) FocusContext() FocusContext
FocusContext is the stable Tasks interaction context for host key routing.
func (*Model) Invoke ¶
Invoke executes one available exported command by stable ID, without replaying a possibly ambiguous default key.
func (*Model) QuitRequested ¶
QuitRequested reports a nested quit request for the host to handle.
func (*Model) Update ¶
Update passes a Bubble Tea v2 message into Tasks. Nested quit never returns tea.Quit; use QuitRequested to observe a non-suppressed request.
type ThemeOptions ¶
ThemeOptions are Tasks semantic theme values, independent of any host UI.