bingo-light 2.0.1 → 2.1.1
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/.claude/commands/bingo.md +116 -0
- package/README.en.md +522 -0
- package/README.md +297 -285
- package/bingo_core/__init__.py +1 -1
- package/bingo_core/setup.py +343 -55
- package/mcp-server.py +1 -1
- package/package.json +2 -1
- package/README.zh-CN.md +0 -534
package/README.md
CHANGED
|
@@ -2,130 +2,149 @@
|
|
|
2
2
|
<br>
|
|
3
3
|
<img src="docs/logo.svg" alt="bingo-light logo" width="200">
|
|
4
4
|
<br><br>
|
|
5
|
-
<strong>Fork
|
|
5
|
+
<strong>Fork 同步,一条命令搞定。<br>人用、AI 用,零依赖。</strong>
|
|
6
6
|
<br><br>
|
|
7
|
-
<
|
|
7
|
+
<a href="README.en.md">English</a> | <b>简体中文</b>
|
|
8
8
|
<br><br>
|
|
9
9
|
<a href="https://github.com/DanOps-1/bingo-light/actions"><img src="https://github.com/DanOps-1/bingo-light/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
10
10
|
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
|
|
11
11
|
<a href="https://github.com/DanOps-1/bingo-light/releases"><img src="https://img.shields.io/github/v/release/DanOps-1/bingo-light?label=Release&color=orange" alt="Release"></a>
|
|
12
|
-
<
|
|
13
|
-
<a href="#for-ai-agents"><img src="https://img.shields.io/badge/MCP_Server-29_tools-blueviolet.svg" alt="MCP: 29 tools"></a>
|
|
12
|
+
<a href="#mcp-服务器"><img src="https://img.shields.io/badge/MCP_Server-29_tools-blueviolet.svg" alt="MCP: 27 tools"></a>
|
|
14
13
|
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.8+-3776ab.svg" alt="Python 3.8+"></a>
|
|
15
14
|
<img src="https://img.shields.io/badge/Dependencies-Zero-brightgreen.svg" alt="Zero deps">
|
|
16
15
|
<a href="https://github.com/DanOps-1/bingo-light/stargazers"><img src="https://img.shields.io/github/stars/DanOps-1/bingo-light?style=social" alt="Stars"></a>
|
|
17
16
|
<br><br>
|
|
18
17
|
</p>
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
GitHub's "Sync fork" button breaks the moment you have customizations. `git rebase` is a 6-step ritual. And none of it works from an AI agent.
|
|
19
|
+
GitHub 的 "Sync fork" 按钮?你一改代码它就废了。手动 `git rebase`?六步操作,每次都得记。AI 想帮你同步?没接口可调。
|
|
23
20
|
|
|
24
|
-
**bingo-light
|
|
21
|
+
**bingo-light 把这三个问题一锅端。**
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
改动以补丁栈的形式叠在上游之上,干干净净。同步一句 `bingo-light sync`。冲突解过一次就记住了,下次自动跳过。搞砸了 `bingo-light undo` 秒回。
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
所有命令支持 `--json` 输出。内置 MCP 服务器 29 个工具,AI 从初始化到冲突解决全程自主,不用人盯。
|
|
29
26
|
|
|
30
27
|
---
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
## 目录
|
|
30
|
+
|
|
31
|
+
- [快速开始](#快速开始)
|
|
32
|
+
- [演示](#演示)
|
|
33
|
+
- [安装](#安装)
|
|
34
|
+
- [功能特性](#功能特性)
|
|
35
|
+
- [工作原理](#工作原理)
|
|
36
|
+
- [MCP 服务器](#mcp-服务器)
|
|
37
|
+
- [命令参考](#命令参考)
|
|
38
|
+
- [集成指南](#集成指南)
|
|
39
|
+
- [配置](#配置)
|
|
40
|
+
- [常见问题](#常见问题)
|
|
41
|
+
- [与其他方案对比](#与其他方案对比)
|
|
42
|
+
- [项目生态](#项目生态)
|
|
43
|
+
- [参与贡献](#参与贡献)
|
|
44
|
+
- [许可证](#许可证)
|
|
35
45
|
|
|
36
46
|
---
|
|
37
47
|
|
|
38
|
-
##
|
|
48
|
+
## 快速开始
|
|
39
49
|
|
|
40
50
|
```bash
|
|
41
|
-
#
|
|
51
|
+
# 安装(任选一种)
|
|
42
52
|
pip install bingo-light # Python
|
|
43
53
|
npm install -g bingo-light # Node.js
|
|
44
54
|
brew install DanOps-1/tap/bingo-light # Homebrew
|
|
45
55
|
|
|
46
|
-
#
|
|
47
|
-
cd
|
|
56
|
+
# 初始化 Fork 追踪
|
|
57
|
+
cd my-forked-project
|
|
48
58
|
bingo-light init https://github.com/original/project.git
|
|
49
59
|
|
|
50
|
-
#
|
|
60
|
+
# 改代码,创建命名补丁
|
|
61
|
+
vim src/feature.py
|
|
62
|
+
bingo-light patch new my-feature
|
|
63
|
+
|
|
64
|
+
# 上游有更新?一句话同步
|
|
51
65
|
bingo-light sync
|
|
52
66
|
```
|
|
53
67
|
|
|
54
|
-
|
|
68
|
+
就这么简单。补丁永远干净地叠在最新上游之上。
|
|
55
69
|
|
|
56
|
-
##
|
|
70
|
+
## 演示
|
|
57
71
|
|
|
58
|
-
###
|
|
72
|
+
### 日常操作:初始化 → 建补丁 → 同步
|
|
59
73
|
|
|
60
74
|
<p align="center">
|
|
61
|
-
<img src="docs/demo.svg" alt="bingo-light
|
|
75
|
+
<img src="docs/demo.svg" alt="bingo-light 基本演示" width="850">
|
|
62
76
|
</p>
|
|
63
77
|
|
|
64
|
-
###
|
|
78
|
+
### 冲突处理:同步 → 分析 → 搞定
|
|
65
79
|
|
|
66
80
|
<p align="center">
|
|
67
|
-
<img src="docs/demo-conflict.svg" alt="bingo-light
|
|
81
|
+
<img src="docs/demo-conflict.svg" alt="bingo-light 冲突解决演示" width="850">
|
|
68
82
|
</p>
|
|
69
83
|
|
|
70
|
-
>
|
|
84
|
+
> AI 调 `conflict-analyze --json` 拿到双方代码,写好合并结果,rebase 自动继续。全程零人工。
|
|
71
85
|
|
|
72
|
-
|
|
86
|
+
### AI 拿到的是结构化数据
|
|
73
87
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
- :bell: **Notification hooks** -- Slack, Discord, webhooks on sync/conflict/test events.
|
|
91
|
-
- :label: **Patch metadata** -- tags, reasons, expiry dates, upstream PR tracking.
|
|
92
|
-
- :tab: **Shell completions** -- tab completion for bash, zsh, and fish.
|
|
93
|
-
|
|
94
|
-
### For AI Agents
|
|
95
|
-
|
|
96
|
-
- :electric_plug: **MCP server (29 tools)** -- full fork management from init through conflict resolution.
|
|
97
|
-
- :bar_chart: **`--json` on everything** -- every command returns structured JSON. Parse, don't scrape.
|
|
98
|
-
- :mute: **`--yes` flag** -- fully non-interactive. No TTY required. No prompts. Ever.
|
|
99
|
-
- :gear: **Auto-detect non-TTY** -- pipes and subprocesses trigger non-interactive mode automatically.
|
|
100
|
-
- :memo: **`BINGO_DESCRIPTION` env var** -- set patch descriptions without stdin.
|
|
101
|
-
- :mag: **`conflict-analyze --json`** -- structured conflict data: file, ours, theirs, resolution hints.
|
|
102
|
-
- :white_check_mark: **`conflict-resolve`** -- write resolved content via MCP, auto-stage, continue rebase. Zero manual intervention.
|
|
103
|
-
- :satellite: **Advisor agent** -- `contrib/agent.py` monitors drift, analyzes risk, auto-syncs when safe.
|
|
88
|
+
```
|
|
89
|
+
$ bingo-light status --json
|
|
90
|
+
```
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"ok": true,
|
|
94
|
+
"upstream_url": "https://github.com/torvalds/linux.git",
|
|
95
|
+
"behind": 47,
|
|
96
|
+
"patch_count": 2,
|
|
97
|
+
"patches": [
|
|
98
|
+
{"name": "custom-scheduler", "hash": "a3f7c21", "subject": "O(1) task scheduling", "files": 3},
|
|
99
|
+
{"name": "perf-monitoring", "hash": "b8e2d4f", "subject": "eBPF tracing hooks", "files": 5}
|
|
100
|
+
],
|
|
101
|
+
"conflict_risk": ["kernel/sched/core.c"]
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
### 冲突分析(AI 直接消费)
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
```
|
|
108
|
+
$ bingo-light conflict-analyze --json
|
|
109
|
+
```
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"rebase_in_progress": true,
|
|
113
|
+
"current_patch": "custom-scheduler",
|
|
114
|
+
"conflicts": [
|
|
115
|
+
{
|
|
116
|
+
"file": "kernel/sched/core.c",
|
|
117
|
+
"conflict_count": 2,
|
|
118
|
+
"ours": "... 上游版本 ...",
|
|
119
|
+
"theirs": "... 你的补丁版本 ...",
|
|
120
|
+
"hint": "上游重构了调度器核心;补丁需要适配新结构。"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
```
|
|
108
125
|
|
|
109
|
-
|
|
126
|
+
## 安装
|
|
127
|
+
|
|
128
|
+
装完跑 `bingo-light setup`,交互式配好 MCP 和 AI Skill(Claude Code、Cursor、Windsurf、VS Code/Copilot、Gemini CLI 等一键选配)。
|
|
110
129
|
|
|
111
130
|
### pip / pipx
|
|
112
131
|
|
|
113
132
|
```bash
|
|
114
|
-
pip install bingo-light #
|
|
115
|
-
bingo-light setup #
|
|
133
|
+
pip install bingo-light # 或: pipx install bingo-light
|
|
134
|
+
bingo-light setup # 选配 AI 工具
|
|
116
135
|
```
|
|
117
136
|
|
|
118
137
|
### npm / npx
|
|
119
138
|
|
|
120
139
|
```bash
|
|
121
|
-
npm install -g bingo-light #
|
|
140
|
+
npm install -g bingo-light # 全局安装
|
|
122
141
|
bingo-light setup
|
|
123
142
|
|
|
124
|
-
#
|
|
143
|
+
# 或 npx 免装:
|
|
125
144
|
npx bingo-light setup
|
|
126
145
|
```
|
|
127
146
|
|
|
128
|
-
MCP
|
|
147
|
+
MCP 客户端直接用 npx:
|
|
129
148
|
```json
|
|
130
149
|
{"command": "npx", "args": ["-y", "bingo-light-mcp"]}
|
|
131
150
|
```
|
|
@@ -143,20 +162,20 @@ bingo-light setup
|
|
|
143
162
|
# CLI
|
|
144
163
|
docker run --rm -v "$PWD:/repo" -w /repo ghcr.io/danops-1/bingo-light status
|
|
145
164
|
|
|
146
|
-
# MCP
|
|
165
|
+
# MCP 服务器(stdio)
|
|
147
166
|
docker run --rm -i -v "$PWD:/repo" -w /repo ghcr.io/danops-1/bingo-light mcp-server.py
|
|
148
167
|
```
|
|
149
168
|
|
|
150
|
-
### Shell
|
|
169
|
+
### Shell 安装器
|
|
151
170
|
|
|
152
171
|
```bash
|
|
153
172
|
curl -fsSL https://raw.githubusercontent.com/DanOps-1/bingo-light/main/install.sh | sh
|
|
154
173
|
|
|
155
|
-
#
|
|
174
|
+
# 非交互模式(CI / Docker)
|
|
156
175
|
curl -fsSL .../install.sh | sh -s -- --yes
|
|
157
176
|
```
|
|
158
177
|
|
|
159
|
-
###
|
|
178
|
+
### 从源码安装
|
|
160
179
|
|
|
161
180
|
```bash
|
|
162
181
|
git clone https://github.com/DanOps-1/bingo-light.git
|
|
@@ -164,46 +183,78 @@ cd bingo-light
|
|
|
164
183
|
make install && bingo-light setup
|
|
165
184
|
```
|
|
166
185
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
186
|
+
**依赖:** Python 3.8+ / git 2.20+,没了。
|
|
187
|
+
|
|
188
|
+
## 功能特性
|
|
189
|
+
|
|
190
|
+
### AI 侧
|
|
191
|
+
|
|
192
|
+
| 功能 | 说明 |
|
|
193
|
+
|------|------|
|
|
194
|
+
| **MCP 服务器** | 29 个工具,初始化到冲突解决全覆盖 |
|
|
195
|
+
| **`--json`** | 所有命令输出结构化 JSON |
|
|
196
|
+
| **`--yes`** | 跳过一切确认,不需要 TTY |
|
|
197
|
+
| **非 TTY 自适应** | 管道或子进程调用时自动静默 |
|
|
198
|
+
| **`BINGO_DESCRIPTION`** | 环境变量设补丁描述 |
|
|
199
|
+
| **`conflict-analyze`** | 冲突数据结构化:文件、双方代码、解决提示 |
|
|
200
|
+
| **`conflict-resolve`** | MCP 直接写入解决内容,自动暂存 + 继续 rebase |
|
|
201
|
+
| **Advisor 代理** | `contrib/agent.py` 自动监控、分析、安全时自动同步 |
|
|
202
|
+
|
|
203
|
+
### 人类侧
|
|
204
|
+
|
|
205
|
+
| 功能 | 说明 |
|
|
206
|
+
|------|------|
|
|
207
|
+
| **零依赖** | Python 3 + git,一行装完 |
|
|
208
|
+
| **命名补丁** | 每个改动是独立的、有名字的 commit |
|
|
209
|
+
| **一键同步** | `bingo-light sync`,补丁自动 rebase 到最新上游 |
|
|
210
|
+
| **先试后跑** | `sync --dry-run` 临时分支预演,不碰真代码 |
|
|
211
|
+
| **冲突记忆** | rerere 自动开,解一次就记住,再也不问 |
|
|
212
|
+
| **秒级撤销** | `bingo-light undo` 恢复同步前状态 |
|
|
213
|
+
| **冲突预警** | `status` 提前告诉你哪些文件会出事 |
|
|
214
|
+
| **自检修复** | `doctor` 全面体检 + 试跑 rebase |
|
|
215
|
+
| **导出导入** | `.patch` 文件,quilt 兼容 |
|
|
216
|
+
| **CI 自动同步** | 生成 GitHub Actions 流水线,冲突自动告警 |
|
|
217
|
+
| **TUI 面板** | curses 实时仪表盘(`contrib/tui.py`) |
|
|
218
|
+
| **多仓管理** | `workspace` 统一管所有 Fork |
|
|
219
|
+
| **补全** | bash / zsh / fish |
|
|
220
|
+
| **通知推送** | Discord、Slack、Webhook,事件触发 |
|
|
221
|
+
| **补丁元数据** | 标签、原因、过期时间、关联上游 PR |
|
|
222
|
+
| **测试联动** | 同步后自动跑测试,挂了自动回滚 |
|
|
223
|
+
|
|
224
|
+
## 工作原理
|
|
172
225
|
|
|
173
226
|
```
|
|
174
227
|
upstream (github.com/original/project)
|
|
175
228
|
|
|
|
176
229
|
| git fetch
|
|
177
230
|
v
|
|
178
|
-
upstream-tracking
|
|
231
|
+
upstream-tracking ─────── 上游的精确镜像,从不手动碰
|
|
179
232
|
|
|
|
180
233
|
| git rebase
|
|
181
234
|
v
|
|
182
|
-
bingo-patches
|
|
235
|
+
bingo-patches ─────────── 你的改动叠在这里
|
|
183
236
|
|
|
|
184
|
-
+── [bl] custom-scheduler: O(1)
|
|
185
|
-
+── [bl] perf-monitoring: eBPF
|
|
186
|
-
+── [bl] fix-logging:
|
|
237
|
+
+── [bl] custom-scheduler: O(1) 任务调度
|
|
238
|
+
+── [bl] perf-monitoring: eBPF 追踪钩子
|
|
239
|
+
+── [bl] fix-logging: 结构化 JSON 日志
|
|
187
240
|
|
|
|
188
241
|
v
|
|
189
|
-
HEAD (
|
|
242
|
+
HEAD (你的工作 Fork)
|
|
190
243
|
```
|
|
191
244
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
**Conflict memory:** `init` auto-enables git rerere. Resolve a conflict once and git remembers the resolution. Next sync applies it automatically. bingo-light detects auto-resolved conflicts and continues the rebase without stopping.
|
|
245
|
+
**同步:** fetch 上游 → 快进追踪分支 → rebase 补丁到最新上游。补丁永远干净地叠在最新代码上。
|
|
195
246
|
|
|
196
|
-
|
|
247
|
+
**冲突记忆:** 初始化时自动开 rerere。解过一次,git 就记住了——下次碰到同样的冲突直接跳过。
|
|
197
248
|
|
|
198
|
-
|
|
249
|
+
**AI 解冲突:** rebase 卡住时,AI 调 `conflict-analyze` 拿双方代码和提示,写好合并结果扔给 `conflict-resolve`,rebase 自动继续,不用人管。
|
|
199
250
|
|
|
200
|
-
##
|
|
251
|
+
## MCP 服务器
|
|
201
252
|
|
|
202
|
-
|
|
253
|
+
`mcp-server.py`,纯 Python 3,零依赖,stdio 传输,29 个工具,JSON-RPC 2.0。
|
|
203
254
|
|
|
204
|
-
|
|
255
|
+
运行 `bingo-light setup` 自动配置,或手动添加:
|
|
205
256
|
|
|
206
|
-
|
|
257
|
+
**Claude Code**(`.mcp.json` 或 `~/.claude/settings.json`):
|
|
207
258
|
|
|
208
259
|
```json
|
|
209
260
|
{
|
|
@@ -216,9 +267,7 @@ Add to `.mcp.json` in your project root or `~/.claude/settings.json`:
|
|
|
216
267
|
}
|
|
217
268
|
```
|
|
218
269
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
270
|
+
**Claude Desktop**(`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
222
271
|
|
|
223
272
|
```json
|
|
224
273
|
{
|
|
@@ -231,105 +280,102 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
231
280
|
}
|
|
232
281
|
```
|
|
233
282
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
###
|
|
237
|
-
|
|
238
|
-
|
|
|
239
|
-
|
|
240
|
-
| `bingo_init` |
|
|
241
|
-
| `bingo_status` |
|
|
242
|
-
| `bingo_sync` |
|
|
243
|
-
| `bingo_undo` |
|
|
244
|
-
| `bingo_patch_new` |
|
|
245
|
-
| `bingo_patch_list` |
|
|
246
|
-
| `bingo_patch_show` |
|
|
247
|
-
| `bingo_patch_drop` |
|
|
248
|
-
| `bingo_patch_export` |
|
|
249
|
-
| `bingo_patch_import` |
|
|
250
|
-
| `bingo_patch_meta` |
|
|
251
|
-
| `bingo_patch_squash` |
|
|
252
|
-
| `bingo_patch_reorder` |
|
|
253
|
-
| `bingo_doctor` |
|
|
254
|
-
| `bingo_diff` |
|
|
255
|
-
| `bingo_auto_sync` |
|
|
256
|
-
| `bingo_conflict_analyze` |
|
|
257
|
-
| `bingo_conflict_resolve` |
|
|
258
|
-
| `bingo_config` |
|
|
259
|
-
| `bingo_history` |
|
|
260
|
-
| `bingo_test` |
|
|
261
|
-
| `bingo_workspace_status` |
|
|
262
|
-
| `bingo_patch_edit` |
|
|
263
|
-
| `bingo_workspace_init` |
|
|
264
|
-
| `bingo_workspace_add` |
|
|
265
|
-
| `bingo_workspace_sync` |
|
|
266
|
-
| `bingo_workspace_list` |
|
|
267
|
-
|
|
268
|
-
|
|
283
|
+
**其他客户端**(Cursor、Windsurf、VS Code Copilot 等):stdio 连 `python3 mcp-server.py`,或跑 `bingo-light setup` 一键配。
|
|
284
|
+
|
|
285
|
+
### 全部工具
|
|
286
|
+
|
|
287
|
+
| 工具 | 用途 |
|
|
288
|
+
|------|------|
|
|
289
|
+
| `bingo_init` | 初始化 Fork 追踪 |
|
|
290
|
+
| `bingo_status` | 健康检查:漂移、补丁、冲突风险 |
|
|
291
|
+
| `bingo_sync` | 拉取上游并变基补丁 |
|
|
292
|
+
| `bingo_undo` | 恢复到同步前状态 |
|
|
293
|
+
| `bingo_patch_new` | 创建命名补丁 |
|
|
294
|
+
| `bingo_patch_list` | 列出补丁栈 |
|
|
295
|
+
| `bingo_patch_show` | 查看补丁 diff |
|
|
296
|
+
| `bingo_patch_drop` | 移除补丁 |
|
|
297
|
+
| `bingo_patch_export` | 导出为 `.patch` 文件 |
|
|
298
|
+
| `bingo_patch_import` | 导入 `.patch` 文件 |
|
|
299
|
+
| `bingo_patch_meta` | 获取/设置补丁元数据 |
|
|
300
|
+
| `bingo_patch_squash` | 合并两个补丁 |
|
|
301
|
+
| `bingo_patch_reorder` | 非交互式重排补丁 |
|
|
302
|
+
| `bingo_doctor` | 全面诊断 + 测试变基 |
|
|
303
|
+
| `bingo_diff` | 补丁总 diff vs 上游 |
|
|
304
|
+
| `bingo_auto_sync` | 生成 GitHub Actions 工作流 |
|
|
305
|
+
| `bingo_conflict_analyze` | AI 用的结构化冲突数据 |
|
|
306
|
+
| `bingo_conflict_resolve` | 写入解决内容,暂存,继续 rebase |
|
|
307
|
+
| `bingo_config` | 获取/设置配置 |
|
|
308
|
+
| `bingo_history` | 同步历史 + hash 映射 |
|
|
309
|
+
| `bingo_test` | 运行测试套件 |
|
|
310
|
+
| `bingo_workspace_status` | 多仓库工作区概览 |
|
|
311
|
+
| `bingo_patch_edit` | 修改已有补丁 |
|
|
312
|
+
| `bingo_workspace_init` | 初始化多仓库工作区 |
|
|
313
|
+
| `bingo_workspace_add` | 添加仓库到工作区 |
|
|
314
|
+
| `bingo_workspace_sync` | 同步工作区所有仓库 |
|
|
315
|
+
| `bingo_workspace_list` | 列出工作区仓库 |
|
|
316
|
+
|
|
317
|
+
## 命令参考
|
|
269
318
|
|
|
270
|
-
```bash
|
|
271
|
-
# Fork status (AI-friendly)
|
|
272
|
-
bingo-light status --json
|
|
273
319
|
```
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
320
|
+
bingo-light init <upstream-url> [branch] 初始化上游追踪
|
|
321
|
+
bingo-light patch new <name> 创建命名补丁
|
|
322
|
+
bingo-light patch list [-v] 列出补丁栈
|
|
323
|
+
bingo-light patch show <name|index> 查看补丁 diff
|
|
324
|
+
bingo-light patch edit <name|index> 修改补丁(先暂存变更)
|
|
325
|
+
bingo-light patch drop <name|index> 移除补丁
|
|
326
|
+
bingo-light patch reorder [--order "3,1,2"] 重排补丁
|
|
327
|
+
bingo-light patch export [dir] 导出为 .patch 文件
|
|
328
|
+
bingo-light patch import <file|dir> 导入 .patch 文件
|
|
329
|
+
bingo-light patch squash <idx1> <idx2> 合并两个补丁
|
|
330
|
+
bingo-light patch meta <name> [key] [value] 获取/设置补丁元数据
|
|
331
|
+
bingo-light sync [--dry-run] [--force] 与上游同步
|
|
332
|
+
bingo-light sync --test 同步后跑测试,失败自动回滚
|
|
333
|
+
bingo-light undo 恢复到同步前状态
|
|
334
|
+
bingo-light status 健康检查 + 冲突预测
|
|
335
|
+
bingo-light doctor 全面诊断
|
|
336
|
+
bingo-light diff 补丁总 diff vs 上游
|
|
337
|
+
bingo-light log 同步历史
|
|
338
|
+
bingo-light conflict-analyze 分析 rebase 冲突
|
|
339
|
+
bingo-light config get|set|list [key] [val] 管理配置
|
|
340
|
+
bingo-light history 详细同步历史 + 映射
|
|
341
|
+
bingo-light test 运行测试套件
|
|
342
|
+
bingo-light workspace init|add|status|sync 多仓库管理
|
|
343
|
+
bingo-light auto-sync 生成 GitHub Actions 工作流
|
|
344
|
+
bingo-light version 打印版本
|
|
345
|
+
bingo-light help 打印帮助
|
|
287
346
|
```
|
|
288
347
|
|
|
289
|
-
|
|
290
|
-
# Conflict analysis (structured data for AI resolution)
|
|
291
|
-
bingo-light conflict-analyze --json
|
|
292
|
-
```
|
|
348
|
+
**全局标志:** `--json`(结构化 JSON 输出) | `--yes`(跳过所有确认提示)
|
|
293
349
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
"current_patch": "custom-scheduler",
|
|
298
|
-
"conflicts": [
|
|
299
|
-
{
|
|
300
|
-
"file": "kernel/sched/core.c",
|
|
301
|
-
"conflict_count": 2,
|
|
302
|
-
"ours": "... upstream version ...",
|
|
303
|
-
"theirs": "... your patch version ...",
|
|
304
|
-
"hint": "Upstream refactored scheduler core; patch needs to target new structure."
|
|
305
|
-
}
|
|
306
|
-
]
|
|
307
|
-
}
|
|
308
|
-
```
|
|
350
|
+
## 集成指南
|
|
351
|
+
|
|
352
|
+
### Claude Code (MCP)
|
|
309
353
|
|
|
310
|
-
|
|
354
|
+
MCP 配好后,Claude Code 全程接管:
|
|
311
355
|
|
|
312
356
|
```
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
1. bingo_status(cwd)
|
|
317
|
-
2. bingo_sync(cwd, dry_run
|
|
318
|
-
3. bingo_sync(cwd)
|
|
319
|
-
4. bingo_conflict_analyze(
|
|
320
|
-
5.
|
|
321
|
-
6. bingo_conflict_resolve(cwd, file, content)
|
|
322
|
-
7. bingo_status(cwd)
|
|
357
|
+
你: "同步上游,冲突帮我修了。"
|
|
358
|
+
|
|
359
|
+
Claude Code:
|
|
360
|
+
1. bingo_status(cwd) → 落后 47 commit,risk: core.c
|
|
361
|
+
2. bingo_sync(cwd, dry_run) → 预判 1 个冲突
|
|
362
|
+
3. bingo_sync(cwd) → rebase 卡在冲突
|
|
363
|
+
4. bingo_conflict_analyze() → 拿到双方代码 + 提示
|
|
364
|
+
5. 读两边,写合并结果
|
|
365
|
+
6. bingo_conflict_resolve(cwd, file, content) → 搞定
|
|
366
|
+
7. bingo_status(cwd) → 0 落后,补丁干净
|
|
323
367
|
```
|
|
324
368
|
|
|
325
|
-
###
|
|
369
|
+
### Aider / CLI 代理
|
|
326
370
|
|
|
327
371
|
```bash
|
|
328
|
-
bingo-light status --json #
|
|
329
|
-
bingo-light sync --yes #
|
|
330
|
-
bingo-light conflict-analyze --json #
|
|
372
|
+
bingo-light status --json # 解析 Fork 状态
|
|
373
|
+
bingo-light sync --yes # 非交互同步
|
|
374
|
+
bingo-light conflict-analyze --json # 结构化冲突数据
|
|
331
375
|
```
|
|
332
376
|
|
|
377
|
+
### 自定义 Python 代理
|
|
378
|
+
|
|
333
379
|
```python
|
|
334
380
|
import subprocess, json
|
|
335
381
|
|
|
@@ -345,178 +391,144 @@ if status["behind"] > 0:
|
|
|
345
391
|
result = bingo("sync")
|
|
346
392
|
if result.get("conflicts"):
|
|
347
393
|
analysis = bingo("conflict-analyze")
|
|
348
|
-
|
|
394
|
+
for c in analysis["conflicts"]:
|
|
395
|
+
resolved = my_llm_resolve(c["ours"], c["theirs"], c["hint"])
|
|
396
|
+
# 通过 CLI 或 MCP 写入解决内容
|
|
349
397
|
```
|
|
350
398
|
|
|
351
|
-
|
|
399
|
+
## 配置
|
|
352
400
|
|
|
353
|
-
|
|
401
|
+
配置存在 `.bingolight`(git-config 格式),自动排除在版本控制外。
|
|
354
402
|
|
|
355
|
-
```
|
|
356
|
-
bingo-light
|
|
357
|
-
bingo-light
|
|
358
|
-
bingo-light
|
|
359
|
-
bingo-light undo Revert to pre-sync state
|
|
360
|
-
bingo-light status Fork health + conflict prediction
|
|
361
|
-
bingo-light diff Combined patch diff vs upstream
|
|
362
|
-
bingo-light doctor Full diagnostic
|
|
363
|
-
bingo-light log Sync history
|
|
364
|
-
bingo-light history Detailed sync history with hash mappings
|
|
365
|
-
bingo-light patch new <name> Create named patch from staged changes
|
|
366
|
-
bingo-light patch list [-v] List patch stack
|
|
367
|
-
bingo-light patch show <name|index> Show patch diff
|
|
368
|
-
bingo-light patch edit <name|index> Amend a patch (stage changes first)
|
|
369
|
-
bingo-light patch drop <name|index> Remove a patch
|
|
370
|
-
bingo-light patch reorder [--order "3,1,2"] Reorder patches
|
|
371
|
-
bingo-light patch export [dir] Export as .patch files
|
|
372
|
-
bingo-light patch import <file|dir> Import .patch files
|
|
373
|
-
bingo-light patch squash <idx1> <idx2> Merge two patches
|
|
374
|
-
bingo-light patch meta <name> [key] [value] Get/set patch metadata
|
|
375
|
-
bingo-light conflict-analyze Structured conflict data for AI
|
|
376
|
-
bingo-light config get|set|list [key] [val] Manage configuration
|
|
377
|
-
bingo-light test Run configured test suite
|
|
378
|
-
bingo-light workspace init|add|status|sync Multi-repo management
|
|
379
|
-
bingo-light auto-sync Generate GitHub Actions workflow
|
|
380
|
-
bingo-light version Print version
|
|
381
|
-
bingo-light help Show usage
|
|
403
|
+
```bash
|
|
404
|
+
bingo-light config set sync.auto-test true # 同步后自动跑测试
|
|
405
|
+
bingo-light config set test.command "make test" # 测试命令
|
|
406
|
+
bingo-light config list # 查看所有配置
|
|
382
407
|
```
|
|
383
408
|
|
|
384
|
-
|
|
409
|
+
### 通知 Hook
|
|
385
410
|
|
|
386
|
-
|
|
411
|
+
在 `.bingo/hooks/` 放可执行脚本:
|
|
387
412
|
|
|
388
|
-
|
|
413
|
+
| Hook | 触发时机 |
|
|
414
|
+
|------|---------|
|
|
415
|
+
| `on-sync-success` | 同步成功后 |
|
|
416
|
+
| `on-conflict` | rebase 碰到冲突时 |
|
|
417
|
+
| `on-test-fail` | 同步后测试失败时 |
|
|
389
418
|
|
|
390
|
-
|
|
391
|
-
<summary><b>...click GitHub's "Sync fork" button?</b></summary>
|
|
392
|
-
<br>
|
|
419
|
+
Hook 通过 stdin 接 JSON。示例见 [contrib/hooks/](contrib/hooks/)(Slack / Discord / Webhook)。
|
|
393
420
|
|
|
394
|
-
|
|
395
|
-
</details>
|
|
421
|
+
## 常见问题
|
|
396
422
|
|
|
397
423
|
<details>
|
|
398
|
-
<summary><b
|
|
399
|
-
<br>
|
|
424
|
+
<summary><b>为什么不直接 <code>git rebase</code>?</b></summary>
|
|
400
425
|
|
|
401
|
-
|
|
426
|
+
可以。bingo-light 包的是 rebase 周边那些烦事:追踪上游、维护补丁分支、开 rerere、预测冲突、输出结构化数据。偶尔 rebase 一次用不着它,但长期维护好几个补丁的话,省心省力。
|
|
402
427
|
</details>
|
|
403
428
|
|
|
404
429
|
<details>
|
|
405
|
-
<summary><b
|
|
406
|
-
<br>
|
|
430
|
+
<summary><b>能用在已有的 Fork 上吗?</b></summary>
|
|
407
431
|
|
|
408
|
-
|
|
432
|
+
能。进你的 Fork 目录,`bingo-light init <upstream-url>`,再 `bingo-light patch new <name>` 把现有改动转成补丁。标准 git 仓库就行。
|
|
409
433
|
</details>
|
|
410
434
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
| | **bingo-light** | GitHub Sync | git rebase | quilt | StGit |
|
|
414
|
-
|---|:---:|:---:|:---:|:---:|:---:|
|
|
415
|
-
| Named patch stack | **Yes** | No | No | Yes | Yes |
|
|
416
|
-
| One-command sync | **Yes** | Click only | No (6 steps) | No | No |
|
|
417
|
-
| Handles customizations | **Yes** | **No** | Manual | Manual | Manual |
|
|
418
|
-
| Conflict memory (rerere) | **Auto** | No | Manual | No | No |
|
|
419
|
-
| Conflict prediction | **Yes** | No | No | No | No |
|
|
420
|
-
| AI / MCP integration | **29 tools** | No | No | No | No |
|
|
421
|
-
| JSON output | **All commands** | No | No | No | No |
|
|
422
|
-
| Non-interactive mode | **Native** | No | Partial | Partial | Partial |
|
|
423
|
-
| Undo sync | **One command** | No | git reflog | Manual | Manual |
|
|
424
|
-
| Install | One command | Built-in | Built-in | Package mgr | Package mgr |
|
|
425
|
-
|
|
426
|
-
---
|
|
435
|
+
<details>
|
|
436
|
+
<summary><b>只给 AI 用?</b></summary>
|
|
427
437
|
|
|
428
|
-
|
|
438
|
+
人和 AI 用的是同一套命令。`bingo-light sync` 谁跑都一样。`--json`、`--yes`、MCP 这些是给 AI 加的接口,不加就是正常的人类输出。
|
|
439
|
+
</details>
|
|
429
440
|
|
|
430
441
|
<details>
|
|
431
|
-
<summary><b
|
|
432
|
-
<br>
|
|
442
|
+
<summary><b>冲突记忆怎么回事?</b></summary>
|
|
433
443
|
|
|
434
|
-
|
|
444
|
+
`init` 时自动开了 git 的 `rerere`(reuse recorded resolution)。你解一次冲突,git 记住解法。下次碰到一样的冲突,直接套用,不再问你。bingo-light 还会检测到自动解决的冲突后自己继续 rebase,不会卡着等人。
|
|
435
445
|
</details>
|
|
436
446
|
|
|
437
447
|
<details>
|
|
438
|
-
<summary><b
|
|
439
|
-
<br>
|
|
448
|
+
<summary><b>同步搞砸了?</b></summary>
|
|
440
449
|
|
|
441
|
-
|
|
450
|
+
`bingo-light undo`。补丁分支秒回同步前的状态。底层用 reflog,再复杂的 rebase 也能回。
|
|
442
451
|
</details>
|
|
443
452
|
|
|
444
453
|
<details>
|
|
445
|
-
<summary><b
|
|
446
|
-
<br>
|
|
454
|
+
<summary><b>支持 GitHub/GitLab/Bitbucket 吗?</b></summary>
|
|
447
455
|
|
|
448
|
-
|
|
456
|
+
都支持。底层就是标准 git 操作(fetch、rebase、push),什么 git 远程都能用。`auto-sync` 能生成 GitHub Actions 流水线,但核心功能不绑平台。
|
|
449
457
|
</details>
|
|
450
458
|
|
|
451
459
|
<details>
|
|
452
|
-
<summary><b>
|
|
453
|
-
<br>
|
|
460
|
+
<summary><b>和 <code>git format-patch</code> / quilt 有什么区别?</b></summary>
|
|
454
461
|
|
|
455
|
-
|
|
462
|
+
`format-patch` 能导出但不管活的补丁栈。quilt 管栈但脱离了 git。bingo-light 的补丁就是真正的 git commit,享受完整历史、冲突解决、rerere 记忆,同时支持 quilt 格式导出导入。
|
|
456
463
|
</details>
|
|
457
464
|
|
|
465
|
+
## 为什么不用...
|
|
466
|
+
|
|
458
467
|
<details>
|
|
459
|
-
<summary><b
|
|
468
|
+
<summary><b>...GitHub 的 "Sync fork" 按钮?</b></summary>
|
|
460
469
|
<br>
|
|
461
470
|
|
|
462
|
-
|
|
471
|
+
只能 fast-forward。你一有自己的改动,它要么拒绝要么生成 merge commit 把你的代码埋了。没有补丁栈,没有冲突记忆,没有 API。
|
|
463
472
|
</details>
|
|
464
473
|
|
|
465
474
|
<details>
|
|
466
|
-
<summary><b>
|
|
475
|
+
<summary><b>...手动 <code>git rebase</code>?</b></summary>
|
|
467
476
|
<br>
|
|
468
477
|
|
|
469
|
-
|
|
478
|
+
可以,6 步:fetch、切 tracking 分支、pull、切 patches 分支、rebase、push。得记住分支名、手动开 rerere、搞砸了自己从 reflog 里捞。`bingo-light sync` 一条命令包了,还带撤销、冲突预测和结构化输出。
|
|
470
479
|
</details>
|
|
471
480
|
|
|
472
481
|
<details>
|
|
473
|
-
<summary><b
|
|
482
|
+
<summary><b>...StGit / quilt / TopGit?</b></summary>
|
|
474
483
|
<br>
|
|
475
484
|
|
|
476
|
-
|
|
485
|
+
StGit 管栈但没 AI 集成、没 MCP、没 JSON 输出、没冲突预测。quilt 脱离 git 体系,没 rerere 没历史。TopGit 基本废弃了。这些工具都不是为 AI 时代设计的。
|
|
477
486
|
</details>
|
|
478
487
|
|
|
479
|
-
|
|
488
|
+
## 与其他方案对比
|
|
480
489
|
|
|
481
|
-
|
|
490
|
+
| | **bingo-light** | GitHub Sync | git rebase | quilt | StGit |
|
|
491
|
+
|---|:---:|:---:|:---:|:---:|:---:|
|
|
492
|
+
| 命名补丁栈 | **有** | 无 | 无 | 有 | 有 |
|
|
493
|
+
| 一键同步 | **有** | 仅按钮 | 无(6 步) | 无 | 无 |
|
|
494
|
+
| 处理定制化改动 | **有** | **不行** | 手动 | 手动 | 手动 |
|
|
495
|
+
| 冲突记忆 (rerere) | **自动** | 无 | 需手动启用 | 无 | 无 |
|
|
496
|
+
| 冲突预测 | **有** | 无 | 无 | 无 | 无 |
|
|
497
|
+
| AI/MCP 集成 | **29 个工具** | 无 | 无 | 无 | 无 |
|
|
498
|
+
| JSON 输出 | **所有命令** | 无 | 无 | 无 | 无 |
|
|
499
|
+
| 非交互模式 | **原生支持** | 无 | 部分 | 部分 | 部分 |
|
|
500
|
+
| 撤销同步 | **一条命令** | 无 | git reflog | 手动 | 手动 |
|
|
501
|
+
| 安装方式 | 一条命令 | 内置 | 内置 | 包管理器 | 包管理器 |
|
|
502
|
+
|
|
503
|
+
## 项目生态
|
|
482
504
|
|
|
483
505
|
```
|
|
484
|
-
bingo-light CLI
|
|
485
|
-
bingo_core/
|
|
486
|
-
mcp-server.py MCP
|
|
487
|
-
contrib/agent.py Advisor
|
|
488
|
-
contrib/tui.py
|
|
489
|
-
install.sh
|
|
490
|
-
completions/ Shell
|
|
491
|
-
contrib/hooks/
|
|
492
|
-
tests/
|
|
493
|
-
docs/
|
|
494
|
-
docs/llms.txt Complete LLM-consumable reference
|
|
506
|
+
bingo-light CLI 入口(Python 3,零依赖)
|
|
507
|
+
bingo_core/ 核心库包(全部业务逻辑)
|
|
508
|
+
mcp-server.py MCP 服务器(零依赖 Python 3,29 个工具)
|
|
509
|
+
contrib/agent.py Advisor 代理(监控 + 分析 + 安全时自动同步)
|
|
510
|
+
contrib/tui.py 终端面板(curses TUI)
|
|
511
|
+
install.sh 安装器(--yes 支持 CI,--help 查看选项)
|
|
512
|
+
completions/ Shell 补全(bash/zsh/fish)
|
|
513
|
+
contrib/hooks/ 通知 Hook 示例(Slack/Discord/Webhook)
|
|
514
|
+
tests/ 测试套件(250 个测试,5 个文件)
|
|
515
|
+
docs/ 文档
|
|
495
516
|
```
|
|
496
517
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
## Documentation
|
|
500
|
-
|
|
501
|
-
- [Getting Started](docs/getting-started.md) -- 5-minute quickstart guide
|
|
502
|
-
- [Concepts](docs/concepts.md) -- branch model, patch stack, sync flow
|
|
503
|
-
- [Changelog](CHANGELOG.md) -- version history
|
|
504
|
-
- [Security](.github/SECURITY.md) -- security model and vulnerability reporting
|
|
505
|
-
|
|
506
|
-
## Contributing
|
|
518
|
+
## 参与贡献
|
|
507
519
|
|
|
508
|
-
|
|
520
|
+
欢迎 PR。纯 Python,零依赖,不用构建。
|
|
509
521
|
|
|
510
522
|
```bash
|
|
511
523
|
git clone https://github.com/DanOps-1/bingo-light.git
|
|
512
524
|
cd bingo-light
|
|
513
|
-
make test #
|
|
514
|
-
make test-all #
|
|
515
|
-
make lint #
|
|
525
|
+
make test # 核心测试
|
|
526
|
+
make test-all # 全部 250 个测试
|
|
527
|
+
make lint # Python 语法 + flake8 + shellcheck
|
|
516
528
|
```
|
|
517
529
|
|
|
518
|
-
|
|
530
|
+
详见 [CONTRIBUTING.md](CONTRIBUTING.md)。
|
|
519
531
|
|
|
520
|
-
##
|
|
532
|
+
## 许可证
|
|
521
533
|
|
|
522
|
-
[MIT](LICENSE)
|
|
534
|
+
[MIT](LICENSE)
|