/** * StatusBar component for TUI. * Displays: [ipuaro] [ctx: 12%] [project: myapp] [main] [47m] status */ import { Box, Text } from "ink" import type React from "react" import type { BranchInfo, TuiStatus } from "../types.js" export interface StatusBarProps { contextUsage: number projectName: string branch: BranchInfo sessionTime: string status: TuiStatus } function getStatusIndicator(status: TuiStatus): { text: string; color: string } { switch (status) { case "ready": { return { text: "ready", color: "green" } } case "thinking": { return { text: "thinking...", color: "yellow" } } case "tool_call": { return { text: "executing...", color: "cyan" } } case "awaiting_confirmation": { return { text: "confirm?", color: "magenta" } } case "error": { return { text: "error", color: "red" } } default: { return { text: "ready", color: "green" } } } } function formatContextUsage(usage: number): string { return `${String(Math.round(usage * 100))}%` } export function StatusBar({ contextUsage, projectName, branch, sessionTime, status, }: StatusBarProps): React.JSX.Element { const statusIndicator = getStatusIndicator(status) const branchDisplay = branch.isDetached ? `HEAD@${branch.name.slice(0, 7)}` : branch.name return ( [ipuaro] [ctx:{" "} 0.8 ? "red" : "white"}> {formatContextUsage(contextUsage)} ] [{projectName}] [{branchDisplay}] [{sessionTime}] {statusIndicator.text} ) }