@boyingliu01/xp-gate 0.8.18 → 0.8.20

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 (49) hide show
  1. package/lib/init.js +2 -2
  2. package/lib/install-skill.js +13 -4
  3. package/lib/principles.js +5 -0
  4. package/mock-policy/AGENTS.md +2 -2
  5. package/mutation/AGENTS.md +2 -2
  6. package/package.json +1 -1
  7. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  8. package/plugins/claude-code/skills/delphi-review/AGENTS.md +2 -2
  9. package/plugins/claude-code/skills/delphi-review/SKILL.md +76 -0
  10. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +2 -2
  11. package/plugins/claude-code/skills/sprint-flow/SKILL.md +133 -1083
  12. package/plugins/claude-code/skills/sprint-flow/references/components/middleware.md +5 -2
  13. package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +333 -0
  14. package/plugins/claude-code/skills/sprint-flow/references/phase-2-build.md +4 -193
  15. package/plugins/claude-code/skills/sprint-flow/references/phase-6-ship.md +4 -188
  16. package/plugins/claude-code/skills/sprint-flow/references/phase-7-land.md +4 -135
  17. package/plugins/claude-code/skills/sprint-flow/references/phase-8-cleanup.md +4 -187
  18. package/plugins/claude-code/skills/sprint-flow/references/phase-minus-1-isolate.md +58 -0
  19. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +2 -2
  20. package/plugins/opencode/package.json +1 -1
  21. package/plugins/opencode/skills/delphi-review/AGENTS.md +2 -2
  22. package/plugins/opencode/skills/delphi-review/SKILL.md +76 -0
  23. package/plugins/opencode/skills/sprint-flow/AGENTS.md +2 -2
  24. package/plugins/opencode/skills/sprint-flow/SKILL.md +133 -1083
  25. package/plugins/opencode/skills/sprint-flow/references/components/middleware.md +5 -2
  26. package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +333 -0
  27. package/plugins/opencode/skills/sprint-flow/references/phase-2-build.md +4 -193
  28. package/plugins/opencode/skills/sprint-flow/references/phase-6-ship.md +4 -188
  29. package/plugins/opencode/skills/sprint-flow/references/phase-7-land.md +4 -135
  30. package/plugins/opencode/skills/sprint-flow/references/phase-8-cleanup.md +4 -187
  31. package/plugins/opencode/skills/sprint-flow/references/phase-minus-1-isolate.md +58 -0
  32. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +2 -2
  33. package/plugins/qoder/bin/xp-gate-check +5 -1
  34. package/plugins/qoder/skills/delphi-review/AGENTS.md +2 -2
  35. package/plugins/qoder/skills/sprint-flow/AGENTS.md +2 -2
  36. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +2 -2
  37. package/principles/AGENTS.md +2 -2
  38. package/skills/delphi-review/AGENTS.md +2 -2
  39. package/skills/delphi-review/SKILL.md +76 -0
  40. package/skills/sprint-flow/AGENTS.md +2 -2
  41. package/skills/sprint-flow/SKILL.md +133 -1083
  42. package/skills/sprint-flow/references/components/middleware.md +5 -2
  43. package/skills/sprint-flow/references/orchestration-rules.md +333 -0
  44. package/skills/sprint-flow/references/phase-2-build.md +4 -193
  45. package/skills/sprint-flow/references/phase-6-ship.md +4 -188
  46. package/skills/sprint-flow/references/phase-7-land.md +4 -135
  47. package/skills/sprint-flow/references/phase-8-cleanup.md +4 -187
  48. package/skills/sprint-flow/references/phase-minus-1-isolate.md +58 -0
  49. package/skills/test-specification-alignment/AGENTS.md +2 -2
