@boyingliu01/xp-gate 0.12.13 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapters/typescript.sh +5 -2
- package/build-integrity/__tests__/ccn-refactor-gate10.test.ts +133 -0
- package/build-integrity/gate-10.ts +111 -123
- package/hooks/gate-3.sh +68 -0
- package/hooks/gate-4.sh +80 -0
- package/hooks/gate-7.sh +45 -0
- package/hooks/gate-8.sh +56 -0
- package/hooks/pre-commit +15 -3
- package/mock-policy/AGENTS.md +4 -4
- package/mutation/AGENTS.md +4 -4
- package/package.json +1 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +4 -4
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +50 -62
- package/plugins/claude-code/skills/sprint-flow/SKILL.md +200 -238
- package/plugins/claude-code/skills/sprint-flow/references/force-levels.md +13 -14
- package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +61 -197
- package/plugins/claude-code/skills/sprint-flow/references/phase-1-prep.md +294 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +194 -0
- package/{skills/sprint-flow/references/phase-2-build.md → plugins/claude-code/skills/sprint-flow/references/phase-3-build.md} +11 -11
- package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +153 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-5-ship.md +40 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-6-close.md +134 -0
- package/plugins/claude-code/skills/sprint-flow/templates/auto-estimate-learning-log.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/templates/auto-estimate-output-template.md +15 -37
- package/plugins/claude-code/skills/sprint-flow/templates/emergent-issues-template.md +7 -7
- package/plugins/claude-code/skills/sprint-flow/templates/pain-document-template.md +5 -5
- package/plugins/claude-code/skills/sprint-flow/templates/sprint-progress-template.md +36 -47
- package/plugins/claude-code/skills/sprint-flow/templates/sprint-summary-template.md +16 -15
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +4 -4
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/delphi-review/AGENTS.md +4 -4
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +50 -62
- package/plugins/opencode/skills/sprint-flow/SKILL.md +200 -238
- package/plugins/opencode/skills/sprint-flow/references/force-levels.md +13 -14
- package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +61 -197
- package/plugins/opencode/skills/sprint-flow/references/phase-1-prep.md +294 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +194 -0
- package/plugins/{claude-code/skills/sprint-flow/references/phase-2-build.md → opencode/skills/sprint-flow/references/phase-3-build.md} +11 -11
- package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +153 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-5-ship.md +40 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-6-close.md +134 -0
- package/plugins/opencode/skills/sprint-flow/templates/auto-estimate-learning-log.md +1 -1
- package/plugins/opencode/skills/sprint-flow/templates/auto-estimate-output-template.md +15 -37
- package/plugins/opencode/skills/sprint-flow/templates/emergent-issues-template.md +7 -7
- package/plugins/opencode/skills/sprint-flow/templates/pain-document-template.md +5 -5
- package/plugins/opencode/skills/sprint-flow/templates/sprint-progress-template.md +36 -47
- package/plugins/opencode/skills/sprint-flow/templates/sprint-summary-template.md +16 -15
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +4 -4
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/AGENTS.md +4 -4
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +50 -62
- package/plugins/qoder/skills/sprint-flow/SKILL.md +274 -208
- package/plugins/qoder/skills/sprint-flow/references/components/middleware.md +5 -2
- package/plugins/qoder/skills/sprint-flow/references/force-levels.md +13 -14
- package/plugins/qoder/skills/sprint-flow/references/orchestration-rules.md +61 -197
- package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +294 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +194 -0
- package/plugins/{opencode/skills/sprint-flow/references/phase-2-build.md → qoder/skills/sprint-flow/references/phase-3-build.md} +11 -11
- package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +153 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-5-ship.md +40 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-6-close.md +134 -0
- package/plugins/qoder/skills/sprint-flow/templates/auto-estimate-learning-log.md +1 -1
- package/plugins/qoder/skills/sprint-flow/templates/auto-estimate-output-template.md +15 -37
- package/plugins/qoder/skills/sprint-flow/templates/emergent-issues-template.md +7 -7
- package/plugins/qoder/skills/sprint-flow/templates/pain-document-template.md +5 -5
- package/plugins/qoder/skills/sprint-flow/templates/sprint-progress-template.md +36 -47
- package/plugins/qoder/skills/sprint-flow/templates/sprint-summary-template.md +16 -15
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +4 -4
- package/principles/AGENTS.md +4 -4
- package/principles/lint-baseline.ts +35 -40
- package/skills/delphi-review/AGENTS.md +4 -4
- package/skills/sprint-flow/AGENTS.md +50 -62
- package/skills/sprint-flow/SKILL.md +200 -238
- package/skills/sprint-flow/references/force-levels.md +13 -14
- package/skills/sprint-flow/references/orchestration-rules.md +61 -197
- package/skills/sprint-flow/references/phase-1-prep.md +294 -0
- package/skills/sprint-flow/references/phase-2-design.md +194 -0
- package/skills/sprint-flow/references/phase-3-build.md +147 -0
- package/skills/sprint-flow/references/phase-4-verify.md +153 -0
- package/skills/sprint-flow/references/phase-5-ship.md +40 -0
- package/skills/sprint-flow/references/phase-6-close.md +134 -0
- package/skills/sprint-flow/templates/auto-estimate-learning-log.md +1 -1
- package/skills/sprint-flow/templates/auto-estimate-output-template.md +15 -37
- package/skills/sprint-flow/templates/emergent-issues-template.md +7 -7
- package/skills/sprint-flow/templates/pain-document-template.md +5 -5
- package/skills/sprint-flow/templates/sprint-progress-template.md +36 -47
- package/skills/sprint-flow/templates/sprint-summary-template.md +16 -15
- package/skills/test-specification-alignment/AGENTS.md +4 -4
- package/plugins/claude-code/skills/sprint-flow/references/phase-0-think.md +0 -115
- package/plugins/claude-code/skills/sprint-flow/references/phase-1-plan.md +0 -178
- package/plugins/claude-code/skills/sprint-flow/references/phase-3-review.md +0 -215
- package/plugins/claude-code/skills/sprint-flow/references/phase-4-uat.md +0 -125
- package/plugins/claude-code/skills/sprint-flow/references/phase-5-feedback.md +0 -100
- package/plugins/claude-code/skills/sprint-flow/references/phase-6-ship.md +0 -9
- package/plugins/claude-code/skills/sprint-flow/references/phase-7-land.md +0 -9
- package/plugins/claude-code/skills/sprint-flow/references/phase-8-cleanup.md +0 -9
- package/plugins/claude-code/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +0 -263
- package/plugins/claude-code/skills/sprint-flow/references/phase-minus-1-isolate.md +0 -58
- package/plugins/opencode/skills/sprint-flow/references/phase-0-think.md +0 -115
- package/plugins/opencode/skills/sprint-flow/references/phase-1-plan.md +0 -178
- package/plugins/opencode/skills/sprint-flow/references/phase-3-review.md +0 -215
- package/plugins/opencode/skills/sprint-flow/references/phase-4-uat.md +0 -125
- package/plugins/opencode/skills/sprint-flow/references/phase-5-feedback.md +0 -100
- package/plugins/opencode/skills/sprint-flow/references/phase-6-ship.md +0 -9
- package/plugins/opencode/skills/sprint-flow/references/phase-7-land.md +0 -9
- package/plugins/opencode/skills/sprint-flow/references/phase-8-cleanup.md +0 -9
- package/plugins/opencode/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +0 -263
- package/plugins/opencode/skills/sprint-flow/references/phase-minus-1-isolate.md +0 -58
- package/plugins/qoder/skills/sprint-flow/references/phase-0-think.md +0 -115
- package/plugins/qoder/skills/sprint-flow/references/phase-1-plan.md +0 -178
- package/plugins/qoder/skills/sprint-flow/references/phase-2-build.md +0 -43
- package/plugins/qoder/skills/sprint-flow/references/phase-3-review.md +0 -215
- package/plugins/qoder/skills/sprint-flow/references/phase-4-uat.md +0 -125
- package/plugins/qoder/skills/sprint-flow/references/phase-5-feedback.md +0 -100
- package/plugins/qoder/skills/sprint-flow/references/phase-6-ship.md +0 -9
- package/plugins/qoder/skills/sprint-flow/references/phase-7-land.md +0 -9
- package/plugins/qoder/skills/sprint-flow/references/phase-8-cleanup.md +0 -9
- package/plugins/qoder/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +0 -263
- package/plugins/qoder/skills/sprint-flow/references/phase-minus-1-isolate.md +0 -58
- package/skills/sprint-flow/references/phase-0-think.md +0 -115
- package/skills/sprint-flow/references/phase-1-plan.md +0 -178
- package/skills/sprint-flow/references/phase-3-review.md +0 -215
- package/skills/sprint-flow/references/phase-4-uat.md +0 -125
- package/skills/sprint-flow/references/phase-5-feedback.md +0 -100
- package/skills/sprint-flow/references/phase-6-ship.md +0 -9
- package/skills/sprint-flow/references/phase-7-land.md +0 -9
- package/skills/sprint-flow/references/phase-8-cleanup.md +0 -9
- package/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +0 -263
- package/skills/sprint-flow/references/phase-minus-1-isolate.md +0 -58
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# Phase 5: FEEDBACK CAPTURE(反馈捕获)
|
|
2
|
-
|
|
3
|
-
## 目标
|
|
4
|
-
|
|
5
|
-
记录 Emergent 发现,工程回顾(团队级),持续改进。为 Sprint 2 准备 Pain Document。
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 调用 Skills
|
|
10
|
-
|
|
11
|
-
- `learn` (gstack) — 模式记录(个人级)
|
|
12
|
-
- `retro` (gstack) _(新增)_ — 周工程回顾:提交历史、工作模式、代码质量趋势(团队级)
|
|
13
|
-
- `systematic-debugging` (superpowers) _(可选)_ — 根因调试:反馈中的 bug 做根因分析
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 执行步骤
|
|
18
|
-
|
|
19
|
-
### Step 1: 调用 learn skill
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
skill(name="learn", user_message="[Emergent Issues 内容 + Sprint 总结]")
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
learn 执行:
|
|
26
|
-
- 记录本次 Sprint 的 emergent 发现
|
|
27
|
-
- 转化为 CLAUDE.md 规则
|
|
28
|
-
- 更新 institutional memory
|
|
29
|
-
|
|
30
|
-
### Step 2: 工程回顾 — 调用 retro(新增 — ISSUE32)
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
skill(name="retro")
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
retro 执行:
|
|
37
|
-
- **提交历史分析**: 本次 Sprint 的 commits、工作模式
|
|
38
|
-
- **代码质量趋势**: 结合 Phase 3 的 benchmark 数据,展示质量变化
|
|
39
|
-
- **团队贡献分解**: 每人贡献比例 + praise + growth areas
|
|
40
|
-
- **改进建议**: 下次 Sprint 的改进点
|
|
41
|
-
|
|
42
|
-
输出: Retro 报告(周级工程回顾)
|
|
43
|
-
|
|
44
|
-
### Step 3: 根因调试(可选 — ISSUE32)
|
|
45
|
-
|
|
46
|
-
**IF Phase 4 发现 bug 或 Phase 3 验证失败**:
|
|
47
|
-
```
|
|
48
|
-
skill(name="systematic-debugging", user_message="[具体 bug 描述]")
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
systematic-debugging 执行 4 阶段:
|
|
52
|
-
1. Investigate(根因调查)
|
|
53
|
-
2. Analyze(分析)
|
|
54
|
-
3. Hypothesize(假设验证)
|
|
55
|
-
4. Implement(修复)
|
|
56
|
-
|
|
57
|
-
**Iron Law**: 无调查 → 不修复
|
|
58
|
-
|
|
59
|
-
### Step 4: 转化 Emergent Issues 为 Sprint 2 Pain Document
|
|
60
|
-
|
|
61
|
-
如果有 emergent issues,转化为新需求:
|
|
62
|
-
```markdown
|
|
63
|
-
# Sprint 2 Pain Document
|
|
64
|
-
|
|
65
|
-
## 来源
|
|
66
|
-
基于 Sprint 1 的 Emergent Issues
|
|
67
|
-
|
|
68
|
-
## Critical Issues (自动进入 Sprint 2)
|
|
69
|
-
| Issue | Sprint 1 描述 | Sprint 2 目标 |
|
|
70
|
-
|-------|--------------|--------------|
|
|
71
|
-
|
|
72
|
-
## Major Issues (询问用户是否纳入)
|
|
73
|
-
| Issue | Sprint 1 描述 | Sprint 2 目标 |
|
|
74
|
-
|-------|--------------|--------------|
|
|
75
|
-
|
|
76
|
-
## Minor Issues (可选纳入)
|
|
77
|
-
| Issue | Sprint 1 描述 | Sprint 2 目标 |
|
|
78
|
-
|-------|--------------|--------------|
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Step 5: 保存 Feedback Log 和 Sprint 2 Pain Document
|
|
82
|
-
|
|
83
|
-
保存到:
|
|
84
|
-
- `<project-root>/.sprint-state/phase-outputs/feedback-log.md`
|
|
85
|
-
- `<project-root>/.sprint-state/phase-outputs/sprint2-pain.md` (如有 emergent issues)
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## 暂停点
|
|
90
|
-
|
|
91
|
-
**无** — Phase 5 完成后自动进入 Phase 6
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## 输出
|
|
96
|
-
|
|
97
|
-
- Feedback Log (`feedback-log.md`)
|
|
98
|
-
- Retro Report(retro 输出)
|
|
99
|
-
- Sprint 2 Pain Document (`sprint2-pain.md`) — 如果有 emergent issues
|
|
100
|
-
- 进入 Phase 6 自动执行
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Phase 6: SHIP + DEPLOY(发布)
|
|
2
|
-
|
|
3
|
-
**完整指令**: @see SKILL.md `## Phase 6: SHIP` section.
|
|
4
|
-
|
|
5
|
-
**摘要**: 结构化分支完成决策, 创建 PR, 合并部署, 监控. 生成 Sprint Summary.
|
|
6
|
-
|
|
7
|
-
**关键链**: PHASE5-GATE → verification → finishing-a-development-branch(4选项) → ship → land-and-deploy → canary → Sprint Summary
|
|
8
|
-
|
|
9
|
-
**输出**: PR URL, Sprint Summary
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Phase 7: LAND(合并 + 部署)
|
|
2
|
-
|
|
3
|
-
**完整指令**: @see SKILL.md `## Phase 7: LAND` section.
|
|
4
|
-
|
|
5
|
-
**摘要**: 自动合并 PR, 等待 CI, 执行部署, Canary Health Check, 失败自动回滚.
|
|
6
|
-
|
|
7
|
-
**关键链**: merge PR → wait CI(10min) → wait Deploy(10min) → Canary Health Check(5min) → auto-rollback on failure
|
|
8
|
-
|
|
9
|
-
**输出**: 部署状态 (success/failure/skipped), Canary 报告
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Phase 8: CLEANUP(清理 + 总结)
|
|
2
|
-
|
|
3
|
-
**完整指令**: @see SKILL.md `## Phase 8: CLEANUP` section.
|
|
4
|
-
|
|
5
|
-
**摘要**: 自动清理 worktree, 更新 sprint-state.json, 输出 Sprint Summary, 处理 emergent issues.
|
|
6
|
-
|
|
7
|
-
**关键链**: worktree detection → remove(retry×3) → residual check → sprint-state update → Sprint Summary → emergent issues(→Sprint 2?)
|
|
8
|
-
|
|
9
|
-
**输出**: Cleanup Report, Sprint Summary
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
# Phase -0.5: AUTO-ESTIMATE(自动化规模评估与流程路由)
|
|
2
|
-
|
|
3
|
-
**执行时机**: Phase -1 ISOLATE 完成后、Phase 0 THINK 之前。**自动执行**。
|
|
4
|
-
|
|
5
|
-
**目的**: 自动评估需求规模,匹配适度流程,避免小需求走重量级流程造成资源浪费。
|
|
6
|
-
|
|
7
|
-
**核心原则**:
|
|
8
|
-
- **客观指标 > 主观判断**:依赖代码结构分析,不依赖人/AI 的主观直觉
|
|
9
|
-
- **显式告知**:用户看到客观指标,不是 AI 主观结论
|
|
10
|
-
- **可纠偏**:用户可接受/修改/取消
|
|
11
|
-
- **学习闭环**:记录用户 override,优化阈值
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 执行流程
|
|
16
|
-
|
|
17
|
-
### 步骤 1: 识别需求类型
|
|
18
|
-
|
|
19
|
-
分析用户输入的需求描述,判定变更类型:
|
|
20
|
-
|
|
21
|
-
| 关键词模式 | 变更类型 | AUTO-ESTIMATE 时机 |
|
|
22
|
-
|-----------|---------|-------------------|
|
|
23
|
-
| 删除、移除、去掉、砍掉、清理 + 已有模块名 | 删除已存在代码 | 立即执行 |
|
|
24
|
-
| 修改、改、调整、重构、优化 + 已有模块名 | 修改已存在代码 | 立即执行 |
|
|
25
|
-
| 新增、添加、开发、实现、创建 + 新模块名 | 新增功能 | brainstorming 后执行 |
|
|
26
|
-
| 修复、fix、bug | Bug 修复 | 立即执行 |
|
|
27
|
-
| 无法判断 | 询问用户 | — |
|
|
28
|
-
|
|
29
|
-
**IF 新增功能**: 跳过当前 AUTO-ESTIMATE,先执行 Phase 0 brainstorming,brainstorming 完成后以设计文档为输入重新执行 AUTO-ESTIMATE。
|
|
30
|
-
|
|
31
|
-
**IF 删除/修改/Bug 修复**: 继续执行以下步骤。
|
|
32
|
-
|
|
33
|
-
### 步骤 2: 收集指标
|
|
34
|
-
|
|
35
|
-
#### 2.1 引用计数
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
# 从用户输入中提取目标关键词(模块名、函数名、类名)
|
|
39
|
-
# 示例:删除平面维护界面 → target="plane", "平面"
|
|
40
|
-
grep -rn "{target_pattern}" --include="*.{ext}" . | grep -v node_modules | grep -v .git | wc -l
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
**阈值**:
|
|
44
|
-
- ≤3: 轻量
|
|
45
|
-
- 4-10: 标准
|
|
46
|
-
- >10: 复杂
|
|
47
|
-
|
|
48
|
-
#### 2.2 跨模块依赖
|
|
49
|
-
|
|
50
|
-
分析引用出现的目录分布:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
# 提取引用所在的目录(取前两级目录)
|
|
54
|
-
grep -rn "{target_pattern}" --include="*.{ext}" . | grep -v node_modules | grep -v .git | \
|
|
55
|
-
awk -F: '{print $1}' | sed 's|/[^/]*$||' | sort -u
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**阈值**:
|
|
59
|
-
- 1 个目录: 轻量
|
|
60
|
-
- 2 个目录: 标准
|
|
61
|
-
- 3+ 个目录: 复杂
|
|
62
|
-
|
|
63
|
-
#### 2.3 循环依赖检测
|
|
64
|
-
|
|
65
|
-
简单检查:如果 A 引用 B 且 B 引用 A,则存在循环依赖。
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
# 简化检测:检查目标是否导入其调用者
|
|
69
|
-
# 这需要根据具体语言调整。对于 TS/JS:
|
|
70
|
-
grep -rn "import.*{target}" --include="*.ts" --include="*.tsx" .
|
|
71
|
-
grep -rn "import.*{caller}" --include="*.ts" --include="*.tsx" {target_dir}/
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**阈值**:
|
|
75
|
-
- 无: 正常
|
|
76
|
-
- 存在: 高风险 → 无论如何输出风险警告
|
|
77
|
-
|
|
78
|
-
#### 2.4 Public API 暴露
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
# 统计目标模块中 export 的数量
|
|
82
|
-
grep -rn "^export " {target_dir}/ --include="*.ts" | wc -l
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**阈值**:
|
|
86
|
-
- ≤2: 低影响
|
|
87
|
-
- 3-5: 中影响
|
|
88
|
-
- >5: 高影响 → 输出风险警告
|
|
89
|
-
|
|
90
|
-
#### 2.5 相关测试文件
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
# 统计与目标相关的测试文件数
|
|
94
|
-
find . -name "*{target}*.test.*" -o -name "*{target}*.spec.*" | grep -v node_modules | wc -l
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
**阈值**:
|
|
98
|
-
- 0: 无测试覆盖(风险提示)
|
|
99
|
-
- 1-2: 正常
|
|
100
|
-
- >3: 重构工作量大 → 提示
|
|
101
|
-
|
|
102
|
-
### 步骤 3: 汇总评估
|
|
103
|
-
|
|
104
|
-
根据各指标得分,汇总整体评估结果:
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
总分计算:
|
|
108
|
-
- 引用计数:轻量=1, 标准=2, 复杂=3
|
|
109
|
-
- 跨模块:轻量=1, 标准=2, 复杂=3
|
|
110
|
-
- 循环依赖:无=0, 存在=5(强制复杂)
|
|
111
|
-
- Public API:低=0, 中=1, 高=2
|
|
112
|
-
- 测试文件:正常=0, 多=1
|
|
113
|
-
|
|
114
|
-
总分:1-3 = 轻量 | 4-6 = 标准 | 7+ 或 循环依赖存在 = 复杂
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### 步骤 4: 输出评估结果
|
|
118
|
-
|
|
119
|
-
使用 `templates/auto-estimate-output-template.md` 的标准格式向用户展示评估结果。
|
|
120
|
-
|
|
121
|
-
**MUST** 遵循模板格式,包含:
|
|
122
|
-
- 需求描述 + 变更类型
|
|
123
|
-
- 影响级别标识
|
|
124
|
-
- 各项指标的具体数值
|
|
125
|
-
- 建议流程
|
|
126
|
-
- 风险警告(如有)
|
|
127
|
-
- 用户操作选项
|
|
128
|
-
|
|
129
|
-
### 步骤 5: 处理用户选择
|
|
130
|
-
|
|
131
|
-
#### 用户选择「接受建议」
|
|
132
|
-
|
|
133
|
-
> 按推荐流程执行。保存评估结果到 sprint-state.json。
|
|
134
|
-
|
|
135
|
-
```json
|
|
136
|
-
{
|
|
137
|
-
"auto_estimate": {
|
|
138
|
-
"change_type": "删除已存在代码",
|
|
139
|
-
"metrics": {
|
|
140
|
-
"ref_count": 12,
|
|
141
|
-
"cross_module_count": 3,
|
|
142
|
-
"modules": ["auth", "user", "admin"],
|
|
143
|
-
"circular_dep": true,
|
|
144
|
-
"public_api_count": 5,
|
|
145
|
-
"test_file_count": 4
|
|
146
|
-
},
|
|
147
|
-
"estimated_level": "复杂",
|
|
148
|
-
"recommended_flow": "完整 Sprint Flow (Phase 0-8)",
|
|
149
|
-
"risk_warnings": ["循环依赖: user ↔ plane"],
|
|
150
|
-
"user_decision": "accepted"
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
#### 用户选择「修改流程」
|
|
156
|
-
|
|
157
|
-
> 展示修改流程子菜单(3 个选项:轻量/标准/完整)。
|
|
158
|
-
> 要求用户输入修改原因(必填)。
|
|
159
|
-
|
|
160
|
-
记录到学习日志:
|
|
161
|
-
```json
|
|
162
|
-
{
|
|
163
|
-
"sprint_id": "{sprint_id}",
|
|
164
|
-
"task_description": "{需求描述}",
|
|
165
|
-
"estimated_level": "标准",
|
|
166
|
-
"user_override_level": "轻量",
|
|
167
|
-
"override_reason": "{用户输入原因}",
|
|
168
|
-
"timestamp": "{当前时间}"
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
数据写入 `.sprint-state/auto-estimate-learning.json`(追加模式)。
|
|
173
|
-
|
|
174
|
-
#### 用户选择「取消」
|
|
175
|
-
|
|
176
|
-
> 停止本次 sprint。
|
|
177
|
-
> 输出:`[CANCELLED] 用户取消 Sprint,AUTO-ESTIMATE 评估结果为 {estimated_level}`。
|
|
178
|
-
|
|
179
|
-
### 步骤 6: 路由执行
|
|
180
|
-
|
|
181
|
-
根据最终确定的流程级别,进入对应 Phase:
|
|
182
|
-
|
|
183
|
-
| 流程级别 | 路由 |
|
|
184
|
-
|---------|------|
|
|
185
|
-
| **轻量** | → Phase 0 THINK(reduced-intensity 流程,见 references/force-levels.md) |
|
|
186
|
-
| **标准** | → Phase 0 THINK(正常流程) |
|
|
187
|
-
| **复杂** | → Phase 0 THINK(完整流程 + 风险警告提示) |
|
|
188
|
-
|
|
189
|
-
**DELPHI-GATE invariant**: 所有流程级别(轻量/标准/复杂)的 Phase 2 BUILD 启动前,**必须**检查 `.sprint-state/delphi-reviewed.json` 的 verdict 为 `APPROVED`。未通过 delphi-review 直接路由到 BUILD 属于严重违规。
|
|
190
|
-
|
|
191
|
-
**轻量级的正确理解**: 轻量级意味着 reduced-intensity 的 delphi-review(**2 专家、1 轮、2/2 APPROVED、较短上下文**),**不是**跳过 delphi-review,**不是** 1 专家评审。见 references/force-levels.md 的轻量级流程定义。
|
|
192
|
-
|
|
193
|
-
**自动 escalation 规则**(检测到以下情况时,自动提升流程级别):
|
|
194
|
-
|
|
195
|
-
| 触发条件 | 原级别 | 提升级别 | 理由 |
|
|
196
|
-
|---------|--------|---------|------|
|
|
197
|
-
| 风险警告(循环依赖、Public API > 5) | 轻量 | 标准 | 技术风险需要标准流程 |
|
|
198
|
-
| 多位专家 disagreement 或 REQUEST_CHANGES | 轻量/标准 | 复杂 | 意见分歧需要更全面评审 |
|
|
199
|
-
| 涉及文件数 > 10 或 LOC > 500 | 轻量 | 标准 | 超出轻量级预算 |
|
|
200
|
-
| 修改公共 API(export 接口) | 轻量/标准 | 复杂 | API 变更影响范围广 |
|
|
201
|
-
| 检测到循环依赖 | 任何级别 | 复杂 | 架构风险强制复杂流程 |
|
|
202
|
-
| 相关测试文件缺失或覆盖率 < 80% | 轻量/标准 | 标准 | 需要补充测试 |
|
|
203
|
-
|
|
204
|
-
**跨参考**: 详见 references/force-levels.md 的各级别流程定义和强制规则。
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## 特殊场景处理
|
|
209
|
-
|
|
210
|
-
### 场景 1: 小改动(总计 < 20 行新增/删除代码)
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
# 检查预估改动量
|
|
214
|
-
git diff --stat HEAD 2>/dev/null # 如果有局部修改
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
**处理**: 如果预估改动 < 20 行且涉及 ≤ 2 个文件,自动判定为「轻量」并告知用户,不强制展示完整 AUTO-ESTIMATE 面板。
|
|
218
|
-
|
|
219
|
-
**注意**: 轻量级仍需要完整的 Sprint Flow 流程(包括 delphi-review),只是 reduced-intensity。见 references/force-levels.md 的轻量级定义。**不会**绕过 DELPHI-GATE 直接路由到 BUILD。
|
|
220
|
-
|
|
221
|
-
### 场景 2: 无法提取目标关键词
|
|
222
|
-
|
|
223
|
-
**处理**: 询问用户「无法自动识别目标模块,请指定要分析的关键词(函数名/类名/模块名):」
|
|
224
|
-
|
|
225
|
-
### 场景 3: 用户输入包含多个独立需求
|
|
226
|
-
|
|
227
|
-
**处理**: 提示用户「检测到多个独立需求,建议分别执行 sprint。是否拆分?」→ 等待确认
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## 编排注意事项
|
|
232
|
-
|
|
233
|
-
Phase -0.5 经常使用并行 background explore agents 评估代码影响范围。Agent dispatch 后必须遵循 **Background Task Resume Protocol**(参见 `orchestration-rules.md`),在所有 background task 返回后自动恢复继续,不得等待人工消息(Issue #248)。
|
|
234
|
-
|
|
235
|
-
---
|
|
236
|
-
|
|
237
|
-
## 与学习循环的集成
|
|
238
|
-
|
|
239
|
-
### 数据收集
|
|
240
|
-
|
|
241
|
-
每次 sprint 完成(Phase 8 CLEANUP)后,将以下数据记录到 `.sprint-state/auto-estimate-learning.json`:
|
|
242
|
-
|
|
243
|
-
```json
|
|
244
|
-
{
|
|
245
|
-
"entries": [
|
|
246
|
-
{
|
|
247
|
-
"sprint_id": "sprint-YYYY-MM-DD-NN",
|
|
248
|
-
"estimated_level": "标准",
|
|
249
|
-
"user_decision": "accepted",
|
|
250
|
-
"actual_effort_phase_count": 5,
|
|
251
|
-
"actual_duration_minutes": 45,
|
|
252
|
-
"was_accurate": true
|
|
253
|
-
}
|
|
254
|
-
]
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### 阈值优化
|
|
259
|
-
|
|
260
|
-
当积累 ≥ 20 条记录后,提示用户可以运行阈值分析:
|
|
261
|
-
|
|
262
|
-
> 已积累 {n} 条 AUTO-ESTIMATE 记录。是否运行阈值优化分析?
|
|
263
|
-
> 分析会检查:过度估计(建议标准但实际轻量)、低估(建议轻量但实际复杂),并推荐阈值调整。
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Phase -1: ISOLATE(git worktree 隔离)
|
|
2
|
-
|
|
3
|
-
**执行时机**: `/sprint-flow` 启动后、Phase 0 THINK 之前。**自动执行**。
|
|
4
|
-
|
|
5
|
-
**目的**: 默认在 git worktree 中隔离 sprint 工作,防止在保护分支上直接运行导致代码污染。
|
|
6
|
-
|
|
7
|
-
**AI agent 直接执行 bash 命令**(不需要调用外部 skill),步骤如下:
|
|
8
|
-
|
|
9
|
-
| 步骤 | 动作 | 说明 |
|
|
10
|
-
|------|------|------|
|
|
11
|
-
| 0 | **检测当前环境** | 运行 `git rev-parse --git-dir` 和 `git rev-parse --git-common-dir`。如果 `GIT_DIR != GIT_COMMON`:已在 worktree 中 → 输出 "Already in isolated worktree" → 进入 Phase 0 |
|
|
12
|
-
| 0.5 | **Sprint Lock 检测(Issue #144)** | 检查 `.sprint-state/sprint.lock` 是否存在: `[ -f .sprint-state/sprint.lock ]`。如果存在: 读取锁内容,检查是否 stale(超过 24 小时或 worktree 目录不存在)→ stale → 输出 `[WARN] 发现过期 sprint lock,将覆盖` → 更新锁。非 stale → 输出 `[BLOCK] 已有活跃 sprint (ID: {sprint_id}, started: {started_at})。请先完成当前 sprint 或手动删除 .sprint-state/sprint.lock` → 退出。锁不存在 → 创建锁: `echo '{"sprint_id":"sprint-YYYY-MM-DD-NN","started_at":"<ISO8601>"}' > .sprint-state/sprint.lock` |
|
|
13
|
-
| 1 | **检查保护分支** | 获取当前分支名 `git branch --show-current`。保护分支列表: `main, master, develop, trunk, mainline`。保护分支 → 强制创建 worktree。非保护分支 → 依然创建 worktree(推荐,不阻断) |
|
|
14
|
-
| 2 | **创建 worktree** | 创建目录: `mkdir -p .worktrees/sprint`。检测已有 NN 编号: `ls .worktrees/sprint/ 2>/dev/null \| grep -oE '[0-9]{2}$' \| sort -n \| tail -1`(取最后两位数字,数值排序,取最大),NN = 结果 + 1(无结果则从 01 开始)。运行 `git worktree add .worktrees/sprint/sprint-YYYY-MM-DD-NN -b sprint/YYYY-MM-DD-NN`。**注意**: `cd` 在 AI agent 单次工具调用中不保持状态,步骤 3-6 必须通过 `workdir` 参数或 `&&` 链式命令在新 worktree 目录下执行 |
|
|
15
|
-
| 3 | **项目 setup** | 在 worktree 目录下: 检测项目类型: `package.json` → `npm install`, `go.mod` → `go mod download`, `pyproject.toml` → `pip/poetry install` |
|
|
16
|
-
| 4 | **.gitignore 校验** | 在**仓库根目录**(非 worktree)执行: `git check-ignore -q .worktrees`。如果未忽略 → 将 `.worktrees/` 添加到 `.gitignore` → `git add .gitignore` → `git commit -m 'chore: ignore .worktrees directory'` |
|
|
17
|
-
| 5 | **Sprint State 记录** | `mkdir -p .sprint-state` 在 worktree 目录下。写入 `.sprint-state/sprint-state.json`(如已存在则合并,保留原有字段),新增/更新 `isolation` 对象,设置 `phase: -1`,`status: "running"` |
|
|
18
|
-
| 6 | **基线验证** | 在 worktree 目录下: 检测测试方式(package.json 有 "test" script → `npm test`, go.mod → `go test ./...`, pyproject.toml → `pytest`)。测试失败 → 输出失败信息 → 询问用户是否继续 |
|
|
19
|
-
|
|
20
|
-
## 参数处理
|
|
21
|
-
|
|
22
|
-
- `--no-isolate`: 跳过自动创建,输出 ⚠️ 警告 `'[WARN] 未创建 worktree 隔离,在 {branch} 分支上直接运行 sprint 有污染风险'` → 进入 Phase 0
|
|
23
|
-
- `--branch-name <name>`: 使用自定义分支名(默认自动生成 `sprint/YYYY-MM-DD-NN`),分支名中的 `/` 在 worktree 路径中自动替换为 `-`(如 `feat/user-login` → 分支名 `feat/user-login`,路径 `.worktrees/sprint/feat-user-login`)
|
|
24
|
-
- `--force`: 强制在当前分支继续(即使已是保护分支),**要求用户显式确认**: 输出 ⚠️ 警告 `'[WARN] 使用 --force 在 {branch} 分支上直接运行 sprint。此操作绕过隔离保护,请确认风险。'` → 等待用户确认("继续" / "取消") → 确认后进入 Phase 0
|
|
25
|
-
|
|
26
|
-
## 参数交互规则
|
|
27
|
-
|
|
28
|
-
| 参数组合 | 行为 |
|
|
29
|
-
|---------|------|
|
|
30
|
-
| `--no-isolate` 单独 | 跳过隔离,输出警告 → Phase 0 |
|
|
31
|
-
| `--force` 单独 | 跳过隔离,要求确认 → Phase 0 |
|
|
32
|
-
| `--no-isolate` + `--branch-name` | `--branch-name` 忽略,仅 `--no-isolate` 生效 |
|
|
33
|
-
| `--force` + `--branch-name` | `--branch-name` 忽略,仅 `--force` 生效 |
|
|
34
|
-
| `--no-isolate` + `--force` | 等效,输出 `--no-isolate` 警告 → Phase 0 |
|
|
35
|
-
| `--resume-from build` + `--no-isolate` | `--resume-from` 优先,直接跳过 Phase -1 |
|
|
36
|
-
|
|
37
|
-
## 错误处理和回退
|
|
38
|
-
|
|
39
|
-
| 错误场景 | 回退行为 |
|
|
40
|
-
|---------|---------|
|
|
41
|
-
| `git worktree add` 失败(沙箱/权限问题) | 输出 `[ERROR] git worktree add 失败: {error}` → `[WARN] 无法创建 worktree 隔离,将在当前目录继续。请手动设置隔离分支。` → 在当前目录继续 |
|
|
42
|
-
| `.gitignore` 自动添加失败 | 输出 `[WARN] 无法自动添加 .gitignore,请手动将 .worktrees/ 添加到 .gitignore` → 继续 |
|
|
43
|
-
| 基线测试失败 | 输出 `[FAIL] 基线测试未通过:` + 失败详情 → 询问用户 `'基线测试失败,是否继续 sprint?(y/N)'` |
|
|
44
|
-
|
|
45
|
-
## sprint-state.json isolation 对象格式
|
|
46
|
-
|
|
47
|
-
```json
|
|
48
|
-
{
|
|
49
|
-
"isolation": {
|
|
50
|
-
"worktree_path": ".worktrees/sprint/sprint-2026-05-24-01",
|
|
51
|
-
"branch": "sprint/2026-05-24-01",
|
|
52
|
-
"created_from": "main",
|
|
53
|
-
"created_from_commit": "abc123def..."
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
> **清理提示**: Sprint 完成(Phase 6 SHIP)后,执行 `git worktree remove <worktree_path>` 清理 worktree 目录,同时保留 `.sprint-state/` 中的历史记录。
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# Phase 0: THINK(需求探索与设计)
|
|
2
|
-
|
|
3
|
-
## 目标
|
|
4
|
-
|
|
5
|
-
使用 brainstorming skill 进行结构化需求探索,输出经用户批准的设计文档。
|
|
6
|
-
|
|
7
|
-
**关键变更(ISSUE30)**: 从 `office-hours` 切换到 `brainstorming`,原因:
|
|
8
|
-
- brainstorming 有 **HARD-GATE**(设计未批准 → 不可进入实现),防止 "觉得已经理解了就直接开始写代码"
|
|
9
|
-
- brainstorming 输出结构化设计文档,可直接作为 Phase 1 PLAN 的输入
|
|
10
|
-
- office-hours 的 YC 六问适合新产品方向验证,brainstorming 更适合"具体功能实现前设计"的场景
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## 调用 Skills
|
|
15
|
-
|
|
16
|
-
- `brainstorming` (superpowers) — **HARD-GATE**: 设计未批准 → 不可进入实现
|
|
17
|
-
- 可选补充:`office-hours` (gstack) — 当用户需求非常模糊、需要先验证产品方向时
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## HARD-GATE 机制
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
DO NOT enter Phase 1 (PLAN) or do any implementation
|
|
25
|
-
until the brainstorming design has been APPROVED by the user.
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
这是 sprint-flow 的关键安全门。brainstorming skill 内部会执行:
|
|
29
|
-
|
|
30
|
-
1. **Explore project context** — 检查文件、文档、最近 commits
|
|
31
|
-
2. **Ask clarifying questions** — 一次一个,理解目的/约束/成功标准
|
|
32
|
-
3. **Propose approaches** — 2-3 个方案,含 trade-offs 和建议
|
|
33
|
-
4. **Present design** — 分节展示,每节获得用户批准
|
|
34
|
-
5. **Write design doc** — 保存到 `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
35
|
-
6. **Transition to implementation** — brainstorming 自动调用 writing-plans
|
|
36
|
-
|
|
37
|
-
**sprint-flow 编排层行为**:
|
|
38
|
-
- 收到 brainstorming APPROVED 设计文档后,自动进入 Phase 1
|
|
39
|
-
- 如果 brainstorming 未完成(用户未 APPROVED),BLOCK 并等待
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## 执行步骤
|
|
44
|
-
|
|
45
|
-
### Step 1: 调用 brainstorming skill
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
skill(name="brainstorming", user_message="[需求描述]")
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
brainstorming 内部流程:
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
Explore project context → Ask clarifying questions → Propose 2-3 approaches
|
|
55
|
-
→ Present design sections → User approves design? → YES → Write design doc
|
|
56
|
-
→ Invoke writing-plans skill
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**注意**: brainstorming 内部会自动调用 `writing-plans` 创建实现计划,该计划直接作为 Phase 1 的输入。
|
|
60
|
-
|
|
61
|
-
### Step 2: 等待 HARD-GATE APPROVED
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
⚠️ HARD-GATE: 设计未 APPROVED → 不可进入 Phase 1
|
|
65
|
-
|
|
66
|
-
等待用户审批 brainstorming 输出的设计文档。
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
sprint-flow 编排层检查:
|
|
70
|
-
- [ ] 设计文档已保存 (`docs/plans/YYYY-MM-DD-<topic>-design.md`)
|
|
71
|
-
- [ ] 用户已 APPROVED
|
|
72
|
-
- [ ] 无未解决的 blocking questions
|
|
73
|
-
|
|
74
|
-
如果任一条件不满足 → **BLOCK**,等待用户确认。
|
|
75
|
-
|
|
76
|
-
### Step 3: 保存设计文档路径
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
设计文档路径写入 sprint-state,供 Phase 1 使用。
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
保存到 `<project-root>/.sprint-state/phase-outputs/design-doc.md`(内容为设计文档路径引用,或直接复制设计文档)。
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## 可选补充: office-hours(方向验证)
|
|
87
|
-
|
|
88
|
-
当用户输入非常模糊时(如 "我想做一个 AI 工具" 而不是 "开发用户登录功能"),可以先调用 `office-hours` 验证产品方向,再进入 brainstorming 详细设计:
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
skill(name="office-hours", user_message="[模糊需求描述]")
|
|
92
|
-
// → Pain Document → 再进入 brainstorming 详细设计
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**使用场景**:
|
|
96
|
-
- 用户描述的是一个新产品/新功能方向,而非具体功能
|
|
97
|
-
- 需要先验证"是否值得做"再进入"怎么做"
|
|
98
|
-
|
|
99
|
-
**如果不满足以上条件**: 直接跳过 office-hours,只使用 brainstorming。
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## 暂停点
|
|
104
|
-
|
|
105
|
-
| 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
|
|
106
|
-
|--------|---------|---------|-------------|
|
|
107
|
-
| **HARD-GATE** | brainstorming 设计未 APPROVED | 用户审批设计文档 | 设计 APPROVED 后自动进入 Phase 1 |
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## 输出
|
|
112
|
-
|
|
113
|
-
- Design Document (`docs/plans/YYYY-MM-DD-<topic>-design.md`)
|
|
114
|
-
- Implementation Plan(brainstorming 内部 writing-plans 输出)
|
|
115
|
-
- 进入 Phase 1 自动执行(使用设计文档作为输入)
|