Local project autopsy CLI that scans codebases and generates rich, readable reports with scores, grades, and actionable insights
npm install codemortemLocal project autopsy CLI that scans codebases and generates rich, readable reports with scores, grades, and actionable insights.
``bash`
npm install -g codemortem
Or run without installation:
`bash`
npx codemortem
`bashAnalyze current directory
codemortem
codemortem analyze
Features
- š Static Analysis: Scans all source files recursively
- š Rich Metrics: Code Quality, Architecture, Documentation, Dependencies, Security, Testing, Git
- šÆ Actionable Insights: Identifies specific pain points with file and line numbers
- š Visual Reports: Colorful ASCII bar charts for quick comprehension
- š·ļø Letter Grades: Overall score with A-F grading system
- šØ Risk Assessment: High, medium, and low severity issue identification
Example Output
`
.codemortem - Project Autopsy Report.
Starting analysis...š codemortem - Project Autopsy Report
=====================================
Overall Score: 87/100 (B Grade)
Category Breakdown:
Code Quality āāāāāāāāāāāāāāāāāāāā 96
Architecture āāāāāāāāāāāāāāāāāāāā 100
Documentation āāāāāāāāāāāāāāāāāāāā 70
Dependencies āāāāāāāāāāāāāāāāāāāā 80
Security āāāāāāāāāāāāāāāāāāāā 90
Testing āāāāāāāāāāāāāāāāāāāā 20
Git Process āāāāāāāāāāāāāāāāāāāā 98
Testing Maturity:
Test-to-Source Ratio āāāāāāāāāāāāāāāāāāāā 0
Risk Profile:
High Risk Issues āāāāāāāāāāāāāāāāāāāā 80
Medium Risk Issues āāāāāāāāāāāāāāāāāāāā 90
Security Issues āāāāāāāāāāāāāāāāāāāā 95
ā ļø Top Pain Points:
1. index.js:17 - Function too long (67 lines, threshold: 50)
2. project - No test files detected
3. analyzers/git-analyzer.js:1 - High nesting depth detected (6, threshold: 4)
4. analyzers/code-quality-analyzer.js:1 - High nesting depth detected (5, threshold: 4)
5. project root - README file not found
š Project Statistics:
⢠Files analyzed: 11
⢠Total lines: 1,588
⢠Languages: js
⢠Avg file size: 4,313 bytes
šØ Risk Summary:
⢠Critical: 2 high severity issues
⢠High: 5 medium severity issues
ā
Strengths:
⢠Good security practices
⢠Clean, well-structured code
Analysis complete!
`Metrics & Scoring
The tool analyzes 7 key areas:
- Code Quality: File length, function length, nesting depth, cyclomatic complexity
- Architecture: God files, folder depth, coupling, cohesion
- Documentation: README completeness, comment density, JSDoc coverage
- Dependencies: Package.json completeness, unused dependencies, deprecated packages
- Security: Hardcoded secrets, unsafe APIs, vulnerable dependencies
- Testing: Test file detection, test-to-source ratio, coverage estimation
- Git Process: Commit history quality, branch strategy, commit message quality
Options
| Flag | Alias | Description |
|------|-------|-------------|
|
--dir | -D | Directory to analyze (defaults to current) |
| --summary | -s | Show summary report only |
| --json | -j | Output in JSON format |
| --deep | -d` | Run deep analysis |MIT