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.
Files changed (200) hide show
  1. package/dist/analysis/static/wpPhpcsRunner.d.ts +11 -0
  2. package/dist/analysis/static/wpPhpcsRunner.js +219 -0
  3. package/dist/analysis/static/wpPhpcsRunner.js.map +1 -0
  4. package/dist/clients/implementations/openRouterClient.js +2 -2
  5. package/dist/clients/implementations/openRouterClient.js.map +1 -1
  6. package/dist/clients/openRouterClient.js +2 -2
  7. package/dist/clients/openRouterClient.js.map +1 -1
  8. package/dist/clients/utils/promptFormatter.d.ts +3 -2
  9. package/dist/clients/utils/promptFormatter.js +82 -24
  10. package/dist/clients/utils/promptFormatter.js.map +1 -1
  11. package/dist/core/ConfigurationService.d.ts +21 -0
  12. package/dist/core/ConfigurationService.js +39 -0
  13. package/dist/core/ConfigurationService.js.map +1 -1
  14. package/dist/core/handlers/FileProcessingHandler.js +5 -0
  15. package/dist/core/handlers/FileProcessingHandler.js.map +1 -1
  16. package/dist/core/reviewOrchestrator.js +61 -1
  17. package/dist/core/reviewOrchestrator.js.map +1 -1
  18. package/dist/index.d.ts +0 -1
  19. package/dist/index.js +0 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/runtime/cliEntry.js +57 -4
  22. package/dist/runtime/cliEntry.js.map +1 -1
  23. package/dist/runtime/fileCollector.d.ts +10 -1
  24. package/dist/runtime/fileCollector.js +217 -2
  25. package/dist/runtime/fileCollector.js.map +1 -1
  26. package/dist/runtime/reporting/markdownReportBuilder.d.ts +2 -0
  27. package/dist/runtime/reporting/markdownReportBuilder.js +57 -0
  28. package/dist/runtime/reporting/markdownReportBuilder.js.map +1 -1
  29. package/dist/runtime/reviewPipeline.d.ts +22 -3
  30. package/dist/runtime/reviewPipeline.js +46 -7
  31. package/dist/runtime/reviewPipeline.js.map +1 -1
  32. package/dist/runtime/runAiCodeReview.d.ts +19 -1
  33. package/dist/runtime/runAiCodeReview.js +243 -8
  34. package/dist/runtime/runAiCodeReview.js.map +1 -1
  35. package/dist/runtime/ui/RuntimeApp.js +15 -4
  36. package/dist/runtime/ui/RuntimeApp.js.map +1 -1
  37. package/dist/runtime/ui/screens/ProgressScreen.d.ts +6 -1
  38. package/dist/runtime/ui/screens/ProgressScreen.js +28 -2
  39. package/dist/runtime/ui/screens/ProgressScreen.js.map +1 -1
  40. package/dist/runtime/ui/screens/ResultsScreen.js +8 -1
  41. package/dist/runtime/ui/screens/ResultsScreen.js.map +1 -1
  42. package/dist/types/review.d.ts +60 -0
  43. package/dist/utils/detection/frameworkDetector.js +55 -0
  44. package/dist/utils/detection/frameworkDetector.js.map +1 -1
  45. package/dist/utils/promptTemplateManager.js +1 -0
  46. package/dist/utils/promptTemplateManager.js.map +1 -1
  47. package/package.json +13 -10
  48. package/.cr-aia.yml +0 -23
  49. package/.crignore +0 -0
  50. package/src/analysis/FindingsExtractor.ts +0 -431
  51. package/src/analysis/ai-detection/analyzers/BaseAnalyzer.ts +0 -267
  52. package/src/analysis/ai-detection/analyzers/DocumentationAnalyzer.ts +0 -622
  53. package/src/analysis/ai-detection/analyzers/GitHistoryAnalyzer.ts +0 -430
  54. package/src/analysis/ai-detection/core/AIDetectionEngine.ts +0 -467
  55. package/src/analysis/ai-detection/types/DetectionTypes.ts +0 -406
  56. package/src/analysis/ai-detection/utils/SubmissionConverter.ts +0 -390
  57. package/src/analysis/context/ReviewContext.ts +0 -378
  58. package/src/analysis/context/index.ts +0 -7
  59. package/src/analysis/index.ts +0 -8
  60. package/src/analysis/tokens/TokenAnalysisFormatter.ts +0 -154
  61. package/src/analysis/tokens/TokenAnalyzer.ts +0 -747
  62. package/src/analysis/tokens/index.ts +0 -8
  63. package/src/clients/base/abstractClient.ts +0 -190
  64. package/src/clients/base/httpClient.ts +0 -160
  65. package/src/clients/base/index.ts +0 -12
  66. package/src/clients/base/modelDetection.ts +0 -107
  67. package/src/clients/base/responseProcessor.ts +0 -586
  68. package/src/clients/factory/clientFactory.ts +0 -55
  69. package/src/clients/factory/index.ts +0 -8
  70. package/src/clients/implementations/index.ts +0 -8
  71. package/src/clients/implementations/openRouterClient.ts +0 -411
  72. package/src/clients/openRouterClient.ts +0 -863
  73. package/src/clients/openRouterClientWrapper.ts +0 -44
  74. package/src/clients/utils/directoryStructure.ts +0 -52
  75. package/src/clients/utils/index.ts +0 -11
  76. package/src/clients/utils/languageDetection.ts +0 -44
  77. package/src/clients/utils/promptFormatter.ts +0 -105
  78. package/src/clients/utils/promptLoader.ts +0 -53
  79. package/src/clients/utils/tokenCounter.ts +0 -297
  80. package/src/core/ApiClientSelector.ts +0 -37
  81. package/src/core/ConfigurationService.ts +0 -591
  82. package/src/core/ConsolidationService.ts +0 -423
  83. package/src/core/InteractiveDisplayManager.ts +0 -81
  84. package/src/core/OutputManager.ts +0 -275
  85. package/src/core/ReviewGenerator.ts +0 -140
  86. package/src/core/fileDiscovery.ts +0 -237
  87. package/src/core/handlers/EstimationHandler.ts +0 -104
  88. package/src/core/handlers/FileProcessingHandler.ts +0 -204
  89. package/src/core/handlers/OutputHandler.ts +0 -125
  90. package/src/core/handlers/ReviewExecutor.ts +0 -104
  91. package/src/core/reviewOrchestrator.ts +0 -333
  92. package/src/core/utils/ModelInfoUtils.ts +0 -56
  93. package/src/formatters/outputFormatter.ts +0 -62
  94. package/src/formatters/utils/IssueFormatters.ts +0 -83
  95. package/src/formatters/utils/JsonFormatter.ts +0 -77
  96. package/src/formatters/utils/MarkdownFormatters.ts +0 -609
  97. package/src/formatters/utils/MetadataFormatter.ts +0 -269
  98. package/src/formatters/utils/ModelInfoExtractor.ts +0 -115
  99. package/src/index.ts +0 -28
  100. package/src/plugins/PluginInterface.ts +0 -50
  101. package/src/plugins/PluginManager.ts +0 -126
  102. package/src/prompts/PromptManager.ts +0 -69
  103. package/src/prompts/cache/PromptCache.ts +0 -50
  104. package/src/prompts/promptText/common/variables/css-frameworks.json +0 -33
  105. package/src/prompts/promptText/common/variables/framework-versions.json +0 -45
  106. package/src/prompts/promptText/frameworks/react/comprehensive.hbs +0 -19
  107. package/src/prompts/promptText/languages/css/comprehensive.hbs +0 -18
  108. package/src/prompts/promptText/languages/generic/comprehensive.hbs +0 -20
  109. package/src/prompts/promptText/languages/html/comprehensive.hbs +0 -18
  110. package/src/prompts/promptText/languages/javascript/comprehensive.hbs +0 -18
  111. package/src/prompts/promptText/languages/python/comprehensive.hbs +0 -18
  112. package/src/prompts/promptText/languages/typescript/comprehensive.hbs +0 -18
  113. package/src/runtime/auth/service.ts +0 -58
  114. package/src/runtime/auth/session.ts +0 -103
  115. package/src/runtime/auth/types.ts +0 -11
  116. package/src/runtime/cliEntry.ts +0 -196
  117. package/src/runtime/debug/logManager.ts +0 -37
  118. package/src/runtime/errors.ts +0 -13
  119. package/src/runtime/fileCollector.ts +0 -222
  120. package/src/runtime/manifest.ts +0 -64
  121. package/src/runtime/openrouterProxy.ts +0 -45
  122. package/src/runtime/preprod/webCheck.ts +0 -104
  123. package/src/runtime/proxyConfig.ts +0 -94
  124. package/src/runtime/proxyEnvironment.ts +0 -71
  125. package/src/runtime/reportMerge.ts +0 -102
  126. package/src/runtime/reporting/markdownReportBuilder.ts +0 -138
  127. package/src/runtime/reporting/reportDataCollector.ts +0 -234
  128. package/src/runtime/reporting/summaryGenerator.ts +0 -86
  129. package/src/runtime/reviewPipeline.ts +0 -161
  130. package/src/runtime/runAiCodeReview.ts +0 -153
  131. package/src/runtime/runtimeConfig.ts +0 -5
  132. package/src/runtime/ui/Layout.tsx +0 -57
  133. package/src/runtime/ui/RuntimeApp.tsx +0 -233
  134. package/src/runtime/ui/inkModules.ts +0 -73
  135. package/src/runtime/ui/screens/AuthScreen.tsx +0 -128
  136. package/src/runtime/ui/screens/ModeSelection.tsx +0 -185
  137. package/src/runtime/ui/screens/ProgressScreen.tsx +0 -62
  138. package/src/runtime/ui/screens/ResultsScreen.tsx +0 -83
  139. package/src/strategies/ArchitecturalReviewStrategy.ts +0 -54
  140. package/src/strategies/CodingTestReviewStrategy.ts +0 -920
  141. package/src/strategies/ConsolidatedReviewStrategy.ts +0 -59
  142. package/src/strategies/ExtractPatternsReviewStrategy.ts +0 -64
  143. package/src/strategies/MultiPassReviewStrategy.ts +0 -785
  144. package/src/strategies/ReviewStrategy.ts +0 -64
  145. package/src/strategies/StrategyFactory.ts +0 -79
  146. package/src/strategies/index.ts +0 -14
  147. package/src/tokenizers/baseTokenizer.ts +0 -61
  148. package/src/tokenizers/gptTokenizer.ts +0 -27
  149. package/src/tokenizers/index.ts +0 -8
  150. package/src/types/apiResponses.ts +0 -40
  151. package/src/types/cli.ts +0 -24
  152. package/src/types/common.ts +0 -39
  153. package/src/types/configuration.ts +0 -201
  154. package/src/types/handlebars.d.ts +0 -5
  155. package/src/types/patch.d.ts +0 -25
  156. package/src/types/review.ts +0 -294
  157. package/src/types/reviewContext.d.ts +0 -65
  158. package/src/types/reviewSchema.ts +0 -181
  159. package/src/types/structuredReview.ts +0 -167
  160. package/src/types/tokenAnalysis.ts +0 -56
  161. package/src/utils/FileReader.ts +0 -93
  162. package/src/utils/FileWriter.ts +0 -76
  163. package/src/utils/PathGenerator.ts +0 -97
  164. package/src/utils/api/apiUtils.ts +0 -14
  165. package/src/utils/api/index.ts +0 -1
  166. package/src/utils/apiErrorHandler.ts +0 -287
  167. package/src/utils/ciDataCollector.ts +0 -252
  168. package/src/utils/codingTestConfigLoader.ts +0 -466
  169. package/src/utils/dependencies/aiDependencyAnalyzer.ts +0 -454
  170. package/src/utils/detection/frameworkDetector.ts +0 -879
  171. package/src/utils/detection/index.ts +0 -10
  172. package/src/utils/detection/projectTypeDetector.ts +0 -518
  173. package/src/utils/diagramGenerator.ts +0 -206
  174. package/src/utils/errorLogger.ts +0 -60
  175. package/src/utils/estimationUtils.ts +0 -407
  176. package/src/utils/fileFilters.ts +0 -373
  177. package/src/utils/fileSystem.ts +0 -57
  178. package/src/utils/index.ts +0 -36
  179. package/src/utils/logger.ts +0 -290
  180. package/src/utils/pathValidator.ts +0 -98
  181. package/src/utils/priorityFilter.ts +0 -59
  182. package/src/utils/projectDocs.ts +0 -189
  183. package/src/utils/promptPaths.ts +0 -29
  184. package/src/utils/promptTemplateManager.ts +0 -157
  185. package/src/utils/review/consolidateReview.ts +0 -553
  186. package/src/utils/review/fixDisplay.ts +0 -100
  187. package/src/utils/review/fixImplementation.ts +0 -61
  188. package/src/utils/review/index.ts +0 -36
  189. package/src/utils/review/interactiveProcessing.ts +0 -294
  190. package/src/utils/review/progressTracker.ts +0 -296
  191. package/src/utils/review/reviewExtraction.ts +0 -382
  192. package/src/utils/review/types.ts +0 -46
  193. package/src/utils/reviewActionHandler.ts +0 -18
  194. package/src/utils/reviewParser.ts +0 -253
  195. package/src/utils/sanitizer.ts +0 -238
  196. package/src/utils/smartFileSelector.ts +0 -255
  197. package/src/utils/templateLoader.ts +0 -514
  198. package/src/utils/treeGenerator.ts +0 -153
  199. package/tsconfig.build.json +0 -14
  200. package/tsconfig.json +0 -59
