Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirMode  os.FileMode = 0o700
	FileMode os.FileMode = 0o600
)
View Source
const DefaultTOML = `` /* 2903-byte string literal not displayed */

Variables

This section is empty.

Functions

func EnsureDir

func EnsureDir(dir string) error

func Keys

func Keys() []string

func SetInFile

func SetInFile(path, key, value string) error

func WriteFile

func WriteFile(path string, data []byte) error

Types

type Capture

type Capture struct {
	Precise        bool     `toml:"precise"`
	Exclude        []string `toml:"exclude"`
	MutatingTools  []string `toml:"mutating_tools"`
	ReadonlyTools  []string `toml:"readonly_tools"`
	MaxFileBytes   int64    `toml:"max_file_bytes"`
	MaxOutputBytes int      `toml:"max_output_bytes"`
	TestCommands   []string `toml:"test_commands"`
	TestGlobs      []string `toml:"test_globs"`
}

type Config

type Config struct {
	Capture   Capture   `toml:"capture"`
	LLM       LLM       `toml:"llm"`
	Rules     Rules     `toml:"rules"`
	Scope     Scope     `toml:"scope"`
	Redact    Redact    `toml:"redact"`
	Retention Retention `toml:"retention"`
	Notes     Notes     `toml:"notes"`
	UI        UI        `toml:"ui"`
}

func Default

func Default() Config

func Load

func Load(p Paths, repoDir string) (Config, error)

func (Config) Get

func (c Config) Get(key string) (string, error)

func (Config) Validate

func (c Config) Validate() error

type LLM

type LLM struct {
	Provider           string  `toml:"provider"`
	Model              string  `toml:"model"`
	BaseURL            string  `toml:"base_url"`
	APIKeyEnv          string  `toml:"api_key_env"`
	MaxUSDPerChange    float64 `toml:"max_usd_per_change"`
	SendCode           bool    `toml:"send_code"`
	PriceInputPerMTok  float64 `toml:"price_input_per_mtok"`
	PriceOutputPerMTok float64 `toml:"price_output_per_mtok"`
	MaxTokens          int     `toml:"max_tokens"`
}

func (LLM) EffectiveProvider

func (l LLM) EffectiveProvider() string

type Notes

type Notes struct {
	Auto bool `toml:"auto"`
}

type Paths

type Paths struct {
	ConfigDir  string
	ConfigFile string
	DataDir    string
	DB         string
	Spool      string
	Shadow     string
	Keys       string
	Logs       string
	LogFile    string
	LLMCache   string
}

func DefaultPaths

func DefaultPaths() Paths

DefaultPaths follows XDG_CONFIG_HOME and XDG_DATA_HOME. Without them it uses ~/.config and ~/.local/share, and on Windows %APPDATA% and %LOCALAPPDATA%.

func PathsAt

func PathsAt(configDir, dataDir string) Paths

func (Paths) Ensure

func (p Paths) Ensure() error

type Redact

type Redact struct {
	Patterns         []string `toml:"patterns"`
	EntropyThreshold float64  `toml:"entropy_threshold"`
	EntropyMinLength int      `toml:"entropy_min_length"`
}

type Retention

type Retention struct {
	SnapshotsDays int `toml:"snapshots_days"`
	RawDays       int `toml:"raw_days"`
}

type Rules

type Rules struct {
	Disabled         []string          `toml:"disabled"`
	Severity         map[string]string `toml:"severity"`
	LargeChangeLines int               `toml:"large_change_lines"`
	LargeChangeFiles int               `toml:"large_change_files"`
	RetryLoopRuns    int               `toml:"retry_loop_runs"`
}

type Scope

type Scope struct {
	Paths []string `toml:"paths"`
}

type UI

type UI struct {
	Theme  string            `toml:"theme"`
	Keymap map[string]string `toml:"keymap"`
}

Jump to

Keyboard shortcuts

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