Added comprehensive technical debt metrics to the thothctl inventory iac command. These metrics provide quantifiable insights into infrastructure code health and maintenance needs.
New method _calculate_technical_debt_metrics() that computes:
- Total Components: Count of all modules in the inventory
- Outdated Modules: Modules with available updates
- Outdated Providers: Providers with available updates
- Current Modules/Providers: Up-to-date components
- Breaking Changes: Modules and providers with breaking changes
- Debt Score: 0-100 scale (higher = more debt)
- Risk Level: critical/high/medium/low
- Recommendations: Actionable suggestions
Base Score = (Outdated Items / Total Items) × 100
Breaking Changes Weight = (Breaking Changes Count) × 5
Final Score = min(100, Base Score + Breaking Changes Weight)
Risk Levels:
- Critical: ≥70% debt score
- High: 50-69% debt score
- Medium: 30-49% debt score
- Low: <30% debt score
Added technical debt section to console summary:
- Color-coded debt score (red/yellow/cyan/green)
- Outdated modules and providers count
- Breaking changes warnings
- Risk level indicator
Added visual technical debt section with:
- Debt score card with risk-based color coding
- Outdated modules/providers cards
- Breaking changes warnings
- Recommendations panel with actionable items
- Modern card-based layout matching existing design
The technical debt metrics are automatically calculated when using --check-versions:
# Basic inventory with technical debt metrics
thothctl inventory iac --check-versions
# Full analysis with compatibility checking
thothctl inventory iac --check-versions --check-schema-compatibility
# Generate all report types
thothctl inventory iac --check-versions --report-type all📊 Technical Debt Metrics:
Debt Score: 45.2% (MEDIUM risk)
Outdated Modules: 12/35
Outdated Providers: 3
⚠️ Modules with Breaking Changes: 2
⚠️ Providers with Breaking Changes: 1
- Visual cards showing debt score with color-coded risk level
- Breakdown of outdated components
- Breaking changes highlighted with warning icons
- Recommendations panel with specific action items
- Quantifiable Metrics: Clear numbers for tracking technical debt over time
- Risk Assessment: Immediate understanding of infrastructure health
- Prioritization: Breaking changes highlighted for careful review
- Actionable: Specific recommendations for improvement
- Trend Tracking: JSON output enables historical analysis
- Stakeholder Communication: Professional HTML reports for management
-
src/thothctl/services/inventory/inventory_service.py- Added
_calculate_technical_debt_metrics()method - Integrated calculation before report generation
- Added
-
src/thothctl/commands/inventory/commands/iac.py- Enhanced
_display_summary()with technical debt section - Added color-coded console output
- Enhanced
-
src/thothctl/services/inventory/report_service.py- Added technical debt section to HTML report generation
- Integrated with existing modern card-based design
The feature integrates seamlessly with existing functionality:
- Only runs when
--check-versionsis enabled - Uses existing version check data
- Leverages compatibility analysis when available
- Appears in all report formats (console, HTML, JSON)
Potential improvements:
- Historical trend tracking across multiple inventory runs
- Configurable debt score weights
- Custom risk level thresholds
- Integration with CI/CD for automated debt tracking
- Debt reduction planning tools