diff --git a/.aide/branches.json b/.aide/branches.json index eeb0fa7..22fc4ad 100644 --- a/.aide/branches.json +++ b/.aide/branches.json @@ -1,5 +1,5 @@ { - "next_number": 22, + "next_number": 23, "branches": [ { "number": 1, @@ -246,6 +246,18 @@ "status": "finished", "end_commit": "d93eecca44169cf88d0d1397dcf80e507487d1c0", "finished_at": "2025-12-19T04:25:16+08:00" + }, + { + "number": 22, + "branch_name": "aide/022", + "source_branch": "master", + "start_commit": "af40327146d6be0781bb8f9ccdcaf8b2ce216455", + "task_id": "2025-12-19T04-37-00", + "task_summary": "开始任务准备: 调整 aide 体系的 finish 清理、提交信息和 decide 界面", + "started_at": "2025-12-19T04:37:00+08:00", + "status": "finished", + "end_commit": "76026e4b62996b667b2f788a2cf6e34cc79cebfb", + "finished_at": "2025-12-19T04:50:04+08:00" } ] } diff --git a/.aide/branches.md b/.aide/branches.md index ad1bf39..93d78fe 100644 --- a/.aide/branches.md +++ b/.aide/branches.md @@ -1,5 +1,16 @@ # Git 分支概况 +## aide/022 + +- **任务**: 开始任务准备: 调整 aide 体系的 finish 清理、提交信息和 decide 界面 +- **任务ID**: 2025-12-19T04-37-00 +- **源分支**: master +- **起始提交**: af40327 +- **结束提交**: 76026e4 +- **状态**: finished +- **起始时间**: 2025-12-19 04:37 +- **结束时间**: 2025-12-19 04:50 + ## aide/021 - **任务**: 开始任务准备: 将任务计划文件清理功能从 command/run 迁移到 aide diff --git a/.aide/logs/2025-12-19T04-37-00-status.json b/.aide/logs/2025-12-19T04-37-00-status.json new file mode 100644 index 0000000..a123373 --- /dev/null +++ b/.aide/logs/2025-12-19T04-37-00-status.json @@ -0,0 +1,139 @@ +{ + "task_id": "2025-12-19T04-37-00", + "current_phase": "finish", + "current_step": 16, + "started_at": "2025-12-19T04:37:00+08:00", + "history": [ + { + "timestamp": "2025-12-19T04:37:00+08:00", + "action": "start", + "phase": "task-optimize", + "step": 1, + "summary": "开始任务准备: 调整 aide 体系的 finish 清理、提交信息和 decide 界面", + "git_commit": "18e06ff3d19999097c915c0af67e75dec95a5260" + }, + { + "timestamp": "2025-12-19T04:39:17+08:00", + "action": "next-step", + "phase": "task-optimize", + "step": 2, + "summary": "任务分析完成,识别出 5 个需要修改的文件", + "git_commit": "caf4cb96664ed21ea90662e81530d2524a5aa805" + }, + { + "timestamp": "2025-12-19T04:42:45+08:00", + "action": "next-step", + "phase": "task-optimize", + "step": 3, + "summary": "任务细则已确认", + "git_commit": "40edc8ca26b7e4632681693cef14e569f0a30a84" + }, + { + "timestamp": "2025-12-19T04:42:58+08:00", + "action": "next-part", + "phase": "flow-design", + "step": 4, + "summary": "进入流程设计环节", + "git_commit": "ef0b2a020e1fac1faf5a4a625a703fd1fc2291ff" + }, + { + "timestamp": "2025-12-19T04:43:45+08:00", + "action": "next-step", + "phase": "flow-design", + "step": 5, + "summary": "流程图设计完成", + "git_commit": "a17521ba8a3a3dc777494f2c71e8dd1f5245a3da" + }, + { + "timestamp": "2025-12-19T04:43:59+08:00", + "action": "next-part", + "phase": "impl", + "step": 6, + "summary": "流程设计完成,进入实现环节", + "git_commit": "d2d5155c6e72e6a4ef7aafc6ea28ba29dc4f8aa4" + }, + { + "timestamp": "2025-12-19T04:45:09+08:00", + "action": "next-step", + "phase": "impl", + "step": 7, + "summary": "子任务 1 完成:移除 run.md 和 auto-run.md 中的清理代码", + "git_commit": "2b2c130f9594d0443dcb06ef6490e34e6930cbb5" + }, + { + "timestamp": "2025-12-19T04:45:41+08:00", + "action": "next-step", + "phase": "impl", + "step": 8, + "summary": "子任务 2 完成:修改 branch.py 中的提交信息格式", + "git_commit": "804fdc62012c70e9802fe8dfdab52d362a711329" + }, + { + "timestamp": "2025-12-19T04:47:07+08:00", + "action": "next-step", + "phase": "impl", + "step": 9, + "summary": "子任务 3 完成:调整 decide 界面显示源文件内容", + "git_commit": "f5eedaa0651baaac630a03a7c7cbaf630605c028" + }, + { + "timestamp": "2025-12-19T04:47:19+08:00", + "action": "next-part", + "phase": "verify", + "step": 10, + "summary": "实现完成,进入验证环节", + "git_commit": "111b711e64ad7f925c227999e9d0220532682381" + }, + { + "timestamp": "2025-12-19T04:47:58+08:00", + "action": "next-step", + "phase": "verify", + "step": 11, + "summary": "验证完成: 所有修改通过语法检查和功能验证", + "git_commit": "580f6738f7a458f7d3def30df999f4a78d841a81" + }, + { + "timestamp": "2025-12-19T04:48:14+08:00", + "action": "next-part", + "phase": "docs", + "step": 12, + "summary": "验证通过,进入文档环节", + "git_commit": "b5f5633a40d682383dbe4835a71b9289d596052d" + }, + { + "timestamp": "2025-12-19T04:48:50+08:00", + "action": "next-step", + "phase": "docs", + "step": 13, + "summary": "文档更新完成", + "git_commit": "2b8c75563972bcb20f8afac95cd03ef1f7b3c180" + }, + { + "timestamp": "2025-12-19T04:49:06+08:00", + "action": "next-part", + "phase": "confirm", + "step": 14, + "summary": "文档更新完成,进入用户确认环节", + "git_commit": "856f0596a4f89c19fb5758c11bd84d1f46fec16b" + }, + { + "timestamp": "2025-12-19T04:49:51+08:00", + "action": "next-step", + "phase": "confirm", + "step": 15, + "summary": "用户确认通过", + "git_commit": "cee9a1e110e2617b686f38594ac970c365bbd2b3" + }, + { + "timestamp": "2025-12-19T04:50:04+08:00", + "action": "next-part", + "phase": "finish", + "step": 16, + "summary": "用户确认通过,进入收尾", + "git_commit": "76026e4b62996b667b2f788a2cf6e34cc79cebfb" + } + ], + "source_branch": "master", + "start_commit": "af40327146d6be0781bb8f9ccdcaf8b2ce216455", + "task_branch": "aide/022" +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 79427b9..826bff5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,27 @@ ## 2025-12-19 +### 优化 + +**finish 清理代码移除** + +- 移除 `run.md` 和 `auto-run.md` 中的"清理临时文件"指令和 `aide flow next-step "任务完成"` 命令 +- 原因:aide 程序在 finish 时已自动执行清理,无需在命令文档中重复指导 + +**finish 提交信息格式优化** + +- 修改 `branch.py` 中的收尾提交信息格式: + - 正常完成:`完成:<分支名> - <任务名>` + - 强制清理:`任务中断,清理:<分支名> - <任务名>` +- 替代原有的 `{短哈希}的任务收尾` 格式,更加语义化 + +**decide 界面源文件显示** + +- `handlers.py` 新增 `_read_source_lines` 方法:读取待定项来源文件的指定行内容 +- `handle_get_items` 方法增强:返回数据中包含 `source_content` 字段 +- `app.js` 更新:显示待定项来源文件的原文内容(以代码块形式) +- `style.css` 新增:`.location-label` 和 `.source-content` 样式 + ### 新增功能 **PlantUML 渲染配置** diff --git a/aide-marketplace/aide-plugin/commands/auto-run.md b/aide-marketplace/aide-plugin/commands/auto-run.md index 755e3bb..3e7ac9e 100644 --- a/aide-marketplace/aide-plugin/commands/auto-run.md +++ b/aide-marketplace/aide-plugin/commands/auto-run.md @@ -419,14 +419,9 @@ aide flow next-step "文档更新完成" aide flow next-part finish "文档更新完成,进入收尾" ``` -- 清理临时文件 - 检查遗漏的 TODO - 输出完成摘要 -```bash -aide flow next-step "任务完成" -``` - --- ## 续接流程 diff --git a/aide-marketplace/aide-plugin/commands/run.md b/aide-marketplace/aide-plugin/commands/run.md index b05e27a..64a0857 100644 --- a/aide-marketplace/aide-plugin/commands/run.md +++ b/aide-marketplace/aide-plugin/commands/run.md @@ -409,14 +409,9 @@ aide flow next-part confirm "文档更新完成,进入用户确认环节" aide flow next-part finish "用户确认通过,进入收尾" ``` -- 清理临时文件 - 检查遗漏的 TODO - 向用户汇报完成情况 -```bash -aide flow next-step "任务完成" -``` - --- ## 续接流程 diff --git a/aide-program/aide/decide/handlers.py b/aide-program/aide/decide/handlers.py index d34d364..8e67cd2 100644 --- a/aide-program/aide/decide/handlers.py +++ b/aide-program/aide/decide/handlers.py @@ -65,10 +65,39 @@ class DecideHandlers: if pending is None: return self._server_error("无法读取待定项数据", "文件不存在或格式错误") - body = json.dumps(pending.to_dict(include_meta=False), ensure_ascii=False).encode("utf-8") + # 转换为字典并为每个 item 添加 source_content + data = pending.to_dict(include_meta=False) + for item in data.get("items", []): + location = item.get("location") + if location and location.get("file"): + source_content = self._read_source_lines( + location["file"], + location.get("start", 1), + location.get("end", 1) + ) + if source_content: + item["source_content"] = source_content + + body = json.dumps(data, ensure_ascii=False).encode("utf-8") headers = self._cors_headers({"Content-Type": "application/json; charset=utf-8"}) return 200, headers, body + def _read_source_lines(self, file_path: str, start: int, end: int) -> str | None: + """读取源文件指定行范围的内容""" + try: + # 相对路径基于项目根目录 + full_path = Path(self.storage.root) / file_path + if not full_path.exists(): + return None + lines = full_path.read_text(encoding="utf-8").splitlines() + # 转换为 0-indexed + start_idx = max(0, start - 1) + end_idx = min(len(lines), end) + selected = lines[start_idx:end_idx] + return "\n".join(selected) + except Exception: + return None + def handle_submit(self, body: bytes) -> Response: try: pending = self.storage.load_pending() diff --git a/aide-program/aide/decide/web/app.js b/aide-program/aide/decide/web/app.js index 2473d29..47d6156 100644 --- a/aide-program/aide/decide/web/app.js +++ b/aide-program/aide/decide/web/app.js @@ -88,10 +88,22 @@ function renderItemCard(item) { } if (item.location && item.location.file) { - const location = document.createElement("div"); - location.className = "item-location"; - location.textContent = `位置: ${item.location.file}:${item.location.start}-${item.location.end}`; - card.appendChild(location); + const locationWrap = document.createElement("div"); + locationWrap.className = "item-location"; + + const locationLabel = document.createElement("div"); + locationLabel.className = "location-label"; + locationLabel.textContent = `来源: ${item.location.file} (行 ${item.location.start}-${item.location.end})`; + locationWrap.appendChild(locationLabel); + + if (item.source_content) { + const sourceContent = document.createElement("pre"); + sourceContent.className = "source-content"; + sourceContent.textContent = item.source_content; + locationWrap.appendChild(sourceContent); + } + + card.appendChild(locationWrap); } const options = renderOptions(item); diff --git a/aide-program/aide/decide/web/style.css b/aide-program/aide/decide/web/style.css index 50f6404..8a5717a 100644 --- a/aide-program/aide/decide/web/style.css +++ b/aide-program/aide/decide/web/style.css @@ -130,6 +130,26 @@ body { line-height: 1.6; } +.location-label { + font-size: var(--font-size-sm); + margin-bottom: var(--spacing-xs); +} + +.source-content { + background: var(--color-background); + border: 1px solid var(--color-border); + border-radius: var(--radius-sm); + padding: var(--spacing-sm); + margin: var(--spacing-xs) 0 0 0; + font-family: "SF Mono", Monaco, Consolas, monospace; + font-size: 13px; + line-height: 1.5; + overflow-x: auto; + white-space: pre-wrap; + word-break: break-word; + color: var(--color-text); +} + .options-list { margin-top: var(--spacing-md); display: grid; diff --git a/aide-program/aide/flow/branch.py b/aide-program/aide/flow/branch.py index ece9215..d7d77f8 100644 --- a/aide-program/aide/flow/branch.py +++ b/aide-program/aide/flow/branch.py @@ -620,11 +620,10 @@ class BranchManager: # 8. 创建收尾提交 self.git.add_all() - short_hash = start_commit[:7] if start_commit else "unknown" if is_force_clean: - commit_msg = f"{short_hash}的强制清理" + commit_msg = f"任务中断,清理:{task_branch} - {branch_info.task_summary}" else: - commit_msg = f"{short_hash}的任务收尾" + commit_msg = f"完成:{task_branch} - {branch_info.task_summary}" self.git.commit(commit_msg) return True, f"任务分支已合并到 {source_branch}" diff --git a/task-now.md b/task-now.md index 587146f..e69de29 100644 --- a/task-now.md +++ b/task-now.md @@ -1,17 +0,0 @@ -> commands & skills都是将会提供给你使用的指导规范以及工具和能力,下文中会用LLM来指代你的角色, - -对现有的 commands & skills & aide program 体系做一些调整: - -1. - -移除commands/run中阶段 7:收尾 (finish)里的“清理临时文件”和后面的aide flow next-step,(auto-run同步检查和处理) - -因为这些内容已经被aide程序集成自动处理了,在finish之后就已经自动完成了清理,包括flow数据文件,如果后面再执行next-step就会找不到flow数据文件报错。 - -2. - -aide flow 在finish时我希望最后回到原分支的那个提交不要再用“abcd1234的任务收尾”作为提交信息,而是根据是finish还是clean结束的,改用“完成:<分支名> - <任务名>”或者“任务中断,清理:<分支名> - <任务名>”。 - -3. - -调整decide的界面,我希望每一个待定项的source部分显示出来不要只是显示task-now.md n-m,这种某个文件第几行的简单文字,而是显示出该待定项的来源的完整原始文件内容那几行原文,这样我在决定时可以更清楚地看到原内容是什么,而不是还要去打开文件查看(如果我想的话)。 \ No newline at end of file