@boyingliu01/xp-gate 0.41.62 → 0.41.64

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.
@@ -112,13 +112,78 @@ function readMachineConfig(home) {
112
112
  }
113
113
  }
114
114
 
115
+ /**
116
+ * Read a PROJECT-level `.delphi-config.json` and report whether it declares
117
+ * `channels` (#711).
118
+ *
119
+ * WHY THIS EXISTS, AND WHY IT DOES NOT CHANGE THE ANSWER
120
+ * The project file can declare profiles and seats and is read for those. Its
121
+ * `channels` field was read by NOTHING, and said nothing about it: a team that
122
+ * committed `{"channels": ["external"]}` believed native channels were off for
123
+ * everyone who cloned the repo, while resolution fell through to the machine
124
+ * default with `nativeEnabled: true`.
125
+ *
126
+ * Making the project value WIN would let a repository narrow a machine-wide,
127
+ * security-adjacent setting for whoever checks it out, which is a design
128
+ * decision this defect does not authorize. Making it a hard ERROR would break
129
+ * existing repos that carry the field harmlessly. So the machine remains the
130
+ * only source of truth and the project field is REPORTED — the defect #711
131
+ * names is the SILENCE, not the precedence.
132
+ *
133
+ * @param {string} projectDir
134
+ * @returns {{ declared?: boolean, error?: string }}
135
+ */
136
+ function readProjectChannelIntent(projectDir) {
137
+ if (!projectDir) return {};
138
+ const file = path.join(projectDir, '.delphi-config.json');
139
+ if (!fs.existsSync(file)) return {};
140
+ let parsed;
141
+ try {
142
+ parsed = JSON.parse(fs.readFileSync(file, 'utf8'));
143
+ } catch (err) {
144
+ return { error: `project ${file} is unreadable: ${err && err.message ? err.message : String(err)}` };
145
+ }
146
+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
147
+ return { error: `project ${file} is not a JSON object` };
148
+ }
149
+ return { declared: Object.prototype.hasOwnProperty.call(parsed, 'channels') };
150
+ }
151
+
115
152
  /**
116
153
  * Resolve which Delphi channels are enabled on this machine.
117
154
  *
118
- * @param {{ home?: string }} [opts]
155
+ * @param {{ home?: string, projectDir?: string }} [opts]
156
+ * `projectDir` is optional so existing callers keep their exact behaviour; when
157
+ * supplied, a project-level `channels` field is reported but never applied.
119
158
  * @returns {{ channels: string[], source: 'env'|'config'|'default', nativeEnabled: boolean, warning?: string }}
120
159
  */
