fix: use proper YAML parsing for no-db mode detection (bd-r6k2)
Replace fragile strings.Contains("no-db: true") with proper YAML parsing
to avoid false matches in comments or nested keys.
Changes:
- Add NoDb field to localConfig struct
- Add isNoDbModeConfigured() helper function
- Update main.go and doctor.go to use the helper
- Add 8 test cases for isNoDbModeConfigured
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -854,16 +854,8 @@ func checkDatabaseVersion(path string) doctorCheck {
|
||||
|
||||
if jsonlPath != "" {
|
||||
// JSONL exists but no database - check if this is no-db mode or fresh clone
|
||||
// Check config.yaml for no-db: true
|
||||
configPath := filepath.Join(beadsDir, "config.yaml")
|
||||
isNoDbMode := false
|
||||
// #nosec G304 -- configPath is constructed from beadsDir which is in .beads/
|
||||
if configData, err := os.ReadFile(configPath); err == nil {
|
||||
// Simple check for no-db: true in config.yaml
|
||||
isNoDbMode = strings.Contains(string(configData), "no-db: true")
|
||||
}
|
||||
|
||||
if isNoDbMode {
|
||||
// Use proper YAML parsing to detect no-db mode (bd-r6k2)
|
||||
if isNoDbModeConfigured(beadsDir) {
|
||||
return doctorCheck{
|
||||
Name: "Database",
|
||||
Status: statusOK,
|
||||
|
||||
Reference in New Issue
Block a user