@boyingliu01/xp-gate 0.41.10 → 0.41.52

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 (123) hide show
  1. package/adapters/gate-3.sh +28 -1
  2. package/adapters/gate-6-layers.sh +18 -1
  3. package/bin/xp-gate.js +13 -0
  4. package/gate-3.sh +28 -1
  5. package/gate-6-layers.sh +18 -1
  6. package/gates/python-health.ts +74 -26
  7. package/gates/test-layers.ts +94 -9
  8. package/hooks/gate-3.sh +28 -1
  9. package/hooks/gate-6-layers.sh +18 -1
  10. package/hooks/gate-entries/gate-11-entry.sh +21 -0
  11. package/hooks/gate-entries/gate-2-entry.sh +15 -0
  12. package/hooks/install.sh +15 -3
  13. package/hooks/pre-commit +90 -13
  14. package/hooks/pre-push +10 -1
  15. package/hooks/sprint-gate.sh +101 -13
  16. package/lib/check-alignment-runner.cjs +97 -0
  17. package/lib/check.js +6 -0
  18. package/lib/crap-cli.js +14 -6
  19. package/lib/delphi-setup.js +13 -0
  20. package/lib/doctor-tui.js +205 -102
  21. package/lib/doctor.js +146 -7
  22. package/lib/gate-runner.js +14 -3
  23. package/lib/init-install.js +299 -0
  24. package/lib/init-languages.js +158 -0
  25. package/lib/init-manifest.js +165 -0
  26. package/lib/init-md-injection.js +58 -0
  27. package/lib/init.js +134 -500
  28. package/lib/install-skill.js +66 -1
  29. package/lib/layer-baseline.cjs +94 -0
  30. package/lib/mattpocock-license-verdict.json +7 -0
  31. package/lib/uninstall-skills.js +140 -0
  32. package/lib/uninstall.js +41 -100
  33. package/lib/update-skill.js +9 -1
  34. package/package.json +3 -1
  35. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  36. package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
  37. package/plugins/claude-code/skills/delphi-review/INSTALL.md +22 -3
  38. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
  39. package/plugins/claude-code/skills/sprint-flow/references/definition-of-done.md +2 -2
  40. package/plugins/claude-code/skills/sprint-flow/references/phase-3-build.md +1 -1
  41. package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +2 -2
  42. package/plugins/claude-code/skills/sprint-flow/references/phase-6-close.md +17 -0
  43. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
  44. package/plugins/dsh/lib/delphi-evidence.d.ts +59 -0
  45. package/plugins/dsh/lib/delphi-evidence.d.ts.map +1 -0
  46. package/plugins/dsh/lib/delphi-evidence.js +128 -0
  47. package/plugins/dsh/lib/delphi-finding.d.ts +123 -0
  48. package/plugins/dsh/lib/delphi-finding.d.ts.map +1 -0
  49. package/plugins/dsh/lib/delphi-finding.js +332 -0
  50. package/plugins/dsh/lib/delphi-findings-parse.d.ts +29 -0
  51. package/plugins/dsh/lib/delphi-findings-parse.d.ts.map +1 -0
  52. package/plugins/dsh/lib/delphi-findings-parse.js +138 -0
  53. package/plugins/dsh/lib/delphi-ledger.d.ts +55 -0
  54. package/plugins/dsh/lib/delphi-ledger.d.ts.map +1 -0
  55. package/plugins/dsh/lib/delphi-ledger.js +124 -0
  56. package/plugins/dsh/lib/delphi-run.d.ts +7 -0
  57. package/plugins/dsh/lib/delphi-run.d.ts.map +1 -1
  58. package/plugins/dsh/lib/delphi-run.js +48 -18
  59. package/plugins/dsh/lib/delphi-seats.d.ts +34 -0
  60. package/plugins/dsh/lib/delphi-seats.d.ts.map +1 -0
  61. package/plugins/dsh/lib/delphi-seats.js +40 -0
  62. package/plugins/dsh/lib/evidence.d.ts +21 -0
  63. package/plugins/dsh/lib/evidence.d.ts.map +1 -1
  64. package/plugins/dsh/lib/evidence.js +3 -0
  65. package/plugins/dsh/lib/index.d.ts.map +1 -1
  66. package/plugins/dsh/lib/index.js +12 -0
  67. package/plugins/dsh/package.json +1 -1
  68. package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
  69. package/plugins/dsh/skills/delphi-review/INSTALL.md +22 -3
  70. package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
  71. package/plugins/dsh/skills/sprint-flow/references/definition-of-done.md +2 -2
  72. package/plugins/dsh/skills/sprint-flow/references/phase-3-build.md +1 -1
  73. package/plugins/dsh/skills/sprint-flow/references/phase-4-verify.md +2 -2
  74. package/plugins/dsh/skills/sprint-flow/references/phase-6-close.md +17 -0
  75. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
  76. package/plugins/dsh/src/delphi-evidence.test.ts +100 -0
  77. package/plugins/dsh/src/delphi-evidence.ts +201 -0
  78. package/plugins/dsh/src/delphi-finding.test.ts +333 -0
  79. package/plugins/dsh/src/delphi-finding.ts +446 -0
  80. package/plugins/dsh/src/delphi-findings-parse.test.ts +100 -0
  81. package/plugins/dsh/src/delphi-findings-parse.ts +158 -0
  82. package/plugins/dsh/src/delphi-findings.test.ts +4 -0
  83. package/plugins/dsh/src/delphi-ledger.test.ts +210 -0
  84. package/plugins/dsh/src/delphi-ledger.ts +158 -0
  85. package/plugins/dsh/src/delphi-run.test.ts +71 -68
  86. package/plugins/dsh/src/delphi-run.ts +80 -24
  87. package/plugins/dsh/src/delphi-seats.test.ts +117 -0
  88. package/plugins/dsh/src/delphi-seats.ts +50 -0
  89. package/plugins/dsh/src/evidence-findings.test.ts +75 -0
  90. package/plugins/dsh/src/evidence.ts +25 -0
  91. package/plugins/dsh/src/index.ts +14 -0
  92. package/plugins/opencode/package.json +1 -1
  93. package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
  94. package/plugins/opencode/skills/delphi-review/INSTALL.md +22 -3
  95. package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
  96. package/plugins/opencode/skills/sprint-flow/references/definition-of-done.md +2 -2
  97. package/plugins/opencode/skills/sprint-flow/references/phase-3-build.md +1 -1
  98. package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +2 -2
  99. package/plugins/opencode/skills/sprint-flow/references/phase-6-close.md +17 -0
  100. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
  101. package/plugins/qoder/plugin.json +1 -1
  102. package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
  103. package/plugins/qoder/skills/delphi-review/INSTALL.md +22 -3
  104. package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
  105. package/plugins/qoder/skills/sprint-flow/references/definition-of-done.md +2 -2
  106. package/plugins/qoder/skills/sprint-flow/references/phase-3-build.md +1 -1
  107. package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +2 -2
  108. package/plugins/qoder/skills/sprint-flow/references/phase-6-close.md +17 -0
  109. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
  110. package/principles/index.ts +50 -1
  111. package/scripts/delphi-config-read.cjs +43 -6
  112. package/scripts/delphi-external-review.cjs +69 -12
  113. package/scripts/delphi-prompts.cjs +47 -1
  114. package/skills/delphi-review/AGENTS.md +1 -1
  115. package/skills/delphi-review/INSTALL.md +22 -3
  116. package/skills/sprint-flow/AGENTS.md +1 -1
  117. package/skills/sprint-flow/references/definition-of-done.md +2 -2
  118. package/skills/sprint-flow/references/phase-3-build.md +1 -1
  119. package/skills/sprint-flow/references/phase-4-verify.md +2 -2
  120. package/skills/sprint-flow/references/phase-6-close.md +17 -0
  121. package/skills/test-specification-alignment/AGENTS.md +1 -1
  122. package/sprint-gate.sh +101 -13
  123. package/mutation/stryker-types.ts +0 -14
