tui

package
v0.0.0-...-6b1d25a Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChatOptions = []SelectOption{
	{
		Key:         "llama3.2:3b",
		Label:       "llama3.2:3b",
		Detail:      "~2.0 GB · 3B params",
		Description: "Recomendado — Meta Llama 3.2, balance velocidad/calidad",
	},
	{
		Key:         "phi4-mini:3.8b",
		Label:       "phi4-mini:3.8b",
		Detail:      "~2.5 GB · 3.8B params",
		Description: "Microsoft Phi-4 Mini, excelente para JSON y structured output",
	},
	{
		Key:         "qwen3.5:0.5b",
		Label:       "qwen3.5:0.5b",
		Detail:      "~0.4 GB · 0.5B params",
		Description: "Ultraligero, funciona en cualquier parte",
	},
	{
		Key:         "gemma3:2b",
		Label:       "gemma3:2b",
		Detail:      "~1.5 GB · 2B params",
		Description: "Google Gemma 3, buena relación calidad/tamaño",
	},
	{
		Key:         "mistral:7b",
		Label:       "mistral:7b",
		Detail:      "~4.1 GB · 7B params",
		Description: "Más preciso pero pesado — requiere GPU o mucha RAM",
	},
}
View Source
var EmbeddingOptions = []SelectOption{
	{
		Key:         "mxbai-embed-large:latest",
		Label:       "mxbai-embed-large",
		Detail:      "1024 dims · ~0.5B",
		Description: "Recomendado — balance calidad/rendimiento",
	},
	{
		Key:         "nomic-embed-text:latest",
		Label:       "nomic-embed-text",
		Detail:      "768 dims · ~0.1B",
		Description: "Más rápido en CPU, bueno para equipos modestos",
	},
	{
		Key:         "all-minilm:latest",
		Label:       "all-minilm",
		Detail:      "384 dims · ~0.02B",
		Description: "Ultraligero, ideal para CPU o Raspberry Pi",
	},
}

Functions

func BrandLines

func BrandLines() []string

BrandLines retorna las líneas del brand (para bubbletea).

func ErrorStr

func ErrorStr(text string) string

ErrorStr renderiza un mensaje de error.

func FormatServiceStatus

func FormatServiceStatus(s ServiceStatus) string

FormatServiceStatus returns a colored string for service status.

func FormatTestResult

func FormatTestResult(r TestResult) string

FormatTestResult returns a colored string for a test result.

func GPUSummary

func GPUSummary() string

GPUSummary returns a formatted string with GPU detection results.

func Info

func Info(text string) string

Info renderiza un mensaje informativo.

func LogoLines

func LogoLines() []string

LogoLines retorna las líneas del logo (para bubbletea).

func PrintBrand

func PrintBrand(subtitle string)

PrintBrand imprime brand centrado sin borde en stdout.

func PrintError

func PrintError(text string)

PrintError imprime un error.

func PrintFullBanner

func PrintFullBanner(subtitle string)

PrintFullBanner imprime brand sin Zorro ni borde en stdout (compatibilidad).

func PrintInfo

func PrintInfo(text string)

PrintInfo imprime un mensaje informativo.

func PrintSuccess

func PrintSuccess(text string)

PrintSuccess imprime un mensaje de éxito.

func PrintWarning

func PrintWarning(text string)

PrintWarning imprime una advertencia.

func RenderBanner

func RenderBanner(variant BannerVariant, subtitle string, termWidth int) string

RenderBanner renders the appropriate banner for the given variant and width. NO usa bordes alrededor del ASCII art. Centra usando el ancho real de terminal.

func RenderBrand

func RenderBrand() string

RenderBrand renderiza el logo ZYRO 3D centrado con estilo naranja (sin borde).

func RenderFullBanner

func RenderFullBanner(subtitle string) string

RenderFullBanner es idéntico a RenderWelcome (sin Zorro, sin borde). Se mantiene para compatibilidad pero se recomienda usar RenderWelcome.

func RenderLogo() string

RenderLogo renderiza el Zorro Hacker centrado con estilo verde. Solo se usa para el tema de OpenCode, NO en el CLI install.

func RenderNewLogo() string

RenderNewLogo renderiza el nuevo zorro naranja.

func RenderSeparator

func RenderSeparator() string

RenderSeparator dibuja una línea horizontal sutil (ej: ─────────────).

func RenderSmallBanner

func RenderSmallBanner(subtitle string) string

RenderSmallBanner renders a minimal text-only banner for narrow terminals (sin borde).

func RenderStepGroup

func RenderStepGroup(steps []*InstallStep, s spinner.Model, termWidth int) string

RenderStepGroup renderiza la lista de pasos dentro de un contenedor con borde redondeado.

func RenderStepList

func RenderStepList(steps []*InstallStep, s spinner.Model) string

RenderStepList renders the list of steps with their current states. Opcionalmente se puede envolver en un borde con stepGroupStyle.

func RenderSummary

func RenderSummary(steps []*InstallStep) string

RenderSummary renders a summary table of all completed steps.

func RenderWelcome

func RenderWelcome(subtitle string) string

RenderWelcome renderiza brand + subtítulo centrados, SIN borde. Es el banner principal para el flujo de instalación.

func RunConfirm

func RunConfirm(question string) (bool, error)

RunConfirm displays an interactive Yes/No prompt and returns the choice. It blocks until the user makes a selection.

func RunInstall

func RunInstall(steps []InstallStep) error

