codereview-aia 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analysis/FindingsExtractor.d.ts +105 -0
- package/dist/analysis/FindingsExtractor.js +363 -0
- package/dist/analysis/FindingsExtractor.js.map +1 -0
- package/dist/analysis/ai-detection/analyzers/BaseAnalyzer.d.ts +111 -0
- package/dist/analysis/ai-detection/analyzers/BaseAnalyzer.js +215 -0
- package/dist/analysis/ai-detection/analyzers/BaseAnalyzer.js.map +1 -0
- package/dist/analysis/ai-detection/analyzers/DocumentationAnalyzer.d.ts +142 -0
- package/dist/analysis/ai-detection/analyzers/DocumentationAnalyzer.js +503 -0
- package/dist/analysis/ai-detection/analyzers/DocumentationAnalyzer.js.map +1 -0
- package/dist/analysis/ai-detection/analyzers/GitHistoryAnalyzer.d.ts +88 -0
- package/dist/analysis/ai-detection/analyzers/GitHistoryAnalyzer.js +343 -0
- package/dist/analysis/ai-detection/analyzers/GitHistoryAnalyzer.js.map +1 -0
- package/dist/analysis/ai-detection/core/AIDetectionEngine.d.ts +104 -0
- package/dist/analysis/ai-detection/core/AIDetectionEngine.js +369 -0
- package/dist/analysis/ai-detection/core/AIDetectionEngine.js.map +1 -0
- package/dist/analysis/ai-detection/types/DetectionTypes.d.ts +364 -0
- package/dist/analysis/ai-detection/types/DetectionTypes.js +32 -0
- package/dist/analysis/ai-detection/types/DetectionTypes.js.map +1 -0
- package/dist/analysis/ai-detection/utils/SubmissionConverter.d.ts +97 -0
- package/dist/analysis/ai-detection/utils/SubmissionConverter.js +339 -0
- package/dist/analysis/ai-detection/utils/SubmissionConverter.js.map +1 -0
- package/dist/analysis/context/ReviewContext.d.ts +184 -0
- package/dist/analysis/context/ReviewContext.js +294 -0
- package/dist/analysis/context/ReviewContext.js.map +1 -0
- package/dist/analysis/context/index.d.ts +6 -0
- package/dist/analysis/context/index.js +23 -0
- package/dist/analysis/context/index.js.map +1 -0
- package/dist/analysis/index.d.ts +7 -0
- package/dist/analysis/index.js +24 -0
- package/dist/analysis/index.js.map +1 -0
- package/dist/analysis/tokens/TokenAnalysisFormatter.d.ts +27 -0
- package/dist/analysis/tokens/TokenAnalysisFormatter.js +143 -0
- package/dist/analysis/tokens/TokenAnalysisFormatter.js.map +1 -0
- package/dist/analysis/tokens/TokenAnalyzer.d.ts +155 -0
- package/dist/analysis/tokens/TokenAnalyzer.js +502 -0
- package/dist/analysis/tokens/TokenAnalyzer.js.map +1 -0
- package/dist/analysis/tokens/index.d.ts +7 -0
- package/dist/analysis/tokens/index.js +24 -0
- package/dist/analysis/tokens/index.js.map +1 -0
- package/dist/clients/base/abstractClient.d.ts +99 -0
- package/dist/clients/base/abstractClient.js +98 -0
- package/dist/clients/base/abstractClient.js.map +1 -0
- package/dist/clients/base/httpClient.d.ts +24 -0
- package/dist/clients/base/httpClient.js +147 -0
- package/dist/clients/base/httpClient.js.map +1 -0
- package/dist/clients/base/index.d.ts +11 -0
- package/dist/clients/base/index.js +28 -0
- package/dist/clients/base/index.js.map +1 -0
- package/dist/clients/base/modelDetection.d.ts +41 -0
- package/dist/clients/base/modelDetection.js +88 -0
- package/dist/clients/base/modelDetection.js.map +1 -0
- package/dist/clients/base/responseProcessor.d.ts +45 -0
- package/dist/clients/base/responseProcessor.js +495 -0
- package/dist/clients/base/responseProcessor.js.map +1 -0
- package/dist/clients/factory/clientFactory.d.ts +23 -0
- package/dist/clients/factory/clientFactory.js +50 -0
- package/dist/clients/factory/clientFactory.js.map +1 -0
- package/dist/clients/factory/index.d.ts +7 -0
- package/dist/clients/factory/index.js +24 -0
- package/dist/clients/factory/index.js.map +1 -0
- package/dist/clients/implementations/index.d.ts +7 -0
- package/dist/clients/implementations/index.js +24 -0
- package/dist/clients/implementations/index.js.map +1 -0
- package/dist/clients/implementations/openRouterClient.d.ts +69 -0
- package/dist/clients/implementations/openRouterClient.js +294 -0
- package/dist/clients/implementations/openRouterClient.js.map +1 -0
- package/dist/clients/openRouterClient.d.ts +42 -0
- package/dist/clients/openRouterClient.js +738 -0
- package/dist/clients/openRouterClient.js.map +1 -0
- package/dist/clients/openRouterClientWrapper.d.ts +22 -0
- package/dist/clients/openRouterClientWrapper.js +64 -0
- package/dist/clients/openRouterClientWrapper.js.map +1 -0
- package/dist/clients/utils/directoryStructure.d.ts +14 -0
- package/dist/clients/utils/directoryStructure.js +48 -0
- package/dist/clients/utils/directoryStructure.js.map +1 -0
- package/dist/clients/utils/index.d.ts +10 -0
- package/dist/clients/utils/index.js +31 -0
- package/dist/clients/utils/index.js.map +1 -0
- package/dist/clients/utils/languageDetection.d.ts +13 -0
- package/dist/clients/utils/languageDetection.js +46 -0
- package/dist/clients/utils/languageDetection.js.map +1 -0
- package/dist/clients/utils/promptFormatter.d.ts +36 -0
- package/dist/clients/utils/promptFormatter.js +92 -0
- package/dist/clients/utils/promptFormatter.js.map +1 -0
- package/dist/clients/utils/promptLoader.d.ts +27 -0
- package/dist/clients/utils/promptLoader.js +49 -0
- package/dist/clients/utils/promptLoader.js.map +1 -0
- package/dist/clients/utils/tokenCounter.d.ts +81 -0
- package/dist/clients/utils/tokenCounter.js +209 -0
- package/dist/clients/utils/tokenCounter.js.map +1 -0
- package/dist/core/ApiClientSelector.d.ts +8 -0
- package/dist/core/ApiClientSelector.js +29 -0
- package/dist/core/ApiClientSelector.js.map +1 -0
- package/dist/core/ConfigurationService.d.ts +286 -0
- package/dist/core/ConfigurationService.js +477 -0
- package/dist/core/ConfigurationService.js.map +1 -0
- package/dist/core/ConsolidationService.d.ts +99 -0
- package/dist/core/ConsolidationService.js +341 -0
- package/dist/core/ConsolidationService.js.map +1 -0
- package/dist/core/InteractiveDisplayManager.d.ts +22 -0
- package/dist/core/InteractiveDisplayManager.js +70 -0
- package/dist/core/InteractiveDisplayManager.js.map +1 -0
- package/dist/core/OutputManager.d.ts +26 -0
- package/dist/core/OutputManager.js +217 -0
- package/dist/core/OutputManager.js.map +1 -0
- package/dist/core/ReviewGenerator.d.ts +13 -0
- package/dist/core/ReviewGenerator.js +102 -0
- package/dist/core/ReviewGenerator.js.map +1 -0
- package/dist/core/fileDiscovery.d.ts +35 -0
- package/dist/core/fileDiscovery.js +202 -0
- package/dist/core/fileDiscovery.js.map +1 -0
- package/dist/core/handlers/EstimationHandler.d.ts +18 -0
- package/dist/core/handlers/EstimationHandler.js +110 -0
- package/dist/core/handlers/EstimationHandler.js.map +1 -0
- package/dist/core/handlers/FileProcessingHandler.d.ts +31 -0
- package/dist/core/handlers/FileProcessingHandler.js +159 -0
- package/dist/core/handlers/FileProcessingHandler.js.map +1 -0
- package/dist/core/handlers/OutputHandler.d.ts +27 -0
- package/dist/core/handlers/OutputHandler.js +127 -0
- package/dist/core/handlers/OutputHandler.js.map +1 -0
- package/dist/core/handlers/ReviewExecutor.d.ts +32 -0
- package/dist/core/handlers/ReviewExecutor.js +111 -0
- package/dist/core/handlers/ReviewExecutor.js.map +1 -0
- package/dist/core/reviewOrchestrator.d.ts +24 -0
- package/dist/core/reviewOrchestrator.js +294 -0
- package/dist/core/reviewOrchestrator.js.map +1 -0
- package/dist/core/utils/ModelInfoUtils.d.ts +16 -0
- package/dist/core/utils/ModelInfoUtils.js +54 -0
- package/dist/core/utils/ModelInfoUtils.js.map +1 -0
- package/dist/formatters/outputFormatter.d.ts +31 -0
- package/dist/formatters/outputFormatter.js +65 -0
- package/dist/formatters/outputFormatter.js.map +1 -0
- package/dist/formatters/utils/IssueFormatters.d.ts +20 -0
- package/dist/formatters/utils/IssueFormatters.js +67 -0
- package/dist/formatters/utils/IssueFormatters.js.map +1 -0
- package/dist/formatters/utils/JsonFormatter.d.ts +13 -0
- package/dist/formatters/utils/JsonFormatter.js +57 -0
- package/dist/formatters/utils/JsonFormatter.js.map +1 -0
- package/dist/formatters/utils/MarkdownFormatters.d.ts +51 -0
- package/dist/formatters/utils/MarkdownFormatters.js +456 -0
- package/dist/formatters/utils/MarkdownFormatters.js.map +1 -0
- package/dist/formatters/utils/MetadataFormatter.d.ts +65 -0
- package/dist/formatters/utils/MetadataFormatter.js +219 -0
- package/dist/formatters/utils/MetadataFormatter.js.map +1 -0
- package/dist/formatters/utils/ModelInfoExtractor.d.ts +33 -0
- package/dist/formatters/utils/ModelInfoExtractor.js +111 -0
- package/dist/formatters/utils/ModelInfoExtractor.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/PluginInterface.d.ts +44 -0
- package/dist/plugins/PluginInterface.js +9 -0
- package/dist/plugins/PluginInterface.js.map +1 -0
- package/dist/plugins/PluginManager.d.ts +51 -0
- package/dist/plugins/PluginManager.js +151 -0
- package/dist/plugins/PluginManager.js.map +1 -0
- package/dist/prompts/PromptManager.d.ts +30 -0
- package/dist/prompts/PromptManager.js +62 -0
- package/dist/prompts/PromptManager.js.map +1 -0
- package/dist/prompts/cache/PromptCache.d.ts +32 -0
- package/dist/prompts/cache/PromptCache.js +48 -0
- package/dist/prompts/cache/PromptCache.js.map +1 -0
- package/dist/runtime/auth/service.d.ts +2 -0
- package/dist/runtime/auth/service.js +41 -0
- package/dist/runtime/auth/service.js.map +1 -0
- package/dist/runtime/auth/session.d.ts +5 -0
- package/dist/runtime/auth/session.js +87 -0
- package/dist/runtime/auth/session.js.map +1 -0
- package/dist/runtime/auth/types.d.ts +9 -0
- package/dist/runtime/auth/types.js +3 -0
- package/dist/runtime/auth/types.js.map +1 -0
- package/dist/runtime/cliEntry.d.ts +1 -0
- package/dist/runtime/cliEntry.js +213 -0
- package/dist/runtime/cliEntry.js.map +1 -0
- package/dist/runtime/debug/logManager.d.ts +5 -0
- package/dist/runtime/debug/logManager.js +31 -0
- package/dist/runtime/debug/logManager.js.map +1 -0
- package/dist/runtime/errors.d.ts +5 -0
- package/dist/runtime/errors.js +15 -0
- package/dist/runtime/errors.js.map +1 -0
- package/dist/runtime/fileCollector.d.ts +5 -0
- package/dist/runtime/fileCollector.js +167 -0
- package/dist/runtime/fileCollector.js.map +1 -0
- package/dist/runtime/manifest.d.ts +1 -0
- package/dist/runtime/manifest.js +65 -0
- package/dist/runtime/manifest.js.map +1 -0
- package/dist/runtime/openrouterProxy.d.ts +4 -0
- package/dist/runtime/openrouterProxy.js +43 -0
- package/dist/runtime/openrouterProxy.js.map +1 -0
- package/dist/runtime/preprod/webCheck.d.ts +1 -0
- package/dist/runtime/preprod/webCheck.js +98 -0
- package/dist/runtime/preprod/webCheck.js.map +1 -0
- package/dist/runtime/proxyConfig.d.ts +6 -0
- package/dist/runtime/proxyConfig.js +86 -0
- package/dist/runtime/proxyConfig.js.map +1 -0
- package/dist/runtime/proxyEnvironment.d.ts +3 -0
- package/dist/runtime/proxyEnvironment.js +63 -0
- package/dist/runtime/proxyEnvironment.js.map +1 -0
- package/dist/runtime/reportMerge.d.ts +30 -0
- package/dist/runtime/reportMerge.js +70 -0
- package/dist/runtime/reportMerge.js.map +1 -0
- package/dist/runtime/reporting/markdownReportBuilder.d.ts +15 -0
- package/dist/runtime/reporting/markdownReportBuilder.js +97 -0
- package/dist/runtime/reporting/markdownReportBuilder.js.map +1 -0
- package/dist/runtime/reporting/reportDataCollector.d.ts +31 -0
- package/dist/runtime/reporting/reportDataCollector.js +170 -0
- package/dist/runtime/reporting/reportDataCollector.js.map +1 -0
- package/dist/runtime/reporting/summaryGenerator.d.ts +10 -0
- package/dist/runtime/reporting/summaryGenerator.js +67 -0
- package/dist/runtime/reporting/summaryGenerator.js.map +1 -0
- package/dist/runtime/reviewPipeline.d.ts +28 -0
- package/dist/runtime/reviewPipeline.js +122 -0
- package/dist/runtime/reviewPipeline.js.map +1 -0
- package/dist/runtime/runAiCodeReview.d.ts +10 -0
- package/dist/runtime/runAiCodeReview.js +138 -0
- package/dist/runtime/runAiCodeReview.js.map +1 -0
- package/dist/runtime/runtimeConfig.d.ts +4 -0
- package/dist/runtime/runtimeConfig.js +7 -0
- package/dist/runtime/runtimeConfig.js.map +1 -0
- package/dist/runtime/ui/Layout.d.ts +11 -0
- package/dist/runtime/ui/Layout.js +47 -0
- package/dist/runtime/ui/Layout.js.map +1 -0
- package/dist/runtime/ui/RuntimeApp.d.ts +6 -0
- package/dist/runtime/ui/RuntimeApp.js +161 -0
- package/dist/runtime/ui/RuntimeApp.js.map +1 -0
- package/dist/runtime/ui/inkModules.d.ts +10 -0
- package/dist/runtime/ui/inkModules.js +63 -0
- package/dist/runtime/ui/inkModules.js.map +1 -0
- package/dist/runtime/ui/screens/AuthScreen.d.ts +6 -0
- package/dist/runtime/ui/screens/AuthScreen.js +67 -0
- package/dist/runtime/ui/screens/AuthScreen.js.map +1 -0
- package/dist/runtime/ui/screens/ModeSelection.d.ts +10 -0
- package/dist/runtime/ui/screens/ModeSelection.js +100 -0
- package/dist/runtime/ui/screens/ModeSelection.js.map +1 -0
- package/dist/runtime/ui/screens/ProgressScreen.d.ts +7 -0
- package/dist/runtime/ui/screens/ProgressScreen.js +38 -0
- package/dist/runtime/ui/screens/ProgressScreen.js.map +1 -0
- package/dist/runtime/ui/screens/ResultsScreen.d.ts +7 -0
- package/dist/runtime/ui/screens/ResultsScreen.js +22 -0
- package/dist/runtime/ui/screens/ResultsScreen.js.map +1 -0
- package/dist/strategies/ArchitecturalReviewStrategy.d.ts +29 -0
- package/dist/strategies/ArchitecturalReviewStrategy.js +42 -0
- package/dist/strategies/ArchitecturalReviewStrategy.js.map +1 -0
- package/dist/strategies/CodingTestReviewStrategy.d.ts +194 -0
- package/dist/strategies/CodingTestReviewStrategy.js +681 -0
- package/dist/strategies/CodingTestReviewStrategy.js.map +1 -0
- package/dist/strategies/ConsolidatedReviewStrategy.d.ts +25 -0
- package/dist/strategies/ConsolidatedReviewStrategy.js +45 -0
- package/dist/strategies/ConsolidatedReviewStrategy.js.map +1 -0
- package/dist/strategies/ExtractPatternsReviewStrategy.d.ts +30 -0
- package/dist/strategies/ExtractPatternsReviewStrategy.js +51 -0
- package/dist/strategies/ExtractPatternsReviewStrategy.js.map +1 -0
- package/dist/strategies/MultiPassReviewStrategy.d.ts +86 -0
- package/dist/strategies/MultiPassReviewStrategy.js +590 -0
- package/dist/strategies/MultiPassReviewStrategy.js.map +1 -0
- package/dist/strategies/ReviewStrategy.d.ts +45 -0
- package/dist/strategies/ReviewStrategy.js +24 -0
- package/dist/strategies/ReviewStrategy.js.map +1 -0
- package/dist/strategies/StrategyFactory.d.ts +19 -0
- package/dist/strategies/StrategyFactory.js +72 -0
- package/dist/strategies/StrategyFactory.js.map +1 -0
- package/dist/strategies/index.d.ts +13 -0
- package/dist/strategies/index.js +30 -0
- package/dist/strategies/index.js.map +1 -0
- package/dist/tokenizers/baseTokenizer.d.ts +25 -0
- package/dist/tokenizers/baseTokenizer.js +48 -0
- package/dist/tokenizers/baseTokenizer.js.map +1 -0
- package/dist/tokenizers/gptTokenizer.d.ts +7 -0
- package/dist/tokenizers/gptTokenizer.js +28 -0
- package/dist/tokenizers/gptTokenizer.js.map +1 -0
- package/dist/tokenizers/index.d.ts +7 -0
- package/dist/tokenizers/index.js +24 -0
- package/dist/tokenizers/index.js.map +1 -0
- package/dist/types/apiResponses.d.ts +39 -0
- package/dist/types/apiResponses.js +9 -0
- package/dist/types/apiResponses.js.map +1 -0
- package/dist/types/cli.d.ts +22 -0
- package/dist/types/cli.js +3 -0
- package/dist/types/cli.js.map +1 -0
- package/dist/types/common.d.ts +22 -0
- package/dist/types/common.js +14 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/configuration.d.ts +682 -0
- package/dist/types/configuration.js +65 -0
- package/dist/types/configuration.js.map +1 -0
- package/dist/types/review.d.ts +258 -0
- package/dist/types/review.js +8 -0
- package/dist/types/review.js.map +1 -0
- package/dist/types/reviewSchema.d.ts +543 -0
- package/dist/types/reviewSchema.js +121 -0
- package/dist/types/reviewSchema.js.map +1 -0
- package/dist/types/structuredReview.d.ts +119 -0
- package/dist/types/structuredReview.js +6 -0
- package/dist/types/structuredReview.js.map +1 -0
- package/dist/types/tokenAnalysis.d.ts +44 -0
- package/dist/types/tokenAnalysis.js +4 -0
- package/dist/types/tokenAnalysis.js.map +1 -0
- package/dist/utils/FileReader.d.ts +33 -0
- package/dist/utils/FileReader.js +88 -0
- package/dist/utils/FileReader.js.map +1 -0
- package/dist/utils/FileWriter.d.ts +26 -0
- package/dist/utils/FileWriter.js +76 -0
- package/dist/utils/FileWriter.js.map +1 -0
- package/dist/utils/PathGenerator.d.ts +30 -0
- package/dist/utils/PathGenerator.js +82 -0
- package/dist/utils/PathGenerator.js.map +1 -0
- package/dist/utils/api/apiUtils.d.ts +3 -0
- package/dist/utils/api/apiUtils.js +20 -0
- package/dist/utils/api/apiUtils.js.map +1 -0
- package/dist/utils/api/index.d.ts +1 -0
- package/dist/utils/api/index.js +18 -0
- package/dist/utils/api/index.js.map +1 -0
- package/dist/utils/apiErrorHandler.d.ts +130 -0
- package/dist/utils/apiErrorHandler.js +256 -0
- package/dist/utils/apiErrorHandler.js.map +1 -0
- package/dist/utils/ciDataCollector.d.ts +51 -0
- package/dist/utils/ciDataCollector.js +197 -0
- package/dist/utils/ciDataCollector.js.map +1 -0
- package/dist/utils/codingTestConfigLoader.d.ts +66 -0
- package/dist/utils/codingTestConfigLoader.js +420 -0
- package/dist/utils/codingTestConfigLoader.js.map +1 -0
- package/dist/utils/dependencies/aiDependencyAnalyzer.d.ts +30 -0
- package/dist/utils/dependencies/aiDependencyAnalyzer.js +343 -0
- package/dist/utils/dependencies/aiDependencyAnalyzer.js.map +1 -0
- package/dist/utils/detection/frameworkDetector.d.ts +43 -0
- package/dist/utils/detection/frameworkDetector.js +795 -0
- package/dist/utils/detection/frameworkDetector.js.map +1 -0
- package/dist/utils/detection/index.d.ts +9 -0
- package/dist/utils/detection/index.js +28 -0
- package/dist/utils/detection/index.js.map +1 -0
- package/dist/utils/detection/projectTypeDetector.d.ts +27 -0
- package/dist/utils/detection/projectTypeDetector.js +469 -0
- package/dist/utils/detection/projectTypeDetector.js.map +1 -0
- package/dist/utils/diagramGenerator.d.ts +49 -0
- package/dist/utils/diagramGenerator.js +218 -0
- package/dist/utils/diagramGenerator.js.map +1 -0
- package/dist/utils/errorLogger.d.ts +24 -0
- package/dist/utils/errorLogger.js +59 -0
- package/dist/utils/errorLogger.js.map +1 -0
- package/dist/utils/estimationUtils.d.ts +139 -0
- package/dist/utils/estimationUtils.js +329 -0
- package/dist/utils/estimationUtils.js.map +1 -0
- package/dist/utils/fileFilters.d.ts +72 -0
- package/dist/utils/fileFilters.js +338 -0
- package/dist/utils/fileFilters.js.map +1 -0
- package/dist/utils/fileSystem.d.ts +22 -0
- package/dist/utils/fileSystem.js +45 -0
- package/dist/utils/fileSystem.js.map +1 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/index.js +52 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +77 -0
- package/dist/utils/logger.js +271 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/pathValidator.d.ts +40 -0
- package/dist/utils/pathValidator.js +98 -0
- package/dist/utils/pathValidator.js.map +1 -0
- package/dist/utils/priorityFilter.d.ts +34 -0
- package/dist/utils/priorityFilter.js +54 -0
- package/dist/utils/priorityFilter.js.map +1 -0
- package/dist/utils/projectDocs.d.ts +47 -0
- package/dist/utils/projectDocs.js +158 -0
- package/dist/utils/projectDocs.js.map +1 -0
- package/dist/utils/promptPaths.d.ts +6 -0
- package/dist/utils/promptPaths.js +33 -0
- package/dist/utils/promptPaths.js.map +1 -0
- package/dist/utils/promptTemplateManager.d.ts +34 -0
- package/dist/utils/promptTemplateManager.js +140 -0
- package/dist/utils/promptTemplateManager.js.map +1 -0
- package/dist/utils/review/consolidateReview.d.ts +15 -0
- package/dist/utils/review/consolidateReview.js +481 -0
- package/dist/utils/review/consolidateReview.js.map +1 -0
- package/dist/utils/review/fixDisplay.d.ts +20 -0
- package/dist/utils/review/fixDisplay.js +84 -0
- package/dist/utils/review/fixDisplay.js.map +1 -0
- package/dist/utils/review/fixImplementation.d.ts +28 -0
- package/dist/utils/review/fixImplementation.js +60 -0
- package/dist/utils/review/fixImplementation.js.map +1 -0
- package/dist/utils/review/index.d.ts +13 -0
- package/dist/utils/review/index.js +50 -0
- package/dist/utils/review/index.js.map +1 -0
- package/dist/utils/review/interactiveProcessing.d.ts +25 -0
- package/dist/utils/review/interactiveProcessing.js +251 -0
- package/dist/utils/review/interactiveProcessing.js.map +1 -0
- package/dist/utils/review/progressTracker.d.ts +106 -0
- package/dist/utils/review/progressTracker.js +227 -0
- package/dist/utils/review/progressTracker.js.map +1 -0
- package/dist/utils/review/reviewExtraction.d.ts +31 -0
- package/dist/utils/review/reviewExtraction.js +324 -0
- package/dist/utils/review/reviewExtraction.js.map +1 -0
- package/dist/utils/review/types.d.ts +45 -0
- package/dist/utils/review/types.js +18 -0
- package/dist/utils/review/types.js.map +1 -0
- package/dist/utils/reviewActionHandler.d.ts +16 -0
- package/dist/utils/reviewActionHandler.js +34 -0
- package/dist/utils/reviewActionHandler.js.map +1 -0
- package/dist/utils/reviewParser.d.ts +34 -0
- package/dist/utils/reviewParser.js +218 -0
- package/dist/utils/reviewParser.js.map +1 -0
- package/dist/utils/sanitizer.d.ts +82 -0
- package/dist/utils/sanitizer.js +239 -0
- package/dist/utils/sanitizer.js.map +1 -0
- package/dist/utils/smartFileSelector.d.ts +50 -0
- package/dist/utils/smartFileSelector.js +261 -0
- package/dist/utils/smartFileSelector.js.map +1 -0
- package/dist/utils/templateLoader.d.ts +44 -0
- package/dist/utils/templateLoader.js +431 -0
- package/dist/utils/templateLoader.js.map +1 -0
- package/dist/utils/treeGenerator.d.ts +12 -0
- package/dist/utils/treeGenerator.js +133 -0
- package/dist/utils/treeGenerator.js.map +1 -0
- package/package.json +11 -12
- package/src/index.ts +1 -0
- package/src/runtime/debug/logManager.ts +37 -0
- package/src/runtime/fileCollector.ts +58 -24
- package/src/runtime/preprod/webCheck.ts +104 -0
- package/src/runtime/reviewPipeline.ts +10 -4
- package/src/runtime/ui/RuntimeApp.tsx +96 -13
- package/src/runtime/ui/screens/ModeSelection.tsx +148 -15
- package/src/runtime/ui/screens/ProgressScreen.tsx +10 -3
- package/src/runtime/ui/screens/ResultsScreen.tsx +8 -1
- package/src/utils/logger.ts +64 -14
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview API error handling utilities.
|
|
3
|
+
*
|
|
4
|
+
* This module provides standardized error handling for API calls,
|
|
5
|
+
* including custom error classes for different types of API errors,
|
|
6
|
+
* utility functions for handling fetch responses, and logging helpers.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Base class for API errors
|
|
10
|
+
*
|
|
11
|
+
* This class extends the standard Error class to provide additional context
|
|
12
|
+
* for API-related errors. It includes properties for the HTTP status code
|
|
13
|
+
* and additional error details from the API response.
|
|
14
|
+
*
|
|
15
|
+
* All specific API error types (like AuthenticationError, RateLimitError, etc.)
|
|
16
|
+
* extend this base class to provide a consistent error handling interface.
|
|
17
|
+
*/
|
|
18
|
+
export declare class ApiError extends Error {
|
|
19
|
+
statusCode?: number | undefined;
|
|
20
|
+
details?: unknown | undefined;
|
|
21
|
+
constructor(message: string, statusCode?: number | undefined, details?: unknown | undefined);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error thrown when API rate limits are exceeded
|
|
25
|
+
*/
|
|
26
|
+
export declare class RateLimitError extends ApiError {
|
|
27
|
+
retryAfter?: number | undefined;
|
|
28
|
+
constructor(message: string, retryAfter?: number | undefined, statusCode?: number, details?: unknown);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Error thrown when authentication fails
|
|
32
|
+
*/
|
|
33
|
+
export declare class AuthenticationError extends ApiError {
|
|
34
|
+
constructor(message: string, statusCode?: number, details?: unknown);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Error thrown when a resource is not found
|
|
38
|
+
*/
|
|
39
|
+
export declare class NotFoundError extends ApiError {
|
|
40
|
+
constructor(message: string, statusCode?: number, details?: unknown);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Error thrown when the API returns an invalid response format
|
|
44
|
+
*/
|
|
45
|
+
export declare class InvalidResponseError extends ApiError {
|
|
46
|
+
constructor(message: string, statusCode?: number, details?: unknown);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Error thrown when token limit is exceeded
|
|
50
|
+
*/
|
|
51
|
+
export declare class TokenLimitError extends ApiError {
|
|
52
|
+
tokenCount?: number | undefined;
|
|
53
|
+
tokenLimit?: number | undefined;
|
|
54
|
+
constructor(message: string, tokenCount?: number | undefined, tokenLimit?: number | undefined, statusCode?: number, details?: unknown);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Handle a fetch response and throw appropriate errors if needed
|
|
58
|
+
*
|
|
59
|
+
* This function processes a fetch response and throws appropriate error types
|
|
60
|
+
* based on the HTTP status code and response body. It handles common API error
|
|
61
|
+
* scenarios like authentication failures, rate limiting, and resource not found.
|
|
62
|
+
*
|
|
63
|
+
* The function attempts to parse the response body as JSON if possible, or falls
|
|
64
|
+
* back to text if not. It then constructs an appropriate error object with
|
|
65
|
+
* detailed information about what went wrong.
|
|
66
|
+
*
|
|
67
|
+
* @param response The fetch response object from an API call
|
|
68
|
+
* @param apiName The name of the API being called (for logging and error messages)
|
|
69
|
+
* @returns The original response object if the response is ok (status 200-299)
|
|
70
|
+
* @throws AuthenticationError for 401/403 status codes (authentication/authorization issues)
|
|
71
|
+
* @throws NotFoundError for 404 status codes (resource not found)
|
|
72
|
+
* @throws RateLimitError for 429 status codes (rate limit exceeded)
|
|
73
|
+
* @throws ApiError for all other error status codes
|
|
74
|
+
* @example
|
|
75
|
+
* try {
|
|
76
|
+
* const response = await fetch('https://api.example.com/data');
|
|
77
|
+
* await handleFetchResponse(response, 'ExampleAPI');
|
|
78
|
+
* // Process successful response
|
|
79
|
+
* } catch (error) {
|
|
80
|
+
* // Error is already logged and has the appropriate type
|
|
81
|
+
* if (error instanceof RateLimitError) {
|
|
82
|
+
* // Handle rate limiting specifically
|
|
83
|
+
* }
|
|
84
|
+
* }
|
|
85
|
+
*/
|
|
86
|
+
export declare function handleFetchResponse(response: Response, apiName: string): Promise<Response>;
|
|
87
|
+
/**
|
|
88
|
+
* Safely parse JSON from a response
|
|
89
|
+
* @param response The fetch response object
|
|
90
|
+
* @param apiName The name of the API being called (for logging)
|
|
91
|
+
* @returns The parsed JSON data
|
|
92
|
+
* @throws InvalidResponseError if the response cannot be parsed as JSON
|
|
93
|
+
*/
|
|
94
|
+
export declare function safeJsonParse<T>(response: Response | any, apiName: string): Promise<T>;
|
|
95
|
+
/**
|
|
96
|
+
* Log an API error with appropriate context and formatting
|
|
97
|
+
*
|
|
98
|
+
* This function logs API errors with rich context information to help with debugging
|
|
99
|
+
* and troubleshooting. It detects the specific type of error and formats the log
|
|
100
|
+
* message accordingly, providing different information based on the error type.
|
|
101
|
+
*
|
|
102
|
+
* The function handles various error types including:
|
|
103
|
+
* - Rate limit errors (with retry information)
|
|
104
|
+
* - Authentication errors
|
|
105
|
+
* - Resource not found errors
|
|
106
|
+
* - Invalid response errors
|
|
107
|
+
* - General API errors
|
|
108
|
+
* - Unexpected errors
|
|
109
|
+
*
|
|
110
|
+
* @param error The error object that was thrown
|
|
111
|
+
* @param context Object containing context information:
|
|
112
|
+
* - apiName: The name of the API service (e.g., 'OpenAI', 'Anthropic')
|
|
113
|
+
* - operation: The operation being performed (e.g., 'generating review')
|
|
114
|
+
* - url: Optional URL for the request that failed
|
|
115
|
+
* @example
|
|
116
|
+
* try {
|
|
117
|
+
* // API call that might fail
|
|
118
|
+
* } catch (error) {
|
|
119
|
+
* logApiError(error, {
|
|
120
|
+
* apiName: 'OpenAI',
|
|
121
|
+
* operation: 'generating code review',
|
|
122
|
+
* url: 'https://api.openai.com/v1/chat/completions'
|
|
123
|
+
* });
|
|
124
|
+
* }
|
|
125
|
+
*/
|
|
126
|
+
export declare function logApiError(error: unknown, context: {
|
|
127
|
+
operation: string;
|
|
128
|
+
url?: string;
|
|
129
|
+
apiName: string;
|
|
130
|
+
}): void;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview API error handling utilities.
|
|
4
|
+
*
|
|
5
|
+
* This module provides standardized error handling for API calls,
|
|
6
|
+
* including custom error classes for different types of API errors,
|
|
7
|
+
* utility functions for handling fetch responses, and logging helpers.
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.TokenLimitError = exports.InvalidResponseError = exports.NotFoundError = exports.AuthenticationError = exports.RateLimitError = exports.ApiError = void 0;
|
|
14
|
+
exports.handleFetchResponse = handleFetchResponse;
|
|
15
|
+
exports.safeJsonParse = safeJsonParse;
|
|
16
|
+
exports.logApiError = logApiError;
|
|
17
|
+
const logger_1 = __importDefault(require("./logger"));
|
|
18
|
+
/**
|
|
19
|
+
* Base class for API errors
|
|
20
|
+
*
|
|
21
|
+
* This class extends the standard Error class to provide additional context
|
|
22
|
+
* for API-related errors. It includes properties for the HTTP status code
|
|
23
|
+
* and additional error details from the API response.
|
|
24
|
+
*
|
|
25
|
+
* All specific API error types (like AuthenticationError, RateLimitError, etc.)
|
|
26
|
+
* extend this base class to provide a consistent error handling interface.
|
|
27
|
+
*/
|
|
28
|
+
class ApiError extends Error {
|
|
29
|
+
statusCode;
|
|
30
|
+
details;
|
|
31
|
+
constructor(message, statusCode, details) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.statusCode = statusCode;
|
|
34
|
+
this.details = details;
|
|
35
|
+
this.name = 'ApiError';
|
|
36
|
+
// Ensure instanceof works correctly in ES5
|
|
37
|
+
Object.setPrototypeOf(this, ApiError.prototype);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ApiError = ApiError;
|
|
41
|
+
/**
|
|
42
|
+
* Error thrown when API rate limits are exceeded
|
|
43
|
+
*/
|
|
44
|
+
class RateLimitError extends ApiError {
|
|
45
|
+
retryAfter;
|
|
46
|
+
constructor(message, retryAfter, statusCode, details) {
|
|
47
|
+
super(message, statusCode, details);
|
|
48
|
+
this.retryAfter = retryAfter;
|
|
49
|
+
this.name = 'RateLimitError';
|
|
50
|
+
// Ensure instanceof works correctly in ES5
|
|
51
|
+
Object.setPrototypeOf(this, RateLimitError.prototype);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.RateLimitError = RateLimitError;
|
|
55
|
+
/**
|
|
56
|
+
* Error thrown when authentication fails
|
|
57
|
+
*/
|
|
58
|
+
class AuthenticationError extends ApiError {
|
|
59
|
+
constructor(message, statusCode, details) {
|
|
60
|
+
super(message, statusCode, details);
|
|
61
|
+
this.name = 'AuthenticationError';
|
|
62
|
+
// Ensure instanceof works correctly in ES5
|
|
63
|
+
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.AuthenticationError = AuthenticationError;
|
|
67
|
+
/**
|
|
68
|
+
* Error thrown when a resource is not found
|
|
69
|
+
*/
|
|
70
|
+
class NotFoundError extends ApiError {
|
|
71
|
+
constructor(message, statusCode, details) {
|
|
72
|
+
super(message, statusCode, details);
|
|
73
|
+
this.name = 'NotFoundError';
|
|
74
|
+
// Ensure instanceof works correctly in ES5
|
|
75
|
+
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.NotFoundError = NotFoundError;
|
|
79
|
+
/**
|
|
80
|
+
* Error thrown when the API returns an invalid response format
|
|
81
|
+
*/
|
|
82
|
+
class InvalidResponseError extends ApiError {
|
|
83
|
+
constructor(message, statusCode, details) {
|
|
84
|
+
super(message, statusCode, details);
|
|
85
|
+
this.name = 'InvalidResponseError';
|
|
86
|
+
// Ensure instanceof works correctly in ES5
|
|
87
|
+
Object.setPrototypeOf(this, InvalidResponseError.prototype);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.InvalidResponseError = InvalidResponseError;
|
|
91
|
+
/**
|
|
92
|
+
* Error thrown when token limit is exceeded
|
|
93
|
+
*/
|
|
94
|
+
class TokenLimitError extends ApiError {
|
|
95
|
+
tokenCount;
|
|
96
|
+
tokenLimit;
|
|
97
|
+
constructor(message, tokenCount, tokenLimit, statusCode, details) {
|
|
98
|
+
super(message, statusCode, details);
|
|
99
|
+
this.tokenCount = tokenCount;
|
|
100
|
+
this.tokenLimit = tokenLimit;
|
|
101
|
+
this.name = 'TokenLimitError';
|
|
102
|
+
// Ensure instanceof works correctly in ES5
|
|
103
|
+
Object.setPrototypeOf(this, TokenLimitError.prototype);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.TokenLimitError = TokenLimitError;
|
|
107
|
+
/**
|
|
108
|
+
* Handle a fetch response and throw appropriate errors if needed
|
|
109
|
+
*
|
|
110
|
+
* This function processes a fetch response and throws appropriate error types
|
|
111
|
+
* based on the HTTP status code and response body. It handles common API error
|
|
112
|
+
* scenarios like authentication failures, rate limiting, and resource not found.
|
|
113
|
+
*
|
|
114
|
+
* The function attempts to parse the response body as JSON if possible, or falls
|
|
115
|
+
* back to text if not. It then constructs an appropriate error object with
|
|
116
|
+
* detailed information about what went wrong.
|
|
117
|
+
*
|
|
118
|
+
* @param response The fetch response object from an API call
|
|
119
|
+
* @param apiName The name of the API being called (for logging and error messages)
|
|
120
|
+
* @returns The original response object if the response is ok (status 200-299)
|
|
121
|
+
* @throws AuthenticationError for 401/403 status codes (authentication/authorization issues)
|
|
122
|
+
* @throws NotFoundError for 404 status codes (resource not found)
|
|
123
|
+
* @throws RateLimitError for 429 status codes (rate limit exceeded)
|
|
124
|
+
* @throws ApiError for all other error status codes
|
|
125
|
+
* @example
|
|
126
|
+
* try {
|
|
127
|
+
* const response = await fetch('https://api.example.com/data');
|
|
128
|
+
* await handleFetchResponse(response, 'ExampleAPI');
|
|
129
|
+
* // Process successful response
|
|
130
|
+
* } catch (error) {
|
|
131
|
+
* // Error is already logged and has the appropriate type
|
|
132
|
+
* if (error instanceof RateLimitError) {
|
|
133
|
+
* // Handle rate limiting specifically
|
|
134
|
+
* }
|
|
135
|
+
* }
|
|
136
|
+
*/
|
|
137
|
+
async function handleFetchResponse(response, apiName) {
|
|
138
|
+
if (!response.ok) {
|
|
139
|
+
// Try to get the error body
|
|
140
|
+
let errorBody = 'Unknown error';
|
|
141
|
+
try {
|
|
142
|
+
// Clone the response so we can read it multiple times if needed
|
|
143
|
+
// const clonedResponse = response.clone();
|
|
144
|
+
// Log all headers for debugging
|
|
145
|
+
console.log(`[DEBUG] ${apiName} API response headers:`);
|
|
146
|
+
response.headers.forEach((value, name) => {
|
|
147
|
+
console.log(`[DEBUG] ${name}: ${value}`);
|
|
148
|
+
});
|
|
149
|
+
// Try to parse as JSON first
|
|
150
|
+
const contentType = response.headers.get('content-type');
|
|
151
|
+
console.log(`[DEBUG] Content-Type: ${contentType}`);
|
|
152
|
+
if (contentType?.includes('application/json')) {
|
|
153
|
+
errorBody = await response.json();
|
|
154
|
+
console.log(`[DEBUG] JSON error body: ${JSON.stringify(errorBody)}`);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
errorBody = await response.text();
|
|
158
|
+
console.log(`[DEBUG] Text error body: ${errorBody}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
// Log body read errors
|
|
163
|
+
console.log(`[DEBUG] Failed to read error body: ${e instanceof Error ? e.message : String(e)}`);
|
|
164
|
+
logger_1.default.debug(`Failed to read error body: ${e instanceof Error ? e.message : String(e)}`);
|
|
165
|
+
}
|
|
166
|
+
// Create appropriate error based on status code
|
|
167
|
+
const errorMessage = `${apiName} API error! Status: ${response.status}, Response: ${typeof errorBody === 'string' ? errorBody : JSON.stringify(errorBody)}`;
|
|
168
|
+
// Log the error
|
|
169
|
+
logger_1.default.error(errorMessage);
|
|
170
|
+
// Throw appropriate error based on status code
|
|
171
|
+
if (response.status === 401 || response.status === 403) {
|
|
172
|
+
throw new AuthenticationError(errorMessage, response.status, errorBody);
|
|
173
|
+
}
|
|
174
|
+
if (response.status === 404) {
|
|
175
|
+
throw new NotFoundError(errorMessage, response.status, errorBody);
|
|
176
|
+
}
|
|
177
|
+
if (response.status === 429) {
|
|
178
|
+
// Check for retry-after header
|
|
179
|
+
const retryAfter = response.headers.get('retry-after');
|
|
180
|
+
const retryAfterSeconds = retryAfter ? parseInt(retryAfter, 10) : undefined;
|
|
181
|
+
throw new RateLimitError(errorMessage, retryAfterSeconds, response.status, errorBody);
|
|
182
|
+
}
|
|
183
|
+
throw new ApiError(errorMessage, response.status, errorBody);
|
|
184
|
+
}
|
|
185
|
+
return response;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Safely parse JSON from a response
|
|
189
|
+
* @param response The fetch response object
|
|
190
|
+
* @param apiName The name of the API being called (for logging)
|
|
191
|
+
* @returns The parsed JSON data
|
|
192
|
+
* @throws InvalidResponseError if the response cannot be parsed as JSON
|
|
193
|
+
*/
|
|
194
|
+
async function safeJsonParse(response, apiName) {
|
|
195
|
+
try {
|
|
196
|
+
return (await response.json());
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
const errorMessage = `Failed to parse ${apiName} API response as JSON: ${error instanceof Error ? error.message : String(error)}`;
|
|
200
|
+
logger_1.default.error(errorMessage);
|
|
201
|
+
throw new InvalidResponseError(errorMessage);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Log an API error with appropriate context and formatting
|
|
206
|
+
*
|
|
207
|
+
* This function logs API errors with rich context information to help with debugging
|
|
208
|
+
* and troubleshooting. It detects the specific type of error and formats the log
|
|
209
|
+
* message accordingly, providing different information based on the error type.
|
|
210
|
+
*
|
|
211
|
+
* The function handles various error types including:
|
|
212
|
+
* - Rate limit errors (with retry information)
|
|
213
|
+
* - Authentication errors
|
|
214
|
+
* - Resource not found errors
|
|
215
|
+
* - Invalid response errors
|
|
216
|
+
* - General API errors
|
|
217
|
+
* - Unexpected errors
|
|
218
|
+
*
|
|
219
|
+
* @param error The error object that was thrown
|
|
220
|
+
* @param context Object containing context information:
|
|
221
|
+
* - apiName: The name of the API service (e.g., 'OpenAI', 'Anthropic')
|
|
222
|
+
* - operation: The operation being performed (e.g., 'generating review')
|
|
223
|
+
* - url: Optional URL for the request that failed
|
|
224
|
+
* @example
|
|
225
|
+
* try {
|
|
226
|
+
* // API call that might fail
|
|
227
|
+
* } catch (error) {
|
|
228
|
+
* logApiError(error, {
|
|
229
|
+
* apiName: 'OpenAI',
|
|
230
|
+
* operation: 'generating code review',
|
|
231
|
+
* url: 'https://api.openai.com/v1/chat/completions'
|
|
232
|
+
* });
|
|
233
|
+
* }
|
|
234
|
+
*/
|
|
235
|
+
function logApiError(error, context) {
|
|
236
|
+
const { operation, url, apiName } = context;
|
|
237
|
+
if (error instanceof RateLimitError) {
|
|
238
|
+
logger_1.default.warn(`Rate limit exceeded for ${apiName} API during ${operation}${url ? ` (${url})` : ''}. Retry after: ${error.retryAfter || 'unknown'} seconds.`);
|
|
239
|
+
}
|
|
240
|
+
else if (error instanceof AuthenticationError) {
|
|
241
|
+
logger_1.default.error(`Authentication failed for ${apiName} API during ${operation}${url ? ` (${url})` : ''}. Check your API key.`);
|
|
242
|
+
}
|
|
243
|
+
else if (error instanceof NotFoundError) {
|
|
244
|
+
logger_1.default.error(`Resource not found on ${apiName} API during ${operation}${url ? ` (${url})` : ''}. Check your request parameters.`);
|
|
245
|
+
}
|
|
246
|
+
else if (error instanceof InvalidResponseError) {
|
|
247
|
+
logger_1.default.error(`Invalid response from ${apiName} API during ${operation}${url ? ` (${url})` : ''}. The API may have changed or returned an unexpected format.`);
|
|
248
|
+
}
|
|
249
|
+
else if (error instanceof ApiError) {
|
|
250
|
+
logger_1.default.error(`API error from ${apiName} during ${operation}${url ? ` (${url})` : ''}: ${error.message}`);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
logger_1.default.error(`Unexpected error during ${apiName} API ${operation}${url ? ` (${url})` : ''}: ${error instanceof Error ? error.message : String(error)}`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=apiErrorHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiErrorHandler.js","sourceRoot":"","sources":["../../src/utils/apiErrorHandler.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAgIH,kDA2DC;AASD,sCAUC;AAiCD,kCAyCC;AAtRD,sDAA8B;AAE9B;;;;;;;;;GASG;AACH,MAAa,QAAS,SAAQ,KAAK;IAGxB;IACA;IAHT,YACE,OAAe,EACR,UAAmB,EACnB,OAAiB;QAExB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,eAAU,GAAV,UAAU,CAAS;QACnB,YAAO,GAAP,OAAO,CAAU;QAGxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,2CAA2C;QAC3C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;CACF;AAXD,4BAWC;AAED;;GAEG;AACH,MAAa,cAAe,SAAQ,QAAQ;IAGjC;IAFT,YACE,OAAe,EACR,UAAmB,EAC1B,UAAmB,EACnB,OAAiB;QAEjB,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QAJ7B,eAAU,GAAV,UAAU,CAAS;QAK1B,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,2CAA2C;QAC3C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACF;AAZD,wCAYC;AAED;;GAEG;AACH,MAAa,mBAAoB,SAAQ,QAAQ;IAC/C,YAAY,OAAe,EAAE,UAAmB,EAAE,OAAiB;QACjE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1C,gBAAM,CAAC,KAAK,CACV,yBAAyB,OAAO,eAAe,SAAS,GACtD,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,EACtB,kCAAkC,CACnC,CAAC;IACJ,CAAC;SAAM,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;QACjD,gBAAM,CAAC,KAAK,CACV,yBAAyB,OAAO,eAAe,SAAS,GACtD,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,EACtB,8DAA8D,CAC/D,CAAC;IACJ,CAAC;SAAM,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;QACrC,gBAAM,CAAC,KAAK,CACV,kBAAkB,OAAO,WAAW,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,OAAO,EAAE,CAC3F,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,gBAAM,CAAC,KAAK,CACV,2BAA2B,OAAO,QAAQ,SAAS,GACjD,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,EACtB,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CI/CD data collector utility.
|
|
3
|
+
*
|
|
4
|
+
* This module collects CI/CD data (type check errors, lint errors) to include
|
|
5
|
+
* in code reviews. It supports both project-wide and per-file analysis.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* CI data structure
|
|
9
|
+
*/
|
|
10
|
+
export interface CIData {
|
|
11
|
+
/**
|
|
12
|
+
* Number of type check errors
|
|
13
|
+
*/
|
|
14
|
+
typeCheckErrors?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Number of lint errors
|
|
17
|
+
*/
|
|
18
|
+
lintErrors?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Raw type check output
|
|
21
|
+
*/
|
|
22
|
+
typeCheckOutput?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Raw lint output
|
|
25
|
+
*/
|
|
26
|
+
lintOutput?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Per-file error counts
|
|
29
|
+
*/
|
|
30
|
+
fileErrors?: {
|
|
31
|
+
[filePath: string]: {
|
|
32
|
+
typeCheckErrors: number;
|
|
33
|
+
lintErrors: number;
|
|
34
|
+
typeCheckMessages?: string[];
|
|
35
|
+
lintMessages?: string[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Collect CI/CD data for the current project
|
|
41
|
+
* @param projectPath Path to the project root
|
|
42
|
+
* @returns Promise resolving to CI data
|
|
43
|
+
*/
|
|
44
|
+
export declare function collectCIData(projectPath: string): Promise<CIData>;
|
|
45
|
+
/**
|
|
46
|
+
* Format CI data for inclusion in prompts
|
|
47
|
+
* @param ciData CI data to format
|
|
48
|
+
* @param specificFile Optional specific file to focus on
|
|
49
|
+
* @returns Formatted string for prompt inclusion
|
|
50
|
+
*/
|
|
51
|
+
export declare function formatCIDataForPrompt(ciData: CIData, specificFile?: string): string;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview CI/CD data collector utility.
|
|
4
|
+
*
|
|
5
|
+
* This module collects CI/CD data (type check errors, lint errors) to include
|
|
6
|
+
* in code reviews. It supports both project-wide and per-file analysis.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.collectCIData = collectCIData;
|
|
13
|
+
exports.formatCIDataForPrompt = formatCIDataForPrompt;
|
|
14
|
+
const node_child_process_1 = require("node:child_process");
|
|
15
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
+
const node_util_1 = require("node:util");
|
|
17
|
+
const logger_1 = __importDefault(require("./logger"));
|
|
18
|
+
const execAsync = (0, node_util_1.promisify)(node_child_process_1.exec);
|
|
19
|
+
/**
|
|
20
|
+
* Collect CI/CD data for the current project
|
|
21
|
+
* @param projectPath Path to the project root
|
|
22
|
+
* @returns Promise resolving to CI data
|
|
23
|
+
*/
|
|
24
|
+
async function collectCIData(projectPath) {
|
|
25
|
+
const ciData = {
|
|
26
|
+
fileErrors: {},
|
|
27
|
+
};
|
|
28
|
+
// Collect type check errors
|
|
29
|
+
try {
|
|
30
|
+
logger_1.default.info('Running type check to collect error count...');
|
|
31
|
+
const { stdout, stderr } = await execAsync('npm run build:types', {
|
|
32
|
+
cwd: projectPath,
|
|
33
|
+
env: { ...process.env, CI: 'true' },
|
|
34
|
+
});
|
|
35
|
+
ciData.typeCheckOutput = stdout + stderr;
|
|
36
|
+
parseTypeCheckErrors(ciData.typeCheckOutput, ciData, projectPath);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
// Type check failed - extract error count from output
|
|
40
|
+
const output = error.stdout + error.stderr;
|
|
41
|
+
ciData.typeCheckOutput = output;
|
|
42
|
+
parseTypeCheckErrors(output, ciData, projectPath);
|
|
43
|
+
}
|
|
44
|
+
// Collect lint errors
|
|
45
|
+
try {
|
|
46
|
+
logger_1.default.info('Running lint to collect error count...');
|
|
47
|
+
const { stdout, stderr } = await execAsync('npm run lint', {
|
|
48
|
+
cwd: projectPath,
|
|
49
|
+
env: { ...process.env, CI: 'true' },
|
|
50
|
+
});
|
|
51
|
+
ciData.lintOutput = stdout + stderr;
|
|
52
|
+
parseLintErrors(ciData.lintOutput, ciData, projectPath);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// Lint failed - extract error count from output
|
|
56
|
+
const output = error.stdout + error.stderr;
|
|
57
|
+
ciData.lintOutput = output;
|
|
58
|
+
parseLintErrors(output, ciData, projectPath);
|
|
59
|
+
}
|
|
60
|
+
// Calculate totals
|
|
61
|
+
calculateTotals(ciData);
|
|
62
|
+
return ciData;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Parse TypeScript errors from output
|
|
66
|
+
*/
|
|
67
|
+
function parseTypeCheckErrors(output, ciData, projectPath) {
|
|
68
|
+
const lines = output.split('\n');
|
|
69
|
+
for (const line of lines) {
|
|
70
|
+
// TypeScript error format: src/file.ts(line,col): error TS2322: ...
|
|
71
|
+
const match = line.match(/^(.+?)\((\d+),(\d+)\): error (TS\d+): (.+)$/);
|
|
72
|
+
if (match) {
|
|
73
|
+
const [, file, lineNum, colNum, errorCode, message] = match;
|
|
74
|
+
const relativeFile = node_path_1.default.relative(projectPath, file);
|
|
75
|
+
if (!ciData.fileErrors?.[relativeFile]) {
|
|
76
|
+
ciData.fileErrors[relativeFile] = {
|
|
77
|
+
typeCheckErrors: 0,
|
|
78
|
+
lintErrors: 0,
|
|
79
|
+
typeCheckMessages: [],
|
|
80
|
+
lintMessages: [],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const fileError = ciData.fileErrors?.[relativeFile];
|
|
84
|
+
if (fileError) {
|
|
85
|
+
fileError.typeCheckErrors++;
|
|
86
|
+
fileError.typeCheckMessages?.push(`Line ${lineNum}:${colNum} - ${errorCode}: ${message}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Parse ESLint errors from output
|
|
93
|
+
*/
|
|
94
|
+
function parseLintErrors(output, ciData, projectPath) {
|
|
95
|
+
const lines = output.split('\n');
|
|
96
|
+
let currentFile = null;
|
|
97
|
+
for (const line of lines) {
|
|
98
|
+
// ESLint file header format: /path/to/file.ts
|
|
99
|
+
if (line.match(/^[/\\]/)) {
|
|
100
|
+
currentFile = node_path_1.default.relative(projectPath, line.trim());
|
|
101
|
+
if (!ciData.fileErrors?.[currentFile]) {
|
|
102
|
+
ciData.fileErrors[currentFile] = {
|
|
103
|
+
typeCheckErrors: 0,
|
|
104
|
+
lintErrors: 0,
|
|
105
|
+
typeCheckMessages: [],
|
|
106
|
+
lintMessages: [],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// ESLint error format: line:col error message rule-name
|
|
111
|
+
else if (currentFile && line.match(/^\s*\d+:\d+\s+error\s+/)) {
|
|
112
|
+
const match = line.match(/^\s*(\d+):(\d+)\s+error\s+(.+?)\s+(.+)$/);
|
|
113
|
+
if (match) {
|
|
114
|
+
const [, lineNum, colNum, message, rule] = match;
|
|
115
|
+
const fileError = ciData.fileErrors?.[currentFile];
|
|
116
|
+
if (fileError) {
|
|
117
|
+
fileError.lintErrors++;
|
|
118
|
+
fileError.lintMessages?.push(`Line ${lineNum}:${colNum} - ${message} (${rule})`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Calculate total error counts from per-file data
|
|
126
|
+
*/
|
|
127
|
+
function calculateTotals(ciData) {
|
|
128
|
+
let totalTypeCheckErrors = 0;
|
|
129
|
+
let totalLintErrors = 0;
|
|
130
|
+
for (const fileData of Object.values(ciData.fileErrors || {})) {
|
|
131
|
+
totalTypeCheckErrors += fileData.typeCheckErrors;
|
|
132
|
+
totalLintErrors += fileData.lintErrors;
|
|
133
|
+
}
|
|
134
|
+
ciData.typeCheckErrors = totalTypeCheckErrors;
|
|
135
|
+
ciData.lintErrors = totalLintErrors;
|
|
136
|
+
logger_1.default.info(`Found ${totalTypeCheckErrors} type check errors and ${totalLintErrors} lint errors across all files`);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Format CI data for inclusion in prompts
|
|
140
|
+
* @param ciData CI data to format
|
|
141
|
+
* @param specificFile Optional specific file to focus on
|
|
142
|
+
* @returns Formatted string for prompt inclusion
|
|
143
|
+
*/
|
|
144
|
+
function formatCIDataForPrompt(ciData, specificFile) {
|
|
145
|
+
const lines = [];
|
|
146
|
+
lines.push('## CI/CD Status');
|
|
147
|
+
lines.push('');
|
|
148
|
+
// Overall summary
|
|
149
|
+
lines.push(`- Total TypeScript errors: ${ciData.typeCheckErrors || 0}`);
|
|
150
|
+
lines.push(`- Total ESLint errors: ${ciData.lintErrors || 0}`);
|
|
151
|
+
// Per-file data
|
|
152
|
+
if (ciData.fileErrors && Object.keys(ciData.fileErrors).length > 0) {
|
|
153
|
+
lines.push('');
|
|
154
|
+
lines.push('### Errors by file:');
|
|
155
|
+
// If reviewing a specific file, show only that file's errors
|
|
156
|
+
if (specificFile && ciData.fileErrors[specificFile]) {
|
|
157
|
+
const fileData = ciData.fileErrors[specificFile];
|
|
158
|
+
lines.push('');
|
|
159
|
+
lines.push(`**${specificFile}**:`);
|
|
160
|
+
lines.push(`- TypeScript errors: ${fileData.typeCheckErrors}`);
|
|
161
|
+
if (fileData.typeCheckMessages && fileData.typeCheckMessages.length > 0) {
|
|
162
|
+
lines.push(' TypeScript issues:');
|
|
163
|
+
fileData.typeCheckMessages.slice(0, 5).forEach((msg) => {
|
|
164
|
+
lines.push(` - ${msg}`);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
lines.push(`- ESLint errors: ${fileData.lintErrors}`);
|
|
168
|
+
if (fileData.lintMessages && fileData.lintMessages.length > 0) {
|
|
169
|
+
lines.push(' ESLint issues:');
|
|
170
|
+
fileData.lintMessages.slice(0, 5).forEach((msg) => {
|
|
171
|
+
lines.push(` - ${msg}`);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
// Show top 5 files with most errors
|
|
177
|
+
const fileList = Object.entries(ciData.fileErrors)
|
|
178
|
+
.map(([file, data]) => ({
|
|
179
|
+
file,
|
|
180
|
+
totalErrors: data.typeCheckErrors + data.lintErrors,
|
|
181
|
+
...data,
|
|
182
|
+
}))
|
|
183
|
+
.sort((a, b) => b.totalErrors - a.totalErrors)
|
|
184
|
+
.slice(0, 5);
|
|
185
|
+
for (const fileInfo of fileList) {
|
|
186
|
+
lines.push('');
|
|
187
|
+
lines.push(`**${fileInfo.file}**: ${fileInfo.totalErrors} total errors`);
|
|
188
|
+
lines.push(` - TypeScript: ${fileInfo.typeCheckErrors} errors`);
|
|
189
|
+
lines.push(` - ESLint: ${fileInfo.lintErrors} errors`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
lines.push('');
|
|
194
|
+
lines.push('Please include fixes for these CI/CD issues in your code review.');
|
|
195
|
+
return lines.join('\n');
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=ciDataCollector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ciDataCollector.js","sourceRoot":"","sources":["../../src/utils/ciDataCollector.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAmDH,sCA2CC;AA8FD,sDA0DC;AApPD,2DAA0C;AAC1C,0DAA6B;AAC7B,yCAAsC;AACtC,sDAA8B;AAE9B,MAAM,SAAS,GAAG,IAAA,qBAAS,EAAC,yBAAI,CAAC,CAAC;AAuClC;;;;GAIG;AACI,KAAK,UAAU,aAAa,CAAC,WAAmB;IACrD,MAAM,MAAM,GAAW;QACrB,UAAU,EAAE,EAAE;KACf,CAAC;IAEF,4BAA4B;IAC5B,IAAI,CAAC;QACH,gBAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;QAC5D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,qBAAqB,EAAE;YAChE,GAAG,EAAE,WAAW;YAChB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE;SACpC,CAAC,CAAC;Q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