feat: add git user.name to actor fallback chain (#994)

- Insert git config user.name in fallback chain before final $USER default
- Consolidate duplicate actor resolution logic into single function
- Add BEADS_ACTOR as env var alias for MCP compatibility
- Add tests for actor resolution priority
- Update CONFIG.md with Actor Identity Resolution section

The new fallback order is:
  --actor flag > BD_ACTOR > BEADS_ACTOR > git user.name > $USER > "unknown"

Co-authored-by: Ohffs <ohffsnotnow@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
ohnotnow
2026-01-10 20:43:46 +00:00
committed by GitHub
parent 3ecffa111b
commit bfae0e554c
6 changed files with 266 additions and 79 deletions

View File

@@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"os"
"os/user"
"strings"
"github.com/spf13/cobra"
@@ -132,20 +131,10 @@ Examples:
commentText = args[1]
}
// Get author from author flag, BD_ACTOR var, or system USER var
// Get author from author flag, or use git-aware default
author, _ := cmd.Flags().GetString("author")
if author == "" {
author = os.Getenv("BD_ACTOR")
if author == "" {
author = os.Getenv("USER")
}
if author == "" {
if u, err := user.Current(); err == nil {
author = u.Username
} else {
author = "unknown"
}
}
author = getActorWithGit()
}
var comment *types.Comment