@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,260 @@
|
|
|
1
|
+
"""
|
|
2
|
+
VooDocs HTML Exporter
|
|
3
|
+
|
|
4
|
+
Exports documentation to HTML format with styling.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class HTMLExporter:
|
|
12
|
+
"""Exports Markdown documentation to HTML."""
|
|
13
|
+
|
|
14
|
+
def __init__(self):
|
|
15
|
+
self.css = self._get_default_css()
|
|
16
|
+
|
|
17
|
+
def export(self, markdown_file: str, output_file: Optional[str] = None) -> str:
|
|
18
|
+
"""Export Markdown file to HTML."""
|
|
19
|
+
md_path = Path(markdown_file)
|
|
20
|
+
|
|
21
|
+
if not md_path.exists():
|
|
22
|
+
raise FileNotFoundError(f"Markdown file not found: {markdown_file}")
|
|
23
|
+
|
|
24
|
+
# Read Markdown content
|
|
25
|
+
markdown_content = md_path.read_text(encoding='utf-8')
|
|
26
|
+
|
|
27
|
+
# Convert to HTML
|
|
28
|
+
html_content = self._markdown_to_html(markdown_content)
|
|
29
|
+
|
|
30
|
+
# Wrap in full HTML document
|
|
31
|
+
full_html = self._wrap_html(html_content, md_path.stem)
|
|
32
|
+
|
|
33
|
+
# Write to file
|
|
34
|
+
if output_file:
|
|
35
|
+
output_path = Path(output_file)
|
|
36
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
37
|
+
output_path.write_text(full_html, encoding='utf-8')
|
|
38
|
+
return str(output_path)
|
|
39
|
+
|
|
40
|
+
return full_html
|
|
41
|
+
|
|
42
|
+
def _markdown_to_html(self, markdown_text: str) -> str:
|
|
43
|
+
"""Convert Markdown to HTML (simple implementation)."""
|
|
44
|
+
try:
|
|
45
|
+
import markdown as md_module
|
|
46
|
+
md = md_module.Markdown(extensions=['tables', 'fenced_code', 'codehilite'])
|
|
47
|
+
return md.convert(markdown_text)
|
|
48
|
+
except (ImportError, AttributeError):
|
|
49
|
+
# Fallback to basic conversion
|
|
50
|
+
return self._basic_markdown_to_html(markdown_text)
|
|
51
|
+
|
|
52
|
+
def _basic_markdown_to_html(self, markdown: str) -> str:
|
|
53
|
+
"""Basic Markdown to HTML conversion (fallback)."""
|
|
54
|
+
import re
|
|
55
|
+
|
|
56
|
+
html = markdown
|
|
57
|
+
|
|
58
|
+
# Headers
|
|
59
|
+
html = re.sub(r'^### (.+)$', r'<h3>\1</h3>', html, flags=re.MULTILINE)
|
|
60
|
+
html = re.sub(r'^## (.+)$', r'<h2>\1</h2>', html, flags=re.MULTILINE)
|
|
61
|
+
html = re.sub(r'^# (.+)$', r'<h1>\1</h1>', html, flags=re.MULTILINE)
|
|
62
|
+
|
|
63
|
+
# Bold
|
|
64
|
+
html = re.sub(r'\*\*(.+?)\*\*', r'<strong>\1</strong>', html)
|
|
65
|
+
|
|
66
|
+
# Italic
|
|
67
|
+
html = re.sub(r'\*(.+?)\*', r'<em>\1</em>', html)
|
|
68
|
+
|
|
69
|
+
# Code blocks
|
|
70
|
+
html = re.sub(r'```(\w+)?\n(.+?)\n```', r'<pre><code class="language-\1">\2</code></pre>', html, flags=re.DOTALL)
|
|
71
|
+
|
|
72
|
+
# Inline code
|
|
73
|
+
html = re.sub(r'`(.+?)`', r'<code>\1</code>', html)
|
|
74
|
+
|
|
75
|
+
# Lists
|
|
76
|
+
html = re.sub(r'^\- (.+)$', r'<li>\1</li>', html, flags=re.MULTILINE)
|
|
77
|
+
html = re.sub(r'(<li>.*</li>)', r'<ul>\1</ul>', html, flags=re.DOTALL)
|
|
78
|
+
|
|
79
|
+
# Paragraphs
|
|
80
|
+
html = re.sub(r'\n\n', r'</p><p>', html)
|
|
81
|
+
html = f'<p>{html}</p>'
|
|
82
|
+
|
|
83
|
+
return html
|
|
84
|
+
|
|
85
|
+
def _wrap_html(self, content: str, title: str) -> str:
|
|
86
|
+
"""Wrap HTML content in full document."""
|
|
87
|
+
return f"""<!DOCTYPE html>
|
|
88
|
+
<html lang="en">
|
|
89
|
+
<head>
|
|
90
|
+
<meta charset="UTF-8">
|
|
91
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
92
|
+
<title>{title} - VooDocs Documentation</title>
|
|
93
|
+
<style>
|
|
94
|
+
{self.css}
|
|
95
|
+
</style>
|
|
96
|
+
</head>
|
|
97
|
+
<body>
|
|
98
|
+
<div class="container">
|
|
99
|
+
<header>
|
|
100
|
+
<h1 class="voodocs-title">{title}</h1>
|
|
101
|
+
<p class="voodocs-subtitle">Generated by VooDocs</p>
|
|
102
|
+
</header>
|
|
103
|
+
<main>
|
|
104
|
+
{content}
|
|
105
|
+
</main>
|
|
106
|
+
<footer>
|
|
107
|
+
<p>Documentation generated with <a href="https://voodocs.dev">VooDocs</a></p>
|
|
108
|
+
</footer>
|
|
109
|
+
</div>
|
|
110
|
+
</body>
|
|
111
|
+
</html>"""
|
|
112
|
+
|
|
113
|
+
def _get_default_css(self) -> str:
|
|
114
|
+
"""Get default CSS styling."""
|
|
115
|
+
return """
|
|
116
|
+
* {
|
|
117
|
+
margin: 0;
|
|
118
|
+
padding: 0;
|
|
119
|
+
box-sizing: border-box;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
body {
|
|
123
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
124
|
+
line-height: 1.6;
|
|
125
|
+
color: #333;
|
|
126
|
+
background-color: #f5f5f5;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.container {
|
|
130
|
+
max-width: 900px;
|
|
131
|
+
margin: 0 auto;
|
|
132
|
+
padding: 20px;
|
|
133
|
+
background-color: white;
|
|
134
|
+
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
header {
|
|
138
|
+
border-bottom: 3px solid #8b5cf6;
|
|
139
|
+
padding-bottom: 20px;
|
|
140
|
+
margin-bottom: 30px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.voodocs-title {
|
|
144
|
+
color: #8b5cf6;
|
|
145
|
+
font-size: 2.5em;
|
|
146
|
+
margin-bottom: 10px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.voodocs-subtitle {
|
|
150
|
+
color: #666;
|
|
151
|
+
font-size: 1.1em;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
h1, h2, h3, h4, h5, h6 {
|
|
155
|
+
margin-top: 1.5em;
|
|
156
|
+
margin-bottom: 0.5em;
|
|
157
|
+
color: #2d3748;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
h2 {
|
|
161
|
+
border-bottom: 2px solid #e2e8f0;
|
|
162
|
+
padding-bottom: 0.3em;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
p {
|
|
166
|
+
margin-bottom: 1em;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
code {
|
|
170
|
+
background-color: #f7fafc;
|
|
171
|
+
padding: 2px 6px;
|
|
172
|
+
border-radius: 3px;
|
|
173
|
+
font-family: 'Courier New', monospace;
|
|
174
|
+
font-size: 0.9em;
|
|
175
|
+
color: #e53e3e;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
pre {
|
|
179
|
+
background-color: #2d3748;
|
|
180
|
+
color: #f7fafc;
|
|
181
|
+
padding: 15px;
|
|
182
|
+
border-radius: 5px;
|
|
183
|
+
overflow-x: auto;
|
|
184
|
+
margin: 1em 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
pre code {
|
|
188
|
+
background-color: transparent;
|
|
189
|
+
color: #f7fafc;
|
|
190
|
+
padding: 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
ul, ol {
|
|
194
|
+
margin-left: 2em;
|
|
195
|
+
margin-bottom: 1em;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
li {
|
|
199
|
+
margin-bottom: 0.5em;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
table {
|
|
203
|
+
width: 100%;
|
|
204
|
+
border-collapse: collapse;
|
|
205
|
+
margin: 1em 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
th, td {
|
|
209
|
+
border: 1px solid #e2e8f0;
|
|
210
|
+
padding: 10px;
|
|
211
|
+
text-align: left;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
th {
|
|
215
|
+
background-color: #8b5cf6;
|
|
216
|
+
color: white;
|
|
217
|
+
font-weight: bold;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
tr:nth-child(even) {
|
|
221
|
+
background-color: #f7fafc;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
a {
|
|
225
|
+
color: #8b5cf6;
|
|
226
|
+
text-decoration: none;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
a:hover {
|
|
230
|
+
text-decoration: underline;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
footer {
|
|
234
|
+
margin-top: 50px;
|
|
235
|
+
padding-top: 20px;
|
|
236
|
+
border-top: 1px solid #e2e8f0;
|
|
237
|
+
text-align: center;
|
|
238
|
+
color: #666;
|
|
239
|
+
font-size: 0.9em;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.badge {
|
|
243
|
+
display: inline-block;
|
|
244
|
+
padding: 3px 8px;
|
|
245
|
+
border-radius: 3px;
|
|
246
|
+
font-size: 0.85em;
|
|
247
|
+
font-weight: bold;
|
|
248
|
+
margin-right: 5px;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.badge-green {
|
|
252
|
+
background-color: #48bb78;
|
|
253
|
+
color: white;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.badge-purple {
|
|
257
|
+
background-color: #8b5cf6;
|
|
258
|
+
color: white;
|
|
259
|
+
}
|
|
260
|
+
"""
|