code2llm 0.5.103__tar.gz → 0.5.105__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.
- {code2llm-0.5.103 → code2llm-0.5.105}/PKG-INFO +8 -8
- {code2llm-0.5.103 → code2llm-0.5.105}/README.md +7 -7
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/__init__.py +1 -1
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/cli_commands.py +1 -1
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/cli_exports/formats.py +17 -1
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/cli_exports/orchestrator.py +4 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/cli_parser.py +1 -1
- code2llm-0.5.105/code2llm/core/lang/php.py +66 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/typescript.py +18 -20
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/refactoring.py +1 -1
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/yaml_exporter.py +96 -1
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/nlp/__init__.py +1 -1
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm.egg-info/PKG-INFO +8 -8
- {code2llm-0.5.103 → code2llm-0.5.105}/pyproject.toml +1 -1
- {code2llm-0.5.103 → code2llm-0.5.105}/setup.py +1 -1
- code2llm-0.5.103/code2llm/core/lang/php.py +0 -106
- {code2llm-0.5.103 → code2llm-0.5.105}/LICENSE +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/__main__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/call_graph.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/cfg.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/coupling.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/data_analysis.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/dfg.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/pipeline_detector.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/side_effects.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/smells.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/type_inference.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/utils/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/analysis/utils/ast_helpers.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/api.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/cli.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/cli_analysis.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/cli_exports/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/cli_exports/code2logic.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/cli_exports/prompt.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/analyzer.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/ast_registry.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/config.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/export_pipeline.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/file_analyzer.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/file_cache.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/file_filter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/gitignore.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/incremental.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/base.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/cpp.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/csharp.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/generic.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/go_lang.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/java.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/ruby.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/rust.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/ts_extractors.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/lang/ts_parser.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/large_repo.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/models.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/repo_files.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/streaming/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/streaming/cache.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/streaming/incremental.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/streaming/prioritizer.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/streaming/scanner.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/streaming/strategies.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/streaming_analyzer.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/core/toon_size_manager.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/article_view.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/base.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/context_exporter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/context_view.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/evolution_exporter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/flow_constants.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/flow_exporter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/flow_renderer.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/html_dashboard.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/index_generator.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/json_exporter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/llm_exporter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/map_exporter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/mermaid_exporter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/mermaid_flow_helpers.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/project_yaml_exporter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/readme_exporter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/report_generators.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/toon/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/toon/helpers.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/toon/metrics.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/toon/module_detail.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/toon/renderer.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/toon.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/toon_view.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/exporters/validate_project.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/generators/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/generators/llm_flow.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/generators/llm_task.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/generators/mermaid.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/nlp/config.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/nlp/entity_resolution.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/nlp/intent_matching.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/nlp/normalization.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/nlp/pipeline.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/patterns/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/patterns/detector.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/refactor/__init__.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm/refactor/prompt_engine.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm.egg-info/SOURCES.txt +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm.egg-info/dependency_links.txt +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm.egg-info/entry_points.txt +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm.egg-info/requires.txt +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/code2llm.egg-info/top_level.txt +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/setup.cfg +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_advanced_analysis.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_analyzer.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_deep_analysis.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_edge_cases.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_flow_exporter.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_format_quality.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_multilanguage_e2e.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_nlp_pipeline.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_nonpython_cc_calls.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_pipeline_detector.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_project_toon_export.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_prompt_engine.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_prompt_txt.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/tests/test_refactoring_engine.py +0 -0
- {code2llm-0.5.103 → code2llm-0.5.105}/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.
|
|
3
|
+
Version: 0.5.105
|
|
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
|
|
@@ -66,13 +66,13 @@ Dynamic: requires-python
|
|
|
66
66
|
|
|
67
67
|
## AI Cost Tracking
|
|
68
68
|
|
|
69
|
-
     
|
|
70
|
+
  
