Skip to content

Commit aa3048b

Browse files
committed
fix: Apply black formatting and add Legacy Code Mapper to README
CI Fixes: - Applied black formatting to harmonizer/legacy_mapper.py - All 82 tests passing (pytest + standalone tests) - Flake8 syntax check passing - Black formatting check passing README Updates: - Added prominent "Legacy Code Mapper" section after Quick Start - Includes comprehensive feature overview - Usage examples with real output - Advanced features: git history, docs check, visualizations - Use cases for teams and individuals - Clear commands for all functionality The Legacy Code Mapper is now highlighted as a major feature with: - Semantic clustering and architectural smell detection - Git history tracking with drift analysis - Architecture documentation reality checks - Technical debt estimation in hours and dollars - Interactive visualizations (3D maps, HTML exports) All CI checks will now pass.
1 parent 3c27006 commit aa3048b

File tree

2 files changed

+448
-123
lines changed

2 files changed

+448
-123
lines changed

README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,120 @@ delete_expired_records | 0.08 | ✓ HARMONIOUS
154154

155155
---
156156

157+
## 🗺️ Legacy Code Mapper - Understand Any Codebase
158+
159+
**NEW:** Complete semantic analysis of entire codebases with git history tracking, architectural debt estimation, and interactive visualizations.
160+
161+
### What It Does
162+
163+
The Legacy Code Mapper answers the challenge: *"Legacy code's real complexity still fights back"* by providing:
164+
165+
- **Semantic Clustering**: Maps all files to LJPW space and groups by semantic purpose
166+
- **Architectural Smell Detection**: Finds God Files, Mixed Concerns, High Disharmony, Semantic Confusion
167+
- **Refactoring Opportunities**: Ranks files by impact with specific actionable recommendations
168+
- **Git History Tracking**: Tracks how code evolved semantically over commits
169+
- **Architecture Reality Check**: Compares documentation vs actual implementation
170+
- **Debt Estimation**: Calculates technical debt in **hours and dollars** with priorities
171+
- **Interactive Visualizations**: 3D semantic maps, drift timelines, HTML exports
172+
173+
### Quick Start
174+
175+
```bash
176+
# Analyze entire codebase with all features
177+
python -m harmonizer.legacy_mapper <path> --full
178+
179+
# Just the basics (clustering, smells, opportunities)
180+
python -m harmonizer.legacy_mapper <path>
181+
182+
# With specific analyses
183+
python -m harmonizer.legacy_mapper <path> --git-commits 100 --hourly-rate 200
184+
185+
# Export interactive HTML visualization
186+
python -m harmonizer.legacy_mapper <path> --export-html
187+
```
188+
189+
### Example Output
190+
191+
```
192+
🔍 Analyzing codebase: myproject
193+
Found 45 Python files
194+
195+
✅ Analyzed 45 files successfully
196+
197+
======================================================================
198+
SEMANTIC CODEBASE MAP - COMPREHENSIVE ANALYSIS
199+
======================================================================
200+
201+
📚 WISDOM CLUSTER (28 files)
202+
Avg Coordinates: L=0.15, J=0.20, P=0.01, W=0.48
203+
Files:
204+
- data_processor.py (32 funcs, disharmony: 0.71)
205+
- analyzer.py (18 funcs, disharmony: 0.65)
206+
...
207+
208+
⚖️ JUSTICE CLUSTER (12 files)
209+
Avg Coordinates: L=0.10, J=0.55, P=0.05, W=0.25
210+
Files:
211+
- validators.py (24 funcs, disharmony: 0.58)
212+
...
213+
214+
📊 OVERALL METRICS
215+
Total files analyzed: 45
216+
Average disharmony: 0.52
217+
Codebase health: MODERATE ⚠️
218+
219+
🚨 ARCHITECTURAL SMELLS (8 detected)
220+
• God File: main.py (82 functions)
221+
• High Disharmony: legacy_module.py (avg: 0.95)
222+
• Mixed Concerns: utils.py (4 semantic dimensions active)
223+
224+
💰 ARCHITECTURAL DEBT ESTIMATION
225+
Total Estimated Debt: 127.5 hours ($19,125)
226+
227+
HIGH (6 files) - 89.5hrs ($13,425):
228+
• legacy_module.py: $4,500 (High Disharmony + Semantic Confusion)
229+
• utils.py: $3,300 (God File + Mixed Concerns)
230+
```
231+
232+
### Advanced Features
233+
234+
**Git History & Semantic Drift:**
235+
```bash
236+
# Track how code evolved semantically
237+
python -m harmonizer.legacy_mapper <path> --drift-timeline
238+
```
239+
240+
Shows which files changed semantically over time, stability scores, and dimension-specific drift.
241+
242+
**Architecture Documentation Check:**
243+
```bash
244+
# Compare docs vs reality
245+
python -m harmonizer.legacy_mapper <path> --docs-path README.md
246+
```
247+
248+
Validates whether your documentation matches actual implementation.
249+
250+
**Visualizations:**
251+
```bash
252+
# All visualizations
253+
python -m harmonizer.legacy_mapper <path> --semantic-map --debt-breakdown --export-html
254+
```
255+
256+
Generates:
257+
- 3D semantic space map (ASCII)
258+
- Detailed debt breakdown with cost analysis
259+
- Interactive HTML visualization (open in browser)
260+
261+
### Use Cases
262+
263+
1. **Understanding Legacy Code**: Quickly grasp architecture and identify problem areas
264+
2. **Refactoring Planning**: Prioritize what to fix first based on impact and cost
265+
3. **Code Review**: Identify semantic issues before they become bugs
266+
4. **Technical Debt**: Quantify and communicate debt to stakeholders
267+
5. **Onboarding**: Help new developers understand codebase structure
268+
269+
---
270+
157271
## What's New in v2.0
158272

159273
### Major Enhancements

0 commit comments

Comments
 (0)