code2llm 0.5.4__tar.gz → 0.5.6__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 (89) hide show
  1. code2llm-0.5.6/PKG-INFO +357 -0
  2. code2llm-0.5.6/README.md +308 -0
  3. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/analysis/pipeline_detector.py +40 -4
  4. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/analysis/type_inference.py +36 -27
  5. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/cli.py +31 -18
  6. code2llm-0.5.6/code2llm/core/analyzer.py +232 -0
  7. code2llm-0.5.6/code2llm/core/core/__init__.py +6 -0
  8. code2llm-0.5.6/code2llm/core/core/file_analyzer.py +365 -0
  9. code2llm-0.5.6/code2llm/core/core/file_cache.py +62 -0
  10. code2llm-0.5.6/code2llm/core/core/file_filter.py +44 -0
  11. code2llm-0.5.6/code2llm/core/core/refactoring.py +174 -0
  12. code2llm-0.5.6/code2llm/core/streaming/__init__.py +7 -0
  13. code2llm-0.5.6/code2llm/core/streaming/cache.py +51 -0
  14. code2llm-0.5.6/code2llm/core/streaming/incremental.py +75 -0
  15. code2llm-0.5.6/code2llm/core/streaming/prioritizer.py +131 -0
  16. code2llm-0.5.6/code2llm/core/streaming/scanner.py +201 -0
  17. code2llm-0.5.6/code2llm/core/streaming/strategies.py +68 -0
  18. code2llm-0.5.6/code2llm/core/streaming_analyzer.py +181 -0
  19. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/mermaid_exporter.py +9 -1
  20. code2llm-0.5.6/code2llm/exporters/toon/__init__.py +66 -0
  21. code2llm-0.5.6/code2llm/exporters/toon/helpers.py +115 -0
  22. code2llm-0.5.6/code2llm/exporters/toon/metrics.py +501 -0
  23. code2llm-0.5.6/code2llm/exporters/toon/module_detail.py +162 -0
  24. code2llm-0.5.6/code2llm/exporters/toon/renderer.py +357 -0
  25. code2llm-0.5.6/code2llm/exporters/toon.py +10 -0
  26. code2llm-0.5.6/code2llm.egg-info/PKG-INFO +357 -0
  27. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm.egg-info/SOURCES.txt +16 -0
  28. {code2llm-0.5.4 → code2llm-0.5.6}/pyproject.toml +2 -2
  29. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_advanced_analysis.py +10 -11
  30. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_edge_cases.py +5 -5
  31. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_prompt_engine.py +4 -4
  32. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_refactoring_engine.py +4 -2
  33. code2llm-0.5.4/PKG-INFO +0 -639
  34. code2llm-0.5.4/README.md +0 -590
  35. code2llm-0.5.4/code2llm/core/analyzer.py +0 -765
  36. code2llm-0.5.4/code2llm/core/streaming_analyzer.py +0 -666
  37. code2llm-0.5.4/code2llm/exporters/toon.py +0 -1033
  38. code2llm-0.5.4/code2llm.egg-info/PKG-INFO +0 -639
  39. {code2llm-0.5.4 → code2llm-0.5.6}/LICENSE +0 -0
  40. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/__init__.py +0 -0
  41. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/__main__.py +0 -0
  42. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/analysis/__init__.py +0 -0
  43. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/analysis/call_graph.py +0 -0
  44. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/analysis/cfg.py +0 -0
  45. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/analysis/coupling.py +0 -0
  46. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/analysis/data_analysis.py +0 -0
  47. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/analysis/dfg.py +0 -0
  48. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/analysis/side_effects.py +0 -0
  49. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/analysis/smells.py +0 -0
  50. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/core/__init__.py +0 -0
  51. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/core/config.py +0 -0
  52. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/core/models.py +0 -0
  53. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/__init__.py +0 -0
  54. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/base.py +0 -0
  55. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/context_exporter.py +0 -0
  56. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/evolution_exporter.py +0 -0
  57. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/flow_exporter.py +0 -0
  58. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/json_exporter.py +0 -0
  59. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/llm_exporter.py +0 -0
  60. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/map_exporter.py +0 -0
  61. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/readme_exporter.py +0 -0
  62. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/exporters/yaml_exporter.py +0 -0
  63. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/generators/__init__.py +0 -0
  64. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/generators/llm_flow.py +0 -0
  65. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/generators/llm_task.py +0 -0
  66. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/generators/mermaid.py +0 -0
  67. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/nlp/__init__.py +0 -0
  68. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/nlp/config.py +0 -0
  69. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/nlp/entity_resolution.py +0 -0
  70. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/nlp/intent_matching.py +0 -0
  71. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/nlp/normalization.py +0 -0
  72. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/nlp/pipeline.py +0 -0
  73. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/patterns/__init__.py +0 -0
  74. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/patterns/detector.py +0 -0
  75. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/refactor/__init__.py +0 -0
  76. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm/refactor/prompt_engine.py +0 -0
  77. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm.egg-info/dependency_links.txt +0 -0
  78. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm.egg-info/entry_points.txt +0 -0
  79. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm.egg-info/requires.txt +0 -0
  80. {code2llm-0.5.4 → code2llm-0.5.6}/code2llm.egg-info/top_level.txt +0 -0
  81. {code2llm-0.5.4 → code2llm-0.5.6}/setup.cfg +0 -0
  82. {code2llm-0.5.4 → code2llm-0.5.6}/setup.py +0 -0
  83. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_analyzer.py +0 -0
  84. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_deep_analysis.py +0 -0
  85. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_flow_exporter.py +0 -0
  86. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_format_quality.py +0 -0
  87. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_nlp_pipeline.py +0 -0
  88. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_pipeline_detector.py +0 -0
  89. {code2llm-0.5.4 → code2llm-0.5.6}/tests/test_toon_v2.py +0 -0
