Documentation
¶
Index ¶
- Constants
- func ExecuteCommand(ctx context.Context, m *model, input string) (string, bool)
- func ParseCommand(input string) (cmd string, args string, isCmd bool)
- func Run() error
- type AuthMethodItem
- type BashPreview
- type Command
- type CommandHandler
- type DiffPreview
- type ModelItem
- type ModelSelectedMsg
- type PermissionPrompt
- func (p *PermissionPrompt) GetRequest() *permission.PermissionRequest
- func (p *PermissionPrompt) HandleKeypress(msg tea.KeyMsg) tea.Cmd
- func (p *PermissionPrompt) Hide()
- func (p *PermissionPrompt) IsActive() bool
- func (p *PermissionPrompt) Render() string
- func (p *PermissionPrompt) RenderInline() string
- func (p *PermissionPrompt) Show(req *permission.PermissionRequest, width, height int)
- type PermissionRequestMsg
- type PermissionResponseMsg
- type ProviderConnectResultMsg
- type ProviderItem
- type ProviderSelectedMsg
- type SearchProviderItem
- type SearchProviderSelectedMsg
- type SelectionLevel
- type SelectorCancelledMsg
- type SelectorState
- func (s *SelectorState) Cancel()
- func (s *SelectorState) ConnectProvider(ctx context.Context, p provider.Provider, authMethod provider.AuthMethod) (string, error)
- func (s *SelectorState) EnterModelSelect(ctx context.Context, width, height int) error
- func (s *SelectorState) EnterProviderSelect(width, height int) error
- func (s *SelectorState) GoBack() bool
- func (s *SelectorState) HandleConnectResult(msg ProviderConnectResultMsg)
- func (s *SelectorState) HandleKeypress(key tea.KeyMsg) tea.Cmd
- func (s *SelectorState) IsActive() bool
- func (s *SelectorState) MoveDown()
- func (s *SelectorState) MoveUp()
- func (s *SelectorState) Render() string
- func (s *SelectorState) Select() tea.Cmd
- func (s *SelectorState) SetModel(modelID string, providerName string, authMethod provider.AuthMethod) (string, error)
- type SelectorTab
- type SelectorType
- type SuggestionState
- func (s *SuggestionState) GetSelected() string
- func (s *SuggestionState) Hide()
- func (s *SuggestionState) IsVisible() bool
- func (s *SuggestionState) MoveDown()
- func (s *SuggestionState) MoveUp()
- func (s *SuggestionState) Render(width int) string
- func (s *SuggestionState) Reset()
- func (s *SuggestionState) UpdateSuggestions(input string)
Constants ¶
const (
// DefaultMaxCommandLines is the default number of lines to show when collapsed
DefaultMaxCommandLines = 20
)
const (
// DefaultMaxVisibleLines is the default number of lines to show when collapsed
DefaultMaxVisibleLines = 20
)
Variables ¶
This section is empty.
Functions ¶
func ExecuteCommand ¶
ExecuteCommand executes a slash command
func ParseCommand ¶
ParseCommand parses input and returns command name and args if it's a slash command
Types ¶
type AuthMethodItem ¶
type AuthMethodItem struct {
Provider provider.Provider
AuthMethod provider.AuthMethod
DisplayName string
Status provider.ProviderStatus
EnvVars []string
}
AuthMethodItem represents an auth method in the second level
type BashPreview ¶
type BashPreview struct {
// contains filtered or unexported fields
}
BashPreview renders a bash command preview with expand/collapse functionality
func NewBashPreview ¶
func NewBashPreview(meta *permission.BashMetadata) *BashPreview
NewBashPreview creates a new BashPreview instance
func (*BashPreview) IsExpanded ¶
func (b *BashPreview) IsExpanded() bool
IsExpanded returns whether the preview is expanded
func (*BashPreview) NeedsExpand ¶
func (b *BashPreview) NeedsExpand() bool
NeedsExpand returns true if the command has more lines than the default visible count
func (*BashPreview) Render ¶
func (b *BashPreview) Render(width int) string
Render renders the bash command preview
func (*BashPreview) SetMaxVisible ¶
func (b *BashPreview) SetMaxVisible(n int)
SetMaxVisible sets the maximum visible lines when collapsed
func (*BashPreview) ToggleExpand ¶
func (b *BashPreview) ToggleExpand()
ToggleExpand toggles between expanded and collapsed view
type Command ¶
type Command struct {
Name string
Description string
Handler CommandHandler
}
Command represents a slash command
func GetMatchingCommands ¶
GetMatchingCommands returns commands matching the prefix for fuzzy search
type CommandHandler ¶
CommandHandler is a function that handles a slash command
type DiffPreview ¶
type DiffPreview struct {
// contains filtered or unexported fields
}
DiffPreview renders a diff preview with expand/collapse functionality
func NewDiffPreview ¶
func NewDiffPreview(diffMeta *permission.DiffMetadata) *DiffPreview
NewDiffPreview creates a new DiffPreview instance
func (*DiffPreview) IsExpanded ¶
func (d *DiffPreview) IsExpanded() bool
IsExpanded returns whether the preview is expanded
func (*DiffPreview) Render ¶
func (d *DiffPreview) Render(width int) string
Render renders the diff preview
func (*DiffPreview) SetMaxVisible ¶
func (d *DiffPreview) SetMaxVisible(n int)
SetMaxVisible sets the maximum visible lines when collapsed
func (*DiffPreview) ToggleExpand ¶
func (d *DiffPreview) ToggleExpand()
ToggleExpand toggles between expanded and collapsed view
type ModelItem ¶
type ModelItem struct {
ID string
Name string
DisplayName string
ProviderName string
AuthMethod provider.AuthMethod
IsCurrent bool
}
ModelItem represents a model in the model selector
type ModelSelectedMsg ¶
type ModelSelectedMsg struct {
ModelID string
ProviderName string
AuthMethod provider.AuthMethod
}
ModelSelectedMsg is sent when a model is selected
type PermissionPrompt ¶
type PermissionPrompt struct {
// contains filtered or unexported fields
}
PermissionPrompt manages the permission request UI with Claude Code style.
func NewPermissionPrompt ¶
func NewPermissionPrompt() *PermissionPrompt
NewPermissionPrompt creates a new PermissionPrompt instance
func (*PermissionPrompt) GetRequest ¶
func (p *PermissionPrompt) GetRequest() *permission.PermissionRequest
GetRequest returns the current permission request
func (*PermissionPrompt) HandleKeypress ¶
func (p *PermissionPrompt) HandleKeypress(msg tea.KeyMsg) tea.Cmd
HandleKeypress handles keyboard input for the permission prompt
func (*PermissionPrompt) IsActive ¶
func (p *PermissionPrompt) IsActive() bool
IsActive returns whether the prompt is visible
func (*PermissionPrompt) Render ¶
func (p *PermissionPrompt) Render() string
Render renders the permission prompt (calls RenderInline)
func (*PermissionPrompt) RenderInline ¶
func (p *PermissionPrompt) RenderInline() string
RenderInline renders the permission prompt inline with Claude Code style
func (*PermissionPrompt) Show ¶
func (p *PermissionPrompt) Show(req *permission.PermissionRequest, width, height int)
Show displays the permission prompt with the given request
type PermissionRequestMsg ¶
type PermissionRequestMsg struct {
Request *permission.PermissionRequest
ToolCall interface{} // The original tool call
}
PermissionRequestMsg is sent when a tool needs permission
type PermissionResponseMsg ¶
type PermissionResponseMsg struct {
Approved bool
AllowAll bool // True if user selected "allow all during session"
Request *permission.PermissionRequest
}
PermissionResponseMsg is sent when the user responds to a permission request
type ProviderConnectResultMsg ¶
type ProviderConnectResultMsg struct {
AuthIdx int
Success bool
Message string
NewStatus provider.ProviderStatus
}
ProviderConnectResultMsg is sent when inline connection completes
type ProviderItem ¶
type ProviderItem struct {
Provider provider.Provider
DisplayName string
AuthMethods []AuthMethodItem
}
ProviderItem represents a provider in the first level
type ProviderSelectedMsg ¶
type ProviderSelectedMsg struct {
Provider provider.Provider
AuthMethod provider.AuthMethod
}
ProviderSelectedMsg is sent when a provider is selected
type SearchProviderItem ¶
type SearchProviderItem struct {
Name search.ProviderName
DisplayName string
Status string // "current", "available", "unavailable"
RequiresKey bool
EnvVars []string
}
SearchProviderItem represents a search provider in the selector
type SearchProviderSelectedMsg ¶
type SearchProviderSelectedMsg struct {
Provider search.ProviderName
}
SearchProviderSelectedMsg is sent when a search provider is selected
type SelectionLevel ¶
type SelectionLevel int
SelectionLevel represents the current selection level
const ( LevelProvider SelectionLevel = iota LevelAuthMethod )
type SelectorCancelledMsg ¶
type SelectorCancelledMsg struct{}
SelectorCancelledMsg is sent when the selector is cancelled
type SelectorState ¶
type SelectorState struct {
// contains filtered or unexported fields
}
SelectorState holds the state for the interactive selector
func NewSelectorState ¶
func NewSelectorState() SelectorState
NewSelectorState creates a new SelectorState
func (*SelectorState) ConnectProvider ¶
func (s *SelectorState) ConnectProvider(ctx context.Context, p provider.Provider, authMethod provider.AuthMethod) (string, error)
ConnectProvider connects to the selected provider and verifies the connection
func (*SelectorState) EnterModelSelect ¶
func (s *SelectorState) EnterModelSelect(ctx context.Context, width, height int) error
EnterModelSelect enters model selection mode
func (*SelectorState) EnterProviderSelect ¶
func (s *SelectorState) EnterProviderSelect(width, height int) error
EnterProviderSelect enters provider selection mode
func (*SelectorState) GoBack ¶
func (s *SelectorState) GoBack() bool
GoBack goes back to the previous level
func (*SelectorState) HandleConnectResult ¶
func (s *SelectorState) HandleConnectResult(msg ProviderConnectResultMsg)
HandleConnectResult updates the selector state with connection result
func (*SelectorState) HandleKeypress ¶
func (s *SelectorState) HandleKeypress(key tea.KeyMsg) tea.Cmd
HandleKeypress handles a keypress and returns a command if selection is made
func (*SelectorState) IsActive ¶
func (s *SelectorState) IsActive() bool
IsActive returns whether the selector is active
func (*SelectorState) MoveDown ¶
func (s *SelectorState) MoveDown()
MoveDown moves the selection down
func (*SelectorState) Select ¶
func (s *SelectorState) Select() tea.Cmd
Select handles selection and returns a command
func (*SelectorState) SetModel ¶
func (s *SelectorState) SetModel(modelID string, providerName string, authMethod provider.AuthMethod) (string, error)
SetModel sets the current model
type SelectorTab ¶
type SelectorTab int
SelectorTab represents which tab is active in the provider selector
const ( TabLLM SelectorTab = iota TabSearch )
type SelectorType ¶
type SelectorType int
SelectorType represents what kind of selection we're doing
const ( SelectorTypeProvider SelectorType = iota SelectorTypeModel )
type SuggestionState ¶
type SuggestionState struct {
// contains filtered or unexported fields
}
SuggestionState holds the state for command suggestions
func NewSuggestionState ¶
func NewSuggestionState() SuggestionState
NewSuggestionState creates a new SuggestionState
func (*SuggestionState) GetSelected ¶
func (s *SuggestionState) GetSelected() string
GetSelected returns the currently selected command name, or empty string if none
func (*SuggestionState) IsVisible ¶
func (s *SuggestionState) IsVisible() bool
IsVisible returns whether suggestions are visible
func (*SuggestionState) MoveDown ¶
func (s *SuggestionState) MoveDown()
MoveDown moves the selection down
func (*SuggestionState) Render ¶
func (s *SuggestionState) Render(width int) string
Render renders the suggestions box
func (*SuggestionState) UpdateSuggestions ¶
func (s *SuggestionState) UpdateSuggestions(input string)
UpdateSuggestions updates suggestions based on input