@boyingliu01/xp-gate 0.41.10 → 0.41.56
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.
- package/adapters/gate-3.sh +28 -1
- package/adapters/gate-6-layers.sh +18 -1
- package/bin/xp-gate.js +13 -0
- package/gate-3.sh +28 -1
- package/gate-6-layers.sh +18 -1
- package/gates/python-health.ts +74 -26
- package/gates/test-layers.ts +94 -9
- package/hooks/gate-3.sh +28 -1
- package/hooks/gate-6-layers.sh +18 -1
- package/hooks/gate-entries/gate-11-entry.sh +21 -0
- package/hooks/gate-entries/gate-2-entry.sh +15 -0
- package/hooks/install.sh +15 -3
- package/hooks/pre-commit +90 -13
- package/hooks/pre-push +10 -1
- package/hooks/sprint-gate.sh +101 -13
- package/lib/check-alignment-runner.cjs +97 -0
- package/lib/check.js +6 -0
- package/lib/crap-cli.js +14 -6
- package/lib/delphi-setup.js +13 -0
- package/lib/doctor-tui.js +205 -102
- package/lib/doctor.js +283 -31
- package/lib/gate-runner.js +14 -3
- package/lib/init-install.js +299 -0
- package/lib/init-languages.js +158 -0
- package/lib/init-manifest.js +165 -0
- package/lib/init-md-injection.js +58 -0
- package/lib/init.js +134 -500
- package/lib/install-skill.js +66 -1
- package/lib/layer-baseline.cjs +94 -0
- package/lib/mattpocock-license-verdict.json +7 -0
- package/lib/uninstall-skills.js +140 -0
- package/lib/uninstall.js +41 -100
- package/lib/update-skill.js +9 -1
- package/package.json +3 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/claude-code/skills/delphi-review/INSTALL.md +22 -3
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/definition-of-done.md +2 -2
- package/plugins/claude-code/skills/sprint-flow/references/phase-3-build.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +2 -2
- package/plugins/claude-code/skills/sprint-flow/references/phase-6-close.md +17 -0
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/lib/delphi-evidence.d.ts +59 -0
- package/plugins/dsh/lib/delphi-evidence.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-evidence.js +128 -0
- package/plugins/dsh/lib/delphi-finding.d.ts +123 -0
- package/plugins/dsh/lib/delphi-finding.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-finding.js +332 -0
- package/plugins/dsh/lib/delphi-findings-parse.d.ts +29 -0
- package/plugins/dsh/lib/delphi-findings-parse.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-findings-parse.js +138 -0
- package/plugins/dsh/lib/delphi-ledger.d.ts +55 -0
- package/plugins/dsh/lib/delphi-ledger.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-ledger.js +124 -0
- package/plugins/dsh/lib/delphi-run.d.ts +7 -0
- package/plugins/dsh/lib/delphi-run.d.ts.map +1 -1
- package/plugins/dsh/lib/delphi-run.js +48 -18
- package/plugins/dsh/lib/delphi-seats.d.ts +34 -0
- package/plugins/dsh/lib/delphi-seats.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-seats.js +40 -0
- package/plugins/dsh/lib/evidence.d.ts +21 -0
- package/plugins/dsh/lib/evidence.d.ts.map +1 -1
- package/plugins/dsh/lib/evidence.js +3 -0
- package/plugins/dsh/lib/index.d.ts.map +1 -1
- package/plugins/dsh/lib/index.js +12 -0
- package/plugins/dsh/package.json +1 -1
- package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/dsh/skills/delphi-review/INSTALL.md +22 -3
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/dsh/skills/sprint-flow/references/definition-of-done.md +2 -2
- package/plugins/dsh/skills/sprint-flow/references/phase-3-build.md +1 -1
- package/plugins/dsh/skills/sprint-flow/references/phase-4-verify.md +2 -2
- package/plugins/dsh/skills/sprint-flow/references/phase-6-close.md +17 -0
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/src/delphi-evidence.test.ts +100 -0
- package/plugins/dsh/src/delphi-evidence.ts +201 -0
- package/plugins/dsh/src/delphi-finding.test.ts +333 -0
- package/plugins/dsh/src/delphi-finding.ts +446 -0
- package/plugins/dsh/src/delphi-findings-parse.test.ts +100 -0
- package/plugins/dsh/src/delphi-findings-parse.ts +158 -0
- package/plugins/dsh/src/delphi-findings.test.ts +4 -0
- package/plugins/dsh/src/delphi-ledger.test.ts +210 -0
- package/plugins/dsh/src/delphi-ledger.ts +158 -0
- package/plugins/dsh/src/delphi-run.test.ts +71 -68
- package/plugins/dsh/src/delphi-run.ts +80 -24
- package/plugins/dsh/src/delphi-seats.test.ts +117 -0
- package/plugins/dsh/src/delphi-seats.ts +50 -0
- package/plugins/dsh/src/evidence-findings.test.ts +75 -0
- package/plugins/dsh/src/evidence.ts +25 -0
- package/plugins/dsh/src/index.ts +14 -0
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/opencode/skills/delphi-review/INSTALL.md +22 -3
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/definition-of-done.md +2 -2
- package/plugins/opencode/skills/sprint-flow/references/phase-3-build.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +2 -2
- package/plugins/opencode/skills/sprint-flow/references/phase-6-close.md +17 -0
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/qoder/skills/delphi-review/INSTALL.md +22 -3
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/qoder/skills/sprint-flow/references/definition-of-done.md +2 -2
- package/plugins/qoder/skills/sprint-flow/references/phase-3-build.md +1 -1
- package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +2 -2
- package/plugins/qoder/skills/sprint-flow/references/phase-6-close.md +17 -0
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
- package/principles/index.ts +50 -1
- package/scripts/delphi-config-read.cjs +43 -6
- package/scripts/delphi-external-review.cjs +69 -12
- package/scripts/delphi-prompts.cjs +47 -1
- package/skills/delphi-review/AGENTS.md +1 -1
- package/skills/delphi-review/INSTALL.md +22 -3
- package/skills/sprint-flow/AGENTS.md +1 -1
- package/skills/sprint-flow/references/definition-of-done.md +2 -2
- package/skills/sprint-flow/references/phase-3-build.md +1 -1
- package/skills/sprint-flow/references/phase-4-verify.md +2 -2
- package/skills/sprint-flow/references/phase-6-close.md +17 -0
- package/skills/test-specification-alignment/AGENTS.md +1 -1
- package/sprint-gate.sh +101 -13
- package/mutation/stryker-types.ts +0 -14
package/lib/doctor.js
CHANGED
|
@@ -25,7 +25,7 @@ const {
|
|
|
25
25
|
DELPHI_ROLES,
|
|
26
26
|
MIN_DISTINCT_MODELS,
|
|
27
27
|
} = require('./doctor-constants.js');
|
|
28
|
-
const { checkUpgrade, formatUpgradeMsg } = require('./check-version.js');
|
|
28
|
+
const { checkUpgrade, formatUpgradeMsg, getRemoteVersion, compareVersions } = require('./check-version.js');
|
|
29
29
|
const { GATE_CLI_TOOLS, checkCliTool, getToolInstallCmd, checkBash, detectInstalledPlatforms, getSkillsDirs } = require('./detect-deps.js');
|
|
30
30
|
// Doctor's tool section is built from the shared audit, so the validity /
|
|
31
31
|
// uniqueness / currency rules live in exactly one place (2026-11-23).
|
|
@@ -47,6 +47,17 @@ const { parseQuarantine, findPolicyViolations } = require('./flaky.js');
|
|
|
47
47
|
* and stubs are a few hundred bytes. 4 KB separates them comfortably.
|
|
48
48
|
*/
|
|
49
49
|
const PARSE_CHECK_MIN_BYTES = 4096;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Upper bound on doctor's version probes (the CLI's own upgrade lookup and the
|
|
53
|
+
* OpenCode plugin's freshness comparison).
|
|
54
|
+
*
|
|
55
|
+
* Both reach the network, and a doctor that waits for a slow registry is worse
|
|
56
|
+
* than one that reports the comparison as incomplete: an `npm view` was measured
|
|
57
|
+
* at ~66 s on a loaded machine, while the answer doctor needs is advisory only.
|
|
58
|
+
* 3 s is the budget the upgrade probe has always used.
|
|
59
|
+
*/
|
|
60
|
+
const UPGRADE_PROBE_TIMEOUT_MS = 3000;
|
|
50
61
|
const {
|
|
51
62
|
diagnoseTuiRegistration, diagnoseInstalledSkills,
|
|
52
63
|
fixTuiRegistration, ensureTuiRegistration, readTuiJson,
|
|
@@ -125,6 +136,35 @@ const EXEC_TIMEOUT_MS = 1500;
|
|
|
125
136
|
*/
|
|
126
137
|
const GLOBAL_DIAGNOSIS_TIMEOUT_MS = 10000;
|
|
127
138
|
|
|
139
|
+
/**
|
|
140
|
+
* The surfaces a full diagnosis reports, as patterns over REAL check names.
|
|
141
|
+
*
|
|
142
|
+
* #777: the timeout notice used to name a hardcoded list
|
|
143
|
+
* (`['Hooks', 'Adapters', 'Skills', 'Gate env', 'OpenCode TUI']`) and NONE of those is
|
|
144
|
+
* a check name. `Hooks` is a LABEL handed to `checkSingleHook`, the adapters check is
|
|
145
|
+
* recorded as `Adapters directory`, and `Gate env` / `OpenCode TUI` appear nowhere. A
|
|
146
|
+
* name that is never in `reported` is always "pending", so the notice named all five
|
|
147
|
+
* every time -- including in the same output where `✓ Adapters directory: 24 file(s)`
|
|
148
|
+
* and twelve `✓ Skill: ...` lines had just succeeded.
|
|
149
|
+
*
|
|
150
|
+
* Patterns rather than a literal list because half these checks are named at runtime:
|
|
151
|
+
* the hook checks are `pre-commit` / `pre-push` / ..., and skills are
|
|
152
|
+
* `Skill: <name>` per installed skill. A literal list cannot cover them and would
|
|
153
|
+
* drift again the next time one is added.
|
|
154
|
+
*
|
|
155
|
+
* When a new check starts reporting a surface nobody listed here, the omission shows
|
|
156
|
+
* up as that surface never being named as pending -- which is the quiet direction. The
|
|
157
|
+
* loud direction (naming a surface that DID report) is what was broken, and patterns
|
|
158
|
+
* make that impossible.
|
|
159
|
+
*/
|
|
160
|
+
const REPORTED_SURFACE_PATTERNS = [
|
|
161
|
+
/^pre-commit$/, /^pre-push$/, /^post-merge$/, /^post-commit$/,
|
|
162
|
+
/^Adapters directory$/,
|
|
163
|
+
/^Skill: /,
|
|
164
|
+
/^Gate scripts$/,
|
|
165
|
+
/^TUI registration$/,
|
|
166
|
+
];
|
|
167
|
+
|
|
128
168
|
/**
|
|
129
169
|
* Merge a timed-out partial diagnosis into one honest verdict (#629).
|
|
130
170
|
*
|
|
@@ -144,7 +184,29 @@ const GLOBAL_DIAGNOSIS_TIMEOUT_MS = 10000;
|
|
|
144
184
|
function mergeTimedOutDiagnosis(partial, pending) {
|
|
145
185
|
const completed = (partial && Array.isArray(partial.checks)) ? partial.checks : [];
|
|
146
186
|
const inherited = (partial && Number.isFinite(partial.issues)) ? partial.issues : 0;
|
|
147
|
-
|
|
187
|
+
// #777: drop anything the run DID report, whatever the caller passed. The caller is
|
|
188
|
+
// the only place that knows what it expected, but only this function knows what
|
|
189
|
+
// actually arrived -- and naming a completed check as pending is the defect, so the
|
|
190
|
+
// filter belongs on the side that has the evidence.
|
|
191
|
+
const reportedNames = completed.map((c) => c && c.name).filter(Boolean);
|
|
192
|
+
const pendingNames = (Array.isArray(pending) ? pending.filter(Boolean) : [])
|
|
193
|
+
.filter((name) => !reportedNames.includes(name))
|
|
194
|
+
// A surface is satisfied when ANY reported name carries it as a word-boundary
|
|
195
|
+
// prefix, in either direction. `Adapters` is satisfied by `Adapters directory`
|
|
196
|
+
// (the reported name is longer), and `Skill: delphi-review` satisfies `Skills`
|
|
197
|
+
// through its `Skill` stem. Matching whole strings was the original bug in a
|
|
198
|
+
// different shape: the label and the check name differ, and an exact test can
|
|
199
|
+
// never reconcile them.
|
|
200
|
+
.filter((name) => {
|
|
201
|
+
// Strip a trailing plural `s` as well: `Skills` (the label) against `Skill: x`
|
|
202
|
+
// (the check) differ by one letter, and that one letter is why the pair never
|
|
203
|
+
// matched.
|
|
204
|
+
const stem = name.toLowerCase().replace(/[^a-z0-9]+/g, '').replace(/s$/, '');
|
|
205
|
+
return !reportedNames.some((reported) => {
|
|
206
|
+
const other = reported.toLowerCase().replace(/[^a-z0-9]+/g, '').replace(/s$/, '');
|
|
207
|
+
return other.startsWith(stem) || stem.startsWith(other);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
148
210
|
const detail = pendingNames.length > 0
|
|
149
211
|
? `Timed out after ${GLOBAL_DIAGNOSIS_TIMEOUT_MS / 1000}s — did not report in time: ${pendingNames.join(', ')}`
|
|
150
212
|
: `Timed out after ${GLOBAL_DIAGNOSIS_TIMEOUT_MS / 1000}s — some checks incomplete`;
|
|
@@ -3395,32 +3457,133 @@ async function diagnoseUpgrade() {
|
|
|
3395
3457
|
} catch { /* non-blocking — don't fail doctor on network issue */ }
|
|
3396
3458
|
}
|
|
3397
3459
|
|
|
3460
|
+
/** The OpenCode plugin package, as installed by `npm install` in ~/.config/opencode. */
|
|
3461
|
+
const OPENCODE_PLUGIN_PKG = '@boyingliu01/opencode-plugin';
|
|
3462
|
+
|
|
3398
3463
|
/**
|
|
3399
|
-
*
|
|
3400
|
-
*
|
|
3464
|
+
* Compare an installed version against the newest published one.
|
|
3465
|
+
*
|
|
3466
|
+
* Field-by-field numeric compare, NOT string ordering: `lexicographic "0.41.9"
|
|
3467
|
+
* > "0.41.10"` would call a current install outdated as soon as the patch level
|
|
3468
|
+
* grows a digit. `check-version.js::compareVersions` is the same rule and is
|
|
3469
|
+
* reused rather than re-implemented, so the two checks cannot disagree.
|
|
3470
|
+
*
|
|
3471
|
+
* @param {string} installed
|
|
3472
|
+
* @param {string} latest
|
|
3473
|
+
* @returns {boolean} true when a newer release exists
|
|
3474
|
+
*/
|
|
3475
|
+
function isBehind(installed, latest) {
|
|
3476
|
+
return compareVersions(installed, latest) < 0;
|
|
3477
|
+
}
|
|
3478
|
+
|
|
3479
|
+
/**
|
|
3480
|
+
* Read the installed OpenCode plugin version, or null when it is not installed.
|
|
3481
|
+
*
|
|
3482
|
+
* A manifest that exists but cannot be parsed is reported as an empty version
|
|
3483
|
+
* rather than swallowed: "installed but unreadable" is a different state from
|
|
3484
|
+
* "not installed", and the caller must be able to say so.
|
|
3485
|
+
*
|
|
3486
|
+
* Takes `homeDir` so the lookup is reachable from a test without a real
|
|
3487
|
+
* `~/.config/opencode` install (vitest workers cannot chdir a HOME either).
|
|
3488
|
+
*
|
|
3489
|
+
* @param {string} [homeDir] defaults to the resolved HOME_DIR()
|
|
3490
|
+
* @returns {{version: string}|null}
|
|
3491
|
+
*/
|
|
3492
|
+
function readOpenCodePluginVersion(homeDir = HOME_DIR()) {
|
|
3493
|
+
const pluginPath = path.join(homeDir, '.config', 'opencode', 'node_modules', ...OPENCODE_PLUGIN_PKG.split('/'), 'package.json');
|
|
3494
|
+
if (!fs.existsSync(pluginPath)) return null;
|
|
3495
|
+
try {
|
|
3496
|
+
const pluginPkg = JSON.parse(fs.readFileSync(pluginPath, 'utf8'));
|
|
3497
|
+
return { version: typeof pluginPkg.version === 'string' ? pluginPkg.version : '' };
|
|
3498
|
+
} catch {
|
|
3499
|
+
return { version: '' };
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
|
|
3503
|
+
/**
|
|
3504
|
+
* Ask the registry for the plugin's newest version, bounded by the probe budget.
|
|
3505
|
+
*
|
|
3506
|
+
* Returns null — never a guessed version — when the lookup fails or runs out of
|
|
3507
|
+
* time. `getRemoteVersion` already resolves null on a network error, but it does
|
|
3508
|
+
* NOT apply the probe budget: `check-version.js` uses its own 5 s socket timeout,
|
|
3509
|
+
* and a socket that opens and then stalls can exceed that. The race makes the
|
|
3510
|
+
* bound explicit at the call site, which is also the documented contract.
|
|
3511
|
+
*
|
|
3512
|
+
* @param {(pkgName: string) => Promise<{latest?: string}|null>} [fetchRemote]
|
|
3513
|
+
* @returns {Promise<string|null>}
|
|
3401
3514
|
*/
|
|
3402
|
-
function
|
|
3403
|
-
|
|
3404
|
-
|
|
3515
|
+
async function lookupPluginLatest(fetchRemote = getRemoteVersion) {
|
|
3516
|
+
let timer;
|
|
3517
|
+
const budget = new Promise((resolve) => {
|
|
3518
|
+
timer = setTimeout(() => resolve(null), UPGRADE_PROBE_TIMEOUT_MS);
|
|
3519
|
+
// Never hold the process open on account of a probe.
|
|
3520
|
+
if (typeof timer.unref === 'function') timer.unref();
|
|
3521
|
+
});
|
|
3522
|
+
const lookup = (async () => {
|
|
3405
3523
|
try {
|
|
3406
|
-
const
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3524
|
+
const result = await fetchRemote(OPENCODE_PLUGIN_PKG);
|
|
3525
|
+
return result && typeof result.latest === 'string' ? result.latest : null;
|
|
3526
|
+
} catch {
|
|
3527
|
+
return null;
|
|
3528
|
+
}
|
|
3529
|
+
})();
|
|
3530
|
+
try {
|
|
3531
|
+
return await Promise.race([lookup, budget]);
|
|
3532
|
+
} finally {
|
|
3533
|
+
clearTimeout(timer);
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
/**
|
|
3538
|
+
* Check 8: OpenCode plugin version (#896).
|
|
3539
|
+
*
|
|
3540
|
+
* The plugin is compared against ITS OWN newest release. It used to be compared
|
|
3541
|
+
* against the xp-gate CLI version, on the assumption that the two "should match";
|
|
3542
|
+
* they are separate packages and do not release in lockstep (the plugin declares
|
|
3543
|
+
* no dependency on the CLI), so on a fully current install the old check warned
|
|
3544
|
+
* forever and prescribed an `npm update` that re-resolves to the same version.
|
|
3545
|
+
*
|
|
3546
|
+
* Three outcomes, and the third is the point: a lookup that produced no answer
|
|
3547
|
+
* is reported as unverified. It is neither PASS (nothing was compared) nor WARN
|
|
3548
|
+
* (nothing is known to be stale) — "not checked" must not be reachable as
|
|
3549
|
+
* "passed", and must not demand an action that may be wrong either.
|
|
3550
|
+
*
|
|
3551
|
+
* Inputs are injectable for the same reason as `diagnoseLanguageTools`: the
|
|
3552
|
+
* decision table is the part worth pinning, and it must be testable without a
|
|
3553
|
+
* real install and without the network.
|
|
3554
|
+
*
|
|
3555
|
+
* @param {Array<{name:string,status:string,detail:string}>} checks
|
|
3556
|
+
* @param {{homeDir?: string, fetchRemote?: Function}} [options]
|
|
3557
|
+
* @returns {Promise<number>} issue count (WARNs only — an unverified comparison is not an issue)
|
|
3558
|
+
*/
|
|
3559
|
+
async function diagnoseOpenCodePlugin(checks, options = {}) {
|
|
3560
|
+
const installed = readOpenCodePluginVersion(options.homeDir);
|
|
3561
|
+
if (!installed) {
|
|
3423
3562
|
checks.push({ name: 'OpenCode plugin', status: 'SKIP', detail: 'Not installed in OpenCode config' });
|
|
3563
|
+
return 0;
|
|
3564
|
+
}
|
|
3565
|
+
if (!installed.version) {
|
|
3566
|
+
checks.push({ name: 'OpenCode plugin version', status: 'WARN', detail: 'installed, but package.json has no readable version' });
|
|
3567
|
+
return 1;
|
|
3568
|
+
}
|
|
3569
|
+
checks.push({ name: 'OpenCode plugin version', status: 'PASS', detail: installed.version });
|
|
3570
|
+
|
|
3571
|
+
const remote = await lookupPluginLatest(options.fetchRemote);
|
|
3572
|
+
if (!remote) {
|
|
3573
|
+
checks.push({
|
|
3574
|
+
name: 'OpenCode plugin version freshness',
|
|
3575
|
+
status: 'SKIP',
|
|
3576
|
+
detail: `comparison not completed — could not reach the registry for ${OPENCODE_PLUGIN_PKG}`,
|
|
3577
|
+
});
|
|
3578
|
+
return 0;
|
|
3579
|
+
}
|
|
3580
|
+
if (isBehind(installed.version, remote)) {
|
|
3581
|
+
checks.push({
|
|
3582
|
+
name: 'OpenCode plugin version',
|
|
3583
|
+
status: 'WARN',
|
|
3584
|
+
detail: `installed ${installed.version}, latest ${remote} — run 'cd ~/.config/opencode && npm update ${OPENCODE_PLUGIN_PKG}'`,
|
|
3585
|
+
});
|
|
3586
|
+
return 1;
|
|
3424
3587
|
}
|
|
3425
3588
|
return 0;
|
|
3426
3589
|
}
|
|
@@ -3813,7 +3976,7 @@ async function collectTrailing(checks) {
|
|
|
3813
3976
|
} catch {
|
|
3814
3977
|
// Non-blocking: the upgrade hint is a convenience, never a verdict.
|
|
3815
3978
|
}
|
|
3816
|
-
const trailing = diagnoseOpenCodePlugin(checks);
|
|
3979
|
+
const trailing = await diagnoseOpenCodePlugin(checks);
|
|
3817
3980
|
const langIssues = diagnoseLanguageTools();
|
|
3818
3981
|
return { issues: trailing + langIssues, langIssues };
|
|
3819
3982
|
}
|
|
@@ -3891,9 +4054,14 @@ async function raceDiagnosis(refreshEnv) {
|
|
|
3891
4054
|
const timeoutPromise = new Promise((resolve) => {
|
|
3892
4055
|
timer = setTimeout(() => {
|
|
3893
4056
|
const completed = Array.isArray(progress.checks) ? progress.checks : [];
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
4057
|
+
// #777: derive the pending set from the surface PATTERNS above, matched against
|
|
4058
|
+
// the names this run actually recorded. The previous form listed five labels and
|
|
4059
|
+
// none of them is a check name, so all five were reported missing every time --
|
|
4060
|
+
// next to the very lines showing them succeeding.
|
|
4061
|
+
const reported = completed.map((c) => c && c.name).filter(Boolean);
|
|
4062
|
+
const pending = REPORTED_SURFACE_PATTERNS
|
|
4063
|
+
.filter((re) => !reported.some((name) => re.test(name)))
|
|
4064
|
+
.map((re) => re.source.replace(/^\^|\$$/g, '').replace(/\\/g, ''));
|
|
3897
4065
|
resolve(mergeTimedOutDiagnosis(
|
|
3898
4066
|
{ checks: completed, issues: progress.getIssues() },
|
|
3899
4067
|
pending,
|
|
@@ -4133,6 +4301,46 @@ function formatDoctorJson(checks, issues) {
|
|
|
4133
4301
|
* agentsSource: string, agentDetails: string[]}} `channelResolution` is returned so
|
|
4134
4302
|
* the SKIP detail can name the channels and where they came from.
|
|
4135
4303
|
*/
|
|
4304
|
+
/**
|
|
4305
|
+
* The verdict for the native path when the channels preference switched it off (#711).
|
|
4306
|
+
*
|
|
4307
|
+
* A SKIP alone could not tell "switched off cleanly" from "switched off but the files
|
|
4308
|
+
* are still there". The difference matters: Qoder still loads leftover `delphi-*.md` as
|
|
4309
|
+
* custom agents, and the repair is one command. So leftovers WARN.
|
|
4310
|
+
*
|
|
4311
|
+
* @param {string} agentsDir directory that may hold `delphi-*.md`
|
|
4312
|
+
* @param {{channels: string[], source: string}} channelResolution how channels resolved
|
|
4313
|
+
* @returns {[string, string]} status and detail
|
|
4314
|
+
*/
|
|
4315
|
+
function disabledBindingVerdict(agentsDir, channelResolution) {
|
|
4316
|
+
const leftover = countNativeAgentFiles(agentsDir);
|
|
4317
|
+
const head = `native channel disabled (channels=${channelResolution.channels.join(',')} `
|
|
4318
|
+
+ `via ${channelResolution.source}) — `;
|
|
4319
|
+
if (leftover > 0) {
|
|
4320
|
+
return ['WARN', head + `${leftover} native agent file(s) still present in ${agentsDir}; they are `
|
|
4321
|
+
+ 'not used but Qoder still loads them — run `xp-gate delphi-setup --uninstall`'];
|
|
4322
|
+
}
|
|
4323
|
+
return ['SKIP', head + 'Delphi review runs through the external provider'];
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4326
|
+
/**
|
|
4327
|
+
* How many native Delphi agent files exist in `agentsDir` (#711).
|
|
4328
|
+
*
|
|
4329
|
+
* Used only to tell "disabled cleanly" from "disabled with leftovers" -- a distinction
|
|
4330
|
+
* the SKIP line could not express, and one that matters because Qoder still loads the
|
|
4331
|
+
* files as custom agents.
|
|
4332
|
+
*
|
|
4333
|
+
* @param {string} agentsDir directory that may hold `delphi-*.md`
|
|
4334
|
+
* @returns {number} matching file count, 0 when unreadable
|
|
4335
|
+
*/
|
|
4336
|
+
function countNativeAgentFiles(agentsDir) {
|
|
4337
|
+
try {
|
|
4338
|
+
return fs.readdirSync(agentsDir).filter((f) => /^delphi-.*\.md$/.test(f)).length;
|
|
4339
|
+
} catch {
|
|
4340
|
+
return 0;
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4136
4344
|
function resolveAgentTarget(options) {
|
|
4137
4345
|
const delphiChannel = require('./delphi-channel.js');
|
|
4138
4346
|
const channelHome = process.env.XDG_CONFIG_HOME
|
|
@@ -4215,9 +4423,7 @@ function checkDelphiAgentBindings(add, options) {
|
|
|
4215
4423
|
// by configuration there is nothing to keep healthy, and reporting its absence as
|
|
4216
4424
|
// FAIL told users their working setup was broken.
|
|
4217
4425
|
if (nativeDisabled) {
|
|
4218
|
-
add('Qoder Delphi agent bindings',
|
|
4219
|
-
`native channel disabled (channels=${channelResolution.channels.join(',')} via ${channelResolution.source}) — `
|
|
4220
|
-
+ 'Delphi review runs through the external provider');
|
|
4426
|
+
add('Qoder Delphi agent bindings', ...disabledBindingVerdict(agentsDir, channelResolution));
|
|
4221
4427
|
}
|
|
4222
4428
|
for (const role of nativeDisabled ? [] : DELPHI_ROLES) {
|
|
4223
4429
|
const outcome = inspectAgentBinding(role, agentsDir, readQoderModelId);
|
|
@@ -4466,6 +4672,34 @@ async function checkDelphiVersionConsistency(add, options, npmLatest) {
|
|
|
4466
4672
|
*
|
|
4467
4673
|
* @param {(name: string, status: string, detail?: string) => void} add
|
|
4468
4674
|
*/
|
|
4675
|
+
/**
|
|
4676
|
+
* The per-profile configuration layers under a DSH home, if any.
|
|
4677
|
+
*
|
|
4678
|
+
* DSH stores configuration as a loader patch layer per profile:
|
|
4679
|
+
* `profiles/<profile>/cordis.patch.yml`. An empty `[]` is a layer that adds nothing,
|
|
4680
|
+
* which is a valid configuration, so existence alone is what this reports -- parsing
|
|
4681
|
+
* the YAML to look for a seat override would tie this check to a schema it does not own.
|
|
4682
|
+
*
|
|
4683
|
+
* @param {string} dshHome the resolved `~/.dsh`
|
|
4684
|
+
* @returns {string[]} absolute paths to the layers found
|
|
4685
|
+
*/
|
|
4686
|
+
function listDshProfileConfigs(dshHome) {
|
|
4687
|
+
const profilesDir = path.join(dshHome, 'profiles');
|
|
4688
|
+
let entries;
|
|
4689
|
+
try {
|
|
4690
|
+
entries = fs.readdirSync(profilesDir, { withFileTypes: true });
|
|
4691
|
+
} catch {
|
|
4692
|
+
return [];
|
|
4693
|
+
}
|
|
4694
|
+
const found = [];
|
|
4695
|
+
for (const entry of entries) {
|
|
4696
|
+
if (!entry.isDirectory() || entry.name.endsWith('.bak') || entry.name.includes('.bak-')) continue;
|
|
4697
|
+
const layer = path.join(profilesDir, entry.name, 'cordis.patch.yml');
|
|
4698
|
+
if (fs.existsSync(layer)) found.push(layer);
|
|
4699
|
+
}
|
|
4700
|
+
return found;
|
|
4701
|
+
}
|
|
4702
|
+
|
|
4469
4703
|
function checkDshChannelReadiness(add) {
|
|
4470
4704
|
// 7. DSH native-channel readiness (#443 REQ-6): only meaningful when a DSH home
|
|
4471
4705
|
// exists. The two-layer switch (preset capability + host setting) defaults to
|
|
@@ -4485,6 +4719,22 @@ function checkDshChannelReadiness(add) {
|
|
|
4485
4719
|
];
|
|
4486
4720
|
const settingsFile = settingsCandidates.find((p) => fs.existsSync(p));
|
|
4487
4721
|
if (!settingsFile) {
|
|
4722
|
+
// #812: the three names above are not where DSH keeps its configuration. Measured
|
|
4723
|
+
// on this machine: `~/.dsh/profiles/<profile>/cordis.patch.yml` -- `headless` holds
|
|
4724
|
+
// an empty `[]`, `web` holds 628 lines. The directory existed, the configuration
|
|
4725
|
+
// existed, and this check called it absent while asserting a CONSEQUENCE
|
|
4726
|
+
// ("defaults to disabled") about a setting it had never looked at.
|
|
4727
|
+
const profileFiles = listDshProfileConfigs(dshHome);
|
|
4728
|
+
if (profileFiles.length > 0) {
|
|
4729
|
+
// A profile layer that does not mention subagents is the PLATFORM DEFAULT, not a
|
|
4730
|
+
// misconfiguration. Saying FAIL here told a working setup it was broken, which is
|
|
4731
|
+
// the same bug family as #646 one level down: "not mentioned" is not "disabled".
|
|
4732
|
+
add(label, 'SKIP',
|
|
4733
|
+
`${profileFiles.length} DSH profile layer(s) present and no seat override in them `
|
|
4734
|
+
+ `(e.g. ${path.relative(dshHome, profileFiles[0])}) — subagent model selection `
|
|
4735
|
+
+ 'is at its platform default, which is not a defect (#812)');
|
|
4736
|
+
return;
|
|
4737
|
+
}
|
|
4488
4738
|
add(label, 'FAIL',
|
|
4489
4739
|
`${dshHome} exists but no settings file found — subagent model selection defaults to disabled (#443)`);
|
|
4490
4740
|
return;
|
|
@@ -4836,10 +5086,12 @@ function collectSkillDrift(skillDir, bundledFiles, bundledSkillDir, sha256) {
|
|
|
4836
5086
|
}
|
|
4837
5087
|
|
|
4838
5088
|
module.exports = {
|
|
5089
|
+
checkDshChannelReadiness,
|
|
4839
5090
|
reportUnreadablePath, reportStalePath, reportSyncResult,
|
|
4840
5091
|
runHookAndModuleSync, staleSyncEntries,
|
|
4841
5092
|
planStaleHookSync, reportBlockedHookSync, refreshSafeHooks,
|
|
4842
5093
|
doctor, doctorDelphi, isXpGateFile, diagnoseLanguageTools, diagnoseCliTools, SIGNATURES, getHookSignatures, isXpGateHookContent,
|
|
5094
|
+
diagnoseOpenCodePlugin,
|
|
4843
5095
|
fixVersionMismatch,
|
|
4844
5096
|
fixTemplateDirMismatch,
|
|
4845
5097
|
fixMissingHooks,
|
package/lib/gate-runner.js
CHANGED
|
@@ -437,7 +437,9 @@ const TSX_SEARCH_DEPTH = 4;
|
|
|
437
437
|
* @param {string} [cwd] directory to start from; defaults to process.cwd()
|
|
438
438
|
* @returns {string|null}
|
|
439
439
|
*/
|
|
440
|
-
function findTsxCli(cwd = process.cwd()) {
|
|
440
|
+
function findTsxCli(cwd = process.cwd(), ignoreOwnInstall = false) {
|
|
441
|
+
// The PROJECT's copy wins: a consumer may pin a different tsx, and silently using ours
|
|
442
|
+
// would be a different bug in the opposite direction.
|
|
441
443
|
let dir = path.resolve(cwd);
|
|
442
444
|
for (let depth = 0; depth < TSX_SEARCH_DEPTH; depth += 1) {
|
|
443
445
|
const candidate = path.join(dir, 'node_modules', 'tsx', 'dist', 'cli.mjs');
|
|
@@ -446,7 +448,16 @@ function findTsxCli(cwd = process.cwd()) {
|
|
|
446
448
|
if (parent === dir) break;
|
|
447
449
|
dir = parent;
|
|
448
450
|
}
|
|
449
|
-
|
|
451
|
+
// #782: then OUR copy. This package depends on tsx, so one is always beside this
|
|
452
|
+
// file -- and running it needs no npm cache at all.
|
|
453
|
+
//
|
|
454
|
+
// Without this the search fell through to `npx`, which writes a temp file under
|
|
455
|
+
// $npm_config_cache on every run, even when tsx is fully unpacked under `_npx/`. In a
|
|
456
|
+
// workspace-write sandbox where the cache lives outside the workspace that is EPERM,
|
|
457
|
+
// and the EPERM was reported as GATE FAILED -- a verdict on code that was fine.
|
|
458
|
+
if (ignoreOwnInstall) return null;
|
|
459
|
+
const own = path.join(__dirname, '..', '..', '..', 'node_modules', 'tsx', 'dist', 'cli.mjs');
|
|
460
|
+
return fs.existsSync(own) ? own : null;
|
|
450
461
|
}
|
|
451
462
|
|
|
452
463
|
/**
|
|
@@ -466,7 +477,7 @@ function findTsxCli(cwd = process.cwd()) {
|
|
|
466
477
|
* @returns {{command: string, args: string[], viaNpx: boolean}}
|
|
467
478
|
*/
|
|
468
479
|
function resolveTsxInvocation(args, opts = {}) {
|
|
469
|
-
const tsxCli = findTsxCli(opts.cwd);
|
|
480
|
+
const tsxCli = findTsxCli(opts.cwd, opts.ignoreOwnInstall === true);
|
|
470
481
|
if (tsxCli) return { command: process.execPath, args: [tsxCli, ...args], viaNpx: false };
|
|
471
482
|
const [command, argv] = resolveNpxInvocation(['-y', 'tsx', ...args]);
|
|
472
483
|
return { command, args: argv, viaNpx: true };
|