| 56 | } |
| 57 | |
| 58 | function printStats(stats) { |
| 59 | console.log('\nCodebase Index Statistics\n' + '='.repeat(40)); |
| 60 | console.log(`Files: ${stats.files}`); |
| 61 | console.log(`Lines: ${stats.lines.toLocaleString()}`); |
| 62 | console.log(`Exports: ${stats.exports}`); |
| 63 | console.log(`Edges: ${stats.edges} (dependency links)`); |
| 64 | console.log(`Routes: ${stats.routes}`); |
| 65 | console.log(`Scripts: ${stats.packageScripts}`); |
| 66 | console.log(`Verify: ${stats.verificationCommands} commands`); |
| 67 | |
| 68 | console.log('\nBy language:'); |
| 69 | for (const [lang, count] of Object.entries(stats.byLanguage).sort((a, b) => b[1] - a[1])) { |
| 70 | console.log(` ${lang.padEnd(14)} ${count}`); |
| 71 | } |
| 72 | |
| 73 | console.log('\nBy role:'); |
| 74 | for (const [role, count] of Object.entries(stats.byRole).sort((a, b) => b[1] - a[1])) { |
| 75 | console.log(` ${role.padEnd(14)} ${count}`); |
| 76 | } |
| 77 | console.log(''); |
| 78 | } |
| 79 | |
| 80 | function loadRequiredIndex(outputPath) { |
| 81 | if (!fs.existsSync(outputPath)) { |