cli

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source

Logo contains the ASCII art for the application

Variables

View Source
var ProcessingAnimationFrames = []string{
	"● ○ ○ ○ ○ ○",
	"● ● ○ ○ ○ ○",
	"● ● ● ○ ○ ○",
	"● ● ● ● ○ ○",
	"● ● ● ● ● ○",
	"● ● ● ● ● ●",
	"○ ● ● ● ● ●",
	"○ ○ ● ● ● ●",
	"○ ○ ○ ● ● ●",
	"○ ○ ○ ○ ● ●",
	"○ ○ ○ ○ ○ ●",
	"○ ○ ○ ○ ● ●",
	"○ ○ ○ ● ● ●",
	"○ ○ ● ● ● ●",
	"○ ● ● ● ● ●",
	"● ● ● ● ● ●",
	"● ● ● ● ● ○",
	"● ● ● ● ○ ○",
	"● ● ● ○ ○ ○",
	"● ● ○ ○ ○ ○",
	"● ○ ○ ○ ○ ○",
}
View Source
var Theme = struct {
	// Primary colors - Sky Blue theme
	Primary       lipgloss.Color // Main brand color (Sky Blue 400) #38BDF8
	PrimaryDark   lipgloss.Color // Darker variant (Sky Blue 500) #0EA5E9
	PrimaryStrong lipgloss.Color // Strong variant (Sky Blue 500) #0EA5E9
	PrimaryLight  lipgloss.Color // Light variant (Sky Blue 300) #7DD3FC

	// Cyan accent colors
	Cyan      lipgloss.Color // Cyan 400 #22D3EE
	CyanLight lipgloss.Color // Cyan 300 #67E8F9

	// Semantic colors - HTTP methods (pastel shades)
	Success lipgloss.Color // GET - Emerald 400 #34D399
	Error   lipgloss.Color // DELETE - Rose 400 #FB7185
	Warning lipgloss.Color // PUT - Amber 400 #FBBF24
	Info    lipgloss.Color // POST - Sky Blue 400 #38BDF8

	// Special accent colors
	Yellow  lipgloss.Color // Highlight - Yellow 300 #FDE047
	Fuchsia lipgloss.Color // Strong accent - Fuchsia 400 #E879F9

	// Text colors - readable hierarchy
	Text       lipgloss.Color // Primary text (Slate 50) #F8FAFC
	TextMuted  lipgloss.Color // Secondary text (Slate 300) #CBD5E1
	TextSubtle lipgloss.Color // Muted text (Slate 400) #94A3B8
	Gray       lipgloss.Color // Subtle text (Slate 500) #64748B
	White      lipgloss.Color // Pure white #FFFFFF

	// Background colors - depth and contrast
	BgDark      lipgloss.Color // Main background (Slate 950) #020617
	BgSecondary lipgloss.Color // Secondary background (Slate 900) #0F172A
	BgElevated  lipgloss.Color // Elevated background (Slate 800) #1E293B
	BgCode      lipgloss.Color // Code background (Slate 800) #1E293B
	BgSelected  lipgloss.Color // Selected item background (Slate 800) #1E293B

	// Border colors
	BorderSubtle  lipgloss.Color // Subtle border (Slate 700) #334155
	BorderDefault lipgloss.Color // Default border (Slate 600) #475569
	BorderBright  lipgloss.Color // Bright border (Sky Blue 500) #0EA5E9

	// Blue/Indigo shades (for gradients/headers)
	Blue      lipgloss.Color // Blue 400 #60A5FA
	BlueLight lipgloss.Color // Blue 300 #93C5FD
	Indigo    lipgloss.Color // Indigo 400 #818CF8
	Violet    lipgloss.Color // Violet 400 #A78BFA

	// Gradients
	LogoGradient      []string // Sky blue progression for logo
	AnimationGradient []string // Rainbow effect for animations
	HeaderGradient    []string // Sky to purple for headers
}{

	Primary:       lipgloss.Color("#38BDF8"),
	PrimaryDark:   lipgloss.Color("#0EA5E9"),
	PrimaryStrong: lipgloss.Color("#0EA5E9"),
	PrimaryLight:  lipgloss.Color("#7DD3FC"),

	Cyan:      lipgloss.Color("#22D3EE"),
	CyanLight: lipgloss.Color("#67E8F9"),

	Success: lipgloss.Color("#34D399"),
	Error:   lipgloss.Color("#FB7185"),
	Warning: lipgloss.Color("#FBBF24"),
	Info:    lipgloss.Color("#38BDF8"),

	Yellow:  lipgloss.Color("#FDE047"),
	Fuchsia: lipgloss.Color("#E879F9"),

	Text:       lipgloss.Color("#F8FAFC"),
	TextMuted:  lipgloss.Color("#CBD5E1"),
	TextSubtle: lipgloss.Color("#94A3B8"),
	Gray:       lipgloss.Color("#64748B"),
	White:      lipgloss.Color("#FFFFFF"),

	BgDark:      lipgloss.Color("#020617"),
	BgSecondary: lipgloss.Color("#0F172A"),
	BgElevated:  lipgloss.Color("#1E293B"),
	BgCode:      lipgloss.Color("#1E293B"),
	BgSelected:  lipgloss.Color("#2a2a2a"),

	BorderSubtle:  lipgloss.Color("#334155"),
	BorderDefault: lipgloss.Color("#475569"),
	BorderBright:  lipgloss.Color("#0EA5E9"),

	Blue:      lipgloss.Color("#60A5FA"),
	BlueLight: lipgloss.Color("#93C5FD"),
	Indigo:    lipgloss.Color("#818CF8"),
	Violet:    lipgloss.Color("#A78BFA"),

	LogoGradient: []string{
		"#0EA5E9",
		"#38BDF8",
		"#7DD3FC",
		"#BAE6FD",
	},
	AnimationGradient: []string{
		"#22D3EE",
		"#38BDF8",
		"#60A5FA",
		"#818CF8",
	},
	HeaderGradient: []string{
		"#38BDF8",
		"#60A5FA",
		"#818CF8",
		"#A78BFA",
	},
}

