Skip to content

Commit a2425e3

Browse files
refactoring
1 parent b1bf9a8 commit a2425e3

1 file changed

Lines changed: 47 additions & 38 deletions

File tree

REFACTORING_PLAN.md

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,75 +9,83 @@ wprowadzenie **taksonomii 4 formatów** (v0.3.0), a następnie:
99
- **Reorganizacja**: generatory przeniesione do `generators/` subpakietu
1010
- **Testy**: nazwy sprint-based → feature-based
1111

12-
## Aktualna Struktura (v0.4.0)
12+
## Aktualna Struktura (v0.6.0)
1313

1414
```
1515
code2llm/
1616
├── code2llm/ # Główna paczka
17-
│ ├── __init__.py # Eksportuje publiczne API (v0.4.0)
17+
│ ├── __init__.py # Eksportuje publiczne API
1818
│ ├── __main__.py # Entry point: python -m code2llm
1919
│ ├── cli.py # CLI: code2llm (map,toon,flow,context,all)
2020
│ ├── core/ # Klasy bazowe i konfiguracja
2121
│ │ ├── __init__.py
2222
│ │ ├── config.py # Config, ANALYSIS_MODES, NODE_COLORS
2323
│ │ ├── models.py # FlowNode, FlowEdge, DataFlow, AnalysisResult
2424
│ │ ├── analyzer.py # ProjectAnalyzer - główny orchestrator
25-
│ │ └── streaming_analyzer.py # StreamingAnalyzer z priorytetyzacją
25+
│ │ ├── streaming_analyzer.py # StreamingAnalyzer z priorytetyzacją
26+
│ │ ├── core/ # Subpackage: file analysis internals (v0.6.0)
27+
│ │ │ ├── __init__.py # Re-exports: FileCache, FastFileFilter, FileAnalyzer, RefactoringAnalyzer
28+
│ │ │ ├── cache.py # FileCache
29+
│ │ │ ├── file_filter.py # FastFileFilter
30+
│ │ │ ├── file_analyzer.py # FileAnalyzer (AST parsing)
31+
│ │ │ └── refactoring.py # RefactoringAnalyzer
32+
│ │ └── streaming/ # Subpackage: streaming internals (v0.6.0)
33+
│ │ ├── __init__.py # Re-exports: StreamingScanner, SmartPrioritizer, etc.
34+
│ │ ├── scanner.py # StreamingScanner
35+
│ │ ├── prioritizer.py # SmartPrioritizer
36+
│ │ └── incremental.py # IncrementalAnalyzer
2637
│ ├── analysis/ # Moduły analizy
2738
│ │ ├── call_graph.py # CallGraphExtractor
2839
│ │ ├── cfg.py # CFGExtractor - Control Flow Graph
2940
│ │ ├── coupling.py # CouplingAnalyzer
3041
│ │ ├── data_analysis.py # DataAnalyzer
3142
│ │ ├── dfg.py # DFGExtractor - Data Flow Graph
32-
│ │ ├── pipeline_detector.py # PipelineDetector (networkx)
43+
│ │ ├── pipeline_detector.py # PipelineDetector (networkx, method→method edges)
3344
│ │ ├── side_effects.py # SideEffectDetector
34-
│ │ ├── type_inference.py # TypeInference (AST-based)
45+
│ │ ├── type_inference.py # TypeInference (AST-based, dispatch dict)
3546
│ │ └── smells.py # SmellDetector
36-
│ ├── exporters/ # Eksport do formatów (7 eksporterów)
47+
│ ├── exporters/ # Eksport do formatów (9 eksporterów)
3748
│ │ ├── __init__.py
3849
│ │ ├── base.py # Exporter ABC
39-
│ │ ├── toon.py # ToonExporter → analysis.toon (diagnostyka)
50+
│ │ ├── toon/ # Package: ToonExporter (v0.6.0, was toon.py)
51+
│ │ │ ├── __init__.py # ToonExporter facade
52+
│ │ │ ├── renderer.py # ToonRenderer (CC-split sub-methods)
53+
│ │ │ ├── metrics.py # MetricsComputer
54+
│ │ │ ├── helpers.py # Helper functions
55+
│ │ │ └── module_detail.py # ModuleDetailRenderer
56+
│ │ ├── toon.py # backward-compat shim → toon/ package
4057
│ │ ├── map_exporter.py # MapExporter → map.toon (struktura)
4158
│ │ ├── flow_exporter.py # FlowExporter → flow.toon (data-flow)
4259
│ │ ├── context_exporter.py # ContextExporter → context.md (LLM)
4360
│ │ ├── llm_exporter.py # backward-compat shim → ContextExporter
4461
│ │ ├── yaml_exporter.py # YAMLExporter → analysis.yaml
4562
│ │ ├── json_exporter.py # JSONExporter → analysis.json
46-
│ │ └── mermaid_exporter.py # MermaidExporter → *.mmd
47-
│ ├── generators/ # Generatory (przeniesione z root-level)
63+
│ │ ├── mermaid_exporter.py # MermaidExporter → *.mmd (subpackage grouping)
64+
│ │ ├── evolution_exporter.py # EvolutionExporter → evolution.toon
65+
│ │ └── readme_exporter.py # READMEExporter → README.md
66+
│ ├── generators/ # Generatory
4867
│ │ ├── __init__.py
4968
│ │ ├── llm_flow.py # LLM flow summary generator
5069
│ │ ├── llm_task.py # LLM task breakdown generator
5170
│ │ └── mermaid.py # Mermaid PNG generator
5271
│ ├── nlp/ # NLP pipeline
53-
│ ├── patterns/ # Detekcja wzorców (do podłączenia w v0.5)
54-
│ └── refactor/ # Silnik refaktoryzacji
55-
├── tests/
56-
│ ├── test_analyzer.py
57-
│ ├── test_edge_cases.py
58-
│ ├── test_nlp_pipeline.py
59-
│ ├── test_flow_exporter.py # (was test_sprint2_flow.py)
60-
│ ├── test_pipeline_detector.py # (was test_sprint3_pipelines.py)
61-
│ ├── test_deep_analysis.py # (was test_sprint4.py)
62-
│ ├── test_prompt_engine.py # (was test_sprint5.py)
63-
│ ├── test_toon_v2.py
64-
│ ├── test_refactoring_engine.py
65-
│ ├── test_format_quality.py
66-
│ └── test_advanced_analysis.py
72+
│ ├── patterns/ # Detekcja wzorców
73+
│ ├── refactor/ # Silnik refaktoryzacji
74+
│ └── templates/ # Jinja2 templates for refactoring prompts
75+
├── tests/ # 159 tests, all passing
6776
├── benchmarks/
68-
│ ├── benchmark_performance.py
69-
│ ├── benchmark_format_quality.py
70-
│ └── test_performance.py
71-
├── setup.py
77+
├── examples/
7278
├── pyproject.toml
7379
├── Makefile
74-
├── requirements.txt
7580
└── README.md
7681
```
7782

