@boyingliu01/xp-gate 0.41.67 → 0.41.69
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/bin/xp-gate.js +52 -34
- package/lib/doctor-delphi.js +893 -0
- package/lib/doctor.js +8 -836
- package/lib/mattpocock-license-verdict.json +1 -1
- package/lib/test-alignment.ts +165 -133
- package/package.json +1 -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/sprint-flow/AGENTS.md +1 -1
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/package.json +1 -1
- package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
- 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/sprint-flow/AGENTS.md +1 -1
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
- package/skills/delphi-review/AGENTS.md +1 -1
- package/skills/sprint-flow/AGENTS.md +1 -1
- package/skills/test-specification-alignment/AGENTS.md +1 -1
package/bin/xp-gate.js
CHANGED
|
@@ -144,36 +144,60 @@ function runAlignmentViaNpx(runnerPath, specPath, testDirs, outputPath, jsonMode
|
|
|
144
144
|
return result.status === 0 ? 0 : 1;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Parse check-alignment's flags.
|
|
149
|
+
*
|
|
150
|
+
* Extracted from runAlignmentCheck, which measured 63 lines against a 50-line
|
|
151
|
+
* rule. The flags are one independent question; the injection guard and the
|
|
152
|
+
* loader dance are two more.
|
|
153
|
+
*
|
|
154
|
+
* @param {string[]} subargs
|
|
155
|
+
* @returns {{specPath: string, testDirs: string[]|undefined, outputPath: string|undefined, jsonMode: boolean}}
|
|
156
|
+
*/
|
|
157
|
+
function parseAlignmentArgs(subargs) {
|
|
158
|
+
const pick = (flag) => {
|
|
159
|
+
const i = subargs.indexOf(flag);
|
|
160
|
+
return i >= 0 ? subargs[i + 1] : undefined;
|
|
161
|
+
};
|
|
162
|
+
const testsValue = pick('--tests');
|
|
163
|
+
return {
|
|
164
|
+
specPath: pick('--spec') ?? path.join(process.cwd(), 'specification.yaml'),
|
|
165
|
+
testDirs: testsValue === undefined ? undefined : [testsValue],
|
|
166
|
+
outputPath: pick('--output'),
|
|
167
|
+
jsonMode: subargs.includes('--json'),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
158
170
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Refuse a path containing a shell metacharacter (#392-#6 / Delphi R1 MJ-02).
|
|
173
|
+
*
|
|
174
|
+
* Runs BEFORE any launcher, including the in-process fast path, so both
|
|
175
|
+
* platforms refuse identically. Behavioural, not shape-only.
|
|
176
|
+
*
|
|
177
|
+
* @param {{specPath: string, testDirs?: string[], outputPath?: string}} args
|
|
178
|
+
* @returns {1|null} exit code when refused
|
|
179
|
+
*/
|
|
180
|
+
function refuseUnsafeAlignmentPath({ specPath, testDirs, outputPath }) {
|
|
181
|
+
for (const value of [specPath, ...(testDirs || []), outputPath].filter((v) => v !== undefined)) {
|
|
163
182
|
const unsafe = firstUnsafeArg([value]);
|
|
164
183
|
if (unsafe) {
|
|
165
184
|
console.error(`check-alignment: refusing path containing a shell metacharacter: ${unsafe}`);
|
|
166
185
|
return 1;
|
|
167
186
|
}
|
|
168
187
|
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function runAlignmentCheck(subargs) {
|
|
192
|
+
const args = parseAlignmentArgs(subargs);
|
|
193
|
+
const refused = refuseUnsafeAlignmentPath(args);
|
|
194
|
+
if (refused !== null) return refused;
|
|
169
195
|
|
|
170
196
|
const runnerPath = path.join(__dirname, '..', 'lib', 'check-alignment-runner.cjs');
|
|
171
197
|
|
|
172
|
-
// #894: the runner is referenced by PATH, so a packaging mistake
|
|
173
|
-
// command into a bare ERR_MODULE_NOT_FOUND stack trace
|
|
174
|
-
//
|
|
175
|
-
// same voice as the others: what is missing, and what the operator can do about
|
|
176
|
-
// it. "Cannot find module" from inside a tsx loader names neither.
|
|
198
|
+
// #894: the runner is referenced by PATH, so a packaging mistake turned this
|
|
199
|
+
// command into a bare ERR_MODULE_NOT_FOUND stack trace, shipped in every
|
|
200
|
+
// version before 0.41.10. A gate that cannot start must say what is missing.
|
|
177
201
|
if (!require('node:fs').existsSync(runnerPath)) {
|
|
178
202
|
console.error('❌ BLOCKED - check-alignment: the alignment runner is missing from this install.');
|
|
179
203
|
console.error(` Expected: ${runnerPath}`);
|
|
@@ -182,19 +206,13 @@ async function runAlignmentCheck(subargs) {
|
|
|
182
206
|
return 1;
|
|
183
207
|
}
|
|
184
208
|
|
|
185
|
-
// Primary: run the engine in-process via tsx/cjs (fast path, works in-repo
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
// ships zero runtime deps per the zero-install contract). npx self-provisions
|
|
189
|
-
// tsx on demand, so the published command stays functional without adding a dep.
|
|
209
|
+
// Primary: run the engine in-process via tsx/cjs (fast path, works in-repo).
|
|
210
|
+
// Fall back to `npx -y tsx` when tsx is not resolvable, which is the published
|
|
211
|
+
// global install (the package ships zero runtime deps).
|
|
190
212
|
//
|
|
191
|
-
// The try guards ONLY the
|
|
192
|
-
//
|
|
193
|
-
//
|
|
194
|
-
// Delphi walkthrough R2 CI-02: require('../lib/test-alignment.ts') also needs
|
|
195
|
-
// the loader, so it belongs INSIDE the guard — if the .ts file itself cannot
|
|
196
|
-
// load, the npx fallback re-attempts it under a provisioned tsx instead of
|
|
197
|
-
// crashing with an unhandled exception. Engine EXECUTION stays outside.
|
|
213
|
+
// The try guards ONLY the module-LOAD step. The engine call sits outside it: an
|
|
214
|
+
// engine-level failure is a real bug that must surface, not be misattributed to
|
|
215
|
+
// "tsx unavailable" (Delphi R2 CI-02).
|
|
198
216
|
let runFullAlignment;
|
|
199
217
|
try {
|
|
200
218
|
require('tsx/cjs');
|
|
@@ -203,9 +221,9 @@ async function runAlignmentCheck(subargs) {
|
|
|
203
221
|
if (!err || (err.code !== 'MODULE_NOT_FOUND' && !/Cannot find module/.test(String(err && err.message)))) {
|
|
204
222
|
throw err;
|
|
205
223
|
}
|
|
206
|
-
return runAlignmentViaNpx(runnerPath, specPath, testDirs, outputPath, jsonMode);
|
|
224
|
+
return runAlignmentViaNpx(runnerPath, args.specPath, args.testDirs, args.outputPath, args.jsonMode);
|
|
207
225
|
}
|
|
208
|
-
return runAlignmentInProcess(specPath, testDirs, outputPath, jsonMode, runFullAlignment);
|
|
226
|
+
return runAlignmentInProcess(args.specPath, args.testDirs, args.outputPath, args.jsonMode, runFullAlignment);
|
|
209
227
|
}
|
|
210
228
|
|
|
211
229
|
const COMMANDS = {
|