vibe-coder-mcp
Version:
Production-ready MCP server with complete agent integration, multi-transport support, and comprehensive development automation tools for AI-assisted workflows.
65 lines (64 loc) • 2.1 kB
JavaScript
import ora from 'ora';
import { themeManager } from '../themes.js';
export class ProgressIndicator {
spinner = null;
startTime = 0;
start(message = 'Processing...') {
this.startTime = Date.now();
this.spinner = ora({
text: message,
color: 'cyan',
spinner: 'dots12'
}).start();
}
update(message) {
if (this.spinner) {
this.spinner.text = message;
}
}
success(message) {
if (this.spinner) {
const duration = this.getDuration();
const colors = themeManager.getColors();
const finalMessage = message ? `${message} ${colors.textMuted(`(${duration})`)}` : `Done ${colors.textMuted(`(${duration})`)}`;
this.spinner.succeed(finalMessage);
this.spinner = null;
}
}
fail(message) {
if (this.spinner) {
const duration = this.getDuration();
const colors = themeManager.getColors();
const finalMessage = message ? `${message} ${colors.textMuted(`(${duration})`)}` : `Failed ${colors.textMuted(`(${duration})`)}`;
this.spinner.fail(finalMessage);
this.spinner = null;
}
}
warn(message) {
if (this.spinner) {
const duration = this.getDuration();
const colors = themeManager.getColors();
const finalMessage = message ? `${message} ${colors.textMuted(`(${duration})`)}` : `Warning ${colors.textMuted(`(${duration})`)}`;
this.spinner.warn(finalMessage);
this.spinner = null;
}
}
stop() {
if (this.spinner) {
this.spinner.stop();
this.spinner = null;
}
}
isRunning() {
return this.spinner !== null && this.spinner.isSpinning;
}
getDuration() {
const ms = Date.now() - this.startTime;
if (ms < 1000) {
return `${ms}ms`;
}
const seconds = (ms / 1000).toFixed(1);
return `${seconds}s`;
}
}
export const progress = new ProgressIndicator();