Fix config system: rename config.json → metadata.json, fix config.yaml loading
- Renamed config.json to metadata.json to clarify purpose (database metadata) - Fixed config.yaml/config.json conflict by making Viper explicitly load only config.yaml - Added automatic migration from config.json to metadata.json on first read - Fixed jsonOutput variable shadowing across 22 command files - Updated bd init to create both metadata.json and config.yaml template - Fixed 5 failing JSON output tests - All tests passing Resolves config file confusion and makes config.yaml work correctly. Closes #178 (global flags), addresses config issues from #193 Amp-Thread-ID: https://ampcode.com/threads/T-e6ac8192-e18f-4ed7-83bc-4a5986718bb7 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -100,7 +100,7 @@ This command:
|
||||
return
|
||||
}
|
||||
|
||||
// Check if target database exists and is current (use config.json name)
|
||||
// Check if target database exists and is current (use metadata.json name)
|
||||
targetPath := cfg.DatabasePath(beadsDir)
|
||||
var currentDB *dbInfo
|
||||
var oldDBs []*dbInfo
|
||||
@@ -444,7 +444,7 @@ This command:
|
||||
if !dryRun {
|
||||
if err := cfg.Save(beadsDir); err != nil {
|
||||
if !jsonOutput {
|
||||
color.Yellow("Warning: failed to update config.json version: %v\n", err)
|
||||
color.Yellow("Warning: failed to update metadata.json version: %v\n", err)
|
||||
}
|
||||
// Don't fail migration if config save fails
|
||||
}
|
||||
@@ -667,7 +667,7 @@ func handleUpdateRepoID(dryRun bool, autoYes bool) {
|
||||
}
|
||||
}
|
||||
|
||||
// loadOrCreateConfig loads config.json or creates default if not found
|
||||
// loadOrCreateConfig loads metadata.json or creates default if not found
|
||||
func loadOrCreateConfig(beadsDir string) (*configfile.Config, error) {
|
||||
cfg, err := configfile.Load(beadsDir)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user