@@ -0,0 +1,124 @@
1
+ /**
2
+ * The ledger a review keeps between rounds.
3
+ *
4
+ * One round's reports go in; a ledger plus a prompt section come out. Keeping
5
+ * this out of `runReview` matters for two reasons: `runReview` is already the
6
+ * most complex function in the module, and the ledger's rules (merge, freeze,
7
+ * escalate) must be testable WITHOUT making three model calls.
8
+ *
9
+ * @test REQ-DSH-016
10
+ * @intent 把每轮的席位报告累积成一份跨轮的条目台账,使"这条已关闭"
11
+ * 成为可判定的事实,而不是靠席位改变措辞。
12
+ * @covers AC-DSH-016-03
13
+ */
14
+ import { matchFinding } from "./delphi-finding.js";
15
+ import { parseFindings } from "./delphi-findings-parse.js";
16
+ import { blockingFindings } from "./delphi-seats.js";
17
+ /** An empty ledger: nothing has been reported yet. */
18
+ export function emptyLedger() {
19
+ return { findings: [], round: 0 };
20
+ }
21
+ /**
22
+ * Findings that must not count as blockers any more.
23
+ *
24
+ * A finding is settled when its seat now APPROVES: the seat that raised it is
25
+ * the only one that can say it is satisfied, and the verdict is the only
26
+ * signal the protocol has ever had. Everything else stays open.
27
+ */
28
+ function settledBy(verdict, findings) {
29
+ if (verdict.verdict !== "APPROVED")
30
+ return [];
31
+ const owned = findings.filter((f) => f.status === "open" && ownedBy(f, verdict.role));
32
+ return owned.map((f) => ({ ...f, status: "resolved", statusChangedAtRound: f.statusChangedAtRound }));
33
+ }
34
+ /**
35
+ * Whether `role` is one of the seats that raised this finding.
36
+ *
37
+ * `seat` collapses to "multi" once two seats agree, and "multi" equals no role --
38
+ * so closing on `seat` alone made every shared finding impossible to settle, and
39
+ * it blocked consensus until the round cap. The owner SET is the truth; `seat`
40
+ * stays as the display name only. A legacy entry without `raisedBy` falls back to
41
+ * its single seat.
42
+ */
43
+ function ownedBy(finding, role) {
44
+ if (finding.raisedBy !== undefined)
45
+ return finding.raisedBy.includes(role);
46
+ return finding.seat === role || finding.seat === "multi";
47
+ }
48
+ /**
49
+ * How many of `findings` a fresh approval from `role` would close.
50
+ *
51
+ * Exported so the shared-ownership rule can be asserted without scripting a full
52
+ * review -- a regression here is invisible until a review silently never ends.
53
+ */
54
+ export function closeByAnyOwner(findings, role) {
55
+ return findings.filter((f) => f.status === "open" && ownedBy(f, role)).length;
56
+ }
57
+ /** Apply a closing pass over the ledger, keeping non-owned findings untouched. */
58
+ function closeOwned(ledger, closed) {
59
+ const closedIds = new Set(closed.map((f) => f.id));
60
+ return ledger.map((f) => closedIds.has(f.id) ? { ...f, status: "resolved" } : f);
61
+ }
62
+ /**
63
+ * Fold one round's reports into the ledger.
64
+ *
65
+ * Order matters: close what the seats are now satisfied with FIRST, then add
66
+ * this round's rows, so a finding that was just closed does not get reopened by
67
+ * the same report that closed it.
68
+ */
69
+ export function updateLedger(ledger, round) {
70
+ const closed = round.verdicts.flatMap((v) => settledBy(v, ledger.findings));
71
+ const afterClose = closeOwned(ledger.findings, closed);
72
+ const added = round.verdicts.reduce((acc, v) => absorb(acc, v), { findings: afterClose, opened: [] });
73
+ return { findings: added.findings, closed, opened: added.opened };
74
+ }
75
+ /** Fold one seat's rows into the ledger being accumulated. */
76
+ function absorb(acc, verdict) {
77
+ return parseFindings(verdict.report, verdict.role).reduce((inner, candidate) => {
78
+ const outcome = matchFinding(candidate, inner.findings);
79
+ const opened = outcome.reused ? inner.opened : [...inner.opened, outcome.finding];
80
+ return { findings: replaceOrAppend(inner.findings, outcome.finding), opened };
81
+ }, acc);
82
+ }
83
+ /** Keep ledger order stable: replace in place when the id already exists. */
84
+ function replaceOrAppend(ledger, finding) {
85
+ const index = ledger.findIndex((f) => f.id === finding.id);
86
+ if (index === -1)
87
+ return [...ledger, finding];
88
+ const next = [...ledger];
89
+ next[index] = finding;
90
+ return next;
91
+ }
92
+ /** One ledger row in the prompt: what it is, how bad, and whether it is closed. */
93
+ function ledgerRow(finding) {
94
+ const state = finding.status === "open" ? "OPEN" : finding.status.toUpperCase();
95
+ return `| ${finding.id} | ${finding.severity} | ${state} | ${finding.title.slice(0, 80)} |`;
96
+ }
97
+ /**
98
+ * The prompt section a later round receives.
99
+ *
100
+ * Closed rows are listed rather than silently dropped: a seat that reported a
101
+ * problem needs to see that the system recorded it as fixed, otherwise its
102
+ * absence reads as "forgotten" and it re-raises the same issue.
103
+ */
104
+ export function ledgerPrompt(ledger) {
105
+ if (ledger.findings.length === 0)
106
+ return "";
107
+ return `\n\n## Finding ledger (${countLine(ledger.findings)})\n\n${tableOf(ledger.findings)}\n\n${LEDGER_INSTRUCTIONS}`;
108
+ }
109
+ /** The heading's parenthetical: how much there is, and how much still blocks. */
110
+ function countLine(findings) {
111
+ const blocking = blockingFindings(findings);
112
+ return `${findings.length} entries, ${blocking.length} still blocking`;
113
+ }
114
+ /** The ledger as a markdown table, one row per finding. */
115
+ function tableOf(findings) {
116
+ const rows = findings.map(ledgerRow).join("\n");
117
+ return `| ID | Severity | State | Description |\n|---|---|---|---|\n${rows}`;
118
+ }
119
+ /** What the seat must do with the table; worded once, used by every later round. */
120
+ const LEDGER_INSTRUCTIONS = `Entries marked RESOLVED or DISPROVED are CLOSED. Do not raise them again: ` +
121
+ `re-raising a closed entry is not a new finding. If a closed entry is still wrong, ` +
122
+ `state it as a NEW row with a different location.\n` +
123
+ `Reply with only the entries that are STILL OPEN and belong to you, in the same table shape.`;
124
+ //# sourceMappingURL=delphi-ledger.js.map
@@ -8,11 +8,18 @@
8
8
  * @covers AC-DSH-016-03
