config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WarnWriter io.Writer = os.Stderr

WarnWriter is the destination for config warnings (e.g. unknown fields). It defaults to os.Stderr but can be overridden in tests.

Functions

func ReadLanguageOnly added in v1.0.0

func ReadLanguageOnly(dir string) string

ReadLanguageOnly reads only the language field from .lorerc without full config loading. This is used before Cobra command construction so that i18n.T() returns the correct language for command Short/Long strings. Returns "" if the file is absent, unreadable, or has no language field. No validation, no Viper, no error surfacing — silent fallback.

func RegisterFlags

func RegisterFlags(cmd *cobra.Command)

RegisterFlags declares persistent CLI flags on the given command. Called by cmd/root.go — no Viper dependency is exposed.

Types

type AIConfig

type AIConfig struct {
	Provider string        `yaml:"provider" mapstructure:"provider"`
	Model    string        `yaml:"model" mapstructure:"model"`
	APIKey   string        `yaml:"api_key" mapstructure:"api_key"`
	Endpoint string        `yaml:"endpoint" mapstructure:"endpoint"`
	Timeout  time.Duration `yaml:"timeout" mapstructure:"timeout"`
}

type AngelaConfig

type AngelaConfig struct {
	Mode       string                 `yaml:"mode" mapstructure:"mode"`
	MaxTokens  int                    `yaml:"max_tokens" mapstructure:"max_tokens"`
	StyleGuide map[string]interface{} `yaml:"style_guide" mapstructure:"style_guide"`
}

type Config

type Config struct {
	Language     string             `yaml:"language" mapstructure:"language"`
	AI           AIConfig           `yaml:"ai"`
	Angela       AngelaConfig       `yaml:"angela"`
	Decision     DecisionConfig     `yaml:"decision"`
	Notification NotificationConfig `yaml:"notification"`
	Templates    TemplatesConfig    `yaml:"templates"`
	Hooks        HooksConfig        `yaml:"hooks"`
	Output       OutputConfig       `yaml:"output"`
}

func Load

func Load() (*Config, error)

Load is a convenience wrapper that loads config from the current working directory.

func LoadFromDir

func LoadFromDir(dir string) (*Config, error)

LoadFromDir loads configuration from a specific directory.

func LoadFromDirWithFlags

func LoadFromDirWithFlags(dir string, cmd *cobra.Command) (*Config, error)

LoadFromDirWithFlags loads config with the full cascade including CLI flag overrides. Called by cmd/root.go in PersistentPreRunE after RegisterFlags.

type ConfigReport added in v1.0.0

type ConfigReport struct {
	Valid    bool              // true if no errors (warnings are OK)
	Warnings []string          // unknown fields, suggestions
	Errors   []string          // invalid values, parse errors
	Active   map[string]string // resolved values after cascade
}

ConfigReport holds the results of config validation.

func ValidateConfig added in v1.0.0

func ValidateConfig(dir string) *ConfigReport

ValidateConfig validates .lorerc and .lorerc.local files in dir. It checks for unknown fields (with "did you mean?" suggestions) and collects the active resolved values.

func (*ConfigReport) OK added in v1.0.0

func (r *ConfigReport) OK() bool

OK returns true when validation found no errors and no warnings.

type DecisionConfig added in v1.0.0

type DecisionConfig struct {
	ThresholdFull      int      `yaml:"threshold_full" mapstructure:"threshold_full"`
	ThresholdReduced   int      `yaml:"threshold_reduced" mapstructure:"threshold_reduced"`
	ThresholdSuggest   int      `yaml:"threshold_suggest" mapstructure:"threshold_suggest"`
	AlwaysAsk          []string `yaml:"always_ask" mapstructure:"always_ask"`
	AlwaysSkip         []string `yaml:"always_skip" mapstructure:"always_skip"`
	CriticalScopes     []string `yaml:"critical_scopes" mapstructure:"critical_scopes"`
	Learning           bool     `yaml:"learning" mapstructure:"learning"`
	LearningMinCommits int      `yaml:"learning_min_commits" mapstructure:"learning_min_commits"`
}

type HooksConfig

type HooksConfig struct {
	PostCommit      bool `yaml:"post_commit" mapstructure:"post_commit"`
	StarPrompt      bool `yaml:"star_prompt" mapstructure:"star_prompt"`
	StarPromptAfter int  `yaml:"star_prompt_after" mapstructure:"star_prompt_after"`
}

type NotificationConfig added in v1.0.0

type NotificationConfig struct {
	Mode         string   `yaml:"mode" mapstructure:"mode"`
	DisabledEnvs []string `yaml:"disabled_envs" mapstructure:"disabled_envs"`
}

type OutputConfig

type OutputConfig struct {
	Dir    string `yaml:"dir" mapstructure:"dir"`
	Format string `yaml:"format" mapstructure:"format"`
}

type TemplatesConfig

type TemplatesConfig struct {
	Dir string `yaml:"dir" mapstructure:"dir"`
}

Jump to

Keyboard shortcuts

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