SPB Git

spb/khaelor Public

KHAELOR — a terminal-native autonomous engineering agent powered by Anthropic.

TypeScript 82.9% HTML 14.9% CSS 1.1% JavaScript 0.7%
2.9 KB · 64 lines typescript
Raw Blame History
1/**2 * KHAELOR3 * File: src/tui/splash.ts4 * Description: The opening moment — wordmark with an ember gradient sweep, ~600 ms, skippable, first-run only (TUI v2 §2).5 *6 * Author: Simon-Pierre Boucher7 * Contact: contact@spboucher.ai8 */910import { gradientSweepFrame, gradientText } from "./theme/gradient.js";11import type { Rgb } from "./theme/gradient.js";12import type { Theme } from "./theme.js";1314/** The KHAELOR wordmark (block letters, no box-drawing dependence). */15export const WORDMARK: readonly string[] = [16  "██╗  ██╗██╗  ██╗ █████╗ ███████╗██╗      ██████╗ ██████╗",17  "██║ ██╔╝██║  ██║██╔══██╗██╔════╝██║     ██╔═══██╗██╔══██╗",18  "█████╔╝ ███████║███████║█████╗  ██║     ██║   ██║██████╔╝",19  "██╔═██╗ ██╔══██║██╔══██║██╔══╝  ██║     ██║   ██║██╔══██╗",20  "██║  ██╗██║  ██║██║  ██║███████╗███████╗╚██████╔╝██║  ██║",21  "╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═╝  ╚═╝",22];2324export const WORDMARK_TAGLINE = "understand · design · implement";2526const EMBER: Rgb = [255, 107, 53];27const EMBER_GLOW: Rgb = [255, 184, 107];2829/** Total sweep frames (~600 ms at one frame per 60 ms tick, TUI v2 §2). */30export const SPLASH_FRAMES = 10;3132/**33 * One frame of the reveal: the ember gradient sweeps left → right, then the34 * final frame settles on the static ember→glow ramp. Pure — the caller owns35 * timing (16 ms budget rule) and skip-on-any-key.36 */37export function renderSplashFrame(frame: number, truecolor: boolean): string[] {38  const lines: string[] = [""];39  for (const row of WORDMARK) {40    if (!truecolor) {41      lines.push(`  ${row}`);42    } else if (frame >= SPLASH_FRAMES - 1) {43      lines.push(`  ${gradientText(row, EMBER, EMBER_GLOW)}`);44    } else {45      const offset = Math.round((row.length / SPLASH_FRAMES) * (SPLASH_FRAMES - 1 - frame));46      lines.push(`  ${gradientSweepFrame(row, EMBER, EMBER_GLOW, offset)}`);47    }48  }49  lines.push(`        ${truecolor ? gradientText(WORDMARK_TAGLINE, EMBER_GLOW, EMBER) : WORDMARK_TAGLINE}`);50  lines.push("");51  return lines;52}5354/** The compact returning-user line: `KHAELOR ▸ my-project · main` (TUI v2 §2). */55export function renderCompactBrand(56  theme: Theme,57  project: string,58  branch: string | null,59): string {60  const mark = theme.paintGradient("ember", "KHAELOR");61  const context = branch !== null ? `${project} · ${branch}` : project;62  return ` ${mark} ${theme.paint("dim", "▸")} ${theme.paint("text", context)}`;63}64