UNPKG

@morodomi/ait3

Version:

AIT³ Development Platform - AI + Ticket + Test + Tool driven development methodology

47 lines (46 loc) 1.33 kB
import { STYLES } from './styles.js'; /** * Utility functions for formatting table output in CLI commands */ export function padString(str, length) { return str.padEnd(length); } export function truncateString(str, maxLength) { return str.length > maxLength ? str.substring(0, maxLength - 3) + '...' : str; } export function getStatusColor(status) { switch (status) { case 'todo': return STYLES.info; case 'doing': return STYLES.warning; case 'done': return STYLES.success; default: return (text) => text; // No styling } } export function getPriorityColor(priority) { switch (priority) { case 'critical': return (text) => STYLES.bold(STYLES.danger(text)); case 'high': return STYLES.danger; case 'medium': return STYLES.warning; case 'low': return STYLES.muted; default: return (text) => text; // No styling } } export function createTableHeader(columns) { const header = columns .map(col => padString(col.title, col.width)) .join(''); const separator = '─'.repeat(columns.reduce((sum, col) => sum + col.width, 0)); return [ STYLES.bold(header), STYLES.muted(separator) ]; }