fix(cli): log and status show the signed-in account, not the git author fallback

bdrive log preferred Op.Author (git/OS identity) even when the op carried the
hub account (Op.User/UserName), so team history showed local git emails.
Found by the agent-onboarding live e2e: device signed in as e2e-bot showed
snow@runbear.io in log. Now: UserName → User → Author. bdrive status likewise
shows 'signed in as Name <email>' when a session exists.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VbiaaVM2ACxeRi8ySG9ybc
This commit is contained in:
Snow Lee
2026-07-18 21:24:00 -07:00
co-authored by Claude Fable 5
parent 01902d435f
commit a16580b300
+19 -2
View File
@@ -90,7 +90,15 @@ func statusCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Printf("device: %s (%s) as %s\n\n", dev.Name, dev.ID, dev.Author)
if settings, _ := config.LoadSettings(); settings.Email != "" {
who := settings.Email
if settings.Name != "" {
who = settings.Name + " <" + settings.Email + ">"
}
fmt.Printf("device: %s (%s) signed in as %s\n\n", dev.Name, dev.ID, who)
} else {
fmt.Printf("device: %s (%s) as %s\n\n", dev.Name, dev.ID, dev.Author)
}
first := true
for id, mi := range mounts {
if !first {
@@ -179,7 +187,16 @@ func logCmd() *cobra.Command {
} else {
kind = "delete"
}
line := fmt.Sprintf("%s %s %-40s %s on %s", when, kind, op.Path, op.Author, op.DeviceName)
// Prefer the signed-in account over the git/OS author fallback,
// so team history shows hub identities.
who := op.UserName
if who == "" {
who = op.User
}
if who == "" {
who = op.Author
}
line := fmt.Sprintf("%s %s %-40s %s on %s", when, kind, op.Path, who, op.DeviceName)
if op.Kind == journal.KindPut {
line += fmt.Sprintf(" (%s)", humanBytes(op.Size))
}