67 lines
4.1 KiB
Markdown
67 lines
4.1 KiB
Markdown
---
|
||
id: blueprint-buff
|
||
---
|
||
|
||
## 概述
|
||
|
||
炼境向被管理项目施加"蓝图 Buff"的能力层。Buff 注入后,git 提交自动触发任务状态同步(📋→🔵),炼境实时刷新蓝图视图。核心链路只依赖 git,与 AI 工具热插拔解耦,可批量复用到任意被管理项目。
|
||
|
||
## 决策记录
|
||
|
||
- 用 tokio 每5秒轮询 HEAD commit 而非写 git hook,原因:Windows 上 shell hook 执行依赖 Git Bash,路径复杂;轮询方式对项目零侵入且跨平台
|
||
- git commit 只自动标 🔵(进行中),不自动标 ✅(完成);完成的语义需要验收,这是自动化的边界
|
||
- Buff 同步后顺手调用 `get_blueprint()`,内部触发 `append_usage_snapshot()`,使飞轮数据与实际开发进度对齐
|
||
- 使用文件路径匹配而非 commit message 解析,与 AI 工具/提交信息风格完全解耦
|
||
|
||
## 任务卡
|
||
|
||
### ✅ blueprint_buffs 数据表
|
||
- status: done
|
||
- complexity: S
|
||
- files: src-tauri/src/db.rs
|
||
- acceptance: blueprint_buffs 表 migration 执行成功,字段包含 project_path/project_id/applied_at/last_sync_at/last_commit/status
|
||
|
||
### ✅ Buff 生命周期 Rust 命令
|
||
- status: done
|
||
- complexity: M
|
||
- files: src-tauri/src/commands/buff.rs, src-tauri/src/commands/mod.rs, src-tauri/src/lib.rs
|
||
- depends: blueprint-buff
|
||
- acceptance: apply_blueprint_buff/remove_blueprint_buff/get_buff_status/list_buffed_projects 四个命令可正常调用,apply 时同步调用 sync_blueprint_rules 注入规则
|
||
|
||
### ✅ git watcher + 任务匹配写回 + 飞轮快照
|
||
- status: done
|
||
- complexity: M
|
||
- files: src-tauri/src/commands/buff.rs, src-tauri/Cargo.toml
|
||
- depends: blueprint-buff
|
||
- acceptance: git commit 后5秒内,files 字段命中的任务卡自动标记为 🔵 in_progress,调用 get_blueprint 追加飞轮快照,emit blueprint://changed 事件
|
||
|
||
### ✅ 前端 Buff 管理 UI
|
||
- status: done
|
||
- complexity: M
|
||
- files: src/lib/commands.ts, src/components/dashboard/BlueprintModal.tsx, src/components/dashboard/ProjectCard.tsx
|
||
- depends: blueprint-buff
|
||
- acceptance: ProjectCard 已施加 Buff 时显示紫色⚡徽章,BlueprintModal GovernancePanel 有施加/撤销按钮,施加后展示 init prompt 供复制
|
||
|
||
### ✅ 前端实时刷新
|
||
- status: done
|
||
- complexity: S
|
||
- files: src/components/dashboard/BlueprintModal.tsx
|
||
- depends: blueprint-buff
|
||
- acceptance: git commit 后已打开的蓝图视图自动重新加载,变更的任务卡显示"刚刚更新"标记并在3秒后淡出
|
||
|
||
### ✅ BlueprintView 跨项目切换
|
||
- status: done
|
||
- complexity: M
|
||
- files: src/components/dashboard/BlueprintModal.tsx, src/components/dashboard/ProjectCard.tsx
|
||
- depends: blueprint-buff
|
||
- acceptance: 任意项目 ProjectCard 可打开该项目自己的蓝图视图,传入 projectId 支持 Buff 管理,炼境自身蓝图入口不受影响
|
||
|
||
### 🔵 B1 — files 重叠推断降为兜底(同批已有显式推进则不推断)
|
||
- status: in_progress
|
||
- complexity: M
|
||
- files: src-tauri/src/commands/buff.rs, src-tauri/src/commands/blueprint.rs
|
||
- acceptance: "agent_verify: [cargo test] ①批内蓝图 diff 含 +### 🔵/✅ → 不标且内容不变;②无显式推进 + 精确路径命中 → 标 🔵;③仅反向后缀不命中;④lib.rs 不命中 mylib.rs;⑤尾逗号空项不命中;⑥「、」分隔可拆;⑦last_commit 非 HEAD 祖先 → 跳过。[回放脚本] master 历史 50 → ≤5,53af8c3/239d9fd/79853b7 对 P6/P7/P8/A4 零命中。human_verify: 重装炼境后合并下一个 PR,主仓库工作区不再出现无关卡被标 🔵"
|
||
- 起因:2026-10-02 合并 PR #24/#25/#26 后 P6/P7/P8(agent-client-parity)与 A4(architecture-evolution)未开工却被标 🔵,仅因与 P1/P3/P9 共用 files;enterprise-system 2026-07-22 回传同类问题(第二例,governance-feedback-loop 挂触发条件满足)
|
||
- 回放(master 240 个 first-parent 提交):现有算法命中 50 次——明确误判 30、存疑 17、明确正确 3;热点为 mcp_tools.rs/onboarding.rs/commands.ts 等共享文件
|
||
- 根因:两阶段锁下真正在做的卡提交落地时已是 🔵/✅,files 重叠只能碰到仍为 📋 的卡——选择偏差使精度结构性偏低,非调匹配规则可解
|