Theme defines the Sky Blue color palette for the entire application

Functions

func BuildAuthProviderFromForm

func BuildAuthProviderFromForm(authType string, fields []FormField) (auth.AuthProvider, string, error)

BuildAuthProviderFromForm creates an AuthProvider from form fields

func FetchModelsForProvider added in v0.3.0

func FetchModelsForProvider(cfg *config.Config) tea.Cmd

func FormatToolResult

func FormatToolResult(title string, details []string) []string
func RenderLogo() string

RenderLogo returns the styled logo with gradient colors.

func RenderProcessingAnimation added in v0.3.0

func RenderProcessingAnimation(frame int) string

func Start

func Start(baseURL string, specPath string, analysis *analyzer.Analysis, authProvider auth.AuthProvider, version string)

func StartWithConversation added in v0.3.0

func StartWithConversation(baseURL string, analysis *analyzer.Analysis, project *storage.Project, authProvider auth.AuthProvider, version string, conversationID string)

StartWithConversation starts the TUI with a loaded conversation

func StartWithProject

func StartWithProject(baseURL string, analysis *analyzer.Analysis, project *storage.Project, authProvider auth.AuthProvider, version string)

Types

type AgentState

type AgentState int
const (
	StateIdle AgentState = iota
	StateThinking
	StateUsingTool
	StateProcessing
	StateAskingConfirmation
	StateShowingCommands
	StateShowingTestPlan
	StateRunningTests
	StateWizard
	StateModelSelector
)

type ChatModel

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

Model represents the state of our chat-based interactive application

func NewChatModel

func NewChatModel(baseURL string, analysis *analyzer.Analysis) *ChatModel

NewChatModel creates a new chat-based interactive model

func (ChatModel) Init

func (m ChatModel) Init() tea.Cmd

Init initializes the model

func (ChatModel) Update

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

Update handles messages and updates the model

func (ChatModel) View

