@voodocs/cli 2.1.3 → 2.2.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/lib/cli/generate.py +59 -0
- package/package.json +1 -1
package/lib/cli/generate.py
CHANGED
|
@@ -202,6 +202,65 @@ def generate(
|
|
|
202
202
|
except Exception as e:
|
|
203
203
|
click.secho(f"❌ {file_path}: {e}", fg='red')
|
|
204
204
|
|
|
205
|
+
# Generate consolidated documentation
|
|
206
|
+
click.echo()
|
|
207
|
+
click.secho("📚 Generating consolidated documentation...", fg='cyan')
|
|
208
|
+
try:
|
|
209
|
+
from darkarts.documentation import DocumentationConsolidator, DocumentedItem, AnnotationCategorizer
|
|
210
|
+
|
|
211
|
+
consolidator = DocumentationConsolidator(
|
|
212
|
+
project_name=config.get('project', {}).get('name', 'Project') if config else 'Project'
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
# Add all processed files to consolidator
|
|
216
|
+
for file_path in files_to_process:
|
|
217
|
+
try:
|
|
218
|
+
content = file_path.read_text(encoding='utf-8')
|
|
219
|
+
annotation = _extract_annotation(content)
|
|
220
|
+
|
|
221
|
+
if annotation:
|
|
222
|
+
# Parse annotations
|
|
223
|
+
annotations_dict = {
|
|
224
|
+
'module_id': _extract_section(annotation, '⊢'),
|
|
225
|
+
'dependencies': _extract_section(annotation, '∂'),
|
|
226
|
+
'assumptions': _extract_section(annotation, '⚠'),
|
|
227
|
+
'invariants': _extract_section(annotation, '⊨'),
|
|
228
|
+
'security': _extract_section(annotation, '🔒'),
|
|
229
|
+
'complexity': _extract_section(annotation, '⚡'),
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
# Create documented item
|
|
233
|
+
item = DocumentedItem(
|
|
234
|
+
name=AnnotationCategorizer.extract_name(str(file_path)),
|
|
235
|
+
file_path=str(file_path.relative_to(source_path)),
|
|
236
|
+
item_type=AnnotationCategorizer.detect_type(str(file_path), annotations_dict),
|
|
237
|
+
content=_generate_doc_for_file(file_path, 'markdown', include_private),
|
|
238
|
+
annotations=annotations_dict,
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
# Detect categories
|
|
242
|
+
item.domains = AnnotationCategorizer.detect_domains(str(file_path), annotations_dict)
|
|
243
|
+
item.concerns = AnnotationCategorizer.detect_concerns(annotations_dict)
|
|
244
|
+
item.layers = AnnotationCategorizer.detect_layers(str(file_path), annotations_dict)
|
|
245
|
+
|
|
246
|
+
consolidator.add_item(item)
|
|
247
|
+
except Exception as e:
|
|
248
|
+
click.secho(f" ⚠️ Failed to consolidate {file_path}: {e}", fg='yellow')
|
|
249
|
+
|
|
250
|
+
# Generate all consolidated docs
|
|
251
|
+
consolidated_docs = consolidator.generate_all()
|
|
252
|
+
|
|
253
|
+
# Write consolidated docs
|
|
254
|
+
for doc_path, doc_content in consolidated_docs.items():
|
|
255
|
+
full_path = output_path / doc_path
|
|
256
|
+
full_path.parent.mkdir(parents=True, exist_ok=True)
|
|
257
|
+
full_path.write_text(doc_content, encoding='utf-8')
|
|
258
|
+
click.echo(f" ✓ {doc_path}")
|
|
259
|
+
|
|
260
|
+
click.secho(f" ✓ Generated {len(consolidated_docs)} consolidated documents", fg='green')
|
|
261
|
+
except Exception as e:
|
|
262
|
+
click.secho(f" ⚠️ Consolidated documentation failed: {e}", fg='yellow')
|
|
263
|
+
|
|
205
264
|
# Summary
|
|
206
265
|
click.echo()
|
|
207
266
|
click.echo("━" * 60)
|
package/package.json
CHANGED