config

package
v1.0.43 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPersonalConfigPath added in v1.0.34

func GetPersonalConfigPath(projectPath string) string

func IsValidKey added in v1.0.34

func IsValidKey(key string) bool

func ResolveAgentEnv added in v1.0.34

func ResolveAgentEnv() map[string]string

Types

type AgentConfig added in v1.0.34

type AgentConfig struct {
	BaseURL         string            `yaml:"base-url" json:"base_url"`
	AuthToken       string            `yaml:"auth-token" json:"auth_token" sensitive:"true"`
	APIKey          string            `yaml:"api-key" json:"api_key" sensitive:"true"`
	Model           string            `yaml:"model" json:"model"`
	ModelSonnet     string            `yaml:"model.sonnet" json:"model_sonnet"`
	ModelOpus       string            `yaml:"model.opus" json:"model_opus"`
	ModelHaiku      string            `yaml:"model.haiku" json:"model_haiku"`
	SubagentModel   string            `yaml:"subagent-model" json:"subagent_model"`
	Provider        string            `yaml:"provider" json:"provider"`
	PermissionMode  string            `yaml:"permission-mode" json:"permission_mode"`
	SkipPermissions bool              `yaml:"skip-permissions" json:"skip_permissions"`
	Effort          string            `yaml:"effort" json:"effort"`
	AllowedTools    []string          `yaml:"allowed-tools" json:"allowed_tools"`
	Env             map[string]string `yaml:"env" json:"env"`
}

func DefaultAgentConfig added in v1.0.34

func DefaultAgentConfig() *AgentConfig

type Config

type Config struct {
	DefaultProjectDir  string                  `yaml:"default_project_dir" json:"default_project_dir"`
	PreferredShell     string                  `yaml:"preferred_shell" json:"preferred_shell"`
	TUIEnabled         bool                    `yaml:"tui_enabled" json:"tui_enabled"`
	AutoInstallDeps    bool                    `yaml:"auto_install_deps" json:"auto_install_deps"`
	FallbackToPlainCLI bool                    `yaml:"fallback_to_plain_cli" json:"fallback_to_plain_cli"`
	LogLevel           string                  `yaml:"log_level" json:"log_level"`
	Theme              string                  `yaml:"theme" json:"theme"`
	Language           string                  `yaml:"language" json:"language"`
	Agent              *AgentConfig            `yaml:"agent,omitempty" json:"agent,omitempty"`
	Profiles           map[string]*AgentConfig `yaml:"profiles,omitempty" json:"profiles,omitempty"`
	ActiveProfile      string                  `yaml:"active-profile,omitempty" json:"active_profile,omitempty"`
}

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func Load

func Load() (*Config, error)

Load loads the configuration from file

func (*Config) CreateProfile added in v1.0.34

func (c *Config) CreateProfile(name string, agent *AgentConfig) error

func (*Config) DeleteProfile added in v1.0.34

func (c *Config) DeleteProfile(name string) error

func (*Config) GetActiveProfile added in v1.0.34

func (c *Config) GetActiveProfile() string

func (*Config) GetProfile added in v1.0.34

func (c *Config) GetProfile(name string) (*AgentConfig, error)

func (*Config) HasProfiles added in v1.0.34

func (c *Config) HasProfiles() bool

func (*Config) HasSensitiveValues added in v1.0.34

func (c *Config) HasSensitiveValues() bool

func (*Config) ListProfiles added in v1.0.34

func (c *Config) ListProfiles() []string

func (*Config) ProfileExists added in v1.0.34

func (c *Config) ProfileExists(name string) bool

func (*Config) Save

func (c *Config) Save() error

Save saves the configuration to file

func (*Config) SetActiveProfile added in v1.0.34

func (c *Config) SetActiveProfile(name string) error

type ConfigKeyDef added in v1.0.34

type ConfigKeyDef struct {
	Key         string        `json:"key"`
	Type        ConfigKeyType `json:"type"`
	EnvVar      string        `json:"env_var"`
	CLIFlag     string        `json:"cli_flag"`
	Default     interface{}   `json:"default"`
	Sensitive   bool          `json:"sensitive"`
	Description string        `json:"description"`
	EnumValues  []string      `json:"enum_values,omitempty"`
	Category    string        `json:"category"`
}