func (m ChatModel) View() string

View renders the UI

type Command

type Command struct {
	Name        string
	Description string
}

type ConversationListModel added in v0.3.0

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

ConversationListModel shows list of conversations for a project

func NewConversationListModel added in v0.3.0

func NewConversationListModel(project *storage.Project) ConversationListModel

NewConversationListModel creates a new conversation selector

func (ConversationListModel) GetSelectedConversation added in v0.3.0

func (m ConversationListModel) GetSelectedConversation() *storage.Conversation

GetSelectedConversation returns the selected conversation

func (ConversationListModel) Init added in v0.3.0

func (m ConversationListModel) Init() tea.Cmd

func (ConversationListModel) IsCancelled added in v0.3.0

func (m ConversationListModel) IsCancelled() bool

IsCancelled returns true if user cancelled

func (ConversationListModel) ShouldCreateNew added in v0.3.0

func (m ConversationListModel) ShouldCreateNew() bool

ShouldCreateNew returns true if user wants to create a new conversation

func (ConversationListModel) Update added in v0.3.0

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

func (ConversationListModel) View added in v0.3.0

func (m ConversationListModel) View() string

type ExecutionMode

type ExecutionMode int
const (
	ModeAsk ExecutionMode = iota
	ModeAutoExecute
)

type FormField

type FormField struct {
	Name        string
	Label       string
	Value       string
	Placeholder string
	IsPassword  bool
	IsRadio     bool
	RadioIndex  int      // For radio button groups
	Options     []string // Options for radio buttons
}

FormField represents a single input field in a form

func CreateAuthFormFields

func CreateAuthFormFields(authType string) []FormField

CreateAuthFormFields creates form fields based on selected auth type

type FormatInfo

type FormatInfo struct {
	Name            string // Human readable name
	NativeSupport   bool   // Can be parsed without conversion
	NeedsConversion bool   // Needs LLM conversion
	Version         string // Format version if detected
}

FormatInfo contains detected format information

type KeyTestResult

type KeyTestResult struct {
	Success  bool
	Models   []string
	Error    string
	Provider string // Which provider was actually tested
}

KeyTestResult signals the result of API key testing

type ModelSelector added in v0.3.0

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

func NewModelSelector added in v0.3.0

func NewModelSelector() *ModelSelector

func (*ModelSelector) GetSelectedModel added in v0.3.0

func (m *ModelSelector) GetSelectedModel() string

func (*ModelSelector) HandleKey added in v0.3.0

func (m *ModelSelector) HandleKey(msg tea.KeyMsg) (bool, string)

func (*ModelSelector) Render added in v0.3.0

func (m *ModelSelector) Render() string

func (*ModelSelector) SetError added in v0.3.0

func (m *ModelSelector) SetError(err string)

func (*ModelSelector) SetModels added in v0.3.0

func (m *ModelSelector) SetModels(models []string)

func (*ModelSelector) SetProvider added in v0.3.0

func (m *ModelSelector) SetProvider(provider string)

type ModelsFetchedMsg added in v0.3.0

type ModelsFetchedMsg struct {
	Models   []string
	Error    string
	Provider string
}

type OnboardingModel

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

OnboardingModel handles the onboarding flow

func NewOnboardingModel

func NewOnboardingModel() OnboardingModel

NewOnboardingModel creates the initial onboarding model

func (OnboardingModel) Init

func (m OnboardingModel) Init() tea.Cmd

Init initializes the onboarding model

func (OnboardingModel) Update

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

Update handles messages during onboarding

func (OnboardingModel) View

func (m OnboardingModel) View() string

View renders the onboarding UI

func (OnboardingModel) WasCompleted

func (m OnboardingModel) WasCompleted() bool

WasCompleted returns true if the user completed onboarding

type OnboardingMsg

type OnboardingMsg struct {
	NextState OnboardingState
}

OnboardingMsg signals state transitions

type OnboardingState

type OnboardingState int

OnboardingState tracks the onboarding progress

