@voodocs/cli 0.4.1 → 1.0.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +322 -0
  2. package/lib/cli/__init__.py +53 -0
  3. package/lib/cli/benchmark.py +311 -0
  4. package/lib/cli/fix.py +244 -0
  5. package/lib/cli/generate.py +310 -0
  6. package/lib/cli/test_cli.py +215 -0
  7. package/lib/cli/validate.py +364 -0
  8. package/lib/darkarts/__init__.py +11 -5
  9. package/lib/darkarts/annotations/__init__.py +11 -3
  10. package/lib/darkarts/annotations/darkarts_parser.py +1 -1
  11. package/lib/darkarts/annotations/types.py +16 -3
  12. package/lib/darkarts/cli_darkarts.py +385 -0
  13. package/lib/darkarts/context/__init__.py +11 -3
  14. package/lib/darkarts/context/ai_integrations.py +7 -21
  15. package/lib/darkarts/context/commands.py +1 -1
  16. package/lib/darkarts/context/diagram.py +8 -22
  17. package/lib/darkarts/context/models.py +7 -22
  18. package/lib/darkarts/context/module_utils.py +1 -1
  19. package/lib/darkarts/context/ui.py +1 -1
  20. package/lib/darkarts/context/validation.py +1 -1
  21. package/lib/darkarts/context/yaml_utils.py +8 -23
  22. package/lib/darkarts/core/__init__.py +12 -2
  23. package/lib/darkarts/core/interface.py +16 -2
  24. package/lib/darkarts/core/loader.py +17 -2
  25. package/lib/darkarts/core/plugin.py +16 -3
  26. package/lib/darkarts/core/registry.py +17 -2
  27. package/lib/darkarts/exceptions.py +17 -3
  28. package/lib/darkarts/plugins/voodocs/__init__.py +12 -2
  29. package/lib/darkarts/plugins/voodocs/ai_native_plugin.py +16 -5
  30. package/lib/darkarts/plugins/voodocs/annotation_validator.py +16 -3
  31. package/lib/darkarts/plugins/voodocs/api_spec_generator.py +16 -3
  32. package/lib/darkarts/plugins/voodocs/documentation_generator.py +16 -3
  33. package/lib/darkarts/plugins/voodocs/html_exporter.py +16 -3
  34. package/lib/darkarts/plugins/voodocs/instruction_generator.py +1 -1
  35. package/lib/darkarts/plugins/voodocs/pdf_exporter.py +16 -3
  36. package/lib/darkarts/plugins/voodocs/test_generator.py +16 -3
  37. package/lib/darkarts/telemetry.py +16 -3
  38. package/lib/darkarts/validation/README.md +147 -0
  39. package/lib/darkarts/validation/__init__.py +91 -0
  40. package/lib/darkarts/validation/autofix.py +297 -0
  41. package/lib/darkarts/validation/benchmark.py +426 -0
  42. package/lib/darkarts/validation/benchmark_wrapper.py +22 -0
  43. package/lib/darkarts/validation/config.py +257 -0
  44. package/lib/darkarts/validation/performance.py +412 -0
  45. package/lib/darkarts/validation/performance_wrapper.py +37 -0
  46. package/lib/darkarts/validation/semantic.py +461 -0
  47. package/lib/darkarts/validation/semantic_wrapper.py +77 -0
  48. package/lib/darkarts/validation/test_validation.py +160 -0
  49. package/lib/darkarts/validation/types.py +97 -0
  50. package/lib/darkarts/validation/watch.py +239 -0
  51. package/package.json +20 -6
  52. package/voodocs_cli.py +28 -0
  53. package/cli.py +0 -1646
  54. package/lib/darkarts/cli.py +0 -128
