feat: rebrand as Hermit — TUI palette, dual glyphs, binary 0.10.0
ci / tcc-check (push) Failing after 41s
ci / linux (aarch64, 0) (push) Skipped
ci / linux (x86, 1) (push) Skipped
ci / linux (x86_64, 1) (push) Skipped
ci / windows (push) Skipped

Ship hermit binary (cst-agent symlink), ~/.config/hermit with legacy fallback,
Hermit color theme and mini crab frames, plus SVG→PUA font build pipeline.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WHC
2026-10-29 21:42:45 +08:00
co-authored by Cursor
parent 2602806aea
commit f30b4ede48
32 changed files with 793 additions and 265 deletions
+146 -56
View File
@@ -24,6 +24,7 @@
#include "cst_tools.h"
#include "cst_util.h"
#include "cst_version.h"
#include "cst_hermit_glyph.h"
#include "os_compat.h"
#include "sashidown.h"
@@ -496,18 +497,18 @@ static char *xstrndup(const char *s, size_t n) {
/* --- theme ---------------------------------------------------------------- */
/* Dark panel chrome — cool steel accents (not peach OpenCode clone). */
/* Hermit palette: brand teal, crab orange, eye purple (design mock). */
static void theme_init(void) {
const char *nc = getenv("NO_COLOR");
g_nocolor = nc && nc[0];
const char *asc = getenv("CST_ASCII");
const char *asc = hermit_getenv("ASCII");
#if defined(__ANDROID__)
g_utf8 = 1; /* bionic is UTF-8 only; nl_langinfo needs API 26 */
#elif !defined(_WIN32)
const char *cs = nl_langinfo(CODESET);
g_utf8 = cs && (strcasecmp(cs, "UTF-8") == 0 || strcasecmp(cs, "utf8") == 0);
#endif
g_ascii = asc && asc[0] ? asc[0] != '0' : !g_utf8;
g_ascii = asc[0] ? asc[0] != '0' : !g_utf8;
if (!HAS_COLOR())
return;
start_color();
@@ -515,54 +516,62 @@ static void theme_init(void) {
short primary = COLOR_CYAN;
short panel = COLOR_BLACK;
short muted = COLOR_CYAN;
short muted = COLOR_WHITE;
short success = COLOR_GREEN;
short err = COLOR_RED;
short assist = COLOR_CYAN;
short assist = COLOR_MAGENTA;
short text = COLOR_WHITE;
short box = COLOR_BLACK, side = COLOR_BLACK;
short accent = COLOR_BLUE, bright = COLOR_WHITE, logo_dim = COLOR_CYAN;
short accent = COLOR_CYAN, bright = COLOR_WHITE, logo_dim = COLOR_CYAN;
short tool = COLOR_YELLOW;
short prompt_c = COLOR_CYAN;
if (COLORS >= 256) {
box = 235;
side = 234;
accent = 75; /* #5c9cf5 steel blue */
accent = 75; /* #277F94 brand teal */
bright = 255;
logo_dim = 242;
primary = 75; /* brand/user accent: blue, not peach */
panel = 233; /* #121212 */
primary = 75;
panel = 233;
muted = 244;
success = 114;
err = 167;
assist = 74; /* soft cyan assistant */
text = 252; /* brighter body for readability */
assist = 177; /* #9957AD eye purple */
tool = 216; /* #F68042 crab orange */
prompt_c = 152; /* #A9D9D7 prompt cyan */
text = 252;
if (can_change_color()) {
init_color(75, 430, 660, 996); /* #6ea8fe brand */
init_color(233, 55, 58, 70); /* #0e0f12 deeper panel */
init_color(244, 502, 520, 560); /* cool muted */
init_color(252, 820, 830, 850); /* body */
init_color(75, 153, 498, 580); /* #277F94 brand */
init_color(152, 663, 851, 843); /* #A9D9D7 prompt */
init_color(216, 965, 502, 259); /* #F68042 crab */
init_color(177, 600, 341, 678); /* #9957AD eye */
init_color(167, 850, 320, 320); /* error red */
init_color(168, 643, 341, 310); /* #A4574F brick legs */
init_color(233, 55, 58, 70); /* #0e0f12 panel */
init_color(244, 502, 520, 560); /* muted */
init_color(252, 820, 830, 850); /* body text */
init_color(114, 400, 750, 450);
init_color(167, 850, 320, 320);
init_color(74, 380, 720, 780);
init_color(235, 100, 105, 120); /* raised box */
init_color(234, 78, 82, 96); /* sidebar */
init_color(216, 980, 720, 420); /* warm tip only */
init_color(235, 100, 105, 120);
init_color(234, 78, 82, 96);
}
} else if (can_change_color() && COLORS >= 8) {
init_color(COLOR_BLACK, 55, 58, 70);
init_color(COLOR_CYAN, 430, 660, 996);
init_color(COLOR_CYAN, 153, 498, 580);
init_color(COLOR_WHITE, 820, 830, 850);
init_color(COLOR_GREEN, 400, 750, 450);
init_color(COLOR_RED, 850, 320, 320);
init_color(COLOR_BLUE, 380, 720, 780);
init_color(COLOR_YELLOW, 980, 720, 420);
init_color(COLOR_MAGENTA, 600, 341, 678);
init_color(COLOR_YELLOW, 965, 502, 259);
panel = COLOR_BLACK;
primary = COLOR_CYAN;
muted = COLOR_WHITE;
text = COLOR_WHITE;
success = COLOR_GREEN;
err = COLOR_RED;
assist = COLOR_BLUE;
assist = COLOR_MAGENTA;
tool = COLOR_YELLOW;
prompt_c = COLOR_CYAN;
}
/* Header is dark too — primary only as text accent (not a bright bar). */
@@ -574,11 +583,11 @@ static void theme_init(void) {
init_pair(CP_MUTED, muted, panel);
init_pair(CP_SUCCESS, success, panel);
init_pair(CP_ERROR, err, panel);
init_pair(CP_TOOL, primary, panel);
init_pair(CP_TOOL, tool, panel);
init_pair(CP_PANEL, text, panel);
init_pair(CP_SGR_GREEN, success, panel);
init_pair(CP_SGR_YELLOW, primary, panel);
init_pair(CP_SGR_CYAN, assist, panel);
init_pair(CP_SGR_YELLOW, tool, panel);
init_pair(CP_SGR_CYAN, prompt_c, panel);
if (COLORS >= 256)
init_pair(CP_SGR_MAGENTA, 176, panel);
else
@@ -2687,20 +2696,87 @@ static void draw_todo(tui_t *t) {
/* --- start screen ---------------------------------------------------------- */
/* 3-row block font for "cstagent"; each glyph is 4 columns wide. */
static const char *const LOGO[8][3] = {
{"█▀▀▀", "█ ", "▀▀▀▀"}, /* c */
{"█▀▀▀", "▀▀▀█", "▀▀▀▀"}, /* s */
{"▀█▀▀", " █ ", " ▀▀▀"}, /* t */
{"█▀▀█", "█▀▀█", "▀ ▀"}, /* a */
{"█▀▀▀", "█ ▀█", "▀▀▀▀"}, /* g */
{"█▀▀▀", "█▀▀ ", "▀▀▀▀"}, /* e */
{"█▀▀▄", "█ █", "▀ ▀"}, /* n */
{"▀█▀▀", " █ ", " ▀▀▀"}, /* t */
/* 3-row block font for "HERMIT"; each glyph is 4 columns wide. */
static const char *const LOGO[6][3] = {
{"█ █", "█▀▀█", "█ █"}, /* H */
{"█▀▀▀", "█▀▀ ", "▀▀▀▀"}, /* E */
{"█▀▀█", "█▀▀█", "▀ ▀"}, /* R */
{"█▀▄█", "█ █", "▀ ▀"}, /* M */
{"▀█▀▀", " █ ", " ▀▀▀"}, /* I */
{"▀█▀▀", " █ ", " ▀▀▀"}, /* T */
};
#define LOGO_W (8 * 5 - 1)
#define LOGO_N 6
#define LOGO_W (LOGO_N * 5 - 1)
#define LOGO_H 3
static int hermit_role_pair(int role) {
switch (role) {
case 0:
return CP_TOOL; /* body */
case 1:
return CP_ACCENT; /* shell */
case 2:
return CP_ASSIST; /* eye */
case 3:
return COLORS >= 256 ? CP_MUTED : CP_ERROR; /* brick legs */
case 4:
return CP_SGR_CYAN; /* >_ */
default:
return CP_MUTED;
}
}
static void draw_hermit_icon(WINDOW *win, int y0, int x0, hermit_state_t st,
int with_shell, int frame) {
hermit_icon_mode_t mode = hermit_icon_mode_eff(g_ascii);
if (mode == HERMIT_ICON_FONT) {
wchar_t wc = hermit_font_codepoint(st, frame, with_shell);
cchar_t cc;
wchar_t wstr[2] = {wc, 0};
if (setcchar(&cc, wstr, 0, 0, NULL) == OK) {
if (HAS_COLOR())
wattron(win, COLOR_PAIR(CP_TOOL));
mvwadd_wch(win, y0, x0, &cc);
if (HAS_COLOR())
wattroff(win, COLOR_PAIR(CP_TOOL));
return;
}
}
const char *lines[8];
int n = hermit_shell_art(st, with_shell, g_ascii, lines, 8);
for (int r = 0; r < n; r++) {
const char *row = lines[r];
for (int c = 0; row[c]; c++) {
if (row[c] == ' ')
continue;
char ch[2] = {row[c], 0};
int pair = hermit_role_pair(hermit_shell_cell_role(st, with_shell, r, c));
draw_ansi_at(win, y0 + r, x0 + c, 1, ch, pair, 0, 0);
}
}
}
static void draw_hermit_badge(WINDOW *win, int y, int x, const tui_t *t) {
hermit_state_t st = hermit_state_from_ui(
t->busy, t->ask_pending || t->awaiting_perm, 0);
hermit_icon_mode_t mode = hermit_icon_mode_eff(g_ascii);
if (mode == HERMIT_ICON_FONT) {
wchar_t wc = hermit_font_codepoint(st, t->spin, 0);
cchar_t cc;
wchar_t wstr[2] = {wc, 0};
if (setcchar(&cc, wstr, 0, 0, NULL) == OK) {
if (HAS_COLOR())
wattron(win, COLOR_PAIR(CP_TOOL));
mvwadd_wch(win, y, x, &cc);
if (HAS_COLOR())
wattroff(win, COLOR_PAIR(CP_TOOL));
return;
}
}
const char *b = hermit_mini_badge(st, t->spin, g_ascii);
draw_ansi_at(win, y, x, (int)strlen(b), b, CP_TOOL, 0, 0);
}
static const char *const TIPS[] = {
"Tab switches between Build and Plan (read-only) mode",
"Shift+Tab cycles approval: ask, auto, yolo",
@@ -2720,40 +2796,51 @@ static void draw_home(tui_t *t) {
getmaxyx(t->logw, h, w);
int box_top = t->in_y - t->log_y;
int box_bot = box_top + t->in_h;
/* Tight home stack: wordmark (default) or CST_LOGO=block, tagline, chip. */
int brand_y = box_top - 2;
if (brand_y < 0)
brand_y = 0;
int want_block = 0;
{
const char *lb = getenv("CST_LOGO");
want_block = lb && !strcmp(lb, "block");
const char *lb = hermit_getenv("LOGO");
want_block = lb[0] && !strcmp(lb, "block");
}
/* Crab on the right of the brand stack when there is room. */
int crab_w = 14, crab_h = 6;
int crab_x = w - crab_w - 2;
int show_crab = crab_x > LOGO_W + 4 && box_top >= crab_h + 1;
if (want_block && !(g_ascii || !g_utf8 || g_logo_text) &&
box_top - LOGO_H - 2 >= 0 && w >= LOGO_W) {
int x0 = (w - LOGO_W) / 2, y0 = box_top - LOGO_H - 2;
for (int g = 0; g < 8; g++)
int x0 = show_crab ? (crab_x - LOGO_W) / 2 : (w - LOGO_W) / 2;
if (x0 < 0)
x0 = 0;
int y0 = box_top - LOGO_H - 2;
for (int g = 0; g < LOGO_N; g++)
for (int r = 0; r < LOGO_H; r++)
draw_ansi_at(t->logw, y0 + r, x0 + g * 5, 4, LOGO[g][r],
g < 3 ? CP_ACCENT : CP_BRIGHT, 0, 0);
draw_ansi_at(t->logw, y0 + r, x0 + g * 5, 4, LOGO[g][r], CP_ACCENT, 0,
0);
brand_y = y0 + LOGO_H;
} else {
const char *mark = "CST-agent";
const char *mark = "HERMIT";
int mw = (int)strlen(mark);
int x = (w - mw) / 2;
int x = show_crab ? (crab_x - mw) / 2 : (w - mw) / 2;
if (x < 0)
x = 0;
if (brand_y >= 1)
brand_y -= 1;
draw_ansi_at(t->logw, brand_y, x, 3, "CST", CP_ACCENT, 1, 0);
draw_ansi_at(t->logw, brand_y, x + 3, mw - 3, "-agent", CP_BRIGHT, 1, 0);
draw_ansi_at(t->logw, brand_y, x, mw, mark, CP_ACCENT, 1, 0);
}
if (show_crab) {
int cy = box_top - crab_h;
if (cy < 0)
cy = 0;
draw_hermit_icon(t->logw, cy, crab_x, HERMIT_ST_IDLE, 1, t->spin);
}
int ty = brand_y + 1;
if (ty < box_top) {
const char *tag =
g_ascii ? "code . plan . parliament" : "code · plan · parliament";
int tw = (int)strlen(tag);
int x = (w - tw) / 2;
int x = show_crab ? (crab_x - tw) / 2 : (w - tw) / 2;
if (x < 0)
x = 0;
draw_ansi_at(t->logw, ty, x, tw, tag, CP_MUTED, 0, 0);
@@ -2772,9 +2859,10 @@ static void draw_home(tui_t *t) {
}
int right = t->in_x - t->log_x + t->in_w;
if (box_bot < h) {
char hint[96];
char hint[128];
snprintf(hint, sizeof(hint),
"\033[97mtab\033[39m modes \033[97mctrl+p\033[39m commands");
"\033[97mtab\033[39m modes \033[97mctrl+p\033[39m commands "
"\033[97mshift+tab\033[39m approval");
int hw = vis_cols(hint);
if (right - hw >= 0)
draw_ansi_at(t->logw, box_bot, right - hw, hw, hint, CP_MUTED, 0, 0);
@@ -2785,7 +2873,7 @@ static void draw_home(tui_t *t) {
int tw = vis_cols(tip);
if (tw > w - 4)
tw = w - 4;
draw_ansi_at(t->logw, box_bot + 2, (w - tw) / 2, tw, tip, CP_MUTED, 0, 0);
draw_ansi_at(t->logw, box_bot + 2, (w - tw) / 2, tw, tip, CP_TOOL, 0, 0);
}
const char *ext = cst_extensions_report();
if (ext[0] && box_bot + 3 < h) {
@@ -3018,7 +3106,7 @@ static void draw_side(tui_t *t) {
if (h >= 4) {
draw_ansi_at(s, h - 3, x, mw, t->where, CP_SIDE_MUTED, 0, 0);
snprintf(line, sizeof(line), "CST %s", CST_VERSION);
snprintf(line, sizeof(line), "Hermit %s", CST_VERSION);
draw_ansi_at(s, h - 2, x, mw, line, CP_SIDE_MUTED, 0, 0);
}
wrefresh(s);
@@ -3183,9 +3271,11 @@ static void draw_topbar(tui_t *t) {
if (hexish)
title = "New session";
}
/* CST mark + title + model. Role lives only in the Seat Deck. */
/* Hermit badge + title + model. Role lives only in the Seat Deck. */
int x = 1;
x += draw_ansi_at(w, 0, x, 3, "CST", CP_TOPBAR_ACCENT, 1, 0);
draw_hermit_badge(w, 0, x, t);
x += 4;
x += draw_ansi_at(w, 0, x, 6, "Hermit", CP_TOPBAR_ACCENT, 1, 0);
x += draw_ansi_at(w, 0, x, 1, " ", CP_TOPBAR_MUTED, 0, 0);
int model_room = 0;
char mid[160] = "";