78-
### Usunięte w v0.4.0
79-
- `optimization/` — 1590L martwego kodu (zero importów z zewnątrz)
80-
- `visualizers/` — 150L martwego kodu (PNG via mermaid)
83+
### Usunięte
84+
- `optimization/` — 1590L martwego kodu (v0.4.0)
85+
- `visualizers/` — 150L martwego kodu (v0.4.0)
86+
- `core/analyzer_old.py` — 765L (v0.6.0)
87+
- `core/streaming_analyzer_old.py` — 666L (v0.6.0)
88+
- `TODO/` — stare pliki migracji (v0.6.0)
8189

8290
## Kluczowe Decyzje Architektoniczne
8391

@@ -206,17 +214,18 @@ result.to_dict(include_defaults=True) # Include all fields
206214
- **Black** do formatowania
207215
- **isort** do importów (opcjonalnie)
208216

209-
## Status: ✅ Ukończone (v0.4.0)
217+
## Status: ✅ Ukończone (v0.6.0)
210218

211219
- [x] Rename code2flow → code2llm
212220
- [x] Struktura katalogów (reorganizacja generators/)
213-
- [x] Moduły core/
214-
- [x] Moduły analysis/ (+ pipeline_detector, side_effects, type_inference)
215-
- [x] Moduły exporters/ (7 eksporterów, wszystkie podłączone do CLI)
221+
- [x] Moduły core/ + core/core/ + core/streaming/ subpackages
222+
- [x] Moduły analysis/ (+ pipeline_detector method→method, type_inference dispatch)
223+
- [x] Moduły exporters/ (9 eksporterów + toon/ package, wszystkie podłączone do CLI)
216224
- [x] Moduły generators/ (przeniesione z root-level)
217-
- [x] Usunięcie martwego kodu (optimization/, visualizers/)
218-
- [x] CLI
225+
- [x] Usunięcie martwego kodu (optimization/, visualizers/, *_old.py, TODO/)
226+
- [x] CLI (streaming, strategy, refactor, examples)
219227
- [x] setup.py / pyproject.toml
220228
- [x] Makefile
221-
- [x] Testy (feature-named)
229+
- [x] Testy (159/159 passing)
230+
- [x] Metryki: CC̄=4.7, max-CC=19, 12 pipelines, 0 god modules
222231
- [ ] Dokumentacja API (do zrobienia)

0 commit comments

Comments
 (0)