config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config handles application configuration loading and defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColorConfig

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

ColorConfig holds light and dark hex codes for a specific semantic role.

func (ColorConfig) Dark

func (c ColorConfig) Dark() string

Dark returns the hex code for dark mode.

func (ColorConfig) Light

func (c ColorConfig) Light() string

Light returns the hex code for light mode.

type Config

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

Config holds all application configuration values.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration.

func (*Config) Providers

func (c *Config) Providers() ProviderConfig

Providers returns the configuration for AI providers.

func (*Config) Tools

func (c *Config) Tools() ToolsConfig

Tools returns the configuration for tools.

func (*Config) UI

func (c *Config) UI() UIConfig

UI returns the configuration for the terminal UI.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks config values for life correctness. Returns an error if any values are invalid.

type FileReader

type FileReader struct{}

FileReader implements FileSystem using the real OS for config loading.

func (FileReader) MkdirAll

func (FileReader) MkdirAll(path string, perm os.FileMode) error

MkdirAll creates a directory named path, along with any necessary parents.

func (FileReader) ReadFile

func (FileReader) ReadFile(path string) ([]byte, error)

ReadFile reads the file named by path and returns the contents.

func (FileReader) UserHomeDir

func (FileReader) UserHomeDir() (string, error)

UserHomeDir returns the current user's home directory.

func (FileReader) WriteFile

func (FileReader) WriteFile(path string, data []byte, perm os.FileMode) error

WriteFile writes data to a file named by path.

type FileSystem

type FileSystem interface {
	UserHomeDir() (string, error)
	ReadFile(path string) ([]byte, error)
	WriteFile(path string, data []byte, perm os.FileMode) error
	MkdirAll(path string, perm os.FileMode) error
}

FileSystem abstracts file operations for testability.

type Manager

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

Manager handles configuration loading with injected dependencies.

func NewManager

func NewManager(fs FileSystem) *Manager

NewManager creates a Manager with the provided filesystem.

func (*Manager) Load

func (m *Manager) Load() (*Config, error)

Load reads configuration and merges it with defaults.

type ModelConfig

type ModelConfig struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	ContextWindow int    `json:"context_window"`
}

ModelConfig represents an AI model configuration.

type ProviderConfig

type ProviderConfig map[string][]ModelConfig

ProviderConfig maps provider names to their available models.

type ToolsConfig

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

ToolsConfig holds tool-specific configuration.

func (ToolsConfig) MaxFileSize

func (c ToolsConfig) MaxFileSize() int64

MaxFileSize returns the maximum file size allowed for tool operations.

func (ToolsConfig) MaxIterations

func (c ToolsConfig) MaxIterations() int

MaxIterations returns the maximum number of tool iterations per request.

func (ToolsConfig) PermissionDefault

func (c ToolsConfig) PermissionDefault() string

PermissionDefault returns the default permission level for tools.

func (ToolsConfig) ToolPermissions

func (c ToolsConfig) ToolPermissions() map[string]string

ToolPermissions returns a copy of the tool-specific permission levels.

type UIConfig

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

UIConfig holds styling configuration for the terminal UI.

func (UIConfig) BashOutputHeight

func (c UIConfig) BashOutputHeight() int

BashOutputHeight returns the maximum height of bash output blocks.

func (UIConfig) ChatWindowWidth

func (c UIConfig) ChatWindowWidth() int

ChatWindowWidth returns the width of the chat UI in characters.

func (UIConfig) ErrorColor

func (c UIConfig) ErrorColor() ColorConfig

ErrorColor returns the color used for error indicators.

func (UIConfig) MutedColor

func (c UIConfig) MutedColor() ColorConfig

MutedColor returns the color used for secondary or less important text.

func (UIConfig) PrimaryColor

func (c UIConfig) PrimaryColor() ColorConfig

PrimaryColor returns the primary brand color.

func (*UIConfig) SetChatWindowWidth

func (c *UIConfig) SetChatWindowWidth(w int)

SetChatWindowWidth updates the chat window width.

func (UIConfig) SuccessColor

func (c UIConfig) SuccessColor() ColorConfig

SuccessColor returns the color used for success indicators.

func (UIConfig) TextColor

func (c UIConfig) TextColor() ColorConfig

TextColor returns the color used for primary body text.

func (UIConfig) ThinkingHeight

func (c UIConfig) ThinkingHeight() int

ThinkingHeight returns the height of the thinking/process indicator.

Jump to

Keyboard shortcuts

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