@@ -0,0 +1,385 @@
1
+ """@darkarts
2
+ ⊢cli:darkarts.commands
3
+ ∂{argparse,pathlib,annotations}
4
+ ⚠{files-exist,valid-paths}
5
+ ⊨{∀cmd→exit∈{0,1},user-friendly-errors}
6
+ 🔒{read-write-files}
7
+ ⚡{O(n³)|n=files,11-loops,depth=4}
8
+
9
+ DarkArts CLI Commands
10
+
11
+ Provides CLI commands for DarkArts symbolic documentation.
12
+ """
13
+
14
+ import sys
15
+ from pathlib import Path
16
+ from typing import List, Optional
17
+
18
+ from darkarts.annotations import (
19
+ parse_darkarts,
20
+ DarkArtsParser,
21
+ DarkArtsTranslator,
22
+ convert_voodocs_to_darkarts,
23
+ )
24
+ from darkarts.annotations.parser import AnnotationParser
25
+
26
+
27
+ def cmd_darkarts_translate(args):
28
+ """
29
+ Translate DarkArts annotations to natural language or vice versa.
30
+
31
+ Usage:
32
+ voodocs darkarts translate <files> [--to-symbols]
33
+ """
34
+ print("🔮 DarkArts Translation")
35
+ print("=" * 60)
36
+ print()
37
+
38
+ translator = DarkArtsTranslator()
39
+ to_symbols = args.to_symbols if hasattr(args, 'to_symbols') else False
40
+
41
+ for file_path in args.files:
42
+ path = Path(file_path)
43
+
44
+ if not path.exists():
45
+ print(f"❌ File not found: {file_path}")
46
+ continue
47
+
48
+ print(f"📄 {path.name}")
49
+ print("-" * 60)
50
+
51
+ try:
52
+ if to_symbols:
53
+ # Natural language → Symbols (VooDocs → DarkArts)
54
+ parser = AnnotationParser()
55
+ annotations = parser.parse_file(str(path))
56
+
57
+ if annotations.module:
58
+ # Convert module annotation
59
+ voodocs_dict = {
60
+ 'module_purpose': annotations.module.module_purpose,
61
+ 'dependencies': annotations.module.dependencies,
62
+ 'assumptions': annotations.module.assumptions,
63
+ }
64
+
65
+ darkarts = convert_voodocs_to_darkarts(voodocs_dict)
66
+ print(darkarts)
67
+ else:
68
+ print("⚠️ No @voodocs annotations found")
69
+ else:
70
+ # Symbols → Natural language (DarkArts → Human)
71
+ darkarts_annotations = parse_darkarts(path.read_text())
72
+
73
+ if darkarts_annotations:
74
+ for i, ann in enumerate(darkarts_annotations, 1):
75
+ if len(darkarts_annotations) > 1:
76
+ print(f"\n## Annotation {i}\n")
77
+ natural = translator.symbols_to_natural(ann)
78
+ print(natural)
79
+ else:
80
+ print("⚠️ No @darkarts annotations found")
81
+
82
+ except Exception as e:
83
+ print(f"❌ Error: {e}")
84
+
85
+ print()
86
+
87
+ return 0
88
+
89
+
90
+ def cmd_darkarts_convert(args):
91
+ """
92
+ Convert files between VooDocs and DarkArts formats.
93
+
94
+ Usage:
95
+ voodocs darkarts convert <files> [--in-place]
96
+ """
97
+ print("🔄 DarkArts Conversion")
98
+ print("=" * 60)
99
+ print()
100
+
101
+ translator = DarkArtsTranslator()
102
+ in_place = args.in_place if hasattr(args, 'in_place') else False
103
+
104
+ for file_path in args.files:
105
+ path = Path(file_path)
106
+
107
+ if not path.exists():
108
+ print(f"❌ File not found: {file_path}")
109
+ continue
110
+
111
+ print(f"📄 {path.name}")
112
+
113
+ try:
114
+ content = path.read_text()
115
+
116
+ # Parse VooDocs annotations
117
+ parser = AnnotationParser()
118
+ annotations = parser.parse_file(str(path))
119
+
120
+ if not annotations.module:
121
+ print(" ⚠️ No @voodocs annotations found")
122
+ continue
123
+
124
+ # Convert to DarkArts
125
+ voodocs_dict = {
126
+ 'module_purpose': annotations.module.module_purpose,
127
+ 'dependencies': annotations.module.dependencies,
128
+ 'assumptions': annotations.module.assumptions,
129
+ }
130
+
131
+ darkarts = convert_voodocs_to_darkarts(voodocs_dict)
132
+
133
+ if in_place:
134
+ # Replace @voodocs with @darkarts in file
135
+ # This is a simple replacement - in production would be more sophisticated
136
+ new_content = content.replace(
137
+ '"""@voodocs',
138
+ darkarts.replace('"""@darkarts\n', '').replace('\n"""', '')
139
+ )
140
+ path.write_text(new_content)
141
+ print(" ✅ Converted in place")
142
+ else:
143
+ # Print to console
144
+ print(darkarts)
145
+
146
+ except Exception as e:
147
+ print(f" ❌ Error: {e}")
148
+
149
+ print()
150
+
151
+ return 0
152
+
153
+
154
+ def cmd_darkarts_stats(args):
155
+ """
156
+ Show statistics about DarkArts annotations.
157
+
158
+ Usage:
159
+ voodocs darkarts stats <paths>
160
+ """
161
+ print("📊 DarkArts Statistics")
162
+ print("=" * 60)
163
+ print()
164
+
165
+ total_files = 0
166
+ files_with_darkarts = 0
167
+ total_annotations = 0
168
+ total_symbols = 0
169
+ symbol_counts = {}
170
+
171
+ paths = args.paths if hasattr(args, 'paths') else ['.']
172
+
173
+ for path_str in paths:
174
+ path = Path(path_str)
175
+
176
+ if path.is_file():
177
+ files = [path]
178
+ elif path.is_dir():
179
+ files = list(path.rglob('*.py'))
180
+ else:
181
+ continue
182
+
183
+ for file_path in files:
184
+ total_files += 1
185
+
186
+ try:
187
+ content = file_path.read_text()
188
+ annotations = parse_darkarts(content)
189
+
190
+ if annotations:
191
+ files_with_darkarts += 1
192
+ total_annotations += len(annotations)
193
+
194
+ # Count symbols
195
+ for ann in annotations:
196
+ for char in ann.raw_text:
197
+ if char in ['⊢', '∂', '⚠', '⊨', '🔒', '⚡', '∀', '∃', '∧', '∨', '¬', '⇒', '∈']:
198
+ symbol_counts[char] = symbol_counts.get(char, 0) + 1
199
+ total_symbols += 1
200
+
201
+ except Exception:
202
+ pass
203
+
204
+ # Print statistics
205
+ print(f"Total files scanned: {total_files}")
206
+ print(f"Files with @darkarts: {files_with_darkarts}")
207
+ print(f"Total annotations: {total_annotations}")
208
+ print(f"Total symbols used: {total_symbols}")
209
+
210
+ if symbol_counts:
211
+ print("\nMost used symbols:")
212
+ sorted_symbols = sorted(symbol_counts.items(), key=lambda x: x[1], reverse=True)
213
+ for symbol, count in sorted_symbols[:10]:
214
+ print(f" {symbol} : {count}")
215
+
216
+ if total_files > 0:
217
+ coverage = (files_with_darkarts / total_files) * 100
218
+ print(f"\nCoverage: {coverage:.1f}%")
219
+
220
+ print()
221
+ return 0
222
+
223
+
224
+ def cmd_darkarts_validate(args):
225
+ """
226
+ Validate DarkArts annotations.
227
+
228
+ Usage:
229
+ voodocs darkarts validate <files>
230
+ """
231
+ print("✅ DarkArts Validation")
232
+ print("=" * 60)
233
+ print()
234
+
235
+ all_valid = True
236
+
237
+ for file_path in args.files:
238
+ path = Path(file_path)
239
+
240
+ if not path.exists():
241
+ print(f"❌ File not found: {file_path}")
242
+ all_valid = False
243
+ continue
244
+
245
+ print(f"📄 {path.name}")
246
+
247
+ try:
248
+ content = path.read_text()
249
+ annotations = parse_darkarts(content)
250
+
251
+ if not annotations:
252
+ print(" ⚠️ No @darkarts annotations found")
253
+ continue
254
+
255
+ for i, ann in enumerate(annotations, 1):
256
+ # Basic validation
257
+ issues = []
258
+
259
+ if not ann.module:
260
+ issues.append("Missing module declaration (⊢)")
261
+
262
+ if not ann.dependencies:
263
+ issues.append("Missing dependencies (∂)")
264
+
265
+ if not ann.invariants:
266
+ issues.append("Missing invariants (⊨)")
267
+
268
+ if issues:
269
+ print(f" ⚠️ Annotation {i}:")
270
+ for issue in issues:
271
+ print(f" - {issue}")
272
+ all_valid = False
273
+ else:
274
+ print(f" ✅ Annotation {i}: Valid")
275
+
276
+ except Exception as e:
277
+ print(f" ❌ Error: {e}")
278
+ all_valid = False
279
+
280
+ print()
281
+
282
+ return 0 if all_valid else 1
283
+
284
+
285
+ def add_darkarts_subcommands(subparsers):
286
+ """
287
+ Add DarkArts subcommands to VooDocs CLI.
288
+
289
+ Args:
290
+ subparsers: Argparse subparsers object
291
+ """
292
+ # darkarts command group
293
+ darkarts_parser = subparsers.add_parser(
294
+ "darkarts",
295
+ help="DarkArts symbolic documentation tools"
296
+ )
297
+ darkarts_subparsers = darkarts_parser.add_subparsers(
298
+ dest="darkarts_action",
299
+ help="DarkArts actions"
300
+ )
301
+
302
+ # darkarts translate
303
+ translate_parser = darkarts_subparsers.add_parser(
304
+ "translate",
305
+ help="Translate between symbols and natural language"
306
+ )
307
+ translate_parser.add_argument(
308
+ "files",
309
+ nargs="+",
310
+ help="Files to translate"
311
+ )
312
+ translate_parser.add_argument(
313
+ "--to-symbols",
314
+ action="store_true",
315
+ help="Translate from natural language to symbols (default: symbols to natural)"
316
+ )
317
+
318
+ # darkarts convert
319
+ convert_parser = darkarts_subparsers.add_parser(
320
+ "convert",
321
+ help="Convert VooDocs annotations to DarkArts"
322
+ )
323
+ convert_parser.add_argument(
324
+ "files",
325
+ nargs="+",
326
+ help="Files to convert"
327
+ )
328
+ convert_parser.add_argument(
329
+ "--in-place",
330
+ action="store_true",
331
+ help="Modify files in place (default: print to console)"
332
+ )
333
+
334
+ # darkarts stats
335
+ stats_parser = darkarts_subparsers.add_parser(
336
+ "stats",
337
+ help="Show DarkArts usage statistics"
338
+ )
339
+ stats_parser.add_argument(
340
+ "paths",
341
+ nargs="*",
342
+ default=["."],
343
+ help="Paths to analyze (default: current directory)"
344
+ )
345
+
346
+ # darkarts validate
347
+ validate_parser = darkarts_subparsers.add_parser(
348
+ "validate",
349
+ help="Validate DarkArts annotations"
350
+ )
351
+ validate_parser.add_argument(
352
+ "files",
353
+ nargs="+",
354
+ help="Files to validate"
355
+ )
356
+
357
+ return darkarts_parser
358
+
359
+
360
+ def dispatch_darkarts_command(args):
361
+ """
362
+ Dispatch DarkArts subcommands.
363
+
364
+ Args:
365
+ args: Parsed command-line arguments
366
+
367
+ Returns:
368
+ Exit code (0 for success, 1 for error)
369
+ """
370
+ if not hasattr(args, 'darkarts_action') or not args.darkarts_action:
371
+ print("Error: No DarkArts action specified")
372
+ print("Use 'voodocs darkarts --help' for usage")
373
+ return 1
374
+
375
+ if args.darkarts_action == "translate":
376
+ return cmd_darkarts_translate(args)
377
+ elif args.darkarts_action == "convert":
378
+ return cmd_darkarts_convert(args)
379
+ elif args.darkarts_action == "stats":
380
+ return cmd_darkarts_stats(args)
381
+ elif args.darkarts_action == "validate":
382
+ return cmd_darkarts_validate(args)
383
+ else:
384
+ print(f"Error: Unknown DarkArts action: {args.darkarts_action}")
385
+ return 1
@@ -1,9 +1,17 @@
1
- """
2
- VooDocs Context System
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
- A structured, machine-readable knowledge base for software projects.
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
- """@voodocs
2
- module_purpose: "Native AI assistant integrations (Claude, Cursor, Copilot, Windsurf, Cline)"
3
- dependencies: [
4
- "pathlib: File path handling",
5
- "typing: Type hints"
6
- ]
7
- assumptions: [
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(1)|most-cmds,O(n)|generate:n=src-files}
7
+ ⚡{O():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
- """@voodocs
2
- module_purpose: "Architecture diagram generation from context (Mermaid and D2 formats)"
3
- dependencies: [
4
- "subprocess: External diagram rendering (manus-render-diagram)",
5
- "pathlib: File path handling",
6
- "typing: Type hints"
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
- """@voodocs
2
- module_purpose: "Data structures for VooDocs context system (dataclasses for all context entities)"
3
- dependencies: [
4
- "dataclasses: Python dataclass decorator",
5
- "typing: Type hints for optional and complex types",
6
- "datetime: Date handling"
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
 
@@ -4,7 +4,7 @@
4
4
  ⚠{annotations:parsed,paths:relative,extensions:standard}
5
5
  ⊨{∀extract→complete-module,language:detected,api:extracted}
6
6
  🔒{read-only,¬modify-annotations}
7
- ⚡{O(1)}
7
+ ⚡{O(n):module-utilities|3-loops}
8
8
 
9
9
  Module Extraction Utilities
10
10
 
@@ -4,7 +4,7 @@
4
4
  ⚠{term:ansi,tqdm:installed,users:visual-feedback}
5
5
  ⊨{colors→reset,progress→close,confirm→bool,∀output→safe}
6
6
  🔒{no-implications}
7
- ⚡{O(1)}
7
+ ⚡{O():ui-rendering|4-loops,depth=2}
8
8
 
9
9
  User Interface Utilities
10
10
 
@@ -4,7 +4,7 @@
4
4
  ⚠{name∈fs-safe,v∈semver,path∈rel∨abs}
5
5
  ⊨{∀validate_*→(⊥⇒raise)∧(⊤⇒norm),deterministic,msg:actionable}
6
6
  🔒{validate-input,¬injection,¬fs-attack}
7
- ⚡{O(1)|regex-fast-on-short-str}
7
+ ⚡{O(n):validation|regex-on-input-strings}
8
8
 
9
9
  Input Validation Utilities
10
10
 
@@ -1,29 +1,14 @@
1
- """@voodocs
2
- module_purpose: "YAML parsing, serialization, and formatting for .voodocs.context files"
3
- dependencies: [
4
- "yaml: PyYAML library for YAML parsing",
5
- "pathlib: File path handling",
6
- "models: ContextFile and related dataclasses"
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
- DarkArts Core - Domain-agnostic reasoning engine.
3
- """
13
+
4
14
 
5
15
  from .plugin import (
6
16
  DarkArtsPlugin,
@@ -1,6 +1,20 @@
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.
3
- """
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
17
+ """"
4
18
 
5
19
  from typing import Any, Dict, List, Optional
6
20
  from .plugin import DarkArtsPlugin, PluginInput, PluginOutput, PluginMetadata, PluginError
@@ -1,6 +1,21 @@
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.
3
- """
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
18
+ """"
4
19
 
5
20
  import importlib
6
21
  import importlib.util
@@ -1,8 +1,21 @@
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
- This module defines the base classes and interfaces for the DarkArts plugin system.
5
- """
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)
18
+ """"
6
19
 
7
20
  from abc import ABC, abstractmethod
8
21
  from dataclasses import dataclass, field