xonecas.io
64875
Mc

mini-coder / commit ccfcf47

fix: more little TUI fixes, persist settings changes in the TUI

and small other changes to theme and colors.

xonecas2026-04-29 ccfcf470c2a82c3fe673e955fdbc6b08a3540c3c parent 87f5161

3 files changed

src/args.ts+1−1
@@ -68,7 +68,7 @@ async function getSettings(): Promise<Settings | undefined> {
6868 return parseSettings(settings, "settings");
6969 }
7070
71-async function saveSettings(s: Settings) {
71+export async function saveSettings(s: Settings) {
7272 await mkdir(DATA_DIR, { recursive: true });
7373 const file = Bun.file(SETTINGS_PATH);
7474 await Bun.write(file, JSON.stringify(s, null, 4));
src/tui-components.ts+6−5
@@ -100,19 +100,20 @@ export function ActivityPill(state: TUIState, spinnerFrame: string) {
100100
101101 export function ContextPill(state: TUIState) {
102102 let text = "";
103- let bg = theme.bwhite;
103+ let bg = theme.bgreen;
104104 if (!state.contextSize) {
105105 text = "0%";
106+ bg = theme.bwhite;
106107 } else {
107108 const max = state.options.model.contextWindow;
108109 const percent = Math.floor((state.contextSize / max) * 100);
109- if (percent > 90) {
110+ if (percent > 80) {
110111 bg = theme.bred;
111- } else if (percent > 75) {
112- bg = theme.red;
113112 } else if (percent > 60) {
114- bg = theme.yellow;
113+ bg = theme.red;
115114 } else if (percent > 40) {
115+ bg = theme.yellow;
116+ } else if (percent > 30) {
116117 bg = theme.byellow;
117118 }
118119 text = `~${percent}%`;
src/tui-overlay.ts+12−0
@@ -1,5 +1,6 @@
11 import { HStack, Text, TextInput, VStack } from "@cel-tui/core";
22 import {
3+ getModel,
34 getModels,
45 type KnownProvider,
56 type ThinkingLevel,
@@ -10,6 +11,7 @@ import { listSessionsForCwd } from "./session";
1011 import { TextPill, theme } from "./tui-components";
1112 import type { SelectOptions, SelectState, Session, TUIState } from "./types";
1213 import { estimateTokens } from "./shared";
14+import { saveSettings } from "./args";
1315
1416 export function SelectOverlay(
1517 value: string,
@@ -349,6 +351,11 @@ export function mainMenu(state: TUIState) {
349351
350352 state.options.provider = selectedProvider;
351353 state.options.model = model;
354+ saveSettings({
355+ provider: selectedProvider,
356+ model: model.id,
357+ effort: state.options.effort
358+ })
352359 closeMenu(s);
353360 return;
354361 }
@@ -358,6 +365,11 @@ export function mainMenu(state: TUIState) {
358365 if (!effort) return;
359366
360367 state.options.effort = effort;
368+ saveSettings({
369+ provider: state.options.provider,
370+ model: state.options.model.id,
371+ effort: effort
372+ })
361373 closeMenu(s);
362374 }
363375 },