|
|
71
71
|
|
|
72
|
-
- 🤖 **LLM usage:** $7.5000 (
|
|
73
|
-
- 👤 **Human dev:** ~$
|
|
72
|
+
- 🤖 **LLM usage:** $7.5000 (154 commits)
|
|
73
|
+
- 👤 **Human dev:** ~$5373 (53.7h @ $100/h, 30min dedup)
|
|
74
74
|
|
|
75
|
-
Generated on 2026-
|
|
75
|
+
Generated on 2026-04-18 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)
|
|
76
76
|
|
|
77
77
|
---
|
|
78
78
|
|
|
@@ -400,8 +400,8 @@ code2llm ./ -f yaml --separate-orphans
|
|
|
400
400
|
---
|
|
401
401
|
|
|
402
402
|
**Generated by**: `code2llm ./ -f all --readme`
|
|
403
|
-
**Analysis Date**: 2026-
|
|
404
|
-
**Total Functions**:
|
|
403
|
+
**Analysis Date**: 2026-04-18
|
|
404
|
+
**Total Functions**: 1014
|
|
405
405
|
**Total Classes**: 111
|
|
406
406
|
**Modules**: 131
|
|
407
407
|
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
## AI Cost Tracking
|
|
5
5
|
|
|
6
|
-
     
|
|
7
|
+
  
|
|
8
8
|
|
|
9
|
-
- 🤖 **LLM usage:** $7.5000 (
|
|
10
|
-
- 👤 **Human dev:** ~$
|
|
9
|
+
- 🤖 **LLM usage:** $7.5000 (154 commits)
|
|
10
|
+
- 👤 **Human dev:** ~$5373 (53.7h @ $100/h, 30min dedup)
|
|
11
11
|
|
|
12
|
-
Generated on 2026-
|
|
12
|
+
Generated on 2026-04-18 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -337,8 +337,8 @@ code2llm ./ -f yaml --separate-orphans
|
|
|
337
337
|
---
|
|
338
338
|
|
|
339
339
|
**Generated by**: `code2llm ./ -f all --readme`
|
|
340
|
-
**Analysis Date**: 2026-
|
|
341
|
-
**Total Functions**:
|
|
340
|
+
**Analysis Date**: 2026-04-18
|
|
341
|
+
**Total Functions**: 1014
|
|
342
342
|
**Total Classes**: 111
|
|
343
343
|
**Modules**: 131
|
|
344
344
|
|
|
@@ -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.
|
|
11
|
+
__version__ = "0.5.105"
|
|
12
12
|
__author__ = "STTS Project"
|
|
13
13
|
|
|
14
14
|
# Core analysis components (lightweight, always needed)
|
|
@@ -128,7 +128,7 @@ def validate_chunked_output(output_dir: Path, args) -> bool:
|
|
|
128
128
|
print(f"✗ No chunk directories found in: {output_dir}", file=sys.stderr)
|
|
129
129
|
return False
|
|
130
130
|
|
|
131
|
-
required_files = ['analysis.toon', 'context.md', 'evolution.toon.yaml']
|
|
131
|
+
required_files = ['analysis.toon.yaml', 'context.md', 'evolution.toon.yaml']
|
|
132
132
|
issues = []
|
|
133
133
|
valid_chunks = []
|
|
134
134
|
|
|
@@ -213,6 +213,18 @@ def _export_mermaid_pngs(args, output_dir: Path) -> None:
|
|
|
213
213
|
print(f" - PNG: Skipped (install with: make install-mermaid)")
|
|
214
214
|
|
|
215
215
|
|
|
216
|
+
def _export_calls(args, result, output_dir: Path):
|
|
217
|
+
"""Export standalone calls.yaml (call graph as structured YAML).
|
|
218
|
+
|
|
219
|
+
Generates calls.yaml without any Mermaid files — useful for programmatic
|
|
220
|
+
analysis of call graphs without visualization overhead.
|
|
221
|
+
"""
|
|
222
|
+
yaml_exporter = YAMLExporter()
|
|
223
|
+
yaml_exporter.export_calls(result, str(output_dir / 'calls.yaml'))
|
|
224
|
+
if args.verbose:
|
|
225
|
+
print(f" - CALLS (call graph YAML): {output_dir / 'calls.yaml'}")
|
|
226
|
+
|
|
227
|
+
|
|
216
228
|
def _export_mermaid(args, result, output_dir: Path):
|
|
217
229
|
"""Export Mermaid diagrams + optional PNG generation.
|
|
218
230
|
|
|
@@ -233,13 +245,17 @@ def _export_mermaid(args, result, output_dir: Path):
|
|
|
233
245
|
exporter.export_call_graph(result, str(output_dir / 'calls.mmd'))
|
|
234
246
|
exporter.export_compact(result, str(output_dir / 'compact_flow.mmd'))
|
|
235
247
|
|
|
248
|
+
# Export calls.yaml (structured call graph data)
|
|
249
|
+
yaml_exporter = YAMLExporter()
|
|
250
|
+
yaml_exporter.export_calls(result, str(output_dir / 'calls.yaml'))
|
|
251
|
+
|
|
236
252
|
if args.verbose:
|
|
237
253
|
files = ['flow.mmd']
|
|
238
254
|
if getattr(args, 'flow_detail', False):
|
|
239
255
|
files.append('flow_detailed.mmd')
|
|
240
256
|
if getattr(args, 'flow_full', False):
|
|
241
257
|
files.append('flow_full.mmd')
|
|
242
|
-
files.extend(['calls.mmd', 'compact_flow.mmd'])
|
|
258
|
+
files.extend(['calls.mmd', 'compact_flow.mmd', 'calls.yaml'])
|
|
243
259
|
print(f" - Mermaid: {output_dir}/*.mmd ({', '.join(files)})")
|
|
244
260
|
|
|
245
261
|
_export_mermaid_pngs(args, output_dir)
|
|
@@ -7,6 +7,7 @@ from typing import Optional
|
|
|
7
7
|
from .formats import (
|
|
8
8
|
_export_simple_formats,
|
|
9
9
|
_export_mermaid,
|
|
10
|
+
_export_calls,
|
|
10
11
|
_export_evolution,
|
|
11
12
|
_export_data_structures,
|
|
12
13
|
_export_context_fallback,
|
|
@@ -58,6 +59,9 @@ def _export_single_project(
|
|
|
58
59
|
if 'mermaid' in formats:
|
|
59
60
|
_export_mermaid(args, result, output_dir)
|
|
60
61
|
|
|
62
|
+
if 'calls' in formats:
|
|
63
|
+
_export_calls(args, result, output_dir)
|
|
64
|
+
|
|
61
65
|
_export_evolution(args, result, output_dir)
|
|
62
66
|
_export_data_structures(args, result, output_dir)
|
|
63
67
|
_export_context_fallback(args, result, output_dir, formats)
|
|
@@ -75,7 +75,7 @@ Strategy Options (--strategy):
|
|
|
75
75
|
parser.add_argument(
|
|
76
76
|
'-f', '--format',
|
|
77
77
|
default='toon',
|
|
78
|
-
help='Output formats: toon,map,flow,context,code2logic,yaml,json,mermaid,evolution,png,project-yaml,all (default: toon)'
|
|
78
|
+
help='Output formats: toon,map,flow,context,code2logic,yaml,json,mermaid,evolution,calls,png,project-yaml,all (default: toon)'
|
|
79
79
|
)
|
|
80
80
|
|
|
81
81
|
parser.add_argument(
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from typing import Dict, Optional, Tuple
|
|
3
|
+
from code2llm.core.models import ClassInfo, FunctionInfo, ModuleInfo
|
|
4
|
+
from code2llm.core.lang.base import calculate_complexity_regex, extract_calls_regex, _extract_declarations
|
|
5
|
+
|
|
6
|
+
def _parse_php_metadata(content: str, module_name: str, result: Dict) -> Tuple[Optional[str], bool]:
|
|
7
|
+
lines = content.split('\n')
|
|
8
|
+
current_namespace = None
|
|
9
|
+
in_php = False
|
|
10
|
+
for line in lines:
|
|
11
|
+
line = line.strip()
|
|
12
|
+
if line.startswith('<?php') or line.startswith('<?'):
|
|
13
|
+
in_php = True
|
|
14
|
+
continue
|
|
15
|
+
if line == '?>':
|
|
16
|
+
in_php = False
|
|
17
|
+
continue
|
|
18
|
+
if not in_php: continue
|
|
19
|
+
ns_match = re.match(r'^namespace\s+([\\\w]+)', line)
|
|
20
|
+
if ns_match:
|
|
21
|
+
current_namespace = ns_match.group(1)
|
|
22
|
+
continue
|
|
23
|
+
use_match = re.match(r'^use\s+([\\\w]+)', line)
|
|
24
|
+
if use_match:
|
|
25
|
+
result['module'].imports.append(use_match.group(1))
|
|
26
|
+
return current_namespace, in_php
|
|
27
|
+
|
|
28
|
+
def _adjust_qualified_names(result: Dict, module_name: str, namespace: str) -> None:
|
|
29
|
+
ns_prefix = f".{namespace}"
|
|
30
|
+
for key in ['classes', 'functions']:
|
|
31
|
+
new_items = {}
|
|
32
|
+
for qname, item in list(result[key].items()):
|
|
33
|
+
new_qname = qname.replace(f"{module_name}.", f"{module_name}{ns_prefix}.", 1)
|
|
34
|
+
item.qualified_name = new_qname
|
|
35
|
+
new_items[new_qname] = item
|
|
36
|
+
result[key] = new_items
|
|
37
|
+
result['module'].__setattr__(key, list(new_items.keys()))
|
|
38
|
+
|
|
39
|
+
def _extract_php_traits(content: str, file_path: str, module_name: str, namespace: Optional[str], result: Dict, stats: Dict) -> None:
|
|
40
|
+
trait_pattern = re.compile(r'^\s*trait\s+(\w+)')
|
|
41
|
+
for line_no, line in enumerate(content.split('\n'), 1):
|
|
42
|
+
tm = trait_pattern.match(line.strip())
|
|
43
|
+
if tm:
|
|
44
|
+
tname = tm.group(1)
|
|
45
|
+
qual = f"{module_name}.{namespace + '.' if namespace else ''}{tname}"
|
|
46
|
+
result['classes'][qual] = ClassInfo(name=tname, qualified_name=qual, file=file_path, line=line_no, module=module_name, bases=[], methods=[], docstring="")
|
|
47
|
+
result['module'].classes.append(qual)
|
|
48
|
+
stats['classes_found'] += 1
|
|
49
|
+
|
|
50
|
+
def analyze_php(content: str, file_path: str, module_name: str, ext: str, stats: Dict) -> Dict:
|
|
51
|
+
patterns = {
|
|
52
|
+
'import': re.compile(r'^(?:include|require|include_once|require_once)\s*["\']([^"\']+)["\']'),
|
|
53
|
+
'class': re.compile(r'(?:abstract\s+|final\s+)?class\s+(\w+)(?:\s+extends\s+(\w+))?(?:\s+implements\s+([\w,\s\\]+))?'),
|
|
54
|
+
'interface': re.compile(r'interface\s+(\w+)'),
|
|
55
|
+
'function': re.compile(r'(?:public\s+|private\s+|protected\s+)?(?:static\s+)?function\s+(\w+)\s*\('),
|
|
56
|
+
}
|
|
57
|
+
lang_config = {'index_files': (), 'brace_track': True, 'reserved': {'if', 'for', 'while', 'switch', 'return', 'catch', 'echo', 'print'}}
|
|
58
|
+
result = _extract_declarations(content, file_path, module_name, patterns, stats, lang_config)
|
|
59
|
+
namespace, _ = _parse_php_metadata(content, module_name, result)
|
|
60
|
+
if namespace:
|
|
61
|
+
_adjust_qualified_names(result, module_name, namespace)
|
|
62
|
+
_extract_php_traits(content, file_path, module_name, namespace, result, stats)
|
|
63
|
+
calculate_complexity_regex(content, result, lang='c_family')
|
|
64
|
+
extract_calls_regex(content, module_name, result)
|
|
65
|
+
stats['files_processed'] += 1
|
|
66
|
+
return result
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
"""TypeScript/JavaScript analyzer (regex-based)."""
|
|
2
|
-
|
|
3
1
|
import re
|
|
4
2
|
from typing import Dict
|
|
5
|
-
|
|
6
|
-
from code2llm.core.models import ClassInfo, FunctionInfo, ModuleInfo
|
|
7
3
|
from code2llm.core.lang.base import calculate_complexity_regex, extract_calls_regex, _extract_declarations
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"""Analyze TypeScript/JavaScript files using shared extraction."""
|
|
13
|
-
|
|
14
|
-
# TypeScript-specific patterns
|
|
15
|
-
patterns = {
|
|
5
|
+
def get_typescript_patterns() -> Dict[str, re.Pattern]:
|
|
6
|
+
"""Returns regex patterns for TypeScript/JavaScript parsing."""
|
|
7
|
+
return {
|
|
16
8
|
'import': re.compile(r"^\s*import\s+.*?\s+from\s+['\"]([^'\"]+)['\"]"),
|
|
17
9
|
'decorator': re.compile(r"^\s*@(\w+(?:\.\w+)?)(?:\([^)]*\))?"),
|
|
18
10
|
'class': re.compile(
|
|
@@ -32,24 +24,30 @@ def analyze_typescript_js(content: str, file_path: str, module_name: str,
|
|
|
32
24
|
r"^\s*(?:(?:public|private|protected|static|readonly)\s+)*(\w+)\s*(?::\s*[^=]+)?\s*=\s*(?:<[^>]+>\s*)?(?:async\s+)?(?:\([^)]*\)|[a-zA-Z_]\w*)\s*=>"
|
|
33
25
|
),
|
|
34
26
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
|
|
28
|
+
def get_typescript_lang_config() -> Dict:
|
|
29
|
+
"""Returns language configuration for TypeScript/JavaScript."""
|
|
30
|
+
return {
|
|
38
31
|
'index_files': ('index.ts', 'index.js', 'index.tsx', 'index.jsx'),
|
|
39
32
|
'brace_track': True,
|
|
40
33
|
'reserved': {'if', 'for', 'while', 'switch', 'return', 'catch', 'constructor',
|
|
41
34
|
'class', 'import', 'export', 'new'},
|
|
42
35
|
}
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
|
|
37
|
+
def analyze_typescript_js(content: str, file_path: str, module_name: str,
|
|
38
|
+
ext: str, stats: Dict) -> Dict:
|
|
39
|
+
"""Analyze TypeScript/JavaScript files using shared extraction."""
|
|
40
|
+
|
|
41
|
+
patterns = get_typescript_patterns()
|
|
42
|
+
lang_config = get_typescript_lang_config()
|
|
43
|
+
|
|
45
44
|
result = _extract_declarations(
|
|
46
45
|
content, file_path, module_name,
|
|
47
46
|
patterns, stats, lang_config
|
|
48
47
|
)
|
|
49
|
-
|
|
50
|
-
# Post-processing: calculate complexity and extract calls
|
|
48
|
+
|
|
51
49
|
calculate_complexity_regex(content, result, lang='c_family')
|
|
52
50
|
extract_calls_regex(content, module_name, result)
|
|
53
|
-
|
|
51
|
+
|
|
54
52
|
stats['files_processed'] += 1
|
|
55
|
-
return result
|
|
53
|
+
return result
|
|
@@ -185,7 +185,7 @@ class RefactoringAnalyzer:
|
|
|
185
185
|
|
|
186
186
|
# Check classes
|
|
187
187
|
for class_name, class_info in result.classes.items():
|
|
188
|
-
if Path(class_info.file).resolve() ==
|
|
188
|
+
if Path(class_info.file).resolve() == item_path and class_info.line == item_lineno:
|
|
189
189
|
class_info.reachability = "unreachable" # (if we add reachability to ClassInfo too)
|
|
190
190
|
|
|
191
191
|
def _mark_reachable_items(self, result: AnalysisResult) -> None:
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import yaml
|
|
4
4
|
from collections import defaultdict
|
|
5
5
|
from pathlib import Path
|
|
6
|
+
from typing import Dict, List, Set, Tuple, Optional
|
|
6
7
|
from .base import Exporter
|
|
7
|
-
from code2llm.core.models import AnalysisResult
|
|
8
|
+
from code2llm.core.models import AnalysisResult, FunctionInfo
|
|
8
9
|
from code2llm.analysis.data_analysis import DataAnalyzer
|
|
9
10
|
|
|
10
11
|
|
|
@@ -106,3 +107,97 @@ class YAMLExporter(Exporter):
|
|
|
106
107
|
safe_name = mod_name.replace('.', '_') or 'root'
|
|
107
108
|
with open(output_path / f'{safe_name}.yaml', 'w', encoding='utf-8') as f:
|
|
108
109
|
yaml.dump(content, f, default_flow_style=False, allow_unicode=True)
|
|
110
|
+
|
|
111
|
+
def export_calls(self, result: AnalysisResult, output_path: str, max_calls_per_func: int = 10, max_edges: int = 500) -> None:
|
|
112
|
+
"""Export call graph as structured YAML (calls.yaml).
|
|
113
|
+
|
|
114
|
+
Generates a structured representation of the call graph with:
|
|
115
|
+
- nodes: all functions that participate in calls (with metadata)
|
|
116
|
+
- edges: caller -> callee relationships
|
|
117
|
+
- modules: grouping of functions by module
|
|
118
|
+
- stats: summary statistics
|
|
119
|
+
"""
|
|
120
|
+
# Collect connected nodes and edges
|
|
121
|
+
connected: Set[str] = set()
|
|
122
|
+
edges: List[Dict] = []
|
|
123
|
+
seen_pairs: Set[Tuple[str, str]] = set()
|
|
124
|
+
|
|
125
|
+
for func_name, fi in result.functions.items():
|
|
126
|
+
for callee in fi.calls[:max_calls_per_func]:
|
|
127
|
+
resolved = self._resolve_callee(callee, result.functions)
|
|
128
|
+
if resolved and resolved != func_name:
|
|
129
|
+
connected.add(func_name)
|
|
130
|
+
connected.add(resolved)
|
|
131
|
+
pair = (func_name, resolved)
|
|
132
|
+
if pair not in seen_pairs:
|
|
133
|
+
seen_pairs.add(pair)
|
|
134
|
+
edges.append({
|
|
135
|
+
'caller': func_name,
|
|
136
|
+
'callee': resolved,
|
|
137
|
+
'call_type': 'direct' if callee == resolved.split('.')[-1] else 'resolved'
|
|
138
|
+
})
|
|
139
|
+
if len(edges) >= max_edges:
|
|
140
|
+
break
|
|
141
|
+
if len(edges) >= max_edges:
|
|
142
|
+
break
|
|
143
|
+
|
|
144
|
+
# Build nodes data
|
|
145
|
+
nodes: Dict[str, Dict] = {}
|
|
146
|
+
for fn in connected:
|
|
147
|
+
fi = result.functions.get(fn)
|
|
148
|
+
if fi:
|
|
149
|
+
cc = self._get_cc(fi)
|
|
150
|
+
nodes[fn] = {
|
|
151
|
+
'name': fi.name,
|
|
152
|
+
'module': fi.module,
|
|
153
|
+
'line': fi.line,
|
|
154
|
+
'cyclomatic_complexity': cc,
|
|
155
|
+
'calls_out': len(fi.calls),
|
|
156
|
+
'calls_in': sum(1 for f in result.functions.values() if fn in [self._resolve_callee(c, result.functions) for c in f.calls]),
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
# Group by module
|
|
160
|
+
modules: Dict[str, List[str]] = defaultdict(list)
|
|
161
|
+
for fn in connected:
|
|
162
|
+
fi = result.functions.get(fn)
|
|
163
|
+
if fi:
|
|
164
|
+
modules[fi.module].append(fn)
|
|
165
|
+
|
|
166
|
+
# Build output structure
|
|
167
|
+
calls_data = {
|
|
168
|
+
'project': result.project_path,
|
|
169
|
+
'generated_from': 'code2llm call graph analysis',
|
|
170
|
+
'stats': {
|
|
171
|
+
'total_nodes': len(nodes),
|
|
172
|
+
'total_edges': len(edges),
|
|
173
|
+
'modules_count': len(modules),
|
|
174
|
+
},
|
|
175
|
+
'nodes': nodes,
|
|
176
|
+
'edges': edges,
|
|
177
|
+
'modules': {mod: sorted(funcs) for mod, funcs in sorted(modules.items())},
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
# Add entry points if available
|
|
181
|
+
if result.entry_points:
|
|
182
|
+
calls_data['entry_points'] = sorted(result.entry_points)
|
|
183
|
+
|
|
184
|
+
Path(output_path).parent.mkdir(parents=True, exist_ok=True)
|
|
185
|
+
with open(output_path, 'w', encoding='utf-8') as f:
|
|
186
|
+
yaml.dump(calls_data, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
|
|
187
|
+
|
|
188
|
+
@staticmethod
|
|
189
|
+
def _resolve_callee(callee: str, funcs: Dict[str, FunctionInfo]) -> Optional[str]:
|
|
190
|
+
"""Resolve callee to a known qualified name."""
|
|
191
|
+
if callee in funcs:
|
|
192
|
+
return callee
|
|
193
|
+
candidates = [qn for qn in funcs if qn.endswith(f".{callee}")]
|
|
194
|
+
if len(candidates) == 1:
|
|
195
|
+
return candidates[0]
|
|
196
|
+
return None
|
|
197
|
+
|
|
198
|
+
@staticmethod
|
|
199
|
+
def _get_cc(fi: FunctionInfo) -> int:
|
|
200
|
+
"""Extract cyclomatic complexity from FunctionInfo."""
|
|
201
|
+
if isinstance(fi.complexity, dict):
|
|
202
|
+
return fi.complexity.get('cyclomatic_complexity', 0)
|
|
203
|
+
return fi.complexity or 0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code2llm
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.105
|
|
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
|
|
@@ -66,13 +66,13 @@ Dynamic: requires-python
|
|
|
66
66
|
|
|
67
67
|
## AI Cost Tracking
|
|
68
68
|
|
|
69
|
-
     
|
|
70
|
+
  
|
|
71
71
|
|
|
72
|
-
- 🤖 **LLM usage:** $7.5000 (
|
|
73
|
-
- 👤 **Human dev:** ~$
|
|
72
|
+
- 🤖 **LLM usage:** $7.5000 (154 commits)
|
|
73
|
+
- 👤 **Human dev:** ~$5373 (53.7h @ $100/h, 30min dedup)
|
|
74
74
|
|
|
75
|
-
Generated on 2026-
|
|
75
|
+
Generated on 2026-04-18 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)
|
|
76
76
|
|
|
77
77
|
---
|
|
78
78
|
|
|
@@ -400,8 +400,8 @@ code2llm ./ -f yaml --separate-orphans
|
|
|
400
400
|
---
|
|
401
401
|
|
|
402
402
|
**Generated by**: `code2llm ./ -f all --readme`
|
|
403
|
-
**Analysis Date**: 2026-
|
|
404
|
-
**Total Functions**:
|
|
403
|
+
**Analysis Date**: 2026-04-18
|
|
404
|
+
**Total Functions**: 1014
|
|
405
405
|
**Total Classes**: 111
|
|
406
406
|
**Modules**: 131
|
|
407
407
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "code2llm"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.105"
|
|
8
8
|
description = "High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"""PHP analyzer (regex-based)."""
|
|
2
|
-
|
|
3
|
-
import re
|
|
4
|
-
from typing import Dict
|
|
5
|
-
|
|
6
|
-
from code2llm.core.models import ClassInfo, FunctionInfo, ModuleInfo
|
|
7
|
-
from code2llm.core.lang.base import calculate_complexity_regex, extract_calls_regex, _extract_declarations
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def analyze_php(content: str, file_path: str, module_name: str,
|
|
11
|
-
ext: str, stats: Dict) -> Dict:
|
|
12
|
-
"""Analyze PHP files using shared extraction."""
|
|
13
|
-
|
|
14
|
-
# PHP-specific patterns
|
|
15
|
-
patterns = {
|
|
16
|
-
'import': re.compile(r'^(?:include|require|include_once|require_once)\s*["\']([^"\']+)["\']'),
|
|
17
|
-
'class': re.compile(
|
|
18
|
-
r'(?:abstract\s+|final\s+)?class\s+(\w+)(?:\s+extends\s+(\w+))?(?:\s+implements\s+([\w,\s\\]+))?'
|
|
19
|
-
),
|
|
20
|
-
'interface': re.compile(r'interface\s+(\w+)'),
|
|
21
|
-
'function': re.compile(
|
|
22
|
-
r'(?:public\s+|private\s+|protected\s+)?(?:static\s+)?function\s+(\w+)\s*\('
|
|
23
|
-
),
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
# Language configuration
|
|
27
|
-
lang_config = {
|
|
28
|
-
'index_files': (),
|
|
29
|
-
'brace_track': True,
|
|
30
|
-
'reserved': {'if', 'for', 'while', 'switch', 'return', 'catch', 'echo', 'print'},
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
# Use shared extraction
|
|
34
|
-
result = _extract_declarations(
|
|
35
|
-
content, file_path, module_name,
|
|
36
|
-
patterns, stats, lang_config
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
# PHP-specific: handle namespaces and adjust qualified names
|
|
40
|
-
lines = content.split('\n')
|
|
41
|
-
current_namespace = None
|
|
42
|
-
in_php = False
|
|
43
|
-
|
|
44
|
-
for line in lines:
|
|
45
|
-
line = line.strip()
|
|
46
|
-
if line.startswith('<?php') or line.startswith('<?'):
|
|
47
|
-
in_php = True
|
|
48
|
-
continue
|
|
49
|
-
if line == '?>':
|
|
50
|
-
in_php = False
|
|
51
|
-
continue
|
|
52
|
-
if not in_php:
|
|
53
|
-
continue
|
|
54
|
-
|
|
55
|
-
ns_match = re.match(r'^namespace\s+([\\\w]+)', line)
|
|
56
|
-
if ns_match:
|
|
57
|
-
current_namespace = ns_match.group(1)
|
|
58
|
-
continue
|
|
59
|
-
|
|
60
|
-
use_match = re.match(r'^use\s+([\\\w]+)', line)
|
|
61
|
-
if use_match:
|
|
62
|
-
result['module'].imports.append(use_match.group(1))
|
|
63
|
-
continue
|
|
64
|
-
|
|
65
|
-
# Adjust qualified names for namespaces
|
|
66
|
-
if current_namespace:
|
|
67
|
-
ns_prefix = f".{current_namespace}"
|
|
68
|
-
new_classes = {}
|
|
69
|
-
for qname, cls in list(result['classes'].items()):
|
|
70
|
-
new_qname = qname.replace(f"{module_name}.", f"{module_name}{ns_prefix}.", 1)
|
|
71
|
-
cls.qualified_name = new_qname
|
|
72
|
-
new_classes[new_qname] = cls
|
|
73
|
-
result['classes'] = new_classes
|
|
74
|
-
result['module'].classes = list(new_classes.keys())
|
|
75
|
-
|
|
76
|
-
new_functions = {}
|
|
77
|
-
for qname, func in list(result['functions'].items()):
|
|
78
|
-
new_qname = qname.replace(f"{module_name}.", f"{module_name}{ns_prefix}.", 1)
|
|
79
|
-
func.qualified_name = new_qname
|
|
80
|
-
new_functions[new_qname] = func
|
|
81
|
-
result['functions'] = new_functions
|
|
82
|
-
result['module'].functions = list(new_functions.keys())
|
|
83
|
-
|
|
84
|
-
# Handle traits as classes
|
|
85
|
-
trait_pattern = re.compile(r'^\s*trait\s+(\w+)')
|
|
86
|
-
for line_no, line in enumerate(lines, 1):
|
|
87
|
-
tm = trait_pattern.match(line.strip())
|
|
88
|
-
if tm:
|
|
89
|
-
tname = tm.group(1)
|
|
90
|
-
if current_namespace:
|
|
91
|
-
qual = f"{module_name}.{current_namespace}.{tname}"
|
|
92
|
-
else:
|
|
93
|
-
qual = f"{module_name}.{tname}"
|
|
94
|
-
result['classes'][qual] = ClassInfo(
|
|
95
|
-
name=tname, qualified_name=qual,
|
|
96
|
-
file=file_path, line=line_no, module=module_name,
|
|
97
|
-
bases=[], methods=[], docstring="",
|
|
98
|
-
)
|
|
99
|
-
result['module'].classes.append(qual)
|
|
100
|
-
stats['classes_found'] += 1
|
|
101
|
-
|
|
102
|
-
calculate_complexity_regex(content, result, lang='c_family')
|
|
103
|
-
extract_calls_regex(content, module_name, result)
|
|
104
|
-
|
|
105
|
-
stats['files_processed'] += 1
|
|
106
|
-
return result
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|