diff --git a/.aide/branches.json b/.aide/branches.json index 8bd9883..eaf742b 100644 --- a/.aide/branches.json +++ b/.aide/branches.json @@ -1,5 +1,5 @@ { - "next_number": 2, + "next_number": 3, "branches": [ { "number": 1, @@ -10,6 +10,16 @@ "task_summary": "开始任务准备: 创建环境安装 Command", "started_at": "2025-12-17T04:54:31+08:00", "status": "active" + }, + { + "number": 2, + "branch_name": "aide/002", + "source_branch": "master", + "start_commit": "be2573843758e916d4da0b4c11ed04eaa4143dde", + "task_id": "2025-12-17T05-33-04", + "task_summary": "测试任务:写一个 hello 程序", + "started_at": "2025-12-17T05:33:04+08:00", + "status": "active" } ] } diff --git a/.aide/branches.md b/.aide/branches.md index d6b059a..e57f7b6 100644 --- a/.aide/branches.md +++ b/.aide/branches.md @@ -1,5 +1,14 @@ # Git 分支概况 +## aide/002 + +- **任务**: 测试任务:写一个 hello 程序 +- **任务ID**: 2025-12-17T05-33-04 +- **源分支**: master +- **起始提交**: be25738 +- **状态**: active +- **时间**: 2025-12-17 05:33 + ## aide/001 - **任务**: 开始任务准备: 创建环境安装 Command diff --git a/.aide/flow-status.json b/.aide/flow-status.json new file mode 100644 index 0000000..f0aecc5 --- /dev/null +++ b/.aide/flow-status.json @@ -0,0 +1,75 @@ +{ + "task_id": "2025-12-17T05-33-04", + "current_phase": "finish", + "current_step": 8, + "started_at": "2025-12-17T05:33:04+08:00", + "history": [ + { + "timestamp": "2025-12-17T05:33:04+08:00", + "action": "start", + "phase": "task-optimize", + "step": 1, + "summary": "测试任务:写一个 hello 程序", + "git_commit": "356002d3d0377c11d3de2e3f16afd377c094d28a" + }, + { + "timestamp": "2025-12-17T05:33:33+08:00", + "action": "next-part", + "phase": "flow-design", + "step": 2, + "summary": "简单任务,跳过任务优化", + "git_commit": "eb089ce02d848208f271cfa1d2c7cfe831c7c06f" + }, + { + "timestamp": "2025-12-17T05:33:58+08:00", + "action": "next-part", + "phase": "impl", + "step": 3, + "summary": "简单任务,跳过流程设计", + "git_commit": "06f51ed01f04ea6cbc55b7c839a7d44582961603" + }, + { + "timestamp": "2025-12-17T05:34:46+08:00", + "action": "next-step", + "phase": "impl", + "step": 4, + "summary": "创建 hello.py 程序", + "git_commit": "01ff16417784cb976d19ac81a43bc542bce6e61b" + }, + { + "timestamp": "2025-12-17T05:35:00+08:00", + "action": "next-part", + "phase": "verify", + "step": 5, + "summary": "代码实现完成", + "git_commit": "e97781d75c2421ca6e8280bf57240b48e5599e0c" + }, + { + "timestamp": "2025-12-17T05:35:37+08:00", + "action": "next-step", + "phase": "verify", + "step": 6, + "summary": "验证程序运行正常", + "git_commit": "bac4ce699628f581bc9ae5a3fa10ff32ccf38820" + }, + { + "timestamp": "2025-12-17T05:35:51+08:00", + "action": "next-part", + "phase": "docs", + "step": 7, + "summary": "验证完成", + "git_commit": "4ac3aa186f33caf69bfe788537d5c473ffa019bf" + }, + { + "timestamp": "2025-12-17T05:38:37+08:00", + "action": "next-part", + "phase": "finish", + "step": 8, + "summary": "测试任务完成,修复验证", + "git_commit": "7f59a660b1eafa4153ade83ceffe8075131ca32d" + } + ], + "source_branch": "master", + "start_commit": "be2573843758e916d4da0b4c11ed04eaa4143dde", + "task_branch": "aide/002" +} diff --git a/.aide/flow-status.lock b/.aide/flow-status.lock deleted file mode 100755 index 9c8e1e8..0000000 --- a/.aide/flow-status.lock +++ /dev/null @@ -1 +0,0 @@ -34429 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e338817..2f5a67e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ ## 2025-12-17 +### 修复 + +**aide flow 分支切换问题修复** +- 修复 finish 阶段分支切换时 lock 文件冲突的问题 +- 修复 finish 阶段状态文件未提交导致切换失败的问题 +- 在 `BranchManager` 添加 `_cleanup_lock_file` 方法 +- 调整 `FlowTracker` 中分支合并的执行顺序(先提交再合并) + ### 新增功能 **环境安装 Commands** diff --git a/aide-program/aide/flow/tracker.py b/aide-program/aide/flow/tracker.py index f86427e..8f76166 100644 --- a/aide-program/aide/flow/tracker.py +++ b/aide-program/aide/flow/tracker.py @@ -108,14 +108,6 @@ class FlowTracker: if action == "next-part": assert to_phase is not None validator.validate_next_part(current_phase, to_phase) - - # 如果进入 finish 环节,执行分支合并 - if to_phase == "finish": - success, merge_msg = self.branch_mgr.finish_branch_merge( - task_summary=normalized_text, - ) - if not success: - output.warn(merge_msg) elif action == "back-part": assert to_phase is not None validator.validate_back_part(current_phase, to_phase) @@ -135,6 +127,18 @@ class FlowTracker: final_status = self._do_git_commit(updated, commit_msg) self.storage.save_status(final_status) + # 如果进入 finish 环节,执行分支合并(必须在提交后执行) + if action == "next-part" and to_phase == "finish": + # 再次提交状态文件(因为 save_status 更新了 git_commit hash) + self.git.add_all() + self.git.commit("[aide] finish: 更新状态文件") + + success, merge_msg = self.branch_mgr.finish_branch_merge( + task_summary=normalized_text, + ) + if not success: + output.warn(merge_msg) + if action == "next-part": output.ok(f"进入环节: {to_phase}") elif action == "back-part":