const (
	OnboardingWelcome OnboardingState = iota
	OnboardingProvider
	OnboardingAPIKey
	OnboardingServerURL
	OnboardingSelectModel
	OnboardingComplete
)

type OpenRouterModel

type OpenRouterModel struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	ContextLength int    `json:"context_length"`
	Pricing       struct {
		Prompt     string `json:"prompt"`
		Completion string `json:"completion"`
	} `json:"pricing"`
}

type ProjectCreatorModel

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

ProjectCreatorModel represents the project creation wizard

func NewProjectCreatorModel

func NewProjectCreatorModel() ProjectCreatorModel

NewProjectCreatorModel creates a new project creation wizard

func (ProjectCreatorModel) GetAuthConfig

func (m ProjectCreatorModel) GetAuthConfig() (authType string, authData map[string]string)

GetAuthConfig returns the auth configuration (type and fields map)

func (ProjectCreatorModel) GetDetectedFormat

func (m ProjectCreatorModel) GetDetectedFormat() string

GetDetectedFormat returns the detected format name for conversion

func (ProjectCreatorModel) GetProjectData

func (m ProjectCreatorModel) GetProjectData() (url, specPath, name string)

GetProjectData returns the project data entered by the user

func (ProjectCreatorModel) Init

func (m ProjectCreatorModel) Init() tea.Cmd

func (ProjectCreatorModel) IsCancelled

func (m ProjectCreatorModel) IsCancelled() bool

IsCancelled returns true if the user cancelled the wizard

func (ProjectCreatorModel) IsConfirmed

func (m ProjectCreatorModel) IsConfirmed() bool

IsConfirmed returns true if the user confirmed project creation

func (ProjectCreatorModel) NeedsConversion

func (m ProjectCreatorModel) NeedsConversion() bool

NeedsConversion returns true if the spec file needs LLM conversion

func (ProjectCreatorModel) Update

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

func (ProjectCreatorModel) View

func (m ProjectCreatorModel) View() string

type ProjectCreatorStep

type ProjectCreatorStep int

ProjectCreatorStep represents the current step in project creation

const (
	ProjectStepURL            ProjectCreatorStep = iota // API URL input
	ProjectStepSpecPath                                 // Specification file path input
	ProjectStepFormatDetected                           // Show detected format
	ProjectStepName                                     // Project name input
	ProjectStepAuthPrompt                               // Ask if user wants to configure auth
	ProjectStepAuthType                                 // Select auth type
	ProjectStepAuthDetails                              // Enter auth details
	ProjectStepConfirm                                  // Confirming creation
)

type ProjectListModel

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

ProjectListModel represents the interactive project list UI

func NewProjectListModel

func NewProjectListModel(projects []*storage.Project) ProjectListModel

func (ProjectListModel) GetError

func (m ProjectListModel) GetError() error

GetError returns any error that occurred

func (ProjectListModel) GetSelectedProject

func (m ProjectListModel) GetSelectedProject() *storage.Project

GetSelectedProject returns the selected project (call after tea.Program exits)

func (ProjectListModel) Init

func (m ProjectListModel) Init() tea.Cmd

func (ProjectListModel) ShouldCreateNew

func (m ProjectListModel) ShouldCreateNew() bool

ShouldCreateNew returns true if the user selected "Create new project"

func (ProjectListModel) Update

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

func (ProjectListModel) View

func (m ProjectListModel) View() string

type ProjectWithConversationsModel added in v0.3.0

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

ProjectWithConversationsModel shows projects with conversation preview below

func NewProjectWithConversationsModel added in v0.3.0

func NewProjectWithConversationsModel(projects []*storage.Project) ProjectWithConversationsModel

NewProjectWithConversationsModel creates a new project selector with conversation preview

func (ProjectWithConversationsModel) GetSelectedProject added in v0.3.0

func (m ProjectWithConversationsModel) GetSelectedProject() *storage.Project

GetSelectedProject returns the selected project

func (ProjectWithConversationsModel) Init added in v0.3.0

func (ProjectWithConversationsModel) IsCancelled added in v0.3.0

