Skip to main content
Glama
messages.ts2.15 kB
/** * @fileoverview Display message utilities * Provides formatted message boxes for errors, success, warnings, info, and banners */ import boxen from 'boxen'; import chalk from 'chalk'; import { getBoxWidth } from '../layout/helpers.js'; /** * Display a fancy banner */ export function displayBanner(title: string = 'Task Master'): void { console.log( boxen(chalk.white.bold(title), { padding: 1, margin: { top: 1, bottom: 1 }, borderStyle: 'round', borderColor: 'blue', textAlignment: 'center' }) ); } /** * Display an error message in a boxed format (matches scripts/modules/ui.js style) * Note: For general CLI error handling, use displayError from utils/error-handler.ts * This function is for displaying formatted error messages as part of UI output. */ export function displayErrorBox(message: string, details?: string): void { const boxWidth = getBoxWidth(); console.error( boxen( chalk.red.bold('X Error: ') + chalk.white(message) + (details ? '\n\n' + chalk.gray(details) : ''), { padding: 1, borderStyle: 'round', borderColor: 'red', width: boxWidth } ) ); } /** * Alias for displayErrorBox */ export const displayError = displayErrorBox; /** * Display a success message */ export function displaySuccess(message: string): void { const boxWidth = getBoxWidth(); console.log( boxen( chalk.green.bold(String.fromCharCode(8730) + ' ') + chalk.white(message), { padding: 1, borderStyle: 'round', borderColor: 'green', width: boxWidth } ) ); } /** * Display a warning message */ export function displayWarning(message: string): void { const boxWidth = getBoxWidth(); console.log( boxen(chalk.yellow.bold('⚠️ ') + chalk.white(message), { padding: 1, borderStyle: 'round', borderColor: 'yellow', width: boxWidth }) ); } /** * Display info message */ export function displayInfo(message: string): void { const boxWidth = getBoxWidth(); console.log( boxen(chalk.blue.bold('i ') + chalk.white(message), { padding: 1, borderStyle: 'round', borderColor: 'blue', width: boxWidth }) ); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eyaltoledano/claude-task-master'

If you have feedback or need assistance with the MCP directory API, please join our Discord server