@boyingliu01/xp-gate 0.19.2 → 0.20.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.
Files changed (223) hide show
  1. package/adapters/gate-4.sh +83 -18
  2. package/adapters/gate-8.sh +49 -5
  3. package/adapters/iac.sh +1 -1
  4. package/adapters/typescript.sh +15 -60
  5. package/bin/xp-gate.js +15 -16
  6. package/gate-10.sh +35 -2
  7. package/gate-4.sh +110 -21
  8. package/gate-8.sh +49 -5
  9. package/hooks/gate-10.sh +35 -2
  10. package/hooks/gate-4.sh +110 -21
  11. package/hooks/gate-8.sh +49 -5
  12. package/hooks/lib/jscpd-run.sh +63 -0
  13. package/hooks/lib/sprint-gate-report.sh +58 -0
  14. package/hooks/lib/test-failure.sh +152 -0
  15. package/hooks/lib/typecheck.sh +141 -0
  16. package/hooks/lib/validate-code-walkthrough.cjs +43 -5
  17. package/hooks/post-merge +100 -0
  18. package/hooks/pre-commit +401 -155
  19. package/hooks/pre-push +75 -19
  20. package/lib/__tests__/bootstrap.test.js +23 -41
  21. package/lib/__tests__/check-version.test.js +8 -1
  22. package/lib/__tests__/detect-deps.test.js +16 -0
  23. package/lib/__tests__/doctor-drift-round2.test.js +212 -0
  24. package/lib/__tests__/doctor-executed-surface.test.js +209 -0
  25. package/lib/__tests__/doctor-hook-drift.test.js +329 -0
  26. package/lib/__tests__/doctor-machine-mutation.test.js +116 -0
  27. package/lib/__tests__/doctor-module-drift.test.js +206 -0
  28. package/lib/__tests__/doctor-module-resolution-parity.test.js +314 -0
  29. package/lib/__tests__/doctor-path-equivalence.test.js +59 -0
  30. package/lib/__tests__/doctor-repair-boundary.test.js +52 -0
  31. package/lib/__tests__/doctor-tui-skill-freshness.test.js +105 -0
  32. package/lib/__tests__/doctor.test.js +155 -0
  33. package/lib/__tests__/gate-runner.test.js +19 -3
  34. package/lib/__tests__/helpers/lib-sandbox.cjs +55 -0
  35. package/lib/__tests__/init.test.js +44 -17
  36. package/lib/__tests__/install-skill-full-dir.test.js +151 -0
  37. package/lib/__tests__/install-skill.test.js +51 -132
  38. package/lib/__tests__/language-tools-detect.test.js +158 -0
  39. package/lib/__tests__/phase-transition.test.js +15 -1
  40. package/lib/__tests__/qoder-delphi-agents.test.js +285 -0
  41. package/lib/__tests__/shared-paths.test.js +20 -0
  42. package/lib/__tests__/shared-utils.test.js +69 -0
  43. package/lib/__tests__/skill-flags.test.js +48 -0
  44. package/lib/__tests__/ui-detector.test.ts +6 -2
  45. package/lib/__tests__/uninstall.test.js +20 -0
  46. package/lib/__tests__/update-hooks.test.js +12 -0
  47. package/lib/__tests__/update-skill.test.js +7 -4
  48. package/lib/detect-deps.js +3 -20
  49. package/lib/doctor-tui.js +22 -5
  50. package/lib/doctor.js +1178 -31
  51. package/lib/init.js +184 -33
  52. package/lib/install-cmd.js +7 -4
  53. package/lib/install-skill.js +38 -95
  54. package/lib/language-tools.js +83 -4
  55. package/lib/mattpocock-license-verdict.json +1 -1
  56. package/lib/shared-paths.js +5 -2
  57. package/lib/shared-utils.js +47 -3
  58. package/lib/uninstall.js +12 -0
  59. package/lib/update-hooks.js +4 -4
  60. package/lib/update-skill.js +6 -7
  61. package/mock-policy/AGENTS.md +4 -4
  62. package/mutation/AGENTS.md +4 -4
  63. package/mutation/__tests__/gate-m.test.ts +66 -14
  64. package/mutation/__tests__/mutmut-runner.test.ts +91 -42
  65. package/mutation/__tests__/test-filter-parity.test.ts +37 -0
  66. package/mutation/gate-m.ts +21 -8
  67. package/package.json +1 -1
  68. package/plugins/claude-code/.claude-plugin/plugin.json +2 -2
  69. package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -1
  70. package/plugins/claude-code/skills/delphi-review/AGENTS.md +4 -4
  71. package/plugins/claude-code/skills/delphi-review/SKILL.md +98 -14
  72. package/plugins/claude-code/skills/delphi-review/references/code-walkthrough.md +36 -3
  73. package/plugins/claude-code/skills/delphi-review/references/requirements.md +6 -6
  74. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +4 -4
  75. package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +3 -3
  76. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +4 -4
  77. package/plugins/dsh/README.md +169 -4
  78. package/plugins/dsh/dsh-overlay.patch.yml +67 -0
  79. package/plugins/dsh/package.json +1 -1
  80. package/plugins/dsh/scripts/prepack.cjs +24 -19
  81. package/plugins/dsh/setup-dsh.ps1 +160 -0
  82. package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -1
  83. package/plugins/dsh/skills/delphi-review/AGENTS.md +4 -4
  84. package/plugins/dsh/skills/delphi-review/SKILL.md +98 -14
  85. package/plugins/dsh/skills/delphi-review/references/code-walkthrough.md +36 -3
  86. package/plugins/dsh/skills/delphi-review/references/requirements.md +6 -6
  87. package/plugins/dsh/skills/sprint-flow/AGENTS.md +4 -4
  88. package/plugins/dsh/skills/sprint-flow/references/phase-2-design.md +3 -3
  89. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +4 -4
  90. package/plugins/dsh/src/command.test.ts +66 -2
  91. package/plugins/dsh/src/command.ts +36 -14
  92. package/plugins/dsh/src/contract.test.ts +31 -1
  93. package/plugins/dsh/src/delphi-config.test.ts +190 -0
  94. package/plugins/dsh/src/delphi-config.ts +223 -0
  95. package/plugins/dsh/src/delphi-run.test.ts +181 -0
  96. package/plugins/dsh/src/delphi-run.ts +129 -0
  97. package/plugins/dsh/src/delphi.test.ts +222 -0
  98. package/plugins/dsh/src/delphi.ts +247 -0
  99. package/plugins/dsh/src/dialect.test.ts +59 -0
  100. package/plugins/dsh/src/dialect.ts +40 -0
  101. package/plugins/dsh/src/index.ts +70 -4
  102. package/plugins/dsh/src/skills.test.ts +26 -19
  103. package/plugins/opencode/package.json +1 -1
  104. package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -1
  105. package/plugins/opencode/skills/delphi-review/AGENTS.md +4 -4
  106. package/plugins/opencode/skills/delphi-review/SKILL.md +98 -14
  107. package/plugins/opencode/skills/delphi-review/references/code-walkthrough.md +36 -3
  108. package/plugins/opencode/skills/delphi-review/references/requirements.md +6 -6
  109. package/plugins/opencode/skills/sprint-flow/AGENTS.md +4 -4
  110. package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +3 -3
  111. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +4 -4
  112. package/plugins/qoder/agents/delphi-architecture.md +1 -1
  113. package/plugins/qoder/agents/delphi-feasibility.md +1 -1
  114. package/plugins/qoder/agents/delphi-technical.md +1 -1
  115. package/plugins/qoder/plugin.json +2 -2
  116. package/plugins/qoder/skills/admin-template-guidelines/SKILL.md +6 -797
  117. package/plugins/qoder/skills/admin-template-guidelines/references/rule-1.md +91 -0
  118. package/plugins/qoder/skills/admin-template-guidelines/references/rule-2.md +155 -0
  119. package/plugins/qoder/skills/admin-template-guidelines/references/rule-3.md +70 -0
  120. package/plugins/qoder/skills/admin-template-guidelines/references/rule-4.md +154 -0
  121. package/plugins/qoder/skills/admin-template-guidelines/references/rule-5.md +126 -0
  122. package/plugins/qoder/skills/admin-template-guidelines/references/rule-6.md +180 -0
  123. package/plugins/qoder/skills/batch-grill-me/SKILL.md +15 -0
  124. package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -1
  125. package/plugins/qoder/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  126. package/plugins/qoder/skills/clipboard-vision/describe-clipboard.sh +161 -0
  127. package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +61 -28
  128. package/plugins/qoder/skills/delphi-review/AGENTS.md +4 -4
  129. package/plugins/qoder/skills/delphi-review/INSTALL.md +97 -98
  130. package/plugins/qoder/skills/delphi-review/SKILL.md +170 -63
  131. package/plugins/qoder/skills/delphi-review/hooks.md +19 -0
  132. package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +6 -10
  133. package/plugins/qoder/skills/delphi-review/references/code-walkthrough.md +36 -3
  134. package/plugins/qoder/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
  135. package/plugins/qoder/skills/delphi-review/references/requirements.md +402 -0
  136. package/plugins/qoder/skills/delphi-review/references/round-templates.md +134 -0
  137. package/plugins/qoder/skills/delphi-review/scripts/verify-consensus.sh +43 -0
  138. package/plugins/qoder/skills/delphi-review/tools.md +29 -0
  139. package/plugins/qoder/skills/domain-modeling/ADR-FORMAT.md +64 -0
  140. package/plugins/qoder/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  141. package/plugins/qoder/skills/domain-modeling/SKILL.md +74 -0
  142. package/plugins/qoder/skills/grill-with-docs/SKILL.md +7 -0
  143. package/plugins/qoder/skills/grilling/SKILL.md +12 -0
  144. package/plugins/qoder/skills/ralph-loop/SKILL.md +87 -428
  145. package/plugins/qoder/skills/ralph-loop/references/components.md +113 -0
  146. package/plugins/qoder/skills/ralph-loop/references/workflow-details.md +99 -0
  147. package/plugins/qoder/skills/sprint-flow/AGENTS.md +5 -5
  148. package/plugins/qoder/skills/sprint-flow/SKILL.md +255 -454
  149. package/plugins/qoder/skills/sprint-flow/__tests__/sprint-flow.test.cjs +457 -0
  150. package/plugins/qoder/skills/sprint-flow/hooks.md +18 -0
  151. package/plugins/qoder/skills/sprint-flow/references/components/memory.md +1 -1
  152. package/plugins/qoder/skills/sprint-flow/references/components/middleware.md +1 -1
  153. package/plugins/qoder/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  154. package/plugins/qoder/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  155. package/plugins/qoder/skills/sprint-flow/references/force-levels.md +0 -1
  156. package/plugins/qoder/skills/sprint-flow/references/orchestration-rules.md +34 -27
  157. package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +1 -1
  158. package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +160 -123
  159. package/plugins/qoder/skills/sprint-flow/references/phase-3-build.md +203 -2
  160. package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +107 -34
  161. package/plugins/qoder/skills/sprint-flow/references/phase-5-ship.md +194 -12
  162. package/plugins/qoder/skills/sprint-flow/references/phase-6-close.md +139 -7
  163. package/plugins/qoder/skills/sprint-flow/references/phase-overview.md +486 -0
  164. package/plugins/qoder/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
  165. package/plugins/qoder/skills/sprint-flow/tools.md +29 -0
  166. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +4 -4
  167. package/plugins/qoder/skills/test-specification-alignment/SKILL.md +104 -601
  168. package/plugins/qoder/skills/to-issues/SKILL.md +1 -1
  169. package/principles/AGENTS.md +9 -8
  170. package/principles/__tests__/adapter-metrics.test.ts +292 -0
  171. package/principles/__tests__/analyzer.test.ts +29 -6
  172. package/principles/__tests__/baseline-prune-timeout.test.ts +71 -0
  173. package/principles/__tests__/baseline-prune.test.ts +338 -0
  174. package/principles/__tests__/boy-scout-init-baseline.test.ts +167 -0
  175. package/principles/__tests__/boy-scout-integration.test.ts +97 -6
  176. package/principles/__tests__/boy-scout.test.ts +253 -7
  177. package/principles/__tests__/config-enforcement.test.ts +469 -0
  178. package/principles/__tests__/config-git-timeout.test.ts +66 -0
  179. package/principles/__tests__/direct-execution.test.ts +187 -0
  180. package/principles/__tests__/index.test.ts +16 -3
  181. package/principles/__tests__/warnings-baseline-budgets.test.ts +74 -0
  182. package/principles/adapters/typescript.ts +613 -13
  183. package/principles/analyzer.ts +22 -0
  184. package/principles/baseline-prune.ts +217 -0
  185. package/principles/boy-scout.ts +481 -51
  186. package/principles/config.ts +362 -54
  187. package/principles/direct-execution.ts +60 -0
  188. package/principles/index.ts +40 -17
  189. package/principles/rules/__tests__/clean-code/many-exports.test.ts +16 -10
  190. package/principles/rules/clean-code/code-duplication.ts +8 -8
  191. package/principles/rules/clean-code/deep-nesting.ts +8 -8
  192. package/principles/rules/clean-code/god-class.ts +8 -8
  193. package/principles/rules/clean-code/large-file.ts +15 -11
  194. package/principles/rules/clean-code/long-function.ts +8 -8
  195. package/principles/rules/clean-code/magic-numbers.ts +10 -7
  196. package/principles/rules/clean-code/many-exports.ts +7 -7
  197. package/principles/rules/clean-code/missing-error-handling.ts +5 -5
  198. package/principles/rules/clean-code/too-many-params.ts +8 -8
  199. package/principles/rules/clean-code/unused-imports.ts +5 -5
  200. package/principles/rules/solid/dip.ts +18 -8
  201. package/principles/rules/solid/isp.ts +9 -8
  202. package/principles/rules/solid/lsp.ts +6 -6
  203. package/principles/rules/solid/ocp.ts +6 -5
  204. package/principles/rules/solid/srp.ts +7 -8
  205. package/principles/types.ts +15 -0
  206. package/scripts/__tests__/sync-package-content.test.js +28 -0
  207. package/scripts/delphi-external-review.cjs +193 -10
  208. package/scripts/sync-package-content.js +7 -4
  209. package/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -1
  210. package/skills/delphi-review/AGENTS.md +4 -4
  211. package/skills/delphi-review/SKILL.md +98 -14
  212. package/skills/delphi-review/references/code-walkthrough.md +36 -3
  213. package/skills/delphi-review/references/requirements.md +6 -6
  214. package/skills/sprint-flow/AGENTS.md +4 -4
  215. package/skills/sprint-flow/references/phase-2-design.md +3 -3
  216. package/skills/test-specification-alignment/AGENTS.md +4 -4
  217. package/lib/__tests__/download-skill.test.js +0 -281
  218. package/lib/download-skill.js +0 -96
  219. package/plugins/qoder/skills/ralph-loop/references/components/memory.md +0 -55
  220. package/plugins/qoder/skills/ralph-loop/references/components/middleware.md +0 -54
  221. package/plugins/qoder/skills/ralph-loop/references/components/skill-invocations.md +0 -39
  222. package/plugins/qoder/skills/ralph-loop/references/components/system-prompt.md +0 -24
  223. package/plugins/qoder/skills/ralph-loop/references/components/tool-descriptions.md +0 -32
