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
package/src/utils/fileFilters.ts
DELETED
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Utilities for filtering and selecting files for code review.
|
|
3
|
-
*
|
|
4
|
-
* This module provides functions for identifying, filtering, and selecting files
|
|
5
|
-
* for code review based on various criteria. It handles file discovery, gitignore
|
|
6
|
-
* pattern matching, file extension filtering, and test file identification.
|
|
7
|
-
* Supported file types include TypeScript, JavaScript, JSON, and Markdown.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import fs from 'node:fs/promises';
|
|
11
|
-
import path from 'node:path';
|
|
12
|
-
import type { FileInfo } from '../types/review';
|
|
13
|
-
import logger from './logger';
|
|
14
|
-
|
|
15
|
-
// import { promises as fsPromises } from 'fs'; // TODO: Remove if not needed
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Supported file extensions for code review - focus on executable code only
|
|
19
|
-
* Exclude non-executable files like .md, .txt, .log, .tgz, .json, and .svg
|
|
20
|
-
*/
|
|
21
|
-
const SUPPORTED_EXTENSIONS = [
|
|
22
|
-
'.ts',
|
|
23
|
-
'.tsx',
|
|
24
|
-
'.js',
|
|
25
|
-
'.jsx',
|
|
26
|
-
'.py',
|
|
27
|
-
'.pyc',
|
|
28
|
-
'.pyi',
|
|
29
|
-
'.pyx',
|
|
30
|
-
'.pyd',
|
|
31
|
-
'.php',
|
|
32
|
-
'.java',
|
|
33
|
-
'.rb',
|
|
34
|
-
'.rake',
|
|
35
|
-
'.gemspec',
|
|
36
|
-
'.ru',
|
|
37
|
-
'.erb',
|
|
38
|
-
'.go',
|
|
39
|
-
'.rs',
|
|
40
|
-
'.c',
|
|
41
|
-
'.cpp',
|
|
42
|
-
'.h',
|
|
43
|
-
'.hpp',
|
|
44
|
-
'.cs',
|
|
45
|
-
'.swift',
|
|
46
|
-
'.kt',
|
|
47
|
-
'.dart',
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Check if a file is a test file
|
|
52
|
-
* @param filePath File path
|
|
53
|
-
* @returns True if the file is a test file
|
|
54
|
-
*/
|
|
55
|
-
export function isTestFile(filePath: string): boolean {
|
|
56
|
-
const fileName = path.basename(filePath);
|
|
57
|
-
return (
|
|
58
|
-
fileName.includes('.test.') ||
|
|
59
|
-
fileName.includes('.spec.') ||
|
|
60
|
-
fileName.startsWith('test-') ||
|
|
61
|
-
fileName.endsWith('.test.ts') ||
|
|
62
|
-
fileName.endsWith('.test.js') ||
|
|
63
|
-
fileName.endsWith('.spec.ts') ||
|
|
64
|
-
fileName.endsWith('.spec.js') ||
|
|
65
|
-
filePath.includes('/__tests__/') ||
|
|
66
|
-
filePath.includes('/test/') ||
|
|
67
|
-
filePath.includes('/tests/')
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Load gitignore patterns from a project directory
|
|
73
|
-
* @param projectDir Project directory path
|
|
74
|
-
* @returns Array of gitignore patterns
|
|
75
|
-
*/
|
|
76
|
-
export async function loadGitignorePatterns(projectDir: string): Promise<string[]> {
|
|
77
|
-
try {
|
|
78
|
-
const gitignorePath = path.join(projectDir, '.gitignore');
|
|
79
|
-
|
|
80
|
-
// Check if .gitignore exists
|
|
81
|
-
try {
|
|
82
|
-
await fs.access(gitignorePath);
|
|
83
|
-
} catch (_error) {
|
|
84
|
-
// File doesn't exist
|
|
85
|
-
logger.debug(`No .gitignore file found at ${gitignorePath}`);
|
|
86
|
-
return [];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Read and parse .gitignore
|
|
90
|
-
const content = await fs.readFile(gitignorePath, 'utf-8');
|
|
91
|
-
return content
|
|
92
|
-
.split('\n')
|
|
93
|
-
.map((line) => line.trim())
|
|
94
|
-
.filter((line) => line && !line.startsWith('#'));
|
|
95
|
-
} catch (error) {
|
|
96
|
-
logger.error(`Error reading .gitignore: ${error}`);
|
|
97
|
-
return [];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Check if a file should be excluded based on gitignore patterns
|
|
103
|
-
* @param filePath File path
|
|
104
|
-
* @param gitignorePatterns Array of gitignore patterns
|
|
105
|
-
* @returns True if the file should be excluded
|
|
106
|
-
*/
|
|
107
|
-
export function shouldExcludeFile(filePath: string, gitignorePatterns: string[]): boolean {
|
|
108
|
-
// Convert Windows paths to Unix-style for consistent pattern matching
|
|
109
|
-
const normalizedPath = filePath.replace(/\\/g, '/');
|
|
110
|
-
|
|
111
|
-
for (const pattern of gitignorePatterns) {
|
|
112
|
-
// Skip empty lines and comments
|
|
113
|
-
if (!pattern || pattern.startsWith('#')) {
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Handle negation patterns (those starting with !)
|
|
118
|
-
const isNegation = pattern.startsWith('!');
|
|
119
|
-
const actualPattern = isNegation ? pattern.slice(1) : pattern;
|
|
120
|
-
|
|
121
|
-
// Convert glob pattern to regex
|
|
122
|
-
let regexPattern = actualPattern
|
|
123
|
-
// Escape special regex characters
|
|
124
|
-
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
|
125
|
-
// Convert glob ** to regex
|
|
126
|
-
.replace(/\*\*/g, '.*')
|
|
127
|
-
// Convert glob * to regex
|
|
128
|
-
.replace(/\*/g, '[^/]*')
|
|
129
|
-
// Convert glob ? to regex
|
|
130
|
-
.replace(/\?/g, '[^/]');
|
|
131
|
-
|
|
132
|
-
// Handle directory-specific patterns (those ending with /)
|
|
133
|
-
if (regexPattern.endsWith('/')) {
|
|
134
|
-
regexPattern = `${regexPattern}.*`;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Create the regex
|
|
138
|
-
const regex = new RegExp(
|
|
139
|
-
`^${regexPattern}$|^${regexPattern}/|/${regexPattern}$|/${regexPattern}/`,
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
// Check if the path matches the pattern
|
|
143
|
-
const matches = regex.test(normalizedPath);
|
|
144
|
-
|
|
145
|
-
if (matches) {
|
|
146
|
-
// If it's a negation pattern and matches, don't exclude
|
|
147
|
-
if (isNegation) {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
// If it's a regular pattern and matches, exclude
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// If no patterns matched, don't exclude
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Get the language for a file based on its extension
|
|
161
|
-
* @param filePath File path
|
|
162
|
-
* @returns Language identifier
|
|
163
|
-
*/
|
|
164
|
-
export function getLanguageForFile(filePath: string): string {
|
|
165
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
166
|
-
|
|
167
|
-
switch (ext) {
|
|
168
|
-
case '.ts':
|
|
169
|
-
case '.tsx':
|
|
170
|
-
return 'typescript';
|
|
171
|
-
case '.js':
|
|
172
|
-
case '.jsx':
|
|
173
|
-
return 'javascript';
|
|
174
|
-
case '.py':
|
|
175
|
-
case '.pyi':
|
|
176
|
-
case '.pyx':
|
|
177
|
-
return 'python';
|
|
178
|
-
case '.php':
|
|
179
|
-
return 'php';
|
|
180
|
-
case '.rb':
|
|
181
|
-
case '.rake':
|
|
182
|
-
case '.gemspec':
|
|
183
|
-
case '.ru':
|
|
184
|
-
case '.erb':
|
|
185
|
-
return 'ruby';
|
|
186
|
-
case '.go':
|
|
187
|
-
return 'go';
|
|
188
|
-
case '.java':
|
|
189
|
-
return 'java';
|
|
190
|
-
case '.rs':
|
|
191
|
-
return 'rust';
|
|
192
|
-
case '.c':
|
|
193
|
-
case '.h':
|
|
194
|
-
return 'c';
|
|
195
|
-
case '.cpp':
|
|
196
|
-
case '.hpp':
|
|
197
|
-
return 'cpp';
|
|
198
|
-
case '.cs':
|
|
199
|
-
return 'csharp';
|
|
200
|
-
case '.swift':
|
|
201
|
-
return 'swift';
|
|
202
|
-
case '.kt':
|
|
203
|
-
return 'kotlin';
|
|
204
|
-
case '.dart':
|
|
205
|
-
return 'dart';
|
|
206
|
-
case '.json':
|
|
207
|
-
return 'json';
|
|
208
|
-
case '.md':
|
|
209
|
-
return 'markdown';
|
|
210
|
-
default:
|
|
211
|
-
return 'unknown';
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Check if a file is supported for code review
|
|
217
|
-
* @param filePath File path
|
|
218
|
-
* @returns True if the file is supported
|
|
219
|
-
*/
|
|
220
|
-
export function isSupportedFile(filePath: string): boolean {
|
|
221
|
-
// Skip files that start with a dot (hidden files)
|
|
222
|
-
const fileName = path.basename(filePath);
|
|
223
|
-
if (fileName.startsWith('.')) {
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
228
|
-
return SUPPORTED_EXTENSIONS.includes(ext);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Discover files in a directory recursively
|
|
233
|
-
* @param dirPath Directory path
|
|
234
|
-
* @param options Options for file discovery
|
|
235
|
-
* @returns Array of file paths
|
|
236
|
-
*/
|
|
237
|
-
export async function discoverFiles(
|
|
238
|
-
dirPath: string,
|
|
239
|
-
options: {
|
|
240
|
-
excludePatterns?: string[];
|
|
241
|
-
includeTests?: boolean;
|
|
242
|
-
maxDepth?: number;
|
|
243
|
-
currentDepth?: number;
|
|
244
|
-
} = {},
|
|
245
|
-
): Promise<string[]> {
|
|
246
|
-
const { excludePatterns = [], includeTests = false, maxDepth = 10, currentDepth = 0 } = options;
|
|
247
|
-
|
|
248
|
-
// Check max depth
|
|
249
|
-
if (currentDepth > maxDepth) {
|
|
250
|
-
return [];
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
try {
|
|
254
|
-
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
255
|
-
const files: string[] = [];
|
|
256
|
-
|
|
257
|
-
for (const entry of entries) {
|
|
258
|
-
const entryPath = path.join(dirPath, entry.name);
|
|
259
|
-
|
|
260
|
-
// Skip excluded files (from .gitignore)
|
|
261
|
-
if (shouldExcludeFile(entryPath, excludePatterns)) {
|
|
262
|
-
logger.debug(`Skipping path: ${entryPath} (matched by .gitignore pattern)`);
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (entry.isDirectory()) {
|
|
267
|
-
// Skip node_modules, .git directories, and directories starting with '.'
|
|
268
|
-
if (entry.name === 'node_modules' || entry.name === '.git' || entry.name.startsWith('.')) {
|
|
269
|
-
logger.debug(`Skipping directory: ${entry.name} (hidden or excluded)`);
|
|
270
|
-
continue;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Recursively discover files in subdirectories
|
|
274
|
-
const subFiles = await discoverFiles(entryPath, {
|
|
275
|
-
excludePatterns,
|
|
276
|
-
includeTests,
|
|
277
|
-
maxDepth,
|
|
278
|
-
currentDepth: currentDepth + 1,
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
files.push(...subFiles);
|
|
282
|
-
} else if (entry.isFile()) {
|
|
283
|
-
// Skip dot files
|
|
284
|
-
if (entry.name.startsWith('.')) {
|
|
285
|
-
logger.debug(`Skipping file: ${entry.name} (hidden file)`);
|
|
286
|
-
continue;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// Skip test files if not including tests
|
|
290
|
-
if (!includeTests && isTestFile(entryPath)) {
|
|
291
|
-
logger.debug(`Skipping file: ${entryPath} (test file)`);
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// Skip unsupported files
|
|
296
|
-
if (!isSupportedFile(entryPath)) {
|
|
297
|
-
logger.debug(`Skipping file: ${entryPath} (unsupported file type)`);
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
files.push(entryPath);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return files;
|
|
306
|
-
} catch (error) {
|
|
307
|
-
logger.error(`Error discovering files in ${dirPath}:`, error);
|
|
308
|
-
return [];
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Read file content and create a FileInfo object
|
|
314
|
-
* @param filePath File path
|
|
315
|
-
* @returns FileInfo object
|
|
316
|
-
*/
|
|
317
|
-
export async function readFileInfo(filePath: string): Promise<FileInfo> {
|
|
318
|
-
try {
|
|
319
|
-
const content = await fs.readFile(filePath, 'utf-8');
|
|
320
|
-
// const language = getLanguageForFile(filePath); // TODO: Remove if not needed
|
|
321
|
-
|
|
322
|
-
return {
|
|
323
|
-
path: filePath,
|
|
324
|
-
relativePath: filePath,
|
|
325
|
-
content,
|
|
326
|
-
};
|
|
327
|
-
} catch (error) {
|
|
328
|
-
logger.error(`Error reading file ${filePath}:`, error);
|
|
329
|
-
throw error;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Read multiple files and create FileInfo objects
|
|
335
|
-
* @param filePaths Array of file paths
|
|
336
|
-
* @returns Array of FileInfo objects
|
|
337
|
-
*/
|
|
338
|
-
export async function readMultipleFiles(filePaths: string[]): Promise<FileInfo[]> {
|
|
339
|
-
const filePromises = filePaths.map((filePath) => readFileInfo(filePath));
|
|
340
|
-
return Promise.all(filePromises);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Get files to review based on the target path
|
|
345
|
-
* @param targetPath The target file or directory path
|
|
346
|
-
* @param isFile Whether the target is a file
|
|
347
|
-
* @param includeTests Whether to include test files
|
|
348
|
-
* @returns Array of file paths to review
|
|
349
|
-
*/
|
|
350
|
-
export async function getFilesToReview(
|
|
351
|
-
targetPath: string,
|
|
352
|
-
isFile: boolean,
|
|
353
|
-
includeTests = false,
|
|
354
|
-
excludePatterns: string[] = [],
|
|
355
|
-
): Promise<string[]> {
|
|
356
|
-
if (isFile) {
|
|
357
|
-
// If the target is a file, just return it
|
|
358
|
-
return [targetPath];
|
|
359
|
-
}
|
|
360
|
-
// If it's a directory, load .gitignore patterns if not already provided
|
|
361
|
-
let patterns = excludePatterns;
|
|
362
|
-
if (patterns.length === 0) {
|
|
363
|
-
patterns = await loadGitignorePatterns(targetPath);
|
|
364
|
-
logger.debug(`Loaded ${patterns.length} patterns from .gitignore`);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// If the target is a directory, discover files
|
|
368
|
-
return discoverFiles(targetPath, {
|
|
369
|
-
excludePatterns: patterns,
|
|
370
|
-
includeTests,
|
|
371
|
-
maxDepth: 10,
|
|
372
|
-
});
|
|
373
|
-
}
|
package/src/utils/fileSystem.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview File system utilities for the code review tool.
|
|
3
|
-
*
|
|
4
|
-
* This module re-exports utilities from more specialized modules to maintain
|
|
5
|
-
* backward compatibility while adhering to the Single Responsibility Principle.
|
|
6
|
-
*
|
|
7
|
-
* The original functionality has been split into:
|
|
8
|
-
* - pathValidator: For path validation and security checks
|
|
9
|
-
* - fileReader: For reading file operations
|
|
10
|
-
* - fileWriter: For writing file operations
|
|
11
|
-
* - pathGenerator: For generating output paths
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
// Import from pathValidator for aliases
|
|
15
|
-
import {
|
|
16
|
-
isDirectory,
|
|
17
|
-
isFile,
|
|
18
|
-
isPathWithinCwd,
|
|
19
|
-
pathExists,
|
|
20
|
-
validateTargetPath,
|
|
21
|
-
} from './pathValidator';
|
|
22
|
-
|
|
23
|
-
// Re-export from pathValidator
|
|
24
|
-
export { validateTargetPath, pathExists, isDirectory, isFile, isPathWithinCwd };
|
|
25
|
-
|
|
26
|
-
// Aliases for backward compatibility
|
|
27
|
-
export const fileExists = pathExists;
|
|
28
|
-
export const directoryExists = isDirectory;
|
|
29
|
-
export const validatePath = validateTargetPath;
|
|
30
|
-
|
|
31
|
-
// Re-export from fileReader
|
|
32
|
-
export {
|
|
33
|
-
readFile,
|
|
34
|
-
readFilesInDirectory as findFilesInDirectory,
|
|
35
|
-
readFilesWithInfo,
|
|
36
|
-
readFileWithInfo,
|
|
37
|
-
} from './FileReader';
|
|
38
|
-
|
|
39
|
-
// Import from fileWriter for aliases
|
|
40
|
-
import {
|
|
41
|
-
appendFile as appendFileImpl,
|
|
42
|
-
ensureDirectoryExists,
|
|
43
|
-
writeFile as writeFileImpl,
|
|
44
|
-
} from './FileWriter';
|
|
45
|
-
|
|
46
|
-
// Re-export from fileWriter
|
|
47
|
-
export { ensureDirectoryExists, writeFileImpl as writeFile, appendFileImpl as appendFile };
|
|
48
|
-
|
|
49
|
-
// Alias for backward compatibility
|
|
50
|
-
export const createDirectory = ensureDirectoryExists;
|
|
51
|
-
|
|
52
|
-
// Re-export from pathGenerator
|
|
53
|
-
export {
|
|
54
|
-
generateTempFilePath,
|
|
55
|
-
generateUniqueOutputPath,
|
|
56
|
-
generateVersionedOutputPath,
|
|
57
|
-
} from './PathGenerator';
|
package/src/utils/logger.ts
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Centralized logging system for the cr-aia tool.
|
|
3
|
-
*
|
|
4
|
-
* This module provides a standardized logging interface with support for
|
|
5
|
-
* different log levels, colored output, and log level control via environment
|
|
6
|
-
* variables. It's designed to be used throughout the codebase to ensure
|
|
7
|
-
* consistent logging behavior.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// Define log levels with numeric values for comparison
|
|
11
|
-
export enum LogLevel {
|
|
12
|
-
DEBUG = 0,
|
|
13
|
-
INFO = 1,
|
|
14
|
-
WARN = 2,
|
|
15
|
-
ERROR = 3,
|
|
16
|
-
NONE = 4,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Map string log level names to enum values
|
|
20
|
-
const LOG_LEVEL_MAP: Record<string, LogLevel> = {
|
|
21
|
-
debug: LogLevel.DEBUG,
|
|
22
|
-
info: LogLevel.INFO,
|
|
23
|
-
warn: LogLevel.WARN,
|
|
24
|
-
error: LogLevel.ERROR,
|
|
25
|
-
none: LogLevel.NONE,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
import { createWriteStream, mkdirSync, type WriteStream } from 'node:fs';
|
|
29
|
-
import { dirname } from 'node:path';
|
|
30
|
-
|
|
31
|
-
// ANSI color codes for terminal output
|
|
32
|
-
const COLORS = {
|
|
33
|
-
reset: '\x1b[0m',
|
|
34
|
-
dim: '\x1b[2m',
|
|
35
|
-
bright: '\x1b[1m',
|
|
36
|
-
debug: '\x1b[36m', // Cyan
|
|
37
|
-
info: '\x1b[32m', // Green
|
|
38
|
-
warn: '\x1b[33m', // Yellow
|
|
39
|
-
error: '\x1b[31m', // Red
|
|
40
|
-
time: '\x1b[90m', // Gray
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Track if we're initializing to avoid circular dependencies
|
|
44
|
-
const isInitializing = false;
|
|
45
|
-
let logFileStream: WriteStream | null = null;
|
|
46
|
-
let suppressConsoleOutput = false;
|
|
47
|
-
|
|
48
|
-
// Get the current log level from environment variables
|
|
49
|
-
function getCurrentLogLevel(): LogLevel {
|
|
50
|
-
// Avoid debug logs during initialization to prevent overwhelming output
|
|
51
|
-
const shouldLog = process.argv.includes('--trace-logger') && !isInitializing;
|
|
52
|
-
|
|
53
|
-
if (shouldLog) {
|
|
54
|
-
// Only print when explicitly requested with --trace-logger
|
|
55
|
-
console.error(
|
|
56
|
-
`Debug: getCurrentLogLevel called, AI_CODE_REVIEW_LOG_LEVEL=${process.env.AI_CODE_REVIEW_LOG_LEVEL}`,
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Always check CLI flags first - highest priority
|
|
61
|
-
if (process.argv.includes('--debug')) {
|
|
62
|
-
if (shouldLog) {
|
|
63
|
-
console.error('Debug: Debug flag found in process.argv, forcing DEBUG level');
|
|
64
|
-
}
|
|
65
|
-
return LogLevel.DEBUG;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Next check environment variable
|
|
69
|
-
const envLogLevel = process.env.AI_CODE_REVIEW_LOG_LEVEL?.toLowerCase();
|
|
70
|
-
|
|
71
|
-
if (envLogLevel) {
|
|
72
|
-
if (shouldLog) {
|
|
73
|
-
console.error(`Debug: Found AI_CODE_REVIEW_LOG_LEVEL environment variable: ${envLogLevel}`);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (envLogLevel in LOG_LEVEL_MAP) {
|
|
77
|
-
if (shouldLog) {
|
|
78
|
-
console.error(`Debug: Mapped log level ${envLogLevel} -> ${LOG_LEVEL_MAP[envLogLevel]}`);
|
|
79
|
-
}
|
|
80
|
-
return LOG_LEVEL_MAP[envLogLevel];
|
|
81
|
-
}
|
|
82
|
-
if (shouldLog) {
|
|
83
|
-
console.error(
|
|
84
|
-
`Debug: Invalid log level: ${envLogLevel}, valid options are: ${Object.keys(LOG_LEVEL_MAP).join(', ')}`,
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
} else if (shouldLog) {
|
|
88
|
-
console.error('Debug: AI_CODE_REVIEW_LOG_LEVEL environment variable not found');
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Default to INFO if not specified
|
|
92
|
-
if (shouldLog) {
|
|
93
|
-
console.error('Debug: No valid log level found, defaulting to INFO');
|
|
94
|
-
}
|
|
95
|
-
return LogLevel.INFO;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// The current log level
|
|
99
|
-
let currentLogLevel = getCurrentLogLevel();
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Set the current log level
|
|
103
|
-
* @param level The log level to set
|
|
104
|
-
*/
|
|
105
|
-
export function setLogLevel(level: LogLevel | string): void {
|
|
106
|
-
// Only log when explicitly requested with --trace-logger
|
|
107
|
-
const shouldLog = process.argv.includes('--trace-logger');
|
|
108
|
-
|
|
109
|
-
if (shouldLog) {
|
|
110
|
-
console.error(`Debug: setLogLevel called with ${level}`);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (typeof level === 'string') {
|
|
114
|
-
const levelLower = level.toLowerCase();
|
|
115
|
-
if (levelLower in LOG_LEVEL_MAP) {
|
|
116
|
-
currentLogLevel = LOG_LEVEL_MAP[levelLower];
|
|
117
|
-
if (shouldLog) {
|
|
118
|
-
console.error(`Debug: Log level set to ${levelLower} -> ${currentLogLevel}`);
|
|
119
|
-
}
|
|
120
|
-
} else {
|
|
121
|
-
console.warn(`Invalid log level: ${level}. Using default.`);
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
currentLogLevel = level;
|
|
125
|
-
if (shouldLog) {
|
|
126
|
-
console.error(`Debug: Log level set to numeric value ${level}`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Get the current log level
|
|
133
|
-
* @returns The current log level
|
|
134
|
-
*/
|
|
135
|
-
export function getLogLevel(): LogLevel {
|
|
136
|
-
return currentLogLevel;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function formatConsoleMessage(level: string, message: string, timestamp: string): string {
|
|
140
|
-
const levelUpper = level.toUpperCase().padEnd(5);
|
|
141
|
-
return `${COLORS.time}[${timestamp}]${COLORS.reset} ${COLORS[level as keyof typeof COLORS]}${levelUpper}${COLORS.reset} ${message}`;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function formatFileMessage(level: string, message: string, timestamp: string, args: any[]): string {
|
|
145
|
-
const levelUpper = level.toUpperCase().padEnd(5);
|
|
146
|
-
const extras = args.length ? ` ${args.map((arg) => serializeLogArg(arg)).join(' ')}` : '';
|
|
147
|
-
return `[${timestamp}] ${levelUpper} ${message}${extras}`;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function serializeLogArg(arg: unknown): string {
|
|
151
|
-
if (typeof arg === 'string') {
|
|
152
|
-
return arg;
|
|
153
|
-
}
|
|
154
|
-
if (arg instanceof Error) {
|
|
155
|
-
return arg.stack || arg.message;
|
|
156
|
-
}
|
|
157
|
-
try {
|
|
158
|
-
return JSON.stringify(arg);
|
|
159
|
-
} catch {
|
|
160
|
-
return String(arg);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export function enableFileLogging(filePath: string, options?: { suppressConsole?: boolean }): void {
|
|
165
|
-
try {
|
|
166
|
-
mkdirSync(dirname(filePath), { recursive: true });
|
|
167
|
-
if (logFileStream) {
|
|
168
|
-
logFileStream.end();
|
|
169
|
-
}
|
|
170
|
-
logFileStream = createWriteStream(filePath, { flags: 'a' });
|
|
171
|
-
suppressConsoleOutput = options?.suppressConsole ?? true;
|
|
172
|
-
} catch (error) {
|
|
173
|
-
console.error('Failed to enable file logging:', error);
|
|
174
|
-
logFileStream = null;
|
|
175
|
-
suppressConsoleOutput = false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export function disableFileLogging(): void {
|
|
180
|
-
if (logFileStream) {
|
|
181
|
-
logFileStream.end();
|
|
182
|
-
logFileStream = null;
|
|
183
|
-
}
|
|
184
|
-
suppressConsoleOutput = false;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Log a message if the current log level allows it
|
|
189
|
-
* @param level The log level
|
|
190
|
-
* @param message The message to log
|
|
191
|
-
* @param args Additional arguments to log
|
|
192
|
-
*/
|
|
193
|
-
function log(level: LogLevel, levelName: string, message: string, ...args: any[]): void {
|
|
194
|
-
const timestamp = new Date().toISOString();
|
|
195
|
-
|
|
196
|
-
if (logFileStream) {
|
|
197
|
-
logFileStream.write(`${formatFileMessage(levelName, message, timestamp, args)}\n`);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const shouldLogToConsole = !suppressConsoleOutput && level >= currentLogLevel;
|
|
201
|
-
|
|
202
|
-
if (shouldLogToConsole) {
|
|
203
|
-
const formattedMessage = formatConsoleMessage(levelName, message, timestamp);
|
|
204
|
-
|
|
205
|
-
switch (level) {
|
|
206
|
-
case LogLevel.DEBUG:
|
|
207
|
-
console.debug(formattedMessage, ...args);
|
|
208
|
-
break;
|
|
209
|
-
case LogLevel.INFO:
|
|
210
|
-
console.log(formattedMessage, ...args);
|
|
211
|
-
break;
|
|
212
|
-
case LogLevel.WARN:
|
|
213
|
-
console.warn(formattedMessage, ...args);
|
|
214
|
-
break;
|
|
215
|
-
case LogLevel.ERROR:
|
|
216
|
-
console.error(formattedMessage, ...args);
|
|
217
|
-
break;
|
|
218
|
-
default:
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
} else if (!suppressConsoleOutput && level === LogLevel.DEBUG && process.argv.includes('--trace-logger')) {
|
|
222
|
-
console.error(
|
|
223
|
-
`Suppressing DEBUG log because currentLogLevel=${currentLogLevel}, message was: ${message}`,
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Log a debug message
|
|
230
|
-
* @param message The message to log
|
|
231
|
-
* @param args Additional arguments to log
|
|
232
|
-
*/
|
|
233
|
-
export function debug(message: string, ...args: any[]): void {
|
|
234
|
-
log(LogLevel.DEBUG, 'debug', message, ...args);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Log an info message
|
|
239
|
-
* @param message The message to log
|
|
240
|
-
* @param args Additional arguments to log
|
|
241
|
-
*/
|
|
242
|
-
export function info(message: string, ...args: any[]): void {
|
|
243
|
-
log(LogLevel.INFO, 'info', message, ...args);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Log a warning message
|
|
248
|
-
* @param message The message to log
|
|
249
|
-
* @param args Additional arguments to log
|
|
250
|
-
*/
|
|
251
|
-
export function warn(message: string, ...args: any[]): void {
|
|
252
|
-
log(LogLevel.WARN, 'warn', message, ...args);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Log an error message
|
|
257
|
-
* @param message The message to log
|
|
258
|
-
* @param args Additional arguments to log
|
|
259
|
-
*/
|
|
260
|
-
export function error(message: string, ...args: any[]): void {
|
|
261
|
-
log(LogLevel.ERROR, 'error', message, ...args);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Create a logger instance with a specific prefix
|
|
266
|
-
* @param prefix The prefix to add to all log messages
|
|
267
|
-
* @returns An object with debug, info, warn, and error methods
|
|
268
|
-
*/
|
|
269
|
-
export function createLogger(prefix: string) {
|
|
270
|
-
return {
|
|
271
|
-
debug: (message: string, ...args: any[]) => debug(`[${prefix}] ${message}`, ...args),
|
|
272
|
-
info: (message: string, ...args: any[]) => info(`[${prefix}] ${message}`, ...args),
|
|
273
|
-
warn: (message: string, ...args: any[]) => warn(`[${prefix}] ${message}`, ...args),
|
|
274
|
-
error: (message: string, ...args: any[]) => error(`[${prefix}] ${message}`, ...args),
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// Export a default logger instance
|
|
279
|
-
export default {
|
|
280
|
-
debug,
|
|
281
|
-
info,
|
|
282
|
-
warn,
|
|
283
|
-
error,
|
|
284
|
-
setLogLevel,
|
|
285
|
-
getLogLevel,
|
|
286
|
-
createLogger,
|
|
287
|
-
LogLevel,
|
|
288
|
-
enableFileLogging,
|
|
289
|
-
disableFileLogging,
|
|
290
|
-
};
|