code2llm 0.5.4__tar.gz → 0.5.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. code2llm-0.5.7/PKG-INFO +371 -0
  2. code2llm-0.5.7/README.md +322 -0
  3. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/__init__.py +1 -1
  4. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/analysis/data_analysis.py +34 -13
  5. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/analysis/pipeline_detector.py +40 -4
  6. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/analysis/type_inference.py +36 -27
  7. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/cli.py +108 -63
  8. code2llm-0.5.7/code2llm/core/analyzer.py +232 -0
  9. code2llm-0.5.7/code2llm/core/core/__init__.py +6 -0
  10. code2llm-0.5.7/code2llm/core/core/file_analyzer.py +365 -0
  11. code2llm-0.5.7/code2llm/core/core/file_cache.py +62 -0
  12. code2llm-0.5.7/code2llm/core/core/file_filter.py +44 -0
  13. code2llm-0.5.7/code2llm/core/core/refactoring.py +174 -0
  14. code2llm-0.5.7/code2llm/core/streaming/__init__.py +7 -0
  15. code2llm-0.5.7/code2llm/core/streaming/cache.py +51 -0
  16. code2llm-0.5.7/code2llm/core/streaming/incremental.py +75 -0
  17. code2llm-0.5.7/code2llm/core/streaming/prioritizer.py +131 -0
  18. code2llm-0.5.7/code2llm/core/streaming/scanner.py +201 -0
  19. code2llm-0.5.7/code2llm/core/streaming/strategies.py +68 -0
  20. code2llm-0.5.7/code2llm/core/streaming_analyzer.py +181 -0
  21. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/context_exporter.py +29 -12
  22. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/evolution_exporter.py +61 -28
  23. code2llm-0.5.7/code2llm/exporters/flow_constants.py +29 -0
  24. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/flow_exporter.py +11 -190
  25. code2llm-0.5.7/code2llm/exporters/flow_renderer.py +188 -0
  26. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/mermaid_exporter.py +9 -1
  27. code2llm-0.5.7/code2llm/exporters/toon/__init__.py +66 -0
  28. code2llm-0.5.7/code2llm/exporters/toon/helpers.py +115 -0
  29. code2llm-0.5.7/code2llm/exporters/toon/metrics.py +501 -0
  30. code2llm-0.5.7/code2llm/exporters/toon/module_detail.py +162 -0
  31. code2llm-0.5.7/code2llm/exporters/toon/renderer.py +357 -0
  32. code2llm-0.5.7/code2llm/exporters/toon.py +10 -0
  33. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/generators/llm_flow.py +37 -16
  34. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/generators/llm_task.py +45 -24
  35. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/nlp/__init__.py +1 -1
  36. code2llm-0.5.7/code2llm.egg-info/PKG-INFO +371 -0
  37. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm.egg-info/SOURCES.txt +18 -0
  38. {code2llm-0.5.4 → code2llm-0.5.7}/pyproject.toml +2 -2
  39. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_advanced_analysis.py +10 -11
  40. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_edge_cases.py +5 -5
  41. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_prompt_engine.py +4 -4
  42. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_refactoring_engine.py +4 -2
  43. code2llm-0.5.4/PKG-INFO +0 -639
  44. code2llm-0.5.4/README.md +0 -590
  45. code2llm-0.5.4/code2llm/core/analyzer.py +0 -765
  46. code2llm-0.5.4/code2llm/core/streaming_analyzer.py +0 -666
  47. code2llm-0.5.4/code2llm/exporters/toon.py +0 -1033
  48. code2llm-0.5.4/code2llm.egg-info/PKG-INFO +0 -639
  49. {code2llm-0.5.4 → code2llm-0.5.7}/LICENSE +0 -0
  50. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/__main__.py +0 -0
  51. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/analysis/__init__.py +0 -0
  52. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/analysis/call_graph.py +0 -0
  53. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/analysis/cfg.py +0 -0
  54. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/analysis/coupling.py +0 -0
  55. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/analysis/dfg.py +0 -0
  56. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/analysis/side_effects.py +0 -0
  57. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/analysis/smells.py +0 -0
  58. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/core/__init__.py +0 -0
  59. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/core/config.py +0 -0
  60. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/core/models.py +0 -0
  61. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/__init__.py +0 -0
  62. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/base.py +0 -0
  63. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/json_exporter.py +0 -0
  64. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/llm_exporter.py +0 -0
  65. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/map_exporter.py +0 -0
  66. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/readme_exporter.py +0 -0
  67. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/exporters/yaml_exporter.py +0 -0
  68. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/generators/__init__.py +0 -0
  69. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/generators/mermaid.py +0 -0
  70. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/nlp/config.py +0 -0
  71. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/nlp/entity_resolution.py +0 -0
  72. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/nlp/intent_matching.py +0 -0
  73. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/nlp/normalization.py +0 -0
  74. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/nlp/pipeline.py +0 -0
  75. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/patterns/__init__.py +0 -0
  76. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/patterns/detector.py +0 -0
  77. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/refactor/__init__.py +0 -0
  78. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm/refactor/prompt_engine.py +0 -0
  79. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm.egg-info/dependency_links.txt +0 -0
  80. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm.egg-info/entry_points.txt +0 -0
  81. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm.egg-info/requires.txt +0 -0
  82. {code2llm-0.5.4 → code2llm-0.5.7}/code2llm.egg-info/top_level.txt +0 -0
  83. {code2llm-0.5.4 → code2llm-0.5.7}/setup.cfg +0 -0
  84. {code2llm-0.5.4 → code2llm-0.5.7}/setup.py +0 -0
  85. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_analyzer.py +0 -0
  86. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_deep_analysis.py +0 -0
  87. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_flow_exporter.py +0 -0
  88. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_format_quality.py +0 -0
  89. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_nlp_pipeline.py +0 -0
  90. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_pipeline_detector.py +0 -0
  91. {code2llm-0.5.4 → code2llm-0.5.7}/tests/test_toon_v2.py +0 -0
