fix: verify .beads directory exists after bd init

bd init can exit with code 0 but fail to create the .beads directory
when orphaned bd daemons interfere. Add explicit verification that
the directory exists, with a helpful error message if not.
This commit is contained in:
Dustin Smith
2026-01-19 21:36:28 +07:00
committed by John Ogle
parent dcfcde5a83
commit 0953863641

View File

@@ -399,6 +399,12 @@ func initTownBeads(townPath string) error {
}
}
// Verify .beads directory was actually created (bd init can exit 0 without creating it)
beadsDir := filepath.Join(townPath, ".beads")
if _, statErr := os.Stat(beadsDir); os.IsNotExist(statErr) {
return fmt.Errorf("bd init succeeded but .beads directory not created (check bd daemon interference)")
}
// Explicitly set issue_prefix config (bd init --prefix may not persist it in newer versions).
prefixSetCmd := exec.Command("bd", "config", "set", "issue_prefix", "hq")
prefixSetCmd.Dir = townPath