@@ -0,0 +1,357 @@
1
+ Metadata-Version: 2.4
2
+ Name: code2llm
3
+ Version: 0.5.6
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
+ ### Performance Options
99
+ ```bash
100
+ # Fast analysis for large projects
101
+ code2llm ./ -f toon --strategy quick
102
+
103
+ # Memory-limited analysis
104
+ code2llm ./ -f all --max-memory 500
105
+
106
+ # Skip PNG generation (faster)
107
+ code2llm ./ -f all --no-png
108
+ ```
109
+
110
+ ### Refactoring Focus
111
+ ```bash
112
+ # Get refactoring recommendations
113
+ code2llm ./ -f evolution
114
+
115
+ # Focus on specific code smells
116
+ code2llm ./ -f toon --refactor --smell god_function
117
+
118
+ # Data flow analysis
119
+ code2llm ./ -f flow --data-flow
120
+ ```
121
+
122
+ ## 📖 Understanding Each File
123
+
124
+ ### `analysis.toon` - Health Diagnostics
125
+ **Purpose**: Quick overview of code health issues
126
+ **Key sections**:
127
+ - **HEALTH**: Critical issues (🔴) and warnings (🟡)
128
+ - **REFACTOR**: Prioritized refactoring actions
129
+ - **COUPLING**: Module dependencies and potential cycles
130
+ - **LAYERS**: Package complexity metrics
131
+ - **FUNCTIONS**: High-complexity functions (CC ≥ 10)
132
+ - **CLASSES**: Complex classes needing attention
133
+
134
+ **Example usage**:
135
+ ```bash
136
+ # View health issues
137
+ cat analysis.toon | head -30
138
+
139
+ # Check refactoring priorities
140
+ grep "REFACTOR" analysis.toon
141
+ ```
142
+
143
+ ### `evolution.toon` - Refactoring Queue
144
+ **Purpose**: Step-by-step refactoring plan
145
+ **Key sections**:
146
+ - **NEXT**: Immediate actions to take
147
+ - **RISKS**: Potential breaking changes
148
+ - **METRICS-TARGET**: Success criteria
149
+
150
+ **Example usage**:
151
+ ```bash
152
+ # Get refactoring plan
153
+ cat evolution.toon
154
+
155
+ # Track progress
156
+ grep "NEXT" evolution.toon
157
+ ```
158
+
159
+ ### `flow.toon` - Data Flow Analysis
160
+ **Purpose**: Understand data movement through the system
161
+ **Key sections**:
162
+ - **PIPELINES**: Data processing chains
163
+ - **CONTRACTS**: Function input/output contracts
164
+ - **SIDE_EFFECTS**: Functions with external impacts
165
+
166
+ **Example usage**:
167
+ ```bash
168
+ # Find data pipelines
169
+ grep "PIPELINES" flow.toon
170
+
171
+ # Identify side effects
172
+ grep "SIDE_EFFECTS" flow.toon
173
+ ```
174
+
175
+ ### `map.toon` - Structural Map
176
+ **Purpose**: High-level architecture overview
177
+ **Key sections**:
178
+ - **MODULES**: All modules with basic stats
179
+ - **IMPORTS**: Dependency relationships
180
+ - **SIGNATURES**: Public API functions
181
+
182
+ **Example usage**:
183
+ ```bash
184
+ # See project structure
185
+ cat map.toon | head -50
186
+
187
+ # Find public APIs
188
+ grep "SIGNATURES" map.toon
189
+ ```
190
+
191
+ ### `context.md` - LLM Narrative
192
+ **Purpose**: Ready-to-paste context for AI assistants
193
+ **Key sections**:
194
+ - **Overview**: Project statistics
195
+ - **Architecture**: Module breakdown
196
+ - **Entry Points**: Public interfaces
197
+ - **Patterns**: Design patterns detected
198
+
199
+ **Example usage**:
200
+ ```bash
201
+ # Copy to clipboard for LLM
202
+ cat context.md | pbcopy # macOS
203
+ cat context.md | xclip -sel clip # Linux
204
+
205
+ # Use with Claude/ChatGPT for code analysis
206
+ ```
207
+
208
+ ### Visualization Files (`*.mmd`, `*.png`)
209
+ **Purpose**: Visual understanding of code structure
210
+ **Files**:
211
+ - `flow.mmd` - Detailed control flow with complexity colors
212
+ - `calls.mmd` - Simple call graph
213
+ - `compact_flow.mmd` - High-level module view
214
+ - `*.png` - Pre-rendered images
215
+
216
+ **Example usage**:
217
+ ```bash
218
+ # View diagrams
219
+ open flow.png # macOS
220
+ xdg-open flow.png # Linux
221
+
222
+ # Edit in Mermaid Live Editor
223
+ # Copy content of .mmd files to https://mermaid.live
224
+ ```
225
+
226
+ ## 🔍 Common Analysis Patterns
227
+
228
+ ### 1. Code Health Assessment
229
+ ```bash
230
+ # Quick health check
231
+ code2llm ./ -f toon
232
+ cat analysis.toon | grep -E "(HEALTH|REFACTOR)"
233
+ ```
234
+
235
+ ### 2. Refactoring Planning
236
+ ```bash
237
+ # Get refactoring queue
238
+ code2llm ./ -f evolution
239
+ cat evolution.toon
240
+
241
+ # Focus on specific issues
242
+ code2llm ./ -f toon --refactor --smell god_function
243
+ ```
244
+
245
+ ### 3. LLM Assistance
246
+ ```bash
247
+ # Generate context for AI
248
+ code2llm ./ -f context
249
+ cat context.md
250
+
251
+ # Use with Claude: "Based on this context, help me refactor the god modules"
252
+ ```
253
+
254
+ ### 4. Team Documentation
255
+ ```bash
256
+ # Generate all docs for team
257
+ code2llm ./ -f all -o ./docs/
258
+
259
+ # Create visual diagrams
260
+ open docs/flow.png
261
+ ```
262
+
263
+ ## 📊 Interpreting Metrics
264
+
265
+ ### Complexity Metrics (CC)
266
+ - **🔴 Critical (≥5.0)**: Immediate refactoring needed
267
+ - **🟠 High (3.0-4.9)**: Consider refactoring
268
+ - **🟡 Medium (1.5-2.9)**: Monitor complexity
269
+ - **🟢 Low (0.1-1.4)**: Acceptable
270
+ - **⚪ Basic (0.0)**: Simple functions
271
+
272
+ ### Module Health
273
+ - **GOD Module**: Too large (>500 lines, >20 methods)
274
+ - **HUB**: High fan-out (calls many modules)
275
+ - **FAN-IN**: High incoming dependencies
276
+ - **CYCLES**: Circular dependencies
277
+
278
+ ### Data Flow Indicators
279
+ - **PIPELINE**: Sequential data processing
280
+ - **CONTRACT**: Clear input/output specification
281
+ - **SIDE_EFFECT**: External state modification
282
+
283
+ ## 🛠️ Integration Examples
284
+
285
+ ### CI/CD Pipeline
286
+ ```bash
287
+ #!/bin/bash
288
+ # Analyze code quality in CI
289
+ code2llm ./ -f toon -o ./analysis
290
+ if grep -q "🔴 GOD" ./analysis/analysis.toon; then
291
+ echo "❌ God modules detected"
292
+ exit 1
293
+ fi
294
+ ```
295
+
296
+ ### Pre-commit Hook
297
+ ```bash
298
+ #!/bin/sh
299
+ # .git/hooks/pre-commit
300
+ code2llm ./ -f toon -o ./temp_analysis
301
+ if grep -q "🔴" ./temp_analysis/analysis.toon; then
302
+ echo "⚠️ Critical issues found. Review before committing."
303
+ fi
304
+ rm -rf ./temp_analysis
305
+ ```
306
+
307
+ ### Documentation Generation
308
+ ```bash
309
+ # Generate docs for README
310
+ code2llm ./ -f context -o ./docs/
311
+ echo "## Architecture" >> README.md
312
+ cat docs/context.md >> README.md
313
+ ```
314
+
315
+ ## 📚 Next Steps
316
+
317
+ 1. **Review `analysis.toon`** - Identify critical issues
318
+ 2. **Check `evolution.toon`** - Plan refactoring priorities
319
+ 3. **Use `context.md`** - Get LLM assistance for complex changes
320
+ 4. **Reference visualizations** - Understand system architecture
321
+ 5. **Track progress** - Re-run analysis after changes
322
+
323
+ ## 🔧 Advanced Usage
324
+
325
+ ### Custom Analysis
326
+ ```bash
327
+ # Deep analysis with all insights
328
+ code2llm ./ -m hybrid -f all --max-depth 15 -v
329
+
330
+ # Performance-optimized
331
+ code2llm ./ -m static -f toon --strategy quick
332
+
333
+ # Refactoring-focused
334
+ code2llm ./ -f toon,evolution --refactor
335
+ ```
336
+
337
+ ### Output Customization
338
+ ```bash
339
+ # Separate output directories
340
+ code2llm ./ -f all -o ./analysis-$(date +%Y%m%d)
341
+
342
+ # Split YAML into multiple files
343
+ code2llm ./ -f yaml --split-output
344
+
345
+ # Separate orphaned functions
346
+ code2llm ./ -f yaml --separate-orphans
347
+ ```
348
+
349
+ ---
350
+
351
+ **Generated by**: `code2llm ./ -f all --readme`
352
+ **Analysis Date**: 2026-03-01
353
+ **Total Functions**: 645
354
+ **Total Classes**: 94
355
+ **Modules**: 76
356
+
357
+ For more information about code2llm, visit: https://github.com/tom-sapletta/code2llm
@@ -0,0 +1,308 @@
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
+ ### Performance Options
50
+ ```bash
51
+ # Fast analysis for large projects
52
+ code2llm ./ -f toon --strategy quick
53
+
54
+ # Memory-limited analysis
55
+ code2llm ./ -f all --max-memory 500
56
+
57
+ # Skip PNG generation (faster)
58
+ code2llm ./ -f all --no-png
59
+ ```
60
+
61
+ ### Refactoring Focus
62
+ ```bash
63
+ # Get refactoring recommendations
64
+ code2llm ./ -f evolution
65
+
66
+ # Focus on specific code smells
67
+ code2llm ./ -f toon --refactor --smell god_function
68
+
69
+ # Data flow analysis
70
+ code2llm ./ -f flow --data-flow
71
+ ```
72
+
73
+ ## 📖 Understanding Each File
74
+
75
+ ### `analysis.toon` - Health Diagnostics
76
+ **Purpose**: Quick overview of code health issues
77
+ **Key sections**:
78
+ - **HEALTH**: Critical issues (🔴) and warnings (🟡)
79
+ - **REFACTOR**: Prioritized refactoring actions
80
+ - **COUPLING**: Module dependencies and potential cycles
81
+ - **LAYERS**: Package complexity metrics
82
+ - **FUNCTIONS**: High-complexity functions (CC ≥ 10)
83
+ - **CLASSES**: Complex classes needing attention
84
+
85
+ **Example usage**:
86
+ ```bash
87
+ # View health issues
88
+ cat analysis.toon | head -30
89
+
90
+ # Check refactoring priorities
91
+ grep "REFACTOR" analysis.toon
92
+ ```
93
+
94
+ ### `evolution.toon` - Refactoring Queue
95
+ **Purpose**: Step-by-step refactoring plan
96
+ **Key sections**:
97
+ - **NEXT**: Immediate actions to take
98
+ - **RISKS**: Potential breaking changes
99
+ - **METRICS-TARGET**: Success criteria
100
+
101
+ **Example usage**:
102
+ ```bash
103
+ # Get refactoring plan
104
+ cat evolution.toon
105
+
106
+ # Track progress
107
+ grep "NEXT" evolution.toon
108
+ ```
109
+
110
+ ### `flow.toon` - Data Flow Analysis
111
+ **Purpose**: Understand data movement through the system
112
+ **Key sections**:
113
+ - **PIPELINES**: Data processing chains
114
+ - **CONTRACTS**: Function input/output contracts
115
+ - **SIDE_EFFECTS**: Functions with external impacts
116
+
117
+ **Example usage**:
118
+ ```bash
119
+ # Find data pipelines
120
+ grep "PIPELINES" flow.toon
121
+
122
+ # Identify side effects
123
+ grep "SIDE_EFFECTS" flow.toon
124
+ ```
125
+
126
+ ### `map.toon` - Structural Map
127
+ **Purpose**: High-level architecture overview
128
+ **Key sections**:
129
+ - **MODULES**: All modules with basic stats
130
+ - **IMPORTS**: Dependency relationships
131
+ - **SIGNATURES**: Public API functions
132
+
133
+ **Example usage**:
134
+ ```bash
135
+ # See project structure
136
+ cat map.toon | head -50
137
+
138
+ # Find public APIs
139
+ grep "SIGNATURES" map.toon
140
+ ```
141
+
142
+ ### `context.md` - LLM Narrative
143
+ **Purpose**: Ready-to-paste context for AI assistants
144
+ **Key sections**:
145
+ - **Overview**: Project statistics
146
+ - **Architecture**: Module breakdown
147
+ - **Entry Points**: Public interfaces
148
+ - **Patterns**: Design patterns detected
149
+
150
+ **Example usage**:
151
+ ```bash
152
+ # Copy to clipboard for LLM
153
+ cat context.md | pbcopy # macOS
154
+ cat context.md | xclip -sel clip # Linux
155
+
156
+ # Use with Claude/ChatGPT for code analysis
157
+ ```
158
+
159
+ ### Visualization Files (`*.mmd`, `*.png`)
160
+ **Purpose**: Visual understanding of code structure
161
+ **Files**:
162
+ - `flow.mmd` - Detailed control flow with complexity colors
163
+ - `calls.mmd` - Simple call graph
164
+ - `compact_flow.mmd` - High-level module view
165
+ - `*.png` - Pre-rendered images
166
+
167
+ **Example usage**:
168
+ ```bash
169
+ # View diagrams
170
+ open flow.png # macOS
171
+ xdg-open flow.png # Linux
172
+
173
+ # Edit in Mermaid Live Editor
174
+ # Copy content of .mmd files to https://mermaid.live
175
+ ```
176
+
177
+ ## 🔍 Common Analysis Patterns
178
+
179
+ ### 1. Code Health Assessment
180
+ ```bash
181
+ # Quick health check
182
+ code2llm ./ -f toon
183
+ cat analysis.toon | grep -E "(HEALTH|REFACTOR)"
184
+ ```
185
+
186
+ ### 2. Refactoring Planning
187
+ ```bash
188
+ # Get refactoring queue
189
+ code2llm ./ -f evolution
190
+ cat evolution.toon
191
+
192
+ # Focus on specific issues
193
+ code2llm ./ -f toon --refactor --smell god_function
194
+ ```
195
+
196
+ ### 3. LLM Assistance
197
+ ```bash
198
+ # Generate context for AI
199
+ code2llm ./ -f context
200
+ cat context.md
201
+
202
+ # Use with Claude: "Based on this context, help me refactor the god modules"
203
+ ```
204
+
205
+ ### 4. Team Documentation
206
+ ```bash
207
+ # Generate all docs for team
208
+ code2llm ./ -f all -o ./docs/
209
+
210
+ # Create visual diagrams
211
+ open docs/flow.png
212
+ ```
213
+
214
+ ## 📊 Interpreting Metrics
215
+
216
+ ### Complexity Metrics (CC)
217
+ - **🔴 Critical (≥5.0)**: Immediate refactoring needed
218
+ - **🟠 High (3.0-4.9)**: Consider refactoring
219
+ - **🟡 Medium (1.5-2.9)**: Monitor complexity
220
+ - **🟢 Low (0.1-1.4)**: Acceptable
221
+ - **⚪ Basic (0.0)**: Simple functions
222
+
223
+ ### Module Health
224
+ - **GOD Module**: Too large (>500 lines, >20 methods)
225
+ - **HUB**: High fan-out (calls many modules)
226
+ - **FAN-IN**: High incoming dependencies
227
+ - **CYCLES**: Circular dependencies
228
+
229
+ ### Data Flow Indicators
230
+ - **PIPELINE**: Sequential data processing
231
+ - **CONTRACT**: Clear input/output specification
232
+ - **SIDE_EFFECT**: External state modification
233
+
234
+ ## 🛠️ Integration Examples
235
+
236
+ ### CI/CD Pipeline
237
+ ```bash
238
+ #!/bin/bash
239
+ # Analyze code quality in CI
240
+ code2llm ./ -f toon -o ./analysis
241
+ if grep -q "🔴 GOD" ./analysis/analysis.toon; then
242
+ echo "❌ God modules detected"
243
+ exit 1
244
+ fi
245
+ ```
246
+
247
+ ### Pre-commit Hook
248
+ ```bash
249
+ #!/bin/sh
250
+ # .git/hooks/pre-commit
251
+ code2llm ./ -f toon -o ./temp_analysis
252
+ if grep -q "🔴" ./temp_analysis/analysis.toon; then
253
+ echo "⚠️ Critical issues found. Review before committing."
254
+ fi
255
+ rm -rf ./temp_analysis
256
+ ```
257
+
258
+ ### Documentation Generation
259
+ ```bash
260
+ # Generate docs for README
261
+ code2llm ./ -f context -o ./docs/
262
+ echo "## Architecture" >> README.md
263
+ cat docs/context.md >> README.md
264
+ ```
265
+
266
+ ## 📚 Next Steps
267
+
268
+ 1. **Review `analysis.toon`** - Identify critical issues
269
+ 2. **Check `evolution.toon`** - Plan refactoring priorities
270
+ 3. **Use `context.md`** - Get LLM assistance for complex changes
271
+ 4. **Reference visualizations** - Understand system architecture
272
+ 5. **Track progress** - Re-run analysis after changes
273
+
274
+ ## 🔧 Advanced Usage
275
+
276
+ ### Custom Analysis
277
+ ```bash
278
+ # Deep analysis with all insights
279
+ code2llm ./ -m hybrid -f all --max-depth 15 -v
280
+
281
+ # Performance-optimized
282
+ code2llm ./ -m static -f toon --strategy quick
283
+
284
+ # Refactoring-focused
285
+ code2llm ./ -f toon,evolution --refactor
286
+ ```
287
+
288
+ ### Output Customization
289
+ ```bash
290
+ # Separate output directories
291
+ code2llm ./ -f all -o ./analysis-$(date +%Y%m%d)
292
+
293
+ # Split YAML into multiple files
294
+ code2llm ./ -f yaml --split-output
295
+
296
+ # Separate orphaned functions
297
+ code2llm ./ -f yaml --separate-orphans
298
+ ```
299
+
300
+ ---
301
+
302
+ **Generated by**: `code2llm ./ -f all --readme`
303
+ **Analysis Date**: 2026-03-01
304
+ **Total Functions**: 645
305
+ **Total Classes**: 94
306
+ **Modules**: 76
307
+
308
+ For more information about code2llm, visit: https://github.com/tom-sapletta/code2llm