code2llm 0.5.80__tar.gz → 0.5.82__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 (120) hide show
  1. {code2llm-0.5.80 → code2llm-0.5.82}/PKG-INFO +18 -18
  2. {code2llm-0.5.80 → code2llm-0.5.82}/README.md +17 -17
  3. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/__init__.py +1 -1
  4. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/cli_analysis.py +1 -1
  5. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/cli_commands.py +5 -5
  6. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/cli_exports/formats.py +3 -3
  7. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/cli_exports/orchestrator.py +29 -8
  8. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/cli_exports/prompt.py +136 -52
  9. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/cli_parser.py +10 -10
  10. code2llm-0.5.82/code2llm/core/lang/base.py +370 -0
  11. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/project_yaml_exporter.py +1 -1
  12. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/readme_exporter.py +6 -6
  13. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/report_generators.py +1 -1
  14. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/toon_view.py +2 -2
  15. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/validate_project.py +7 -7
  16. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/nlp/__init__.py +1 -1
  17. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm.egg-info/PKG-INFO +18 -18
  18. {code2llm-0.5.80 → code2llm-0.5.82}/pyproject.toml +1 -1
  19. {code2llm-0.5.80 → code2llm-0.5.82}/setup.py +2 -2
  20. code2llm-0.5.80/code2llm/core/lang/base.py +0 -312
  21. {code2llm-0.5.80 → code2llm-0.5.82}/LICENSE +0 -0
  22. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/__main__.py +0 -0
  23. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/analysis/__init__.py +0 -0
  24. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/analysis/call_graph.py +0 -0
  25. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/analysis/cfg.py +0 -0
  26. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/analysis/coupling.py +0 -0
  27. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/analysis/data_analysis.py +0 -0
  28. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/analysis/dfg.py +0 -0
  29. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/analysis/pipeline_detector.py +0 -0
  30. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/analysis/side_effects.py +0 -0
  31. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/analysis/smells.py +0 -0
  32. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/analysis/type_inference.py +0 -0
  33. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/api.py +0 -0
  34. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/cli.py +0 -0
  35. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/cli_exports/__init__.py +0 -0
  36. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/cli_exports/code2logic.py +0 -0
  37. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/__init__.py +0 -0
  38. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/analyzer.py +0 -0
  39. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/config.py +0 -0
  40. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/file_analyzer.py +0 -0
  41. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/file_cache.py +0 -0
  42. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/file_filter.py +0 -0
  43. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/gitignore.py +0 -0
  44. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/lang/__init__.py +0 -0
  45. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/lang/cpp.py +0 -0
  46. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/lang/csharp.py +0 -0
  47. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/lang/generic.py +0 -0
  48. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/lang/go_lang.py +0 -0
  49. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/lang/java.py +0 -0
  50. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/lang/php.py +0 -0
  51. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/lang/ruby.py +0 -0
  52. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/lang/rust.py +0 -0
  53. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/lang/typescript.py +0 -0
  54. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/large_repo.py +0 -0
  55. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/models.py +0 -0
  56. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/refactoring.py +0 -0
  57. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/repo_files.py +0 -0
  58. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/streaming/__init__.py +0 -0
  59. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/streaming/cache.py +0 -0
  60. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/streaming/incremental.py +0 -0
  61. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/streaming/prioritizer.py +0 -0
  62. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/streaming/scanner.py +0 -0
  63. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/streaming/strategies.py +0 -0
  64. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/streaming_analyzer.py +0 -0
  65. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/core/toon_size_manager.py +0 -0
  66. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/__init__.py +0 -0
  67. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/article_view.py +0 -0
  68. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/base.py +0 -0
  69. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/context_exporter.py +0 -0
  70. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/context_view.py +0 -0
  71. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/evolution_exporter.py +0 -0
  72. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/flow_constants.py +0 -0
  73. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/flow_exporter.py +0 -0
  74. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/flow_renderer.py +0 -0
  75. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/html_dashboard.py +0 -0
  76. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/index_generator.py +0 -0
  77. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/json_exporter.py +0 -0
  78. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/llm_exporter.py +0 -0
  79. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/map_exporter.py +0 -0
  80. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/mermaid_exporter.py +0 -0
  81. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/toon/__init__.py +0 -0
  82. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/toon/helpers.py +0 -0
  83. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/toon/metrics.py +0 -0
  84. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/toon/module_detail.py +0 -0
  85. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/toon/renderer.py +0 -0
  86. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/toon.py +0 -0
  87. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/exporters/yaml_exporter.py +0 -0
  88. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/generators/__init__.py +0 -0
  89. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/generators/llm_flow.py +0 -0
  90. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/generators/llm_task.py +0 -0
  91. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/generators/mermaid.py +0 -0
  92. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/nlp/config.py +0 -0
  93. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/nlp/entity_resolution.py +0 -0
  94. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/nlp/intent_matching.py +0 -0
  95. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/nlp/normalization.py +0 -0
  96. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/nlp/pipeline.py +0 -0
  97. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/patterns/__init__.py +0 -0
  98. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/patterns/detector.py +0 -0
  99. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/refactor/__init__.py +0 -0
  100. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm/refactor/prompt_engine.py +0 -0
  101. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm.egg-info/SOURCES.txt +0 -0
  102. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm.egg-info/dependency_links.txt +0 -0
  103. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm.egg-info/entry_points.txt +0 -0
  104. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm.egg-info/requires.txt +0 -0
  105. {code2llm-0.5.80 → code2llm-0.5.82}/code2llm.egg-info/top_level.txt +0 -0
  106. {code2llm-0.5.80 → code2llm-0.5.82}/setup.cfg +0 -0
  107. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_advanced_analysis.py +0 -0
  108. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_analyzer.py +0 -0
  109. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_deep_analysis.py +0 -0
  110. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_edge_cases.py +0 -0
  111. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_flow_exporter.py +0 -0
  112. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_format_quality.py +0 -0
  113. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_multilanguage_e2e.py +0 -0
  114. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_nlp_pipeline.py +0 -0
  115. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_nonpython_cc_calls.py +0 -0
  116. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_pipeline_detector.py +0 -0
  117. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_prompt_engine.py +0 -0
  118. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_prompt_txt.py +0 -0
  119. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_refactoring_engine.py +0 -0
  120. {code2llm-0.5.80 → code2llm-0.5.82}/tests/test_toon_v2.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code2llm
