Skip to content

​AI-Powered open-source deepwiki generator​ built with Rust – Transform your codebase into professional architecture documentation in minutes

License

Notifications You must be signed in to change notification settings

sopaco/deepwiki-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Litho (deepwiki-rs)

English | 中文

💪🏻 High-performance AI-driven intelligent document generator (DeepWiki-like) built with Rust

📚 Automatically generates high quality Repo-Wiki for any codebase

GitHub Actions Workflow Status


👋 What's Litho

Litho is an AI-powered documentation generation engine that automatically analyzes your source code and generates comprehensive, professional architecture documentation in the C4 model format. No more manual documentation that falls behind code changes - Litho keeps your documentation perfectly in sync with your codebase.

Litho transforms raw code into beautifully structured documentation with context diagrams, container diagrams, component diagrams, and code-level documentation - all automatically generated from your source code.

Whether you're a developer, architect, or technical lead, Litho eliminates the burden of maintaining documentation and ensures your team always has accurate, up-to-date architectural information.

Transform your codebase into professional architecture documentation in minutes

Before Litho After Litho

Manual Documentation

  • Outdated, incomplete, or missing documentation
  • Manual updates that fall behind code changes
  • Inconsistent formatting and structure
  • Time-consuming to maintain
  • Hard to navigate and understand
  • Usually just a few markdown files

AI-Generated Documentation

  • Automatically generated from codebase
  • Always up-to-date with code changes
  • Professional C4 model structure
  • Consistent formatting and styling
  • Easy to navigate and understand
  • Complete with diagrams, context, and relationships

🚀 Litho automatically transforms your messy codebase into beautiful, professional documentation


