tui

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonServer

type CommonServer struct {
	Name    string            // Name identifier for the server
	Command string            // Command to execute for the server (Claude)
	Args    []string          // Arguments for the command (Claude)
	Env     map[string]string // Environment variables (Claude)
	URL     string            // URL for SSE connection (Cursor)
	IsSSE   bool              // Type identifier (true for Cursor SSE, false for Claude Command)
}

CommonServer is a unified structure to represent server configurations from different sources (Cursor, Claude Desktop, etc.) within the UI.

type ConfigType

type ConfigType string

Define configuration types

const (
	ConfigTypeCursor  ConfigType = "cursor"
	ConfigTypeClaude  ConfigType = "claude"
	ConfigTypeAmpCode ConfigType = "ampcode" // Configuration for Amp (Cursor)
	ConfigTypeAmp     ConfigType = "amp"     // Configuration for standalone Amp
	ConfigTypeProfile ConfigType = "profile" // New config type for profiles
	ConfigTypeNone    ConfigType = ""        // Represents no config loaded
)

type ConfirmModel

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

ConfirmModel represents a confirmation dialog

func NewConfirmModel

func NewConfirmModel(title, message string) ConfirmModel

NewConfirmModel creates a new confirmation dialog

func (ConfirmModel) Cancelled

func (m ConfirmModel) Cancelled() bool

Cancelled returns whether the dialog was cancelled

func (ConfirmModel) Confirmed

func (m ConfirmModel) Confirmed() bool

Confirmed returns whether the dialog was confirmed

func (ConfirmModel) Update

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

Update handles confirmation dialog input

func (ConfirmModel) View

func (m ConfirmModel) View() string

View renders the confirmation dialog

type ConfirmMsg

type ConfirmMsg struct {
	Confirmed bool
}

ConfirmMsg is returned when a selection is confirmed

type FormKeyMap

type FormKeyMap struct {
	Submit key.Binding
	Cancel key.Binding
	Next   key.Binding // Tab
	Prev   key.Binding // Shift+Tab

}

FormKeyMap defines keybindings specific to the form view

type FormModel

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

FormModel represents the form for adding/editing servers

func NewFormModel

func NewFormModel() FormModel

NewFormModel creates a new form model with initialized inputs

func (*FormModel) Reset

func (m *FormModel) Reset() tea.Cmd

Reset clears all form inputs and resets state

func (*FormModel) ToServer

func (m *FormModel) ToServer() (types.CommonServer, error)

ToServer converts the current form state into a CommonServer object. It performs basic validation (e.g., name is required).

func (FormModel) Update

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

Update handles form input messages

func (FormModel) View

func (m FormModel) View() string

View renders the form

type Model

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

Main application model

func NewModel

func NewModel() Model

NewModel initializes and returns a new Model

func (Model) FullHelp

func (m Model) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap for compatibility

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model and returns an initial command

func (Model) ShortHelp

func (m Model) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap for compatibility

func (Model) Update

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

Update is called when a message is received

func (Model) View

func (m Model) View() string

View renders the current state of the model

type ProfileFormKeyMap

type ProfileFormKeyMap struct {
	Submit key.Binding
	Cancel key.Binding
	Next   key.Binding // Tab
	Prev   key.Binding // Shift+Tab
}

ProfileFormKeyMap defines keybindings specific to the profile form view

type ProfileFormModel

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

ProfileFormModel represents the form for adding/editing profiles

func NewProfileFormModel

func NewProfileFormModel() ProfileFormModel

NewProfileFormModel creates a new profile form model with initialized inputs

func (*ProfileFormModel) GetProfileData

func (m *ProfileFormModel) GetProfileData() (string, string, error)

GetProfileData retrieves the profile data from the form

func (*ProfileFormModel) GetToolsAndPrompts

func (m *ProfileFormModel) GetToolsAndPrompts() ([]string, []string, []string, []string)

GetToolsAndPrompts retrieves tool and prompt configuration from the form

func (*ProfileFormModel) ParsePathList

func (m *ProfileFormModel) ParsePathList(input string) []string

ParsePathList parses a comma-separated list of paths into a slice of strings

func (*ProfileFormModel) SetProfileData

func (m *ProfileFormModel) SetProfileData(name, description string)

SetProfileData populates the form with existing profile data for editing

func (ProfileFormModel) Update

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

Update handles profile form input messages

func (ProfileFormModel) View

func (m ProfileFormModel) View() string

View renders the profile form

type ServerConfigEditor

type ServerConfigEditor interface {
	// ListServers retrieves all configured servers (both enabled and disabled).
	// It returns a map where the key is the server name.
	ListServers() (map[string]CommonServer, error)

	// ListDisabledServers returns the names of disabled servers.
	// This might be redundant if ListServers includes enabled status, but kept for now
	// based on the original proposal.
	ListDisabledServers() ([]string, error)

	// EnableMCPServer enables a specific server by name.
	EnableMCPServer(name string) error

	// DisableMCPServer disables a specific server by name.
	DisableMCPServer(name string) error

	// AddMCPServer adds or updates a server configuration.
	AddMCPServer(server CommonServer, overwrite bool) error

	// RemoveMCPServer removes a specific server by name.
	RemoveMCPServer(name string) error

	// Save persists the configuration changes to the underlying storage.
	Save() error

	// GetConfigPath returns the path of the configuration file being managed.
	GetConfigPath() string

	// IsServerDisabled checks if a server with the given name is currently disabled.
	IsServerDisabled(name string) (bool, error)

	// GetServer retrieves a specific server configuration by name.
	GetServer(name string) (CommonServer, bool, error)
}

ServerConfigEditor defines the interface for managing server configurations in a backend-agnostic way for the TUI.

Jump to

Keyboard shortcuts

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