code2logic 1.0.43__tar.gz → 1.0.44__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.
Files changed (59) hide show
  1. {code2logic-1.0.43 → code2logic-1.0.44}/PKG-INFO +50 -37
  2. {code2logic-1.0.43 → code2logic-1.0.44}/README.md +49 -36
  3. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/__init__.py +1 -1
  4. {code2logic-1.0.43 → code2logic-1.0.44}/pyproject.toml +1 -1
  5. {code2logic-1.0.43 → code2logic-1.0.44}/LICENSE +0 -0
  6. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/__main__.py +0 -0
  7. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/adaptive.py +0 -0
  8. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/analyzer.py +0 -0
  9. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/base.py +0 -0
  10. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/base_generator.py +0 -0
  11. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/benchmark.py +0 -0
  12. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/benchmarks/__init__.py +0 -0
  13. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/benchmarks/common.py +0 -0
  14. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/benchmarks/results.py +0 -0
  15. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/benchmarks/runner.py +0 -0
  16. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/chunked_reproduction.py +0 -0
  17. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/cli.py +0 -0
  18. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/code_review.py +0 -0
  19. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/config.py +0 -0
  20. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/core/__init__.py +0 -0
  21. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/dependency.py +0 -0
  22. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/errors.py +0 -0
  23. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/file_formats.py +0 -0
  24. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/formats/__init__.py +0 -0
  25. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/function_logic.py +0 -0
  26. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/generators.py +0 -0
  27. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/gherkin.py +0 -0
  28. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/integrations/__init__.py +0 -0
  29. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/intent.py +0 -0
  30. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/llm/__init__.py +0 -0
  31. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/llm.py +0 -0
  32. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/llm_clients.py +0 -0
  33. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/llm_profiler.py +0 -0
  34. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/logicml.py +0 -0
  35. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/markdown_format.py +0 -0
  36. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/mcp_server.py +0 -0
  37. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/metrics.py +0 -0
  38. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/models.py +0 -0
  39. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/parsers.py +0 -0
  40. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/project_comparison.md +0 -0
  41. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/project_reproducer.py +0 -0
  42. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/prompts.py +0 -0
  43. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/py.typed +0 -0
  44. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/quality.py +0 -0
  45. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/refactor.py +0 -0
  46. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/reproducer.py +0 -0
  47. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/reproduction.py +0 -0
  48. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/schemas/__init__.py +0 -0
  49. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/schemas/json_schema.py +0 -0
  50. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/schemas/logicml_schema.py +0 -0
  51. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/schemas/markdown_schema.py +0 -0
  52. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/schemas/yaml_schema.py +0 -0
  53. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/shared_utils.py +0 -0
  54. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/similarity.py +0 -0
  55. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/terminal.py +0 -0
  56. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/tools/__init__.py +0 -0
  57. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/toon_format.py +0 -0
  58. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/universal.py +0 -0
  59. {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code2logic
3
- Version: 1.0.43
3
+ Version: 1.0.44
4
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
6
  License-File: LICENSE
@@ -94,10 +94,18 @@ pip install code2logic[nlp] # Enhanced intents
94
94
 
95
95
  ## 📖 Quick Start
96
96
  ```bash
97
- code2logic ./ -f yaml --compact --function-logic --with-schema -o project.yaml
98
- code2logic ./ -f toon --function-logic function.toon --with-schema --name project -o ./
99
- # Optional: include function intent/purpose column in function.toon
100
- code2logic ./ -f toon --function-logic function.toon --does --name project -o ./
97
+ # TOON compact (best token efficiency 5.9x smaller than JSON)
98
+ code2logic ./ -f toon --compact --name project -o ./
99
+
100
+ # TOON with function-logic + structural context
101
+ code2logic ./ -f toon --compact --no-repeat-module \
102
+ --function-logic function.toon --function-logic-context minimal --name project -o ./
103
+
104
+ # TOON-Hybrid (project structure + function details for hub modules)
105
+ code2logic ./ -f toon --hybrid --no-repeat-module --name project -o ./
106
+
107
+ # YAML compact (human-readable, good compromise)
108
+ code2logic ./ -f yaml --compact --name project -o ./
101
109
  ```
102
110
 
103
111
  ### Command Line
@@ -312,14 +320,20 @@ Similar Functions:
312
320
 
313
321
  ```text
314
322
  code2logic/
315
- ├── analyzer.py # Main orchestrator
316
- ├── parsers.py # Tree-sitter + fallback parser
317
- ├── dependency.py # NetworkX dependency analysis
318
- ├── similarity.py # Rapidfuzz similar detection
319
- ├── intent.py # NLP intent generation
320
- ├── generators.py # Output generators (MD/Compact/JSON)
321
- ├── models.py # Data structures
322
- └── cli.py # Command-line interface
323
+ ├── analyzer.py # Main orchestrator
324
+ ├── parsers.py # Tree-sitter + fallback parser
325
+ ├── dependency.py # NetworkX dependency analysis
326
+ ├── similarity.py # Rapidfuzz similar detection
327
+ ├── intent.py # NLP intent generation
328
+ ├── generators.py # Output generators (MD/Compact/JSON/YAML/CSV)
329
+ ├── toon_format.py # TOON generator (compact, hybrid)
330
+ ├── logicml.py # LogicML generator (typed signatures)
331
+ ├── function_logic.py # Function-logic TOON with structural context
332
+ ├── metrics.py # AST-based quality metrics
333
+ ├── models.py # Data structures
334
+ ├── cli.py # Command-line interface
335
+ ├── benchmarks/ # Benchmark runner, results, common utils
336
+ └── llm_clients.py # Unified LLM client (OpenRouter/Ollama/LiteLLM)
323
337
  ```
324
338
 
325
339
  ## 🔌 Integration Examples
@@ -415,40 +429,39 @@ Compact format is ~10-15x smaller than Markdown.
415
429
 
416
430
  ## 🔬 Code Reproduction Benchmarks
417
431
 
418
- Code2Logic can reproduce code from specifications using LLMs. Benchmark results:
432
+ Benchmark results (20 files, model: `arcee-ai/trinity-large-preview`, 2026-02-25):
419
433
 
420
- ### Format Comparison (Token Efficiency)
434
+ ### Project Benchmark — Format Comparison
421
435
 
422
- | Format | Score | Token Efficiency | Spec Tokens | Runs OK |
423
- | --- | --- | --- | --- | --- |
424
- | **YAML** | **71.1%** | 42.1 | **366** | 66.7% |
425
- | **Markdown** | 65.6% | **48.7** | 385 | **100%** |
426
- | JSON | 61.9% | 23.7 | 605 | 66.7% |
427
- | Gherkin | 51.3% | 19.1 | 411 | 66.7% |
436
+ | Format | Score | Syntax OK | Runs OK | ~Tokens | Efficiency (p/kT) |
437
+ |--------|------:|----------:|--------:|--------:|---------:|
438
+ | **toon** | **63,8%** | 100% | 60% | 17 875 | **3,57** |
439
+ | json | 62,9% | 100% | 60% | 104 914 | 0,60 |
440
+ | markdown | 62,5% | 100% | 55% | 36 851 | 1,70 |
441
+ | yaml | 62,4% | 100% | 55% | 68 651 | 0,91 |
442
+ | logicml | 60,4% | 100% | 55% | ~30 000 | ~2,01 |
443
+ | csv | 53,0% | 100% | 40% | 80 779 | 0,66 |
444
+ | function.toon | 49,3% | 95% | 35% | 29 271 | 1,68 |
445
+ | gherkin | 38,6% | 95% | 30% | ~25 000 | ~1,54 |
446
+
447
+ **Behavioral benchmark:** 85,7% (6/7 functions passed).
428
448
 
429
449
  ### Key Findings
430
450
 
431
- - **YAML is best for score** - 71.1% reproduction accuracy
432
- - **Markdown is best for token efficiency** - 48.7 score/1000 tokens
433
- - **YAML uses 39.6% fewer tokens than JSON** with 9.2% higher score
434
- - **Markdown has 100% runs OK** - generated code always executes
451
+ - **TOON wins on efficiency** — best score (63,8%) at 5,9x fewer tokens than JSON
452
+ - **Syntax OK = 100%** for all major formats LLM always generates valid syntax
453
+ - **function.toon paradox** — worse than project.toon despite larger file, due to missing class/module context (fixed in v1.0.43 with `--function-logic-context`)
454
+ - **gherkin/csv** poor fit for code description, their structure doesn't map to programming constructs
435
455
 
436
456
  ### Run Benchmarks
437
457
 
438
458
  ```bash
439
- # Token-aware benchmark
440
- python examples/11_token_benchmark.py --folder tests/samples/ --no-llm
441
-
442
- # Async multi-format benchmark
443
- python examples/09_async_benchmark.py --folder tests/samples/ --no-llm
444
-
445
- # Function-level reproduction
446
- python examples/10_function_reproduction.py --file tests/samples/sample_functions.py --no-llm
447
-
448
- python examples/15_unified_benchmark.py --folder tests/samples/ --no-llm
459
+ make benchmark # Full benchmark suite (requires OPENROUTER_API_KEY)
449
460
 
450
- # Terminal markdown rendering demo
451
- python examples/16_terminal_demo.py --folder tests/samples/
461
+ # Or individually:
462
+ python examples/15_unified_benchmark.py --type format --folder tests/samples/ --limit 20
463
+ python examples/15_unified_benchmark.py --type project --folder tests/samples/ --limit 20
464
+ python examples/15_unified_benchmark.py --type function --file tests/samples/sample_functions.py
452
465
  ```
453
466
 
454
467
  ## 🤝 Contributing
@@ -48,10 +48,18 @@ pip install code2logic[nlp] # Enhanced intents
48
48
 
49
49
  ## 📖 Quick Start
50
50
  ```bash
51
- code2logic ./ -f yaml --compact --function-logic --with-schema -o project.yaml
52
- code2logic ./ -f toon --function-logic function.toon --with-schema --name project -o ./
53
- # Optional: include function intent/purpose column in function.toon
54
- code2logic ./ -f toon --function-logic function.toon --does --name project -o ./
51
+ # TOON compact (best token efficiency 5.9x smaller than JSON)
52
+ code2logic ./ -f toon --compact --name project -o ./
53
+
54
+ # TOON with function-logic + structural context
55
+ code2logic ./ -f toon --compact --no-repeat-module \
56
+ --function-logic function.toon --function-logic-context minimal --name project -o ./
57
+
58
+ # TOON-Hybrid (project structure + function details for hub modules)
59
+ code2logic ./ -f toon --hybrid --no-repeat-module --name project -o ./
60
+
61
+ # YAML compact (human-readable, good compromise)
62
+ code2logic ./ -f yaml --compact --name project -o ./
55
63
  ```
56
64
 
57
65
  ### Command Line
@@ -266,14 +274,20 @@ Similar Functions:
266
274
 
267
275
  ```text
268
276
  code2logic/
269
- ├── analyzer.py # Main orchestrator
270
- ├── parsers.py # Tree-sitter + fallback parser
271
- ├── dependency.py # NetworkX dependency analysis
272
- ├── similarity.py # Rapidfuzz similar detection
273
- ├── intent.py # NLP intent generation
274
- ├── generators.py # Output generators (MD/Compact/JSON)
275
- ├── models.py # Data structures
276
- └── cli.py # Command-line interface
277
+ ├── analyzer.py # Main orchestrator
278
+ ├── parsers.py # Tree-sitter + fallback parser
279
+ ├── dependency.py # NetworkX dependency analysis
280
+ ├── similarity.py # Rapidfuzz similar detection
281
+ ├── intent.py # NLP intent generation
282
+ ├── generators.py # Output generators (MD/Compact/JSON/YAML/CSV)
283
+ ├── toon_format.py # TOON generator (compact, hybrid)
284
+ ├── logicml.py # LogicML generator (typed signatures)
285
+ ├── function_logic.py # Function-logic TOON with structural context
286
+ ├── metrics.py # AST-based quality metrics
287
+ ├── models.py # Data structures
288
+ ├── cli.py # Command-line interface
289
+ ├── benchmarks/ # Benchmark runner, results, common utils
290
+ └── llm_clients.py # Unified LLM client (OpenRouter/Ollama/LiteLLM)
277
291
  ```
278
292
 
279
293
  ## 🔌 Integration Examples
@@ -369,40 +383,39 @@ Compact format is ~10-15x smaller than Markdown.
369
383
 
370
384
  ## 🔬 Code Reproduction Benchmarks
371
385
 
372
- Code2Logic can reproduce code from specifications using LLMs. Benchmark results:
386
+ Benchmark results (20 files, model: `arcee-ai/trinity-large-preview`, 2026-02-25):
373
387
 
374
- ### Format Comparison (Token Efficiency)
388
+ ### Project Benchmark — Format Comparison
375
389
 
376
- | Format | Score | Token Efficiency | Spec Tokens | Runs OK |
377
- | --- | --- | --- | --- | --- |
378
- | **YAML** | **71.1%** | 42.1 | **366** | 66.7% |
379
- | **Markdown** | 65.6% | **48.7** | 385 | **100%** |
380
- | JSON | 61.9% | 23.7 | 605 | 66.7% |
381
- | Gherkin | 51.3% | 19.1 | 411 | 66.7% |
390
+ | Format | Score | Syntax OK | Runs OK | ~Tokens | Efficiency (p/kT) |
391
+ |--------|------:|----------:|--------:|--------:|---------:|
392
+ | **toon** | **63,8%** | 100% | 60% | 17 875 | **3,57** |
393
+ | json | 62,9% | 100% | 60% | 104 914 | 0,60 |
394
+ | markdown | 62,5% | 100% | 55% | 36 851 | 1,70 |
395
+ | yaml | 62,4% | 100% | 55% | 68 651 | 0,91 |
396
+ | logicml | 60,4% | 100% | 55% | ~30 000 | ~2,01 |
397
+ | csv | 53,0% | 100% | 40% | 80 779 | 0,66 |
398
+ | function.toon | 49,3% | 95% | 35% | 29 271 | 1,68 |
399
+ | gherkin | 38,6% | 95% | 30% | ~25 000 | ~1,54 |
400
+
401
+ **Behavioral benchmark:** 85,7% (6/7 functions passed).
382
402
 
383
403
  ### Key Findings
384
404
 
385
- - **YAML is best for score** - 71.1% reproduction accuracy
386
- - **Markdown is best for token efficiency** - 48.7 score/1000 tokens
387
- - **YAML uses 39.6% fewer tokens than JSON** with 9.2% higher score
388
- - **Markdown has 100% runs OK** - generated code always executes
405
+ - **TOON wins on efficiency** — best score (63,8%) at 5,9x fewer tokens than JSON
406
+ - **Syntax OK = 100%** for all major formats LLM always generates valid syntax
407
+ - **function.toon paradox** — worse than project.toon despite larger file, due to missing class/module context (fixed in v1.0.43 with `--function-logic-context`)
408
+ - **gherkin/csv** poor fit for code description, their structure doesn't map to programming constructs
389
409
 
390
410
  ### Run Benchmarks
391
411
 
392
412
  ```bash
393
- # Token-aware benchmark
394
- python examples/11_token_benchmark.py --folder tests/samples/ --no-llm
395
-
396
- # Async multi-format benchmark
397
- python examples/09_async_benchmark.py --folder tests/samples/ --no-llm
398
-
399
- # Function-level reproduction
400
- python examples/10_function_reproduction.py --file tests/samples/sample_functions.py --no-llm
401
-
402
- python examples/15_unified_benchmark.py --folder tests/samples/ --no-llm
413
+ make benchmark # Full benchmark suite (requires OPENROUTER_API_KEY)
403
414
 
404
- # Terminal markdown rendering demo
405
- python examples/16_terminal_demo.py --folder tests/samples/
415
+ # Or individually:
416
+ python examples/15_unified_benchmark.py --type format --folder tests/samples/ --limit 20
417
+ python examples/15_unified_benchmark.py --type project --folder tests/samples/ --limit 20
418
+ python examples/15_unified_benchmark.py --type function --file tests/samples/sample_functions.py
406
419
  ```
407
420
 
408
421
  ## 🤝 Contributing
@@ -18,7 +18,7 @@ Example:
18
18
  >>> print(output)
19
19
  """
20
20
 
21
- __version__ = "1.0.43"
21
+ __version__ = "1.0.44"
22
22
  __author__ = "Softreck"
23
23
  __email__ = "info@softreck.dev"
24
24
  __license__ = "MIT"
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "code2logic"
7
- version = "1.0.43"
7
+ version = "1.0.44"
8
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"
File without changes