config

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides configuration management for the noidea tool. It handles loading, saving, and validating user configuration settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAPIKey added in v0.2.3

func DeleteAPIKey(provider string) error

DeleteAPIKey removes the API key from secure storage and config

func ParseFloat

func ParseFloat(s string, defaultVal float64) float64

ParseFloat parses a string to a float64 with a default value if parsing fails

func SaveAPIKey added in v0.2.3

func SaveAPIKey(provider, apiKey string) error

SaveAPIKey saves the API key to secure storage and updates the config file The API key is intentionally NOT saved in the config file for security

func SaveConfig

func SaveConfig(cfg Config) error

SaveConfig saves the configuration to the default location

func ValidateConfig

func ValidateConfig(config Config) []string

ValidateConfig checks the configuration for errors or inconsistencies Returns a list of issues or an empty slice if the config is valid

Types

type Config

type Config struct {
	// LLM contains settings for the AI language model integration
	LLM struct {
		Enabled     bool    `json:"enabled"`
		Provider    string  `json:"provider"`    // "xai", "openai", "deepseek"
		APIKey      string  `json:"api_key"`     // API key for the language model provider
		Model       string  `json:"model"`       // Model name to use
		Temperature float64 `json:"temperature"` // Temperature for AI responses (0.0-1.0)
	} `json:"llm"`

	// Moai contains settings for the Moai feedback system
	Moai struct {
		UseLint         bool   `json:"use_lint"`         // Include linting feedback
		FacesMode       string `json:"faces_mode"`       // "random", "sequential", "mood"
		Personality     string `json:"personality"`      // Selected personality
		PersonalityFile string `json:"personality_file"` // Custom personality definitions
		Feedback        bool   `json:"feedback"`         // Enable AI feedback in post-commit hook
	} `json:"moai"`
}

Config represents the application configuration

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a default configuration

func LoadConfig

func LoadConfig() Config

LoadConfig loads the configuration from the default location or environment variables If the config file doesn't exist, it returns the default config

Jump to

Keyboard shortcuts

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