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
224 lines • 11.5 kB
JavaScript
/**
* Comprehensive Tool Dependency Mapping
* Maps every tool to its required dependencies for lazy loading
*/
export const COMPREHENSIVE_TOOL_DEPENDENCIES = {
// ========== CORE DEBUGGING TOOLS ==========
'inject_debugging': ['playwright', 'framework-detector'],
'list_tools': [], // No dependencies
'get_debug_state': [], // Uses in-memory sessions
// ========== BROWSER INTERACTION TOOLS ==========
'simulate_user_action': ['playwright'],
'take_screenshot': ['playwright'],
'monitor_realtime': ['playwright', 'event-monitor'],
'mock_network': ['playwright'],
// ========== PERFORMANCE & AUDIT TOOLS ==========
'run_audit': ['playwright', 'audit-engine', 'lighthouse'],
'performance_profile': ['playwright', 'performance-profiler'],
'analyze_bundle_size': ['webpack-analyzer', 'bundle-analyzer'],
// ========== AI & CLOUD TOOLS ==========
'analyze_with_ai': ['cloud-ai-service', 'api-key-manager'],
'generate_debug_report': ['report-generator', 'cloud-ai-service'],
'ai_test_generation': ['ai-test-engine', 'openai-client'],
'ai_code_analysis': ['ast-parser', 'ai-analyzer'],
// ========== NEXTJS SPECIFIC TOOLS ==========
'nextjs_debug_hydration': ['playwright', 'nextjs-engine'],
'nextjs_trace_data_fetching': ['nextjs-engine', 'async-tracker'],
'nextjs_analyze_bundle': ['nextjs-engine', 'webpack-analyzer'],
'nextjs_monitor_cache': ['nextjs-engine', 'cache-monitor'],
'nextjs_debug_api_routes': ['nextjs-engine', 'api-tracer'],
'nextjs_debug_middleware': ['nextjs-engine', 'middleware-analyzer'],
'nextjs_debug_ssr': ['nextjs-engine', 'ssr-analyzer'],
'nextjs_analyze_performance': ['nextjs-engine', 'performance-analyzer'],
// ========== FLUTTER SPECIFIC TOOLS ==========
'flutter_debug_canvas': ['playwright', 'flutter-engine'],
'flutter_inspect_widget_tree': ['flutter-engine', 'widget-analyzer'],
'flutter_debug_state': ['flutter-engine', 'state-analyzer'],
'flutter_analyze_performance': ['flutter-engine', 'flutter-profiler'],
'flutter_debug_navigation': ['flutter-engine', 'navigation-helper'],
'flutter_accessibility_check': ['flutter-engine', 'accessibility-checker'],
'flutter_quantum_debug': ['flutter-engine', 'quantum-debugger'],
// ========== REACT/VUE/ANGULAR TOOLS ==========
'react_inspect_components': ['playwright', 'react-devtools'],
'react_debug_state': ['react-state-engine'],
'vue_debug_reactivity': ['vue-devtools'],
'angular_debug_change_detection': ['angular-devtools'],
// ========== META-FRAMEWORK TOOLS ==========
'remix_debug_loaders': ['meta-framework-engine'],
'astro_debug_islands': ['meta-framework-engine'],
'nuxt_debug_nitro': ['meta-framework-engine'],
'sveltekit_debug_load': ['meta-framework-engine'],
'qwik_debug_resumability': ['meta-framework-engine'],
// ========== PHOENIX/ELIXIR TOOLS ==========
'phoenix_debug_liveview': ['tidewave', 'liveview-engine'],
'phoenix_trace_channels': ['tidewave', 'channel-tracer'],
'elixir_attach_to_beam': ['tidewave', 'beam-debugger'],
'elixir_trace_processes': ['tidewave', 'process-tracer'],
'ecto_debug_queries': ['tidewave', 'ecto-analyzer'],
'phoenix_profile_plugs': ['tidewave', 'plug-profiler'],
'phoenix_test_generation': ['tidewave', 'test-generator'],
// ========== PYTHON BACKEND TOOLS ==========
'python_trace_request': ['python-engine', 'request-tracer'],
'django_debug_orm': ['python-engine', 'django-debugger'],
'flask_debug_routes': ['python-engine', 'flask-debugger'],
'fastapi_debug_deps': ['python-engine', 'fastapi-debugger'],
'python_profile_memory': ['python-engine', 'memory-profiler'],
// ========== RUBY/RAILS TOOLS ==========
'rails_debug_activerecord': ['rails-engine', 'activerecord-analyzer'],
'rails_trace_middleware': ['rails-engine', 'middleware-tracer'],
'ruby_profile_memory': ['rails-engine', 'ruby-profiler'],
// ========== DATABASE TOOLS ==========
'trace_database_query': ['database-engine'],
'analyze_slow_queries': ['database-engine', 'query-analyzer'],
'debug_connection_pool': ['database-engine', 'pool-monitor'],
'profile_database_locks': ['database-engine', 'lock-analyzer'],
// ========== GRAPHQL TOOLS ==========
'graphql_trace_resolvers': ['graphql-engine'],
'graphql_analyze_complexity': ['graphql-engine', 'complexity-analyzer'],
'graphql_debug_subscriptions': ['graphql-engine', 'subscription-debugger'],
// ========== TEST DEBUGGING TOOLS ==========
'debug_test_failures': ['test-runner', 'failure-analyzer'],
'analyze_test_coverage': ['coverage-analyzer'],
'debug_flaky_tests': ['test-stability-analyzer'],
'generate_test_data': ['test-data-generator'],
// ========== TDD/BDD TOOLS ==========
'enable_tdd_mode': ['tdd-engine', 'test-watcher'],
'run_tests_with_coverage': ['test-runner', 'coverage-reporter'],
'test_impact_analysis': ['impact-analyzer', 'dependency-graph'],
'regression_detection': ['regression-analyzer', 'diff-engine'],
// ========== VISUAL REGRESSION TOOLS ==========
'visual_regression_test': ['playwright', 'visual-comparator'],
'capture_visual_baseline': ['playwright', 'screenshot-engine'],
'compare_visual_changes': ['visual-comparator', 'diff-visualizer'],
// ========== EVOLUTION/REFACTORING TOOLS ==========
'evolve_codebase': ['evolution-engine', 'ast-transformer'],
'analyze_code_impact': ['impact-analyzer', 'dependency-graph'],
'suggest_refactoring': ['refactoring-engine', 'code-analyzer'],
// ========== FAULT INJECTION TOOLS ==========
'inject_network_fault': ['fault-injection-engine'],
'simulate_slow_response': ['fault-injection-engine'],
'trigger_memory_pressure': ['fault-injection-engine'],
// ========== MAINTENANCE TOOLS ==========
'update_selectors': ['selector-updater', 'dom-analyzer'],
'maintain_test_suite': ['test-maintenance-engine'],
'cleanup_debug_artifacts': ['artifact-cleaner']
};
/**
* Dependency modules and their lazy loaders
*/
export const DEPENDENCY_LOADERS = {
// Browser automation
'playwright': async () => (await import('../utils/lazy-dependencies.js')).lazyPlaywright.load(),
// Framework engines
'nextjs-engine': async () => (await import('../utils/lazy-dependencies.js')).lazyNextJsEngine.load(),
'flutter-engine': async () => (await import('../utils/lazy-dependencies.js')).lazyFlutterEngine.load(),
'python-engine': async () => (await import('../utils/lazy-dependencies.js')).lazyPythonEngine.load(),
'database-engine': async () => (await import('../utils/lazy-dependencies.js')).lazyDatabaseEngine.load(),
'rails-engine': async () => (await import('../utils/lazy-dependencies.js')).lazyRailsEngine.load(),
'meta-framework-engine': async () => (await import('../utils/lazy-dependencies.js')).lazyMetaFrameworkEngine.load(),
'graphql-engine': async () => (await import('../utils/lazy-dependencies.js')).lazyGraphQLEngine.load(),
// Third-party integrations
'tidewave': async () => (await import('../utils/lazy-dependencies.js')).lazyTidewave.load(),
// Analysis engines
'audit-engine': async () => (await import('../audit-engine.js')).AuditEngine,
'performance-profiler': async () => (await import('../performance-profiler.js')).PerformanceProfiler,
'webpack-analyzer': async () => (await import('../modules/nextjs-bundle-analyzer.js')).NextJSBundleAnalyzer,
'bundle-analyzer': async () => (await import('../handlers/bundle-handler.js')).BundleHandler,
// AI services
'cloud-ai-service': async () => (await import('../cloud-ai-service.js')).CloudAIService,
'api-key-manager': async () => (await import('../api-key-manager.js')).APIKeyManager,
'ai-test-engine': async () => (await import('../test-generator-ai.js')).TestGeneratorAI,
'openai-client': async () => {
try {
const openai = await import('openai');
return openai.OpenAI;
}
catch {
console.log('⚠️ OpenAI client not available');
return null;
}
},
// Test tools
'test-runner': async () => (await import('../tdd-debug-engine.js')).TDDDebugEngine,
'coverage-analyzer': async () => (await import('../handlers/tdd-handler.js')).TDDHandler,
'test-maintenance-engine': async () => (await import('../smart-test-maintenance.js')).SmartTestMaintenance,
// Visual tools
'visual-comparator': async () => (await import('../utils/visual-validation-engine.js')).VisualValidationEngine,
'screenshot-engine': async () => (await import('../screenshot-optimizer.js')).ScreenshotOptimizer,
// Evolution tools
'evolution-engine': async () => (await import('../test-evolution-engine.js')).TestEvolutionEngine,
'ast-transformer': async () => (await import('../ast-change-detector.js')).ASTChangeDetector,
// Fault injection
'fault-injection-engine': async () => (await import('../fault-injection-engine.js')).FaultInjectionEngine,
// React/Vue/Angular specific
'react-state-engine': async () => (await import('../react-state-engine.js')).ReactStateEngine,
'react-devtools': async () => null, // Injected via browser extension
'vue-devtools': async () => null, // Injected via browser extension
'angular-devtools': async () => null, // Injected via browser extension,
// Lighthouse for audits
'lighthouse': async () => {
try {
const lighthouse = await import('lighthouse');
return lighthouse;
}
catch {
console.log('⚠️ Lighthouse not available, using basic audit engine');
return null;
}
}
};
/**
* Get all dependencies required for a tool
*/
export function getComprehensiveToolDependencies(toolName) {
return COMPREHENSIVE_TOOL_DEPENDENCIES[toolName] || [];
}
/**
* Load all dependencies for a tool
*/
export async function loadToolDependencies(toolName) {
const deps = getComprehensiveToolDependencies(toolName);
const loadedDeps = new Map();
for (const dep of deps) {
const loader = DEPENDENCY_LOADERS[dep];
if (loader) {
try {
console.log(`📦 Loading dependency: ${dep} for tool: ${toolName}`);
const module = await loader();
loadedDeps.set(dep, module);
}
catch (error) {
console.error(`❌ Failed to load dependency ${dep}:`, error);
// Continue loading other dependencies
}
}
}
return loadedDeps;
}
/**
* Check if a tool requires any external dependencies
*/
export function requiresExternalDependencies(toolName) {
const deps = getComprehensiveToolDependencies(toolName);
return deps.length > 0;
}
/**
* Get memory usage estimate for tool dependencies
*/
export function getToolMemoryEstimate(toolName) {
const deps = getComprehensiveToolDependencies(toolName);
const memoryEstimates = {
'playwright': 150, // MB
'nextjs-engine': 50,
'flutter-engine': 60,
'python-engine': 40,
'database-engine': 30,
'tidewave': 20,
'lighthouse': 100,
'ai-test-engine': 80,
'visual-comparator': 40,
// Add more estimates as needed
};
return deps.reduce((total, dep) => total + (memoryEstimates[dep] || 10), 0);
}
//# sourceMappingURL=comprehensive-tool-dependencies.js.map