用途
ops-sprint 是 CocoOps 体系中的冲刺健康度(sprint health)计算技能,通过 $ops sprint 调用,用于在冲刺进行中给出速度、燃尽率与完成度预测,并生成可共享的快照。
主要能力
- 读取冲刺窗口:从 cocoplus.toml 的 [sprint] 段提取 start_date(冲刺开始 ISO 日期)、end_date(结束日期,缺失时按两周默认推算)、feature_prefix(特性提交前缀,默认 feat)以及可选的 scope(流水线/模块名称列表,用于限定分析范围)。若 cocoplus.toml 或 [sprint] 段不存在,则使用默认值:start_date 为 14 天前、end_date 为今天、feature_prefix 为 feat。
- 确定性指标计算:以
git log --oneline --since="<start_date>" --until="<end_date>" --grep="^feat"统计匹配特性前缀的提交数,每个符合条件的提交计为 1 个速度单位;以git log --oneline --since="<start_date>" -- "*.sql" "*.py"统计触及流水线的提交,作为流水线任务完成情况的广度信号。 - 燃尽与预测:daily_burn_rate = velocity_units / elapsed_sprint_days;remaining_days 为结束日期与今天的天数差;projected_additional = daily_burn_rate × remaining_days;predicted_final = velocity_units + projected_additional。
- 结果写入 .cocoplus/ops/sprint-health.json,采用先写临时文件再重命名的原子写入方式,内容包含 computed_at、sprint_window(start、end、elapsed_days、remaining_days)、metrics(velocity_units、pipeline_commits、daily_burn_rate、predicted_final_velocity)和 signals(commits_in_window、feature_prefix_used)。
使用方式
- 执行前会校验 .cocoplus/ 是否存在;若不存在则输出“CocoPlus is not initialized. Run $pod init first.”并停止。
- 读取配置并计算上述指标,写出 sprint-health.json。
- 将 sprint-health.json 交由 Haiku 子代理生成简洁叙事,要求每条陈述都引用具体数量或日期,内容包括当前速度与每日燃烧率、基于趋势的冲刺完成预测、节奏属于领先/正常/风险,以及在风险时给出 1–2 条优先行动建议。
- 提交快照:仅当文件自上次提交后发生变化才提交(用
git diff --quiet .cocoplus/ops/sprint-health.json检查),命令为git add .cocoplus/ops/sprint-health.json和git commit -m "ops(sprint): update sprint health snapshot <YYYY-MM-DD>";若未变化则跳过并提示“Snapshot unchanged since last run — no commit needed.”。 - 输出标准格式报告:项目与日期、冲刺窗口(start → end,elapsed/total 天)、速度(units,daily_burn_rate/day)、流水线提交数、预测完成量(predicted_final_velocity units by end_date)、状态(ON TRACK | AHEAD | AT RISK)、Haiku 叙事以及快照路径。
适用场景
适用于使用 CocoOps 且已初始化 .cocoplus/ 的仓库,在冲刺期间定期生成团队一致的冲刺健康快照,便于成员看到相同的速度与预测数字。
限制
- 依赖 git 历史与冲刺窗口配置;没有定义窗口时速度数字无意义。
- 指标必须由 git log 计数确定性地得出,不应交由 LLM 推断;预测必须使用实测每日燃烧率而非猜测。
- 快照作为团队产物需要提交,否则队友无法看到相同数字。
- 官方未提供关于收费、平台支持范围等更多信息。