repowiki

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

RepoWiki - Repository Report Generator

RepoWiki - 仓库报告生成工具

Generate a DeepWiki-style in-depth analysis report based on the current repository's code structure, configuration files, and dependency relationships.
基于当前仓库的代码结构、配置文件和依赖关系,生成DeepWiki风格的深度分析报告。

Report Structure Specification

报告结构规范

The generated report must strictly follow the layered structure below, output as a single Markdown file.
生成的报告必须严格遵循以下分层结构,输出为单个Markdown文件。

Layer 1: Project Overview

第一层:项目概述

markdown
undefined
markdown
undefined

{Project Name}

{项目名称}

{One-line project positioning description}
{一句话项目定位描述}

Purpose & Scope

目标与范围

{2-3 paragraphs describing what problem the project solves, core value, target users}
{2-3段文字,描述项目解决的问题、核心价值、目标用户}

Tech Stack

技术栈

CategoryTechnologyPurpose
Language......
Framework......
Build Tool......
Testing......
Database......
类别技术用途
编程语言......
框架......
构建工具......
测试工具......
数据库......

Repository Structure

仓库结构

{Mermaid graph showing top-level directory structure and module relationships}
{Mermaid图表展示顶层目录结构与模块关系}

Core Systems Overview

核心系统概览

{Mermaid graph showing interactions between major subsystems}
undefined
{Mermaid图表展示主要子系统间的交互关系}
undefined

Layer 2: Module & Package Analysis

第二层:模块与包分析

markdown
undefined
markdown
undefined

Module Inventory

模块清单

ModulePathResponsibilityKey Dependencies
............
模块路径职责核心依赖
............

Module Dependency Architecture

模块依赖架构

{Mermaid graph: inter-module dependency diagram}
{Mermaid图表:模块间依赖关系图}

{Module Name} Detailed Analysis

{模块名称} 详细分析

<details> <summary>Related Source Files</summary>
  • path/to/file1.ts
  • path/to/file2.ts
</details>
<details> <summary>相关源文件</summary>
  • path/to/file1.ts
  • path/to/file2.ts
</details>

Responsibilities & Boundaries

职责与边界

