style(install): KeiSei brand colors + ASCII banner in installer output (#37)

KEISEI ASCII logo (голубой) at install start; [install] prefix тёмно-жёлтый
(38;5;178); primitive names + language codes голубой (38;5;39); language names
тёмно-жёлтый. lib-log COLOR now enables under curl|bash (detect terminal via
[ -t 1 ] || /dev/tty — web-install tees stdout so -t 1 was false → colors off).
Color detection, not an interactivity gate. Verified piped-under-pty.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
KeiSei84 2026-05-22 16:06:17 +08:00 committed by GitHub
parent ea03b48463
commit 83c21327f0
5 changed files with 34 additions and 11 deletions

View file

@ -203,6 +203,7 @@ if ! printf '%s\n' "$CONFIRM_INPUT" | show_confirm_screen "$CONFIRM_LABEL"; then
fi fi
# --- execute install phases ---------------------------------------------- # --- execute install phases ----------------------------------------------
kei_banner
setup_target_dirs setup_target_dirs
scaffold_memory_index scaffold_memory_index
install_blocks install_blocks

View file

@ -1,21 +1,43 @@
# shellcheck shell=bash # shellcheck shell=bash
# lib-log.sh — say / warn / err with optional ANSI color. # lib-log.sh — say / warn / err with optional ANSI color + KeiSei banner.
# Honors NO_COLOR (no-color.org) and TTY detection on fd 1. # Honors NO_COLOR (no-color.org). Color is ON when stdout is a TTY OR a
# controlling terminal is reachable via /dev/tty — the latter matters under
# `curl|bash`, where web-install.sh tees stdout (so `-t 1` is false even in an
# interactive session, but the terminal is still there via /dev/tty).
# This `-t 1`-with-/dev/tty test is COLOR detection, NOT an interactivity gate
# (see ~/.claude/rules/tty-interactivity-gate.md) — it pairs with no `-t 0`.
# Sourced by install.sh; no top-level execution. # Sourced by install.sh; no top-level execution.
# ANSI on iff stdout is a TTY and NO_COLOR is unset. if { [ -t 1 ] || { : < /dev/tty; } 2>/dev/null; } && [ "${NO_COLOR:-}" = "" ]; then
if [ -t 1 ] && [ "${NO_COLOR:-}" = "" ]; then
COLOR=1 COLOR=1
else else
COLOR=0 COLOR=0
fi fi
# Brand palette: тёмно-жёлтый (gold) for [install], голубой (sky-blue) for KeiSei.
if [ "$COLOR" = "1" ]; then if [ "$COLOR" = "1" ]; then
say() { printf '\033[1;36m[install]\033[0m %s\n' "$*"; } KEI_GOLD=$'\033[38;5;178m' # тёмно-жёлтый — install prefix
KEI_BLUE=$'\033[38;5;39m' # голубой — logo / primitives
KEI_DIM=$'\033[2m'
KEI_RST=$'\033[0m'
say() { printf '%s[install]%s %s\n' "$KEI_GOLD" "$KEI_RST" "$*"; }
warn() { printf '\033[1;33m[warn]\033[0m %s\n' "$*"; } warn() { printf '\033[1;33m[warn]\033[0m %s\n' "$*"; }
err() { printf '\033[1;31m[error]\033[0m %s\n' "$*" >&2; } err() { printf '\033[1;31m[error]\033[0m %s\n' "$*" >&2; }
else else
KEI_GOLD= KEI_BLUE= KEI_DIM= KEI_RST=
say() { printf '[install] %s\n' "$*"; } say() { printf '[install] %s\n' "$*"; }
warn() { printf '[warn] %s\n' "$*"; } warn() { printf '[warn] %s\n' "$*"; }
err() { printf '[error] %s\n' "$*" >&2; } err() { printf '[error] %s\n' "$*" >&2; }
fi fi
# KeiSei ASCII banner — голубой logo, shown once at install start.
kei_banner() {
printf '\n'
printf '%s ██╗ ██╗███████╗██╗███████╗███████╗██╗%s\n' "$KEI_BLUE" "$KEI_RST"
printf '%s ██║ ██╔╝██╔════╝██║██╔════╝██╔════╝██║%s\n' "$KEI_BLUE" "$KEI_RST"
printf '%s █████╔╝ █████╗ ██║███████╗█████╗ ██║%s\n' "$KEI_BLUE" "$KEI_RST"
printf '%s ██╔═██╗ ██╔══╝ ██║╚════██║██╔══╝ ██║%s\n' "$KEI_BLUE" "$KEI_RST"
printf '%s ██║ ██╗███████╗██║███████║███████╗██║%s\n' "$KEI_BLUE" "$KEI_RST"
printf '%s ╚═╝ ╚═╝╚══════╝╚═╝╚══════╝╚══════╝╚═╝%s\n' "$KEI_BLUE" "$KEI_RST"
printf '%s KeiSeiKit · installing%s\n\n' "$KEI_GOLD" "$KEI_RST"
}

View file

@ -57,7 +57,7 @@ onboarding_pick_language() {
while IFS=$'\t' read -r code name; do while IFS=$'\t' read -r code name; do
[ -z "$code" ] && continue [ -z "$code" ] && continue
codes+=("$code") codes+=("$code")
printf " %2d) %s — %s\n" "$i" "$code" "$name" >&2 printf " %2d) ${KEI_BLUE:-}%s${KEI_RST:-}${KEI_GOLD:-}%s${KEI_RST:-}\n" "$i" "$code" "$name" >&2
i=$((i+1)) i=$((i+1))
done <<< "$langs" done <<< "$langs"
ans="$(_onb_read_choice "${#codes[@]}" "[1-${#codes[@]}, default 1=en]: ")" ans="$(_onb_read_choice "${#codes[@]}" "[1-${#codes[@]}, default 1=en]: ")"

View file

@ -100,7 +100,7 @@ _print_primitive_rows() {
[ -z "$name" ] && continue [ -z "$name" ] && continue
kind="$(primitive_field "$name" kind 2>/dev/null || echo '?')" kind="$(primitive_field "$name" kind 2>/dev/null || echo '?')"
extra="$(primitive_time_secs "$name")s, $(( $(primitive_disk_kb "$name") / 1024 )) MB" extra="$(primitive_time_secs "$name")s, $(( $(primitive_disk_kb "$name") / 1024 )) MB"
printf ' + %-22s (%s, ~%s)\n' "$name" "$kind" "$extra" printf ' + %s%-22s%s (%s, ~%s)\n' "${KEI_BLUE:-}" "$name" "${KEI_RST:-}" "$kind" "$extra"
done done
} }

View file

@ -28,7 +28,7 @@ copy_shell_primitive() {
mkdir -p "$AGENTS_DIR/_primitives" mkdir -p "$AGENTS_DIR/_primitives"
cp -f "$src" "$dst" cp -f "$src" "$dst"
chmod +x "$dst" chmod +x "$dst"
say " + shell: $name ($file)" say " + shell: ${KEI_BLUE:-}$name${KEI_RST:-} ($file)"
} }
remove_shell_primitive() { remove_shell_primitive() {
@ -65,7 +65,7 @@ copy_rust_primitive() {
cp -rf "$src/$sibling/"* "$dst/$sibling/" 2>/dev/null || true cp -rf "$src/$sibling/"* "$dst/$sibling/" 2>/dev/null || true
fi fi
done done
say " + rust: $name (crate $crate)" say " + rust: ${KEI_BLUE:-}$name${KEI_RST:-} (crate $crate)"
} }
remove_rust_primitive() { remove_rust_primitive() {
@ -103,7 +103,7 @@ copy_node_primitive() {
find "$dst" -depth -name "$ex" -exec rm -rf {} + 2>/dev/null || true find "$dst" -depth -name "$ex" -exec rm -rf {} + 2>/dev/null || true
done < <(_node_excludes) done < <(_node_excludes)
fi fi
say " + node: $name (path $rel)" say " + node: ${KEI_BLUE:-}$name${KEI_RST:-} (path $rel)"
} }
remove_node_primitive() { remove_node_primitive() {
@ -171,7 +171,7 @@ install_external_primitive() {
err "external primitive $name: entry point $slug not found in $file" err "external primitive $name: entry point $slug not found in $file"
return 1 return 1
fi fi
say " + external: $name (via $file)" say " + external: ${KEI_BLUE:-}$name${KEI_RST:-} (via $file)"
"$slug" || warn "$name install failed — re-run after fixing prereqs" "$slug" || warn "$name install failed — re-run after fixing prereqs"
} }