fix(routing): complete bd init --contributor routing (bd-6x6g) (#1088)

Implements the missing contributor routing logic so bd init --contributor actually works. Contributors' issues automatically route to ~/.beads-planning/ while maintainers' issues stay local.
This commit is contained in:
Peter Chanthamynavong
2026-01-14 20:50:56 -08:00
committed by GitHub
parent b9d2799d29
commit 31239495f1
6 changed files with 1211 additions and 21 deletions

View File

@@ -1,7 +1,9 @@
package routing
import (
"os"
"os/exec"
"path/filepath"
"strings"
)
@@ -102,3 +104,28 @@ func DetermineTargetRepo(config *RoutingConfig, userRole UserRole, repoPath stri
// No routing configured - use current repo
return "."
}
// ExpandPath expands ~ to home directory and resolves relative paths to absolute.
// Returns the original path if expansion fails.
func ExpandPath(path string) string {
if path == "" || path == "." {
return path
}
// Expand ~ to home directory
if strings.HasPrefix(path, "~/") {
home, err := os.UserHomeDir()
if err == nil {
path = filepath.Join(home, path[2:])
}
}
// Convert relative paths to absolute
if !filepath.IsAbs(path) {
if abs, err := filepath.Abs(path); err == nil {
path = abs
}
}
return path
}