Skip to content

Commit a51e1dd

Browse files
refactor(docs): code analysis engine
changes: - file: prompt.py area: cli added: [_build_source_files_section] modified: [_export_chunked_prompt_txt, _export_prompt_txt] - file: readme_exporter.py area: docs modified: [READMEExporter, _generate_readme_content] - file: test_prompt_txt.py area: test added: [temp_source_dir] new_tests: 1 modified: [TestPromptTxtGeneration] testing: new_tests: 1 scenarios: - prompt_txt_includes_orchestrator_source_file_description stats: lines: "+593/-292 (net +301)" files: 17 complexity: "Large structural change (normalized)"
1 parent a235d9b commit a51e1dd

22 files changed

Lines changed: 619 additions & 296 deletions

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
## [Unreleased]
22

3+
## [0.5.84] - 2026-03-26
4+
5+
### Docs
6+
- Update project/README.md
7+
- Update project/context.md
8+
9+
### Test
10+
- Update tests/test_prompt_txt.py
11+
12+
### Other
13+
- Update code2llm/cli_exports/prompt.py
14+
- Update code2llm/exporters/readme_exporter.py
15+
- Update project/analysis.toon.yaml
16+
- Update project/calls.mmd
17+
- Update project/calls.png
18+
- Update project/compact_flow.mmd
19+
- Update project/compact_flow.png
20+
- Update project/evolution.toon.yaml
21+
- Update project/flow.mmd
22+
- Update project/flow.png
23+
- ... and 3 more files
24+
325
## [0.5.83] - 2026-03-26
426

527
### Docs

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.83
1+
0.5.84

code2llm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
and entity resolution with multilingual support.
99
"""
1010

11-
__version__ = "0.5.83"
11+
__version__ = "0.5.84"
1212
__author__ = "STTS Project"
1313

1414
# Core analysis components (lightweight, always needed)

code2llm/cli_exports/prompt.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def _export_prompt_txt(args, output_dir: Path, formats: list[str], source_path:
1414
lines = _build_prompt_header(project_path)
1515
lines.extend(_build_main_files_section(output_dir, output_rel_path))
1616
lines.extend(_build_optional_files_section(output_dir, output_rel_path))
17+
lines.extend(_build_source_files_section(source_path))
1718

1819
missing = _get_missing_files(output_dir)
1920
if missing:
@@ -41,6 +42,7 @@ def _export_chunked_prompt_txt(args, output_dir: Path, formats: list[str], sourc
4142
lines = _build_prompt_header(project_path)
4243
lines.extend(_build_main_files_section(output_dir, output_rel_path))
4344
lines.extend(_build_optional_files_section(output_dir, output_rel_path))
45+
lines.extend(_build_source_files_section(source_path))
4446

4547
if subprojects:
4648
lines.extend(_build_subprojects_section(subprojects, output_dir, output_rel_path))
@@ -94,6 +96,11 @@ def _get_prompt_paths(source_path: Optional[Path], output_dir: Path) -> Tuple[st
9496
]
9597

9698

99+
_SOURCE_FILES = [
100+
('code2llm/cli_exports/orchestrator.py', 'Export orchestration - coordinates single-project and chunked export flows, including prompt generation'),
101+
]
102+
103+
97104
def _build_prompt_header(project_path: str) -> List[str]:
98105
"""Build header section of prompt."""
99106
return [
@@ -145,6 +152,27 @@ def _build_optional_files_section(output_dir: Path, output_rel_path: str) -> Lis
145152
return ["", "Optional files:", ""] + lines
146153

147154

155+
def _build_source_files_section(source_path: Optional[Path]) -> List[str]:
156+
"""Build source files section with size metrics."""
157+
if source_path is None:
158+
return []
159+
160+
source_root = source_path if source_path.is_dir() else source_path.parent
161+
lines = []
162+
for rel_path, desc in _SOURCE_FILES:
163+
file_path = source_root / rel_path
164+
if not file_path.exists():
165+
continue
166+
167+
size_str = _format_size(file_path.stat().st_size)
168+
lines.append(f"- {rel_path} ({desc}) [{size_str}]")
169+
170+
if not lines:
171+
return []
172+
173+
return ["", "Source files:", ""] + lines
174+
175+
148176
def _format_size(size_bytes: int) -> str:
149177
"""Format file size in human readable format."""
150178
if size_bytes < 1024:

code2llm/exporters/readme_exporter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def _generate_readme_content(self, project_path: str, output_dir: Path,
235235
**Purpose**: Pre-formatted prompt listing all generated files for LLM conversation
236236
**Contents**:
237237
- **Files section**: Lists all existing generated files with descriptions
238+
- **Source files section**: Highlights important source files such as `cli_exports/orchestrator.py`
238239
- **Missing section**: Shows which files weren't generated (if any)
239240
- **Task section**: Instructions for LLM analysis
240241
- **Requirements section**: Guidelines for suggested changes

code2llm/nlp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
with multilingual support and fuzzy matching.
55
"""
66

7-
__version__ = "0.5.83"
7+
__version__ = "0.5.84"
88

99
from .pipeline import NLPPipeline
1010
from .normalization import QueryNormalizer

project/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,6 @@ code2llm ./ -f yaml --separate-orphans
331331
**Analysis Date**: 2026-03-26
332332
**Total Functions**: 931
333333
**Total Classes**: 106
334-
**Modules**: 122
334+
**Modules**: 117
335335

336336
For more information about code2llm, visit: https://github.com/tom-sapletta/code2llm

project/analysis.toon.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
# code2llm | 113f 21404L | python:108,shell:4,php:1 | 2026-03-26
1+
# code2llm | 113f 21404L | python:105,shell:2,php:1 | 2026-03-26
22
# CC̄=4.6 | critical:10/931 | dups:0 | cycles:0
33

44
HEALTH[10]:
5-
🟡 CC _process_functions CC=34 (limit:15)
5+
🟡 CC main CC=17 (limit:15)
6+
🟡 CC validate_chunked_output CC=15 (limit:15)
67
🟡 CC export_to_yaml CC=25 (limit:15)
7-
🟡 CC export_flow_detailed CC=25 (limit:15)
88
🟡 CC export_flow_compact CC=23 (limit:15)
9+
🟡 CC export_flow_detailed CC=25 (limit:15)
910
🟡 CC export_flow_full CC=23 (limit:15)
10-
🟡 CC main CC=17 (limit:15)
11-
🟡 CC analyze_ruby CC=17 (limit:15)
1211
🟡 CC _export_mermaid CC=16 (limit:15)
1312
🟡 CC extract_calls_regex CC=16 (limit:15)
14-
🟡 CC validate_chunked_output CC=15 (limit:15)
13+
🟡 CC _process_functions CC=34 (limit:15)
14+
🟡 CC analyze_ruby CC=17 (limit:15)
1515

1616
REFACTOR[1]:
1717
1. split 10 high-CC methods (CC>15)
1818

1919
PIPELINES[637]:
2020
[1] Src [read_readme]: read_readme
2121
PURITY: 100% pure
22-
[2] Src [run_benchmark]: run_benchmark → load_previous
22+
[2] Src [save_report]: save_report
2323
PURITY: 100% pure
24-
[3] Src [save_report]: save_report
24+
[3] Src [run_benchmark]: run_benchmark → load_previous
2525
PURITY: 100% pure
2626
[4] Src [main]: main → load_file → is_toon_file
2727
PURITY: 100% pure
28-
[5] Src [main]: main → create_html → get_shield_url
28+
[5] Src [__init__]: __init__
2929
PURITY: 100% pure
3030

3131
LAYERS:

0 commit comments

Comments
 (0)