xp-gate 0.5.1

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 (90) hide show
  1. package/adapter-common.sh +192 -0
  2. package/adapters/cpp.sh +76 -0
  3. package/adapters/dart.sh +41 -0
  4. package/adapters/flutter.sh +41 -0
  5. package/adapters/go.sh +59 -0
  6. package/adapters/iac.sh +189 -0
  7. package/adapters/java.sh +191 -0
  8. package/adapters/kotlin.sh +77 -0
  9. package/adapters/objectivec.sh +38 -0
  10. package/adapters/powershell.sh +138 -0
  11. package/adapters/python.sh +104 -0
  12. package/adapters/shell.sh +55 -0
  13. package/adapters/swift.sh +44 -0
  14. package/adapters/typescript.sh +61 -0
  15. package/bin/xp-gate.js +157 -0
  16. package/hooks/adapter-common.sh +192 -0
  17. package/hooks/pre-commit +1667 -0
  18. package/hooks/pre-push +395 -0
  19. package/lib/__tests__/detect-deps.test.js +209 -0
  20. package/lib/__tests__/doctor.test.js +448 -0
  21. package/lib/__tests__/download-skill.test.js +281 -0
  22. package/lib/__tests__/init.test.js +327 -0
  23. package/lib/__tests__/install-skill.test.js +326 -0
  24. package/lib/__tests__/migrate.test.js +212 -0
  25. package/lib/__tests__/rollback.test.js +183 -0
  26. package/lib/__tests__/ui-detector.test.ts +200 -0
  27. package/lib/__tests__/uninstall-skill.test.js +189 -0
  28. package/lib/__tests__/uninstall.test.js +589 -0
  29. package/lib/__tests__/update-skill.test.js +276 -0
  30. package/lib/detect-deps.js +157 -0
  31. package/lib/doctor.js +370 -0
  32. package/lib/download-skill.js +96 -0
  33. package/lib/init.js +367 -0
  34. package/lib/install-skill.js +184 -0
  35. package/lib/migrate.js +120 -0
  36. package/lib/rollback.js +78 -0
  37. package/lib/ui-detector.ts +99 -0
  38. package/lib/uninstall-skill.js +69 -0
  39. package/lib/uninstall.js +401 -0
  40. package/lib/update-skill.js +90 -0
  41. package/package.json +39 -0
  42. package/plugins/claude-code/.claude-plugin/plugin.json +21 -0
  43. package/plugins/claude-code/bin/delphi-review-guard.sh +68 -0
  44. package/plugins/claude-code/bin/xp-gate-check +47 -0
  45. package/plugins/claude-code/hooks/hooks.json +37 -0
  46. package/skills/delphi-review/.delphi-config.json.example +45 -0
  47. package/skills/delphi-review/AGENTS.md +54 -0
  48. package/skills/delphi-review/INSTALL.md +152 -0
  49. package/skills/delphi-review/SKILL.md +371 -0
  50. package/skills/delphi-review/evals/evals.json +82 -0
  51. package/skills/delphi-review/opencode.json.delphi.example +56 -0
  52. package/skills/delphi-review/references/code-walkthrough.md +486 -0
  53. package/skills/ralph-loop/SKILL.md +330 -0
  54. package/skills/ralph-loop/evals/evals.json +311 -0
  55. package/skills/ralph-loop/evolution-history.json +59 -0
  56. package/skills/ralph-loop/evolution-log.md +16 -0
  57. package/skills/ralph-loop/references/components/memory.md +55 -0
  58. package/skills/ralph-loop/references/components/middleware.md +54 -0
  59. package/skills/ralph-loop/references/components/skill-invocations.md +39 -0
  60. package/skills/ralph-loop/references/components/system-prompt.md +24 -0
  61. package/skills/ralph-loop/references/components/tool-descriptions.md +32 -0
  62. package/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
  63. package/skills/ralph-loop/templates/progress-log.md +36 -0
  64. package/skills/sprint-flow/SKILL.md +600 -0
  65. package/skills/sprint-flow/evals/evals.json +78 -0
  66. package/skills/sprint-flow/evolution-history.json +39 -0
  67. package/skills/sprint-flow/evolution-log.md +23 -0
  68. package/skills/sprint-flow/references/components/memory.md +87 -0
  69. package/skills/sprint-flow/references/components/middleware.md +72 -0
  70. package/skills/sprint-flow/references/components/skill-invocations.md +104 -0
  71. package/skills/sprint-flow/references/components/system-prompt.md +27 -0
  72. package/skills/sprint-flow/references/components/tool-descriptions.md +96 -0
  73. package/skills/sprint-flow/references/phase-0-think.md +115 -0
  74. package/skills/sprint-flow/references/phase-1-plan.md +178 -0
  75. package/skills/sprint-flow/references/phase-2-build.md +198 -0
  76. package/skills/sprint-flow/references/phase-3-review.md +213 -0
  77. package/skills/sprint-flow/references/phase-4-uat.md +125 -0
  78. package/skills/sprint-flow/references/phase-5-feedback.md +100 -0
  79. package/skills/sprint-flow/references/phase-6-ship.md +193 -0
  80. package/skills/sprint-flow/references/phase-7-land.md +140 -0
  81. package/skills/sprint-flow/references/phase-8-cleanup.md +192 -0
  82. package/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
  83. package/skills/sprint-flow/templates/pain-document-template.md +115 -0
  84. package/skills/sprint-flow/templates/sprint-summary-template.md +120 -0
  85. package/skills/test-specification-alignment/AGENTS.md +59 -0
  86. package/skills/test-specification-alignment/SKILL.md +605 -0
  87. package/skills/test-specification-alignment/evals/evals.json +75 -0
  88. package/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
  89. package/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
  90. package/skills/test-specification-alignment/references/specification-format.md +348 -0
