repowiki 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. repowiki-0.1.0/.env.example +13 -0
  2. repowiki-0.1.0/.github/workflows/ci.yml +31 -0
  3. repowiki-0.1.0/.github/workflows/publish.yml +40 -0
  4. repowiki-0.1.0/.gitignore +34 -0
  5. repowiki-0.1.0/LICENSE +21 -0
  6. repowiki-0.1.0/PKG-INFO +205 -0
  7. repowiki-0.1.0/README.md +164 -0
  8. repowiki-0.1.0/README_CN.md +121 -0
  9. repowiki-0.1.0/frontend/index.html +12 -0
  10. repowiki-0.1.0/frontend/package-lock.json +3232 -0
  11. repowiki-0.1.0/frontend/package.json +32 -0
  12. repowiki-0.1.0/frontend/src/App.tsx +16 -0
  13. repowiki-0.1.0/frontend/src/components/MermaidDiagram.tsx +49 -0
  14. repowiki-0.1.0/frontend/src/components/SettingsModal.tsx +78 -0
  15. repowiki-0.1.0/frontend/src/components/WikiContent.tsx +97 -0
  16. repowiki-0.1.0/frontend/src/components/WikiSidebar.tsx +68 -0
  17. repowiki-0.1.0/frontend/src/index.css +1 -0
  18. repowiki-0.1.0/frontend/src/lib/api.ts +134 -0
  19. repowiki-0.1.0/frontend/src/main.tsx +10 -0
  20. repowiki-0.1.0/frontend/src/pages/ChatView.tsx +99 -0
  21. repowiki-0.1.0/frontend/src/pages/Home.tsx +141 -0
  22. repowiki-0.1.0/frontend/src/pages/WikiView.tsx +75 -0
  23. repowiki-0.1.0/frontend/src/stores/wiki.ts +86 -0
  24. repowiki-0.1.0/frontend/src/vite-env.d.ts +1 -0
  25. repowiki-0.1.0/frontend/tsconfig.json +21 -0
  26. repowiki-0.1.0/frontend/vite.config.ts +19 -0
  27. repowiki-0.1.0/pyproject.toml +72 -0
  28. repowiki-0.1.0/src/repowiki/__init__.py +3 -0
  29. repowiki-0.1.0/src/repowiki/__main__.py +5 -0
  30. repowiki-0.1.0/src/repowiki/cli.py +287 -0
  31. repowiki-0.1.0/src/repowiki/config.py +93 -0
  32. repowiki-0.1.0/src/repowiki/core/__init__.py +0 -0
  33. repowiki-0.1.0/src/repowiki/core/analyzer.py +284 -0
  34. repowiki-0.1.0/src/repowiki/core/cache.py +96 -0
  35. repowiki-0.1.0/src/repowiki/core/graph.py +195 -0
  36. repowiki-0.1.0/src/repowiki/core/models.py +121 -0
  37. repowiki-0.1.0/src/repowiki/core/rag.py +137 -0
  38. repowiki-0.1.0/src/repowiki/core/scanner.py +246 -0
  39. repowiki-0.1.0/src/repowiki/core/wiki_builder.py +227 -0
  40. repowiki-0.1.0/src/repowiki/export/__init__.py +0 -0
  41. repowiki-0.1.0/src/repowiki/export/html.py +177 -0
  42. repowiki-0.1.0/src/repowiki/export/json_export.py +41 -0
  43. repowiki-0.1.0/src/repowiki/export/markdown.py +32 -0
  44. repowiki-0.1.0/src/repowiki/ingest/__init__.py +0 -0
  45. repowiki-0.1.0/src/repowiki/ingest/github.py +101 -0
  46. repowiki-0.1.0/src/repowiki/ingest/local.py +60 -0
  47. repowiki-0.1.0/src/repowiki/llm/__init__.py +0 -0
  48. repowiki-0.1.0/src/repowiki/llm/client.py +95 -0
  49. repowiki-0.1.0/src/repowiki/llm/prompts.py +224 -0
  50. repowiki-0.1.0/src/repowiki/server/__init__.py +0 -0
  51. repowiki-0.1.0/src/repowiki/server/app.py +72 -0
  52. repowiki-0.1.0/src/repowiki/server/models.py +34 -0
  53. repowiki-0.1.0/src/repowiki/server/routers/__init__.py +0 -0
  54. repowiki-0.1.0/src/repowiki/server/routers/chat.py +78 -0
  55. repowiki-0.1.0/src/repowiki/server/routers/scan.py +133 -0
  56. repowiki-0.1.0/src/repowiki/server/routers/wiki.py +110 -0
