@voodocs/cli 0.4.2 → 1.0.1
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/CHANGELOG.md +431 -0
- package/lib/cli/__init__.py +53 -0
- package/lib/cli/benchmark.py +311 -0
- package/lib/cli/fix.py +244 -0
- package/lib/cli/generate.py +310 -0
- package/lib/cli/test_cli.py +215 -0
- package/lib/cli/validate.py +364 -0
- package/lib/darkarts/__init__.py +11 -5
- package/lib/darkarts/annotations/__init__.py +11 -3
- package/lib/darkarts/annotations/darkarts_parser.py +1 -1
- package/lib/darkarts/annotations/translator.py +32 -5
- package/lib/darkarts/annotations/types.py +15 -2
- package/lib/darkarts/cli_darkarts.py +143 -15
- package/lib/darkarts/context/__init__.py +11 -3
- package/lib/darkarts/context/ai_integrations.py +7 -21
- package/lib/darkarts/context/commands.py +1 -1
- package/lib/darkarts/context/diagram.py +8 -22
- package/lib/darkarts/context/models.py +7 -22
- package/lib/darkarts/context/module_utils.py +1 -1
- package/lib/darkarts/context/ui.py +1 -1
- package/lib/darkarts/context/validation.py +1 -1
- package/lib/darkarts/context/yaml_utils.py +8 -23
- package/lib/darkarts/core/__init__.py +12 -2
- package/lib/darkarts/core/interface.py +15 -1
- package/lib/darkarts/core/loader.py +16 -1
- package/lib/darkarts/core/plugin.py +15 -2
- package/lib/darkarts/core/registry.py +16 -1
- package/lib/darkarts/exceptions.py +16 -2
- package/lib/darkarts/plugins/voodocs/__init__.py +12 -2
- package/lib/darkarts/plugins/voodocs/ai_native_plugin.py +15 -4
- package/lib/darkarts/plugins/voodocs/annotation_validator.py +15 -2
- package/lib/darkarts/plugins/voodocs/api_spec_generator.py +15 -2
- package/lib/darkarts/plugins/voodocs/documentation_generator.py +15 -2
- package/lib/darkarts/plugins/voodocs/html_exporter.py +15 -2
- package/lib/darkarts/plugins/voodocs/instruction_generator.py +1 -1
- package/lib/darkarts/plugins/voodocs/pdf_exporter.py +15 -2
- package/lib/darkarts/plugins/voodocs/test_generator.py +15 -2
- package/lib/darkarts/telemetry.py +15 -2
- package/lib/darkarts/validation/README.md +147 -0
- package/lib/darkarts/validation/__init__.py +91 -0
- package/lib/darkarts/validation/autofix.py +297 -0
- package/lib/darkarts/validation/benchmark.py +426 -0
- package/lib/darkarts/validation/benchmark_wrapper.py +22 -0
- package/lib/darkarts/validation/config.py +257 -0
- package/lib/darkarts/validation/performance.py +412 -0
- package/lib/darkarts/validation/performance_wrapper.py +37 -0
- package/lib/darkarts/validation/semantic.py +461 -0
- package/lib/darkarts/validation/semantic_wrapper.py +77 -0
- package/lib/darkarts/validation/test_validation.py +160 -0
- package/lib/darkarts/validation/types.py +97 -0
- package/lib/darkarts/validation/watch.py +239 -0
- package/package.json +19 -6
- package/voodocs_cli.py +28 -0
- package/cli.py +0 -1646
- package/lib/darkarts/cli.py +0 -128
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
⚠{files-exist,valid-paths}
|
|
5
5
|
⊨{∀cmd→exit∈{0,1},user-friendly-errors}
|
|
6
6
|
🔒{read-write-files}
|
|
7
|
-
⚡{O(n)|n=files}
|
|
7
|
+
⚡{O(n³)|n=files,11-loops,depth=4}
|
|
8
8
|
|
|
9
9
|
DarkArts CLI Commands
|
|
10
10
|
|
|
@@ -12,6 +12,7 @@ Provides CLI commands for DarkArts symbolic documentation.
|
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
14
|
import sys
|
|
15
|
+
import re
|
|
15
16
|
from pathlib import Path
|
|
16
17
|
from typing import List, Optional
|
|
17
18
|
|
|
@@ -22,6 +23,7 @@ from darkarts.annotations import (
|
|
|
22
23
|
convert_voodocs_to_darkarts,
|
|
23
24
|
)
|
|
24
25
|
from darkarts.annotations.parser import AnnotationParser
|
|
26
|
+
from darkarts.annotations.types import Language
|
|
25
27
|
|
|
26
28
|
|
|
27
29
|
def cmd_darkarts_translate(args):
|
|
@@ -93,6 +95,12 @@ def cmd_darkarts_convert(args):
|
|
|
93
95
|
|
|
94
96
|
Usage:
|
|
95
97
|
voodocs darkarts convert <files> [--in-place]
|
|
98
|
+
|
|
99
|
+
Improvements:
|
|
100
|
+
- Supports Python, TypeScript, JavaScript
|
|
101
|
+
- Preserves ALL annotation fields (not just module-level)
|
|
102
|
+
- Fixed symbol conversion (no mid-word replacements)
|
|
103
|
+
- Working --in-place flag for all languages
|
|
96
104
|
"""
|
|
97
105
|
print("🔄 DarkArts Conversion")
|
|
98
106
|
print("=" * 60)
|
|
@@ -116,41 +124,161 @@ def cmd_darkarts_convert(args):
|
|
|
116
124
|
# Parse VooDocs annotations
|
|
117
125
|
parser = AnnotationParser()
|
|
118
126
|
annotations = parser.parse_file(str(path))
|
|
127
|
+
language = parser.detect_language(str(path))
|
|
119
128
|
|
|
120
129
|
if not annotations.module:
|
|
121
130
|
print(" ⚠️ No @voodocs annotations found")
|
|
122
131
|
continue
|
|
123
132
|
|
|
124
|
-
# Convert
|
|
125
|
-
|
|
126
|
-
'module_purpose': annotations.module.module_purpose,
|
|
127
|
-
'dependencies': annotations.module.dependencies,
|
|
128
|
-
'assumptions': annotations.module.assumptions,
|
|
129
|
-
}
|
|
133
|
+
# Convert module-level annotation
|
|
134
|
+
converted_annotations = []
|
|
130
135
|
|
|
131
|
-
|
|
136
|
+
if annotations.module:
|
|
137
|
+
module_dict = {}
|
|
138
|
+
|
|
139
|
+
# Include ALL fields
|
|
140
|
+
if hasattr(annotations.module, 'module_purpose') and annotations.module.module_purpose:
|
|
141
|
+
module_dict['module_purpose'] = annotations.module.module_purpose
|
|
142
|
+
if hasattr(annotations.module, 'dependencies') and annotations.module.dependencies:
|
|
143
|
+
module_dict['dependencies'] = annotations.module.dependencies
|
|
144
|
+
if hasattr(annotations.module, 'assumptions') and annotations.module.assumptions:
|
|
145
|
+
module_dict['assumptions'] = annotations.module.assumptions
|
|
146
|
+
if hasattr(annotations.module, 'invariants') and annotations.module.invariants:
|
|
147
|
+
module_dict['invariants'] = annotations.module.invariants
|
|
148
|
+
if hasattr(annotations.module, 'security_model') and annotations.module.security_model:
|
|
149
|
+
module_dict['security_model'] = annotations.module.security_model
|
|
150
|
+
if hasattr(annotations.module, 'performance_model') and annotations.module.performance_model:
|
|
151
|
+
module_dict['performance_model'] = annotations.module.performance_model
|
|
152
|
+
|
|
153
|
+
if module_dict:
|
|
154
|
+
darkarts = convert_voodocs_to_darkarts(module_dict)
|
|
155
|
+
converted_annotations.append(('module', darkarts, 0))
|
|
156
|
+
|
|
157
|
+
# Convert function-level annotations
|
|
158
|
+
for func in annotations.module.functions:
|
|
159
|
+
func_dict = {}
|
|
160
|
+
|
|
161
|
+
if hasattr(func, 'preconditions') and func.preconditions:
|
|
162
|
+
func_dict['preconditions'] = func.preconditions
|
|
163
|
+
if hasattr(func, 'postconditions') and func.postconditions:
|
|
164
|
+
func_dict['postconditions'] = func.postconditions
|
|
165
|
+
if hasattr(func, 'invariants') and func.invariants:
|
|
166
|
+
func_dict['invariants'] = func.invariants
|
|
167
|
+
if hasattr(func, 'security_implications') and func.security_implications:
|
|
168
|
+
func_dict['security_implications'] = func.security_implications
|
|
169
|
+
if hasattr(func, 'complexity') and func.complexity:
|
|
170
|
+
# Convert ComplexityAnnotation to string
|
|
171
|
+
if hasattr(func.complexity, 'time'):
|
|
172
|
+
func_dict['complexity'] = func.complexity.time
|
|
173
|
+
else:
|
|
174
|
+
func_dict['complexity'] = str(func.complexity)
|
|
175
|
+
|
|
176
|
+
if func_dict:
|
|
177
|
+
darkarts = convert_voodocs_to_darkarts(func_dict)
|
|
178
|
+
converted_annotations.append(('function', darkarts, func.line_number if hasattr(func, 'line_number') else 0))
|
|
179
|
+
|
|
180
|
+
# Convert class-level annotations
|
|
181
|
+
for cls in annotations.module.classes:
|
|
182
|
+
cls_dict = {}
|
|
183
|
+
|
|
184
|
+
if hasattr(cls, 'invariants') and cls.invariants:
|
|
185
|
+
cls_dict['invariants'] = cls.invariants
|
|
186
|
+
if hasattr(cls, 'assumptions') and cls.assumptions:
|
|
187
|
+
cls_dict['assumptions'] = cls.assumptions
|
|
188
|
+
|
|
189
|
+
if cls_dict:
|
|
190
|
+
darkarts = convert_voodocs_to_darkarts(cls_dict)
|
|
191
|
+
converted_annotations.append(('class', darkarts, cls.line_number if hasattr(cls, 'line_number') else 0))
|
|
192
|
+
|
|
193
|
+
if not converted_annotations:
|
|
194
|
+
print(" ⚠️ No convertible annotations found")
|
|
195
|
+
continue
|
|
132
196
|
|
|
133
197
|
if in_place:
|
|
134
198
|
# Replace @voodocs with @darkarts in file
|
|
135
|
-
|
|
136
|
-
new_content = content.replace(
|
|
137
|
-
'"""@voodocs',
|
|
138
|
-
darkarts.replace('"""@darkarts\n', '').replace('\n"""', '')
|
|
139
|
-
)
|
|
199
|
+
new_content = _replace_annotations_in_file(content, converted_annotations, language)
|
|
140
200
|
path.write_text(new_content)
|
|
141
|
-
print(" ✅ Converted in place")
|
|
201
|
+
print(f" ✅ Converted {len(converted_annotations)} annotation(s) in place")
|
|
142
202
|
else:
|
|
143
203
|
# Print to console
|
|
144
|
-
|
|
204
|
+
for ann_type, darkarts, line_num in converted_annotations:
|
|
205
|
+
print(f"\n {ann_type.capitalize()} annotation (line {line_num}):")
|
|
206
|
+
print(f" {darkarts}")
|
|
145
207
|
|
|
146
208
|
except Exception as e:
|
|
147
209
|
print(f" ❌ Error: {e}")
|
|
210
|
+
import traceback
|
|
211
|
+
traceback.print_exc()
|
|
148
212
|
|
|
149
213
|
print()
|
|
150
214
|
|
|
151
215
|
return 0
|
|
152
216
|
|
|
153
217
|
|
|
218
|
+
|
|
219
|
+
from darkarts.annotations.types import Language
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def _replace_annotations_in_file(content: str, converted_annotations: list, language: Language) -> str:
|
|
223
|
+
"""
|
|
224
|
+
Replace @voodocs annotations with @darkarts in file content.
|
|
225
|
+
|
|
226
|
+
Args:
|
|
227
|
+
content: Original file content
|
|
228
|
+
converted_annotations: List of (type, darkarts_text, line_num) tuples
|
|
229
|
+
language: Programming language
|
|
230
|
+
|
|
231
|
+
Returns:
|
|
232
|
+
Modified content with @darkarts annotations
|
|
233
|
+
"""
|
|
234
|
+
# Determine comment syntax based on language
|
|
235
|
+
if language == Language.PYTHON:
|
|
236
|
+
voodocs_pattern = r'"""@voodocs\s*(.*?)\s*"""'
|
|
237
|
+
|
|
238
|
+
def create_darkarts(darkarts_text):
|
|
239
|
+
# darkarts_text already has """@darkarts format
|
|
240
|
+
return darkarts_text
|
|
241
|
+
|
|
242
|
+
else: # TypeScript, JavaScript, etc.
|
|
243
|
+
voodocs_pattern = r'/\*\*@voodocs\s*(.*?)\s*\*/'
|
|
244
|
+
|
|
245
|
+
def create_darkarts(darkarts_text):
|
|
246
|
+
# Convert Python-style to JS-style
|
|
247
|
+
lines = darkarts_text.strip().split('\n')
|
|
248
|
+
if lines and lines[0] == '"""@darkarts':
|
|
249
|
+
lines[0] = '/**@darkarts'
|
|
250
|
+
if lines and lines[-1] == '"""':
|
|
251
|
+
lines[-1] = '*/'
|
|
252
|
+
return '\n'.join(lines)
|
|
253
|
+
|
|
254
|
+
# Find all @voodocs annotations
|
|
255
|
+
matches = list(re.finditer(voodocs_pattern, content, re.DOTALL))
|
|
256
|
+
|
|
257
|
+
if not matches:
|
|
258
|
+
return content
|
|
259
|
+
|
|
260
|
+
# Replace each annotation
|
|
261
|
+
result = content
|
|
262
|
+
offset = 0
|
|
263
|
+
|
|
264
|
+
for i, match in enumerate(matches):
|
|
265
|
+
if i < len(converted_annotations):
|
|
266
|
+
_, darkarts_text, _ = converted_annotations[i]
|
|
267
|
+
darkarts_formatted = create_darkarts(darkarts_text)
|
|
268
|
+
|
|
269
|
+
# Calculate positions with offset
|
|
270
|
+
start = match.start() + offset
|
|
271
|
+
end = match.end() + offset
|
|
272
|
+
|
|
273
|
+
# Replace
|
|
274
|
+
result = result[:start] + darkarts_formatted + result[end:]
|
|
275
|
+
|
|
276
|
+
# Update offset
|
|
277
|
+
offset += len(darkarts_formatted) - (end - start)
|
|
278
|
+
|
|
279
|
+
return result
|
|
280
|
+
|
|
281
|
+
|
|
154
282
|
def cmd_darkarts_stats(args):
|
|
155
283
|
"""
|
|
156
284
|
Show statistics about DarkArts annotations.
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
"""
|
|
2
|
-
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢init:context.package
|
|
3
|
+
∂{}
|
|
4
|
+
⚠{python≥3.7}
|
|
5
|
+
⊨{∀import→exports-available,namespace:clean,¬side-effects-on-import}
|
|
6
|
+
🔒{pure-init,¬io,¬network,¬exec}
|
|
7
|
+
⚡{O(1):import-time}
|
|
8
|
+
|
|
9
|
+
Package initialization for context.
|
|
3
10
|
|
|
4
|
-
|
|
11
|
+
Module exports and namespace configuration.
|
|
5
12
|
"""
|
|
6
13
|
|
|
14
|
+
|
|
7
15
|
from .models import (
|
|
8
16
|
ContextFile,
|
|
9
17
|
Versioning,
|
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
"""@
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"AI config directories follow standard conventions (.claude/skills/, .cursor/rules/, etc.)",
|
|
9
|
-
"Project root is current working directory",
|
|
10
|
-
"File system allows directory creation",
|
|
11
|
-
"UTF-8 encoding is supported"
|
|
12
|
-
]
|
|
13
|
-
invariants: [
|
|
14
|
-
"All generated configs must be valid for their respective AIs",
|
|
15
|
-
"Detection must not modify any files",
|
|
16
|
-
"Generated content must be UTF-8 encoded",
|
|
17
|
-
"File paths must use forward slashes for cross-platform compatibility",
|
|
18
|
-
"Each AI integration must return Dict[str, str] mapping paths to content"
|
|
19
|
-
]
|
|
20
|
-
security_model: "Read-only detection, write only when explicitly called by user commands"
|
|
21
|
-
performance_model: "O(1) for detection, O(k) for generation where k=number of AI assistants"
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢ai-integrations:context.ai-native
|
|
3
|
+
∂{pathlib,typing}
|
|
4
|
+
⚠{ai-dirs:standard-conventions,cwd:project-root,fs:writable,encoding:utf8}
|
|
5
|
+
⊨{∀config→valid-for-ai,∀detect→¬modify-files,∀content:utf8,∀path:forward-slash,∀integration→Dict[str,str]}
|
|
6
|
+
🔒{read-only:detect,write:explicit-user-command}
|
|
7
|
+
⚡{O(n²):detect-with-analysis,O(k):generate|k=ai-count}
|
|
22
8
|
|
|
23
9
|
AI-specific integration templates for VooDocs Context System.
|
|
24
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
⚠{.voodocs.context∈root,git:available,py≥3.11,cwd=root}
|
|
5
5
|
⊨{ctx:yaml,v∈semver,exit∈{0,1},∀update→v++,files:utf8}
|
|
6
6
|
🔒{read:ctx,write⊳confirm}
|
|
7
|
-
⚡{O(
|
|
7
|
+
⚡{O(n³):typical-nested-loops,worst-case:O(2^n):recursion-detected|32-loops,depth=3}
|
|
8
8
|
|
|
9
9
|
Context System Commands
|
|
10
10
|
|
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
"""@
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
assumptions: [
|
|
9
|
-
"Context file contains architecture.modules section",
|
|
10
|
-
"manus-render-diagram utility is available for PNG rendering",
|
|
11
|
-
"Output directory is writable",
|
|
12
|
-
"Mermaid/D2 syntax is valid"
|
|
13
|
-
]
|
|
14
|
-
invariants: [
|
|
15
|
-
"Generated diagrams must be valid Mermaid or D2 syntax",
|
|
16
|
-
"Module names must be sanitized for diagram syntax",
|
|
17
|
-
"Diagram generation must not modify context file",
|
|
18
|
-
"PNG rendering is optional and fails gracefully if utility unavailable"
|
|
19
|
-
]
|
|
20
|
-
security_model: "Read context file, write diagram files to user-specified paths"
|
|
21
|
-
performance_model: "O(n) where n=number of modules, O(n^2) for dependency graphs"
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢diagram:context.visualization
|
|
3
|
+
∂{subprocess,pathlib,typing}
|
|
4
|
+
⚠{context:has-architecture-modules,manus-render-diagram:available,output-dir:writable,syntax:valid-mermaid-d2}
|
|
5
|
+
⊨{∀diagram→valid-syntax,∀module-name:sanitized,¬modify-context,∀png-render→graceful-fail}
|
|
6
|
+
🔒{read:context-file,write:diagram-files}
|
|
7
|
+
⚡{O(n³):dependency-graph-generation|13-loops,depth=3}
|
|
22
8
|
|
|
23
9
|
Architecture Diagram Generator
|
|
24
10
|
|
|
25
|
-
Generates visual diagrams from context files.
|
|
11
|
+
Generates visual diagrams from context files in Mermaid and D2 formats.
|
|
26
12
|
"""
|
|
27
13
|
|
|
28
14
|
import subprocess
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
"""@
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
assumptions: [
|
|
9
|
-
"Python 3.7+ with dataclasses support",
|
|
10
|
-
"All dates are ISO 8601 format (YYYY-MM-DD)",
|
|
11
|
-
"Version strings follow semver (major.minor)",
|
|
12
|
-
"All text fields are UTF-8 strings"
|
|
13
|
-
]
|
|
14
|
-
invariants: [
|
|
15
|
-
"All dataclasses must be immutable (frozen=False but should not be mutated)",
|
|
16
|
-
"Optional fields must have None as default",
|
|
17
|
-
"List fields must use field(default_factory=list)",
|
|
18
|
-
"Dict fields must use field(default_factory=dict)",
|
|
19
|
-
"All models must be serializable to dict via asdict()"
|
|
20
|
-
]
|
|
21
|
-
security_model: "Pure data structures, no I/O or side effects"
|
|
22
|
-
performance_model: "O(1) for all operations, lightweight dataclasses"
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢models:context.data-structures
|
|
3
|
+
∂{dataclasses,typing,datetime}
|
|
4
|
+
⚠{python≥3.7,dates:iso8601,versions:semver,text:utf8}
|
|
5
|
+
⊨{∀dataclass:quasi-immutable,∀optional→None-default,∀list:default-factory,∀dict:default-factory,∀model→serializable-asdict}
|
|
6
|
+
🔒{pure-data,¬io,¬side-effects}
|
|
7
|
+
⚡{O(n):iteration-serialization|dataclass-operations}
|
|
23
8
|
|
|
24
9
|
Context System Data Models
|
|
25
10
|
|
|
@@ -1,29 +1,14 @@
|
|
|
1
|
-
"""@
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
assumptions: [
|
|
9
|
-
"PyYAML is installed and available",
|
|
10
|
-
"Files are UTF-8 encoded",
|
|
11
|
-
"YAML files follow .voodocs.context schema",
|
|
12
|
-
"File system is readable and writable"
|
|
13
|
-
]
|
|
14
|
-
invariants: [
|
|
15
|
-
"All YAML output must be valid and parseable",
|
|
16
|
-
"None values must be represented as empty strings, not 'null'",
|
|
17
|
-
"Indentation must be 2 spaces",
|
|
18
|
-
"Dict keys must preserve insertion order",
|
|
19
|
-
"Architecture decisions and modules must be converted to proper objects"
|
|
20
|
-
]
|
|
21
|
-
security_model: "Read/write context files only, no arbitrary file access"
|
|
22
|
-
performance_model: "O(n/c) for parsing where n=file size, c=10x speedup from LibYAML. Phase 3 optimizations: LibYAML C loader (10x), LRU caching (100x on cache hits), streamlined conversion (3x). Combined: 10-300x faster."
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢yaml-utils:context.serialization
|
|
3
|
+
∂{yaml,pathlib,models}
|
|
4
|
+
⚠{pyyaml:installed,encoding:utf8,schema:voodocs-context,fs:read-write}
|
|
5
|
+
⊨{∀yaml-output→valid-parseable,∀None→empty-string,indent:2-spaces,∀dict:preserve-order,∀arch→proper-objects}
|
|
6
|
+
🔒{read-write:context-files-only,¬arbitrary-file-access}
|
|
7
|
+
⚡{O(n/c):parse|n=file-size,c=10x-libyaml,cache:100x-hits,combined:10-300x}
|
|
23
8
|
|
|
24
9
|
YAML Utilities for Context Files
|
|
25
10
|
|
|
26
|
-
Handles reading, writing, and formatting of .voodocs.context YAML files.
|
|
11
|
+
Handles reading, writing, and formatting of .voodocs.context YAML files with LibYAML C backend optimization.
|
|
27
12
|
"""
|
|
28
13
|
|
|
29
14
|
import yaml
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢init:core.package
|
|
3
|
+
∂{}
|
|
4
|
+
⚠{python≥3.7}
|
|
5
|
+
⊨{∀import→exports-available,namespace:clean,¬side-effects-on-import}
|
|
6
|
+
🔒{pure-init,¬io,¬network,¬exec}
|
|
7
|
+
⚡{O(1):import-time}
|
|
8
|
+
|
|
9
|
+
Package initialization for core.
|
|
10
|
+
|
|
11
|
+
Module exports and namespace configuration.
|
|
1
12
|
"""
|
|
2
|
-
|
|
3
|
-
"""
|
|
13
|
+
|
|
4
14
|
|
|
5
15
|
from .plugin import (
|
|
6
16
|
DarkArtsPlugin,
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢interface:core.api
|
|
3
|
+
∂{typing,darkarts.core.plugin,darkarts.core.registry,darkarts.core.loader}
|
|
4
|
+
⚠{python≥3.7,plugins:registered,registry:initialized}
|
|
5
|
+
⊨{∀solve→PluginOutput,∀plugin-call→routed-correctly,∀error→PluginError,auto-detect:best-effort,¬modify-registry-during-solve}
|
|
6
|
+
🔒{delegates-to-plugins,plugin-security-dependent,¬direct-file-io}
|
|
7
|
+
⚡{O(1):dispatch,O(p):plugin-execution|p=plugin-complexity}
|
|
8
|
+
|
|
2
9
|
Unified interface to the DarkArts platform.
|
|
10
|
+
|
|
11
|
+
Provides high-level API for problem solving with automatic plugin routing:
|
|
12
|
+
- Problem solving with plugin selection (manual or auto-detect)
|
|
13
|
+
- Plugin management (list, get, register, load)
|
|
14
|
+
- Explanation generation for solutions
|
|
15
|
+
- Learning mode for pattern recognition
|
|
16
|
+
- Built-in plugin discovery and loading
|
|
3
17
|
"""
|
|
4
18
|
|
|
5
19
|
from typing import Any, Dict, List, Optional
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢loader:core.plugin-discovery
|
|
3
|
+
∂{importlib,os,sys,pathlib,typing,darkarts.core.plugin,darkarts.core.registry}
|
|
4
|
+
⚠{python≥3.7,fs:readable,modules:importable,plugins:valid-subclass}
|
|
5
|
+
⊨{∀load→DarkArtsPlugin|PluginError,∀register→registry-updated,∀discovery→finds-all-valid,¬modify-source}
|
|
6
|
+
🔒{⚠️EXEC-CODE:import-plugins,read:plugin-dirs,¬network,¬arbitrary-file-write}
|
|
7
|
+
⚡{O(n)|n=plugins,import-overhead:per-plugin}
|
|
8
|
+
|
|
2
9
|
Plugin loader for discovering and loading plugins.
|
|
10
|
+
|
|
11
|
+
Dynamic plugin discovery and loading system with support for:
|
|
12
|
+
- Module-based loading (importlib)
|
|
13
|
+
- File-based loading (from .py files)
|
|
14
|
+
- Directory scanning (auto-discovery)
|
|
15
|
+
- Built-in plugin detection
|
|
16
|
+
- Automatic registry integration
|
|
17
|
+
- Plugin validation and error handling
|
|
3
18
|
"""
|
|
4
19
|
|
|
5
20
|
import importlib
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢plugin:core.extensibility
|
|
3
|
+
∂{abc,dataclasses,enum,typing}
|
|
4
|
+
⚠{python≥3.7,subclass:implements-abstract-methods}
|
|
5
|
+
⊨{∀plugin:DarkArtsPlugin-subclass,∀metadata:valid-schema,∀input→PluginInput,∀output→PluginOutput,∀abstract-method:must-implement,lifecycle:init→execute→cleanup}
|
|
6
|
+
🔒{interface-only,security:plugin-dependent,¬direct-io}
|
|
7
|
+
⚡{O(1):interface-dispatch,O(p):plugin-implementation|p=plugin-complexity}
|
|
8
|
+
|
|
2
9
|
Core plugin system for DarkArts.
|
|
3
10
|
|
|
4
|
-
|
|
11
|
+
Defines the base classes and interfaces for the DarkArts plugin system with:
|
|
12
|
+
- Abstract plugin interface (DarkArtsPlugin base class)
|
|
13
|
+
- Plugin capabilities (parse, analyze, execute, explain, learn, multi-step)
|
|
14
|
+
- Standardized input/output (PluginInput, PluginOutput dataclasses)
|
|
15
|
+
- Plugin metadata (name, version, description, dependencies, capabilities)
|
|
16
|
+
- Exception hierarchy (ParseError, ExecutionError, PluginError)
|
|
17
|
+
- Lifecycle management (initialization, execution, cleanup)
|
|
5
18
|
"""
|
|
6
19
|
|
|
7
20
|
from abc import ABC, abstractmethod
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢registry:core.plugin-management
|
|
3
|
+
∂{typing,darkarts.core.plugin}
|
|
4
|
+
⚠{python≥3.7,plugins:valid-metadata}
|
|
5
|
+
⊨{∀register→unique-name|PluginError,∀get→plugin|None,∀unregister→removed,¬duplicate-names,∀deps→satisfied-before-register,thread-safe:dict-ops}
|
|
6
|
+
🔒{read-write:registry-only,¬file-io,¬network,in-memory-only}
|
|
7
|
+
⚡{O(1):register-get-unregister,O(n):list|n=plugin-count,dict-based}
|
|
8
|
+
|
|
2
9
|
Plugin registry for managing and discovering plugins.
|
|
10
|
+
|
|
11
|
+
Central registry for plugin lifecycle management with:
|
|
12
|
+
- Plugin registration with uniqueness enforcement
|
|
13
|
+
- Dependency validation (plugins must register dependencies first)
|
|
14
|
+
- Plugin lookup by name or capability
|
|
15
|
+
- Plugin enumeration and discovery
|
|
16
|
+
- Thread-safe operations (dict-based)
|
|
17
|
+
- Global singleton registry pattern
|
|
3
18
|
"""
|
|
4
19
|
|
|
5
20
|
from typing import Dict, List, Optional
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢exceptions:errors.hierarchy
|
|
3
|
+
∂{}
|
|
4
|
+
⚠{python≥3.7}
|
|
5
|
+
⊨{∀exception:VooDocsError-subclass,∀error→informative-message,hierarchy:base→specific,catchable:by-type}
|
|
6
|
+
🔒{pure-exceptions,¬io,¬side-effects,¬exec}
|
|
7
|
+
⚡{O(1):exception-creation}
|
|
8
|
+
|
|
2
9
|
VooDocs Custom Exceptions
|
|
3
10
|
|
|
4
|
-
|
|
11
|
+
Structured exception hierarchy for error handling with:
|
|
12
|
+
- Base exception (VooDocsError for all VooDocs errors)
|
|
13
|
+
- Parser errors (ParserError, ParserNotBuiltError, AnnotationError)
|
|
14
|
+
- Validation errors (InvalidAnnotationError, ValidationError)
|
|
15
|
+
- Generator errors (GeneratorError)
|
|
16
|
+
- Configuration errors (ConfigurationError)
|
|
17
|
+
- File errors (FileNotFoundError)
|
|
18
|
+
- Informative messages (clear guidance for users)
|
|
5
19
|
"""
|
|
6
20
|
|
|
7
21
|
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢init:plugins.voodocs.package
|
|
3
|
+
∂{}
|
|
4
|
+
⚠{python≥3.7}
|
|
5
|
+
⊨{∀import→exports-available,namespace:clean,¬side-effects-on-import}
|
|
6
|
+
🔒{pure-init,¬io,¬network,¬exec}
|
|
7
|
+
⚡{O(n²):plugin-initialization|10-loops,depth=2}
|
|
8
|
+
|
|
9
|
+
Package initialization for plugins.voodocs.
|
|
10
|
+
|
|
11
|
+
Module exports and namespace configuration.
|
|
1
12
|
"""
|
|
2
|
-
|
|
3
|
-
"""
|
|
13
|
+
|
|
4
14
|
|
|
5
15
|
import ast
|
|
6
16
|
import re
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢ai-voodocs-plugin:plugins.documentation
|
|
3
|
+
∂{darkarts.core,darkarts.annotations,darkarts.plugins.voodocs.documentation_generator,darkarts.plugins.voodocs.test_generator,darkarts.plugins.voodocs.api_spec_generator}
|
|
4
|
+
⚠{python≥3.7,source-code:parseable,annotations:@voodocs-format}
|
|
5
|
+
⊨{∀parse→annotations-extracted,∀execute→docs-generated,∀analyze→insights,¬modify-source,idempotent:same-input→same-output}
|
|
6
|
+
🔒{read-only:source,write:docs-output,¬network,¬arbitrary-exec}
|
|
7
|
+
⚡{O(n)|n=source-lines,ast-parsing:linear}
|
|
8
|
+
|
|
2
9
|
AI-Native VooDocs Plugin for DarkArts
|
|
3
10
|
|
|
4
|
-
Enhanced
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
Enhanced documentation plugin supporting:
|
|
12
|
+
- @voodocs annotation parsing (AI-native documentation)
|
|
13
|
+
- Traditional AST-based documentation (fallback)
|
|
14
|
+
- Automatic documentation generation (Markdown, HTML, PDF)
|
|
15
|
+
- Test generation from annotations (preconditions/postconditions → tests)
|
|
16
|
+
- API specification generation (OpenAPI from annotations)
|
|
17
|
+
- Multi-format output (docs, tests, specs)
|
|
7
18
|
"""
|
|
8
19
|
|
|
9
20
|
from darkarts.core import (
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢validator:plugins.quality-assurance
|
|
3
|
+
∂{typing,darkarts.annotations.types,re}
|
|
4
|
+
⚠{python≥3.7,annotations:parsed}
|
|
5
|
+
⊨{∀validate→issues-list,∀issue:categorized,∀severity:error|warning|info,¬modify-annotations,comprehensive:all-rules-checked}
|
|
6
|
+
🔒{read-only:annotations,¬file-io,¬network,¬exec}
|
|
7
|
+
⚡{O(n)|n=annotations,validation:linear}
|
|
8
|
+
|
|
2
9
|
VooDocs Annotation Validator
|
|
3
10
|
|
|
4
|
-
|
|
11
|
+
Quality assurance for @voodocs annotations with:
|
|
12
|
+
- Syntax validation (correct format and structure)
|
|
13
|
+
- Completeness checking (required fields present)
|
|
14
|
+
- Consistency verification (invariants don't contradict postconditions)
|
|
15
|
+
- Complexity notation validation (Big-O format)
|
|
16
|
+
- Security model checking (valid security declarations)
|
|
17
|
+
- Best practice recommendations (suggestions for improvement)
|
|
5
18
|
"""
|
|
6
19
|
|
|
7
20
|
from typing import List, Dict, Any, Optional
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢api-spec-generator:plugins.api-documentation
|
|
3
|
+
∂{typing,pathlib,json,yaml,darkarts.annotations.types}
|
|
4
|
+
⚠{python≥3.7,annotations:parsed,format:supported}
|
|
5
|
+
⊨{∀generate→api-spec,∀function→endpoint,∀annotation→schema,¬modify-annotations,valid-spec:parseable}
|
|
6
|
+
🔒{read-only:annotations,write:spec-files,¬network,¬exec}
|
|
7
|
+
⚡{O(n)|n=functions,spec-generation:linear}
|
|
8
|
+
|
|
2
9
|
DarkArts API Specification Generator
|
|
3
10
|
|
|
4
|
-
|
|
11
|
+
Automatic API specification generation from @voodocs annotations with:
|
|
12
|
+
- OpenAPI 3.0 generation (industry-standard REST API specs)
|
|
13
|
+
- Swagger support (compatible with Swagger UI)
|
|
14
|
+
- GraphQL schema generation (type-safe API definitions)
|
|
15
|
+
- Parameter extraction (from preconditions)
|
|
16
|
+
- Response schema generation (from postconditions)
|
|
17
|
+
- Error documentation (from error_cases)
|
|
5
18
|
"""
|
|
6
19
|
|
|
7
20
|
from typing import List, Optional, Dict, Any
|