3
- Version: 0.5.80
3
+ Version: 0.5.82
4
4
  Summary: High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries
5
5
  Home-page: https://github.com/wronai/stts
6
6
  Author: STTS Project
@@ -128,7 +128,7 @@ cat analysis.toon | head -30
128
128
  grep "REFACTOR" analysis.toon
129
129
  ```
130
130
 
131
- ### `evolution.toon` - Refactoring Queue
131
+ ### `evolution.toon.yaml` - Refactoring Queue
132
132
  **Purpose**: Step-by-step refactoring plan
133
133
  **Key sections**:
134
134
  - **NEXT**: Immediate actions to take
@@ -138,10 +138,10 @@ grep "REFACTOR" analysis.toon
138
138
  **Example usage**:
139
139
  ```bash
140
140
  # Get refactoring plan
141
- cat evolution.toon
141
+ cat evolution.toon.yaml
142
142
 
143
143
  # Track progress
144
- grep "NEXT" evolution.toon
144
+ grep "NEXT" evolution.toon.yaml
145
145
  ```
146
146
 
147
147
  ### `flow.toon` - Legacy Data Flow Analysis
@@ -160,34 +160,34 @@ grep "PIPELINES" flow.toon
160
160
  grep "SIDE_EFFECTS" flow.toon
161
161
  ```
162
162
 
163
- ### `map.toon` - Structural Map + Project Header
163
+ ### `map.toon.yaml` - Structural Map + Project Header
164
164
  **Purpose**: High-level architecture overview plus compact project header
165
165
  **Key sections**:
166
166
  - **MODULES**: All modules with basic stats
167
167
  - **IMPORTS**: Dependency relationships
168
- - **e:** Public API exports and signatures
168
+ - **EXPORTS**: Public API surface and signatures
169
169
  - **HEADER**: Stats, alerts, hotspots, evolution trend
170
170
 
171
171
  **Example usage**:
172
172
  ```bash
173
173
  # See project structure
174
- cat map.toon | head -50
174
+ cat map.toon.yaml | head -50
175
175
 
176
176
  # Find public APIs
177
- grep "^ e:" map.toon
177
+ grep "SIGNATURES" map.toon.yaml
178
178
  ```
179
179
 
180
- ### `project.toon` - Legacy Project Logic (Deprecated)
181
- **Purpose**: Compact module view generated by code2logic integration
182
- **Status**: Deprecated the lightweight project overview is now merged into `map.toon` header
180
+ ### `analysis_view.toon` - Compact Analysis View
181
+ **Purpose**: Compact module view generated from project.yaml data
182
+ **Status**: Legacy view generated on demand from unified project.yaml
183
183
 
184
184
  **Example usage**:
185
185
  ```bash
186
186
  # View compact project structure
187
- cat project.toon | head -30
187
+ cat analysis_view.toon | head -30
188
188
 
189
189
  # Find largest files
190
- grep -E "^ .*[0-9]{3,}$" project.toon | sort -t',' -k2 -n -r | head -10
190
+ grep -E "^ .*[0-9]{3,}$" analysis_view.toon | sort -t',' -k2 -n -r | head -10
191
191
  ```
192
192
 
193
193
  ### `prompt.txt` - Ready-to-Send LLM Prompt
