codereview-aia 0.1.2 → 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/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/clients/implementations/openRouterClient.js +2 -2
- package/dist/clients/implementations/openRouterClient.js.map +1 -1
- package/dist/clients/openRouterClient.js +2 -2
- package/dist/clients/openRouterClient.js.map +1 -1
- package/dist/clients/utils/promptFormatter.d.ts +3 -2
- package/dist/clients/utils/promptFormatter.js +82 -24
- package/dist/clients/utils/promptFormatter.js.map +1 -1
- package/dist/core/ConfigurationService.d.ts +21 -0
- package/dist/core/ConfigurationService.js +39 -0
- package/dist/core/ConfigurationService.js.map +1 -1
- package/dist/core/handlers/FileProcessingHandler.js +5 -0
- package/dist/core/handlers/FileProcessingHandler.js.map +1 -1
- package/dist/core/reviewOrchestrator.js +61 -1
- package/dist/core/reviewOrchestrator.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime/cliEntry.js +57 -4
- package/dist/runtime/cliEntry.js.map +1 -1
- package/dist/runtime/fileCollector.d.ts +10 -1
- package/dist/runtime/fileCollector.js +217 -2
- package/dist/runtime/fileCollector.js.map +1 -1
- package/dist/runtime/reporting/markdownReportBuilder.d.ts +2 -0
- package/dist/runtime/reporting/markdownReportBuilder.js +57 -0
- package/dist/runtime/reporting/markdownReportBuilder.js.map +1 -1
- package/dist/runtime/reviewPipeline.d.ts +22 -3
- package/dist/runtime/reviewPipeline.js +46 -7
- package/dist/runtime/reviewPipeline.js.map +1 -1
- package/dist/runtime/runAiCodeReview.d.ts +19 -1
- package/dist/runtime/runAiCodeReview.js +243 -8
- package/dist/runtime/runAiCodeReview.js.map +1 -1
- package/dist/runtime/ui/RuntimeApp.js +15 -4
- package/dist/runtime/ui/RuntimeApp.js.map +1 -1
- package/dist/runtime/ui/screens/ProgressScreen.d.ts +6 -1
- package/dist/runtime/ui/screens/ProgressScreen.js +28 -2
- package/dist/runtime/ui/screens/ProgressScreen.js.map +1 -1
- package/dist/runtime/ui/screens/ResultsScreen.js +8 -1
- package/dist/runtime/ui/screens/ResultsScreen.js.map +1 -1
- package/dist/types/review.d.ts +60 -0
- package/dist/utils/detection/frameworkDetector.js +55 -0
- package/dist/utils/detection/frameworkDetector.js.map +1 -1
- package/dist/utils/promptTemplateManager.js +1 -0
- package/dist/utils/promptTemplateManager.js.map +1 -1
- package/package.json +13 -10
- package/.cr-aia.yml +0 -23
- package/.crignore +0 -0
- 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/context/index.ts +0 -7
- package/src/analysis/index.ts +0 -8
- package/src/analysis/tokens/TokenAnalysisFormatter.ts +0 -154
- package/src/analysis/tokens/TokenAnalyzer.ts +0 -747
- package/src/analysis/tokens/index.ts +0 -8
- package/src/clients/base/abstractClient.ts +0 -190
- package/src/clients/base/httpClient.ts +0 -160
- package/src/clients/base/index.ts +0 -12
- 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/factory/index.ts +0 -8
- package/src/clients/implementations/index.ts +0 -8
- package/src/clients/implementations/openRouterClient.ts +0 -411
- package/src/clients/openRouterClient.ts +0 -863
- package/src/clients/openRouterClientWrapper.ts +0 -44
- package/src/clients/utils/directoryStructure.ts +0 -52
- package/src/clients/utils/index.ts +0 -11
- package/src/clients/utils/languageDetection.ts +0 -44
- package/src/clients/utils/promptFormatter.ts +0 -105
- package/src/clients/utils/promptLoader.ts +0 -53
- 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 -204
- 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/outputFormatter.ts +0 -62
- 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 -28
- 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 -196
- package/src/runtime/debug/logManager.ts +0 -37
- package/src/runtime/errors.ts +0 -13
- package/src/runtime/fileCollector.ts +0 -222
- 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 -161
- package/src/runtime/runAiCodeReview.ts +0 -153
- package/src/runtime/runtimeConfig.ts +0 -5
- package/src/runtime/ui/Layout.tsx +0 -57
- package/src/runtime/ui/RuntimeApp.tsx +0 -233
- 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 -62
- package/src/runtime/ui/screens/ResultsScreen.tsx +0 -83
- 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/strategies/index.ts +0 -14
- package/src/tokenizers/baseTokenizer.ts +0 -61
- package/src/tokenizers/gptTokenizer.ts +0 -27
- package/src/tokenizers/index.ts +0 -8
- package/src/types/apiResponses.ts +0 -40
- package/src/types/cli.ts +0 -24
- package/src/types/common.ts +0 -39
- 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 -294
- package/src/types/reviewContext.d.ts +0 -65
- package/src/types/reviewSchema.ts +0 -181
- 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/api/index.ts +0 -1
- 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/index.ts +0 -10
- 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/index.ts +0 -36
- package/src/utils/logger.ts +0 -290
- package/src/utils/pathValidator.ts +0 -98
- package/src/utils/priorityFilter.ts +0 -59
- 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/reviewActionHandler.ts +0 -18
- 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
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt Template Manager
|
|
3
|
-
*
|
|
4
|
-
* This utility provides an interface between the bundledPrompts system
|
|
5
|
-
* and the new Handlebars template system, enabling a smooth migration.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from 'node:fs';
|
|
9
|
-
import path from 'node:path';
|
|
10
|
-
import type { ReviewType } from '../types/review';
|
|
11
|
-
import logger from './logger';
|
|
12
|
-
import { listAvailableTemplates, loadPromptTemplate } from './templateLoader';
|
|
13
|
-
import { resolvePromptTemplatesDir } from './promptPaths';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Maps framework identifiers from the API to template directory names
|
|
17
|
-
*/
|
|
18
|
-
const frameworkMapping: Record<string, string> = {
|
|
19
|
-
react: 'react',
|
|
20
|
-
angular: 'angular',
|
|
21
|
-
vue: 'vue',
|
|
22
|
-
'next.js': 'nextjs',
|
|
23
|
-
nextjs: 'nextjs',
|
|
24
|
-
django: 'django',
|
|
25
|
-
flask: 'flask',
|
|
26
|
-
fastapi: 'fastapi',
|
|
27
|
-
pyramid: 'pyramid',
|
|
28
|
-
laravel: 'laravel',
|
|
29
|
-
flutter: 'flutter',
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Maps language identifiers from the API to template directory names
|
|
34
|
-
*/
|
|
35
|
-
const languageMapping: Record<string, string> = {
|
|
36
|
-
typescript: 'typescript',
|
|
37
|
-
javascript: 'javascript',
|
|
38
|
-
js: 'javascript',
|
|
39
|
-
python: 'python',
|
|
40
|
-
html: 'html',
|
|
41
|
-
css: 'css',
|
|
42
|
-
php: 'php',
|
|
43
|
-
ruby: 'ruby',
|
|
44
|
-
dart: 'dart',
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Maps ReviewType enum to template file names
|
|
49
|
-
*/
|
|
50
|
-
const reviewTypeMapping: Record<string, string> = {
|
|
51
|
-
architectural: 'architectural-review',
|
|
52
|
-
'best-practices': 'best-practices',
|
|
53
|
-
'quick-fixes': 'quick-fixes-review',
|
|
54
|
-
security: 'security-review',
|
|
55
|
-
performance: 'performance-review',
|
|
56
|
-
'unused-code': 'unused-code-review',
|
|
57
|
-
'code-tracing-unused-code': 'code-tracing-unused-code-review',
|
|
58
|
-
'focused-unused-code': 'focused-unused-code-review',
|
|
59
|
-
'improved-unused-code': 'improved-unused-code-review',
|
|
60
|
-
consolidated: 'consolidated-review',
|
|
61
|
-
// Add mapping for improved quick fixes
|
|
62
|
-
'improved-quick-fixes': 'improved-quick-fixes-review',
|
|
63
|
-
evaluation: 'evaluation',
|
|
64
|
-
'extract-patterns': 'extract-patterns-review',
|
|
65
|
-
'coding-test': 'coding-test',
|
|
66
|
-
// Contemporary development patterns
|
|
67
|
-
'ai-integration': 'ai-integration-review',
|
|
68
|
-
'cloud-native': 'cloud-native-review',
|
|
69
|
-
'developer-experience': 'developer-experience-review',
|
|
70
|
-
comprehensive: 'comprehensive',
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Get prompt template for the specified review type, language, and framework
|
|
75
|
-
*
|
|
76
|
-
* @param reviewType The type of review to get a prompt for
|
|
77
|
-
* @param language The programming language (optional)
|
|
78
|
-
* @param framework The framework (optional)
|
|
79
|
-
* @returns The prompt template string or undefined if not found
|
|
80
|
-
*/
|
|
81
|
-
export function getPromptTemplate(
|
|
82
|
-
reviewType: ReviewType | string,
|
|
83
|
-
language?: string,
|
|
84
|
-
framework?: string,
|
|
85
|
-
): string | undefined {
|
|
86
|
-
// Convert ReviewType enum to string if needed
|
|
87
|
-
const reviewTypeStr =
|
|
88
|
-
typeof reviewType === 'string' ? reviewType : String(reviewType).toLowerCase();
|
|
89
|
-
|
|
90
|
-
// Map review type to template file name
|
|
91
|
-
const templateName = reviewTypeMapping[reviewTypeStr];
|
|
92
|
-
if (!templateName) {
|
|
93
|
-
logger.error(`No template mapping found for review type: ${reviewTypeStr}`);
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Map language and framework to template directory names
|
|
98
|
-
const mappedLanguage = language ? languageMapping[language.toLowerCase()] : undefined;
|
|
99
|
-
const mappedFramework = framework ? frameworkMapping[framework.toLowerCase()] : undefined;
|
|
100
|
-
|
|
101
|
-
// Try to load the template
|
|
102
|
-
const template = loadPromptTemplate(templateName, mappedLanguage, mappedFramework);
|
|
103
|
-
|
|
104
|
-
return template || undefined;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Check if templates directory exists and is properly structured
|
|
109
|
-
*
|
|
110
|
-
* @returns true if templates are available, false otherwise
|
|
111
|
-
*/
|
|
112
|
-
export function checkTemplatesAvailability(): boolean {
|
|
113
|
-
const templatesDir = resolvePromptTemplatesDir();
|
|
114
|
-
|
|
115
|
-
if (!fs.existsSync(templatesDir)) {
|
|
116
|
-
logger.warn('Templates directory not found. Using bundled prompts instead.');
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Check for essential directories
|
|
121
|
-
const requiredDirs = ['common', 'frameworks', 'languages'];
|
|
122
|
-
for (const dir of requiredDirs) {
|
|
123
|
-
if (!fs.existsSync(path.join(templatesDir, dir))) {
|
|
124
|
-
logger.warn(
|
|
125
|
-
`Required templates subdirectory '${dir}' not found. Using bundled prompts instead.`,
|
|
126
|
-
);
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Check for common variables
|
|
132
|
-
const variablesDir = path.join(templatesDir, 'common', 'variables');
|
|
133
|
-
if (
|
|
134
|
-
!fs.existsSync(variablesDir) ||
|
|
135
|
-
!fs.existsSync(path.join(variablesDir, 'framework-versions.json'))
|
|
136
|
-
) {
|
|
137
|
-
logger.warn('Framework variables data not found. Using bundled prompts instead.');
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Get a list of supported frameworks and languages
|
|
146
|
-
*
|
|
147
|
-
* @returns Object containing arrays of supported frameworks, languages, and review types
|
|
148
|
-
*/
|
|
149
|
-
export function getSupportedTemplates(): Record<string, string[]> {
|
|
150
|
-
return listAvailableTemplates();
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export default {
|
|
154
|
-
getPromptTemplate,
|
|
155
|
-
checkTemplatesAvailability,
|
|
156
|
-
getSupportedTemplates,
|
|
157
|
-
};
|