feat(cli): rework developer CLI with non-blocking tasks and GitHub CI checks
Rebuild the developer CLI and interactive TUI from the ground up using Bubble Tea v2, Lip Gloss v2, and non-blocking background workers. Adds support for background docker pulls with live per-layer byte progress, build log streaming, interactive container shells, dynamic sidebar tabs (logs / build / ci), and gh cli integration to view or watch CI checks.
This commit is contained in:
50 files changed
+7228
-2520
No files matched your search
@@ -0,0 +1,95 @@
|
||||
// Package ui holds the CLI's visual vocabulary: one palette, one set of status
|
||||
// badges, and one keymap, so every screen looks and behaves the same way.
|
||||
package ui
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
"strings"
|
||||
|
||||
"charm.land/lipgloss/v2"
|
||||
)
|
||||
|
||||
// The palette is intentionally small. Colour carries meaning here — green is
|
||||
// healthy, red is broken, amber is in flight, cyan is local — so introducing
|
||||
// extra hues would dilute the signal rather than add information.
|
||||
var (
|
||||
Accent = lipgloss.Color("212")
|
||||
Success = lipgloss.Color("42")
|
||||
Warning = lipgloss.Color("214")
|
||||
Danger = lipgloss.Color("203")
|
||||
Info = lipgloss.Color("81")
|
||||
Muted = lipgloss.Color("241")
|
||||
Faint = lipgloss.Color("238")
|
||||
Text = lipgloss.Color("252")
|
||||
Bright = lipgloss.Color("230")
|
||||
Ink = lipgloss.Color("235")
|
||||
)
|
||||
|
||||
var (
|
||||
Title = lipgloss.NewStyle().Bold(true).Foreground(Accent)
|
||||
Heading = lipgloss.NewStyle().Bold(true).Foreground(Bright)
|
||||
Help = lipgloss.NewStyle().Foreground(Muted)
|
||||
Dim = lipgloss.NewStyle().Foreground(Faint)
|
||||
Body = lipgloss.NewStyle().Foreground(Text)
|
||||
OK = lipgloss.NewStyle().Foreground(Success)
|
||||
Alert = lipgloss.NewStyle().Foreground(Danger)
|
||||
Pending = lipgloss.NewStyle().Foreground(Warning)
|
||||
Local = lipgloss.NewStyle().Foreground(Info)
|
||||
Selected = lipgloss.NewStyle().Bold(true).Foreground(Bright).Background(lipgloss.Color("57"))
|
||||
)
|
||||
|
||||
// Panel frames the sidebar and overlays.
|
||||
func Panel(title string, focused bool) lipgloss.Style {
|
||||
var border color.Color = Faint
|
||||
if focused {
|
||||
border = Accent
|
||||
}
|
||||
return lipgloss.NewStyle().
|
||||
Border(lipgloss.RoundedBorder()).
|
||||
BorderForeground(border).
|
||||
Padding(0, 1)
|
||||
}
|
||||
|
||||
// Rule draws a labelled separator across the given width.
|
||||
func Rule(label string, width int) string {
|
||||
if width < 8 {
|
||||
return Dim.Render(label)
|
||||
}
|
||||
prefix := "── " + label + " "
|
||||
if lipgloss.Width(prefix) >= width {
|
||||
return Dim.Render(prefix[:width])
|
||||
}
|
||||
fill := width - lipgloss.Width(prefix)
|
||||
return Dim.Render(prefix + repeat("─", fill))
|
||||
}
|
||||
|
||||
func repeat(char string, count int) string {
|
||||
if count <= 0 {
|
||||
return ""
|
||||
}
|
||||
out := make([]byte, 0, count*len(char))
|
||||
for range count {
|
||||
out = append(out, char...)
|
||||
}
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// Blank reports whether a line would render as empty. Build tools emit lines
|
||||
// that hold nothing but a colour reset; they are not empty as strings but they
|
||||
// occupy a row for no reason, which turns a log panel into double-spaced text.
|
||||
func Blank(line string) bool { return lipgloss.Width(strings.TrimSpace(line)) == 0 }
|
||||
|
||||
// Truncate shortens a string to width runes, marking the cut with an ellipsis.
|
||||
func Truncate(value string, width int) string {
|
||||
if width <= 0 {
|
||||
return ""
|
||||
}
|
||||
runes := []rune(value)
|
||||
if len(runes) <= width {
|
||||
return value
|
||||
}
|
||||
if width == 1 {
|
||||
return "…"
|
||||
}
|
||||
return string(runes[:width-1]) + "…"
|
||||
}
|
||||
Reference in new issue
Block a user