xonecas.io
79113
Ma

mini-coding-agent / commit 35fe0f4

fix(naming): styles actually named from their color

xonecas2026-10-10 35fe0f4778e1f470095022d4b8118936102ed28c parent 35198b8

8 files changed

src/tui/commands.zig+1−1
@@ -53,5 +53,5 @@ pub fn helpRow(a: std.mem.Allocator, key: []const u8, description: []const u8, w
5353 padded.appendSlice(a, key) catch {};
5454 var i = key.len;
5555 while (i < width) : (i += 1) padded.append(a, ' ') catch {};
56- return std.fmt.allocPrint(a, " {s} {s}", .{ styles.dim(a, padded.items), description }) catch key;
56+ return std.fmt.allocPrint(a, " {s} {s}", .{ styles.comment(a, padded.items), description }) catch key;
5757 }
src/tui/render.zig+1−1
@@ -259,7 +259,7 @@ pub fn bodyRows(a: std.mem.Allocator, lines: []const BodyLine, width: usize) []c
259259 for (rows[tail_at..]) |r| n -= physicalRows(r, width);
260260 break :blk n;
261261 };
262- out.append(a, styles.dim(a, std.fmt.allocPrint(a, "... {d} lines not shown ...", .{hidden_rows}) catch "")) catch {};
262+ out.append(a, styles.comment(a, std.fmt.allocPrint(a, "... {d} lines not shown ...", .{hidden_rows}) catch "")) catch {};
263263 for (rows[tail_at..]) |r| out.append(a, r) catch {};
264264 return out.items;
265265 }
src/tui/styles.zig+9−9
@@ -1,7 +1,7 @@
11 const std = @import("std");
22 const theme = @import("theme.zig");
33
4-fn fg(a: std.mem.Allocator, hex: []const u8, text: []const u8) []const u8 {
4+fn colored(a: std.mem.Allocator, hex: []const u8, text: []const u8) []const u8 {
55 return std.fmt.allocPrint(a, "{s}{s}{s}", .{
66 theme.sgrFg(a, hex),
77 text,
@@ -13,15 +13,15 @@ pub fn styledWith(a: std.mem.Allocator, style: theme.Style, text: []const u8) []
1313 return std.fmt.allocPrint(a, "{s}{s}{s}", .{ theme.sgr(a, style), text, theme.SGR_PLAIN }) catch text;
1414 }
1515
16-pub fn dim(a: std.mem.Allocator, text: []const u8) []const u8 {
17- return fg(a, theme.current.comment, text);
16+pub fn comment(a: std.mem.Allocator, text: []const u8) []const u8 {
17+ return colored(a, theme.current.comment, text);
1818 }
19-pub fn red(a: std.mem.Allocator, text: []const u8) []const u8 {
20- return fg(a, theme.current.error_, text);
19+pub fn err(a: std.mem.Allocator, text: []const u8) []const u8 {
20+ return colored(a, theme.current.err, text);
2121 }
22-pub fn yellow(a: std.mem.Allocator, text: []const u8) []const u8 {
23- return fg(a, theme.current.warn, text);
22+pub fn warn(a: std.mem.Allocator, text: []const u8) []const u8 {
23+ return colored(a, theme.current.warn, text);
2424 }
25-pub fn teal(a: std.mem.Allocator, text: []const u8) []const u8 {
26- return fg(a, theme.current.accent, text);
25+pub fn accent(a: std.mem.Allocator, text: []const u8) []const u8 {
26+ return colored(a, theme.current.accent, text);
2727 }
src/tui/theme.zig+4−8
@@ -16,8 +16,7 @@ pub const Theme = struct {
1616 comment: []const u8,
1717 prompt: []const u8,
1818 accent: []const u8,
19- add: []const u8,
20- error_: []const u8,
19+ err: []const u8,
2120 warn: []const u8,
2221 diff_add: []const u8,
2322 diff_delete: []const u8,
@@ -32,8 +31,7 @@ const TOKYONIGHT = Theme{
3231 .comment = "#565f89",
3332 .prompt = "#7aa2f7",
3433 .accent = "#1abc9c",
35- .add = "#9ece6a",
36- .error_ = "#f7768e",
34+ .err = "#f7768e",
3735 .warn = "#e0af68",
3836 .diff_add = "#243e4a",
3937 .diff_delete = "#4a272f",
@@ -93,8 +91,7 @@ const OXOCARBON = Theme{
9391 .comment = "#525252",
9492 .prompt = "#78a9ff",
9593 .accent = "#3ddbd9",
96- .add = "#08bdba",
97- .error_ = "#ee5396",
94+ .err = "#ee5396",
9895 .warn = "#be95ff",
9996 .diff_add = "#122f2f",
10097 .diff_delete = "#361c28",
@@ -146,8 +143,7 @@ const KANAGAWA = Theme{
146143 .comment = "#737c73",
147144 .prompt = "#8ba4b0",
148145 .accent = "#8ea4a2",
149- .add = "#76946a",
150- .error_ = "#e82424",
146+ .err = "#e82424",
151147 .warn = "#ff9e3b",
152148 .diff_add = "#2b3328",
153149 .diff_delete = "#43242b",
src/tui/tool_view.zig+3−3
@@ -9,7 +9,7 @@ const BodyLine = render.BodyLine;
99 pub const PendingCall = struct { name: []const u8, summary: []const u8 };
1010
1111 fn callHead(a: std.mem.Allocator, name: []const u8) []const u8 {
12- return styles.teal(a, std.fmt.allocPrint(a, "-> {s}", .{name}) catch "->");
12+ return styles.accent(a, std.fmt.allocPrint(a, "-> {s}", .{name}) catch "->");
1313 }
1414
1515 pub fn diffHead(a: std.mem.Allocator, name: []const u8, path: []const u8) []const u8 {
@@ -53,7 +53,7 @@ pub fn callBody(a: std.mem.Allocator, name: []const u8, summary: []const u8, met
5353 std.fmt.allocPrint(a, "{s} {s}{s}", .{
5454 head,
5555 line,
56- if (meta) |m| styles.dim(a, std.fmt.allocPrint(a, " [{s}]", .{m}) catch "") else "",
56+ if (meta) |m| styles.comment(a, std.fmt.allocPrint(a, " [{s}]", .{m}) catch "") else "",
5757 }) catch line
5858 else
5959 line;
@@ -94,5 +94,5 @@ pub fn exitLine(a: std.mem.Allocator, text: []const u8, is_error: bool) ?[]const
9494 const last = if (std.mem.lastIndexOfScalar(u8, trimmed, '\n')) |i| trimmed[i + 1 ..] else trimmed;
9595 if (!std.mem.startsWith(u8, last, "exit code: ")) return null;
9696 const label = std.fmt.allocPrint(a, " └ exit {s}", .{last["exit code: ".len..]}) catch return null;
97- return if (is_error) styles.red(a, label) else styles.dim(a, label);
97+ return if (is_error) styles.err(a, label) else styles.comment(a, label);
9898 }
src/tui/tui.zig+24−23
@@ -191,7 +191,7 @@ const Tui = struct {
191191 }
192192
193193 fn fail(self: *Tui, comptime fmt: []const u8, args: anytype) void {
194- self.note(styles.red(self.s, std.fmt.allocPrint(self.s, fmt, args) catch "! error"));
194+ self.note(styles.err(self.s, std.fmt.allocPrint(self.s, fmt, args) catch "! error"));
195195 }
196196
197197 fn commitUser(self: *Tui, text: []const u8) void {
@@ -202,13 +202,14 @@ const Tui = struct {
202202 fn pushBanner(self: *Tui) void {
203203 self.scrollback.separator = true;
204204 const model = self.opts.model;
205+ const brand = styles.accent(self.s, "mini-coding-agent");
205206 self.push(if (model) |m|
206207 if (m.effort.len == 0)
207- std.fmt.allocPrint(self.s, "mini · {s}/{s}", .{ m.provider, m.id }) catch "mini"
208+ std.fmt.allocPrint(self.s, "{s} · {s}/{s}", .{ brand, m.provider, m.id }) catch brand
208209 else
209- std.fmt.allocPrint(self.s, "mini · {s}/{s} · {s}", .{ m.provider, m.id, m.effort }) catch "mini"
210+ std.fmt.allocPrint(self.s, "{s} · {s}/{s} · {s}", .{ brand, m.provider, m.id, m.effort }) catch brand
210211 else
211- "mini · no model configured");
212+ std.fmt.allocPrint(self.s, "{s} · no model configured", .{brand}) catch brand);
212213 const loaded = self.opts.loaded;
213214 self.push(std.fmt.allocPrint(self.s, "{d} agent files · {d} skills", .{
214215 loaded.agent_files, loaded.skills,
@@ -217,7 +218,7 @@ const Tui = struct {
217218 }
218219
219220 fn statusLine(self: *Tui) []const u8 {
220- const model = self.opts.model orelse return styles.dim(self.s, "no model configured");
221+ const model = self.opts.model orelse return styles.comment(self.s, "no model configured");
221222 self.messages_mutex.lockUncancelable(platform.io);
222223 const used = usage_mod.estimateContextTokens(self.messages.items, self.opts.system_prompt, self.opts.tools_json);
223224 const cache = usage_mod.lastUsage(self.messages.items);
@@ -227,17 +228,17 @@ const Tui = struct {
227228 usage_mod.cacheLine(self.s, cache),
228229 }) catch "ctx";
229230 if (self.paused or self.phase == .pausing) {
230- return std.fmt.allocPrint(self.s, "{s} · {s}", .{ styles.dim(self.s, "paused - type steering, Enter to submit"), info }) catch info;
231+ return std.fmt.allocPrint(self.s, "{s} · {s}", .{ styles.comment(self.s, "paused - type steering, Enter to submit"), info }) catch info;
231232 }
232233 if (self.active and self.pause_requested.load(.seq_cst)) {
233- return std.fmt.allocPrint(self.s, "{s} · {s}", .{ styles.dim(self.s, "pausing - waiting for the step boundary"), info }) catch info;
234+ return std.fmt.allocPrint(self.s, "{s} · {s}", .{ styles.comment(self.s, "pausing - waiting for the step boundary"), info }) catch info;
234235 }
235236 if (!self.active or self.phase == .idle) return info;
236237 const elapsed = @max(0, @divFloor(time.nowMs() - self.turn_start, 1000));
237238 return std.fmt.allocPrint(self.s, "{s} {s} · {s} · {s}", .{
238- styles.teal(self.s, spinnerChar(self.frame)),
239+ styles.accent(self.s, spinnerChar(self.frame)),
239240 self.stateLabel(),
240- styles.dim(self.s, std.fmt.allocPrint(self.s, "{d}s", .{elapsed}) catch ""),
241+ styles.comment(self.s, std.fmt.allocPrint(self.s, "{d}s", .{elapsed}) catch ""),
241242 info,
242243 }) catch info;
243244 }
@@ -279,14 +280,14 @@ const Tui = struct {
279280 else => {},
280281 }
281282 var out: std.ArrayList(u8) = .empty;
282- out.appendSlice(a, if (color) |c| styles.styledWith(a, .{ .fg = c }, text) else styles.dim(a, text)) catch {};
283+ out.appendSlice(a, if (color) |c| styles.styledWith(a, .{ .fg = c }, text) else styles.comment(a, text)) catch {};
283284 if (bytes > 0) {
284285 const n = usage_mod.formatTokens(a, (bytes + 3) / 4);
285- out.appendSlice(a, styles.dim(a, std.fmt.allocPrint(a, " · ~{s} tok", .{n}) catch "")) catch {};
286+ out.appendSlice(a, styles.comment(a, std.fmt.allocPrint(a, " · ~{s} tok", .{n}) catch "")) catch {};
286287 }
287288 const queued = self.pending_calls.items.len -| @intFromBool(self.phase == .running_tool);
288289 if (queued > 0) {
289- out.appendSlice(a, styles.dim(a, std.fmt.allocPrint(a, " · {d} queued", .{queued}) catch "")) catch {};
290+ out.appendSlice(a, styles.comment(a, std.fmt.allocPrint(a, " · {d} queued", .{queued}) catch "")) catch {};
290291 }
291292 return out.items;
292293 }
@@ -332,11 +333,11 @@ const Tui = struct {
332333 for (render.wrapLine(self.s, part, width)) |row| {
333334 if (used >= budget_rows) break;
334335 used += 1;
335- lines.append(self.s, styles.dim(self.s, row)) catch {};
336+ lines.append(self.s, styles.comment(self.s, row)) catch {};
336337 }
337338 }
338339 } else {
339- lines.append(self.s, styles.dim(self.s, "no matches")) catch {};
340+ lines.append(self.s, styles.comment(self.s, "no matches")) catch {};
340341 }
341342 } else {
342343 for (ed.rows) |r| lines.append(self.s, r) catch {};
@@ -417,19 +418,19 @@ const Tui = struct {
417418 .tool_result => |tr| self.commitToolResult(tr.name, tr.text, tr.is_error, tr.diffs, tr.body),
418419 .err => |m| {
419420 self.reportStatus("error", null, m);
420- self.endTurn(styles.red(self.s, std.fmt.allocPrint(self.s, "! {s}", .{m}) catch "! error"));
421+ self.endTurn(styles.err(self.s, std.fmt.allocPrint(self.s, "! {s}", .{m}) catch "! error"));
421422 },
422423 .no_model => {
423424 self.reportStatus("error", null, "no model configured");
424- self.endTurn(styles.red(self.s, "! no model configured"));
425+ self.endTurn(styles.err(self.s, "! no model configured"));
425426 },
426427 .cancelled => {
427428 self.reportStatus("idle", null, null);
428- self.endTurn(styles.red(self.s, "! cancelled"));
429+ self.endTurn(styles.err(self.s, "! cancelled"));
429430 },
430431 .complete => {
431432 self.reportStatus("done", null, null);
432- self.endTurn(styles.dim(self.s, std.fmt.allocPrint(self.s, "[complete · {d}s]", .{@max(0, @divFloor(time.nowMs() - self.turn_start, 1000))}) catch "[complete]"));
433+ self.endTurn(styles.comment(self.s, std.fmt.allocPrint(self.s, "[complete · {d}s]", .{@max(0, @divFloor(time.nowMs() - self.turn_start, 1000))}) catch "[complete]"));
433434 },
434435 }
435436 self.dirty = true;
@@ -478,7 +479,7 @@ const Tui = struct {
478479 const rows = if (std.mem.eql(u8, name, "edit")) render.plainRows(self.s, lines) else render.bodyRows(self.s, lines, width);
479480 const mark_error = is_error and bash_exit == null;
480481 for (rows, 0..) |row, i| {
481- const prefix = if (mark_error and i == rows.len - 1) styles.red(self.s, ERROR_PREFIX) else styles.dim(self.s, BODY_PREFIX);
482+ const prefix = if (mark_error and i == rows.len - 1) styles.err(self.s, ERROR_PREFIX) else styles.comment(self.s, BODY_PREFIX);
482483 self.push(std.fmt.allocPrint(self.s, "{s}{s}", .{ prefix, row }) catch row);
483484 }
484485 if (bash_exit) |status_line| self.push(status_line);
@@ -486,7 +487,7 @@ const Tui = struct {
486487 for (diffs) |d| {
487488 self.push(tool_view.diffHead(self.s, name, d.path));
488489 for (render.plainRows(self.s, diff_view.diffBody(self.s, d))) |row| {
489- self.push(std.fmt.allocPrint(self.s, "{s}{s}", .{ styles.dim(self.s, BODY_PREFIX), row }) catch row);
490+ self.push(std.fmt.allocPrint(self.s, "{s}{s}", .{ styles.comment(self.s, BODY_PREFIX), row }) catch row);
490491 }
491492 }
492493 self.scrollback.separator = true;
@@ -569,7 +570,7 @@ const Tui = struct {
569570 if (!self.aborting) {
570571 self.aborting = true;
571572 self.reportStatus("idle", null, null);
572- self.endTurn(styles.red(self.s, "! cancelled"));
573+ self.endTurn(styles.err(self.s, "! cancelled"));
573574 }
574575 self.dirty = true;
575576 } else if (self.command_active) {
@@ -669,7 +670,7 @@ const Tui = struct {
669670 self.newSession();
670671 self.push("");
671672 self.pushBanner();
672- self.note(styles.dim(self.s, "new session"));
673+ self.note(styles.comment(self.s, "new session"));
673674 },
674675 .provider => self.startProviderSelect(),
675676 .model => {
@@ -752,7 +753,7 @@ const Tui = struct {
752753 };
753754 self.command_active = true;
754755 self.prompt_open = false;
755- self.note(styles.dim(self.s, "querying models..."));
756+ self.note(styles.comment(self.s, "querying models..."));
756757 self.dirty = true;
757758 }
758759
src/tui/usage.zig+3−3
@@ -60,9 +60,9 @@ pub fn contextUsageLine(a: std.mem.Allocator, used: u64, model: *const models.Mo
6060 const cw = @max(model.context_window, 1);
6161 const percent = @as(f64, @floatFromInt(used)) / @as(f64, @floatFromInt(cw)) * 100.0;
6262 const sizes = std.fmt.allocPrint(a, "{s}/{s}", .{ formatTokens(a, used), formatTokens(a, cw) }) catch "";
63- if (used + model.max_tokens > cw) return styles.red(a, std.fmt.allocPrint(a, "ctx full · {s}", .{sizes}) catch "ctx full");
63+ if (used + model.max_tokens > cw) return styles.err(a, std.fmt.allocPrint(a, "ctx full · {s}", .{sizes}) catch "ctx full");
6464 const text = std.fmt.allocPrint(a, "ctx {s} · {d}%", .{ sizes, @as(u64, @intFromFloat(percent + 0.5)) }) catch "ctx";
65- return if (percent >= 85) styles.yellow(a, text) else styles.dim(a, text);
65+ return if (percent >= 85) styles.warn(a, text) else styles.comment(a, text);
6666 }
6767
6868 pub fn lastUsage(messages: []const message_mod.Message) message_mod.Usage {
@@ -83,5 +83,5 @@ pub fn cacheLine(a: std.mem.Allocator, usage: message_mod.Usage) []const u8 {
8383 0
8484 else
8585 @intFromFloat(@as(f64, @floatFromInt(usage.cache_read)) / @as(f64, @floatFromInt(prompt)) * 100.0 + 0.5);
86- return styles.dim(a, std.fmt.allocPrint(a, "cache {d}%", .{pct}) catch "cache");
86+ return styles.comment(a, std.fmt.allocPrint(a, "cache {d}%", .{pct}) catch "cache");
8787 }
tools/stress.sh+2−2
@@ -102,10 +102,10 @@ fi
102102
103103 # The banner lands in scrollback, not the live region, so wait on all of it.
104104 for _ in $(seq 300); do
105- pane all | grep -q 'mini ·' && break
105+ pane all | grep -q 'mini-coding-agent' && break
106106 sleep 0.1
107107 done
108-if ! pane all | grep -q 'mini ·'; then
108+if ! pane all | grep -q 'mini-coding-agent'; then
109109 echo "stress: mini did not start; pane says:" >&2
110110 pane all >&2
111111 exit 1