Compare commits

..

1 Commits

3 changed files with 4 additions and 54 deletions
-42
View File
@@ -111,18 +111,6 @@ python scripts/agent_poller.py --action create-pr \
Closes #N" Closes #N"
``` ```
PR 创建后,在 Issue 下评论 PR 链接:
```bash
python scripts/agent_poller.py --action comment --issue N \
--body "PR 已创建: <PR_URL>
变更:
- <摘要>
等待 CI 通过后 merge。"
```
### 5. 等待 CI ### 5. 等待 CI
PR 创建后 CI 自动触发。用 agent_poller 监控状态: PR 创建后 CI 自动触发。用 agent_poller 监控状态:
@@ -178,33 +166,3 @@ QE-Agent 开 Issue (qe-feedback)
- **测试**:每次提交前必须确保 `python -m pytest -v` 全量通过 - **测试**:每次提交前必须确保 `python -m pytest -v` 全量通过
- **范围**:不混入与当前 Issue 无关的改动 - **范围**:不混入与当前 Issue 无关的改动
- **PR**Push 后立即创建 PRCI 通过后 mergePR 信息写入 Issue 后关闭 - **PR**Push 后立即创建 PRCI 通过后 mergePR 信息写入 Issue 后关闭
## agent_poller 命令速查
| 命令 | 用途 | 阶段 |
|------|------|------|
| `--action list` | 列出所有待处理 Issue | 1. 轮询 |
| `--action get --issue N` | 查看 Issue 详情 | 2. 分析 |
| `--action create-pr --issue N --branch X --body "..."` | 创建 PR | 4. 提 PR |
| `--action comment --issue N --body "..."` | 评论 Issue(记录 PR 链接等) | 4. 提 PR |
| `--action pr-status --pr N` | 查看 PR + CI 状态 | 5. 等 CI |
| `--action merge-pr --pr N` | Merge PR(自动检查 CI | 6. Merge |
| `--action close-issue --issue N --body "..."` | 手动关闭 Issue | 6. 关闭 |
| `--action lifecycle --issue N` | 查看 Issue 完整生命周期 | 随时 |
## 闭环完成检查清单
处理每个 Issue 时,确认以下节点全部完成:
- [ ] **分析**`agent_poller.py --action get` 理解 Issue 内容
- [ ] **分支**`git checkout -b dev/issue-N-<slug>`
- [ ] **开发**:修改功能代码 + 同步更新 UT
- [ ] **测试**`python -m pytest -v` 全量通过
- [ ] **提交**`git commit -m "fix: <描述> - Closes #N"`
- [ ] **推送**`git push origin dev/issue-N-<slug>`
- [ ] **PR**`agent_poller.py --action create-pr` 创建 PR
- [ ] **评论**`agent_poller.py --action comment` 在 Issue 下记录 PR 链接
- [ ] **CI**`agent_poller.py --action pr-status` 确认 CI 通过
- [ ] **合并**`agent_poller.py --action merge-pr` 合并 PR
- [ ] **关闭**:确认 Issue 已自动关闭,否则 `--action close-issue`
- [ ] **验证**`agent_poller.py --action lifecycle` 确认全流程完成
+2 -9
View File
@@ -33,10 +33,7 @@ def _req(method, path, data=None):
req.add_header("Content-Type", "application/json") req.add_header("Content-Type", "application/json")
try: try:
with urllib.request.urlopen(req) as resp: with urllib.request.urlopen(req) as resp:
raw = resp.read() return json.loads(resp.read())
if not raw:
return {} # Gitea merge returns 200 with empty body
return json.loads(raw)
except urllib.error.HTTPError as e: except urllib.error.HTTPError as e:
body = e.read().decode() body = e.read().decode()
print(f"API Error {e.code}: {body}", file=sys.stderr) print(f"API Error {e.code}: {body}", file=sys.stderr)
@@ -156,11 +153,7 @@ def merge_pr(pr_num):
sys.exit(1) sys.exit(1)
result = _req("POST", f"/pulls/{pr_num}/merge", {"Do": "merge"}) result = _req("POST", f"/pulls/{pr_num}/merge", {"Do": "merge"})
# Verify merge success by re-checking PR state if result.get("merged"):
pr_after = _req("GET", f"/pulls/{pr_num}")
if pr_after.get("merged"):
print(f"PR #{pr_num} merged successfully")
elif result.get("merged"):
print(f"PR #{pr_num} merged successfully") print(f"PR #{pr_num} merged successfully")
else: else:
print(f"Merge result: {result.get('message', 'unknown')}") print(f"Merge result: {result.get('message', 'unknown')}")
+2 -3
View File
@@ -26,20 +26,19 @@ case "$MODE" in
echo "" echo ""
echo "正在执行单次检查..." echo "正在执行单次检查..."
claude -p --agent agents/DEV_AGENT.md \ claude -p --agent agents/DEV_AGENT.md \
"你是 Dev-Agent检查 Gitea 所有打开的 Issue--action list),跳过纯测试相关的。对每个负责的 Issue,走完完整闭环:分析 → 分支 → 开发+UT → pytest → commit → push → create-pr → comment Issue → 等 CI → merge-pr → 关闭。" "你是 Dev-Agent检查 Gitea 所有打开的 Issue,跳过纯测试相关的,其他全部领取分析并修复,记得同步更新测试。"
;; ;;
2) 2)
echo "" echo ""
echo "启动持续轮询模式 (每 10 分钟)..." echo "启动持续轮询模式 (每 10 分钟)..."
echo "按 Ctrl+C 停止" echo "按 Ctrl+C 停止"
claude -p --agent agents/DEV_AGENT.md \ claude -p --agent agents/DEV_AGENT.md \
"你是 Dev-Agent用 loop 模式每 10 分钟检查一次 Gitea Issue--action list)。跳过纯测试相关的。每个 Issue 走完整闭环:分析→开发→push→create-pr→comment→CI→merge-pr→close。每个步骤用 agent_poller.py 对应命令。" "你是 Dev-Agent用 loop 模式每 10 分钟检查一次 Gitea 所有打开的 Issue,跳过纯测试相关的,其他全部领取处理。完成后评论进度,push 触发 CI。"
;; ;;
3) 3)
echo "" echo ""
echo "启动交互模式..." echo "启动交互模式..."
echo "进入后输入: 检查 Gitea Issues 并处理" echo "进入后输入: 检查 Gitea Issues 并处理"
echo "可用命令速查: agent_poller.py --help"
claude --agent agents/DEV_AGENT.md claude --agent agents/DEV_AGENT.md
;; ;;
*) *)