Skip to content

Commit 18a564b

Browse files
Thomas StrombergThomas Stromberg
authored andcommitted
extend cache, rename app
1 parent 023e42d commit 18a564b

File tree

1 file changed

+36
-25
lines changed

1 file changed

+36
-25
lines changed

main.go

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ const (
118118
apiSearchEndpoint = "https://api.github.com/search/issues"
119119
apiPullsEndpoint = "https://api.github.com/repos/%s/%s/pulls/%d"
120120
defaultSprinklerURL = "wss://hook.g.robot-army.dev/ws"
121-
maxConcurrent = 20 // Increased for better throughput
122-
cacheTTL = 24 * time.Hour // 24 hours
123-
prRefreshCooldownSecs = 1 // Avoid refreshing same PR within 1 second
124-
maxOrgNameLength = 39 // GitHub org name limit
125-
minTokenLength = 10 // Minimum GitHub token length
126-
maxIdleConnsPerHost = 10 // HTTP client setting
121+
maxConcurrent = 20 // Increased for better throughput
122+
cacheTTL = 10 * 24 * time.Hour // 10 days
123+
prRefreshCooldownSecs = 1 // Avoid refreshing same PR within 1 second
124+
maxOrgNameLength = 39 // GitHub org name limit
125+
minTokenLength = 10 // Minimum GitHub token length
126+
maxIdleConnsPerHost = 10 // HTTP client setting
127127
idleConnTimeout = 90 * time.Second
128128
minPRURLParts = 6 // Minimum parts in PR URL
129129
minOrgURLParts = 4 // Minimum parts in org URL
@@ -1228,7 +1228,7 @@ func formatPR(pr *PR, username string) string {
12281228
output.WriteString(lipgloss.NewStyle().
12291229
Foreground(lipgloss.Color("#E5484D")). // Modern red
12301230
Bold(true).
1231-
Render(" "))
1231+
Render(" "))
12321232
} else if isBlocking {
12331233
// Yellow bullet for regular next action
12341234
output.WriteString(lipgloss.NewStyle().
@@ -1285,37 +1285,42 @@ func formatPR(pr *PR, username string) string {
12851285

12861286
// Add NextAction kinds if available
12871287
if pr.TurnResponse != nil && pr.TurnResponse.Analysis.NextAction != nil {
1288-
var actionKinds []string
1289-
var userHasAction bool
1288+
var userActionKinds []string
1289+
var otherCriticalKinds []string
12901290
var userActionCritical bool
1291+
seen := make(map[string]bool)
12911292

1292-
// Check if current user has actions - if so, only show those
1293+
// First, collect current user's actions
12931294
if userAction, hasUserAction := pr.TurnResponse.Analysis.NextAction[username]; hasUserAction {
1294-
// Only show current user's action
1295-
actionKinds = append(actionKinds, string(userAction.Kind))
1296-
userHasAction = true
1297-
userActionCritical = userAction.Critical
1298-
} else {
1299-
// Show all unique action kinds from all users
1300-
seen := make(map[string]bool)
1301-
for _, action := range pr.TurnResponse.Analysis.NextAction {
1295+
kind := string(userAction.Kind)
1296+
if !seen[kind] {
1297+
userActionKinds = append(userActionKinds, kind)
1298+
seen[kind] = true
1299+
userActionCritical = userAction.Critical
1300+
}
1301+
}
1302+
1303+
// Then collect critical actions from other users (avoiding duplicates)
1304+
for user, action := range pr.TurnResponse.Analysis.NextAction {
1305+
if user != username && action.Critical {
13021306
kind := string(action.Kind)
13031307
if !seen[kind] {
1308+
otherCriticalKinds = append(otherCriticalKinds, kind)
13041309
seen[kind] = true
1305-
actionKinds = append(actionKinds, kind)
13061310
}
13071311
}
13081312
}
13091313

1310-
if len(actionKinds) > 0 {
1314+
// Display actions if any exist
1315+
if len(userActionKinds) > 0 || len(otherCriticalKinds) > 0 {
13111316
// Dark grey emdash
13121317
output.WriteString(lipgloss.NewStyle().
13131318
Foreground(lipgloss.Color("#6B6B6B")). // Dark grey
13141319
Render(" — "))
13151320

1316-
// Color the action based on whether it's the user's action and its criticality
1317-
actionText := strings.Join(actionKinds, " ")
1318-
if userHasAction {
1321+
// Display user's actions first with appropriate color
1322+
if len(userActionKinds) > 0 {
1323+
actionText := strings.Join(userActionKinds, " ")
13191324
if userActionCritical {
13201325
// Red for critical user action
13211326
output.WriteString(lipgloss.NewStyle().
@@ -1327,8 +1332,14 @@ func formatPR(pr *PR, username string) string {
13271332
Foreground(lipgloss.Color("#FFB224")).
13281333
Render(actionText))
13291334
}
1330-
} else {
1331-
// Dark grey for others' actions
1335+
}
1336+
1337+
// Display other critical actions in dark grey
1338+
if len(otherCriticalKinds) > 0 {
1339+
if len(userActionKinds) > 0 {
1340+
output.WriteString(" ") // Space between user and other actions
1341+
}
1342+
actionText := strings.Join(otherCriticalKinds, " ")
13321343
output.WriteString(lipgloss.NewStyle().
13331344
Foreground(lipgloss.Color("#6B6B6B")).
13341345
Render(actionText))

0 commit comments

Comments
 (0)