@boyingliu01/xp-gate 0.38.13 → 0.38.14
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/hooks/gate-entries/gate-5-entry.sh +91 -4
- package/lib/__tests__/baseline-unevaluated.test.js +142 -0
- package/lib/baseline.js +83 -8
- package/lib/mattpocock-license-verdict.json +1 -1
- 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
|
@@ -17,6 +17,64 @@
|
|
|
17
17
|
# on - there is no copy left in the hook.
|
|
18
18
|
# ============================================================================
|
|
19
19
|
|
|
20
|
+
# ============================================================================
|
|
21
|
+
# Is the coverage report on disk evidence for THIS commit?
|
|
22
|
+
#
|
|
23
|
+
# TOP-LEVEL on purpose, like generate_quality_report(): it is a predicate about a
|
|
24
|
+
# file, not part of the gate's control flow, and keeping it out of gate_5_run is
|
|
25
|
+
# what lets a test exercise it without triggering a full test run.
|
|
26
|
+
#
|
|
27
|
+
# The gate previously asked this question three different ways and answered it
|
|
28
|
+
# inconsistently. #821 fixed the EVIDENCE check to ask the git index:
|
|
29
|
+
#
|
|
30
|
+
# git cat-file -e ":coverage/coverage-summary.json"
|
|
31
|
+
#
|
|
32
|
+
# but the three sites that READ the report still asked the working directory with
|
|
33
|
+
# `[ -f ... ]`. Those are different questions:
|
|
34
|
+
#
|
|
35
|
+
# - coverage/ is gitignored, so a report produced by a local `--coverage` run
|
|
36
|
+
# is never in the index. Replacing `-f` with the index test outright would
|
|
37
|
+
# discard real local measurements -- which is why the `-f` sites survived.
|
|
38
|
+
# - a leftover report from an earlier run is also absent from the index, and
|
|
39
|
+
# `-f` accepts it just as readily.
|
|
40
|
+
#
|
|
41
|
+
# Reproduced 2026-11-18: a commit staging only hook shell sources was blocked by
|
|
42
|
+
# BLOCKED - TypeScript coverage 1% below 78% threshold
|
|
43
|
+
# reading a five-hour-old partial report (574/45329 lines). The comment at the
|
|
44
|
+
# evidence check records the same artifact family blocking a commit on
|
|
45
|
+
# 2026-11-16, so this is a recurrence, not a one-off.
|
|
46
|
+
#
|
|
47
|
+
# Neither question is the right one. The right one is "was this report produced
|
|
48
|
+
# by THIS run?", which the gate can answer because it stamps GATE_5_START before
|
|
49
|
+
# running the tests. Staged evidence (#601) still wins outright: the commit
|
|
50
|
+
# carries it deliberately, so its mtime is not an objection.
|
|
51
|
+
#
|
|
52
|
+
# Returns 0 when the report may be read, non-zero when it must be ignored.
|
|
53
|
+
_gate5_coverage_usable() {
|
|
54
|
+
if [ "${GATE_5_COVERAGE_EVIDENCE:-false}" = "true" ]; then
|
|
55
|
+
return 0
|
|
56
|
+
fi
|
|
57
|
+
local start="${GATE_5_START:-}"
|
|
58
|
+
# No stamp means the gate is not mid-run; nothing can be attributed to it.
|
|
59
|
+
case "$start" in
|
|
60
|
+
''|*[!0-9]*) return 1 ;;
|
|
61
|
+
esac
|
|
62
|
+
local f mtime
|
|
63
|
+
for f in coverage/coverage-summary.json coverage/coverage-final.json; do
|
|
64
|
+
[ -f "$f" ] || continue
|
|
65
|
+
# GNU stat first, BSD stat second: the hooks run on both.
|
|
66
|
+
mtime=$(stat -c %Y "$f" 2>/dev/null || stat -f %m "$f" 2>/dev/null) || continue
|
|
67
|
+
case "$mtime" in
|
|
68
|
+
''|*[!0-9]*) continue ;;
|
|
69
|
+
esac
|
|
70
|
+
# stat reports whole seconds, the stamp is milliseconds.
|
|
71
|
+
if [ $(( mtime * 1000 )) -ge "$start" ]; then
|
|
72
|
+
return 0
|
|
73
|
+
fi
|
|
74
|
+
done
|
|
75
|
+
return 1
|
|
76
|
+
}
|
|
77
|
+
|
|
20
78
|
# ============================================================================
|
|
21
79
|
# Gate body. `return` is used instead of `exit` so the driver decides to
|
|
22
80
|
# stop: see scripts/wrap-gate-entries.cjs for why the two are equivalent
|
|
@@ -75,7 +133,19 @@ else
|
|
|
75
133
|
if [ -n "$STAGED_TEST_FILES" ]; then
|
|
76
134
|
while IFS= read -r _tf; do
|
|
77
135
|
[ -n "$_tf" ] || continue
|
|
78
|
-
|
|
136
|
+
# `git show ":<path>"` reads the STAGED blob, which is what the commit
|
|
137
|
+
# will contain. The path variable here was `$tf` -- never assigned in this
|
|
138
|
+
# scope -- so the command was always `git show ":"`, which git rejects
|
|
139
|
+
# with "ambiguous argument", and every file fell through to the working
|
|
140
|
+
# tree copy. Measured: the fallback ran for 100% of files, so this gate
|
|
141
|
+
# has only ever inspected the working tree.
|
|
142
|
+
#
|
|
143
|
+
# That is the wrong direction for a commit gate: the user controls the
|
|
144
|
+
# working tree AND the index independently, so "clean in the index, marker
|
|
145
|
+
# still in the working copy" bypassed the focus check, and the reverse
|
|
146
|
+
# ("marker only in the index") was read as a false positive against a
|
|
147
|
+
# file the commit did not contain.
|
|
148
|
+
_tf_content=$(git show ":$_tf" 2>/dev/null) || _tf_content=$(cat "$_tf" 2>/dev/null || true)
|
|
79
149
|
[ -n "$_tf_content" ] || continue
|
|
80
150
|
|
|
81
151
|
# --- focus markers: BLOCK ---
|
|
@@ -989,9 +1059,17 @@ else
|
|
|
989
1059
|
# real unusable shape) and a staged 42% BOTH passed, because the
|
|
990
1060
|
# threshold comparison below never ran. "No evidence" and "evidence
|
|
991
1061
|
# says 42%" must not take the same branch.
|
|
992
|
-
if [ -f "coverage/coverage-summary.json" ] || [ -f "coverage/coverage-final.json" ];
|
|
1062
|
+
if { [ -f "coverage/coverage-summary.json" ] || [ -f "coverage/coverage-final.json" ]; } \
|
|
1063
|
+
&& _gate5_coverage_usable; then
|
|
993
1064
|
echo "TypeScript coverage collected during test run."
|
|
994
1065
|
COV_EXIT=$((COV_EXIT || 0))
|
|
1066
|
+
elif [ -f "coverage/coverage-summary.json" ] || [ -f "coverage/coverage-final.json" ]; then
|
|
1067
|
+
# Present but produced by a different run: saying "collected during
|
|
1068
|
+
# test run" here is what made a five-hour-old report block a commit
|
|
1069
|
+
# with a percentage that described neither this commit nor this tree.
|
|
1070
|
+
echo "ℹ️ Coverage report on disk predates this run — ignored as stale."
|
|
1071
|
+
echo " Run 'npx vitest run --coverage' to measure this tree."
|
|
1072
|
+
COV_EXIT=$((COV_EXIT || 0))
|
|
995
1073
|
elif [ "${TESTS_SKIPPED:-false}" = "true" ]; then
|
|
996
1074
|
echo "ℹ️ No TypeScript tests were selected — no TS coverage to evaluate."
|
|
997
1075
|
COV_EXIT=$((COV_EXIT || 0))
|
|
@@ -1214,7 +1292,7 @@ else
|
|
|
1214
1292
|
# "no test/source files changed" was wrong, and it read as a pass. That is
|
|
1215
1293
|
# the fail-open shape this whole issue exists to remove, sitting one branch
|
|
1216
1294
|
# below a sibling that had already been fixed for it.
|
|
1217
|
-
if [ -f "coverage/coverage-summary.json" ]; then
|
|
1295
|
+
if [ -f "coverage/coverage-summary.json" ] && _gate5_coverage_usable; then
|
|
1218
1296
|
# #594: reject NaN at the SOURCE, not after the fact. Math.round() does
|
|
1219
1297
|
# not fail on a non-numeric input -- it returns NaN and console.log prints
|
|
1220
1298
|
# "NaN" -- so istanbul's "Unknown" (a file with no executable lines) sailed
|
|
@@ -1314,6 +1392,15 @@ else
|
|
|
1314
1392
|
fi
|
|
1315
1393
|
fi
|
|
1316
1394
|
else
|
|
1395
|
+
# This arm is now reached for two different inputs: no report at all, and
|
|
1396
|
+
# a report too old to describe this run. Name the second one before the
|
|
1397
|
+
# #570/#823 decision, which stays exactly as it was -- "no measurement
|
|
1398
|
+
# was produced" still blocks unless nothing was selected. Without this
|
|
1399
|
+
# line an operator reads "not found" while the file is plainly there.
|
|
1400
|
+
if [ -f "coverage/coverage-summary.json" ] && ! _gate5_coverage_usable; then
|
|
1401
|
+
echo "ℹ️ Coverage report on disk predates this run — ignored as stale."
|
|
1402
|
+
echo " Run 'npx vitest run --coverage' to measure this tree."
|
|
1403
|
+
fi
|
|
1317
1404
|
# #570: the report file is absent, so nothing was measured. Warning and
|
|
1318
1405
|
# continuing made "delete coverage/coverage-summary.json" an effective way
|
|
1319
1406
|
# to switch this gate off.
|
|
@@ -1648,7 +1735,7 @@ else
|
|
|
1648
1735
|
# Default: attempt to parse coverage from common formats regardless of language
|
|
1649
1736
|
COVERAGE_ENFORCED=true
|
|
1650
1737
|
COVERAGE_PERCENT=""
|
|
1651
|
-
if [ -f "coverage/coverage-summary.json" ]; then
|
|
1738
|
+
if [ -f "coverage/coverage-summary.json" ] && _gate5_coverage_usable; then
|
|
1652
1739
|
COVERAGE_PERCENT=$(node -e "
|
|
1653
1740
|
try {
|
|
1654
1741
|
const fs = require('fs');
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @test REQ-152 Baseline CLI handler
|
|
3
|
+
* @intent `xp-gate baseline create` rebuilt the baseline from an empty object and
|
|
4
|
+
* then wrote it unconditionally. Files whose linter could not RUN were
|
|
5
|
+
* therefore recorded as "no entry", which the gate reads as "no known
|
|
6
|
+
* issues" -- and because the write always happened, a run in which every
|
|
7
|
+
* tool failed replaced a good baseline with `{}`.
|
|
8
|
+
*
|
|
9
|
+
* That is not hypothetical in this repo. It presents as
|
|
10
|
+
* BLOCKED - 50 NEW shellcheck issue(s) (baseline: 0, current: 50)
|
|
11
|
+
* on a tree where nothing had changed, and the two states that must never
|
|
12
|
+
* be confused are exactly the ones being confused:
|
|
13
|
+
* "the linter found nothing"
|
|
14
|
+
* "the linter never answered"
|
|
15
|
+
* The second was being written to disk as the first.
|
|
16
|
+
*
|
|
17
|
+
* The repair keeps the ratchet honest in both directions, which is why
|
|
18
|
+
* these tests come in a pair: a fix that preserved every old entry would
|
|
19
|
+
* pass the failure test while making the baseline unable to ever shrink.
|
|
20
|
+
* @covers AC-BASELINE-05 AC-BASELINE-06
|
|
21
|
+
*/
|
|
22
|
+
const path = require('path');
|
|
23
|
+
const fs = require('fs');
|
|
24
|
+
const os = require('os');
|
|
25
|
+
|
|
26
|
+
const { execFileSync } = require('child_process');
|
|
27
|
+
|
|
28
|
+
const { createBaseline } = require('../baseline.js');
|
|
29
|
+
|
|
30
|
+
describe('baseline rebuild — an unevaluated file is not a clean file', () => {
|
|
31
|
+
let tmpDir;
|
|
32
|
+
const originalCwd = process.cwd;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Write an eslint stand-in in the layout this platform actually executes.
|
|
36
|
+
*
|
|
37
|
+
* On Windows cmd.exe cannot run an extensionless POSIX wrapper, so npm installs
|
|
38
|
+
* a `.cmd` launcher; a stub named only `eslint` would exercise a path that never
|
|
39
|
+
* exists here and the test would fail for an unrelated reason.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} jsBody statements the fake linter runs
|
|
42
|
+
*/
|
|
43
|
+
function writeEslintStub(jsBody) {
|
|
44
|
+
const binDir = path.join(tmpDir, 'node_modules', '.bin');
|
|
45
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
46
|
+
const js = `#!/usr/bin/env node\n${jsBody}\n`;
|
|
47
|
+
if (process.platform === 'win32') {
|
|
48
|
+
fs.writeFileSync(path.join(binDir, 'eslint-stub.js'), js);
|
|
49
|
+
fs.writeFileSync(
|
|
50
|
+
path.join(binDir, 'eslint.cmd'),
|
|
51
|
+
'@node "%~dp0eslint-stub.js" %*\r\n'
|
|
52
|
+
);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const stub = path.join(binDir, 'eslint');
|
|
56
|
+
fs.writeFileSync(stub, js);
|
|
57
|
+
fs.chmodSync(stub, 0o755);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function git(...args) {
|
|
61
|
+
execFileSync('git', ['-c', 'user.email=t@t', '-c', 'user.name=t', ...args], {
|
|
62
|
+
cwd: tmpDir,
|
|
63
|
+
stdio: 'pipe',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function readBaseline() {
|
|
68
|
+
return JSON.parse(
|
|
69
|
+
fs.readFileSync(path.join(tmpDir, '.xp-gate', 'lint-baseline.json'), 'utf8')
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
beforeEach(() => {
|
|
74
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'baseline-unevaluated-'));
|
|
75
|
+
process.cwd = () => tmpDir;
|
|
76
|
+
// findFilesByExt enumerates with `git ls-files`, so a fixture outside a work
|
|
77
|
+
// tree yields no files and the linter is never invoked -- every assertion
|
|
78
|
+
// below would then pass while the code under test never ran.
|
|
79
|
+
execFileSync('git', ['init', '-q'], { cwd: tmpDir });
|
|
80
|
+
fs.writeFileSync(path.join(tmpDir, '.eslintrc.json'), '{}\n');
|
|
81
|
+
// Under src/, not at the root: findFilesByExt enumerates with
|
|
82
|
+
// `git ls-files "**/*.js"`, and that glob matches only files in a
|
|
83
|
+
// subdirectory -- a root-level a.js is invisible to it, so the linter branch
|
|
84
|
+
// would never run and both tests would pass without exercising the fix.
|
|
85
|
+
// Measured: `git ls-files "**/*.js"` returns "" for a tracked root a.js.
|
|
86
|
+
fs.mkdirSync(path.join(tmpDir, 'src'), { recursive: true });
|
|
87
|
+
fs.writeFileSync(path.join(tmpDir, 'src', 'a.js'), 'const a = 1;\n');
|
|
88
|
+
git('add', '.eslintrc.json', 'src/a.js');
|
|
89
|
+
|
|
90
|
+
// A baseline from a previous successful run: this file had two warnings.
|
|
91
|
+
fs.mkdirSync(path.join(tmpDir, '.xp-gate'), { recursive: true });
|
|
92
|
+
fs.writeFileSync(
|
|
93
|
+
path.join(tmpDir, '.xp-gate', 'lint-baseline.json'),
|
|
94
|
+
JSON.stringify({
|
|
95
|
+
'src/a.js': { eslint: { warnings: 2, errors: 0 }, totalWarnings: 2 },
|
|
96
|
+
}, null, 2)
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
afterEach(() => {
|
|
101
|
+
process.cwd = originalCwd;
|
|
102
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('AC-BASELINE-05: keeps the previous entry when the linter cannot run', async () => {
|
|
106
|
+
// Exit non-zero with no stdout: the shape of a crashed or unspawnable tool,
|
|
107
|
+
// and the only shape runLintInBatches treats as "not evaluated".
|
|
108
|
+
writeEslintStub('process.exit(1);');
|
|
109
|
+
|
|
110
|
+
const baseline = await createBaseline();
|
|
111
|
+
|
|
112
|
+
// The defect: without the carry-over this entry vanished, so Gate 1 compared
|
|
113
|
+
// a.js against a baseline of nothing and reported its two known warnings as
|
|
114
|
+
// brand new.
|
|
115
|
+
expect(baseline['src/a.js']).toBeDefined();
|
|
116
|
+
expect(baseline['src/a.js'].eslint.warnings).toBe(2);
|
|
117
|
+
expect(readBaseline()['src/a.js'].eslint.warnings).toBe(2);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('AC-BASELINE-06: still shrinks when the linter DOES answer', async () => {
|
|
121
|
+
// The companion the failure test cannot provide: a "preserve everything" fix
|
|
122
|
+
// would pass AC-BASELINE-05 and leave the baseline permanently unshrinkable.
|
|
123
|
+
writeEslintStub(`
|
|
124
|
+
const files = process.argv.slice(2).filter(
|
|
125
|
+
a => !a.startsWith('-') && a !== 'json'
|
|
126
|
+
);
|
|
127
|
+
const out = files.map(f => ({
|
|
128
|
+
filePath: require('path').resolve(f),
|
|
129
|
+
warningCount: 0,
|
|
130
|
+
errorCount: 0,
|
|
131
|
+
}));
|
|
132
|
+
process.stdout.write(JSON.stringify(out));
|
|
133
|
+
`);
|
|
134
|
+
|
|
135
|
+
const baseline = await createBaseline();
|
|
136
|
+
|
|
137
|
+
// Evaluated and clean: the stale count must be replaced, not carried.
|
|
138
|
+
expect(baseline['src/a.js']).toBeDefined();
|
|
139
|
+
expect(baseline['src/a.js'].eslint.warnings).toBe(0);
|
|
140
|
+
expect(readBaseline()['src/a.js'].eslint.warnings).toBe(0);
|
|
141
|
+
});
|
|
142
|
+
});
|
package/lib/baseline.js
CHANGED
|
@@ -22,6 +22,27 @@ function getBaselineFile() {
|
|
|
22
22
|
return path.join(getXpGateDir(), 'lint-baseline.json');
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Read the baseline currently on disk for use as a fallback while rebuilding.
|
|
27
|
+
*
|
|
28
|
+
* Returns `{}` when there is nothing to read. Both "no baseline yet" and "the
|
|
29
|
+
* existing baseline is corrupt" must behave the same way here: this value only
|
|
30
|
+
* ever RESTORES entries for files the rebuild could not evaluate, so a repair
|
|
31
|
+
* path is not needed. Note the difference from the readers elsewhere in this
|
|
32
|
+
* file, which fail loudly -- those answer "what is the baseline", and a wrong
|
|
33
|
+
* answer there changes a verdict. This one only decides whether to keep a row
|
|
34
|
+
* it already had.
|
|
35
|
+
*/
|
|
36
|
+
function readBaselineForMerge() {
|
|
37
|
+
try {
|
|
38
|
+
const raw = fs.readFileSync(getBaselineFile(), 'utf8');
|
|
39
|
+
const parsed = JSON.parse(raw);
|
|
40
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
|
|
41
|
+
} catch {
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
25
46
|
function ensureDir(dirPath) {
|
|
26
47
|
if (!fs.existsSync(dirPath)) {
|
|
27
48
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
@@ -61,13 +82,21 @@ const LINT_BATCH_SIZE = 100;
|
|
|
61
82
|
* @param {string[]} files project-relative paths
|
|
62
83
|
* @param {(batch: string[]) => string} buildCmd builds the command line for a batch
|
|
63
84
|
* @param {string} jsonFlag flag that makes the tool emit JSON on stdout
|
|
64
|
-
* @returns {{results: any[], errors: string[]}} parsed
|
|
65
|
-
* list of failure messages
|
|
66
|
-
*
|
|
85
|
+
* @returns {{results: any[], errors: string[], failedFiles: string[]}} parsed
|
|
86
|
+
* per-batch results, a list of failure messages, and the files that were in a
|
|
87
|
+
* batch which produced no usable output. An empty `results` with a non-empty
|
|
88
|
+
* `errors` means "not evaluated", never "clean".
|
|
89
|
+
*
|
|
90
|
+
* `failedFiles` exists because the caller must be able to tell an evaluated
|
|
91
|
+
* file from an unevaluated one. Without it, a batch that crashed was
|
|
92
|
+
* indistinguishable from a batch that reported nothing, and the baseline
|
|
93
|
+
* writer treated both as "no issues here" -- then wrote that conclusion to
|
|
94
|
+
* disk, overwriting the entries the previous successful run had recorded.
|
|
67
95
|
*/
|
|
68
96
|
function runLintInBatches(files, buildCmd, jsonFlag) {
|
|
69
97
|
const results = [];
|
|
70
98
|
const errors = [];
|
|
99
|
+
const failedFiles = [];
|
|
71
100
|
|
|
72
101
|
for (let i = 0; i < files.length; i += LINT_BATCH_SIZE) {
|
|
73
102
|
const batch = files.slice(i, i + LINT_BATCH_SIZE);
|
|
@@ -83,20 +112,28 @@ function runLintInBatches(files, buildCmd, jsonFlag) {
|
|
|
83
112
|
stdout = e.stdout;
|
|
84
113
|
if (!stdout || !String(stdout).trim()) {
|
|
85
114
|
errors.push(formatToolFailure(e));
|
|
115
|
+
failedFiles.push(...batch);
|
|
86
116
|
continue;
|
|
87
117
|
}
|
|
88
118
|
}
|
|
89
119
|
const trimmed = String(stdout).trim();
|
|
90
|
-
if (!trimmed)
|
|
120
|
+
if (!trimmed) {
|
|
121
|
+
// No output at all for a batch the tool was asked about: nothing was
|
|
122
|
+
// evaluated, so these files must not be recorded as clean.
|
|
123
|
+
failedFiles.push(...batch);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
91
126
|
try {
|
|
92
127
|
const parsed = JSON.parse(trimmed);
|
|
93
128
|
if (Array.isArray(parsed)) results.push(...parsed);
|
|
129
|
+
else failedFiles.push(...batch);
|
|
94
130
|
} catch {
|
|
95
131
|
errors.push(`linter returned unparseable output for ${batch.length} file(s)`);
|
|
132
|
+
failedFiles.push(...batch);
|
|
96
133
|
}
|
|
97
134
|
}
|
|
98
135
|
|
|
99
|
-
return { results, errors };
|
|
136
|
+
return { results, errors, failedFiles };
|
|
100
137
|
}
|
|
101
138
|
|
|
102
139
|
/**
|
|
@@ -275,6 +312,23 @@ async function createBaseline() {
|
|
|
275
312
|
|
|
276
313
|
const baseline = {};
|
|
277
314
|
|
|
315
|
+
// The baseline is a RATCHET: it records what was already known so a new issue
|
|
316
|
+
// stands out. Rebuilding it from an empty object is correct only for files that
|
|
317
|
+
// were actually evaluated. A batch whose linter could not run taught us nothing
|
|
318
|
+
// about its files, so writing them as "no entry" would silently lower the bar
|
|
319
|
+
// for every one of them -- and because the write is unconditional, a run in
|
|
320
|
+
// which every tool failed replaced a good baseline with `{}`. That is a
|
|
321
|
+
// measured recurrence in this repo: it presents as
|
|
322
|
+
// BLOCKED - 50 NEW shellcheck issue(s) (baseline: 0, current: 50)
|
|
323
|
+
// on a tree where nothing had changed, and it cannot be distinguished from a
|
|
324
|
+
// genuine regression until the old baseline is reconstructed by hand.
|
|
325
|
+
//
|
|
326
|
+
// So: read what was on disk, and after the rebuild put back the entries for
|
|
327
|
+
// files this run could not evaluate. Files that WERE evaluated still shrink --
|
|
328
|
+
// that is the ratchet working -- because `baseline[file]` is set for them.
|
|
329
|
+
const previous = readBaselineForMerge();
|
|
330
|
+
const unevaluated = new Set();
|
|
331
|
+
|
|
278
332
|
// TypeScript/JavaScript — ESLint
|
|
279
333
|
const tsFiles = findFilesByExt(['.ts', '.tsx', '.js', '.jsx']);
|
|
280
334
|
if (tsFiles.length > 0) {
|
|
@@ -296,12 +350,13 @@ async function createBaseline() {
|
|
|
296
350
|
|
|
297
351
|
if (eslintConfigExists && eslintAvailable) {
|
|
298
352
|
const eslintCmd = eslintBin ? quoteBin(eslintBin) : 'npx eslint';
|
|
299
|
-
const { results, errors } = runLintInBatches(
|
|
353
|
+
const { results, errors, failedFiles } = runLintInBatches(
|
|
300
354
|
tsFiles,
|
|
301
355
|
batch => `${eslintCmd} ${batch.map(f => `"${f}"`).join(' ')}`,
|
|
302
356
|
'-f json --no-warn-ignored'
|
|
303
357
|
);
|
|
304
358
|
recordFailures('eslint', errors);
|
|
359
|
+
failedFiles.forEach(f => unevaluated.add(f));
|
|
305
360
|
for (const fileResult of results) {
|
|
306
361
|
const fileName = matchResultToFile(fileResult.filePath, tsFiles);
|
|
307
362
|
if (!fileName) continue;
|
|
@@ -334,12 +389,13 @@ async function createBaseline() {
|
|
|
334
389
|
}
|
|
335
390
|
|
|
336
391
|
if (ruffAvailable) {
|
|
337
|
-
const { results, errors } = runLintInBatches(
|
|
392
|
+
const { results, errors, failedFiles } = runLintInBatches(
|
|
338
393
|
pyFiles,
|
|
339
394
|
batch => `ruff check ${batch.map(f => `"${f}"`).join(' ')}`,
|
|
340
395
|
'--output-format json'
|
|
341
396
|
);
|
|
342
397
|
recordFailures('ruff', errors);
|
|
398
|
+
failedFiles.forEach(f => unevaluated.add(f));
|
|
343
399
|
for (const fileResult of results) {
|
|
344
400
|
// A result that names no file cannot be recorded against one. Skipping it
|
|
345
401
|
// is the fix for the literal "undefined" key this used to write.
|
|
@@ -413,12 +469,13 @@ async function createBaseline() {
|
|
|
413
469
|
// Same batching as the other tools: one argv for every shell script in the
|
|
414
470
|
// repo is the same platform-limit hazard, even though this repo happens to
|
|
415
471
|
// sit under the threshold today.
|
|
416
|
-
const { results, errors } = runLintInBatches(
|
|
472
|
+
const { results, errors, failedFiles } = runLintInBatches(
|
|
417
473
|
shFiles,
|
|
418
474
|
batch => `shellcheck -f json ${batch.map(f => `"${f}"`).join(' ')}`,
|
|
419
475
|
''
|
|
420
476
|
);
|
|
421
477
|
recordFailures('shellcheck', errors);
|
|
478
|
+
failedFiles.forEach(f => unevaluated.add(f));
|
|
422
479
|
const warningsByFile = {};
|
|
423
480
|
for (const item of results) {
|
|
424
481
|
const matchedFile = matchResultToFile(item.file, shFiles);
|
|
@@ -447,6 +504,24 @@ async function createBaseline() {
|
|
|
447
504
|
}
|
|
448
505
|
}
|
|
449
506
|
|
|
507
|
+
// Restore what this run could not evaluate, so a broken toolchain cannot
|
|
508
|
+
// rewrite known-bad files as clean. `baseline[file]` being set means some tool
|
|
509
|
+
// did evaluate it this run, and the fresh value wins -- that is the ratchet
|
|
510
|
+
// shrinking, not data loss.
|
|
511
|
+
let carried = 0;
|
|
512
|
+
for (const file of unevaluated) {
|
|
513
|
+
if (baseline[file]) continue;
|
|
514
|
+
if (!Object.prototype.hasOwnProperty.call(previous, file)) continue;
|
|
515
|
+
baseline[file] = previous[file];
|
|
516
|
+
carried++;
|
|
517
|
+
}
|
|
518
|
+
if (carried > 0) {
|
|
519
|
+
console.log(
|
|
520
|
+
`Kept ${carried} baseline entry/entries for files no linter could evaluate ` +
|
|
521
|
+
`(${unevaluated.size} file(s) affected) -- not evaluated is not clean.`
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
|
|
450
525
|
fs.writeFileSync(getBaselineFile(), JSON.stringify(baseline, null, 2));
|
|
451
526
|
return baseline;
|
|
452
527
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.14",
|
|
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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
package/plugins/dsh/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boyingliu01/dsh-plugin-xp-gate",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.14",
|
|
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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
3
|
+
"version": "0.38.14",
|
|
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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.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.38.
|
|
6
|
+
**Version:** 0.38.14.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|