func (m ProjectWithConversationsModel) IsCancelled() bool

IsCancelled returns true if user cancelled

func (ProjectWithConversationsModel) Update added in v0.3.0

func (ProjectWithConversationsModel) View added in v0.3.0

type ResumeSelectorModel added in v0.3.0

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

ResumeSelectorModel is a fullscreen UI for selecting project and conversation.

func NewResumeSelectorModel added in v0.3.0

func NewResumeSelectorModel(projects []*storage.Project, version string) ResumeSelectorModel

NewResumeSelectorModel creates a new project and conversation selector.

func (ResumeSelectorModel) GetSelectedConversation added in v0.3.0

func (m ResumeSelectorModel) GetSelectedConversation() *storage.Conversation

GetSelectedConversation returns the selected conversation.

func (ResumeSelectorModel) GetSelectedProject added in v0.3.0

func (m ResumeSelectorModel) GetSelectedProject() *storage.Project

GetSelectedProject returns the selected project.

func (ResumeSelectorModel) Init added in v0.3.0

func (m ResumeSelectorModel) Init() tea.Cmd

Init initializes the model (required by tea.Model interface).

func (ResumeSelectorModel) IsCancelled added in v0.3.0

func (m ResumeSelectorModel) IsCancelled() bool

IsCancelled returns true if the user cancelled the selection.

func (ResumeSelectorModel) ShouldCreateNew added in v0.3.0

func (m ResumeSelectorModel) ShouldCreateNew() bool

ShouldCreateNew returns true if the user wants to create a new conversation.

func (ResumeSelectorModel) ShouldCreateNewProject added in v0.3.0

func (m ResumeSelectorModel) ShouldCreateNewProject() bool

ShouldCreateNewProject returns true if the user wants to create a new project.

func (ResumeSelectorModel) Update added in v0.3.0

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

Update handles messages and updates the selector state.

func (ResumeSelectorModel) View added in v0.3.0

func (m ResumeSelectorModel) View() string

View renders the selector UI.

type Test

type Test struct {
	ID          int
	Method      string
	Endpoint    string
	Description string
	Status      string
	Result      string
	BackendTest *agent.TestCase
	Selected    bool
}

type TestUIModel

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

TestUIModel represents the test UI state

func NewTestUIModel

func NewTestUIModel(baseURL string, specPath string, analysis *analyzer.Analysis, authProvider auth.AuthProvider, version string) *TestUIModel

func (TestUIModel) Init

func (m TestUIModel) Init() tea.Cmd

Init initializes the model

func (TestUIModel) RenderWizard

func (m TestUIModel) RenderWizard() string

RenderWizard renders the current wizard state

func (TestUIModel) Update

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

Update handles all incoming messages and updates the model state.

func (TestUIModel) View

func (m TestUIModel) View() string

View renders the UI

type ToolCallData

type ToolCallData struct {
	ID   string         `json:"id"`
	Name string         `json:"name"`
	Args map[string]any `json:"arguments"`
}

ToolCallData represents a tool call with its arguments.

type WizardState

type WizardState struct {
	Type          WizardType
	Step          WizardStep
	SelectedType  string   // Selected auth type: "bearer", "apikey", "basic"
	MenuItems     []string // Menu options for selection
	SelectedIndex int      // Currently selected menu item
	FormFields    []FormField
	FocusedField  int // Currently focused form field
}

WizardState holds the state of an active wizard

func NewAuthWizard

func NewAuthWizard() *WizardState

NewAuthWizard creates a new authentication wizard

type WizardStep

type WizardStep int

WizardStep represents the current step in a wizard

const (
	StepSelectType WizardStep = iota // Selecting auth type
	StepFillForm                     // Filling out form fields
	StepConfirm                      // Confirming action
)

type WizardType

type WizardType string

WizardType represents the type of wizard currently active

const (
	WizardNone    WizardType = ""
	WizardAuth    WizardType = "auth"
	WizardProfile WizardType = "profile"
)

Jump to

Keyboard shortcuts

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