Files
AirPlan-V2/lib/air_runtime/project_bootstrap.py
AirPlan 6130478c96 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>
2026-06-12 15:56:44 +08:00

59 lines
1.6 KiB
Python
Executable File

"""
项目引导模块 — 确保 AirPlan 目录结构存在。
V2 保持与 V1 相同的不变量:制品驱动通信、上下文隔离。
"""
from __future__ import annotations
from pathlib import Path
def ensure_project_bootstrap(project_root: Path) -> dict[str, bool]:
"""创建 AirPlan 必需目录结构。"""
root = project_root / "AirPlan"
docs = root / "docs"
arch = docs / "architecture"
adr_dir = arch / "adr"
c4_dir = arch / "c4"
debug_dir = docs / "debug"
state = root / "state"
dirs = [
root,
docs,
arch,
adr_dir,
c4_dir,
debug_dir,
state,
state / "airarc" / "reviews",
state / "aireng" / "dispatch",
state / "aireng" / "archive",
state / "aireng" / "plans",
state / "airdo" / "tasks",
state / "airdbg" / "sessions",
state / "airdbg" / "snapshots",
state / "airxdb" / "artifacts",
state / "airsdb" / "reports",
state / "airndb" / "captures",
state / "aircontext",
state / "airdep" / "sessions",
state / "airtst" / "reports",
state / "airsec",
state / "airrvr" / "reviews",
]
for d in dirs:
d.mkdir(parents=True, exist_ok=True)
# 创建必要文件
(root / "AGENTS.md").touch()
(root / "plan.md").touch()
(root / "todo.md").touch()
(adr_dir / "placeholder.md").touch()
(c4_dir / "module.md").touch()
(debug_dir / "debug-log.md").touch()
(debug_dir / "gui-debug-log.md").touch()
(docs / "staticanalysis.md").touch()
return {"bootstrap": True}