@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,66 @@
|
|
|
1
|
+
"""
|
|
2
|
+
VooDocs PDF Exporter
|
|
3
|
+
|
|
4
|
+
Exports documentation to PDF format.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class PDFExporter:
|
|
12
|
+
"""Exports Markdown documentation to PDF."""
|
|
13
|
+
|
|
14
|
+
def export(self, markdown_file: str, output_file: Optional[str] = None) -> str:
|
|
15
|
+
"""Export Markdown file to PDF."""
|
|
16
|
+
md_path = Path(markdown_file)
|
|
17
|
+
|
|
18
|
+
if not md_path.exists():
|
|
19
|
+
raise FileNotFoundError(f"Markdown file not found: {markdown_file}")
|
|
20
|
+
|
|
21
|
+
# Determine output file
|
|
22
|
+
if not output_file:
|
|
23
|
+
output_file = md_path.with_suffix('.pdf')
|
|
24
|
+
|
|
25
|
+
output_path = Path(output_file)
|
|
26
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
27
|
+
|
|
28
|
+
# Try different PDF generation methods
|
|
29
|
+
try:
|
|
30
|
+
self._export_with_weasyprint(md_path, output_path)
|
|
31
|
+
except ImportError:
|
|
32
|
+
try:
|
|
33
|
+
self._export_with_markdown_pdf(md_path, output_path)
|
|
34
|
+
except ImportError:
|
|
35
|
+
raise ImportError(
|
|
36
|
+
"PDF export requires either 'weasyprint' or 'markdown-pdf'. "
|
|
37
|
+
"Install with: pip install weasyprint"
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
return str(output_path)
|
|
41
|
+
|
|
42
|
+
def _export_with_weasyprint(self, md_path: Path, output_path: Path):
|
|
43
|
+
"""Export using WeasyPrint (HTML to PDF)."""
|
|
44
|
+
from weasyprint import HTML
|
|
45
|
+
from darkarts.plugins.voodocs.html_exporter import HTMLExporter
|
|
46
|
+
|
|
47
|
+
# First convert to HTML
|
|
48
|
+
html_exporter = HTMLExporter()
|
|
49
|
+
html_content = html_exporter.export(str(md_path))
|
|
50
|
+
|
|
51
|
+
# Then convert HTML to PDF
|
|
52
|
+
HTML(string=html_content).write_pdf(str(output_path))
|
|
53
|
+
|
|
54
|
+
def _export_with_markdown_pdf(self, md_path: Path, output_path: Path):
|
|
55
|
+
"""Export using markdown-pdf (fallback)."""
|
|
56
|
+
import subprocess
|
|
57
|
+
|
|
58
|
+
# Use manus-md-to-pdf utility if available
|
|
59
|
+
result = subprocess.run(
|
|
60
|
+
['manus-md-to-pdf', str(md_path), str(output_path)],
|
|
61
|
+
capture_output=True,
|
|
62
|
+
text=True
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
if result.returncode != 0:
|
|
66
|
+
raise RuntimeError(f"PDF generation failed: {result.stderr}")
|