@@ -1,390 +0,0 @@
1
- /**
2
- * @fileoverview Utility to convert existing code review data to AI detection format.
3
- *
4
- * This module provides functions to transform the existing FileInfo and project structure
5
- * into the CodeSubmission format required by the AI detection engine.
6
- */
7
-
8
- import { execSync } from 'node:child_process';
9
- import { statSync } from 'node:fs';
10
- import path from 'node:path';
11
- import type { FileInfo } from '../../../types/review';
12
- import type { ProjectDocs } from '../../../utils/projectDocs';
13
- import type {
14
- CodeFile,
15
- CodeSubmission,
16
- DocumentationSet,
17
- GitCommit,
18
- GitRepository,
19
- ParsedCodebase,
20
- ParsedFunction,
21
- } from '../types/DetectionTypes';
22
-
23
- /**
24
- * Convert review data to AI detection submission format
25
- */
26
- export class SubmissionConverter {
27
- /**
28
- * Convert FileInfo array and project data to CodeSubmission
29
- * @param files Array of FileInfo objects
30
- * @param projectName Project name
31
- * @param projectDocs Project documentation
32
- * @param projectPath Path to project root
33
- * @returns CodeSubmission object for AI detection
34
- */
35
- static async convert(
36
- files: FileInfo[],
37
- _projectName: string,
38
- projectDocs: ProjectDocs | null,
39
- projectPath: string = process.cwd(),
40
- ): Promise<CodeSubmission> {
41
- try {
42
- const repository = await SubmissionConverter.extractGitRepository(projectPath);
43
- const codebase = SubmissionConverter.createParsedCodebase(files);
44
- const documentation = SubmissionConverter.createDocumentationSet(files, projectDocs);
45
-
46
- return {
47
- repository,
48
- codebase,
49
- documentation,
50
- };
51
- } catch (error) {
52
- console.warn('Error converting submission:', error);
53
- return SubmissionConverter.createFallbackSubmission(files, projectDocs);
54
- }
55
- }
56
-
57
- /**
58
- * Extract git repository information
59
- * @param projectPath Path to project root
60
- * @returns Git repository data
61
- */
62
- private static async extractGitRepository(projectPath: string): Promise<GitRepository> {
63
- try {
64
- // Check if git repository exists
65
- execSync('git rev-parse --git-dir', {
66
- cwd: projectPath,
67
- stdio: 'pipe',
68
- });
69
-
70
- // Get commit history (last 50 commits)
71
- const gitLogOutput = execSync(
72
- 'git log --pretty=format:"%H|%s|%ai|%an|%ae" -n 50 --name-only',
73
- {
74
- cwd: projectPath,
75
- encoding: 'utf8',
76
- stdio: 'pipe',
77
- },
78
- );
79
-
80
- const commits = SubmissionConverter.parseGitLog(gitLogOutput);
81
-
82
- return {
83
- commits,
84
- rootPath: projectPath,
85
- };
86
- } catch (error) {
87
- console.warn('Failed to extract git repository info:', error);
88
- return {
89
- commits: [],
90
- rootPath: projectPath,
91
- };
92
- }
93
- }
94
-
95
- /**
96
- * Parse git log output into commit objects
97
- * @param gitLogOutput Raw git log output
98
- * @returns Array of parsed git commits
99
- */
100
- private static parseGitLog(gitLogOutput: string): GitCommit[] {
101
- const commits: GitCommit[] = [];
102
- const lines = gitLogOutput.split('\n').filter((line) => line.trim());
103
-
104
- let currentCommit: Partial<GitCommit> | null = null;
105
- let collectingFiles = false;
106
-
107
- for (const line of lines) {
108
- if (line.includes('|')) {
109
- // Commit header line
110
- if (currentCommit) {
111
- commits.push(currentCommit as GitCommit);
112
- }
113
-
114
- const parts = line.split('|');
115
- if (parts.length >= 5) {
116
- currentCommit = {
117
- hash: parts[0],
118
- message: parts[1],
119
- timestamp: new Date(parts[2]),
120
- author: {
121
- name: parts[3],
122
- email: parts[4],
123
- },
124
- changedFiles: [],
125
- };
126
- collectingFiles = true;
127
- }
128
- } else if (collectingFiles && currentCommit && line.trim()) {
129
- // File name line
130
- currentCommit.changedFiles?.push(line.trim());
131
- }
132
- }
133
-
134
- // Add the last commit
135
- if (currentCommit) {
136
- commits.push(currentCommit as GitCommit);
137
- }
138
-
139
- return commits.reverse(); // Oldest first
140
- }
141
-
142
- /**
143
- * Create parsed codebase from FileInfo array
144
- * @param files Array of FileInfo objects
145
- * @returns Parsed codebase structure
146
- */
147
- private static createParsedCodebase(files: FileInfo[]): ParsedCodebase {
148
- const codeFiles: CodeFile[] = files.map((file) => ({
149
- path: file.path,
150
- content: file.content,
151
- language: SubmissionConverter.detectLanguage(file.path),
152
- size: Buffer.byteLength(file.content, 'utf8'),
153
- lastModified: SubmissionConverter.getFileModifiedTime(file.path),
154
- }));
155
-
156
- const functions = SubmissionConverter.extractFunctions(codeFiles);
157
-
158
- return {
159
- files: codeFiles,
160
- functions,
161
- statistics: {
162
- totalLines: codeFiles.reduce((sum, file) => sum + file.content.split('\n').length, 0),
163
- totalFiles: codeFiles.length,
164
- languages: Array.from(new Set(codeFiles.map((f) => f.language))),
165
- },
166
- };
167
- }
168
-
169
- /**
170
- * Create documentation set from files and project docs
171
- * @param files Array of FileInfo objects
172
- * @param projectDocs Project documentation
173
- * @returns Documentation set
174
- */
175
- private static createDocumentationSet(
176
- files: FileInfo[],
177
- projectDocs: ProjectDocs | null,
178
- ): DocumentationSet {
179
- // Find README file
180
- const readmeFile = files.find((file) => /readme/i.test(path.basename(file.path)));
181
-
182
- // Get code files for comment analysis
183
- const codeFiles = files
184
- .filter((file) => SubmissionConverter.isCodeFile(file.path))
185
- .map((file) => ({
186
- path: file.path,
187
- content: file.content,
188
- language: SubmissionConverter.detectLanguage(file.path),
189
- size: Buffer.byteLength(file.content, 'utf8'),
190
- }));
191
-
192
- return {
193
- readme: readmeFile?.content || projectDocs?.readme,
194
- codeFiles,
195
- otherDocs: SubmissionConverter.extractOtherDocs(files),
196
- };
197
- }
198
-
199
- /**
200
- * Detect programming language from file path
201
- * @param filePath File path
202
- * @returns Programming language
203
- */
204
- private static detectLanguage(filePath: string): string {
205
- const ext = path.extname(filePath).toLowerCase();
206
- const langMap: Record<string, string> = {
207
- '.js': 'javascript',
208
- '.jsx': 'javascript',
209
- '.ts': 'typescript',
210
- '.tsx': 'typescript',
211
- '.py': 'python',
212
- '.java': 'java',
213
- '.go': 'go',
214
- '.rb': 'ruby',
215
- '.php': 'php',
216
- '.cpp': 'cpp',
217
- '.c': 'c',
218
- '.cs': 'csharp',
219
- '.swift': 'swift',
220
- '.kt': 'kotlin',
221
- '.rs': 'rust',
222
- '.dart': 'dart',
223
- };
224
-
225
- return langMap[ext] || 'unknown';
226
- }
227
-
228
- /**
229
- * Get file modification time
230
- * @param filePath File path
231
- * @returns Last modified date or undefined
232
- */
233
- private static getFileModifiedTime(filePath: string): Date | undefined {
234
- try {
235
- const stats = statSync(filePath);
236
- return stats.mtime;
237
- } catch {
238
- return undefined;
239
- }
240
- }
241
-
242
- /**
243
- * Check if file is a code file
244
- * @param filePath File path
245
- * @returns True if it's a code file
246
- */
247
- private static isCodeFile(filePath: string): boolean {
248
- const codeExtensions = [
249
- '.js',
250
- '.jsx',
251
- '.ts',
252
- '.tsx',
253
- '.py',
254
- '.java',
255
- '.go',
256
- '.rb',
257
- '.php',
258
- '.cpp',
259
- '.c',
260
- '.cs',
261
- '.swift',
262
- '.kt',
263
- '.rs',
264
- '.scala',
265
- '.clj',
266
- '.dart',
267
- ];
268
-
269
- const ext = path.extname(filePath).toLowerCase();
270
- return codeExtensions.includes(ext);
271
- }
272
-
273
- /**
274
- * Extract function information from code files (simplified)
275
- * @param codeFiles Array of code files
276
- * @returns Array of parsed functions
277
- */
278
- private static extractFunctions(codeFiles: CodeFile[]): ParsedFunction[] {
279
- const functions: ParsedFunction[] = [];
280
-
281
- codeFiles.forEach((file) => {
282
- if (file.language === 'typescript' || file.language === 'javascript') {
283
- const extractedFunctions = SubmissionConverter.extractJSFunctions(file);
284
- functions.push(...extractedFunctions);
285
- }
286
- // Add other language parsers as needed
287
- });
288
-
289
- return functions;
290
- }
291
-
292
- /**
293
- * Extract JavaScript/TypeScript functions (simplified regex-based)
294
- * @param file Code file
295
- * @returns Array of parsed functions
296
- */
297
- private static extractJSFunctions(file: CodeFile): ParsedFunction[] {
298
- const functions: ParsedFunction[] = [];
299
- const lines = file.content.split('\n');
300
-
301
- // Simple regex patterns for function detection
302
- const functionPatterns = [
303
- /function\s+(\w+)\s*\([^)]*\)/,
304
- /const\s+(\w+)\s*=\s*\([^)]*\)\s*=>/,
305
- /(\w+)\s*:\s*\([^)]*\)\s*=>/,
306
- /async\s+function\s+(\w+)/,
307
- ];
308
-
309
- lines.forEach((line, index) => {
310
- for (const pattern of functionPatterns) {
311
- const match = line.match(pattern);
312
- if (match) {
313
- functions.push({
314
- name: match[1] || 'anonymous',
315
- filePath: file.path,
316
- startLine: index + 1,
317
- endLine: index + 1, // Simplified - would need proper parsing
318
- parameters: [], // Simplified
319
- conditionals: [],
320
- loops: [],
321
- catches: [],
322
- logicalOperators: [],
323
- });
324
- break;
325
- }
326
- }
327
- });
328
-
329
- return functions;
330
- }
331
-
332
- /**
333
- * Extract other documentation files
334
- * @param files Array of FileInfo objects
335
- * @returns Array of documentation files
336
- */
337
- private static extractOtherDocs(files: FileInfo[]) {
338
- const docPatterns = [/\.md$/i, /changelog/i, /license/i, /contributing/i, /authors/i];
339
-
340
- return files
341
- .filter(
342
- (file) =>
343
- docPatterns.some((pattern) => pattern.test(file.path)) &&
344
- !/readme/i.test(path.basename(file.path)),
345
- )
346
- .map((file) => ({
347
- path: file.path,
348
- content: file.content,
349
- type: SubmissionConverter.categorizeDocFile(file.path),
350
- }));
351
- }
352
-
353
- /**
354
- * Categorize documentation file type
355
- * @param filePath File path
356
- * @returns Documentation type
357
- */
358
- private static categorizeDocFile(
359
- filePath: string,
360
- ): 'readme' | 'changelog' | 'api' | 'guide' | 'other' {
361
- const fileName = path.basename(filePath).toLowerCase();
362
-
363
- if (fileName.includes('changelog')) return 'changelog';
364
- if (fileName.includes('api')) return 'api';
365
- if (fileName.includes('guide') || fileName.includes('tutorial')) return 'guide';
366
- if (fileName.includes('readme')) return 'readme';
367
-
368
- return 'other';
369
- }
370
-
371
- /**
372
- * Create fallback submission when git extraction fails
373
- * @param files Array of FileInfo objects
374
- * @param projectDocs Project documentation
375
- * @returns Minimal CodeSubmission
376
- */
377
- private static createFallbackSubmission(
378
- files: FileInfo[],
379
- projectDocs: ProjectDocs | null,
380
- ): CodeSubmission {
381
- return {
382
- repository: {
383
- commits: [],
384
- rootPath: process.cwd(),
385
- },
386
- codebase: SubmissionConverter.createParsedCodebase(files),
387
- documentation: SubmissionConverter.createDocumentationSet(files, projectDocs),
388
- };
389
- }
390
- }