121
160
  function resolveChannels(opts = {}) {
161
+ const resolved = resolveChannelsFromMachine(opts);
162
+ const project = readProjectChannelIntent(opts.projectDir);
163
+ const notes = [];
164
+ if (resolved.warning) notes.push(resolved.warning);
165
+ if (project.error) {
166
+ notes.push(project.error);
167
+ } else if (project.declared) {
168
+ notes.push(
169
+ 'project .delphi-config.json declares "channels", but the channel preference is read from '
170
+ + 'the MACHINE config only (~/.config/xp-gate/.delphi-config.json) — this field is IGNORED. '
171
+ + 'Set channels there, or use XP_GATE_DELPHI_CHANNEL.',
172
+ );
173
+ }
174
+ return notes.length > 0 ? { ...resolved, warning: notes.join('; ') } : resolved;
175
+ }
176
+
177
+ /**
178
+ * The machine-level resolution: env var, then the machine config, then defaults.
179
+ *
180
+ * Split out of `resolveChannels` so the project-scope reporting above cannot
181
+ * change the precedence it reports on.
182
+ *
183
+ * @param {{ home?: string }} [opts]
184
+ * @returns {{ channels: string[], source: 'env'|'config'|'default', nativeEnabled: boolean, warning?: string }}
185
+ */
186
+ function resolveChannelsFromMachine(opts = {}) {
122
187
  const envRaw = process.env[CHANNEL_ENV];
123
188
  if (envRaw !== undefined && envRaw.trim() !== '') {
124
189
  const { channels, unknown } = normaliseChannels(envRaw);
package/lib/doctor.js CHANGED
@@ -4346,7 +4346,13 @@ function resolveAgentTarget(options) {
4346
4346
  const channelHome = process.env.XDG_CONFIG_HOME
4347
4347
  ? path.dirname(process.env.XDG_CONFIG_HOME)
4348
4348
  : undefined;
4349
- const channelResolution = delphiChannel.resolveChannels({ home: channelHome });
4349
+ // #711: pass the project directory so a project-level `channels` field is
4350
+ // REPORTED even though it never applies. Before this, a repo whose
4351
+ // .delphi-config.json declared channels looked configured and did nothing.
4352
+ const channelResolution = delphiChannel.resolveChannels({
4353
+ home: channelHome,
4354
+ projectDir: options.projectDir || process.cwd(),
4355
+ });
4350
4356
 
4351
4357
  const homeAgentsDir = path.join(HOME_DIR(), '.qoder', 'agents');
4352
4358
  // Injectable for tests; defaults to the cwd the doctor runs from.
@@ -4446,6 +4452,14 @@ function checkDelphiAgentBindings(add, options) {
4446
4452
  }
4447
4453
  add('Qoder Delphi agent bindings', agentsStatus, agentDetails.join('; ') || 'all three bound');
4448
4454
  }
4455
+ // #711: the channel preference resolves, so far, from the machine config and
4456
+ // the env var. A project that puts `channels` in ITS OWN .delphi-config.json
4457
+ // gets no effect from it, and before this line got no warning either -- the
4458
+ // file looked authoritative and did nothing. Reported as its own row so the
4459
+ // fact is visible whether or not the native path is enabled.
4460
+ if (channelResolution.warning) {
4461
+ add('Delphi channel preference', 'WARN', channelResolution.warning);
4462
+ }
4449
4463
  }
4450
4464
 
4451
4465
  /**
@@ -4801,7 +4815,53 @@ function reportHostedSeats(add, models) {
4801
4815
  }
4802
4816
  add(label, 'WARN',
4803
4817
  `hosted (non local-*) seats: ${hosted.map(({ role, model }) => `${role}=${model}`).join(', ')} — `
4804
- + 'local-only review is the standing rule; run: python scripts/check_delphi_local_models.py --probe');
4818
+ + 'local-only review is the standing rule; check the seats with: xp-gate doctor delphi');
4819
+ }
4820
+
4821
+ /**
4822
+ * Compare the configured seats against the models a project PINNED (#712).
4823
+ *
4824
+ * WHY A PROJECT-LEVEL DECLARATION
4825
+ * The local-only rule above is a fixed WARN, which is right for a preference.
4826
+ * A consumer project often has a HARD requirement instead — "these three seats
4827
+ * must be exactly these three models" — and had no way to say so: each repo
4828
+ * re-implemented the check in its own script, so the constraint lived nowhere
4829
+ * upstream and drifted per project.
4830
+ *
4831
+ * `pinned_models` is that declaration. When it is ABSENT nothing changes (the
4832
+ * WARN above stands), so existing configs keep their exact behaviour.
4833
+ *
4834
+ * A mismatch is FAIL, not WARN: if the project said "exactly these", anything
4835
+ * else is a defect the project already decided is unacceptable. Both sides of
4836
+ * every difference are printed — "seat differs" without the two values leaves
4837
+ * the operator to diff the config by hand.
4838
+ *
4839
+ * @param {Function} add
4840
+ * @param {object} pinned reported `pinned_models`
4841
+ * @param {Array<string|undefined>} models one per DELPHI_ROLES entry
4842
+ */
4843
+ function reportPinnedSeats(add, pinned, models) {
4844
+ const label = 'Delphi pinned seats (#712)';
4845
+ if (!pinned || typeof pinned !== 'object' || Array.isArray(pinned)) {
4846
+ add(label, 'FAIL', 'pinned_models must be an object of role -> model id');
4847
+ return;
4848
+ }
4849
+ const unknown = Object.keys(pinned).filter((r) => !DELPHI_ROLES.includes(r));
4850
+ if (unknown.length > 0) {
4851
+ // A typo'd role pins nothing and reads as satisfied. Name it.
4852
+ add(label, 'FAIL', `pinned_models names unknown role(s): ${unknown.join(', ')} (known: ${DELPHI_ROLES.join(', ')})`);
4853
+ return;
4854
+ }
4855
+ const diffs = DELPHI_ROLES
4856
+ .map((role, i) => ({ role, want: pinned[role], got: models[i] }))
4857
+ .filter(({ want, got }) => want !== undefined && want !== got);
4858
+ if (diffs.length === 0) {
4859
+ add(label, 'PASS', `all ${Object.keys(pinned).length} pinned seat(s) match the configured profile`);
4860
+ return;
4861
+ }
4862
+ add(label, 'FAIL', diffs
4863
+ .map(({ role, want, got }) => `${role}: pinned ${want}, configured ${got ?? '(none)'}`)
4864
+ .join('; '));
4805
4865
  }
4806
4866
 
4807
4867
  /**
@@ -4893,6 +4953,11 @@ function reportConfigFile(p) {
4893
4953
  // finally has a caller (`xp-gate doctor delphi`) instead of existing
4894
4954
  // only in its own docstring.
4895
4955
  reportHostedSeats(add, models);
4956
+ // #712: a project may PIN the three seats. Absent means "no opinion",
4957
+ // which keeps every existing config's behaviour identical.
4958
+ if (Object.prototype.hasOwnProperty.call(raw, 'pinned_models')) {
4959
+ reportPinnedSeats(add, raw.pinned_models, models);
4960
+ }
4896
4961
  }
4897
4962
  reportConfigShadow({ add, cfgPath, globalConfigPath, models });
4898
4963
  }
@@ -33,6 +33,20 @@ async function install(args = []) {
33
33
  const { doctor } = require('./doctor.js');
34
34
  const doctorCode = await doctor(['--fix']);
35
35
 
36
+ // #712: the Delphi chain had NO execution point in the install path. `doctor`
37
+ // covers the gates and hooks; `doctorDelphi` covers seat distinctness, the
38
+ // local-only rule, pinned seats and the skill/runner parity, and it was
39
+ // reachable only from `xp-gate doctor delphi`. Between installs and the next
40
+ // review, nothing confirmed Delphi still worked -- you found out when a review
41
+ // failed.
42
+ //
43
+ // The exit code is deliberately NOT propagated (#503): a hosted seat or a
44
+ // missing optional runner is a diagnostic about the environment, not a failed
45
+ // install, and returning it would make `xp-gate install && next-step` fail on
46
+ // a successful install. What must exist is the OUTPUT -- silence is the defect
47
+ // this is fixing.
48
+ await reportDelphiChain();
49
+
36
50
  if (doctorCode === 0) {
37
51
  console.log('\n✓ Installation complete and verified!');
38
52
  } else {
@@ -46,4 +60,29 @@ async function install(args = []) {
46
60
  return 0;
47
61
  }
48
62
 
49
- module.exports = { install };
63
+
64
+ /**
65
+ * Run the Delphi chain check and print it (#712).
66
+ *
67
+ * Split out of `install()` for the same reason every other check here is: the
68
+ * steps are independent questions, and inlining this one pushed the function past
69
+ * the length limit. It also makes the intent legible — the install path calls it
70
+ * unconditionally, which is the point.
71
+ *
72
+ * The exit code is deliberately NOT propagated (#503): a hosted seat or a missing
73
+ * optional runner is a diagnostic about the environment, not a failed install.
74
+ * What must exist is the OUTPUT — silence is the defect this fixes.
75
+ */
76
+ async function reportDelphiChain() {
77
+ console.log('\n━━━ Delphi Review Chain ━━━\n');
78
+ try {
79
+ const { doctorDelphi } = require('./doctor.js');
80
+ await doctorDelphi({ projectDir: process.cwd() });
81
+ } catch (err) {
82
+ // A crash in the Delphi check must not take the install with it, but it must
83
+ // not disappear either.
84
+ console.log(` ⚠ Delphi chain check could not run: ${err && err.message ? err.message : String(err)}`);
85
+ }
86
+ }
87
+
88
+ module.exports = { install, reportDelphiChain };
@@ -2,6 +2,6 @@
2
2
  "verdict": "PASS",
3
3
  "license_type": "MIT",
4
4
  "sha256": "0e7ac423bf2c6e223b7c5b156f8cf72da49d748e56a1641402c31f22ad07dbb5",
5
- "checked_at": "2026-12-01T23:45:53.707Z",
5
+ "checked_at": "2026-12-01T23:56:57.611Z",
6
6
  "source": "network"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.41.62",
3
+ "version": "0.41.64",
4
4
  "description": "Deterministic quality gates for AI-generated code: 15 gates, Delphi review, sprint flow. Works with Claude Code, OpenCode, Qoder.",
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.41.62",
3
+ "version": "0.41.64",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
6
6
  "author": {
@@ -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.62.0
6
+ **Version:** 0.41.64.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.
@@ -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.62.0
6
+ **Version:** 0.41.64.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.
@@ -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.62.0
6
+ **Version:** 0.41.64.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/dsh-plugin-xp-gate",
3
- "version": "0.41.62",
3
+ "version": "0.41.64",
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.62.0
6
+ **Version:** 0.41.64.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.
@@ -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.62.0
6
+ **Version:** 0.41.64.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.
@@ -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.62.0
6
+ **Version:** 0.41.64.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/opencode-plugin",
3
- "version": "0.41.62",
3
+ "version": "0.41.64",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "description": "XP-Gate quality gates + AI workflow skills for OpenCode",
@@ -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.62.0
6
+ **Version:** 0.41.64.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.
@@ -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.62.0
6
+ **Version:** 0.41.64.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.
@@ -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.62.0
6
+ **Version:** 0.41.64.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-gate",
3
- "version": "0.41.62",
3
+ "version": "0.41.64",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Qoder. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
6
6
  "author": {
@@ -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.62.0
6
+ **Version:** 0.41.64.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.
@@ -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.62.0
6
+ **Version:** 0.41.64.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.
@@ -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.62.0
6
+ **Version:** 0.41.64.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -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.62.0
6
+ **Version:** 0.41.64.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.
@@ -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.62.0
6
+ **Version:** 0.41.64.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.
@@ -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.62.0
6
+ **Version:** 0.41.64.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.