@boyingliu01/xp-gate 0.38.35 → 0.38.36
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/powershell.sh +2 -0
- package/adapters/shell.sh +7 -0
- package/adapters/typescript.sh +51 -1
- package/hooks/gate-entries/gate-2-entry.sh +16 -0
- package/hooks/gate-entries/gate-5-entry.sh +181 -16
- package/hooks/lib/jscpd-run.sh +53 -5
- 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/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/adapters/powershell.sh
CHANGED
|
@@ -472,6 +472,7 @@ run_tests() {
|
|
|
472
472
|
PWSH=$(_detect_pwsh)
|
|
473
473
|
if [ -z "$PWSH" ]; then
|
|
474
474
|
echo "PowerShell not available, skipping PowerShell tests"
|
|
475
|
+
echo "XP_GATE_TESTS_SKIPPED"
|
|
475
476
|
return 0
|
|
476
477
|
fi
|
|
477
478
|
|
|
@@ -510,6 +511,7 @@ _pester_timeout "XP_GATE_POWERSHELL_TEST_TIMEOUT_S" "${XP_GATE_POWERSHELL_TEST_T
|
|
|
510
511
|
return $run_exit
|
|
511
512
|
else
|
|
512
513
|
echo "No Pester tests found"
|
|
514
|
+
echo "XP_GATE_TESTS_SKIPPED"
|
|
513
515
|
return 0
|
|
514
516
|
fi
|
|
515
517
|
}
|
package/adapters/shell.sh
CHANGED
|
@@ -212,6 +212,13 @@ run_tests() {
|
|
|
212
212
|
local bats_bin
|
|
213
213
|
if ! bats_bin="$(_shell_resolve_bats)"; then
|
|
214
214
|
echo "bats not available, skipping shell test suite (install: npm i -D bats)"
|
|
215
|
+
# Machine-readable skip, read by Gate 5's `_gate5_test_run_skipped`. Returning
|
|
216
|
+
# 0 here is right -- nothing was expected to run and blocking would punish a
|
|
217
|
+
# project for its environment -- but the gate cannot tell "returned 0 because
|
|
218
|
+
# the suite passed" from "returned 0 because nothing ran" without being told.
|
|
219
|
+
# Measured 2026-11-19: a failing .bats suite on a machine with bats installed
|
|
220
|
+
# but not on the hook's PATH produced "PASSED - Unit tests passed."
|
|
221
|
+
echo "XP_GATE_TESTS_SKIPPED"
|
|
215
222
|
return 0
|
|
216
223
|
fi
|
|
217
224
|
|
package/adapters/typescript.sh
CHANGED
|
@@ -220,8 +220,22 @@ run_tests() {
|
|
|
220
220
|
_run_local_tool vitest run
|
|
221
221
|
elif _local_bin jest >/dev/null; then
|
|
222
222
|
_run_local_tool jest --passWithNoTests
|
|
223
|
+
elif _declared_test_command >/dev/null 2>&1; then
|
|
224
|
+
# The project states how its own tests run. Node ships a test runner built in
|
|
225
|
+
# (`node --test`, Node 18+), so "no runner installed locally" is frequently
|
|
226
|
+
# false, and the SKIP below then states a reason that is not true -- which
|
|
227
|
+
# reads as "this project has no tests", the exact defect family AGENTS.md
|
|
228
|
+
# names. Measured on a fixture whose package.json says `"test": "node
|
|
229
|
+
# --test"` with a deliberately failing assertion: Gate 5 printed SKIP, the
|
|
230
|
+
# commit walked past it, and the failing test never ran.
|
|
231
|
+
#
|
|
232
|
+
# This is NOT the npx problem the header of this file warns about: it runs
|
|
233
|
+
# what the project declared, from the project's own tree, and installs
|
|
234
|
+
# nothing. The named runners above still win, so existing projects keep the
|
|
235
|
+
# exact output shape Gate 5's failure handler parses.
|
|
236
|
+
_run_declared_test_command
|
|
223
237
|
else
|
|
224
|
-
# SKIP, not BLOCK:
|
|
238
|
+
# SKIP, not BLOCK: nothing declares a runner, so no test was expected to run.
|
|
225
239
|
# Returning non-zero here is what turned "this project does not use
|
|
226
240
|
# vitest/jest" into "TESTS FAILED" for every downstream repo with .js files.
|
|
227
241
|
echo "⏭️ SKIP - No test runner installed locally (node_modules/.bin has no vitest or jest)"
|
|
@@ -230,6 +244,42 @@ run_tests() {
|
|
|
230
244
|
fi
|
|
231
245
|
}
|
|
232
246
|
|
|
247
|
+
# Print the project's declared test command, or nothing when it declares none.
|
|
248
|
+
#
|
|
249
|
+
# Read from package.json with node rather than grep: the script can contain any
|
|
250
|
+
# JSON-escaped character, and a grep that trips over one would silently report
|
|
251
|
+
# "no declaration" and fall back to the SKIP this function exists to prevent.
|
|
252
|
+
_declared_test_command() {
|
|
253
|
+
[ -f package.json ] || return 1
|
|
254
|
+
command -v node >/dev/null 2>&1 || return 1
|
|
255
|
+
local cmd
|
|
256
|
+
cmd=$(node -e '
|
|
257
|
+
let p;
|
|
258
|
+
try { p = JSON.parse(require("fs").readFileSync("package.json", "utf8")); }
|
|
259
|
+
catch { process.exit(1); }
|
|
260
|
+
const t = p && p.scripts && p.scripts.test;
|
|
261
|
+
if (typeof t !== "string" || !t.trim()) process.exit(1);
|
|
262
|
+
// npm initialises this placeholder in every package; running it would report
|
|
263
|
+
// a failure for a project that simply has no tests.
|
|
264
|
+
if (/^no test specified$/i.test(t.trim())) process.exit(1);
|
|
265
|
+
process.stdout.write(t);
|
|
266
|
+
' 2>/dev/null) || return 1
|
|
267
|
+
[ -n "$cmd" ] || return 1
|
|
268
|
+
printf '%s\n' "$cmd"
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
# Run the command `_declared_test_command` printed, propagating its exit status.
|
|
272
|
+
#
|
|
273
|
+
# Executed through the shell because a package.json test script is shell by
|
|
274
|
+
# contract (it is what `npm test` would run). The command comes from the project
|
|
275
|
+
# under test, which the gate is already trusting to build and test itself.
|
|
276
|
+
_run_declared_test_command() {
|
|
277
|
+
local cmd
|
|
278
|
+
cmd=$(_declared_test_command) || return 127
|
|
279
|
+
echo "Running declared test command: $cmd"
|
|
280
|
+
run_without_git_context sh -c "$cmd"
|
|
281
|
+
}
|
|
282
|
+
|
|
233
283
|
run_coverage() {
|
|
234
284
|
echo "Running TypeScript coverage..."
|
|
235
285
|
local runner bin out_file rc
|
|
@@ -96,6 +96,22 @@ EOF_CHANGED
|
|
|
96
96
|
echo "⚠️ jscpd exited with code $JSCPD_EXIT without a report — the output above is its real error"
|
|
97
97
|
echo "⏭️ SKIPPED - Duplicate code (jscpd run error)"
|
|
98
98
|
GATE_2_STATUS="SKIP"
|
|
99
|
+
elif [ "$JSCPD_OUTCOME" = "no_files" ]; then
|
|
100
|
+
# jscpd ran, exited 0, and examined nothing -- its own stderr says so. That is
|
|
101
|
+
# not a clean scan: "Found 0 clones" over zero files is a statement about the
|
|
102
|
+
# filter, not about the code. Measured 2026-11-19 on a Dart fixture, where the
|
|
103
|
+
# change set named a .dart file that jscpd's --format set did not cover: the
|
|
104
|
+
# table read "Total: 0 files" and Gate 2 still recorded PASS.
|
|
105
|
+
#
|
|
106
|
+
# SKIP, not BLOCK: the project may legitimately contain no file of a type
|
|
107
|
+
# jscpd understands, and blocking would punish a language for jscpd's format
|
|
108
|
+
# list. SKIP with this reason keeps it distinguishable from "checked, clean".
|
|
109
|
+
echo "⏭️ SKIPPED - Duplicate code (jscpd analysed no files)"
|
|
110
|
+
echo " jscpd exited 0 but examined 0 files, so its 'Found 0 clones' is not a"
|
|
111
|
+
echo " verdict on this change set. Check that the changed file extensions are"
|
|
112
|
+
echo " covered by jscpd's --format set (or the project's jscpd config)."
|
|
113
|
+
GATE_2_STATUS="SKIP"
|
|
114
|
+
GATE_2_DETAIL="jscpd_analysed_no_files"
|
|
99
115
|
else
|
|
100
116
|
echo "✅ PASSED - jscpd duplicate code check completed."
|
|
101
117
|
fi
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# --- shellcheck suppressions for this file, see the note below ---
|
|
4
|
+
# shellcheck disable=SC2001,SC2034,SC2086,SC2126,SC2140
|
|
5
|
+
|
|
2
6
|
# ============================================================================
|
|
3
7
|
# gate-5 entry — extracted from pre-commit by scripts/extract-gates.cjs
|
|
4
8
|
#
|
|
@@ -17,6 +21,42 @@
|
|
|
17
21
|
# on - there is no copy left in the hook.
|
|
18
22
|
# ============================================================================
|
|
19
23
|
|
|
24
|
+
# SC2034 -- four variables shellcheck reports as written-but-never-read INSIDE
|
|
25
|
+
# THIS FILE. All four are consumed from elsewhere, and the check that establishes
|
|
26
|
+
# it has to search wider than this file:
|
|
27
|
+
#
|
|
28
|
+
# COVERAGE_THRESHOLD_SOURCE read by githooks/pre-commit (2 references).
|
|
29
|
+
# PY_TEST_SKIPPED read by githooks/lib/coverage-total.sh:54, where
|
|
30
|
+
# enforce_python_coverage refuses to consume a stale
|
|
31
|
+
# .coverage left by a subset run. NOT dead -- an
|
|
32
|
+
# earlier version of this comment claimed it was,
|
|
33
|
+
# based on grepping only pre-commit and gate-driver.
|
|
34
|
+
# GATE_5_COVERAGE_APPLIES_TO read by githooks/gate-entries/gate-13-entry.sh at
|
|
35
|
+
# two sites (the persisted "applies_to" field and the
|
|
36
|
+
# subset exemption). Also NOT dead, same wrong grep.
|
|
37
|
+
# TESTS_DEFERRED written here, and no reader found anywhere: not in
|
|
38
|
+
# pre-commit, gate-driver, lib/ or the other gate
|
|
39
|
+
# bodies. This one IS unused, and is left in place
|
|
40
|
+
# rather than deleted in a change about something
|
|
41
|
+
# else; deleting it is safe and belongs in its own
|
|
42
|
+
# commit.
|
|
43
|
+
#
|
|
44
|
+
# The lesson is the one this repository keeps relearning: "I grepped and found no
|
|
45
|
+
# reader" is evidence about the directories you grepped, not about the codebase.
|
|
46
|
+
#
|
|
47
|
+
|
|
48
|
+
# Three note-level codes, suppressed for the same reason: each is a deliberate
|
|
49
|
+
# shell idiom the linter cannot tell from an accident.
|
|
50
|
+
#
|
|
51
|
+
# SC2086 ($SMART_TARGETS, $RELATED_TESTS, $PY_CHANGED_ALL). These hold
|
|
52
|
+
# space-separated file lists and are expanded UNQUOTED on purpose -- quoting
|
|
53
|
+
# collapses the list into one bogus path. The alternative shellcheck suggests
|
|
54
|
+
# is an array, which means rewriting the surrounding branches; the code is
|
|
55
|
+
# correct as written.
|
|
56
|
+
# SC2001 (sed instead of parameter substitution). The existing sed forms sit in
|
|
57
|
+
# multi-step pipelines where they are the readable choice.
|
|
58
|
+
# SC2126 (grep piped to wc -l). Kept for symmetry with the surrounding counts.
|
|
59
|
+
|
|
20
60
|
# ============================================================================
|
|
21
61
|
# Is the coverage report on disk evidence for THIS commit?
|
|
22
62
|
#
|
|
@@ -680,7 +720,7 @@ else
|
|
|
680
720
|
# of a test result was reported as the absence of a need for one. The
|
|
681
721
|
# Principles extensions list got `.cs` in ac214d38; this one was left behind,
|
|
682
722
|
# which is why the C# arm looked like it worked while Gate 5 stood down.
|
|
683
|
-
CODE_EXTENSIONS="\.(ts|tsx|js|jsx|mjs|cjs|py|go|java|kt|kts|cs|csx|cpp|cc|cxx|c|h|hpp|swift|m|mm|dart|sh|ps1)$"
|
|
723
|
+
CODE_EXTENSIONS="\.(ts|tsx|js|jsx|mjs|cjs|py|go|java|kt|kts|cs|csx|cpp|cc|cxx|c|h|hpp|swift|m|mm|dart|php|phtml|sh|ps1)$"
|
|
684
724
|
CHANGED_CODE_FILES=$(echo "$CHANGED_FILES" | grep -E "$CODE_EXTENSIONS" || true)
|
|
685
725
|
if [ -z "$CHANGED_CODE_FILES" ]; then
|
|
686
726
|
# #554: this branch DID stand down deliberately, but "PASS" is a claim that
|
|
@@ -876,7 +916,7 @@ else
|
|
|
876
916
|
# coverage arm further down finds no report and blocks with
|
|
877
917
|
# "coverage/coverage-summary.json not found" -- blaming a missing
|
|
878
918
|
# artifact for a runner that was never installed (dsh-aot-runner #21).
|
|
879
|
-
if
|
|
919
|
+
if _gate5_test_run_skipped "$TESTS_EXIT_CODE" "$TESTS_OUTPUT"; then
|
|
880
920
|
TESTS_SKIPPED=true
|
|
881
921
|
fi
|
|
882
922
|
if [ "$TESTS_EXIT_CODE" -ne 0 ]; then
|
|
@@ -960,7 +1000,7 @@ else
|
|
|
960
1000
|
# "tests passed" and for "no runner installed", so the output is the
|
|
961
1001
|
# only evidence of which one happened. Setting TESTS_RAN_ANY here
|
|
962
1002
|
# unconditionally would claim a measurement that never took place.
|
|
963
|
-
if
|
|
1003
|
+
if _gate5_test_run_skipped "$TESTS_EXIT_CODE" "$TESTS_OUTPUT"; then
|
|
964
1004
|
TESTS_SKIPPED=true
|
|
965
1005
|
else
|
|
966
1006
|
echo "✅ PASSED - Unit tests passed."
|
|
@@ -1158,7 +1198,7 @@ else
|
|
|
1158
1198
|
elif [ "$PY_TEST_COUNT" -gt 20 ] 2>/dev/null; then
|
|
1159
1199
|
echo "ℹ️ Python: $PY_TEST_COUNT changed test files (>20) — running FULL suite (#399)."
|
|
1160
1200
|
fi
|
|
1161
|
-
|
|
1201
|
+
|
|
1162
1202
|
pytest $PY_XDIST_ARGS $PY_COV_SOURCE --cov-fail-under="$PY_COV_FAIL_UNDER" --tb=short
|
|
1163
1203
|
COV_EXIT=$((COV_EXIT || $?))
|
|
1164
1204
|
else
|
|
@@ -1180,7 +1220,7 @@ else
|
|
|
1180
1220
|
if [ -z "$PY_TARGETS" ]; then
|
|
1181
1221
|
# related lookup found nothing → tier 3 full run is safest.
|
|
1182
1222
|
echo "ℹ️ Python: no related tests found for changed sources — running FULL suite (#399)."
|
|
1183
|
-
|
|
1223
|
+
|
|
1184
1224
|
pytest $PY_XDIST_ARGS $PY_COV_SOURCE --cov-fail-under="$PY_COV_FAIL_UNDER" --tb=short
|
|
1185
1225
|
COV_EXIT=$((COV_EXIT || $?))
|
|
1186
1226
|
else
|
|
@@ -1197,7 +1237,7 @@ else
|
|
|
1197
1237
|
# Coverage check FAILED". --cov-fail-under=0 is the documented
|
|
1198
1238
|
# way to switch it off for one invocation.
|
|
1199
1239
|
PARTIAL_TEST_RUN=true
|
|
1200
|
-
|
|
1240
|
+
|
|
1201
1241
|
pytest $PY_XDIST_ARGS $PY_COV_SOURCE --cov-fail-under=0 --tb=short $PY_TARGETS
|
|
1202
1242
|
COV_EXIT=$((COV_EXIT || $?))
|
|
1203
1243
|
fi
|
|
@@ -1211,14 +1251,9 @@ else
|
|
|
1211
1251
|
;;
|
|
1212
1252
|
"go")
|
|
1213
1253
|
if command -v go &> /dev/null; then
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
echo "❌ BLOCKED - Go coverage $TOTAL_COVERAGE% below ${COVERAGE_THRESHOLD:-80}% threshold"
|
|
1218
|
-
return 1
|
|
1219
|
-
fi
|
|
1220
|
-
echo "Go coverage: $TOTAL_COVERAGE%"
|
|
1221
|
-
COV_EXIT=$((COV_EXIT || 0))
|
|
1254
|
+
# Extracted so the arm can be tested without running this repo's own
|
|
1255
|
+
# suite. The defect it fixes is described on the function.
|
|
1256
|
+
_gate5_go_coverage_arm || return 1
|
|
1222
1257
|
fi
|
|
1223
1258
|
;;
|
|
1224
1259
|
"shell")
|
|
@@ -1867,7 +1902,30 @@ else
|
|
|
1867
1902
|
if [ "$COVERAGE_ENFORCED" = false ]; then
|
|
1868
1903
|
echo "ℹ️ Coverage enforcement not applicable for ${CURRENT_LANG}"
|
|
1869
1904
|
fi
|
|
1870
|
-
|
|
1905
|
+
# The verdict must agree with the decision, including when the decision was to
|
|
1906
|
+
# hand the work to CI.
|
|
1907
|
+
#
|
|
1908
|
+
# This line used to print unconditionally. For the shell adapter -- which
|
|
1909
|
+
# declares tests_delegated_to_ci() and prints "Not checked by this gate --
|
|
1910
|
+
# verified on push/PR instead" a few lines earlier -- the log therefore ended
|
|
1911
|
+
# with a PASSED for a suite that ran nowhere. Measured 2026-11-19 on a shell
|
|
1912
|
+
# fixture whose only .bats test is `[ 1 -eq 2 ]`:
|
|
1913
|
+
#
|
|
1914
|
+
# shell: tests run in CI bats-contracts job ...
|
|
1915
|
+
# Not checked by this gate -- verified on push/PR instead.
|
|
1916
|
+
# PASSED - Coverage check completed.
|
|
1917
|
+
#
|
|
1918
|
+
# The delegation is deliberate (239 bats suites serially measured 18m47s, which
|
|
1919
|
+
# is why CI owns that job), so the fix is not to stop delegating -- it is to stop
|
|
1920
|
+
# reporting a pass for it. Same family as "SKIP must be recorded, not merely
|
|
1921
|
+
# printed", with the polarity reversed: the skip WAS printed, and then a PASS
|
|
1922
|
+
# was printed on top of it.
|
|
1923
|
+
if [ -n "${DELEGATED_LANGS:-}" ]; then
|
|
1924
|
+
echo "ℹ️ Tests for ${DELEGATED_LANGS} are checked in CI, not by this gate."
|
|
1925
|
+
echo " No test verdict was produced here -- absence of a failure is not a pass."
|
|
1926
|
+
else
|
|
1927
|
+
echo "✅ PASSED - Coverage check completed."
|
|
1928
|
+
fi
|
|
1871
1929
|
done # end for CURRENT_LANG (Stage 2 coverage)
|
|
1872
1930
|
|
|
1873
1931
|
fi # End: if [ "${TESTS_SKIPPED:-false}" != "true" ] (Issue #312 coverage skip)
|
|
@@ -1934,7 +1992,18 @@ else
|
|
|
1934
1992
|
# Not written as a `:-PASS` expansion: AC-599-03 forbids a PASS default in
|
|
1935
1993
|
# any `GATE_N_STATUS:-DEFAULT` expansion, because that is how an unassigned
|
|
1936
1994
|
# gate came to render as "passed". An explicit comparison keeps both rules.
|
|
1937
|
-
|
|
1995
|
+
#
|
|
1996
|
+
# The delegation check comes FIRST, and it is the same defect one layer down
|
|
1997
|
+
# from the prose fix above: a language whose tests are delegated to CI never
|
|
1998
|
+
# ran a test here, so recording PASS for it is a claim about work nobody did.
|
|
1999
|
+
# Measured on the shell fixture: the gate printed "No test verdict was produced
|
|
2000
|
+
# here -- absence of a failure is not a pass" and the summary line one inch
|
|
2001
|
+
# below still read "Gate 5: Tests + Coverage PASS (coverage: N/A%)". The
|
|
2002
|
+
# summary is what a reader keeps and what the journal records.
|
|
2003
|
+
if [ -n "${DELEGATED_LANGS:-}" ]; then
|
|
2004
|
+
GATE_5_STATUS="SKIP"
|
|
2005
|
+
GATE_5_DETAIL="${GATE_5_DETAIL:+${GATE_5_DETAIL}; }tests delegated to CI for: ${DELEGATED_LANGS}"
|
|
2006
|
+
elif [ -z "$GATE_5_STATUS" ]; then
|
|
1938
2007
|
GATE_5_STATUS="PASS"
|
|
1939
2008
|
fi
|
|
1940
2009
|
fi
|
|
@@ -1986,7 +2055,103 @@ record_gate_audit "gate-5" "tests-coverage" "$GATE_5_STATUS" "0" "$GATE_5_START"
|
|
|
1986
2055
|
return 0
|
|
1987
2056
|
}
|
|
1988
2057
|
|
|
2058
|
+
# Did the test run actually verify anything, or did the adapter decline to run?
|
|
2059
|
+
#
|
|
2060
|
+
# The gate used to answer this by grepping the adapter's output for one sentence:
|
|
2061
|
+
#
|
|
2062
|
+
# printf '%s' "$TESTS_OUTPUT" | grep -q "No test runner installed locally"
|
|
2063
|
+
#
|
|
2064
|
+
# which is what the TYPESCRIPT adapter prints. Every other adapter words its
|
|
2065
|
+
# skip differently, so every other adapter's skip was recorded as a pass.
|
|
2066
|
+
# Measured 2026-11-19, shell fixture with one deliberately failing .bats test:
|
|
2067
|
+
#
|
|
2068
|
+
# Running tests...
|
|
2069
|
+
# bats not available, skipping shell test suite (install: npm i -D bats)
|
|
2070
|
+
# PASSED - Unit tests passed.
|
|
2071
|
+
#
|
|
2072
|
+
# The same shape appears for php, powershell, swift and objectivec. A prose list
|
|
2073
|
+
# can only contain the sentences someone remembered reading -- the exact reason
|
|
2074
|
+
# hand-written language lists were removed from this codebase.
|
|
2075
|
+
#
|
|
2076
|
+
# Two signals now, in priority order:
|
|
2077
|
+
#
|
|
2078
|
+
# 1. The adapter printed XP_GATE_TESTS_SKIPPED. This is the contract; adapters
|
|
2079
|
+
# that know they declined say so once, in a form nobody has to parse.
|
|
2080
|
+
# 2. The old TS sentence, kept so an adapter that has not been updated yet
|
|
2081
|
+
# still lands on the right side. Deprecated, not removed.
|
|
2082
|
+
#
|
|
2083
|
+
# A non-zero exit is never a skip: an adapter that exited non-zero found
|
|
2084
|
+
# something, whatever else it printed.
|
|
2085
|
+
_gate5_test_run_skipped() {
|
|
2086
|
+
local code="$1" out="$2"
|
|
2087
|
+
[ "$code" -eq 0 ] || return 1
|
|
2088
|
+
printf '%s' "$out" | grep -q 'XP_GATE_TESTS_SKIPPED' && return 0
|
|
2089
|
+
printf '%s' "$out" | grep -q 'No test runner installed locally' && return 0
|
|
2090
|
+
return 1
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
# Go coverage arm: run the suite WITH coverage and judge both outcomes.
|
|
2094
|
+
#
|
|
2095
|
+
# The `go` language has no meaningful split between "run the tests" and "measure
|
|
2096
|
+
# coverage" -- `go test -coverprofile` does both -- so this arm is the only place
|
|
2097
|
+
# a Go test failure can be noticed. It was not noticed:
|
|
2098
|
+
#
|
|
2099
|
+
# go test -coverprofile=coverage.out ./... 2>/dev/null # exit status dropped
|
|
2100
|
+
# TOTAL_COVERAGE=$(go tool cover -func ...)
|
|
2101
|
+
# if [ -n "$TOTAL_COVERAGE" ] && (( TOTAL_COVERAGE < 80 )); then return 1; fi
|
|
2102
|
+
# COV_EXIT=$((COV_EXIT || 0)) # unconditional zero
|
|
2103
|
+
#
|
|
2104
|
+
# A failing test therefore reached the verdict only through the percentage it
|
|
2105
|
+
# happened to leave behind. Measured on a fixture whose only test asserts
|
|
2106
|
+
# `Add(1,1) == 3` -- it fails, and covers 100% of statements:
|
|
2107
|
+
#
|
|
2108
|
+
# --- FAIL: TestDeliberatelyFailing (0.00s)
|
|
2109
|
+
# FAIL p 0.044s
|
|
2110
|
+
# coverage: 100.0% of statements
|
|
2111
|
+
# PASSED - Coverage check completed.
|
|
2112
|
+
#
|
|
2113
|
+
# A red suite scored green. The `shell` arm ten lines below had the same job and
|
|
2114
|
+
# did it correctly (`COV_EXIT=$((COV_EXIT || $?))`), which is what makes this a
|
|
2115
|
+
# defect rather than a design choice.
|
|
2116
|
+
#
|
|
2117
|
+
# Two things are deliberately NOT done here:
|
|
2118
|
+
#
|
|
2119
|
+
# - `2>/dev/null` is gone. Discarding stderr is why the failing test's own
|
|
2120
|
+
# output was the only clue, printed directly above a line that said PASSED.
|
|
2121
|
+
# The suite's output is shown so a block is attributable.
|
|
2122
|
+
# - A missing TOTAL_COVERAGE does NOT become a block. `go tool cover` prints
|
|
2123
|
+
# nothing when the profile is absent, and reading that as "0% < 80%" would
|
|
2124
|
+
# block every project whose tests failed to compile -- converting a compile
|
|
2125
|
+
# error into a coverage verdict, which is the wrong-vocabulary trap named in
|
|
2126
|
+
# githooks/AGENTS.md.
|
|
2127
|
+
_gate5_go_coverage_arm() {
|
|
2128
|
+
local out rc total
|
|
2129
|
+
out=$(go test -coverprofile=coverage.out ./... 2>&1)
|
|
2130
|
+
rc=$?
|
|
2131
|
+
# Show the tail: for a failing suite that is where FAIL and the test names are.
|
|
2132
|
+
printf '%s\n' "$out" | tail -20
|
|
2133
|
+
|
|
2134
|
+
if [ "$rc" -ne 0 ]; then
|
|
2135
|
+
echo "❌ BLOCKED - Go tests FAILED"
|
|
2136
|
+
echo " The suite was run with coverage; a failing test is a failure whether"
|
|
2137
|
+
echo " or not the coverage it measured looks acceptable."
|
|
2138
|
+
COV_EXIT=$((COV_EXIT || rc))
|
|
2139
|
+
return 1
|
|
2140
|
+
fi
|
|
2141
|
+
|
|
2142
|
+
total=$(go tool cover -func=coverage.out 2>/dev/null | grep "^total:" | awk '{print substr($3, 1, length($3)-1)}')
|
|
2143
|
+
if [ -n "$total" ] && (( $(echo "$total < 80" | bc -l 2>/dev/null || echo "0") )); then
|
|
2144
|
+
echo "❌ BLOCKED - Go coverage ${total}% below ${COVERAGE_THRESHOLD:-80}% threshold"
|
|
2145
|
+
COV_EXIT=$((COV_EXIT || 1))
|
|
2146
|
+
return 1
|
|
2147
|
+
fi
|
|
2148
|
+
echo "Go coverage: ${total}%"
|
|
2149
|
+
COV_EXIT=$((COV_EXIT || 0))
|
|
2150
|
+
return 0
|
|
2151
|
+
}
|
|
2152
|
+
|
|
1989
2153
|
|
|
1990
2154
|
|
|
1991
2155
|
# Called by pre-commit's ordered driver.
|
|
1992
2156
|
|
|
2157
|
+
|
package/hooks/lib/jscpd-run.sh
CHANGED
|
@@ -196,6 +196,34 @@ resolve_jscpd_config() {
|
|
|
196
196
|
# stay a warning). This only stops the gate from naming the wrong reason.
|
|
197
197
|
classify_jscpd_run() {
|
|
198
198
|
local _exit="$1" _out="$2" _report _count
|
|
199
|
+
# A failed run outranks everything else: it is the most specific fact, and
|
|
200
|
+
# calling a crash "no_files" would hide the crash.
|
|
201
|
+
if [ "$_exit" -ne 0 ] 2>/dev/null; then
|
|
202
|
+
printf 'error\n'
|
|
203
|
+
return 0
|
|
204
|
+
fi
|
|
205
|
+
# "Found 0 clones" means "no duplicate was found", which equals "no duplicate
|
|
206
|
+
# exists" only if something was examined. jscpd reports the difference on stderr
|
|
207
|
+
# and still exits 0:
|
|
208
|
+
#
|
|
209
|
+
# Warning: jscpd analyzed no files: check the paths and the --format,
|
|
210
|
+
# --ignore and --pattern filters
|
|
211
|
+
# Found 0 clones.
|
|
212
|
+
#
|
|
213
|
+
# Measured 2026-11-19 on a Dart fixture: the table read Total: 0 files /
|
|
214
|
+
# 0 lines / 0 tokens, Gate 2 printed "PASSED - jscpd duplicate code check
|
|
215
|
+
# completed" and the summary recorded PASS. A gate that examined nothing was
|
|
216
|
+
# indistinguishable from one that examined the change set and found it clean.
|
|
217
|
+
#
|
|
218
|
+
# The reason it happens on a Dart project is itself worth naming: the file list
|
|
219
|
+
# the gate hands jscpd is built from the change set, and jscpd only accepts the
|
|
220
|
+
# extensions its `--format` set covers. When the two disagree the scan is empty,
|
|
221
|
+
# which is an environment/configuration fact, not a verdict. `no_files` reaches
|
|
222
|
+
# the gate as SKIP with this name attached.
|
|
223
|
+
if printf '%s' "$_out" | grep -qiE 'analy[sz]ed no files|analy[sz]e[sd]? (no|zero) files'; then
|
|
224
|
+
printf 'no_files\n'
|
|
225
|
+
return 0
|
|
226
|
+
fi
|
|
199
227
|
_report=$(printf '%s' "$_out" | grep -oE 'Found [0-9]+ (clones?|duplicates?)' | tail -1)
|
|
200
228
|
if [ -n "$_report" ]; then
|
|
201
229
|
_count=$(printf '%s' "$_report" | sed -E 's/^Found ([0-9]+).*/\1/')
|
|
@@ -206,12 +234,32 @@ classify_jscpd_run() {
|
|
|
206
234
|
fi
|
|
207
235
|
return 0
|
|
208
236
|
fi
|
|
209
|
-
|
|
210
|
-
|
|
237
|
+
# Exit 0 with no report at all. Two sub-cases, and they are not the same:
|
|
238
|
+
#
|
|
239
|
+
# - Nothing but a timing line: measured by running jscpd with an --ignore that
|
|
240
|
+
# excludes everything --
|
|
241
|
+
# $ jscpd --ignore "**/*" lib.dart ; echo $?
|
|
242
|
+
# time: 0.156ms
|
|
243
|
+
# 0
|
|
244
|
+
# No table, no counts, no warning. The scan examined nothing, so "leave the
|
|
245
|
+
# verdict as it was" leaves it as PASS -- a clean bill for a codebase nobody
|
|
246
|
+
# looked at.
|
|
247
|
+
# - Anything else (an unfamiliar format, a version banner, a partial report):
|
|
248
|
+
# the run did produce evidence we cannot parse. Turning that into a SKIP
|
|
249
|
+
# would disable the gate for every project whose jscpd prints something new,
|
|
250
|
+
# which is why this fallback existed in the first place.
|
|
251
|
+
#
|
|
252
|
+
# Only the first is a "nothing happened" run. Strip ANSI, drop blank lines and
|
|
253
|
+
# the timing line, and see whether anything remains.
|
|
254
|
+
local _meaningful
|
|
255
|
+
_meaningful=$(printf '%s' "$_out" \
|
|
256
|
+
| sed -E 's/\x1b\[[0-9;]*m//g' \
|
|
257
|
+
| grep -vE '^[[:space:]]*$' \
|
|
258
|
+
| grep -viE '^[[:space:]]*(time|duration)[[:space:]]*:' \
|
|
259
|
+
| head -1)
|
|
260
|
+
if [ -z "$_meaningful" ]; then
|
|
261
|
+
printf 'no_files\n'
|
|
211
262
|
return 0
|
|
212
263
|
fi
|
|
213
|
-
# Exit 0 with no report: the run said nothing we can stand behind, but calling
|
|
214
|
-
# it an error would turn every unfamiliar jscpd format into a SKIP. Leave the
|
|
215
|
-
# gate's verdict as it was.
|
|
216
264
|
printf 'clean\n'
|
|
217
265
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.36",
|
|
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.36.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.36.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.36.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.36",
|
|
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.36.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.36.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.36.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.36.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.36.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.36.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.36.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.36.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.36.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.36.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.36.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.36.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|