-
Notifications
You must be signed in to change notification settings - Fork 424
Extract inline lipgloss styles and harden ShowWelcomeBanner styling #39246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| "fmt" | ||
| "os" | ||
|
|
||
| "github.com/github/gh-aw/pkg/styles" | ||
| "github.com/github/gh-aw/pkg/tty" | ||
| ) | ||
|
|
||
|
|
@@ -40,8 +41,8 @@ | |
| func ShowWelcomeBanner(description string) { | ||
| ClearScreen() | ||
| fmt.Fprintln(os.Stderr, "") | ||
| fmt.Fprintln(os.Stderr, "🚀 Welcome to GitHub Agentic Workflows!") | ||
| fmt.Fprintln(os.Stderr, applyStyle(styles.Header, "🚀 Welcome to GitHub Agentic Workflows!")) | ||
|
Check failure on line 44 in pkg/console/terminal.go
|
||
| fmt.Fprintln(os.Stderr, "") | ||
| fmt.Fprintln(os.Stderr, description) | ||
| fmt.Fprintln(os.Stderr, FormatInfoMessage(description)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/improve-codebase-architecture] 💡 Consider a neutral approachFor a welcome-banner description, plain text or a subtle wrap is more appropriate: // Option A: keep it plain (matches the original intent)
fmt.Fprintln(os.Stderr, description)
// Option B: apply a muted/normal style without the "i " icon
if tty.IsStderrTerminal() {
fmt.Fprintln(os.Stderr, styles.Muted.Render(description))
} else {
fmt.Fprintln(os.Stderr, description)
}Reserve |
||
| fmt.Fprintln(os.Stderr, "") | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -347,3 +347,26 @@ var TreeEnumerator = lipgloss.NewStyle(). | |
| // TreeNode style for tree node content | ||
| var TreeNode = lipgloss.NewStyle(). | ||
| Foreground(ColorForeground) | ||
|
|
||
| // Schedule calendar intensity styles for the heatmap renderer | ||
|
|
||
| // ScheduleCalendarEmpty style for zero-trigger slots - muted | ||
| var ScheduleCalendarEmpty = lipgloss.NewStyle(). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing wasm stubs for 5 new
💡 Suggested fixAdd the five stubs to // Schedule calendar intensity styles (no-op in Wasm)
var (
ScheduleCalendarEmpty = WasmStyle{}
ScheduleCalendarLow = WasmStyle{}
ScheduleCalendarMedium = WasmStyle{}
ScheduleCalendarHigh = WasmStyle{}
ScheduleCalendarCritical = WasmStyle{}
)Every other style var in |
||
| Foreground(ColorComment) | ||
|
|
||
| // ScheduleCalendarLow style for low-trigger slots (count == 1) - cyan | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/improve-codebase-architecture] The doc comments embed the count thresholds from 💡 Suggested wordingDocument semantic intent only — leave threshold specifics to // ScheduleCalendarLow style for low-intensity calendar slots - cyan
var ScheduleCalendarLow = lipgloss.NewStyle().
Foreground(ColorInfo)
// ScheduleCalendarMedium style for medium-intensity calendar slots - green
var ScheduleCalendarMedium = lipgloss.NewStyle().
Foreground(ColorSuccess)This keeps |
||
| var ScheduleCalendarLow = lipgloss.NewStyle(). | ||
| Foreground(ColorInfo) | ||
|
|
||
| // ScheduleCalendarMedium style for medium-trigger slots (count 2–3) - green | ||
| var ScheduleCalendarMedium = lipgloss.NewStyle(). | ||
| Foreground(ColorSuccess) | ||
|
|
||
| // ScheduleCalendarHigh style for high-trigger slots (count 4–6) - orange | ||
| var ScheduleCalendarHigh = lipgloss.NewStyle(). | ||
| Foreground(ColorWarning) | ||
|
|
||
| // ScheduleCalendarCritical style for critical-trigger slots (count 7+) - bold red | ||
| var ScheduleCalendarCritical = lipgloss.NewStyle(). | ||
| Bold(true). | ||
| Foreground(ColorError) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/zoom-out]
applyStyleusesisTTY()→tty.IsStdoutTerminal(), but this function writes toos.Stderr.ClearScreenandClearLinein the same file correctly guard ontty.IsStderrTerminal(). If the user pipes stdout (e.g.gh aw run ... | tee log),isTTY()returnsfalseand the header renders unstyled; conversely, if stderr is redirected to a file while stdout is a terminal, ANSI codes leak into the file.💡 Suggested fix
Either wrap the call in an explicit stderr TTY check:
Or add a complementary
applyStderrStylehelper alongsideapplyStyleinconsole.gothat gates ontty.IsStderrTerminal()— keeping the abstraction consistent.