refactor: deepen modules, consolidate inference, delete dead code

- Extract build_graph/load_config/create_renderer in presentation (393→~250 lines)
- Move module inference into ModuleName::from_path(), delete 3 scattered copies
- Move resolve_relationships/filter_external_imports into CodeGraph
- Add LanguageExtractor trait in tree-sitter adapter
- Add CodeGraph::elements_by_module(), replace 6 identical grouping loops
- Delete dead RenderDiagrams query
This commit is contained in:
2026-06-16 16:34:41 +02:00
parent dc8ecd983a
commit d28b00c697
15 changed files with 322 additions and 460 deletions

View File

@@ -1,5 +1,3 @@
use std::collections::HashMap;
use archlens_domain::{
CodeElement, CodeGraph, DomainError, RelationshipKind, RenderOutput, RenderedFile,
ports::DiagramRenderer,
@@ -55,19 +53,7 @@ impl DiagramRenderer for AsciiRenderer {
return Ok(RenderOutput::single(file));
}
let mut grouped: HashMap<String, Vec<&CodeElement>> = HashMap::new();
let mut ungrouped: Vec<&CodeElement> = Vec::new();
for element in graph.elements() {
if let Some(module) = element.module() {
grouped
.entry(module.as_str().to_string())
.or_default()
.push(element);
} else {
ungrouped.push(element);
}
}
let (grouped, ungrouped) = graph.elements_by_module();
if !ungrouped.is_empty() {
lines.push(String::new());