diff --git a/docs/architecture/module.mmd b/docs/architecture/module.mmd index 49f99e2..e0db7c4 100644 --- a/docs/architecture/module.mmd +++ b/docs/architecture/module.mmd @@ -3,8 +3,8 @@ graph TD Presentation[Presentation] Adapters[Adapters] Application[Application] - Presentation -->|11 deps| Adapters - Presentation -->|1 dep| Domain Presentation -->|1 dep| Application - Application -->|4 deps| Domain - Adapters -->|25 deps| Domain \ No newline at end of file + Adapters -->|25 deps| Domain + Presentation -->|1 dep| Domain + Presentation -->|11 deps| Adapters + Application -->|4 deps| Domain \ No newline at end of file diff --git a/docs/architecture/project.mmd b/docs/architecture/project.mmd index e750e68..eee7b3b 100644 --- a/docs/architecture/project.mmd +++ b/docs/architecture/project.mmd @@ -16,19 +16,19 @@ graph TD archlens_html[archlens-html] end archlens_application --> archlens_domain - archlens --> archlens_toml_config - archlens --> archlens_file_writer - archlens --> archlens_d2 - archlens --> archlens_python_project archlens --> archlens_application archlens --> archlens_mermaid - archlens --> archlens_cargo_workspace - archlens --> archlens_domain - archlens --> archlens_tree_sitter - archlens --> archlens_html archlens --> archlens_stdout_writer - archlens --> archlens_walkdir archlens --> archlens_ascii + archlens --> archlens_domain + archlens --> archlens_file_writer + archlens --> archlens_python_project + archlens --> archlens_walkdir + archlens --> archlens_toml_config + archlens --> archlens_html + archlens --> archlens_cargo_workspace + archlens --> archlens_d2 + archlens --> archlens_tree_sitter archlens_tree_sitter --> archlens_domain archlens_walkdir --> archlens_domain archlens_mermaid --> archlens_domain diff --git a/docs/architecture/type/overview.mmd b/docs/architecture/type/overview.mmd index 869fa13..932d91a 100644 --- a/docs/architecture/type/overview.mmd +++ b/docs/architecture/type/overview.mmd @@ -1,34 +1,7 @@ classDiagram - namespace Domain { - class OutputConfig - class DiagramLevel - class RenderOutput - class RenderedFile - class SourceFile - class ModuleName - class ModuleAssignment - class Language - class FilePath - class RelationshipKind - class Visibility - class CodeElementKind - class RuleKind - class RuleViolation - class BoundaryRule - class AnalysisConfig - class AnalysisResult - class AnalysisWarning - class Relationship - class CodeElement - class FileDiscovery - class ConfigLoader - class ProjectAnalyzer - class OutputWriter - class DiagramRenderer - class SourceAnalyzer - class NormalizedGraph - class CodeGraph - class DomainError + namespace Presentation { + class Cli + class Command } namespace Adapters { class MermaidRenderer @@ -63,9 +36,36 @@ classDiagram class MemberToml class PackageSection } - namespace Presentation { - class Cli - class Command + namespace Domain { + class OutputConfig + class DiagramLevel + class RenderOutput + class RenderedFile + class SourceFile + class ModuleName + class ModuleAssignment + class Language + class FilePath + class RelationshipKind + class Visibility + class CodeElementKind + class RuleKind + class RuleViolation + class BoundaryRule + class AnalysisConfig + class AnalysisResult + class AnalysisWarning + class Relationship + class CodeElement + class FileDiscovery + class ConfigLoader + class ProjectAnalyzer + class OutputWriter + class DiagramRenderer + class SourceAnalyzer + class NormalizedGraph + class CodeGraph + class DomainError } namespace Application { class AnalyzeCodebase @@ -76,6 +76,118 @@ classDiagram class GenerateDiagramResult class GenerateDiagram } + Cli : command Option + Cli : path PathBuf + Cli : level String + Cli : format String + Cli : output Option + Cli : config Option + Cli : scope Option + Cli : exclude Vec + Cli : include_tests bool + Cli : no_weights bool + Cli : watch bool + Cli : since Option + Cli : split_by_module bool + Cli : strict bool + Cli : check bool + Cli : verbose u8 + MermaidRenderer : level DiagramLevel + MermaidRenderer : show_weights bool + MermaidRenderer : +new() -] Self + MermaidRenderer : +with_level(level DiagramLevel) -] Self + MermaidRenderer : +with_weights(show bool) -] Self + MermaidRenderer : -display_name(qualified str) -] str + MermaidRenderer : -format_element_name(element CodeElement) -] String + MermaidRenderer : -format_visibility(visibility Visibility) -] static str + MermaidRenderer : -render_class_diagram(graph CodeGraph) -] String + MermaidRenderer : -push_class_lines(lines mut Vec[String], deferred mut Vec[String], element CodeElement, indent str, in_namespace bool) + MermaidRenderer : -render_module_flowchart(graph CodeGraph) -] String + MermaidRenderer : -render_project_flowchart(graph CodeGraph) -] String + MermaidRenderer : -sanitize_id(name str) -] String + AsciiRenderer : +new() -] Self + AsciiRenderer : -format_kind(element CodeElement) -] static str + PythonProjectAnalyzer : +new() -] Self + <> ProjectSection + ProjectSection : name Option + ProjectSection : dependencies Vec + <> PoetrySection + PoetrySection : name Option + PoetrySection : dependencies HashMap + <> ToolSection + ToolSection : poetry PoetrySection + <> PyprojectToml + PyprojectToml : project Option + PyprojectToml : tool ToolSection + WalkdirDiscovery : +new() -] Self + WalkdirDiscovery : -detect_language(path Path) -] Option[Language] + WalkdirDiscovery : -is_excluded(path Path, root Path, excludes [String]) -] bool + ExtractionContext : elements Vec + ExtractionContext : relationships Vec + ExtractionContext : warnings Vec + ExtractionContext : local_types HashSet + ExtractionContext : file_path FilePath + ExtractionContext : +new(file_path FilePath) -] Self + ExtractionContext : +add_element(element CodeElement) + ExtractionContext : +add_relationship(rel Relationship) + ExtractionContext : +add_warning(file_path FilePath, line usize, message str) + ExtractionContext : +file_path() -] FilePath + ExtractionContext : +into_result() -] Result[AnalysisResult, DomainError] + TreeSitterAnalyzer : rust RustExtractor + TreeSitterAnalyzer : python PythonExtractor + TreeSitterAnalyzer : +new() -] Self + TreeSitterAnalyzer : -extractor_for(language Language) -] Option[dyn LanguageExtractor] + FileOutputWriter : output_path OutputPath + FileOutputWriter : +new(output_dir PathBuf) -] Self + FileOutputWriter : +single_file(path PathBuf) -] Self + <> OutputPath + StdoutOutputWriter : +new() -] Self + <> RawRules + RawRules : allow Vec + RawRules : deny Vec + <> RawConfig + RawConfig : analysis RawAnalysis + RawConfig : output RawOutput + RawConfig : modules HashMap + RawConfig : rules RawRules + <> RawAnalysis + RawAnalysis : exclude Vec + RawAnalysis : level Option + <> RawOutput + RawOutput : format Option + RawOutput : path Option + RawOutput : split_by_module bool + TomlConfigLoader : raw RawConfig + TomlConfigLoader : +from_path(path Path) -] Result[Self, DomainError] + TomlConfigLoader : -parse_level(level Option[String]) -] DiagramLevel + D2Renderer : level DiagramLevel + D2Renderer : +new() -] Self + D2Renderer : +with_level(level DiagramLevel) -] Self + HtmlRenderer : +new() -] Self + <> GraphData + GraphData : nodes Vec + GraphData : edges Vec + <> NodeData + NodeData : id String + NodeData : label String + NodeData : module String + NodeData : kind String + NodeData : fields Vec + NodeData : methods Vec + <> EdgeData + EdgeData : source String + EdgeData : target String + EdgeData : kind String + CargoWorkspaceAnalyzer : +new() -] Self + <> WorkspaceToml + WorkspaceToml : workspace Option + <> WorkspaceSection + WorkspaceSection : members Vec + <> MemberToml + MemberToml : package Option + MemberToml : dependencies HashMap + <> PackageSection + PackageSection : name String OutputConfig : split_by_module bool OutputConfig : output_path Option OutputConfig : +with_split_by_module(split bool) -] Self @@ -224,118 +336,6 @@ classDiagram CodeGraph : +subgraph_by_module(module ModuleName) -] CodeGraph CodeGraph : +merge_project_edges(project_graph CodeGraph) CodeGraph : +module_edges() -] HashMap[(String, String), usize] - MermaidRenderer : level DiagramLevel - MermaidRenderer : show_weights bool - MermaidRenderer : +new() -] Self - MermaidRenderer : +with_level(level DiagramLevel) -] Self - MermaidRenderer : +with_weights(show bool) -] Self - MermaidRenderer : -display_name(qualified str) -] str - MermaidRenderer : -format_element_name(element CodeElement) -] String - MermaidRenderer : -format_visibility(visibility Visibility) -] static str - MermaidRenderer : -render_class_diagram(graph CodeGraph) -] String - MermaidRenderer : -push_class_lines(lines mut Vec[String], deferred mut Vec[String], element CodeElement, indent str, in_namespace bool) - MermaidRenderer : -render_module_flowchart(graph CodeGraph) -] String - MermaidRenderer : -render_project_flowchart(graph CodeGraph) -] String - MermaidRenderer : -sanitize_id(name str) -] String - AsciiRenderer : +new() -] Self - AsciiRenderer : -format_kind(element CodeElement) -] static str - PythonProjectAnalyzer : +new() -] Self - <> ProjectSection - ProjectSection : name Option - ProjectSection : dependencies Vec - <> PoetrySection - PoetrySection : name Option - PoetrySection : dependencies HashMap - <> ToolSection - ToolSection : poetry PoetrySection - <> PyprojectToml - PyprojectToml : project Option - PyprojectToml : tool ToolSection - WalkdirDiscovery : +new() -] Self - WalkdirDiscovery : -detect_language(path Path) -] Option[Language] - WalkdirDiscovery : -is_excluded(path Path, root Path, excludes [String]) -] bool - ExtractionContext : elements Vec - ExtractionContext : relationships Vec - ExtractionContext : warnings Vec - ExtractionContext : local_types HashSet - ExtractionContext : file_path FilePath - ExtractionContext : +new(file_path FilePath) -] Self - ExtractionContext : +add_element(element CodeElement) - ExtractionContext : +add_relationship(rel Relationship) - ExtractionContext : +add_warning(file_path FilePath, line usize, message str) - ExtractionContext : +file_path() -] FilePath - ExtractionContext : +into_result() -] Result[AnalysisResult, DomainError] - TreeSitterAnalyzer : rust RustExtractor - TreeSitterAnalyzer : python PythonExtractor - TreeSitterAnalyzer : +new() -] Self - TreeSitterAnalyzer : -extractor_for(language Language) -] Option[dyn LanguageExtractor] - FileOutputWriter : output_path OutputPath - FileOutputWriter : +new(output_dir PathBuf) -] Self - FileOutputWriter : +single_file(path PathBuf) -] Self - <> OutputPath - StdoutOutputWriter : +new() -] Self - <> RawRules - RawRules : allow Vec - RawRules : deny Vec - <> RawConfig - RawConfig : analysis RawAnalysis - RawConfig : output RawOutput - RawConfig : modules HashMap - RawConfig : rules RawRules - <> RawAnalysis - RawAnalysis : exclude Vec - RawAnalysis : level Option - <> RawOutput - RawOutput : format Option - RawOutput : path Option - RawOutput : split_by_module bool - TomlConfigLoader : raw RawConfig - TomlConfigLoader : +from_path(path Path) -] Result[Self, DomainError] - TomlConfigLoader : -parse_level(level Option[String]) -] DiagramLevel - D2Renderer : level DiagramLevel - D2Renderer : +new() -] Self - D2Renderer : +with_level(level DiagramLevel) -] Self - HtmlRenderer : +new() -] Self - <> GraphData - GraphData : nodes Vec - GraphData : edges Vec - <> NodeData - NodeData : id String - NodeData : label String - NodeData : module String - NodeData : kind String - NodeData : fields Vec - NodeData : methods Vec - <> EdgeData - EdgeData : source String - EdgeData : target String - EdgeData : kind String - CargoWorkspaceAnalyzer : +new() -] Self - <> WorkspaceToml - WorkspaceToml : workspace Option - <> WorkspaceSection - WorkspaceSection : members Vec - <> MemberToml - MemberToml : package Option - MemberToml : dependencies HashMap - <> PackageSection - PackageSection : name String - Cli : command Option - Cli : path PathBuf - Cli : level String - Cli : format String - Cli : output Option - Cli : config Option - Cli : scope Option - Cli : exclude Vec - Cli : include_tests bool - Cli : no_weights bool - Cli : watch bool - Cli : since Option - Cli : split_by_module bool - Cli : strict bool - Cli : check bool - Cli : verbose u8 AnalyzeCodebase : file_discovery F AnalyzeCodebase : source_analyzer S AnalyzeCodebase : +new(file_discovery F, source_analyzer S) -] Self