cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source

Logo contains the ASCII art for the application

Variables

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

	// 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"),

	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 FormatToolResult

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

func Start

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

func StartWithProject

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

Types

type AgentState

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

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 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 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
	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"`
}

OpenRouterModel represents a model from OpenRouter API

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 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) *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 messages and updates the model

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"`
}

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