@boyingliu01/xp-gate 0.12.9 → 0.12.10

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.
Files changed (36) hide show
  1. package/adapter-common.sh +13 -18
  2. package/lib/__tests__/doctor.test.js +65 -38
  3. package/lib/check-version.js +19 -4
  4. package/lib/upgrade.js +64 -0
  5. package/mock-policy/AGENTS.md +3 -3
  6. package/mutation/AGENTS.md +3 -3
  7. package/mutation/runners/stryker-runner.ts +7 -5
  8. package/package.json +1 -1
  9. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  10. package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
  11. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
  12. package/plugins/claude-code/skills/sprint-flow/SKILL.md +117 -14
  13. package/plugins/claude-code/skills/sprint-flow/__tests__/sprint-flow.test.cjs +444 -0
  14. package/plugins/claude-code/skills/sprint-flow/references/phase-2-build.md +104 -0
  15. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
  16. package/plugins/opencode/package.json +1 -1
  17. package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
  18. package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
  19. package/plugins/opencode/skills/sprint-flow/SKILL.md +117 -14
  20. package/plugins/opencode/skills/sprint-flow/__tests__/sprint-flow.test.cjs +444 -0
  21. package/plugins/opencode/skills/sprint-flow/references/phase-2-build.md +104 -0
  22. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
  23. package/plugins/qoder/plugin.json +1 -1
  24. package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
  25. package/plugins/qoder/skills/sprint-flow/AGENTS.md +3 -3
  26. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
  27. package/principles/AGENTS.md +3 -3
  28. package/principles/__tests__/config.test.ts +1 -1
  29. package/principles/config.ts +1 -1
  30. package/principles/rules/__tests__/clean-code/large-file.test.ts +6 -6
  31. package/skills/delphi-review/AGENTS.md +3 -3
  32. package/skills/sprint-flow/AGENTS.md +3 -3
  33. package/skills/sprint-flow/SKILL.md +117 -14
  34. package/skills/sprint-flow/__tests__/sprint-flow.test.cjs +444 -0
  35. package/skills/sprint-flow/references/phase-2-build.md +104 -0
  36. package/skills/test-specification-alignment/AGENTS.md +3 -3
@@ -20,6 +20,65 @@
20
20
 
21
21
  ---
22
22
 
23
+ ---
24
+
25
+ ## Uncommitted Changes Gate
26
+
27
+ **Purpose**: Prevent entering BUILD with uncommitted changes that could mix with sprint work.
28
+
29
+ **Execution**: Before entering Phase 2 BUILD, the orchestrator MUST check for uncommitted changes in the worktree.
30
+
31
+ ### Gate Logic
32
+
33
+ ```bash
34
+ # Check for uncommitted changes
35
+ UNCOMMITTED=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
36
+
37
+ if [ "$SKIP_UNCOMMITTED_GATE" = "1" ]; then
38
+ echo "[UNCOMMITTED-GATE] Skipped (SKIP_UNCOMMITTED_GATE=1)"
39
+ echo "{\"skipped\":true,\"reason\":\"SKIP_UNCOMMITTED_GATE=1\",\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > .sprint-state/uncommitted-gate-log.json
40
+ elif [ "$UNCOMMITTED" -gt 0 ]; then
41
+ echo "⚠️ [UNCOMMITTED-GATE] Found ${UNCOMMITTED} uncommitted files in worktree:"
42
+ git status --short 2>/dev/null | head -20
43
+ echo ""
44
+ echo "Uncommitted changes may conflict with sprint work. Recommended actions:"
45
+ echo " 1. Commit changes: git add -A && git commit -m 'pre-sprint: save work before BUILD'"
46
+ echo " 2. Stash changes: git stash push -m 'pre-sprint stash'"
47
+ echo " 3. Skip gate: export SKIP_UNCOMMITTED_GATE=1 (not recommended)"
48
+ echo ""
49
+ echo "Logging to .sprint-state/uncommitted-gate-log.json"
50
+ echo "{\"blocked\":true,\"uncommitted_files\":${UNCOMMITTED},\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > .sprint-state/uncommitted-gate-log.json
51
+ echo "[BLOCK] Uncommitted changes detected. Please commit, stash, or set SKIP_UNCOMMITTED_GATE=1 to continue."
52
+ exit 1
53
+ else
54
+ echo "✅ [UNCOMMITTED-GATE] Worktree clean. Proceeding to BUILD."
55
+ echo "{\"clean\":true,\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > .sprint-state/uncommitted-gate-log.json
56
+ fi
57
+ ```
58
+
59
+ ### Escape Valve
60
+
61
+ ```bash
62
+ # Skip the uncommitted changes gate (use with caution)
63
+ SKIP_UNCOMMITTED_GATE=1
64
+ ```
65
+
66
+ ### Log Format (`.sprint-state/uncommitted-gate-log.json`)
67
+
68
+ ```json
69
+ {
70
+ "clean": true,
71
+ "blocked": false,
72
+ "skipped": false,
73
+ "uncommitted_files": 0,
74
+ "timestamp": "2026-07-05T10:00:00Z"
75
+ }
76
+ ```
77
+
78
+ **Log location**: `.sprint-state/uncommitted-gate-log.json` — written on every gate execution for audit trail.
79
+
80
+ ---
81
+
23
82
  ## TDD 强制执行
