fix(config): normalize keys in GetYamlConfig to match SetYamlConfig (#874)

GetYamlConfig was not normalizing key aliases (e.g., sync.branch ->
sync-branch), causing 'bd config get sync.branch' to return 'not set'
even when the value was correctly stored.

SetYamlConfig already normalized keys, but GetYamlConfig did not,
leading to a confusing mismatch where set appeared to work but get
could not find the value.

Added TestGetYamlConfig_KeyNormalization to verify the fix.

Fixes #873
This commit is contained in:
Graeme Foster
2026-01-03 19:51:01 +00:00
committed by GitHub
parent 0c7dcee3ac
commit e623746e60
2 changed files with 50 additions and 1 deletions

View File

@@ -130,11 +130,13 @@ func SetYamlConfig(key, value string) error {
// 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 GetYamlConfig(key string) string {
if v == nil {
return ""
}
return v.GetString(key)
normalizedKey := normalizeYamlKey(key)
return v.GetString(normalizedKey)
}
// findProjectConfigYaml finds the project's .beads/config.yaml file.