feat(statusline): lower max rigs to 3 and add alias support
- Add Alias field to RigEntry struct for short display names - Limit displayed rigs to 3 (was unlimited, causing overflow) - Use alias in statusline when configured (e.g., gcr instead of google_cookie_retrieval) - Show +N overflow indicator when more rigs exist Closes: hq-5j33zz
This commit is contained in:
@@ -171,13 +171,17 @@ func runMayorStatusLine(t *tmux.Tmux) error {
|
||||
townRoot, _ = workspace.Find(paneDir)
|
||||
}
|
||||
|
||||
// Load registered rigs to validate against
|
||||
// Load registered rigs to validate against and get aliases
|
||||
registeredRigs := make(map[string]bool)
|
||||
rigAliases := make(map[string]string)
|
||||
if townRoot != "" {
|
||||
rigsConfigPath := filepath.Join(townRoot, "mayor", "rigs.json")
|
||||
if rigsConfig, err := config.LoadRigsConfig(rigsConfigPath); err == nil {
|
||||
for rigName := range rigsConfig.Rigs {
|
||||
for rigName, entry := range rigsConfig.Rigs {
|
||||
registeredRigs[rigName] = true
|
||||
if entry.Alias != "" {
|
||||
rigAliases[rigName] = entry.Alias
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -291,11 +295,16 @@ func runMayorStatusLine(t *tmux.Tmux) error {
|
||||
// Create sortable rig list
|
||||
type rigInfo struct {
|
||||
name string
|
||||
alias string
|
||||
status *rigStatus
|
||||
}
|
||||
var rigs []rigInfo
|
||||
for rigName, status := range rigStatuses {
|
||||
rigs = append(rigs, rigInfo{name: rigName, status: status})
|
||||
ri := rigInfo{name: rigName, status: status}
|
||||
if alias, ok := rigAliases[rigName]; ok {
|
||||
ri.alias = alias
|
||||
}
|
||||
rigs = append(rigs, ri)
|
||||
}
|
||||
|
||||
// Sort by: 1) running state, 2) operational state, 3) alphabetical
|
||||
@@ -321,9 +330,16 @@ func runMayorStatusLine(t *tmux.Tmux) error {
|
||||
})
|
||||
|
||||
// Build display with group separators
|
||||
// Limit to maxRigs to prevent statusline overflow
|
||||
maxRigs := 3
|
||||
var rigParts []string
|
||||
var lastGroup string
|
||||
displayCount := 0
|
||||
for _, rig := range rigs {
|
||||
if displayCount >= maxRigs {
|
||||
break
|
||||
}
|
||||
|
||||
isRunning := rig.status.hasWitness || rig.status.hasRefinery
|
||||
var currentGroup string
|
||||
if isRunning {
|
||||
@@ -363,7 +379,19 @@ func runMayorStatusLine(t *tmux.Tmux) error {
|
||||
if led == "🅿️" {
|
||||
space = " "
|
||||
}
|
||||
rigParts = append(rigParts, led+space+rig.name)
|
||||
|
||||
// Use alias if available, otherwise use full name
|
||||
displayName := rig.name
|
||||
if rig.alias != "" {
|
||||
displayName = rig.alias
|
||||
}
|
||||
rigParts = append(rigParts, led+space+displayName)
|
||||
displayCount++
|
||||
}
|
||||
|
||||
// Show overflow indicator if there are more rigs
|
||||
if len(rigs) > maxRigs {
|
||||
rigParts = append(rigParts, fmt.Sprintf("+%d", len(rigs)-maxRigs))
|
||||
}
|
||||
|
||||
if len(rigParts) > 0 {
|
||||
|
||||
@@ -168,6 +168,7 @@ type RigEntry struct {
|
||||
AddedAt time.Time `json:"added_at"`
|
||||
BeadsConfig *BeadsConfig `json:"beads,omitempty"`
|
||||
Crew *CrewRegistryConfig `json:"crew,omitempty"`
|
||||
Alias string `json:"alias,omitempty"` // Short display name for statusline
|
||||
}
|
||||
|
||||
// BeadsConfig represents beads configuration for a rig.
|
||||
|
||||
Reference in New Issue
Block a user