codereview-aia 0.1.0
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/.cr-aia.yml +23 -0
- package/.crignore +0 -0
- package/dist/index.js +27 -0
- package/package.json +85 -0
- package/src/analysis/FindingsExtractor.ts +431 -0
- package/src/analysis/ai-detection/analyzers/BaseAnalyzer.ts +267 -0
- package/src/analysis/ai-detection/analyzers/DocumentationAnalyzer.ts +622 -0
- package/src/analysis/ai-detection/analyzers/GitHistoryAnalyzer.ts +430 -0
- package/src/analysis/ai-detection/core/AIDetectionEngine.ts +467 -0
- package/src/analysis/ai-detection/types/DetectionTypes.ts +406 -0
- package/src/analysis/ai-detection/utils/SubmissionConverter.ts +390 -0
- package/src/analysis/context/ReviewContext.ts +378 -0
- package/src/analysis/context/index.ts +7 -0
- package/src/analysis/index.ts +8 -0
- package/src/analysis/tokens/TokenAnalysisFormatter.ts +154 -0
- package/src/analysis/tokens/TokenAnalyzer.ts +747 -0
- package/src/analysis/tokens/index.ts +8 -0
- package/src/clients/base/abstractClient.ts +190 -0
- package/src/clients/base/httpClient.ts +160 -0
- package/src/clients/base/index.ts +12 -0
- package/src/clients/base/modelDetection.ts +107 -0
- package/src/clients/base/responseProcessor.ts +586 -0
- package/src/clients/factory/clientFactory.ts +55 -0
- package/src/clients/factory/index.ts +8 -0
- package/src/clients/implementations/index.ts +8 -0
- package/src/clients/implementations/openRouterClient.ts +411 -0
- package/src/clients/openRouterClient.ts +863 -0
- package/src/clients/openRouterClientWrapper.ts +44 -0
- package/src/clients/utils/directoryStructure.ts +52 -0
- package/src/clients/utils/index.ts +11 -0
- package/src/clients/utils/languageDetection.ts +44 -0
- package/src/clients/utils/promptFormatter.ts +105 -0
- package/src/clients/utils/promptLoader.ts +53 -0
- package/src/clients/utils/tokenCounter.ts +297 -0
- package/src/core/ApiClientSelector.ts +37 -0
- package/src/core/ConfigurationService.ts +591 -0
- package/src/core/ConsolidationService.ts +423 -0
- package/src/core/InteractiveDisplayManager.ts +81 -0
- package/src/core/OutputManager.ts +275 -0
- package/src/core/ReviewGenerator.ts +140 -0
- package/src/core/fileDiscovery.ts +237 -0
- package/src/core/handlers/EstimationHandler.ts +104 -0
- package/src/core/handlers/FileProcessingHandler.ts +204 -0
- package/src/core/handlers/OutputHandler.ts +125 -0
- package/src/core/handlers/ReviewExecutor.ts +104 -0
- package/src/core/reviewOrchestrator.ts +333 -0
- package/src/core/utils/ModelInfoUtils.ts +56 -0
- package/src/formatters/outputFormatter.ts +62 -0
- package/src/formatters/utils/IssueFormatters.ts +83 -0
- package/src/formatters/utils/JsonFormatter.ts +77 -0
- package/src/formatters/utils/MarkdownFormatters.ts +609 -0
- package/src/formatters/utils/MetadataFormatter.ts +269 -0
- package/src/formatters/utils/ModelInfoExtractor.ts +115 -0
- package/src/index.ts +27 -0
- package/src/plugins/PluginInterface.ts +50 -0
- package/src/plugins/PluginManager.ts +126 -0
- package/src/prompts/PromptManager.ts +69 -0
- package/src/prompts/cache/PromptCache.ts +50 -0
- package/src/prompts/promptText/common/variables/css-frameworks.json +33 -0
- package/src/prompts/promptText/common/variables/framework-versions.json +45 -0
- package/src/prompts/promptText/frameworks/react/comprehensive.hbs +19 -0
- package/src/prompts/promptText/languages/css/comprehensive.hbs +18 -0
- package/src/prompts/promptText/languages/generic/comprehensive.hbs +20 -0
- package/src/prompts/promptText/languages/html/comprehensive.hbs +18 -0
- package/src/prompts/promptText/languages/javascript/comprehensive.hbs +18 -0
- package/src/prompts/promptText/languages/python/comprehensive.hbs +18 -0
- package/src/prompts/promptText/languages/typescript/comprehensive.hbs +18 -0
- package/src/runtime/auth/service.ts +58 -0
- package/src/runtime/auth/session.ts +103 -0
- package/src/runtime/auth/types.ts +11 -0
- package/src/runtime/cliEntry.ts +196 -0
- package/src/runtime/errors.ts +13 -0
- package/src/runtime/fileCollector.ts +188 -0
- package/src/runtime/manifest.ts +64 -0
- package/src/runtime/openrouterProxy.ts +45 -0
- package/src/runtime/proxyConfig.ts +94 -0
- package/src/runtime/proxyEnvironment.ts +71 -0
- package/src/runtime/reportMerge.ts +102 -0
- package/src/runtime/reporting/markdownReportBuilder.ts +138 -0
- package/src/runtime/reporting/reportDataCollector.ts +234 -0
- package/src/runtime/reporting/summaryGenerator.ts +86 -0
- package/src/runtime/reviewPipeline.ts +155 -0
- package/src/runtime/runAiCodeReview.ts +153 -0
- package/src/runtime/runtimeConfig.ts +5 -0
- package/src/runtime/ui/Layout.tsx +57 -0
- package/src/runtime/ui/RuntimeApp.tsx +150 -0
- package/src/runtime/ui/inkModules.ts +73 -0
- package/src/runtime/ui/screens/AuthScreen.tsx +128 -0
- package/src/runtime/ui/screens/ModeSelection.tsx +52 -0
- package/src/runtime/ui/screens/ProgressScreen.tsx +55 -0
- package/src/runtime/ui/screens/ResultsScreen.tsx +76 -0
- package/src/strategies/ArchitecturalReviewStrategy.ts +54 -0
- package/src/strategies/CodingTestReviewStrategy.ts +920 -0
- package/src/strategies/ConsolidatedReviewStrategy.ts +59 -0
- package/src/strategies/ExtractPatternsReviewStrategy.ts +64 -0
- package/src/strategies/MultiPassReviewStrategy.ts +785 -0
- package/src/strategies/ReviewStrategy.ts +64 -0
- package/src/strategies/StrategyFactory.ts +79 -0
- package/src/strategies/index.ts +14 -0
- package/src/tokenizers/baseTokenizer.ts +61 -0
- package/src/tokenizers/gptTokenizer.ts +27 -0
- package/src/tokenizers/index.ts +8 -0
- package/src/types/apiResponses.ts +40 -0
- package/src/types/cli.ts +24 -0
- package/src/types/common.ts +39 -0
- package/src/types/configuration.ts +201 -0
- package/src/types/handlebars.d.ts +5 -0
- package/src/types/patch.d.ts +25 -0
- package/src/types/review.ts +294 -0
- package/src/types/reviewContext.d.ts +65 -0
- package/src/types/reviewSchema.ts +181 -0
- package/src/types/structuredReview.ts +167 -0
- package/src/types/tokenAnalysis.ts +56 -0
- package/src/utils/FileReader.ts +93 -0
- package/src/utils/FileWriter.ts +76 -0
- package/src/utils/PathGenerator.ts +97 -0
- package/src/utils/api/apiUtils.ts +14 -0
- package/src/utils/api/index.ts +1 -0
- package/src/utils/apiErrorHandler.ts +287 -0
- package/src/utils/ciDataCollector.ts +252 -0
- package/src/utils/codingTestConfigLoader.ts +466 -0
- package/src/utils/dependencies/aiDependencyAnalyzer.ts +454 -0
- package/src/utils/detection/frameworkDetector.ts +879 -0
- package/src/utils/detection/index.ts +10 -0
- package/src/utils/detection/projectTypeDetector.ts +518 -0
- package/src/utils/diagramGenerator.ts +206 -0
- package/src/utils/errorLogger.ts +60 -0
- package/src/utils/estimationUtils.ts +407 -0
- package/src/utils/fileFilters.ts +373 -0
- package/src/utils/fileSystem.ts +57 -0
- package/src/utils/index.ts +36 -0
- package/src/utils/logger.ts +240 -0
- package/src/utils/pathValidator.ts +98 -0
- package/src/utils/priorityFilter.ts +59 -0
- package/src/utils/projectDocs.ts +189 -0
- package/src/utils/promptPaths.ts +29 -0
- package/src/utils/promptTemplateManager.ts +157 -0
- package/src/utils/review/consolidateReview.ts +553 -0
- package/src/utils/review/fixDisplay.ts +100 -0
- package/src/utils/review/fixImplementation.ts +61 -0
- package/src/utils/review/index.ts +36 -0
- package/src/utils/review/interactiveProcessing.ts +294 -0
- package/src/utils/review/progressTracker.ts +296 -0
- package/src/utils/review/reviewExtraction.ts +382 -0
- package/src/utils/review/types.ts +46 -0
- package/src/utils/reviewActionHandler.ts +18 -0
- package/src/utils/reviewParser.ts +253 -0
- package/src/utils/sanitizer.ts +238 -0
- package/src/utils/smartFileSelector.ts +255 -0
- package/src/utils/templateLoader.ts +514 -0
- package/src/utils/treeGenerator.ts +153 -0
- package/tsconfig.build.json +14 -0
- package/tsconfig.json +59 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Consolidated review strategy implementation.
|
|
3
|
+
*
|
|
4
|
+
* This module implements the consolidated review strategy, which analyzes multiple files
|
|
5
|
+
* together to provide a comprehensive review of the codebase.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ApiClientConfig } from '../core/ApiClientSelector';
|
|
9
|
+
import { generateReview } from '../core/ReviewGenerator';
|
|
10
|
+
import type { FileInfo, ReviewOptions, ReviewResult } from '../types/review';
|
|
11
|
+
import { collectCIData } from '../utils/ciDataCollector';
|
|
12
|
+
import logger from '../utils/logger';
|
|
13
|
+
import type { ProjectDocs } from '../utils/projectDocs';
|
|
14
|
+
import { BaseReviewStrategy } from './ReviewStrategy';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Strategy for consolidated reviews of multiple files
|
|
18
|
+
*/
|
|
19
|
+
export class ConsolidatedReviewStrategy extends BaseReviewStrategy {
|
|
20
|
+
/**
|
|
21
|
+
* Execute the consolidated review strategy
|
|
22
|
+
* @param files Files to review
|
|
23
|
+
* @param projectName Project name
|
|
24
|
+
* @param projectDocs Project documentation
|
|
25
|
+
* @param options Review options
|
|
26
|
+
* @param apiClientConfig API client configuration
|
|
27
|
+
* @returns Promise resolving to the review result
|
|
28
|
+
*/
|
|
29
|
+
async execute(
|
|
30
|
+
files: FileInfo[],
|
|
31
|
+
projectName: string,
|
|
32
|
+
projectDocs: ProjectDocs | null,
|
|
33
|
+
options: ReviewOptions,
|
|
34
|
+
apiClientConfig: ApiClientConfig,
|
|
35
|
+
): Promise<ReviewResult> {
|
|
36
|
+
logger.info(`Executing consolidated ${this.reviewType} review strategy...`);
|
|
37
|
+
|
|
38
|
+
// Collect CI data if we're reviewing TypeScript files
|
|
39
|
+
let ciData;
|
|
40
|
+
if (
|
|
41
|
+
options.language === 'typescript' ||
|
|
42
|
+
files.some((f) => f.path.endsWith('.ts') || f.path.endsWith('.tsx'))
|
|
43
|
+
) {
|
|
44
|
+
logger.info('Collecting CI data for TypeScript project...');
|
|
45
|
+
ciData = await collectCIData(process.cwd());
|
|
46
|
+
options.ciData = ciData;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Generate the review using the selected API client
|
|
50
|
+
return generateReview(
|
|
51
|
+
files,
|
|
52
|
+
projectName,
|
|
53
|
+
this.reviewType,
|
|
54
|
+
projectDocs,
|
|
55
|
+
options,
|
|
56
|
+
apiClientConfig,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Extract patterns review strategy implementation.
|
|
3
|
+
*
|
|
4
|
+
* This module implements the extract patterns review strategy, which analyzes
|
|
5
|
+
* codebases to extract detailed patterns, architecture, and design decisions
|
|
6
|
+
* for creating exemplar project libraries.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { ApiClientConfig } from '../core/ApiClientSelector';
|
|
10
|
+
import { generateReview } from '../core/ReviewGenerator';
|
|
11
|
+
import type { FileInfo, ReviewOptions, ReviewResult } from '../types/review';
|
|
12
|
+
import logger from '../utils/logger';
|
|
13
|
+
import type { ProjectDocs } from '../utils/projectDocs';
|
|
14
|
+
import { BaseReviewStrategy } from './ReviewStrategy';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Strategy for extracting code patterns and architectural insights
|
|
18
|
+
*/
|
|
19
|
+
export class ExtractPatternsReviewStrategy extends BaseReviewStrategy {
|
|
20
|
+
/**
|
|
21
|
+
* Create a new extract patterns review strategy
|
|
22
|
+
*/
|
|
23
|
+
constructor() {
|
|
24
|
+
super('extract-patterns');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Execute the extract patterns review strategy
|
|
29
|
+
* @param files Files to review
|
|
30
|
+
* @param projectName Project name
|
|
31
|
+
* @param projectDocs Project documentation
|
|
32
|
+
* @param options Review options
|
|
33
|
+
* @param apiClientConfig API client configuration
|
|
34
|
+
* @returns Promise resolving to the review result
|
|
35
|
+
*/
|
|
36
|
+
async execute(
|
|
37
|
+
files: FileInfo[],
|
|
38
|
+
projectName: string,
|
|
39
|
+
projectDocs: ProjectDocs | null,
|
|
40
|
+
options: ReviewOptions,
|
|
41
|
+
apiClientConfig: ApiClientConfig,
|
|
42
|
+
): Promise<ReviewResult> {
|
|
43
|
+
logger.info('Executing extract patterns review strategy...');
|
|
44
|
+
|
|
45
|
+
// Enhance options for pattern extraction
|
|
46
|
+
const enhancedOptions: ReviewOptions = {
|
|
47
|
+
...options,
|
|
48
|
+
type: this.reviewType,
|
|
49
|
+
// Enable comprehensive analysis features
|
|
50
|
+
includeProjectDocs: true,
|
|
51
|
+
includeDependencyAnalysis: true,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Generate the review using the selected API client
|
|
55
|
+
return generateReview(
|
|
56
|
+
files,
|
|
57
|
+
projectName,
|
|
58
|
+
this.reviewType,
|
|
59
|
+
projectDocs,
|
|
60
|
+
enhancedOptions,
|
|
61
|
+
apiClientConfig,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|