Documentation
¶
Index ¶
- Variables
- func AddRepo(configPath, repoPath string) error
- func AllSettings() map[string]interface{}
- func FindConfigYAMLPath() (string, error)
- func GetBool(key string) bool
- func GetConfigFileUsed() string
- func GetDevlogDir() string
- func GetDevlogEnforceOnCommit() bool
- func GetDirectoryLabels() []string
- func GetDuration(key string) time.Duration
- func GetExternalProjects() map[string]string
- func GetIdentity(flagValue string) string
- func GetInt(key string) int
- func GetString(key string) string
- func GetStringMapString(key string) map[string]string
- func GetStringSlice(key string) []string
- func GetYamlConfig(key string) string
- func Initialize() error
- func IsYamlOnlyKey(key string) bool
- func LogOverride(override ConfigOverride)
- func RemoveRepo(configPath, repoPath string) error
- func ResolveExternalProjectPath(projectName string) string
- func Set(key string, value interface{})
- func SetReposInYAML(configPath string, repos *ReposConfig) error
- func SetYamlConfig(key, value string) error
- type ConfigOverride
- type ConfigSource
- type MultiRepoConfig
- type ReposConfig
Constants ¶
This section is empty.
Variables ¶
var YamlOnlyKeys = map[string]bool{ "no-db": true, "no-daemon": true, "no-auto-flush": true, "no-auto-import": true, "json": true, "auto-start-daemon": true, "db": true, "actor": true, "identity": true, "flush-debounce": true, "lock-timeout": true, "remote-sync-interval": true, "git.author": true, "git.no-gpg-sign": true, "no-push": true, "no-git-ops": true, "sync-branch": true, "sync.branch": true, "sync.require_confirmation_on_mass_delete": true, "daemon.auto_commit": true, "daemon.auto_push": true, "daemon.auto_pull": true, "routing.mode": true, "routing.default": true, "routing.maintainer": true, "routing.contributor": true, "create.require-description": true, "validation.on-create": true, "validation.on-sync": true, "devlog.enforce-on-commit": true, "devlog.dir": true, "devlog.author": true, "devlog.branch-tracking": true, "last-seen-changelog-version": true, "last-remote-version-check": true, "hierarchy.max-depth": true, }
YamlOnlyKeys are configuration keys that must be stored in config.yaml rather than the SQLite database. These are "startup" settings that are read before the database is opened.
This fixes GH#536: users were confused when `bd config set no-db true` appeared to succeed but had no effect (because no-db is read from yaml at startup, not from SQLite).
Functions ¶
func AddRepo ¶
AddRepo adds a repository to the repos.additional list in config.yaml If primary is not set, it defaults to "."
func AllSettings ¶
func AllSettings() map[string]interface{}
AllSettings returns all configuration settings as a map
func FindConfigYAMLPath ¶
FindConfigYAMLPath finds the config.yaml file in .beads directory Walks up from CWD to find .beads/config.yaml
func GetConfigFileUsed ¶
func GetConfigFileUsed() string
GetConfigFileUsed returns the path to the config file used by viper. Returns empty string if no config file was found.
func GetDevlogDir ¶
func GetDevlogDir() string
GetDevlogDir retrieves the devlog.dir configuration value
func GetDevlogEnforceOnCommit ¶
func GetDevlogEnforceOnCommit() bool
GetDevlogEnforceOnCommit retrieves the devlog.enforce-on-commit configuration value
func GetDirectoryLabels ¶
func GetDirectoryLabels() []string
GetDirectoryLabels returns labels for the current working directory based on config. It checks directory.labels config for matching patterns. Returns nil if no labels are configured for the current directory.
func GetDuration ¶
GetDuration retrieves a duration configuration value
func GetExternalProjects ¶
GetExternalProjects returns the external_projects configuration. Maps project names to paths for cross-project dependency resolution. Example config.yaml:
external_projects: beads: ../beads gastown: /absolute/path/to/gastown
func GetIdentity ¶
GetIdentity resolves the user's identity for messaging. Priority chain:
- flagValue (if non-empty, from --identity flag)
- BEADS_IDENTITY env var / config.yaml identity field (via viper)
- git config user.name
- hostname
This is used as the sender field in bd mail commands.
func GetStringMapString ¶
GetStringMapString retrieves a map[string]string configuration value
func GetStringSlice ¶
GetStringSlice retrieves a string slice configuration value
func GetYamlConfig ¶
GetYamlConfig gets a configuration value from config.yaml. Returns empty string if key is not found or is commented out. Keys are normalized to their canonical yaml format (e.g., sync.branch -> sync-branch).
func Initialize ¶
func Initialize() error
Initialize sets up the viper configuration singleton Should be called once at application startup
func IsYamlOnlyKey ¶
IsYamlOnlyKey returns true if the given key should be stored in config.yaml rather than the SQLite database.
func LogOverride ¶
func LogOverride(override ConfigOverride)
LogOverride logs a message about a configuration override in verbose mode.
func RemoveRepo ¶
RemoveRepo removes a repository from the repos.additional list in config.yaml
func ResolveExternalProjectPath ¶
ResolveExternalProjectPath resolves a project name to its absolute path. Returns empty string if project not configured or path doesn't exist.
func SetReposInYAML ¶
func SetReposInYAML(configPath string, repos *ReposConfig) error
SetReposInYAML writes the repos configuration to config.yaml It preserves other config sections and comments where possible
func SetYamlConfig ¶
SetYamlConfig sets a configuration value in the project's config.yaml file. It handles both adding new keys and updating existing (possibly commented) keys. Keys are normalized to their canonical yaml format (e.g., sync.branch -> sync-branch).
Types ¶
type ConfigOverride ¶
type ConfigOverride struct {
Key string
EffectiveValue interface{}
OverriddenBy ConfigSource
OriginalSource ConfigSource
OriginalValue interface{}
}
ConfigOverride represents a detected configuration override
func CheckOverrides ¶
func CheckOverrides(flagOverrides map[string]struct { Value interface{} WasSet bool }) []ConfigOverride
CheckOverrides checks for configuration overrides and returns a list of detected overrides. This is useful for informing users when env vars or flags override config file values. flagOverrides is a map of key -> (flagValue, flagWasSet) for flags that were explicitly set.
type ConfigSource ¶
type ConfigSource string
ConfigSource represents where a configuration value came from
const ( SourceDefault ConfigSource = "default" SourceConfigFile ConfigSource = "config_file" SourceEnvVar ConfigSource = "env_var" SourceFlag ConfigSource = "flag" )
func GetValueSource ¶
func GetValueSource(key string) ConfigSource
GetValueSource returns the source of a configuration value. Priority (highest to lowest): env var > config file > default Note: Flag overrides are handled separately in main.go since viper doesn't know about cobra flags.
type MultiRepoConfig ¶
type MultiRepoConfig struct {
Primary string // Primary repo path (where canonical issues live)
Additional []string // Additional repos to hydrate from
}
MultiRepoConfig contains configuration for multi-repo support
func GetMultiRepoConfig ¶
func GetMultiRepoConfig() *MultiRepoConfig
GetMultiRepoConfig retrieves multi-repo configuration Returns nil if multi-repo is not configured (single-repo mode)
type ReposConfig ¶
type ReposConfig struct {
Primary string `yaml:"primary,omitempty"`
Additional []string `yaml:"additional,omitempty,flow"`
}
ReposConfig represents the repos section of config.yaml
func GetReposFromYAML ¶
func GetReposFromYAML(configPath string) (*ReposConfig, error)
GetReposFromYAML reads the repos configuration from config.yaml Returns an empty ReposConfig if repos section doesn't exist
func ListRepos ¶
func ListRepos(configPath string) (*ReposConfig, error)
ListRepos returns the current repos configuration from YAML