deepwiki-rs 0.9.0

deepwiki-rs(also known as Litho) is a high-performance automatic generation engine for C4 architecture documentation, developed using Rust. It can intelligently analyze project structures, identify core components, parse dependency relationships, and leverage large language models (LLMs) to automatically generate professional architecture documentation.
deepwiki-rs-0.9.0 is not a library.
Visit the last successful build: deepwiki-rs-0.5.0

[!WARNING] Here be dragons! As we plan to ship a torrent of features in the following months, future updates will contain breaking changes. With SGNetworks evolving, we'll annotate changes and highlight migration paths as we encounter them.

The major refactoring version of Litho 1.0 is currently underway. It will be the most accurate, high-performance, and efficient Davin DeepWiki-like solution among open-source options. The new version introduces an excellent engineering architecture design, along with proper support for different technology stacks, languages, and frameworks. It offers better accuracy and performance. We still need some timeโ€”please support us, and stay tuned.

๐Ÿš€ Help me develop this software better by sponsoring on GitHub

๐Ÿ‘‹ What's Litho

Litho (also known as deepwiki-rs) is a powerful Rust-based tool designed to automate the generation of software architecture documentation. Leveraging advanced AI capabilities, Litho intelligently analyzes project structures, identifies core components, parses dependency relationships, and generates professional documentation automatically.

Litho is completely free and open-source, making it an ideal solution for teams looking to maintain up-to-date architecture documentation without the manual effort. By using large language models (LLMs), Litho provides insightful analysis and clear documentation that helps developers understand complex codebases more easily.

โค๏ธ Like Litho? Star it ๐ŸŒŸ or Sponsor Me! โค๏ธ

Thanks to the kind people

Stargazers repo roster for @sopaco/deepwiki-rs

๐ŸŒ  Key Features

  • Automated Documentation Generation: Automatically generates comprehensive documentation by analyzing project code, reducing manual documentation efforts.
  • AI-Powered Analysis: Utilizes large language models (LLMs) with ReAct pattern for intelligent analysis, accurately identifying core components and architectural patterns in projects.
  • C4 Architecture Documentation: Generates professional C4 architecture-style documentation including Overview, Architecture, and detailed CoreComponents documentation.
  • Multi-Format Output: Supports generating documentation in multiple formats including Markdown and HTML to meet different needs and scenarios.
  • Extensibility: Modular design with a plugin system supports extension and customization for different project types and requirements.
  • Multi-Language Support: Capable of analyzing projects written in various programming languages including Rust, Python, JavaScript/TypeScript, Java, C/C++, and Go.
  • Dependency Visualization: Extracts and visualizes file and function dependency relationships to help understand codebase structure.
  • Component Identification: Automatically identifies and analyzes core components within a project, calculating importance scores based on various metrics.
  • Architecture Detection: Recognizes common architectural patterns such as MVC, layered architecture, and microservices.

๐Ÿง  How it works

Litho follows a systematic approach to generate architecture documentation:

  1. Project Analysis: First, Litho scans the project structure, identifies files and directories, and performs initial analysis.
  2. Metadata Extraction: The tool extracts detailed metadata including component information, dependency relationships, and structural details.
  3. AI-Enhanced Analysis: Using large language models, Litho performs in-depth analysis of code components, their functionality, and relationships.
  4. Documentation Generation: Finally, Litho generates comprehensive architecture documentation in the requested format(s), including diagrams and detailed descriptions.
graph TD
    subgraph Litho
        A[Project Analysis] --> B[Metadata Extraction]
        B --> C[AI-Enhanced Analysis]
        C --> D[Documentation Generation]
    end

๐Ÿ—๏ธ Architecture Overview

Litho is built with a modular architecture designed for extensibility and performance. The system consists of several key components working together:

flowchart TB
    %% ๅฎšไน‰ไธป่ฆๆจกๅ—
    Main_Entry_Point((Main Entry Point))
    Metadata_Extractor(Metadata Extractor)
    LLM_Manager(LLM Manager)
    Document_Generator(Document Generator)
    React_Agent(React Agent)

    %% ๅญๆจกๅ—
    Project_Structure(Project Structure)
    Dependencies(Dependencies)
    Core_Components(Core Components)
    LLM_Service(LLM Service)
    Markdown_Generator(Markdown Generator)
    HTML_Generator(HTML Generator)
    ReAct_Pattern(ReAct Pattern)

    %% ๅค–้ƒจ็ณป็ปŸ
    External_LLM_API(External LLM API)
    Markdown_Files(Markdown Files)
    HTML_Files(HTML Files)

    %% ่ฟžๆŽฅๅ…ณ็ณป
    Main_Entry_Point --> Metadata_Extractor
    Main_Entry_Point --> LLM_Manager
    Main_Entry_Point --> Document_Generator
    Main_Entry_Point --> React_Agent

    Metadata_Extractor --> Project_Structure
    Metadata_Extractor --> Dependencies
    Metadata_Extractor --> Core_Components

    LLM_Manager --> LLM_Service
    LLM_Service --> External_LLM_API

    Document_Generator --> Markdown_Generator
    Document_Generator --> HTML_Generator
    Markdown_Generator --> Markdown_Files
    HTML_Generator --> HTML_Files

    React_Agent --> ReAct_Pattern

    %% ๅค–้ƒจ็ณป็ปŸ่ฏดๆ˜Ž
    classDef external fill:#666,stroke:#444,stroke-width:1px,color:#fff
    class External_LLM_API,Markdown_Files,HTML_Files external

