Project Wiki - Project Knowledge Base Construction Tool
📋 Table of Contents
Core Values
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
Minimal Usage (1 Minute)
bash
# 1. Analyze project
python3 scripts/analyze_project.py --path ./your-project
# 2. View results
cat project-analysis.json
Sample Output:
json
{
"languages": ["Python", "JavaScript"],
"frameworks": ["fastapi", "vue"],
"project_structure": {...}
}
Complete Workflow (5 Minutes)
bash
# 1. Project analysis
python3 scripts/analyze_project.py --path ./your-project
# 2. Build knowledge graph
python3 scripts/knowledge_graph.py --path ./your-project --format mermaid
# 3. Extract implicit knowledge
python3 scripts/knowledge_extractor.py --path ./your-project --language python
# 4. View results
# - project-analysis.json: Project structure analysis
# - knowledge-graph.json: Knowledge graph data
# - knowledge-graph.mmd: Mermaid diagram
# - implicit-knowledge.json: Implicit knowledge extraction
Operation Steps
Step 1: Project Structure Analysis
Purpose: Identify programming languages, frameworks, build tools, and project structure
bash
python3 scripts/analyze_project.py --path ./your-project
Key Fields:
- : List of programming languages (Python, JavaScript, Java, Go, Rust, etc.)
- : List of frameworks (all lowercase, corresponding to framework guide anchors)
- : Build tools (npm, pip, maven, gradle, cargo, etc.)
- : Directory tree 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
Step 2: Access Framework Guides
Trigger Condition: Step 1 returns the
field
Access Methods:
Method 1: Direct Jump
# Example: frameworks: ["fastapi", "vue"]
→ 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
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)
Step 3: Build Knowledge Graph
Purpose: Generate relationship networks of modules/APIs/configurations
bash
python3 scripts/knowledge_graph.py --path ./your-project --format mermaid
Output Files:
- : Structured data (nodes and edges)
- : Mermaid flow chart (directly renderable)
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
Step 4: Extract Implicit Knowledge
Purpose: Mine design decisions, best practices, and code conventions from code
bash
python3 scripts/knowledge_extractor.py --path ./your-project --language python
Extracted 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)
Step 5: Generate Documents (Agent-led)
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
Supported Frameworks (13)
⭐ 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
.
Resource Index
Core Scripts
| Script | Purpose | Parameters | Output |
|---|
| analyze_project.py | Project structure analysis | Project path | |
| knowledge_graph.py | Knowledge graph construction | Project path<br> Output format | <br> |
| knowledge_extractor.py | Implicit knowledge extraction | Project path<br> Programming language | |
| extract_docs.py | Documentation and API extraction | Project path<br> Programming language | |
| analyze_dependencies.py | Dependency relationship analysis | Project path<br> Output format | Dependency graph (JSON/Mermaid) |
Reference Documents
| 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: How to quickly locate framework guides?
A: After executing Step 1, check the
field in
, for example:
json
{
"frameworks": ["fastapi", "vue"]
}
Then search for
and
in
references/frameworks/index.md
to jump to the corresponding sections.
Q2: Which programming languages are supported?
A: Currently supported languages:
- Python, JavaScript, Java, Go, Rust
- C/C++, Ruby, PHP, Dart
Q3: Is framework detection accurate?
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: How to visualize the knowledge graph?
A: Two methods:
Method 1: Directly Render Mermaid
bash
# Generate Mermaid file
python3 scripts/knowledge_graph.py --path ./your-project --format mermaid
# Open knowledge-graph.mmd with a Markdown editor that supports Mermaid (e.g., Typora, GitHub)
Method 2: Online Rendering
- Copy the content of to https://mermaid.live/
- Or use the Mermaid plugin for VS Code
Q5: How to incrementally update the knowledge base?
A: Re-execute the affected steps:
- Code changes → Re-run
- Architecture adjustments → Re-run
- Requirements updates → Re-run
It is recommended to integrate the above scripts into the CI/CD pipeline.
Q6: What is the principle of implicit knowledge extraction?
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: Can the format of generated documents be customized?
A: Yes. Refer to the template files in the
directory:
- 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.