Documentation
¶
Index ¶
- Constants
- type Action
- type BuildInfo
- type CommandEntry
- type CommandPalette
- func (p *CommandPalette) Cancelled() bool
- func (p *CommandPalette) IsFiltering() bool
- func (p *CommandPalette) KeyMap() []key.Binding
- func (p *CommandPalette) Overlay(background string, width, height int) string
- func (p *CommandPalette) SelectedCommand() (*CommandEntry, []string, bool)
- func (p *CommandPalette) Session() *session.Session
- func (p *CommandPalette) Update(msg tea.Msg) (*CommandPalette, tea.Cmd)
- func (p *CommandPalette) View() string
- type Deps
- type HiveDocReviewCmd
- type KVView
- func (v *KVView) AddFilterRune(r rune)
- func (v *KVView) CancelFilter()
- func (v *KVView) ConfirmFilter()
- func (v *KVView) DeleteFilterRune()
- func (v *KVView) IsFiltering() bool
- func (v *KVView) MoveDown()
- func (v *KVView) MoveUp()
- func (v *KVView) ScrollPreviewDown()
- func (v *KVView) ScrollPreviewUp()
- func (v *KVView) SelectedKey() string
- func (v *KVView) SetKeys(keys []string)
- func (v *KVView) SetPreview(entry *kv.Entry)
- func (v *KVView) SetSize(width, height int)
- func (v *KVView) StartFilter()
- func (v *KVView) View() string
- type KeybindingResolver
- func (h *KeybindingResolver) HelpEntries() []string
- func (h *KeybindingResolver) HelpString() string
- func (h *KeybindingResolver) IsAction(key string, t action.Type) bool
- func (h *KeybindingResolver) IsCommand(key string, cmdName string) bool
- func (h *KeybindingResolver) KeyBindings() []key.Binding
- func (h *KeybindingResolver) RenderWithFormData(name string, cmd config.UserCommand, sess session.Session, args []string, ...) Action
- func (h *KeybindingResolver) Resolve(key string, sess session.Session) (Action, bool)
- func (h *KeybindingResolver) ResolveFormCommand(key string, sess session.Session) (string, config.UserCommand, bool)
- func (h *KeybindingResolver) ResolveUserCommand(name string, cmd config.UserCommand, sess session.Session, args []string) Action
- func (h *KeybindingResolver) SetActiveView(view ViewType)
- func (h *KeybindingResolver) SetSelectedWindow(windowName string)
- func (h *KeybindingResolver) SetTmuxWindowLookup(fn func(sessionID string) string)
- func (h *KeybindingResolver) SetToolLookup(fn func(sessionID string) string)
- type Modal
- type ModalCoordinator
- func (mc *ModalCoordinator) ClearFormState()
- func (mc *ModalCoordinator) DismissConfirm()
- func (mc *ModalCoordinator) DismissHelp()
- func (mc *ModalCoordinator) DismissInfo()
- func (mc *ModalCoordinator) DismissNotifications()
- func (mc *ModalCoordinator) HasEditorFocus(state UIState) bool
- func (mc *ModalCoordinator) Overlay(state UIState, bg string, s spinner.Model, loadingMsg string) string
- func (mc *ModalCoordinator) SetSize(w, h int)
- func (mc *ModalCoordinator) ShowConfirm(title, message string)
- func (mc *ModalCoordinator) ShowHelp(title string, sections []components.HelpDialogSection)
- func (mc *ModalCoordinator) ShowInfo(title string, sections []components.InfoSection, footer, helpText string)
- func (mc *ModalCoordinator) ShowNotifications(bus *tuinotify.Bus)
- func (mc *ModalCoordinator) ShowOutputModal(title string)
- type Model
- type NewSessionForm
- type NewSessionFormResult
- type NotificationModal
- type Opts
- type OutputModal
- type ParsedCommand
- type PendingCreate
- type ReviewOnlyModel
- type ReviewOnlyOptions
- type SelectField
- func (s *SelectField) Blur()
- func (s *SelectField) Focus() tea.Cmd
- func (s *SelectField) Focused() bool
- func (s *SelectField) IsFiltering() bool
- func (s *SelectField) KeyMap() []key.Binding
- func (s *SelectField) SelectedIndex() int
- func (s *SelectField) SetSize(width, height int)
- func (s SelectField) Update(msg tea.Msg) (SelectField, tea.Cmd)
- func (s SelectField) View() string
- type SelectItem
- type ToastController
- type ToastView
- type UIState
- type ViewType
Constants ¶
const ( // MaxVisibleCommands is the maximum number of commands shown in the palette. MaxVisibleCommands = 12 // CommandPaletteWidth is the content width of the command palette modal. CommandPaletteWidth = 90 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandEntry ¶
type CommandEntry struct {
Name string
Command config.UserCommand
}
CommandEntry represents an item in the command palette.
type CommandPalette ¶
type CommandPalette struct {
// contains filtered or unexported fields
}
CommandPalette is a vim-style command palette for user commands.
func NewCommandPalette ¶
func NewCommandPalette(cmds map[string]config.UserCommand, sess *session.Session, width, height int, activeView ViewType) *CommandPalette
NewCommandPalette creates a new command palette with the given commands. Commands are filtered by scope - only commands active in the current view are shown.
func (*CommandPalette) Cancelled ¶
func (p *CommandPalette) Cancelled() bool
Cancelled returns true if the user cancelled the palette.
func (*CommandPalette) IsFiltering ¶
func (p *CommandPalette) IsFiltering() bool
IsFiltering returns whether the palette is currently filtering. Always true for the new text input-based palette.
func (*CommandPalette) KeyMap ¶
func (p *CommandPalette) KeyMap() []key.Binding
KeyMap returns keys that the command palette uses (for help integration).
func (*CommandPalette) Overlay ¶
func (p *CommandPalette) Overlay(background string, width, height int) string
Overlay renders the command palette as a layer over the given background.
func (*CommandPalette) SelectedCommand ¶
func (p *CommandPalette) SelectedCommand() (*CommandEntry, []string, bool)
SelectedCommand returns the selected command entry and parsed args, if any.
func (*CommandPalette) Session ¶
func (p *CommandPalette) Session() *session.Session
Session returns the session context for template rendering.
func (*CommandPalette) Update ¶
func (p *CommandPalette) Update(msg tea.Msg) (*CommandPalette, tea.Cmd)
Update handles messages for the command palette.
func (*CommandPalette) View ¶
func (p *CommandPalette) View() string
View renders the command palette.
type Deps ¶ added in v0.32.0
type Deps struct {
// Required — nil causes a panic at construction time.
Config *config.Config
Service *hive.SessionService
Renderer *tmpl.Renderer
TerminalManager *terminal.Manager
PluginManager *plugins.Manager
// Optional — nil disables the corresponding feature.
MsgStore *hive.MessageService
Bus *eventbus.EventBus
DB *db.DB
KVStore corekv.KV
BuildInfo BuildInfo
DoctorService *hive.DoctorService
}
Deps holds all external dependencies for the TUI Model.
type HiveDocReviewCmd ¶
type HiveDocReviewCmd struct {
Arg string // Optional document path argument
}
HiveDocReviewCmd activates the review tab with optional document selection.
type KVView ¶
type KVView struct {
// contains filtered or unexported fields
}
KVView is a two-column KV browser: searchable key list (left) + colorized JSON preview (right).
func (*KVView) AddFilterRune ¶
AddFilterRune adds a character to the filter.
func (*KVView) CancelFilter ¶
func (v *KVView) CancelFilter()
CancelFilter clears the filter and exits filtering mode.
func (*KVView) ConfirmFilter ¶
func (v *KVView) ConfirmFilter()
ConfirmFilter exits filtering mode, keeping the filter active.
func (*KVView) DeleteFilterRune ¶
func (v *KVView) DeleteFilterRune()
DeleteFilterRune removes the last character from the filter.
func (*KVView) IsFiltering ¶
IsFiltering returns whether the view is in filter mode.
func (*KVView) MoveDown ¶
func (v *KVView) MoveDown()
MoveDown moves the cursor down in the key list.
func (*KVView) ScrollPreviewDown ¶
func (v *KVView) ScrollPreviewDown()
ScrollPreviewDown scrolls the JSON preview down.
func (*KVView) ScrollPreviewUp ¶
func (v *KVView) ScrollPreviewUp()
ScrollPreviewUp scrolls the JSON preview up.
func (*KVView) SelectedKey ¶
SelectedKey returns the currently selected key, or empty if none.
func (*KVView) SetPreview ¶
SetPreview sets the preview entry for the selected key.
type KeybindingResolver ¶
type KeybindingResolver struct {
// contains filtered or unexported fields
}
KeybindingResolver resolves keybindings to actions via UserCommands. It handles resolution only - execution is handled by the command.Service.
func NewKeybindingResolver ¶
func NewKeybindingResolver(keybindings map[string]config.Keybinding, commands map[string]config.UserCommand, renderer *tmpl.Renderer) *KeybindingResolver
NewKeybindingResolver creates a new resolver with the given config. Commands should be the merged user commands (user config + system defaults).
func (*KeybindingResolver) HelpEntries ¶
func (h *KeybindingResolver) HelpEntries() []string
HelpEntries returns all configured keybindings for display, sorted by key. Only returns keybindings that are in scope for the current view.
func (*KeybindingResolver) HelpString ¶
func (h *KeybindingResolver) HelpString() string
HelpString returns a formatted help string for all keybindings.
func (*KeybindingResolver) IsAction ¶
func (h *KeybindingResolver) IsAction(key string, t action.Type) bool
IsAction checks if a key maps to the given built-in action.
func (*KeybindingResolver) IsCommand ¶
func (h *KeybindingResolver) IsCommand(key string, cmdName string) bool
IsCommand checks if a key maps to the given command name.
func (*KeybindingResolver) KeyBindings ¶
func (h *KeybindingResolver) KeyBindings() []key.Binding
KeyBindings returns key.Binding objects for integration with bubbles help system. Only returns keybindings that are in scope for the current view.
func (*KeybindingResolver) RenderWithFormData ¶
func (h *KeybindingResolver) RenderWithFormData( name string, cmd config.UserCommand, sess session.Session, args []string, formData map[string]any, ) Action
RenderWithFormData resolves a user command with form data injected into the template context under the .Form namespace.
func (*KeybindingResolver) Resolve ¶
Resolve attempts to resolve a key press to an action for the given session. Recycled sessions only allow delete actions to prevent accidental operations.
func (*KeybindingResolver) ResolveFormCommand ¶
func (h *KeybindingResolver) ResolveFormCommand(key string, sess session.Session) (string, config.UserCommand, bool)
ResolveFormCommand checks if a key maps to a user command with form fields. Returns the command name and command if found, after scope and recycle checks.
func (*KeybindingResolver) ResolveUserCommand ¶
func (h *KeybindingResolver) ResolveUserCommand(name string, cmd config.UserCommand, sess session.Session, args []string) Action
ResolveUserCommand converts a user command to an Action ready for execution. The name is used to display the command source (e.g., ":review"). Supports both action-based commands (recycle, delete) and shell commands.
func (*KeybindingResolver) SetActiveView ¶
func (h *KeybindingResolver) SetActiveView(view ViewType)
SetActiveView updates the current active view for scope checking.
func (*KeybindingResolver) SetSelectedWindow ¶
func (h *KeybindingResolver) SetSelectedWindow(windowName string)
SetSelectedWindow overrides the TmuxWindow template value for the next resolve call. The override is consumed (cleared) after each Resolve or ResolveUserCommand call. Pass empty string to clear the override and fall back to the lookup function.
func (*KeybindingResolver) SetTmuxWindowLookup ¶
func (h *KeybindingResolver) SetTmuxWindowLookup(fn func(sessionID string) string)
SetTmuxWindowLookup sets a function that resolves tmux window names for sessions. This enables the TmuxWindow field in shell command templates.
func (*KeybindingResolver) SetToolLookup ¶
func (h *KeybindingResolver) SetToolLookup(fn func(sessionID string) string)
SetToolLookup sets a function that resolves tool names for sessions.
type Modal ¶
type Modal struct {
// contains filtered or unexported fields
}
Modal represents a confirmation dialog.
func (Modal) ConfirmSelected ¶
ConfirmSelected returns true if the confirm button is selected.
func (*Modal) ToggleSelection ¶
func (m *Modal) ToggleSelection()
ToggleSelection switches the selected button.
type ModalCoordinator ¶ added in v0.32.0
type ModalCoordinator struct {
// Modal components
Confirm Modal
Output OutputModal
NewSession *NewSessionForm
CommandPalette *CommandPalette
Help *components.HelpDialog
Notification *NotificationModal
InfoDialog *components.InfoDialog
FormDialog *form.Dialog
DocPicker *review.DocumentPickerModal
RenameInput textinput.Model
RenameSessionID string
// Pending action state
Pending Action
PendingCreate *PendingCreate
PendingRecycledSessions []session.Session
PendingFormCmd config.UserCommand
PendingFormName string
PendingFormSess *session.Session
PendingFormArgs []string
// Recycle streaming
RecycleOutput <-chan string
RecycleDone <-chan error
RecycleCancel context.CancelFunc
// contains filtered or unexported fields
}
ModalCoordinator owns all modal component references, pending action state, recycle streaming state, and provides overlay rendering plus lifecycle methods.
func NewModalCoordinator ¶ added in v0.32.0
func NewModalCoordinator() *ModalCoordinator
NewModalCoordinator creates a new ModalCoordinator with default state.
func (*ModalCoordinator) ClearFormState ¶ added in v0.32.0
func (mc *ModalCoordinator) ClearFormState()
ClearFormState resets all form dialog state.
func (*ModalCoordinator) DismissConfirm ¶ added in v0.32.0
func (mc *ModalCoordinator) DismissConfirm()
DismissConfirm resets the confirm modal to zero value.
func (*ModalCoordinator) DismissHelp ¶ added in v0.32.0
func (mc *ModalCoordinator) DismissHelp()
DismissHelp closes the help dialog.
func (*ModalCoordinator) DismissInfo ¶ added in v0.32.0
func (mc *ModalCoordinator) DismissInfo()
DismissInfo closes the info dialog.
func (*ModalCoordinator) DismissNotifications ¶ added in v0.32.0
func (mc *ModalCoordinator) DismissNotifications()
DismissNotifications closes the notification modal.
func (*ModalCoordinator) HasEditorFocus ¶ added in v0.32.0
func (mc *ModalCoordinator) HasEditorFocus(state UIState) bool
HasEditorFocus returns true if a modal with text input is active.
func (*ModalCoordinator) Overlay ¶ added in v0.32.0
func (mc *ModalCoordinator) Overlay(state UIState, bg string, s spinner.Model, loadingMsg string) string
Overlay renders the appropriate modal overlay based on the current UI state. It returns the background string unchanged if no modal is active.
func (*ModalCoordinator) SetSize ¶ added in v0.32.0
func (mc *ModalCoordinator) SetSize(w, h int)
SetSize updates the available dimensions for modal rendering.
func (*ModalCoordinator) ShowConfirm ¶ added in v0.32.0
func (mc *ModalCoordinator) ShowConfirm(title, message string)
ShowConfirm creates and displays the confirmation modal.
func (*ModalCoordinator) ShowHelp ¶ added in v0.32.0
func (mc *ModalCoordinator) ShowHelp(title string, sections []components.HelpDialogSection)
ShowHelp creates and displays the help dialog.
func (*ModalCoordinator) ShowInfo ¶ added in v0.32.0
func (mc *ModalCoordinator) ShowInfo(title string, sections []components.InfoSection, footer, helpText string)
ShowInfo creates and displays the info dialog.
func (*ModalCoordinator) ShowNotifications ¶ added in v0.32.0
func (mc *ModalCoordinator) ShowNotifications(bus *tuinotify.Bus)
ShowNotifications creates and displays the notification modal.
func (*ModalCoordinator) ShowOutputModal ¶ added in v0.32.0
func (mc *ModalCoordinator) ShowOutputModal(title string)
ShowOutputModal creates and displays the output modal.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the main Bubble Tea model for the TUI.
func (Model) PendingCreate ¶
func (m Model) PendingCreate() *PendingCreate
PendingCreate returns any pending session creation data.
type NewSessionForm ¶
type NewSessionForm struct {
// contains filtered or unexported fields
}
NewSessionForm manages the new session creation form.
func NewNewSessionForm ¶
func NewNewSessionForm(repos []sessions.DiscoveredRepo, preselectedRemote string, existingNames map[string]bool) *NewSessionForm
NewNewSessionForm creates a new session form with the given repos. If preselectedRemote is non-empty, the matching repo will be pre-selected. existingNames is used to validate that the session name is unique.
func (*NewSessionForm) Cancelled ¶
func (f *NewSessionForm) Cancelled() bool
Cancelled returns true if the form was cancelled.
func (*NewSessionForm) Init ¶
func (f *NewSessionForm) Init() tea.Cmd
Init returns the initial command for the form.
func (*NewSessionForm) Result ¶
func (f *NewSessionForm) Result() NewSessionFormResult
Result returns the form result. Only valid if Submitted() is true. Returns zero value if repos slice is empty (should not happen in normal use).
func (*NewSessionForm) Submitted ¶
func (f *NewSessionForm) Submitted() bool
Submitted returns true if the form was submitted.
func (*NewSessionForm) Update ¶
func (f *NewSessionForm) Update(msg tea.Msg) (NewSessionForm, tea.Cmd)
Update handles messages for the form.
type NewSessionFormResult ¶
type NewSessionFormResult struct {
Repo sessions.DiscoveredRepo
SessionName string
}
NewSessionFormResult contains the form submission result.
type NotificationModal ¶
type NotificationModal struct {
// contains filtered or unexported fields
}
NotificationModal displays a scrollable history of notifications.
func NewNotificationModal ¶
func NewNotificationModal(bus *tuinotify.Bus, width, height int) *NotificationModal
NewNotificationModal creates a modal showing notification history.
func (*NotificationModal) Clear ¶
func (m *NotificationModal) Clear() error
Clear deletes all notifications and refreshes the view.
func (*NotificationModal) Overlay ¶
func (m *NotificationModal) Overlay(background string, width, height int) string
Overlay renders the notification modal centered over the background.
func (*NotificationModal) ScrollDown ¶
func (m *NotificationModal) ScrollDown()
ScrollDown scrolls the viewport down.
func (*NotificationModal) ScrollUp ¶
func (m *NotificationModal) ScrollUp()
ScrollUp scrolls the viewport up.
type OutputModal ¶
type OutputModal struct {
// contains filtered or unexported fields
}
OutputModal displays streaming command output in a modal dialog.
func NewOutputModal ¶
func NewOutputModal(title string) OutputModal
NewOutputModal creates a new output modal with the given title.
func (*OutputModal) AddLine ¶
func (m *OutputModal) AddLine(line string)
AddLine appends a line of output to the modal.
func (*OutputModal) IsRunning ¶
func (m *OutputModal) IsRunning() bool
IsRunning returns true if the command is still running.
func (OutputModal) Overlay ¶
func (m OutputModal) Overlay(background string, width, height int) string
Overlay renders the output modal centered over the background.
func (*OutputModal) SetComplete ¶
func (m *OutputModal) SetComplete(err error)
SetComplete marks the modal as complete with optional error.
func (*OutputModal) SetSpinner ¶
func (m *OutputModal) SetSpinner(s spinner.Model)
SetSpinner updates the spinner model.
func (*OutputModal) Spinner ¶
func (m *OutputModal) Spinner() spinner.Model
Spinner returns the spinner model for tick updates.
type ParsedCommand ¶
ParsedCommand represents a parsed command input.
func ParseCommandInput ¶
func ParseCommandInput(input string) ParsedCommand
ParseCommandInput parses a command string like ":command arg1 arg2" into name and args. The input should start with ':' but it's optional. Arguments are split by whitespace.
type PendingCreate ¶
PendingCreate holds data for a session to create after TUI exits.
type ReviewOnlyModel ¶
type ReviewOnlyModel struct {
// contains filtered or unexported fields
}
ReviewOnlyModel is a minimal TUI for reviewing context documents.
func NewReviewOnly ¶
func NewReviewOnly(opts ReviewOnlyOptions) ReviewOnlyModel
NewReviewOnly creates a new review-only TUI model.
type ReviewOnlyOptions ¶
type ReviewOnlyOptions struct {
Documents []review.Document
InitialDoc *review.Document
ContextDir string // Directory for saving feedback files (e.g., context directory)
DB *db.DB
CommentLineWidth int
CopyCommand string // Shell command for copying to clipboard (e.g., "pbcopy" on macOS)
}
ReviewOnlyOptions configures the review-only TUI.
type SelectField ¶
type SelectField struct {
// contains filtered or unexported fields
}
SelectField is a select input component wrapping list.Model.
func NewSelectField ¶
func NewSelectField(title string, items []SelectItem, selected int) SelectField
NewSelectField creates a new select field with the given items. selected is the index to pre-select (-1 for none).
func (*SelectField) Focus ¶
func (s *SelectField) Focus() tea.Cmd
Focus sets focus state on the select field.
func (*SelectField) Focused ¶
func (s *SelectField) Focused() bool
Focused returns whether the field is focused.
func (*SelectField) IsFiltering ¶
func (s *SelectField) IsFiltering() bool
IsFiltering returns whether the list is currently filtering.
func (*SelectField) KeyMap ¶
func (s *SelectField) KeyMap() []key.Binding
KeyMap returns keys that the select field uses (for help integration).
func (*SelectField) SelectedIndex ¶
func (s *SelectField) SelectedIndex() int
SelectedIndex returns the index of the selected item.
func (*SelectField) SetSize ¶
func (s *SelectField) SetSize(width, height int)
SetSize sets the dimensions of the select field.
func (SelectField) Update ¶
func (s SelectField) Update(msg tea.Msg) (SelectField, tea.Cmd)
Update handles messages for the select field.
type SelectItem ¶
type SelectItem struct {
// contains filtered or unexported fields
}
SelectItem represents an item in a SelectField.
func (SelectItem) FilterValue ¶
func (i SelectItem) FilterValue() string
FilterValue implements list.Item.
type ToastController ¶
type ToastController struct {
// contains filtered or unexported fields
}
ToastController manages the lifecycle of active toast notifications. It handles push, eviction, TTL countdown, and dismissal.
func NewToastController ¶
func NewToastController() *ToastController
func (*ToastController) Dismiss ¶
func (c *ToastController) Dismiss()
Dismiss removes the newest (bottom-most) toast.
func (*ToastController) DismissAll ¶
func (c *ToastController) DismissAll()
DismissAll removes all active toasts.
func (*ToastController) HasToasts ¶
func (c *ToastController) HasToasts() bool
HasToasts returns true if there are any active toasts.
func (*ToastController) Push ¶
func (c *ToastController) Push(n notify.Notification)
Push adds a notification to the toast stack. If the stack exceeds defaultMaxToasts, the oldest toast is evicted.
func (*ToastController) Tick ¶
func (c *ToastController) Tick()
Tick removes any toasts whose expiration time has passed.
func (*ToastController) Toasts ¶
func (c *ToastController) Toasts() []toast
Toasts returns the current active toast slice.
type ToastView ¶
type ToastView struct {
// contains filtered or unexported fields
}
ToastView renders toast notifications and composites them as an overlay.
func NewToastView ¶
func NewToastView(controller *ToastController) *ToastView
Source Files
¶
- buildinfo.go
- command_palette.go
- command_parser.go
- form_factory.go
- keybindings.go
- kv_cmds.go
- kv_view.go
- modal.go
- modal_coordinator.go
- model.go
- model_handlers.go
- model_render.go
- new_session_form.go
- notification_modal.go
- output_modal.go
- polling.go
- review_doc_cmd.go
- review_only.go
- select_field.go
- toast_controller.go
- toast_view.go
- view.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package components provides reusable TUI components.
|
Package components provides reusable TUI components. |
|
views
|
|
|
review
Package review implements a TUI for reviewing and commenting on markdown documents.
|
Package review implements a TUI for reviewing and commenting on markdown documents. |