@@ -256,7 +256,7 @@ cat analysis.toon | grep -E "(HEALTH|REFACTOR)"
256
256
  ```bash
257
257
  # Get refactoring queue
258
258
  code2llm ./ -f evolution
259
- cat evolution.toon
259
+ cat evolution.toon.yaml
260
260
 
261
261
  # Focus on specific issues
262
262
  code2llm ./ -f toon --refactor --smell god_function
@@ -335,7 +335,7 @@ cat docs/context.md >> README.md
335
335
  ## 📚 Next Steps
336
336
 
337
337
  1. **Review `analysis.toon`** - Identify critical issues
338
- 2. **Check `evolution.toon`** - Plan refactoring priorities
338
+ 2. **Check `evolution.toon.yaml`** - Plan refactoring priorities
339
339
  3. **Use `context.md`** - Get LLM assistance for complex changes
340
340
  4. **Reference visualizations** - Understand system architecture
341
341
  5. **Track progress** - Re-run analysis after changes
@@ -369,10 +369,10 @@ code2llm ./ -f yaml --separate-orphans
369
369
  ---
370
370
 
371
371
  **Generated by**: `code2llm ./ -f all --readme`
372
- **Analysis Date**: 2026-03-25
373
- **Total Functions**: 891
372
+ **Analysis Date**: 2026-03-26
373
+ **Total Functions**: 931
374
374
  **Total Classes**: 106
375
- **Modules**: 121
375
+ **Modules**: 122
376
376
 
377
377
  For more information about code2llm, visit: https://github.com/tom-sapletta/code2llm
378
378
 
@@ -78,7 +78,7 @@ cat analysis.toon | head -30
78
78
  grep "REFACTOR" analysis.toon
79
79
  ```
80
80
 
81
- ### `evolution.toon` - Refactoring Queue
81
+ ### `evolution.toon.yaml` - Refactoring Queue
82
82
  **Purpose**: Step-by-step refactoring plan
83
83
  **Key sections**:
84
84
  - **NEXT**: Immediate actions to take
@@ -88,10 +88,10 @@ grep "REFACTOR" analysis.toon
88
88
  **Example usage**:
89
89
  ```bash
90
90
  # Get refactoring plan
91
- cat evolution.toon
91
+ cat evolution.toon.yaml
92
92
 
93
93
  # Track progress
94
- grep "NEXT" evolution.toon
94
+ grep "NEXT" evolution.toon.yaml
95
95
  ```
96
96
 
97
97
  ### `flow.toon` - Legacy Data Flow Analysis
@@ -110,34 +110,34 @@ grep "PIPELINES" flow.toon
110
110
  grep "SIDE_EFFECTS" flow.toon
111
111
  ```
112
112
 
113
- ### `map.toon` - Structural Map + Project Header
113
+ ### `map.toon.yaml` - Structural Map + Project Header
114
114
  **Purpose**: High-level architecture overview plus compact project header
115
115
  **Key sections**:
116
116
  - **MODULES**: All modules with basic stats
117
117
  - **IMPORTS**: Dependency relationships
118
- - **e:** Public API exports and signatures
118
+ - **EXPORTS**: Public API surface and signatures
119
119
  - **HEADER**: Stats, alerts, hotspots, evolution trend
120
120
 
121
121
  **Example usage**:
122
122
  ```bash
123
123
  # See project structure
124
- cat map.toon | head -50
124
+ cat map.toon.yaml | head -50
125
125
 
126
126
  # Find public APIs
127
- grep "^ e:" map.toon
127
+ grep "SIGNATURES" map.toon.yaml
128
128
  ```
129
129
 
130
- ### `project.toon` - Legacy Project Logic (Deprecated)
131
- **Purpose**: Compact module view generated by code2logic integration
132
- **Status**: Deprecated the lightweight project overview is now merged into `map.toon` header
130
+ ### `analysis_view.toon` - Compact Analysis View
131
+ **Purpose**: Compact module view generated from project.yaml data
132
+ **Status**: Legacy view generated on demand from unified project.yaml
133
133
 
134
134
  **Example usage**:
135
135
  ```bash
136
136
  # View compact project structure
137
- cat project.toon | head -30
137
+ cat analysis_view.toon | head -30
138
138
 
139
139
  # Find largest files
140
- grep -E "^ .*[0-9]{3,}$" project.toon | sort -t',' -k2 -n -r | head -10
140
+ grep -E "^ .*[0-9]{3,}$" analysis_view.toon | sort -t',' -k2 -n -r | head -10
141
141
  ```
142
142
 
143
143
  ### `prompt.txt` - Ready-to-Send LLM Prompt
@@ -206,7 +206,7 @@ cat analysis.toon | grep -E "(HEALTH|REFACTOR)"
206
206
  ```bash
207
207
  # Get refactoring queue
208
208
  code2llm ./ -f evolution
209
- cat evolution.toon
209
+ cat evolution.toon.yaml
210
210
 
211
211
  # Focus on specific issues
212
212
  code2llm ./ -f toon --refactor --smell god_function
@@ -285,7 +285,7 @@ cat docs/context.md >> README.md
285
285
  ## 📚 Next Steps
286
286
 
287
287
  1. **Review `analysis.toon`** - Identify critical issues
288
- 2. **Check `evolution.toon`** - Plan refactoring priorities
288
+ 2. **Check `evolution.toon.yaml`** - Plan refactoring priorities
289
289
  3. **Use `context.md`** - Get LLM assistance for complex changes
290
290
  4. **Reference visualizations** - Understand system architecture
291
291
  5. **Track progress** - Re-run analysis after changes
@@ -319,10 +319,10 @@ code2llm ./ -f yaml --separate-orphans
319
319
  ---
320
320
 
321
321
  **Generated by**: `code2llm ./ -f all --readme`
322
- **Analysis Date**: 2026-03-25
323
- **Total Functions**: 891
322
+ **Analysis Date**: 2026-03-26
323
+ **Total Functions**: 931
324
324
  **Total Classes**: 106
325
- **Modules**: 121
325
+ **Modules**: 122
326
326
 
