cli

package
v0.0.0-...-d80aada Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package cli provides simplified command-line interface This version removes all subcommands for a cleaner, more direct experience

Package cli provides command-line interface functionality

This package coordinates CLI operations but delegates business logic to appropriate service packages. It should focus on: - Command parsing and validation - User interaction (prompts, output formatting) - Calling appropriate services - Error presentation to users

Business logic should live in service packages, not here.

Package cli provides command-line interface implementations

Package cli provides first-time setup functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunSetupIfNeeded

func RunSetupIfNeeded(cfg *config.Config) error

RunSetupIfNeeded runs the setup wizard if needed

func ShowBeautifulWelcome

func ShowBeautifulWelcome(userName string)

ShowBeautifulWelcome shows a beautiful welcome screen

Types

type ChatOptions

type ChatOptions struct {
	Temperature float32
	MaxTokens   int
}

ChatOptions configures chat behavior

type Session

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

Session holds all state and dependencies for a CLI session. It follows the same pattern as ai.Service and assistant.Assistant.

func NewSession

func NewSession(cfg *config.Config, ai *ai.Service, db *pgxpool.Pool, assistant assistant.Assistant, log logger.Logger) (*Session, error)

NewSession creates a new CLI session with validated dependencies. Returns an error if required dependencies are missing.

func (*Session) AI

func (s *Session) AI() *ai.Service

AI returns the session's AI service. This provides access to the underlying AI provider.

func (*Session) Assistant

func (s *Session) Assistant() assistant.Assistant

Assistant returns the session's assistant instance. This provides access to the chat functionality.

func (*Session) Chat

Chat delegates to the internal assistant

func (*Session) Config

func (s *Session) Config() *config.Config

Config returns the configuration

func (*Session) ConversationID

func (s *Session) ConversationID() uuid.UUID

ConversationID returns the current conversation ID

func (*Session) DB

func (s *Session) DB() *pgxpool.Pool

DB returns the session's database connection pool. Returns nil if no database is configured.

func (*Session) GetConversationID

func (s *Session) GetConversationID() string

GetConversationID returns the current conversation ID as string

func (*Session) GetConversationManager

func (s *Session) GetConversationManager() *conversation.Manager

GetConversationManager returns the conversation manager if available This is a more specific method that avoids exposing raw database

func (*Session) GetMaxTokens

func (s *Session) GetMaxTokens() int

GetMaxTokens returns the max tokens setting

func (*Session) GetOwnerName

func (s *Session) GetOwnerName() string

GetOwnerName returns the owner's name

func (*Session) GetTemperature

func (s *Session) GetTemperature() float32

GetTemperature returns the temperature setting

func (*Session) HasDatabase

func (s *Session) HasDatabase() bool

HasDatabase returns true if a database is configured

func (*Session) HasMemoryCapability

func (s *Session) HasMemoryCapability() bool

HasMemoryCapability returns true if memory features are available

func (*Session) Options

func (s *Session) Options() ChatOptions

Options returns the current chat options

func (*Session) OwnerName

func (s *Session) OwnerName() string

OwnerName returns the owner's name (for backward compatibility)

func (*Session) SetConversationID

func (s *Session) SetConversationID(id string) error

SetConversationID updates the conversation ID from string

func (*Session) SetConversationUUID

func (s *Session) SetConversationUUID(id uuid.UUID)

SetConversationUUID updates the conversation ID

func (*Session) SetMaxTokens

func (s *Session) SetMaxTokens(tokens int)

SetMaxTokens sets the max tokens

func (*Session) SetOptions

func (s *Session) SetOptions(opts ChatOptions)

SetOptions updates the chat options

func (*Session) SetTemperature

func (s *Session) SetTemperature(temp float32)

SetTemperature sets the temperature

func (*Session) Stream

func (s *Session) Stream(ctx context.Context, req assistant.Request) (<-chan assistant.StreamChunk, error)

Stream delegates to the internal assistant

type SetupWizard

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

SetupWizard runs the first-time setup wizard

func NewSetupWizard

func NewSetupWizard(cfg *config.Config) *SetupWizard

NewSetupWizard creates a new setup wizard

func (*SetupWizard) Run

func (s *SetupWizard) Run() error

Run executes the setup wizard

type SimpleRootCmd

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

SimpleRootCmd creates a simplified root command with no subcommands

func NewSimpleRootCmd

func NewSimpleRootCmd(cfg *config.Config, aiService *ai.Service, db *pgxpool.Pool, assistantService assistant.Assistant, log logger.Logger) (*SimpleRootCmd, error)

NewSimpleRootCmd creates root command without subcommands

func (*SimpleRootCmd) Execute

func (rc *SimpleRootCmd) Execute() error

Execute runs the command

type UI

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

UI provides simple command-line interface (no TTY dependency)

func NewUI

func NewUI() *UI

NewUI creates new simple UI

func (*UI) GetChoice

func (ui *UI) GetChoice() string

GetChoice gets user choice

func (*UI) Prompt

func (ui *UI) Prompt(message string) string

Prompt shows prompt and gets input

func (*UI) ShowMenu

func (ui *UI) ShowMenu()

ShowMenu shows main menu

func (*UI) ShowMessage

func (ui *UI) ShowMessage(message string, isError bool)

ShowMessage shows message

func (*UI) WaitForEnter

func (ui *UI) WaitForEnter()

WaitForEnter waits for user to press Enter

type UserSetupInfo

type UserSetupInfo struct {
	Name     string
	Email    string
	Language string
	Timezone string
	Theme    string
}

UserSetupInfo holds user setup information

Directories

Path Synopsis
Package chat provides improved chat functionality
Package chat provides improved chat functionality
Package command implements the command system for the CLI interface.
Package command implements the command system for the CLI interface.
Package shutdown provides graceful shutdown with progress display
Package shutdown provides graceful shutdown with progress display
Package startup provides beautiful initialization progress display
Package startup provides beautiful initialization progress display
Package terminal provides enhanced terminal input handling
Package terminal provides enhanced terminal input handling
ui
Package ui provides unified UI components for the CLI
Package ui provides unified UI components for the CLI
components/chat
Package chat provides chat UI animations
Package chat provides chat UI animations
components/styles
Package styles provides shared UI styles and theming for the CLI interface.
Package styles provides shared UI styles and theming for the CLI interface.
render
Package render provides UI component builders for dynamic rendering
Package render provides UI component builders for dynamic rendering
views/conversations
Package conversations provides UI components for conversation management
Package conversations provides UI components for conversation management

Jump to

Keyboard shortcuts

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