fix: validate BEADS_DIR env var for project files (bd-420)
Extends the fix from PR #424 to also validate the BEADS_DIR environment variable. Previously, only the directory tree search was validated, but BEADS_DIR could still point to a daemon-only directory. Changes: - Add validation to BEADS_DIR path using hasBeadsProjectFiles() - Add comprehensive test for BEADS_DIR validation - Test verifies both rejection of daemon-only dirs and acceptance of valid dirs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -275,7 +275,10 @@ func FindBeadsDir() string {
|
||||
if beadsDir := os.Getenv("BEADS_DIR"); beadsDir != "" {
|
||||
absBeadsDir := utils.CanonicalizePath(beadsDir)
|
||||
if info, err := os.Stat(absBeadsDir); err == nil && info.IsDir() {
|
||||
return absBeadsDir
|
||||
// Validate directory contains actual project files (bd-420)
|
||||
if hasBeadsProjectFiles(absBeadsDir) {
|
||||
return absBeadsDir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user