Skip to content

Commit cd48025

Browse files
refactor(docs): code analysis engine
changes: - file: prompt.py area: cli modified: [_export_prompt_txt, _export_chunked_prompt_txt] removed: [_build_source_files_section] - file: test_prompt_txt.py area: test modified: [TestPromptTxtGeneration] removed: [test_prompt_txt_includes_orchestrator_source_file_description, temp_source_dir] stats: lines: "+239/-291 (net -52)" files: 10 complexity: "Large structural change (normalized)"
1 parent 9a44073 commit cd48025

15 files changed

Lines changed: 260 additions & 295 deletions

File tree

CHANGELOG.md

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

3+
## [0.5.95] - 2026-03-26
4+
5+
### Docs
6+
- Update project/context.md
7+
8+
### Test
9+
- Update tests/test_prompt_txt.py
10+
11+
### Other
12+
- Update code2llm/cli_exports/prompt.py
13+
- Update project/analysis.toon.yaml
14+
- Update project/calls.mmd
15+
- Update project/calls.png
16+
- Update project/flow.png
17+
- Update project/index.html
18+
- Update project/map.toon.yaml
19+
320
## [0.5.94] - 2026-03-26
421

522
### Docs

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.94
1+
0.5.95

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.94"
11+
__version__ = "0.5.95"
1212
__author__ = "STTS Project"
1313

1414
# Core analysis components (lightweight, always needed)

code2llm/cli_exports/prompt.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ 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))
1817

