cosmobar guided setup
Configure cosmobar by interviewing the user, then apply the result with one command. Do not hardcode the list of segments or themes — read them live from the binary so this stays correct as cosmobar gains new segments.
Steps
Confirm the binary is installed. Run
cosmobar --version.- If you get "command not found", tell the user to install it first:
curl -sS https://raw.githubusercontent.com/oleksbard/cosmobar/main/install.sh | shthen stop and let them install.
- If you get "command not found", tell the user to install it first:
Discover what's available (dynamic — always run these, never assume):
cosmobar segments --json→ array of segments, each withname,description,default_on,requires_git,pro_max_only.cosmobar themes --json→ array of theme names.
Interview the user with the AskUserQuestion tool. Keep it short — group related choices:
- Segments: present every segment returned by the JSON, using its
description. Pre-select the ones wheredefault_onis true. Mention thatpro_max_onlysegments only show data on Pro/Max plans, andrequires_gitsegments only appear inside a git repo. Let the user pick the set to show. The order they end up with is the left-to-right display order. - Theme: offer the names from the themes JSON (default
coral). - Clock:
24h,12h, oroff. - Glyphs (optional):
auto(default) orascii— pickasciionly if their terminal can't render block characters like▓░. - Style:
lean(default),tick, orblocks(background pills). All styles are font-free — there is no Nerd Font / powerline option. - Caps — ask ONLY when the chosen style is
blocks:soft(default) orsquare. Forleanortick, do not ask about caps at all.AskUserQuestioncan't branch mid-batch, so put style in the first batch and send the caps question separately afterwards, only if style came backblocks. - Animation:
on(default) oroff. When on, a segment's value briefly scrambles through symbols and "decodes" into its new value whenever it changes — purely visual, width-stable. Offerofffor users who want a completely static bar. - Rate-limit window (only if
rate_limitsis enabled):both(default),5h, or7d. - Cost rollup (only if
costis enabled): show today's cross-session spend (· $5.30 today) on the cost segment —today(default) to show, empty to hide. - Block cost (only if
rate_limitsis enabled):on(default) oroff. When on, the 5-hour window shows its spend, e.g.5h 31% $4.20 (2h30m left).
- Segments: present every segment returned by the JSON, using its
Apply immediately — no preview step, no confirmation prompt. As soon as the interview answers are in, write the config and wire it. Don't render a preview and don't put up a "shall I apply this?" question — both are just friction, and applying is reversible. This one command writes
~/.config/cosmobar/config.tomlAND wires~/.claude/settings.json(backing up the previous file):cosmobar init --force --theme <THEME> --order <comma,separated,enabled,segments> --clock <24h|12h|off> --glyphs <auto|ascii> --style <lean|tick|blocks> [--caps <soft|square>] --rate-window <both|5h|7d> [--animate <on|off>] [--cost-rollups today] [--block-cost <on|off>]--orderis the comma-separated list of the segments the user enabled, in their chosen order.--forceoverwrites any existing config (this is a reconfigure).--capsis only relevant when--style blocksis used — omit it otherwise.--rate-windowis only relevant whenrate_limitsis included in--order.--animate on|offtoggles the value-change scramble animation (default on).--cost-rollupsis only relevant whencostis in--order— passtodayto show the today rollup (the default), or omit to keep it.--block-cost on|offis only relevant whenrate_limitsis in--order— shows the 5h block's spend (default on).
Confirm in one line. Just tell the user it's applied — it appears at the bottom of Claude Code on their next message, they can re-run
/cosmobaranytime, or hand-edit~/.config/cosmobar/config.tomland check it withcosmobar preview. Don't ask follow-up questions.
Notes
- Everything is reversible:
cosmobar uninstallremoves the statusline wiring (add--purgeto also delete the config and the binary). cosmobar doctorreports whether the binary, config, color support, and wiring are all healthy.