Skip to content

Commit c660406

Browse files
committed
feat: detect username for branch prefix
1 parent 927dbc7 commit c660406

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

config/config.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import (
55
"encoding/json"
66
"fmt"
77
"os"
8+
"os/user"
89
"path/filepath"
10+
"strings"
911
)
1012

1113
const ConfigFileName = "config.json"
@@ -37,7 +39,14 @@ func DefaultConfig() *Config {
3739
DefaultProgram: "claude",
3840
AutoYes: false,
3941
DaemonPollInterval: 1000,
40-
BranchPrefix: "session/",
42+
BranchPrefix: func() string {
43+
user, err := user.Current()
44+
if err != nil || user == nil || user.Username == "" {
45+
log.ErrorLog.Printf("failed to get current user: %v", err)
46+
return "session/"
47+
}
48+
return fmt.Sprintf("%s/", strings.ToLower(user.Username))
49+
}(),
4150
}
4251
}
4352

0 commit comments

Comments
 (0)