fix(routing): default to Maintainer when no git remote exists (#1185)

When no git remote is configured, DetectUserRole() now defaults to
Maintainer instead of Contributor. This fixes issue routing for:

1. New personal projects (no remote configured yet)
2. Intentionally local-only repositories

Previously, issues would silently route to ~/.beads-planning instead
of the local .beads/ directory.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
aleiby
2026-01-19 10:11:00 -08:00
committed by GitHub
parent 460d2bf113
commit f4ee7ee73b
2 changed files with 30 additions and 7 deletions

View File

@@ -29,7 +29,7 @@ const (
// Detection strategy:
// 1. Check if user has push access to origin (git remote -v shows write URL)
// 2. Check git config for beads.role setting (explicit override)
// 3. Fall back to contributor if uncertain
// 3. Fall back to maintainer for local projects (no remote configured)
func DetectUserRole(repoPath string) (UserRole, error) {
// First check for explicit role in git config
output, err := gitCommandRunner(repoPath, "config", "--get", "beads.role")
@@ -49,8 +49,8 @@ func DetectUserRole(repoPath string) (UserRole, error) {
// Fallback to standard fetch URL if push URL fails (some git versions/configs)
output, err = gitCommandRunner(repoPath, "remote", "get-url", "origin")
if err != nil {
// No remote or error - default to contributor
return Contributor, nil
// No remote means local project - default to maintainer
return Maintainer, nil
}
}