UNPKG

@codervisor/devlog-ai

Version:

AI Chat History Extractor & Docker-based Automation - TypeScript implementation for GitHub Copilot and other AI coding assistants with automated testing capabilities

79 lines (78 loc) 2.01 kB
/** * CLI utility functions for consistent command-line interface patterns */ import chalk from 'chalk'; /** * Extract error message with consistent fallback pattern */ export function extractErrorMessage(error) { return error instanceof Error ? error.message : String(error); } /** * Display error message with consistent formatting */ export function displayError(operation, error) { const message = extractErrorMessage(error); console.log(chalk.red(`Error ${operation}: ${message}`)); } /** * Display success message with consistent formatting */ export function displaySuccess(message) { console.log(chalk.green(message)); } /** * Display warning message with consistent formatting */ export function displayWarning(message) { console.log(chalk.yellow(message)); } /** * Display info message with consistent formatting */ export function displayInfo(message) { console.log(chalk.blue(message)); } /** * Display section header with consistent formatting */ export function displayHeader(title) { console.log(chalk.bold(title)); } /** * Display numbered list item with consistent formatting */ export function displayListItem(index, content) { console.log(`${chalk.cyan(`${index}.`)} ${content}`); } /** * Display key-value pair with consistent formatting */ export function displayKeyValue(key, value) { console.log(`${chalk.gray(key + ':')} ${value}`); } /** * Format file path for display */ export function formatPath(path) { return chalk.dim(path); } /** * Format count/number for display */ export function formatCount(count) { return chalk.cyan(count.toString()); } /** * Display a separator line */ export function displaySeparator() { console.log(chalk.gray('─'.repeat(50))); } /** * Display progress indicator */ export function displayProgress(current, total, operation) { const percentage = Math.round((current / total) * 100); console.log(chalk.blue(`[${percentage}%] ${operation} (${current}/${total})`)); }