diff --git a/docs/architecture/module.mmd b/docs/architecture/module.mmd new file mode 100644 index 0000000..7d6eeff --- /dev/null +++ b/docs/architecture/module.mmd @@ -0,0 +1,7 @@ +graph TD + Adapters[Adapters] + Domain[Domain] + Presentation[Presentation] + Application[Application] + Adapters --> Domain + Application --> Domain \ No newline at end of file diff --git a/docs/architecture/project.mmd b/docs/architecture/project.mmd new file mode 100644 index 0000000..c328386 --- /dev/null +++ b/docs/architecture/project.mmd @@ -0,0 +1,33 @@ +graph TD + archlens_domain[archlens-domain] + archlens_application[archlens-application] + archlens[archlens] + subgraph Adapters + archlens_tree_sitter[archlens-tree-sitter] + archlens_walkdir[archlens-walkdir] + archlens_mermaid[archlens-mermaid] + archlens_ascii[archlens-ascii] + archlens_file_writer[archlens-file-writer] + archlens_stdout_writer[archlens-stdout-writer] + archlens_toml_config[archlens-toml-config] + archlens_cargo_workspace[archlens-cargo-workspace] + end + archlens_application --> archlens_domain + archlens --> archlens_ascii + archlens --> archlens_toml_config + archlens --> archlens_file_writer + archlens --> archlens_tree_sitter + archlens --> archlens_cargo_workspace + archlens --> archlens_stdout_writer + archlens --> archlens_domain + archlens --> archlens_application + archlens --> archlens_mermaid + archlens --> archlens_walkdir + archlens_tree_sitter --> archlens_domain + archlens_walkdir --> archlens_domain + archlens_mermaid --> archlens_domain + archlens_ascii --> archlens_domain + archlens_file_writer --> archlens_domain + archlens_stdout_writer --> archlens_domain + archlens_toml_config --> archlens_domain + archlens_cargo_workspace --> archlens_domain \ No newline at end of file diff --git a/docs/architecture/type/adapters.mmd b/docs/architecture/type/adapters.mmd new file mode 100644 index 0000000..580bfce --- /dev/null +++ b/docs/architecture/type/adapters.mmd @@ -0,0 +1,78 @@ +classDiagram + namespace Adapters { + class AsciiRenderer + AsciiRenderer : +new() + AsciiRenderer : -format_kind() + class CargoWorkspaceAnalyzer + CargoWorkspaceAnalyzer : +new() + class WorkspaceToml + <> WorkspaceToml + WorkspaceToml : workspace: Option + class WorkspaceSection + <> WorkspaceSection + WorkspaceSection : members: Vec + class MemberToml + <> MemberToml + MemberToml : package: Option + MemberToml : dependencies: HashMap + class PackageSection + <> PackageSection + PackageSection : name: String + class StdoutOutputWriter + StdoutOutputWriter : +new() + class FileOutputWriter + FileOutputWriter : output_path: OutputPath + FileOutputWriter : +new() + FileOutputWriter : +single_file() + class OutputPath + <> OutputPath + class MermaidRenderer + MermaidRenderer : level: DiagramLevel + MermaidRenderer : +new() + MermaidRenderer : +with_level() + MermaidRenderer : -format_element_name() + MermaidRenderer : -format_visibility() + MermaidRenderer : -render_class_diagram() + MermaidRenderer : -push_class_lines() + MermaidRenderer : -render_module_flowchart() + MermaidRenderer : -render_project_flowchart() + MermaidRenderer : -sanitize_id() + class LanguageExtractor + class TreeSitterAnalyzer + TreeSitterAnalyzer : rust: RustExtractor + TreeSitterAnalyzer : python: PythonExtractor + TreeSitterAnalyzer : +new() + TreeSitterAnalyzer : -extractor_for() + class RustExtractor + class PythonExtractor + class WalkdirDiscovery + WalkdirDiscovery : +new() + WalkdirDiscovery : -detect_language() + WalkdirDiscovery : -is_excluded() + class RawConfig + <> RawConfig + RawConfig : analysis: RawAnalysis + RawConfig : output: RawOutput + RawConfig : modules: HashMap + class RawAnalysis + <> RawAnalysis + RawAnalysis : exclude: Vec + RawAnalysis : level: Option + class RawOutput + <> RawOutput + RawOutput : format: Option + RawOutput : path: Option + RawOutput : split_by_module: bool + class TomlConfigLoader + TomlConfigLoader : raw: RawConfig + TomlConfigLoader : +from_path() + TomlConfigLoader : -parse_level() + } + FileOutputWriter --> OutputPath + TreeSitterAnalyzer --> RustExtractor + TreeSitterAnalyzer --> PythonExtractor + RustExtractor <|-- LanguageExtractor + PythonExtractor <|-- LanguageExtractor + RawConfig --> RawAnalysis + RawConfig --> RawOutput + TomlConfigLoader --> RawConfig \ No newline at end of file diff --git a/docs/architecture/type/application.mmd b/docs/architecture/type/application.mmd new file mode 100644 index 0000000..600421e --- /dev/null +++ b/docs/architecture/type/application.mmd @@ -0,0 +1,30 @@ +classDiagram + namespace Application { + class AnalyzeCodebase + AnalyzeCodebase : file_discovery: F + AnalyzeCodebase : source_analyzer: S + AnalyzeCodebase : +new() + AnalyzeCodebase : +execute() + class AnalyzeCodebaseResult + AnalyzeCodebaseResult : graph: CodeGraph + AnalyzeCodebaseResult : warnings: Vec + AnalyzeCodebaseResult : +graph() + AnalyzeCodebaseResult : +warnings() + class FakeDiagramRenderer + FakeDiagramRenderer : +new() + class FakeResponse + <> FakeResponse + class FakeSourceAnalyzer + FakeSourceAnalyzer : results: HashMap + FakeSourceAnalyzer : +new() + FakeSourceAnalyzer : +with_result() + FakeSourceAnalyzer : +with_error() + class FakeFileDiscovery + FakeFileDiscovery : files: Vec + FakeFileDiscovery : +new() + FakeFileDiscovery : +empty() + class FakeOutputWriter + FakeOutputWriter : written: RefCell + FakeOutputWriter : +new() + FakeOutputWriter : +written_outputs() + } \ No newline at end of file diff --git a/docs/architecture/type/domain.mmd b/docs/architecture/type/domain.mmd new file mode 100644 index 0000000..e4e8686 --- /dev/null +++ b/docs/architecture/type/domain.mmd @@ -0,0 +1,139 @@ +classDiagram + namespace Domain { + class Relationship + Relationship : source: String + Relationship : target: String + Relationship : kind: RelationshipKind + Relationship : source_file: Option + Relationship : +new() + Relationship : +with_source_file() + Relationship : +source() + Relationship : +target() + Relationship : +kind() + Relationship : +source_file() + class CodeElement + CodeElement : name: String + CodeElement : kind: CodeElementKind + CodeElement : file_path: FilePath + CodeElement : line: usize + CodeElement : visibility: Visibility + CodeElement : module: Option + CodeElement : generics: Vec + CodeElement : attributes: Vec + CodeElement : fields: Vec + CodeElement : methods: Vec + CodeElement : +new() + CodeElement : +with_visibility() + CodeElement : +with_module() + CodeElement : +with_generics() + CodeElement : +with_attributes() + CodeElement : +name() + CodeElement : +kind() + CodeElement : +file_path() + CodeElement : +line() + CodeElement : +visibility() + CodeElement : +module() + CodeElement : +generics() + CodeElement : +attributes() + CodeElement : +with_fields() + CodeElement : +with_methods() + CodeElement : +fields() + CodeElement : +methods() + class DomainError + class DiagramRenderer + class SourceAnalyzer + class ConfigLoader + class FileDiscovery + class ProjectAnalyzer + class OutputWriter + class AnalysisResult + AnalysisResult : elements: Vec + AnalysisResult : relationships: Vec + AnalysisResult : warnings: Vec + AnalysisResult : +new() + AnalysisResult : +empty() + AnalysisResult : +elements() + AnalysisResult : +relationships() + AnalysisResult : +warnings() + class AnalysisConfig + AnalysisConfig : excludes: Vec + AnalysisConfig : level: DiagramLevel + AnalysisConfig : module_mappings: HashMap + AnalysisConfig : scope: Option + AnalysisConfig : +with_excludes() + AnalysisConfig : +with_level() + AnalysisConfig : +with_module_mappings() + AnalysisConfig : +excludes() + AnalysisConfig : +level() + AnalysisConfig : +with_scope() + AnalysisConfig : +module_mappings() + AnalysisConfig : +scope() + class AnalysisWarning + AnalysisWarning : file_path: FilePath + AnalysisWarning : line: usize + AnalysisWarning : message: String + AnalysisWarning : +new() + AnalysisWarning : +file_path() + AnalysisWarning : +line() + AnalysisWarning : +message() + class CodeElementKind + class RelationshipKind + class Visibility + class DiagramLevel + class OutputConfig + OutputConfig : split_by_module: bool + OutputConfig : output_path: Option + OutputConfig : +with_split_by_module() + OutputConfig : +with_output_path() + OutputConfig : +split_by_module() + OutputConfig : +output_path() + class RenderedFile + RenderedFile : name: String + RenderedFile : content: String + RenderedFile : +new() + RenderedFile : +name() + RenderedFile : +content() + class RenderOutput + RenderOutput : files: Vec + RenderOutput : +new() + RenderOutput : +single() + RenderOutput : +files() + class ModuleName + ModuleName : +new() + ModuleName : +from_path() + ModuleName : +from_directory_group() + ModuleName : +capitalize() + ModuleName : +as_str() + class Language + Language : +name() + class SourceFile + SourceFile : path: FilePath + SourceFile : language: Language + SourceFile : +new() + SourceFile : +path() + SourceFile : +language() + class FilePath + FilePath : +new() + FilePath : +as_str() + class CodeGraph + CodeGraph : elements: Vec + CodeGraph : relationships: Vec + CodeGraph : +new() + CodeGraph : +add_element() + CodeGraph : +add_relationship() + CodeGraph : +elements() + CodeGraph : +relationships() + CodeGraph : +modules() + CodeGraph : +elements_by_module() + CodeGraph : +resolve_relationships() + CodeGraph : +filter_external_imports() + CodeGraph : +subgraph_by_module() + } + Relationship --> RelationshipKind + CodeElement --> CodeElementKind + CodeElement --> FilePath + CodeElement --> Visibility + AnalysisConfig --> DiagramLevel + AnalysisWarning --> FilePath + SourceFile --> FilePath + SourceFile --> Language \ No newline at end of file diff --git a/docs/architecture/type/overview.mmd b/docs/architecture/type/overview.mmd new file mode 100644 index 0000000..9380754 --- /dev/null +++ b/docs/architecture/type/overview.mmd @@ -0,0 +1,275 @@ +classDiagram + namespace Presentation { + class Cli + 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 : split_by_module: bool + Cli : strict: bool + Cli : check: bool + Cli : verbose: u8 + class Command + } + namespace Application { + class AnalyzeCodebase + AnalyzeCodebase : file_discovery: F + AnalyzeCodebase : source_analyzer: S + AnalyzeCodebase : +new() + AnalyzeCodebase : +execute() + class AnalyzeCodebaseResult + AnalyzeCodebaseResult : graph: CodeGraph + AnalyzeCodebaseResult : warnings: Vec + AnalyzeCodebaseResult : +graph() + AnalyzeCodebaseResult : +warnings() + class FakeDiagramRenderer + FakeDiagramRenderer : +new() + class FakeResponse + <> FakeResponse + class FakeSourceAnalyzer + FakeSourceAnalyzer : results: HashMap + FakeSourceAnalyzer : +new() + FakeSourceAnalyzer : +with_result() + FakeSourceAnalyzer : +with_error() + class FakeFileDiscovery + FakeFileDiscovery : files: Vec + FakeFileDiscovery : +new() + FakeFileDiscovery : +empty() + class FakeOutputWriter + FakeOutputWriter : written: RefCell + FakeOutputWriter : +new() + FakeOutputWriter : +written_outputs() + } + namespace Domain { + class Relationship + Relationship : source: String + Relationship : target: String + Relationship : kind: RelationshipKind + Relationship : source_file: Option + Relationship : +new() + Relationship : +with_source_file() + Relationship : +source() + Relationship : +target() + Relationship : +kind() + Relationship : +source_file() + class CodeElement + CodeElement : name: String + CodeElement : kind: CodeElementKind + CodeElement : file_path: FilePath + CodeElement : line: usize + CodeElement : visibility: Visibility + CodeElement : module: Option + CodeElement : generics: Vec + CodeElement : attributes: Vec + CodeElement : fields: Vec + CodeElement : methods: Vec + CodeElement : +new() + CodeElement : +with_visibility() + CodeElement : +with_module() + CodeElement : +with_generics() + CodeElement : +with_attributes() + CodeElement : +name() + CodeElement : +kind() + CodeElement : +file_path() + CodeElement : +line() + CodeElement : +visibility() + CodeElement : +module() + CodeElement : +generics() + CodeElement : +attributes() + CodeElement : +with_fields() + CodeElement : +with_methods() + CodeElement : +fields() + CodeElement : +methods() + class DomainError + class DiagramRenderer + class SourceAnalyzer + class ConfigLoader + class FileDiscovery + class ProjectAnalyzer + class OutputWriter + class AnalysisResult + AnalysisResult : elements: Vec + AnalysisResult : relationships: Vec + AnalysisResult : warnings: Vec + AnalysisResult : +new() + AnalysisResult : +empty() + AnalysisResult : +elements() + AnalysisResult : +relationships() + AnalysisResult : +warnings() + class AnalysisConfig + AnalysisConfig : excludes: Vec + AnalysisConfig : level: DiagramLevel + AnalysisConfig : module_mappings: HashMap + AnalysisConfig : scope: Option + AnalysisConfig : +with_excludes() + AnalysisConfig : +with_level() + AnalysisConfig : +with_module_mappings() + AnalysisConfig : +excludes() + AnalysisConfig : +level() + AnalysisConfig : +with_scope() + AnalysisConfig : +module_mappings() + AnalysisConfig : +scope() + class AnalysisWarning + AnalysisWarning : file_path: FilePath + AnalysisWarning : line: usize + AnalysisWarning : message: String + AnalysisWarning : +new() + AnalysisWarning : +file_path() + AnalysisWarning : +line() + AnalysisWarning : +message() + class CodeElementKind + class RelationshipKind + class Visibility + class DiagramLevel + class OutputConfig + OutputConfig : split_by_module: bool + OutputConfig : output_path: Option + OutputConfig : +with_split_by_module() + OutputConfig : +with_output_path() + OutputConfig : +split_by_module() + OutputConfig : +output_path() + class RenderedFile + RenderedFile : name: String + RenderedFile : content: String + RenderedFile : +new() + RenderedFile : +name() + RenderedFile : +content() + class RenderOutput + RenderOutput : files: Vec + RenderOutput : +new() + RenderOutput : +single() + RenderOutput : +files() + class ModuleName + ModuleName : +new() + ModuleName : +from_path() + ModuleName : +from_directory_group() + ModuleName : +capitalize() + ModuleName : +as_str() + class Language + Language : +name() + class SourceFile + SourceFile : path: FilePath + SourceFile : language: Language + SourceFile : +new() + SourceFile : +path() + SourceFile : +language() + class FilePath + FilePath : +new() + FilePath : +as_str() + class CodeGraph + CodeGraph : elements: Vec + CodeGraph : relationships: Vec + CodeGraph : +new() + CodeGraph : +add_element() + CodeGraph : +add_relationship() + CodeGraph : +elements() + CodeGraph : +relationships() + CodeGraph : +modules() + CodeGraph : +elements_by_module() + CodeGraph : +resolve_relationships() + CodeGraph : +filter_external_imports() + CodeGraph : +subgraph_by_module() + } + namespace Adapters { + class AsciiRenderer + AsciiRenderer : +new() + AsciiRenderer : -format_kind() + class CargoWorkspaceAnalyzer + CargoWorkspaceAnalyzer : +new() + class WorkspaceToml + <> WorkspaceToml + WorkspaceToml : workspace: Option + class WorkspaceSection + <> WorkspaceSection + WorkspaceSection : members: Vec + class MemberToml + <> MemberToml + MemberToml : package: Option + MemberToml : dependencies: HashMap + class PackageSection + <> PackageSection + PackageSection : name: String + class StdoutOutputWriter + StdoutOutputWriter : +new() + class FileOutputWriter + FileOutputWriter : output_path: OutputPath + FileOutputWriter : +new() + FileOutputWriter : +single_file() + class OutputPath + <> OutputPath + class MermaidRenderer + MermaidRenderer : level: DiagramLevel + MermaidRenderer : +new() + MermaidRenderer : +with_level() + MermaidRenderer : -format_element_name() + MermaidRenderer : -format_visibility() + MermaidRenderer : -render_class_diagram() + MermaidRenderer : -push_class_lines() + MermaidRenderer : -render_module_flowchart() + MermaidRenderer : -render_project_flowchart() + MermaidRenderer : -sanitize_id() + class LanguageExtractor + class TreeSitterAnalyzer + TreeSitterAnalyzer : rust: RustExtractor + TreeSitterAnalyzer : python: PythonExtractor + TreeSitterAnalyzer : +new() + TreeSitterAnalyzer : -extractor_for() + class RustExtractor + class PythonExtractor + class WalkdirDiscovery + WalkdirDiscovery : +new() + WalkdirDiscovery : -detect_language() + WalkdirDiscovery : -is_excluded() + class RawConfig + <> RawConfig + RawConfig : analysis: RawAnalysis + RawConfig : output: RawOutput + RawConfig : modules: HashMap + class RawAnalysis + <> RawAnalysis + RawAnalysis : exclude: Vec + RawAnalysis : level: Option + class RawOutput + <> RawOutput + RawOutput : format: Option + RawOutput : path: Option + RawOutput : split_by_module: bool + class TomlConfigLoader + TomlConfigLoader : raw: RawConfig + TomlConfigLoader : +from_path() + TomlConfigLoader : -parse_level() + } + AsciiRenderer <|-- DiagramRenderer + CargoWorkspaceAnalyzer <|-- ProjectAnalyzer + StdoutOutputWriter <|-- OutputWriter + FileOutputWriter --> OutputPath + FileOutputWriter <|-- OutputWriter + MermaidRenderer --> DiagramLevel + MermaidRenderer <|-- DiagramRenderer + TreeSitterAnalyzer --> RustExtractor + TreeSitterAnalyzer --> PythonExtractor + TreeSitterAnalyzer <|-- SourceAnalyzer + RustExtractor <|-- LanguageExtractor + PythonExtractor <|-- LanguageExtractor + WalkdirDiscovery <|-- FileDiscovery + RawConfig --> RawAnalysis + RawConfig --> RawOutput + TomlConfigLoader --> RawConfig + TomlConfigLoader <|-- ConfigLoader + AnalyzeCodebaseResult --> CodeGraph + FakeDiagramRenderer <|-- DiagramRenderer + FakeSourceAnalyzer <|-- SourceAnalyzer + FakeFileDiscovery <|-- FileDiscovery + FakeOutputWriter <|-- OutputWriter + Relationship --> RelationshipKind + CodeElement --> CodeElementKind + CodeElement --> FilePath + CodeElement --> Visibility + AnalysisConfig --> DiagramLevel + AnalysisWarning --> FilePath + SourceFile --> FilePath + SourceFile --> Language \ No newline at end of file diff --git a/docs/architecture/type/presentation.mmd b/docs/architecture/type/presentation.mmd new file mode 100644 index 0000000..d2fe437 --- /dev/null +++ b/docs/architecture/type/presentation.mmd @@ -0,0 +1,17 @@ +classDiagram + namespace Presentation { + class Cli + 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 : split_by_module: bool + Cli : strict: bool + Cli : check: bool + Cli : verbose: u8 + class Command + } \ No newline at end of file