@voodocs/cli 0.1.0
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.
- package/LICENSE +37 -0
- package/README.md +153 -0
- package/USAGE.md +314 -0
- package/cli.py +1340 -0
- package/examples/.cursorrules +437 -0
- package/examples/instructions/.claude/instructions.md +372 -0
- package/examples/instructions/.cursorrules +437 -0
- package/examples/instructions/.windsurfrules +437 -0
- package/examples/instructions/VOODOCS_INSTRUCTIONS.md +437 -0
- package/examples/math_example.py +41 -0
- package/examples/phase2_test.py +24 -0
- package/examples/test_compound_conditions.py +40 -0
- package/examples/test_math_example.py +186 -0
- package/lib/darkarts/README.md +115 -0
- package/lib/darkarts/__init__.py +16 -0
- package/lib/darkarts/annotations/__init__.py +34 -0
- package/lib/darkarts/annotations/parser.py +618 -0
- package/lib/darkarts/annotations/types.py +181 -0
- package/lib/darkarts/cli.py +128 -0
- package/lib/darkarts/core/__init__.py +32 -0
- package/lib/darkarts/core/interface.py +256 -0
- package/lib/darkarts/core/loader.py +231 -0
- package/lib/darkarts/core/plugin.py +215 -0
- package/lib/darkarts/core/registry.py +146 -0
- package/lib/darkarts/exceptions.py +51 -0
- package/lib/darkarts/parsers/typescript/dist/cli.d.ts +9 -0
- package/lib/darkarts/parsers/typescript/dist/cli.d.ts.map +1 -0
- package/lib/darkarts/parsers/typescript/dist/cli.js +69 -0
- package/lib/darkarts/parsers/typescript/dist/cli.js.map +1 -0
- package/lib/darkarts/parsers/typescript/dist/parser.d.ts +111 -0
- package/lib/darkarts/parsers/typescript/dist/parser.d.ts.map +1 -0
- package/lib/darkarts/parsers/typescript/dist/parser.js +365 -0
- package/lib/darkarts/parsers/typescript/dist/parser.js.map +1 -0
- package/lib/darkarts/parsers/typescript/package-lock.json +51 -0
- package/lib/darkarts/parsers/typescript/package.json +19 -0
- package/lib/darkarts/parsers/typescript/src/cli.ts +41 -0
- package/lib/darkarts/parsers/typescript/src/parser.ts +408 -0
- package/lib/darkarts/parsers/typescript/tsconfig.json +19 -0
- package/lib/darkarts/plugins/voodocs/__init__.py +379 -0
- package/lib/darkarts/plugins/voodocs/ai_native_plugin.py +151 -0
- package/lib/darkarts/plugins/voodocs/annotation_validator.py +280 -0
- package/lib/darkarts/plugins/voodocs/api_spec_generator.py +486 -0
- package/lib/darkarts/plugins/voodocs/documentation_generator.py +610 -0
- package/lib/darkarts/plugins/voodocs/html_exporter.py +260 -0
- package/lib/darkarts/plugins/voodocs/instruction_generator.py +706 -0
- package/lib/darkarts/plugins/voodocs/pdf_exporter.py +66 -0
- package/lib/darkarts/plugins/voodocs/test_generator.py +636 -0
- package/package.json +70 -0
- package/requirements.txt +13 -0
- package/templates/ci/github-actions.yml +73 -0
- package/templates/ci/gitlab-ci.yml +35 -0
- package/templates/ci/pre-commit-hook.sh +26 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Automated tests for math_example
|
|
3
|
+
Generated from @voodocs annotations
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
from hypothesis import given, strategies as st, assume
|
|
8
|
+
from hypothesis import settings, HealthCheck
|
|
9
|
+
from math_example import *
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TestAddPositive:
|
|
13
|
+
"""Tests for add_positive()"""
|
|
14
|
+
|
|
15
|
+
@given(x=st.integers(min_value=1), y=st.integers(min_value=1))
|
|
16
|
+
@settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
|
|
17
|
+
def test_property_based_add_positive(self, x, y):
|
|
18
|
+
"""Property-based test for add_positive()"""
|
|
19
|
+
# Assume preconditions hold
|
|
20
|
+
assume(x > 0)
|
|
21
|
+
assume(y > 0)
|
|
22
|
+
result = add_positive(x, y)
|
|
23
|
+
# Assert postconditions
|
|
24
|
+
|
|
25
|
+
def test_precondition_enforcement(self):
|
|
26
|
+
"""Test that add_positive() enforces its preconditions"""
|
|
27
|
+
# Precondition 1: x > 0
|
|
28
|
+
# Test violation: add_positive(x=0)
|
|
29
|
+
# Precondition 2: y > 0
|
|
30
|
+
# Test violation: add_positive(y=0)
|
|
31
|
+
# TODO: Implement specific precondition violation tests
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
def test_postconditions_hold(self):
|
|
35
|
+
"""Test that postconditions hold after add_positive() executes"""
|
|
36
|
+
# Postcondition 1: result > x
|
|
37
|
+
# Postcondition 2: result > y
|
|
38
|
+
# TODO: Call function with valid inputs and verify postconditions
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
def test_edge_cases(self):
|
|
42
|
+
"""Test edge cases for add_positive()"""
|
|
43
|
+
# Common edge cases to consider:
|
|
44
|
+
# - Empty inputs (empty strings, empty lists, None)
|
|
45
|
+
# - Boundary values (0, -1, max int, min int)
|
|
46
|
+
# - Special values (NaN, Infinity for numbers)
|
|
47
|
+
# TODO: Implement edge case tests based on function signature
|
|
48
|
+
pass
|
|
49
|
+
|
|
50
|
+
def test_performance(self):
|
|
51
|
+
"""Test performance characteristics of add_positive()"""
|
|
52
|
+
# Expected complexity: Time=O(1), Space=O(1)
|
|
53
|
+
import time
|
|
54
|
+
|
|
55
|
+
# TODO: Implement performance test
|
|
56
|
+
# Measure execution time for various input sizes
|
|
57
|
+
# Verify it matches the expected complexity
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
def test_happy_path(self):
|
|
61
|
+
"""Test normal execution of add_positive()"""
|
|
62
|
+
# Ensure all preconditions are met:
|
|
63
|
+
# - x > 0
|
|
64
|
+
# - y > 0
|
|
65
|
+
# result = add_positive(...) # TODO: Provide valid arguments
|
|
66
|
+
# Verify all postconditions hold:
|
|
67
|
+
# - result > x
|
|
68
|
+
# - result > y
|
|
69
|
+
pass
|
|
70
|
+
|
|
71
|
+
class TestFactorial:
|
|
72
|
+
"""Tests for factorial()"""
|
|
73
|
+
|
|
74
|
+
@given(n=st.integers(min_value=0))
|
|
75
|
+
@settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
|
|
76
|
+
def test_property_based_factorial(self, n):
|
|
77
|
+
"""Property-based test for factorial()"""
|
|
78
|
+
# Assume preconditions hold
|
|
79
|
+
assume(n >= 0)
|
|
80
|
+
result = factorial(n)
|
|
81
|
+
# Assert postconditions
|
|
82
|
+
assert result >= 1
|
|
83
|
+
|
|
84
|
+
def test_precondition_enforcement(self):
|
|
85
|
+
"""Test that factorial() enforces its preconditions"""
|
|
86
|
+
# Precondition 1: n >= 0
|
|
87
|
+
# TODO: Implement specific precondition violation tests
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
def test_postconditions_hold(self):
|
|
91
|
+
"""Test that postconditions hold after factorial() executes"""
|
|
92
|
+
# Postcondition 1: result >= 1
|
|
93
|
+
# assert result >= 1
|
|
94
|
+
# Postcondition 2: n = 0 β result = 1
|
|
95
|
+
# Postcondition 3: n > 0 β result = n * factorial(n-1)
|
|
96
|
+
# TODO: Call function with valid inputs and verify postconditions
|
|
97
|
+
pass
|
|
98
|
+
|
|
99
|
+
def test_error_case_1_n_0(self):
|
|
100
|
+
"""Test error case: n < 0"""
|
|
101
|
+
with pytest.raises(ValueError):
|
|
102
|
+
# Create condition: n < 0
|
|
103
|
+
factorial(...) # TODO: Provide arguments that trigger n < 0
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def test_edge_cases(self):
|
|
107
|
+
"""Test edge cases for factorial()"""
|
|
108
|
+
# Common edge cases to consider:
|
|
109
|
+
# - Empty inputs (empty strings, empty lists, None)
|
|
110
|
+
# - Boundary values (0, -1, max int, min int)
|
|
111
|
+
# - Special values (NaN, Infinity for numbers)
|
|
112
|
+
# TODO: Implement edge case tests based on function signature
|
|
113
|
+
pass
|
|
114
|
+
|
|
115
|
+
def test_performance(self):
|
|
116
|
+
"""Test performance characteristics of factorial()"""
|
|
117
|
+
# Expected complexity: Time=O(1), Space=O(1)
|
|
118
|
+
import time
|
|
119
|
+
|
|
120
|
+
# TODO: Implement performance test
|
|
121
|
+
# Measure execution time for various input sizes
|
|
122
|
+
# Verify it matches the expected complexity
|
|
123
|
+
pass
|
|
124
|
+
|
|
125
|
+
def test_happy_path(self):
|
|
126
|
+
"""Test normal execution of factorial()"""
|
|
127
|
+
# Ensure all preconditions are met:
|
|
128
|
+
# - n >= 0
|
|
129
|
+
# result = factorial(...) # TODO: Provide valid arguments
|
|
130
|
+
# Verify all postconditions hold:
|
|
131
|
+
# - result >= 1
|
|
132
|
+
# - n = 0 β result = 1
|
|
133
|
+
# - n > 0 β result = n * factorial(n-1)
|
|
134
|
+
pass
|
|
135
|
+
|
|
136
|
+
class TestFindMax:
|
|
137
|
+
"""Tests for find_max()"""
|
|
138
|
+
|
|
139
|
+
@given(st.data())
|
|
140
|
+
def test_property_based_find_max(self, data):
|
|
141
|
+
"""Property-based test for find_max()"""
|
|
142
|
+
# Assume preconditions hold
|
|
143
|
+
# result = find_max(...) # TODO: Provide appropriate arguments
|
|
144
|
+
pass # Remove this when implementing
|
|
145
|
+
|
|
146
|
+
def test_precondition_enforcement(self):
|
|
147
|
+
"""Test that find_max() enforces its preconditions"""
|
|
148
|
+
# Precondition 1: len(items) > 0
|
|
149
|
+
# TODO: Implement specific precondition violation tests
|
|
150
|
+
pass
|
|
151
|
+
|
|
152
|
+
def test_postconditions_hold(self):
|
|
153
|
+
"""Test that postconditions hold after find_max() executes"""
|
|
154
|
+
# Postcondition 1: result β items
|
|
155
|
+
# Postcondition 2: β x β items: result >= x
|
|
156
|
+
# TODO: Call function with valid inputs and verify postconditions
|
|
157
|
+
pass
|
|
158
|
+
|
|
159
|
+
def test_edge_cases(self):
|
|
160
|
+
"""Test edge cases for find_max()"""
|
|
161
|
+
# Common edge cases to consider:
|
|
162
|
+
# - Empty inputs (empty strings, empty lists, None)
|
|
163
|
+
# - Boundary values (0, -1, max int, min int)
|
|
164
|
+
# - Special values (NaN, Infinity for numbers)
|
|
165
|
+
# TODO: Implement edge case tests based on function signature
|
|
166
|
+
pass
|
|
167
|
+
|
|
168
|
+
def test_performance(self):
|
|
169
|
+
"""Test performance characteristics of find_max()"""
|
|
170
|
+
# Expected complexity: Time=O(1), Space=O(1)
|
|
171
|
+
import time
|
|
172
|
+
|
|
173
|
+
# TODO: Implement performance test
|
|
174
|
+
# Measure execution time for various input sizes
|
|
175
|
+
# Verify it matches the expected complexity
|
|
176
|
+
pass
|
|
177
|
+
|
|
178
|
+
def test_happy_path(self):
|
|
179
|
+
"""Test normal execution of find_max()"""
|
|
180
|
+
# Ensure all preconditions are met:
|
|
181
|
+
# - len(items) > 0
|
|
182
|
+
# result = find_max(...) # TODO: Provide valid arguments
|
|
183
|
+
# Verify all postconditions hold:
|
|
184
|
+
# - result β items
|
|
185
|
+
# - β x β items: result >= x
|
|
186
|
+
pass
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# DarkArts Execution Engine
|
|
2
|
+
|
|
3
|
+
**An execution engine that understands and executes mathematical notation directly.**
|
|
4
|
+
|
|
5
|
+
DarkArts bridges the gap between AI's natural mathematical reasoning and computational reality, allowing AI to express solutions in mathematics while getting executable results without writing code.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from darkarts import execute
|
|
13
|
+
|
|
14
|
+
# AI expresses in mathematical notation
|
|
15
|
+
result = execute("Find max x β β€βΊ where xΒ² + 5x + 6 < 100")
|
|
16
|
+
# β 8
|
|
17
|
+
|
|
18
|
+
# Verify
|
|
19
|
+
verify = execute("8Β² + 5(8) + 6")
|
|
20
|
+
# β 110
|
|
21
|
+
|
|
22
|
+
# Iterate
|
|
23
|
+
result = execute("Find max x β β€βΊ where xΒ² + 5x + 6 < 100 and x < 8")
|
|
24
|
+
# β 7
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Architecture
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
darkarts/
|
|
33
|
+
βββ parser/ # Mathematical notation parser
|
|
34
|
+
β βββ latex.py # LaTeX notation parser
|
|
35
|
+
β βββ unicode.py # Unicode symbol recognizer
|
|
36
|
+
β βββ natural.py # Natural language math parser
|
|
37
|
+
βββ executor/ # Execution engine
|
|
38
|
+
β βββ symbolic.py # SymPy integration
|
|
39
|
+
β βββ smt.py # Z3 constraint solver
|
|
40
|
+
β βββ router.py # Problem type router
|
|
41
|
+
βββ verifier/ # Verification system
|
|
42
|
+
β βββ checker.py # Solution verification
|
|
43
|
+
β βββ feedback.py # Error feedback
|
|
44
|
+
βββ tests/ # Test suite
|
|
45
|
+
βββ examples/ # Example problems
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Core Components
|
|
51
|
+
|
|
52
|
+
### 1. Parser
|
|
53
|
+
Understands mathematical notation:
|
|
54
|
+
- LaTeX: `x^2 + 5x + 6 < 100`
|
|
55
|
+
- Unicode: `xΒ² + 5x + 6 < 100`
|
|
56
|
+
- Natural: "x squared plus 5x plus 6 less than 100"
|
|
57
|
+
|
|
58
|
+
### 2. Executor
|
|
59
|
+
Routes to appropriate computational tools:
|
|
60
|
+
- **SymPy**: Symbolic algebra, calculus
|
|
61
|
+
- **Z3**: Constraint solving, optimization
|
|
62
|
+
- **NumPy/SciPy**: Numerical computation
|
|
63
|
+
- **Custom**: Number theory, combinatorics, geometry
|
|
64
|
+
|
|
65
|
+
### 3. Verifier
|
|
66
|
+
Checks solutions and provides feedback:
|
|
67
|
+
- Constraint verification
|
|
68
|
+
- Counterexample generation
|
|
69
|
+
- Correction suggestions
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Development Status
|
|
74
|
+
|
|
75
|
+
**Current Phase**: Architecture & Parser Implementation
|
|
76
|
+
|
|
77
|
+
- [x] Vision document
|
|
78
|
+
- [x] Architecture design
|
|
79
|
+
- [ ] Parser implementation
|
|
80
|
+
- [ ] Executor implementation
|
|
81
|
+
- [ ] Verifier implementation
|
|
82
|
+
- [ ] AI loop integration
|
|
83
|
+
- [ ] AIMO benchmark
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
- [DARKARTS_VISION.md](./DARKARTS_VISION.md) - Complete vision and purpose
|
|
90
|
+
- [THE_MISSING_PIECE.md](./THE_MISSING_PIECE.md) - Discovery of the execution gap
|
|
91
|
+
- [PATTERN_ANALYSIS.md](./PATTERN_ANALYSIS.md) - AI's natural language analysis
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Benchmark: AIMO
|
|
96
|
+
|
|
97
|
+
**Target**: 60%+ accuracy on AI Mathematical Olympiad problems
|
|
98
|
+
|
|
99
|
+
**Method**: AI expresses solutions in mathematical notation, DarkArts executes
|
|
100
|
+
|
|
101
|
+
**Baseline**:
|
|
102
|
+
- AI + Python: ~40% (with fine-tuning)
|
|
103
|
+
- AI + DarkArts: TBD
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
Proprietary - See parent repository
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
**Status**: Active Development
|
|
114
|
+
**Version**: 0.1.0-alpha
|
|
115
|
+
**Last Updated**: December 2025
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
DarkArts: An execution engine for mathematical notation.
|
|
3
|
+
|
|
4
|
+
DarkArts bridges the gap between AI's natural mathematical reasoning
|
|
5
|
+
and computational reality, allowing AI to express solutions in mathematics
|
|
6
|
+
while getting executable results without writing code.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__version__ = "0.1.0-alpha"
|
|
10
|
+
__author__ = "Vooodooo"
|
|
11
|
+
|
|
12
|
+
# Main API will be exposed here once implemented
|
|
13
|
+
# from .parser import parse
|
|
14
|
+
# from .executor import execute
|
|
15
|
+
# from .verifier import verify
|
|
16
|
+
# from .loop import ai_loop
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""
|
|
2
|
+
DarkArts Annotations
|
|
3
|
+
|
|
4
|
+
AI-native code documentation system using mathematical and logical notation.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .types import (
|
|
8
|
+
ParsedAnnotations,
|
|
9
|
+
ModuleAnnotation,
|
|
10
|
+
ClassAnnotation,
|
|
11
|
+
FunctionAnnotation,
|
|
12
|
+
ComplexityAnnotation,
|
|
13
|
+
ErrorCase,
|
|
14
|
+
StateTransition,
|
|
15
|
+
Language,
|
|
16
|
+
AnnotationType,
|
|
17
|
+
VerificationResult,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
from .parser import AnnotationParser
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
'ParsedAnnotations',
|
|
24
|
+
'ModuleAnnotation',
|
|
25
|
+
'ClassAnnotation',
|
|
26
|
+
'FunctionAnnotation',
|
|
27
|
+
'ComplexityAnnotation',
|
|
28
|
+
'ErrorCase',
|
|
29
|
+
'StateTransition',
|
|
30
|
+
'Language',
|
|
31
|
+
'AnnotationType',
|
|
32
|
+
'VerificationResult',
|
|
33
|
+
'AnnotationParser',
|
|
34
|
+
]
|