@@ -0,0 +1,120 @@
1
+ # Emergent Issues Template
2
+
3
+ ## 使用说明
4
+
5
+ 此模板用于 Phase 4 (USER ACCEPTANCE) 人工验收。
6
+
7
+ ⚠️ 这是 AI 无法预测的 UX/质量问题,只有实际使用才能发现。
8
+
9
+ ---
10
+
11
+ # Emergent Issues - [需求名称]
12
+
13
+ ## 验收元信息
14
+
15
+ ```yaml
16
+ 验收日期: YYYY-MM-DD
17
+ 验收阶段: Phase 4 - USER ACCEPTANCE
18
+ 验收人: [姓名]
19
+ MVP 版本: v1.0
20
+ Sprint ID: sprint-YYYY-MM-DD-NN
21
+ ```
22
+
23
+ ---
24
+
25
+ ## 检查清单
26
+
27
+ ### 1. 核心功能体验 (Core Functionality UX)
28
+
29
+ - [ ] 功能是否按预期工作?
30
+ - [ ] 输入 → 输出的流程是否流畅?
31
+ - [ ] 边界情况处理是否正确?(空值、极限值、异常输入)
32
+ - [ ] 错误处理是否友好?
33
+
34
+ **发现的问题**:
35
+ | 问题描述 | 严重程度 | 影响范围 | 发现场景 |
36
+ |---------|---------|---------|---------|
37
+ | [填写] | [Critical/Major/Minor] | [填写] | [填写] |
38
+
39
+ ---
40
+
41
+ ### 2. 多轮交互体验 (Multi-turn Interaction UX)
42
+
43
+ - [ ] 多轮对话/操作是否连贯?
44
+ - [ ] 上下文是否正确传递?
45
+ - [ ] 用户意图理解是否准确?
46
+ - [ ] 响应是否生硬/机械?
47
+
48
+ **发现的问题**:
49
+ | 问题描述 | 严重程度 | 影响范围 | 发现场景 |
50
+ |---------|---------|---------|---------|
51
+ | [填写] | [Critical/Major/Minor] | [填写] | [填写] |
52
+
53
+ ---
54
+
55
+ ### 3. 视觉/交互体验 (Visual/Interaction UX)
56
+
57
+ - [ ] UI 元素是否清晰可辨?
58
+ - [ ] 是否存在"看起来像按钮但不可点击"的元素?
59
+ - [ ] 错误消息位置是否合理?(是否远离问题发生处)
60
+ - [ ] 响应时间是否满意?
61
+ - [ ] 移动端/桌面端是否一致?
62
+
63
+ **发现的问题**:
64
+ | 问题描述 | 严重程度 | 影响范围 | 发现场景 |
65
+ |---------|---------|---------|---------|
66
+ | [填写] | [Critical/Major/Minor] | [填写] | [填写] |
67
+
68
+ ---
69
+
70
+ ### 4. 用户认知负担 (Cognitive Load)
71
+
72
+ - [ ] 用户是否容易理解如何使用?
73
+ - [ ] 是否需要额外学习/培训?
74
+ - [ ] 概念/术语是否一致?
75
+ - [ ] 流程是否符合用户心智模型?
76
+
77
+ **发现的问题**:
78
+ | 问题描述 | 严重程度 | 影响范围 | 发现场景 |
79
+ |---------|---------|---------|---------|
80
+ | [填写] | [Critical/Major/Minor] | [填写] | [填写] |
81
+
82
+ ---
83
+
84
+ ### 5. 意外发现 (Unexpected Observations)
85
+
86
+ - [ ] 是否发现了未预期的用户行为?
87
+ - [ ] 是否发现了新需求场景?
88
+ - [ ] 是否发现了潜在优化点?
89
+
90
+ **发现的问题**:
91
+ | 问题描述 | 严重程度 | 影响范围 | 发现场景 |
92
+ |---------|---------|---------|---------|
93
+ | [填写] | [Critical/Major/Minor] | [填写] | [填写] |
94
+
95
+ ---
96
+
97
+ ## Emergent Issues Summary
98
+
99
+ | 总计发现问题数 | Critical | Major | Minor |
100
+ |---------------|----------|-------|-------|
101
+ | [填写] | [填写] | [填写] | [填写] |
102
+
103
+ ---
104
+
105
+ ## 验收结论
106
+
107
+ - [ ] ✅ 验收通过,进入 Phase 5 (Ship)
108
+ - [ ] ⚠️ 发现问题需 Sprint 2 迭代
109
+ - [ ] ❌ 重大问题,需重新规划
110
+
111
+ **验收人签名**: ________________ **日期**: ________________
112
+
113
+ ---
114
+
115
+ ## Next Step
116
+
117
+ 根据验收结论:
118
+ - ✅ 验收通过 → 进入 Phase 5 (FEEDBACK) 自动执行
119
+ - ⚠️ 发现问题 → 进入 Phase 5,记录反馈,准备 Sprint 2
120
+ - ❌ 重大问题 → Sprint 2 回到 Phase 0 重新规划
@@ -0,0 +1,115 @@
1
+ # Pain Document Template
2
+
3
+ ## 使用说明
4
+
5
+ 此模板用于 Phase 0 (THINK) 输出。基于 office-hours 六个强制问题验证需求真实性。
6
+
7
+ ---
8
+
9
+ # Pain Document - [需求名称]
10
+
11
+ ## 元信息
12
+
13
+ ```yaml
14
+ 生成日期: YYYY-MM-DD
15
+ 生成阶段: Phase 0 - THINK
16
+ 来源: office-hours skill
17
+ Sprint ID: sprint-YYYY-MM-DD-NN
18
+ ```
19
+
20
+ ---
21
+
22
+ ## 1. 需求现实 (Demand Reality)
23
+
24
+ **真实用户是否真的需要这个?**
25
+
26
+ [回答]
27
+
28
+ **现在有什么替代方案?**
29
+
30
+ [回答]
31
+
32
+ **为什么他们还没有用替代方案?**
33
+
34
+ [回答]
35
+
36
+ ---
37
+
38
+ ## 2. 当前状态 (Status Quo)
39
+
40
+ **用户现在怎么解决这个问题?**
41
+
42
+ [回答]
43
+
44
+ **他们的现状有多糟糕?**
45
+
46
+ [回答]
47
+
48
+ ---
49
+
50
+ ## 3. 绝望的具体性 (Desperate Specificity)
51
+
52
+ **能否描述一个具体的用户场景?**
53
+
54
+ [回答]
55
+
56
+ **这个场景有多绝望?**
57
+
58
+ [回答]
59
+
60
+ ---
61
+
62
+ ## 4. 最窄切入点 (Narrowest Wedge)
63
+
64
+ **最小的可行切入点是什么?**
65
+
66
+ [回答]
67
+
68
+ **为什么这是"最窄"?**
69
+
70
+ [回答]
71
+
72
+ ---
73
+
74
+ ## 5. 观察证据 (Observation)
75
+
76
+ **你自己是否观察到这个问题?**
77
+
78
+ [回答]
79
+
80
+ **数据或访谈支持吗?**
81
+
82
+ [回答]
83
+
84
+ ---
85
+
86
+ ## 6. 未来适配 (Future-fit)
87
+
88
+ **这个需求在未来 3-5 年是否仍然存在?**
89
+
90
+ [回答]
91
+
92
+ **是否会被技术变化淘汰?**
93
+
94
+ [回答]
95
+
96
+ ---
97
+
98
+ ## Pain Statement (一句话痛点)
99
+
100
+ > [用一句话描述为什么这是真实痛点]
101
+
102
+ ---
103
+
104
+ ## Proposed Solution (建议方案)
105
+
106
+ 基于六个问题推导出的初步方案:
107
+
108
+ [方案描述]
109
+
110
+ ---
111
+
112
+ ## Next Step
113
+
114
+ - 进入 Phase 1 (PLAN) 自动执行
115
+ - 调用 autoplan skill 进行需求评审
@@ -0,0 +1,120 @@
1
+ # Sprint Summary Template
2
+
3
+ ## 使用说明
4
+
5
+ 此模板用于 Phase 6 (SHIP) 结束时生成 Sprint 总结。
6
+
7
+ ---
8
+
9
+ # Sprint Summary - [需求名称]
10
+
11
+ ## Sprint 元信息
12
+
13
+ ```yaml
14
+ Sprint ID: sprint-YYYY-MM-DD-NN
15
+ 开始日期: YYYY-MM-DD
16
+ 结束日期: YYYY-MM-DD
17
+ 总耗时: [X hours/days]
18
+ MVP 版本: v1.0
19
+ 最终状态: [completed/needs-sprint-2]
20
+ ```
21
+
22
+ ---
23
+
24
+ ## 阶段执行统计
25
+
26
+ | Phase | 耗时 | 状态 | 暂停次数 | 备注 |
27
+ |-------|------|------|---------|------|
28
+ | Phase 0: THINK | [X min] | ✅ 完成 | 0 | [备注] |
29
+ | Phase 1: PLAN | [X min] | ✅ 完成 | [N] | [备注] |
30
+ | Phase 2: BUILD | [X min] | ✅ 完成 | [N] | [备注] |
31
+ | Phase 3: REVIEW | [X min] | ✅ 完成 | [N] | [备注] |
32
+ | Phase 4: UAT | [X min] | ✅ 完成 | 1 (必须) | [备注] |
33
+ | Phase 5: FEEDBACK | [X min] | ✅ 完成 | 0 | [备注] |
34
+ | Phase 6: SHIP | [X min] | ✅ 完成 | [N] | [备注] |
35
+
36
+ ---
37
+
38
+ ## Skills 调用统计
39
+
40
+ | Skill | 调用次数 | 结果 | 备注 |
41
+ |-------|---------|------|------|
42
+ | office-hours | 1 | ✅ | Pain Document 生成 |
43
+ | autoplan | 1 | ✅/⚠️ | [taste_decisions 数量] |
44
+ | delphi-review | [N] rounds | ✅ APPROVED | [Round 数量] |
45
+ | specification.yaml | 1 | ✅ | specification.yaml |
46
+ | BUILD (TDD + review) | 1 | ✅ APPROVED | [Gate 1 失败次数] |
47
+ | test-driven-development | [N] | ✅ | [BUILD (TDD + review) 内部调用] |
48
+ | cross-model-review | [N] rounds | ✅ APPROVED | [Round 数量] |
49
+ | test-specification-alignment | 1 | ✅ | [覆盖率] |
50
+ | browse | 1 | ✅ | [QA 通过] |
51
+ | learn | 1 | ✅ | [记录数量] |
52
+ | ship | 1 | ✅ | [PR URL] |
53
+ | land-and-deploy | 1 | ✅ | [部署 URL] |
54
+ | canary | 1 | ✅ | [监控正常] |
55
+
56
+ ---
57
+
58
+ ## Emergent 发现统计
59
+
60
+ | 类别 | 数量 | 处理状态 | 备注 |
61
+ |------|------|---------|------|
62
+ | Critical | [N] | [自动 Sprint 2] | [描述] |
63
+ | Major | [N] | [询问用户] | [描述] |
64
+ | Minor | [N] | [可选纳入 Sprint 2] | [描述] |
65
+
66
+ ---
67
+
68
+ ## 交付物清单
69
+
70
+ | 交付物 | 路径 | 状态 |
71
+ |-------|------|------|
72
+ | Pain Document | `.sprint-state/phase-outputs/pain-document.md` | ✅ |
73
+ | Specification | `.sprint-state/phase-outputs/specification.yaml` | ✅ |
74
+ | MVP v1 | `.sprint-state/phase-outputs/mvp-v1/` | ✅ |
75
+ | Review Report | `.sprint-state/phase-outputs/review-report.md` | ✅ |
76
+ | Emergent Issues | `.sprint-state/phase-outputs/emergent-issues.md` | ✅/⚠️ |
77
+ | Feedback Log | `.sprint-state/phase-outputs/feedback-log.md` | ✅ |
78
+ | Sprint Summary | `.sprint-state/phase-outputs/sprint-summary.md` | ✅ |
79
+
80
+ ---
81
+
82
+ ## 关键决策记录
83
+
84
+ | 决策点 | 选项 | 选择 | 理由 |
85
+ |-------|------|------|------|
86
+ | [决策1] | [A/B] | [选择] | [理由] |
87
+ | [决策2] | [A/B] | [选择] | [理由] |
88
+
89
+ ---
90
+
91
+ ## Sprint 2 建议(如有 emergent issues)
92
+
93
+ ```yaml
94
+ Sprint 2 触发: [auto/user-confirm/none]
95
+ Sprint 2 Pain Document: sprint2-pain.md
96
+
97
+ Critical Issues (自动纳入):
98
+ - [Issue 1]
99
+ - [Issue 2]
100
+
101
+ Major Issues (建议纳入):
102
+ - [Issue 1]
103
+
104
+ Minor Issues (可选纳入):
105
+ - [Issue 1]
106
+ ```
107
+
108
+ ---
109
+
110
+ ## 下一步行动
111
+
112
+ 根据 Sprint 状态:
113
+ - ✅ Sprint 完成 → 结束流程
114
+ - ⚠️ 有 emergent issues → 提示用户是否开始 Sprint 2
115
+ - ❌ Sprint 失败 → 记录失败原因,结束流程
116
+
117
+ ---
118
+
119
+ **Sprint 结束时间**: YYYY-MM-DD HH:MM:SS
120
+ **报告生成人**: sprint-flow skill
@@ -0,0 +1,59 @@
1
+ # SKILLS/TEST-SPECIFICATION-ALIGNMENT KNOWLEDGE BASE
2
+
3
+ **Generated:** 2026-05-02
4
+ **Commit:** 1f6bc7d
5
+ **Branch:** main
6
+
7
+ ## OVERVIEW
8
+ Test-Specification Alignment Engine - Two-stage validation ensuring tests accurately reflect requirements and design specs.
9
+
10
+ ## STRUCTURE
11
+ ```
12
+ skills/test-specification-alignment/
13
+ ├── SKILL.md # Core alignment engine definition
14
+ └── references/ # Supporting documentation
15
+ ```
16
+
17
+ ## WHERE TO LOOK
18
+ | Task | Location | Notes |
19
+ |------|----------|-------|
20
+ | Core Logic | SKILL.md | Main alignment workflow |
21
+ | Two-Stage Flow | SKILL.md | Phase 1 (align) + Phase 2 (execute) |
22
+
23
+ ## CODE MAP
24
+ | Symbol | Type | Location | Refs | Role |
25
+ |--------|------|----------|------|------|
26
+ | Phase 1 | Align Verification | SKILL.md | N/A | Test alignment with specification |
27
+ | Phase 2 | Execute Tests | SKILL.md | N/A | Test execution with freezes |
28
+ | Freeze Mechanism | Constraint | SKILL.md | N/A | Prevent test modifications during Phase 2 |
29
+
30
+ ## CONVENTIONS
31
+ - Phase 1 allows test modifications to align with specification
32
+ - Phase 2 prohibits any test modifications (freeze enforced)
33
+ - Minimum 80% alignment score required to pass
34
+ - All @test, @intent, @covers tags must be present
35
+
36
+ ## ANTI-PATTERNS (THIS PROJECT)
37
+ - Do NOT modify tests during Phase 2 execution
38
+ - Do NOT proceed with low alignment score (<80%)
39
+ - Do NOT skip specification validation if specification exists
40
+
41
+ ## UNIQUE STYLES
42
+ - Two-phase separation (modify vs. execute)
43
+ - Freeze/unfreeze test protection
44
+ - YAML specification-driven validation
45
+ - Structured JSDoc tag requirements
46
+
47
+ ## COMMANDS
48
+ ```bash
49
+ # Trigger test-specification alignment
50
+ /test-specification-alignment
51
+
52
+ # Check specification alignment
53
+ /verify-tests
54
+ ```
55
+
56
+ ## NOTES
57
+ - Integrates with BUILD (TDD + review) before Arbiter review
58
+ - Mandated before gstack-ship release
59
+ - Uses freeze skill to lock test directories during Phase 2