tui

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusInstalled = "●"
	StatusAvailable = "○"
	StatusDisabled  = "◌"
	StatusNative    = "◆" // Server exists in tool config but not managed by agentctl
)

Status badge symbols

View Source
const (
	HealthHealthy   = "✓"
	HealthUnhealthy = "✗"
	HealthUnknown   = "?"
	HealthChecking  = "◐" // Can be animated with spinner
)

Health indicator symbols

View Source
const (
	ScopeLocalIndicator  = "[L]"
	ScopeGlobalIndicator = "[G]"
)

Scope indicator symbols

Variables

View Source
var (
	// Main application container style
	AppStyle = lipgloss.NewStyle().
				Background(colorBg).
				Foreground(colorFg)

	// Header style for the top bar
	HeaderStyle = lipgloss.NewStyle().
				Background(colorBg).
				Foreground(colorFg).
				Bold(true).
				Padding(0, 1)

	// Title style within header
	HeaderTitleStyle = lipgloss.NewStyle().
						Foreground(colorTeal).
						Bold(true)

	// Subtitle/version style
	HeaderSubtitleStyle = lipgloss.NewStyle().
						Foreground(colorFgMuted)
)

App-level styles

View Source
var (
	// Installed status badge (●) - teal/green
	StatusInstalledStyle = lipgloss.NewStyle().
							Foreground(colorTeal).
							Bold(true)

	// Available status badge (○) - muted
	StatusAvailableStyle = lipgloss.NewStyle().
							Foreground(colorFgMuted)

	// Disabled status badge (◌) - subtle/dim
	StatusDisabledStyle = lipgloss.NewStyle().
						Foreground(colorFgSubtle)

	// Native status badge (◆) - purple/violet for tool-native servers
	StatusNativeStyle = lipgloss.NewStyle().
						Foreground(lipgloss.Color("#a78bfa")).
						Bold(true)
)

Status badge styles

View Source
var (
	// Healthy indicator (✓) - teal/green
	HealthHealthyStyle = lipgloss.NewStyle().
						Foreground(colorTeal).
						Bold(true)

	// Unhealthy indicator (✗) - pink/error
	HealthUnhealthyStyle = lipgloss.NewStyle().
							Foreground(colorPink).
							Bold(true)

	// Unknown indicator (?) - yellow/warning
	HealthUnknownStyle = lipgloss.NewStyle().
						Foreground(colorYellow)

	// Checking indicator (spinner) - cyan
	HealthCheckingStyle = lipgloss.NewStyle().
						Foreground(colorCyan)
)

Health indicator styles

View Source
var (
	// Local scope indicator [L] - teal (project-specific)
	ScopeLocalStyle = lipgloss.NewStyle().
					Foreground(colorTeal)

	// Global scope indicator [G] - muted (user-wide)
	ScopeGlobalStyle = lipgloss.NewStyle().
						Foreground(colorFgMuted)
)

Scope indicator styles

View Source
var (
	// Normal list item
	ListItemNormalStyle = lipgloss.NewStyle().
						Foreground(colorFg).
						Padding(0, 1)

	// Selected list item
	ListItemSelectedStyle = lipgloss.NewStyle().
							Foreground(colorCyan).
							Background(lipgloss.Color("#252836")).
							Bold(true).
							Padding(0, 1)

	// Dimmed/inactive list item
	ListItemDimmedStyle = lipgloss.NewStyle().
						Foreground(colorFgSubtle).
						Padding(0, 1)

	// List item name (primary text)
	ListItemNameStyle = lipgloss.NewStyle().
						Foreground(colorFg)

	// List item name when selected
	ListItemNameSelectedStyle = lipgloss.NewStyle().
								Foreground(colorCyan).
								Bold(true)

	// List item description (secondary text)
	ListItemDescStyle = lipgloss.NewStyle().
						Foreground(colorFgMuted)

	// List item description when selected
	ListItemDescSelectedStyle = lipgloss.NewStyle().
								Foreground(colorBlue)

	// Cursor/selection indicator
	ListCursorStyle = lipgloss.NewStyle().
					Foreground(colorTeal).
					Bold(true)
)

