UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

33 lines • 1.5 kB
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui"; import { formatDisplayVersion } from "../version-label.js"; import { getGrokChromeTokens } from "./chrome-tokens.js"; /** Mode-owned startup welcome card for grok chrome. */ export class GrokWelcomeCard { constructor(appName, version) { this.appName = appName; this.version = version; } invalidate() { // Render output is derived only from immutable constructor data and theme tokens. } render(width) { const tokens = getGrokChromeTokens(); if (width < 3) return [ tokens.primaryText(truncateToWidth(`${this.appName} ${formatDisplayVersion(this.version)}`, width, "")), ]; const contentWidth = width - 2; const line = (text) => { const truncated = truncateToWidth(text, contentWidth, ""); return `${truncated}${" ".repeat(Math.max(0, contentWidth - visibleWidth(truncated)))}`; }; const interior = (text) => `${tokens.cardBorder("│")}${tokens.inputInterior(line(text))}${tokens.cardBorder("│")}`; return [ tokens.cardBorder(`╭${"─".repeat(contentWidth)}╮`), interior(` ${tokens.primaryText(`${this.appName} ${formatDisplayVersion(this.version)}`)}`), interior(" Ready for your next task."), tokens.cardBorder(`╰${"─".repeat(contentWidth)}╯`), ]; } } //# sourceMappingURL=welcome-card.js.map