config

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

func ConfigPath

func ConfigPath() string

func CredentialsPath added in v0.2.0

func CredentialsPath() string
func DefaultProviderLinks() map[string]string

DefaultProviderLinks returns built-in telemetry provider-id to dashboard provider-id mappings.

func DeleteCredential added in v0.2.0

func DeleteCredential(accountID string) error

func DeleteCredentialFrom added in v0.2.0

func DeleteCredentialFrom(path, accountID string) error

func Save

func Save(cfg Config) error

func SaveAutoDetected

func SaveAutoDetected(accounts []core.AccountConfig) error

SaveAutoDetected persists auto-detected accounts into the config file (read-modify-write).

func SaveAutoDetectedTo

func SaveAutoDetectedTo(path string, accounts []core.AccountConfig) error

func SaveCredential added in v0.2.0

func SaveCredential(accountID, apiKey string) error

func SaveCredentialTo added in v0.2.0

func SaveCredentialTo(path, accountID, apiKey string) error

func SaveDashboardProviders

func SaveDashboardProviders(providers []DashboardProviderConfig) error

SaveDashboardProviders persists dashboard provider preferences into the config file (read-modify-write).

func SaveDashboardProvidersTo

func SaveDashboardProvidersTo(path string, providers []DashboardProviderConfig) error

func SaveTheme

func SaveTheme(theme string) error

SaveTheme persists a theme name into the config file (read-modify-write).

func SaveThemeTo

func SaveThemeTo(path string, theme string) error

func SaveTo

func SaveTo(path string, cfg Config) error

Types

type Config

type Config struct {
	UI                   UIConfig                      `json:"ui"`
	Theme                string                        `json:"theme"`
	Experimental         ExperimentalConfig            `json:"experimental"`
	Telemetry            TelemetryConfig               `json:"telemetry"`
	Dashboard            DashboardConfig               `json:"dashboard"`
	ModelNormalization   core.ModelNormalizationConfig `json:"model_normalization"`
	AutoDetect           bool                          `json:"auto_detect"`
	Accounts             []core.AccountConfig          `json:"accounts"`
	AutoDetectedAccounts []core.AccountConfig          `json:"auto_detected_accounts"`
}

func DefaultConfig

func DefaultConfig() Config

func Load

func Load() (Config, error)

func LoadFrom

func LoadFrom(path string) (Config, error)

type Credentials added in v0.2.0

type Credentials struct {
	Keys map[string]string `json:"keys"` // account ID → API key
}

func LoadCredentials added in v0.2.0

func LoadCredentials() (Credentials, error)

func LoadCredentialsFrom added in v0.2.0

func LoadCredentialsFrom(path string) (Credentials, error)

type DashboardConfig

type DashboardConfig struct {
	Providers []DashboardProviderConfig `json:"providers"`
}

type DashboardProviderConfig

type DashboardProviderConfig struct {
	AccountID string `json:"account_id"`
	Enabled   bool   `json:"enabled"`
}

func (*DashboardProviderConfig) UnmarshalJSON

func (p *DashboardProviderConfig) UnmarshalJSON(data []byte) error

type ExperimentalConfig

type ExperimentalConfig struct {
	Analytics bool `json:"analytics"`
}

type TelemetryConfig added in v0.5.0

type TelemetryConfig struct {
	// ProviderLinks maps source telemetry provider IDs to configured provider IDs.
	// Example: {"anthropic":"claude_code"}.
	ProviderLinks map[string]string `json:"provider_links"`
}

type UIConfig

type UIConfig struct {
	RefreshIntervalSeconds int     `json:"refresh_interval_seconds"`
	WarnThreshold          float64 `json:"warn_threshold"`
	CritThreshold          float64 `json:"crit_threshold"`
}

Jump to

Keyboard shortcuts

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