RunInstall executes the installation TUI and returns any fatal error.

func RunMainMenu

func RunMainMenu() string

RunMainMenu displays the main menu and returns the selected option key. Returns "exit" if the user cancels.

func RunModelsFlow

func RunModelsFlow() map[string]string

RunModelsFlow ejecuta el flujo completo de configuración de modelos. Retorna la config seleccionada o nil si cancela.

func RunSelect

func RunSelect(title, subtitle string, options []SelectOption) string

RunSelect displays a selection list and returns the selected key. Returns empty string if cancelled.

func SetupHelixAutostart

func SetupHelixAutostart() string

SetupHelixAutostart configura HelixDB para inicio automático con systemd --user.

func SetupOllamaAutostart

func SetupOllamaAutostart() string

SetupOllamaAutostart configura Ollama para inicio automático.

func Success

func Success(text string) string

Success renderiza un mensaje de éxito con checkmark verde.

func Warning

func Warning(text string) string

Warning renderiza un mensaje de advertencia.

Types

type BannerVariant

type BannerVariant int

BannerVariant determines which banner to render based on terminal width.

const (
	// BannerMedium shows ZYRO 3D centered (≥60 cols).
	BannerMedium BannerVariant = iota
	// BannerSmall shows simple text (<60 cols).
	BannerSmall
)

func ResolveBanner

func ResolveBanner(width int) BannerVariant

ResolveBanner determines the banner variant based on terminal width.

type ConfirmModel

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

ConfirmModel is a bubbletea model for interactive Yes/No prompts. The user navigates with ↑↓ arrows and confirms with Enter.

func NewConfirmModel

func NewConfirmModel(question string) ConfirmModel

NewConfirmModel creates a new confirm model.

func (ConfirmModel) Init

func (m ConfirmModel) Init() tea.Cmd

func (ConfirmModel) Update

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

func (ConfirmModel) View

func (m ConfirmModel) View() string

type ConfirmResult

type ConfirmResult int

ConfirmResult represents the user's choice.

const (
	// ConfirmYes means the user selected "Sí".
	ConfirmYes ConfirmResult = iota
	// ConfirmNo means the user selected "No".
	ConfirmNo
)

type InstalStepMsg

type InstalStepMsg struct {
	// Index is the step index in the steps slice.
	Index int
	// Err is nil on success, or the error returned by Action.
	Err error
}

InstalStepMsg is sent when a step completes execution.

type InstallModel

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

InstallModel is the main bubbletea model for the multi-step installer.

func NewInstallModel

func NewInstallModel(steps []InstallStep) InstallModel

NewInstallModel creates a new InstallModel with the given steps.

func (InstallModel) Init

func (m InstallModel) Init() tea.Cmd

Init starts the first step and the spinner.

func (InstallModel) Update

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

Update handles messages and updates the model.

func (InstallModel) View

func (m InstallModel) View() string

View renders the current state of the installer.

type InstallStep

type InstallStep struct {
	// Name is the descriptive title (e.g. "Extracting MCP tools").
	Name string

	// Action is the function that performs the actual work.
	// It runs in a goroutine. Returns error on failure.
	Action func() error
	// contains filtered or unexported fields
}

InstallStep defines a single step in the installation process.

type MenuItem struct {
	Key         string
	Label       string
	Description string
}

MenuItem represents a single option in the main menu.

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

MenuModel is the main menu Bubbletea model.

func NewMainMenu

func NewMainMenu() MenuModel

NewMainMenu creates the main menu with default options.

func (m MenuModel) Init() tea.Cmd
func (m MenuModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
func (m MenuModel) View() string

type SelectModel

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

SelectModel is a generic list selector for choosing from options.

func NewSelectModel

func NewSelectModel(title, subtitle string, options []SelectOption) SelectModel

NewSelectModel creates a new selection list.

func (SelectModel) Init

func (m SelectModel) Init() tea.Cmd

func (SelectModel) Update

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

func (SelectModel) View

func (m SelectModel) View() string

type SelectOption

type SelectOption struct {
	Key         string
	Label       string
	Description string
	Detail      string // right-aligned detail (e.g. "1024 dims", "2.0 GB")
}

SelectOption represents an option in a selection list.

type ServiceStatus

type ServiceStatus struct {
	Name    string
	Running bool
	URL     string
}

ServiceStatus represents the status of a service.

func CheckHelixDB

func CheckHelixDB() ServiceStatus

CheckHelixDB verifica que HelixDB esté corriendo.

func CheckOllama

func CheckOllama() ServiceStatus

CheckOllama verifica que Ollama esté corriendo.

type StepState

type StepState int

StepState represents the current state of an installation step.

const (
	// StepPending means the step hasn't started yet.
	StepPending StepState = iota
	// StepRunning means the step is currently executing (spinner visible).
	StepRunning
	// StepDone means the step completed successfully.
	StepDone
	// StepError means the step failed.
	StepError
)

func (StepState) String

func (s StepState) String() string

String returns a visual representation of the step state.

type TestResult

type TestResult struct {
	Name   string
	OK     bool
	Detail string
}

TestResult holds the result of a model test.

func TestChat

func TestChat(model string, timeout int) TestResult

TestChat prueba el modelo chat contra Ollama.

func TestEmbedding

func TestEmbedding(model string, timeout int) TestResult

TestEmbedding prueba el modelo de embeddings contra Ollama.

Jump to

Keyboard shortcuts

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