This chapter introduces the three core technologies underpinning Crush, a terminal-based AI coding agent. First, Bubble Tea and the ELM architecture: Crush models its UI as a state-driven message loop, with a central Model in internal/ui/model/ui.go handling typed messages (tea.Msg) via an Update function and executing async tasks through tea.Cmd, ensuring predictable, traceable state changes and parallel initialization via tea.Batch. Second, the Ultraviolet rendering engine: enabled transparently in Bubble Tea v2 through tea.WithEnvironment, it uses double buffering and diff-based incremental rendering to eliminate flicker and minimize redraw cost, with a declarative layout package and runtime terminal capability queries. Third, the Lipgloss styling system: a declarative API over ANSI escape codes supporting immutable styles, inheritance via Copy(), and nested style structs (~450 lines) that organize semantic styles and simplify theming. Together these form Crush's technical foundation.
Chapter 1: Technical Foundations of Crush — Bubble Tea, Ultraviolet, and Lipgloss
Summary
This chapter introduces the three core technologies underpinning Crush, a terminal-based AI coding agent. First, Bubble Tea and the ELM architecture: Crush models its UI as a state-driven message loop, with a central Model in internal/ui/model/ui.go handling typed messages (tea.Msg) via an Update function and executing async tasks through tea.Cmd, ensuring predictable, traceable state changes and parallel initialization via tea.Batch. Second, the Ultraviolet rendering engine: enabled transparently in Bubble Tea v2 through tea.WithEnvironment, it uses double buffering and diff-based incremental rendering to eliminate flicker and minimize redraw cost, with a declarative layout package and runtime terminal capability queries. Third, the Lipgloss styling system: a declarative API over ANSI escape codes supporting immutable styles, inheritance via Copy(), and nested style structs (~450 lines) that organize semantic styles and simplify theming. Together these form Crush's technical foundation.
This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/177168682