bubbletea-v2
Charm v2 discipline for Bubble Tea programs — declarative views, Cmd/Msg as the only async boundary, headless golden-frame testing, and terminal capability degradation.
- License 许可
- MIT
- 所属仓库
- poppyTM/oride
- 最近更新
- 2026-09-30
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- bubbletea-v2
- description
- Charm v2 discipline for Bubble Tea programs — declarative views, Cmd/Msg as the only async boundary, headless golden-frame testing, and terminal capability degradation.
03 SKILL.md 正文
Bubble Tea v2 Discipline
Purpose
Keep the Oride TUI correct under the Charm v2 (Elm-style) runtime: no I/O in
View, no blocking in Update, and every terminal capability either declared
or gracefully absent.
Rules
View()is pure and cheap. No file reads, no process spawns, no network. It runs on every frame; anything slow belongs in aCmd.Cmd/Msgis the only asynchronous boundary. Goroutines reach the program throughProgram.Send, never by mutating shared state.- Never block
Update. Anything that can take time returns aCmd. - Declare terminal features in the view: alt screen, mouse mode, keyboard enhancements, focus reporting and cursor. Do not toggle them imperatively per frame — that is how a terminal is left broken after a crash.
- Request keyboard enhancements only when the program uses them, and always
handle the terminal that does not support them. The
ctrl+shift+<letter>ambiguity is real and must be resolved from the key's own fields, not from a guess about the terminal. - Every colour decision degrades: true colour, then 256, then 16, then none.
A
no-colortheme must resolve every non-primitive token to nothing, and a palette that claims to suppress colour while painting one is an error. - No meaning carried by colour alone. A state that is tinted is also spelled out in words.
- Width is conservative: assume ambiguous-width characters are wide, and never let a row silently lose its tail — truncate with a visible marker.
- Cursor shape and blink are view state, not terminal escape sequences written by hand.
- Batching has two forms and they are not interchangeable:
Batchruns concurrently,Sequenceruns in order. Choose deliberately.
Anti-patterns
- A
Cmdthat only sends a message to another part of the same program — that is anUpdatecall. - Doing work in
Initthat can fail;Inithas no error path. - Reading
os.Getenvfor the terminal when the program already receives the environment as a message. - Rendering the whole frame on each keystroke. Announcements are deltas.
Verification
- Headless tests drive a real
tea.Programand compare frame buffers byte for byte; a frame and the code that draws it change in the same commit. - A test asserts that with reduced motion the frames differ in the animated line and in no other.
- Capability is injected by option, never by writing to the process environment.
04 同仓库更多 Skills
zoom-reflow
暂无简介
wireframe-styleguide
暂无简介
visual-regression
Pixel-by-pixel snapshot testing, Playwright integration, dynamic content masking, deterministic font rendering, and cross-browser CI gates
ui-implementation
Component-driven UI implementation, multi-state matrix (default, hover, focus-visible, active, disabled, loading, empty, error), DTCG design tokens, responsive layout contracts, and accessibility tree mapping.
tui-editor-engine
Text buffer and editing semantics for a terminal code editor — index conversion, transaction-first editing, multi-cursor invariants, undo grouping, and large-file behaviour.
tree-sitter-context-indexing
暂无简介