repowise-dev/repowise
GitHub: repowise-dev/repowise
为 AI 编码助手赋予代码库深层理解的智能分析工具,通过图谱、Git 挖掘、自动文档和架构决策四层智能,让 Agent 能回答「为什么」而不仅是「是什么」。
Stars: 77 | Forks: 24

**面向 AI 辅助工程团队的代码库智能分析工具。** 四层智能。八个 MCP 工具。只需一次 `pip install`。 [](https://pypi.org/project/repowise/) [](https://www.gnu.org/licenses/agpl-3.0) [](https://pypi.org/project/repowise/) [](https://modelcontextprotocol.io) [](https://github.com/repowise-dev/repowise) [**在线演示 →**](https://repowise.dev/examples) · [**面向团队的托管版**](https://repowise.dev) · [**文档**](https://repowise-dev.github.io) · [**Discord**](https://discord.gg/repowise)
| 视图 | 显示内容 |
|---|---|
| **Chat** | 用自然语言询问关于你代码库的任何问题 |
| **Docs** | 带有语法高亮和 Mermaid 图的 AI 生成 wiki |
| **Graph** | 交互式依赖图——可处理 2,000+ 个节点 |
| **Search** | 全文和语义搜索,带有全局命令面板 (Ctrl+K) |
| **Symbols** | 每个函数、类和方法的可搜索索引 |
| **Coverage** | 每个文件的文档新鲜度,支持一键重新生成 |
| **Ownership** | 贡献者归属和巴士因子风险 |
| **Hotspots** | 按排名排序的高变动文件及提交历史 |
| **Dead Code** | 带有置信度分数和批量操作的废弃代码 |
| **Decisions** | 带有过期监控的架构决策 |
## 自动生成的 CLAUDE.md
在每次 `repowise init` 和 `repowise update` 之后,repowise 都会根据实际的代码库智能重新生成你的 `CLAUDE.md`——而不是使用模板。无需 LLM 调用。5 秒内完成。
```
repowise generate-claude-md
```
生成的部分包括:架构摘要、模块图、热点警告、所有权图、隐藏耦合对、活跃的架构决策和废弃代码候选项。顶部的用户自有部分永远不会被触碰。
```
## 架构
Monorepo with 4 packages. Entry points: api/server.ts, cli/index.ts.
## 热点 — 谨慎处理
- payments/processor.ts — 47 commits/month, high complexity, primary owner: @sarah
- shared/events/EventBus.ts — 23 dependents, co-changes with all service listeners
## 活跃的架构决策
- JWT over sessions (auth/service.ts) — stateless required for k8s horizontal scaling
- CircuitBreaker on all external calls — after payment provider outages in Q3 2024
## 隐式耦合(无 import 链接,但同步变化)
- auth.ts ↔ middleware/session.ts — co-changed 31 times in last 500 commits
```
## Git 智能
repowise 会挖掘你最近的 500 次提交(可配置),以生成任何静态分析都无法发现的信号。
**热点** —— 变动率和复杂度均位列前 25% 的文件。这是 bug 的藏身之处。在仪表盘、CLAUDE.md 中会被标记,并在 Claude Code 接触它们之前通过 `get_risk()` 显示出来。
**所有权** —— 将 `git blame` 聚合为每位工程师的所有权百分比。知道该联系谁。知道哪里存在知识孤岛。
**共变对** —— 在同一个提交中一起更改但没有导入链接的文件。AST 解析无法检测到的隐藏耦合。`get_context()` 会在显示直接依赖项的同时显示共变伙伴。
**巴士因子** —— 超过 80% 由单个工程师拥有的文件。显示在所有权视图中。在 CLAUDE.md 中作为知识风险显示。
**重要提交** —— 每个文件最近 10 条有意义的提交信息(已过滤:无合并、无依赖项版本更新、无 lint)包含在生成提示中。LLM 会解释代码*为什么*以这种方式构建。
## 废弃代码检测
纯粹的图遍历和 SQL。无需 LLM 调用。无论仓库大小,均可在 10 秒内完成。
```
repowise dead-code
23 findings · 4 safe to delete
✓ utils/legacy_parser.ts file 1.00 safe to delete
✓ auth/session.ts file 0.92 safe to delete
✓ helpers/formatDate export 0.71 safe to delete
✓ types/OldUser export 0.68 safe to delete
✗ analytics/v1/tracker.ts file 0.41 recent activity — review first
```
设计上趋于保守。`safe_to_delete` 要求置信度 ≥ 0.70,并排除了动态加载的模式(`*Plugin`、`*Handler`、`*Adapter`、`*Middleware`)。repowise 只负责列出候选项。由工程师决定是否删除。
## 架构决策
```
repowise decision add # guided interactive capture (~90 seconds)
repowise decision confirm # review auto-proposed decisions from git history
repowise decision health # stale, conflicting, ungoverned hotspots
```
```
repowise decision health
2 stale decisions
→ "JWT over sessions" — auth/service.ts rewritten 3 months ago, decision may be outdated
→ "EventBus in-process only" — 8 of 14 governed files changed since recorded
1 conflict
→ payments/: two decisions with overlapping scope and contradictory rationale
1 ungoverned hotspot
→ payments/processor.ts — 47 commits/month, no architectural decisions recorded
```
决策被链接到图节点,随着代码的演进跟踪其是否过期,并在 Claude Code 涉及受管辖文件时通过 `get_why()` 显示出来。
当资深工程师离开时,“原因”通常也会随之被带走。而决策智能将其保留在了代码库中。
## 对比分析
| | repowise | Google Code Wiki | DeepWiki | Swimm | CodeScene |
|---|---|---|---|---|---|
| 可自托管,开源 | ✅ AGPL-3.0 | ❌ 仅限云端 | ❌ 仅限云端 | ❌ 仅限企业版 | ✅ Docker |
| 自动生成文档 | ✅ | ✅ Gemini | ✅ | ✅ PR2Doc | ❌ |
| 私有仓库 — 无需上云 | ✅ | ❌ 开发中 | ❌ 仅限 OSS forks | ✅ 企业版 | ✅ |
| 废弃代码检测 | ✅ | ❌ | ❌ | ❌ | ❌ |
| Git 智能(热点、所有权、共变) | ✅ | ❌ | ❌ | ❌ | ✅ |
| 巴士因子分析 | ✅ | ❌ | ❌ | ❌ | ✅ |
| 架构决策记录 | ✅ | ❌ | ❌ | ❌ | ❌ |
| 面向 AI Agent 的 MCP Server | ✅ 8 个工具 | ❌ | ✅ 3 个工具 | ✅ | ✅ |
| 自动生成的 CLAUDE.md | ✅ | ❌ | ❌ | ❌ | ❌ |
| 文档新鲜度评分 | ✅ | ❌ | ❌ | ⚠️ 仅限过期检测 | ❌ |
| 提交时增量更新 | ✅ <30s | ✅ | ❌ | ✅ | ✅ |
| 本地仪表盘 / 前端 | ✅ | ❌ | ❌ | ❌ 仅限 IDE | ✅ |
| 内部使用免费 | ✅ | ✅ 公共仓库 | ✅ 公共仓库 | ❌ | ❌ |
**诚实的总结:**
- **对比 Google Code Wiki** —— Google 的产品(于 2025 年 11 月推出)仅限云端,目前尚不支持私有仓库。基于 Gemini 的文档功能很强大,但没有 Git 行为智能、废弃代码检测、MCP Server 和架构决策。
- **对比 DeepWiki** —— 仅限云端,闭源(存在社区可自托管的 forks)。文档和 Q&A 功能强大,带有基础的 3 工具 MCP Server。没有 Git 分析、废弃代码检测和决策功能。
- **对比 Swimm** —— Swimm 的优势在于通过过期检测,将手动编写的文档链接到代码片段。没有图、没有 Git 行为分析、没有废弃代码检测、默认没有 MCP。私有托管需要企业版定价。
- **对比 CodeScene** —— CodeScene 拥有出色的 Git 智能(热点、共变、所有权、巴士因子)。没有文档生成、没有 RAG、没有架构决策。闭源,按作者数量定价。
repowise 是这些特性的交集:CodeScene 级别的 Git 智能 + 自动生成的文档 + 原生支持 Agent 的 MCP + 架构决策,可自托管且完全开源。
## 托管版 —— 面向团队
自托管的 OSS 版本是完整且可投入生产环境的。面向工程团队的托管版正在积极开发中。
托管版增加了只有在托管的、多用户环境中才有意义的功能:
- **共享的团队上下文层** —— 一个由完整的图和决策层支持的 CLAUDE.md,通过 MCP 自动注入到每个团队成员的 Claude Code 会话中
- **会话智能收集** —— 从 AI 编码会话中提取架构决策,并自动提交到团队知识库中
- **工程负责人仪表盘** —— 巴士因子趋势、热点随时间的演变、跨仓库的废弃代码、所有权偏移
- **托管的 Webhooks** —— 零配置,在任何分支的每次提交时自动重新索引
- **集成** *(即将推出)* —— Slack 警报、Notion 同步、Confluence 同步、Jira 和 Linear 决策关联
- **跨仓库智能** —— 跨你所有仓库的热点、废弃代码和所有权概览
[加入托管版等候名单 →](https://repowise.dev) · [联系我们获取企业版](mailto:hello@repowise.dev)
## CLI 参考
```
# Core
repowise init [PATH] # index codebase (one-time)
repowise update [PATH] # incremental update (<30 seconds)
repowise serve [PATH] # MCP server + local dashboard
repowise watch [PATH] # auto-update on file save
# Query
repowise query "
为那些厌倦了问*“这段代码为什么存在?”*的工程师而构建。
[repowise.dev](https://repowise.dev) · [在线演示 →](https://repowise.dev/examples) · [Discord](https://discord.gg/repowise) · [X](https://x.com/repowisedev)
标签:AI编程助手, AI辅助开发, DNS解析, Git分析, MCP协议, NetworkX, Python开发, tree-sitter, 代码分析工具, 代码图谱, 代码审查, 代码库智能分析, 代码理解, 代码索引, 依赖图分析, 大模型上下文协议, 工程团队工具, 开发工具链, 开发者体验, 开源项目, 数据管道, 架构决策记录, 死代码检测, 特权检测, 知识库管理, 突变策略, 自动生成文档, 软件工程, 逆向工具