UNPKG

@kya-os/cli

Version:

CLI for MCP-I setup and management

182 lines (181 loc) 6.06 kB
/** * Welcome Component * Beautiful welcome messages using figlet and gradient-string */ import figlet from "figlet"; import gradient from "gradient-string"; import boxen from "boxen"; import chalk from "chalk"; import { mind } from "gradient-string"; /** * Custom KYA-OS ASCII art logo with cryptographic visual language * Uses hexagonal patterns and network motifs to reflect decentralized identity */ const KYA_OS_ASCII_ART = ` ██╗ ██╗██╗ ██╗ █████╗ ⬢ ◊ ∞ ██║ ██╔╝╚██╗ ██╔╝██╔══██╗ ╱ ╲ ╱ ╲ — OS █████╔╝ ╚████╔╝ ███████║ ⬡━━━⬢━━━⬡ ██╔═██╗ ╚██╔╝ ██╔══██║ ╲ ╱ ╲ ╱ ██║ ██╗ ██║ ██║ ██║ ◊ ∞ ⬢ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ┌─────◊ AGENT IDENTITY PROTOCOL ◊─────┐ │ ⬢ Decentralized ∞ Cryptographic │ │ ◊ Verifiable ⚡ Autonomous │ │ │ │ ░░▒▒▓▓ SOVEREIGN AGENTS ▓▓▒▒░░ │ └─────────────────────────────────────┘ `; /** * Create a gradient welcome banner with custom ASCII art */ export async function createWelcomeBanner(text = "KYA-OS") { // Apply gradient to the custom ASCII art const gradientText = mind.multiline(KYA_OS_ASCII_ART); // Wrap in a box const boxed = boxen(gradientText, { padding: 1, margin: 1, borderStyle: "round", borderColor: "cyan", title: "Model Context Protocol - Identity", titleAlignment: "center", }); return Promise.resolve(boxed); } /** * Create a gradient welcome banner using figlet (classic version) */ export async function createWelcomeBannerClassic(text = "KYA-OS") { return new Promise((resolve, reject) => { figlet.text(text, { font: "Big", horizontalLayout: "default", verticalLayout: "default", width: 80, whitespaceBreak: true, }, (err, data) => { if (err) { reject(err); return; } // Apply gradient const gradientText = mind.multiline(data || ""); // Wrap in a box const boxed = boxen(gradientText, { padding: 1, margin: 1, borderStyle: "round", borderColor: "cyan", title: "Model Context Protocol - Identity", titleAlignment: "center", }); resolve(boxed); }); }); } /** * Create a simple gradient text */ export function createGradientText(text, style = "cool") { const gradients = { rainbow: gradient.rainbow, cool: gradient.cristal, warm: gradient.passion, pastel: gradient.pastel, }; return gradients[style](text); } /** * Create a boxed message with gradient */ export function createGradientBox(content, options) { const { title = "", borderColor = "cyan", padding = 1, gradientStyle = "cool", } = options || {}; const text = Array.isArray(content) ? content.join("\n") : content; const gradientText = createGradientText(text, gradientStyle); return boxen(gradientText, { padding, borderStyle: "round", borderColor, title, titleAlignment: "center", }); } /** * Create a stylized error box */ export function createErrorBox(message, details) { let content = chalk.bold.red(`✖ ${message}`); if (details) { content += "\n\n" + chalk.gray(details); } return boxen(content, { padding: 1, borderStyle: "round", borderColor: "red", title: "Error", titleAlignment: "center", }); } /** * Create a stylized success box */ export function createSuccessBox(message, details) { let content = chalk.bold.green(`✓ ${message}`); if (details) { content += "\n\n" + chalk.gray(details); } return boxen(content, { padding: 1, borderStyle: "round", borderColor: "green", title: "Success", titleAlignment: "center", }); } /** * Create a stylized info box */ export function createInfoBox(message, details) { let content = chalk.bold.cyan(`ℹ ${message}`); if (details) { content += "\n\n" + chalk.gray(details); } return boxen(content, { padding: 1, borderStyle: "round", borderColor: "cyan", title: "Information", titleAlignment: "center", }); } /** * Create a gradient text with KYA-OS themed colors */ export function createKYAGradientText(text, theme = "active") { const themes = { dormant: gradient(["#2d2d34", "#404049"]), active: gradient(["#1e3a5f", "#64b5f6"]), verified: gradient(["#146b7a", "#26c6da"]), networked: gradient(["#5b1f7a", "#ab47bc"]), sovereign: gradient(["#7a1f5b", "#e1bee7", "#2d9c7b"]), }; return themes[theme](text); } /** * Create a cryptographic-themed welcome banner */ export async function createCryptoWelcomeBanner() { // Apply sophisticated gradient to the custom ASCII art const gradientText = createKYAGradientText(KYA_OS_ASCII_ART.trim(), "sovereign"); // Wrap in a box with cryptographic styling const boxed = boxen(gradientText, { padding: 1, margin: 1, borderStyle: "round", borderColor: "magenta", title: "⬢◊∞ Model Context Protocol - Identity ∞◊⬢", titleAlignment: "center", }); return Promise.resolve(boxed); } //# sourceMappingURL=welcome.js.map