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

100 lines • 3.86 kB
/** * AI-Debug ↔ Serena Integration Protocol * * Lightweight integration that enables seamless workflow between: * - AI-Debug: Runtime debugging, visual testing, performance analysis * - Serena: Static code analysis, semantic search, code generation * * Strategic Decision: NO code incorporation, YES ecosystem integration */ /** * AI-Debug Integration Manager * Handles export of findings to Serena-compatible format */ export class SerenaIntegrationManager { /** * Export current debugging session findings for Serena analysis */ static async exportFindings(sessionId) { // Implementation will gather findings from current AI-Debug session return []; } /** * Create shared session identifier that both tools can reference */ static generateSharedSessionId(projectPath) { const timestamp = Date.now(); const projectName = projectPath.split('/').pop() || 'unknown'; return `debug_${projectName}_${timestamp}`; } /** * Export session data in format that Serena can import */ static async exportSessionContext(aiDebugSessionId) { return { id: this.generateSharedSessionId('current'), project_path: process.cwd(), created_at: Date.now(), updated_at: Date.now(), ai_debug_session: aiDebugSessionId, serena_active: false, framework: 'auto-detected', primary_language: 'typescript', active_files: [], current_task: 'debugging_session' }; } /** * Generate Serena command suggestions based on AI-Debug findings */ static generateSerenaWorkflow(findings) { const commands = []; findings.forEach(finding => { switch (finding.type) { case 'performance': if (finding.location.file) { commands.push(`find_symbol "${finding.location.component}" ${finding.location.file}`); commands.push(`search_for_pattern "performance.*optimization" ${finding.location.file}`); } break; case 'accessibility': commands.push(`search_for_pattern "aria-|role=|alt=" . --paths_include_glob "*.tsx,*.jsx"`); commands.push(`find_referencing_symbols "useAccessibility"`); break; case 'error': if (finding.location.file) { commands.push(`find_symbol "error|catch|throw" ${finding.location.file}`); commands.push(`search_for_pattern "try.*catch" ${finding.location.file}`); } break; } }); return commands; } } /** * Complementary Workflow Documentation * * EXAMPLE WORKFLOW: * * 1. AI Debug Local: "Found performance issue in UserComponent.tsx:45" * → Export finding: session_abc123_performance_issue.json * * 2. Developer: Switch to Serena with exported context * → serena import session_abc123_performance_issue.json * * 3. Serena: "Analyzing UserComponent.tsx performance patterns..." * → find_symbol "UserComponent" src/ * → search_for_pattern "useMemo|useCallback" src/UserComponent.tsx * * 4. Serena: "Suggested fix: Memoize expensive calculation" * → replace_symbol_body "calculateExpensiveValue" "useMemo(() => {...}, [deps])" * * 5. AI Debug Local: "Validating fix with performance regression test..." * → inject_debugging url * → run_audit sessionId (performance category) * → take_screenshot for before/after comparison * * RESULT: Seamless debug → analyze → fix → validate cycle without tool coupling */ //# sourceMappingURL=serena-integration-protocol.js.map