Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192import chalk from 'chalk';
export const BOLD = chalk.bold;export const DIM = chalk.dim;export const CYAN = chalk.cyan;export const GREEN = chalk.green;export const YELLOW = chalk.yellow;export const RED = chalk.red;export const MAGENTA = chalk.magenta;export const WHITE = chalk.white;
export function header(text: string): void { console.log(); console.log(BOLD(CYAN(text)));}
export function success(text: string): void { console.log(GREEN(` ✓ ${text}`));}
export function info(text: string): void { console.log(DIM(` ${text}`));}
export function warn(text: string): void { console.log(YELLOW(` ! ${text}`));}
export function error(text: string): void { console.log(RED(` ✗ ${text}`));}
export function line(): void { console.log();}
export function command(text: string): void { console.log(` ${CYAN('$')} ${WHITE(text)}`);}
export function label(name: string, value: string, color?: typeof GREEN): void { const colorFn = color || WHITE; const pad = Math.max(14, name.length + 2); console.log(` ${DIM(name.padEnd(pad))}${colorFn(value)}`);}
export function statusDot(running: boolean): string { return running ? GREEN('●') : DIM('○');}
export function banner(): void { console.log(); console.log(BOLD(MAGENTA(' ╭───────────────────────────────────────╮'))); console.log(BOLD(MAGENTA(' │ Aether Substrate CLI │'))); console.log(BOLD(MAGENTA(' ╰───────────────────────────────────────╯'))); console.log(DIM(' Bootstrap, run, and expose your Substrate.'));}
export function table(rows: string[][]): void { if (rows.length === 0) return; // Calculate column widths const colWidths = rows[0].map((_, colIdx) => Math.max(...rows.map(row => stripAnsi(row[colIdx] || '').length)) ); for (const row of rows) { const formatted = row.map((cell, i) => { const stripped = stripAnsi(cell); const pad = colWidths[i] - stripped.length; return cell + ' '.repeat(Math.max(0, pad)); }); console.log(` ${formatted.join(' ')}`); }}
function stripAnsi(str: string): string { return str.replace(/\u001b\[[0-9;]*m/g, '');}
export function truncate(str: string, maxLen: number): string { if (str.length <= maxLen) return str; return str.substring(0, maxLen - 2) + '..';}
export function shortDid(did: string): string { if (did.length <= 20) return did; return did.substring(0, 16) + '..';}
export function formatNumber(n: number): string { return n.toLocaleString('en-US');}