@@ -0,0 +1,371 @@
1
+ Metadata-Version: 2.4
2
+ Name: code2llm
3
+ Version: 0.5.7
4
+ Summary: High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries
5
+ Home-page: https://github.com/wronai/stts
6
+ Author: STTS Project
7
+ Author-email: Tom Sapletta <tom@sapletta.com>
8
+ License-Expression: Apache-2.0
9
+ Project-URL: Homepage, https://github.com/wronai/stts
10
+ Project-URL: Repository, https://github.com/wronai/stts
11
+ Project-URL: Issues, https://github.com/wronai/stts/issues
12
+ Keywords: static-analysis,control-flow,data-flow,call-graph,reverse-engineering,toon-format,code-analysis,ast,optimization,complexity-analysis
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Software Development :: Code Generators
24
+ Classifier: Topic :: Software Development :: Quality Assurance
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: networkx>=2.6
29
+ Requires-Dist: matplotlib>=3.4
30
+ Requires-Dist: pyyaml>=5.4
31
+ Requires-Dist: numpy>=1.20
32
+ Requires-Dist: jinja2>=3.0
33
+ Requires-Dist: radon>=5.1
34
+ Requires-Dist: astroid>=3.0
35
+ Requires-Dist: vulture>=2.10
36
+ Requires-Dist: tiktoken>=0.5
37
+ Requires-Dist: tree-sitter>=0.21
38
+ Requires-Dist: tree-sitter-python>=0.21
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest>=6.2; extra == "dev"
41
+ Requires-Dist: pytest-cov>=2.12; extra == "dev"
42
+ Requires-Dist: black>=21.0; extra == "dev"
43
+ Requires-Dist: flake8>=3.9; extra == "dev"
44
+ Requires-Dist: mypy>=0.910; extra == "dev"
45
+ Dynamic: author
46
+ Dynamic: home-page
47
+ Dynamic: license-file
48
+ Dynamic: requires-python
49
+
50
+ # code2llm - Generated Analysis Files
51
+
52
+ This directory contains the complete analysis of your Python project generated by `code2llm`. Each file serves a specific purpose for understanding, refactoring, and documenting your codebase.
53
+
54
+ ## 📁 Generated Files Overview
55
+
56
+ When you run `code2llm ./ -f all`, the following files are created:
57
+
58
+ ### 🎯 Core Analysis Files
59
+
60
+ | File | Format | Purpose | Key Insights |
61
+ |------|--------|---------|--------------|
62
+ | `analysis.toon` | **TOON** | **🔥 Health diagnostics** - Complexity, god modules, coupling | 45 critical functions, 0 god modules |
63
+ | `evolution.toon` | **TOON** | **📋 Refactoring queue** - Prioritized improvements | 0 refactoring actions needed |
64
+ | `flow.toon` | **TOON** | **🔄 Data flow analysis** - Pipelines, contracts, types | Data dependencies and side effects |
65
+ | `map.toon` | **TOON** | **🗺️ Structural map** - Modules, imports, signatures | Project architecture overview |
66
+
67
+ ### 🤖 LLM-Ready Documentation
68
+
69
+ | File | Format | Purpose | Use Case |
70
+ |------|--------|---------|----------|
71
+ | `context.md` | **Markdown** | **📖 LLM narrative** - Architecture summary | Paste into ChatGPT/Claude for code analysis |
72
+ | `analysis.yaml` | **YAML** | **📊 Structured data** - Machine-readable | For scripts and automated processing |
73
+ | `analysis.json` | **JSON** | **🔧 API format** - Programmatic access | For integration with other tools |
74
+
75
+ ### 📊 Visualizations
76
+
77
+ | File | Format | Purpose | Description |
78
+ |------|--------|---------|-------------|
79
+ | `flow.mmd` | **Mermaid** | **🔄 Control flow diagram** | Function call paths with complexity styling |
80
+ | `calls.mmd` | **Mermaid** | **📞 Call graph** | Function dependencies (edges only) |
81
+ | `compact_flow.mmd` | **Mermaid** | **📦 Module overview** | Aggregated module-level view |
82
+ | `*.png` | **PNG** | **🖼️ Visual diagrams** | Rendered versions of Mermaid files |
83
+
84
+ ## 🚀 Quick Start Commands
85
+
86
+ ### Basic Analysis
87
+ ```bash
88
+ # Quick health check (TOON format only)
89
+ code2llm ./ -f toon
90
+
91
+ # Generate all formats (what created these files)
92
+ code2llm ./ -f all
93
+
94
+ # LLM-ready context only
95
+ code2llm ./ -f context
96
+ ```
97
+
98
+ Przykład z projektu toonic, z użyciem modelu Kimi K2.5 w VScode Windsurf:
99
+ ![img_1.png](img_1.png)
100
+ ```bash
101
+ code2llm ./ -f toon,evolution -o ./project
102
+ ```
103
+
104
+ ### Performance Options
105
+ ```bash
106
+ # Fast analysis for large projects
107
+ code2llm ./ -f toon --strategy quick
108
+
109
+ # Memory-limited analysis
110
+ code2llm ./ -f all --max-memory 500
111
+
112
+ # Skip PNG generation (faster)
113
+ code2llm ./ -f all --no-png
114
+ ```
115
+
116
+ ### Refactoring Focus
117
+ ```bash
118
+ # Get refactoring recommendations
119
+ code2llm ./ -f evolution
120
+
121
+ # Focus on specific code smells
122
+ code2llm ./ -f toon --refactor --smell god_function
123
+
124
+ # Data flow analysis
125
+ code2llm ./ -f flow --data-flow
126
+ ```
127
+
128
+ ## 📖 Understanding Each File
129
+
130
+ ### `analysis.toon` - Health Diagnostics
131
+ **Purpose**: Quick overview of code health issues
132
+ **Key sections**:
133
+ - **HEALTH**: Critical issues (🔴) and warnings (🟡)
134
+ - **REFACTOR**: Prioritized refactoring actions
135
+ - **COUPLING**: Module dependencies and potential cycles
136
+ - **LAYERS**: Package complexity metrics
137
+ - **FUNCTIONS**: High-complexity functions (CC ≥ 10)
138
+ - **CLASSES**: Complex classes needing attention
139
+
140
+ **Example usage**:
141
+ ```bash
142
+ # View health issues
143
+ cat analysis.toon | head -30
144
+
145
+ # Check refactoring priorities
146
+ grep "REFACTOR" analysis.toon
147
+ ```
148
+
149
+ ### `evolution.toon` - Refactoring Queue
150
+ **Purpose**: Step-by-step refactoring plan
151
+ **Key sections**:
152
+ - **NEXT**: Immediate actions to take
153
+ - **RISKS**: Potential breaking changes
154
+ - **METRICS-TARGET**: Success criteria
155
+
156
+ **Example usage**:
157
+ ```bash
158
+ # Get refactoring plan
159
+ cat evolution.toon
160
+
161
+ # Track progress
162
+ grep "NEXT" evolution.toon
163
+ ```
164
+
165
+ ### `flow.toon` - Data Flow Analysis
166
+ **Purpose**: Understand data movement through the system
167
+ **Key sections**:
168
+ - **PIPELINES**: Data processing chains
169
+ - **CONTRACTS**: Function input/output contracts
170
+ - **SIDE_EFFECTS**: Functions with external impacts
171
+
172
+ **Example usage**:
173
+ ```bash
174
+ # Find data pipelines
175
+ grep "PIPELINES" flow.toon
176
+
177
+ # Identify side effects
178
+ grep "SIDE_EFFECTS" flow.toon
179
+ ```
180
+
181
+ ### `map.toon` - Structural Map
182
+ **Purpose**: High-level architecture overview
183
+ **Key sections**:
184
+ - **MODULES**: All modules with basic stats
185
+ - **IMPORTS**: Dependency relationships
186
+ - **SIGNATURES**: Public API functions
187
+
188
+ **Example usage**:
189
+ ```bash
190
+ # See project structure
191
+ cat map.toon | head -50
192
+
193
+ # Find public APIs
194
+ grep "SIGNATURES" map.toon
195
+ ```
196
+
197
+ ### `context.md` - LLM Narrative
198
+ **Purpose**: Ready-to-paste context for AI assistants
199
+ **Key sections**:
200
+ - **Overview**: Project statistics
201
+ - **Architecture**: Module breakdown
202
+ - **Entry Points**: Public interfaces
203
+ - **Patterns**: Design patterns detected
204
+
205
+ **Example usage**:
206
+ ```bash
207
+ # Copy to clipboard for LLM
208
+ cat context.md | pbcopy # macOS
209
+ cat context.md | xclip -sel clip # Linux
210
+
211
+ # Use with Claude/ChatGPT for code analysis
212
+ ```
213
+
214
+ ### Visualization Files (`*.mmd`, `*.png`)
215
+ **Purpose**: Visual understanding of code structure
216
+ **Files**:
217
+ - `flow.mmd` - Detailed control flow with complexity colors
218
+ - `calls.mmd` - Simple call graph
219
+ - `compact_flow.mmd` - High-level module view
220
+ - `*.png` - Pre-rendered images
221
+
222
+ **Example usage**:
223
+ ```bash
224
+ # View diagrams
225
+ open flow.png # macOS
226
+ xdg-open flow.png # Linux
227
+
228
+ # Edit in Mermaid Live Editor
229
+ # Copy content of .mmd files to https://mermaid.live
230
+ ```
231
+
232
+ ## 🔍 Common Analysis Patterns
233
+
234
+ ### 1. Code Health Assessment
235
+ ```bash
236
+ # Quick health check
237
+ code2llm ./ -f toon
238
+ cat analysis.toon | grep -E "(HEALTH|REFACTOR)"
239
+ ```
240
+
241
+ ### 2. Refactoring Planning
242
+ ```bash
243
+ # Get refactoring queue
244
+ code2llm ./ -f evolution
245
+ cat evolution.toon
246
+
247
+ # Focus on specific issues
248
+ code2llm ./ -f toon --refactor --smell god_function
249
+ ```
250
+
251
+ ### 3. LLM Assistance
252
+ ```bash
253
+ # Generate context for AI
254
+ code2llm ./ -f context
255
+ cat context.md
256
+
257
+ # Use with Claude: "Based on this context, help me refactor the god modules"
258
+ ```
259
+
260
+ ### 4. Team Documentation
261
+ ```bash
262
+ # Generate all docs for team
263
+ code2llm ./ -f all -o ./docs/
264
+
265
+ # Create visual diagrams
266
+ open docs/flow.png
267
+ ```
268
+
269
+ ## 📊 Interpreting Metrics
270
+
271
+ ### Complexity Metrics (CC)
272
+ - **🔴 Critical (≥5.0)**: Immediate refactoring needed
273
+ - **🟠 High (3.0-4.9)**: Consider refactoring
274
+ - **🟡 Medium (1.5-2.9)**: Monitor complexity
275
+ - **🟢 Low (0.1-1.4)**: Acceptable
276
+ - **⚪ Basic (0.0)**: Simple functions
277
+
278
+ ### Module Health
279
+ - **GOD Module**: Too large (>500 lines, >20 methods)
280
+ - **HUB**: High fan-out (calls many modules)
281
+ - **FAN-IN**: High incoming dependencies
282
+ - **CYCLES**: Circular dependencies
283
+
284
+ ### Data Flow Indicators
285
+ - **PIPELINE**: Sequential data processing
286
+ - **CONTRACT**: Clear input/output specification
287
+ - **SIDE_EFFECT**: External state modification
288
+
289
+ ## 🛠️ Integration Examples
290
+
291
+ ### CI/CD Pipeline
292
+ ```bash
293
+ #!/bin/bash
294
+ # Analyze code quality in CI
295
+ code2llm ./ -f toon -o ./analysis
296
+ if grep -q "🔴 GOD" ./analysis/analysis.toon; then
297
+ echo "❌ God modules detected"
298
+ exit 1
299
+ fi
300
+ ```
301
+
302
+ ### Pre-commit Hook
303
+ ```bash
304
+ #!/bin/sh
305
+ # .git/hooks/pre-commit
306
+ code2llm ./ -f toon -o ./temp_analysis
307
+ if grep -q "🔴" ./temp_analysis/analysis.toon; then
308
+ echo "⚠️ Critical issues found. Review before committing."
309
+ fi
310
+ rm -rf ./temp_analysis
311
+ ```
312
+
313
+ ### Documentation Generation
314
+ ```bash
315
+ # Generate docs for README
316
+ code2llm ./ -f context -o ./docs/
317
+ echo "## Architecture" >> README.md
318
+ cat docs/context.md >> README.md
319
+ ```
320
+
321
+ ## 📚 Next Steps
322
+
323
+ 1. **Review `analysis.toon`** - Identify critical issues
324
+ 2. **Check `evolution.toon`** - Plan refactoring priorities
325
+ 3. **Use `context.md`** - Get LLM assistance for complex changes
326
+ 4. **Reference visualizations** - Understand system architecture
327
+ 5. **Track progress** - Re-run analysis after changes
328
+
329
+ ## 🔧 Advanced Usage
330
+
331
+ ### Custom Analysis
332
+ ```bash
333
+ # Deep analysis with all insights
334
+ code2llm ./ -m hybrid -f all --max-depth 15 -v
335
+
336
+ # Performance-optimized
337
+ code2llm ./ -m static -f toon --strategy quick
338
+
339
+ # Refactoring-focused
340
+ code2llm ./ -f toon,evolution --refactor
341
+ ```
342
+
343
+ ### Output Customization
344
+ ```bash
345
+ # Separate output directories
346
+ code2llm ./ -f all -o ./analysis-$(date +%Y%m%d)
347
+
348
+ # Split YAML into multiple files
349
+ code2llm ./ -f yaml --split-output
350
+
351
+ # Separate orphaned functions
352
+ code2llm ./ -f yaml --separate-orphans
353
+ ```
354
+
355
+ ---
356
+
357
+ **Generated by**: `code2llm ./ -f all --readme`
358
+ **Analysis Date**: 2026-03-01
359
+ **Total Functions**: 645
360
+ **Total Classes**: 94
361
+ **Modules**: 76
362
+
363
+ For more information about code2llm, visit: https://github.com/tom-sapletta/code2llm
364
+
365
+ ## License
366
+
367
+ Apache License 2.0 - see [LICENSE](LICENSE) for details.
368
+
369
+ ## Author
370
+
371
+ Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
@@ -0,0 +1,322 @@
1
+ # code2llm - Generated Analysis Files
2
+
3
+ This directory contains the complete analysis of your Python project generated by `code2llm`. Each file serves a specific purpose for understanding, refactoring, and documenting your codebase.
4
+
5
+ ## 📁 Generated Files Overview
6
+
7
+ When you run `code2llm ./ -f all`, the following files are created:
8
+
9
+ ### 🎯 Core Analysis Files
10
+
11
+ | File | Format | Purpose | Key Insights |
12
+ |------|--------|---------|--------------|
13
+ | `analysis.toon` | **TOON** | **🔥 Health diagnostics** - Complexity, god modules, coupling | 45 critical functions, 0 god modules |
14
+ | `evolution.toon` | **TOON** | **📋 Refactoring queue** - Prioritized improvements | 0 refactoring actions needed |
15
+ | `flow.toon` | **TOON** | **🔄 Data flow analysis** - Pipelines, contracts, types | Data dependencies and side effects |
16
+ | `map.toon` | **TOON** | **🗺️ Structural map** - Modules, imports, signatures | Project architecture overview |
17
+
18
+ ### 🤖 LLM-Ready Documentation
19
+
20
+ | File | Format | Purpose | Use Case |
21
+ |------|--------|---------|----------|
22
+ | `context.md` | **Markdown** | **📖 LLM narrative** - Architecture summary | Paste into ChatGPT/Claude for code analysis |
23
+ | `analysis.yaml` | **YAML** | **📊 Structured data** - Machine-readable | For scripts and automated processing |
24
+ | `analysis.json` | **JSON** | **🔧 API format** - Programmatic access | For integration with other tools |
25
+
26
+ ### 📊 Visualizations
27
+
28
+ | File | Format | Purpose | Description |
29
+ |------|--------|---------|-------------|
30
+ | `flow.mmd` | **Mermaid** | **🔄 Control flow diagram** | Function call paths with complexity styling |
31
+ | `calls.mmd` | **Mermaid** | **📞 Call graph** | Function dependencies (edges only) |
32
+ | `compact_flow.mmd` | **Mermaid** | **📦 Module overview** | Aggregated module-level view |
33
+ | `*.png` | **PNG** | **🖼️ Visual diagrams** | Rendered versions of Mermaid files |
34
+
35
+ ## 🚀 Quick Start Commands
36
+
37
+ ### Basic Analysis
38
+ ```bash
39
+ # Quick health check (TOON format only)
40
+ code2llm ./ -f toon
41
+
42
+ # Generate all formats (what created these files)
43
+ code2llm ./ -f all
44
+
45
+ # LLM-ready context only
46
+ code2llm ./ -f context
47
+ ```
48
+
49
+ Przykład z projektu toonic, z użyciem modelu Kimi K2.5 w VScode Windsurf:
50
+ ![img_1.png](img_1.png)
51
+ ```bash
52
+ code2llm ./ -f toon,evolution -o ./project
53
+ ```
54
+
55
+ ### Performance Options
56
+ ```bash
57
+ # Fast analysis for large projects
58
+ code2llm ./ -f toon --strategy quick
59
+
60
+ # Memory-limited analysis
61
+ code2llm ./ -f all --max-memory 500
62
+
63
+ # Skip PNG generation (faster)
64
+ code2llm ./ -f all --no-png
65
+ ```
66
+
67
+ ### Refactoring Focus
68
+ ```bash
69
+ # Get refactoring recommendations
70
+ code2llm ./ -f evolution
71
+
72
+ # Focus on specific code smells
73
+ code2llm ./ -f toon --refactor --smell god_function
74
+
75
+ # Data flow analysis
76
+ code2llm ./ -f flow --data-flow
77
+ ```
78
+
79
+ ## 📖 Understanding Each File
80
+
81
+ ### `analysis.toon` - Health Diagnostics
82
+ **Purpose**: Quick overview of code health issues
83
+ **Key sections**:
84
+ - **HEALTH**: Critical issues (🔴) and warnings (🟡)
85
+ - **REFACTOR**: Prioritized refactoring actions
86
+ - **COUPLING**: Module dependencies and potential cycles
87
+ - **LAYERS**: Package complexity metrics
88
+ - **FUNCTIONS**: High-complexity functions (CC ≥ 10)
89
+ - **CLASSES**: Complex classes needing attention
90
+
91
+ **Example usage**:
92
+ ```bash
93
+ # View health issues
94
+ cat analysis.toon | head -30
95
+
96
+ # Check refactoring priorities
97
+ grep "REFACTOR" analysis.toon
98
+ ```
99
+
100
+ ### `evolution.toon` - Refactoring Queue
101
+ **Purpose**: Step-by-step refactoring plan
102
+ **Key sections**:
103
+ - **NEXT**: Immediate actions to take
104
+ - **RISKS**: Potential breaking changes
105
+ - **METRICS-TARGET**: Success criteria
106
+
107
+ **Example usage**:
108
+ ```bash
109
+ # Get refactoring plan
110
+ cat evolution.toon
111
+
112
+ # Track progress
113
+ grep "NEXT" evolution.toon
114
+ ```
115
+
116
+ ### `flow.toon` - Data Flow Analysis
117
+ **Purpose**: Understand data movement through the system
118
+ **Key sections**:
119
+ - **PIPELINES**: Data processing chains
120
+ - **CONTRACTS**: Function input/output contracts
121
+ - **SIDE_EFFECTS**: Functions with external impacts
122
+
123
+ **Example usage**:
124
+ ```bash
125
+ # Find data pipelines
126
+ grep "PIPELINES" flow.toon
127
+
128
+ # Identify side effects
129
+ grep "SIDE_EFFECTS" flow.toon
130
+ ```
131
+
132
+ ### `map.toon` - Structural Map
133
+ **Purpose**: High-level architecture overview
134
+ **Key sections**:
135
+ - **MODULES**: All modules with basic stats
136
+ - **IMPORTS**: Dependency relationships
137
+ - **SIGNATURES**: Public API functions
138
+
139
+ **Example usage**:
140
+ ```bash
141
+ # See project structure
142
+ cat map.toon | head -50
143
+
144
+ # Find public APIs
145
+ grep "SIGNATURES" map.toon
146
+ ```
147
+
148
+ ### `context.md` - LLM Narrative
149
+ **Purpose**: Ready-to-paste context for AI assistants
150
+ **Key sections**:
151
+ - **Overview**: Project statistics
152
+ - **Architecture**: Module breakdown
153
+ - **Entry Points**: Public interfaces
154
+ - **Patterns**: Design patterns detected
155
+
156
+ **Example usage**:
157
+ ```bash
158
+ # Copy to clipboard for LLM
159
+ cat context.md | pbcopy # macOS
160
+ cat context.md | xclip -sel clip # Linux
161
+
162
+ # Use with Claude/ChatGPT for code analysis
163
+ ```
164
+
165
+ ### Visualization Files (`*.mmd`, `*.png`)
166
+ **Purpose**: Visual understanding of code structure
167
+ **Files**:
168
+ - `flow.mmd` - Detailed control flow with complexity colors
169
+ - `calls.mmd` - Simple call graph
170
+ - `compact_flow.mmd` - High-level module view
171
+ - `*.png` - Pre-rendered images
172
+
173
+ **Example usage**:
174
+ ```bash
175
+ # View diagrams
176
+ open flow.png # macOS
177
+ xdg-open flow.png # Linux
178
+
179
+ # Edit in Mermaid Live Editor
180
+ # Copy content of .mmd files to https://mermaid.live
181
+ ```
182
+
183
+ ## 🔍 Common Analysis Patterns
184
+
185
+ ### 1. Code Health Assessment
186
+ ```bash
187
+ # Quick health check
188
+ code2llm ./ -f toon
189
+ cat analysis.toon | grep -E "(HEALTH|REFACTOR)"
190
+ ```
191
+
192
+ ### 2. Refactoring Planning
193
+ ```bash
194
+ # Get refactoring queue
195
+ code2llm ./ -f evolution
196
+ cat evolution.toon
197
+
198
+ # Focus on specific issues
199
+ code2llm ./ -f toon --refactor --smell god_function
200
+ ```
201
+
202
+ ### 3. LLM Assistance
203
+ ```bash
204
+ # Generate context for AI
205
+ code2llm ./ -f context
206
+ cat context.md
207
+
208
+ # Use with Claude: "Based on this context, help me refactor the god modules"
209
+ ```
210
+
211
+ ### 4. Team Documentation
212
+ ```bash
213
+ # Generate all docs for team
214
+ code2llm ./ -f all -o ./docs/
215
+
216
+ # Create visual diagrams
217
+ open docs/flow.png
218
+ ```
219
+
220
+ ## 📊 Interpreting Metrics
221
+
222
+ ### Complexity Metrics (CC)
223
+ - **🔴 Critical (≥5.0)**: Immediate refactoring needed
224
+ - **🟠 High (3.0-4.9)**: Consider refactoring
225
+ - **🟡 Medium (1.5-2.9)**: Monitor complexity
226
+ - **🟢 Low (0.1-1.4)**: Acceptable
227
+ - **⚪ Basic (0.0)**: Simple functions
228
+
229
+ ### Module Health
230
+ - **GOD Module**: Too large (>500 lines, >20 methods)
231
+ - **HUB**: High fan-out (calls many modules)
232
+ - **FAN-IN**: High incoming dependencies
233
+ - **CYCLES**: Circular dependencies
234
+
235
+ ### Data Flow Indicators
236
+ - **PIPELINE**: Sequential data processing
237
+ - **CONTRACT**: Clear input/output specification
238
+ - **SIDE_EFFECT**: External state modification
239
+
240
+ ## 🛠️ Integration Examples
241
+
242
+ ### CI/CD Pipeline
243
+ ```bash
244
+ #!/bin/bash
245
+ # Analyze code quality in CI
246
+ code2llm ./ -f toon -o ./analysis
247
+ if grep -q "🔴 GOD" ./analysis/analysis.toon; then
248
+ echo "❌ God modules detected"
249
+ exit 1
250
+ fi
251
+ ```
252
+
253
+ ### Pre-commit Hook
254
+ ```bash
255
+ #!/bin/sh
256
+ # .git/hooks/pre-commit
257
+ code2llm ./ -f toon -o ./temp_analysis
258
+ if grep -q "🔴" ./temp_analysis/analysis.toon; then
259
+ echo "⚠️ Critical issues found. Review before committing."
260
+ fi
261
+ rm -rf ./temp_analysis
262
+ ```
263
+
264
+ ### Documentation Generation
265
+ ```bash
266
+ # Generate docs for README
267
+ code2llm ./ -f context -o ./docs/
268
+ echo "## Architecture" >> README.md
269
+ cat docs/context.md >> README.md
270
+ ```
271
+
272
+ ## 📚 Next Steps
273
+
274
+ 1. **Review `analysis.toon`** - Identify critical issues
275
+ 2. **Check `evolution.toon`** - Plan refactoring priorities
276
+ 3. **Use `context.md`** - Get LLM assistance for complex changes
277
+ 4. **Reference visualizations** - Understand system architecture
278
+ 5. **Track progress** - Re-run analysis after changes
279
+
280
+ ## 🔧 Advanced Usage
281
+
282
+ ### Custom Analysis
283
+ ```bash
284
+ # Deep analysis with all insights
285
+ code2llm ./ -m hybrid -f all --max-depth 15 -v
286
+
287
+ # Performance-optimized
288
+ code2llm ./ -m static -f toon --strategy quick
289
+
290
+ # Refactoring-focused
291
+ code2llm ./ -f toon,evolution --refactor
292
+ ```
293
+
294
+ ### Output Customization
295
+ ```bash
296
+ # Separate output directories
297
+ code2llm ./ -f all -o ./analysis-$(date +%Y%m%d)
298
+
299
+ # Split YAML into multiple files
300
+ code2llm ./ -f yaml --split-output
301
+
302
+ # Separate orphaned functions
303
+ code2llm ./ -f yaml --separate-orphans
304
+ ```
305
+
306
+ ---
307
+
308
+ **Generated by**: `code2llm ./ -f all --readme`
309
+ **Analysis Date**: 2026-03-01
310
+ **Total Functions**: 645
311
+ **Total Classes**: 94
312
+ **Modules**: 76
313
+
314
+ For more information about code2llm, visit: https://github.com/tom-sapletta/code2llm
315
+
316
+ ## License
317
+
318
+ Apache License 2.0 - see [LICENSE](LICENSE) for details.
319
+
320
+ ## Author
321
+
322
+ Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
@@ -8,7 +8,7 @@ Includes NLP Processing Pipeline for query normalization, intent matching,
8
8
  and entity resolution with multilingual support.
9
9
  """
10
10
 
11
- __version__ = "0.5.2"
11
+ __version__ = "0.5.7"
12
12
  __author__ = "STTS Project"
13
13
 
14
14
  # Core analysis components