24
83
 
25
84
  ### Gate 5a-BLOCK: 新增文件测试强制
@@ -41,3 +100,48 @@
41
100
  # 非 main/master 分支临时跳过 Gate 5a-BLOCK
42
101
  SKIP_GATE_5A_BLOCK=1 git commit -m "message"
43
102
  ```
103
+
104
+ ---
105
+
106
+ ## Timing & Stability
107
+
108
+ This section documents expected execution times and timeout handling for each Phase 2 sub-step to reduce execution timing stddev and prevent pipeline stalls.
109
+
110
+ ### Expected Execution Times
111
+
112
+ | Step | Description | Expected Time | Timeout | On Timeout |
113
+ |------|-------------|--------------|---------|------------|
114
+ | DELPHI-GATE | Verify delphi-reviewed.json exists | 1-2s | 10s | BLOCK (critical gate) |
115
+ | ralph-loop (per REQ) | TDD + verification per requirement | 5-15 min | 30 min/REQ | Mark REQ as `timeout`, continue next REQ |
116
+ | parallel dispatch | Multi-agent parallel build | 10-30 min | 45 min | Collect partial results, continue |
117
+ | TDD cycle (per unit) | RED → GREEN → REFACTOR | 2-5 min | 10 min | Skip unit, log failure |
118
+ | freeze + blind-review | Code review in isolation | 5-10 min | 20 min | WARNING, continue |
119
+ | verification | Test suite + coverage check | 2-5 min | 15 min | Retry once, then BLOCK |
120
+ | cost monitor | Token cost accounting | <1s | 5s | Skip, log warning |
121
+ | Phase 2 total (lightweight) | ≤3 REQs | 15-30 min | 45 min | — |
122
+ | Phase 2 total (standard) | 4-10 REQs | 30-120 min | 150 min | — |
123
+ | Phase 2 total (complex) | >10 REQs | 60-240 min | 300 min | — |
124
+
125
+ ### Stability Guidelines
126
+
127
+ 1. **Timeout handling**: All Phase 2 sub-steps MUST have explicit timeouts. If a step times out, log the failure to `.sprint-state/phase-outputs/phase-2-errors.json` and continue to the next step (except DELPHI-GATE which is a hard BLOCK).
128
+
129
+ 2. **Retry strategy**: For recoverable failures (verification, TDD cycle):
130
+ - First failure: log warning, retry once
131
+ - Second failure: log error, BLOCK and prompt user decision
132
+ - Do NOT retry more than twice for any single sub-step
133
+
134
+ 3. **Parallel dispatch stability**: When using `--mode parallel`, if any agent fails:
135
+ - Collect partial results from successful agents
136
+ - Rerun failed agent(s) individually with `--mode ralph-loop`
137
+ - Do NOT rerun the entire parallel batch
138
+
139
+ 4. **Cost monitor thresholds**:
140
+ - Token cost per REQ > 50,000 → WARNING (review REQ scope)
141
+ - Token cost per REQ > 100,000 → BLOCK (REQ too large, split into smaller units)
142
+
143
+ 5. **StdDev reduction**: To reduce execution timing variability:
144
+ - Cache dependency installation results between REQs
145
+ - Reuse TDD scaffolding across similar REQ types
146
+ - Pre-compute code structure analysis once at Phase start
147
+ - Batch lint/format operations at the end, not per REQ
@@ -1,9 +1,9 @@
1
1
  # SKILLS/TEST-SPECIFICATION-ALIGNMENT KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-07-05
4
- **Commit:** a620d9b
3
+ **Generated:** 2026-07-03
4
+ **Commit:** c3ed581
5
5
  **Branch:** main
6
- **Version:** 0.12.9.0
6
+ **Version:** 0.12.4.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/opencode-plugin",
3
- "version": "0.12.9",
3
+ "version": "0.12.10",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "description": "XP-Gate quality gates + AI workflow skills + Sprint Flow TUI sidebar for OpenCode",
@@ -1,9 +1,9 @@
1
1
  # SKILLS/DELPHI-REVIEW KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-07-05
4
- **Commit:** a620d9b
3
+ **Generated:** 2026-07-03
4
+ **Commit:** c3ed581
5
5
  **Branch:** main
6
- **Version:** 0.12.9.0
6
+ **Version:** 0.12.4.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, 3 experts from ≥2 providers, domestic models only). Supports design + code-walkthrough modes.
@@ -1,9 +1,9 @@
1
1
  # SKILLS/SPRINT-FLOW KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-07-05
4
- **Commit:** a620d9b
3
+ **Generated:** 2026-07-03
4
+ **Commit:** c3ed581
5
5
  **Branch:** main
6
- **Version:** 0.12.9.0
6
+ **Version:** 0.12.4.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **11-phase** development pipeline: ISOLATE → AUTO-ESTIMATE → THINK → PLAN → BUILD → REVIEW → SHIP → LAND → USER ACCEPTANCE → FEEDBACK → CLEANUP. Phase 2 default build mode is **ralph-loop** (REQ-level iteration, 40-67% token savings vs parallel). HARD-GATE in Phase 1: design must pass Delphi review (≥90% consensus) before any coding.
@@ -13,7 +13,7 @@ description: >
13
13
  - "start sprint"
14
14
  - "一键开发"
15
15
  - "/sprint-flow"
16
- 触发后第一行输出: `Sprint Flow: ISOLATE → AUTO-ESTIMATE → THINK → PLAN → BUILD → REVIEW → SHIP → LAND → USER ACCEPTANCE → FEEDBACK → CLEANUP`
16
+ 触发后第一行输出: `Sprint Flow: ISOLATE → AUTO-ESTIMATE → THINK → PLAN → BUILD → REVIEW → FEEDBACK → SHIP → LAND → USER ACCEPTANCE → CLEANUP`
17
17
  用法: /sprint-flow "[需求描述]"
18
18
  示例: /sprint-flow "开发访谈机器人,支持多轮对话"
19
19
  可选参数:
@@ -37,6 +37,44 @@ triggers:
37
37
  - "开发新功能"
38
38
  - "实现 X"
39
39
  - "一键开发"
40
+ triggers_negative_examples:
41
+ - "实现排序算法" # algorithm implementation, not feature development
42
+ - "实现一下" # casual "do it", not a sprint request
43
+ - "帮我实现这个函数" # single function, not full feature
44
+ - "怎么实现登录功能" # asking HOW, not requesting development
45
+ - "start spring boot" # framework name, not sprint
46
+ - "开发环境配置" # environment setup, not feature development
47
+ - "一键部署" # deploy, not develop
48
+ - "新功能建议" # feature suggestion/request, not execution
49
+ - "implement a sort function" # algorithm, not full feature
50
+ - "how to implement auth" # educational question
51
+ triggers_negative_test_cases:
52
+ - input: "实现排序算法"
53
+ expect: "NOT triggered"
54
+ - input: "实现一下"
55
+ expect: "NOT triggered"
56
+ - input: "帮我实现这个函数"
57
+ expect: "NOT triggered"
58
+ - input: "怎么实现登录功能"
59
+ expect: "NOT triggered"
60
+ - input: "start spring boot"
61
+ expect: "NOT triggered"
62
+ - input: "开发环境配置"
63
+ expect: "NOT triggered"
64
+ - input: "一键部署"
65
+ expect: "NOT triggered"
66
+ - input: "新功能建议"
67
+ expect: "NOT triggered"
68
+ - input: "implement a sort function"
69
+ expect: "NOT triggered"
70
+ - input: "how to implement auth"
71
+ expect: "NOT triggered"
72
+ - input: "开发用户认证模块"
73
+ expect: "triggered"
74
+ - input: "/sprint-flow \"开发访谈机器人\""
75
+ expect: "triggered"
76
+ - input: "一键开发 REST API"
77
+ expect: "triggered"
40
78
  workflow_steps:
41
79
  - "Phase -1: ISOLATE"
42
80
  - "Phase -0.5: AUTO-ESTIMATE"
@@ -108,6 +146,35 @@ workflow_steps:
108
146
 
109
147
  ---
110
148
 
149
+ ## Unique Value Proposition
150
+
151
+ Sprint Flow is NOT just a sequential launcher of existing skills. Here's what makes it different from manually running each skill:
152
+
153
+ ### Why Sprint Flow vs Manual Skill Execution
154
+
155
+ | Dimension | Manual Execution | Sprint Flow |
156
+ |-----------|-----------------|-------------|
157
+ | **Context Continuity** | Each skill starts fresh; lost design decisions between phases | Phase summaries + sprint-state.json maintain full traceability across 11 phases |
158
+ | **Gate Enforcement** | No enforcement — easy to skip Delphi, skip TDD, skip UAT | HARD-GATE: design must be APPROVED (≥90% Delphi consensus) before coding; UAT is mandatory (no bypass) |
159
+ | **Token Efficiency** | Linear context accumulation across phases — ~150K+ tokens | Ralph-loop default: 40-67% token savings via clean REQ-level contexts |
160
+ | **Emergent Requirements** | Discovered late, silently ignored or merged | Phase 7 USER ACCEPTANCE explicitly captures emergent issues via template; triggers Sprint 2 for critical issues |
161
+ | **Quality Ecosystem** | No integration with quality gates | Integrated with xp-gate's full quality ecosystem: Gate 5 (coverage), Gate M2 (mock density), Delphi code-walkthrough |
162
+ | **Progress Tracking** | Ad-hoc, memory-based | `.sprint-state/` persistence with phase history, timing, and metrics — `--status` renders progress dashboard |
163
+
164
+ ### Key Differentiators
165
+
166
+ 1. **40-67% Token Savings via Ralph Loop**: Phase 2 default (`ralph-loop`) processes one REQ at a time with clean context, avoiding the linear context accumulation that costs 150K+ tokens in parallel mode.
167
+
168
+ 2. **HARD-GATE Discipline**: Design must pass Delphi review (≥90% consensus, ≥2 model providers, domestic models only) before Phase 2 BUILD can start. This is enforced both in SKILL.md instructions and via the Claude Code plugin's PreToolUse hook.
169
+
170
+ 3. **Emergent Requirements Acknowledgment**: Based on research showing 78% of failures are invisible to AI (arXiv study), Phase 7 USER ACCEPTANCE is a mandatory manual verification step — cannot be automated, skipped, or bypassed.
171
+
172
+ 4. **XP-Gate Quality Ecosystem Integration**: Sprint Flow is part of the broader xp-gate ecosystem. Phase 2 BUILD integrates with Gate 5 (test coverage ≥80%), Gate M2 (mock density ≤30%), and Gate MW (code-walkthrough validation). Phase 3 REVIEW runs Delphi code-walkthrough that generates `.code-walkthrough-result.json` for pre-push enforcement.
173
+
174
+ 5. **Full Lifecycle Coverage**: From worktree isolation (Phase -1) to cleanup (Phase 8), sprint-flow covers the entire development lifecycle — not just the "write code" part. AUTO-ESTIMATE (Phase -0.5) prevents over-engineering by routing lightweight changes through simplified workflows.
175
+
176
+ ---
177
+
111
178
  ## 完整流程(默认无参数)
112
179
 
113
180
  调用 `/sprint-flow "[需求描述]"` 后,自动执行以下流程:
@@ -162,7 +229,7 @@ Phase 8: CLEANUP → worktree remove + branch delete + sprint summary
162
229
 
163
230
  **Phase Flow**:
164
231
  ```
