[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6R5EQBB77D0HH6MEBFR3HGE":3,"skill-same:01M6R5EQBB77D0HH6MEBFR3HGE":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":6,"updatedAt":52,"install":53,"resources":66},"01M6R5EQBB77D0HH6MEBFR3HGE","bubble-tea",null,"Build terminal UIs in Go with Bubble Tea v2 (Elm Architecture). Covers Model\u002FUpdate\u002FView lifecycle, commands (Batch, Sequence, Tick), key\u002Fmouse handling, Program options, and Charm ecosystem (Bubbles, Lip Gloss, Huh).\nUse when: building Go TUI apps, creating terminal interfaces, handling keyboard\u002Fmouse input in TUI, using Bubble Tea or Charm libraries, or troubleshooting \"tea.Model\" or \"tea.Cmd\" issues.","autonoco\u002Fbuttons","autonoco","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F204403401?v=4","01M6R5E6PXPE4A2HG451Q1M7KM","Autono","01M6R5E6TR6V0Q259HACB0B9JC",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fautonoco\u002Fbuttons\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fbubble-tea\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"bubble tea","tea","commands","when","sequence","ecosystem","input","keyboard","apps","huh","charm","terminal","options","model","batch","issues","update","libraries","architecture","go","2026-11-10 10:12:30",false,"---\nname: bubble-tea\ndescription: >\n    Build terminal UIs in Go with Bubble Tea v2 (Elm Architecture). Covers Model\u002FUpdate\u002FView lifecycle,\n    commands (Batch, Sequence, Tick), key\u002Fmouse handling, Program options, and Charm ecosystem (Bubbles, Lip Gloss, Huh).\n\n    Use when: building Go TUI apps, creating terminal interfaces, handling keyboard\u002Fmouse input in TUI,\n    using Bubble Tea or Charm libraries, or troubleshooting \"tea.Model\" or \"tea.Cmd\" issues.\n---\n\nApply these patterns when building terminal UIs with Bubble Tea v2. For full API reference, see [references\u002F](references\u002F).\n\n**Important**: This covers Bubble Tea **v2** (`github.com\u002Fcharmbracelet\u002Fbubbletea\u002Fv2`). Key v2 changes from v1:\n- `View()` returns `tea.View` (not `string`) — use `tea.NewView(s)`\n- Key events are `tea.KeyPressMsg` (not `tea.KeyMsg`)\n- `tea.Quit` is now `tea.Quit()` (function call, returns `Msg`)\n- `Init()` returns `tea.Cmd` (not `(tea.Model, tea.Cmd)` in basic form)\n\n## Core Architecture (Elm Architecture)\n\nEvery Bubble Tea program has three parts:\n\n```go\ntype Model interface {\n    Init() tea.Cmd             \u002F\u002F initial command (or nil)\n    Update(tea.Msg) (tea.Model, tea.Cmd)  \u002F\u002F handle events, return new state + command\n    View() tea.View            \u002F\u002F render UI from state\n}\n```\n\n1. **Init** — runs once at startup, returns an initial command (or `nil`)\n2. **Update** — receives messages (events), returns updated model + next command\n3. **View** — pure function: model in, string out (wrapped in `tea.NewView`)\n\n## Minimal Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"os\"\n    tea \"github.com\u002Fcharmbracelet\u002Fbubbletea\u002Fv2\"\n)\n\ntype model struct {\n    cursor   int\n    choices  []string\n    selected map[int]struct{}\n}\n\nfunc initialModel() model {\n    return model{\n        choices:  []string{\"Buy carrots\", \"Buy celery\", \"Buy kohlrabi\"},\n        selected: make(map[int]struct{}),\n    }\n}\n\nfunc (m model) Init() tea.Cmd { return nil }\n\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    switch msg := msg.(type) {\n    case tea.KeyPressMsg:\n        switch msg.String() {\n        case \"ctrl+c\", \"q\":\n            return m, tea.Quit\n        case \"up\", \"k\":\n            if m.cursor > 0 { m.cursor-- }\n        case \"down\", \"j\":\n            if m.cursor \u003C len(m.choices)-1 { m.cursor++ }\n        case \"enter\", \" \":\n            if _, ok := m.selected[m.cursor]; ok {\n                delete(m.selected, m.cursor)\n            } else {\n                m.selected[m.cursor] = struct{}{}\n            }\n        }\n    }\n    return m, nil\n}\n\nfunc (m model) View() tea.View {\n    s := \"What should we buy?\\n\\n\"\n    for i, choice := range m.choices {\n        cursor, checked := \" \", \" \"\n        if m.cursor == i { cursor = \">\" }\n        if _, ok := m.selected[i]; ok { checked = \"x\" }\n        s += fmt.Sprintf(\"%s [%s] %s\\n\", cursor, checked, choice)\n    }\n    s += \"\\nPress q to quit.\\n\"\n    return tea.NewView(s)\n}\n\nfunc main() {\n    if _, err := tea.NewProgram(initialModel()).Run(); err != nil {\n        fmt.Fprintf(os.Stderr, \"error: %v\\n\", err)\n        os.Exit(1)\n    }\n}\n```\n\n## Commands (Cmd)\n\nCommands perform I\u002FO and return messages. **Never do I\u002FO in Update or View** — return a `Cmd` instead.\n\n```go\n\u002F\u002F nil = no command\nreturn m, nil\n\n\u002F\u002F Single command\nreturn m, fetchData\n\n\u002F\u002F Run commands concurrently (no ordering guarantee)\nreturn m, tea.Batch(cmd1, cmd2, cmd3)\n\n\u002F\u002F Run commands sequentially (one at a time, in order)\nreturn m, tea.Sequence(cmd1, cmd2, cmd3)\n```\n\n### Custom Command Pattern\n\n```go\ntype DataMsg struct{ Items []Item }\ntype ErrMsg struct{ Err error }\n\nfunc fetchData() tea.Msg {\n    items, err := api.GetItems()\n    if err != nil {\n        return ErrMsg{err}\n    }\n    return DataMsg{items}\n}\n\n\u002F\u002F In Update:\ncase tea.KeyPressMsg:\n    if msg.String() == \"r\" {\n        return m, fetchData  \u002F\u002F pass function as Cmd\n    }\ncase DataMsg:\n    m.items = msg.Items\ncase ErrMsg:\n    m.err = msg.Err\n```\n\n### Tick \u002F Timer\n\n```go\ntype TickMsg time.Time\n\nfunc doTick() tea.Cmd {\n    return tea.Tick(time.Second, func(t time.Time) tea.Msg {\n        return TickMsg(t)\n    })\n}\n\nfunc (m model) Init() tea.Cmd { return doTick() }\n\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    switch msg.(type) {\n    case TickMsg:\n        m.elapsed++\n        return m, doTick()  \u002F\u002F loop: return another tick\n    }\n    return m, nil\n}\n```\n\n`tea.Every` is similar but syncs to system clock (fires at exact intervals).\n\n### Conditional Batching\n\n```go\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    var cmds []tea.Cmd\n    if m.needsRefresh {\n        cmds = append(cmds, refreshCmd)\n    }\n    cmds = append(cmds, saveCmd)\n    return m, tea.Batch(cmds...)\n}\n```\n\n## Key Handling (v2)\n\n```go\ncase tea.KeyPressMsg:\n    \u002F\u002F By string representation\n    switch msg.String() {\n    case \"q\", \"ctrl+c\":\n        return m, tea.Quit\n    case \"enter\":\n        \u002F\u002F handle enter\n    case \"up\", \"k\":\n        \u002F\u002F handle up\n    }\n\n    \u002F\u002F By key code\n    switch msg.Key().Code {\n    case tea.KeyEnter:\n    case tea.KeyTab:\n    case tea.KeyEscape:\n    }\n\n    \u002F\u002F By keystroke (includes modifiers)\n    switch msg.Keystroke() {\n    case \"ctrl+c\":\n    case \"shift+alt+a\":\n    }\n\n    \u002F\u002F Printable characters\n    if msg.Key().Text != \"\" {\n        m.input += msg.Key().Text\n    }\n```\n\n### Common Key Constants\n\n```go\ntea.KeyUp, tea.KeyDown, tea.KeyLeft, tea.KeyRight\ntea.KeyEnter, tea.KeyReturn, tea.KeyTab, tea.KeyEscape\ntea.KeyBackspace, tea.KeyDelete, tea.KeySpace\ntea.KeyHome, tea.KeyEnd, tea.KeyPgUp, tea.KeyPgDown\ntea.KeyF1 ... tea.KeyF63\n```\n\n### Modifier Keys\n\n```go\ntea.ModCtrl, tea.ModAlt, tea.ModShift\ntea.ModMeta, tea.ModHyper, tea.ModSuper\n```\n\n## Mouse Handling\n\n```go\ncase tea.MouseClickMsg:\n    x, y := msg.Mouse().X, msg.Mouse().Y\n    button := msg.Mouse().Button  \u002F\u002F tea.MouseLeft, tea.MouseRight, etc.\n\ncase tea.MouseWheelMsg:\n    \u002F\u002F scroll events\n\ncase tea.MouseMotionMsg:\n    \u002F\u002F hover\u002Fdrag events\n```\n\nMouse buttons: `MouseLeft`, `MouseMiddle`, `MouseRight`, `MouseWheelUp`, `MouseWheelDown`, `MouseBackward`, `MouseForward`.\n\n## Window Size\n\n```go\ncase tea.WindowSizeMsg:\n    m.width = msg.Width\n    m.height = msg.Height\n```\n\nRequest explicitly: `tea.RequestWindowSize()`\n\n## Built-in Messages\n\n```go\ntea.Quit()                    \u002F\u002F quit the program\ntea.ClearScreen()             \u002F\u002F clear terminal\ntea.Suspend()                 \u002F\u002F suspend (like Ctrl+Z)\ntea.SetClipboard(\"text\")      \u002F\u002F set clipboard\ntea.ReadClipboard()           \u002F\u002F read clipboard\ntea.RequestWindowSize()       \u002F\u002F request window dimensions\ntea.RequestCursorPosition()   \u002F\u002F request cursor position\n```\n\n## Program Setup\n\n```go\np := tea.NewProgram(\n    initialModel(),\n    \u002F\u002F Options:\n    tea.WithOutput(os.Stderr),          \u002F\u002F custom output writer\n    tea.WithInput(customReader),        \u002F\u002F custom input reader\n    tea.WithFPS(60),                    \u002F\u002F framerate (default: 60)\n    tea.WithContext(ctx),               \u002F\u002F context for cancellation\n    tea.WithWindowSize(80, 24),         \u002F\u002F initial window size\n    tea.WithoutSignalHandler(),         \u002F\u002F disable signal handling\n    tea.WithoutCatchPanics(),           \u002F\u002F let panics propagate\n    tea.WithFilter(filterFunc),         \u002F\u002F message filter\n)\n\nmodel, err := p.Run()  \u002F\u002F blocking\n```\n\n### Sending Messages from Outside\n\n```go\np := tea.NewProgram(m)\ngo func() {\n    p.Send(MyCustomMsg{data: \"hello\"})\n}()\np.Run()\n```\n\n### Printing Outside the TUI\n\n```go\n\u002F\u002F From within Update (as Cmd):\nreturn m, tea.Println(\"Status: done\")\nreturn m, tea.Printf(\"Processed %d items\", count)\n\n\u002F\u002F From outside:\np.Println(\"External message\")\n```\n\n## Focus and Blur\n\n```go\ncase tea.FocusMsg:\n    m.focused = true\ncase tea.BlurMsg:\n    m.focused = false\n```\n\n## Debugging\n\n```go\n\u002F\u002F Log to file (since TUI owns stdout)\nif os.Getenv(\"DEBUG\") != \"\" {\n    f, err := tea.LogToFile(\"debug.log\", \"debug\")\n    if err != nil {\n        fmt.Println(\"fatal:\", err)\n        os.Exit(1)\n    }\n    defer f.Close()\n}\n\u002F\u002F Then use log.Println() throughout your code\n\u002F\u002F Monitor: tail -f debug.log\n```\n\n## Charm Ecosystem\n\n| Library | Purpose | Import |\n|---------|---------|--------|\n| **Bubbles** | Reusable components (text input, viewport, spinner, list, table, paginator, progress bar) | `github.com\u002Fcharmbracelet\u002Fbubbles` |\n| **Lip Gloss** | Styling and layout (colors, borders, padding, alignment) | `github.com\u002Fcharmbracelet\u002Flipgloss` |\n| **Huh** | Interactive forms and prompts | `github.com\u002Fcharmbracelet\u002Fhuh` |\n| **Harmonica** | Spring animations | `github.com\u002Fcharmbracelet\u002Fharmonica` |\n| **BubbleZone** | Mouse event zone tracking | `github.com\u002Flrstanley\u002Fbubblezone` |\n\n### Bubbles Components Pattern\n\n```go\nimport \"github.com\u002Fcharmbracelet\u002Fbubbles\u002Ftextinput\"\n\ntype model struct {\n    textInput textinput.Model\n}\n\nfunc initialModel() model {\n    ti := textinput.New()\n    ti.Placeholder = \"Search...\"\n    ti.Focus()\n    return model{textInput: ti}\n}\n\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    var cmd tea.Cmd\n    m.textInput, cmd = m.textInput.Update(msg)  \u002F\u002F delegate to component\n    return m, cmd\n}\n\nfunc (m model) View() tea.View {\n    return tea.NewView(m.textInput.View())\n}\n```\n\n## Common Patterns\n\n### Multiple Components\n\n```go\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    var cmds []tea.Cmd\n\n    \u002F\u002F Update each component, collect commands\n    var cmd tea.Cmd\n    m.input, cmd = m.input.Update(msg)\n    cmds = append(cmds, cmd)\n\n    m.list, cmd = m.list.Update(msg)\n    cmds = append(cmds, cmd)\n\n    return m, tea.Batch(cmds...)\n}\n```\n\n### State Machine (Screens\u002FViews)\n\n```go\ntype state int\nconst (\n    stateMenu state = iota\n    stateInput\n    stateConfirm\n)\n\ntype model struct {\n    state state\n    \u002F\u002F ...\n}\n\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    switch m.state {\n    case stateMenu:\n        return m.updateMenu(msg)\n    case stateInput:\n        return m.updateInput(msg)\n    case stateConfirm:\n        return m.updateConfirm(msg)\n    }\n    return m, nil\n}\n\nfunc (m model) View() tea.View {\n    switch m.state {\n    case stateMenu:\n        return tea.NewView(m.menuView())\n    case stateInput:\n        return tea.NewView(m.inputView())\n    case stateConfirm:\n        return tea.NewView(m.confirmView())\n    }\n    return tea.NewView(\"\")\n}\n```\n\n### Running External Processes\n\n```go\ncmd := exec.Command(\"vim\", \"file.txt\")\nreturn m, tea.ExecProcess(cmd, func(err error) tea.Msg {\n    return editorFinishedMsg{err}\n})\n```\n\nThis pauses the TUI, runs the process with full terminal access, then resumes.\n\n## Common Mistakes\n\n- **Doing I\u002FO in Update**: Never. Return a `Cmd` instead.\n- **Forgetting to return a Cmd from Init**: Return `nil` if no initial I\u002FO needed.\n- **Not delegating Update to sub-components**: Bubbles components need their `Update` called.\n- **Using `string` return from View (v1 style)**: v2 requires `tea.View` — use `tea.NewView(s)`.\n- **Using `tea.KeyMsg` (v1)**: v2 uses `tea.KeyPressMsg` and `tea.KeyReleaseMsg`.\n- **Using `tea.Quit` as a value (v1)**: v2 requires `tea.Quit()` (function call).\n- **Printing to stdout**: TUI owns stdout. Use `tea.LogToFile` for debugging.\n- **Not collecting Cmds from sub-components**: Use `tea.Batch(cmds...)` to combine.\n","Apply these patterns when building terminal UIs with Bubble Tea v2. For full API reference, see [references\u002F](references\u002F).\n\n**Important**: This covers Bubble Tea **v2** (`github.com\u002Fcharmbracelet\u002Fbubbletea\u002Fv2`). Key v2 changes from v1:\n- `View()` returns `tea.View` (not `string`) — use `tea.NewView(s)`\n- Key events are `tea.KeyPressMsg` (not `tea.KeyMsg`)\n- `tea.Quit` is now `tea.Quit()` (function call, returns `Msg`)\n- `Init()` returns `tea.Cmd` (not `(tea.Model, tea.Cmd)` in basic form)\n\n## Core Architecture (Elm Architecture)\n\nEvery Bubble Tea program has three parts:\n\n```go\ntype Model interface {\n    Init() tea.Cmd             \u002F\u002F initial command (or nil)\n    Update(tea.Msg) (tea.Model, tea.Cmd)  \u002F\u002F handle events, return new state + command\n    View() tea.View            \u002F\u002F render UI from state\n}\n```\n\n1. **Init** — runs once at startup, returns an initial command (or `nil`)\n2. **Update** — receives messages (events), returns updated model + next command\n3. **View** — pure function: model in, string out (wrapped in `tea.NewView`)\n\n## Minimal Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"os\"\n    tea \"github.com\u002Fcharmbracelet\u002Fbubbletea\u002Fv2\"\n)\n\ntype model struct {\n    cursor   int\n    choices  []string\n    selected map[int]struct{}\n}\n\nfunc initialModel() model {\n    return model{\n        choices:  []string{\"Buy carrots\", \"Buy celery\", \"Buy kohlrabi\"},\n        selected: make(map[int]struct{}),\n    }\n}\n\nfunc (m model) Init() tea.Cmd { return nil }\n\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    switch msg := msg.(type) {\n    case tea.KeyPressMsg:\n        switch msg.String() {\n        case \"ctrl+c\", \"q\":\n            return m, tea.Quit\n        case \"up\", \"k\":\n            if m.cursor > 0 { m.cursor-- }\n        case \"down\", \"j\":\n            if m.cursor \u003C len(m.choices)-1 { m.cursor++ }\n        case \"enter\", \" \":\n            if _, ok := m.selected[m.cursor]; ok {\n                delete(m.selected, m.cursor)\n            } else {\n                m.selected[m.cursor] = struct{}{}\n            }\n        }\n    }\n    return m, nil\n}\n\nfunc (m model) View() tea.View {\n    s := \"What should we buy?\\n\\n\"\n    for i, choice := range m.choices {\n        cursor, checked := \" \", \" \"\n        if m.cursor == i { cursor = \">\" }\n        if _, ok := m.selected[i]; ok { checked = \"x\" }\n        s += fmt.Sprintf(\"%s [%s] %s\\n\", cursor, checked, choice)\n    }\n    s += \"\\nPress q to quit.\\n\"\n    return tea.NewView(s)\n}\n\nfunc main() {\n    if _, err := tea.NewProgram(initialModel()).Run(); err != nil {\n        fmt.Fprintf(os.Stderr, \"error: %v\\n\", err)\n        os.Exit(1)\n    }\n}\n```\n\n## Commands (Cmd)\n\nCommands perform I\u002FO and return messages. **Never do I\u002FO in Update or View** — return a `Cmd` instead.\n\n```go\n\u002F\u002F nil = no command\nreturn m, nil\n\n\u002F\u002F Single command\nreturn m, fetchData\n\n\u002F\u002F Run commands concurrently (no ordering guarantee)\nreturn m, tea.Batch(cmd1, cmd2, cmd3)\n\n\u002F\u002F Run commands sequentially (one at a time, in order)\nreturn m, tea.Sequence(cmd1, cmd2, cmd3)\n```\n\n### Custom Command Pattern\n\n```go\ntype DataMsg struct{ Items []Item }\ntype ErrMsg struct{ Err error }\n\nfunc fetchData() tea.Msg {\n    items, err := api.GetItems()\n    if err != nil {\n        return ErrMsg{err}\n    }\n    return DataMsg{items}\n}\n\n\u002F\u002F In Update:\ncase tea.KeyPressMsg:\n    if msg.String() == \"r\" {\n        return m, fetchData  \u002F\u002F pass function as Cmd\n    }\ncase DataMsg:\n    m.items = msg.Items\ncase ErrMsg:\n    m.err = msg.Err\n```\n\n### Tick \u002F Timer\n\n```go\ntype TickMsg time.Time\n\nfunc doTick() tea.Cmd {\n    return tea.Tick(time.Second, func(t time.Time) tea.Msg {\n        return TickMsg(t)\n    })\n}\n\nfunc (m model) Init() tea.Cmd { return doTick() }\n\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    switch msg.(type) {\n    case TickMsg:\n        m.elapsed++\n        return m, doTick()  \u002F\u002F loop: return another tick\n    }\n    return m, nil\n}\n```\n\n`tea.Every` is similar but syncs to system clock (fires at exact intervals).\n\n### Conditional Batching\n\n```go\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    var cmds []tea.Cmd\n    if m.needsRefresh {\n        cmds = append(cmds, refreshCmd)\n    }\n    cmds = append(cmds, saveCmd)\n    return m, tea.Batch(cmds...)\n}\n```\n\n## Key Handling (v2)\n\n```go\ncase tea.KeyPressMsg:\n    \u002F\u002F By string representation\n    switch msg.String() {\n    case \"q\", \"ctrl+c\":\n        return m, tea.Quit\n    case \"enter\":\n        \u002F\u002F handle enter\n    case \"up\", \"k\":\n        \u002F\u002F handle up\n    }\n\n    \u002F\u002F By key code\n    switch msg.Key().Code {\n    case tea.KeyEnter:\n    case tea.KeyTab:\n    case tea.KeyEscape:\n    }\n\n    \u002F\u002F By keystroke (includes modifiers)\n    switch msg.Keystroke() {\n    case \"ctrl+c\":\n    case \"shift+alt+a\":\n    }\n\n    \u002F\u002F Printable characters\n    if msg.Key().Text != \"\" {\n        m.input += msg.Key().Text\n    }\n```\n\n### Common Key Constants\n\n```go\ntea.KeyUp, tea.KeyDown, tea.KeyLeft, tea.KeyRight\ntea.KeyEnter, tea.KeyReturn, tea.KeyTab, tea.KeyEscape\ntea.KeyBackspace, tea.KeyDelete, tea.KeySpace\ntea.KeyHome, tea.KeyEnd, tea.KeyPgUp, tea.KeyPgDown\ntea.KeyF1 ... tea.KeyF63\n```\n\n### Modifier Keys\n\n```go\ntea.ModCtrl, tea.ModAlt, tea.ModShift\ntea.ModMeta, tea.ModHyper, tea.ModSuper\n```\n\n## Mouse Handling\n\n```go\ncase tea.MouseClickMsg:\n    x, y := msg.Mouse().X, msg.Mouse().Y\n    button := msg.Mouse().Button  \u002F\u002F tea.MouseLeft, tea.MouseRight, etc.\n\ncase tea.MouseWheelMsg:\n    \u002F\u002F scroll events\n\ncase tea.MouseMotionMsg:\n    \u002F\u002F hover\u002Fdrag events\n```\n\nMouse buttons: `MouseLeft`, `MouseMiddle`, `MouseRight`, `MouseWheelUp`, `MouseWheelDown`, `MouseBackward`, `MouseForward`.\n\n## Window Size\n\n```go\ncase tea.WindowSizeMsg:\n    m.width = msg.Width\n    m.height = msg.Height\n```\n\nRequest explicitly: `tea.RequestWindowSize()`\n\n## Built-in Messages\n\n```go\ntea.Quit()                    \u002F\u002F quit the program\ntea.ClearScreen()             \u002F\u002F clear terminal\ntea.Suspend()                 \u002F\u002F suspend (like Ctrl+Z)\ntea.SetClipboard(\"text\")      \u002F\u002F set clipboard\ntea.ReadClipboard()           \u002F\u002F read clipboard\ntea.RequestWindowSize()       \u002F\u002F request window dimensions\ntea.RequestCursorPosition()   \u002F\u002F request cursor position\n```\n\n## Program Setup\n\n```go\np := tea.NewProgram(\n    initialModel(),\n    \u002F\u002F Options:\n    tea.WithOutput(os.Stderr),          \u002F\u002F custom output writer\n    tea.WithInput(customReader),        \u002F\u002F custom input reader\n    tea.WithFPS(60),                    \u002F\u002F framerate (default: 60)\n    tea.WithContext(ctx),               \u002F\u002F context for cancellation\n    tea.WithWindowSize(80, 24),         \u002F\u002F initial window size\n    tea.WithoutSignalHandler(),         \u002F\u002F disable signal handling\n    tea.WithoutCatchPanics(),           \u002F\u002F let panics propagate\n    tea.WithFilter(filterFunc),         \u002F\u002F message filter\n)\n\nmodel, err := p.Run()  \u002F\u002F blocking\n```\n\n### Sending Messages from Outside\n\n```go\np := tea.NewProgram(m)\ngo func() {\n    p.Send(MyCustomMsg{data: \"hello\"})\n}()\np.Run()\n```\n\n### Printing Outside the TUI\n\n```go\n\u002F\u002F From within Update (as Cmd):\nreturn m, tea.Println(\"Status: done\")\nreturn m, tea.Printf(\"Processed %d items\", count)\n\n\u002F\u002F From outside:\np.Println(\"External message\")\n```\n\n## Focus and Blur\n\n```go\ncase tea.FocusMsg:\n    m.focused = true\ncase tea.BlurMsg:\n    m.focused = false\n```\n\n## Debugging\n\n```go\n\u002F\u002F Log to file (since TUI owns stdout)\nif os.Getenv(\"DEBUG\") != \"\" {\n    f, err := tea.LogToFile(\"debug.log\", \"debug\")\n    if err != nil {\n        fmt.Println(\"fatal:\", err)\n        os.Exit(1)\n    }\n    defer f.Close()\n}\n\u002F\u002F Then use log.Println() throughout your code\n\u002F\u002F Monitor: tail -f debug.log\n```\n\n## Charm Ecosystem\n\n| Library | Purpose | Import |\n|---------|---------|--------|\n| **Bubbles** | Reusable components (text input, viewport, spinner, list, table, paginator, progress bar) | `github.com\u002Fcharmbracelet\u002Fbubbles` |\n| **Lip Gloss** | Styling and layout (colors, borders, padding, alignment) | `github.com\u002Fcharmbracelet\u002Flipgloss` |\n| **Huh** | Interactive forms and prompts | `github.com\u002Fcharmbracelet\u002Fhuh` |\n| **Harmonica** | Spring animations | `github.com\u002Fcharmbracelet\u002Fharmonica` |\n| **BubbleZone** | Mouse event zone tracking | `github.com\u002Flrstanley\u002Fbubblezone` |\n\n### Bubbles Components Pattern\n\n```go\nimport \"github.com\u002Fcharmbracelet\u002Fbubbles\u002Ftextinput\"\n\ntype model struct {\n    textInput textinput.Model\n}\n\nfunc initialModel() model {\n    ti := textinput.New()\n    ti.Placeholder = \"Search...\"\n    ti.Focus()\n    return model{textInput: ti}\n}\n\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    var cmd tea.Cmd\n    m.textInput, cmd = m.textInput.Update(msg)  \u002F\u002F delegate to component\n    return m, cmd\n}\n\nfunc (m model) View() tea.View {\n    return tea.NewView(m.textInput.View())\n}\n```\n\n## Common Patterns\n\n### Multiple Components\n\n```go\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    var cmds []tea.Cmd\n\n    \u002F\u002F Update each component, collect commands\n    var cmd tea.Cmd\n    m.input, cmd = m.input.Update(msg)\n    cmds = append(cmds, cmd)\n\n    m.list, cmd = m.list.Update(msg)\n    cmds = append(cmds, cmd)\n\n    return m, tea.Batch(cmds...)\n}\n```\n\n### State Machine (Screens\u002FViews)\n\n```go\ntype state int\nconst (\n    stateMenu state = iota\n    stateInput\n    stateConfirm\n)\n\ntype model struct {\n    state state\n    \u002F\u002F ...\n}\n\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    switch m.state {\n    case stateMenu:\n        return m.updateMenu(msg)\n    case stateInput:\n        return m.updateInput(msg)\n    case stateConfirm:\n        return m.updateConfirm(msg)\n    }\n    return m, nil\n}\n\nfunc (m model) View() tea.View {\n    switch m.state {\n    case stateMenu:\n        return tea.NewView(m.menuView())\n    case stateInput:\n        return tea.NewView(m.inputView())\n    case stateConfirm:\n        return tea.NewView(m.confirmView())\n    }\n    return tea.NewView(\"\")\n}\n```\n\n### Running External Processes\n\n```go\ncmd := exec.Command(\"vim\", \"file.txt\")\nreturn m, tea.ExecProcess(cmd, func(err error) tea.Msg {\n    return editorFinishedMsg{err}\n})\n```\n\nThis pauses the TUI, runs the process with full terminal access, then resumes.\n\n## Common Mistakes\n\n- **Doing I\u002FO in Update**: Never. Return a `Cmd` instead.\n- **Forgetting to return a Cmd from Init**: Return `nil` if no initial I\u002FO needed.\n- **Not delegating Update to sub-components**: Bubbles components need their `Update` called.\n- **Using `string` return from View (v1 style)**: v2 requires `tea.View` — use `tea.NewView(s)`.\n- **Using `tea.KeyMsg` (v1)**: v2 uses `tea.KeyPressMsg` and `tea.KeyReleaseMsg`.\n- **Using `tea.Quit` as a value (v1)**: v2 requires `tea.Quit()` (function call).\n- **Printing to stdout**: TUI owns stdout. Use `tea.LogToFile` for debugging.\n- **Not collecting Cmds from sub-components**: Use `tea.Batch(cmds...)` to combine.\n",{"name":5,"description":7},"main","97949250d40e4763497bf61d24e9119a7d6a4766",".agents\u002Fskills\u002Fbubble-tea",0,"https:\u002F\u002Fgithub.com\u002Fautonoco\u002Fbuttons","https:\u002F\u002Fdocs.buttons.sh","https:\u002F\u002Fgithub.com\u002Fautonoco","autono.co","2026-09-15 00:06:16",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add autonoco\u002Fbuttons --skill bubble-tea",{"tool":59,"command":60},"bunx","bunx skills add autonoco\u002Fbuttons --skill bubble-tea",{"tool":62,"command":63},"pnpm","pnpm dlx skills add autonoco\u002Fbuttons --skill bubble-tea","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fautonoco\u002Fbuttons\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fbubble-tea\u002FSKILL.md",true,[67],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Ffull-guide.md","REFERENCE","参考文档",10725,"https:\u002F\u002Fgithub.com\u002Fautonoco\u002Fbuttons\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fbubble-tea\u002Freferences\u002Ffull-guide.md",[74,80,106,111,132,153],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":39},"01M6R5GQ3Y6S8MYQ0AADV6ECK7","buttons","https:\u002F\u002Fgithub.com\u002Fautonoco\u002Fbuttons\u002Fblob\u002Fmain\u002Fdocs\u002F.mintlify\u002Fskills\u002Fbuttons\u002FSKILL.md",[],[76],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":39},"01M6R5GGJ5A1G8HY5WQEJ80V0D","mintlify","Build and maintain documentation sites with Mintlify. Use when creating docs pages, configuring navigation, adding components, or setting up API references.","MIT","https:\u002F\u002Fgithub.com\u002Fautonoco\u002Fbuttons\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fmintlify\u002FSKILL.md",[],[82,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,22],"cli","docs","workflow","components","documentation","git","api","node","use","up","references","build","maintain","pages","sites","with","for","maintain documentation",{"skillNo":107,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":39},"01M6R5G4TTCNC9MPE2WDG3KV8F","https:\u002F\u002Fgithub.com\u002Fautonoco\u002Fbuttons\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fmintlify-docs\u002FSKILL.md",[],[82,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,22],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":39},"01M6R5FXMGBM2YXZVQH6RQRYPD","cobra","Build Go CLI applications with Cobra framework. Covers command structure, flags (local\u002Fpersistent\u002Frequired), hooks (PreRun\u002FPostRun), shell completions, Viper config integration, error handling, and doc generation.\nUse when: building Go CLIs, adding Cobra commands or subcommands, working with flags, generating shell completions, or troubleshooting \"unknown command\" or flag parsing errors.","https:\u002F\u002Fgithub.com\u002Fautonoco\u002Fbuttons\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fcobra\u002FSKILL.md",[],[113,88,38,118,119,120,121,122,123,96,124,125,126,127,21,128,129,130,131,22],"config","framework","doc","applications","parsing","command","hooks","flags","structure","local","error","errors","unknown","viper",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":138,"publishedAt":39},"01M6R5FH15DGZVK8SSJGGJQ7A2","cli-design-guidelines","Design human-first CLI tools following clig.dev best practices. Covers help text, output formatting, error handling, flags\u002Fargs, subcommands, interactivity, configuration, signals, naming, and distribution.\nUse when: building CLI tools, designing command interfaces, adding flags or subcommands, writing help text, formatting CLI output, handling CLI errors, or reviewing CLI UX.","https:\u002F\u002Fgithub.com\u002Fautonoco\u002Fbuttons\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fcli-design-guidelines\u002FSKILL.md",[],[139,88,140,141,142,143,144,145,146,147,123,96,148,149,128,150,151,129,152,22],"design","guidelines","cli design guidelines","writing","error handling","best practices","dev","first","text","signals","distribution","output","naming","output formatting",{"skillNo":154,"name":76,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":39},"01M6R5F6WA8613XB7VZRM3WW95","Deterministic workflow engine for AI agents. Create and press\nreusable buttons (shell scripts, HTTP APIs, prompt instructions)\nwith typed inputs and structured JSON output. Use when wrapping\nrepeatable actions, calling HTTP endpoints, or building multi-step\nworkflows where each step is a named, typed, pressable button.","https:\u002F\u002Fgithub.com\u002Fautonoco\u002Fbuttons\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fbuttons\u002FSKILL.md",[],[76,88,38,159,90,160,161,162,163,164,165,166,96,167,168,169,170,104,171,22],"ai agents","workflows","create","workflow engine","actions","JSON Output","shell scripts","install","installer","calling","deterministic","scripts","http endpoints"]