List item styles

View Source
var (
	// Log panel container
	LogPanelStyle = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(colorFgSubtle).
					Padding(0, 1)

	// Log panel title
	LogPanelTitleStyle = lipgloss.NewStyle().
						Foreground(colorBlue).
						Bold(true).
						Padding(0, 1)

	// Log entry styles by level
	LogEntryInfoStyle = lipgloss.NewStyle().
						Foreground(colorFg)

	LogEntryDebugStyle = lipgloss.NewStyle().
						Foreground(colorFgMuted)

	LogEntryWarnStyle = lipgloss.NewStyle().
						Foreground(colorYellow)

	LogEntryErrorStyle = lipgloss.NewStyle().
						Foreground(colorPink)

	// Log timestamp
	LogTimestampStyle = lipgloss.NewStyle().
						Foreground(colorFgSubtle)

	// Log source/component
	LogSourceStyle = lipgloss.NewStyle().
					Foreground(colorCyan)
)

Log panel styles

View Source
var (
	// Key hints bar container (bottom bar)
	KeyHintsBarStyle = lipgloss.NewStyle().
						Background(lipgloss.Color("#252836")).
						Padding(0, 1)

	// Key binding (e.g., "j/k")
	KeyStyle = lipgloss.NewStyle().
				Foreground(colorTeal).
				Bold(true)

	// Key description (e.g., "up/down")
	KeyDescStyle = lipgloss.NewStyle().
					Foreground(colorFgMuted)

	// Separator between key hints
	KeyHintSeparatorStyle = lipgloss.NewStyle().
							Foreground(colorFgSubtle)
)

Key hints bar styles

View Source
var (
	// Modal backdrop (dimmed background)
	ModalBackdropStyle = lipgloss.NewStyle().
						Background(lipgloss.Color("#1b1e28")).
						Foreground(colorFgSubtle)

	// Modal container
	ModalStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(colorCyan).
				Background(colorBg).
				Padding(1, 2)

	// Modal title
	ModalTitleStyle = lipgloss.NewStyle().
					Foreground(colorCyan).
					Bold(true).
					Align(lipgloss.Center).
					Padding(0, 0, 1, 0)

	// Modal body text
	ModalBodyStyle = lipgloss.NewStyle().
					Foreground(colorFg)

	// Modal button (normal)
	ModalButtonStyle = lipgloss.NewStyle().
						Foreground(colorFgMuted).
						Border(lipgloss.RoundedBorder()).
						BorderForeground(colorFgSubtle).
						Padding(0, 2)

	// Modal button (focused/selected)
	ModalButtonActiveStyle = lipgloss.NewStyle().
							Foreground(colorBg).
							Background(colorTeal).
							Bold(true).
							Border(lipgloss.RoundedBorder()).
							BorderForeground(colorTeal).
							Padding(0, 2)

	// Modal button (danger/destructive)
	ModalButtonDangerStyle = lipgloss.NewStyle().
							Foreground(colorBg).
							Background(colorPink).
							Bold(true).
							Border(lipgloss.RoundedBorder()).
							BorderForeground(colorPink).
							Padding(0, 2)
)

Modal/overlay styles

View Source
var (
	// Tab bar container
	TabBarStyle = lipgloss.NewStyle().
				BorderBottom(true).
				BorderForeground(colorFgSubtle).
				Padding(0, 1)

	// Inactive tab
	TabStyle = lipgloss.NewStyle().
				Foreground(colorFgMuted).
				Padding(0, 2)

	// Active tab
	TabActiveStyle = lipgloss.NewStyle().
					Foreground(colorTeal).
					Bold(true).
					BorderBottom(true).
					BorderForeground(colorTeal).
					Padding(0, 2)
)

Tab styles (for switching between views)

View Source
var (
	// Search input container
	SearchStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(colorCyan).
				Padding(0, 1)

	// Search prompt (e.g., "/")
	SearchPromptStyle = lipgloss.NewStyle().
						Foreground(colorTeal).
						Bold(true)

	// Search input text
	SearchInputStyle = lipgloss.NewStyle().
						Foreground(colorFg)

	// Search placeholder
	SearchPlaceholderStyle = lipgloss.NewStyle().
							Foreground(colorFgSubtle)

	// Match highlight in search results
	SearchMatchStyle = lipgloss.NewStyle().
						Foreground(colorYellow).
						Bold(true)
)