{What this module is and isn't responsible for}
{该模块负责和不负责的内容}

Internal Architecture

内部架构

{Mermaid graph: class/function relationships within the module}
{Mermaid图表:模块内的类/函数关系}

Key Interfaces

核心接口

{Code block: main exported APIs, type definitions, interfaces}
{代码块:主要导出的API、类型定义、接口}

Data Flow

数据流

{Mermaid sequence/flowchart: how data flows within the module}
undefined
{Mermaid时序图/流程图:模块内的数据流转方式}
undefined

Layer 3: Core System Deep Analysis

第三层:核心系统深度分析

Generate an independent section for each core system:
markdown
undefined
为每个核心系统生成独立章节:
markdown
undefined

{System Name}

{系统名称}

<details> <summary>Related Source Files</summary>
  • path/to/relevant/file.ts
</details>
<details> <summary>相关源文件</summary>
  • path/to/relevant/file.ts
</details>

Purpose & Scope

目标与范围

{Description of the system's responsibilities}
{描述该系统的职责}

System Architecture

系统架构

{Mermaid graph: overall architecture diagram of the system}
{Mermaid图表:系统整体架构图}

Core Workflows

核心工作流

{Mermaid sequence diagram: main business processes}
{Mermaid时序图:主要业务流程}

Key Components

核心组件

ComponentFileResponsibility
.........
组件文件职责
.........

Configuration & Extension Points

配置与扩展点

{Code block: key configuration file snippets}
{代码块:关键配置文件片段}

Design Decisions

设计决策

{Why it was designed this way, what trade-offs were made}
undefined
{为何如此设计,做出了哪些权衡}
undefined

Layer 4: Infrastructure & Toolchain

第四层:基础设施与工具链

markdown
undefined
markdown
undefined

Build System

构建系统

Build Pipeline

构建流水线

{Mermaid flowchart: complete process from source to artifacts}
{Mermaid流程图:从源码到产物的完整流程}

Build Configuration

构建配置

{Table: key build configuration items}
{表格:关键构建配置项}

Testing Infrastructure

测试基础设施

Testing Strategy

测试策略

Test TypeToolCoverage
Unit Tests......
Integration Tests......
E2E Tests......
测试类型工具覆盖率
单元测试......
集成测试......
端到端测试......

Test Configuration

测试配置

{Code block: key test configuration file snippets}
{代码块:关键测试配置文件片段}

CI/CD Pipeline

CI/CD流水线

{Mermaid flowchart: CI/CD process}
{Mermaid流程图:CI/CD流程}

Dependency Management

依赖管理

Key Dependencies

核心依赖

DependencyVersionPurpose
.........
依赖版本用途
.........

Dependency Strategy

依赖策略

{Version locking, update strategy, security auditing}
undefined
{版本锁定、更新策略、安全审计}
undefined

Mermaid Diagram Specifications

Mermaid图表规范

Each report must include the following types of diagrams:
每份报告必须包含以下类型的图表:

1. Repository Structure Diagram (Required)

1. 仓库结构图表(必填)

mermaid
graph TD
    Root[Project Root]
    Root --> Src[src/]
    Root --> Config[Configuration]
    Root --> Tests[tests/]
    Src --> Core[core/]
    Src --> Utils[utils/]
    Src --> Types[types/]
mermaid
graph TD
    Root[Project Root]
    Root --> Src[src/]
    Root --> Config[Configuration]
    Root --> Tests[tests/]
    Src --> Core[core/]
    Src --> Utils[utils/]
    Src --> Types[types/]

2. Module Dependency Diagram (Required)

2. 模块依赖图表(必填)

mermaid
graph LR
    A[Module A] --> B[Module B]
    A --> C[Module C]
    B --> D[Module D]
    C --> D
mermaid
graph LR
    A[Module A] --> B[Module B]
    A --> C[Module C]
    B --> D[Module D]
    C --> D

3. Core Workflow Diagram (Required)

3. 核心工作流图表(必填)

mermaid
sequenceDiagram
    participant User
    participant API
    participant Service
    participant DB
    User->>API: Request
    API->>Service: Process
    Service->>DB: Query
    DB-->>Service: Result
    Service-->>API: Response
    API-->>User: Return
mermaid
sequenceDiagram
    participant User
    participant API
    participant Service
    participant DB
    User->>API: Request
    API->>Service: Process
    Service->>DB: Query
    DB-->>Service: Result
    Service-->>API: Response
    API-->>User: Return

4. Data Flow Diagram (As Needed)

4. 数据流图表(按需添加)

mermaid
flowchart LR
    Input[Input] --> Validate[Validate]
    Validate --> Transform[Transform]
    Transform --> Process[Process]
    Process --> Output[Output]
mermaid
flowchart LR
    Input[Input] --> Validate[Validate]
    Validate --> Transform[Transform]
    Transform --> Process[Process]
    Process --> Output[Output]

5. State/Lifecycle Diagram (As Needed)

5. 状态/生命周期图表(按需添加)

mermaid
stateDiagram-v2
    [*] --> Created
    Created --> Active
    Active --> Paused
    Paused --> Active
    Active --> Completed
    Completed --> [*]
mermaid
stateDiagram-v2
    [*] --> Created
    Created --> Active
    Active --> Paused
    Paused --> Active
    Active --> Completed
    Completed --> [*]

Analysis Execution Flow

分析执行流程

Step 1: Collect Repository Metadata

第一步:收集仓库元数据

Use the following tools to gather information (execute in parallel):
  1. Directory Structure - Use Glob to scan
    **/*
    for the complete file tree
  2. Package Management - Read
    package.json
    ,
    go.mod
    ,
    Cargo.toml
    ,
    pyproject.toml
    ,
    pom.xml
    , etc.
  3. Configuration Files - Read
    tsconfig.json
    ,
    .eslintrc.*
    ,
    vite.config.*
    ,
    webpack.config.*
    , etc.
  4. CI/CD - Read
    .github/workflows/*
    ,
    .gitlab-ci.yml
    ,
    Dockerfile
    , etc.
  5. Git History - Get file change frequency from the last 100 commits
使用以下工具收集信息(并行执行):
  1. 目录结构 - 使用Glob扫描
    **/*
    获取完整文件树
  2. 包管理 - 读取
    package.json
    go.mod
    Cargo.toml
    pyproject.toml
    pom.xml
  3. 配置文件 - 读取
    tsconfig.json
    .eslintrc.*
    vite.config.*
    webpack.config.*
  4. CI/CD配置 - 读取
    .github/workflows/*
    .gitlab-ci.yml
    Dockerfile
  5. Git历史 - 从最近100次提交中获取文件变更频率

Step 2: Identify Core Systems

第二步:识别核心系统

Determine core systems based on the following signals:
SignalWeightMethod
File change frequencyHighgit log statistics
Directory sizeMediumFile count
Entry file referencesHighgrep import/require
README mentionsMediumRead documentation
Export countMediumgrep export
根据以下信号确定核心系统:
信号权重方法
文件变更频率git日志统计
目录大小文件数量统计
入口文件引用grep查找import/require语句
README提及读取文档内容
导出数量grep查找export语句

Step 3: Deep Analysis of Each System

第三步:深度分析每个系统

For each core system, perform:
  1. Read all files in that directory
  2. Identify main class, function, and type definitions
  3. Trace import/export dependency chains
  4. Identify design patterns (Repository, Factory, Observer, etc.)
  5. Extract key configurations and constants
对每个核心系统执行以下操作:
  1. 读取该目录下的所有文件
  2. 识别主要类、函数和类型定义
  3. 追踪导入/导出依赖链
  4. 识别设计模式(仓库模式、工厂模式、观察者模式等)
  5. 提取关键配置与常量

Step 4: Generate Mermaid Diagrams

第四步:生成Mermaid图表

Based on the analysis results, generate:
  • At least 1 architecture overview diagram
  • At least 1 module dependency diagram
  • At least 1 core workflow sequence diagram
  • Add state diagrams and data flow diagrams as needed
基于分析结果生成:
  • 至少1张架构概览图
  • 至少1张模块依赖图
  • 至少1张核心工作流时序图
  • 按需添加状态图与数据流图

Step 5: Assemble Report

第五步:组装报告

Assemble the complete report according to the structure specification above, output to
REPOWIKI.md
.
按照上述结构规范组装完整报告,输出到
REPOWIKI.md

Source File Reference Specification

源文件引用规范

Each section must include collapsible source file references:
markdown
<details>
<summary>Related Source Files</summary>

- `src/core/engine.ts` - Core engine implementation
- `src/core/types.ts` - Type definitions
- `src/config/default.ts` - Default configuration
</details>
Reference rules:
  • Only reference files directly related to the current section
  • Each reference includes a brief description
  • Sort by importance, most critical files first
  • 3-10 referenced files per section
每个章节必须包含可折叠的源文件引用:
markdown
<details>
<summary>相关源文件</summary>

- `src/core/engine.ts` - 核心引擎实现
- `src/core/types.ts` - 类型定义
- `src/config/default.ts` - 默认配置
</details>
引用规则:
  • 仅引用与当前章节直接相关的文件
  • 每个引用包含简短描述
  • 按重要性排序,最关键的文件排在前面
  • 每个章节引用3-10个文件

Table Usage Specification

表格使用规范

Tables must be used in the following scenarios:
  1. Tech Stack - Inventory of languages, frameworks, and tools
  2. Module Inventory - Paths, responsibilities, and dependencies of all modules
  3. Configuration Comparison - Configuration differences across environments/modes
  4. API Inventory - Methods, parameters, and return values of public APIs
  5. Dependency Inventory - Versions and purposes of key dependencies
以下场景必须使用表格:
  1. 技术栈 - 编程语言、框架与工具清单
  2. 模块清单 - 所有模块的路径、职责与依赖
  3. 配置对比 - 不同环境/模式下的配置差异
  4. API清单 - 公共API的方法、参数与返回值
  5. 依赖清单 - 核心依赖的版本与用途

Output Requirements

输出要求

  1. Filename:
    REPOWIKI.md
    , placed in the repository root
  2. Language: Match the user's conversation language (Chinese conversation = Chinese report)
  3. Length:
    • Small projects (<50 files): 800-1500 lines
    • Medium projects (50-200 files): 1500-3000 lines
    • Large projects (>200 files): 3000-6000 lines
  4. Diagram count: At least 3 Mermaid diagrams, 6-10 for large projects
  5. Table count: At least 3 tables
  6. Code blocks: Key configurations and interface definitions, no more than 30 lines each
  1. 文件名
    REPOWIKI.md
    ,放置在仓库根目录
  2. 语言:匹配用户对话语言(中文对话=中文报告)
  3. 长度:
    • 小型项目(<50个文件):800-1500行
    • 中型项目(50-200个文件):1500-3000行
    • 大型项目(>200个文件):3000-6000行
  4. 图表数量:至少3张Mermaid图表,大型项目6-10张
  5. 表格数量:至少3张表格
  6. 代码块:关键配置与接口定义,每个不超过30行

Quality Checklist

质量检查清单

After generating the report, verify the following items:
  • Contains project overview and one-line positioning
  • Tech stack table is complete and accurate
  • Repository structure Mermaid diagram matches reality
  • Each core system has an independent section
  • Each section has collapsible source file references
  • Module dependency diagram correctly reflects actual dependencies
  • At least one sequence diagram shows core workflows
  • All tables are correctly formatted with accurate content
  • Code block syntax highlighting is correct
  • No fabricated files or modules
  • Mermaid diagram syntax is correct and renderable
生成报告后,验证以下项目:
  • 包含项目概述与一句话定位
  • 技术栈表格完整准确
  • 仓库结构Mermaid图表与实际一致
  • 每个核心系统有独立章节
  • 每个章节有可折叠的源文件引用
  • 模块依赖图正确反映实际依赖关系
  • 至少有一张时序图展示核心工作流
  • 所有表格格式正确、内容准确
  • 代码块语法高亮正确
  • 无虚构文件或模块
  • Mermaid图表语法正确可渲染

Example Snippet

示例片段

Below is a report snippet example for a TypeScript web project:
markdown
undefined
以下是TypeScript Web项目的报告片段示例:
markdown
undefined

MyApp

MyApp

A full-stack e-commerce platform built on Next.js, supporting multi-tenancy and real-time inventory management.
基于Next.js构建的全栈电商平台,支持多租户与实时库存管理。

Purpose & Scope

目标与范围

MyApp is an e-commerce SaaS platform for small and medium-sized merchants. It provides product management, order processing, payment integration, and real-time inventory synchronization as core features. The project uses Next.js App Router architecture, Prisma as the ORM, and PostgreSQL as the primary database.
MyApp是面向中小商家的电商SaaS平台,提供商品管理、订单处理、支付集成与实时库存同步等核心功能。项目采用Next.js App Router架构,Prisma作为ORM,PostgreSQL作为主数据库。

Tech Stack

技术栈

CategoryTechnologyPurpose
LanguageTypeScript 5.3Full-stack development language
FrameworkNext.js 14Full-stack React framework
ORMPrisma 5.8Database access layer
DatabasePostgreSQL 16Primary data storage
CacheRedis 7Session and hot data caching
TestingVitest + PlaywrightUnit and E2E testing
类别技术用途
编程语言TypeScript 5.3全栈开发语言
框架Next.js 14全栈React框架
ORMPrisma 5.8数据库访问层
数据库PostgreSQL 16主数据存储
缓存Redis 7会话与热点数据缓存
测试Vitest + Playwright单元与端到端测试

Repository Structure

仓库结构

mermaid
graph TD
    Root["myapp/"]
    Root --> App["app/ - Next.js App Router"]
    Root --> Lib["lib/ - Shared Business Logic"]
    Root --> Components["components/ - UI Components"]
    Root --> Prisma["prisma/ - Database Schema"]
    Root --> Tests["tests/ - Test Files"]

    App --> API["api/ - API Routes"]
    App --> Pages["(routes)/ - Pages"]
    Lib --> Services["services/ - Business Services"]
    Lib --> Utils["utils/ - Utility Functions"]
mermaid
graph TD
    Root["myapp/"]
    Root --> App["app/ - Next.js App Router"]
    Root --> Lib["lib/ - 共享业务逻辑"]
    Root --> Components["components/ - UI组件"]
    Root --> Prisma["prisma/ - 数据库Schema"]
    Root --> Tests["tests/ - 测试文件"]

    App --> API["api/ - API路由"]
    App --> Pages["(routes)/ - 页面"]
    Lib --> Services["services/ - 业务服务"]
    Lib --> Utils["utils/ - 工具函数"]

Core Systems Overview

核心系统概览

mermaid
graph LR
    Client["Client"] --> AppRouter["App Router"]
    AppRouter --> Auth["Auth System"]
    AppRouter --> API["API Layer"]
    API --> OrderService["Order Service"]
    API --> ProductService["Product Service"]
    API --> PaymentService["Payment Service"]
    OrderService --> DB["PostgreSQL"]
    ProductService --> DB
    ProductService --> Cache["Redis"]
    PaymentService --> Stripe["Stripe API"]
mermaid
graph LR
    Client["客户端"] --> AppRouter["App Router"]
    AppRouter --> Auth["认证系统"]
    AppRouter --> API["API层"]
    API --> OrderService["订单服务"]
    API --> ProductService["商品服务"]
    API --> PaymentService["支付服务"]
    OrderService --> DB["PostgreSQL"]
    ProductService --> DB
    ProductService --> Cache["Redis"]
    PaymentService --> Stripe["Stripe API"]

Order System

订单系统

<details> <summary>Related Source Files</summary>
  • lib/services/order.ts
    - Order service core logic
  • app/api/orders/route.ts
    - Order API routes
  • prisma/schema.prisma
    - Order data model
  • lib/validators/order.ts
    - Order data validation
  • components/order/OrderForm.tsx
    - Order form component
</details>
<details> <summary>相关源文件</summary>
  • lib/services/order.ts
    - 订单服务核心逻辑
  • app/api/orders/route.ts
    - 订单API路由
  • prisma/schema.prisma
    - 订单数据模型
  • lib/validators/order.ts
    - 订单数据校验
  • components/order/OrderForm.tsx
    - 订单表单组件
</details>

Purpose & Scope

目标与范围

The order system manages the complete order lifecycle from shopping cart to payment completion. This includes order creation, inventory locking, payment processing, status transitions, and notification delivery.
订单系统管理从购物车到支付完成的完整订单生命周期,包括订单创建、库存锁定、支付处理、状态流转与通知推送。

Order Lifecycle

订单生命周期

mermaid
stateDiagram-v2
    [*] --> Created: User places order
    Created --> Paying: Initiate payment
    Paying --> Paid: Payment successful
    Paying --> Cancelled: Payment timeout/failure
    Paid --> Shipping: Merchant ships
    Shipping --> Completed: Delivery confirmed
    Completed --> [*]
    Cancelled --> [*]
undefined
mermaid
stateDiagram-v2
    [*] --> Created: 用户下单
    Created --> Paying: 发起支付
    Paying --> Paid: 支付成功
    Paying --> Cancelled: 支付超时/失败
    Paid --> Shipping: 商家发货
    Shipping --> Completed: 确认收货
    Completed --> [*]
    Cancelled --> [*]
undefined

Language/Framework Adaptation

语言/框架适配

Adjust analysis focus based on project type:
Project TypeAnalysis Focus
Node.js/TypeScriptpackage.json, tsconfig, module exports
Gogo.mod, package structure, interface definitions
Pythonpyproject.toml, package structure, class hierarchy
RustCargo.toml, crate structure, trait definitions
Java/Kotlinpom.xml/build.gradle, package structure, class hierarchy
Monorepoworkspace config, inter-package dependencies, build order
Frontend SPArouting structure, state management, component tree
Backend APIroute definitions, middleware chain, data models
CLI Toolcommand structure, argument parsing, subcommands
根据项目类型调整分析重点:
项目类型分析重点
Node.js/TypeScriptpackage.json、tsconfig、模块导出
Gogo.mod、包结构、接口定义
Pythonpyproject.toml、包结构、类层级
RustCargo.toml、 crate结构、 trait定义
Java/Kotlinpom.xml/build.gradle、包结构、类层级
单体仓库工作区配置、包间依赖、构建顺序
前端SPA路由结构、状态管理、组件树
后端API路由定义、中间件链、数据模型
CLI工具命令结构、参数解析、子命令