codereview-aia 0.1.3 → 0.1.4
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/{src/analysis/context/index.ts → dist/analysis/context/index.d.ts} +0 -1
- package/dist/analysis/context/index.js +23 -0
- package/dist/analysis/context/index.js.map +1 -0
- package/{src/analysis/index.ts → dist/analysis/index.d.ts} +0 -1
- package/dist/analysis/index.js +24 -0
- package/dist/analysis/index.js.map +1 -0
- package/dist/analysis/static/wpPhpcsRunner.d.ts +11 -0
- package/dist/analysis/static/wpPhpcsRunner.js +219 -0
- package/dist/analysis/static/wpPhpcsRunner.js.map +1 -0
- package/dist/analysis/tokens/TokenAnalysisFormatter.d.ts +27 -0
- package/{src/analysis/tokens/TokenAnalysisFormatter.ts → dist/analysis/tokens/TokenAnalysisFormatter.js} +64 -75
- 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/{src/analysis/tokens/index.ts → dist/analysis/tokens/index.d.ts} +0 -1
- 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/{src/clients/base/index.ts → dist/clients/base/index.d.ts} +0 -1
- 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/{src/clients/factory/index.ts → dist/clients/factory/index.d.ts} +0 -1
- package/dist/clients/factory/index.js +24 -0
- package/dist/clients/factory/index.js.map +1 -0
- package/{src/clients/implementations/index.ts → dist/clients/implementations/index.d.ts} +0 -1
- 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/{src/clients/openRouterClientWrapper.ts → dist/clients/openRouterClientWrapper.d.ts} +2 -24
- 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/{src/clients/utils/index.ts → dist/clients/utils/index.d.ts} +0 -1
- 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 +37 -0
- package/dist/clients/utils/promptFormatter.js +150 -0
- package/dist/clients/utils/promptFormatter.js.map +1 -0
- package/{src/clients/utils/promptLoader.ts → dist/clients/utils/promptLoader.d.ts} +1 -27
- 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 +307 -0
- package/dist/core/ConfigurationService.js +516 -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 +164 -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 +354 -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/{src/formatters/outputFormatter.ts → dist/formatters/outputFormatter.d.ts} +2 -33
- 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 +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 +266 -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 +14 -0
- package/dist/runtime/fileCollector.js +382 -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 +17 -0
- package/dist/runtime/reporting/markdownReportBuilder.js +154 -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 +47 -0
- package/dist/runtime/reviewPipeline.js +161 -0
- package/dist/runtime/reviewPipeline.js.map +1 -0
- package/dist/runtime/runAiCodeReview.d.ts +28 -0
- package/dist/runtime/runAiCodeReview.js +373 -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 +172 -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 +12 -0
- package/dist/runtime/ui/screens/ProgressScreen.js +64 -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 +29 -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/{src/strategies/index.ts → dist/strategies/index.d.ts} +0 -1
- 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/{src/tokenizers/index.ts → dist/tokenizers/index.d.ts} +0 -1
- 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/{src/types/common.ts → dist/types/common.d.ts} +2 -19
- 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 +318 -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/{src/types/reviewSchema.ts → dist/types/reviewSchema.js} +44 -104
- 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.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 +850 -0
- package/dist/utils/detection/frameworkDetector.js.map +1 -0
- package/{src/utils/detection/index.ts → dist/utils/detection/index.d.ts} +0 -1
- 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/{src/utils/index.ts → dist/utils/index.d.ts} +0 -14
- 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/{src/utils/priorityFilter.ts → dist/utils/priorityFilter.d.ts} +1 -26
- 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 +141 -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/{src/utils/reviewActionHandler.ts → dist/utils/reviewActionHandler.d.ts} +0 -2
- 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 +5 -2
- package/.cr-aia.yml +0 -23
- package/.crignore +0 -0
- package/docs/opt-in-full-context.md +0 -27
- package/reports/cr-cr-aia-17-11-2025-20-13.md +0 -354
- package/src/analysis/FindingsExtractor.ts +0 -431
- package/src/analysis/ai-detection/analyzers/BaseAnalyzer.ts +0 -267
- package/src/analysis/ai-detection/analyzers/DocumentationAnalyzer.ts +0 -622
- package/src/analysis/ai-detection/analyzers/GitHistoryAnalyzer.ts +0 -430
- package/src/analysis/ai-detection/core/AIDetectionEngine.ts +0 -467
- package/src/analysis/ai-detection/types/DetectionTypes.ts +0 -406
- package/src/analysis/ai-detection/utils/SubmissionConverter.ts +0 -390
- package/src/analysis/context/ReviewContext.ts +0 -378
- package/src/analysis/tokens/TokenAnalyzer.ts +0 -747
- package/src/clients/base/abstractClient.ts +0 -190
- package/src/clients/base/httpClient.ts +0 -160
- package/src/clients/base/modelDetection.ts +0 -107
- package/src/clients/base/responseProcessor.ts +0 -586
- package/src/clients/factory/clientFactory.ts +0 -55
- package/src/clients/implementations/openRouterClient.ts +0 -413
- package/src/clients/openRouterClient.ts +0 -870
- package/src/clients/utils/directoryStructure.ts +0 -52
- package/src/clients/utils/languageDetection.ts +0 -44
- package/src/clients/utils/promptFormatter.ts +0 -182
- package/src/clients/utils/tokenCounter.ts +0 -297
- package/src/core/ApiClientSelector.ts +0 -37
- package/src/core/ConfigurationService.ts +0 -591
- package/src/core/ConsolidationService.ts +0 -423
- package/src/core/InteractiveDisplayManager.ts +0 -81
- package/src/core/OutputManager.ts +0 -275
- package/src/core/ReviewGenerator.ts +0 -140
- package/src/core/fileDiscovery.ts +0 -237
- package/src/core/handlers/EstimationHandler.ts +0 -104
- package/src/core/handlers/FileProcessingHandler.ts +0 -210
- package/src/core/handlers/OutputHandler.ts +0 -125
- package/src/core/handlers/ReviewExecutor.ts +0 -104
- package/src/core/reviewOrchestrator.ts +0 -333
- package/src/core/utils/ModelInfoUtils.ts +0 -56
- package/src/formatters/utils/IssueFormatters.ts +0 -83
- package/src/formatters/utils/JsonFormatter.ts +0 -77
- package/src/formatters/utils/MarkdownFormatters.ts +0 -609
- package/src/formatters/utils/MetadataFormatter.ts +0 -269
- package/src/formatters/utils/ModelInfoExtractor.ts +0 -115
- package/src/index.ts +0 -25
- package/src/plugins/PluginInterface.ts +0 -50
- package/src/plugins/PluginManager.ts +0 -126
- package/src/prompts/PromptManager.ts +0 -69
- package/src/prompts/cache/PromptCache.ts +0 -50
- package/src/prompts/promptText/common/variables/css-frameworks.json +0 -33
- package/src/prompts/promptText/common/variables/framework-versions.json +0 -45
- package/src/prompts/promptText/frameworks/react/comprehensive.hbs +0 -19
- package/src/prompts/promptText/languages/css/comprehensive.hbs +0 -18
- package/src/prompts/promptText/languages/generic/comprehensive.hbs +0 -20
- package/src/prompts/promptText/languages/html/comprehensive.hbs +0 -18
- package/src/prompts/promptText/languages/javascript/comprehensive.hbs +0 -18
- package/src/prompts/promptText/languages/python/comprehensive.hbs +0 -18
- package/src/prompts/promptText/languages/typescript/comprehensive.hbs +0 -18
- package/src/runtime/auth/service.ts +0 -58
- package/src/runtime/auth/session.ts +0 -103
- package/src/runtime/auth/types.ts +0 -11
- package/src/runtime/cliEntry.ts +0 -214
- package/src/runtime/debug/logManager.ts +0 -37
- package/src/runtime/errors.ts +0 -13
- package/src/runtime/fileCollector.ts +0 -495
- package/src/runtime/manifest.ts +0 -64
- package/src/runtime/openrouterProxy.ts +0 -45
- package/src/runtime/preprod/webCheck.ts +0 -104
- package/src/runtime/proxyConfig.ts +0 -94
- package/src/runtime/proxyEnvironment.ts +0 -71
- package/src/runtime/reportMerge.ts +0 -102
- package/src/runtime/reporting/markdownReportBuilder.ts +0 -138
- package/src/runtime/reporting/reportDataCollector.ts +0 -234
- package/src/runtime/reporting/summaryGenerator.ts +0 -86
- package/src/runtime/reviewPipeline.ts +0 -200
- package/src/runtime/runAiCodeReview.ts +0 -308
- package/src/runtime/runtimeConfig.ts +0 -5
- package/src/runtime/ui/Layout.tsx +0 -57
- package/src/runtime/ui/RuntimeApp.tsx +0 -262
- package/src/runtime/ui/inkModules.ts +0 -73
- package/src/runtime/ui/screens/AuthScreen.tsx +0 -128
- package/src/runtime/ui/screens/ModeSelection.tsx +0 -185
- package/src/runtime/ui/screens/ProgressScreen.tsx +0 -110
- package/src/runtime/ui/screens/ResultsScreen.tsx +0 -103
- package/src/strategies/ArchitecturalReviewStrategy.ts +0 -54
- package/src/strategies/CodingTestReviewStrategy.ts +0 -920
- package/src/strategies/ConsolidatedReviewStrategy.ts +0 -59
- package/src/strategies/ExtractPatternsReviewStrategy.ts +0 -64
- package/src/strategies/MultiPassReviewStrategy.ts +0 -785
- package/src/strategies/ReviewStrategy.ts +0 -64
- package/src/strategies/StrategyFactory.ts +0 -79
- package/src/tokenizers/baseTokenizer.ts +0 -61
- package/src/tokenizers/gptTokenizer.ts +0 -27
- package/src/types/apiResponses.ts +0 -40
- package/src/types/cli.ts +0 -24
- package/src/types/configuration.ts +0 -201
- package/src/types/handlebars.d.ts +0 -5
- package/src/types/patch.d.ts +0 -25
- package/src/types/review.ts +0 -312
- package/src/types/reviewContext.d.ts +0 -65
- package/src/types/structuredReview.ts +0 -167
- package/src/types/tokenAnalysis.ts +0 -56
- package/src/utils/FileReader.ts +0 -93
- package/src/utils/FileWriter.ts +0 -76
- package/src/utils/PathGenerator.ts +0 -97
- package/src/utils/api/apiUtils.ts +0 -14
- package/src/utils/apiErrorHandler.ts +0 -287
- package/src/utils/ciDataCollector.ts +0 -252
- package/src/utils/codingTestConfigLoader.ts +0 -466
- package/src/utils/dependencies/aiDependencyAnalyzer.ts +0 -454
- package/src/utils/detection/frameworkDetector.ts +0 -879
- package/src/utils/detection/projectTypeDetector.ts +0 -518
- package/src/utils/diagramGenerator.ts +0 -206
- package/src/utils/errorLogger.ts +0 -60
- package/src/utils/estimationUtils.ts +0 -407
- package/src/utils/fileFilters.ts +0 -373
- package/src/utils/fileSystem.ts +0 -57
- package/src/utils/logger.ts +0 -290
- package/src/utils/pathValidator.ts +0 -98
- package/src/utils/projectDocs.ts +0 -189
- package/src/utils/promptPaths.ts +0 -29
- package/src/utils/promptTemplateManager.ts +0 -157
- package/src/utils/review/consolidateReview.ts +0 -553
- package/src/utils/review/fixDisplay.ts +0 -100
- package/src/utils/review/fixImplementation.ts +0 -61
- package/src/utils/review/index.ts +0 -36
- package/src/utils/review/interactiveProcessing.ts +0 -294
- package/src/utils/review/progressTracker.ts +0 -296
- package/src/utils/review/reviewExtraction.ts +0 -382
- package/src/utils/review/types.ts +0 -46
- package/src/utils/reviewParser.ts +0 -253
- package/src/utils/sanitizer.ts +0 -238
- package/src/utils/smartFileSelector.ts +0 -255
- package/src/utils/templateLoader.ts +0 -514
- package/src/utils/treeGenerator.ts +0 -153
- package/tsconfig.build.json +0 -14
- package/tsconfig.json +0 -59
- /package/{src/utils/api/index.ts → dist/utils/api/index.d.ts} +0 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadProxySettings = loadProxySettings;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
10
|
+
const CR_AIA_CONFIG_CANDIDATES = ['.cr-aia.yml'];
|
|
11
|
+
const DEFAULT_PROXY_BASE_URL = 'https://cr.ai.enki.si';
|
|
12
|
+
function loadProxySettings(repoRoot) {
|
|
13
|
+
const config = loadCrAiaConfig(repoRoot);
|
|
14
|
+
const scopedConfig = config && typeof config === 'object' ? getScopedConfig(config) : undefined;
|
|
15
|
+
const envBase = sanitize(process.env.PROXY_BASE_URL);
|
|
16
|
+
const fileBase = getFirstDefined(config, scopedConfig, ['proxy_base_url', 'proxyBaseUrl']);
|
|
17
|
+
const httpReferer = sanitize(process.env.PROXY_HTTP_REFERER) ||
|
|
18
|
+
getFirstDefined(config, scopedConfig, ['http_referer', 'httpReferer']);
|
|
19
|
+
const xTitle = sanitize(process.env.PROXY_X_TITLE) ||
|
|
20
|
+
getFirstDefined(config, scopedConfig, ['x_title', 'xTitle']);
|
|
21
|
+
const baseUrl = envBase || fileBase || DEFAULT_PROXY_BASE_URL;
|
|
22
|
+
const settings = {
|
|
23
|
+
baseUrl,
|
|
24
|
+
};
|
|
25
|
+
if (httpReferer)
|
|
26
|
+
settings.httpReferer = httpReferer;
|
|
27
|
+
if (xTitle)
|
|
28
|
+
settings.xTitle = xTitle;
|
|
29
|
+
return settings;
|
|
30
|
+
}
|
|
31
|
+
function sanitize(value) {
|
|
32
|
+
return value && value.trim() ? value.trim() : undefined;
|
|
33
|
+
}
|
|
34
|
+
function loadCrAiaConfig(repoRoot) {
|
|
35
|
+
for (const candidate of CR_AIA_CONFIG_CANDIDATES) {
|
|
36
|
+
const filePath = (0, node_path_1.join)(repoRoot, candidate);
|
|
37
|
+
if (!(0, node_fs_1.existsSync)(filePath))
|
|
38
|
+
continue;
|
|
39
|
+
try {
|
|
40
|
+
const raw = (0, node_fs_1.readFileSync)(filePath, 'utf-8');
|
|
41
|
+
if (candidate.endsWith('.json')) {
|
|
42
|
+
return JSON.parse(raw);
|
|
43
|
+
}
|
|
44
|
+
return js_yaml_1.default.load(raw);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
function getScopedConfig(config) {
|
|
53
|
+
if (!config)
|
|
54
|
+
return undefined;
|
|
55
|
+
if (typeof config.cr_aia === 'object')
|
|
56
|
+
return config.cr_aia;
|
|
57
|
+
if (typeof config.crAia === 'object')
|
|
58
|
+
return config.crAia;
|
|
59
|
+
if (typeof config['cr-aia'] === 'object')
|
|
60
|
+
return config['cr-aia'];
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
function getFirstDefined(rootConfig, scopedConfig, keys) {
|
|
64
|
+
for (const key of keys) {
|
|
65
|
+
const scopedValue = scopedConfig ? getNested(scopedConfig, key) : undefined;
|
|
66
|
+
if (scopedValue !== undefined)
|
|
67
|
+
return scopedValue;
|
|
68
|
+
const rootValue = rootConfig ? getNested(rootConfig, key) : undefined;
|
|
69
|
+
if (rootValue !== undefined)
|
|
70
|
+
return rootValue;
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
function getNested(obj, pathKey) {
|
|
75
|
+
const segments = pathKey.split('.');
|
|
76
|
+
let current = obj;
|
|
77
|
+
for (const segment of segments) {
|
|
78
|
+
if (!current || typeof current !== 'object')
|
|
79
|
+
return undefined;
|
|
80
|
+
if (!(segment in current))
|
|
81
|
+
return undefined;
|
|
82
|
+
current = current[segment];
|
|
83
|
+
}
|
|
84
|
+
return current;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=proxyConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxyConfig.js","sourceRoot":"","sources":["../../src/runtime/proxyConfig.ts"],"names":[],"mappings":";;;;;AAaA,8CAwBC;AArCD,qCAAmD;AACnD,yCAAiC;AACjC,sDAA2B;AAQ3B,MAAM,wBAAwB,GAAG,CAAC,aAAa,CAAC,CAAC;AACjD,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAEvD,SAAgB,iBAAiB,CAAC,QAAgB;IAChD,MAAM,MAAM,GAAG,eAAe,CAAC,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,CAAC,CAAC,SAAS,CAAC;QACtE,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO,SAAc,CAAC;IACrD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,SAAS,CAAC,GAAwB,EAAE,OAAe;IAC1D,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,OAAO,GAAQ,GAAG,CAAC;IACvB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QAC9D,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC;YAAE,OAAO,SAAS,CAAC;QAC5C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureProxyEnvironmentInitialized = ensureProxyEnvironmentInitialized;
|
|
4
|
+
exports.getActiveProxySettings = getActiveProxySettings;
|
|
5
|
+
const proxyConfig_1 = require("./proxyConfig");
|
|
6
|
+
const session_1 = require("./auth/session");
|
|
7
|
+
let cachedSettings = null;
|
|
8
|
+
function proxySuppliesApiKey(settings) {
|
|
9
|
+
const override = process.env.CR_AIA_PROXY_SUPPLIES_API_KEY;
|
|
10
|
+
if (override && override.trim()) {
|
|
11
|
+
return override.trim().toLowerCase() !== 'false';
|
|
12
|
+
}
|
|
13
|
+
return settings.baseUrl.toLowerCase().includes('cr.ai.enki.si');
|
|
14
|
+
}
|
|
15
|
+
function ensureApiKeyPlaceholder(settings) {
|
|
16
|
+
if (!proxySuppliesApiKey(settings)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const placeholder = process.env.CR_AIA_PROXY_API_KEY_PLACEHOLDER || 'provided-by-proxy';
|
|
20
|
+
if (!process.env.AI_CODE_REVIEW_OPENROUTER_API_KEY) {
|
|
21
|
+
process.env.AI_CODE_REVIEW_OPENROUTER_API_KEY = placeholder;
|
|
22
|
+
}
|
|
23
|
+
if (!process.env.OPENROUTER_API_KEY) {
|
|
24
|
+
process.env.OPENROUTER_API_KEY = placeholder;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function applyProxySettings(settings) {
|
|
28
|
+
process.env.CR_AIA_PROXY_BASE_URL = settings.baseUrl;
|
|
29
|
+
if (settings.httpReferer) {
|
|
30
|
+
process.env.CR_AIA_PROXY_HTTP_REFERER = settings.httpReferer;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
delete process.env.CR_AIA_PROXY_HTTP_REFERER;
|
|
34
|
+
}
|
|
35
|
+
if (settings.xTitle) {
|
|
36
|
+
process.env.CR_AIA_PROXY_X_TITLE = settings.xTitle;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
delete process.env.CR_AIA_PROXY_X_TITLE;
|
|
40
|
+
}
|
|
41
|
+
ensureApiKeyPlaceholder(settings);
|
|
42
|
+
ensureSessionToken();
|
|
43
|
+
}
|
|
44
|
+
function ensureSessionToken() {
|
|
45
|
+
if (process.env.CR_AIA_PROXY_SESSION_TOKEN && process.env.CR_AIA_PROXY_SESSION_TOKEN.trim()) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const token = (0, session_1.getSessionToken)();
|
|
49
|
+
if (token) {
|
|
50
|
+
process.env.CR_AIA_PROXY_SESSION_TOKEN = token;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function ensureProxyEnvironmentInitialized(repoRoot) {
|
|
54
|
+
if (!cachedSettings) {
|
|
55
|
+
cachedSettings = (0, proxyConfig_1.loadProxySettings)(repoRoot);
|
|
56
|
+
applyProxySettings(cachedSettings);
|
|
57
|
+
}
|
|
58
|
+
return cachedSettings;
|
|
59
|
+
}
|
|
60
|
+
function getActiveProxySettings() {
|
|
61
|
+
return cachedSettings;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=proxyEnvironment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxyEnvironment.js","sourceRoot":"","sources":["../../src/runtime/proxyEnvironment.ts"],"names":[],"mappings":";;AA4DA,8EAMC;AAED,wDAEC;AArED,+CAAkD;AAClD,4CAAiD;AAEjD,IAAI,cAAc,GAAyB,IAAI,CAAC;AAEhD,SAAS,mBAAmB,CAAC,QAAuB;IAClD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;IAC3D,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;QAChC,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;IACnD,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,uBAAuB,CAAC,QAAuB;IACtD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,OAAO;IACT,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,IAAI,mBAAmB,CAAC;IAExF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,iCAAiC,EAAE,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,iCAAiC,GAAG,WAAW,CAAC;IAC9D,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,WAAW,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAuB;IACjD,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,QAAQ,CAAC,OAAO,CAAC;IAErD,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,yBAAyB,GAAG,QAAQ,CAAC,WAAW,CAAC;IAC/D,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;IAC/C,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC;IACrD,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAC1C,CAAC;IAED,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAClC,kBAAkB,EAAE,CAAC;AACvB,CAAC;AAED,SAAS,kBAAkB;IACzB,IAAI,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,IAAI,EAAE,EAAE,CAAC;QAC5F,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,IAAA,yBAAe,GAAE,CAAC;IAChC,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,KAAK,CAAC;IACjD,CAAC;AACH,CAAC;AAED,SAAgB,iCAAiC,CAAC,QAAgB;IAChE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,cAAc,GAAG,IAAA,+BAAiB,EAAC,QAAQ,CAAC,CAAC;QAC7C,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,SAAgB,sBAAsB;IACpC,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReviewTotals } from './reviewPipeline';
|
|
2
|
+
export interface StructuredIssue {
|
|
3
|
+
priority?: string;
|
|
4
|
+
filePath?: string;
|
|
5
|
+
lineNumbers?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
suggestedFix?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
impact?: string;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface StructuredDataReport {
|
|
14
|
+
structuredData?: {
|
|
15
|
+
issues?: StructuredIssue[];
|
|
16
|
+
};
|
|
17
|
+
totals?: Record<string, number>;
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
costInfo?: Record<string, unknown>;
|
|
20
|
+
modelUsed?: string;
|
|
21
|
+
}
|
|
22
|
+
interface MergeResult {
|
|
23
|
+
findings: Record<string, unknown>[];
|
|
24
|
+
totals: ReviewTotals;
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
costInfo?: Record<string, unknown>;
|
|
27
|
+
modelUsed?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function mergeReports(reports: StructuredDataReport[]): MergeResult;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeReports = mergeReports;
|
|
4
|
+
function mergeReports(reports) {
|
|
5
|
+
if (reports.length === 0) {
|
|
6
|
+
return { findings: [], totals: { critical: 0, high: 0, medium: 0, low: 0 } };
|
|
7
|
+
}
|
|
8
|
+
if (reports.length === 1) {
|
|
9
|
+
return normalizeReport(reports[0]);
|
|
10
|
+
}
|
|
11
|
+
const allFindings = [];
|
|
12
|
+
const totals = { critical: 0, high: 0, medium: 0, low: 0 };
|
|
13
|
+
for (const report of reports) {
|
|
14
|
+
const normalized = normalizeReport(report);
|
|
15
|
+
if (normalized.findings) {
|
|
16
|
+
allFindings.push(...normalized.findings);
|
|
17
|
+
}
|
|
18
|
+
if (normalized.totals) {
|
|
19
|
+
totals.critical += normalized.totals.critical || 0;
|
|
20
|
+
totals.high += normalized.totals.high || 0;
|
|
21
|
+
totals.medium += normalized.totals.medium || 0;
|
|
22
|
+
totals.low += normalized.totals.low || 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
findings: allFindings,
|
|
27
|
+
totals,
|
|
28
|
+
metadata: {
|
|
29
|
+
mergedFrom: reports.length,
|
|
30
|
+
timestamp: new Date().toISOString(),
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function normalizeReport(report) {
|
|
35
|
+
const findings = [];
|
|
36
|
+
const totals = { critical: 0, high: 0, medium: 0, low: 0 };
|
|
37
|
+
if (report.structuredData?.issues) {
|
|
38
|
+
for (const issue of report.structuredData.issues) {
|
|
39
|
+
const priority = issue.priority?.toLowerCase() || 'medium';
|
|
40
|
+
const finding = {
|
|
41
|
+
file: issue.filePath,
|
|
42
|
+
line: parseInt(issue.lineNumbers?.split('-')[0] || '0', 10),
|
|
43
|
+
rule: issue.type || 'general',
|
|
44
|
+
severity: priority,
|
|
45
|
+
msg: issue.description,
|
|
46
|
+
fix_hint: issue.suggestedFix,
|
|
47
|
+
title: issue.title,
|
|
48
|
+
impact: issue.impact,
|
|
49
|
+
raw: issue,
|
|
50
|
+
};
|
|
51
|
+
findings.push(finding);
|
|
52
|
+
if (priority === 'critical')
|
|
53
|
+
totals.critical += 1;
|
|
54
|
+
else if (priority === 'high')
|
|
55
|
+
totals.high += 1;
|
|
56
|
+
else if (priority === 'medium')
|
|
57
|
+
totals.medium += 1;
|
|
58
|
+
else
|
|
59
|
+
totals.low += 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
findings,
|
|
64
|
+
totals,
|
|
65
|
+
metadata: report.metadata,
|
|
66
|
+
costInfo: report.costInfo,
|
|
67
|
+
modelUsed: report.modelUsed,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=reportMerge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reportMerge.js","sourceRoot":"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AM,CAAC,IAAI,IAAI,CAAC,CAAC;iBAC1C,IAAI,QAAQ,KAAK,QAAQ;gBAAE,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;;gBAC9C,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO;QACL,QAAQ;QACR,MAAM;QACN,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FileIssueGroup, TokenStats } from './reportDataCollector';
|
|
2
|
+
import type { ReviewTotals } from '../reviewPipeline';
|
|
3
|
+
import type { WordPressStandardsReport } from '../../types/review';
|
|
4
|
+
export declare const SUMMARY_PLACEHOLDER = "<!--REPORT_SUMMARY_PLACEHOLDER-->";
|
|
5
|
+
export interface MarkdownReportContext {
|
|
6
|
+
repoName: string;
|
|
7
|
+
generatedAt: Date;
|
|
8
|
+
durationSeconds: number;
|
|
9
|
+
filesReviewed: number;
|
|
10
|
+
totals: ReviewTotals;
|
|
11
|
+
tokenStats?: TokenStats;
|
|
12
|
+
estimatedCostUSD?: number;
|
|
13
|
+
issueGroups: FileIssueGroup[];
|
|
14
|
+
wordpressReport?: WordPressStandardsReport;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildMarkdownReport(ctx: MarkdownReportContext): string;
|
|
17
|
+
export declare function injectSummary(markdown: string, summary: string): string;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUMMARY_PLACEHOLDER = void 0;
|
|
4
|
+
exports.buildMarkdownReport = buildMarkdownReport;
|
|
5
|
+
exports.injectSummary = injectSummary;
|
|
6
|
+
exports.SUMMARY_PLACEHOLDER = '<!--REPORT_SUMMARY_PLACEHOLDER-->';
|
|
7
|
+
function pad(num) {
|
|
8
|
+
return num.toString().padStart(2, '0');
|
|
9
|
+
}
|
|
10
|
+
function formatEuropeanTimestamp(date) {
|
|
11
|
+
const day = pad(date.getDate());
|
|
12
|
+
const month = pad(date.getMonth() + 1);
|
|
13
|
+
const year = date.getFullYear();
|
|
14
|
+
const hours = pad(date.getHours());
|
|
15
|
+
const minutes = pad(date.getMinutes());
|
|
16
|
+
return `${day}.${month}.${year} ${hours}.${minutes}`;
|
|
17
|
+
}
|
|
18
|
+
function formatDuration(seconds) {
|
|
19
|
+
const hrs = Math.floor(seconds / 3600);
|
|
20
|
+
const mins = Math.floor((seconds % 3600) / 60);
|
|
21
|
+
const secs = seconds % 60;
|
|
22
|
+
return `${pad(hrs)}:${pad(mins)}:${pad(secs)}`;
|
|
23
|
+
}
|
|
24
|
+
function formatCost(amount) {
|
|
25
|
+
if (typeof amount !== 'number' || Number.isNaN(amount)) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return `$${amount.toFixed(amount < 1 ? 4 : 2)} USD`;
|
|
29
|
+
}
|
|
30
|
+
function buildStatsSection(ctx) {
|
|
31
|
+
const stats = ['### Stats'];
|
|
32
|
+
const cost = formatCost(ctx.estimatedCostUSD);
|
|
33
|
+
if (cost) {
|
|
34
|
+
stats.push(`- Spend: ${cost}`);
|
|
35
|
+
}
|
|
36
|
+
stats.push(`- Duration: ${formatDuration(ctx.durationSeconds)}`);
|
|
37
|
+
stats.push(`- Files reviewed: ${ctx.filesReviewed}`);
|
|
38
|
+
if (ctx.tokenStats) {
|
|
39
|
+
stats.push(`- Total tokens: ${ctx.tokenStats.totalTokens.toLocaleString()} (input: ${ctx.tokenStats.inputTokens.toLocaleString()} / output: ${ctx.tokenStats.outputTokens.toLocaleString()})`);
|
|
40
|
+
}
|
|
41
|
+
stats.push(`- Issues: Critical ${ctx.totals.critical} · High ${ctx.totals.high} · Medium ${ctx.totals.medium} · Low ${ctx.totals.low}`);
|
|
42
|
+
return stats.join('\n');
|
|
43
|
+
}
|
|
44
|
+
function formatIssueTitle(issue) {
|
|
45
|
+
const capitalized = issue.severity.charAt(0).toUpperCase() + issue.severity.slice(1);
|
|
46
|
+
const linePart = issue.lineLabel ? ` (lines ${issue.lineLabel})` : '';
|
|
47
|
+
const title = issue.title || 'Issue';
|
|
48
|
+
return `##### [${capitalized}] ${title}${linePart}`;
|
|
49
|
+
}
|
|
50
|
+
function buildIssueBlock(group) {
|
|
51
|
+
const lines = [`#### ${group.filePath}`];
|
|
52
|
+
for (const issue of group.issues) {
|
|
53
|
+
lines.push(formatIssueTitle(issue));
|
|
54
|
+
if (issue.description) {
|
|
55
|
+
lines.push(`- **Problem:** ${issue.description.trim()}`);
|
|
56
|
+
}
|
|
57
|
+
if (issue.impact) {
|
|
58
|
+
lines.push(`- **Impact:** ${issue.impact.trim()}`);
|
|
59
|
+
}
|
|
60
|
+
if (issue.suggestedFix) {
|
|
61
|
+
lines.push(`- **Recommendation:** ${issue.suggestedFix.trim()}`);
|
|
62
|
+
}
|
|
63
|
+
lines.push('');
|
|
64
|
+
}
|
|
65
|
+
return lines.join('\n').trimEnd();
|
|
66
|
+
}
|
|
67
|
+
function buildIssuesSection(groups) {
|
|
68
|
+
if (groups.length === 0) {
|
|
69
|
+
return '### Issues\n_No actionable issues reported in this review._';
|
|
70
|
+
}
|
|
71
|
+
const blocks = groups.map((group) => buildIssueBlock(group));
|
|
72
|
+
return `### Issues\n\n${blocks.join('\n\n---\n\n')}`;
|
|
73
|
+
}
|
|
74
|
+
function buildWordPressSection(report) {
|
|
75
|
+
const lines = ['### WordPress Coding Standards'];
|
|
76
|
+
if (report.status === 'skipped') {
|
|
77
|
+
lines.push(`Skipped: ${report.reason ?? 'Not enabled.'}`);
|
|
78
|
+
return lines.join('\n');
|
|
79
|
+
}
|
|
80
|
+
if (report.status === 'failed') {
|
|
81
|
+
lines.push(`Scan failed: ${report.reason ?? 'Unknown error.'}`);
|
|
82
|
+
return lines.join('\n');
|
|
83
|
+
}
|
|
84
|
+
lines.push(`- Errors: ${report.errors}`);
|
|
85
|
+
lines.push(`- Warnings: ${report.warnings}`);
|
|
86
|
+
if (report.findings.length === 0) {
|
|
87
|
+
lines.push('- No WordPress-specific issues detected.');
|
|
88
|
+
return lines.join('\n');
|
|
89
|
+
}
|
|
90
|
+
lines.push('\n#### Notable findings');
|
|
91
|
+
const topFindings = report.findings.slice(0, 5);
|
|
92
|
+
for (const finding of topFindings) {
|
|
93
|
+
// We don't have projectRoot here easily, but finding.filePath is absolute.
|
|
94
|
+
// We can try to infer relative path or just show the path.
|
|
95
|
+
// However, the finding object usually has the full path.
|
|
96
|
+
// Let's assume we want to show it relative to the repo root if possible.
|
|
97
|
+
// Since we don't have the repo root passed to this function easily (it's in ctx.repoName but that's just the name),
|
|
98
|
+
// we might have to stick to what we have or pass projectRoot to buildMarkdownReport.
|
|
99
|
+
// Actually, wpPhpcsRunner's formatWordPressFinding takes projectRoot.
|
|
100
|
+
// Let's just use the finding.filePath for now, or better, update the interface to include projectRoot.
|
|
101
|
+
// Wait, the previous code was:
|
|
102
|
+
// `- ${finding.filePath}:${finding.line} [${finding.type}] ${finding.source} – ${finding.message}`
|
|
103
|
+
// It didn't relativize it.
|
|
104
|
+
// But wait, wpPhpcsRunner.ts's summarizeWordPressReport DOES relativize it.
|
|
105
|
+
// "const rel = path.relative(projectRoot, finding.filePath);"
|
|
106
|
+
// The markdown builder should probably also relativize it for cleanliness.
|
|
107
|
+
// I'll just use the simple format for now to match the previous behavior but using the helper if possible.
|
|
108
|
+
// Actually, I can't easily use the helper because I don't have projectRoot.
|
|
109
|
+
// I'll stick to the existing formatting but clean it up to match the helper's style if I had the root.
|
|
110
|
+
// Let's look at the previous code again:
|
|
111
|
+
// `- ${finding.filePath}:${finding.line} [${finding.type}] ${finding.source} – ${finding.message}`
|
|
112
|
+
// The helper does:
|
|
113
|
+
// `- ${rel || finding.filePath}:${finding.line} [${finding.type}] ${finding.source} – ${finding.message}`
|
|
114
|
+
// So it is the same format, just relative path.
|
|
115
|
+
// I will leave it as is for now to avoid breaking things by needing projectRoot,
|
|
116
|
+
// BUT I will fix the duplication by manually ensuring the format string is identical.
|
|
117
|
+
lines.push(`- ${finding.filePath}:${finding.line} [${finding.type}] ${finding.source} – ${finding.message}`);
|
|
118
|
+
}
|
|
119
|
+
if (report.findings.length > topFindings.length) {
|
|
120
|
+
lines.push(`- ...and ${report.findings.length - topFindings.length} more finding(s)`);
|
|
121
|
+
}
|
|
122
|
+
if (report.reason) {
|
|
123
|
+
lines.push(`\n_${report.reason}_`);
|
|
124
|
+
}
|
|
125
|
+
return lines.join('\n');
|
|
126
|
+
}
|
|
127
|
+
function buildMarkdownReport(ctx) {
|
|
128
|
+
const parts = [];
|
|
129
|
+
const timestamp = formatEuropeanTimestamp(ctx.generatedAt);
|
|
130
|
+
parts.push(`# Code Review Report — ${timestamp}`);
|
|
131
|
+
parts.push(`**Repository:** ${ctx.repoName}`);
|
|
132
|
+
parts.push('\n---\n');
|
|
133
|
+
parts.push(buildStatsSection(ctx));
|
|
134
|
+
parts.push('\n\n---\n');
|
|
135
|
+
parts.push('### Summary');
|
|
136
|
+
parts.push(exports.SUMMARY_PLACEHOLDER);
|
|
137
|
+
parts.push('\n---\n');
|
|
138
|
+
parts.push(buildIssuesSection(ctx.issueGroups));
|
|
139
|
+
if (ctx.wordpressReport) {
|
|
140
|
+
parts.push('\n\n---\n');
|
|
141
|
+
parts.push(buildWordPressSection(ctx.wordpressReport));
|
|
142
|
+
}
|
|
143
|
+
parts.push('\n\n---\n');
|
|
144
|
+
parts.push('_Generated by cr-aia_');
|
|
145
|
+
return parts.join('\n\n');
|
|
146
|
+
}
|
|
147
|
+
function injectSummary(markdown, summary) {
|
|
148
|
+
if (!markdown.includes(exports.SUMMARY_PLACEHOLDER)) {
|
|
149
|
+
return markdown;
|
|
150
|
+
}
|
|
151
|
+
const formattedSummary = summary.trim() ? summary.trim() : '_Summary unavailable._';
|
|
152
|
+
return markdown.replace(exports.SUMMARY_PLACEHOLDER, `>${formattedSummary.replace(/\n+/g, ' ')}`);
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=markdownReportBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownReportBuilder.js","sourceRoot":"","sources":["../../../src/runtime/reporting/markdownReportBuilder.ts"],"names":[],"mappings":";;;AAkLA,kDAyBC;AAED,sCAUC;AAnNY,QAAA,mBAAmB,GAAG,mCAAmC,CAAC;AAcvE,SAAS,GAAG,CAAC,GAAW;IACtB,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAU;IACzC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACvC,OAAO,GAAG,GAAG,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC;AACvD,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,OAAO,GAAG,EAAE,CAAC;IAC1B,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,G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;IACpF,OAAO,QAAQ,CAAC,OAAO,CACrB,2BAAmB,EACnB,IAAI,gBAAgB,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { StructuredDataReport } from '../reportMerge';
|
|
2
|
+
import type { ReviewTotals } from '../reviewPipeline';
|
|
3
|
+
export type IssueSeverity = 'critical' | 'high' | 'medium' | 'low';
|
|
4
|
+
export interface NormalizedIssue {
|
|
5
|
+
filePath: string;
|
|
6
|
+
severity: IssueSeverity;
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
impact?: string;
|
|
10
|
+
suggestedFix?: string;
|
|
11
|
+
lineLabel?: string;
|
|
12
|
+
lineStart?: number;
|
|
13
|
+
lineEnd?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface FileIssueGroup {
|
|
16
|
+
filePath: string;
|
|
17
|
+
issues: NormalizedIssue[];
|
|
18
|
+
}
|
|
19
|
+
export interface TokenStats {
|
|
20
|
+
totalTokens: number;
|
|
21
|
+
inputTokens: number;
|
|
22
|
+
outputTokens: number;
|
|
23
|
+
}
|
|
24
|
+
export interface CollectedReportData {
|
|
25
|
+
totals: ReviewTotals;
|
|
26
|
+
groupedIssues: FileIssueGroup[];
|
|
27
|
+
tokenStats?: TokenStats;
|
|
28
|
+
estimatedCostUSD?: number;
|
|
29
|
+
issueCount: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function collectReportData(reports: StructuredDataReport[]): CollectedReportData;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collectReportData = collectReportData;
|
|
4
|
+
const SEVERITY_ORDER = {
|
|
5
|
+
critical: 0,
|
|
6
|
+
high: 1,
|
|
7
|
+
medium: 2,
|
|
8
|
+
low: 3,
|
|
9
|
+
};
|
|
10
|
+
function normalizeSeverity(priority) {
|
|
11
|
+
const normalized = priority?.toLowerCase().trim();
|
|
12
|
+
if (normalized === 'critical')
|
|
13
|
+
return 'critical';
|
|
14
|
+
if (normalized === 'high')
|
|
15
|
+
return 'high';
|
|
16
|
+
if (normalized === 'low')
|
|
17
|
+
return 'low';
|
|
18
|
+
return 'medium';
|
|
19
|
+
}
|
|
20
|
+
function parseLineLabel(lineNumbers) {
|
|
21
|
+
if (!lineNumbers) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
const trimmed = lineNumbers.trim();
|
|
25
|
+
if (!trimmed) {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
const match = trimmed.match(/^(\d+)(?:\s*-\s*(\d+))?$/);
|
|
29
|
+
if (!match) {
|
|
30
|
+
return { label: trimmed };
|
|
31
|
+
}
|
|
32
|
+
const start = Number.parseInt(match[1], 10);
|
|
33
|
+
const end = match[2] ? Number.parseInt(match[2], 10) : start;
|
|
34
|
+
const label = start === end ? `${start}` : `${start}-${end}`;
|
|
35
|
+
return { label, start, end };
|
|
36
|
+
}
|
|
37
|
+
function toNumber(value) {
|
|
38
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
if (typeof value === 'string') {
|
|
42
|
+
const parsed = Number.parseFloat(value);
|
|
43
|
+
if (!Number.isNaN(parsed)) {
|
|
44
|
+
return parsed;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
function extractIssues(reports) {
|
|
50
|
+
const issues = [];
|
|
51
|
+
for (const report of reports) {
|
|
52
|
+
let structuredIssues = report.structuredData?.issues;
|
|
53
|
+
if (!structuredIssues && typeof report.structuredData === 'string') {
|
|
54
|
+
try {
|
|
55
|
+
const parsed = JSON.parse(report.structuredData);
|
|
56
|
+
structuredIssues = parsed?.issues;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
structuredIssues = undefined;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (!Array.isArray(structuredIssues)) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
for (const issue of structuredIssues) {
|
|
66
|
+
const filePath = issue.filePath?.trim() || 'Unspecified file';
|
|
67
|
+
const severity = normalizeSeverity(issue.priority);
|
|
68
|
+
const { label, start, end } = parseLineLabel(issue.lineNumbers);
|
|
69
|
+
issues.push({
|
|
70
|
+
filePath,
|
|
71
|
+
severity,
|
|
72
|
+
title: issue.title,
|
|
73
|
+
description: issue.description,
|
|
74
|
+
impact: issue.impact,
|
|
75
|
+
suggestedFix: issue.suggestedFix,
|
|
76
|
+
lineLabel: label,
|
|
77
|
+
lineStart: start,
|
|
78
|
+
lineEnd: end,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return issues;
|
|
83
|
+
}
|
|
84
|
+
function groupIssuesByFile(issues) {
|
|
85
|
+
const groups = new Map();
|
|
86
|
+
for (const issue of issues) {
|
|
87
|
+
if (!groups.has(issue.filePath)) {
|
|
88
|
+
groups.set(issue.filePath, []);
|
|
89
|
+
}
|
|
90
|
+
groups.get(issue.filePath).push(issue);
|
|
91
|
+
}
|
|
92
|
+
const sortedGroups = Array.from(groups.entries())
|
|
93
|
+
.map(([filePath, fileIssues]) => {
|
|
94
|
+
fileIssues.sort((a, b) => {
|
|
95
|
+
const severityDiff = SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity];
|
|
96
|
+
if (severityDiff !== 0) {
|
|
97
|
+
return severityDiff;
|
|
98
|
+
}
|
|
99
|
+
if (a.lineStart && b.lineStart) {
|
|
100
|
+
return a.lineStart - b.lineStart;
|
|
101
|
+
}
|
|
102
|
+
return (a.title || '').localeCompare(b.title || '');
|
|
103
|
+
});
|
|
104
|
+
return { filePath, issues: fileIssues };
|
|
105
|
+
})
|
|
106
|
+
.sort((a, b) => a.filePath.localeCompare(b.filePath));
|
|
107
|
+
return sortedGroups;
|
|
108
|
+
}
|
|
109
|
+
function aggregateCostInfo(reports) {
|
|
110
|
+
let inputTokens = 0;
|
|
111
|
+
let outputTokens = 0;
|
|
112
|
+
let estimatedCost = 0;
|
|
113
|
+
let hasCostInfo = false;
|
|
114
|
+
for (const report of reports) {
|
|
115
|
+
const costInfo = (report.costInfo || report.costInfo);
|
|
116
|
+
if (!costInfo)
|
|
117
|
+
continue;
|
|
118
|
+
const input = toNumber(costInfo.inputTokens);
|
|
119
|
+
const output = toNumber(costInfo.outputTokens);
|
|
120
|
+
const total = toNumber(costInfo.totalTokens);
|
|
121
|
+
const estimate = toNumber(costInfo.estimatedCost ?? costInfo.cost);
|
|
122
|
+
if (input) {
|
|
123
|
+
inputTokens += input;
|
|
124
|
+
hasCostInfo = true;
|
|
125
|
+
}
|
|
126
|
+
if (output) {
|
|
127
|
+
outputTokens += output;
|
|
128
|
+
hasCostInfo = true;
|
|
129
|
+
}
|
|
130
|
+
if (estimate) {
|
|
131
|
+
estimatedCost += estimate;
|
|
132
|
+
hasCostInfo = true;
|
|
133
|
+
}
|
|
134
|
+
if (!input && !output && total && !Number.isNaN(total)) {
|
|
135
|
+
// If total tokens is provided without split, distribute evenly.
|
|
136
|
+
inputTokens += total / 2;
|
|
137
|
+
outputTokens += total / 2;
|
|
138
|
+
hasCostInfo = true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (!hasCostInfo) {
|
|
142
|
+
return {};
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
tokenStats: {
|
|
146
|
+
inputTokens: Math.round(inputTokens),
|
|
147
|
+
outputTokens: Math.round(outputTokens),
|
|
148
|
+
totalTokens: Math.round(inputTokens + outputTokens),
|
|
149
|
+
},
|
|
150
|
+
estimatedCostUSD: estimatedCost || undefined,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function collectReportData(reports) {
|
|
154
|
+
const issues = extractIssues(reports);
|
|
155
|
+
const groupedIssues = groupIssuesByFile(issues);
|
|
156
|
+
// Derive severity totals if missing (default zero).
|
|
157
|
+
const totals = { critical: 0, high: 0, medium: 0, low: 0 };
|
|
158
|
+
for (const issue of issues) {
|
|
159
|
+
totals[issue.severity] += 1;
|
|
160
|
+
}
|
|
161
|
+
const { tokenStats, estimatedCostUSD } = aggregateCostInfo(reports);
|
|
162
|
+
return {
|
|
163
|
+
totals,
|
|
164
|
+
groupedIssues,
|
|
165
|
+
tokenStats,
|
|
166
|
+
estimatedCostUSD,
|
|
167
|
+
issueCount: issues.length,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=reportDataCollector.js.map
|