Skip to content

Conversation

@BruinGrowly
Copy link
Owner

No description provided.

Implements semantic codebase mapping using LJPW framework:

Features:
- Analyzes entire codebase and maps files to LJPW space
- Groups files by dominant semantic dimension (natural clusters)
- Detects outliers (files with no clear purpose)
- Calculates average disharmony per file
- Generates comprehensive semantic map report

Output shows:
- Semantic clusters (Love, Justice, Power, Wisdom)
- Average coordinates per cluster
- Top files by function count
- Overall codebase health metrics

Tested on harmonizer itself:
- 9 files analyzed
- 2 clusters: Justice (main/parser) + Wisdom (engine/analysis)
- Overall disharmony: 0.58 (MODERATE)
- Identified high-disharmony files for refactoring

This directly addresses: 'Legacy code's real complexity still fights back'
By revealing the true semantic structure of any codebase.

Usage: python -m harmonizer.legacy_mapper <path>

Next: Add git history tracking, architectural smell detection
Major Upgrades:
- Architectural smell detection (4 types: God File, Semantic Confusion, High Disharmony, Mixed Concerns)
- Refactoring opportunity identification with impact scores
- Complexity heatmap generation (ASCII visual)
- Detailed suggestions for each refactoring target

New Features:
- Detects god files (>30 functions)
- Identifies files with no clear purpose (semantic confusion)
- Flags high disharmony files (>0.7 threshold)
- Finds mixed concern files (3+ active dimensions)
- Calculates complexity reduction estimates
- Provides specific refactoring actions
- Generates visual complexity heatmap by directory
- Sortable by impact score

Enhanced Output:
- Architectural smells grouped by severity (CRITICAL/HIGH/MEDIUM/LOW)
- Top 5 refactoring opportunities with specific actions
- Impact scores and complexity reduction percentages
- Visual heatmap showing problem hotspots

CLI Options:
- --no-heatmap: Skip complexity visualization
- --no-smells: Skip architectural smell detection
- --quiet: Minimal output for automation

Tested on Harmonizer itself:
- 5 architectural smells detected (4 HIGH, 1 MEDIUM)
- Top refactorings: ast_semantic_parser_v2.py (53% impact)
- Specific actions provided for each opportunity

This is now a complete legacy code understanding system.
@BruinGrowly BruinGrowly merged commit 046fafa into main Nov 5, 2025
4 of 14 checks passed
@BruinGrowly BruinGrowly deleted the claude/fix-ci-and-readme-011CUpBZStBR8iC59eVzkbqk branch November 5, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants