code2logic 1.0.30__tar.gz → 1.0.34__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.
- {code2logic-1.0.30 → code2logic-1.0.34}/PKG-INFO +17 -14
- {code2logic-1.0.30 → code2logic-1.0.34}/README.md +9 -1
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/__init__.py +1 -1
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/cli.py +40 -7
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/config.py +8 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/generators.py +23 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/parsers.py +122 -24
- code2logic-1.0.34/code2logic/project_comparison.md +16 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/pyproject.toml +8 -18
- {code2logic-1.0.30 → code2logic-1.0.34}/LICENSE +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/__main__.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/adaptive.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/analyzer.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/base.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/benchmark.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/benchmarks/__init__.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/benchmarks/common.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/benchmarks/results.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/benchmarks/runner.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/chunked_reproduction.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/code_review.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/core/__init__.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/dependency.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/errors.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/file_formats.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/formats/__init__.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/function_logic.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/gherkin.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/integrations/__init__.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/intent.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/llm/__init__.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/llm.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/llm_clients.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/llm_clients_new.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/llm_profiler.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/logicml.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/markdown_format.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/mcp_server.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/metrics.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/models.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/project_reproducer.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/prompts.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/py.typed +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/quality.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/refactor.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/reproducer.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/reproduction.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/schemas/__init__.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/schemas/json_schema.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/schemas/logicml_schema.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/schemas/markdown_schema.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/schemas/yaml_schema.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/shared_utils.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/similarity.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/terminal.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/tools/__init__.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/toon_format.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/universal.py +0 -0
- {code2logic-1.0.30 → code2logic-1.0.34}/code2logic/utils.py +0 -0
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: code2logic
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 1.0.34
|
|
4
|
+
Summary: Code2Logic - Source code to logical representation converter for LLM analysis, featuring Tree-sitter parsing, dependency graph analysis, and multi-language support.
|
|
5
5
|
License: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
6
7
|
Keywords: code-analysis,llm,ast,static-analysis,tree-sitter,code-understanding,documentation,dependency-graph,nlp
|
|
7
8
|
Author: Softreck
|
|
8
|
-
Author-email:
|
|
9
|
+
Author-email: tom@sapletta.com
|
|
9
10
|
Maintainer: Softreck
|
|
10
|
-
Maintainer-email:
|
|
11
|
+
Maintainer-email: tom@sapletta.com
|
|
11
12
|
Requires-Python: >=3.9,<4.0
|
|
12
|
-
Classifier: Development Status ::
|
|
13
|
-
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
-
Classifier: Operating System :: OS Independent
|
|
17
16
|
Classifier: Programming Language :: Python :: 3
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
-
Classifier:
|
|
24
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
-
Classifier: Topic :: Software Development :: Quality Assurance
|
|
26
|
-
Classifier: Topic :: Text Processing :: Linguistic
|
|
27
|
-
Classifier: Typing :: Typed
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
28
23
|
Provides-Extra: full
|
|
29
24
|
Provides-Extra: graph
|
|
30
25
|
Provides-Extra: llm
|
|
@@ -57,7 +52,7 @@ Description-Content-Type: text/markdown
|
|
|
57
52
|
|
|
58
53
|
[](https://badge.fury.io/py/code2logic)
|
|
59
54
|
[](https://www.python.org/downloads/)
|
|
60
|
-
[](https://opensource.org/licenses/Apache-2.0)
|
|
61
56
|
|
|
62
57
|
|
|
63
58
|
**Convert source code to logical representation for LLM analysis.**
|
|
@@ -561,3 +556,11 @@ python -m logic2code out/code2logic/project.c2l.yaml -o out/logic2code/generated
|
|
|
561
556
|
- [GitHub](https://github.com/wronai/code2logic)
|
|
562
557
|
- [Issues](https://github.com/wronai/code2logic/issues)
|
|
563
558
|
|
|
559
|
+
## License
|
|
560
|
+
|
|
561
|
+
Apache License 2.0 - see [LICENSE](LICENSE) for details.
|
|
562
|
+
|
|
563
|
+
## Author
|
|
564
|
+
|
|
565
|
+
Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
|
|
566
|
+
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://badge.fury.io/py/code2logic)
|
|
8
8
|
[](https://www.python.org/downloads/)
|
|
9
|
-
[](https://opensource.org/licenses/Apache-2.0)
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
**Convert source code to logical representation for LLM analysis.**
|
|
@@ -509,3 +509,11 @@ python -m logic2code out/code2logic/project.c2l.yaml -o out/logic2code/generated
|
|
|
509
509
|
- [PyPI](https://pypi.org/project/code2logic/)
|
|
510
510
|
- [GitHub](https://github.com/wronai/code2logic)
|
|
511
511
|
- [Issues](https://github.com/wronai/code2logic/issues)
|
|
512
|
+
|
|
513
|
+
## License
|
|
514
|
+
|
|
515
|
+
Apache License 2.0 - see [LICENSE](LICENSE) for details.
|
|
516
|
+
|
|
517
|
+
## Author
|
|
518
|
+
|
|
519
|
+
Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
|
|
@@ -608,6 +608,11 @@ code2logic [path] [options]
|
|
|
608
608
|
'-o', '--output',
|
|
609
609
|
help='Output file path (default: stdout)'
|
|
610
610
|
)
|
|
611
|
+
parser.add_argument(
|
|
612
|
+
'--name',
|
|
613
|
+
dest='project_name',
|
|
614
|
+
help='Project name for output files (default: from CODE2LOGIC_PROJECT_NAME env or "project"). Used for auto-generating output, schema, and function-logic file names.'
|
|
615
|
+
)
|
|
611
616
|
parser.add_argument(
|
|
612
617
|
'--function-logic',
|
|
613
618
|
nargs='?',
|
|
@@ -725,6 +730,7 @@ code2logic [path] [options]
|
|
|
725
730
|
|
|
726
731
|
# Import after potential installation
|
|
727
732
|
from .analyzer import ProjectAnalyzer, get_library_status
|
|
733
|
+
from .config import Config
|
|
728
734
|
from .function_logic import FunctionLogicGenerator
|
|
729
735
|
from .generators import (
|
|
730
736
|
CSVGenerator,
|
|
@@ -736,6 +742,9 @@ code2logic [path] [options]
|
|
|
736
742
|
from .logicml import LogicMLGenerator
|
|
737
743
|
from .toon_format import TOONGenerator
|
|
738
744
|
|
|
745
|
+
# Load config to get project name
|
|
746
|
+
config = Config()
|
|
747
|
+
|
|
739
748
|
# Status check
|
|
740
749
|
if args.status:
|
|
741
750
|
status = get_library_status()
|
|
@@ -844,6 +853,27 @@ code2logic [path] [options]
|
|
|
844
853
|
|
|
845
854
|
log.separator()
|
|
846
855
|
|
|
856
|
+
# Get project name: CLI arg > env var > default
|
|
857
|
+
project_name = args.project_name if args.project_name else config.get_project_name()
|
|
858
|
+
|
|
859
|
+
# Determine default output path when using --function-logic or --with-schema without -o
|
|
860
|
+
default_output = None
|
|
861
|
+
if (args.function_logic or args.with_schema) and not args.output:
|
|
862
|
+
# Use project name with appropriate extension
|
|
863
|
+
ext_map = {
|
|
864
|
+
'markdown': 'md',
|
|
865
|
+
'compact': 'txt',
|
|
866
|
+
'json': 'json',
|
|
867
|
+
'yaml': 'yaml',
|
|
868
|
+
'hybrid': 'yaml',
|
|
869
|
+
'csv': 'csv',
|
|
870
|
+
'gherkin': 'feature',
|
|
871
|
+
'toon': 'toon',
|
|
872
|
+
'logicml': 'logicml',
|
|
873
|
+
}
|
|
874
|
+
ext = ext_map.get(args.format, args.format)
|
|
875
|
+
default_output = f"{project_name}.{ext}"
|
|
876
|
+
|
|
847
877
|
# Generate output
|
|
848
878
|
if args.verbose:
|
|
849
879
|
log.step(f"Generating {args.format} output (detail: {args.detail})")
|
|
@@ -883,7 +913,8 @@ code2logic [path] [options]
|
|
|
883
913
|
schema = generator.generate_schema('hybrid')
|
|
884
914
|
else:
|
|
885
915
|
schema = generator.generate_schema('compact' if compact else 'full')
|
|
886
|
-
|
|
916
|
+
effective_output = args.output or default_output
|
|
917
|
+
base_name = os.path.splitext(effective_output)[0] if effective_output else project_name
|
|
887
918
|
schema_path = f"{base_name}.yaml-schema.json"
|
|
888
919
|
parent_dir = os.path.dirname(schema_path)
|
|
889
920
|
if parent_dir:
|
|
@@ -916,7 +947,8 @@ code2logic [path] [options]
|
|
|
916
947
|
if args.with_schema:
|
|
917
948
|
schema_type = 'ultra_compact' if use_ultra_compact else 'standard'
|
|
918
949
|
schema = generator.generate_schema(schema_type)
|
|
919
|
-
|
|
950
|
+
effective_output = args.output or default_output
|
|
951
|
+
base_name = os.path.splitext(effective_output)[0] if effective_output else project_name
|
|
920
952
|
schema_path = f"{base_name}.toon-schema.json"
|
|
921
953
|
parent_dir = os.path.dirname(schema_path)
|
|
922
954
|
if parent_dir:
|
|
@@ -940,18 +972,19 @@ code2logic [path] [options]
|
|
|
940
972
|
|
|
941
973
|
# Auto-generate path if 'auto' was specified (--function-logic without argument)
|
|
942
974
|
if args.function_logic == 'auto':
|
|
943
|
-
|
|
975
|
+
effective_output = args.output or default_output
|
|
976
|
+
if effective_output:
|
|
944
977
|
# Derive from output file: project.c2l.yaml -> project.functions.yaml
|
|
945
|
-
base =
|
|
978
|
+
base = effective_output.rsplit('.', 1)[0]
|
|
946
979
|
if base.endswith('.c2l'):
|
|
947
980
|
base = base[:-4]
|
|
948
|
-
ext =
|
|
981
|
+
ext = effective_output.rsplit('.', 1)[-1] if '.' in effective_output else 'logicml'
|
|
949
982
|
logic_path = f"{base}.functions.{ext}"
|
|
950
983
|
else:
|
|
951
|
-
# Default path based on format
|
|
984
|
+
# Default path based on format using project name from config
|
|
952
985
|
ext_map = {'json': 'json', 'yaml': 'yaml', 'toon': 'toon'}
|
|
953
986
|
ext = ext_map.get(args.format, 'logicml')
|
|
954
|
-
logic_path = f"
|
|
987
|
+
logic_path = f"{project_name}.functions.{ext}"
|
|
955
988
|
else:
|
|
956
989
|
logic_path = str(args.function_logic)
|
|
957
990
|
|
|
@@ -153,6 +153,14 @@ class Config:
|
|
|
153
153
|
"""Check if verbose mode is enabled."""
|
|
154
154
|
return os.environ.get('CODE2LOGIC_VERBOSE', '').lower() in ('true', '1', 'yes')
|
|
155
155
|
|
|
156
|
+
def get_project_name(self) -> str:
|
|
157
|
+
"""Get default project name for output files.
|
|
158
|
+
|
|
159
|
+
Returns:
|
|
160
|
+
Project name (default: 'project')
|
|
161
|
+
"""
|
|
162
|
+
return os.environ.get('CODE2LOGIC_PROJECT_NAME', 'project')
|
|
163
|
+
|
|
156
164
|
def get_cache_dir(self) -> Path:
|
|
157
165
|
"""Get cache directory path."""
|
|
158
166
|
cache_dir = os.environ.get('CODE2LOGIC_CACHE_DIR', '~/.code2logic/cache')
|
|
@@ -329,6 +329,18 @@ class CompactGenerator:
|
|
|
329
329
|
if hubs:
|
|
330
330
|
lines.append(f"HUBS: {' '.join(hubs[:5])}")
|
|
331
331
|
|
|
332
|
+
# Dependency edges (compact call flow for LLM)
|
|
333
|
+
deps = {k: v for k, v in project.dependency_graph.items() if v}
|
|
334
|
+
if deps:
|
|
335
|
+
lines.append("")
|
|
336
|
+
lines.append("DEPS:")
|
|
337
|
+
for src, targets in sorted(deps.items())[:20]:
|
|
338
|
+
short_src = Path(src).stem
|
|
339
|
+
short_targets = ','.join(Path(t).stem for t in targets[:5])
|
|
340
|
+
if len(targets) > 5:
|
|
341
|
+
short_targets += f"+{len(targets)-5}"
|
|
342
|
+
lines.append(f" {short_src}->{short_targets}")
|
|
343
|
+
|
|
332
344
|
lines.append("")
|
|
333
345
|
|
|
334
346
|
curr_dir = None
|
|
@@ -350,6 +362,17 @@ class CompactGenerator:
|
|
|
350
362
|
if fn_s:
|
|
351
363
|
parts.append(f"F:{fn_s}")
|
|
352
364
|
|
|
365
|
+
# Add method signatures with return types for classes
|
|
366
|
+
for c in m.classes[:3]:
|
|
367
|
+
pub_methods = [mt for mt in c.methods if not mt.is_private or mt.name == '__init__']
|
|
368
|
+
if pub_methods:
|
|
369
|
+
sigs = []
|
|
370
|
+
for mt in pub_methods[:6]:
|
|
371
|
+
p = ','.join(remove_self_from_params(mt.params or [])[:3])
|
|
372
|
+
ret = f"->{mt.return_type}" if mt.return_type else ""
|
|
373
|
+
sigs.append(f"{mt.name}({p}){ret}")
|
|
374
|
+
parts.append(f"{c.name}:{{{';'.join(sigs)}}}")
|
|
375
|
+
|
|
353
376
|
content = ' | '.join(parts) if parts else '-'
|
|
354
377
|
lines.append(f" {fn} ({m.lines_code}L) {content}")
|
|
355
378
|
|
|
@@ -2039,12 +2039,81 @@ class UniversalParser:
|
|
|
2039
2039
|
constants: List[str] = []
|
|
2040
2040
|
exports: List[str] = []
|
|
2041
2041
|
|
|
2042
|
+
def _get_or_create_class(name: str) -> ClassInfo:
|
|
2043
|
+
for c in classes:
|
|
2044
|
+
if c.name == name:
|
|
2045
|
+
return c
|
|
2046
|
+
c = ClassInfo(name=name)
|
|
2047
|
+
classes.append(c)
|
|
2048
|
+
return c
|
|
2049
|
+
|
|
2050
|
+
def _find_matching_brace(src: str, start_idx: int) -> int:
|
|
2051
|
+
depth = 0
|
|
2052
|
+
in_str = False
|
|
2053
|
+
str_ch = ''
|
|
2054
|
+
i = start_idx
|
|
2055
|
+
while i < len(src):
|
|
2056
|
+
ch = src[i]
|
|
2057
|
+
if in_str:
|
|
2058
|
+
if ch == '\\' and i + 1 < len(src):
|
|
2059
|
+
i += 2
|
|
2060
|
+
continue
|
|
2061
|
+
if ch == str_ch:
|
|
2062
|
+
in_str = False
|
|
2063
|
+
str_ch = ''
|
|
2064
|
+
i += 1
|
|
2065
|
+
continue
|
|
2066
|
+
if ch in ('\"', "'"):
|
|
2067
|
+
in_str = True
|
|
2068
|
+
str_ch = ch
|
|
2069
|
+
i += 1
|
|
2070
|
+
continue
|
|
2071
|
+
if ch == '{':
|
|
2072
|
+
depth += 1
|
|
2073
|
+
elif ch == '}':
|
|
2074
|
+
depth -= 1
|
|
2075
|
+
if depth == 0:
|
|
2076
|
+
return i
|
|
2077
|
+
i += 1
|
|
2078
|
+
return -1
|
|
2079
|
+
|
|
2080
|
+
def _parse_rust_fn(match: re.Match, *, is_method: bool) -> FunctionInfo:
|
|
2081
|
+
name = match.group('name')
|
|
2082
|
+
params_raw = (match.group('params') or '').strip()
|
|
2083
|
+
ret = (match.group('ret') or '').strip()
|
|
2084
|
+
sig = (match.group(0) or '')
|
|
2085
|
+
|
|
2086
|
+
params = [p.strip() for p in params_raw.split(',') if p.strip()]
|
|
2087
|
+
params = params[:8]
|
|
2088
|
+
|
|
2089
|
+
is_pub = bool(re.search(r'\bpub\b', sig))
|
|
2090
|
+
return FunctionInfo(
|
|
2091
|
+
name=name,
|
|
2092
|
+
params=params,
|
|
2093
|
+
return_type=ret,
|
|
2094
|
+
docstring=None,
|
|
2095
|
+
docstring_full=None,
|
|
2096
|
+
calls=[],
|
|
2097
|
+
raises=[],
|
|
2098
|
+
decorators=[],
|
|
2099
|
+
complexity=1,
|
|
2100
|
+
lines=1,
|
|
2101
|
+
is_async=False,
|
|
2102
|
+
is_static=False,
|
|
2103
|
+
is_classmethod=False,
|
|
2104
|
+
is_property=False,
|
|
2105
|
+
intent=self.intent_gen.generate(name),
|
|
2106
|
+
start_line=0,
|
|
2107
|
+
end_line=0,
|
|
2108
|
+
is_private=not is_pub,
|
|
2109
|
+
)
|
|
2110
|
+
|
|
2042
2111
|
for m in re.finditer(r'^use\s+([^;]+);', content, re.MULTILINE):
|
|
2043
2112
|
imports.append(m.group(1).strip())
|
|
2044
2113
|
|
|
2045
2114
|
for m in re.finditer(r'^(?:pub\s+)?struct\s+(\w+)', content, re.MULTILINE):
|
|
2046
2115
|
name = m.group(1)
|
|
2047
|
-
|
|
2116
|
+
_get_or_create_class(name)
|
|
2048
2117
|
types.append(TypeInfo(name=name, kind='struct', definition=''))
|
|
2049
2118
|
exports.append(name)
|
|
2050
2119
|
|
|
@@ -2058,35 +2127,64 @@ class UniversalParser:
|
|
|
2058
2127
|
types.append(TypeInfo(name=name, kind='trait', definition=''))
|
|
2059
2128
|
exports.append(name)
|
|
2060
2129
|
|
|
2061
|
-
for m in re.finditer(r'^(?:pub\s+)?
|
|
2130
|
+
for m in re.finditer(r'^(?:pub\s+)?type\s+(\w+)\s*=', content, re.MULTILINE):
|
|
2062
2131
|
name = m.group(1)
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
docstring=None,
|
|
2070
|
-
docstring_full=None,
|
|
2071
|
-
calls=[],
|
|
2072
|
-
raises=[],
|
|
2073
|
-
decorators=[],
|
|
2074
|
-
complexity=1,
|
|
2075
|
-
lines=1,
|
|
2076
|
-
is_async='async' in m.group(0),
|
|
2077
|
-
is_static=False,
|
|
2078
|
-
is_classmethod=False,
|
|
2079
|
-
is_property=False,
|
|
2080
|
-
intent=self.intent_gen.generate(name),
|
|
2081
|
-
start_line=0,
|
|
2082
|
-
end_line=0,
|
|
2083
|
-
is_private=False,
|
|
2084
|
-
))
|
|
2132
|
+
types.append(TypeInfo(name=name, kind='type', definition=''))
|
|
2133
|
+
exports.append(name)
|
|
2134
|
+
|
|
2135
|
+
for m in re.finditer(r'^(?:pub\s+)?mod\s+(\w+)\s*;', content, re.MULTILINE):
|
|
2136
|
+
name = m.group(1)
|
|
2137
|
+
types.append(TypeInfo(name=name, kind='module', definition=''))
|
|
2085
2138
|
exports.append(name)
|
|
2086
2139
|
|
|
2140
|
+
fn_pat = re.compile(
|
|
2141
|
+
r'^\s*(?P<sig>(?:pub(?:\([^)]*\))?\s+)?fn)\s+(?P<name>\w+)\s*\((?P<params>[^)]*)\)\s*(?:->\s*(?P<ret>[^\s{]+))?',
|
|
2142
|
+
re.MULTILINE,
|
|
2143
|
+
)
|
|
2144
|
+
|
|
2145
|
+
for m in fn_pat.finditer(content):
|
|
2146
|
+
functions.append(_parse_rust_fn(m, is_method=False))
|
|
2147
|
+
exports.append(m.group('name'))
|
|
2148
|
+
|
|
2149
|
+
impl_pat = re.compile(
|
|
2150
|
+
r'^impl\b[^\{]*\{',
|
|
2151
|
+
re.MULTILINE,
|
|
2152
|
+
)
|
|
2153
|
+
|
|
2154
|
+
for m in impl_pat.finditer(content):
|
|
2155
|
+
hdr = content[m.start():m.end()]
|
|
2156
|
+
type_name = ''
|
|
2157
|
+
m_for = re.search(r'\bfor\s+(\w+)\b', hdr)
|
|
2158
|
+
if m_for:
|
|
2159
|
+
type_name = m_for.group(1)
|
|
2160
|
+
else:
|
|
2161
|
+
m_type = re.search(r'^impl\b[^\{]*?\b(\w+)\b\s*\{', hdr)
|
|
2162
|
+
if m_type:
|
|
2163
|
+
type_name = m_type.group(1)
|
|
2164
|
+
|
|
2165
|
+
if not type_name:
|
|
2166
|
+
continue
|
|
2167
|
+
|
|
2168
|
+
open_idx = content.find('{', m.start(), m.end())
|
|
2169
|
+
if open_idx < 0:
|
|
2170
|
+
continue
|
|
2171
|
+
close_idx = _find_matching_brace(content, open_idx)
|
|
2172
|
+
if close_idx < 0:
|
|
2173
|
+
continue
|
|
2174
|
+
|
|
2175
|
+
body = content[open_idx + 1:close_idx]
|
|
2176
|
+
cls = _get_or_create_class(type_name)
|
|
2177
|
+
for fm in fn_pat.finditer(body):
|
|
2178
|
+
cls.methods.append(_parse_rust_fn(fm, is_method=True))
|
|
2179
|
+
|
|
2180
|
+
exports.append(type_name)
|
|
2181
|
+
|
|
2087
2182
|
for m in re.finditer(r'^(?:pub\s+)?const\s+([A-Z][A-Z0-9_]*)\b', content, re.MULTILINE):
|
|
2088
2183
|
constants.append(m.group(1))
|
|
2089
2184
|
|
|
2185
|
+
for m in re.finditer(r'^(?:pub\s+)?static\s+(?:mut\s+)?([A-Z][A-Z0-9_]*)\b', content, re.MULTILINE):
|
|
2186
|
+
constants.append(m.group(1))
|
|
2187
|
+
|
|
2090
2188
|
lines = content.split('\n')
|
|
2091
2189
|
return ModuleInfo(
|
|
2092
2190
|
path=filepath,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Project Comparison Analysis
|
|
2
|
+
|
|
3
|
+
Generated on: $(date)
|
|
4
|
+
|
|
5
|
+
## Project Statistics
|
|
6
|
+
|
|
7
|
+
| Project | Modules | Functions | Total Items | Main Language |
|
|
8
|
+
|---------|---------|-----------|-------------|---------------|
|
|
9
|
+
|
|
10
|
+
## Detailed Analysis
|
|
11
|
+
|
|
12
|
+
### Projects by Size (Total Items)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Projects by Language Distribution
|
|
16
|
+
|
|
@@ -4,12 +4,15 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "code2logic"
|
|
7
|
-
version = "1.0.
|
|
8
|
-
description = "
|
|
7
|
+
version = "1.0.34"
|
|
8
|
+
description = "Code2Logic - Source code to logical representation converter for LLM analysis, featuring Tree-sitter parsing, dependency graph analysis, and multi-language support."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
11
|
-
authors = [
|
|
12
|
-
|
|
11
|
+
authors = [
|
|
12
|
+
"Softreck <tom@sapletta.com>",
|
|
13
|
+
"Tom Sapletta <tom@sapletta.com>",
|
|
14
|
+
]
|
|
15
|
+
maintainers = ["Softreck <tom@sapletta.com>"]
|
|
13
16
|
keywords = [
|
|
14
17
|
"code-analysis",
|
|
15
18
|
"llm",
|
|
@@ -22,21 +25,8 @@ keywords = [
|
|
|
22
25
|
"nlp",
|
|
23
26
|
]
|
|
24
27
|
classifiers = [
|
|
25
|
-
"Development Status ::
|
|
26
|
-
"Environment :: Console",
|
|
28
|
+
"Development Status :: 3 - Alpha",
|
|
27
29
|
"Intended Audience :: Developers",
|
|
28
|
-
"License :: OSI Approved :: Apache Software License",
|
|
29
|
-
"Operating System :: OS Independent",
|
|
30
|
-
"Programming Language :: Python :: 3",
|
|
31
|
-
"Programming Language :: Python :: 3.9",
|
|
32
|
-
"Programming Language :: Python :: 3.10",
|
|
33
|
-
"Programming Language :: Python :: 3.11",
|
|
34
|
-
"Programming Language :: Python :: 3.12",
|
|
35
|
-
"Topic :: Software Development :: Documentation",
|
|
36
|
-
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
37
|
-
"Topic :: Software Development :: Quality Assurance",
|
|
38
|
-
"Topic :: Text Processing :: Linguistic",
|
|
39
|
-
"Typing :: Typed",
|
|
40
30
|
]
|
|
41
31
|
packages = [{ include = "code2logic" }]
|
|
42
32
|
|
|
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
|