9
9
  */
10
10
  import type { DelphiOptions, RoundResult } from "./delphi.js";
11
+ import type { Finding } from "./delphi-finding.js";
11
12
  export interface ReviewOutcome {
12
13
  readonly rounds: readonly RoundResult[];
13
14
  readonly consensus: boolean;
14
15
  readonly finalRatio: number;
15
16
  readonly totalRounds: number;
17
+ /**
18
+ * The finding ledger after the last round. Present so the caller can PERSIST
19
+ * what was still open -- without it the review is unobservable and the matcher
20
+ * can never be calibrated against real data (design §2.7).
21
+ */
22
+ readonly findings: readonly Finding[];
16
23
  }
17
24
  /**
18
25
  * Run a full review. Round 1 is anonymous; each later round sees the aggregate
@@ -1 +1 @@
1
- {"version":3,"file":"delphi-run.d.ts","sourceRoot":"","sources":["../src/delphi-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,aAAa,EAA6B,WAAW,EAAE,MAAM,aAAa,CAAA;AAoBxF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AA0CD;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EACf,SAAS,SAAK,EACd,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,aAAa,CAAC,CA0CxB;AAoDD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAe5D"}
1
+ {"version":3,"file":"delphi-run.d.ts","sourceRoot":"","sources":["../src/delphi-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,aAAa,EAA6B,WAAW,EAAE,MAAM,aAAa,CAAA;AAExF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAsBlD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;CACtC;AA4CD;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EACf,SAAS,SAAK,EACd,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,aAAa,CAAC,CAqBxB;AAqHD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAe5D"}
@@ -10,6 +10,8 @@
10
10
  import { TOOL_ABORTED } from "@deepseek-ai/dsh-tools";
11
11
  import { HarnessError } from "@deepseek-ai/dsh-llm";
12
12
  import { runRound } from "./delphi.js";
13
+ import { blockingFindings } from "./delphi-seats.js";
14
+ import { emptyLedger, ledgerPrompt, updateLedger } from "./delphi-ledger.js";
13
15
  /**
14
16
  * Raise TOOL_ABORTED once the caller's signal has fired.
15
17
  *
@@ -40,7 +42,7 @@ function roundOnePrompt(seat, subject) {
40
42
  * Individual reports stay anonymous -- only the tally and the addressed items
41
43
  * are shared, which is what keeps the method honest.
42
44
  */
