UNPKG

ai-debug-local-mcp

Version:

šŸŽÆ ENHANCED AI GUIDANCE v4.1.2: Dramatically improved tool descriptions help AI users choose the right tools instead of 'close enough' options. Ultra-fast keyboard automation (10x speed), universal recording, multi-ecosystem debugging support, and compreh

158 lines • 4.73 kB
/** * User-Friendly Logger for AI Debug MCP Server * Replaces technical startup logs with friendly progress indicators */ export class UserFriendlyLogger { static isMcpMode = false; static isQuietMode = false; prefix; constructor(prefix = '') { this.prefix = prefix ? `[${prefix}] ` : ''; } /** * Configure logging mode based on environment */ static configure(isMcpMode = false) { this.isMcpMode = isMcpMode; this.isQuietMode = isMcpMode || !process.stdout.isTTY; } /** * Show friendly startup message */ static showStartup() { if (this.isQuietMode) return; console.log('\nšŸ”¬ AI Debug MCP Server'); console.log(' Starting debugging environment...\n'); } /** * Show progress step with friendly message */ static showProgress(step, details) { if (this.isQuietMode) return; const message = details ? `${step} (${details})` : step; console.log(` ā³ ${message}`); } /** * Show completion with success */ static showSuccess(message, details) { if (this.isQuietMode) return; const fullMessage = details ? `${message} - ${details}` : message; console.log(` āœ… ${fullMessage}`); } /** * Show ready state */ static showReady(toolCount, memoryUsage) { if (this.isQuietMode) return; console.log(`\nšŸŽÆ Ready! ${toolCount} debugging tools available`); console.log(` Memory: ${memoryUsage} | Sessions: 0 active\n`); } /** * Show tool loading progress */ static showToolLoading(loaded, total, currentTool) { if (this.isQuietMode) return; const progress = Math.round((loaded / total) * 100); const message = currentTool ? `Loading ${currentTool}...` : `${loaded}/${total} tools loaded`; console.log(` šŸ“¦ ${message} (${progress}%)`); } /** * Show framework detection */ static showFrameworkDetected(framework, confidence = 'high') { if (this.isQuietMode) return; console.log(` šŸŽØ Framework detected: ${framework} (${confidence} confidence)`); } /** * Show session creation */ static showSessionCreated(sessionId, url, framework) { if (this.isQuietMode) return; console.log(`\nšŸ”— Debug session created`); console.log(` ID: ${sessionId}`); console.log(` URL: ${url}`); console.log(` Framework: ${framework}\n`); } /** * Show user action result */ static showUserAction(action, selector, success) { if (this.isQuietMode) return; const status = success ? 'āœ…' : 'āŒ'; console.log(` ${status} ${action} on "${selector}"`); } /** * Show technical details only in debug mode */ static showTechnical(message) { if (this.isQuietMode || process.env.NODE_ENV !== 'development') return; console.log(` šŸ”§ ${message}`); } /** * Show error in user-friendly way */ static showError(error, suggestion) { if (this.isQuietMode) return; console.log(`\nāŒ ${error}`); if (suggestion) { console.log(` šŸ’” ${suggestion}\n`); } } /** * Replace console.log calls in MCP mode */ static logSilent(message) { // Only log in development mode or when explicitly requested if (process.env.NODE_ENV === 'development' && !this.isMcpMode) { console.log(message); } } /** * Log only in verbose mode */ static logVerbose(message) { if (!this.isQuietMode && process.env.DEBUG) { console.log(` šŸ” ${message}`); } } /** * Instance logging methods */ info(message) { if (!UserFriendlyLogger.isQuietMode) { console.log(`${this.prefix}${message}`); } } success(message) { if (!UserFriendlyLogger.isQuietMode) { console.log(`${this.prefix}${message}`); } } warn(message) { if (!UserFriendlyLogger.isQuietMode) { console.warn(`${this.prefix}āš ļø ${message}`); } } error(message) { if (!UserFriendlyLogger.isQuietMode) { console.error(`${this.prefix}āŒ ${message}`); } } debug(message) { if (!UserFriendlyLogger.isQuietMode && process.env.DEBUG === 'true') { console.log(`${this.prefix}šŸ” ${message}`); } } } //# sourceMappingURL=user-friendly-logger.js.map