Search/filter styles

View Source
var (
	// Progress bar track
	ProgressTrackStyle = lipgloss.NewStyle().
						Foreground(colorFgSubtle)

	// Progress bar fill
	ProgressFillStyle = lipgloss.NewStyle().
						Foreground(colorTeal)

	// Spinner style
	SpinnerStyle = lipgloss.NewStyle().
					Foreground(colorCyan)

	// Loading text
	LoadingTextStyle = lipgloss.NewStyle().
						Foreground(colorFgMuted).
						Italic(true)
)

Progress/loading styles

View Source
var (
	// Success message
	SuccessStyle = lipgloss.NewStyle().
					Foreground(colorTeal).
					Bold(true)

	// Warning message
	WarningStyle = lipgloss.NewStyle().
					Foreground(colorYellow).
					Bold(true)

	// Error message
	ErrorStyle = lipgloss.NewStyle().
				Foreground(colorPink).
				Bold(true)

	// Info message
	InfoStyle = lipgloss.NewStyle().
				Foreground(colorCyan)
)

Notification/message styles

View Source
var (
	// Detail pane container
	DetailPaneStyle = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(colorFgSubtle).
					Padding(1, 2)

	// Detail pane title (server name)
	DetailTitleStyle = lipgloss.NewStyle().
						Foreground(colorCyan).
						Bold(true)

	// Detail section header
	DetailSectionStyle = lipgloss.NewStyle().
						Foreground(colorBlue).
						Bold(true).
						MarginTop(1)

	// Detail label (e.g., "Version:", "Author:")
	DetailLabelStyle = lipgloss.NewStyle().
						Foreground(colorFgMuted)

	// Detail value
	DetailValueStyle = lipgloss.NewStyle().
						Foreground(colorFg)

	// Detail URL/link
	DetailLinkStyle = lipgloss.NewStyle().
					Foreground(colorCyan).
					Underline(true)
)

Detail pane styles (right panel showing server details)

View Source
var FilterModeNames = []string{"All", "Installed", "Available", "Disabled", "Native"}

FilterModeNames returns the display names for filter modes

View Source
var ScopeFilterNames = []string{"All", "Local", "Global"}

ScopeFilterNames returns the display names for scope filters

View Source
var TabNames = []string{"Servers", "Commands", "Rules", "Skills", "Hooks", "Tools", "Agents"}

TabNames returns the display names for tabs

Functions

func ConfirmDelete

func ConfirmDelete(resourceType, name string) (bool, error)

ConfirmDelete shows a confirmation dialog for deletion

func FormatServerDescription

func FormatServerDescription(s *Server) string

FormatServerDescription formats the description line for a server Shows transport type and command/URL information

func HealthStatusBadge

func HealthStatusBadge(health HealthStatusType) string

HealthStatusBadge returns a visual badge for the health status

  • HealthStatusUnknown: question mark (?)
  • HealthStatusChecking: spinner character (◐)
  • HealthStatusHealthy: checkmark (✓)
  • HealthStatusUnhealthy: cross (✗)

func RenderHealthIndicator

func RenderHealthIndicator(healthy, checking bool) string

RenderHealthIndicator returns a styled health indicator

func RenderKeyHint

func RenderKeyHint(key, desc string) string

RenderKeyHint returns a formatted key hint (e.g., "j/k up/down")

func RenderKeyHintsBar

func RenderKeyHintsBar(hints []struct{ Key, Desc string }) string

RenderKeyHintsBar renders a complete key hints bar with multiple hints

func RenderScopeIndicator

func RenderScopeIndicator(scope string) string

RenderScopeIndicator returns a styled scope indicator [L] or [G]

func RenderStatusBadge

func RenderStatusBadge(installed, enabled bool) string

RenderStatusBadge returns a styled status badge

func Run

func Run() error

Run starts the TUI application

func RunAliasManager

