(result: AnalyzeResult, options: AnalyzeOptions)
| 280 | } |
| 281 | |
| 282 | function outputAnalysis(result: AnalyzeResult, options: AnalyzeOptions): void { |
| 283 | if (options.output === 'json') { |
| 284 | outputJson(result) |
| 285 | return |
| 286 | } |
| 287 | |
| 288 | if (options.output === 'toon') { |
| 289 | outputToon(result, { showEfficiencyHint: true }) |
| 290 | return |
| 291 | } |
| 292 | |
| 293 | // Human-readable text output |
| 294 | const c = getChalk() |
| 295 | |
| 296 | output(c.bold.cyan(result.project.name)) |
| 297 | output(c.dim(`Project ID: ${result.project.id}`)) |
| 298 | output('') |
| 299 | |
| 300 | // Quality score |
| 301 | const scoreColor = result.quality.score >= 80 ? c.green : result.quality.score >= 50 ? c.yellow : c.red |
| 302 | output(c.bold('Quality Score')) |
| 303 | output(` ${scoreColor(`${result.quality.score}/100`)}`) |
| 304 | if (result.quality.errors > 0 || result.quality.warnings > 0) { |
| 305 | const parts: string[] = [] |
| 306 | if (result.quality.errors > 0) { |
| 307 | parts.push(c.red(`${result.quality.errors} error${result.quality.errors > 1 ? 's' : ''}`)) |
| 308 | } |
| 309 | if (result.quality.warnings > 0) { |
| 310 | parts.push(c.yellow(`${result.quality.warnings} warning${result.quality.warnings > 1 ? 's' : ''}`)) |
| 311 | } |
| 312 | output(` ${parts.join(', ')}`) |
| 313 | } |
| 314 | output('') |
| 315 | |
| 316 | // Project summary |
| 317 | output(c.bold('Project Summary')) |
| 318 | output(` ${c.dim('Notebooks:')} ${result.project.notebooks}`) |
| 319 | output(` ${c.dim('Blocks:')} ${result.project.blocks}`) |
| 320 | output(` ${c.dim('Lines of Code:')} ${result.project.linesOfCode}`) |
| 321 | output('') |
| 322 | |
| 323 | // Structure info |
| 324 | output(c.bold('Structure')) |
| 325 | output(` ${c.dim('Entry Points:')} ${result.structure.entryPoints.length}`) |
| 326 | output(` ${c.dim('Exit Points:')} ${result.structure.exitPoints.length}`) |
| 327 | output(` ${c.dim('Longest Chain:')} ${result.structure.longestChain} blocks`) |
| 328 | output('') |
| 329 | |
| 330 | // Dependencies |
| 331 | if (result.dependencies.imports.length > 0 || result.dependencies.missingIntegrations.length > 0) { |
| 332 | output(c.bold('Dependencies')) |
| 333 | if (result.dependencies.imports.length > 0) { |
| 334 | output(` ${c.dim('Imports:')} ${result.dependencies.imports.join(', ')}`) |
| 335 | } |
| 336 | if (result.dependencies.missingIntegrations.length > 0) { |
| 337 | output(` ${c.red('Missing:')} ${result.dependencies.missingIntegrations.join(', ')}`) |
| 338 | } |
| 339 | output('') |
no test coverage detected