Skip to content

Commit cbc7745

Browse files
refactor(goal): multi-language support with 4 supporting modules
changes: - file: formats.py area: cli added: [_export_calls_format] modified: [_export_calls_toon, _export_calls] - file: validate_toon.py area: core added: [_extract_names_from_toon] modified: [extract_classes_from_toon, extract_functions_from_toon] stats: lines: "+34/-42 (net -8)" files: 4 complexity: "+25% complexity (new features)"
1 parent 31b5e3f commit cbc7745

10 files changed

Lines changed: 46 additions & 47 deletions

File tree

CHANGELOG.md

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

3+
## [0.5.117] - 2026-04-19
4+
5+
### Other
6+
- Update code2llm/cli_exports/formats.py
7+
- Update code2llm/core/lang/__init__.py
8+
- Update validate_toon.py
9+
310
## [0.5.116] - 2026-04-19
411

512
### Docs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
## AI Cost Tracking
55

6-
![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.5.116-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
6+
![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.5.117-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
77
![AI Cost](https://img.shields.io/badge/AI%20Cost-$7.50-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-57.3h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)
88

99
- 🤖 **LLM usage:** $7.5000 (166 commits)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.116
1+
0.5.117

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

1414
# Core analysis components (lightweight, always needed)

code2llm/cli_exports/formats.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -215,30 +215,27 @@ def _export_mermaid_pngs(args, output_dir: Path) -> None:
215215
print(f" - PNG: Skipped (install with: make install-mermaid)")
216216

217217

218-
def _export_calls(args, result, output_dir: Path):
219-
"""Export standalone calls.yaml (structured call graph YAML).
220-
221-
Generates calls.yaml with structured call graph data:
222-
- nodes: functions with metadata (CC, calls_in/out)
223-
- edges: caller -> callee relationships
224-
- modules: grouping by module
225-
- stats: summary statistics
226-
"""
218+
def _export_calls_format(args, result, output_dir: Path, toon: bool = False) -> None:
219+
"""Shared helper: export call graph in YAML or toon format."""
227220
yaml_exporter = YAMLExporter()
228-
yaml_exporter.export_calls(result, str(output_dir / 'calls.yaml'))
229-
if args.verbose:
230-
print(f" - CALLS (call graph YAML): {output_dir / 'calls.yaml'}")
221+
if toon:
222+
yaml_exporter.export_calls_toon(result, str(output_dir / 'calls.toon.yaml'))
223+
if args.verbose:
224+
print(f" - CALLS (toon format): {output_dir / 'calls.toon.yaml'}")
225+
else:
226+
yaml_exporter.export_calls(result, str(output_dir / 'calls.yaml'))
227+
if args.verbose:
228+
print(f" - CALLS (call graph YAML): {output_dir / 'calls.yaml'}")
231229

232230

233-
def _export_calls_toon(args, result, output_dir: Path):
234-
"""Export calls.toon.yaml (call graph in human-readable toon format).
231+
def _export_calls(args, result, output_dir: Path):
232+
"""Export standalone calls.yaml (structured call graph YAML)."""
233+
_export_calls_format(args, result, output_dir, toon=False)
235234

236-
Generates calls.toon.yaml with hubs, modules, and edges sections.
237-
"""
238-
yaml_exporter = YAMLExporter()
239-
yaml_exporter.export_calls_toon(result, str(output_dir / 'calls.toon.yaml'))
240-
if args.verbose:
241-
print(f" - CALLS (toon format): {output_dir / 'calls.toon.yaml'}")
235+
236+
def _export_calls_toon(args, result, output_dir: Path):
237+
"""Export calls.toon.yaml (call graph in human-readable toon format)."""
238+
_export_calls_format(args, result, output_dir, toon=True)
242239

243240

244241
def _export_mermaid(args, result, output_dir: Path):

code2llm/core/lang/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ def list_parsers() -> Dict[str, Any]:
158158
'LANGUAGE_REGISTRY',
159159
'get_parser',
160160
'list_parsers',
161+
# New class-based parsers
162+
'RubyParser',
161163
# Legacy exports
162164
'analyze_typescript_js',
163165
'analyze_go',

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.116"
7+
__version__ = "0.5.117"
88

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "code2llm"
7-
version = "0.5.116"
7+
version = "0.5.117"
88
description = "High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries"
99
readme = "README.md"
1010
requires-python = ">=3.8"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55

66
# Read version
7-
version = "0.5.115"
7+
version = "0.5.116"
88

99
# Read long description
1010
def read_readme():

validate_toon.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,39 +39,32 @@ def extract_functions_from_yaml(yaml_data):
3939

4040
return functions
4141

42+
def _extract_names_from_toon(toon_data, key: str) -> set:
43+
"""Shared helper: extract a set of names from a toon data list by key."""
44+
names = set()
45+
for item in toon_data.get(key, []):
46+
name = item.get('name', '')
47+
if name:
48+
names.add(name)
49+
return names
50+
51+
4252
def extract_functions_from_toon(toon_data):
4353
"""Extract function list from parsed TOON data."""
44-
functions = set()
45-
46-
# Extract from functions array
47-
for func_data in toon_data.get('functions', []):
48-
name = func_data.get('name', '')
49-
if name:
50-
functions.add(name)
51-
52-
return functions
54+
return _extract_names_from_toon(toon_data, 'functions')
55+
5356

5457
def extract_classes_from_yaml(yaml_data):
5558
"""Extract class list from standard YAML format."""
5659
classes = set()
57-
58-
# Extract from classes section (direct class analysis)
5960
for class_name in yaml_data.get('classes', {}):
6061
classes.add(class_name)
61-
6262
return classes
6363

64+
6465
def extract_classes_from_toon(toon_data):
6566
"""Extract class list from parsed TOON data."""
66-
classes = set()
67-
68-
# Extract from classes array
69-
for cls_data in toon_data.get('classes', []):
70-
name = cls_data.get('name', '')
71-
if name:
72-
classes.add(name)
73-
74-
return classes
67+
return _extract_names_from_toon(toon_data, 'classes')
7568

7669
def analyze_class_differences(yaml_data, toon_data):
7770
"""Analyze why classes differ between formats."""

0 commit comments

Comments
 (0)