@@ -2,12 +2,16 @@
2
2
  'use strict';
3
3
 
4
4
  /**
5
- * prepack.cjs — Bundle the 12 repo skills into @boyingliu01/dsh-plugin-xp-gate
5
+ * prepack.cjs — Bundle every repo skill into @boyingliu01/dsh-plugin-xp-gate
6
6
  * before npm publish.
7
7
  *
8
8
  * Skills live in repo-root `skills/`; `plugins/dsh/skills/` is gitignored and
9
9
  * populated here so the published tarball is self-contained (mirrors
10
10
  * plugins/opencode/scripts/prepack.cjs).
11
+ *
12
+ * The skill list is DISCOVERED, not hardcoded: a hardcoded list silently drifts
13
+ * from the repo (it previously shipped 12 of 13, omitting clipboard-vision, and
14
+ * would need editing on every new skill) — see #448.
11
15
  */
12
16
 
13
17
  const fs = require('fs');
@@ -16,24 +20,24 @@ const path = require('path');
16
20
  const PLUGIN_ROOT = path.resolve(__dirname, '..');
17
21
  const REPO_ROOT = path.resolve(PLUGIN_ROOT, '..', '..');
18
22
 
19
- const SKILLS = [
20
- 'admin-template-guidelines',
21
- 'batch-grill-me',
22
- 'delphi-review',
23
- 'domain-modeling',
24
- 'grilling',
25
- 'grill-with-docs',
26
- 'improve-codebase-architecture',
27
- 'ralph-loop',
28
- 'sprint-flow',
29
- 'test-driven-development',
30
- 'test-specification-alignment',
31
- 'to-issues',
32
- ];
33
-
34
23
  const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'coverage']);
