Files
AirCoding/AirPlan/docs/spec/AirPlanV2/commands/dbg.md
AirCoding ae44be31d5 chore: push all design docs, V2 plan specs, and current working state
Includes AirPlan design documents, AircOding-alpha1-plan, AirPlanV2,
AirPlan-ParaV2, AirPlan-Para V1 reference docs, and all working code
changes across packages.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-12 17:12:29 +08:00

64 lines
2.2 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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
```