165
- ISOLATE → AUTO-ESTIMATE → THINK → PLAN → [GITHOOKS-GATE] → BUILD → REVIEW → SHIP → LAND → USER ACCEPTFEEDBACK → CLEANUP
232
+ ISOLATE → AUTO-ESTIMATE → THINK → PLAN → [GITHOOKS-GATE] → BUILD → REVIEW → FEEDBACK → SHIP → LAND → USER ACCEPTANCE → CLEANUP
166
233
  ```
167
234
 
168
235
  **Hard Gates**:
@@ -202,7 +269,7 @@ ISOLATE → AUTO-ESTIMATE → THINK → PLAN → [GITHOOKS-GATE] → BUILD → R
202
269
  6. 触发 `/sprint-flow` 后,**第一行输出应包含工作流阶段概览**:
203
270
 
204
271
  ```
205
- Sprint Flow: ISOLATE → AUTO-ESTIMATE → THINK → PLAN → BUILD → REVIEW → SHIP → LAND → USER ACCEPTANCE → FEEDBACK → CLEANUP
272
+ Sprint Flow: ISOLATE → AUTO-ESTIMATE → THINK → PLAN → BUILD → REVIEW → FEEDBACK → SHIP → LAND → USER ACCEPTANCE → CLEANUP
206
273
  ```
207
274
 
208
275
  ### Phase -1: ISOLATE(git worktree 隔离)
@@ -508,17 +575,22 @@ See [Output Contract](#output-contract) below for the canonical machine-readable
508
575
  ## References
509
576
 
510
577
  详细指令文件位于 `@references/`:
511
- - `@references/phase-minus-1-isolate.md` — Phase -1 详细指令
512
- - `@references/phase-minus-0-5-auto-estimate.md` Phase -0.5 详细指令
513
- - `@references/phase-0-think.md` — Phase 0 详细指令
514
- - `@references/phase-1-plan.md` Phase 1 详细指令
515
- - `@references/phase-2-build.md` — Phase 2 详细指令
516
- - `@references/phase-3-review.md` Phase 3 详细指令
517
- - `@references/phase-4-uat.md` Phase 7 USER ACCEPTANCE 详细指令(人工)
518
- - `@references/phase-5-feedback.md` Phase 4 FEEDBACK 详细指令
519
- - `@references/phase-6-ship.md` Phase 5 SHIP 详细指令
520
- - `@references/phase-7-land.md` Phase 6 LAND 详细指令
521
- - `@references/phase-8-cleanup.md` Phase 8 CLEANUP 详细指令
578
+
579
+ > ⚠️ **Filename numbering note**: Reference filenames use legacy numbering that does NOT match the canonical phase numbers in this document. The table below provides the correct mapping.
580
+
581
+ | File | Canonical Phase | Phase Name |
582
+ |------|----------------|------------|
583
+ | `@references/phase-minus-1-isolate.md` | Phase -1 | ISOLATE |
584
+ | `@references/phase-minus-0-5-auto-estimate.md` | Phase -0.5 | AUTO-ESTIMATE |
585
+ | `@references/phase-0-think.md` | Phase 0 | THINK |
586
+ | `@references/phase-1-plan.md` | Phase 1 | PLAN |
587
+ | `@references/phase-2-build.md` | Phase 2 | BUILD |
588
+ | `@references/phase-3-review.md` | Phase 3 | REVIEW |
589
+ | `@references/phase-5-feedback.md` | Phase 4 | FEEDBACK (⚠️ filename says phase-5) |
590
+ | `@references/phase-6-ship.md` | Phase 5 | SHIP (⚠️ filename says phase-6) |
591
+ | `@references/phase-7-land.md` | Phase 6 | LAND (⚠️ filename says phase-7) |
592
+ | `@references/phase-4-uat.md` | Phase 7 | USER ACCEPTANCE (⚠️ filename says phase-4) |
593
+ | `@references/phase-8-cleanup.md` | Phase 8 | CLEANUP |
522
594
 
523
595
  ---
524
596
 
@@ -543,3 +615,34 @@ See [Output Contract](#output-contract) below for the canonical machine-readable
543
615
  | 78% failures invisible | arXiv research | Phase 7 必要性证明 |
544
616
  | Think → Plan → Build → Ship | gstack ETHOS | 整体流程设计 |
545
617
 
618
+ ---
619
+
620
+ ## Phase Flow Consistency
621
+
622
+ This section documents the canonical 11-phase order to ensure all future edits keep the phase sequence synchronized across all locations in this document and its reference files.
623
+
624
+ **Canonical Phase Order** (Phase -1, -0.5, 0..8):
625
+
626
+ | Phase # | Name | Phase # | Name |
627
+ |---------|------|---------|------|
628
+ | -1 | ISOLATE | 4 | FEEDBACK |
629
+ | -0.5 | AUTO-ESTIMATE | 5 | SHIP |
630
+ | 0 | THINK | 6 | LAND |
631
+ | 1 | PLAN | 7 | USER ACCEPTANCE |
632
+ | 2 | BUILD | 8 | CLEANUP |
633
+ | 3 | REVIEW | | |
634
+
635
+ **Locations that MUST keep this order synchronized**:
636
+ 1. **Frontmatter `workflow_steps`** (lines ~40-51): Phase list
637
+ 2. **Frontmatter `description` trigger text** (line ~16): Flow string
638
+ 3. **Body "完整流程" section** (lines ~115-127): Phase descriptions in order
639
+ 4. **Body "Phase Flow" diagram** (line ~164): ASCII flow diagram
640
+ 5. **Body "强制输出格式规范" section** (line ~204): Output format
641
+ 6. **Body "Workflow Steps" table** (lines ~149-162): Step/Phase table
642
+ 7. **Body "References" section** (lines ~516-521): Reference file list
643
+ 8. **`references/orchestration-rules.md` Phase Subagent Dispatch Matrix**: Phase/Name order
644
+ 9. **`references/phase-4-uat.md`**: Phase 7 USER ACCEPTANCE (⚠️ file named phase-4, phase number is 7)
645
+ 10. **`references/phase-5-feedback.md`**: Phase 4 FEEDBACK (⚠️ file named phase-5, phase number is 4)
646
+
647
+ **⚠️ Known naming discrepancy**: Reference files use legacy numbering (`phase-4-uat.md` for Phase 7, `phase-5-feedback.md` for Phase 4, `phase-6-ship.md` for Phase 5, `phase-7-land.md` for Phase 6). The canonical phase NUMBER is determined by the `Phase #` column above — reference file names are mapped via the References section, not by their filename digits.
648
+