😺 Why use Litho

  • Automatically keep documentation in sync with codebase changes - no more outdated docs
  • Save hundreds of hours on manual documentation creation and maintenance
  • Improve onboarding for new team members with comprehensive, up-to-date documentation
  • Enhance code reviews by providing clear architectural context
  • Meet compliance requirements with auditable, automated documentation
  • Support for multiple programming languages (Rust, Python, Java, Go, C#, JavaScript, etc.)
  • Generate professional C4 model diagrams with context, containers, components, and code
  • Integrate with CI/CD pipelines to automatically generate documentation on every commit

🌟 For:

  • Development teams of all sizes
  • Open source projects
  • Enterprise software developers
  • Anyone who hates maintaining outdated docs!

❤️ Like Litho? Star it 🌟 or Sponsor Me! ❤️

Thanks to the kind people

Stargazers repo roster for @sopaco/deepwiki-rs

🌠 Features & Capabilities

Core Capabilities

  • AI-driven architecture documentation generation from codebase analysis
  • Automatic C4 model diagram creation (Context, Container, Component, Code)
  • Intelligent extraction of code comments, structures, and relationships
  • Multi-language support for various programming languages
  • Customizable template system for documentation output

Advanced Features

  • Git history analysis for tracking architectural evolution
  • Cross-referencing between code elements and documentation
  • Interactive documentation with embedded diagrams and examples
  • Integration with CI/CD pipelines for automated documentation generation

💡 Problem Solved

Litho solves the common problem of outdated and incomplete technical documentation by automatically generating up-to-date architecture documentation from your source code. No more manual documentation that falls behind code changes - Litho keeps your documentation in sync with your codebase.

🌐 Litho Eco Ecosystem

Litho is part of a broader ecosystem of tools designed to enhance developer productivity and documentation quality. The Litho Eco ecosystem includes complementary tools that work seamlessly with Litho to provide a complete documentation workflow:

📘 Litho Book

Litho Book is a high-performance markdown reader built with Rust and Axum, specifically designed to provide an elegant interface for browsing documentation generated by Litho.

Key Features

  • Real-time markdown rendering with syntax highlighting
  • Full Mermaid chart support for architectural diagrams
  • Intelligent search with fuzzy matching for files and content
  • High-performance architecture with low memory usage
  • AI Intelligent Document Interpretation, Answering Questions

🌠 Snapshots

snapshot-1 snapshot-2

Integration with Litho

Litho Book serves as the ideal companion application for consuming documentation generated by Litho. The typical workflow is:

  1. Use Litho to generate documentation from your codebase
  2. Use Litho Book to browse and explore the generated documentation with an elegant interface

Learn more about Litho Book

🔧 Mermaid Fixer

Mermaid Fixer is a high-performance AI-driven tool that automatically detects and fixes syntax errors in Mermaid diagrams within Markdown files.

Key Features

  • Automated scanning of directories for Markdown files
  • Precise detection of Mermaid syntax errors using JS sandbox validation
  • AI-powered intelligent fixing with LLM integration
  • Comprehensive reporting of before/after changes
  • Flexible configuration with support for multiple LLM providers

Integration with Litho

Mermaid Fixer enhances the quality of documentation generated by Litho by automatically fixing syntax errors in Mermaid diagrams. This ensures that all architectural diagrams in your documentation are valid and render correctly.

👀 Snapshots

snapshot-1 snapshot-2

Learn more about Mermaid Fixer

🧠 How it works

zread

Four-Stage Processing Pipeline

Litho's architecture is designed around a four-stage processing pipeline that transforms raw code into comprehensive documentation:

flowchart TD
    A[Input: Source Code Repository] --> B[Phase 1: Preprocessing]
    B --> C[Phase 2: Intelligent Research & Analysis]
    C --> D[Phase 3: Documentation Generation]
    D --> E[Phase 4: Verification & Enhancement]
    E --> F[Output: High-Quality Technical Documentation]

    subgraph Preprocessing Phase
        B1[Code Scanning & Discovery]
        B2[Multi-Language Syntax Analysis]
        B3[Structure & Dependency Extraction]
        B4[Code Insight Generation]
        B5[Agent Memory Chunk Initialization]
        B --> B1 --> B2 --> B3 --> B4 --> B5
    end

    subgraph Intelligent Research & Analysis Phase
        C1[System Context Researcher]
        C2[Domain Module Detector]
        C3[Workflow Researcher]
        C4[Boundary Analyzer]
        C5[Key Module Insight Officer]
        C6[Agent Memory Chunk Read/Write]
        C7[ReAct Reasoning Loop]
        C --> C1 --> C2 --> C3 --> C4 --> C5 --> C6 --> C7
    end

    subgraph Documentation Generation Phase
        D1[Overview Documentation Editor]
        D2[Architecture Documentation Editor]
        D3[Workflow Documentation Editor]
        D4[Boundary Documentation Editor]
        D5[Key Module Editor]
        D6[Agent Memory Chunk Reading]
        D7[High-Quality Documentation Assembly]
        D --> D1 --> D2 --> D3 --> D4 --> D5 --> D6 --> D7
    end

    subgraph Verification & Enhancement Phase
        E1[Mermaid Syntax Verification]
        E2[Documentation Integrity Check]
        E3[Diagram Auto-Repair]
        E4[Quality Report Generation]
        E5[Final Documentation Output]
        E --> E1 --> E2 --> E3 --> E4 --> E5
    end

    style B fill:#e3f2fd,stroke:#1976d2
    style C fill:#f3e5f5,stroke:#7b1fa2
    style D fill:#e8f5e8,stroke:#388e3c
    style E fill:#fff3e0,stroke:#e65100
Loading

Preprocessing Stage

Litho begins by scanning your entire codebase to identify source files, extract metadata, and analyze project structure. This stage:

  • Discovers all source code files across multiple languages
  • Parses file structures and identifies key components
  • Extracts comments, documentation strings, and code annotations
  • Identifies dependencies between modules and components
  • Builds a comprehensive representation of your codebase
flowchart TD
A[Preprocessing Agent] --> B[Structure Extractor]
A --> C[Original Document Extractor]
A --> D[Code Analysis Agent]
A --> E[Relationship Analysis Agent]
B --> F[Project Structure]
C --> G[Original Document Materials]
D --> H[Core Code Insights]
E --> I[Code Dependencies]
F --> J[Store to Memory]
G --> J
H --> J
I --> J
Loading

Research Stage

In this AI-powered stage, Litho analyzes the code structure to understand the architectural intent:

  • Applies machine learning models to identify patterns and relationships
  • Infers architectural roles from code structure and naming conventions
  • Determines component boundaries and service responsibilities
  • Maps dependencies and data flow between components
  • Identifies potential architectural smells and anti-patterns
  • Generates context-aware documentation for each component
flowchart TD
A[Research Orchestrator] --> B[SystemContext Researcher]
A --> C[Domain Module Detector]
A --> D[Architecture Researcher]
A --> E[Workflow Researcher]
A --> F[Key Module Insights]
B --> G[System Context Report]
C --> H[Domain Module Report]
D --> I[Architecture Analysis Report]
E --> J[Workflow Analysis Report]
F --> K[Module Deep Insights]
G --> Memory
H --> Memory
I --> Memory
J --> Memory
K --> Memory
Loading

Composition and Output Stage

Litho combines the analyzed information into a structured documentation format:

  • Generates C4 model diagrams (Context, Container, Component, Code)
  • Creates hierarchical documentation structure with clear navigation
  • Embeds relevant code examples and explanations
  • Applies consistent styling and formatting across all documentation
  • Adds cross-references between related components and diagrams
flowchart TD
A[Document Composer] --> B[Overview Editor]
A --> C[Architecture Editor]
A --> D[Module Insight Editor]
B --> E[Overview Document]
C --> F[Architecture Document]
D --> G[Module Documents]
E --> H[Document Tree]
F --> H
G --> H
H --> I[Disk Outlet]
I --> J[Output Directory]
Loading

Validation and Enhancement Stage

The final stage ensures documentation quality and completeness:

  • Validates diagram syntax and consistency
  • Checks for completeness of documentation coverage
  • Identifies gaps in documentation and suggests improvements
  • Integrates with Mermaid Fixer to ensure all diagrams render correctly
  • Generates statistics and reports on documentation coverage
  • Creates an index and table of contents for easy navigation

🏗️ Architecture Overview

Litho features a sophisticated modular architecture designed for high performance, extensibility, and intelligent analysis. The system implements a multi-stage workflow with specialized AI agents and comprehensive caching mechanisms.

graph LR
    subgraph Input Phase
        A[CLI Startup] --> B[Load Configuration]
        B --> C[Scan Structure]
        C --> D[Extract README]
    end
    subgraph Analysis Phase
        D --> E[Language Parsing]
        E --> F[AI-Enhanced Analysis]
        F --> G[Store in Memory]
    end
    subgraph Reasoning Phase
        G --> H[Orchestrator Startup]
        H --> I[System Context Analysis]
        H --> J[Domain Module Detection]
        H --> K[Workflow Analysis]
        H --> L[Key Module Insights]
        I --> M[Store in Memory]
        J --> M
        K --> M
        L --> M
    end
    subgraph Orchestration Phase
        M --> N[Orchestration Hub Startup]
        N --> O[Generate Project Overview]
        N --> P[Generate Architecture Diagram]
        N --> Q[Generate Workflow Documentation]
        N --> R[Generate Module Insights]
        O --> S[Write to DocTree]
        P --> S
        Q --> S
        R --> S
    end
    subgraph Output Phase
        S --> T[Persist Documents]
        T --> U[Generate Summary Report]
    end
Loading

Core Modules

Litho's architecture consists of several interconnected modules that work together to deliver seamless documentation generation:

  • Code Scanner: Discovers and analyzes source code files across multiple languages
  • Language Parser: Extracts structural information from code using language-specific parsers
  • Architecture Analyzer: AI-powered component that infers architectural patterns and relationships
  • Diagram Generator: Creates C4 model diagrams using Mermaid syntax
  • Documentation Formatter: Structures content into organized, navigable documentation

Core Process

The core processing flow follows a deterministic pipeline:

  1. Scan - Discover and analyze source code files
  2. Parse - Extract structural and semantic information
  3. Analyze - Apply AI models to infer architecture and relationships
  4. Generate - Create diagrams and documentation content
  5. Format - Structure content into organized documentation
  6. Export - Output in desired format(s)
sequenceDiagram
participant Main as main.rs
participant Workflow as workflow.rs
participant Context as GeneratorContext
participant Preprocess as PreProcessAgent
participant Research as ResearchOrchestrator
participant Doc as DocumentationOrchestrator
participant Outlet as DiskOutlet
Main->>Workflow : launch(config)
Workflow->>Context : Create context (LLM, Cache, Memory)
Workflow->>Preprocess : execute(context)
Preprocess->>Context : Store project structure and metadata
Context-->>Workflow : Preprocessing complete
Workflow->>Research : execute_research_pipeline(context)
Research->>Research : Execute multiple research agents in parallel
loop Each Research Agent
Research->>StepForwardAgent : execute(context)
StepForwardAgent->>Context : Validate data sources
StepForwardAgent->>AgentExecutor : Call prompt or extract
AgentExecutor->>LLMClient : Initiate LLM request
LLMClient->>CacheManager : Check cache
alt Cache hit
CacheManager-->>LLMClient : Return cached result
else Cache miss
LLMClient->>LLM : Call LLM API
LLM-->>LLMClient : Return raw response
LLMClient->>CacheManager : Store result to cache
end
LLMClient-->>AgentExecutor : Return processed result
AgentExecutor-->>StepForwardAgent : Return result
StepForwardAgent->>Context : Store result to Memory
end
Research-->>Workflow : Research complete
Workflow->>Doc : execute(context, doc_tree)
Doc->>Doc : Call multiple composition agents to generate docs
Doc-->>Workflow : Documentation generation complete
Workflow->>Outlet : save(context)
Outlet-->>Workflow : Storage complete
Workflow-->>Main : Process finished
Loading

🖥 Getting Started

Prerequisites

Installation

Option 1: Install from crates.io (Recommended)

cargo install deepwiki-rs

Option 2: Build from Source

  1. Clone the repository:
    git clone https://github.com/sopaco/deepwiki-rs.git
  2. Navigate to the project directory:
    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 simple command-line interface to generate documentation from your codebase. For more configuration parameters, refer to the CLI Options Detail.

Basic Command

deepwiki-rs -p ./my-project -o ./docs

# Generate documentation in the target language.
deepwiki-rs --target-language en -p ./my-project

deepwiki-rs --target-language ja -p ./my-project

This command will:

  • Scan all files in ./my-project
  • Analyze the code structure and relationships
  • Generate comprehensive C4 architecture documentation
  • Save the output to ./litho.docs directory

Documentation Generation

Litho supports several options for generating documentation:

# Generate documentation with default settings
deepwiki-rs skip certain processing stages in the generation workflow
deepwiki-rs --skip-preprocessing --skip-research

Advanced Options

# Turn off ReAct Mode to avoid auto-scanning project files via tool-calls
deepwiki-rs -p ./src --disable-preset-tools --llm-api-base-url <your llm provider base-api> --llm-api-key <your api key> --model-efficient GPT-5-mini

# Set up both the efficient model and the powerful model simultaneously
deepwiki-rs -p ./src --model-efficient GPT-5-mini --model-poweruful GPT-5-Pro --llm-api-base-url <your llm provider base-api> --llm_api_key <your api key> --model-efficient GPT-5-mini

📁 Output Structure

Litho generates a well-organized documentation structure:

project-docs/
├── 1. Project Overview      # Project overview, core functionality, technology stack
├── 2. Architecture Overview # Overall architecture, core modules, module breakdown
├── 3. Workflow Overview     # Overall workflow, core processes
├── 4. Deep Dive/            # Detailed technical topic implementation documentation
│   ├── Topic1.md
│   ├── Topic2.md

🤝 Contribute

We welcome all forms of contributions! Report bugs or submit feature requests through GitHub Issues.

Ways to Contribute

  • Language Support: Add support for additional programming languages
  • Template Creation: Design new documentation templates and styles
  • Diagram Enhancements: Improve Mermaid diagram generation algorithms
  • Performance Optimization: Enhance processing speed and memory usage
  • Test Coverage: Add comprehensive test cases for various code patterns
  • Documentation: Improve project documentation and usage guides
  • Bug Fixes: Help identify and fix issues in the codebase

Development Contribution Process

  1. Fork this project
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Create a Pull Request

🪪 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.

GitHub: sopaco

About

​AI-Powered open-source deepwiki generator​ built with Rust – Transform your codebase into professional architecture documentation in minutes

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •