project-wiki
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseProject Wiki - 项目知识库构建工具
Project Wiki - Project Knowledge Base Construction Tool
📋 目录
📋 Table of Contents
核心价值
Core Values
与传统文档的区别:
| 维度 | 传统文档 | 知识库 Wiki |
|---|---|---|
| 更新方式 | 手动维护,易过时 | 代码变更自动增量更新 |
| 组织方式 | 线性目录 | 知识图谱网络 |
| 知识类型 | 显性文档(API/配置) | 显性 + 隐性知识(设计决策/最佳实践) |
| 检索方式 | 文件树浏览 | 多维度标签搜索 + 关联推荐 |
核心能力:
- 🏗️ 架构解析:自动识别项目结构、模块划分、技术栈
- 🧠 隐性知识挖掘:提取代码中的设计模式、架构决策、最佳实践
- 🔗 知识图谱构建:生成模块/API/概念的关系网络(Mermaid 可视化)
- 📚 结构化文档生成:README、API 文档、架构文档自动生成
适用场景:
- 新人入职:快速理解项目架构和核心模块
- 代码重构:评估影响范围,识别技术债
- 知识传承:将资深开发者的隐性知识显性化
- 架构评审:可视化展示系统设计
Differences from Traditional Documentation:
| Aspect | Traditional Documentation | Knowledge Base Wiki |
|---|---|---|
| Update Method | Manually maintained, prone to obsolescence | Automatic incremental updates on code changes |
| Organization Method | Linear directory | Knowledge graph network |
| Knowledge Type | Explicit documentation (API/configuration) | Explicit + implicit knowledge (design decisions/best practices) |
| Retrieval Method | File tree browsing | Multi-dimensional tag search + related recommendations |
Core Capabilities:
- 🏗️ Architecture Parsing: Automatically identifies project structure, module division, and tech stack
- 🧠 Implicit Knowledge Mining: Extracts design patterns, architecture decisions, and best practices from code
- 🔗 Knowledge Graph Construction: Generates relationship networks of modules/APIs/concepts (Mermaid visualization)
- 📚 Structured Document Generation: Automatically generates README, API documentation, and architecture documentation
Applicable Scenarios:
- New employee onboarding: Quickly understand project architecture and core modules
- Code refactoring: Assess impact scope and identify technical debt
- Knowledge inheritance: Externalize implicit knowledge from senior developers
- Architecture review: Visually display system design
快速开始
Quick Start
最简使用(1 分钟)
Minimal Usage (1 Minute)
bash
undefinedbash
undefined1. 分析项目
1. Analyze project
python3 scripts/analyze_project.py --path ./your-project
python3 scripts/analyze_project.py --path ./your-project
2. 查看结果
2. View results
cat project-analysis.json
输出示例:
```json
{
"languages": ["Python", "JavaScript"],
"frameworks": ["fastapi", "vue"],
"project_structure": {...}
}cat project-analysis.json
Sample Output:
```json
{
"languages": ["Python", "JavaScript"],
"frameworks": ["fastapi", "vue"],
"project_structure": {...}
}完整流程(5 分钟)
Complete Workflow (5 Minutes)
bash
undefinedbash
undefined1. 项目分析
1. Project analysis
python3 scripts/analyze_project.py --path ./your-project
python3 scripts/analyze_project.py --path ./your-project
2. 构建知识图谱
2. Build knowledge graph
python3 scripts/knowledge_graph.py --path ./your-project --format mermaid
python3 scripts/knowledge_graph.py --path ./your-project --format mermaid
3. 提取隐性知识
3. Extract implicit knowledge
python3 scripts/knowledge_extractor.py --path ./your-project --language python
python3 scripts/knowledge_extractor.py --path ./your-project --language python
4. 查看结果
4. View results
- project-analysis.json: 项目结构分析
- project-analysis.json: Project structure analysis
- knowledge-graph.json: 知识图谱数据
- knowledge-graph.json: Knowledge graph data
- knowledge-graph.mmd: Mermaid 图表
- knowledge-graph.mmd: Mermaid diagram
- implicit-knowledge.json: 隐性知识提取
- implicit-knowledge.json: Implicit knowledge extraction
---
---操作步骤
Operation Steps
步骤 1:项目结构分析
Step 1: Project Structure Analysis
目的:识别编程语言、框架、构建工具和项目结构
bash
python3 scripts/analyze_project.py --path ./your-project输出文件:
project-analysis.json关键字段:
- : 编程语言列表(Python、JavaScript、Java、Go、Rust 等)
languages - : 框架列表(全小写,与框架指引锚点对应)
frameworks - : 构建工具(npm、pip、maven、gradle、cargo 等)
build_tools - : 目录树结构
project_structure
框架识别说明:
- 支持识别 13+ 主流框架(见框架支持)
- 基于特征关键词和文件模式识别,即使没有明确依赖也能检测
- 返回的框架名可直接用于查阅对应的框架指引
Purpose: Identify programming languages, frameworks, build tools, and project structure
bash
python3 scripts/analyze_project.py --path ./your-projectOutput File:
project-analysis.jsonKey Fields:
- : List of programming languages (Python, JavaScript, Java, Go, Rust, etc.)
languages - : List of frameworks (all lowercase, corresponding to framework guide anchors)
frameworks - : Build tools (npm, pip, maven, gradle, cargo, etc.)
build_tools - : Directory tree structure
project_structure
Framework Identification Notes:
- Supports identification of 13+ mainstream frameworks (see Framework Support)
- Identified based on feature keywords and file patterns, detectable even without explicit dependencies
- Returned framework names can be directly used to access corresponding framework guides
步骤 2:查阅框架指引
Step 2: Access Framework Guides
触发条件:步骤 1 返回了 字段
frameworks查找方式:
方式 1:直接跳转
undefinedTrigger Condition: Step 1 returns the field
frameworksAccess Methods:
Method 1: Direct Jump
undefined示例:frameworks: ["fastapi", "vue"]
Example: frameworks: ["fastapi", "vue"]
→ 查看 references/frameworks/index.md 中的 FastAPI 和 Vue 章节
→ 使用锚点跳转:#fastapi、#vue
**方式 2:框架选择推荐**
根据 `languages` 和项目特征选择最适合的框架指引:
- **Python Web** → Django(企业级)/Flask(轻量级)/FastAPI(异步)
- **前端** → React(生态丰富)/Vue(易上手)/Svelte(高性能)
- **桌面应用** → Electron(成熟)/Tauri(轻量)
---→ View FastAPI and Vue sections in references/frameworks/index.md
→ Use anchor jumps: #fastapi, #vue
**Method 2: Framework Selection Recommendations**
Select the most suitable framework guide based on `languages` and project characteristics:
- **Python Web** → Django (enterprise-level)/Flask (lightweight)/FastAPI (asynchronous)
- **Frontend** → React (rich ecosystem)/Vue (easy to learn)/Svelte (high performance)
- **Desktop Applications** → Electron (mature)/Tauri (lightweight)
---步骤 3:构建知识图谱
Step 3: Build Knowledge Graph
目的:生成模块/API/配置的关系网络
bash
python3 scripts/knowledge_graph.py --path ./your-project --format mermaid输出文件:
- : 结构化数据(节点和边)
knowledge-graph.json - : Mermaid 流程图(可直接渲染)
knowledge-graph.mmd
知识图谱包含:
- 节点类型:模块、API、配置、数据库、外部服务
- 关系类型:包含、依赖、调用、数据流
- 可视化:目录结构图、模块关系图、API 调用图
Purpose: Generate relationship networks of modules/APIs/configurations
bash
python3 scripts/knowledge_graph.py --path ./your-project --format mermaidOutput Files:
- : Structured data (nodes and edges)
knowledge-graph.json - : Mermaid flow chart (directly renderable)
knowledge-graph.mmd
Knowledge Graph Includes:
- Node types: Modules, APIs, Configurations, Databases, External Services
- Relationship types: Contains, Depends on, Calls, Data Flow
- Visualization: Directory structure diagram, module relationship diagram, API call diagram
步骤 4:提取隐性知识
Step 4: Extract Implicit Knowledge
目的:挖掘代码中的设计决策、最佳实践、代码约定
bash
python3 scripts/knowledge_extractor.py --path ./your-project --language python输出文件:
implicit-knowledge.json提取内容:
- 设计模式识别(单例、工厂、观察者等)
- 架构决策记录(为什么选择某个方案)
- 最佳实践提取(命名规范、注释风格)
- 代码约定总结(模块划分、接口设计)
Purpose: Mine design decisions, best practices, and code conventions from code
bash
python3 scripts/knowledge_extractor.py --path ./your-project --language pythonOutput File:
implicit-knowledge.jsonExtracted Content:
- Design pattern recognition (Singleton, Factory, Observer, etc.)
- Architecture decision records (why a certain solution was chosen)
- Best practice extraction (naming conventions, comment styles)
- Code convention summary (module division, interface design)
步骤 5:生成文档(智能体主导)
Step 5: Generate Documents (Agent-led)
基于提取的数据,智能体生成以下文档:
| 文档类型 | 生成方式 | 输出格式 |
|---|---|---|
| README | 参考模板 + 项目数据 | Markdown |
| API 文档 | AST 解析 + 注释提取 | Markdown + JSON |
| 架构文档 | 知识图谱 + 架构决策 | Markdown + Mermaid |
| 知识库首页 | 知识分类 + 时间线 | Markdown |
智能体职责:
- 根据框架指引生成特定框架的文档结构
- 将隐性知识转化为可读的自然语言描述
- 生成可视化图表(架构图、时序图、流程图)
Based on extracted data, the agent generates the following documents:
| Document Type | Generation Method | Output Format |
|---|---|---|
| README | Reference template + project data | Markdown |
| API Documentation | AST parsing + comment extraction | Markdown + JSON |
| Architecture Documentation | Knowledge graph + architecture decisions | Markdown + Mermaid |
| Knowledge Base Homepage | Knowledge classification + timeline | Markdown |
Agent Responsibilities:
- Generate framework-specific document structures based on framework guides
- Convert implicit knowledge into readable natural language descriptions
- Generate visual diagrams (architecture diagrams, sequence diagrams, flow charts)
框架支持
Framework Support
支持的框架(13 个)
Supported Frameworks (13)
⭐ 最常用框架(推荐优先查阅):
- React: 企业级前端,生态最丰富
- Vue: 渐进式前端,易上手
- Django: Python 全栈,快速开发
- Spring Boot: Java 企业级,Spring 生态
桌面应用(3 个):
- Electron - 成熟生态、跨平台
- Tauri - 小体积、高安全性
- Wails - 开发友好、配置简单
前端框架(4 个):
- React - 虚拟 DOM、大型生态
- Vue - 响应式、渐进式
- Svelte - 编译型、高性能
- SolidJS - 细粒度响应式
Web API 框架(5 个):
- Django - Python 全栈、ORM
- Flask - Python 轻量级
- FastAPI - Python 现代异步
- Spring Boot - Java 企业级
- Gin - Go 高性能
跨平台 UI 框架(1 个):
- Flutter - Dart、多平台
完整索引:references/frameworks/index.md
框架选择指南:根据 返回的框架名,直接查阅对应指引即可。
project-analysis.json⭐ Most Commonly Used Frameworks (Recommended for Priority Access):
- React: Enterprise-level frontend, richest ecosystem
- Vue: Progressive frontend, easy to learn
- Django: Python full-stack, rapid development
- Spring Boot: Java enterprise-level, Spring ecosystem
Desktop Applications (3):
- Electron - Mature ecosystem, cross-platform
- Tauri - Small size, high security
- Wails - Developer-friendly, simple configuration
Frontend Frameworks (4):
- React - Virtual DOM, large ecosystem
- Vue - Reactive, progressive
- Svelte - Compiled, high performance
- SolidJS - Fine-grained reactivity
Web API Frameworks (5):
- Django - Python full-stack, ORM
- Flask - Python lightweight
- FastAPI - Python modern asynchronous
- Spring Boot - Java enterprise-level
- Gin - Go high performance
Cross-platform UI Frameworks (1):
- Flutter - Dart, multi-platform
Complete Index: references/frameworks/index.md
Framework Selection Guide: Directly access the corresponding guide using the framework name returned in .
project-analysis.json资源索引
Resource Index
核心脚本
Core Scripts
| 脚本 | 用途 | 参数 | 输出 |
|---|---|---|---|
| analyze_project.py | 项目结构分析 | | |
| knowledge_graph.py | 知识图谱构建 | | |
| knowledge_extractor.py | 隐性知识提取 | | |
| extract_docs.py | 文档和 API 提取 | | |
| analyze_dependencies.py | 依赖关系分析 | | 依赖图(JSON/Mermaid) |
| Script | Purpose | Parameters | Output |
|---|---|---|---|
| analyze_project.py | Project structure analysis | | |
| knowledge_graph.py | Knowledge graph construction | | |
| knowledge_extractor.py | Implicit knowledge extraction | | |
| extract_docs.py | Documentation and API extraction | | |
| analyze_dependencies.py | Dependency relationship analysis | | Dependency graph (JSON/Mermaid) |
参考文档
Reference Documents
| 文档 | 用途 | 何时读取 |
|---|---|---|
| frameworks/index.md | 框架指引索引(最重要) | 检测到框架后查阅 |
| knowledge-base-guide.md | 知识库构建指南 | 构建知识库时参考 |
| knowledge-structure.md | 知识结构组织 | 设计知识分类时参考 |
| readme-template.md | README 生成模板 | 生成项目 README |
| api-doc-guide.md | API 文档生成规范 | 生成 API 文档 |
| architecture-guide.md | 架构文档生成指南 | 生成架构文档 |
| mermaid-syntax.md | Mermaid 图表语法 | 生成可视化图表 |
| Document | Purpose | When to Read |
|---|---|---|
| frameworks/index.md | Framework Guide Index (Most Important) | After detecting frameworks |
| knowledge-base-guide.md | Knowledge base construction guide | When building a knowledge base |
| knowledge-structure.md | Knowledge structure organization | When designing knowledge classification |
| readme-template.md | README generation template | When generating project README |
| api-doc-guide.md | API documentation generation specification | When generating API documentation |
| architecture-guide.md | Architecture documentation generation guide | When generating architecture documentation |
| mermaid-syntax.md | Mermaid diagram syntax | When generating visual diagrams |
常见问题
FAQs
Q1: 如何快速定位框架指引?
Q1: How to quickly locate framework guides?
A: 步骤 1 执行后,查看 的 字段,例如:
project-analysis.jsonframeworksjson
{
"frameworks": ["fastapi", "vue"]
}然后在 中搜索 和 即可跳转到对应章节。
references/frameworks/index.md#fastapi#vueA: After executing Step 1, check the field in , for example:
frameworksproject-analysis.jsonjson
{
"frameworks": ["fastapi", "vue"]
}Then search for and in to jump to the corresponding sections.
#fastapi#vuereferences/frameworks/index.mdQ2: 支持哪些编程语言?
Q2: Which programming languages are supported?
A: 当前支持的语言:
- Python、JavaScript、Java、Go、Rust
- C/C++、Ruby、PHP、Dart
A: Currently supported languages:
- Python, JavaScript, Java, Go, Rust
- C/C++, Ruby, PHP, Dart
Q3: 框架检测准确吗?
Q3: Is framework detection accurate?
A: 基于多维度特征识别:
- 依赖包检测(package.json、requirements.txt 等)
- 文件模式检测(.vue、.jsx、manage.py 等)
- 目录结构检测(src-tauri/、android/ 等)
- 代码模式检测(@app.route、@SpringBootApplication 等)
即使没有明确依赖,也能通过文件和代码特征推断。
A: Identified based on multi-dimensional features:
- Dependency package detection (package.json, requirements.txt, etc.)
- File pattern detection (*.vue, *.jsx, manage.py, etc.)
- Directory structure detection (src-tauri/, android/, etc.)
- Code pattern detection (@app.route, @SpringBootApplication, etc.)
It can infer frameworks through file and code features even without explicit dependencies.
Q4: 知识图谱如何可视化?
Q4: How to visualize the knowledge graph?
A: 两种方式:
方式 1:直接渲染 Mermaid
bash
undefinedA: Two methods:
Method 1: Directly Render Mermaid
bash
undefined生成 Mermaid 文件
Generate Mermaid file
python3 scripts/knowledge_graph.py --path ./your-project --format mermaid
python3 scripts/knowledge_graph.py --path ./your-project --format mermaid
使用支持的 Markdown 编辑器(如 Typora、GitHub)打开 knowledge-graph.mmd
Open knowledge-graph.mmd with a Markdown editor that supports Mermaid (e.g., Typora, GitHub)
**方式 2:在线渲染**
- 复制 `knowledge-graph.mmd` 内容到 https://mermaid.live/
- 或使用 VS Code 的 Mermaid 插件
---
**Method 2: Online Rendering**
- Copy the content of `knowledge-graph.mmd` to https://mermaid.live/
- Or use the Mermaid plugin for VS Code
---Q5: 如何增量更新知识库?
Q5: How to incrementally update the knowledge base?
A: 重新执行受影响的步骤:
- 代码变更 → 重新运行
analyze_project.py - 架构调整 → 重新运行
knowledge_graph.py - 需求更新 → 重新运行
knowledge_extractor.py
建议将上述脚本集成到 CI/CD 流程中。
A: Re-execute the affected steps:
- Code changes → Re-run
analyze_project.py - Architecture adjustments → Re-run
knowledge_graph.py - Requirements updates → Re-run
knowledge_extractor.py
It is recommended to integrate the above scripts into the CI/CD pipeline.
Q6: 隐性知识提取的原理是什么?
Q6: What is the principle of implicit knowledge extraction?
A: 通过以下方式挖掘隐性知识:
- 注释分析:提取设计理由和权衡说明
- 代码模式:识别设计模式(单例、工厂等)
- 命名约定:分析类名、函数名的设计意图
- 依赖关系:通过模块依赖推断架构决策
智能体会将这些结构化数据转化为自然语言描述。
A: Implicit knowledge is mined through the following methods:
- Comment Analysis: Extract design rationales and trade-off explanations
- Code Patterns: Identify design patterns (Singleton, Factory, etc.)
- Naming Conventions: Analyze the design intent of class names and function names
- Dependency Relationships: Infer architecture decisions through module dependencies
The agent converts this structured data into natural language descriptions.
Q7: 生成文档的格式可以自定义吗?
Q7: Can the format of generated documents be customized?
A: 可以。参考 目录下的模板文件:
references/- readme-template.md - README 模板
- api-doc-guide.md - API 文档格式
- architecture-guide.md - 架构文档格式
智能体会根据模板生成文档,你可以修改模板来自定义格式。
A: Yes. Refer to the template files in the directory:
references/- readme-template.md - README template
- api-doc-guide.md - API documentation format
- architecture-guide.md - Architecture documentation format
The agent generates documents based on the templates, and you can modify the templates to customize the format.