@@ -0,0 +1,13 @@
1
+ # RepoWiki configuration
2
+ # Copy to .env and fill in your values
3
+
4
+ # LLM provider API keys (set at least one)
5
+ # OPENAI_API_KEY=sk-xxx
6
+ # DEEPSEEK_API_KEY=sk-xxx
7
+ # ANTHROPIC_API_KEY=sk-xxx
8
+
9
+ # Default model (optional, defaults to deepseek/deepseek-chat)
10
+ # REPOWIKI_MODEL=deepseek/deepseek-chat
11
+
12
+ # Output language (en, zh, ja, ko)
13
+ # REPOWIKI_LANG=en
@@ -0,0 +1,31 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint-and-test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: pip install -e ".[dev]"
26
+
27
+ - name: Lint with ruff
28
+ run: ruff check src/
29
+
30
+ - name: Run tests
31
+ run: pytest tests/ -v
@@ -0,0 +1,40 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.12"
21
+
22
+ - name: Set up Node.js
23
+ uses: actions/setup-node@v4
24
+ with:
25
+ node-version: "22"
26
+
27
+ - name: Install build tools
28
+ run: pip install build
29
+
30
+ - name: Build frontend
31
+ working-directory: frontend
32
+ run: |
33
+ npm install
34
+ npm run build
35
+
36
+ - name: Build package
37
+ run: python -m build
38
+
39
+ - name: Publish to PyPI
40
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,34 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+
10
+ .venv/
11
+ venv/
12
+ env/
13
+
14
+ .env
15
+ .env.local
16
+
17
+ *.db
18
+ *.sqlite3
19
+
20
+ .idea/
21
+ .vscode/
22
+ *.swp
23
+ *.swo
24
+
25
+ .ruff_cache/
26
+ .mypy_cache/
27
+ .pytest_cache/
28
+
29
+ node_modules/
30
+ frontend/dist/
31
+ src/repowiki/server/static/
32
+
33
+ .DS_Store
34
+ Thumbs.db
repowiki-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yufeng He
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: repowiki
3
+ Version: 0.1.0
4
+ Summary: Open-source DeepWiki alternative - generate comprehensive wiki documentation for any codebase
5
+ Project-URL: Homepage, https://github.com/he-yufeng/RepoWiki
6
+ Project-URL: Repository, https://github.com/he-yufeng/RepoWiki
7
+ Project-URL: Issues, https://github.com/he-yufeng/RepoWiki/issues
8
+ Author-email: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai,code-analysis,codebase,deepwiki,developer-tools,documentation,llm,repository,wiki
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Documentation
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: aiosqlite>=0.20.0
25
+ Requires-Dist: click>=8.0
26
+ Requires-Dist: litellm>=1.40.0
27
+ Requires-Dist: networkx>=3.0
28
+ Requires-Dist: numpy>=1.24
29
+ Requires-Dist: pydantic>=2.0
30
+ Requires-Dist: python-dotenv>=1.0
31
+ Requires-Dist: rich>=13.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
34
+ Requires-Dist: pytest>=7.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.4; extra == 'dev'
36
+ Provides-Extra: web
37
+ Requires-Dist: fastapi>=0.115.0; extra == 'web'
38
+ Requires-Dist: python-multipart>=0.0.9; extra == 'web'
39
+ Requires-Dist: uvicorn[standard]>=0.30.0; extra == 'web'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # RepoWiki
43
+
44
+ **Open-source DeepWiki alternative** — generate comprehensive wiki documentation for any codebase from your terminal or browser.
45
+
46
+ [中文文档](README_CN.md)
47
+
48
+ ## Why RepoWiki?
49
+
50
+ | | DeepWiki | deepwiki-open | **RepoWiki** |
51
+ |---|---------|--------------|-------------|
52
+ | Deploy | SaaS only | Docker Compose | **`pip install repowiki`** |
53
+ | Local repos | No | No | **Yes** |
54
+ | CLI | No | No | **Yes** |
55
+ | Web UI | Yes | Yes | **Yes** |
56
+ | Export | Web only | Web only | **Markdown / JSON / HTML** |
57
+ | Reading guide | No | No | **PageRank + guided path** |
58
+ | Terminal Q&A | No | No | **`repowiki chat`** |
59
+ | Dependencies | N/A | Docker + PostgreSQL | **Python + SQLite** |
60
+
61
+ ## Quick Start
62
+
63
+ ```bash
64
+ pip install repowiki
65
+
66
+ # set your API key (DeepSeek, OpenAI, Anthropic, etc.)
67
+ export DEEPSEEK_API_KEY=sk-xxx
68
+ # or
69
+ repowiki config set api_key sk-xxx
70
+
71
+ # scan a local project
72
+ repowiki scan ./my-project
73
+
74
+ # scan a GitHub repo
75
+ repowiki scan https://github.com/pallets/flask
76
+
77
+ # generate self-contained HTML
78
+ repowiki scan ./my-project --format html --open
79
+
80
+ # start the web interface
81
+ pip install repowiki[web]
82
+ repowiki serve
83
+ ```
84
+
85
+ ## Features
86
+
87
+ ### Wiki Generation
88
+ Automatically generates structured documentation for any codebase:
89
+ - **Project overview** — what it does, tech stack, setup instructions
90
+ - **Module documentation** — purpose, key files, relationships, important functions
91
+ - **Architecture diagrams** — auto-detected architecture type with Mermaid visualizations
92
+ - **Reading guide** — "start here" path based on PageRank file importance ranking
93
+
94
+ ### Multiple Output Formats
95
+ - **Markdown** — directory of `.md` files, ready to commit to your repo
96
+ - **JSON** — structured data for API consumption or custom rendering
97
+ - **HTML** — self-contained single file, share with anyone (Mermaid diagrams included)
98
+
99
+ ### Web Interface
100
+ Three-column wiki viewer with sidebar navigation, Mermaid diagram rendering, and an AI-powered Q&A chat about the codebase.
101
+
102
+ ### CLI-First Design
103
+ Everything works from the terminal. No Docker, no database server, no web browser required.
104
+
105
+ ```bash
106
+ repowiki scan . # generate wiki
107
+ repowiki scan . -f html --open # open in browser
108
+ repowiki scan . -l zh # Chinese output
109
+ repowiki chat . # ask questions (coming soon)
110
+ repowiki config list # show configuration
111
+ ```
112
+
113
+ ## Supported Languages
114
+
115
+ Python, JavaScript, TypeScript, Go, Rust, Java, Kotlin, C/C++, C#, Ruby, PHP, Swift, Dart, Vue, Svelte, and 30+ more.
116
+
117
+ ## Supported LLM Providers
118
+
119
+ Powered by [litellm](https://github.com/BerriAI/litellm), RepoWiki works with 100+ LLM providers:
120
+
121
+ | Provider | Model | Alias |
122
+ |----------|-------|-------|
123
+ | Anthropic | Claude Opus 4.6 | `opus` |
124
+ | Anthropic | Claude Sonnet 4.6 | `claude` |
125
+ | OpenAI | GPT-5.4 | `gpt` |
126
+ | OpenAI | GPT-5.4 Mini | `gpt-mini` |
127
+ | Google | Gemini 3.1 Pro | `gemini` |
128
+ | Google | Gemini 2.5 Flash | `gemini-flash` |
129
+ | DeepSeek | DeepSeek V3.2 | `deepseek` |
130
+ | Alibaba | Qwen3.5 Plus | `qwen` |
131
+ | Moonshot | Kimi K2.6 | `kimi` |
132
+ | Zhipu | GLM-5 | `glm` |
133
+ | MiniMax | M2.7 | `minimax` |
134
+
135
+ ```bash
136
+ repowiki config set model deepseek # use alias
137
+ repowiki scan . -m gpt # or pass directly
138
+ ```
139
+
140
+ ## Configuration
141
+
142
+ RepoWiki looks for config in this order:
143
+ 1. CLI flags (`-m`, `-l`, `-o`)
144
+ 2. Environment variables (`REPOWIKI_MODEL`, `REPOWIKI_API_KEY`)
145
+ 3. Config file (`~/.repowiki/config.json`)
146
+ 4. Provider-specific env vars (`DEEPSEEK_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`)
147
+
148
+ ## Project Structure
149
+
150
+ ```
151
+ RepoWiki/
152
+ ├── src/repowiki/
153
+ │ ├── cli.py # Click CLI with scan/serve/chat/config commands
154
+ │ ├── config.py # Configuration management
155
+ │ ├── core/
156
+ │ │ ├── scanner.py # File scanning with language detection
157
+ │ │ ├── analyzer.py # Multi-step LLM analysis pipeline
158
+ │ │ ├── graph.py # Dependency graph + PageRank
159
+ │ │ ├── wiki_builder.py # Wiki page assembly
160
+ │ │ ├── rag.py # TF-IDF retrieval for Q&A
161
+ │ │ └── cache.py # SQLite caching
162
+ │ ├── llm/
163
+ │ │ ├── client.py # litellm async wrapper
164
+ │ │ └── prompts.py # Structured prompt templates
165
+ │ ├── ingest/
166
+ │ │ ├── local.py # Local directory ingestion
167
+ │ │ └── github.py # Git clone with caching
168
+ │ ├── export/
169
+ │ │ ├── markdown.py # Markdown directory export
170
+ │ │ ├── json_export.py # JSON export
171
+ │ │ └── html.py # Self-contained HTML export
172
+ │ └── server/ # FastAPI web backend
173
+ ├── frontend/ # React + Vite + TailwindCSS
174
+ ├── pyproject.toml
175
+ └── LICENSE
176
+ ```
177
+
178
+ ## How It Works
179
+
180
+ 1. **Scan** — Walk the directory tree, filter out binaries and generated files, detect languages and entry points
181
+ 2. **Graph** — Parse import statements across 6 languages, build a dependency graph, run PageRank to rank file importance
182
+ 3. **Analyze** — Send file tree + key files to LLM in 4 structured passes (overview, modules, architecture, reading guide)
183
+ 4. **Cache** — Store results in SQLite keyed by content hash, skip unchanged files on re-scan
184
+ 5. **Export** — Assemble wiki pages with Mermaid diagrams and source links, output in chosen format
185
+
186
+ ## Development
187
+
188
+ ```bash
189
+ git clone https://github.com/he-yufeng/RepoWiki.git
190
+ cd RepoWiki
191
+
192
+ # backend
193
+ python -m venv .venv && source .venv/bin/activate
194
+ pip install -e ".[dev,web]"
195
+
196
+ # frontend
197
+ cd frontend && npm install && npm run dev
198
+
199
+ # run backend
200
+ repowiki serve --port 8000
201
+ ```
202
+
203
+ ## License
204
+
205
+ MIT
@@ -0,0 +1,164 @@
1
+ # RepoWiki
2
+
3
+ **Open-source DeepWiki alternative** — generate comprehensive wiki documentation for any codebase from your terminal or browser.
4
+
5
+ [中文文档](README_CN.md)
6
+
7
+ ## Why RepoWiki?
8
+
9
+ | | DeepWiki | deepwiki-open | **RepoWiki** |
10
+ |---|---------|--------------|-------------|
11
+ | Deploy | SaaS only | Docker Compose | **`pip install repowiki`** |
12
+ | Local repos | No | No | **Yes** |
13
+ | CLI | No | No | **Yes** |
14
+ | Web UI | Yes | Yes | **Yes** |
15
+ | Export | Web only | Web only | **Markdown / JSON / HTML** |
16
+ | Reading guide | No | No | **PageRank + guided path** |
17
+ | Terminal Q&A | No | No | **`repowiki chat`** |
18
+ | Dependencies | N/A | Docker + PostgreSQL | **Python + SQLite** |
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ pip install repowiki
24
+
25
+ # set your API key (DeepSeek, OpenAI, Anthropic, etc.)
26
+ export DEEPSEEK_API_KEY=sk-xxx
27
+ # or
28
+ repowiki config set api_key sk-xxx
29
+
30
+ # scan a local project
31
+ repowiki scan ./my-project
32
+
33
+ # scan a GitHub repo
34
+ repowiki scan https://github.com/pallets/flask
35
+
36
+ # generate self-contained HTML
37
+ repowiki scan ./my-project --format html --open
38
+
39
+ # start the web interface
40
+ pip install repowiki[web]
41
+ repowiki serve
42
+ ```
43
+
44
+ ## Features
45
+
46
+ ### Wiki Generation
47
+ Automatically generates structured documentation for any codebase:
48
+ - **Project overview** — what it does, tech stack, setup instructions
49
+ - **Module documentation** — purpose, key files, relationships, important functions
50
+ - **Architecture diagrams** — auto-detected architecture type with Mermaid visualizations
51
+ - **Reading guide** — "start here" path based on PageRank file importance ranking
52
+
53
+ ### Multiple Output Formats
54
+ - **Markdown** — directory of `.md` files, ready to commit to your repo
55
+ - **JSON** — structured data for API consumption or custom rendering
56
+ - **HTML** — self-contained single file, share with anyone (Mermaid diagrams included)
57
+
58
+ ### Web Interface
59
+ Three-column wiki viewer with sidebar navigation, Mermaid diagram rendering, and an AI-powered Q&A chat about the codebase.
60
+
61
+ ### CLI-First Design
62
+ Everything works from the terminal. No Docker, no database server, no web browser required.
63
+
64
+ ```bash
65
+ repowiki scan . # generate wiki
66
+ repowiki scan . -f html --open # open in browser
67
+ repowiki scan . -l zh # Chinese output
68
+ repowiki chat . # ask questions (coming soon)
69
+ repowiki config list # show configuration
70
+ ```
71
+
72
+ ## Supported Languages
73
+
74
+ Python, JavaScript, TypeScript, Go, Rust, Java, Kotlin, C/C++, C#, Ruby, PHP, Swift, Dart, Vue, Svelte, and 30+ more.
75
+
76
+ ## Supported LLM Providers
77
+
78
+ Powered by [litellm](https://github.com/BerriAI/litellm), RepoWiki works with 100+ LLM providers:
79
+
80
+ | Provider | Model | Alias |
81
+ |----------|-------|-------|
82
+ | Anthropic | Claude Opus 4.6 | `opus` |
83
+ | Anthropic | Claude Sonnet 4.6 | `claude` |
84
+ | OpenAI | GPT-5.4 | `gpt` |
85
+ | OpenAI | GPT-5.4 Mini | `gpt-mini` |
86
+ | Google | Gemini 3.1 Pro | `gemini` |
87
+ | Google | Gemini 2.5 Flash | `gemini-flash` |
88
+ | DeepSeek | DeepSeek V3.2 | `deepseek` |
89
+ | Alibaba | Qwen3.5 Plus | `qwen` |
90
+ | Moonshot | Kimi K2.6 | `kimi` |
91
+ | Zhipu | GLM-5 | `glm` |
92
+ | MiniMax | M2.7 | `minimax` |
93
+
94
+ ```bash
95
+ repowiki config set model deepseek # use alias
96
+ repowiki scan . -m gpt # or pass directly
97
+ ```
98
+
99
+ ## Configuration
100
+
101
+ RepoWiki looks for config in this order:
102
+ 1. CLI flags (`-m`, `-l`, `-o`)
103
+ 2. Environment variables (`REPOWIKI_MODEL`, `REPOWIKI_API_KEY`)
104
+ 3. Config file (`~/.repowiki/config.json`)
105
+ 4. Provider-specific env vars (`DEEPSEEK_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`)
106
+
107
+ ## Project Structure
108
+
109
+ ```
110
+ RepoWiki/
111
+ ├── src/repowiki/
112
+ │ ├── cli.py # Click CLI with scan/serve/chat/config commands
113
+ │ ├── config.py # Configuration management
114
+ │ ├── core/
115
+ │ │ ├── scanner.py # File scanning with language detection
116
+ │ │ ├── analyzer.py # Multi-step LLM analysis pipeline
117
+ │ │ ├── graph.py # Dependency graph + PageRank
118
+ │ │ ├── wiki_builder.py # Wiki page assembly
119
+ │ │ ├── rag.py # TF-IDF retrieval for Q&A
120
+ │ │ └── cache.py # SQLite caching
121
+ │ ├── llm/
122
+ │ │ ├── client.py # litellm async wrapper
123
+ │ │ └── prompts.py # Structured prompt templates
124
+ │ ├── ingest/
125
+ │ │ ├── local.py # Local directory ingestion
126
+ │ │ └── github.py # Git clone with caching
127
+ │ ├── export/
128
+ │ │ ├── markdown.py # Markdown directory export
129
+ │ │ ├── json_export.py # JSON export
130
+ │ │ └── html.py # Self-contained HTML export
131
+ │ └── server/ # FastAPI web backend
132
+ ├── frontend/ # React + Vite + TailwindCSS
133
+ ├── pyproject.toml
134
+ └── LICENSE
135
+ ```
136
+
137
+ ## How It Works
138
+
139
+ 1. **Scan** — Walk the directory tree, filter out binaries and generated files, detect languages and entry points
140
+ 2. **Graph** — Parse import statements across 6 languages, build a dependency graph, run PageRank to rank file importance
141
+ 3. **Analyze** — Send file tree + key files to LLM in 4 structured passes (overview, modules, architecture, reading guide)
142
+ 4. **Cache** — Store results in SQLite keyed by content hash, skip unchanged files on re-scan
143
+ 5. **Export** — Assemble wiki pages with Mermaid diagrams and source links, output in chosen format
144
+
145
+ ## Development
146
+
147
+ ```bash
148
+ git clone https://github.com/he-yufeng/RepoWiki.git
149
+ cd RepoWiki
150
+
151
+ # backend
152
+ python -m venv .venv && source .venv/bin/activate
153
+ pip install -e ".[dev,web]"
154
+
155
+ # frontend
156
+ cd frontend && npm install && npm run dev
157
+
158
+ # run backend
159
+ repowiki serve --port 8000
160
+ ```
161
+
162
+ ## License
163
+
164
+ MIT
@@ -0,0 +1,121 @@
1
+ # RepoWiki
2
+
3
+ **开源 DeepWiki 替代品** — 从终端或浏览器为任意代码仓库生成完整 wiki 文档。
4
+
5
+ [English](README.md)
6
+
7
+ ## 为什么选 RepoWiki?
8
+
9
+ | | DeepWiki | deepwiki-open | **RepoWiki** |
10
+ |---|---------|--------------|-------------|
11
+ | 部署方式 | SaaS,不可自托管 | Docker Compose | **`pip install repowiki`** |
12
+ | 本地仓库 | 不支持 | 不支持 | **原生支持** |
13
+ | CLI | 无 | 无 | **有** |
14
+ | Web UI | 有 | 有 | **有** |
15
+ | 导出格式 | 仅网页 | 仅网页 | **Markdown / JSON / HTML** |
16
+ | 阅读指南 | 无 | 无 | **PageRank 排名 + 阅读路径** |
17
+ | 终端问答 | 无 | 无 | **`repowiki chat`** |
18
+ | 依赖 | N/A | Docker + PostgreSQL | **Python + SQLite** |
19
+
20
+ ## 快速开始
21
+
22
+ ```bash
23
+ pip install repowiki
24
+
25
+ # 设置 API Key(DeepSeek、OpenAI、Anthropic 等)
26
+ export DEEPSEEK_API_KEY=sk-xxx
27
+ # 或者
28
+ repowiki config set api_key sk-xxx
29
+
30
+ # 扫描本地项目
31
+ repowiki scan ./my-project
32
+
33
+ # 扫描 GitHub 仓库
34
+ repowiki scan https://github.com/pallets/flask
35
+
36
+ # 生成自包含 HTML 并打开
37
+ repowiki scan ./my-project --format html --open
38
+
39
+ # 启动 Web 界面
40
+ pip install repowiki[web]
41
+ repowiki serve
42
+ ```
43
+
44
+ ## 核心功能
45
+
46
+ ### Wiki 生成
47
+ 自动为任意代码仓库生成结构化文档:
48
+ - **项目概览** — 做什么、技术栈、如何运行
49
+ - **模块文档** — 用途、关键文件、模块间关系、重要函数
50
+ - **架构图** — 自动识别架构模式,Mermaid 可视化
51
+ - **阅读指南** — 基于 PageRank 文件重要性排名的"从这里开始读"路径
52
+
53
+ ### 多格式导出
54
+ - **Markdown** — `.md` 文件目录,可以直接放进仓库当文档用
55
+ - **JSON** — 结构化数据,方便 API 消费或自定义渲染
56
+ - **HTML** — 自包含单文件,分享给任何人都能直接打开(内含 Mermaid 图表)
57
+
58
+ ### Web 界面
59
+ 三栏布局 wiki 查看器:侧边导航 + 内容区 + Mermaid 图表,还有 AI 问答聊天功能。
60
+
61
+ ### CLI 优先
62
+ 所有功能都能在终端完成。不需要 Docker,不需要数据库,不需要浏览器。
63
+
64
+ ```bash
65
+ repowiki scan . # 生成 wiki
66
+ repowiki scan . -f html --open # 浏览器打开
67
+ repowiki scan . -l zh # 中文输出
68
+ repowiki chat . # 终端问答(即将推出)
69
+ repowiki config list # 查看配置
70
+ ```
71
+
72
+ ## 支持的语言
73
+
74
+ Python、JavaScript、TypeScript、Go、Rust、Java、Kotlin、C/C++、C#、Ruby、PHP、Swift、Dart、Vue、Svelte 等 30+ 种编程语言。
75
+
76
+ ## 支持的 LLM 提供商
77
+
78
+ 基于 [litellm](https://github.com/BerriAI/litellm),支持 100+ LLM 提供商:
79
+
80
+ | 提供商 | 模型 | 别名 |
81
+ |--------|------|------|
82
+ | Anthropic | Claude Opus 4.6 | `opus` |
83
+ | Anthropic | Claude Sonnet 4.6 | `claude` |
84
+ | OpenAI | GPT-5.4 | `gpt` |
85
+ | OpenAI | GPT-5.4 Mini | `gpt-mini` |
86
+ | Google | Gemini 3.1 Pro | `gemini` |
87
+ | Google | Gemini 2.5 Flash | `gemini-flash` |
88
+ | DeepSeek | DeepSeek V3.2 | `deepseek` |
89
+ | 阿里云 | Qwen3.5 Plus | `qwen` |
90
+ | 月之暗面 | Kimi K2.6 | `kimi` |
91
+ | 智谱 | GLM-5 | `glm` |
92
+ | MiniMax | M2.7 | `minimax` |
93
+
94
+ ## 工作原理
95
+
96
+ 1. **扫描** — 遍历目录树,过滤二进制和生成文件,检测语言和入口文件
97
+ 2. **建图** — 解析 6 种语言的 import 语句,构建依赖图,PageRank 计算文件重要性
98
+ 3. **分析** — 4 步 LLM 分析(概览、模块、架构、阅读指南),并发执行
99
+ 4. **缓存** — SQLite 按内容 hash 缓存,重新扫描时跳过未变更文件
100
+ 5. **导出** — 组装 wiki 页面,注入 Mermaid 图和源码链接,按选定格式输出
101
+
102
+ ## 开发
103
+
104
+ ```bash
105
+ git clone https://github.com/he-yufeng/RepoWiki.git
106
+ cd RepoWiki
107
+
108
+ # 后端
109
+ python -m venv .venv && source .venv/bin/activate
110
+ pip install -e ".[dev,web]"
111
+
112
+ # 前端
113
+ cd frontend && npm install && npm run dev
114
+
115
+ # 启动后端
116
+ repowiki serve --port 8000
117
+ ```
118
+
119
+ ## 许可证
120
+
121
+ MIT
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>RepoWiki</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/main.tsx"></script>
11
+ </body>
12
+ </html>