func RunAliasManager() error

RunAliasManager runs the alias manager TUI

func ServerStatusBadge

func ServerStatusBadge(status ServerStatusType) string

ServerStatusBadge returns a visual badge for the server status

  • ServerStatusInstalled: filled circle (●)
  • ServerStatusAvailable: empty circle (○)
  • ServerStatusDisabled: dotted circle (◌)
  • ServerStatusNative: filled diamond (◆)

Types

type AliasEntry

type AliasEntry struct {
	Name       string
	Alias      aliases.Alias
	IsBundled  bool
	IsExpanded bool
}

AliasEntry represents an alias in the list

type AliasManagerKeyMap

type AliasManagerKeyMap struct {
	Up       key.Binding
	Down     key.Binding
	Add      key.Binding
	Edit     key.Binding
	Delete   key.Binding
	Test     key.Binding
	Validate key.Binding
	Search   key.Binding
	Escape   key.Binding
	Enter    key.Binding
	Help     key.Binding
	Quit     key.Binding
	Yes      key.Binding
	No       key.Binding
}

AliasManagerKeyMap defines key bindings

type AliasManagerModel

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

AliasManagerModel is the Bubble Tea model for managing bundled aliases

func NewAliasManager

func NewAliasManager() *AliasManagerModel

NewAliasManager creates a new alias manager model

func (*AliasManagerModel) Init

func (m *AliasManagerModel) Init() tea.Cmd

func (*AliasManagerModel) Update

func (m *AliasManagerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*AliasManagerModel) View

func (m *AliasManagerModel) View() string

type FilterMode

type FilterMode int

FilterMode represents the current filter for the server list

const (
	FilterAll FilterMode = iota
	FilterInstalled
	FilterAvailable
	FilterDisabled
	FilterNative
)

type HealthStatusType

type HealthStatusType int

HealthStatusType represents the health check status of an MCP server

const (
	HealthStatusUnknown HealthStatusType = iota
	HealthStatusChecking
	HealthStatusHealthy
	HealthStatusUnhealthy
)

type InspectorModel added in v0.3.0

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

InspectorModel handles the display of resource details in a modal. It uses the Inspectable interface so each resource type renders itself, avoiding type switches and interface{} code smells.

func NewInspector added in v0.3.0

func NewInspector(resource inspectable.Inspectable, width, height int) InspectorModel

NewInspector creates a new InspectorModel for displaying the given resource.

func (InspectorModel) AtBottom added in v0.3.0

func (m InspectorModel) AtBottom() bool

AtBottom returns true if the viewport is scrolled to the bottom

func (InspectorModel) AtTop added in v0.3.0

func (m InspectorModel) AtTop() bool

AtTop returns true if the viewport is scrolled to the top

func (*InspectorModel) PageDown added in v0.3.0

func (m *InspectorModel) PageDown()

PageDown scrolls the viewport down by a page

func (*InspectorModel) PageUp added in v0.3.0

func (m *InspectorModel) PageUp()

PageUp scrolls the viewport up by a page

func (*InspectorModel) ScrollDown added in v0.3.0

func (m *InspectorModel) ScrollDown()

ScrollDown scrolls the viewport down

func (InspectorModel) ScrollPercent added in v0.3.0

func (m InspectorModel) ScrollPercent() float64

ScrollPercent returns the scroll position as a percentage

func (*InspectorModel) ScrollToBottom added in v0.3.0

func (m *InspectorModel) ScrollToBottom()

ScrollToBottom scrolls to the bottom of the content

func (*InspectorModel) ScrollToTop added in v0.3.0

func (m *InspectorModel) ScrollToTop()

ScrollToTop scrolls to the top of the content

func (*InspectorModel) ScrollUp added in v0.3.0

func (m *InspectorModel) ScrollUp()

ScrollUp scrolls the viewport up

func (*InspectorModel) SetSize added in v0.3.0

func (m *InspectorModel) SetSize(width, height int)

SetSize updates the viewport dimensions

func (InspectorModel) Title added in v0.3.0

func (m InspectorModel) Title() string

Title returns the modal title from the resource

func (InspectorModel) View added in v0.3.0

