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
|
@@ -1,920 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Coding test review strategy implementation.
|
|
3
|
-
*
|
|
4
|
-
* This module implements the coding test review strategy for evaluating candidate submissions
|
|
5
|
-
* against assignment requirements using configurable scoring criteria and evaluation frameworks.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { AIDetectionEngine } from '../analysis/ai-detection/core/AIDetectionEngine';
|
|
9
|
-
import type {
|
|
10
|
-
DetectionConfig,
|
|
11
|
-
DetectionResult,
|
|
12
|
-
} from '../analysis/ai-detection/types/DetectionTypes';
|
|
13
|
-
import { SubmissionConverter } from '../analysis/ai-detection/utils/SubmissionConverter';
|
|
14
|
-
import type { ApiClientConfig } from '../core/ApiClientSelector';
|
|
15
|
-
import { generateReview } from '../core/ReviewGenerator';
|
|
16
|
-
import type { FileInfo, ReviewOptions, ReviewResult } from '../types/review';
|
|
17
|
-
import { collectCIData } from '../utils/ciDataCollector';
|
|
18
|
-
import {
|
|
19
|
-
convertToCodingTestConfig,
|
|
20
|
-
createDefaultCodingTestConfig,
|
|
21
|
-
loadCodingTestConfig,
|
|
22
|
-
parseAssignmentText,
|
|
23
|
-
} from '../utils/codingTestConfigLoader';
|
|
24
|
-
import logger from '../utils/logger';
|
|
25
|
-
import type { ProjectDocs } from '../utils/projectDocs';
|
|
26
|
-
import { BaseReviewStrategy } from './ReviewStrategy';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Configuration interface for coding test evaluation
|
|
30
|
-
*/
|
|
31
|
-
export interface CodingTestConfig {
|
|
32
|
-
/** Assignment specification */
|
|
33
|
-
assignment?: {
|
|
34
|
-
title?: string;
|
|
35
|
-
description?: string;
|
|
36
|
-
requirements?: string[];
|
|
37
|
-
difficulty?: 'junior' | 'mid' | 'senior' | 'lead' | 'architect';
|
|
38
|
-
timeLimit?: number;
|
|
39
|
-
type?: 'coding-challenge' | 'take-home' | 'live-coding' | 'code-review';
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/** Evaluation criteria with weights */
|
|
43
|
-
criteria?: Record<string, number> & {
|
|
44
|
-
correctness?: number;
|
|
45
|
-
codeQuality?: number;
|
|
46
|
-
architecture?: number;
|
|
47
|
-
performance?: number;
|
|
48
|
-
testing?: number;
|
|
49
|
-
documentation?: number;
|
|
50
|
-
errorHandling?: number;
|
|
51
|
-
security?: number;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/** Scoring configuration */
|
|
55
|
-
scoring?: {
|
|
56
|
-
system?: 'numeric' | 'letter' | 'pass-fail' | 'custom';
|
|
57
|
-
maxScore?: number;
|
|
58
|
-
passingThreshold?: number;
|
|
59
|
-
breakdown?: boolean;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/** Feedback configuration */
|
|
63
|
-
feedback?: {
|
|
64
|
-
level?: 'basic' | 'detailed' | 'comprehensive';
|
|
65
|
-
includeExamples?: boolean;
|
|
66
|
-
includeSuggestions?: boolean;
|
|
67
|
-
includeResources?: boolean;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/** Technical constraints */
|
|
71
|
-
constraints?: {
|
|
72
|
-
allowedLibraries?: string[];
|
|
73
|
-
forbiddenPatterns?: string[];
|
|
74
|
-
targetLanguage?: string;
|
|
75
|
-
framework?: string;
|
|
76
|
-
nodeVersion?: string;
|
|
77
|
-
memoryLimit?: number;
|
|
78
|
-
executionTimeout?: number;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
/** AI detection configuration */
|
|
82
|
-
aiDetection?: {
|
|
83
|
-
enabled?: boolean;
|
|
84
|
-
threshold?: number;
|
|
85
|
-
analyzers?: ('git' | 'documentation' | 'structural' | 'statistical' | 'linguistic')[];
|
|
86
|
-
includeInReport?: boolean;
|
|
87
|
-
failOnDetection?: boolean;
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Strategy for coding test assessment and evaluation
|
|
93
|
-
*/
|
|
94
|
-
export class CodingTestReviewStrategy extends BaseReviewStrategy {
|
|
95
|
-
private config: CodingTestConfig;
|
|
96
|
-
private aiDetectionEngine?: AIDetectionEngine;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Create a new coding test review strategy
|
|
100
|
-
* @param config Coding test configuration or options for loading configuration
|
|
101
|
-
*/
|
|
102
|
-
constructor(config: CodingTestConfig | { fromFile?: string; fromUrl?: string } = {}) {
|
|
103
|
-
super('coding-test');
|
|
104
|
-
this.config = this.initializeConfig(config);
|
|
105
|
-
// AI detection initialization moved to execute() method after config merge
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Execute the coding test review strategy
|
|
110
|
-
* @param files Files to review
|
|
111
|
-
* @param projectName Project name
|
|
112
|
-
* @param projectDocs Project documentation
|
|
113
|
-
* @param options Review options
|
|
114
|
-
* @param apiClientConfig API client configuration
|
|
115
|
-
* @returns Promise resolving to the review result
|
|
116
|
-
*/
|
|
117
|
-
async execute(
|
|
118
|
-
files: FileInfo[],
|
|
119
|
-
projectName: string,
|
|
120
|
-
projectDocs: ProjectDocs | null,
|
|
121
|
-
options: ReviewOptions,
|
|
122
|
-
apiClientConfig: ApiClientConfig,
|
|
123
|
-
): Promise<ReviewResult> {
|
|
124
|
-
logger.info(`Executing coding test review strategy for ${projectName}...`);
|
|
125
|
-
|
|
126
|
-
// Merge configuration from options
|
|
127
|
-
const effectiveConfig = this.mergeOptionsWithConfig(options);
|
|
128
|
-
|
|
129
|
-
// Initialize AI detection engine with merged configuration
|
|
130
|
-
this.initializeAIDetectionWithConfig(effectiveConfig);
|
|
131
|
-
|
|
132
|
-
// Collect CI data if applicable
|
|
133
|
-
let ciData;
|
|
134
|
-
if (this.shouldCollectCIData(files, options)) {
|
|
135
|
-
logger.info('Collecting CI data for coding test evaluation...');
|
|
136
|
-
ciData = await collectCIData(process.cwd());
|
|
137
|
-
options.ciData = ciData;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Run AI detection if enabled
|
|
141
|
-
let aiDetectionResult: DetectionResult | null = null;
|
|
142
|
-
if (effectiveConfig.aiDetection?.enabled && this.aiDetectionEngine) {
|
|
143
|
-
logger.info('🔍 Starting AI detection analysis...');
|
|
144
|
-
logger.debug(
|
|
145
|
-
`AI detection configuration: threshold=${effectiveConfig.aiDetection.threshold}, analyzers=${effectiveConfig.aiDetection.analyzers?.join(',')}`,
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
const startTime = Date.now();
|
|
149
|
-
try {
|
|
150
|
-
logger.debug('Converting submission data for AI analysis...');
|
|
151
|
-
const submission = await SubmissionConverter.convert(files, projectName, projectDocs);
|
|
152
|
-
logger.debug(
|
|
153
|
-
`Submission conversion completed. Files: ${submission.codebase.files.length}, Commits: ${submission.repository.commits.length}`,
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
logger.debug('Running AI detection engine analysis...');
|
|
157
|
-
aiDetectionResult = await this.aiDetectionEngine.analyze(submission);
|
|
158
|
-
|
|
159
|
-
const analysisTime = Date.now() - startTime;
|
|
160
|
-
logger.info(`✅ AI detection completed in ${analysisTime}ms`);
|
|
161
|
-
logger.info(
|
|
162
|
-
`📊 Results: Confidence=${aiDetectionResult.confidenceScore.toFixed(3)}, AI Generated=${aiDetectionResult.isAIGenerated}, Patterns=${aiDetectionResult.detectedPatterns.length}`,
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
if (aiDetectionResult.isAIGenerated) {
|
|
166
|
-
const riskLevel = this.calculateRiskLevel(aiDetectionResult.confidenceScore);
|
|
167
|
-
logger.warn(`🚨 AI-generated content detected! Risk Level: ${riskLevel}`);
|
|
168
|
-
|
|
169
|
-
// Log detected patterns for debugging
|
|
170
|
-
if (aiDetectionResult.detectedPatterns.length > 0) {
|
|
171
|
-
logger.debug('Detected patterns:');
|
|
172
|
-
aiDetectionResult.detectedPatterns.forEach((pattern) => {
|
|
173
|
-
logger.debug(
|
|
174
|
-
` - ${pattern.name} (${pattern.id}): confidence=${pattern.confidence}, score=${pattern.score}`,
|
|
175
|
-
);
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Log recommendations
|
|
180
|
-
if (aiDetectionResult.recommendations.length > 0) {
|
|
181
|
-
logger.info('AI detection recommendations:');
|
|
182
|
-
aiDetectionResult.recommendations.forEach((rec) => {
|
|
183
|
-
logger.info(` ${rec}`);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
} else {
|
|
187
|
-
logger.info('✅ No significant AI-generated patterns detected');
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Log analyzer performance
|
|
191
|
-
if (aiDetectionResult.metadata.warnings.length > 0) {
|
|
192
|
-
logger.warn('AI detection warnings:');
|
|
193
|
-
aiDetectionResult.metadata.warnings.forEach((warning) => {
|
|
194
|
-
logger.warn(` ⚠️ ${warning}`);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
} catch (error) {
|
|
198
|
-
const analysisTime = Date.now() - startTime;
|
|
199
|
-
logger.error(
|
|
200
|
-
`❌ AI detection failed after ${analysisTime}ms: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
if (error instanceof Error && error.stack) {
|
|
204
|
-
logger.debug('AI detection error stack:', error.stack);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Log troubleshooting information
|
|
208
|
-
logger.info('🔧 AI detection troubleshooting:');
|
|
209
|
-
logger.info(
|
|
210
|
-
' 1. Ensure the target directory contains a git repository with commit history',
|
|
211
|
-
);
|
|
212
|
-
logger.info(' 2. Check that the project has documentation files (README, comments)');
|
|
213
|
-
logger.info(' 3. Verify sufficient disk space and memory availability');
|
|
214
|
-
logger.info(' 4. Try running with --debug flag for detailed logs');
|
|
215
|
-
logger.info(' 5. Consider using fewer analyzers (--ai-detection-analyzers git)');
|
|
216
|
-
}
|
|
217
|
-
} else if (effectiveConfig.aiDetection?.enabled && !this.aiDetectionEngine) {
|
|
218
|
-
logger.warn('⚠️ AI detection enabled but engine not initialized. Check configuration.');
|
|
219
|
-
} else {
|
|
220
|
-
logger.debug('AI detection disabled or not configured');
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Prepare enhanced options with coding test context and AI detection results
|
|
224
|
-
const enhancedOptions = this.enhanceOptionsWithCodingTestContext(
|
|
225
|
-
options,
|
|
226
|
-
effectiveConfig,
|
|
227
|
-
aiDetectionResult,
|
|
228
|
-
);
|
|
229
|
-
|
|
230
|
-
// Generate the review using the selected API client
|
|
231
|
-
const result = await generateReview(
|
|
232
|
-
files,
|
|
233
|
-
projectName,
|
|
234
|
-
this.reviewType,
|
|
235
|
-
projectDocs,
|
|
236
|
-
enhancedOptions,
|
|
237
|
-
apiClientConfig,
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
// Enhance result with coding test metadata and AI detection
|
|
241
|
-
return this.enhanceResultWithCodingTestMetadata(result, effectiveConfig, aiDetectionResult);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Initialize configuration from various sources
|
|
246
|
-
* @param config Configuration or loading options
|
|
247
|
-
* @returns Initialized configuration
|
|
248
|
-
*/
|
|
249
|
-
private initializeConfig(
|
|
250
|
-
config: CodingTestConfig | { fromFile?: string; fromUrl?: string },
|
|
251
|
-
): CodingTestConfig {
|
|
252
|
-
// Check if it's a loading configuration
|
|
253
|
-
if ('fromFile' in config || 'fromUrl' in config) {
|
|
254
|
-
if (config.fromFile) {
|
|
255
|
-
logger.info(`Loading coding test configuration from file: ${config.fromFile}`);
|
|
256
|
-
const extendedConfig = loadCodingTestConfig(config.fromFile);
|
|
257
|
-
return this.normalizeConfig(convertToCodingTestConfig(extendedConfig));
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (config.fromUrl) {
|
|
261
|
-
logger.info(`Loading coding test configuration from URL: ${config.fromUrl}`);
|
|
262
|
-
// Note: This would need to be handled asynchronously in a real implementation
|
|
263
|
-
// For now, we'll fall back to default configuration
|
|
264
|
-
logger.warn(
|
|
265
|
-
'URL-based configuration loading not implemented in constructor. Using default configuration.',
|
|
266
|
-
);
|
|
267
|
-
return this.normalizeConfig(createDefaultCodingTestConfig());
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// No valid loading option provided, use default
|
|
271
|
-
return this.normalizeConfig(createDefaultCodingTestConfig());
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// It's a direct configuration object
|
|
275
|
-
return this.normalizeConfig(config as CodingTestConfig);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Normalize and validate configuration
|
|
280
|
-
* @param config Input configuration
|
|
281
|
-
* @returns Normalized configuration
|
|
282
|
-
*/
|
|
283
|
-
private normalizeConfig(config: CodingTestConfig): CodingTestConfig {
|
|
284
|
-
const normalized: CodingTestConfig = {
|
|
285
|
-
assignment: {
|
|
286
|
-
difficulty: 'mid',
|
|
287
|
-
type: 'coding-challenge',
|
|
288
|
-
timeLimit: 120,
|
|
289
|
-
...config.assignment,
|
|
290
|
-
},
|
|
291
|
-
criteria: {
|
|
292
|
-
correctness: 30,
|
|
293
|
-
codeQuality: 25,
|
|
294
|
-
architecture: 20,
|
|
295
|
-
performance: 15,
|
|
296
|
-
testing: 10,
|
|
297
|
-
...config.criteria,
|
|
298
|
-
},
|
|
299
|
-
scoring: {
|
|
300
|
-
system: 'numeric',
|
|
301
|
-
maxScore: 100,
|
|
302
|
-
passingThreshold: 70,
|
|
303
|
-
breakdown: true,
|
|
304
|
-
...config.scoring,
|
|
305
|
-
},
|
|
306
|
-
feedback: {
|
|
307
|
-
level: 'detailed',
|
|
308
|
-
includeExamples: true,
|
|
309
|
-
includeSuggestions: true,
|
|
310
|
-
includeResources: false,
|
|
311
|
-
...config.feedback,
|
|
312
|
-
},
|
|
313
|
-
constraints: {
|
|
314
|
-
...config.constraints,
|
|
315
|
-
},
|
|
316
|
-
aiDetection: {
|
|
317
|
-
enabled: false,
|
|
318
|
-
threshold: 0.7,
|
|
319
|
-
analyzers: ['git', 'documentation'],
|
|
320
|
-
includeInReport: true,
|
|
321
|
-
failOnDetection: false,
|
|
322
|
-
...config.aiDetection,
|
|
323
|
-
},
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
// Validate criteria weights sum to 100
|
|
327
|
-
this.validateCriteriaWeights(normalized.criteria!);
|
|
328
|
-
|
|
329
|
-
return normalized;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Validate that criteria weights sum to 100
|
|
334
|
-
* @param criteria Criteria configuration
|
|
335
|
-
*/
|
|
336
|
-
private validateCriteriaWeights(criteria: Record<string, number>): void {
|
|
337
|
-
const total = Object.values(criteria).reduce((sum, weight) => sum + weight, 0);
|
|
338
|
-
if (Math.abs(total - 100) > 0.1) {
|
|
339
|
-
logger.warn(`Criteria weights sum to ${total}, expected 100. Normalizing...`);
|
|
340
|
-
|
|
341
|
-
// Normalize weights to sum to 100
|
|
342
|
-
const normalizationFactor = 100 / total;
|
|
343
|
-
Object.keys(criteria).forEach((key) => {
|
|
344
|
-
criteria[key] = Math.round(criteria[key] * normalizationFactor);
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Merge CLI options with configuration
|
|
351
|
-
* @param options Review options
|
|
352
|
-
* @returns Merged configuration
|
|
353
|
-
*/
|
|
354
|
-
private mergeOptionsWithConfig(options: ReviewOptions): CodingTestConfig {
|
|
355
|
-
const merged = { ...this.config };
|
|
356
|
-
|
|
357
|
-
// Merge assignment configuration
|
|
358
|
-
if (options.assignmentFile || options.assignmentText || options.assignmentUrl) {
|
|
359
|
-
merged.assignment = {
|
|
360
|
-
...merged.assignment,
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
// Handle assignment text parsing
|
|
364
|
-
if (options.assignmentText) {
|
|
365
|
-
const parsedAssignment = parseAssignmentText(options.assignmentText);
|
|
366
|
-
merged.assignment = {
|
|
367
|
-
...merged.assignment,
|
|
368
|
-
...parsedAssignment,
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// Handle assignment file loading
|
|
373
|
-
if (options.assignmentFile) {
|
|
374
|
-
try {
|
|
375
|
-
const fs = require('node:fs');
|
|
376
|
-
const assignmentContent = fs.readFileSync(options.assignmentFile, 'utf8');
|
|
377
|
-
const parsedAssignment = parseAssignmentText(assignmentContent);
|
|
378
|
-
merged.assignment = {
|
|
379
|
-
...merged.assignment,
|
|
380
|
-
...parsedAssignment,
|
|
381
|
-
};
|
|
382
|
-
} catch (error) {
|
|
383
|
-
logger.warn(`Failed to load assignment file ${options.assignmentFile}:`, error);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (options.assessmentType) {
|
|
389
|
-
merged.assignment!.type = options.assessmentType;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
if (options.difficultyLevel) {
|
|
393
|
-
merged.assignment!.difficulty = options.difficultyLevel;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
if (options.timeLimit) {
|
|
397
|
-
merged.assignment!.timeLimit = options.timeLimit;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// Merge criteria weights
|
|
401
|
-
const criteriaUpdates: Record<string, number> = {};
|
|
402
|
-
if (options.weightCorrectness !== undefined)
|
|
403
|
-
criteriaUpdates.correctness = options.weightCorrectness;
|
|
404
|
-
if (options.weightCodeQuality !== undefined)
|
|
405
|
-
criteriaUpdates.codeQuality = options.weightCodeQuality;
|
|
406
|
-
if (options.weightArchitecture !== undefined)
|
|
407
|
-
criteriaUpdates.architecture = options.weightArchitecture;
|
|
408
|
-
if (options.weightPerformance !== undefined)
|
|
409
|
-
criteriaUpdates.performance = options.weightPerformance;
|
|
410
|
-
if (options.weightTesting !== undefined) criteriaUpdates.testing = options.weightTesting;
|
|
411
|
-
|
|
412
|
-
if (Object.keys(criteriaUpdates).length > 0) {
|
|
413
|
-
merged.criteria = { ...merged.criteria, ...criteriaUpdates };
|
|
414
|
-
this.validateCriteriaWeights(merged.criteria);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// Merge scoring configuration
|
|
418
|
-
if (options.scoringSystem) {
|
|
419
|
-
merged.scoring!.system = options.scoringSystem;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
if (options.maxScore !== undefined) {
|
|
423
|
-
merged.scoring!.maxScore = options.maxScore;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
if (options.passingThreshold !== undefined) {
|
|
427
|
-
merged.scoring!.passingThreshold = options.passingThreshold;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if (options.scoreBreakdown !== undefined) {
|
|
431
|
-
merged.scoring!.breakdown = options.scoreBreakdown;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
// Merge feedback configuration
|
|
435
|
-
if (options.feedbackLevel) {
|
|
436
|
-
merged.feedback!.level = options.feedbackLevel;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
if (options.includeExamples !== undefined) {
|
|
440
|
-
merged.feedback!.includeExamples = options.includeExamples;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
if (options.includeSuggestions !== undefined) {
|
|
444
|
-
merged.feedback!.includeSuggestions = options.includeSuggestions;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
if (options.includeResources !== undefined) {
|
|
448
|
-
merged.feedback!.includeResources = options.includeResources;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
// Merge constraints
|
|
452
|
-
if (options.allowedLibraries) {
|
|
453
|
-
merged.constraints!.allowedLibraries = options.allowedLibraries;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
if (options.forbiddenPatterns) {
|
|
457
|
-
merged.constraints!.forbiddenPatterns = options.forbiddenPatterns;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
if (options.language) {
|
|
461
|
-
merged.constraints!.targetLanguage = options.language;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
if (options.framework) {
|
|
465
|
-
merged.constraints!.framework = options.framework;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
// Merge AI detection configuration from CLI options
|
|
469
|
-
if (options.enableAiDetection !== undefined) {
|
|
470
|
-
merged.aiDetection!.enabled = options.enableAiDetection;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
if (options.aiDetectionThreshold !== undefined) {
|
|
474
|
-
merged.aiDetection!.threshold = options.aiDetectionThreshold;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
if (options.aiDetectionAnalyzers) {
|
|
478
|
-
const analyzers = options.aiDetectionAnalyzers.split(',').map((a) => a.trim()) as (
|
|
479
|
-
| 'git'
|
|
480
|
-
| 'documentation'
|
|
481
|
-
| 'structural'
|
|
482
|
-
| 'statistical'
|
|
483
|
-
| 'linguistic'
|
|
484
|
-
)[];
|
|
485
|
-
merged.aiDetection!.analyzers = analyzers;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
if (options.aiDetectionIncludeInReport !== undefined) {
|
|
489
|
-
merged.aiDetection!.includeInReport = options.aiDetectionIncludeInReport;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
if (options.aiDetectionFailOnDetection !== undefined) {
|
|
493
|
-
merged.aiDetection!.failOnDetection = options.aiDetectionFailOnDetection;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
return merged;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Determine if CI data should be collected
|
|
501
|
-
* @param files Files being reviewed
|
|
502
|
-
* @param options Review options
|
|
503
|
-
* @returns True if CI data should be collected
|
|
504
|
-
*/
|
|
505
|
-
private shouldCollectCIData(files: FileInfo[], options: ReviewOptions): boolean {
|
|
506
|
-
return (
|
|
507
|
-
options.language === 'typescript' ||
|
|
508
|
-
files.some((f) => f.path.endsWith('.ts') || f.path.endsWith('.tsx'))
|
|
509
|
-
);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* Enhance options with coding test context
|
|
514
|
-
* @param options Original options
|
|
515
|
-
* @param config Effective configuration
|
|
516
|
-
* @returns Enhanced options
|
|
517
|
-
*/
|
|
518
|
-
private enhanceOptionsWithCodingTestContext(
|
|
519
|
-
options: ReviewOptions,
|
|
520
|
-
config: CodingTestConfig,
|
|
521
|
-
aiDetectionResult?: DetectionResult | null,
|
|
522
|
-
): ReviewOptions {
|
|
523
|
-
const enhanced = { ...options };
|
|
524
|
-
|
|
525
|
-
// Add coding test metadata to options
|
|
526
|
-
enhanced.codingTestConfig = config;
|
|
527
|
-
|
|
528
|
-
// Add prompt fragments for assignment context
|
|
529
|
-
if (!enhanced.promptFragments) {
|
|
530
|
-
enhanced.promptFragments = [];
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
// Add assignment context
|
|
534
|
-
if (config.assignment) {
|
|
535
|
-
enhanced.promptFragments.push({
|
|
536
|
-
content: this.buildAssignmentContextPrompt(config.assignment),
|
|
537
|
-
position: 'start',
|
|
538
|
-
priority: 1,
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
// Add evaluation criteria context
|
|
543
|
-
if (config.criteria) {
|
|
544
|
-
enhanced.promptFragments.push({
|
|
545
|
-
content: this.buildCriteriaContextPrompt(config.criteria),
|
|
546
|
-
position: 'start',
|
|
547
|
-
priority: 2,
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
// Add scoring context
|
|
552
|
-
if (config.scoring) {
|
|
553
|
-
enhanced.promptFragments.push({
|
|
554
|
-
content: this.buildScoringContextPrompt(config.scoring),
|
|
555
|
-
position: 'start',
|
|
556
|
-
priority: 3,
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
// Add feedback instructions
|
|
561
|
-
if (config.feedback) {
|
|
562
|
-
enhanced.promptFragments.push({
|
|
563
|
-
content: this.buildFeedbackInstructionsPrompt(config.feedback),
|
|
564
|
-
position: 'middle',
|
|
565
|
-
priority: 1,
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
// Add constraints context
|
|
570
|
-
if (config.constraints) {
|
|
571
|
-
enhanced.promptFragments.push({
|
|
572
|
-
content: this.buildConstraintsContextPrompt(config.constraints),
|
|
573
|
-
position: 'middle',
|
|
574
|
-
priority: 2,
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
// Add AI detection context if available
|
|
579
|
-
if (aiDetectionResult && config.aiDetection?.includeInReport) {
|
|
580
|
-
enhanced.promptFragments.push({
|
|
581
|
-
content: this.buildAIDetectionContextPrompt(aiDetectionResult, config.aiDetection),
|
|
582
|
-
position: 'middle',
|
|
583
|
-
priority: 0, // High priority for AI detection results
|
|
584
|
-
});
|
|
585
|
-
|
|
586
|
-
// Add AI detection data for template rendering
|
|
587
|
-
if (!enhanced.metadata) {
|
|
588
|
-
enhanced.metadata = {};
|
|
589
|
-
}
|
|
590
|
-
enhanced.metadata.aiDetection = {
|
|
591
|
-
isAIGenerated: aiDetectionResult.isAIGenerated,
|
|
592
|
-
confidenceScore: aiDetectionResult.confidenceScore,
|
|
593
|
-
patternsDetected: aiDetectionResult.detectedPatterns.length,
|
|
594
|
-
highConfidencePatterns: aiDetectionResult.detectedPatterns.filter(
|
|
595
|
-
(p) => p.confidence === 'high',
|
|
596
|
-
).length,
|
|
597
|
-
analysisTime: aiDetectionResult.metadata.totalAnalysisTime,
|
|
598
|
-
analyzersUsed: aiDetectionResult.metadata.enabledAnalyzers,
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
return enhanced;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* Build assignment context prompt
|
|
607
|
-
* @param assignment Assignment configuration
|
|
608
|
-
* @returns Assignment context prompt
|
|
609
|
-
*/
|
|
610
|
-
private buildAssignmentContextPrompt(
|
|
611
|
-
assignment: NonNullable<CodingTestConfig['assignment']>,
|
|
612
|
-
): string {
|
|
613
|
-
let prompt = '## Assignment Context\n\n';
|
|
614
|
-
|
|
615
|
-
if (assignment.title) {
|
|
616
|
-
prompt += `**Assignment Title:** ${assignment.title}\n\n`;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
if (assignment.description) {
|
|
620
|
-
prompt += `**Assignment Description:**\n${assignment.description}\n\n`;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
if (assignment.requirements && assignment.requirements.length > 0) {
|
|
624
|
-
prompt += `**Requirements:**\n`;
|
|
625
|
-
assignment.requirements.forEach((req) => {
|
|
626
|
-
prompt += `- ${req}\n`;
|
|
627
|
-
});
|
|
628
|
-
prompt += '\n';
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
prompt += `**Assessment Type:** ${assignment.type}\n`;
|
|
632
|
-
prompt += `**Difficulty Level:** ${assignment.difficulty}\n`;
|
|
633
|
-
|
|
634
|
-
if (assignment.timeLimit) {
|
|
635
|
-
prompt += `**Time Limit:** ${assignment.timeLimit} minutes\n`;
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
return prompt;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
/**
|
|
642
|
-
* Build criteria context prompt
|
|
643
|
-
* @param criteria Criteria configuration
|
|
644
|
-
* @returns Criteria context prompt
|
|
645
|
-
*/
|
|
646
|
-
private buildCriteriaContextPrompt(criteria: NonNullable<CodingTestConfig['criteria']>): string {
|
|
647
|
-
let prompt = '## Evaluation Criteria\n\n';
|
|
648
|
-
prompt += 'Evaluate the code based on the following weighted criteria:\n\n';
|
|
649
|
-
|
|
650
|
-
Object.entries(criteria).forEach(([criterion, weight]) => {
|
|
651
|
-
prompt += `- **${this.formatCriterionName(criterion)}:** ${weight}% weight\n`;
|
|
652
|
-
});
|
|
653
|
-
|
|
654
|
-
return `${prompt}\n`;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* Build scoring context prompt
|
|
659
|
-
* @param scoring Scoring configuration
|
|
660
|
-
* @returns Scoring context prompt
|
|
661
|
-
*/
|
|
662
|
-
private buildScoringContextPrompt(scoring: NonNullable<CodingTestConfig['scoring']>): string {
|
|
663
|
-
let prompt = '## Scoring System\n\n';
|
|
664
|
-
prompt += `**System:** ${scoring.system}\n`;
|
|
665
|
-
prompt += `**Maximum Score:** ${scoring.maxScore}\n`;
|
|
666
|
-
prompt += `**Passing Threshold:** ${scoring.passingThreshold}\n`;
|
|
667
|
-
|
|
668
|
-
if (scoring.breakdown) {
|
|
669
|
-
prompt += '**Score Breakdown:** Required for each criterion\n';
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
return `${prompt}\n`;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* Build feedback instructions prompt
|
|
677
|
-
* @param feedback Feedback configuration
|
|
678
|
-
* @returns Feedback instructions prompt
|
|
679
|
-
*/
|
|
680
|
-
private buildFeedbackInstructionsPrompt(
|
|
681
|
-
feedback: NonNullable<CodingTestConfig['feedback']>,
|
|
682
|
-
): string {
|
|
683
|
-
let prompt = '## Feedback Instructions\n\n';
|
|
684
|
-
prompt += `**Detail Level:** ${feedback.level}\n`;
|
|
685
|
-
|
|
686
|
-
if (feedback.includeExamples) {
|
|
687
|
-
prompt += '- Include specific code examples in feedback\n';
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
if (feedback.includeSuggestions) {
|
|
691
|
-
prompt += '- Provide concrete improvement suggestions\n';
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
if (feedback.includeResources) {
|
|
695
|
-
prompt += '- Include relevant learning resources\n';
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
return `${prompt}\n`;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
/**
|
|
702
|
-
* Build constraints context prompt
|
|
703
|
-
* @param constraints Constraints configuration
|
|
704
|
-
* @returns Constraints context prompt
|
|
705
|
-
*/
|
|
706
|
-
private buildConstraintsContextPrompt(
|
|
707
|
-
constraints: NonNullable<CodingTestConfig['constraints']>,
|
|
708
|
-
): string {
|
|
709
|
-
let prompt = '## Technical Constraints\n\n';
|
|
710
|
-
|
|
711
|
-
if (constraints.allowedLibraries && constraints.allowedLibraries.length > 0) {
|
|
712
|
-
prompt += `**Allowed Libraries:** ${constraints.allowedLibraries.join(', ')}\n`;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
if (constraints.forbiddenPatterns && constraints.forbiddenPatterns.length > 0) {
|
|
716
|
-
prompt += `**Forbidden Patterns:** ${constraints.forbiddenPatterns.join(', ')}\n`;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
if (constraints.targetLanguage) {
|
|
720
|
-
prompt += `**Target Language:** ${constraints.targetLanguage}\n`;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
if (constraints.framework) {
|
|
724
|
-
prompt += `**Framework:** ${constraints.framework}\n`;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
if (constraints.nodeVersion) {
|
|
728
|
-
prompt += `**Node.js Version:** ${constraints.nodeVersion}\n`;
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
if (constraints.memoryLimit) {
|
|
732
|
-
prompt += `**Memory Limit:** ${constraints.memoryLimit} MB\n`;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
if (constraints.executionTimeout) {
|
|
736
|
-
prompt += `**Execution Timeout:** ${constraints.executionTimeout} seconds\n`;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
return `${prompt}\n`;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* Format criterion name for display
|
|
744
|
-
* @param criterion Criterion key
|
|
745
|
-
* @returns Formatted criterion name
|
|
746
|
-
*/
|
|
747
|
-
private formatCriterionName(criterion: string): string {
|
|
748
|
-
return criterion
|
|
749
|
-
.replace(/([A-Z])/g, ' $1')
|
|
750
|
-
.replace(/^./, (str) => str.toUpperCase())
|
|
751
|
-
.trim();
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
/**
|
|
755
|
-
* Enhance result with coding test metadata
|
|
756
|
-
* @param result Original result
|
|
757
|
-
* @param config Configuration used
|
|
758
|
-
* @returns Enhanced result
|
|
759
|
-
*/
|
|
760
|
-
private enhanceResultWithCodingTestMetadata(
|
|
761
|
-
result: ReviewResult,
|
|
762
|
-
config: CodingTestConfig,
|
|
763
|
-
aiDetectionResult?: DetectionResult | null,
|
|
764
|
-
): ReviewResult {
|
|
765
|
-
const enhanced = {
|
|
766
|
-
...result,
|
|
767
|
-
metadata: {
|
|
768
|
-
...result.metadata,
|
|
769
|
-
codingTestConfig: config,
|
|
770
|
-
assessmentType: config.assignment?.type || 'coding-challenge',
|
|
771
|
-
difficultyLevel: config.assignment?.difficulty || 'mid',
|
|
772
|
-
criteriaWeights: config.criteria,
|
|
773
|
-
scoringSystem: config.scoring?.system || 'numeric',
|
|
774
|
-
maxScore: config.scoring?.maxScore || 100,
|
|
775
|
-
passingThreshold: config.scoring?.passingThreshold || 70,
|
|
776
|
-
},
|
|
777
|
-
};
|
|
778
|
-
|
|
779
|
-
// Add AI detection results to metadata if available
|
|
780
|
-
if (aiDetectionResult) {
|
|
781
|
-
enhanced.metadata.aiDetection = {
|
|
782
|
-
isAIGenerated: aiDetectionResult.isAIGenerated,
|
|
783
|
-
confidenceScore: aiDetectionResult.confidenceScore,
|
|
784
|
-
patternsDetected: aiDetectionResult.detectedPatterns.length,
|
|
785
|
-
highConfidencePatterns: aiDetectionResult.detectedPatterns.filter(
|
|
786
|
-
(p) => p.confidence === 'high',
|
|
787
|
-
).length,
|
|
788
|
-
analysisTime: aiDetectionResult.metadata.totalAnalysisTime,
|
|
789
|
-
analyzersUsed: aiDetectionResult.metadata.enabledAnalyzers,
|
|
790
|
-
};
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
return enhanced;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
/**
|
|
797
|
-
* Initialize AI detection engine with merged configuration
|
|
798
|
-
* @param config Effective configuration after merging options
|
|
799
|
-
*/
|
|
800
|
-
private initializeAIDetectionWithConfig(config: CodingTestConfig): void {
|
|
801
|
-
if (config.aiDetection?.enabled) {
|
|
802
|
-
const detectionConfig: Partial<DetectionConfig> = {
|
|
803
|
-
detectionThreshold: config.aiDetection.threshold || 0.7,
|
|
804
|
-
enabledAnalyzers: config.aiDetection.analyzers || ['git', 'documentation'],
|
|
805
|
-
enableCaching: true,
|
|
806
|
-
includeEvidence: true,
|
|
807
|
-
generateRecommendations: true,
|
|
808
|
-
};
|
|
809
|
-
|
|
810
|
-
this.aiDetectionEngine = new AIDetectionEngine(detectionConfig);
|
|
811
|
-
logger.info(
|
|
812
|
-
'AI detection engine initialized with analyzers:',
|
|
813
|
-
detectionConfig.enabledAnalyzers,
|
|
814
|
-
);
|
|
815
|
-
} else {
|
|
816
|
-
logger.info('AI detection disabled or not configured');
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
/**
|
|
821
|
-
* Initialize AI detection engine if enabled (legacy method - kept for compatibility)
|
|
822
|
-
*/
|
|
823
|
-
private initializeAIDetection(): void {
|
|
824
|
-
if (this.config.aiDetection?.enabled) {
|
|
825
|
-
const detectionConfig: Partial<DetectionConfig> = {
|
|
826
|
-
detectionThreshold: this.config.aiDetection.threshold || 0.7,
|
|
827
|
-
enabledAnalyzers: this.config.aiDetection.analyzers || ['git', 'documentation'],
|
|
828
|
-
enableCaching: true,
|
|
829
|
-
includeEvidence: true,
|
|
830
|
-
generateRecommendations: true,
|
|
831
|
-
};
|
|
832
|
-
|
|
833
|
-
this.aiDetectionEngine = new AIDetectionEngine(detectionConfig);
|
|
834
|
-
logger.info(
|
|
835
|
-
'AI detection engine initialized with analyzers:',
|
|
836
|
-
detectionConfig.enabledAnalyzers,
|
|
837
|
-
);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
* Build AI detection context prompt
|
|
843
|
-
* @param aiDetectionResult AI detection analysis result
|
|
844
|
-
* @param config AI detection configuration
|
|
845
|
-
* @returns AI detection context prompt
|
|
846
|
-
*/
|
|
847
|
-
private buildAIDetectionContextPrompt(
|
|
848
|
-
aiDetectionResult: DetectionResult,
|
|
849
|
-
config: NonNullable<CodingTestConfig['aiDetection']>,
|
|
850
|
-
): string {
|
|
851
|
-
let prompt = '## AI-Generated Code Detection Results\n\n';
|
|
852
|
-
|
|
853
|
-
if (aiDetectionResult.isAIGenerated) {
|
|
854
|
-
prompt += `🚨 **ALERT: AI-Generated Content Detected**\n\n`;
|
|
855
|
-
prompt += `**Confidence Score:** ${(aiDetectionResult.confidenceScore * 100).toFixed(1)}%\n`;
|
|
856
|
-
prompt += `**Risk Level:** ${this.calculateRiskLevel(aiDetectionResult.confidenceScore)}\n\n`;
|
|
857
|
-
} else {
|
|
858
|
-
prompt += `✅ **Human-Authored Code Detected**\n\n`;
|
|
859
|
-
prompt += `**Confidence Score:** ${(aiDetectionResult.confidenceScore * 100).toFixed(1)}%\n\n`;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
if (aiDetectionResult.detectedPatterns.length > 0) {
|
|
863
|
-
prompt += `**Detected Patterns (${aiDetectionResult.detectedPatterns.length}):**\n`;
|
|
864
|
-
|
|
865
|
-
const highConfidencePatterns = aiDetectionResult.detectedPatterns.filter(
|
|
866
|
-
(p) => p.confidence === 'high',
|
|
867
|
-
);
|
|
868
|
-
if (highConfidencePatterns.length > 0) {
|
|
869
|
-
prompt += `\n*High Confidence Patterns:*\n`;
|
|
870
|
-
highConfidencePatterns.forEach((pattern) => {
|
|
871
|
-
prompt += `- **${pattern.name}** (${pattern.id}): ${pattern.description}\n`;
|
|
872
|
-
});
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
const mediumConfidencePatterns = aiDetectionResult.detectedPatterns.filter(
|
|
876
|
-
(p) => p.confidence === 'medium',
|
|
877
|
-
);
|
|
878
|
-
if (mediumConfidencePatterns.length > 0) {
|
|
879
|
-
prompt += `\n*Medium Confidence Patterns:*\n`;
|
|
880
|
-
mediumConfidencePatterns.forEach((pattern) => {
|
|
881
|
-
prompt += `- **${pattern.name}** (${pattern.id}): ${pattern.description}\n`;
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
if (aiDetectionResult.recommendations.length > 0) {
|
|
887
|
-
prompt += `\n**Evaluation Recommendations:**\n`;
|
|
888
|
-
aiDetectionResult.recommendations.forEach((rec) => {
|
|
889
|
-
prompt += `- ${rec}\n`;
|
|
890
|
-
});
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
prompt += `\n**Instructions for Evaluation:**\n`;
|
|
894
|
-
if (aiDetectionResult.isAIGenerated) {
|
|
895
|
-
prompt += `- This submission requires additional verification due to AI detection\n`;
|
|
896
|
-
prompt += `- Focus evaluation on candidate's understanding rather than just code functionality\n`;
|
|
897
|
-
prompt += `- Consider the specific patterns detected when assessing authenticity\n`;
|
|
898
|
-
if (config.failOnDetection) {
|
|
899
|
-
prompt += `- **IMPORTANT:** Configuration indicates this submission should fail if AI-generated\n`;
|
|
900
|
-
}
|
|
901
|
-
} else {
|
|
902
|
-
prompt += `- Proceed with standard evaluation criteria\n`;
|
|
903
|
-
prompt += `- AI detection indicates likely human authorship\n`;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
return `${prompt}\n`;
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
* Calculate risk level based on confidence score
|
|
911
|
-
* @param confidenceScore Confidence score from 0.0 to 1.0
|
|
912
|
-
* @returns Risk level
|
|
913
|
-
*/
|
|
914
|
-
private calculateRiskLevel(confidenceScore: number): string {
|
|
915
|
-
if (confidenceScore >= 0.9) return 'CRITICAL';
|
|
916
|
-
if (confidenceScore >= 0.8) return 'HIGH';
|
|
917
|
-
if (confidenceScore >= 0.6) return 'MEDIUM';
|
|
918
|
-
return 'LOW';
|
|
919
|
-
}
|
|
920
|
-
}
|