|
5 | 5 | */ |
6 | 6 |
|
7 | 7 | import { writeFile } from 'fs/promises' |
| 8 | +import path from 'path' |
8 | 9 | import { GitHubClient, checkGhCli } from './github/gh-client.js' |
9 | 10 | import { GhCliError, GhApiError, GhParseError } from './utils/errors.js' |
10 | 11 | import { categorizeIssues, CATEGORIES } from './categorize/index.js' |
11 | 12 | import { findAllDuplicates, createWorkClusters } from './similarity/index.js' |
| 13 | +import { generateReport, type ReportData } from './reports/index.js' |
12 | 14 |
|
13 | 15 | async function main() { |
14 | 16 | console.log('GitHub Issues Triage Tool v1.0.0') |
@@ -248,15 +250,51 @@ async function main() { |
248 | 250 | await writeFile(outputPath, JSON.stringify(exportData, null, 2), 'utf-8') |
249 | 251 | console.log(`✓ Results exported to ${outputPath}`) |
250 | 252 |
|
251 | | - console.log('\n✓ Categorization complete!') |
| 253 | + // Step 11: Generate Markdown reports |
| 254 | + console.log('\n📝 Generating reports...') |
| 255 | + |
| 256 | + const reportData: ReportData = { |
| 257 | + issues: categorizedItems, |
| 258 | + duplicates: duplicateGroups, |
| 259 | + clusters: workClusters, |
| 260 | + metadata: { |
| 261 | + generatedAt: new Date().toISOString(), |
| 262 | + totalIssues: issues.length, |
| 263 | + totalPRs: prs.length, |
| 264 | + categorizedIssues: categorizedItems.filter( |
| 265 | + (i) => i.categorization.primary !== 'uncategorized', |
| 266 | + ).length, |
| 267 | + uncategorizedIssues: categorizedItems.filter( |
| 268 | + (i) => i.categorization.primary === 'uncategorized', |
| 269 | + ).length, |
| 270 | + }, |
| 271 | + } |
| 272 | + |
| 273 | + // Generate full report |
| 274 | + const fullReport = generateReport(reportData, { variant: 'full' }) |
| 275 | + const fullReportPath = path.join('cache', 'triage-report-full.md') |
| 276 | + await writeFile(fullReportPath, fullReport, 'utf-8') |
| 277 | + console.log(`✓ Full report: ${fullReportPath}`) |
| 278 | + |
| 279 | + // Generate priority report |
| 280 | + const priorityReport = generateReport(reportData, { |
| 281 | + variant: 'priority', |
| 282 | + maxIssuesPerSection: 30, |
| 283 | + }) |
| 284 | + const priorityReportPath = path.join('cache', 'triage-report-priority.md') |
| 285 | + await writeFile(priorityReportPath, priorityReport, 'utf-8') |
| 286 | + console.log(`✓ Priority report: ${priorityReportPath}`) |
| 287 | + |
| 288 | + console.log('\n✓ Triage complete!') |
| 289 | + console.log('\nGenerated files:') |
| 290 | + console.log(` - ${outputPath} (JSON data)`) |
| 291 | + console.log(` - ${fullReportPath} (Full markdown report)`) |
| 292 | + console.log(` - ${priorityReportPath} (Priority issues report)`) |
252 | 293 | console.log('\nNext steps:') |
253 | | - console.log( |
254 | | - '- Review categorization results in cache/categorization-results.json', |
255 | | - ) |
256 | | - console.log('- Use LLM to analyze categorization accuracy') |
257 | | - console.log('- Generate detailed triage reports') |
258 | | - console.log('- Add LLM-based categorization for ambiguous cases') |
259 | | - console.log('- Implement trend analysis') |
| 294 | + console.log('- Review the generated reports') |
| 295 | + console.log('- Use reports to prioritize maintenance work') |
| 296 | + console.log('- Close duplicate issues') |
| 297 | + console.log('- Address urgent bugs and easy fixes') |
260 | 298 | } catch (error) { |
261 | 299 | // Handle specific error types with helpful messages |
262 | 300 | if (error instanceof GhCliError) { |
|
0 commit comments