13b2f5e14d
Removes five unused funcs/vars/fields that golangci-lint had been flagging (anthropic.toolCallDoneEvent, mistral.translateMessages, hook.newError, subprocess.vibeParser.lastAssistantMsgID, tui.cBase), two ineffectual assignments (tui/rendering.go visible-window loop, subprocess stream_test setup), and a stale if/HasPrefix that's now a strings.TrimPrefix. Wires errcheck onto every subprocess / stream lifecycle path so a failed close or shutdown is at least logged rather than silently dropped: - engine/loop.go: stream.Close on both the error and success paths - mcp/manager.go: Shutdown when StartAll partial-fails; Transport close after Initialize failure - mcp/transport.go: stdin.Close + syscall.Kill on graceful-timeout fallback - slm/download.go: Close propagated as a named-return error on the success path; explicitly discarded on the rollback path - slm/classifier.go, slm/manager.go, hook/prompt.go, context/summarize.go, config/write.go, cmd/gnoma/main.go, tool/fs/grep.go: explicit ignores or error logging on Close / Shutdown / WalkDir / Scanln Production-code errcheck and ineffassign are now zero. Remaining golangci-lint output is test-only Close-in-defer noise plus stylistic staticcheck QF suggestions, left alone.
128 lines
2.8 KiB
Go
128 lines
2.8 KiB
Go
package tui
|
|
|
|
import (
|
|
"image/color"
|
|
|
|
"charm.land/lipgloss/v2"
|
|
"somegit.dev/Owlibou/gnoma/internal/permission"
|
|
)
|
|
|
|
// Color palette — catppuccin mocha inspired
|
|
var (
|
|
cPurple = lipgloss.Color("#CBA6F7") // mauve
|
|
cBlue = lipgloss.Color("#89B4FA") // blue
|
|
cGreen = lipgloss.Color("#A6E3A1") // green
|
|
cRed = lipgloss.Color("#F38BA8") // red
|
|
cYellow = lipgloss.Color("#F9E2AF") // yellow
|
|
cPeach = lipgloss.Color("#FAB387") // peach
|
|
cTeal = lipgloss.Color("#94E2D5") // teal
|
|
cText = lipgloss.Color("#CDD6F4") // text
|
|
cSubtext = lipgloss.Color("#A6ADC8") // subtext0
|
|
cOverlay = lipgloss.Color("#6C7086") // overlay0
|
|
cSurface = lipgloss.Color("#313244") // surface0
|
|
cMantle = lipgloss.Color("#181825") // mantle
|
|
)
|
|
|
|
// Permission mode colors — each mode has a distinct color
|
|
var modeColors = map[permission.Mode]color.Color{
|
|
permission.ModeBypass: cGreen, // green = all allowed
|
|
permission.ModeDefault: cBlue, // blue = prompting
|
|
permission.ModePlan: cTeal, // teal = read-only
|
|
permission.ModeAcceptEdits: cPurple, // purple = edits ok
|
|
permission.ModeAuto: cPeach, // peach = smart
|
|
permission.ModeDeny: cRed, // red = locked down
|
|
}
|
|
|
|
// ModeColor returns the color for a permission mode.
|
|
func ModeColor(mode permission.Mode) color.Color {
|
|
if c, ok := modeColors[mode]; ok {
|
|
return c
|
|
}
|
|
return cOverlay
|
|
}
|
|
|
|
// Header
|
|
var (
|
|
sHeaderBrand = lipgloss.NewStyle().
|
|
Background(cPurple).
|
|
Foreground(cMantle).
|
|
Bold(true).
|
|
Padding(0, 1)
|
|
|
|
sHeaderModel = lipgloss.NewStyle().
|
|
Foreground(cGreen).
|
|
Bold(true)
|
|
|
|
sHeaderDim = lipgloss.NewStyle().
|
|
Foreground(cOverlay)
|
|
)
|
|
|
|
// Chat
|
|
var (
|
|
sUserLabel = lipgloss.NewStyle().
|
|
Foreground(cBlue).
|
|
Bold(true)
|
|
|
|
styleAssistantLabel = lipgloss.NewStyle().
|
|
Foreground(cPurple).
|
|
Bold(true)
|
|
|
|
sToolOutput = lipgloss.NewStyle().
|
|
Foreground(cGreen)
|
|
|
|
sToolResult = lipgloss.NewStyle().
|
|
Foreground(cOverlay)
|
|
|
|
sSystem = lipgloss.NewStyle().
|
|
Foreground(cYellow)
|
|
|
|
sError = lipgloss.NewStyle().
|
|
Foreground(cRed)
|
|
|
|
sHint = lipgloss.NewStyle().
|
|
Foreground(cOverlay)
|
|
|
|
sCursor = lipgloss.NewStyle().
|
|
Foreground(cPurple)
|
|
|
|
sDiffAdd = lipgloss.NewStyle().
|
|
Foreground(cGreen)
|
|
|
|
sDiffRemove = lipgloss.NewStyle().
|
|
Foreground(cRed)
|
|
|
|
sText = lipgloss.NewStyle().
|
|
Foreground(cText)
|
|
|
|
sThinkingLabel = lipgloss.NewStyle().
|
|
Foreground(cOverlay).
|
|
Italic(true)
|
|
|
|
sThinkingBody = lipgloss.NewStyle().
|
|
Foreground(cOverlay).
|
|
Italic(true)
|
|
)
|
|
|
|
// Status bar
|
|
var (
|
|
sStatusBar = lipgloss.NewStyle().
|
|
Foreground(cSubtext)
|
|
|
|
sStatusHighlight = lipgloss.NewStyle().
|
|
Foreground(cPurple).
|
|
Bold(true)
|
|
|
|
sStatusDim = lipgloss.NewStyle().
|
|
Foreground(cOverlay)
|
|
|
|
sStatusStreaming = lipgloss.NewStyle().
|
|
Foreground(cYellow).
|
|
Bold(true)
|
|
|
|
sStatusBranch = lipgloss.NewStyle().
|
|
Foreground(cGreen)
|
|
|
|
sStatusIncognito = lipgloss.NewStyle().
|
|
Foreground(cYellow)
|
|
)
|