diff --git a/lib/air_runtime/modes/arc_mode.py b/lib/air_runtime/modes/arc_mode.py index 0651334..c926249 100644 --- a/lib/air_runtime/modes/arc_mode.py +++ b/lib/air_runtime/modes/arc_mode.py @@ -249,8 +249,11 @@ def parallel_review_mode(project_root: Path, todo_path: Path) -> dict: markdown_lines.append(f"- `{g.name}`: {', '.join(g.task_ids)} — {g.reason}") paths["execution_plan_md"].write_text("\n".join(markdown_lines) + "\n", encoding="utf-8") - atomic_json_write(paths["state"], {"enabled": True, "updatedAt": now_iso(), - "projectRoot": str(project_root)}) + # 保留 arcPhase 字段,避免 phase 被 reset 为 discussing + existing_state = safe_json_load(paths["state"]) or {} + state_payload = {**existing_state, "enabled": True, "updatedAt": now_iso(), + "projectRoot": str(project_root)} + atomic_json_write(paths["state"], state_payload) return {"json_path": str(review_json_path), "markdown_path": str(review_md_path), "execution_plan_json_path": str(paths["execution_plan_json"]), "parallel_group_count": len(review.parallel_groups), diff --git a/lib/air_runtime/modes/do_mode.py b/lib/air_runtime/modes/do_mode.py index 9bc7d7d..7aed2a8 100644 --- a/lib/air_runtime/modes/do_mode.py +++ b/lib/air_runtime/modes/do_mode.py @@ -244,7 +244,8 @@ def main(args) -> None: print(f"active_task_id={s['activeTaskId']}") print(f"known_tasks={','.join(s['taskIds'])}") elif sub == "enter": - result = enter_worker(project_root, tid) + task_text = getattr(args, "task_text", "") or "" + result = enter_worker(project_root, tid, task_text=task_text) print("airplan_mode=do") print(f"task_id={result['taskId']}") print(f"brief_path={result['briefPath']}") diff --git a/lib/air_runtime/todo_parser.py b/lib/air_runtime/todo_parser.py index c04c1ec..f70b4b5 100644 --- a/lib/air_runtime/todo_parser.py +++ b/lib/air_runtime/todo_parser.py @@ -69,9 +69,13 @@ def parse_tasks(todo_path: Path) -> list[TodoTask]: continue task_cell = cells[col_map.get("task", 0)] if col_map.get("task", 0) < len(cells) else "" - # 提取 [T-xxx] 格式的任务 ID + # 优先提取 [T-xxx] 方括号格式的 ID;若没有则尝试从开头提取 G-001/H-000 类短 ID tid_match = re.match(r"\[([A-Za-z0-9_\-\.]+)\]", task_cell) - task_id = tid_match.group(1) if tid_match else task_cell + if tid_match: + task_id = tid_match.group(1) + else: + short_match = re.match(r"^([A-Z]+-\d+[a-z]*)", task_cell) + task_id = short_match.group(1) if short_match else task_cell task = task_cell status = cells[col_map.get("status", 1)] if col_map.get("status", 1) < len(cells) else "TODO" files_dirs = cells[col_map.get("files_dirs", 2)] if col_map.get("files_dirs", 2) < len(cells) else "" diff --git a/scripts/airplan.py b/scripts/airplan.py index 91c0447..c09b8f5 100644 --- a/scripts/airplan.py +++ b/scripts/airplan.py @@ -170,6 +170,8 @@ def parse_args(argv: list[str] | None = None) -> argparse.Namespace: help="截图后端偏好(xdb 使用): kms|xvfb|fallback|auto") parser.add_argument("--output", default="", help="截图输出文件名(xdb 使用,默认 screenshot.png)") + parser.add_argument("--task-text", default="", + help="任务描述文本(do 使用,用于 UI 任务检测和路由)") return parser.parse_args(argv)