func (m InspectorModel) View() string

View renders the inspector viewport content

type LogEntry

type LogEntry struct {
	Time    time.Time
	Level   string // info, warn, error, success
	Message string
}

LogEntry represents a single log entry in the log panel

type Model

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

Model is the Bubble Tea model for the TUI

func New

func New() (*Model, error)

New creates a new TUI model

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages

func (Model) View

func (m Model) View() string

View renders the UI

type ResourceCRUD

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

ResourceCRUD handles create, read, update, delete operations for resources

func NewResourceCRUD

func NewResourceCRUD(cfg *config.Config) *ResourceCRUD

NewResourceCRUD creates a new resource CRUD handler

func (*ResourceCRUD) CreateCommand

func (r *ResourceCRUD) CreateCommand() (*command.Command, error)

CreateCommand creates a new command via interactive form

func (*ResourceCRUD) CreateRule

func (r *ResourceCRUD) CreateRule() (*rule.Rule, error)

CreateRule creates a new rule via interactive form

func (*ResourceCRUD) CreateServer

func (r *ResourceCRUD) CreateServer() (*mcp.Server, error)

CreateServer creates a new server via interactive form

func (*ResourceCRUD) CreateSkill

func (r *ResourceCRUD) CreateSkill() (*skill.Skill, error)

CreateSkill creates a new skill via interactive wizard The wizard allows defining the skill and adding multiple commands before saving

func (*ResourceCRUD) DeleteCommand

func (r *ResourceCRUD) DeleteCommand(cmd *command.Command) error

DeleteCommand deletes a command

func (*ResourceCRUD) DeleteRule

func (r *ResourceCRUD) DeleteRule(rl *rule.Rule) error

DeleteRule deletes a rule

func (*ResourceCRUD) DeleteSkill

func (r *ResourceCRUD) DeleteSkill(s *skill.Skill) error

DeleteSkill deletes a skill

func (*ResourceCRUD) EditCommand

func (r *ResourceCRUD) EditCommand(cmd *command.Command) error

EditCommand opens the command in the user's editor

func (*ResourceCRUD) EditRule

func (r *ResourceCRUD) EditRule(rl *rule.Rule) error

EditRule opens the rule in the user's editor

func (*ResourceCRUD) EditSkill

func (r *ResourceCRUD) EditSkill(s *skill.Skill) error

EditSkill opens the skill's SKILL.md file in the user's editor

type ResourceTab

type ResourceTab int

ResourceTab represents the current tab/resource type being viewed

const (
	TabServers ResourceTab = iota
	TabCommands
	TabRules
	TabSkills
	TabHooks
	TabTools
	TabAgents
)

type ScopeFilter added in v0.3.0

type ScopeFilter int

ScopeFilter represents the scope filter for resources

const (
	ScopeFilterAll ScopeFilter = iota
	ScopeFilterLocal
	ScopeFilterGlobal
)

type Server

type Server struct {
	Name          string
	Desc          string // Description of the server
	Status        ServerStatusType
	Health        HealthStatusType
	HealthError   error
	HealthLatency string           // e.g., "120ms"
	Transport     string           // stdio, http, sse
	Command       string           // for display
	Selected      bool             // for multi-select
	Tools         []mcpclient.Tool // Discovered tools
	ServerConfig  *mcp.Server
	AliasConfig   *aliases.Alias
	SourceTools   []string // Tools this server is configured in (for native servers)
}

Server represents a unified server item for the TUI list

func (Server) Description

func (s Server) Description() string

Description implements list.Item interface Returns transport info and command

func (Server) FilterValue

func (s Server) FilterValue() string

FilterValue implements list.Item interface Returns the server name for filtering

func (Server) Title

func (s Server) Title() string

Title implements list.Item interface Returns the server name with a status badge

type ServerStatusType

type ServerStatusType int

ServerStatusType represents the installation status of an MCP server

const (
	ServerStatusInstalled ServerStatusType = iota
	ServerStatusAvailable
	ServerStatusDisabled
	ServerStatusNative // Server exists in tool config but not managed by agentctl
)

Jump to

Keyboard shortcuts

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