FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge pull request #105 from qiankunli/feat/safe-rebase-workflow · compforge/devloop@bde36e5 · GitHub

Commit bde36e5

Browse files
authored
Merge pull request #105 from qiankunli/feat/safe-rebase-workflow
feat: add safe resumable rebase workflow
2 parents 5301dcb + 6c044ff commit bde36e5

12 files changed

Lines changed: 563 additions & 8 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# devloop
44

5-
**A controlled PR/MR development lifecycle for AI coding agents.** This repository is a cross-CLI plugin marketplace. Its flagship plugin, `devloop`, guides Claude Code and Codex through repo entry, branch development, affected-component validation, commit/push, and PR/MR creation while keeping merge in human hands. It supports both **GitHub (PR)** and **GitLab (MR)**, selected from each repo's origin; `example` remains a placeholder for the marketplace's multi-plugin structure.
5+
**A controlled PR/MR development lifecycle for AI coding agents.** This repository is a cross-CLI plugin marketplace. Its flagship plugin, `devloop`, guides Claude Code and Codex through repo entry, branch development, affected-component validation, commit/push, PR/MR creation, and resumable conflict rebases with an exact-SHA `force-with-lease`, while keeping merge in human hands. It supports both **GitHub (PR)** and **GitLab (MR)**, selected from each repo's origin; `example` remains a placeholder for the marketplace's multi-plugin structure.
66

77
> Claude Code and Codex are supported. Design / architecture: [AGENTS.md](./AGENTS.md). Each plugin's own docs live in its directory.
88
@@ -142,7 +142,7 @@ opencode remains placeholder-only until its plugin/hook protocol is wired.
142142

143143
| Plugin | What it is | README |
144144
|--------|-----------|--------|
145-
| `devloop` | Controlled PR/MR lifecycle for AI coding: repo/branch entry, affected-component validation, commit/push/PR, live state, and execution-level guardrails (Claude + Codex; GitHub + GitLab) | [devloop/README.md](./devloop/README.md) |
145+
| `devloop` | Controlled PR/MR lifecycle for AI coding: repo/branch entry, affected-component validation, commit/push/PR, safe conflict rebase, live state, and execution-level guardrails (Claude + Codex; GitHub + GitLab) | [devloop/README.md](./devloop/README.md) |
146146
| `example` | Placeholder demonstrating the multi-plugin marketplace structure | [example/README.md](./example/README.md) |
147147

148148
## Adding a plugin

