import { EventEmitter } from 'events'; import * as ts from 'typescript'; import { MCPManager } from './mcp-client.js'; import { AIToolIntegrationPlaybookService } from './ai-tool-integration-playbook.js'; import { AutonomousExecutionEngine } from './autonomous-execution-engine.js'; import type { ProjectContext } from '../types/index.js'; export interface TypeScriptDocumentationQuery { type: 'api_reference' | 'ast_manipulation' | 'compiler_options' | 'best_practices' | 'error_resolution'; context: string; specificAPI?: string; astNodeType?: ts.SyntaxKind; errorCode?: string; compilerVersion?: string; cacheKey?: string; } export interface TypeScriptWorkflowResult { success: boolean; documentation: string; codeExamples: CodeExample[]; relatedAPIs: string[]; bestPractices: string[]; performanceNotes: string[]; troubleshootingGuide?: TroubleshootingGuide; cacheMetadata: CacheMetadata; } export interface CodeExample { title: string; description: string; code: string; language: 'typescript' | 'javascript'; complexity: 'basic' | 'intermediate' | 'advanced'; compilerVersion: string; tags: string[]; } export interface TroubleshootingGuide { commonIssues: Issue[]; debuggingSteps: string[]; relatedErrors: string[]; quickFixes: QuickFix[]; } export interface Issue { problem: string; cause: string; solution: string; codeExample?: string; } export interface QuickFix { description: string; code: string; automated: boolean; } export interface CacheMetadata { key: string; timestamp: Date; ttl: number; hitCount: number; source: 'context7' | 'local_cache' | 'fallback'; } export interface ASTAnalysisRequest { sourceCode: string; analysisType: 'structure' | 'manipulation' | 'transformation' | 'validation'; targetNodes?: ts.SyntaxKind[]; transformationGoal?: string; } export interface ASTAnalysisResult { structure: ASTNodeInfo[]; manipulationGuide: ManipulationStep[]; codeGeneration: string; performance: PerformanceAnalysis; validation: ValidationResult[]; } export interface ASTNodeInfo { kind: ts.SyntaxKind; kindName: string; position: { start: number; end: number; line: number; column: number; }; children: ASTNodeInfo[]; properties: Record; documentation?: string; } export interface ManipulationStep { operation: 'create' | 'modify' | 'delete' | 'replace'; target: string; code: string; explanation: string; apiMethods: string[]; } export interface PerformanceAnalysis { complexity: 'low' | 'medium' | 'high'; memoryUsage: string; recommendations: string[]; optimizations: string[]; } export interface ValidationResult { valid: boolean; errors: CompilationError[]; warnings: CompilationWarning[]; suggestions: string[]; } export interface CompilationError { code: number; message: string; file: string; line: number; column: number; category: string; severity: 'error' | 'warning' | 'suggestion'; fixSuggestions: string[]; } export interface CompilationWarning { code: number; message: string; file: string; line: number; column: number; suggestion: string; } export interface TypeScriptWorkflowConfig { cacheEnabled: boolean; cacheTTL: number; maxCacheSize: number; preferredCompilerVersion: string; enablePerformanceOptimizations: boolean; includeAdvancedExamples: boolean; enableErrorRecovery: boolean; } export declare class Context7TypeScriptWorkflowService extends EventEmitter { private readonly logger; private mcpManager; private aiPlaybook; private executionEngine; private documentationCache; private astCache; private apiUsageStats; private config; private compilerHost; private compilerOptions; constructor(mcpManager: MCPManager, aiPlaybook: AIToolIntegrationPlaybookService, executionEngine: AutonomousExecutionEngine, config?: Partial); getTypeScriptDocumentation(query: TypeScriptDocumentationQuery): Promise; analyzeAST(request: ASTAnalysisRequest): Promise; resolveCompilationErrors(sourceCode: string, errors: ts.Diagnostic[], projectContext?: ProjectContext): Promise<{ resolutions: ErrorResolution[]; fixedCode: string; confidence: number; }>; getTypeScriptBestPractices(category: 'performance' | 'security' | 'maintainability' | 'testing' | 'general', projectType?: 'library' | 'application' | 'node' | 'browser'): Promise<{ practices: BestPractice[]; codeExamples: CodeExample[]; toolingRecommendations: string[]; migrationGuides: string[]; }>; private analyzeASTStructure; private getASTManipulationGuide; private generateTransformedCode; private validateTypeScriptCode; private analyzePerformanceImplications; private buildContext7Query; private mapQueryTypeToTopic; private processOrchestrationResult; private convertASTAnalysisToExamples; private generateCacheKey; private generateASTCacheKey; private getCachedResult; private cacheResult; private evictOldestCacheEntries; private initializeCompilerEnvironment; private setupEventHandlers; private createProjectContext; private createCodebaseSnapshot; private createFallbackResult; private updateUsageStats; private hashString; private getLineFromPosition; private getColumnFromPosition; private extractNodeProperties; private hasDocumentation; private getNodeDocumentation; private countNodes; private findExpensiveOperations; private estimateMemoryUsage; private convertDiagnosticToError; private convertDiagnosticToWarning; private parseManipulationStepsFromDocumentation; private generateFallbackManipulationSteps; private extractDocumentationFromResult; private parseCodeExamplesFromDocumentation; private extractRelatedAPIs; private extractBestPractices; private extractPerformanceNotes; private generateTroubleshootingGuide; private generateManualResolution; private enhancePracticesWithProjectContext; private getToolingRecommendations; private getMigrationGuides; getCacheStatistics(): { size: number; hitRate: number; maxSize: number; usageStats: Record; }; clearCache(): void; updateConfiguration(config: Partial): void; private initializePerformanceMetrics; } export interface ErrorResolution { errorCode: number; description: string; solution: string; fixedCode: string; confidence: number; automated: boolean; documentation: string; } export interface BestPractice { category: string; title: string; description: string; example: string; benefits: string[]; pitfalls: string[]; tooling: string[]; } //# sourceMappingURL=context7-typescript-workflow.d.ts.map