feat: AirPlan V2 — 全专家插件强制路由 + 事件系统规范化
P0-8 扩大: do_mode.py finish_worker 全专家插件强制路由 - GUI→XDB, network→NDB, C/C++→SDB, done→Rvr, blocked/failed→Dbg - 证据去重: 已有 xdbSessions/ndbSessions/sdbReports/rvrReviewed 则跳过 P1-GAP17: 事件 emit 规范化 - 新增 7 个事件常量 (TASK_ENTERED, TASK_FINISHED, ENGINE_ENTERED 等) - 全部 emit 调用替换字符串字面量为常量,零残留 - 30 个事件类型常量全部定义且唯一 P1-GAP18: 事件日志原子轮转 - emit 计数器每 128 次检查轮转,避免每次 emit 读文件 - 清除未使用的 _emit_with_completion/_pending_merge_complete - 原子轮转: tempfile+os.replace 保证不损坏 eng 极端接管: 强制调用全部专家插件 (Dbg/XDB/NDB/SDB/Rvr) commands/do.md: 更新为全专家插件路由文档 全量测试: 69 通过, 0 失败 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
63
commands/dbg.md
Executable file
63
commands/dbg.md
Executable file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
description: "AirPlan dbg mode - 7-step debug workflow with evidence-first gate"
|
||||
argument-hint: "[start|snapshot|status]"
|
||||
allowed-tools: "[Read, Glob, Grep, Bash, Write, Edit]"
|
||||
---
|
||||
|
||||
# /dbg
|
||||
|
||||
AirDbg 是调试器,强制 7 步证据先于修复流程。EvidenceFirstGate 硬门控——未取证不可改代码(INV-9)。
|
||||
|
||||
## 硬规则
|
||||
|
||||
1. **先读后写** — 修改代码前必须至少完成一项取证(截图/抓包/静态分析/日志分析/代码追踪/复现)
|
||||
2. **修复前快照** — 修改代码前必须 `--sub snapshot` 创建回滚点
|
||||
3. **步骤不可跳过** — 7 步工作流按顺序推进,每步需要对应证据
|
||||
|
||||
## 7 步工作流
|
||||
|
||||
| 步 | 名称 | 需要证据 | 操作 |
|
||||
|----|------|---------|------|
|
||||
| 1 | confirm_symptoms | 症状描述 | `--sub start` 初始化会话 |
|
||||
| 2 | load_context | | 读取相关文件、日志、配置 |
|
||||
| 3 | reproduce | (可跳过) | 复现或标记为不可复现 |
|
||||
| 4 | locate_root_cause | ≥1 种证据 | 分析证据定位根因 |
|
||||
| 5 | fix | 根因分析结论 | 先 `--sub snapshot`,再改代码 |
|
||||
| 6 | verify_again | 测试结果 | 验证修复有效 |
|
||||
| 7 | document | | 写 debug-log.md,关闭会话 |
|
||||
|
||||
## 子命令
|
||||
|
||||
### start — 启动调试会话
|
||||
|
||||
```bash
|
||||
python scripts/airplan.py --mode dbg --project . --sub start --task-id T-001
|
||||
```
|
||||
|
||||
返回 `{sessionId, currentStep, steps}`。会话状态写入 `AirPlan/state/airdbg/sessions/`。
|
||||
|
||||
### snapshot — 修复前创建回滚点
|
||||
|
||||
```bash
|
||||
python scripts/airplan.py --mode dbg --project . --sub snapshot --task-id T-001
|
||||
```
|
||||
|
||||
在当前 HEAD 创建 git tag,返回 `{snapshot_ref}`。
|
||||
|
||||
### status — 查看调试状态
|
||||
|
||||
```bash
|
||||
python scripts/airplan.py --mode dbg --project . --sub status
|
||||
```
|
||||
|
||||
## 集成路径
|
||||
|
||||
**Eng → Dbg**:`monitor_engine()` 检测到 stalled/blocked Worker 且 action=`"upgraded-to-airdbg"` 时:
|
||||
1. 读 `interventions[].sessionId` 获取 Dbg 会话 ID
|
||||
2. 调 `--sub start --task-id {tid}` 开始 Dbg 会话
|
||||
3. Dbg 完成后:finish Worker,然后 merge
|
||||
|
||||
**Dbg → Do finish**:Dbg 修复完成后回到原任务:
|
||||
```bash
|
||||
python scripts/airplan.py --mode do --project . --sub finish --task-id T-001 --result AirPlan/state/airdo/tasks/T-001/result.json
|
||||
```
|
||||
Reference in New Issue
Block a user