43
- function laterRoundPrompt(seat, subject, previous, addressed) {
45
+ function laterRoundPrompt(seat, subject, previous, addressed, ledgerText) {
44
46
  const tally = previous.verdicts
45
47
  .map((v) => `- ${v.role}: ${v.verdict}`)
46
48
  .join("\n");
@@ -49,6 +51,7 @@ function laterRoundPrompt(seat, subject, previous, addressed) {
49
51
  `${tally}\nApprovals: ${previous.approvals}/${previous.validCount} ` +
50
52
  `(threshold ${DEFAULT_THRESHOLD_PERCENT}%).\n\n` +
51
53
  `${addressed ? `What changed since the last round:\n${addressed}\n\n` : ""}` +
54
+ `${ledgerText ? `${ledgerText}\n\n` : ""}` +
52
55
  `Re-examine the material and revise or hold your position.\n\n${subject}\n\n` +
53
56
  `Respond with <=300 words: "### Round assessment" (2-3 sentences), "### Remaining blocking ` +
54
57
  `issues" (table, or a single NONE row), "### VERDICT" followed by exactly APPROVED or ` +
@@ -67,32 +70,59 @@ export async function runReview(opts, subject, addressed = "", signal) {
67
70
  // the review would grind on through every remaining round.
68
71
  const effective = { ...opts, signal };
69
72
  assertNotAborted(signal);
73
+ let ledger = emptyLedger();
70
74
  for (let n = 1; n <= maxRounds; n++) {
71
- const previous = rounds[rounds.length - 1];
72
- const result = previous
73
- ? await runRound(effective, n, "You are a rigorous senior code reviewer.", (seat) => laterRoundPrompt(seat, subject, previous, addressed))
74
- : await runRound(effective, 1, "You are a rigorous senior code reviewer.", (seat) => roundOnePrompt(seat, subject));
75
- assertNotAborted(signal);
76
- rounds.push(result);
77
- // Threshold is a percentage of the whole panel, so a round with a malformed
78
- // report cannot reach consensus even if every valid seat approved.
79
- if (result.approvals / opts.seats.length * 100 >= threshold) {
80
- return {
81
- rounds,
82
- consensus: true,
83
- finalRatio: result.approvals / opts.seats.length,
84
- totalRounds: n,
85
- };
75
+ const result = await nextRound(effective, rounds, subject, addressed, ledger, n, signal);
76
+ rounds.push(result.round);
77
+ ledger = result.ledger;
78
+ if (reachedConsensus(result.round, opts.seats.length, threshold, ledger)) {
79
+ return outcomeOf(rounds, true, result.round, opts.seats.length, ledger);
86
80
  }
87
81
  }
88
82
  const last = rounds[rounds.length - 1];
83
+ return outcomeOf(rounds, false, last, opts.seats.length, ledger);
84
+ }
85
+ /**
86
+ * Run one round and fold its report into the ledger.
87
+ *
88
+ * The ledger from the round before is what a later round argues against: closed
89
+ * entries are shown as CLOSED rather than silently dropped, so a seat can see its
90
+ * finding was recorded as fixed instead of forgotten.
91
+ */
92
+ async function nextRound(effective, rounds, subject, addressed, ledger, n, signal) {
93
+ const previous = rounds[rounds.length - 1];
94
+ const system = "You are a rigorous senior code reviewer.";
95
+ const result = previous
96
+ ? await runRound(effective, n, system, (seat) => laterRoundPrompt(seat, subject, previous, addressed, ledgerPrompt(ledger)))
97
+ : await runRound(effective, 1, system, (seat) => roundOnePrompt(seat, subject));
98
+ assertNotAborted(signal);
99
+ return { round: result, ledger: { ...updateLedger(ledger, result), round: n } };
100
+ }
101
+ /** Assemble the outcome from the rounds collected so far. */
102
+ function outcomeOf(rounds, consensus, last, seats, ledger) {
89
103
  return {
90
104
  rounds,
91
- consensus: false,
92
- finalRatio: last ? last.approvals / opts.seats.length : 0,
105
+ consensus,
106
+ finalRatio: last ? last.approvals / seats : 0,
93
107
  totalRounds: rounds.length,
108
+ findings: ledger.findings,
94
109
  };
95
110
  }
111
+ /**
112
+ * Both conditions, and the gate's is the binding one.
113
+ *
114
+ * The ratio is still `approvals / seats` against the same 90% bar -- this
115
+ * change must never make a review EASIER to pass than the gate expects. What it
116
+ * adds is the ledger's second condition: a round cannot be called consensus while
117
+ * a critical or major finding is still open, even if every seat happened to
118
+ * approve. That can only ever make the bar stricter, never looser.
119
+ */
120
+ function reachedConsensus(result, seats, threshold, ledger) {
121
+ const ratio = result.approvals / seats * 100;
122
+ if (ratio < threshold)
123
+ return false;
124
+ return blockingFindings(ledger.findings).length === 0;
125
+ }
96
126
  /** Human-readable transcript for the tool result. */
97
127
  /**
98
128
  * Reduce a seat's raw report to the part worth reading (#670).
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Who sits out the next round, and what still blocks it.
3
+ *
4
+ * Both rules exist to protect one invariant: itemizing must never make the gate
5
+ * easier to pass. A released seat keeps its APPROVED vote and is recalled the
6
+ * moment a new open critical appears; a disproved or minor finding never blocks.
7
+ *
8
+ * @test REQ-DSH-016
9
+ * @intent 条目化只改变"何时可以停止询问",不改变"什么叫通过"——
10
+ * 释放席位不得把 REQUEST_CHANGES 变成 APPROVED,minor 与 disproved 不得阻断。
11
+ * @covers AC-DSH-016-03
12
+ */
13
+ import type { Finding } from "./delphi-finding.js";
14
+ /** A seat's state for one round. */
15
+ export interface SeatState {
16
+ readonly seat: string;
17
+ readonly verdict: "APPROVED" | "REQUEST_CHANGES";
18
+ readonly released: boolean;
19
+ }
20
+ /** Findings that still block consensus: open, and at least major. */
21
+ export declare function blockingFindings(findings: readonly Finding[]): Finding[];
22
+ /**
23
+ * Decide which seats sit out the next round.
24
+ *
25
+ * A seat is released only when it already APPROVED and nothing it raised is still
26
+ * open. It is recalled the moment any new open critical appears -- otherwise a
27
+ * released seat never learns what the OTHER seats found after it left, which is
28
+ * the agreeableness fatigue this mechanism would otherwise buy back.
29
+ *
30
+ * Releasing never changes a verdict: a seat that said REQUEST_CHANGES stays
31
+ * unreleased and stays REQUEST_CHANGES. Consensus is the gate's, not ours.
32
+ */
33
+ export declare function releaseSeats(seats: readonly SeatState[], findings: readonly Finding[]): SeatState[];
34
+ //# sourceMappingURL=delphi-seats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delphi-seats.d.ts","sourceRoot":"","sources":["../src/delphi-seats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,oCAAoC;AACpC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,iBAAiB,CAAA;IAChD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAC3B;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,CAExE;AAOD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,EAAE,CAMnG"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Who sits out the next round, and what still blocks it.
3
+ *
4
+ * Both rules exist to protect one invariant: itemizing must never make the gate
5
+ * easier to pass. A released seat keeps its APPROVED vote and is recalled the
6
+ * moment a new open critical appears; a disproved or minor finding never blocks.
7
+ *
8
+ * @test REQ-DSH-016
9
+ * @intent 条目化只改变"何时可以停止询问",不改变"什么叫通过"——
10
+ * 释放席位不得把 REQUEST_CHANGES 变成 APPROVED,minor 与 disproved 不得阻断。
11
+ * @covers AC-DSH-016-03
12
+ */
13
+ /** Findings that still block consensus: open, and at least major. */
14
+ export function blockingFindings(findings) {
15
+ return findings.filter((f) => f.status === "open" && f.severity !== "minor");
16
+ }
17
+ /** Whether any finding is a NEW open critical that should re-engage released seats. */
18
+ function hasNewCritical(findings) {
19
+ return findings.some((f) => f.status === "open" && f.severity === "critical");
20
+ }
21
+ /**
22
+ * Decide which seats sit out the next round.
23
+ *
24
+ * A seat is released only when it already APPROVED and nothing it raised is still
25
+ * open. It is recalled the moment any new open critical appears -- otherwise a
26
+ * released seat never learns what the OTHER seats found after it left, which is
27
+ * the agreeableness fatigue this mechanism would otherwise buy back.
28
+ *
29
+ * Releasing never changes a verdict: a seat that said REQUEST_CHANGES stays
30
+ * unreleased and stays REQUEST_CHANGES. Consensus is the gate's, not ours.
31
+ */
32
+ export function releaseSeats(seats, findings) {
33
+ const recall = hasNewCritical(findings);
34
+ return seats.map((seat) => {
35
+ if (seat.verdict !== "APPROVED")
36
+ return { ...seat, released: false };
37
+ return { ...seat, released: !recall };
38
+ });
39
+ }
40
+ //# sourceMappingURL=delphi-seats.js.map
@@ -24,6 +24,25 @@ export interface WalkthroughEvidence {
24
24
  readonly consensus_ratio: number;
25
25
  readonly verdict: "APPROVED";
26
26
  readonly experts: readonly EvidenceExpert[];
27
+ /**
28
+ * The finding ledger as it stood at the end of the review (design §2.7).
29
+ *
30
+ * Written for OBSERVABILITY, not for validation: the gate does not read it, so
31
+ * omitting a finding here never changes a push decision. Without it the matcher
32
+ * is unobservable and its thresholds could never be calibrated against real
33
+ * reviews -- which is the whole reason this is in the same sprint as the
34
+ * matcher rather than a later one.
35
+ */
36
+ readonly findings?: readonly EvidenceFinding[];
37
+ }
38
+ /** One ledger entry, flattened for the evidence file. */
39
+ export interface EvidenceFinding {
40
+ readonly id: string;
41
+ readonly seat: string;
42
+ readonly severity: string;
43
+ readonly status: string;
44
+ readonly location: string;
45
+ readonly title: string;
27
46
  }
28
47
  export interface EvidenceExpert {
29
48
  readonly role: string;
@@ -52,6 +71,8 @@ export interface BuildEvidenceInput {
52
71
  readonly baseUrl?: string;
53
72
  /** Observed agreement. Defaults to unanimous, which is what a 3-seat APPROVED run is. */
54
73
  readonly consensusRatio?: number;
74
+ /** The ledger to record, if the caller keeps one. Purely informational. */
75
+ readonly findings?: readonly EvidenceFinding[];
55
76
  }
56
77
  /**
57
78
  * Label a gateway as local or external.
@@ -1 +1 @@
1
- {"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAA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,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAC7B;AAED,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAA;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,yFAAyF;IACzF,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,eAAe,EAAE,CAAA;CAC/C;AAWD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAKrE;AAwBD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,CAiC5E"}
@@ -87,6 +87,9 @@ export function buildEvidence(input) {
87
87
  channel,
88
88
  verdict: "APPROVED",
89
89
  })),
90
+ // Absent when the caller has no ledger: an empty array would claim "nothing
91
+ // was ever reported", which is a different fact from "nobody recorded it".
92
+ ...(input.findings && input.findings.length > 0 ? { findings: input.findings } : {}),
90
93
  };
91
94
  }
92
95
  //# sourceMappingURL=evidence.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,CAA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rE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAQtC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9E;AA8ID;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA4BjB,CAAA;AAEF,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,OAAY,GAAG,IAAI,CAmC9D"}
@@ -161,6 +161,17 @@ function gateArchTool(shell, dialect) {
161
161
  * succeeded, and losing its text because evidence could not be written would be a
162
162
  * worse outcome than a clear note that the push gate will not be satisfied.
163
163
  */
164
+ /** Flatten the review's ledger for the evidence file; see WalkthroughEvidence.findings. */
165
+ function ledgerForEvidence(outcome) {
166
+ return outcome.findings.map((f) => ({
167
+ id: f.id,
168
+ seat: f.seat,
169
+ severity: f.severity,
170
+ status: f.status,
171
+ location: f.location,
172
+ title: f.title,
173
+ }));
174
+ }
164
175
  async function writeWalkthroughEvidence(cwd, cfg, outcome) {
165
176
  try {
166
177
  const lastRound = outcome.rounds[outcome.rounds.length - 1];
@@ -178,6 +189,7 @@ async function writeWalkthroughEvidence(cwd, cfg, outcome) {
178
189
  now: new Date(),
179
190
  baseUrl: cfg.baseUrl,
180
191
  consensusRatio: outcome.finalRatio,
192
+ findings: ledgerForEvidence(outcome),
181
193
  });
182
194
  const target = join(cwd, EVIDENCE_FILE);
183
195
  await writeFile(target, `${JSON.stringify(evidence, null, 2)}\n`, "utf8");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/dsh-plugin-xp-gate",
3
- "version": "0.41.10",
3
+ "version": "0.41.52",
4
4
  "description": "XP-Gate deterministic quality gates + AI workflow skills as a DeepSeek Harness (DSH) native plugin: gate-check / gate-principles / gate-arch tools + 12 SKILL.md skills",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.41.10.0
6
+ **Version:** 0.41.52.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.
@@ -12,15 +12,34 @@ This guide walks you through setting up the Delphi consensus review skill in you
12
12
 
13
13
  ## Quick Setup (3 steps)
14
14
 
15
- ### Step 1: Copy the configuration template
15
+ ### Step 1: Create ONE configuration, machine-wide by default
16
+
17
+ Two locations are read, and **a project-root file always wins over the machine-wide
18
+ one**. That precedence is the single most important thing on this page:
19
+
20
+ | Location | Scope | When to use it |
21
+ |---|---|---|
22
+ | `~/.config/xp-gate/.delphi-config.json` | every project on this machine | **the normal choice** |
23
+ | `<repo>/.delphi-config.json` | that repo only, and it **overrides** the above | only to pin different seats for one repo |
16
24
 
17
25
  ```bash
18
- # From your project root (where opencode.json lives):
19
- cp skills/delphi-review/.delphi-config.json.example .delphi-config.json
26
+ # Recommended: one config for the whole machine.
27
+ mkdir -p ~/.config/xp-gate
28
+ cp skills/delphi-review/.delphi-config.json.example ~/.config/xp-gate/.delphi-config.json
20
29
  ```
21
30
 
31
+ > **If you copy it into the repo root instead, every later edit to the machine-wide
32
+ > config becomes a no-op for that repo.** `xp-gate doctor delphi` reports this as
33
+ > `Delphi config shadow (#541)`; deleting the repo-root copy makes it go away. Do not
34
+ > put a copy in every project "to be safe" — that is what creates the shadow. Measured
35
+ > 2026-11-17: a consumer followed the old version of this page, then fixed the global
36
+ > seats and kept getting the old ones, because the repo copy silently won.
37
+
22
38
  This file maps abstract expert roles to agent names. You typically don't need to edit this unless you want custom agent names.
23
39
 
40
+ Pass `--config <path>` to point at a specific file for one run; a relative path that
41
+ does not exist in the current directory falls back to the machine-wide config.
42
+
24
43
  ### Step 2: Add agent definitions to opencode.json
25
44
 
26
45
  Copy the `agent` block from `skills/delphi-review/opencode.json.delphi.example` into your `opencode.json`.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.41.10.0
6
+ **Version:** 0.41.52.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; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -17,12 +17,12 @@
17
17
 
18
18
  | # | 条目 | 判据(必须能指出位置) |
19
19
  |---|------|------------------------|
20
- | 1 | **需求可追溯** | `specification.yaml` 有 REQ + AC;测试文件带 `@covers AC-xxx`;`scripts/__tests__/ac-reference-guard.test.cjs` 通过 |
20
+ | 1 | **需求可追溯** | `specification.yaml` 有 REQ + AC;测试文件带 `@covers AC-xxx`。**(xp-gate 自身仓库额外要求)** `scripts/__tests__/ac-reference-guard.test.cjs` 通过;你的项目用等价的「AC 必须存在于 spec」检查 |
21
21
  | 2 | **测试先行** | 实现前存在失败的测试;或说明为何不适用(纯文档/配置) |
22
22
  | 3 | **测试真的能失败** | 至少一个变异体/破坏被测试抓住。「测试通过」在从未运行时和「功能正确」无法区分 |
23
23
  | 4 | **验证命令已运行** | 记录实际命令与输出,不是「应该是绿的」。CI 命令与本地命令一致 |
24
24
  | 5 | **门禁未降级** | 无 `--no-verify`;无新增基线额度来吸收本次改动自身的告警 |
25
- | 6 | **镜像已同步** | 改了 `githooks/`/`skills/`/`plugins/` → `bash scripts/check-hook-mirror.sh` 输出 PASS |
25
+ | 6 | **镜像已同步** | **(仅 xp-gate 自身仓库)** 改了 `githooks/`/`skills/`/`plugins/` → `bash scripts/check-hook-mirror.sh` 输出 PASS。你的项目若没有镜像树,本条不适用——填「不适用」而不是发明等价检查 |
26
26
  | 7 | **不做未经要求的相邻改动** | 每行改动可追溯到本 REQ;顺手发现的无关死代码只提及不删除 |
27
27
  | 8 | **已知限制已写明** | 没做的部分、以及为什么没做,写进 issue/提交,而不是留空 |
28
28
  | 9 | **文档与实现一致** | 门禁数量、CLI 表、阈值等出现在多处的事实同步更新(见 `AGENTS.md` "Known Drift") |
@@ -38,7 +38,7 @@
38
38
  | 4 | **Gate 4 Principles** | 14 条 Clean Code/SOLID 规则,任一 error/warning 即拦(按 `.principlesrc`) | `xp-gate check 4 <file>`;避免超长参数表、空 catch、`as any` |
39
39
  | 5 | **Gate 1 Lint** | 适配器 lint 任一 error | 提交前跑一次项目 lint;不要留未用变量/导入 |
40
40
  | 6 | **Gate 5 测试** | 测试全绿 + 覆盖率 ≥80%(新 .ts/.tsx 无测试直接 BLOCK) | 新代码先写测试(TDD);`npx vitest run <file>` |
41
- | 7 | **mirror/sync 纪律** | 改 `githooks/` 或 `skills/` 后必须 `node src/npm-package/scripts/sync-package-content.js --fix` 且 `bash scripts/check-hook-mirror.sh` 报 PASS | 忘了同步会在 pre-push 的 mirror 校验被打回 |
41
+ | 7 | **mirror/sync 纪律** | **(仅 xp-gate 自身仓库)** 改 `githooks/` 或 `skills/` 后必须 `node src/npm-package/scripts/sync-package-content.js --fix` 且 `bash scripts/check-hook-mirror.sh` 报 PASS | 忘了同步会在 pre-push 的 mirror 校验被打回;无镜像树的项目本条不适用 |
42
42
 
43
43
  **权威清单用 `xp-gate gate-rules` 现取,不要背上面这张表。** 上表是手抄的,阈值真正定义在
44
44
  `.principlesrc`、`jscpd.conf.json` 和 `githooks/pre-commit` 里。`xp-gate gate-rules` 从那些
@@ -148,12 +148,12 @@ ELSE:
148
148
 
149
149
  | # | 条目 | 在 VERIFY 的检查方式 |
150
150
  |---|------|----------------------|
151
- | 1 | 需求可追溯 | `npx vitest run scripts/__tests__/ac-reference-guard.test.cjs` 通过(测试引用的 AC 都在 spec 里) |
151
+ | 1 | 需求可追溯 | 测试引用的 AC 都在 spec 里。**(xp-gate 自身仓库额外要求)** `npx vitest run scripts/__tests__/ac-reference-guard.test.cjs` 通过;你的项目用等价的自带检查 |
152
152
  | 2 | 测试先行 | 有 RED 证据(提交历史或记录),或说明为何不适用 |
153
153
  | 3 | **测试真的能失败** | 至少证明过一个变异体会被抓住——「测试通过」在从未运行时与「功能正确」无法区分 |
154
154
  | 4 | 验证命令已运行 | 记录实际命令 + 输出,不是「应该是绿的」 |
155
155
  | 5 | 门禁未降级 | 无 `--no-verify`;无为了本次改动新增的基线额度 |
156
- | 6 | 镜像已同步 | `bash scripts/check-hook-mirror.sh` → PASS |
156
+ | 6 | 镜像已同步 | **(仅 xp-gate 自身仓库)** `bash scripts/check-hook-mirror.sh` → PASS;无镜像树的项目本条不适用 |
157
157
 
158
158
  第 5 项值得单独说明:**加基线额度来吸收自己刚产生的告警,等于把门禁关掉一次。**
159
159
  `.warnings-baseline.json` 只应记录「改动之前就存在」的告警。
@@ -23,6 +23,10 @@
23
23
 
24
24
  **Purpose**: `.sprint-state/` is gitignored and lives inside the worktree. When the worktree is removed during CLEANUP, all sprint state is lost. This step copies it into the main repository before cleanup.
25
25
 
26
+ **`.xp-gate/` goes too (#836).** The tool writes its own audit surface into a DIFFERENT gitignored directory inside the same worktree: the `--skip-evidence` REASON, the gate-result snapshots, and the quality reports retro reads. Backing up only `.sprint-state/` loses them at the same moment, and the loss is silent -- the sprint closes looking complete while the record of *why* a gate was skipped no longer exists anywhere. #318 extended this list to cover state; it never covered audit.
27
+
28
+ Backup BOTH directories. A missing `.xp-gate/` is not an error (a sprint may never have triggered a gate), so the copy is conditional.
29
+
26
30
  **Execution** (immediately after SHIP→CLOSE GATE passes):
27
31
 
28
32
  ```bash
@@ -34,14 +38,27 @@ BACKUP_DIR=".sprint-history/${SPRINT_ID}"
34
38
  mkdir -p "$BACKUP_DIR"
35
39
  cp -r .sprint-state/* "$BACKUP_DIR/"
36
40
 
41
+ # 2b. Audit surface (#836) — gitignored, worktree-local, and NOT covered by the
42
+ # copy above. Missing is fine; losing a present one is not.
43
+ if [ -d .xp-gate ]; then
44
+ mkdir -p "$BACKUP_DIR/xp-gate"
45
+ cp -r .xp-gate/* "$BACKUP_DIR/xp-gate/"
46
+ fi
47
+
37
48
  # 3. Verify backup
38
49
  ls "$BACKUP_DIR/sprint-state.json" && echo "✅ Sprint state backed up to $BACKUP_DIR"
50
+ if [ -d .xp-gate ]; then
51
+ ls "$BACKUP_DIR/xp-gate/audit.jsonl" \
52
+ && echo "✅ Audit surface backed up to $BACKUP_DIR/xp-gate/" \
53
+ || echo "⚠️ .xp-gate/ existed but audit.jsonl was not copied"
54
+ fi
39
55
  ```
40
56
 
41
57
  **GATE CHECK**:
42
58
  ```
43
59
  [BACKUP] sprint-state.json copied ✓
44
60
  [BACKUP] phase-outputs/ preserved ✓
61
+ [BACKUP] .xp-gate/ audit surface copied ✓ (or: absent, nothing to copy)
45
62
  ```
46
63
 
47
64
  **Output**: `.sprint-history/<sprint-id>/` contains full sprint state, safely outside the worktree.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.41.10.0
6
+ **Version:** 0.41.52.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.