feat(renderer): implement module-level documentation generation

- Added module_md template to renderer for generating detailed module documentation
- Updated CLI to use renderer for module docs with fallback to simple template
- Generated module documentation for test project files with symbols, dependencies, and integrations
- Added proper error handling when module rendering fails

This implements the core functionality for generating detailed architectural documentation at the module level, including symbols, dependencies, and integration points.
This commit is contained in:
2026-01-25 21:24:54 +03:00
parent 3ffe5e235f
commit b7d3e3e488
9 changed files with 377 additions and 4 deletions

View File

View File

@@ -325,9 +325,19 @@ fn generate_docs(model: &ProjectModel, out: &str) -> Result<()> {
// Create individual documentation files for modules and files
for (module_id, _module) in &model.modules {
let module_doc_path = modules_path.join(format!("{}.md", sanitize_filename(module_id)));
let module_content = format!("# Module: {}\n\nTODO: Add module documentation\n", module_id);
std::fs::write(&module_doc_path, module_content)
.map_err(|e| anyhow::anyhow!("Failed to create module doc {}: {}", module_doc_path.display(), e))?;
match renderer.render_module_md(model, module_id) {
Ok(module_content) => {
std::fs::write(&module_doc_path, module_content)
.map_err(|e| anyhow::anyhow!("Failed to create module doc {}: {}", module_doc_path.display(), e))?;
}
Err(e) => {
eprintln!("Warning: Failed to render module doc for {}: {}", module_id, e);
// Fallback to simple template
let module_content = format!("# Module: {}\n\nTODO: Add module documentation\n", module_id);
std::fs::write(&module_doc_path, module_content)
.map_err(|e| anyhow::anyhow!("Failed to create module doc {}: {}", module_doc_path.display(), e))?;
}
}
}
for (_file_id, file_doc) in &model.files {