dev-manager-tauri/.blueprint/modules/blueprint-buff.md
lanrtop 30d6823a1f feat: 蓝图 Buff 系统 v0.1.12
炼境可向任意被管理项目施加「蓝图 Buff」,git 提交自动同步任务进度,与 AI 工具热插拔解耦。

- 后端:blueprint_buffs 数据表 + 生命周期命令(apply/remove/get/list)
- 后端:每 5 秒轮询 git HEAD,文件路径匹配任务卡 files 字段,自动标记 📋🔵
- 后端:sync 时 Buff 触发飞轮快照,emit blueprint://changed 事件
- 前端:ProjectCard 显示  Buff 激活徽章
- 前端:GovernancePanel 新增施加/撤销 Buff 按钮,无蓝图时附带 init prompt
- 前端:BlueprintModal 监听 blueprint://changed,自动刷新并显示「刚刚更新」提示
- 修复:sync prompt 新增 🔵 状态保护规则,防止 Claude 更新时降级炼境自动标记的进度
2026-04-05 01:56:40 +09:00

2.8 KiB
Raw Blame History

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 管理,炼境自身蓝图入口不受影响