package/lib/init.js CHANGED
@@ -335,7 +335,7 @@ async function installLocal(args) {
335
335
  ensureConfigDir();
336
336
 
337
337
  const manifest = generateManifest(srcDir, projectRoot);
338
- updateConfig({ lastInit: new Date().toISOString(), mode: 'local', manifest });
338
+ updateConfig({ lastInit: new Date().toISOString(), mode: 'local', templateDir: TEMPLATE_DIR, manifest });
339
339
 
340
340
  injectKarpathyPrinciples(projectRoot);
341
341
  configureOpenCodePlugin(srcDir, projectRoot);
@@ -388,7 +388,7 @@ async function setupGlobal(args) {
388
388
  ensureConfigDir();
389
389
 
390
390
  const manifest = generateGlobalManifest(srcDir);
391
- updateConfig({ lastInit: new Date().toISOString(), mode: 'global', manifest });
391
+ updateConfig({ lastInit: new Date().toISOString(), mode: 'global', templateDir: TEMPLATE_DIR, manifest });
392
392
 
393
393
  console.log('\nGlobal setup complete!');
394
394
  console.log('All git repositories will now use xp-gate quality gates.');
@@ -3,12 +3,21 @@ const path = require('path');
3
3
  const https = require('https');
4
4
  const http = require('http');
5
5
  const { execSync } = require('child_process');
6
- const { checkDeps, detectPlatform } = require('./detect-deps.js');
6
+ const { checkDeps } = require('./detect-deps.js');
7
7
  const { downloadFromGitHub } = require('./download-skill.js');
8
8
  const { rollback } = require('./rollback.js');
9
- const { HOME_DIR, CONFIG_DIR } = require('./shared-paths.js');
9
+ const { HOME_DIR, CONFIG_DIR, detectPlatform } = require('./shared-paths.js');
10
10
 
11
- const SKILLS_DIR = path.join(HOME_DIR, '.config', 'opencode', 'skills');
11
+ function getSkillsDir() {
12
+ const platform = detectPlatform();
13
+ if (platform === 'qoder') {
14
+ return path.join(HOME_DIR, '.qoder', 'skills');
15
+ }
16
+ if (platform === 'claude-code') {
17
+ return path.join(HOME_DIR, '.claude', 'skills');
18
+ }
19
+ return path.join(HOME_DIR, '.config', 'opencode', 'skills');
20
+ }
12
21
 
13
22
  const SKILLS_REGISTRY = {
14
23
  'sprint-flow': { repo: 'boyingliu01/xp-gate', path: 'skills/sprint-flow' },
@@ -43,7 +52,7 @@ async function installSkill(name, options = {}) {
43
52
  return 1;
44
53
  }
45
54
 
46
- const targetDir = path.join(SKILLS_DIR, name);
55
+ const targetDir = path.join(getSkillsDir(), name);
47
56
  if (fs.existsSync(targetDir) && !force) {
48
57
  console.error(`Error: ${name} is already installed`);
49
58
  console.error('Use --force to overwrite');
package/lib/principles.js CHANGED
@@ -10,8 +10,13 @@ const path = require('path');
10
10
  // - ../../src/principles/index.ts (installed under node_modules/@boyingliu01/xp-gate)
11
11
  function findPrinciplesEntry() {
12
12
  const candidates = [
13
+ // npm package bundled layout: lib/principles.js → principles/index.ts
14
+ path.resolve(__dirname, '..', 'principles', 'index.ts'),
15
+ // Development layout: lib/principles.js → src/principles/index.ts
13
16
  path.resolve(__dirname, '..', '..', '..', 'src', 'principles', 'index.ts'),
17
+ // npm package installed under node_modules/@boyingliu01/xp-gate
14
18
  path.resolve(__dirname, '..', '..', 'src', 'principles', 'index.ts'),
19
+ // Running from repo root
15
20
  path.resolve(process.cwd(), 'src', 'principles', 'index.ts'),
16
21
  ];
17
22
  for (const c of candidates) {
@@ -1,9 +1,9 @@
1
1
  # SRC/MOCK-POLICY KNOWLEDGE BASE
2
2
 
3
3
  **Generated:** 2026-06-17
4
- **Commit:** d1b11ce
4
+ **Commit:** a697146
5
5
  **Branch:** main
6
- **Version:** 0.8.18.0
6
+ **Version:** 0.8.20.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Mock layering policy enforcement — Gate M3 of pre-push hook. Ensures integration tests use real implementations for internal dependencies, mock external dependencies, and annotate pending mocks with removal plans. Combines project scope scanning, mock decision engine, and per-file validation into a single pipeline.
@@ -1,9 +1,9 @@
1
1
  # SRC/MUTATION KNOWLEDGE BASE
2
2
 
3
3
  **Generated:** 2026-06-17
4
- **Commit:** d1b11ce
4
+ **Commit:** a697146
5
5
  **Branch:** main
6
- **Version:** 0.8.18.0
6
+ **Version:** 0.8.20.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **Gate M** (incremental mutation testing) + **Gate M2** helpers (test-layer detection used by `src/mock-policy/`). Pre-push quality gate. TypeScript-only; uses Stryker.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.8.18",
3
+ "version": "0.8.20",
4
4
  "description": "AI-driven development workflow: 6 quality gates + Delphi review + Sprint Flow",
5
5
  "bin": {
6
6
  "xp-gate": "./bin/xp-gate.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-gate",
3
- "version": "0.8.18",
3
+ "version": "0.8.20",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 10 quality gates (Gate 0-9), Sprint Flow (11 phases), and Delphi multi-expert review (>=90% consensus).",
6
6
  "author": {
@@ -1,9 +1,9 @@
1
1
  # SKILLS/DELPHI-REVIEW KNOWLEDGE BASE
2
2
 
3
3
  **Generated:** 2026-06-17
4
- **Commit:** d1b11ce
4
+ **Commit:** a697146
5
5
  **Branch:** main
6
- **Version:** 0.8.18.0
6
+ **Version:** 0.8.20.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.
@@ -190,6 +190,80 @@ Phase 0: 准备 → Round 1: 匿名独立评审 → 共识检查
190
190
 
191
191
  ---
192
192
 
193
+ ## Orchestrator Dispatch Rules(#218 自动多轮调度)
194
+
195
+ ### 背景
196
+
197
+ Delphi review 在 sprint-flow 中通过 subagent 调用时,Round 1→Round 2→Round 3 的调度**必须在 subagent 内部自动完成**,不能每轮暂停等待 orchestrator 或用户干预。只有在以下情况才需要 orchestrator 暂停:
198
+
199
+ ### 自动调度规则
200
+
201
+ | 场景 | 自动处理 | 需暂停 |
202
+ |------|---------|--------|
203
+ | Round 1 完成,需 Round 2 | ✅ subagent 自动继续 | ❌ |
204
+ | Round 2 完成,需 Round 3 | ✅ subagent 自动继续 | ❌ |
205
+ | Round 3+ 完成,仍需更多轮 | ✅ subagent 自动继续,直到 max_rounds | ❌ |
206
+ | 最终 APPROVED (>=90%) | ✅ subagent 输出结果后退出 | ❌ |
207
+ | 最终 REQUEST_CHANGES(可自动修复) | ✅ subagent 尝试修复措辞、AC 缺失等常见问题后自动重评审 | ❌ |
208
+ | 最终 REQUEST_CHANGES(无法自动修复) | ✅ subagent 输出详细失败报告 | **✅ orchestrator 暂停等用户** |
209
+ | 超过 max_rounds (5) 仍无共识 | ✅ subagent 输出"未达成共识报告" | **✅ orchestrator 暂停等用户决策** |
210
+
211
+ ### Subagent 内部 Round 循环
212
+
213
+ 当 delphi-review 以 subagent 启动时(非交互式),应执行以下自动循环:
214
+
215
+ ```python
216
+ round = 1
217
+ while round <= max_review_rounds:
218
+ # 执行当前 round(所有专家匿名/半匿名评审)
219
+ results = execute_round(round)
220
+
221
+ # 检查共识
222
+ consensus = check_consensus(results)
223
+
224
+ if consensus.verdict == "APPROVED" and consensus.ratio >= 0.9:
225
+ emit_verdict("APPROVED", consensus)
226
+ break
227
+
228
+ if round == max_review_rounds:
229
+ # 已达最大轮数仍无共识
230
+ emit_verdict("NO_CONSENSUS", consensus)
231
+ break
232
+
233
+ round += 1
234
+
235
+ if verdict == "REQUEST_CHANGES":
236
+ # 尝试自动修复常见问题
237
+ auto_fix_result = attempt_auto_fix(issues)
238
+ if auto_fix_result.success:
239
+ # 自动修复后,从 Round 2 起步重新评审
240
+ round = 2
241
+ continue # 重新进入循环
242
+ else:
243
+ # 无法自动修复,交给 orchestrator
244
+ emit_verdict("REQUEST_CHANGES", auto_fix_result.failed_issues)
245
+ ```
246
+
247
+ ### 终止结果输出
248
+
249
+ 当 subagent 因终态退出时,必须输出清晰的裁决:
250
+
251
+ - **APPROVED**: 共识报告 + specification.yaml
252
+ - **REQUEST_CHANGES(可自动修复)**: 自动修复后再次评审
253
+ - **REQUEST_CHANGES(不可自动修复)**: 失败报告 + 建议修复方向
254
+ - **NO_CONSENSUS**: 分歧详情报告
255
+
256
+ ### 与 orchestrator 的交互约定
257
+
258
+ | 状态 | Subagent 输出 | Orchestrator 动作 |
259
+ |------|--------------|------------------|
260
+ | APPROVED | `{verdict:"APPROVED", consensus_ratio: N, ...}` | 自动进入下一 Phase |
261
+ | REQUEST_CHANGES (auto-fixed) | `{verdict:"APPROVED", auto_fixed: ["..."]}` | 自动进入下一 Phase |
262
+ | REQUEST_CHANGES (unfixable) | `{verdict:"REQUEST_CHANGES", failed_issues: [...]}` | ⚠️ 暂停等用户修复后,通过 task_id 重新 dispatch |
263
+ | NO_CONSENSUS | `{verdict:"NO_CONSENSUS", disagreements: [...]}` | ⚠️ 暂停等用户决策(可继续/中止/强制通过) |
264
+
265
+ ---
266
+
193
267
  ## 修复与重新评审
194
268
 
195
269
  如果最终裁决是 REQUEST_CHANGES 或 REJECTED:
@@ -197,6 +271,8 @@ Phase 0: 准备 → Round 1: 匿名独立评审 → 共识检查
197
271
  2. 重新评审(从 Round 2 起步,不是 Round 1)
198
272
  3. 迭代直到 APPROVED
199
273
 
274
+ **Automatic re-review(#218)**: 当 delphi-review 以 subagent 运行时,对于常见的自动可控问题(措辞模糊、AC 缺失、格式问题等),subagent 应自行修复后自动重评审,无需等待用户。
275
+
200
276
  修复报告格式:
201
277
  ```markdown
202
278
  ## 修复报告
@@ -1,9 +1,9 @@
1
1
  # SKILLS/SPRINT-FLOW KNOWLEDGE BASE
2
2
 
3
3
  **Generated:** 2026-06-17
4
- **Commit:** d1b11ce
4
+ **Commit:** a697146
5
5
  **Branch:** main
6
- **Version:** 0.8.18.0
6
+ **Version:** 0.8.20.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **11-phase** development pipeline: ISOLATE → AUTO-ESTIMATE → THINK → PLAN → BUILD → REVIEW → USER ACCEPTANCE → FEEDBACK → SHIP → LAND → 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.