xonecas.io
64875
Mc

mini-coder / commit 7c08232

feat: TUI nice things

xonecas2026-04-26 7c08232f8277c56ae67aff8535290b72cbb7b1ba parent bac5039

2 files changed

src/tui-components.ts+27−9
@@ -73,14 +73,6 @@ export const theme = {
7373 // return memoized;
7474 // }
7575
76-// TextPill("mini-coder", theme.bblack, theme.black),
77-// TextPill("mini-coder", theme.bred, theme.red),
78-// TextPill("mini-coder", theme.bgreen, theme.green),
79-// TextPill("mini-coder", theme.byellow, theme.yellow),
80-// TextPill("mini-coder", theme.bblue, theme.blue),
81-// TextPill("mini-coder", theme.bmagenta, theme.magenta),
82-// TextPill("mini-coder", theme.bcyan, theme.cyan),
83-// TextPill("mini-coder", theme.bwhite, theme.white),
8476 export function TextPill(content: string, fgColor: Color, bgColor: Color) {
8577 return HStack({ gap: 1 }, [
8678 HStack({ bgColor, padding: { x: 1 } }, [
@@ -148,17 +140,43 @@ export function ActivityPill(state: TUIState, spinnerFrame: string) {
148140
149141 export function ContextPill(state: TUIState) {
150142 let text = "";
143+ let bg = theme.bwhite;
151144 if (!state.contextSize) {
152145 text = "0%";
153146 } else {
154147 const max = state.options.model.contextWindow;
155148 const percent = Math.floor((state.contextSize / max) * 100);
149+ if (percent > 90) {
150+ bg = theme.bred;
151+ } else if (percent > 75) {
152+ bg = theme.red;
153+ } else if (percent > 60) {
154+ bg = theme.yellow;
155+ } else if (percent > 40) {
156+ bg = theme.byellow;
157+ }
156158 text = `~${percent}%`;
157159 }
158160
159- return TextPill(text, theme.bblack, theme.bwhite);
161+ return TextPill(text, theme.bblack, bg);
160162 }
161163
162164 export function GitPill(state: TUIState) {
163165 return TextPill(state.gitBranch ?? "No git.", theme.bwhite, theme.bblack);
164166 }
167+
168+export function ModelPill(state: TUIState) {
169+ // Like loot: Gold/purple/blue/green/white -> xhigh/high/medium/low/minimal
170+ switch (state.options.effort) {
171+ case "xhigh":
172+ return TextPill(state.options.model.name, theme.white, theme.yellow);
173+ case "high":
174+ return TextPill(state.options.model.name, theme.white, theme.magenta);
175+ case "medium":
176+ return TextPill(state.options.model.name, theme.white, theme.blue);
177+ case "low":
178+ return TextPill(state.options.model.name, theme.white, theme.green);
179+ }
180+ // Minimal
181+ return TextPill(state.options.model.name, theme.bwhite, theme.bblack);
182+}
src/tui.ts+2−1
@@ -17,6 +17,7 @@ import {
1717 ActivityPill,
1818 ContextPill,
1919 GitPill,
20+ ModelPill,
2021 Spinner,
2122 TextPill,
2223 theme,
@@ -77,7 +78,7 @@ export function initTUI(state: TUIState, leave: (s: string) => void) {
7778 Conversation(state),
7879
7980 HStack({ gap: 1 }, [
80- TextPill(state.options.model.name, theme.bblack, theme.bwhite),
81+ ModelPill(state),
8182 TextPill(`../${state.cwd}`, theme.bwhite, theme.bblack),
8283 GitPill(state),
8384 VStack({ flex: 1 }, []),