rekipedia 0.17.24 → 0.17.27

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.
package/README.md CHANGED
@@ -1,163 +1,202 @@
1
1
  # rekipedia
2
2
 
3
- **[English](README.md) | [繁體中文](README.zh-TW.md) | [简体中文](README.zh-CN.md)**
3
+ **Turn any repo into an AI-ready knowledge base — wiki, RAG, and MCP server included.**
4
4
 
5
- > Your AI tech lead — always available, always up to date.
5
+ [![PyPI version](https://img.shields.io/pypi/v/rekipedia)](https://pypi.org/project/rekipedia/)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/)
6
8
 
7
- rekipedia scans any repository into a portable SQLite knowledge store and gives every developer an LLM-powered tech lead they can ask anything.
9
+ ---
10
+
11
+ ## Why rekipedia?
8
12
 
9
- No hallucinations every answer is grounded in your actual codebase.
13
+ - **AI agents hallucinate on unfamiliar code.** rekipedia gives them grounded, citable context from the actual source.
14
+ - **Onboarding is slow.** A generated wiki means new teammates (human or AI) ramp up in minutes, not days.
15
+ - **RAG pipelines need structured input.** rekipedia produces a clean SQLite store, FAISS index, and wiki — ready to plug in.
16
+ - **CI shouldn't break the knowledge base.** Works offline, commits alongside your code, zero cloud dependency.
10
17
 
11
18
  ---
12
19
 
13
- ## Quick start
20
+ ## Quickstart
14
21
 
15
22
  ```bash
16
- # No install required
17
- npx rekipedia init . && npx rekipedia scan .
18
- # or
19
- uvx rekipedia init . && uvx rekipedia scan .
23
+ pip install rekipedia
24
+ # or: npx rekipedia
20
25
  ```
21
26
 
27
+ ### Zero config — no API key needed
28
+
22
29
  ```bash
23
- # Permanent install
24
- pip install rekipedia # core
25
- pip install "rekipedia[rag]" # + semantic search (FAISS)
30
+ reki scan . --no-llm
31
+ ```
32
+
33
+ ```
34
+ ✔ Scanned 312 files · 4,891 symbols indexed
35
+ ✔ Wiki generated · .rekipedia/wiki/
36
+ ✔ Knowledge store · .rekipedia/store.db
37
+ Done in 4.2s
38
+ ```
39
+
40
+ That's it. Your codebase is now a portable knowledge base.
41
+
42
+ ### With LLM (richer wiki + Q&A)
43
+
44
+ ```bash
45
+ export REKIPEDIA_API_KEY=sk-...
46
+ reki scan .
47
+ reki ask "how does authentication work?"
26
48
  ```
27
49
 
28
50
  ---
29
51
 
30
- ## Quick Start — No API Key Needed
52
+ ## Key Features
53
+
54
+ ### 🗂 `reki scan` — Instant knowledge store
31
55
 
32
- Run a full static analysis without any LLM API key:
56
+ Parses your repo into a SQLite knowledge store with symbols, relationships, and auto-generated wiki pages.
33
57
 
34
58
  ```bash
35
- pip install rekipedia
36
- reki scan . --no-llm # ~5-10s, zero API calls
37
- reki onboard . # architecture overview
38
- reki tour . # guided walkthrough by dependency depth
39
- reki domain . # business domain layer map
40
- reki diff . # impact analysis on changed files
41
- reki export . --format md # export full wiki to markdown
59
+ reki scan . # full scan with LLM summaries
60
+ reki scan . --no-llm # zero config, no API key required
42
61
  ```
43
62
 
44
- > **Note:** `reki ask` (AI Q&A) requires an LLM API key. See [LLM Setup](#llm-setup) below.
63
+ ### 💬 `reki ask` Q&A grounded in your code
45
64
 
46
- ---
65
+ Answers questions with file:line citations. No hallucinations — every answer is backed by indexed source.
47
66
 
48
- ## Core commands
67
+ ```bash
68
+ reki ask "what is the entry point?"
69
+ reki ask "which modules handle payments?" --brief
70
+ ```
49
71
 
50
- | Command | What it does |
51
- |---|---|
52
- | `reki init .` | Scaffold config |
53
- | `reki scan .` | Full analysis → wiki + knowledge store |
54
- | `reki update .` | Incremental refresh (changed files only) |
55
- | `reki update . --impact-only` | Impact-aware mode — only regenerates wiki pages for affected modules |
56
- | `reki serve .` | Local web UI — browse, search, ask AI |
57
- | `reki ask` | Interactive Q&A REPL (streamed) |
58
- | `reki embed .` | Build FAISS semantic index for hybrid RAG |
59
- | `reki export .` | Bundle wiki → `--format md\|zip\|json\|html` |
60
- | `reki diff` | Uncommitted-change impact analysis |
61
- | `reki domain .` | Map codebase to business layers (API/Service/Data/UI) |
62
- | `reki tour .` | Guided learning walkthrough by dependency depth |
63
- | `reki onboard .` | Static onboarding guide for new developers |
64
- | `reki review` | LLM PR review grounded in wiki context |
65
- | `reki refactor .` | Detect code smells → `REFACTOR.md` |
66
- | `reki refactor . --dry-run` | Preview refactor suggestions without writing files |
67
- | `reki refactor . --apply` | Auto-apply safe fixes (dead code markers, split suggestions) |
68
- | `reki refactor . --apply --dry-run` | Preview what `--apply` would do |
69
- | `reki watch .` | Auto-index on file change (OS watcher) |
70
- | `reki hook install` | Git post-commit auto-rebuild |
71
- | `reki mcp` | MCP stdio server for AI coding assistants |
72
+ ```
73
+ Answer: The entry point is src/main.py:12 — `App.run()` bootstraps the server.
74
+ Sources: src/main.py:12, src/server.py:34
75
+ ```
72
76
 
73
- ---
77
+ ### 🤖 `reki mcp` — MCP server for AI agents
78
+
79
+ Plug rekipedia directly into Claude Code, Cursor, or any MCP-aware agent.
80
+
81
+ ```bash
82
+ reki mcp
83
+ ```
74
84
 
75
- ### `reki ask` Brief mode
85
+ Available tools: `ask`, `search_nodes`, `get_context`, `get_relationships`, `get_hub_nodes`, `get_impact`
86
+
87
+ ### 🔥 `reki hotspots` — Architectural hotspot detection
88
+
89
+ Finds hub and bridge nodes — the files your whole codebase depends on.
76
90
 
77
91
  ```bash
78
- # Brief mode — ~150 tokens, summary + citations only
79
- reki ask "what does Scanner.scan() do?" --brief
92
+ reki hotspots
93
+ ```
80
94
 
81
- # Or via env var (useful for piping)
82
- REKIPEDIA_BRIEF=1 reki ask "entry point?" | grep 'src/'
95
+ ```
96
+ Hub nodes: src/core/engine.py (42 dependents)
97
+ Bridge nodes: src/adapters/db.py (connects 3 clusters)
83
98
  ```
84
99
 
85
- ---
100
+ ### 🔄 `reki update` — Incremental updates
86
101
 
87
- ## LLM Setup
102
+ Only regenerates wiki pages affected by your changes.
88
103
 
89
- rekipedia uses [litellm](https://github.com/BerriAI/litellm) and supports any provider:
104
+ ```bash
105
+ reki update . --impact-only
106
+ ```
90
107
 
91
- | Provider | Example |
92
- |---|---|
93
- | OpenAI | `OPENAI_API_KEY=sk-... reki scan .` |
94
- | Anthropic Claude | `REKIPEDIA_MODEL=claude-3-5-sonnet-20241022 REKIPEDIA_API_KEY=sk-ant-... reki scan .` |
95
- | Google Gemini | `REKIPEDIA_MODEL=gemini/gemini-2.0-flash REKIPEDIA_API_KEY=AIza... reki scan .` |
96
- | OpenRouter | `REKIPEDIA_MODEL=openrouter/anthropic/claude-3.5-sonnet REKIPEDIA_API_KEY=sk-or-... reki scan .` |
97
- | Local Ollama (default) | `REKIPEDIA_MODEL=ollama/llama4 reki scan .` |
98
- | Azure OpenAI | `REKIPEDIA_MODEL=azure/gpt-4o REKIPEDIA_BASE_URL=https://your-resource.openai.azure.com REKIPEDIA_API_KEY=... reki scan .` |
108
+ ---
99
109
 
100
- After `reki init`, edit `.rekipedia/config.yml`:
110
+ ## MCP Integration
101
111
 
102
- ```yaml
103
- llm:
104
- model: ollama/llama4 # any litellm model string
105
- api_key: "" # or REKIPEDIA_API_KEY env var
106
- base_url: "" # for local / self-hosted endpoints
107
- temperature: 0.2
112
+ rekipedia ships a full MCP stdio server. Connect it to any MCP-aware agent in seconds.
113
+
114
+ Add to your `.mcp.json`:
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "rekipedia": {
120
+ "command": "reki",
121
+ "args": ["mcp"],
122
+ "cwd": "."
123
+ }
124
+ }
125
+ }
108
126
  ```
109
127
 
110
- Supported providers: Ollama, OpenAI, Anthropic, Gemini, any OpenAI-compatible endpoint.
128
+ Claude Code and Cursor will automatically discover this config. The agent can then call:
111
129
 
112
- Environment variables:
113
- - `REKIPEDIA_MODEL` — litellm model string (default: `ollama/llama4`)
114
- - `REKIPEDIA_API_KEY` — API key for the chosen provider
115
- - `REKIPEDIA_BASE_URL` — custom base URL (for Azure, Ollama, proxies)
116
- - `REKIPEDIA_TIMEOUT` — LLM call timeout in seconds (default: 180)
130
+ - `ask` — Q&A over the codebase
131
+ - `search_nodes` — symbol/file search
132
+ - `get_context` — file-level context
133
+ - `get_relationships` — dependency graph queries
134
+ - `get_hub_nodes` — architectural hotspots
135
+ - `get_impact` — change impact analysis
117
136
 
118
137
  ---
119
138
 
120
- ## Output layout
139
+ ## LLM Setup
121
140
 
141
+ rekipedia works without an LLM (`--no-llm`). To enable richer summaries and Q&A:
142
+
143
+ ```bash
144
+ export REKIPEDIA_API_KEY=sk-... # OpenAI, Anthropic, or compatible
145
+ export REKIPEDIA_MODEL=gpt-4o # default: gpt-4o
122
146
  ```
123
- .rekipedia/
124
- ├── config.yml # settings (committed)
125
- ├── store.db # SQLite knowledge store (git-ignored)
126
- ├── wiki/ # generated Markdown pages
127
- ├── rag/ # FAISS index + chunks (git-ignored)
128
- ├── diagrams/ # Mermaid diagrams
129
- └── exports/ # JSON exports + manifest
147
+
148
+ Any OpenAI-compatible endpoint works:
149
+
150
+ ```bash
151
+ export REKIPEDIA_API_KEY=ollama
152
+ export REKIPEDIA_MODEL=ollama/llama3
130
153
  ```
131
154
 
132
155
  ---
133
156
 
134
- ## Python API
157
+ ## Commands
158
+
159
+ | Command | Description |
160
+ |---|---|
161
+ | `reki scan .` | Full scan — index symbols, generate wiki |
162
+ | `reki scan . --no-llm` | Scan without LLM, zero config |
163
+ | `reki ask "question"` | Ask anything about the codebase |
164
+ | `reki ask "question" --brief` | Short answer mode |
165
+ | `reki update . --impact-only` | Incremental update, affected pages only |
166
+ | `reki serve .` | Local web UI at `http://127.0.0.1:7070` |
167
+ | `reki embed .` | Build FAISS semantic index |
168
+ | `reki export . --format md\|zip\|json\|html` | Export the wiki |
169
+ | `reki diff` | Show impact of uncommitted changes |
170
+ | `reki hotspots` | Hub & bridge node detection |
171
+ | `reki refactor . --dry-run` | Preview refactor suggestions |
172
+ | `reki refactor . --apply` | Apply refactor suggestions |
173
+ | `reki mcp` | Start MCP stdio server |
174
+ | `reki review` | LLM-powered PR review |
175
+ | `reki watch .` | Auto-index on file change |
176
+ | `reki hook install` | Install git post-commit hook |
135
177
 
136
- ```python
137
- import rekipedia
178
+ ---
138
179
 
139
- result = rekipedia.scan("/path/to/repo")
140
- answer = rekipedia.ask("/path/to/repo", "How does the auth flow work?")
141
- print(answer.text)
142
- for c in answer.citations:
143
- print(f" {c.file}:{c.line}")
144
- ```
180
+ ## Coming Soon
145
181
 
146
- Async variants: `rekipedia.scan_async()`, `rekipedia.ask_async()`
182
+ - **Hosted wiki** — share your knowledge base with a link, no self-hosting required
183
+ - **Team sync** — collaborative wiki with conflict-free merge for distributed teams
184
+ - **GitHub Action** — auto-update wiki on every push
185
+ - **VS Code extension** — inline `reki ask` from your editor
147
186
 
148
187
  ---
149
188
 
150
- ## Development
189
+ ## Contributing
190
+
191
+ rekipedia is going MIT open source. Contributions welcome.
151
192
 
152
193
  ```bash
153
- make dev # install deps
154
- make test # run tests
155
- make lint # lint
156
- make build # wheel + npm tarball
194
+ git clone https://github.com/unrealandychan/rekipedia.git
195
+ pip install -e ".[dev]"
157
196
  ```
158
197
 
159
- ---
198
+ Open an issue or PR — the bar is low and the maintainer is responsive.
160
199
 
161
- ## License
200
+ ---
162
201
 
163
- Proprietary and Confidential Copyright © 2026 Eddie Chan. All Rights Reserved.
202
+ **Current version:** `0.17.25` · [PyPI](https://pypi.org/project/rekipedia/) · [MIT License](LICENSE)
package/README.zh-CN.md CHANGED
@@ -2,436 +2,158 @@
2
2
 
3
3
  **[English](README.md) | [繁體中文](README.zh-TW.md) | [简体中文](README.zh-CN.md)**
4
4
 
5
- > 您的 AI 技术负责人——随时在线,始终最新。
6
-
7
- rekipedia 可扫描任意代码仓库,将其转化为便携的 SQLite 知识库,让团队中的每位开发者都拥有一个由 LLM 驱动的技术负责人,可以随时询问:_"认证流程是如何运作的?"、"添加一个新 API 端点最快的方式是什么?"、"上周是什么导致了支付服务故障?"_
8
-
9
- 零幻觉,零猜测——每个答案都基于您的真实代码库。
10
-
11
- ### 核心功能
12
- - **关系置信度评分**:每个提取的关系均标记为 EXTRACTED/INFERRED/AMBIGUOUS,并附带置信度分数
13
- - **设计意图提取**:`# NOTE:`、`# HACK:`、`# WHY:` 注释被提取为知识节点
14
- - **God 节点**:度数最高的符号会在 index.md 中呈现,并在图形界面中高亮显示
15
- - **交互式依赖关系图**:`rekipedia serve` 现已包含 `/graph` 路由,提供基于 D3.js 的力导向可视化
16
- - **Git 钩子**:`rekipedia hook install` 可在每次提交时触发自动重建
17
- - **智能 wiki 编排**:`PlannerAgent` 根据您的仓库动态设计 wiki 结构
18
- - **页面重要性评分**:规划器为每个页面分配重要性分数(0–100),导航侧边栏按优先级排序
19
- - **DeepWiki 风格分节**:页面按逻辑分节分组(`getting-started`、`architecture`、`core-components` 等)
20
- - **Wiki 侧边栏分类**:`reki serve` 侧边栏按 `section` 字段分组,支持折叠标题
21
- - **实时搜索**:在侧边栏搜索框中输入内容,可即时按标题或分类筛选 wiki 页面
22
- - **重构分析**:`reki refactor` 检测代码异味(上帝类、循环依赖、死代码、高耦合),并提供 LLM 增强建议——输出 `REFACTOR.md` + `refactor_report.json`
23
- - **上下文切片**:每个页面仅接收其所需的数据(相比固定布局方式减少约 40–60% 的 token 用量)
24
- - **混合 RAG 问答**:FAISS 索引的代码块 + wiki 页面为 LLM 提供完整的代码库上下文以回答问题
25
- - **嵌入模型提供商选择**:`--embed-provider openai|ollama|azure|...`——支持任何兼容 litellm 的嵌入模型
26
- - **Wiki 导出**:打包为单个 Markdown 文件、ZIP 压缩包或结构化 JSON(`rekipedia export`)
27
- - **增量更新**:首次扫描后仅重新处理已变更的文件
28
- - **有据可查的问答**:答案引用真实的文件路径和行号——零幻觉
29
- - **代码库树形索引**——每次扫描在 SQLite 中构建层级目录/文件树,支持结构化导航和未来基于推理的检索。
5
+ > 你的 AI 技术负责人 —— 随时在线,始终最新。
30
6
 
31
- ## 快速开始
7
+ rekipedia 可扫描任意代码库,生成便携式 SQLite 知识库,为每位开发者提供一个由 LLM 驱动的技术负责人,随问随答。
32
8
 
33
- ### 通过 npm / npx(无需安装)
9
+ 零幻觉 —— 每个回答都基于你的真实代码库。
34
10
 
35
- ```bash
36
- npx rekipedia init .
37
- npx rekipedia scan .
38
- ```
11
+ ---
39
12
 
40
- ### 通过 uv / uvx(无需安装)
13
+ ## 快速开始
41
14
 
42
15
  ```bash
43
- uvx rekipedia init .
44
- uvx rekipedia scan .
16
+ # 无需安装
17
+ npx rekipedia init . && npx rekipedia scan .
18
+ # 或
19
+ uvx rekipedia init . && uvx rekipedia scan .
45
20
  ```
46
21
 
47
- ### 永久安装
48
-
49
22
  ```bash
50
- # Core (scan + serve + ask)
51
- pip install rekipedia
52
- # or
53
- uv tool install rekipedia
54
-
55
- # With RAG support (semantic embed + search — needs faiss-cpu + numpy ~100MB)
56
- pip install "rekipedia[rag]"
57
-
58
- # Homebrew (Go single binary — no Python needed)
59
- brew tap unrealandychan/tap
60
- brew install rekipedia
23
+ # 永久安装
24
+ pip install rekipedia # 核心
25
+ pip install "rekipedia[rag]" # + 语义搜索 (FAISS)
61
26
  ```
62
27
 
63
28
  ---
64
29
 
65
- ## 快速开始——无需 API 密钥
30
+ ## 快速开始 —— 无需 API Key
66
31
 
67
- 无需任何 LLM API 密钥即可执行完整静态分析:
32
+ 无需任何 LLM API Key,即可运行完整静态分析:
68
33
 
69
34
  ```bash
70
35
  pip install rekipedia
71
- reki scan . --no-llm # ~5-10 秒,零 API 调用
72
- reki onboard . # 架构总览
73
- reki tour . # 依赖深度导览
74
- reki domain . # 业务领域层次图
75
- reki diff . # 变更影响分析
76
- reki export . --format md # 导出完整 wiki Markdown
36
+ reki scan . --no-llm # ~5-10s,零 API 调用
37
+ reki onboard . # 架构概览
38
+ reki tour . # 按依赖深度引导游览
39
+ reki domain . # 业务域分层图
40
+ reki diff . # 已变更文件的影响分析
41
+ reki export . --format md # 将完整 wiki 导出为 Markdown
77
42
  ```
78
43
 
79
- > **注意:** `reki ask`(AI 问答)需要 LLM API 密钥。请参阅下方 [LLM 配置](#llm-配置)。
44
+ > **注意:** `reki ask`(AI 问答)需要 LLM API Key。请参阅下方 [LLM 配置](#llm-配置)。
80
45
 
81
46
  ---
82
47
 
83
- ## Python API
84
-
85
- 在 Jupyter Notebook、CI 流水线或任意 Python 应用中以编程方式使用 rekipedia:
48
+ ## 核心命令
86
49
 
87
- ```python
88
- import rekipedia
89
-
90
- # Scan a local repo
91
- result = rekipedia.scan("/path/to/repo")
92
- print(result.page_count) # number of wiki pages generated
93
- print(result.symbol_count) # number of code symbols extracted
94
- print(result.token_count) # estimated token count of the wiki
95
-
96
- # Ask a question — grounded answer with file:line citations
97
- answer = rekipedia.ask("/path/to/repo", "How does the auth flow work?")
98
- print(answer.text)
99
- for citation in answer.citations:
100
- print(f" {citation.file}:{citation.line}")
101
-
102
- # Async variants (Jupyter-friendly)
103
- result = await rekipedia.scan_async("/path/to/repo")
104
- answer = await rekipedia.ask_async("/path/to/repo", "What is the entry point?")
105
- ```
106
-
107
- **返回类型:**
108
-
109
- | Type | Key fields |
50
+ | 命令 | 功能说明 |
110
51
  |---|---|
111
- | `ScanResult` | `page_count`, `symbol_count`, `token_count`, `wiki_pages`, `db_path`, `wiki_dir` |
112
- | `AskResult` | `text`, `citations: list[Citation]`, `model_used` |
113
- | `Citation` | `file`, `line`, `snippet` |
52
+ | `reki init .` | 初始化配置 |
53
+ | `reki scan .` | 完整分析 wiki + 知识库 |
54
+ | `reki update .` | 增量刷新(仅处理变更文件) |
55
+ | `reki update . --impact-only` | 影响感知模式 —— 仅重新生成受影响模块的 wiki 页面 |
56
+ | `reki serve .` | 本地 Web UI —— 浏览、搜索、问 AI |
57
+ | `reki ask` | 交互式问答 REPL(流式输出) |
58
+ | `reki embed .` | 构建 FAISS 语义索引(混合 RAG) |
59
+ | `reki export .` | 打包 wiki → `--format md|zip|json|html` |
60
+ | `reki diff` | 未提交变更的影响分析 |
61
+ | `reki domain .` | 将代码库映射到业务层(API/Service/Data/UI) |
62
+ | `reki tour .` | 按依赖深度引导学习游览 |
63
+ | `reki onboard .` | 面向新开发者的静态入职指南 |
64
+ | `reki review` | 基于 wiki 上下文的 LLM PR 审查 |
65
+ | `reki refactor .` | 检测代码异味 → `REFACTOR.md` |
66
+ | `reki refactor . --dry-run` | 预览重构建议,不写入文件 |
67
+ | `reki refactor . --apply` | 自动应用安全修复(死代码标记、拆分建议) |
68
+ | `reki refactor . --apply --dry-run` | 预览 `--apply` 将执行的操作 |
69
+ | `reki watch .` | 文件变更时自动重建索引(OS 监听器) |
70
+ | `reki hook install` | Git post-commit 自动重建 |
71
+ | `reki mcp` | 面向 AI 编程助手的 MCP stdio 服务器 |
114
72
 
115
73
  ---
116
74
 
117
- ## 命令
75
+ ### `reki ask` —— 简洁模式
118
76
 
119
- | Command | Description |
120
- |---|---|
121
- | `rekipedia init [REPO]` | Scaffold `.rekipedia/` with `config.yml` and update `.gitignore` |
122
- | `rekipedia scan [REPO]` | Full analysis — extracts symbols, synthesises wiki pages, exports JSON |
123
- | `rekipedia update [REPO]` | Incremental refresh — re-extracts only changed files, keeps the rest |
124
- | `rekipedia ask [QUESTION]` | Interactive Q&A REPL — streaming answers, Ctrl+C to quit |
125
- | `rekipedia serve [REPO]` | Start a local web UI to browse wiki pages and ask questions |
126
- | `rekipedia embed [REPO]` | Build (or rebuild) the FAISS semantic search index for hybrid RAG Q&A |
127
- | `rekipedia export [REPO]` | Bundle the wiki to a single file (`--format md\|zip\|json`) |
128
- | `rekipedia hook install/uninstall/status` | Manage git post-commit hook for auto wiki rebuild |
129
- | `rekipedia diff [A] [B]` | Compare two graph snapshots (defaults to last two) |
130
- | `rekipedia impact <file>` | Show blast-radius — all affected files, symbols, tests for a changed file |
131
- | `rekipedia search <query>` | Search symbols (`--all-repos` for cross-repo parallel search) |
132
- | `rekipedia export --format graphml\|cypher\|obsidian` | Export graph to GraphML / Neo4j Cypher / Obsidian wikilinks |
133
- | `rekipedia mcp` | Start JSON-RPC 2.0 MCP stdio server (6 tools for AI coding assistants) |
134
- | `rekipedia watch add\|start\|list\|remove` | Watch repos and auto-index on file change |
135
- | `rekipedia refactor [REPO]` | Detect code smells + generate `REFACTOR.md` and `refactor_report.json` (use `--no-llm` for static only) |
136
- | `rekipedia note add\|list\|remove\|edit\|import` | Manage persistent tech lead notes — injected into `reki ask` context automatically |
77
+ ```bash
78
+ # 简洁模式 —— ~150 tokens,仅输出摘要 + 引用
79
+ reki ask "what does Scanner.scan() do?" --brief
80
+
81
+ # 或通过环境变量(便于管道传输)
82
+ REKIPEDIA_BRIEF=1 reki ask "entry point?" | grep 'src/'
83
+ ```
137
84
 
138
85
  ---
139
86
 
140
87
  ## LLM 配置
141
88
 
142
- rekipedia 使用 [litellm](https://github.com/BerriAI/litellm),支持任何提供商:
89
+ rekipedia 使用 [litellm](https://github.com/BerriAI/litellm),支持任意 LLM 提供商:
143
90
 
144
91
  | 提供商 | 示例 |
145
92
  |---|---|
146
- | OpenAI | `OPENAI_API_KEY=sk-... reki scan .` |
147
- | Anthropic Claude | `REKIPEDIA_MODEL=claude-3-5-sonnet-20241022 REKIPEDIA_API_KEY=sk-ant-... reki scan .` |
148
- | Google Gemini | `REKIPEDIA_MODEL=gemini/gemini-2.0-flash REKIPEDIA_API_KEY=AIza... reki scan .` |
149
- | OpenRouter | `REKIPEDIA_MODEL=openrouter/anthropic/claude-3.5-sonnet REKIPEDIA_API_KEY=sk-or-... reki scan .` |
93
+ | OpenAI | `OPENAI_API_KEY=*** reki scan .` |
94
+ | Anthropic Claude | `REKIPEDIA_MODEL=claude-3-5-sonnet-20241022 REKIPEDIA_API_KEY=*** reki scan .` |
95
+ | Google Gemini | `REKIPEDIA_MODEL=gemini/gemini-2.0-flash REKIPEDIA_API_KEY=*** reki scan .` |
96
+ | OpenRouter | `REKIPEDIA_MODEL=openrouter/anthropic/claude-3.5-sonnet REKIPEDIA_API_KEY=*** reki scan .` |
150
97
  | 本地 Ollama(默认) | `REKIPEDIA_MODEL=ollama/llama4 reki scan .` |
151
- | Azure OpenAI | `REKIPEDIA_MODEL=azure/gpt-4o REKIPEDIA_BASE_URL=https://your-resource.openai.azure.com REKIPEDIA_API_KEY=... reki scan .` |
98
+ | Azure OpenAI | `REKIPEDIA_MODEL=azure/gpt-4o REKIPEDIA_BASE_URL=https://your-resource.openai.azure.com REKIPEDIA_API_KEY=*** reki scan .` |
152
99
 
153
- 环境变量:
154
- - `REKIPEDIA_MODEL` — litellm 模型字符串(默认:`ollama/llama4`)
155
- - `REKIPEDIA_API_KEY` — 所选提供商的 API 密钥
156
- - `REKIPEDIA_BASE_URL` — 自定义基础 URL(用于 Azure、Ollama、代理)
157
- - `REKIPEDIA_TIMEOUT` — LLM 调用超时秒数(默认:180)
158
-
159
- 运行 `rekipedia init` 后,编辑 `.rekipedia/config.yml`:
100
+ 执行 `reki init` 后,编辑 `.rekipedia/config.yml`:
160
101
 
161
102
  ```yaml
162
- version: 1
163
- ignore:
164
- - .git
165
- - node_modules
166
- - __pycache__
167
- - .rekipedia
168
- languages:
169
- - python
170
- - typescript
171
103
  llm:
172
- model: ollama/llama4 # any litellm model string
173
- api_key: "" # or set REKIPEDIA_API_KEY env var
174
- base_url: "" # for local / self-hosted endpoints
104
+ model: ollama/llama4
105
+ api_key: ""
106
+ base_url: ""
175
107
  temperature: 0.2
176
108
  ```
177
109
 
178
- ### 支持的提供商(通过 [litellm](https://docs.litellm.ai))
179
-
180
- | Provider | Example model string |
181
- |---|---|
182
- | Ollama (local, free) | `ollama/llama4` |
183
- | OpenAI | `gpt-5.5` |
184
- | Anthropic | `claude-opus-4-6` |
185
- | Google Gemini | `gemini/gemini-3.0-pro` |
186
- | Any OpenAI-compatible | set `base_url` in config |
187
-
188
- ### 运行时覆盖(环境变量)
189
-
190
- ```bash
191
- export REKIPEDIA_MODEL=gpt-5.5
192
- export REKIPEDIA_API_KEY=***
193
- export REKIPEDIA_BASE_URL=https://my-proxy/v1
194
- export REKIPEDIA_SHARD_TOKEN_BUDGET=***
195
- ```
196
-
197
- | Variable | Description |
198
- |---|---|
199
- | `REKIPEDIA_MODEL` | LLM model name to use |
200
- | `REKIPEDIA_API_KEY` | API key for the LLM provider |
201
- | `REKIPEDIA_BASE_URL` | Base URL for OpenAI-compatible endpoints |
202
- | `REKIPEDIA_SHARD_TOKEN_BUDGET` | Max tokens per shard group (default: 40000) |
203
- | `REKIPEDIA_AGENT_ASK` | Set to `1` to enable agentic ReAct ask loop (default: `0` — single-shot) |
204
- | `REKIPEDIA_ASK_MAX_ITER` | Max tool-call iterations for agentic ask (default: `5`) |
205
- | `REKIPEDIA_AGENT_PLANNER` | Set to `1` to enable tool-calling wiki planner (default: `0`) |
110
+ 环境变量:
111
+ - `REKIPEDIA_MODEL` —— litellm 模型字符串(默认:`ollama/llama4`)
112
+ - `REKIPEDIA_API_KEY` —— 所选提供商的 API Key
113
+ - `REKIPEDIA_BASE_URL` —— 自定义 Base URL
114
+ - `REKIPEDIA_TIMEOUT` —— LLM 调用超时时间,单位秒(默认:180)
206
115
 
207
116
  ---
208
117
 
209
- ## 输出
210
-
211
- `rekipedia scan` 将所有内容写入仓库内的 `.rekipedia/` 目录:
118
+ ## 输出目录结构
212
119
 
213
120
  ```
214
121
  .rekipedia/
215
- ├── config.yml # your settings (committed)
216
- ├── store.db # SQLite knowledge store (git-ignored)
217
- ├── scan_meta.json # last scan metadata (model, timestamp, file count)
218
- ├── wiki/ # generated Markdown pages (3–15 pages, dynamically planned)
219
- ├── index.md
220
- │ ├── architecture-overview.md
221
- │ ├── repository-structure.md
222
- │ └── ... (pages vary by repo)
223
- ├── rag/ # RAG index (git-ignored)
224
- │ ├── index.faiss # FAISS flat L2 index
225
- │ └── chunks.json # source code chunks + metadata
226
- ├── diagrams/ # Mermaid diagram files
227
- │ ├── module-graph.md
228
- │ └── class-hierarchy.md
229
- └── exports/ # JSON exports
230
- ├── symbols.json
231
- ├── relationships.json
232
- └── manifest.json # run summary + metadata + page importance scores
233
- ```
234
-
235
- 根据仓库复杂度动态生成 3–15 个 wiki 页面(由 PlannerAgent 驱动)。
236
-
237
- wiki 结构由 `PlannerAgent` 根据仓库实际内容动态设计:
238
-
239
- | Section | Example pages | When generated |
240
- |---|---|---|
241
- | Getting Started | index, installation, quick-start | Always |
242
- | Architecture | architecture-overview, data-flow, repository-structure | ≥3 modules |
243
- | Core Components | One page per major module | ≥2 modules |
244
- | API Reference | cli-reference, python-api, rest-api | CLI/HTTP handlers found |
245
- | Development | testing, contributing, ci-cd | Test files found |
246
- | Ecosystem | integrations, deployment | ≥3 external deps |
247
-
248
- ### 扫描选项
249
-
250
- ```bash
251
- # Use a specific LLM model
252
- rekipedia scan . --model gpt-5.5
253
-
254
- # Skip Docker (run extractors in-process)
255
- rekipedia scan . --no-docker
256
-
257
- # Write output to a custom directory
258
- rekipedia scan . --output-dir /tmp/wiki-output
259
-
260
- # Enable debug logging (litellm, HTTP, full tracebacks)
261
- rekipedia scan . --verbose
262
-
263
- # Auto-embed for RAG after scan
264
- rekipedia scan . --embed-model text-embedding-3-small --embed-provider openai
265
- ```
266
-
267
- ### RAG / 语义搜索
268
-
269
- `rekipedia ask` 使用**混合检索**——wiki 页面 + FAISS 索引的代码块——在完整代码库上下文中回答问题。
270
-
271
- ```bash
272
- # Build or rebuild the FAISS index
273
- rekipedia embed .
274
-
275
- # Custom embedding model + provider
276
- rekipedia embed . --model text-embedding-3-small --provider openai
277
- rekipedia embed . --model nomic-embed-text --provider ollama
278
-
279
- # If your embed provider uses a DIFFERENT API key from your main LLM:
280
- rekipedia embed . --model text-embedding-3-small --provider openai
281
- # set embed_api_key in config.yml, or:
282
- export REKIPEDIA_EMBED_API_KEY=***
283
-
284
- # Or configure everything in .rekipedia/config.yml:
285
- # llm:
286
- # model: ollama/llama4 # main LLM (local)
287
- # embed_model: text-embedding-3-small
288
- # embed_provider: openai
289
- # embed_api_key: sk-xxx # separate key for embed provider
290
- # embed_base_url: "" # optional: custom endpoint
291
-
292
- # Env var overrides (all optional):
293
- export REKIPEDIA_EMBED_MODEL=nomic-embed-text
294
- export REKIPEDIA_EMBED_PROVIDER=ollama
295
- export REKIPEDIA_EMBED_API_KEY=***
296
- export REKIPEDIA_EMBED_BASE_URL=https://my-proxy.example.com/v1
297
- ```
298
-
299
- FAISS 索引保存至 `.rekipedia/rag/index.faiss`,分块后的源代码保存至 `.rekipedia/rag/chunks.json`。
300
-
301
- ### 导出 wiki
302
-
303
- ```bash
304
- # Single combined Markdown file (default)
305
- rekipedia export . --format md --output ./wiki-export.md
306
-
307
- # ZIP archive (one .md per page + manifest.json)
308
- rekipedia export . --format zip --output ./wiki.zip
309
-
310
- # Structured JSON (all pages + metadata)
311
- rekipedia export . --format json --output ./wiki.json
312
- ```
313
-
314
- ### 增量更新
315
-
316
- 首次扫描后,`rekipedia update` 仅重新处理 SHA-256 已发生变化的文件。未变更的符号和关系将从上次运行中延续——wiki 可在数秒内完成刷新。
317
-
318
- ```bash
319
- rekipedia update . # auto-detect changed files
320
- rekipedia update . --no-docker # skip Docker
321
- ```
322
-
323
- 若未找到之前的扫描记录,`update` 会自动回退至全量扫描。
324
-
325
- ### 询问 wiki
326
-
327
- ```bash
328
- # Start interactive Q&A session (streams answers, Ctrl+C to quit)
329
- rekipedia ask
330
- rekipedia ask --repo ./my-project
331
- rekipedia ask --model gpt-4o
332
-
333
- # Single-shot mode (backward compat)
334
- rekipedia ask -q "How does the auth flow work?"
122
+ ├── config.yml
123
+ ├── store.db
124
+ ├── wiki/
125
+ ├── rag/
126
+ ├── diagrams/
127
+ └── exports/
335
128
  ```
336
129
 
337
- 答案**完全**基于您的 wiki 页面和符号索引——LLM 无法虚构扫描知识库中不存在的内容。答案以逐 token 流式方式输出,等待时显示进度指示器。
338
-
339
- 对某个生成页面不满意?请参阅 **[docs/customizing.md](docs/customizing.md)**——您可以固定页面、覆盖提示词、更改写作风格,或添加扫描永不触碰的自定义页面。
340
-
341
- ### 启动 wiki 服务
342
-
343
- ```bash
344
- rekipedia serve . # opens browser at http://127.0.0.1:7070
345
- rekipedia serve . --port 8080 # custom port
346
- rekipedia serve . --no-browser # don't auto-open browser
347
- ```
348
-
349
- - 在深色主题的 Web 界面中浏览生成的 wiki 页面
350
- - 使用相同的有据可查问答功能提问(答案通过 Web 流式返回)
351
- - 问答历史记录存储于 SQLite
352
-
353
130
  ---
354
131
 
355
- ## 前置要求
356
-
357
- - **Python ≥ 3.11**(或使用 `uv`,它自行管理 Python 环境)
358
- - **Docker**——可选;用于隔离提取。若 Docker 不可用,将自动回退至进程内运行模式(`--no-docker` 强制使用进程内模式)
359
-
360
- ---
361
-
362
- ## 与 AI 编程智能体配合使用
363
-
364
- rekipedia 附带一个 **Hermes agent skill**(`rekipedia-agent-skill.md`),可教会 AI 助手(Copilot、Claude Code、Codex)将 rekipedia 作为其代码库智能层:
365
-
366
- 1. 将 `rekipedia-agent-skill.md` 复制到您的 Hermes skills 目录
367
- 2. 任何已加载该 skill 的智能体都将在深入源文件之前自动扫描并查询 rekipedia
368
- 3. 显著降低大型代码库的上下文窗口用量
369
-
370
- ---
371
-
372
- ## 智能体模式
373
-
374
- rekipedia 支持实验性智能体模式,其中 LLM 调用使用工具调用(ReAct)而非单次大上下文输入。
375
-
376
- ### 智能体问答
377
-
378
- 设置 `REKIPEDIA_AGENT_ASK=1` 以启用:
379
-
380
- ```bash
381
- REKIPEDIA_AGENT_ASK=1 reki ask "How does authentication work?"
382
- ```
383
-
384
- LLM 按需发出工具调用以检索信息:
385
- - `search_code(query)` — 对源代码进行语义搜索
386
- - `get_symbol(name)` — 查找符号位置和签名
387
- - `get_page(slug)` — 按需获取 wiki 页面
388
- - `get_relationships(target)` — 获取符号/文件的依赖关系图
389
- - `finish(answer)` — 提供最终答案
390
-
391
- 最大迭代次数可通过 `REKIPEDIA_ASK_MAX_ITER` 配置(默认值:5)。
392
-
393
- ### 智能体规划器
132
+ ## Python API
394
133
 
395
- 设置 `REKIPEDIA_AGENT_PLANNER=1` 以启用工具调用式 wiki 结构规划:
134
+ ```python
135
+ import rekipedia
396
136
 
397
- ```bash
398
- REKIPEDIA_AGENT_PLANNER=1 reki scan .
137
+ result = rekipedia.scan("/path/to/repo")
138
+ answer = rekipedia.ask("/path/to/repo", "How does the auth flow work?")
139
+ print(answer.text)
140
+ for c in answer.citations:
141
+ print(f" {c.file}:{c.line}")
399
142
  ```
400
143
 
401
- 规划器通过工具调用逐步构建 wiki 结构,而非生成单个大型 JSON 响应。
144
+ ---
402
145
 
403
146
  ## 开发
404
147
 
405
148
  ```bash
406
- # Install all deps
407
149
  make dev
408
-
409
- # Run tests
410
150
  make test
411
-
412
- # Lint
413
151
  make lint
414
-
415
- # Build wheel + npm tarball
416
152
  make build
417
153
  ```
418
154
 
419
- ### 发布
420
-
421
- ```bash
422
- PYPI_TOKEN=*** NPM_TOKEN=*** make release
423
-
424
- # Full release: build + tag + push + PyPI + npm
425
- make release-all PYPI_TOKEN=*** NPM_TOKEN=***
426
- # With version bump
427
- make release-all PYPI_TOKEN=*** NPM_TOKEN=*** VERSION=0.5.0
428
- ```
429
-
430
155
  ---
431
156
 
432
157
  ## 许可证
433
158
 
434
- 专有且保密——版权所有 © 2026 Eddie Chan。保留所有权利。
435
-
436
- 未经授权,严禁复制、分发或修改本软件。
437
- 详情请参阅 [LICENSE](LICENSE)。
159
+ MIT 许可证 — Copyright © 2026 Eddie Chan
package/README.zh-TW.md CHANGED
@@ -2,436 +2,158 @@
2
2
 
3
3
  **[English](README.md) | [繁體中文](README.zh-TW.md) | [简体中文](README.zh-CN.md)**
4
4
 
5
- > 您的 AI 技術領導——隨時待命,永遠最新。
6
-
7
- rekipedia 能掃描任何程式碼庫,將其轉化為可攜式的 SQLite 知識庫,並為團隊中每位開發者提供一位由 LLM 驅動的技術領導,讓他們隨時提問:_「驗證流程是如何運作的?」、「新增 API 端點最快的方法是什麼?」、「上週付款服務是什麼出了問題?」_
8
-
9
- 不會產生幻覺,不靠猜測——每個答案都紮根於您實際的程式碼庫。
10
-
11
- ### 主要功能
12
- - **關係可信度評分**:每個提取的關係都標記為 EXTRACTED/INFERRED/AMBIGUOUS,並附有可信度分數
13
- - **設計原理提取**:`# NOTE:`、`# HACK:`、`# WHY:` 注釋會被提取為知識節點
14
- - **核心節點(God nodes)**:連結度最高的符號會顯示於 index.md 並在圖表介面中高亮標示
15
- - **互動式依賴關係圖**:`rekipedia serve` 現在包含一個使用 D3.js 力導向視覺化的 `/graph` 路由
16
- - **Git hooks**:`rekipedia hook install` 會在每次提交時觸發自動重建
17
- - **代理式 wiki 協作**:`PlannerAgent` 根據您的程式碼庫動態設計 wiki 結構
18
- - **頁面重要性評分**:規劃器為每個頁面分配重要性分數(0–100);導航側邊欄依優先級排序
19
- - **DeepWiki 式章節**:頁面分組至邏輯章節(`getting-started`、`architecture`、`core-components` 等)
20
- - **Wiki 側邊欄分類**:`reki serve` 側邊欄依 `section` 欄位將頁面分組,並支援可折疊標頭
21
- - **即時搜尋**:在側邊欄搜尋框中輸入,即可立即按標題或分類篩選 wiki 頁面
22
- - **重構分析**:`reki refactor` 偵測程式碼異味(神類、循環依賴、死碼、高耦合),並提供 LLM 增強的建議——輸出 `REFACTOR.md` + `refactor_report.json`
23
- - **上下文切片**:每個頁面只接收其所需的資料(相較固定佈局方式減少約 40–60% 的 token 用量)
24
- - **混合式 RAG 問答**:FAISS 索引的程式碼片段 + wiki 頁面,讓 LLM 在回答問題時擁有完整的程式碼庫上下文
25
- - **嵌入提供者選擇**:`--embed-provider openai|ollama|azure|...`——支援任何 litellm 相容的嵌入模型
26
- - **Wiki 匯出**:打包為單一 Markdown 檔案、ZIP 壓縮包或結構化 JSON(`rekipedia export`)
27
- - **增量更新**:初次掃描後僅重新處理已變更的檔案
28
- - **有依據的問答**:答案引用真實的檔案路徑和行號——不產生幻覺
29
- - **程式碼庫樹狀索引**——每次掃描都會在 SQLite 中建立階層式目錄/檔案樹,支援結構化導航與未來基於推理的檢索。
5
+ > 你的 AI 技術主管 — 隨時待命,永遠保持最新。
30
6
 
31
- ## 快速開始
7
+ rekipedia 可以將任何程式碼庫 scan 成可攜式的 SQLite 知識庫,讓每位開發者都擁有一位由 LLM 驅動的技術主管,可以隨時提問。
32
8
 
33
- ### 透過 npm / npx(無需安裝)
9
+ 零幻覺 每個回答都以你實際的程式碼庫為依據。
34
10
 
35
- ```bash
36
- npx rekipedia init .
37
- npx rekipedia scan .
38
- ```
11
+ ---
39
12
 
40
- ### 透過 uv / uvx(無需安裝)
13
+ ## 快速開始
41
14
 
42
15
  ```bash
43
- uvx rekipedia init .
44
- uvx rekipedia scan .
16
+ # 無需安裝
17
+ npx rekipedia init . && npx rekipedia scan .
18
+ # 或
19
+ uvx rekipedia init . && uvx rekipedia scan .
45
20
  ```
46
21
 
47
- ### 永久安裝
48
-
49
22
  ```bash
50
- # Core (scan + serve + ask)
51
- pip install rekipedia
52
- # or
53
- uv tool install rekipedia
54
-
55
- # With RAG support (semantic embed + search — needs faiss-cpu + numpy ~100MB)
56
- pip install "rekipedia[rag]"
57
-
58
- # Homebrew (Go single binary — no Python needed)
59
- brew tap unrealandychan/tap
60
- brew install rekipedia
23
+ # 永久安裝
24
+ pip install rekipedia # core
25
+ pip install "rekipedia[rag]" # + semantic search (FAISS)
61
26
  ```
62
27
 
63
28
  ---
64
29
 
65
- ## 快速開始——無需 API 金鑰
30
+ ## 快速開始 — 無需 API 金鑰
66
31
 
67
- 無需任何 LLM API 金鑰即可執行完整靜態分析:
32
+ 不需要任何 LLM API 金鑰,即可執行完整的靜態分析:
68
33
 
69
34
  ```bash
70
35
  pip install rekipedia
71
- reki scan . --no-llm # ~5-10 秒,零 API 呼叫
72
- reki onboard . # 架構總覽
73
- reki tour . # 依賴深度導覽
74
- reki domain . # 業務領域層次圖
75
- reki diff . # 變更影響分析
76
- reki export . --format md # 匯出完整 wiki Markdown
36
+ reki scan . --no-llm # ~5-10s, zero API calls
37
+ reki onboard . # architecture overview
38
+ reki tour . # guided walkthrough by dependency depth
39
+ reki domain . # business domain layer map
40
+ reki diff . # impact analysis on changed files
41
+ reki export . --format md # export full wiki to markdown
77
42
  ```
78
43
 
79
- > **注意:** `reki ask`(AI 問答)需要 LLM API 金鑰。請參閱下方 [LLM 設定](#llm-設定)。
44
+ > **注意:** `reki ask`(AI 問答)需要 LLM API 金鑰。請參閱下方的 [LLM 設定](#llm-設定)。
80
45
 
81
46
  ---
82
47
 
83
- ## Python API
84
-
85
- 在 Jupyter 筆記本、CI 流水線或任何 Python 應用程式中以程式化方式使用 rekipedia:
48
+ ## 核心指令
86
49
 
87
- ```python
88
- import rekipedia
89
-
90
- # Scan a local repo
91
- result = rekipedia.scan("/path/to/repo")
92
- print(result.page_count) # number of wiki pages generated
93
- print(result.symbol_count) # number of code symbols extracted
94
- print(result.token_count) # estimated token count of the wiki
95
-
96
- # Ask a question — grounded answer with file:line citations
97
- answer = rekipedia.ask("/path/to/repo", "How does the auth flow work?")
98
- print(answer.text)
99
- for citation in answer.citations:
100
- print(f" {citation.file}:{citation.line}")
101
-
102
- # Async variants (Jupyter-friendly)
103
- result = await rekipedia.scan_async("/path/to/repo")
104
- answer = await rekipedia.ask_async("/path/to/repo", "What is the entry point?")
105
- ```
106
-
107
- **回傳型別:**
108
-
109
- | Type | Key fields |
50
+ | 指令 | 功能說明 |
110
51
  |---|---|
111
- | `ScanResult` | `page_count`, `symbol_count`, `token_count`, `wiki_pages`, `db_path`, `wiki_dir` |
112
- | `AskResult` | `text`, `citations: list[Citation]`, `model_used` |
113
- | `Citation` | `file`, `line`, `snippet` |
52
+ | `reki init .` | 建立初始設定檔 |
53
+ | `reki scan .` | 完整分析 wiki + 知識庫 |
54
+ | `reki update .` | 增量更新(僅處理變更的檔案) |
55
+ | `reki update . --impact-only` | 影響感知模式 — 僅重新產生受影響模組的 wiki 頁面 |
56
+ | `reki serve .` | 本地端 Web UI — 瀏覽、搜尋、詢問 AI |
57
+ | `reki ask` | 互動式問答 REPL(串流輸出) |
58
+ | `reki embed .` | 建立 FAISS 語意索引以支援 hybrid RAG |
59
+ | `reki export .` | 打包 wiki → `--format md|zip|json|html` |
60
+ | `reki diff` | 未提交變更的影響分析 |
61
+ | `reki domain .` | 將程式碼庫對應至業務層(API/Service/Data/UI) |
62
+ | `reki tour .` | 依相依深度的引導式學習流程 |
63
+ | `reki onboard .` | 給新開發者的靜態引導指南 |
64
+ | `reki review` | 以 wiki 為基礎的 LLM PR 審查 |
65
+ | `reki refactor .` | 偵測程式碼壞味道 → `REFACTOR.md` |
66
+ | `reki refactor . --dry-run` | 預覽重構建議,不實際寫入檔案 |
67
+ | `reki refactor . --apply` | 自動套用安全修正(死碼標記、拆分建議) |
68
+ | `reki refactor . --apply --dry-run` | 預覽 `--apply` 將會執行的內容 |
69
+ | `reki watch .` | 檔案變更時自動建立索引(OS watcher) |
70
+ | `reki hook install` | Git post-commit 自動重建 |
71
+ | `reki mcp` | 供 AI 程式碼助理使用的 MCP stdio 伺服器 |
114
72
 
115
73
  ---
116
74
 
117
- ## 指令
75
+ ### `reki ask` — 簡潔模式
118
76
 
119
- | Command | Description |
120
- |---|---|
121
- | `rekipedia init [REPO]` | Scaffold `.rekipedia/` with `config.yml` and update `.gitignore` |
122
- | `rekipedia scan [REPO]` | Full analysis — extracts symbols, synthesises wiki pages, exports JSON |
123
- | `rekipedia update [REPO]` | Incremental refresh — re-extracts only changed files, keeps the rest |
124
- | `rekipedia ask [QUESTION]` | Interactive Q&A REPL — streaming answers, Ctrl+C to quit |
125
- | `rekipedia serve [REPO]` | Start a local web UI to browse wiki pages and ask questions |
126
- | `rekipedia embed [REPO]` | Build (or rebuild) the FAISS semantic search index for hybrid RAG Q&A |
127
- | `rekipedia export [REPO]` | Bundle the wiki to a single file (`--format md\|zip\|json`) |
128
- | `rekipedia hook install/uninstall/status` | Manage git post-commit hook for auto wiki rebuild |
129
- | `rekipedia diff [A] [B]` | Compare two graph snapshots (defaults to last two) |
130
- | `rekipedia impact <file>` | Show blast-radius — all affected files, symbols, tests for a changed file |
131
- | `rekipedia search <query>` | Search symbols (`--all-repos` for cross-repo parallel search) |
132
- | `rekipedia export --format graphml\|cypher\|obsidian` | Export graph to GraphML / Neo4j Cypher / Obsidian wikilinks |
133
- | `rekipedia mcp` | Start JSON-RPC 2.0 MCP stdio server (6 tools for AI coding assistants) |
134
- | `rekipedia watch add\|start\|list\|remove` | Watch repos and auto-index on file change |
135
- | `rekipedia refactor [REPO]` | Detect code smells + generate `REFACTOR.md` and `refactor_report.json` (use `--no-llm` for static only) |
136
- | `rekipedia note add\|list\|remove\|edit\|import` | Manage persistent tech lead notes — injected into `reki ask` context automatically |
77
+ ```bash
78
+ # Brief mode — ~150 tokens, summary + citations only
79
+ reki ask "what does Scanner.scan() do?" --brief
80
+
81
+ # Or via env var (useful for piping)
82
+ REKIPEDIA_BRIEF=1 reki ask "entry point?" | grep 'src/'
83
+ ```
137
84
 
138
85
  ---
139
86
 
140
87
  ## LLM 設定
141
88
 
142
- rekipedia 使用 [litellm](https://github.com/BerriAI/litellm),支援任何提供者:
89
+ rekipedia 使用 [litellm](https://github.com/BerriAI/litellm),支援任何供應商:
143
90
 
144
- | 提供者 | 範例 |
91
+ | 供應商 | 範例 |
145
92
  |---|---|
146
- | OpenAI | `OPENAI_API_KEY=sk-... reki scan .` |
147
- | Anthropic Claude | `REKIPEDIA_MODEL=claude-3-5-sonnet-20241022 REKIPEDIA_API_KEY=sk-ant-... reki scan .` |
148
- | Google Gemini | `REKIPEDIA_MODEL=gemini/gemini-2.0-flash REKIPEDIA_API_KEY=AIza... reki scan .` |
149
- | OpenRouter | `REKIPEDIA_MODEL=openrouter/anthropic/claude-3.5-sonnet REKIPEDIA_API_KEY=sk-or-... reki scan .` |
93
+ | OpenAI | `OPENAI_API_KEY=*** reki scan .` |
94
+ | Anthropic Claude | `REKIPEDIA_MODEL=claude-3-5-sonnet-20241022 REKIPEDIA_API_KEY=*** reki scan .` |
95
+ | Google Gemini | `REKIPEDIA_MODEL=gemini/gemini-2.0-flash REKIPEDIA_API_KEY=*** reki scan .` |
96
+ | OpenRouter | `REKIPEDIA_MODEL=openrouter/anthropic/claude-3.5-sonnet REKIPEDIA_API_KEY=*** reki scan .` |
150
97
  | 本地 Ollama(預設) | `REKIPEDIA_MODEL=ollama/llama4 reki scan .` |
151
- | Azure OpenAI | `REKIPEDIA_MODEL=azure/gpt-4o REKIPEDIA_BASE_URL=https://your-resource.openai.azure.com REKIPEDIA_API_KEY=... reki scan .` |
152
-
153
- 環境變數:
154
- - `REKIPEDIA_MODEL` — litellm 模型字串(預設:`ollama/llama4`)
155
- - `REKIPEDIA_API_KEY` — 所選提供者的 API 金鑰
156
- - `REKIPEDIA_BASE_URL` — 自訂基礎 URL(用於 Azure、Ollama、代理)
157
- - `REKIPEDIA_TIMEOUT` — LLM 呼叫逾時秒數(預設:180)
98
+ | Azure OpenAI | `REKIPEDIA_MODEL=azure/gpt-4o REKIPEDIA_BASE_URL=https://your-resource.openai.azure.com REKIPEDIA_API_KEY=*** reki scan .` |
158
99
 
159
- 執行 `rekipedia init` 後,編輯 `.rekipedia/config.yml`:
100
+ 執行 `reki init` 後,編輯 `.rekipedia/config.yml`:
160
101
 
161
102
  ```yaml
162
- version: 1
163
- ignore:
164
- - .git
165
- - node_modules
166
- - __pycache__
167
- - .rekipedia
168
- languages:
169
- - python
170
- - typescript
171
103
  llm:
172
- model: ollama/llama4 # any litellm model string
173
- api_key: "" # or set REKIPEDIA_API_KEY env var
174
- base_url: "" # for local / self-hosted endpoints
104
+ model: ollama/llama4
105
+ api_key: ""
106
+ base_url: ""
175
107
  temperature: 0.2
176
108
  ```
177
109
 
178
- ### 支援的提供者(透過 [litellm](https://docs.litellm.ai))
179
-
180
- | Provider | Example model string |
181
- |---|---|
182
- | Ollama (local, free) | `ollama/llama4` |
183
- | OpenAI | `gpt-5.5` |
184
- | Anthropic | `claude-opus-4-6` |
185
- | Google Gemini | `gemini/gemini-3.0-pro` |
186
- | Any OpenAI-compatible | set `base_url` in config |
187
-
188
- ### 執行時覆寫(環境變數)
189
-
190
- ```bash
191
- export REKIPEDIA_MODEL=gpt-5.5
192
- export REKIPEDIA_API_KEY=***
193
- export REKIPEDIA_BASE_URL=https://my-proxy/v1
194
- export REKIPEDIA_SHARD_TOKEN_BUDGET=***
195
- ```
196
-
197
- | Variable | Description |
198
- |---|---|
199
- | `REKIPEDIA_MODEL` | LLM model name to use |
200
- | `REKIPEDIA_API_KEY` | API key for the LLM provider |
201
- | `REKIPEDIA_BASE_URL` | Base URL for OpenAI-compatible endpoints |
202
- | `REKIPEDIA_SHARD_TOKEN_BUDGET` | Max tokens per shard group (default: 40000) |
203
- | `REKIPEDIA_AGENT_ASK` | Set to `1` to enable agentic ReAct ask loop (default: `0` — single-shot) |
204
- | `REKIPEDIA_ASK_MAX_ITER` | Max tool-call iterations for agentic ask (default: `5`) |
205
- | `REKIPEDIA_AGENT_PLANNER` | Set to `1` to enable tool-calling wiki planner (default: `0`) |
110
+ 環境變數:
111
+ - `REKIPEDIA_MODEL` — litellm model string(預設:`ollama/llama4`)
112
+ - `REKIPEDIA_API_KEY` 所選供應商的 API 金鑰
113
+ - `REKIPEDIA_BASE_URL` — 自訂 base URL
114
+ - `REKIPEDIA_TIMEOUT` LLM 呼叫逾時秒數(預設:180)
206
115
 
207
116
  ---
208
117
 
209
- ## 輸出
210
-
211
- `rekipedia scan` 會將所有內容寫入您程式碼庫內的 `.rekipedia/`:
118
+ ## 輸出結構
212
119
 
213
120
  ```
214
121
  .rekipedia/
215
- ├── config.yml # your settings (committed)
216
- ├── store.db # SQLite knowledge store (git-ignored)
217
- ├── scan_meta.json # last scan metadata (model, timestamp, file count)
218
- ├── wiki/ # generated Markdown pages (3–15 pages, dynamically planned)
219
- ├── index.md
220
- │ ├── architecture-overview.md
221
- │ ├── repository-structure.md
222
- │ └── ... (pages vary by repo)
223
- ├── rag/ # RAG index (git-ignored)
224
- │ ├── index.faiss # FAISS flat L2 index
225
- │ └── chunks.json # source code chunks + metadata
226
- ├── diagrams/ # Mermaid diagram files
227
- │ ├── module-graph.md
228
- │ └── class-hierarchy.md
229
- └── exports/ # JSON exports
230
- ├── symbols.json
231
- ├── relationships.json
232
- └── manifest.json # run summary + metadata + page importance scores
233
- ```
234
-
235
- 根據程式碼庫複雜度動態生成 3–15 個 wiki 頁面(由 PlannerAgent 驅動)。
236
-
237
- Wiki 結構由 `PlannerAgent` 根據您程式碼庫的實際內容動態設計:
238
-
239
- | Section | Example pages | When generated |
240
- |---|---|---|
241
- | Getting Started | index, installation, quick-start | Always |
242
- | Architecture | architecture-overview, data-flow, repository-structure | ≥3 modules |
243
- | Core Components | One page per major module | ≥2 modules |
244
- | API Reference | cli-reference, python-api, rest-api | CLI/HTTP handlers found |
245
- | Development | testing, contributing, ci-cd | Test files found |
246
- | Ecosystem | integrations, deployment | ≥3 external deps |
247
-
248
- ### 掃描選項
249
-
250
- ```bash
251
- # Use a specific LLM model
252
- rekipedia scan . --model gpt-5.5
253
-
254
- # Skip Docker (run extractors in-process)
255
- rekipedia scan . --no-docker
256
-
257
- # Write output to a custom directory
258
- rekipedia scan . --output-dir /tmp/wiki-output
259
-
260
- # Enable debug logging (litellm, HTTP, full tracebacks)
261
- rekipedia scan . --verbose
262
-
263
- # Auto-embed for RAG after scan
264
- rekipedia scan . --embed-model text-embedding-3-small --embed-provider openai
265
- ```
266
-
267
- ### RAG / 語義搜尋
268
-
269
- `rekipedia ask` 使用**混合式檢索**——wiki 頁面 + FAISS 索引的程式碼片段——以完整的程式碼庫上下文回答問題。
270
-
271
- ```bash
272
- # Build or rebuild the FAISS index
273
- rekipedia embed .
274
-
275
- # Custom embedding model + provider
276
- rekipedia embed . --model text-embedding-3-small --provider openai
277
- rekipedia embed . --model nomic-embed-text --provider ollama
278
-
279
- # If your embed provider uses a DIFFERENT API key from your main LLM:
280
- rekipedia embed . --model text-embedding-3-small --provider openai
281
- # set embed_api_key in config.yml, or:
282
- export REKIPEDIA_EMBED_API_KEY=***
283
-
284
- # Or configure everything in .rekipedia/config.yml:
285
- # llm:
286
- # model: ollama/llama4 # main LLM (local)
287
- # embed_model: text-embedding-3-small
288
- # embed_provider: openai
289
- # embed_api_key: sk-xxx # separate key for embed provider
290
- # embed_base_url: "" # optional: custom endpoint
291
-
292
- # Env var overrides (all optional):
293
- export REKIPEDIA_EMBED_MODEL=nomic-embed-text
294
- export REKIPEDIA_EMBED_PROVIDER=ollama
295
- export REKIPEDIA_EMBED_API_KEY=***
296
- export REKIPEDIA_EMBED_BASE_URL=https://my-proxy.example.com/v1
297
- ```
298
-
299
- FAISS 索引儲存於 `.rekipedia/rag/index.faiss`,分塊的原始碼儲存於 `.rekipedia/rag/chunks.json`。
300
-
301
- ### 匯出 wiki
302
-
303
- ```bash
304
- # Single combined Markdown file (default)
305
- rekipedia export . --format md --output ./wiki-export.md
306
-
307
- # ZIP archive (one .md per page + manifest.json)
308
- rekipedia export . --format zip --output ./wiki.zip
309
-
310
- # Structured JSON (all pages + metadata)
311
- rekipedia export . --format json --output ./wiki.json
122
+ ├── config.yml
123
+ ├── store.db
124
+ ├── wiki/
125
+ ├── rag/
126
+ ├── diagrams/
127
+ └── exports/
312
128
  ```
313
129
 
314
- ### 增量更新
315
-
316
- 初次掃描後,`rekipedia update` 只會重新處理 SHA-256 已變更的檔案。未變更的符號和關係會從上次執行中延續——wiki 可在幾秒內完成更新。
317
-
318
- ```bash
319
- rekipedia update . # auto-detect changed files
320
- rekipedia update . --no-docker # skip Docker
321
- ```
322
-
323
- 若找不到先前的掃描記錄,`update` 會自動回退至完整掃描。
324
-
325
- ### 向 wiki 提問
326
-
327
- ```bash
328
- # Start interactive Q&A session (streams answers, Ctrl+C to quit)
329
- rekipedia ask
330
- rekipedia ask --repo ./my-project
331
- rekipedia ask --model gpt-4o
332
-
333
- # Single-shot mode (backward compat)
334
- rekipedia ask -q "How does the auth flow work?"
335
- ```
336
-
337
- 答案**完全**以您的 wiki 頁面和符號索引為依據——LLM 無法捏造不存在於已掃描知識庫中的細節。答案以逐 token 串流方式輸出,等待時會顯示進度指示器。
338
-
339
- 對某個生成頁面不滿意?請參閱 **[docs/customizing.md](docs/customizing.md)**——您可以釘選頁面、覆寫提示詞、更改寫作風格,或新增掃描時永遠不會觸及的自訂頁面。
340
-
341
- ### 啟動 wiki 伺服器
342
-
343
- ```bash
344
- rekipedia serve . # opens browser at http://127.0.0.1:7070
345
- rekipedia serve . --port 8080 # custom port
346
- rekipedia serve . --no-browser # don't auto-open browser
347
- ```
348
-
349
- - 在深色主題的網頁介面中瀏覽生成的 wiki 頁面
350
- - 使用相同的有依據問答功能提問(答案透過網頁串流)
351
- - 問答歷史記錄儲存於 SQLite
352
-
353
- ---
354
-
355
- ## 環境需求
356
-
357
- - **Python ≥ 3.11**(或使用 `uv`,它自行管理 Python 版本)
358
- - **Docker**——可選;用於隔離式提取。若 Docker 不可用,會自動回退至行程內執行模式(`--no-docker` 強制使用行程內模式)
359
-
360
- ---
361
-
362
- ## 搭配 AI 程式碼代理使用 rekipedia
363
-
364
- rekipedia 附帶一個 **Hermes agent skill**(`rekipedia-agent-skill.md`),可教導 AI 助理(Copilot、Claude Code、Codex)將 rekipedia 作為其程式碼庫智慧層:
365
-
366
- 1. 將 `rekipedia-agent-skill.md` 複製到您的 Hermes skills 目錄
367
- 2. 任何已載入該技能的代理,都會在深入原始碼檔案前自動掃描並查詢 rekipedia
368
- 3. 大幅減少大型程式碼庫的上下文視窗用量
369
-
370
130
  ---
371
131
 
372
- ## 代理模式
373
-
374
- rekipedia 支援實驗性的代理模式,其中 LLM 呼叫使用工具調用(ReAct)而非單次大型上下文傾倒。
375
-
376
- ### 代理式提問
377
-
378
- 設定 `REKIPEDIA_AGENT_ASK=1` 以啟用:
379
-
380
- ```bash
381
- REKIPEDIA_AGENT_ASK=1 reki ask "How does authentication work?"
382
- ```
383
-
384
- LLM 會發出工具調用以按需取得資訊:
385
- - `search_code(query)` — 對原始碼進行語義搜尋
386
- - `get_symbol(name)` — 查詢符號的位置和簽名
387
- - `get_page(slug)` — 按需取得 wiki 頁面
388
- - `get_relationships(target)` — 取得符號/檔案的依賴關係圖
389
- - `finish(answer)` — 提供最終答案
390
-
391
- 最大迭代次數可透過 `REKIPEDIA_ASK_MAX_ITER` 設定(預設值:5)。
392
-
393
- ### 代理式規劃器
132
+ ## Python API
394
133
 
395
- 設定 `REKIPEDIA_AGENT_PLANNER=1` 以啟用工具調用式 wiki 結構規劃:
134
+ ```python
135
+ import rekipedia
396
136
 
397
- ```bash
398
- REKIPEDIA_AGENT_PLANNER=1 reki scan .
137
+ result = rekipedia.scan("/path/to/repo")
138
+ answer = rekipedia.ask("/path/to/repo", "How does the auth flow work?")
139
+ print(answer.text)
140
+ for c in answer.citations:
141
+ print(f" {c.file}:{c.line}")
399
142
  ```
400
143
 
401
- 規劃器使用工具調用增量建構 wiki 結構,而非生成單一大型 JSON 回應。
144
+ ---
402
145
 
403
146
  ## 開發
404
147
 
405
148
  ```bash
406
- # Install all deps
407
149
  make dev
408
-
409
- # Run tests
410
150
  make test
411
-
412
- # Lint
413
151
  make lint
414
-
415
- # Build wheel + npm tarball
416
152
  make build
417
153
  ```
418
154
 
419
- ### 發佈
420
-
421
- ```bash
422
- PYPI_TOKEN=*** NPM_TOKEN=*** make release
423
-
424
- # Full release: build + tag + push + PyPI + npm
425
- make release-all PYPI_TOKEN=*** NPM_TOKEN=***
426
- # With version bump
427
- make release-all PYPI_TOKEN=*** NPM_TOKEN=*** VERSION=0.5.0
428
- ```
429
-
430
155
  ---
431
156
 
432
157
  ## 授權條款
433
158
 
434
- 專有且機密——版權所有 © 2026 Eddie Chan。保留所有權利。
435
-
436
- 嚴禁未經授權複製、散布或修改本軟體。
437
- 詳情請參閱 [LICENSE](LICENSE)。
159
+ MIT License — Copyright © 2026 Eddie Chan
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rekipedia",
3
- "version": "0.17.24",
3
+ "version": "0.17.27",
4
4
  "description": "Agentic repo-to-wiki: scan any repository into a portable SQLite knowledge store with wiki pages, diagrams, and grounded Q&A.",
5
5
  "bin": {
6
6
  "rekipedia": "./bin/rekipedia.js"