35
24
  const SKIP_FILE_SUFFIXES = ['.lock', '.js.map'];
36
25
 
26
+ /** A skill is a directory directly under skills/ that contains a SKILL.md. */
27
+ function discoverSkills() {
28
+ const root = path.join(REPO_ROOT, 'skills');
29
+ if (!fs.existsSync(root)) {
30
+ console.error(`[prepack] ERROR: skills directory not found at ${root}`);
31
+ process.exit(1);
32
+ }
33
+ return fs
34
+ .readdirSync(root, { withFileTypes: true })
35
+ .filter((e) => e.isDirectory())
36
+ .map((e) => e.name)
37
+ .filter((name) => fs.existsSync(path.join(root, name, 'SKILL.md')))
38
+ .sort();
39
+ }
40
+
37
41
  function shouldSkipFile(name) {
38
42
  return SKIP_FILE_SUFFIXES.some((suffix) => name.endsWith(suffix));
39
43
  }
@@ -63,16 +67,17 @@ function main() {
63
67
  fs.rmSync(skillsDest, { recursive: true, force: true });
64
68
  fs.mkdirSync(skillsDest, { recursive: true });
65
69
 
70
+ const skills = discoverSkills();
66
71
  let copied = 0;
67
- for (const name of SKILLS) {
72
+ for (const name of skills) {
68
73
  if (copyDir(path.join(REPO_ROOT, 'skills', name), path.join(skillsDest, name))) {
69
74
  copied += 1;
70
75
  console.error(`[prepack] skills/${name}`);
71
76
  }
72
77
  }
73
78
 
74
- if (copied !== SKILLS.length) {
75
- console.error(`[prepack] ERROR: expected ${SKILLS.length} skills, copied ${copied}`);
79
+ if (copied !== skills.length) {
80
+ console.error(`[prepack] ERROR: expected ${skills.length} skills, copied ${copied}`);
76
81
  process.exit(1);
77
82
  }
78
83
 
@@ -0,0 +1,160 @@
1
+ # XP-Gate × DeepSeek Harness — 环境准备脚本
2
+ #
3
+ # 作用:把 XP-Gate 的 skill 与插件接入 DeepSeek Harness(DSH)。
4
+ # 幂等:可重复运行。
5
+ #
6
+ # 用法:
7
+ # pwsh -File plugins/dsh/setup-dsh.ps1 # 全部
8
+ # pwsh -File plugins/dsh/setup-dsh.ps1 -SkillsOnly # 只装 skill
9
+ # pwsh -File plugins/dsh/setup-dsh.ps1 -WhatIf # 只预览
10
+
11
+ [CmdletBinding(SupportsShouldProcess = $true)]
12
+ param(
13
+ [switch]$SkillsOnly,
14
+ [switch]$SkipBuild
15
+ )
16
+
17
+ $ErrorActionPreference = 'Stop'
18
+
19
+ $RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
20
+ $DshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $HOME '.dsh' }
21
+ $DshSkills = Join-Path $DshHome 'skills'
22
+ $RepSkills = Join-Path $RepoRoot 'skills'
23
+ $PluginDir = Join-Path $RepoRoot 'plugins\dsh'
24
+ $ProfileDir = Join-Path $DshHome 'profiles\web'
25
+
26
+ function Write-Step($msg) { Write-Host "`n=== $msg ===" -ForegroundColor Cyan }
27
+ function Write-Ok($msg) { Write-Host " [ok] $msg" -ForegroundColor Green }
28
+ function Write-Warn($msg) { Write-Host " [warn] $msg" -ForegroundColor Yellow }
29
+ function Write-Info($msg) { Write-Host " $msg" }
30
+
31
+ # ── 1. Skill 根:把仓库 skills/ 暴露给 DSH ────────────────────────────────
32
+ # DSH 从 ~/.dsh/skills (rank 400) 发现 skill。当前 ~/.agents/skills 是指向
33
+ # ~/.qoder/skills 的 junction,即 DSH 实际加载的是 Qoder 版 skill。
34
+ # 这里用 junction 让 DSH 直接看到仓库版本,与 xp-gate 仓库保持单一真源。
35
+ Write-Step "1. Skill 根 -> $DshSkills"
36
+
37
+ if (-not (Test-Path $DshSkills)) {
38
+ if ($PSCmdlet.ShouldProcess($DshSkills, 'create directory')) {
39
+ New-Item -ItemType Directory -Force -Path $DshSkills | Out-Null
40
+ Write-Ok "创建 $DshSkills"
41
+ }
42
+ } else {
43
+ Write-Ok "已存在 $DshSkills"
44
+ }
45
+
46
+ # 逐个 skill 建 junction(用 junction 而非复制,避免出现第二份真源)
47
+ $skillNames = Get-ChildItem $RepSkills -Directory | Select-Object -ExpandProperty Name
48
+ $linked = 0
49
+ foreach ($s in $skillNames) {
50
+ $src = Join-Path $RepSkills $s
51
+ $dest = Join-Path $DshSkills $s
52
+ if (-not (Test-Path (Join-Path $src 'SKILL.md'))) { continue }
53
+
54
+ $existing = Get-Item $dest -Force -ErrorAction SilentlyContinue
55
+ if ($existing) {
56
+ if ($existing.LinkType -eq 'Junction') {
57
+ $target = ($existing.Target | Select-Object -First 1)
58
+ if ($target -and (Resolve-Path $target -ErrorAction SilentlyContinue).Path -eq $src) {
59
+ Write-Info "$s (已链接)"
60
+ continue
61
+ }
62
+ Write-Warn "${s}: junction 指向别处 -> $target(保持不变,如需切换请手动删除)"
63
+ continue
64
+ }
65
+ Write-Warn "${s}: 已存在真实目录/文件(保持不变)"
66
+ continue
67
+ }
68
+
69
+ if ($PSCmdlet.ShouldProcess($dest, "junction -> $src")) {
70
+ New-Item -ItemType Junction -Path $dest -Target $src | Out-Null
71
+ Write-Ok "$s -> $src"
72
+ $linked++
73
+ }
74
+ }
75
+ Write-Host " 共链接 $linked 个 skill(仓库共 $($skillNames.Count) 个)"
76
+
77
+ if ($SkillsOnly) {
78
+ Write-Step "完成(-SkillsOnly)"
79
+ exit 0
80
+ }
81
+
82
+ # ── 2. 编译 DSH 插件 ─────────────────────────────────────────────────────
83
+ Write-Step "2. 编译 plugins/dsh"
84
+
85
+ if ($SkipBuild) {
86
+ Write-Info "已跳过(-SkipBuild)"
87
+ } else {
88
+ # 依赖:--ignore-scripts 绕过 esbuild 的 postinstall(在受限环境下会 EBUSY)
89
+ if (-not (Test-Path (Join-Path $PluginDir 'node_modules'))) {
90
+ if ($PSCmdlet.ShouldProcess($PluginDir, 'npm install --ignore-scripts')) {
91
+ Push-Location $PluginDir
92
+ try { npm install --ignore-scripts 2>&1 | Select-Object -Last 3 | ForEach-Object { Write-Info $_ } }
93
+ finally { Pop-Location }
94
+ Write-Ok "依赖已安装"
95
+ }
96
+ } else {
97
+ Write-Ok "依赖已存在"
98
+ }
99
+
100
+ if ($PSCmdlet.ShouldProcess($PluginDir, 'tsc build + skills prepack')) {
101
+ Push-Location $PluginDir
102
+ try {
103
+ npm run build 2>&1 | Select-Object -Last 2 | ForEach-Object { Write-Info $_ }
104
+ node scripts/prepack.cjs 2>&1 | Select-Object -Last 1 | ForEach-Object { Write-Info $_ }
105
+ } finally { Pop-Location }
106
+ if (Test-Path (Join-Path $PluginDir 'lib\index.js')) {
107
+ Write-Ok "lib/index.js 已生成"
108
+ } else {
109
+ Write-Warn "lib/index.js 缺失 —— 构建失败"
110
+ }
111
+ Write-Ok "skills/ 已就位"
112
+ }
113
+ }
114
+
115
+ # ── 3. 挂载插件到 profile(说明 + 可选自动执行) ──────────────────────────
116
+ Write-Step "3. 挂载插件到 DSH profile"
117
+
118
+ $dshBin = Join-Path $RepoRoot 'node_modules\.bin\dsh.cmd'
119
+ $patch = Join-Path $ProfileDir 'cordis.patch.yml'
120
+ $already = (Test-Path $patch) -and ((Get-Content $patch -Raw) -match 'dsh-plugin-xp-gate')
121
+
122
+ if ($already) {
123
+ Write-Ok "profile 已包含 dsh-plugin-xp-gate"
124
+ } else {
125
+ Write-Info "尚未挂载。DSH 的 dsh CLI 位于 DSH 安装目录(本机不在 PATH 上):"
126
+ Write-Info " C:\Users\think\.workbuddy\binaries\node\workspace\node_modules\.bin\dsh.cmd"
127
+ Write-Info ""
128
+ Write-Info "挂载方式(推荐用 GUI 的 Plugins 页面,或命令行):"
129
+ Write-Info " & '<dsh.cmd>' plugin --profile web add <本仓库路径>\plugins\dsh"
130
+ Write-Info ""
131
+ Write-Info "注意:DSH 的 patch 是「整段替换 config」,插件通过 package.json 的"
132
+ Write-Info " dsh.bundle.patch 声明自己,安装后会自动进入 bundle 层栈。"
133
+ }
134
+
135
+ # ── 4. Delphi 模型选择提醒 ───────────────────────────────────────────────
136
+ Write-Step "4. Delphi 交叉评审前置条件"
137
+
138
+ Write-Info "delphi-review 硬性要求:3 个专家使用 3 个 distinct trimmed model IDs。"
139
+ Write-Info "DSH 的 subagent 默认【不支持】指定模型,必须先在 GUI 的 Plugins 页面启用:"
140
+ Write-Info ""
141
+ Write-Info " subagent model selection -> enabled = true"
142
+ Write-Info " allowedModels = ["
143
+ Write-Info " { provider: 'whalecloud', model: 'g-deepseek-v4-pro' },"
144
+ Write-Info " { provider: 'whalecloud', model: 'g-qwen3.8-max' },"
145
+ Write-Info " { provider: 'whalecloud', model: 'g-glm-5.3' }"
146
+ Write-Info " ]"
147
+ Write-Info ""
148
+ Write-Info "验证:启用后 subagent 工具会出现 provider/model 参数,"
149
+ Write-Info " 并注册 list_subagent_models 工具。"
150
+ Write-Info ""
151
+ Write-Info "备选路线(无需改 DSH):scripts/delphi-external-review.cjs 直连 OpenAI 兼容 API。"
152
+ Write-Info " 但 .delphi-config.json 的 3 个 key 目前均未设置"
153
+ Write-Info " (DASHSCOPE_API_KEY / ZHIPU_API_KEY / DEEPSEEK_API_KEY)。"
154
+
155
+ Write-Step "完成"
156
+ Write-Host ""
157
+ Write-Host "后续:" -ForegroundColor Cyan
158
+ Write-Host " - 确定性门禁(12 pre-commit + 8 pre-push)已全局生效,无需 DSH 配置"
159
+ Write-Host " - DSH 插件在 Windows 上需先修 POSIX/PowerShell 方言问题(见评估文档 §B2)"
160
+ Write-Host " - 评估报告: docs/plans/2026-09-30-dsh-integration-assessment.md"
@@ -19,7 +19,6 @@ describe('clipboard-vision distribution', () => {
19
19
  'scripts/build-plugin.mjs',
20
20
  'scripts/build-plugin.sh',
21
21
  'scripts/test-plugins.mjs',
22
- 'scripts/test-plugins.sh',
23
22
  'src/npm-package/scripts/sync-package-content.js',
24
23
  'plugins/opencode/scripts/prepack.cjs',
25
24
  'src/npm-package/plugins/opencode/scripts/prepack.cjs',
@@ -1,9 +1,9 @@
1
1
  # SKILLS/DELPHI-REVIEW KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-09-22
4
- **Commit:** 3d1d1bf
5
- **Branch:** main
6
- **Version:** 0.19.2.0
3
+ **Generated:** 2026-10-07
4
+ **Commit:** ff55f35b
5
+ **Branch:** fix/batch-defects-20261007
6
+ **Version:** 0.20.0.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -249,7 +249,7 @@ tools_denied:
249
249
 
250
250
  1. **Step 0: Input Validation** — Check input contains reviewable content (design doc/code/spec/diff). Empty input → `[DelphiReview:BLOCKED]`.
251
251
  2. **Round 1: Anonymous Independent Review** — Invoke architecture, technical, and feasibility independently without exposing their opinions to one another. Every successful result must use `result_type=delphi_expert_result`.
252
- 3. **Execution Verification** — Verify that all three results succeeded and that their `requested_model` values are three distinct trimmed IDs. A local fallback (`provider: local`) is not an executed expert and cannot satisfy this check; a local hosted endpoint configured as an ordinary callable provider can.
252
+ 3. **Execution Verification** — Verify that all three results succeeded and that their `requested_model` values are three distinct trimmed IDs, confirmed against the platform's execution record rather than expert self-report alone (OpenCode: the provider call log; Qoder: the `model` field of `model.request.started` events under `~/.qoder/logs/sessions/<project>/<sessionId>/segments/*.jsonl` — the `--model` argv in `~/.qoder/logs/runs/*/manifest.json` is the session model and proves nothing about subagents). A local fallback (`provider: local`) is not an executed expert and cannot satisfy this check; a local hosted endpoint configured as an ordinary callable provider can. Each expert record must also carry an explicit `channel` of either `external` or `local`; the value is a whitelist and a missing or unknown value fails the gate (it is never defaulted, since defaulting would let a forged record pass by simply omitting the field). Where the platform pins subagents to the session model (current Qoder Custom Agent dispatch, see the Qoder section below), the check cannot pass on built-in models at all and the external provider path is required.
253
253
  4. **Consensus Check** — Aggregate all three successful expert results. Consensus >=90% AND all APPROVED → complete. One expert result is never global approval.
254
254
  5. **Rounds 2-5: Exchange and Final Positions** — If needed, expose prior aggregate evidence, re-evaluate, and stop at the first approved consensus or after five rounds.
255
255
  6. **Failure Handling** — Any expert failure, missing result, duplicate model ID, or unverifiable execution blocks the review. Do not substitute a local fallback or silently reduce the expert count.
@@ -327,27 +327,111 @@ Each round MUST output a structured round marker:
327
327
  - ✅ 三个角色可以共享一个 provider 和 token 计划
328
328
  - ❌ `provider: local` 的特殊 fallback 不能计为一次成功执行
329
329
 
330
- #### Qoder 平台(推荐 — Custom Agent 模式)
330
+ #### Qoder 平台(Custom Agent 模式 — 只能做到同模型三角色)
331
331
 
332
- Qoder 环境下使用 **Custom Agent** 机制,每个专家是一个独立的 custom agent,配置不同的 Qoder 内置模型:
332
+ Qoder 的内置模型**没有本地推理端点**:推理请求由 Qoder 客户端经服务端代理发出,凭证是一次性 job token。所以不能照搬 OpenCode 的 `base_url + api_key` 直连方式;Qoder 侧内置模型的唯一入口是 **Custom Agent** —— 每个专家一个独立 agent 文件,frontmatter 用 `model` 字段声明模型。
333
333
 
334
- | 专家 | Agent 文件 | 模型 | Credits 费率 |
335
- |------|-----------|------|-------------|
336
- | Architecture (A) | `.qoder/agents/delphi-architecture.md` | Qwen3.7-Max | 0.5× |
337
- | Technical (B) | `.qoder/agents/delphi-technical.md` | GLM-5.2 | 0.6× |
338
- | Feasibility (C) | `.qoder/agents/delphi-feasibility.md` | DeepSeek-V4-Pro | 0.5× |
334
+ **契约结论(先说结论)**:这条路径**不满足**"三个不同可执行模型 ID"契约。2026-09-23 做过一次排除混杂因素的复测:先把 `~/.qoder/agents/delphi-*.md` 三份文件绑成三个不同的 0.1× 内置模型(`qfmodel` / `dfmodel` / `gfmodel`;架构角与会话模型同名,所以真正有判别力的是技术角与可行性角),**再**新开会话——新 CLI 进程,`session.config.loaded` 记录 `model: "qfmodel"`,注册表加载的必然是已修好的绑定——然后只派发三个 subagent,各回一句话、不调工具。结果:三个独立的 `is_subagent: true` turn,`turn.started` / `model.request.started` / `model.response.completed` 三处的 `model` 全为会话模型 `qfmodel`,`dfmodel` / `gfmodel` 出现 0 次;同时三份回复分别命中架构 / 技术 / 可行性视角,说明角色提示词确实生效、agent 也确实被加载。即 `subagent_type` 派发路径采纳 Custom Agent 的提示词,但**丢弃**它的 `model` 绑定。
339
335
 
340
- **执行方式**:通过 Agent tool 并行启动 3 个 subagent(type=GeneralPurpose),每个 agent 使用自己配置的模型独立评审,主 orchestrator 收集结果后计算共识。
336
+ 因此 Qoder 原生模式只能作为**同模型、三角色(persona)的自查**,其共识比例不能当作多模型交叉验证的证据,也不应用作 Gate MW 的三模型凭据。需要契约合规的 Delphi 时,按上面的外部 provider 方式配置 `.delphi-config.json`(Qoder 与 OpenCode 同用,条件是模型确有可调端点)。
341
337
 
342
- **优势**:无需外部 API key,直接使用 Qoder Credits,模型由平台统一管理。
338
+ | 角色 | Agent 文件 | 绑定的 modelId | 实际执行模型 |
339
+ |------|-----------|---------------|-------------|
340
+ | Architecture (A) | `.qoder/agents/delphi-architecture.md` | `qfmodel` | 会话模型 |
341
+ | Technical (B) | `.qoder/agents/delphi-technical.md` | `gfmodel` | 会话模型 |
342
+ | Feasibility (C) | `.qoder/agents/delphi-feasibility.md` | `dfmodel` | 会话模型 |
343
+
344
+ **安装位置**(`xp-gate init` 自动部署,已存在的文件不覆盖):
345
+ - 项目级:`<project>/.qoder/agents/`(`xp-gate init`)
346
+ - 用户级:`~/.qoder/agents/`(`xp-gate init --global`)
347
+
348
+ **model 字段格式**:仍须写成 `"[DisplayName](modelId)"`。裸名字或已下线 ID 不会报错,会被平台静默忽略。`xp-gate init` 会审计已部署的 `delphi-*.md`,格式非法或 modelId 与本版本模板不一致时点名文件并给出"删除 → 重跑 `init` → 重启会话"提示;因为部署语义是"已存在不覆盖",从 #417 之前的版本升级必须手工删旧文件再重跑 `init`。注意:修好绑定也只是让角色声明规范,并不改变上表的执行模型结论。
349
+
350
+ **执行方式**:用 Agent tool 并行派发 3 个 subagent,`subagent_type` 分别取 `delphi-architecture`、`delphi-technical`、`delphi-feasibility`。**新建或修改 agent 文件后必须重开会话**——注册表只在会话启动时加载,否则报 `Unknown agent type`。
351
+
352
+ **客观验证(不要采信专家自述)**:`~/.qoder/logs/runs/*/manifest.json` 的 argv `--model` 记录的是**会话/进程启动模型**,对 subagent 没有判别力(历史上所有运行都是同一个 ID)。真正的证据在按会话分段的日志里:
353
+
354
+ ```bash
355
+ grep '"type":"model.request.started"' ~/.qoder/logs/sessions/<project>/<sessionId>/segments/*.jsonl \
356
+ | grep -oE '"model":"[^"]*"' | sort | uniq -c
357
+ ```
358
+
359
+ 同一文件里的 `turn.started`(`is_subagent:true`)与 `model.response.completed` 可交叉核对:前者证明三个角色各自起了独立 turn,后者带 `provider` 字段。两个坑:(1) 被验证的那个 modelId 必须**不等于会话模型**,否则该角色测不出判别力(会话模型通常是 `qfmodel`);(2) 改完 agent 文件必须**换新会话**再测,注册表只在会话启动时加载,用旧会话的数据下结论会被旧绑定污染。专家自述的 `requested_model` 只是在复述自己 frontmatter 里的声明,不构成证据。
360
+
361
+ **成本**:走这条路径不消耗外部 API key,只计 Qoder Credits。
343
362
 
344
363
  #### OpenCode 平台(External API 模式)
345
364
 
346
365
  OpenCode 环境下通过 `opencode.json` 的 agent 配置 + `.delphi-config.json` 调用外部 API:
347
366
  - **MUST 从 `opencode.json` 的 agent 配置中读取模型**
348
- - 通过 `scripts/delphi-external-review.cjs` 调用各 provider 的兼容 API
367
+ - 通过 `scripts/delphi-external-review.cjs` 调用各 provider 的兼容 API(注意:该脚本目前在仓库根 `scripts/` 下,尚未随 skill 目录分发)
349
368
  - 需要用户自行配置 API key(环境变量注入)
350
369
 
370
+ #### DeepSeek Harness 平台(`delphi-review` 工具 — 推荐)
371
+
372
+ DSH 里**不要**用 `subagent` 工具派发三个专家。原因和 Qoder 同源:DSH 的 subagent
373
+ 继承宿主配置的**单一**模型(`SubagentModelSelectionConfig.enabled` 默认 `false`),
374
+ 三个"专家"会是同一模型的三个实例 —— 按本 skill 的规则必须 BLOCK。
375
+
376
+ DSH 的正确入口是插件提供的 **`delphi-review` 工具**(`@boyingliu01/dsh-plugin-xp-gate`):
377
+
378
+ ```
379
+ delphi-review(
380
+ subject: <待评审材料:diff / 设计 / 规格>,
381
+ addressed: <可选:上一轮之后改了什么,用于后续轮次>,
382
+ maxRounds: <可选:覆盖默认 5 轮>
383
+ )
384
+ ```
385
+
386
+ 该工具**直连外部 OpenAI 兼容网关**,每个席位绑定一个不同模型,因此不依赖宿主配置即可
387
+ 满足不变量。它复用**同一份** `.delphi-config.json`,无需额外配置。
388
+
389
+ **代码强制的不变量**(不是文档约定,违反即报错):
390
+
391
+ | 不变量 | 违反时 |
392
+ |---|---|
393
+ | 恰好 3 位专家 | `DelphiConfigError` |
394
+ | 3 个 `requested_model` 去空白后两两不同 | `DelphiConfigError` |
395
+ | 模型不得为未展开的 `${...}` 占位符 | `DelphiConfigError`(在**任何网络调用之前**) |
396
+ | 缺密钥 / 缺 provider / 专家跨网关 | `DelphiSetupError`,报变量名而非回显配置 |
397
+ | 报告缺 `### VERDICT` 段 | 记为 `INVALID_NO_VERDICT`,**不计入共识** |
398
+ | 退出码 0 但内容为空 | 记为 ERROR(推理模型可能把预算全烧在隐藏 token 上) |
399
+
400
+ **轮次语义与本 skill 一致**:Round 1 匿名且并发;Round 2+ 回传**汇总票型**与"已修改项",
401
+ 个体报告始终匿名。达到阈值即停,否则到 `max_review_rounds` 为止并如实返回 `NO CONSENSUS`。
402
+
403
+ **推理模型注意**:`g-glm-5.3-flash` 这类模型会先产出隐藏推理 token。
404
+ 实测 `max_tokens=4000` 时 `finish_reason=length` 且 **content 为空**;
405
+ 席位需独立预算(该席位配置为 32000)。工具把"空内容"记为 ERROR 而非空评审。
406
+
407
+ > 备选:若希望 DSH **原生** `subagent` 也能选模型,需同时满足
408
+ > (1) `dsh-tool-subagent` 的 `modelSelectionSettings: true`(仅能力开关),
409
+ > (2) 宿主设置 `SubagentModelSelectionConfig.enabled = true` 且 `allowedModels` ≥3 个不同模型。
410
+ > 该路线依赖宿主配置,CI / 一次性会话不可靠,故不作为默认路径。
411
+ #### WorkBuddy 平台(Expert 团队模式)
412
+
413
+ WorkBuddy 侧以 Team 型专家团(示例:`delphi-review-team`,安装在 `~/.workbuddy/plugins/marketplaces/my-experts/plugins/`,创建方式见 [docs/platform-workbuddy.md](../../docs/platform-workbuddy.md))承载评审,触发本技能后按此路由执行:
414
+
415
+ | 角色 | Agent ID | 绑定模型 | 倍率 |
416
+ |------|----------|---------|------|
417
+ | 主理人(衡定一,会话自身) | delphi-review-team-team-lead | 会话模型,固定用 `local-deepseek-v4-flash` | 零 credits |
418
+ | Architecture (A) | delphi-arch-reviewer | `deepseek-v4.1-flash` | x0.11 |
419
+ | Technical (B) | delphi-tech-reviewer | `glm-5.3-flash` | x0.06 |
420
+ | Feasibility (C) | delphi-feasibility-reviewer | `hy3` | x0.00(免费) |
421
+
422
+ **执行方式**:
423
+ - 主理人开场自检:会话模型不是 `local-deepseek-v4-flash` 时,先提醒用户切换再开始。
424
+ - 已启用专家团 → 按其团队机制 spawn 3 位成员;未启用 → 用 `Agent` 工具同一消息**并行** spawn 3 个 `general-purpose` 子代理,prompt = 对应专家 MD 全文人设(读专家团 `agents/` 目录)+ 匿名评审模板 + 待评审材料,`model` 参数按上表传。
425
+ - Round 1 三个子代理互不见对方输出(匿名铁律不变)。
426
+
427
+ **执行验证(适配本平台,2026-09-29 校准)**:
428
+ - 参数层路由 ✅ 已实测:`Agent` 工具 `model` 参数传 `deepseek-v4.1-flash` / `glm-5.3-flash` / `hy3` 三个 ID 均被接受,3 个 general-purpose 子代理并行执行成功。
429
+ - 执行层证据 ⚠️ 平台暂缺:WorkBuddy 审计日志(`~/.workbuddy/audit-log/`)只记 command-safety 事件,无 per-request 模型路由记录,无法像 Qoder/OpenCode 那样从日志取证 distinct models。
430
+ - **WorkBuddy 过渡验证标准**:参数级校准(model ID 被平台接受且子代理成功执行)+ 专家 `requested_model` 自述如实记录;报告中必须注明「执行层验证待平台日志支持」。若 `model` 参数被拒绝(报错/回落会话模型),按本技能 Failure Handling 处理,不得静默降级冒充三模型共识。
431
+ - 契约合规兜底:需要严格证据时,走外部 provider 路径(`.delphi-config.json` + 兼容 API,如 whalecloud 网关 3 个模型 ID)。
432
+
433
+ **成本**:3 专家合计 x0.17/轮;主理人选 local 会话模型则零 credits。
434
+
351
435
  ### 共识阈值
352
436
 
353
437
  | 阈值 | 说明 |
@@ -454,9 +538,9 @@ Every Delphi mode MUST use the full JSON schema below. Architecture, technical,
454
538
  "context_file_used": "CONTEXT.md",
455
539
  "round": 1,
456
540
  "expert_verdicts": [
457
- { "role": "architecture", "verdict": "APPROVED", "confidence": 9, "result_type": "delphi_expert_result", "requested_model": "provider/model-a" },
458
- { "role": "technical", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-b" },
459
- { "role": "feasibility", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-c" }
541
+ { "role": "architecture", "verdict": "APPROVED", "confidence": 9, "result_type": "delphi_expert_result", "requested_model": "provider/model-a", "resolved_model": "provider/model-a", "channel": "external" },
542
+ { "role": "technical", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-b", "resolved_model": "provider/model-b", "channel": "external" },
543
+ { "role": "feasibility", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-c", "resolved_model": "provider/model-c", "channel": "external" }
460
544
  ],
461
545
  "requirements_statement": "<short summary of what was reviewed>",
462
546
  "gaps_found": [],
@@ -255,9 +255,15 @@ pre-push hook
255
255
  |------|------|------|
256
256
  | 单次走查成本 | ~$0.03 | 正常执行 |
257
257
  | 变更规模 | 无硬性文件数或行数上限 | 大型变更必须完整评审或由用户选择拆分 |
258
+ | 单席位 prompt 体积 | 默认 40000 字节(`max_prompt_bytes` 可按席位覆盖) | runner 发送前拒绝,报错里给出处置办法 |
258
259
 
259
260
  大型变更没有自动跳过或绕过路径。用户可以选择完整评审,或在评审前主动拆分变更;每个变更仍须通过完整的走查和证据验证。
260
261
 
262
+ **prompt 预算是硬约束,不是建议**:实测 `g-glm-5.3-flash` 在 ~40KB 正常应答(225s)、~50KB 直接崩溃
263
+ (305s,`0xC0000409` + libuv `UV_HANDLE_CLOSING`,表现为 "Network error.")——一个席位崩溃就会让整个共识无法完成。
264
+ 构造输入时按重要性排序、给每个席位独立预算、并在报告里显式列出因体积省略的文件;
265
+ 截断到「核心 hunk 看不见」比超限更糟:席位会花整轮报告「无法审计」,而这是评审者的真实缺陷而非代码缺陷。
266
+
261
267
  ---
262
268
 
263
269
  ## Agent 可用性检查 (MANDATORY)
@@ -356,9 +362,9 @@ IF 任何检查失败:
356
362
  "verdict": "APPROVED",
357
363
  "confidence": 9,
358
364
  "experts": [
359
- { "id": "Expert A", "role": "architecture", "verdict": "APPROVED", "confidence": 9, "result_type": "delphi_expert_result", "requested_model": "provider/model-a", "resolved_model": "provider/model-a" },
360
- { "id": "Expert B", "role": "technical", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-b", "resolved_model": null },
361
- { "id": "Expert C", "role": "feasibility", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-c", "resolved_model": "provider/model-c" }
365
+ { "id": "Expert A", "role": "architecture", "verdict": "APPROVED", "confidence": 9, "result_type": "delphi_expert_result", "requested_model": "provider/model-a", "resolved_model": "provider/model-a", "channel": "external" },
366
+ { "id": "Expert B", "role": "technical", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-b", "resolved_model": "provider/model-b", "channel": "external" },
367
+ { "id": "Expert C", "role": "feasibility", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-c", "resolved_model": "provider/model-c", "channel": "external" }
362
368
  ],
363
369
  "issues": [],
364
370
  "consensus_ratio": 1.0,
@@ -399,6 +405,33 @@ Hook 验证以下条件(全部满足才允许 push):
399
405
  5. timestamp 未过期
400
406
  6. expires 必须是 timestamp 之后恰好 1 小时
401
407
 
408
+ ### experts[] 必填字段与 #423 的迁移说明
409
+
410
+ `validate-code-walkthrough.cjs` 对每个 expert 对象强制要求:
411
+
412
+ | 字段 | 约束 |
413
+ |------|------|
414
+ | `result_type` | 必须等于 `"delphi_expert_result"` |
415
+ | `role` | 非空,三个席位 role 互异 |
416
+ | `requested_model` | 非空;比较前只做 trim,**区分大小写**(规范原文是 "distinct trimmed requested model IDs",见 AGENTS.md) |
417
+ | `resolved_model` | 非空;比较前 trim + 转小写,三者互异 |
418
+ | `channel` | 必须严格属于 `["external", "local"]`;`provider: local` 的 fallback 记录不能计为成功执行 |
419
+
420
+ 缺字段或取值不在白名单 → Gate MW **FAIL**(不是 SKIP)。
421
+
422
+ **升级后旧证据怎么处置**:唯一正确做法是在当前 HEAD 重跑一次评审、由 runner 重新生成证据文件。
423
+ 不要手工给老文件补 `channel` —— 那等于伪造执行证据,而 `channel` 存在的目的正是让证据可追溯到一次真实调用。
424
+ 证据本来就与 commit 绑定(`commit` 必须等于 HEAD,有效期 1 小时),跨 commit 复用从来不是受支持的路径。
425
+
426
+ **回滚语义**:validator 与证据生产者(`scripts/delphi-external-review.cjs`)必须成对回滚。
427
+
428
+ - 旧 validator 读新证据:安全,多余字段被忽略。
429
+ - 新 validator 读旧证据:必然 FAIL(缺 `channel`)。这是设计意图——宁可在发布关口停下,
430
+ 也不放行一份无法证明模型来源的证据;把「三个不同模型真的跑过」降级为可选项,等于让门禁只剩形式。
431
+ - 临时降级开关:**没有**。既没有 `XP_GATE_SKIP_MW` 之类的环境变量,也不允许 `--no-verify`
432
+ (见 `githooks/QUALITY-GATES-CODE-OF-CONDUCT.md`)。如果评审确实无法完成,处理方式是缩小
433
+ `--range` 或按席位调整 prompt 预算重跑,而不是放行。
434
+
402
435
  ---
403
436
 
404
437
  ## 与现有系统集成
@@ -190,9 +190,9 @@ Round 2: delphi-review --mode requirements(带 Round 1 gaps 上下文)
190
190
  "context_file_used": null,
191
191
  "round": 1,
192
192
  "expert_verdicts": [
193
- { "role": "architecture", "verdict": "APPROVED", "confidence": 9, "result_type": "delphi_expert_result", "requested_model": "bailian-tp/qwen-plus" },
194
- { "role": "technical", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "bailian-tp/deepseek-v3" },
195
- { "role": "feasibility", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "bailian-tp/glm-4.5" }
193
+ { "role": "architecture", "verdict": "APPROVED", "confidence": 9, "result_type": "delphi_expert_result", "requested_model": "bailian-tp/qwen-plus", "resolved_model": "qwen-plus", "channel": "external" },
194
+ { "role": "technical", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "bailian-tp/deepseek-v3", "resolved_model": "deepseek-v3", "channel": "external" },
195
+ { "role": "feasibility", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "bailian-tp/glm-4.5", "resolved_model": "glm-4.5", "channel": "external" }
196
196
  ],
197
197
  "requirements_statement": "实现用户注册流程,支持邮箱验证和密码重置",
198
198
  "gaps_found": [],
@@ -214,9 +214,9 @@ Round 2: delphi-review --mode requirements(带 Round 1 gaps 上下文)
214
214
  "context_file_used": null,
215
215
  "round": 1,
216
216
  "expert_verdicts": [
217
- { "role": "architecture", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-a" },
218
- { "role": "technical", "verdict": "GAPS_FOUND", "confidence": 7, "result_type": "delphi_expert_result", "requested_model": "provider/model-b" },
219
- { "role": "feasibility", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-c" }
217
+ { "role": "architecture", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-a", "resolved_model": "provider/model-a", "channel": "external" },
218
+ { "role": "technical", "verdict": "GAPS_FOUND", "confidence": 7, "result_type": "delphi_expert_result", "requested_model": "provider/model-b", "resolved_model": "provider/model-b", "channel": "external" },
219
+ { "role": "feasibility", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-c", "resolved_model": "provider/model-c", "channel": "external" }
220
220
  ],
221
221
  "requirements_statement": "实现用户注册流程,支持邮箱验证和密码重置",
222
222
  "gaps_found": [
@@ -1,9 +1,9 @@
1
1
  # SKILLS/SPRINT-FLOW KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-09-22
4
- **Commit:** 3d1d1bf
5
- **Branch:** main
6
- **Version:** 0.19.2.0
3
+ **Generated:** 2026-10-07
4
+ **Commit:** ff55f35b
5
+ **Branch:** fix/batch-defects-20261007
6
+ **Version:** 0.20.0.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -89,9 +89,9 @@ grill 访谈达成共享理解后(或 CONTEXT.md 快速路径下读取已有
89
89
  "head_commit": "<git rev-parse HEAD>",
90
90
  "consensus_ratio": 1.0,
91
91
  "expert_verdicts": [
92
- { "role": "architecture", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-a" },
93
- { "role": "technical", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-b" },
94
- { "role": "feasibility", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-c" }
92
+ { "role": "architecture", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-a", "resolved_model": "provider/model-a", "channel": "external" },
93
+ { "role": "technical", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-b", "resolved_model": "provider/model-b", "channel": "external" },
94
+ { "role": "feasibility", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-c", "resolved_model": "provider/model-c", "channel": "external" }
95
95
  ],
96
96
  "rounds": 1,
97
97
  "gaps": []
@@ -1,9 +1,9 @@
1
1
  # SKILLS/TEST-SPECIFICATION-ALIGNMENT KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-09-22
4
- **Commit:** 3d1d1bf
5
- **Branch:** main
6
- **Version:** 0.19.2.0
3
+ **Generated:** 2026-10-07
4
+ **Commit:** ff55f35b
5
+ **Branch:** fix/batch-defects-20261007
6
+ **Version:** 0.20.0.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,4 +1,5 @@
1
1
  import { describe, it, expect } from "vitest"
2
+ import { resolve } from "node:path"
2
3
  import {
3
4
  FALLBACK_MESSAGE,
4
5
  GATE_WHITELIST,
@@ -89,7 +90,13 @@ describe("resolveTarget", () => {
89
90
  })
90
91
 
91
92
  it("resolves relative paths against the session cwd", () => {
92
- expect(resolveTarget("src", "/workspace")).toBe("/workspace/src")
93
+ // path.resolve is platform-native, so assert against the same call rather
94
+ // than a POSIX literal (which fails on Windows by construction).
95
+ expect(resolveTarget("src", "/workspace")).toBe(resolve("/workspace", "src"))
96
+ })
97
+
98
+ it("resolves a Windows-relative path against a Windows cwd", () => {
99
+ expect(resolveTarget("src", "C:\\workspace")).toBe(resolve("C:\\workspace", "src"))
93
100
  })
94
101
  })
95
102
 
@@ -99,4 +106,61 @@ describe("GATE_WHITELIST", () => {
99
106
  expect(GATE_WHITELIST).toContain("arch")
100
107
  expect(GATE_WHITELIST).toContain("secrets")
101
108
  })
102
- })
109
+ })
110
+
111
+ /**
112
+ * @test REQ-DSH-010
113
+ * @intent 验证 PowerShell 方言下生成的命令使用 Get-Command/Write-Output 而非 POSIX 的
114
+ * command -v/printf,避免 DSH 在 win32(pwsh executor)下因语法错误导致三个工具全部不可用
115
+ * @covers AC-DSH-010-01
116
+ */
117
+ describe("PowerShell dialect (regression: DSH win32 uses the pwsh executor)", () => {
118
+ it("uses Get-Command instead of command -v", () => {
119
+ const cmd = buildCommand({ subcommand: "principles", target: "src/x.ts", dialect: "powershell" })
120
+ expect(cmd).toContain("Get-Command xp-gate -ErrorAction SilentlyContinue")
121
+ expect(cmd).not.toContain("command -v")
122
+ })
123
+
124
+ it("uses Write-Output instead of printf for the fallback hint", () => {
125
+ const cmd = buildCommand({ subcommand: "check", target: "src", dialect: "powershell" })
126
+ expect(cmd).toContain("Write-Output")
127
+ expect(cmd).not.toContain("printf")
128
+ expect(cmd).toContain(FALLBACK_MESSAGE)
129
+ })
130
+
131
+ it("never emits POSIX shell syntax that PowerShell cannot parse", () => {
132
+ const cmd = buildCommand({ subcommand: "check", target: "src", gates: ["principles"], dialect: "powershell" })
133
+ // `/dev/null` and `; then … ; fi` are the constructs that produced
134
+ // "if语句中的'if'后缺少\"(\"" under the pwsh executor.
135
+ expect(cmd).not.toContain("/dev/null")
136
+ expect(cmd).not.toContain("then ")
137
+ expect(cmd).not.toContain("; fi")
138
+ expect(cmd).not.toContain("2>&1")
139
+ })
140
+
141
+ it("preserves the xp-gate invocation and gate subset", () => {
142
+ const cmd = buildCommand({
143
+ subcommand: "check",
144
+ target: "src",
145
+ gates: ["principles", "arch"],
146
+ dialect: "powershell",
147
+ })
148
+ expect(cmd).toContain("xp-gate check 'src' --gates 'principles,arch'")
149
+ })
150
+
151
+ it("still drops non-whitelisted gates", () => {
152
+ const cmd = buildCommand({
153
+ subcommand: "check",
154
+ target: "src",
155
+ gates: ["principles", "bogus$(id)"],
156
+ dialect: "powershell",
157
+ })
158
+ expect(cmd).toContain("--gates 'principles'")
159
+ expect(cmd).not.toContain("bogus")
160
+ })
161
+
162
+ it("defaults to the POSIX dialect when none is given (backwards compatible)", () => {
163
+ const cmd = buildCommand({ subcommand: "arch" })
164
+ expect(cmd).toContain("command -v xp-gate")
165
+ })
166
+ })