327
327
  For more information about code2llm, visit: https://github.com/tom-sapletta/code2llm
328
328
 
@@ -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.80"
11
+ __version__ = "0.5.82"
12
12
  __author__ = "STTS Project"
13
13
 
14
14
  # Core analysis components (lightweight, always needed)
@@ -223,7 +223,7 @@ def _analyze_subproject(args, subproject, output_dir: Path):
223
223
 
224
224
  formats = [f.strip() for f in args.format.split(',')]
225
225
  if 'all' in formats:
226
- formats = ['toon', 'context', 'evolution', 'code2logic']
226
+ formats = ['toon', 'context', 'evolution']
227
227
 
228
228
  _export_simple_formats(args, result, output_dir, formats)
229
229
 
@@ -21,10 +21,10 @@ def handle_special_commands() -> Optional[int]:
21
21
 
22
22
 
23
23
  def handle_report_command(args_list) -> int:
24
- """Generate views from an existing project.yaml.
24
+ """Generate views from an existing project.yaml (legacy).
25
25
 
26
26
  Usage:
27
- code2llm report --format toon # → project.toon (legacy)
27
+ code2llm report --format toon # → project.toon.yaml (legacy)
28
28
  code2llm report --format context # → context.md
29
29
  code2llm report --format article # → status.md
30
30
  code2llm report --format html # → dashboard.html
@@ -34,12 +34,12 @@ def handle_report_command(args_list) -> int:
34
34
 
35
35
  parser = argparse.ArgumentParser(
36
36
  prog='code2llm report',
37
- description='Generate views from project.yaml (single source of truth)',
37
+ description='Generate views from an existing project.yaml (legacy, single source of truth)',
38
38
  )
39
39
  parser.add_argument(
40
40
  '--input', '-i',
41
41
  default='./project.yaml',
42
- help='Path to project.yaml (default: ./project.yaml)',
42
+ help='Path to legacy project.yaml (default: ./project.yaml)',
43
43
  )