1918
missing = _get_missing_files(output_dir)
2019
if missing:
@@ -45,7 +44,6 @@ def _export_chunked_prompt_txt(args, output_dir: Path, formats: list[str], sourc
4544
lines = _build_prompt_header(project_path)
4645
lines.extend(_build_main_files_section(output_dir, output_rel_path))
4746
lines.extend(_build_optional_files_section(output_dir, output_rel_path))
48-
lines.extend(_build_source_files_section(source_path))
4947

5048
if subprojects:
5149
lines.extend(_build_subprojects_section(subprojects, output_dir, output_rel_path))
@@ -102,11 +100,6 @@ def _get_prompt_paths(source_path: Optional[Path], output_dir: Path) -> Tuple[st
102100
]
103101

104102

105-
_SOURCE_FILES = [
106-
('code2llm/cli_exports/orchestrator.py', 'Export orchestration - coordinates single-project and chunked export flows, including prompt generation'),
107-
]
108-
109-
110103
def _build_prompt_header(project_path: str) -> List[str]:
111104
"""Build header section of prompt."""
112105
return [
@@ -162,27 +155,6 @@ def _build_optional_files_section(output_dir: Path, output_rel_path: str) -> Lis
162155
return ["", "Optional files:", ""] + lines
163156

164157

165-
def _build_source_files_section(source_path: Optional[Path]) -> List[str]:
166-
"""Build source files section with size metrics."""
167-
if source_path is None:
168-
return []
169-
170-
source_root = source_path if source_path.is_dir() else source_path.parent
171-
lines = []
172-
for rel_path, desc in _SOURCE_FILES:
173-
file_path = source_root / rel_path
174-
if not file_path.exists():
175-
continue
176-
177-
size_str = _format_size(file_path.stat().st_size)
178-
lines.append(f"- {rel_path} ({desc}) [{size_str}]")
179-
180-
if not lines:
181-
return []
182-
183-
return ["", "Source files:", ""] + lines
184-
185-
186158
def _format_size(size_bytes: int) -> str:
187159
"""Format file size in human readable format."""
188160
if size_bytes < 1024:

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.94"
7+
__version__ = "0.5.95"
88

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

project/analysis.toon.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ PIPELINES[637]:
2626
PURITY: 100% pure
2727
[4] Src [main]: main → load_file → is_toon_file
2828
PURITY: 100% pure
29-
[5] Src [main]: main → create_html → get_shield_url
29+
[5] Src [__init__]: __init__
3030
PURITY: 100% pure
3131

3232
LAYERS:

project/calls.mmd

Lines changed: 218 additions & 218 deletions
Large diffs are not rendered by default.

project/calls.png

-2.06 KB
Loading

project/context.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@
8282
- **Classes**: 2
8383
- **File**: `side_effects.py`
8484

85-
### code2llm.core.file_analyzer
85+
### code2llm.analysis.cfg
8686
- **Functions**: 17
8787
- **Classes**: 1
88-
- **File**: `file_analyzer.py`
88+
- **File**: `cfg.py`
8989

90-
### code2llm.analysis.cfg
90+
### code2llm.core.file_analyzer
9191
- **Functions**: 17
9292
- **Classes**: 1
93-
- **File**: `cfg.py`
93+
- **File**: `file_analyzer.py`
9494

9595
### code2llm.exporters.evolution_exporter
9696
- **Functions**: 17
@@ -425,10 +425,10 @@ Sections: PIPELINES, TRANSFORMS, CONTRACTS, DATA_TY
425425
- **Key Methods**: code2llm.analysis.call_graph.CallGraphExtractor.__init__, code2llm.analysis.call_graph.CallGraphExtractor.extract, code2llm.analysis.call_graph.CallGraphExtractor._calculate_metrics, code2llm.analysis.call_graph.CallGraphExtractor.visit_Import, code2llm.analysis.call_graph.CallGraphExtractor.visit_ImportFrom, code2llm.analysis.call_graph.CallGraphExtractor.visit_ClassDef, code2llm.analysis.call_graph.CallGraphExtractor.visit_FunctionDef, code2llm.analysis.call_graph.CallGraphExtractor.visit_AsyncFunctionDef, code2llm.analysis.call_graph.CallGraphExtractor.visit_Call, code2llm.analysis.call_graph.CallGraphExtractor._qualified_name
426426
- **Inherits**: ast.NodeVisitor
427427

428-
### code2llm.nlp.normalization.QueryNormalizer
429-
> Normalize queries for consistent processing.
428+
### code2llm.nlp.intent_matching.IntentMatcher
429+
> Match queries to intents using fuzzy and keyword matching.
430430
- **Methods**: 13
431-
- **Key Methods**: code2llm.nlp.normalization.QueryNormalizer.__init__, code2llm.nlp.normalization.QueryNormalizer.normalize, code2llm.nlp.normalization.QueryNormalizer._unicode_normalize, code2llm.nlp.normalization.QueryNormalizer._lowercase, code2llm.nlp.normalization.QueryNormalizer._remove_punctuation, code2llm.nlp.normalization.QueryNormalizer._normalize_whitespace, code2llm.nlp.normalization.QueryNormalizer._remove_stopwords, code2llm.nlp.normalization.QueryNormalizer._tokenize, code2llm.nlp.normalization.QueryNormalizer.step_1a_lowercase, code2llm.nlp.normalization.QueryNormalizer.step_1b_remove_punctuation
431+
- **Key Methods**: code2llm.nlp.intent_matching.IntentMatcher.__init__, code2llm.nlp.intent_matching.IntentMatcher.match, code2llm.nlp.intent_matching.IntentMatcher._fuzzy_match, code2llm.nlp.intent_matching.IntentMatcher._keyword_match, code2llm.nlp.intent_matching.IntentMatcher._apply_context, code2llm.nlp.intent_matching.IntentMatcher._combine_matches, code2llm.nlp.intent_matching.IntentMatcher._resolve_multi_intent, code2llm.nlp.intent_matching.IntentMatcher._calculate_similarity, code2llm.nlp.intent_matching.IntentMatcher.step_2a_fuzzy_match, code2llm.nlp.intent_matching.IntentMatcher.step_2b_semantic_match
432432

433433
## Data Transformation Functions
434434

@@ -494,6 +494,10 @@ Checks:
494494
> Generate all format outputs and evaluate them.
495495
- **Output to**: format_configs.items, __import__, getattr, exporter_cls, time.time
496496

497+
### code2llm.core.repo_files._get_gitignore_parser
498+
> Load gitignore parser for project if available.
499+
- **Output to**: code2llm.core.gitignore.load_gitignore_patterns
500+
497501
### code2llm.core.large_repo.HierarchicalRepoSplitter._process_large_dirs
498502
> Process large directories with file-level chunking.
499503
- **Output to**: self._chunk_by_files, chunks.extend
@@ -502,10 +506,6 @@ Checks:
502506
> Process Python files directly in level1 directory.
503507
- **Output to**: code2llm.core.repo_files._get_gitignore_parser, len, chunks.append, self._chunk_by_files, chunks.extend
504508

505-
### code2llm.core.repo_files._get_gitignore_parser
506-
> Load gitignore parser for project if available.
507-
- **Output to**: code2llm.core.gitignore.load_gitignore_patterns
508-
509509
### code2llm.core.gitignore.GitIgnoreParser._parse_pattern
510510
> Parse a single gitignore pattern into regex.
511511
- **Output to**: pattern.startswith, pattern.endswith, pattern.startswith, self._wildcard_to_regex, re.compile
@@ -520,6 +520,10 @@ Returns list of (module_name, start_line, end_line).
520520
> Check if file should be processed.
521521
- **Output to**: file_path.lower, Path, self._gitignore_parser.is_ignored, any, fnmatch.fnmatch
522522

523+
### code2llm.analysis.cfg.CFGExtractor._format_except
524+
> Format except handler.
525+
- **Output to**: self._expr_to_str
526+
523527
### code2llm.core.file_analyzer.FileAnalyzer._process_class
524528
> Process class definition.
525529
- **Output to**: ClassInfo, None.classes.append, isinstance, isinstance, methods.append
@@ -532,10 +536,6 @@ Returns list of (module_name, start_line, end_line).
532536
> Process a block of statements for CFG with depth limiting.
533537
- **Output to**: None.append, isinstance, None.append, FlowEdge, self._process_if_stmt
534538

535-
### code2llm.core.file_analyzer.FileAnalyzer._process_if_stmt
536-
> Process if statement for CFG.
537-
- **Output to**: FlowNode, func_info.cfg_nodes.append, None.append, self._process_cfg_block, FlowNode
538-
539539
## Behavioral Patterns
540540

541541
### recursion__is_excluded

project/flow.png

-155 Bytes
Loading

0 commit comments

Comments
 (0)