func LookupKey added in v1.0.34

func LookupKey(key string) (*ConfigKeyDef, error)

type ConfigKeyType added in v1.0.34

type ConfigKeyType string
const (
	KeyTypeString     ConfigKeyType = "string"
	KeyTypeBool       ConfigKeyType = "bool"
	KeyTypeEnum       ConfigKeyType = "enum"
	KeyTypeStringList ConfigKeyType = "string-list"
	KeyTypeStringMap  ConfigKeyType = "string-map"
)

type ConfigScope added in v1.0.34

type ConfigScope string
const (
	ScopeDefault       ConfigScope = "default"
	ScopeGlobal        ConfigScope = "global"
	ScopeProfile       ConfigScope = "profile"
	ScopeTeamLocal     ConfigScope = "local"
	ScopePersonalLocal ConfigScope = "personal"
)

type PersonalConfig added in v1.0.34

type PersonalConfig struct {
	Agent         *AgentConfig `yaml:"agent,omitempty"`
	ActiveProfile string       `yaml:"active-profile,omitempty"`
}

func LoadPersonal added in v1.0.34

func LoadPersonal(projectPath string) (*PersonalConfig, error)

func (*PersonalConfig) HasAgentConfig added in v1.0.34

func (c *PersonalConfig) HasAgentConfig() bool

func (*PersonalConfig) Save added in v1.0.34

func (c *PersonalConfig) Save(projectPath string) error

func (*PersonalConfig) SetAgentConfigValue added in v1.0.34

func (c *PersonalConfig) SetAgentConfigValue(key, value string) error

func (*PersonalConfig) UnsetAgentConfigValue added in v1.0.34

func (c *PersonalConfig) UnsetAgentConfigValue(key string) error

type ResolvedConfig added in v1.0.34

type ResolvedConfig struct {
	Values        map[string]*ResolvedValue `json:"values"`
	ActiveProfile string                    `json:"active_profile"`
}

func MergeConfigs added in v1.0.34

func MergeConfigs(defaults, global, profile, teamLocal, personalLocal *AgentConfig) *ResolvedConfig

func ResolveAgentConfig added in v1.0.41

func ResolveAgentConfig() *ResolvedConfig

ResolveAgentConfig returns the fully resolved agent configuration. This includes both environment variables and CLI flags.

func (*ResolvedConfig) Get added in v1.0.34

func (r *ResolvedConfig) Get(key string) *ResolvedValue

func (*ResolvedConfig) GetCLIFlags added in v1.0.41

func (r *ResolvedConfig) GetCLIFlags() []string

GetCLIFlags returns CLI flags based on the schema definitions. This converts config values like skip-permissions=true to "--dangerously-skip-permissions".

func (*ResolvedConfig) GetEnvVars added in v1.0.34

func (r *ResolvedConfig) GetEnvVars() map[string]string

func (*ResolvedConfig) GetValue added in v1.0.34

func (r *ResolvedConfig) GetValue(key string) interface{}

type ResolvedValue added in v1.0.34

type ResolvedValue struct {
	Key       string      `json:"key"`
	Value     interface{} `json:"value"`
	Source    ConfigScope `json:"source"`
	Sensitive bool        `json:"sensitive"`
}

type SchemaRegistry added in v1.0.34

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

func GetRegistry added in v1.0.34

func GetRegistry() *SchemaRegistry

func (*SchemaRegistry) FindSimilar added in v1.0.34

func (r *SchemaRegistry) FindSimilar(key string) []string

func (*SchemaRegistry) IsValidKey added in v1.0.34

func (r *SchemaRegistry) IsValidKey(key string) bool

func (*SchemaRegistry) List added in v1.0.34

func (r *SchemaRegistry) List() []*ConfigKeyDef

func (*SchemaRegistry) ListByCategory added in v1.0.34

func (r *SchemaRegistry) ListByCategory() map[string][]*ConfigKeyDef

func (*SchemaRegistry) Lookup added in v1.0.34

func (r *SchemaRegistry) Lookup(key string) (*ConfigKeyDef, error)

Jump to

Keyboard shortcuts

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