bingo-light 2.1.1 → 2.1.3
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.en.md +20 -7
- package/README.md +209 -126
- package/bingo-light +385 -11
- package/bingo_core/__init__.py +3 -1
- package/bingo_core/dep.py +1012 -0
- package/bingo_core/dep_fork.py +268 -0
- package/bingo_core/dep_npm.py +113 -0
- package/bingo_core/dep_pip.py +178 -0
- package/bingo_core/repo.py +795 -8
- package/bingo_core/setup.py +73 -17
- package/bingo_core/state.py +1 -1
- package/bingo_core/team.py +170 -0
- package/completions/bingo-light.bash +26 -3
- package/completions/bingo-light.fish +46 -1
- package/completions/bingo-light.zsh +38 -2
- package/mcp-server.py +346 -6
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
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
12
|
<br>
|
|
13
|
-
<a href="#for-ai-agents"><img src="https://img.shields.io/badge/MCP_Server-
|
|
13
|
+
<a href="#for-ai-agents"><img src="https://img.shields.io/badge/MCP_Server-49_tools-blueviolet.svg" alt="MCP: 49 tools"></a>
|
|
14
14
|
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.8+-3776ab.svg" alt="Python 3.8+"></a>
|
|
15
15
|
<img src="https://img.shields.io/badge/Dependencies-Zero-brightgreen.svg" alt="Zero deps">
|
|
16
16
|
<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>
|
|
@@ -25,7 +25,7 @@ GitHub's "Sync fork" button breaks the moment you have customizations. `git reba
|
|
|
25
25
|
|
|
26
26
|
Your patches live as a clean, named stack on top of upstream. Syncing is `bingo-light sync`. Conflicts get remembered so you never solve the same one twice. And if something goes sideways, `bingo-light undo` puts everything back in one second.
|
|
27
27
|
|
|
28
|
-
Every command speaks JSON. The built-in MCP server gives AI agents
|
|
28
|
+
Every command speaks JSON. The built-in MCP server gives AI agents 49 tools to manage your fork autonomously -- from init through conflict resolution. No human in the loop required.
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
@@ -69,6 +69,12 @@ That's it. Three commands and your fork stays in sync forever.
|
|
|
69
69
|
|
|
70
70
|
> The AI calls `conflict-analyze --json`, reads the structured ours/theirs data, writes the merged file, and the rebase continues. No human needed.
|
|
71
71
|
|
|
72
|
+
During a rebase, `conflict-analyze` also returns:
|
|
73
|
+
- **`patch_intent`** — patch name, subject, full commit message, original SHA, original diff, metadata (reason/tags/upstream_pr/status/owner), and position in the patch stack.
|
|
74
|
+
- **`verify`** — configured `test.command` plus per-file syntax/parse commands by extension (`.py/.json/.yml/.yaml/.toml/.sh`).
|
|
75
|
+
|
|
76
|
+
`conflict-resolve --verify` (CLI) or `verify: true` (MCP) runs `test.command` after the final `git rebase --continue`; the result is attached as `verify_result`.
|
|
77
|
+
|
|
72
78
|
---
|
|
73
79
|
|
|
74
80
|
## Key Features
|
|
@@ -93,13 +99,14 @@ That's it. Three commands and your fork stays in sync forever.
|
|
|
93
99
|
|
|
94
100
|
### For AI Agents
|
|
95
101
|
|
|
96
|
-
- :electric_plug: **MCP server (
|
|
102
|
+
- :electric_plug: **MCP server (49 tools)** -- full fork management from init through conflict resolution.
|
|
97
103
|
- :bar_chart: **`--json` on everything** -- every command returns structured JSON. Parse, don't scrape.
|
|
98
104
|
- :mute: **`--yes` flag** -- fully non-interactive. No TTY required. No prompts. Ever.
|
|
99
105
|
- :gear: **Auto-detect non-TTY** -- pipes and subprocesses trigger non-interactive mode automatically.
|
|
100
106
|
- :memo: **`BINGO_DESCRIPTION` env var** -- set patch descriptions without stdin.
|
|
101
107
|
- :mag: **`conflict-analyze --json`** -- structured conflict data: file, ours, theirs, resolution hints.
|
|
102
108
|
- :white_check_mark: **`conflict-resolve`** -- write resolved content via MCP, auto-stage, continue rebase. Zero manual intervention.
|
|
109
|
+
- :package: **Dependency patching** -- `dep patch/apply/sync` for npm/pip packages. Patches survive `npm install`.
|
|
103
110
|
- :satellite: **Advisor agent** -- `contrib/agent.py` monitors drift, analyzes risk, auto-syncs when safe.
|
|
104
111
|
|
|
105
112
|
---
|
|
@@ -199,7 +206,7 @@ make install && bingo-light setup
|
|
|
199
206
|
|
|
200
207
|
## For AI Agents
|
|
201
208
|
|
|
202
|
-
bingo-light was designed from day one for AI agents. Every command speaks JSON. The MCP server exposes
|
|
209
|
+
bingo-light was designed from day one for AI agents. Every command speaks JSON. The MCP server exposes 49 tools covering the full lifecycle from `init` to `conflict-resolve`. Non-interactive mode is the default when stdin is not a TTY.
|
|
203
210
|
|
|
204
211
|
### MCP setup -- Claude Code
|
|
205
212
|
|
|
@@ -233,7 +240,7 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
233
240
|
|
|
234
241
|
**Any MCP client** (VS Code Copilot, Cursor, custom agents): connect via stdio to `python3 mcp-server.py`.
|
|
235
242
|
|
|
236
|
-
###
|
|
243
|
+
### 49 MCP Tools
|
|
237
244
|
|
|
238
245
|
| Tool | Purpose |
|
|
239
246
|
|------|---------|
|
|
@@ -375,6 +382,12 @@ bingo-light patch meta <name> [key] [value] Get/set patch metadata
|
|
|
375
382
|
bingo-light conflict-analyze Structured conflict data for AI
|
|
376
383
|
bingo-light config get|set|list [key] [val] Manage configuration
|
|
377
384
|
bingo-light test Run configured test suite
|
|
385
|
+
bingo-light dep patch <package> [name] Patch a modified npm/pip dependency
|
|
386
|
+
bingo-light dep apply [package] Re-apply dependency patches after install
|
|
387
|
+
bingo-light dep sync Re-apply after update + detect conflicts
|
|
388
|
+
bingo-light dep status Dependency patch health check
|
|
389
|
+
bingo-light dep list List all dependency patches
|
|
390
|
+
bingo-light dep drop <package> [patch] Remove a dependency patch
|
|
378
391
|
bingo-light workspace init|add|status|sync Multi-repo management
|
|
379
392
|
bingo-light auto-sync Generate GitHub Actions workflow
|
|
380
393
|
bingo-light version Print version
|
|
@@ -417,7 +430,7 @@ StGit (649 stars) manages patch stacks but has no AI integration, no MCP server,
|
|
|
417
430
|
| Handles customizations | **Yes** | **No** | Manual | Manual | Manual |
|
|
418
431
|
| Conflict memory (rerere) | **Auto** | No | Manual | No | No |
|
|
419
432
|
| Conflict prediction | **Yes** | No | No | No | No |
|
|
420
|
-
| AI / MCP integration | **
|
|
433
|
+
| AI / MCP integration | **49 tools** | No | No | No | No |
|
|
421
434
|
| JSON output | **All commands** | No | No | No | No |
|
|
422
435
|
| Non-interactive mode | **Native** | No | Partial | Partial | Partial |
|
|
423
436
|
| Undo sync | **One command** | No | git reflog | Manual | Manual |
|
|
@@ -483,7 +496,7 @@ Yes. bingo-light uses standard git operations (fetch, rebase, push). It works wi
|
|
|
483
496
|
```
|
|
484
497
|
bingo-light CLI tool (Python 3, zero deps)
|
|
485
498
|
bingo_core/ Core library package (all business logic)
|
|
486
|
-
mcp-server.py MCP server (zero-dep Python 3,
|
|
499
|
+
mcp-server.py MCP server (zero-dep Python 3, 49 tools, JSON-RPC 2.0)
|
|
487
500
|
contrib/agent.py Advisor agent (monitors drift, auto-syncs when safe)
|
|
488
501
|
contrib/tui.py Terminal dashboard (curses TUI, real-time monitoring)
|
|
489
502
|
install.sh Installer (--yes for CI, --help for options)
|
package/README.md
CHANGED
|
@@ -2,38 +2,43 @@
|
|
|
2
2
|
<br>
|
|
3
3
|
<img src="docs/logo.svg" alt="bingo-light logo" width="200">
|
|
4
4
|
<br><br>
|
|
5
|
-
<strong
|
|
5
|
+
<strong>让 AI 接管你的 Fork 维护。<br>同步、冲突、补丁管理 — 全自动。</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
|
-
<a href="#mcp-服务器"><img src="https://img.shields.io/badge/MCP_Server-
|
|
12
|
+
<a href="#mcp-服务器"><img src="https://img.shields.io/badge/MCP_Server-49_tools-blueviolet.svg" alt="MCP: 49 tools"></a>
|
|
13
13
|
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.8+-3776ab.svg" alt="Python 3.8+"></a>
|
|
14
14
|
<img src="https://img.shields.io/badge/Dependencies-Zero-brightgreen.svg" alt="Zero deps">
|
|
15
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>
|
|
16
16
|
<br><br>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
|
-
GitHub 的 "Sync fork"
|
|
19
|
+
Fork 维护是个苦差事 — 上游一更新,你的定制化改动就得手动 rebase。GitHub 的 "Sync fork" 按钮碰到自定义 commit 直接废了。手动操作六步起步,冲突反复解,搞砸了还得从 reflog 里捞。
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
**装完 bingo-light,跟你的 AI 说一句"帮我同步 Fork",剩下的它全搞定。**
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
内置 MCP 服务器 35 个工具,AI 自主完成:拉上游、rebase 补丁、分析冲突、写合并代码、继续 rebase。冲突解过一次自动记住(rerere),下次不再问。搞砸了 `undo` 秒回。
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
> [!TIP]
|
|
26
|
+
> **不想读文档?** 把这段丢给你的 AI,让它帮你装:
|
|
27
|
+
>
|
|
28
|
+
> ```
|
|
29
|
+
> 帮我安装 bingo-light 并配置好 MCP,参考:
|
|
30
|
+
> https://raw.githubusercontent.com/DanOps-1/bingo-light/main/docs/ai-setup.md
|
|
31
|
+
> ```
|
|
26
32
|
|
|
27
33
|
---
|
|
28
34
|
|
|
29
35
|
## 目录
|
|
30
36
|
|
|
31
|
-
- [快速开始](#快速开始)
|
|
32
|
-
- [演示](#演示)
|
|
33
37
|
- [安装](#安装)
|
|
38
|
+
- [演示](#演示)
|
|
34
39
|
- [功能特性](#功能特性)
|
|
40
|
+
- [MCP 服务器(35 工具)](#mcp-服务器)
|
|
35
41
|
- [工作原理](#工作原理)
|
|
36
|
-
- [MCP 服务器](#mcp-服务器)
|
|
37
42
|
- [命令参考](#命令参考)
|
|
38
43
|
- [集成指南](#集成指南)
|
|
39
44
|
- [配置](#配置)
|
|
@@ -41,53 +46,97 @@ GitHub 的 "Sync fork" 按钮?你一改代码它就废了。手动 `git rebase
|
|
|
41
46
|
- [与其他方案对比](#与其他方案对比)
|
|
42
47
|
- [项目生态](#项目生态)
|
|
43
48
|
- [参与贡献](#参与贡献)
|
|
44
|
-
- [许可证](#许可证)
|
|
45
49
|
|
|
46
50
|
---
|
|
47
51
|
|
|
48
|
-
##
|
|
52
|
+
## 安装
|
|
53
|
+
|
|
54
|
+
### 让 AI 帮你装(推荐)
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
把下面这段丢给你的 AI(Claude Code、Cursor、Windsurf 等),它会自动装好并配好 MCP + Skill:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
帮我安装并配置 bingo-light,参考这个文档:
|
|
60
|
+
https://raw.githubusercontent.com/DanOps-1/bingo-light/main/docs/ai-setup.md
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 自己装
|
|
64
|
+
|
|
65
|
+
| 方式 | 命令 |
|
|
66
|
+
|------|------|
|
|
67
|
+
| **pip** | `pip install bingo-light && bingo-light setup` |
|
|
68
|
+
| **npm** | `npm install -g bingo-light && bingo-light setup` |
|
|
69
|
+
| **npx** | `npx bingo-light setup` |
|
|
70
|
+
| **Homebrew** | `brew install DanOps-1/tap/bingo-light && bingo-light setup` |
|
|
71
|
+
|
|
72
|
+
<details>
|
|
73
|
+
<summary><b>更多安装方式</b>(Docker / Shell / 源码)</summary>
|
|
55
74
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
75
|
+
**Docker**
|
|
76
|
+
```bash
|
|
77
|
+
docker run --rm -v "$PWD:/repo" -w /repo ghcr.io/danops-1/bingo-light status
|
|
78
|
+
docker run --rm -i -v "$PWD:/repo" -w /repo ghcr.io/danops-1/bingo-light mcp-server.py
|
|
79
|
+
```
|
|
59
80
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
bingo-light
|
|
81
|
+
**Shell 一键安装**
|
|
82
|
+
```bash
|
|
83
|
+
curl -fsSL https://raw.githubusercontent.com/DanOps-1/bingo-light/main/install.sh | sh
|
|
84
|
+
```
|
|
63
85
|
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
**从源码**
|
|
87
|
+
```bash
|
|
88
|
+
git clone https://github.com/DanOps-1/bingo-light.git
|
|
89
|
+
cd bingo-light && make install && bingo-light setup
|
|
66
90
|
```
|
|
67
91
|
|
|
68
|
-
|
|
92
|
+
</details>
|
|
93
|
+
|
|
94
|
+
> [!NOTE]
|
|
95
|
+
> **依赖:** Python 3.8+ / git 2.20+,没了。零 pip 依赖。
|
|
96
|
+
>
|
|
97
|
+
> MCP 客户端可直接用 npx:`{"command": "npx", "args": ["-y", "bingo-light-mcp"]}`
|
|
98
|
+
|
|
99
|
+
---
|
|
69
100
|
|
|
70
101
|
## 演示
|
|
71
102
|
|
|
72
|
-
|
|
103
|
+
<table>
|
|
104
|
+
<tr>
|
|
105
|
+
<td width="50%">
|
|
106
|
+
|
|
107
|
+
### 日常操作
|
|
108
|
+
|
|
109
|
+
初始化 → 建补丁 → 同步上游
|
|
73
110
|
|
|
74
111
|
<p align="center">
|
|
75
|
-
<img src="docs/demo.svg" alt="bingo-light 基本演示" width="
|
|
112
|
+
<img src="docs/demo.svg" alt="bingo-light 基本演示" width="100%">
|
|
76
113
|
</p>
|
|
77
114
|
|
|
78
|
-
|
|
115
|
+
</td>
|
|
116
|
+
<td width="50%">
|
|
117
|
+
|
|
118
|
+
### 冲突解决
|
|
119
|
+
|
|
120
|
+
同步 → AI 分析 → 自动修复
|
|
79
121
|
|
|
80
122
|
<p align="center">
|
|
81
|
-
<img src="docs/demo-conflict.svg" alt="bingo-light 冲突解决演示" width="
|
|
123
|
+
<img src="docs/demo-conflict.svg" alt="bingo-light 冲突解决演示" width="100%">
|
|
82
124
|
</p>
|
|
83
125
|
|
|
84
|
-
>
|
|
126
|
+
</td>
|
|
127
|
+
</tr>
|
|
128
|
+
</table>
|
|
85
129
|
|
|
86
|
-
|
|
130
|
+
> [!NOTE]
|
|
131
|
+
> AI 调 `conflict-analyze --json` 拿到双方代码和解决提示,写好合并结果,rebase 自动继续。全程零人工。
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### `--json` 输出:AI 直接消费
|
|
136
|
+
|
|
137
|
+
<details open>
|
|
138
|
+
<summary><b>Fork 状态</b> — <code>bingo-light status --json</code></summary>
|
|
87
139
|
|
|
88
|
-
```
|
|
89
|
-
$ bingo-light status --json
|
|
90
|
-
```
|
|
91
140
|
```json
|
|
92
141
|
{
|
|
93
142
|
"ok": true,
|
|
@@ -102,11 +151,11 @@ $ bingo-light status --json
|
|
|
102
151
|
}
|
|
103
152
|
```
|
|
104
153
|
|
|
105
|
-
|
|
154
|
+
</details>
|
|
155
|
+
|
|
156
|
+
<details>
|
|
157
|
+
<summary><b>冲突分析</b> — <code>bingo-light conflict-analyze --json</code></summary>
|
|
106
158
|
|
|
107
|
-
```
|
|
108
|
-
$ bingo-light conflict-analyze --json
|
|
109
|
-
```
|
|
110
159
|
```json
|
|
111
160
|
{
|
|
112
161
|
"rebase_in_progress": true,
|
|
@@ -119,96 +168,140 @@ $ bingo-light conflict-analyze --json
|
|
|
119
168
|
"theirs": "... 你的补丁版本 ...",
|
|
120
169
|
"hint": "上游重构了调度器核心;补丁需要适配新结构。"
|
|
121
170
|
}
|
|
122
|
-
]
|
|
171
|
+
],
|
|
172
|
+
"patch_intent": {
|
|
173
|
+
"name": "custom-scheduler",
|
|
174
|
+
"subject": "...",
|
|
175
|
+
"message": "完整 commit 消息",
|
|
176
|
+
"original_sha": "a1b2c3d...",
|
|
177
|
+
"original_diff": "diff --git ...",
|
|
178
|
+
"meta": {"reason": "...", "tags": [], "status": "permanent"},
|
|
179
|
+
"stack_position": {"index": 3, "total": 7}
|
|
180
|
+
},
|
|
181
|
+
"verify": {
|
|
182
|
+
"test_command": "make test",
|
|
183
|
+
"file_hints": [
|
|
184
|
+
{"file": "kernel/sched/core.c", "command": "bash -n ...", "kind": "syntax"}
|
|
185
|
+
]
|
|
186
|
+
}
|
|
123
187
|
}
|
|
124
188
|
```
|
|
125
189
|
|
|
126
|
-
|
|
190
|
+
`conflict-analyze` 在 rebase 中额外附带 `patch_intent`(补丁意图:原始 commit、diff、metadata、栈位置)与 `verify`(配置的 `test.command` + 按扩展名的逐文件校验命令)。`conflict-resolve --verify` 在最终 `git rebase --continue` 完成后自动跑 `test.command`,结果挂在 `verify_result` 字段。
|
|
127
191
|
|
|
128
|
-
|
|
192
|
+
</details>
|
|
129
193
|
|
|
130
|
-
|
|
194
|
+
<details>
|
|
195
|
+
<summary><b>AI 全自动解冲突</b> — Claude Code 实际工作流</summary>
|
|
131
196
|
|
|
132
|
-
```bash
|
|
133
|
-
pip install bingo-light # 或: pipx install bingo-light
|
|
134
|
-
bingo-light setup # 选配 AI 工具
|
|
135
197
|
```
|
|
198
|
+
你: "同步上游,冲突帮我修了。"
|
|
136
199
|
|
|
137
|
-
|
|
200
|
+
Claude Code:
|
|
201
|
+
1. bingo_status(cwd) → 落后 47 commit,risk: core.c
|
|
202
|
+
2. bingo_sync(cwd, dry_run) → 预判 1 个冲突
|
|
203
|
+
3. bingo_sync(cwd) → rebase 卡在冲突
|
|
204
|
+
4. bingo_conflict_analyze() → 拿到双方代码 + 提示
|
|
205
|
+
5. 读两边,写合并结果
|
|
206
|
+
6. bingo_conflict_resolve(file) → 搞定
|
|
207
|
+
7. bingo_status(cwd) → 0 落后,补丁干净 ✓
|
|
208
|
+
```
|
|
138
209
|
|
|
139
|
-
|
|
140
|
-
npm install -g bingo-light # 全局安装
|
|
141
|
-
bingo-light setup
|
|
210
|
+
</details>
|
|
142
211
|
|
|
143
|
-
|
|
144
|
-
|
|
212
|
+
### 交互式 Setup
|
|
213
|
+
|
|
214
|
+
```console
|
|
215
|
+
$ bingo-light setup
|
|
216
|
+
|
|
217
|
+
◆ bingo-light setup v2.x.x
|
|
218
|
+
│
|
|
219
|
+
◆ MCP Server
|
|
220
|
+
│ Connect bingo-light tools to your AI coding assistants
|
|
221
|
+
│
|
|
222
|
+
│ › ■ Claude Code ~/.claude/settings.json
|
|
223
|
+
│ ■ Cursor ~/.cursor/mcp.json
|
|
224
|
+
│ □ Windsurf (not detected)
|
|
225
|
+
│ ■ VS Code / Copilot ~/.vscode/mcp.json
|
|
226
|
+
│
|
|
227
|
+
◆ Skills / Custom Instructions
|
|
228
|
+
│ Teach your AI how to use bingo-light
|
|
229
|
+
│
|
|
230
|
+
│ ■ Claude Code ~/.claude/commands/bingo.md
|
|
231
|
+
│ ■ Continue ~/.continue/rules/bingo.md
|
|
232
|
+
│
|
|
233
|
+
└ 5 MCP + 2 skill(s) configured — ready to go!
|
|
145
234
|
```
|
|
146
235
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
{"command": "npx", "args": ["-y", "bingo-light-mcp"]}
|
|
150
|
-
```
|
|
236
|
+
> [!TIP]
|
|
237
|
+
> 支持 10 个 AI 工具的 MCP 配置 + 6 个平台的 Skill 安装。方向键多选,一次配完。
|
|
151
238
|
|
|
152
|
-
|
|
239
|
+
## AI 如何使用 bingo-light
|
|
153
240
|
|
|
154
|
-
|
|
155
|
-
brew install DanOps-1/tap/bingo-light
|
|
156
|
-
bingo-light setup
|
|
157
|
-
```
|
|
241
|
+
这才是重点。bingo-light 是为 AI agent 设计的 Fork 维护工具。
|
|
158
242
|
|
|
159
|
-
###
|
|
243
|
+
### AI 拿到什么
|
|
160
244
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
245
|
+
| | 能力 | 说明 |
|
|
246
|
+
|---|------|------|
|
|
247
|
+
| 🔌 | **MCP 服务器** | 35 个工具,AI 直接调用,从 init 到冲突解决全链路 |
|
|
248
|
+
| 📊 | **结构化输出** | 所有命令 `--json` 输出,AI 直接 parse |
|
|
249
|
+
| 🤖 | **零交互** | `--yes` + 非 TTY 自适应,不会卡在确认提示 |
|
|
250
|
+
| 🔍 | **冲突分析** | `conflict-analyze` 返回双方代码 + AI 可执行的解决提示 |
|
|
251
|
+
| ✏️ | **冲突解决** | `conflict-resolve` 直接写入合并代码,自动 stage + 继续 rebase |
|
|
252
|
+
| 🧠 | **冲突记忆** | rerere 自动记住解法,同样冲突不用 AI 再解第二次 |
|
|
253
|
+
| 📋 | **Skill / 指令** | `/bingo` 教 AI 整套工作流,不用你写 prompt |
|
|
254
|
+
| 📦 | **依赖补丁** | `dep patch/apply/sync` — npm/pip 包改了不怕 install 覆盖 |
|
|
255
|
+
| 🔄 | **Advisor 代理** | `contrib/agent.py` 后台监控漂移,安全时自动同步 |
|
|
164
256
|
|
|
165
|
-
|
|
166
|
-
docker run --rm -i -v "$PWD:/repo" -w /repo ghcr.io/danops-1/bingo-light mcp-server.py
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Shell 安装器
|
|
257
|
+
### AI 实际工作流
|
|
170
258
|
|
|
171
|
-
|
|
172
|
-
curl -fsSL https://raw.githubusercontent.com/DanOps-1/bingo-light/main/install.sh | sh
|
|
259
|
+
你说一句 **"同步上游"**,AI 自己跑完整个流程:
|
|
173
260
|
|
|
174
|
-
|
|
175
|
-
|
|
261
|
+
```
|
|
262
|
+
bingo_status() → 落后 47 commit,risk: core.c
|
|
263
|
+
bingo_sync(dry_run=true) → 预判 1 个冲突
|
|
264
|
+
bingo_sync() → rebase 卡在冲突
|
|
265
|
+
bingo_conflict_analyze() → 拿到 ours/theirs + hint
|
|
266
|
+
→ AI 读两边代码,写合并结果
|
|
267
|
+
bingo_conflict_resolve() → 写入、stage、rebase 继续
|
|
268
|
+
bingo_status() → 0 落后,补丁干净 ✓
|
|
176
269
|
```
|
|
177
270
|
|
|
178
|
-
|
|
271
|
+
> [!IMPORTANT]
|
|
272
|
+
> **你不需要理解 rebase、rerere、tracking branch 这些概念。** AI 全部处理。你只需要装好工具,告诉 AI 你想干嘛。
|
|
179
273
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
make install && bingo-light setup
|
|
184
|
-
```
|
|
274
|
+
### 支持哪些 AI 工具
|
|
275
|
+
|
|
276
|
+
`bingo-light setup` 一键配好 MCP + Skill:
|
|
185
277
|
|
|
186
|
-
|
|
278
|
+
| AI 工具 | MCP | Skill |
|
|
279
|
+
|---------|:---:|:-----:|
|
|
280
|
+
| Claude Code | ✅ | ✅ |
|
|
281
|
+
| Cursor | ✅ | — |
|
|
282
|
+
| Windsurf | ✅ | ✅ |
|
|
283
|
+
| VS Code / Copilot | ✅ | — |
|
|
284
|
+
| Cline | ✅ | ✅ |
|
|
285
|
+
| Roo Code | ✅ | ✅ |
|
|
286
|
+
| Zed | ✅ | — |
|
|
287
|
+
| Gemini CLI | ✅ | ✅ |
|
|
288
|
+
| Continue | — | ✅ |
|
|
289
|
+
| Amazon Q | ✅ | — |
|
|
187
290
|
|
|
188
|
-
|
|
291
|
+
---
|
|
189
292
|
|
|
190
|
-
|
|
293
|
+
## 人也能用
|
|
191
294
|
|
|
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` 自动监控、分析、安全时自动同步 |
|
|
295
|
+
不用 AI 也完全没问题。同一套命令,人跑和 AI 跑效果一样。
|
|
202
296
|
|
|
203
|
-
|
|
297
|
+
<details>
|
|
298
|
+
<summary><b>人类功能一览</b></summary>
|
|
204
299
|
|
|
205
300
|
| 功能 | 说明 |
|
|
206
301
|
|------|------|
|
|
207
|
-
| **零依赖** | Python 3 + git,一行装完 |
|
|
208
|
-
| **命名补丁** | 每个改动是独立的、有名字的 commit |
|
|
209
302
|
| **一键同步** | `bingo-light sync`,补丁自动 rebase 到最新上游 |
|
|
303
|
+
| **命名补丁** | 每个改动是独立的、有名字的 commit |
|
|
210
304
|
| **先试后跑** | `sync --dry-run` 临时分支预演,不碰真代码 |
|
|
211
|
-
| **冲突记忆** | rerere 自动开,解一次就记住,再也不问 |
|
|
212
305
|
| **秒级撤销** | `bingo-light undo` 恢复同步前状态 |
|
|
213
306
|
| **冲突预警** | `status` 提前告诉你哪些文件会出事 |
|
|
214
307
|
| **自检修复** | `doctor` 全面体检 + 试跑 rebase |
|
|
@@ -218,9 +311,10 @@ make install && bingo-light setup
|
|
|
218
311
|
| **多仓管理** | `workspace` 统一管所有 Fork |
|
|
219
312
|
| **补全** | bash / zsh / fish |
|
|
220
313
|
| **通知推送** | Discord、Slack、Webhook,事件触发 |
|
|
221
|
-
| **补丁元数据** | 标签、原因、过期时间、关联上游 PR |
|
|
222
314
|
| **测试联动** | 同步后自动跑测试,挂了自动回滚 |
|
|
223
315
|
|
|
316
|
+
</details>
|
|
317
|
+
|
|
224
318
|
## 工作原理
|
|
225
319
|
|
|
226
320
|
```
|
|
@@ -250,7 +344,7 @@ make install && bingo-light setup
|
|
|
250
344
|
|
|
251
345
|
## MCP 服务器
|
|
252
346
|
|
|
253
|
-
`mcp-server.py`,纯 Python 3,零依赖,stdio 传输,
|
|
347
|
+
`mcp-server.py`,纯 Python 3,零依赖,stdio 传输,35 个工具,JSON-RPC 2.0。
|
|
254
348
|
|
|
255
349
|
运行 `bingo-light setup` 自动配置,或手动添加:
|
|
256
350
|
|
|
@@ -339,6 +433,12 @@ bingo-light conflict-analyze 分析 rebase 冲突
|
|
|
339
433
|
bingo-light config get|set|list [key] [val] 管理配置
|
|
340
434
|
bingo-light history 详细同步历史 + 映射
|
|
341
435
|
bingo-light test 运行测试套件
|
|
436
|
+
bingo-light dep patch <package> [name] 补丁 npm/pip 依赖
|
|
437
|
+
bingo-light dep apply [package] 重新应用依赖补丁
|
|
438
|
+
bingo-light dep sync 更新后重新应用 + 冲突检测
|
|
439
|
+
bingo-light dep status 依赖补丁健康状态
|
|
440
|
+
bingo-light dep list 列出所有依赖补丁
|
|
441
|
+
bingo-light dep drop <package> [patch] 删除依赖补丁
|
|
342
442
|
bingo-light workspace init|add|status|sync 多仓库管理
|
|
343
443
|
bingo-light auto-sync 生成 GitHub Actions 工作流
|
|
344
444
|
bingo-light version 打印版本
|
|
@@ -349,32 +449,14 @@ bingo-light help 打印帮助
|
|
|
349
449
|
|
|
350
450
|
## 集成指南
|
|
351
451
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
MCP
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
你: "同步上游,冲突帮我修了。"
|
|
452
|
+
| 集成方式 | 适用场景 | 示例 |
|
|
453
|
+
|---------|---------|------|
|
|
454
|
+
| **MCP** (49 tools) | Claude Code / Cursor / Windsurf 等 | `bingo-light setup` 自动配 |
|
|
455
|
+
| **CLI `--json`** | 任何能跑 shell 的 AI | `bingo-light sync --json --yes` |
|
|
456
|
+
| **Skill** | Claude Code / Continue / Gemini 等 | `/bingo` 教 AI 用法 |
|
|
358
457
|
|
|
359
|
-
|
|
360
|
-
|
|
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 落后,补丁干净
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
### Aider / CLI 代理
|
|
370
|
-
|
|
371
|
-
```bash
|
|
372
|
-
bingo-light status --json # 解析 Fork 状态
|
|
373
|
-
bingo-light sync --yes # 非交互同步
|
|
374
|
-
bingo-light conflict-analyze --json # 结构化冲突数据
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### 自定义 Python 代理
|
|
458
|
+
<details>
|
|
459
|
+
<summary><b>自定义 Python 代理</b></summary>
|
|
378
460
|
|
|
379
461
|
```python
|
|
380
462
|
import subprocess, json
|
|
@@ -393,9 +475,10 @@ if status["behind"] > 0:
|
|
|
393
475
|
analysis = bingo("conflict-analyze")
|
|
394
476
|
for c in analysis["conflicts"]:
|
|
395
477
|
resolved = my_llm_resolve(c["ours"], c["theirs"], c["hint"])
|
|
396
|
-
# 通过 CLI 或 MCP 写入解决内容
|
|
397
478
|
```
|
|
398
479
|
|
|
480
|
+
</details>
|
|
481
|
+
|
|
399
482
|
## 配置
|
|
400
483
|
|
|
401
484
|
配置存在 `.bingolight`(git-config 格式),自动排除在版本控制外。
|
|
@@ -494,7 +577,7 @@ StGit 管栈但没 AI 集成、没 MCP、没 JSON 输出、没冲突预测。qui
|
|
|
494
577
|
| 处理定制化改动 | **有** | **不行** | 手动 | 手动 | 手动 |
|
|
495
578
|
| 冲突记忆 (rerere) | **自动** | 无 | 需手动启用 | 无 | 无 |
|
|
496
579
|
| 冲突预测 | **有** | 无 | 无 | 无 | 无 |
|
|
497
|
-
| AI/MCP 集成 | **
|
|
580
|
+
| AI/MCP 集成 | **35 个工具** | 无 | 无 | 无 | 无 |
|
|
498
581
|
| JSON 输出 | **所有命令** | 无 | 无 | 无 | 无 |
|
|
499
582
|
| 非交互模式 | **原生支持** | 无 | 部分 | 部分 | 部分 |
|
|
500
583
|
| 撤销同步 | **一条命令** | 无 | git reflog | 手动 | 手动 |
|
|
@@ -505,7 +588,7 @@ StGit 管栈但没 AI 集成、没 MCP、没 JSON 输出、没冲突预测。qui
|
|
|
505
588
|
```
|
|
506
589
|
bingo-light CLI 入口(Python 3,零依赖)
|
|
507
590
|
bingo_core/ 核心库包(全部业务逻辑)
|
|
508
|
-
mcp-server.py MCP 服务器(零依赖 Python 3,
|
|
591
|
+
mcp-server.py MCP 服务器(零依赖 Python 3,35 个工具)
|
|
509
592
|
contrib/agent.py Advisor 代理(监控 + 分析 + 安全时自动同步)
|
|
510
593
|
contrib/tui.py 终端面板(curses TUI)
|
|
511
594
|
install.sh 安装器(--yes 支持 CI,--help 查看选项)
|