‎devloop/.claude-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devloop",
3-
"version": "0.1.52",
3+
"version": "0.1.53",
44
"description": "Dev-loop workflow, native-first rebuild: git/PR (GitHub + GitLab) + cwd-aware enter + lint/test gates + .devloop/context.json state layer auto-injected into every prompt. Built on native Claude Code events (CwdChanged / PostCompact / FileChanged / monitors).",
55
"author": {
66
"name": "qiankunli",

‎devloop/.codex-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devloop",
3-
"version": "0.1.52",
3+
"version": "0.1.53",
44
"description": "Dev-loop workflow: git/PR (GitHub + GitLab) + workspace-aware state injection + lint/test gates + execution-level hard intercepts for Claude Code and Codex.",
55
"author": {
66
"name": "qiankunli",

‎devloop/AGENTS.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ devloop/
4747
│ ├── lifecycle/ # ★pre/post commit/MR dispatch + lint/test/review handlers
4848
│ ├── forge.py # ★PullRequest/Comment/Release 中立模型 + Forge port
4949
│ ├── review_feedback.py # review finding/label 的领域 join
50-
│ └── worktree.py # branch 隔离 checkout 的创建/复用、依赖准备与清理
50+
│ ├── worktree.py # branch 隔离 checkout 的创建/复用、依赖准备与清理
51+
│ └── rebase.py # 已有 MR 分支的可恢复 rebase + 精确 SHA lease 发布
5152
├── lib/ # 技术能力:被 domain/hooks/scripts 消费
5253
│ ├── gitcmd.py git_state.py # ★统一 git runner 与 git/branch/worktree 事实
5354
│ ├── forge/ # ★GitHub/GitLab 平级 adapter + HTTP/按 repo 分发

‎devloop/README.md‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ devloop 通过两个控制杠杆落实这条生命周期:**实时状态注入*
1212

1313
## 它做什么
1414

15-
- **PR/MR 生命周期入口**`/enter` 选择 repo/branch;多 session 并发时,`--worktree <tag>` 将 branch 以隔离 checkout 形态展开,并统一处理基线、依赖准备和安全清理。`/gcam``/gcamp``/gcampr` 依次覆盖 commit、push 与创建/复用 PR/MR;新工作从目标分支建立干净基线,最终 merge 始终留给人。
15+
- **PR/MR 生命周期入口**`/enter` 选择 repo/branch;多 session 并发时,`--worktree <tag>` 将 branch 以隔离 checkout 形态展开,并统一处理基线、依赖准备和安全清理。`/gcam``/gcamp``/gcampr` 依次覆盖 commit、push 与创建/复用 PR/MR;已有 PR/MR 的冲突处理走可恢复的 `smart_rebase.sh start/continue/finish`,以 rebase 前保存的远端 SHA 做精确 `force-with-lease`新工作从目标分支建立干净基线,最终 merge 始终留给人。
1616
- **component 感知**(多代码目录仓):一个 git 仓可能有多个自带工具链、可独立 lint/test 的目录——`server/` + `cli/``packages/*``cmd/*`。devloop 按**本次改动**决定跑哪些:改了 `cli/**` 就只跑 `cli` 的 lint/test,不静默回落仓根或 `server/`;改动跨多个 component 就都跑;clean tree 从仓根发起时枚举**全部** component(绝不替你猜一个)。验证戳也按 component 记——「A 过 B 挂」不会被记成整仓已验。术语见 [`CONCEPTS.md`](./CONCEPTS.md)
1717
- **状态总线与 PR/MR 感知**:workspace/repo 的 `.devloop/` 保存当前 branch、工作区、近期 PR/MR、验证和 session 归属等结构化运行态;hook 与 monitor 持续刷新,每轮 prompt 按需注入,并自动排除在 git 提交之外。
1818
- **硬拦截**(PreToolUse deny):保护分支 commit/push、`git add -A`、直接 `git worktree add`、过期分支(PR 已 merged/closed)改文件、别的 session 占用的 checkout 上切分支或改文件(引导 worktree)、工作区根跑子项目命令、裸 `pytest`、uv 项目 `pip install`、编辑 `requirements.txt``lifecycle.pre_commit` 含 lint 时 lint 过期的裸 `git commit` gate。
@@ -35,6 +35,19 @@ lint / test 无独立 slash 命令:正常由 gcam* 的 `pre_commit` gate 自
3535

3636
gcam* 与 fix-lint / run-test 都不依赖 cwd:默认解析 cwd 所在仓库,在 workspace 根则兜底到最近活跃子项目;用 `--repo <name|path>` 显式指定,无需 `cd` 前缀。
3737

38+
已有 PR/MR 分支需要 rebase 时,使用独立事务;`finish` 只发布现有的重写历史,不需要 commit message:
39+
40+
```bash
41+
bash <PLUGIN_ROOT>/scripts/smart_rebase.sh start --repo <name|path> [--target <branch>]
42+
# 解决冲突并 git add 后,可重复 continue
43+
bash <PLUGIN_ROOT>/scripts/smart_rebase.sh continue --repo <name|path>
44+
# 跑完相关测试后安全更新原分支
45+
bash <PLUGIN_ROOT>/scripts/smart_rebase.sh finish --repo <name|path>
46+
```
47+
48+
事务可用 `status` 检查;rebase 尚未完成时可用 `abort` 恢复。远端分支若在此期间被别人更新,
49+
`finish` 会拒绝覆盖并保留事务状态供检查。
50+
3851
## 安装
3952

4053
运行时要求:**Python 3.10+**。devloop launcher 会从 PATH 自动选择首个满足版本的 `python3`

‎devloop/docs/loop.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ devloop 的两个杠杆沿循环分布:**状态总线**(软提示)覆盖
2929
| 3' | 开发后效 | `PostToolUse` | `posttool_git_refresh` | git 状态命令后按**位置感知的有效目录**刷新对应 repo 的 branch 段(**没有**编辑计数 hook:验证是否过期由 gate 现算内容指纹判,不靠工具事件累计——见 CONCEPTS.md〈验证状态〉) |
3030
| 4 | 验证 | `/lint` `/test` | `run_fixlint` / `run_tests``lifecycle.checks` | 按 component 盖 validation 戳(该 component 的 lint/test 时间 + lint 通过那刻的内容指纹) |
3131
| 5 | 提交 / PR | `/gcam` `/gcamp` `/gcampr` | `commit_flow`(PLAN banner 自陈) | 新分支 cut 自 `origin/<target>`(base 由意图定);`--files` 收敛 staging;外来提交自检;建 PR 后触发一次 `poll_pr_status` |
32+
| 5b | 在途 PR/MR rebase | `smart_rebase.sh start/continue/finish` | `domain.rebase`(worktree-local transaction) | start 在改写前保存远端 source SHA;finish 用精确 `force-with-lease`,远端移动即拒绝覆盖 |
3233
| 6 | 等人工 merge | monitors 周期轮询 | `poll_pr_status` |`pr.json` 窗口 → 当前分支派生为 in-flight,turn 注入软提示 |
3334
| 7 | merge 后下一轮 | (人工,AI 范围外) || 分支派生为 inactive,编辑被硬拦;回到第 1 拍,从最新 `origin/<target>` 切新分支 |
3435

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL