Documentation
¶
Overview ¶
Package tasks embeds the Tasks GTD terminal UI as a sidecar plugin, giving the full standalone experience — views, overlays, agent queue — inside a tab.
Index ¶
- func IsRootContext(context string) bool
- func IsTasksContext(context string) bool
- func IsTextInputContext(context string) bool
- type Plugin
- func (p *Plugin) BlocksGlobalKeys() bool
- func (p *Plugin) ClaimsKey(key string) bool
- func (p *Plugin) Commands() []plugin.Command
- func (p *Plugin) ConsumesTextInput() bool
- func (p *Plugin) ContentLinkSurfaces() []contentlink.Surface
- func (p *Plugin) Diagnostics() []plugin.Diagnostic
- func (p *Plugin) FocusContext() string
- func (p *Plugin) FooterStatus() (string, bool)
- func (p *Plugin) ID() string
- func (p *Plugin) Icon() string
- func (p *Plugin) Init(ctx *plugin.Context) error
- func (p *Plugin) IsFocused() bool
- func (p *Plugin) Name() string
- func (p *Plugin) PaneFocus() string
- func (p *Plugin) PaneFocusStops() []plugin.PaneFocusStop
- func (p *Plugin) QuitKeyExits() bool
- func (p *Plugin) SetFocused(f bool)
- func (p *Plugin) SetPaneFocus(id string) tea.Cmd
- func (p *Plugin) SetPaneFocusActive(active bool)
- func (p *Plugin) Start() tea.Cmd
- func (p *Plugin) Stop()
- func (p *Plugin) Update(msg tea.Msg) (plugin.Plugin, tea.Cmd)
- func (p *Plugin) View(width, height int) string
- type TasksReadyMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRootContext ¶
IsRootContext reports whether `q` in a Tasks context should reach sidecar's quit flow rather than the tab. Unknown contexts are not root: see rootContexts.
func IsTasksContext ¶
IsTasksContext reports whether a sidecar focus context belongs to the Tasks tab.
func IsTextInputContext ¶
IsTextInputContext reports whether a Tasks context routes printable keys into an editor widget. It is derived from Tasks' exported context metadata rather than from a list maintained here.
Types ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin wraps the Tasks TUI as a sidecar plugin. Tasks keeps ownership of its configuration, storage, rendering, overlays, and agent queue; the plugin owns only placement and lifecycle.
func (*Plugin) BlocksGlobalKeys ¶
BlocksGlobalKeys implements plugin.KeyRouter. Tasks' own overlays — modals, pickers, prompts, the agent activity list, and every text-input layer — own the keyboard while they are open, so sidecar's global keys must not fire underneath them.
Root contexts are listed (see rootContexts); everything else, INCLUDING an unknown context, is an overlay. A new Tasks overlay therefore routes safely without a change here, and the cost of the conservative default is a sidecar global that does not fire, never a quit out from under an open layer.
func (*Plugin) ClaimsKey ¶
ClaimsKey implements plugin.KeyRouter: the key has a live Tasks binding in the current context, so Tasks wins it over sidecar's global binding.
This is what makes `@`, `tab`, `M`, and `A` mean what they mean in Tasks while the tab is focused. Three rules decide it, in order:
- Host-reserved keys are never claimed (see hostReservedKeys; sidecar enforces the same set, this is defence in depth).
- A key sidecar binds globally is claimed only if the plan's conflict table decided that collision (mayShadowGlobal), and then unconditionally for the whole context (claimIsUnconditional) — so `K`, `W`, `#` and the number row keep their sidecar meanings, and `@` keeps its Tasks meaning no matter what is selected. Tasks' views step with `←`/`→` instead.
- Every other key is availability-aware: one whose only Tasks commands are unavailable right now is not claimed and falls through to sidecar. That is how `r` still refreshes when there is no proposal to reject and no recurrence to edit.
func (*Plugin) Commands ¶
Commands projects Tasks' exported command registry into sidecar commands. Tasks is the single source of truth; sidecar adds categorization and the handler that runs the command by its stable ID.
Commands belonging to the context Tasks is in right now are filtered by CommandAvailable, so the conditional pairs that share a key (`r` is either reject-proposal or open-recur-popup, never both) do not both appear in the palette. Commands for other contexts are kept: CommandAvailable answers for the live focus only, and the palette's other layers are still real help.
func (*Plugin) ConsumesTextInput ¶
ConsumesTextInput reports whether printable keys belong to Tasks input.
func (*Plugin) ContentLinkSurfaces ¶ added in v1.2.0
func (p *Plugin) ContentLinkSurfaces() []contentlink.Surface
ContentLinkSurfaces stays empty until Tasks exports exact passive text rectangles. Its current spatial rectangles include rows and prompt/detail controls, so whole-frame scanning is intentionally unsafe.
func (*Plugin) Diagnostics ¶
func (p *Plugin) Diagnostics() []plugin.Diagnostic
Diagnostics returns plugin health info.
A live model whose store cannot be read reports as an error even though the tab still renders. Tasks paints the user-facing banner (see storeReadHint); Diagnostics is where sidecar records the same condition for `sidecar doctor` and the logs, which is the surface Tasks' banner cannot reach.
func (*Plugin) FocusContext ¶
FocusContext returns the interaction layer currently consuming keys, as reported by Tasks itself.
func (*Plugin) FooterStatus ¶
FooterStatus implements plugin.FooterStatusProvider.
Tasks still paints its own store-read banner — sidecar suppresses only the key-hint row — but that banner lives inside the tab, which is not where a user looks when they are on another tab or reading the chrome. Restating it in the host footer is what keeps "what you are looking at is not your task list" visible at a glance. It is reported here as well as in Diagnostics because the diagnostics modal is a place you have to think to look.
A live sidecar toast outranks it (see renderFooter): the toast expires and this condition does not, so it comes straight back.
func (*Plugin) Init ¶
Init initializes the plugin with context. It deliberately performs no I/O: no configuration walk, no store open, no agent process. All of that happens in the command returned by Start(), after the first frame.
func (*Plugin) PaneFocusStops ¶ added in v1.2.0
func (p *Plugin) PaneFocusStops() []plugin.PaneFocusStop
PaneFocusStops projects Tasks' visible list/detail panes in rendered order. Prompt input and overlays own Tab, so the outer ring disappears while they are active instead of replaying or double-handling the key.
func (*Plugin) QuitKeyExits ¶
QuitKeyExits implements plugin.KeyRouter. In a Tasks root context `q` is sidecar's quit; inside a Tasks overlay it is the overlay's own dismissal, and BlocksGlobalKeys has already routed it there.
func (*Plugin) SetPaneFocus ¶ added in v1.2.0
SetPaneFocus delegates to Tasks' direct focus contract. Unknown, hidden, or input-owned stops are refused by the embedded model without mutation.
func (*Plugin) SetPaneFocusActive ¶ added in v1.2.0
func (*Plugin) Stop ¶
func (p *Plugin) Stop()
Stop closes the embedded model, which saves the sidecar session and shuts down the Tasks agent queue.
Close, not Discard: this is the model the host actually presented, so the view and filters the user left it on are exactly the state the next lifecycle should reload.
type TasksReadyMsg ¶
type TasksReadyMsg struct {
Epoch uint64
// Generation is the plugin lifecycle this build belongs to. It makes
// staleness structural instead of dependent on the host bumping Epoch.
Generation uint64
Model *tasksui.Model
Err error
}
TasksReadyMsg carries the embedded Tasks model once it has been built.
func (TasksReadyMsg) GetEpoch ¶
func (m TasksReadyMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.