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
JavaScript
/**
* 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