Core Components

  • LLM Client: Handles communication with large language models for intelligent analysis.
  • Metadata Extractor: Extracts project structure, dependencies, and component information.
  • Document Generator: Transforms analyzed data into professional documentation in various formats.
  • ReAct Agent: Implements the ReAct pattern for systematic exploration and analysis of codebases.
  • Tools: Provides various utility tools for code analysis, architecture detection, and file exploration.
  • Utils: Offers common utilities for file system operations, string processing, and more.
sequenceDiagram
    participant MetadataExtractor
    participant Structure
    participant Dependencies
    participant Components
    participant LLMService

    MetadataExtractor->>Structure: extract_structure()
    Structure-->>MetadataExtractor: ProjectStructure
    MetadataExtractor->>Dependencies: extract_dependencies()
    Dependencies-->>MetadataExtractor: ProjectDependencies
    MetadataExtractor->>Components: identify_core_components_with_llm()
    Components->>LLMService: (Components-->>MetadataExtractor)
    LLMService-->>Components: (Document Snippets)
    Components-->>MetadataExtractor: CoreComponent list
    MetadataExtractor->>MetadataExtractor: create ProjectMetadata

๐Ÿ–ฅ Getting Started

Prerequisites

  • Rust (version 2024 or later)
  • Cargo
  • Internet connection (for LLM integration)

Installation

  1. Clone the repository.
    git clone https://github.com/sopaco/deepwiki-rs.git
    
  2. Step into the cloned project folder.
    cd deepwiki-rs
    
  3. Build the project.
    cargo build --release
    
  4. The compiled binary will be available in the target/release directory.

๐Ÿš€ Usage

Litho provides a command-line interface for generating architecture documentation. Here are some basic usage examples:

Basic Command

# Generate C4 architecture documentation (default mode)
litho

# Analyze specific project directory
litho /path/to/your/project

# Specify output directory
litho -o ./docs

# Specify project name
litho --name "My Project"

Documentation Modes

Litho supports two documentation generation modes:

C4 Architecture Mode (Default)

Generates professional C4 architecture-style documentation:

  • Overview.md: Project overview, core functionality, and technology stack
  • Architecture.md: Overall architecture, core processes, and module breakdown
  • CoreComponents/: Detailed documentation for each core component
# Use C4 architecture mode (default)
litho --doc-mode c4

# Generate C4 documentation with custom output
litho --doc-mode c4 -o ./architecture-docs

Standard Mode

Generates traditional documentation format:

# Use standard documentation mode
litho --doc-mode standard

Advanced Options

  • Specify documentation format (Markdown or HTML):

    litho --format html
    
  • Enable verbose logging:

    litho -v
    
  • Configure LLM settings:

    litho --project <path-to-project> --output <output-directory> --llm-api <api-url> --llm-key <api-key>
    
  • Customize component detection:

    litho --project <path-to-project> --output <output-directory> --config <path-to-config-file>
    

For more detailed usage information, run:

litho --help

๐Ÿ“ Output Structure

C4 Architecture Mode (Default)

Litho generates a C4 architecture-style documentation structure:

project-docs/
โ”œโ”€โ”€ Overview.md              # Project overview, core functionality, technology stack
โ”œโ”€โ”€ Architecture.md          # Overall architecture, core processes, module breakdown
โ”œโ”€โ”€ CoreComponents/          # Detailed component documentation
โ”‚   โ”œโ”€โ”€ component1.md        # Component functionality, workflow, internal architecture
โ”‚   โ”œโ”€โ”€ component2.md
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ litho_work_summary.md    # Execution summary and process information

Document Contents

  • Overview.md: Contains project overview, core functionality & purpose, and technology selection rationale
  • Architecture.md: Contains overall architecture design, core processes & workflows, and detailed core module explanations
  • CoreComponents/*.md: Each core module's detailed documentation including:
    • Module functionality and purpose
    • Workflow and processing steps
    • Internal architecture and structure

Standard Mode

Traditional documentation structure:

project-docs/
โ”œโ”€โ”€ README.md                 # Main project overview
โ”œโ”€โ”€ architecture.md           # Architecture documentation
โ”œโ”€โ”€ components/              # Component documentation
โ”‚   โ”œโ”€โ”€ component1.md
โ”‚   โ””โ”€โ”€ component2.md
โ”œโ”€โ”€ api/                     # API documentation
โ”‚   โ”œโ”€โ”€ endpoints.md
โ”‚   โ””โ”€โ”€ schemas.md
โ””โ”€โ”€ assets/                  # Generated diagrams and images
    โ”œโ”€โ”€ architecture.svg
    โ””โ”€โ”€ dependencies.png

๐Ÿค Contribute

Help improve Litho by reporting bugs or submitting feature requests through GitHub Issues.

Ways to Contribute

  • Implement support for additional programming languages
  • Enhance the component detection algorithms
  • Add new documentation formats
  • Improve the visualization of architecture diagrams
  • Contribute to the internationalization of the project

โš›๏ธ Developed with

๐Ÿชช License

MIT. A copy of the license is provided in the LICENSE file.

๐Ÿ‘จ About Me

๐Ÿš€ Help me develop this software better by sponsoring on GitHub

An experienced internet veteran, having navigated through the waves of PC internet, mobile internet, and AI applications. Starting from an individual mobile application developer to a professional in the corporate world, I possess rich experience in product design and research and development. Currently, I am employed at Kuaishou, focusing on the R&D of universal front-end systems and AI exploration.

WeChat: dokhell

Email: dokhell@hotmail.com