@boyingliu01/xp-gate 0.41.71 → 0.41.74
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/java.sh +153 -10
- package/adapters/typescript.sh +5 -2
- package/gate-6-layers.sh +21 -5
- package/hooks/gate-6-layers.sh +21 -5
- package/hooks/gate-entries/gate-12b-entry.sh +8 -0
- package/hooks/gate-entries/gate-2-entry.sh +16 -10
- package/hooks/gate-entries/gate-5-entry.sh +41 -11
- package/hooks/gate-entries/gate-6-entry.sh +3 -0
- package/hooks/hook-module-resolution.sh +1 -0
- package/hooks/lib/validate-code-walkthrough.cjs +9 -1
- package/lib/hook-module-resolution.js +11 -0
- package/lib/mattpocock-license-verdict.json +1 -1
- package/mutation/AGENTS.md +9 -5
- 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/sprint-flow/references/phase-3-build.md +3 -3
- package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +2 -2
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/lib/evidence.d.ts +15 -0
- package/plugins/dsh/lib/evidence.d.ts.map +1 -1
- package/plugins/dsh/lib/evidence.js +28 -0
- package/plugins/dsh/lib/index.d.ts.map +1 -1
- package/plugins/dsh/lib/index.js +25 -8
- 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/sprint-flow/references/phase-3-build.md +3 -3
- package/plugins/dsh/skills/sprint-flow/references/phase-overview.md +2 -2
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/src/evidence-reviewed-paths.test.ts +63 -0
- package/plugins/dsh/src/evidence.ts +42 -0
- package/plugins/dsh/src/index.ts +33 -8
- 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/sprint-flow/references/phase-3-build.md +3 -3
- package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +2 -2
- 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/sprint-flow/references/phase-3-build.md +3 -3
- package/plugins/qoder/skills/sprint-flow/references/phase-overview.md +2 -2
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
- package/scripts/sync-package-content.js +11 -1
- package/skills/delphi-review/AGENTS.md +1 -1
- package/skills/sprint-flow/AGENTS.md +1 -1
- package/skills/sprint-flow/references/phase-3-build.md +3 -3
- package/skills/sprint-flow/references/phase-overview.md +2 -2
- package/skills/test-specification-alignment/AGENTS.md +1 -1
package/adapters/java.sh
CHANGED
|
@@ -475,13 +475,43 @@ run_legacy_analysis() {
|
|
|
475
475
|
local out_file
|
|
476
476
|
out_file=$(mktemp "${TMPDIR:-/tmp}/java-legacy.XXXXXX")
|
|
477
477
|
|
|
478
|
+
# Engines present on PATH but unable to start their JVM: no verdict about
|
|
479
|
+
# the code, so they are reported, not counted as violations.
|
|
480
|
+
local unable_reason=""
|
|
481
|
+
_legacy_unable() {
|
|
482
|
+
unable_reason="${unable_reason:+$unable_reason; }$1 cannot run"
|
|
483
|
+
}
|
|
484
|
+
# A wrapper whose JVM is missing can exit with codes other than 127: the
|
|
485
|
+
# checkstyle wrapper runs under `set -e`, so bash's own "java: not found"
|
|
486
|
+
# aborts it with 1, which the rc check alone reads as "violations found".
|
|
487
|
+
#
|
|
488
|
+
# Guarded by rc!=0 at each call site, and only the first few lines are
|
|
489
|
+
# searched: a startup failure prints its diagnostic immediately, while a real
|
|
490
|
+
# violation report is long and could carry these words inside quoted source,
|
|
491
|
+
# a stack trace or a documentation string. Reading the whole file would let
|
|
492
|
+
# such a report be misread as a broken engine and suppress a genuine finding.
|
|
493
|
+
_legacy_jvm_missing() {
|
|
494
|
+
head -n 5 "$1" 2>/dev/null |
|
|
495
|
+
grep -qiE 'java: not found|no java executable|No java executable found'
|
|
496
|
+
}
|
|
497
|
+
|
|
478
498
|
# CheckStyle with Google style (legacy fallback)
|
|
479
499
|
if command -v checkstyle &>/dev/null; then
|
|
480
500
|
lint_tools=$((lint_tools + 1))
|
|
481
501
|
rc=0
|
|
482
502
|
checkstyle -c /google_checks.xml . >"$out_file" 2>&1 || rc=$?
|
|
483
503
|
sed -n '1,20p' "$out_file"
|
|
484
|
-
|
|
504
|
+
# The wrapper scripts print a diagnostic and exit non-zero when their JVM
|
|
505
|
+
# cannot start, so the text match is what separates "engine is broken" from
|
|
506
|
+
# "engine found violations" -- rc alone never could.
|
|
507
|
+
# rc!=0 is a precondition of the text match: a clean run (rc 0) is a pass
|
|
508
|
+
# whatever its (short) output happens to contain.
|
|
509
|
+
if [ "$rc" -ne 0 ] && { [ "$rc" -eq 127 ] || _legacy_jvm_missing "$out_file"; }; then
|
|
510
|
+
lint_tools=$((lint_tools - 1))
|
|
511
|
+
_legacy_unable checkstyle
|
|
512
|
+
elif [ "$rc" -ne 0 ]; then
|
|
513
|
+
worst=1
|
|
514
|
+
fi
|
|
485
515
|
fi
|
|
486
516
|
|
|
487
517
|
# PMD error detection (legacy fallback)
|
|
@@ -489,8 +519,17 @@ run_legacy_analysis() {
|
|
|
489
519
|
lint_tools=$((lint_tools + 1))
|
|
490
520
|
rc=0
|
|
491
521
|
pmd check -d . -R category/java/errorprone.xml >"$out_file" 2>&1 || rc=$?
|
|
522
|
+
# Show the findings the way the checkstyle arm does: a blocked commit must
|
|
523
|
+
# say what it found, not only that it found something.
|
|
492
524
|
sed -n '1,20p' "$out_file"
|
|
493
|
-
|
|
525
|
+
# rc!=0 is a precondition of the text match: a clean run (rc 0) is a pass
|
|
526
|
+
# whatever its (short) output happens to contain.
|
|
527
|
+
if [ "$rc" -ne 0 ] && { [ "$rc" -eq 127 ] || _legacy_jvm_missing "$out_file"; }; then
|
|
528
|
+
lint_tools=$((lint_tools - 1))
|
|
529
|
+
_legacy_unable pmd
|
|
530
|
+
elif [ "$rc" -ne 0 ]; then
|
|
531
|
+
worst=1
|
|
532
|
+
fi
|
|
494
533
|
fi
|
|
495
534
|
rm -f "$out_file"
|
|
496
535
|
|
|
@@ -501,6 +540,14 @@ run_legacy_analysis() {
|
|
|
501
540
|
_XP_JAVA_LEGACY_WARN=1
|
|
502
541
|
echo "XP_G1_REASON: legacy tools unavailable (warn)"
|
|
503
542
|
fi
|
|
543
|
+
if [ -n "$unable_reason" ]; then
|
|
544
|
+
echo "⚠️ Java code quality NOT verified - legacy engine(s) could not execute (#507 AC-507-01-03)"
|
|
545
|
+
_XP_JAVA_LEGACY_WARN=1
|
|
546
|
+
# Recorded once, here. The `worst` branch below does not repeat it: two
|
|
547
|
+
# XP_G1_REASON lines naming the same reason would make a consumer that
|
|
548
|
+
# collects reasons record it twice.
|
|
549
|
+
echo "XP_G1_REASON: legacy engine $unable_reason"
|
|
550
|
+
fi
|
|
504
551
|
|
|
505
552
|
# p3c-pmd check (Alibaba coding guidelines) — primary Java quality gate
|
|
506
553
|
# (`-Dpmd.failOnViolation=true` makes violations exit non-zero).
|
|
@@ -693,13 +740,52 @@ _run_maven_tests() {
|
|
|
693
740
|
echo " ℹ️ Java selective run — $targets"
|
|
694
741
|
mvn test jacoco:report -q -Dtest="$targets" \
|
|
695
742
|
-Dsurefire.failIfNoSpecifiedTests=false \
|
|
696
|
-
-DfailIfNoTests=false 2>&1 | tail -10
|
|
743
|
+
-DfailIfNoTests=false "${JACOCO_ASCII_ARGS[@]+"${JACOCO_ASCII_ARGS[@]}"}" 2>&1 | tail -10
|
|
697
744
|
else
|
|
698
|
-
mvn test jacoco:report -q 2>&1 | tail -10
|
|
745
|
+
mvn test jacoco:report -q "${JACOCO_ASCII_ARGS[@]+"${JACOCO_ASCII_ARGS[@]}"}" 2>&1 | tail -10
|
|
699
746
|
fi
|
|
700
747
|
return "${PIPESTATUS[0]}"
|
|
701
748
|
}
|
|
702
749
|
|
|
750
|
+
# #703: the JaCoCo agent silently writes NOTHING when the build path contains
|
|
751
|
+
# non-ASCII characters (measured on zh-CN Windows at D:\projects\SQL审计工具).
|
|
752
|
+
# Maven then prints
|
|
753
|
+
#
|
|
754
|
+
# [INFO] Skipping JaCoCo execution due to missing execution data file
|
|
755
|
+
#
|
|
756
|
+
# and exits 0, so "the build passed" and "coverage was never measured" are the
|
|
757
|
+
# same output. Re-running `mvn verify` cannot help -- it takes the same path.
|
|
758
|
+
#
|
|
759
|
+
# The fix is to move the DATA FILE out of the non-ASCII tree, not to ask the user
|
|
760
|
+
# to re-run. `destFile` is what the agent writes and `dataFile` is what the report
|
|
761
|
+
# reads, so both are set, and both point at the SAME per-module name: sharing one
|
|
762
|
+
# file across modules would merge their execution data and make the percentage
|
|
763
|
+
# meaningless (the issue calls this out explicitly).
|
|
764
|
+
#
|
|
765
|
+
# Only when the path is non-ASCII: on a normal path the default
|
|
766
|
+
# `target/jacoco.exec` keeps working, and changing it would move the file every
|
|
767
|
+
# user's tooling expects to find.
|
|
768
|
+
JACOCO_ASCII_ARGS=()
|
|
769
|
+
if printf '%s' "$PWD" | LC_ALL=C grep -q '[^ -~]'; then
|
|
770
|
+
JACOCO_ASCII_DIR="${TMPDIR:-/tmp}/xp-gate-jacoco-$$"
|
|
771
|
+
if mkdir -p "$JACOCO_ASCII_DIR" 2>/dev/null; then
|
|
772
|
+
# `${project.artifactId}` is interpolated by Maven per module, which is what
|
|
773
|
+
# keeps multi-module projects from colliding on one file. A module whose
|
|
774
|
+
# artifactId itself is non-ASCII is the remaining edge; it is reported rather
|
|
775
|
+
# than silently skipped.
|
|
776
|
+
JACOCO_ASCII_ARGS=(
|
|
777
|
+
"-Djacoco.destFile=${JACOCO_ASCII_DIR}/\${project.artifactId}.exec"
|
|
778
|
+
"-Djacoco.dataFile=${JACOCO_ASCII_DIR}/\${project.artifactId}.exec"
|
|
779
|
+
)
|
|
780
|
+
trap 'rm -rf "$JACOCO_ASCII_DIR"' EXIT
|
|
781
|
+
echo " ℹ️ Build path contains non-ASCII characters — JaCoCo data is being written to"
|
|
782
|
+
echo " ${JACOCO_ASCII_DIR} so the agent does not silently skip it (#703)."
|
|
783
|
+
else
|
|
784
|
+
echo " ⚠️ Build path contains non-ASCII characters and ${JACOCO_ASCII_DIR} could not be"
|
|
785
|
+
echo " created; JaCoCo will likely write no execution data and coverage cannot be measured."
|
|
786
|
+
fi
|
|
787
|
+
fi
|
|
788
|
+
|
|
703
789
|
# Run the Gradle suite, optionally filtered with repeated --tests flags.
|
|
704
790
|
#
|
|
705
791
|
# $1..$N simple class names, may be empty
|
|
@@ -848,12 +934,53 @@ run_p3c_check() {
|
|
|
848
934
|
# primary engine: .xp-gate/wc-java-lint-timeout. Degrades safely when
|
|
849
935
|
# `timeout` is unavailable (rc 127 must never be mistaken for a tool verdict).
|
|
850
936
|
_legacy_build_run() {
|
|
937
|
+
local rc=0
|
|
851
938
|
if command -v timeout >/dev/null 2>&1; then
|
|
852
|
-
timeout "$(resolve_wc_java_lint_timeout)" "$@"
|
|
939
|
+
timeout "$(resolve_wc_java_lint_timeout)" "$@" || rc=$?
|
|
853
940
|
else
|
|
854
941
|
echo " ⚠️ 'timeout' command not available - legacy build-tool call runs unguarded" >&2
|
|
855
|
-
"$@"
|
|
942
|
+
"$@" || rc=$?
|
|
943
|
+
fi
|
|
944
|
+
# 127 is the shell's "command not found": the tool never ran, so its exit
|
|
945
|
+
# code is not a verdict about the code (#507).
|
|
946
|
+
#
|
|
947
|
+
# Returns the WARN code, not 0. Every caller funnels this rc into
|
|
948
|
+
# `[ "$rc" -ne 0 ] && worst=1`, which reads 0 as "the check passed" -- so
|
|
949
|
+
# returning 0 here would make "the tool was never installed" indistinguishable
|
|
950
|
+
# from "the code is clean", the exact defect this change exists to remove. It
|
|
951
|
+
# must not return 1 either, because the callers print "violations found" for
|
|
952
|
+
# any non-zero that is not mapped. 3 is the adapter's existing WARN code
|
|
953
|
+
# (`XP_G1_REASON` + `return 3` below), so callers can map it without learning
|
|
954
|
+
# a new vocabulary. Measured: java.sh already returns 3 for a soft downgrade.
|
|
955
|
+
if [ "$rc" -eq 127 ]; then
|
|
956
|
+
echo " ⚠️ legacy build tool not installed - ${1:-?} was never run, so this check did NOT verify the code"
|
|
957
|
+
echo " XP_G1_REASON: legacy build tool missing: ${1:-?}"
|
|
958
|
+
_XP_JAVA_LEGACY_WARN=1
|
|
959
|
+
return 3
|
|
856
960
|
fi
|
|
961
|
+
return "$rc"
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
# Map a legacy-build rc into the violation/warn bookkeeping shared by the
|
|
965
|
+
# p3c and whalecloud paths. Returns the caller's "this is a violation" answer:
|
|
966
|
+
# 0 for a real finding, 1 for a clean run or a WARN-only outcome (which
|
|
967
|
+
# _XP_JAVA_LEGACY_WARN already carries).
|
|
968
|
+
_legacy_build_verdict() {
|
|
969
|
+
local rc="$1"
|
|
970
|
+
# 3 is the WARN sentinel _legacy_build_run returns when the tool is absent:
|
|
971
|
+
# nothing was verified, so it is reported via the flag _legacy_build_run
|
|
972
|
+
# already set, and never treated as a finding.
|
|
973
|
+
# 127 is matched too, belt-and-braces: _legacy_build_run already converts it
|
|
974
|
+
# to 3, so this arm is unreachable today, but a caller that ever invokes the
|
|
975
|
+
# tool directly must still not read "command not found" as a violation.
|
|
976
|
+
if [ "$rc" -eq 3 ] || [ "$rc" -eq 127 ]; then
|
|
977
|
+
_XP_JAVA_LEGACY_WARN=1
|
|
978
|
+
return 1
|
|
979
|
+
fi
|
|
980
|
+
if [ "$rc" -ne 0 ]; then
|
|
981
|
+
return 0
|
|
982
|
+
fi
|
|
983
|
+
return 1
|
|
857
984
|
}
|
|
858
985
|
|
|
859
986
|
_run_p3c_check() {
|
|
@@ -867,7 +994,11 @@ _run_p3c_check() {
|
|
|
867
994
|
# resolves plugins/rulesets over the network, a cold cache must not
|
|
868
995
|
# hang pre-commit unbounded -- #507 Delphi round-1 C-MAJOR-2)
|
|
869
996
|
_legacy_build_run mvn pmd:check -P xp-gate-p3c -Dpmd.failOnViolation=true 2>&1 | tail -30
|
|
870
|
-
|
|
997
|
+
# verdict helper exits 0 for "a real violation" -> the caller blocks on 1.
|
|
998
|
+
if _legacy_build_verdict "${PIPESTATUS[0]}"; then
|
|
999
|
+
return 1
|
|
1000
|
+
fi
|
|
1001
|
+
return 0
|
|
871
1002
|
else
|
|
872
1003
|
# Profile not installed. The inline ruleset paths (/rulesets/java/ali-*)
|
|
873
1004
|
# resolve INSIDE the p3c-pmd jar — without that dependency in the pom,
|
|
@@ -903,7 +1034,11 @@ _run_p3c_check() {
|
|
|
903
1034
|
if grep -q 'xp-gateP3cCheck\|p3c-pmd' build.gradle 2>/dev/null || \
|
|
904
1035
|
grep -q 'xp-gateP3cCheck\|p3c-pmd' build.gradle.kts 2>/dev/null; then
|
|
905
1036
|
_legacy_build_run gradle xp-gateP3cCheck --quiet 2>&1 | tail -20
|
|
906
|
-
|
|
1037
|
+
# verdict helper exits 0 for "a real violation" -> the caller blocks on 1.
|
|
1038
|
+
if _legacy_build_verdict "${PIPESTATUS[0]}"; then
|
|
1039
|
+
return 1
|
|
1040
|
+
fi
|
|
1041
|
+
return 0
|
|
907
1042
|
else
|
|
908
1043
|
echo " ℹ️ p3c-pmd not configured in Gradle build"
|
|
909
1044
|
echo " To enable: bash $PLUGIN_DIR/scripts/install-gradle-p3c.sh"
|
|
@@ -930,7 +1065,11 @@ _run_whalecloud_check() {
|
|
|
930
1065
|
_legacy_build_run mvn pmd:check checkstyle:check spotbugs:check \
|
|
931
1066
|
-P xp-gate-whalecloud-java -Dpmd.failOnViolation=true \
|
|
932
1067
|
2>&1 | tail -30
|
|
933
|
-
|
|
1068
|
+
# verdict helper exits 0 for "a real violation" -> the caller blocks on 1.
|
|
1069
|
+
if _legacy_build_verdict "${PIPESTATUS[0]}"; then
|
|
1070
|
+
return 1
|
|
1071
|
+
fi
|
|
1072
|
+
return 0
|
|
934
1073
|
else
|
|
935
1074
|
echo " ⚠️ whalecloud-java profile not installed in pom.xml"
|
|
936
1075
|
echo " To enable: bash $WHALECLOUD_PLUGIN_DIR/scripts/install-maven-whalecloud.sh"
|
|
@@ -941,7 +1080,11 @@ _run_whalecloud_check() {
|
|
|
941
1080
|
if grep -q 'xp-gateWhalecloudCheck' build.gradle 2>/dev/null || \
|
|
942
1081
|
grep -q 'xp-gateWhalecloudCheck' build.gradle.kts 2>/dev/null; then
|
|
943
1082
|
_legacy_build_run gradle xp-gateWhalecloudCheck --quiet 2>&1 | tail -20
|
|
944
|
-
|
|
1083
|
+
# verdict helper exits 0 for "a real violation" -> the caller blocks on 1.
|
|
1084
|
+
if _legacy_build_verdict "${PIPESTATUS[0]}"; then
|
|
1085
|
+
return 1
|
|
1086
|
+
fi
|
|
1087
|
+
return 0
|
|
945
1088
|
else
|
|
946
1089
|
echo " ⚠️ whalecloud-java not configured in Gradle build"
|
|
947
1090
|
echo " To enable: bash $WHALECLOUD_PLUGIN_DIR/scripts/install-gradle-whalecloud.sh"
|
package/adapters/typescript.sh
CHANGED
|
@@ -81,12 +81,15 @@ _run_local_tool() {
|
|
|
81
81
|
# was asked to detect.
|
|
82
82
|
compiler_check_command() {
|
|
83
83
|
[ -f tsconfig.json ] || return 0
|
|
84
|
+
# --skipLibCheck matches Gate 1's typecheck (lib/typecheck.sh): without it a
|
|
85
|
+
# third-party .d.ts shipped with a TS version newer than the project's is a
|
|
86
|
+
# hard Gate 13 BLOCK on a file the project does not own.
|
|
84
87
|
if [ -x node_modules/.bin/tsc ]; then
|
|
85
|
-
printf "%s" "node_modules/.bin/tsc --noEmit"
|
|
88
|
+
printf "%s" "node_modules/.bin/tsc --noEmit --skipLibCheck"
|
|
86
89
|
return 0
|
|
87
90
|
fi
|
|
88
91
|
if command -v tsc >/dev/null 2>&1; then
|
|
89
|
-
printf "%s" "tsc --noEmit"
|
|
92
|
+
printf "%s" "tsc --noEmit --skipLibCheck"
|
|
90
93
|
return 0
|
|
91
94
|
fi
|
|
92
95
|
# A tsconfig with no tsc anywhere: say nothing, so the gate reports SKIP
|
package/gate-6-layers.sh
CHANGED
|
@@ -43,6 +43,11 @@ set -uo pipefail
|
|
|
43
43
|
LAYER_CONFIG="${XP_GATE_LAYER_CONFIG:-architecture.yaml}"
|
|
44
44
|
LAYER_BASELINE="${XP_GATE_LAYER_BASELINE:-.layer-baseline.json}"
|
|
45
45
|
LAYER_SCAN_ROOT="${XP_GATE_LAYER_SCAN_ROOT:-.}"
|
|
46
|
+
# stderr goes to a FILE, not to /dev/null: an awk syntax or runtime error yields
|
|
47
|
+
# "no findings", and in this script no findings means "everything is compliant".
|
|
48
|
+
# Swallowing it turned a broken scanner into a clean run.
|
|
49
|
+
LAYER_SCAN_ERR="${TMPDIR:-/tmp}/xp-layer-scan-err.$$"
|
|
50
|
+
trap 'rm -f "$LAYER_SCAN_ERR"' EXIT
|
|
46
51
|
|
|
47
52
|
# ─── Output helpers ─────────────────────────────────────────────────────────
|
|
48
53
|
_layers_say() { echo " $*"; }
|
|
@@ -172,7 +177,9 @@ LAYER_TSV=$(awk '
|
|
|
172
177
|
if (indent == layerindent && body ~ /^- /) {
|
|
173
178
|
if (body ~ /^-[ \t]*name:[ \t]*/) {
|
|
174
179
|
flush()
|
|
175
|
-
|
|
180
|
+
# A trailing comment must be stripped too: layer names here often carry
|
|
181
|
+
# `# explanation`, and keeping it makes the name match no path at all.
|
|
182
|
+
name = unq(substr(body, index(body, ":") + 1)); sub(/[ ]+#.*$/, "", name)
|
|
176
183
|
listkey = ""
|
|
177
184
|
}
|
|
178
185
|
# A bare `-` opens a record whose `name:` comes on the next, deeper line; the
|
|
@@ -187,7 +194,10 @@ LAYER_TSV=$(awk '
|
|
|
187
194
|
# naturally. Accepting only one of the two made a correct config parse to an
|
|
188
195
|
# empty pattern list, which then matched no file and reported "0 violations"
|
|
189
196
|
# — the silent-pass shape this gate exists to remove.
|
|
190
|
-
|
|
197
|
+
# Both spellings: `patterns:` is what this repository writes, `paths:` is the
|
|
198
|
+
# synonym some projects use. Accepting only one silently classifies every file
|
|
199
|
+
# as "matches no layer", which reads as "nothing to check".
|
|
200
|
+
else if (body ~ /^(patterns?|paths?):/) { pattern = list_value("pattern", substr(body, index(body, ":") + 1)) }
|
|
191
201
|
else if (body ~ /^allowedImports:/ || body ~ /^allowed_imports:/) { allowed = list_value("allowed", substr(body, index(body, ":") + 1)) }
|
|
192
202
|
else if (body ~ /^forbiddenImports:/ || body ~ /^forbidden_imports:/) { forbidden = list_value("forbidden", substr(body, index(body, ":") + 1)) }
|
|
193
203
|
else if (listkey != "" && body ~ /^- /) { append_item(listkey, body) }
|
|
@@ -234,12 +244,12 @@ LAYER_COUNT=$(printf '%s\n' "$LAYER_TSV" | grep -c . || true)
|
|
|
234
244
|
# Fallback to find for non-git fixtures (the BATS suite uses bare temp dirs).
|
|
235
245
|
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
236
246
|
FILE_LIST=$(git ls-files --cached --others --exclude-standard -- \
|
|
237
|
-
'*.ts' '*.tsx' '*.js' '*.jsx' '*.mjs' '*.cjs' 2>/dev/null \
|
|
247
|
+
'*.ts' '*.tsx' '*.js' '*.jsx' '*.mjs' '*.cjs' '*.java' 2>/dev/null \
|
|
238
248
|
| grep -v '^\.layer-fixture' || true)
|
|
239
249
|
else
|
|
240
250
|
FILE_LIST=$(find "$LAYER_SCAN_ROOT" -type f \
|
|
241
251
|
\( -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx' \
|
|
242
|
-
-o -name '*.mjs' -o -name '*.cjs' \) \
|
|
252
|
+
-o -name '*.mjs' -o -name '*.cjs' -o -name '*.java' \) \
|
|
243
253
|
-not -path '*/node_modules/*' -not -path '*/.git/*' \
|
|
244
254
|
-not -path '*/dist/*' -not -path '*/coverage/*' \
|
|
245
255
|
-not -path '*/.stryker-tmp/*' -not -path '*/.layer-fixture*' 2>/dev/null | sed 's|^\./||')
|
|
@@ -490,8 +500,14 @@ FINDINGS=$(XP_LAYER_TSV="$LAYER_TSV_FILE" XP_LAYER_STATS="$LAYER_STATS_FILE" awk
|
|
|
490
500
|
close(ENVIRON["XP_LAYER_STATS"])
|
|
491
501
|
}
|
|
492
502
|
}
|
|
493
|
-
' $FILE_LIST 2
|
|
503
|
+
' $FILE_LIST 2>"$LAYER_SCAN_ERR")
|
|
494
504
|
rm -f "$LAYER_TSV_FILE"
|
|
505
|
+
# A scanner that wrote to stderr may have produced partial findings, and partial
|
|
506
|
+
# findings here read as "compliant". Say so rather than letting the silence stand.
|
|
507
|
+
if [ -s "$LAYER_SCAN_ERR" ]; then
|
|
508
|
+
_layers_say " ⚠️ the scanner wrote to stderr — findings may be incomplete:"
|
|
509
|
+
sed 's/^/ /' "$LAYER_SCAN_ERR" | head -3
|
|
510
|
+
fi
|
|
495
511
|
|
|
496
512
|
if [ -s "$LAYER_STATS_FILE" ]; then
|
|
497
513
|
read -r LAYER_CLASSIFIED_FILES LAYER_CLASSIFIED < "$LAYER_STATS_FILE" || true
|
package/hooks/gate-6-layers.sh
CHANGED
|
@@ -43,6 +43,11 @@ set -uo pipefail
|
|
|
43
43
|
LAYER_CONFIG="${XP_GATE_LAYER_CONFIG:-architecture.yaml}"
|
|
44
44
|
LAYER_BASELINE="${XP_GATE_LAYER_BASELINE:-.layer-baseline.json}"
|
|
45
45
|
LAYER_SCAN_ROOT="${XP_GATE_LAYER_SCAN_ROOT:-.}"
|
|
46
|
+
# stderr goes to a FILE, not to /dev/null: an awk syntax or runtime error yields
|
|
47
|
+
# "no findings", and in this script no findings means "everything is compliant".
|
|
48
|
+
# Swallowing it turned a broken scanner into a clean run.
|
|
49
|
+
LAYER_SCAN_ERR="${TMPDIR:-/tmp}/xp-layer-scan-err.$$"
|
|
50
|
+
trap 'rm -f "$LAYER_SCAN_ERR"' EXIT
|
|
46
51
|
|
|
47
52
|
# ─── Output helpers ─────────────────────────────────────────────────────────
|
|
48
53
|
_layers_say() { echo " $*"; }
|
|
@@ -172,7 +177,9 @@ LAYER_TSV=$(awk '
|
|
|
172
177
|
if (indent == layerindent && body ~ /^- /) {
|
|
173
178
|
if (body ~ /^-[ \t]*name:[ \t]*/) {
|
|
174
179
|
flush()
|
|
175
|
-
|
|
180
|
+
# A trailing comment must be stripped too: layer names here often carry
|
|
181
|
+
# `# explanation`, and keeping it makes the name match no path at all.
|
|
182
|
+
name = unq(substr(body, index(body, ":") + 1)); sub(/[ ]+#.*$/, "", name)
|
|
176
183
|
listkey = ""
|
|
177
184
|
}
|
|
178
185
|
# A bare `-` opens a record whose `name:` comes on the next, deeper line; the
|
|
@@ -187,7 +194,10 @@ LAYER_TSV=$(awk '
|
|
|
187
194
|
# naturally. Accepting only one of the two made a correct config parse to an
|
|
188
195
|
# empty pattern list, which then matched no file and reported "0 violations"
|
|
189
196
|
# — the silent-pass shape this gate exists to remove.
|
|
190
|
-
|
|
197
|
+
# Both spellings: `patterns:` is what this repository writes, `paths:` is the
|
|
198
|
+
# synonym some projects use. Accepting only one silently classifies every file
|
|
199
|
+
# as "matches no layer", which reads as "nothing to check".
|
|
200
|
+
else if (body ~ /^(patterns?|paths?):/) { pattern = list_value("pattern", substr(body, index(body, ":") + 1)) }
|
|
191
201
|
else if (body ~ /^allowedImports:/ || body ~ /^allowed_imports:/) { allowed = list_value("allowed", substr(body, index(body, ":") + 1)) }
|
|
192
202
|
else if (body ~ /^forbiddenImports:/ || body ~ /^forbidden_imports:/) { forbidden = list_value("forbidden", substr(body, index(body, ":") + 1)) }
|
|
193
203
|
else if (listkey != "" && body ~ /^- /) { append_item(listkey, body) }
|
|
@@ -234,12 +244,12 @@ LAYER_COUNT=$(printf '%s\n' "$LAYER_TSV" | grep -c . || true)
|
|
|
234
244
|
# Fallback to find for non-git fixtures (the BATS suite uses bare temp dirs).
|
|
235
245
|
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
236
246
|
FILE_LIST=$(git ls-files --cached --others --exclude-standard -- \
|
|
237
|
-
'*.ts' '*.tsx' '*.js' '*.jsx' '*.mjs' '*.cjs' 2>/dev/null \
|
|
247
|
+
'*.ts' '*.tsx' '*.js' '*.jsx' '*.mjs' '*.cjs' '*.java' 2>/dev/null \
|
|
238
248
|
| grep -v '^\.layer-fixture' || true)
|
|
239
249
|
else
|
|
240
250
|
FILE_LIST=$(find "$LAYER_SCAN_ROOT" -type f \
|
|
241
251
|
\( -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx' \
|
|
242
|
-
-o -name '*.mjs' -o -name '*.cjs' \) \
|
|
252
|
+
-o -name '*.mjs' -o -name '*.cjs' -o -name '*.java' \) \
|
|
243
253
|
-not -path '*/node_modules/*' -not -path '*/.git/*' \
|
|
244
254
|
-not -path '*/dist/*' -not -path '*/coverage/*' \
|
|
245
255
|
-not -path '*/.stryker-tmp/*' -not -path '*/.layer-fixture*' 2>/dev/null | sed 's|^\./||')
|
|
@@ -490,8 +500,14 @@ FINDINGS=$(XP_LAYER_TSV="$LAYER_TSV_FILE" XP_LAYER_STATS="$LAYER_STATS_FILE" awk
|
|
|
490
500
|
close(ENVIRON["XP_LAYER_STATS"])
|
|
491
501
|
}
|
|
492
502
|
}
|
|
493
|
-
' $FILE_LIST 2
|
|
503
|
+
' $FILE_LIST 2>"$LAYER_SCAN_ERR")
|
|
494
504
|
rm -f "$LAYER_TSV_FILE"
|
|
505
|
+
# A scanner that wrote to stderr may have produced partial findings, and partial
|
|
506
|
+
# findings here read as "compliant". Say so rather than letting the silence stand.
|
|
507
|
+
if [ -s "$LAYER_SCAN_ERR" ]; then
|
|
508
|
+
_layers_say " ⚠️ the scanner wrote to stderr — findings may be incomplete:"
|
|
509
|
+
sed 's/^/ /' "$LAYER_SCAN_ERR" | head -3
|
|
510
|
+
fi
|
|
495
511
|
|
|
496
512
|
if [ -s "$LAYER_STATS_FILE" ]; then
|
|
497
513
|
read -r LAYER_CLASSIFIED_FILES LAYER_CLASSIFIED < "$LAYER_STATS_FILE" || true
|
|
@@ -80,6 +80,14 @@ if [ -n "$MIRROR_STAGED" ] && printf '%s
|
|
|
80
80
|
# mirror for it reported a BLOCK on every doc edit (harmless only because
|
|
81
81
|
# GATE_FAILED was never read -- see below).
|
|
82
82
|
*/AGENTS.md) continue ;;
|
|
83
|
+
# Same reasoning for the other top-level `githooks/*.md` documents
|
|
84
|
+
# (QUALITY-GATES-CODE-OF-CONDUCT.md today). They are DOCUMENTATION: the
|
|
85
|
+
# sync ships the hook SUITE, and no .md file exists under
|
|
86
|
+
# src/npm-package/hooks/. The `githooks/*` catch-all below therefore
|
|
87
|
+
# produced a phantom mirror path, and editing such a document became
|
|
88
|
+
# un-committable. A .md file is never a hook artifact, so the blanket rule
|
|
89
|
+
# must not claim one.
|
|
90
|
+
githooks/*.md) continue ;;
|
|
83
91
|
# `githooks/adapters/` mirrors to `src/npm-package/adapters/`, NOT under
|
|
84
92
|
# `hooks/` -- that is what scripts/check-hook-mirror.sh declares (line 6)
|
|
85
93
|
# and what sync-package-content.js writes. The blanket `githooks/*` rule
|
|
@@ -73,11 +73,11 @@ else
|
|
|
73
73
|
fi
|
|
74
74
|
# #591: drop data/evidence/build-output paths before the scan. Real source
|
|
75
75
|
# extensions are untouched, so this narrows the noise, not the gate.
|
|
76
|
-
JSCPD_SCAN_FILES=
|
|
76
|
+
JSCPD_SCAN_FILES=()
|
|
77
77
|
while IFS= read -r _jf; do
|
|
78
78
|
[ -n "$_jf" ] || continue
|
|
79
79
|
if ! jscpd_is_default_ignored "$_jf"; then
|
|
80
|
-
JSCPD_SCAN_FILES
|
|
80
|
+
JSCPD_SCAN_FILES+=("$_jf")
|
|
81
81
|
fi
|
|
82
82
|
done <<EOF_CHANGED
|
|
83
83
|
$CHANGED_FILES
|
|
@@ -90,7 +90,15 @@ EOF_CHANGED
|
|
|
90
90
|
# a normal scan. The `no_files` branch below cannot catch it: that branch is only
|
|
91
91
|
# reached after jscpd RUNS, and with no argument it runs for minutes before
|
|
92
92
|
# saying anything. Deciding here keeps the cost proportional to the change.
|
|
93
|
-
|
|
93
|
+
#
|
|
94
|
+
# Counted, not string-matched. This list became an ARRAY so a path containing
|
|
95
|
+
# spaces survives intact; `${JSCPD_SCAN_FILES// /}` on an array expands only
|
|
96
|
+
# ELEMENT 0, so it answers "empty" whenever the first entry is blank -- and a
|
|
97
|
+
# blank first entry with real files behind it would skip the scan entirely,
|
|
98
|
+
# silently turning "not checked" into a SKIP. The loop above filters blanks
|
|
99
|
+
# today, which is the only reason that form happened to work; counting the
|
|
100
|
+
# elements does not depend on that invariant holding forever.
|
|
101
|
+
if [ "${#JSCPD_SCAN_FILES[@]}" -eq 0 ]; then
|
|
94
102
|
echo "⏭️ SKIPPED - Duplicate code (no changed file is in jscpd's format set)"
|
|
95
103
|
echo " Decided BEFORE the scan: with no path argument jscpd scans the whole tree."
|
|
96
104
|
GATE_2_STATUS="SKIP"
|
|
@@ -99,8 +107,7 @@ EOF_CHANGED
|
|
|
99
107
|
fi
|
|
100
108
|
JSCPD_OUTPUT=$(mktemp)
|
|
101
109
|
JSCPD_EXIT=0
|
|
102
|
-
|
|
103
|
-
jscpd ${JSCPD_ARGS[@]+"${JSCPD_ARGS[@]}"} $JSCPD_SCAN_FILES > "$JSCPD_OUTPUT" 2>&1 || JSCPD_EXIT=$?
|
|
110
|
+
jscpd ${JSCPD_ARGS[@]+"${JSCPD_ARGS[@]}"} ${JSCPD_SCAN_FILES[@]+"${JSCPD_SCAN_FILES[@]}"} > "$JSCPD_OUTPUT" 2>&1 || JSCPD_EXIT=$?
|
|
104
111
|
head -30 "$JSCPD_OUTPUT" || true
|
|
105
112
|
JSCPD_OUTCOME=$(classify_jscpd_run "$JSCPD_EXIT" "$(cat "$JSCPD_OUTPUT")")
|
|
106
113
|
rm -f "$JSCPD_OUTPUT"
|
|
@@ -280,19 +287,18 @@ GO_LIST
|
|
|
280
287
|
# was replaced by head's (and SIGPIPE under pipefail) — inconsistent with the
|
|
281
288
|
# temp-file treatment the typescript branch already had from #477/#392. The
|
|
282
289
|
# #591 default ignore set applies here too.
|
|
283
|
-
GENERIC_JSCPD_FILES=
|
|
290
|
+
GENERIC_JSCPD_FILES=()
|
|
284
291
|
while IFS= read -r _gf; do
|
|
285
292
|
[ -n "$_gf" ] || continue
|
|
286
293
|
if ! jscpd_is_default_ignored "$_gf"; then
|
|
287
|
-
GENERIC_JSCPD_FILES
|
|
294
|
+
GENERIC_JSCPD_FILES+=("$_gf")
|
|
288
295
|
fi
|
|
289
296
|
done <<EOF_GENERIC
|
|
290
297
|
$SOURCE_FILES
|
|
291
298
|
EOF_GENERIC
|
|
292
|
-
if [
|
|
299
|
+
if [ "${#GENERIC_JSCPD_FILES[@]}" -gt 0 ]; then
|
|
293
300
|
GENERIC_JSCPD_TMP=$(mktemp)
|
|
294
|
-
|
|
295
|
-
jscpd $GENERIC_JSCPD_FILES > "$GENERIC_JSCPD_TMP" 2>&1 || GENERIC_JSCPD_EXIT=$?
|
|
301
|
+
jscpd ${GENERIC_JSCPD_FILES[@]+"${GENERIC_JSCPD_FILES[@]}"} > "$GENERIC_JSCPD_TMP" 2>&1 || GENERIC_JSCPD_EXIT=$?
|
|
296
302
|
head -15 "$GENERIC_JSCPD_TMP" || true
|
|
297
303
|
rm -f "$GENERIC_JSCPD_TMP"
|
|
298
304
|
if [ "${GENERIC_JSCPD_EXIT:-0}" -ne 0 ]; then
|
|
@@ -111,27 +111,57 @@
|
|
|
111
111
|
# toolchain keeps the old fail-closed behaviour rather than gaining a new skip.
|
|
112
112
|
_gate5_language_has_tests() {
|
|
113
113
|
local lang="$1"
|
|
114
|
-
local pattern
|
|
114
|
+
local pattern ext
|
|
115
115
|
case "$lang" in
|
|
116
|
-
csharp) pattern='*.Tests.csproj' ;;
|
|
117
|
-
java) pattern='*Test.java' ;;
|
|
118
|
-
kotlin) pattern='*Test.kt' ;;
|
|
119
|
-
go) pattern='*_test.go' ;;
|
|
120
|
-
python) pattern='test_*.py' ;;
|
|
121
|
-
php) pattern='*Test.php' ;;
|
|
122
|
-
cpp|c) pattern='test_*.cpp' ;;
|
|
123
|
-
dart|flutter) pattern='*_test.dart' ;;
|
|
124
|
-
ruby) pattern='*_spec.rb' ;;
|
|
125
|
-
rust) pattern='*.rs' ;;
|
|
116
|
+
csharp) pattern='*.Tests.csproj'; ext='.cs' ;;
|
|
117
|
+
java) pattern='*Test.java'; ext='.java' ;;
|
|
118
|
+
kotlin) pattern='*Test.kt'; ext='.kt' ;;
|
|
119
|
+
go) pattern='*_test.go'; ext='.go' ;;
|
|
120
|
+
python) pattern='test_*.py'; ext='.py' ;;
|
|
121
|
+
php) pattern='*Test.php'; ext='.php' ;;
|
|
122
|
+
cpp|c) pattern='test_*.cpp'; ext='.cpp' ;;
|
|
123
|
+
dart|flutter) pattern='*_test.dart'; ext='.dart' ;;
|
|
124
|
+
ruby) pattern='*_spec.rb'; ext='.rb' ;;
|
|
125
|
+
rust) pattern='*.rs'; ext='.rs' ;;
|
|
126
126
|
*) return 0 ;;
|
|
127
127
|
esac
|
|
128
128
|
# A language with a known convention: report "no tests" only on positive proof
|
|
129
129
|
# that the find completed AND matched nothing. `find` failing to run is not
|
|
130
130
|
# evidence of absence.
|
|
131
|
+
#
|
|
132
|
+
# Both the naming convention AND the conventional test tree count. Maven and
|
|
133
|
+
# Gradle keep sources under src/test/<lang> regardless of what they are
|
|
134
|
+
# called, and suites like tests/test_sample.kt are named for their subject,
|
|
135
|
+
# not with a Test suffix. Looking only at the suffix answered "no tests" for
|
|
136
|
+
# projects that plainly have them, which SKIPped the coverage floor.
|
|
131
137
|
local found
|
|
132
138
|
found=$(find . -name "$pattern" \
|
|
133
139
|
-not -path './node_modules/*' -not -path './.git/*' \
|
|
134
140
|
-print -quit 2>/dev/null) || return 0
|
|
141
|
+
if [ -z "$found" ]; then
|
|
142
|
+
found=$(find . -name "*${ext}" -path '*/src/test/*' \
|
|
143
|
+
-not -path './node_modules/*' -not -path './.git/*' \
|
|
144
|
+
-not -path './vendor/*' -not -path './third_party/*' \
|
|
145
|
+
-not -path '*/build/*' -not -path '*/target/*' \
|
|
146
|
+
-print -quit 2>/dev/null) || return 0
|
|
147
|
+
fi
|
|
148
|
+
if [ -z "$found" ]; then
|
|
149
|
+
# Anchored to ./tests/, not '*/tests/*': an unanchored match also fires on
|
|
150
|
+
# vendor/<pkg>/tests/, third_party/ and build output, which would answer
|
|
151
|
+
# "this project has tests" from a dependency's tree and defeat the
|
|
152
|
+
# fail-closed coverage floor this probe exists to protect.
|
|
153
|
+
#
|
|
154
|
+
# `find` exits 1 when ./tests does not exist, and that is the COMMON case
|
|
155
|
+
# here -- so this call must NOT reuse the `|| return 0` idiom. That idiom
|
|
156
|
+
# means "the find could not run, so do not conclude absence"; here a
|
|
157
|
+
# missing ./tests IS positive proof of absence, and returning 0 on it
|
|
158
|
+
# reported a testless project as having tests (the exact inversion this
|
|
159
|
+
# helper exists to prevent). Guard the directory instead, so the find only
|
|
160
|
+
# runs when there is something to search.
|
|
161
|
+
if [ -d ./tests ]; then
|
|
162
|
+
found=$(find ./tests -name "*${ext}" -print -quit 2>/dev/null) || return 0
|
|
163
|
+
fi
|
|
164
|
+
fi
|
|
135
165
|
[ -n "$found" ]
|
|
136
166
|
}
|
|
137
167
|
|
|
@@ -679,6 +679,9 @@ CSARCHPROJ
|
|
|
679
679
|
;;
|
|
680
680
|
*)
|
|
681
681
|
echo " ⏭️ SKIPPED - Architecture validation (not configured for $CURRENT_LANG)"
|
|
682
|
+
if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then
|
|
683
|
+
GATE_6_REASON_BY_LANG["$CURRENT_LANG"]="no_archlint_detector"
|
|
684
|
+
fi
|
|
682
685
|
# Append rather than overwrite: languages are walked in config order, so
|
|
683
686
|
# the LAST language with no architecture detector used to replace the
|
|
684
687
|
# reason of a language that HAD one. Measured 2026-11-24: all 14 gate-6
|
|
@@ -37,6 +37,7 @@ HOOK_ADAPTER_TIERS=(
|
|
|
37
37
|
'adapter_flat|ADAPTER_DIR|{name}.sh'
|
|
38
38
|
'adapter_nested|ADAPTER_DIR|adapters/{name}.sh'
|
|
39
39
|
'project_nested|PROJECT_GITHOOKS|adapters/{name}.sh'
|
|
40
|
+
'script_flat|SCRIPT_DIR|{name}.sh'
|
|
40
41
|
'script_nested|SCRIPT_DIR|adapters/{name}.sh'
|
|
41
42
|
)
|
|
42
43
|
|
|
@@ -504,7 +504,15 @@ function validateCoverage(evidence, changedPaths) {
|
|
|
504
504
|
// (it stops an unreviewed FILE) and not a proof.
|
|
505
505
|
const reviewed = evidence.reviewed_paths;
|
|
506
506
|
if (!Array.isArray(reviewed)) {
|
|
507
|
-
|
|
507
|
+
// #902: the message must name a remedy that EXISTS. Before the writer emitted
|
|
508
|
+
// this field, the only actionable statement was "regenerate the evidence", and
|
|
509
|
+
// regenerating produced the same document without it -- so the advice looped.
|
|
510
|
+
fail(
|
|
511
|
+
'reviewed_paths must be an array of the paths this walkthrough read. '
|
|
512
|
+
+ 'Regenerate the walkthrough with `reviewedPaths` set to the files the review '
|
|
513
|
+
+ 'covered (the delphi-review tool takes it as a parameter); listing every changed '
|
|
514
|
+
+ 'path instead defeats the coverage check.',
|
|
515
|
+
);
|
|
508
516
|
}
|
|
509
517
|
// BOTH sides normalised. Stripping `./` from `reviewed_paths` only meant a genuine
|
|
510
518
|
// `./src/x.ts` in the evidence failed to match git's `src/x.ts`, so a covered file was
|
|
@@ -52,6 +52,17 @@ const RESOLUTION_ORDER = Object.freeze([
|
|
|
52
52
|
template: 'adapters/{name}.sh',
|
|
53
53
|
comment: 'Project githooks adapters/',
|
|
54
54
|
}),
|
|
55
|
+
Object.freeze({
|
|
56
|
+
tier_id: 'script_flat',
|
|
57
|
+
base: 'SCRIPT_DIR',
|
|
58
|
+
template: '{name}.sh',
|
|
59
|
+
comment:
|
|
60
|
+
'Adapters shipped beside the hook rather than in an adapters/ subdir ' +
|
|
61
|
+
'(worktrees, fixtures). Ranked BELOW project_nested: the adapter the ' +
|
|
62
|
+
'project declares must not be shadowed by a copy that merely sits beside ' +
|
|
63
|
+
'the running hook. Ranked above script_nested, because a flat sibling is ' +
|
|
64
|
+
"the install's own layout.",
|
|
65
|
+
}),
|
|
55
66
|
Object.freeze({
|
|
56
67
|
tier_id: 'script_nested',
|
|
57
68
|
base: 'SCRIPT_DIR',
|
package/mutation/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SRC/MUTATION KNOWLEDGE BASE
|
|
2
2
|
|
|
3
|
-
Mutation testing for pre-push **Gate M** (plus
|
|
3
|
+
Mutation testing for pre-push **Gate M** (plus the test-layer helper
|
|
4
4
|
consumed by `src/mock-policy/`). Multi-language: one runner per engine, driven
|
|
5
5
|
by the same incremental changed-files contract.
|
|
6
6
|
|
|
@@ -54,10 +54,14 @@ paying to mutate the mutator.
|
|
|
54
54
|
|
|
55
55
|
## TRAPS
|
|
56
56
|
|
|
57
|
-
**
|
|
58
|
-
(
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
**There is no "Gate M2".** Mock-density scanning is a SUB-STEP of Gate 5
|
|
58
|
+
(`gate-5-entry.sh`, advisory at 30%), not a pre-push gate — and it does not live
|
|
59
|
+
here. Several documents used to name a pre-push "Gate M2"; nothing in
|
|
60
|
+
`githooks/gate-registry.sh` ever matched it, and the copy it described was removed.
|
|
61
|
+
|
|
62
|
+
Only `detectTestLayer` lives in this module, and its consumer is
|
|
63
|
+
`src/mock-policy/gate-m3.ts` (Gate ML). Keep that export stable, or the two
|
|
64
|
+
modules start disagreeing about what a file is.
|
|
61
65
|
|
|
62
66
|
**On main/master, Gate M still runs** — only the Delphi code-walkthrough
|
|
63
67
|
validator is skipped. Do not read "pushing to main" as "mutation did not happen".
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boyingliu01/xp-gate",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.74",
|
|
4
4
|
"description": "Deterministic quality gates for AI-generated code: 15 gates, Delphi review, sprint flow. Works with Claude Code, OpenCode, Qoder.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"xp-gate": "bin/xp-gate.js"
|