44
44
  parser.add_argument(
45
45
  '--format', '-f',
@@ -63,7 +63,7 @@ def handle_report_command(args_list) -> int:
63
63
  input_path = Path(args.input)
64
64
  if not input_path.exists():
65
65
  print(f"Error: project.yaml not found: {input_path}", file=sys.stderr)
66
- print("Run 'code2llm <source> -f project-yaml' first to generate it.", file=sys.stderr)
66
+ print("If you still need it, use the legacy 'code2llm <source> -f project-yaml' export.", file=sys.stderr)
67
67
  return 1
68
68
 
69
69
  output_dir = Path(args.output)
@@ -80,7 +80,7 @@ def _run_report(args, project_yaml_path: str, output_dir: Path) -> None:
80
80
  report_formats = ['toon', 'context', 'article', 'html']
81
81
 
82
82
  generator_map = {
83
- 'toon': ('project.toon', ToonViewGenerator(), 'TOON view'),
83
+ 'toon': ('project.toon.yaml', ToonViewGenerator(), 'TOON view'),
84
84
  'context': ('context.md', ContextViewGenerator(), 'Context view'),
85
85
  'article': ('status.md', ArticleViewGenerator(), 'Article view'),
86
86
  'html': ('dashboard.html', HTMLDashboardGenerator(), 'HTML dashboard'),
@@ -116,12 +116,12 @@ def _export_simple_formats(args, result, output_dir: Path, formats):
116
116
  print(f" - {label}: {filepath}")
117
117
 
118
118
  # Unified project.yaml (single source of truth)
119
- if 'project-yaml' in formats or 'all' in formats:
119
+ if 'project-yaml' in formats:
120
120
  yaml_path = _export_project_yaml(args, result, output_dir)
121
121
  # Auto-generate all views from project.yaml
122
122
  data = load_project_yaml(str(yaml_path))
123
123
  view_map = {
124
- 'project.toon': ToonViewGenerator(),
124
+ 'project.toon.yaml': ToonViewGenerator(),
125
125
  'context.md': ContextViewGenerator(),
126
126
  'dashboard.html': HTMLDashboardGenerator(),
127
127
  }
@@ -23,24 +23,35 @@ def _run_exports(args, result, output_dir: Path, source_path: Optional[Path] = N
23
23
 
24
24
  For chunked analysis, exports to subproject subdirectories.
25
25
  """
26
- formats = [f.strip() for f in args.format.split(',')]
26
+ requested_formats = [f.strip() for f in args.format.split(',')]
27
+ formats = requested_formats[:]
27
28
  if 'all' in formats:
28
- formats = ['toon', 'map', 'context', 'yaml', 'json', 'mermaid', 'evolution']
29
+ formats = ['toon', 'map', 'context', 'mermaid', 'evolution']
29
30
 
30
31
  is_chunked = args.chunk if hasattr(args, 'chunk') else False
31
32
 
32
33
  try:
33
34
  if is_chunked and source_path:
34
- _export_chunked_results(args, result, output_dir, source_path, formats)
35
+ _export_chunked_results(args, result, output_dir, source_path, formats, requested_formats)
35
36
  else:
36
- _export_single_project(args, result, output_dir, formats, source_path)
37
+ _export_single_project(args, result, output_dir, formats, requested_formats, source_path)
37
38
  except Exception as e:
38
39
  print(f"Error during export: {e}", file=sys.stderr)
39
40
  sys.exit(1)
40
41
 
41
42
 
42
- def _export_single_project(args, result, output_dir: Path, formats: list, source_path: Optional[Path] = None):
43
+ def _export_single_project(
44
+ args,
45
+ result,
46
+ output_dir: Path,
47
+ formats: list,
48
+ requested_formats: Optional[list] = None,
49
+ source_path: Optional[Path] = None,
50
+ ):
43
51
  """Export single project results."""
52
+ if requested_formats is None:
53
+ requested_formats = formats
54
+
44
55
  _export_simple_formats(args, result, output_dir, formats)
45
56
 
46
57
  if 'mermaid' in formats:
@@ -52,7 +63,7 @@ def _export_single_project(args, result, output_dir: Path, formats: list, source
52
63
 
53
64
  if source_path is not None:
54
65
  _export_code2logic(args, source_path, output_dir, formats)
55
- _export_prompt_txt(args, output_dir, formats, source_path)
66
+ _export_prompt_txt(args, output_dir, requested_formats, source_path)
56
67
 
57
68
  if hasattr(args, 'refactor') and args.refactor:
58
69
  _export_refactor_prompts(args, result, output_dir)
@@ -63,8 +74,18 @@ def _export_single_project(args, result, output_dir: Path, formats: list, source
63
74
  _export_index_html(args, output_dir)
64
75
 
65
76
 
66
- def _export_chunked_results(args, result, output_dir: Path, source_path: Path, formats: list):
77
+ def _export_chunked_results(
78
+ args,
79
+ result,
80
+ output_dir: Path,
81
+ source_path: Path,
82
+ formats: list,
83
+ requested_formats: Optional[list] = None,
84
+ ):
67
85
  """Export chunked analysis results to subproject directories."""
86
+ if requested_formats is None:
87
+ requested_formats = formats
88
+
68
89
  subprojects = _get_filtered_subprojects(args, source_path)
69
90
 
70
91
  for sp in subprojects:
@@ -76,7 +97,7 @@ def _export_chunked_results(args, result, output_dir: Path, source_path: Path, f
76
97
 
77
98
  if source_path is not None:
78
99
  _export_code2logic(args, source_path, output_dir, formats)
79
- _export_chunked_prompt_txt(args, output_dir, formats, source_path, subprojects)
100
+ _export_chunked_prompt_txt(args, output_dir, requested_formats, source_path, subprojects)
80
101
 
81
102
  _export_readme(args, result, output_dir)
82
103
 
@@ -13,6 +13,7 @@ def _export_prompt_txt(args, output_dir: Path, formats: list[str], source_path:
13
13
  project_path, output_rel_path = _get_prompt_paths(source_path, output_dir)
14
14
  lines = _build_prompt_header(project_path)
15
15
  lines.extend(_build_main_files_section(output_dir, output_rel_path))
16
+ lines.extend(_build_optional_files_section(output_dir, output_rel_path))
16
17
 
17
18
  missing = _get_missing_files(output_dir)
18
19
  if missing:
@@ -39,6 +40,7 @@ def _export_chunked_prompt_txt(args, output_dir: Path, formats: list[str], sourc
39
40
  project_path, output_rel_path = _get_prompt_paths(source_path, output_dir)
40
41
  lines = _build_prompt_header(project_path)
41
42
  lines.extend(_build_main_files_section(output_dir, output_rel_path))
43
+ lines.extend(_build_optional_files_section(output_dir, output_rel_path))
42
44
 
43
45
  if subprojects:
44
46
  lines.extend(_build_subprojects_section(subprojects, output_dir, output_rel_path))
@@ -77,11 +79,18 @@ def _get_prompt_paths(source_path: Optional[Path], output_dir: Path) -> Tuple[st
77
79
 
78
80
 
79
81
  _MAIN_FILES = [
80
- ('analysis.toon', 'Health diagnostics - complexity metrics, god modules, coupling issues, refactoring priorities'),
81
- ('map.toon.yaml', 'Structural map - files, sizes, imports, exports, signatures, project header'),
82
- ('context.md', 'LLM narrative - architecture summary, key entry points, process flows, public API surface'),
83
- ('evolution.toon.yaml', 'Refactoring queue - ranked actions by impact/effort, risks, metrics targets, history'),
84
- ('README.md', 'Documentation - complete guide to all generated files, usage examples, interpretation'),
82
+ ('analysis.toon', 'Health diagnostics - complexity metrics, god modules, coupling issues, refactoring priorities', ('analysis.toon', 'analysis.toon.yaml')),
83
+ ('map.toon.yaml', 'Structural map - files, sizes, imports, exports, signatures, project header', ('map.toon.yaml',)),
84
+ ('evolution.toon.yaml', 'Refactoring queue - ranked actions by impact/effort, risks, metrics targets, history', ('evolution.toon.yaml',)),
85
+ ('context.md', 'LLM narrative - architecture summary and project context', ('context.md',)),
86
+ ('README.md', 'Generated documentation - overview and usage guide', ('README.md',)),
87
+ ]
88
+
89
+
90
+ _OPTIONAL_FILES = [
91
+ ('project.toon', 'Project logic - compact module view from code2logic', ('project.toon', 'project/project.toon', 'project.toon.txt')),
92
+ ('project/validation.toon.yaml', 'Validation analysis - generated by vallm tool', ('project/validation.toon.yaml',)),
93
+ ('project/duplication.toon.yaml', 'Code duplication analysis - generated by redup tool', ('project/duplication.toon.yaml',)),
85
94
  ]
86
95
 
87
96
 
@@ -94,21 +103,48 @@ def _build_prompt_header(project_path: str) -> List[str]:
94
103
  f"we are in project path: {project_path}",
95
104
  "",
96
105
  "Files for analysis:",
106
+ "",
107
+ "Note: project/validation.toon.yaml and project/duplication.toon.yaml are generated by external tools (vallm and redup)",
97
108
  ]
98
109
 
99
110
 
100
- def _build_main_files_section(output_dir: Path, output_rel_path: str) -> List[str]:
101
- """Build main files section with size metrics."""
111
+ def _find_existing_prompt_file(output_dir: Path, candidates: tuple[str, ...]) -> Optional[str]:
112
+ """Return the first candidate path that exists, relative to output_dir."""
113
+ for candidate in candidates:
114
+ if (output_dir / candidate).exists():
115
+ return candidate
116
+ return None
117
+
118
+
119
+ def _build_prompt_file_lines(output_dir: Path, output_rel_path: str, files: list) -> List[str]:
120
+ """Build file lines for either the required or optional prompt file sections."""
102
121
  lines = []
103
- for name, desc in _MAIN_FILES:
104
- file_path = output_dir / name
105
- if file_path.exists():
106
- size_bytes = file_path.stat().st_size
107
- size_str = _format_size(size_bytes)
108
- lines.append(f"- {output_rel_path}/{name} ({desc}) [{size_str}]")
122
+ for _display_name, desc, candidates in files:
123
+ existing = _find_existing_prompt_file(output_dir, candidates)
124
+ if not existing:
125
+ continue
126
+
127
+ file_path = output_dir / existing
128
+ size_str = _format_size(file_path.stat().st_size)
129
+ lines.append(f"- {output_rel_path}/{existing} ({desc}) [{size_str}]")
130
+
109
131
  return lines
110
132
 
111
133
 
134
+ def _build_main_files_section(output_dir: Path, output_rel_path: str) -> List[str]:
135
+ """Build main files section with size metrics."""
136
+ return _build_prompt_file_lines(output_dir, output_rel_path, _MAIN_FILES)
137
+
138
+
139
+ def _build_optional_files_section(output_dir: Path, output_rel_path: str) -> List[str]:
140
+ """Build optional files section with size metrics."""
141
+ lines = _build_prompt_file_lines(output_dir, output_rel_path, _OPTIONAL_FILES)
142
+ if not lines:
143
+ return []
144
+
145
+ return ["", "Optional files:", ""] + lines
146
+
147
+
112
148
  def _format_size(size_bytes: int) -> str:
113
149
  """Format file size in human readable format."""
114
150
  if size_bytes < 1024:
@@ -121,7 +157,11 @@ def _format_size(size_bytes: int) -> str:
121
157
 
122
158
  def _get_missing_files(output_dir: Path) -> List[str]:
123
159
  """Return names of expected main files that are missing."""
124
- return [name for name, _ in _MAIN_FILES if not (output_dir / name).exists()]
160
+ missing = []
161
+ for display_name, _, candidates in _MAIN_FILES:
162
+ if _find_existing_prompt_file(output_dir, candidates) is None:
163
+ missing.append(display_name)
164
+ return missing
125
165
 
126
166
 
127
167
  def _build_subprojects_section(subprojects: list, output_dir: Path, output_rel_path: str) -> List[str]:
@@ -161,28 +201,57 @@ def _build_missing_files_section(output_dir: Path, output_rel_path: str) -> List
161
201
  return []
162
202
  lines = ["", "Missing files (not generated in this run):"]
163
203
  for name in missing:
164
- lines.append(f"- {output_rel_path}/{name}")
204
+ # Special handling for validation and duplication files
205
+ if name in ['validation.toon.yaml', 'duplication.toon.yaml']:
206
+ lines.append(f"- {output_rel_path}/project/{name}")
207
+ else:
208
+ lines.append(f"- {output_rel_path}/{name}")
165
209
  return lines
166
210
 
167
211
 
168
212
  def _analyze_generated_files(output_dir: Path, subprojects: list = None) -> dict:
169
213
  """Analyze which files were generated and determine appropriate focus areas."""
214
+ analysis_file = _find_existing_prompt_file(output_dir, ('analysis.toon', 'analysis.toon.yaml'))
215
+ map_file = _find_existing_prompt_file(output_dir, ('map.toon.yaml',))
216
+ evolution_file = _find_existing_prompt_file(output_dir, ('evolution.toon.yaml',))
217
+ context_file = _find_existing_prompt_file(output_dir, ('context.md',))
218
+ readme_file = _find_existing_prompt_file(output_dir, ('README.md',))
219
+ project_logic_file = _find_existing_prompt_file(output_dir, ('project.toon', 'project/project.toon', 'project.toon.txt'))
220
+ validation_file = _find_existing_prompt_file(output_dir, ('project/validation.toon.yaml',))
221
+ duplication_file = _find_existing_prompt_file(output_dir, ('project/duplication.toon.yaml',))
222
+
170
223
  analysis = {
171
- 'has_analysis_toon': (output_dir / 'analysis.toon').exists(),
172
- 'has_map_toon': (output_dir / 'map.toon.yaml').exists(),
173
- 'has_context_md': (output_dir / 'context.md').exists(),
174
- 'has_evolution_toon': (output_dir / 'evolution.toon.yaml').exists(),
175
- 'has_readme': (output_dir / 'README.md').exists(),
176
- 'has_yaml': (output_dir / 'analysis.yaml').exists(),
177
- 'has_json': (output_dir / 'analysis.json').exists(),
178
- 'has_mermaid': (output_dir / 'flow.mmd').exists() or (output_dir / 'calls.mmd').exists(),
224
+ 'has_analysis_toon': analysis_file is not None,
225
+ 'analysis_file': analysis_file or 'analysis.toon',
226
+ 'has_map_toon': map_file is not None,
227
+ 'map_file': map_file or 'map.toon.yaml',
228
+ 'has_evolution_toon': evolution_file is not None,
229
+ 'evolution_file': evolution_file or 'evolution.toon.yaml',
230
+ 'has_context_md': context_file is not None,
231
+ 'context_file': context_file or 'context.md',
232
+ 'has_readme_md': readme_file is not None,
233
+ 'readme_file': readme_file or 'README.md',
234
+ 'has_project_logic': project_logic_file is not None,
235
+ 'project_logic_file': project_logic_file or 'project.toon',
236
+ 'has_validation_toon': validation_file is not None,
237
+ 'validation_file': validation_file or 'project/validation.toon.yaml',
238
+ 'has_duplication_toon': duplication_file is not None,
239
+ 'duplication_file': duplication_file or 'project/duplication.toon.yaml',
179
240
  'is_chunked': subprojects is not None and len(subprojects) > 0,
180
241
  'file_count': 0,
181
242
  }
182
243
 
183
244
  # Count total files
245
+ actionable_keys = {
246
+ 'has_analysis_toon',
247
+ 'has_map_toon',
248
+ 'has_evolution_toon',
249
+ 'has_project_logic',
250
+ 'has_validation_toon',
251
+ 'has_duplication_toon',
252
+ }
184
253
  for key, exists in analysis.items():
185
- if key.startswith('has_') and exists:
254
+ if key in actionable_keys and exists:
186
255
  analysis['file_count'] += 1
187
256
 
188
257
  return analysis
@@ -191,27 +260,31 @@ def _analyze_generated_files(output_dir: Path, subprojects: list = None) -> dict
191
260
  def _build_dynamic_focus_areas(file_analysis: dict) -> List[str]:
192
261
  """Build focus areas based on generated files."""
193
262
  focus_areas = []
263
+
264
+ analysis_file = file_analysis.get('analysis_file', 'analysis.toon')
265
+ map_file = file_analysis.get('map_file', 'map.toon.yaml')
266
+ evolution_file = file_analysis.get('evolution_file', 'evolution.toon.yaml')
267
+ project_logic_file = file_analysis.get('project_logic_file', 'project.toon')
268
+ validation_file = file_analysis.get('validation_file', 'project/validation.toon.yaml')
269
+ duplication_file = file_analysis.get('duplication_file', 'project/duplication.toon.yaml')
194
270
 
195
271
  if file_analysis['has_analysis_toon']:
196
- focus_areas.append("1. **Code Health Analysis** - Review complexity metrics, god modules, coupling issues from analysis.toon")
272
+ focus_areas.append(f"1. **Code Health Analysis** - Review complexity metrics, god modules, coupling issues from {analysis_file}")
197
273
 
198
274
  if file_analysis['has_map_toon']:
199
- focus_areas.append("2. **Structural Map** - Use map.toon.yaml to inspect imports, exports, signatures, and the project header")
275
+ focus_areas.append(f"2. **Structural Map** - Use {map_file} to inspect imports, exports, signatures, and the project header")
200
276
 
201
277
  if file_analysis['has_evolution_toon']:
202
- focus_areas.append("3. **Refactoring Priorities** - Examine ranked refactoring actions and risk assessment from evolution.toon.yaml")
203
-
204
- if file_analysis['has_context_md']:
205
- focus_areas.append("4. **Architecture Overview** - Understand main flows, entry points, and public API from context.md")
206
-
207
- if file_analysis['has_yaml'] or file_analysis['has_json']:
208
- focus_areas.append("5. **Structured Data** - Use machine-readable formats for automated analysis and metrics extraction")
278
+ focus_areas.append(f"3. **Refactoring Priorities** - Examine ranked refactoring actions and risk assessment from {evolution_file}")
279
+
280
+ if file_analysis.get('has_project_logic'):
281
+ focus_areas.append(f"4. **Project Logic** - Review the compact module overview from {project_logic_file}")
209
282
 
210
- if file_analysis['has_mermaid']:
211
- focus_areas.append("6. **Visual Flow** - Review control flow diagrams and call graphs for architectural insights")
283
+ if file_analysis['has_validation_toon']:
284
+ focus_areas.append(f"5. **Validation Analysis** - Review validation results and issues identified by vallm from {validation_file}")
212
285
 
213
- if file_analysis['is_chunked']:
214
- focus_areas.append("7. **Large Repository Patterns** - Identify cross-chunk dependencies and consolidation opportunities")
286
+ if file_analysis['has_duplication_toon']:
287
+ focus_areas.append(f"6. **Code Duplication** - Examine duplicate code patterns detected by redup from {duplication_file}")
215
288
 
216
289
  if not focus_areas:
217
290
  focus_areas.append("1. **General Code Review** - Provide overall architecture assessment and improvement recommendations")
@@ -221,6 +294,13 @@ def _build_dynamic_focus_areas(file_analysis: dict) -> List[str]:
221
294
 
222
295
  def _build_dynamic_tasks(file_analysis: dict) -> List[str]:
223
296
  """Build tasks based on available files."""
297
+ analysis_file = file_analysis.get('analysis_file', 'analysis.toon')
298
+ map_file = file_analysis.get('map_file', 'map.toon.yaml')
299
+ evolution_file = file_analysis.get('evolution_file', 'evolution.toon.yaml')
300
+ validation_file = file_analysis.get('validation_file', 'project/validation.toon.yaml')
301
+ duplication_file = file_analysis.get('duplication_file', 'project/duplication.toon.yaml')
302
+ project_logic_file = file_analysis.get('project_logic_file', 'project.toon')
303
+
224
304
  tasks = [
225
305
  "- Summarize the architecture, main flows, and structural dependencies.",
226
306
  "- Identify the highest-risk areas and propose a refactoring plan.",
@@ -228,19 +308,22 @@ def _build_dynamic_tasks(file_analysis: dict) -> List[str]:
228
308
  ]
229
309
 
230
310
  if file_analysis['has_analysis_toon']:
231
- tasks.append("- Highlight critical functions (CC ≥ 10) and top problem areas from analysis.toon.")
311
+ tasks.append(f"- Highlight critical functions (CC ≥ 10) and top problem areas from {analysis_file}.")
232
312
 
233
313
  if file_analysis['has_map_toon']:
234
- tasks.append("- Cross-check imports, exports, and signatures against map.toon.yaml before proposing splits.")
314
+ tasks.append(f"- Cross-check imports, exports, and signatures against {map_file} before proposing splits.")
235
315
 
236
316
  if file_analysis['has_evolution_toon']:
237
- tasks.append("- Prioritize refactoring actions by impact/effort ratio from evolution.toon.yaml.")
238
-
239
- if file_analysis['has_context_md']:
240
- tasks.append("- Validate entry points and public API surface match the architecture described.")
317
+ tasks.append(f"- Prioritize refactoring actions by impact/effort ratio from {evolution_file}.")
241
318
 
242
- if file_analysis['is_chunked']:
243
- tasks.append("- Analyze cross-chunk dependencies and suggest consolidation strategies.")
319
+ if file_analysis.get('has_project_logic'):
320
+ tasks.append(f"- Use {project_logic_file} to validate the compact project overview against the rest of the analysis.")
321
+
322
+ if file_analysis['has_validation_toon']:
323
+ tasks.append(f"- Review validation findings from {validation_file} generated by vallm.")
324
+
325
+ if file_analysis['has_duplication_toon']:
326
+ tasks.append(f"- Analyze code duplication patterns from {duplication_file} generated by redup.")
244
327
 
245
328
  return tasks
246
329
 
@@ -271,14 +354,15 @@ def _build_prompt_footer(chunked: bool = False, file_analysis: dict = None) -> L
271
354
  lines.append("")
272
355
  lines.append("Analysis Strategy:")
273
356
  if file_analysis['has_analysis_toon'] and file_analysis['has_map_toon']:
274
- lines.append("- Start with analysis.toon for health metrics, then map.toon.yaml for structure and signatures")
357
+ lines.append(f"- Start with {file_analysis.get('analysis_file', 'analysis.toon')} for health metrics, then {file_analysis.get('map_file', 'map.toon.yaml')} for structure and signatures")
275
358
  if file_analysis['has_evolution_toon']:
276
- lines.append("- Finish with evolution.toon.yaml for action priorities and next steps")
277
- elif file_analysis['has_context_md']:
278
- lines.append("- Use context.md as the primary reference for architectural understanding")
279
-
280
- if file_analysis['has_yaml']:
281
- lines.append("- Reference analysis.yaml for precise metrics and programmatic data")
359
+ lines.append(f"- Review {file_analysis.get('evolution_file', 'evolution.toon.yaml')} for action priorities and next steps")
360
+ if file_analysis.get('has_project_logic'):
361
+ lines.append(f"- Compare the compact project overview in {file_analysis.get('project_logic_file', 'project.toon')} with the main analysis files")
362
+ if file_analysis['has_validation_toon']:
363
+ lines.append(f"- Check {file_analysis.get('validation_file', 'project/validation.toon.yaml')} for validation issues (vallm tool output)")
364
+ if file_analysis['has_duplication_toon']:
365
+ lines.append(f"- Examine {file_analysis.get('duplication_file', 'project/duplication.toon.yaml')} for duplicate code patterns (redup tool output)")
282
366
 
283
367
  # Constraints
284
368
  lines.append("")