@boyingliu01/xp-gate 0.38.3 → 0.38.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapters/gate-10.sh +478 -0
- package/adapters/gate-12-file-hygiene.sh +315 -0
- package/adapters/gate-13-compiler-strictness.sh +1443 -0
- package/adapters/gate-6-layers.sh +375 -0
- package/adapters/gate-8.sh +13 -1
- package/adapters/iac.sh +60 -27
- package/adapters/shell.sh +50 -2
- package/build-integrity/gate-10.ts +44 -3
- package/gate-12-file-hygiene.sh +18 -9
- package/gate-8.sh +13 -1
- package/hooks/gate-12-file-hygiene.sh +18 -9
- package/hooks/gate-8.sh +13 -1
- package/hooks/gate-entries/gate-0-entry.sh +15 -2
- package/hooks/gate-entries/gate-1-entry.sh +44 -3
- package/hooks/gate-entries/gate-5-entry.sh +8 -0
- package/hooks/post-commit +9 -0
- package/hooks/pre-push +11 -2
- package/lib/delphi-channel.js +10 -1
- package/lib/mattpocock-license-verdict.json +1 -1
- package/mock-policy/AGENTS.md +1 -1
- package/mutation/AGENTS.md +1 -1
- package/package.json +1 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/bin/xp-gate-version-check.sh +6 -0
- 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/__tests__/verify-sprint-state.test.bats +23 -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/sprint-flow/__tests__/verify-sprint-state.test.bats +23 -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/sprint-flow/__tests__/verify-sprint-state.test.bats +23 -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/sprint-flow/__tests__/verify-sprint-state.test.bats +23 -1
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
- package/principles/AGENTS.md +1 -1
- package/skills/delphi-review/AGENTS.md +1 -1
- package/skills/sprint-flow/AGENTS.md +1 -1
- package/skills/sprint-flow/__tests__/verify-sprint-state.test.bats +23 -1
- package/skills/test-specification-alignment/AGENTS.md +1 -1
package/gate-12-file-hygiene.sh
CHANGED
|
@@ -140,10 +140,11 @@ fi
|
|
|
140
140
|
# Runs in BOTH modes. Docs-only commits read the staged DIFF (hunk cost)
|
|
141
141
|
# instead of every full blob — a marker line must be ADDED to matter, so
|
|
142
142
|
# '^+' minus '+++' headers is the precise scope.
|
|
143
|
+
# Exactly 7 chars + a space/EOL boundary: longer runs (Maven `====` log separators, RST/setext underlines) are not conflicts.
|
|
143
144
|
CONFLICT_MARKER_FILES=""
|
|
144
145
|
if [ "${GATE_12_DOCS_ONLY:-false}" = true ]; then
|
|
145
146
|
if git diff --cached --no-color --diff-filter=d 2>/dev/null \
|
|
146
|
-
| grep -E '^\+' | grep -v '^+++' | grep -qE '^\+(
|
|
147
|
+
| grep -E '^\+' | grep -v '^+++' | grep -qE '^\+(<{7}|={7}|>{7})([[:space:]]|$)'; then
|
|
147
148
|
CONFLICT_MARKER_FILES="$STAGED_FILES"
|
|
148
149
|
fi
|
|
149
150
|
else
|
|
@@ -154,7 +155,7 @@ while IFS= read -r file; do
|
|
|
154
155
|
continue
|
|
155
156
|
fi
|
|
156
157
|
# Check for conflict markers in staged content
|
|
157
|
-
if git show ":$file" 2>/dev/null | grep -qE '^(
|
|
158
|
+
if git show ":$file" 2>/dev/null | grep -qE '^(<{7}|={7}|>{7})([[:space:]]|$)'; then
|
|
158
159
|
CONFLICT_MARKER_FILES="$CONFLICT_MARKER_FILES $file"
|
|
159
160
|
fi
|
|
160
161
|
done <<EOF
|
|
@@ -198,7 +199,15 @@ fi
|
|
|
198
199
|
|
|
199
200
|
# --- Check 5: YAML/JSON syntax validation (Issue #351) ---
|
|
200
201
|
# Only check staged YAML/JSON files that have changes
|
|
201
|
-
|
|
202
|
+
#
|
|
203
|
+
# #772: these were accumulated into a space-separated STRING and re-split with an
|
|
204
|
+
# unquoted `for f in $YAML_JSON_ERRORS`. Parser messages contain spaces, so one
|
|
205
|
+
# broken file printed as a run of fake "filenames" -- PyYAML's
|
|
206
|
+
# "while parsing a flow sequence" became five entries. The list under
|
|
207
|
+
# "YAML/JSON syntax errors:" reads as the set of files to go fix, so the split
|
|
208
|
+
# sent the reader hunting for files that do not exist. Arrays keep each entry
|
|
209
|
+
# whole no matter what the message contains.
|
|
210
|
+
YAML_JSON_ERRORS=()
|
|
202
211
|
YAML_JSON_CHECK_COUNT=0
|
|
203
212
|
|
|
204
213
|
# Detect available validators
|
|
@@ -240,7 +249,7 @@ except Exception:
|
|
|
240
249
|
pass
|
|
241
250
|
" 2>&1)
|
|
242
251
|
if [ $? -ne 0 ] && [ -n "$YAML_ERROR" ]; then
|
|
243
|
-
YAML_JSON_ERRORS
|
|
252
|
+
YAML_JSON_ERRORS+=("$file(yaml:$YAML_ERROR)")
|
|
244
253
|
fi
|
|
245
254
|
fi
|
|
246
255
|
;;
|
|
@@ -251,12 +260,12 @@ except Exception:
|
|
|
251
260
|
let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{JSON.parse(d)}catch(e){console.log(e.message.split('\\n')[0]);process.exit(1)}})
|
|
252
261
|
" 2>&1)
|
|
253
262
|
if [ $? -ne 0 ] && [ -n "$JSON_ERROR" ]; then
|
|
254
|
-
YAML_JSON_ERRORS
|
|
263
|
+
YAML_JSON_ERRORS+=("$file(json:$JSON_ERROR)")
|
|
255
264
|
fi
|
|
256
265
|
elif [ "$JSON_CMD" = "jq" ]; then
|
|
257
266
|
JSON_ERROR=$(git show ":$file" 2>/dev/null | jq empty 2>&1)
|
|
258
267
|
if [ $? -ne 0 ] && [ -n "$JSON_ERROR" ]; then
|
|
259
|
-
YAML_JSON_ERRORS
|
|
268
|
+
YAML_JSON_ERRORS+=("$file(json:syntax error)")
|
|
260
269
|
fi
|
|
261
270
|
fi
|
|
262
271
|
;;
|
|
@@ -265,9 +274,9 @@ done <<EOF
|
|
|
265
274
|
$CHANGED_YAML_JSON
|
|
266
275
|
EOF
|
|
267
276
|
|
|
268
|
-
if [
|
|
277
|
+
if [ "${#YAML_JSON_ERRORS[@]}" -gt 0 ]; then
|
|
269
278
|
echo " ❌ YAML/JSON syntax errors:"
|
|
270
|
-
for f in $YAML_JSON_ERRORS; do
|
|
279
|
+
for f in "${YAML_JSON_ERRORS[@]}"; do
|
|
271
280
|
echo " - $f"
|
|
272
281
|
done
|
|
273
282
|
HYGIENE_ISSUES=$((HYGIENE_ISSUES + 1))
|
|
@@ -288,7 +297,7 @@ if [ "$HYGIENE_ISSUES" -eq 0 ]; then
|
|
|
288
297
|
GATE_12_STATUS="PASS"
|
|
289
298
|
else
|
|
290
299
|
# Hard blocks: conflict markers + YAML/JSON syntax errors
|
|
291
|
-
if [ -n "$CONFLICT_MARKER_FILES" ] || [
|
|
300
|
+
if [ -n "$CONFLICT_MARKER_FILES" ] || [ "${#YAML_JSON_ERRORS[@]}" -gt 0 ]; then
|
|
292
301
|
echo ""
|
|
293
302
|
echo "❌ BLOCKED - File hygiene violations must be fixed before commit."
|
|
294
303
|
GATE_12_STATUS="BLOCK"
|
package/gate-8.sh
CHANGED
|
@@ -348,7 +348,19 @@ if command -v detect-secrets-hook >/dev/null 2>&1 && [ -f ".secrets.baseline" ];
|
|
|
348
348
|
fi
|
|
349
349
|
# Temp cleanup is owned by the gate8_cleanup trap; no rm here.
|
|
350
350
|
else
|
|
351
|
-
|
|
351
|
+
# #793: this branch used to blame the tool unconditionally. Both "the hook is
|
|
352
|
+
# not installed" and "the baseline file is missing" land here, so a repo with
|
|
353
|
+
# detect-secrets 1.5.52 on PATH was told to run `pip install -e ".[dev]"` --
|
|
354
|
+
# correct-looking advice that changes nothing, while the file actually missing
|
|
355
|
+
# (the committed `.secrets.baseline`) was never named. The two have different
|
|
356
|
+
# remedies and only one of them is an install, so they are split here.
|
|
357
|
+
if command -v detect-secrets-hook >/dev/null 2>&1; then
|
|
358
|
+
echo " ⚠️ detect-secrets-hook is installed but .secrets.baseline is missing."
|
|
359
|
+
echo " Generate it once with: detect-secrets scan > .secrets.baseline"
|
|
360
|
+
echo " (gitleaks still ran.)"
|
|
361
|
+
else
|
|
362
|
+
echo " ⚠️ detect-secrets-hook unavailable (install: pip install -e \".[dev]\") — gitleaks only."
|
|
363
|
+
fi
|
|
352
364
|
fi
|
|
353
365
|
|
|
354
366
|
record_gate_audit "gate-8" "secret-scanning" "$GATE_8_STATUS" "0" "$GATE_8_START"
|
|
@@ -140,10 +140,11 @@ fi
|
|
|
140
140
|
# Runs in BOTH modes. Docs-only commits read the staged DIFF (hunk cost)
|
|
141
141
|
# instead of every full blob — a marker line must be ADDED to matter, so
|
|
142
142
|
# '^+' minus '+++' headers is the precise scope.
|
|
143
|
+
# Exactly 7 chars + a space/EOL boundary: longer runs (Maven `====` log separators, RST/setext underlines) are not conflicts.
|
|
143
144
|
CONFLICT_MARKER_FILES=""
|
|
144
145
|
if [ "${GATE_12_DOCS_ONLY:-false}" = true ]; then
|
|
145
146
|
if git diff --cached --no-color --diff-filter=d 2>/dev/null \
|
|
146
|
-
| grep -E '^\+' | grep -v '^+++' | grep -qE '^\+(
|
|
147
|
+
| grep -E '^\+' | grep -v '^+++' | grep -qE '^\+(<{7}|={7}|>{7})([[:space:]]|$)'; then
|
|
147
148
|
CONFLICT_MARKER_FILES="$STAGED_FILES"
|
|
148
149
|
fi
|
|
149
150
|
else
|
|
@@ -154,7 +155,7 @@ while IFS= read -r file; do
|
|
|
154
155
|
continue
|
|
155
156
|
fi
|
|
156
157
|
# Check for conflict markers in staged content
|
|
157
|
-
if git show ":$file" 2>/dev/null | grep -qE '^(
|
|
158
|
+
if git show ":$file" 2>/dev/null | grep -qE '^(<{7}|={7}|>{7})([[:space:]]|$)'; then
|
|
158
159
|
CONFLICT_MARKER_FILES="$CONFLICT_MARKER_FILES $file"
|
|
159
160
|
fi
|
|
160
161
|
done <<EOF
|
|
@@ -198,7 +199,15 @@ fi
|
|
|
198
199
|
|
|
199
200
|
# --- Check 5: YAML/JSON syntax validation (Issue #351) ---
|
|
200
201
|
# Only check staged YAML/JSON files that have changes
|
|
201
|
-
|
|
202
|
+
#
|
|
203
|
+
# #772: these were accumulated into a space-separated STRING and re-split with an
|
|
204
|
+
# unquoted `for f in $YAML_JSON_ERRORS`. Parser messages contain spaces, so one
|
|
205
|
+
# broken file printed as a run of fake "filenames" -- PyYAML's
|
|
206
|
+
# "while parsing a flow sequence" became five entries. The list under
|
|
207
|
+
# "YAML/JSON syntax errors:" reads as the set of files to go fix, so the split
|
|
208
|
+
# sent the reader hunting for files that do not exist. Arrays keep each entry
|
|
209
|
+
# whole no matter what the message contains.
|
|
210
|
+
YAML_JSON_ERRORS=()
|
|
202
211
|
YAML_JSON_CHECK_COUNT=0
|
|
203
212
|
|
|
204
213
|
# Detect available validators
|
|
@@ -240,7 +249,7 @@ except Exception:
|
|
|
240
249
|
pass
|
|
241
250
|
" 2>&1)
|
|
242
251
|
if [ $? -ne 0 ] && [ -n "$YAML_ERROR" ]; then
|
|
243
|
-
YAML_JSON_ERRORS
|
|
252
|
+
YAML_JSON_ERRORS+=("$file(yaml:$YAML_ERROR)")
|
|
244
253
|
fi
|
|
245
254
|
fi
|
|
246
255
|
;;
|
|
@@ -251,12 +260,12 @@ except Exception:
|
|
|
251
260
|
let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{JSON.parse(d)}catch(e){console.log(e.message.split('\\n')[0]);process.exit(1)}})
|
|
252
261
|
" 2>&1)
|
|
253
262
|
if [ $? -ne 0 ] && [ -n "$JSON_ERROR" ]; then
|
|
254
|
-
YAML_JSON_ERRORS
|
|
263
|
+
YAML_JSON_ERRORS+=("$file(json:$JSON_ERROR)")
|
|
255
264
|
fi
|
|
256
265
|
elif [ "$JSON_CMD" = "jq" ]; then
|
|
257
266
|
JSON_ERROR=$(git show ":$file" 2>/dev/null | jq empty 2>&1)
|
|
258
267
|
if [ $? -ne 0 ] && [ -n "$JSON_ERROR" ]; then
|
|
259
|
-
YAML_JSON_ERRORS
|
|
268
|
+
YAML_JSON_ERRORS+=("$file(json:syntax error)")
|
|
260
269
|
fi
|
|
261
270
|
fi
|
|
262
271
|
;;
|
|
@@ -265,9 +274,9 @@ done <<EOF
|
|
|
265
274
|
$CHANGED_YAML_JSON
|
|
266
275
|
EOF
|
|
267
276
|
|
|
268
|
-
if [
|
|
277
|
+
if [ "${#YAML_JSON_ERRORS[@]}" -gt 0 ]; then
|
|
269
278
|
echo " ❌ YAML/JSON syntax errors:"
|
|
270
|
-
for f in $YAML_JSON_ERRORS; do
|
|
279
|
+
for f in "${YAML_JSON_ERRORS[@]}"; do
|
|
271
280
|
echo " - $f"
|
|
272
281
|
done
|
|
273
282
|
HYGIENE_ISSUES=$((HYGIENE_ISSUES + 1))
|
|
@@ -288,7 +297,7 @@ if [ "$HYGIENE_ISSUES" -eq 0 ]; then
|
|
|
288
297
|
GATE_12_STATUS="PASS"
|
|
289
298
|
else
|
|
290
299
|
# Hard blocks: conflict markers + YAML/JSON syntax errors
|
|
291
|
-
if [ -n "$CONFLICT_MARKER_FILES" ] || [
|
|
300
|
+
if [ -n "$CONFLICT_MARKER_FILES" ] || [ "${#YAML_JSON_ERRORS[@]}" -gt 0 ]; then
|
|
292
301
|
echo ""
|
|
293
302
|
echo "❌ BLOCKED - File hygiene violations must be fixed before commit."
|
|
294
303
|
GATE_12_STATUS="BLOCK"
|
package/hooks/gate-8.sh
CHANGED
|
@@ -348,7 +348,19 @@ if command -v detect-secrets-hook >/dev/null 2>&1 && [ -f ".secrets.baseline" ];
|
|
|
348
348
|
fi
|
|
349
349
|
# Temp cleanup is owned by the gate8_cleanup trap; no rm here.
|
|
350
350
|
else
|
|
351
|
-
|
|
351
|
+
# #793: this branch used to blame the tool unconditionally. Both "the hook is
|
|
352
|
+
# not installed" and "the baseline file is missing" land here, so a repo with
|
|
353
|
+
# detect-secrets 1.5.52 on PATH was told to run `pip install -e ".[dev]"` --
|
|
354
|
+
# correct-looking advice that changes nothing, while the file actually missing
|
|
355
|
+
# (the committed `.secrets.baseline`) was never named. The two have different
|
|
356
|
+
# remedies and only one of them is an install, so they are split here.
|
|
357
|
+
if command -v detect-secrets-hook >/dev/null 2>&1; then
|
|
358
|
+
echo " ⚠️ detect-secrets-hook is installed but .secrets.baseline is missing."
|
|
359
|
+
echo " Generate it once with: detect-secrets scan > .secrets.baseline"
|
|
360
|
+
echo " (gitleaks still ran.)"
|
|
361
|
+
else
|
|
362
|
+
echo " ⚠️ detect-secrets-hook unavailable (install: pip install -e \".[dev]\") — gitleaks only."
|
|
363
|
+
fi
|
|
352
364
|
fi
|
|
353
365
|
|
|
354
366
|
record_gate_audit "gate-8" "secret-scanning" "$GATE_8_STATUS" "0" "$GATE_8_START"
|
|
@@ -17,6 +17,20 @@
|
|
|
17
17
|
# on - there is no copy left in the hook.
|
|
18
18
|
# ============================================================================
|
|
19
19
|
|
|
20
|
+
# #809: Windows caps one env var at 32767 chars. A large merge's staged list can
|
|
21
|
+
# exceed that; exporting it then makes Windows-native children (pytest+syrupy
|
|
22
|
+
# restoring os.environ) raise ValueError, which Gate 5 misreads as Tests FAILED.
|
|
23
|
+
# XP_STAGED_ACM is only the #640 fork cache and every consumer falls back to
|
|
24
|
+
# `git diff --cached` when it is unset -- so export only when it fits, else drop.
|
|
25
|
+
export_staged_acm_cache() {
|
|
26
|
+
if [ "${#1}" -le 32767 ]; then
|
|
27
|
+
XP_STAGED_ACM="$1"
|
|
28
|
+
export XP_STAGED_ACM
|
|
29
|
+
else
|
|
30
|
+
unset XP_STAGED_ACM
|
|
31
|
+
fi
|
|
32
|
+
}
|
|
33
|
+
|
|
20
34
|
# ============================================================================
|
|
21
35
|
# Gate 0: Version Consistency Check (Protected Branches)
|
|
22
36
|
# ============================================================================
|
|
@@ -88,8 +102,7 @@ has_changelog_change=false
|
|
|
88
102
|
# A cache that is only warm on some branches is not a cache, it is a branch-wide
|
|
89
103
|
# behaviour difference. Assign it before anything can branch.
|
|
90
104
|
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
|
|
91
|
-
|
|
92
|
-
export XP_STAGED_ACM
|
|
105
|
+
export_staged_acm_cache "$STAGED_FILES"
|
|
93
106
|
|
|
94
107
|
if [ "$is_protected" = "true" ]; then
|
|
95
108
|
# Env var bypass: SKIP_VERSION_CHECK=1 skips Gate 0 entirely
|
|
@@ -22,6 +22,32 @@
|
|
|
22
22
|
# Combination of: Old Gates 1 (Static), Gate 2 (Linting), Gate 5 (Shell Check)
|
|
23
23
|
# v0.14.3+ (Issue #312): Skip if no code files changed
|
|
24
24
|
# ============================================================================
|
|
25
|
+
# Select the CHANGED files that the shell arm must lint, one per line.
|
|
26
|
+
#
|
|
27
|
+
# A file is a shell script when its name ends in .sh/.bash, OR when its first
|
|
28
|
+
# line carries a bash/sh shebang. The shebang arm is what reaches `pre-commit`,
|
|
29
|
+
# `pre-push`, `post-commit` and `post-merge`: they have no extension and are the
|
|
30
|
+
# largest shell programs in this repository, so the previous extension-only
|
|
31
|
+
# filter (`grep '\.sh$'`) made them structurally exempt from the gate. The same
|
|
32
|
+
# rule is implemented in githooks/adapters/shell.sh -- keep the two in step.
|
|
33
|
+
#
|
|
34
|
+
# Only files that exist in the work tree are returned: a deleted file cannot be
|
|
35
|
+
# linted, and passing it to shellcheck would turn a deletion into a failure.
|
|
36
|
+
_shell_changed_files() {
|
|
37
|
+
local f first
|
|
38
|
+
for f in $CHANGED_FILES; do
|
|
39
|
+
[ -f "$f" ] || continue
|
|
40
|
+
case "$f" in
|
|
41
|
+
*.sh|*.bash) echo "$f"; continue ;;
|
|
42
|
+
esac
|
|
43
|
+
# No shell extension: accept only a shell shebang on line 1.
|
|
44
|
+
first="$(sed -n '1p' "$f" 2>/dev/null || true)"
|
|
45
|
+
case "$first" in
|
|
46
|
+
'#!'*bash*|'#!'*'/sh'|'#!'*' sh'|'#!'*'env sh'*) echo "$f" ;;
|
|
47
|
+
esac
|
|
48
|
+
done
|
|
49
|
+
}
|
|
50
|
+
|
|
25
51
|
# Gate body. `return` is used instead of `exit` so the driver decides to
|
|
26
52
|
# stop: see scripts/wrap-gate-entries.cjs for why the two are equivalent
|
|
27
53
|
# here, and why sub-shell exits are deliberately left as `exit`.
|
|
@@ -241,8 +267,16 @@ else
|
|
|
241
267
|
# scripts/check-no-npx-probe.sh fails the build if the npx rung returns.
|
|
242
268
|
BIOME_ARGV=(biome)
|
|
243
269
|
fi
|
|
244
|
-
#
|
|
245
|
-
|
|
270
|
+
# Quoted expansion. The array holds exactly one path token (either the
|
|
271
|
+
# bare word `biome` or an absolute node_modules path), and that path can
|
|
272
|
+
# contain spaces -- a project checked out under "C:/My Projects/..." is
|
|
273
|
+
# ordinary on Windows. Unquoted, `${BIOME_ARGV[@]}` re-splits it into
|
|
274
|
+
# several arguments, so biome would be invoked as a different command and
|
|
275
|
+
# exit 127; the 127 branch below reads that as "biome absent" and SKIPs.
|
|
276
|
+
# The old `disable=SC2086 # may hold a multi-token form` was inaccurate:
|
|
277
|
+
# every assignment site above sets a single element or an empty array,
|
|
278
|
+
# so no multi-token form exists to protect.
|
|
279
|
+
BIOME_OUT=$(cd "$TS_PROJECT_DIR" && "${BIOME_ARGV[@]}" check --staged . 2>&1)
|
|
246
280
|
BIOME_STATUS=$?
|
|
247
281
|
if [ "$BIOME_STATUS" -eq 127 ]; then
|
|
248
282
|
# 127 is the shell's own "command not found": biome is genuinely absent.
|
|
@@ -524,7 +558,14 @@ else
|
|
|
524
558
|
shell)
|
|
525
559
|
# Shell: check staged shell files only. Installed hook adapters are infrastructure,
|
|
526
560
|
# not project changes, and should not be linted on unrelated commits.
|
|
527
|
-
|
|
561
|
+
#
|
|
562
|
+
# The filter used to be `grep '\.sh$'`, which cannot match the extensionless
|
|
563
|
+
# hooks -- `pre-commit`, `pre-push`, `post-commit`, `post-merge` -- and those are
|
|
564
|
+
# the two largest shell programs in this repository. A file that cannot enter the
|
|
565
|
+
# gate cannot fail it, so the biggest shell code in the repo was structurally
|
|
566
|
+
# exempt. Same rule as githooks/adapters/shell.sh: a .sh/.bash name, OR a shell
|
|
567
|
+
# shebang on the first line for the extensionless cases.
|
|
568
|
+
SHELL_FILES="$(_shell_changed_files)"
|
|
528
569
|
|
|
529
570
|
if [ -z "$SHELL_FILES" ]; then
|
|
530
571
|
echo "✅ PASSED - No staged shell scripts to check."
|
|
@@ -322,6 +322,14 @@ else
|
|
|
322
322
|
"${dir}/__tests__/${filename}.spec.${ext}"
|
|
323
323
|
"tests/${filename}.test.${ext}"
|
|
324
324
|
"tests/${filename}.spec.${ext}"
|
|
325
|
+
# #787: `test/` (singular) is as conventional as `tests/` (plural), and
|
|
326
|
+
# both live in the wild -- Jest silently accepts either, so a repo that
|
|
327
|
+
# picked the singular spelling was hard-BLOCKED on a file whose test was
|
|
328
|
+
# right there. The asymmetry made it read like a user error: identical
|
|
329
|
+
# content under tests/ passed, and only the path spelling decided the
|
|
330
|
+
# verdict, so "did you mean tests/" was not actionable advice.
|
|
331
|
+
"test/${filename}.test.${ext}"
|
|
332
|
+
"test/${filename}.spec.${ext}"
|
|
325
333
|
)
|
|
326
334
|
|
|
327
335
|
for pattern in "${patterns[@]}"; do
|
package/hooks/post-commit
CHANGED
|
@@ -38,6 +38,15 @@ head_commit="$(git rev-parse HEAD 2>/dev/null || true)"
|
|
|
38
38
|
if [ -n "$toplevel" ] && [ -n "$head_commit" ] \
|
|
39
39
|
&& [ -f "$toplevel/src/npm-package/lib/gate-audit.ts" ]; then
|
|
40
40
|
_pending="$toplevel/.xp-gate/audit.pending.jsonl"
|
|
41
|
+
# #810: `_flush` used to be defined ONLY inside the two tool branches below,
|
|
42
|
+
# while the drain loop at the bottom called it unconditionally. On a machine
|
|
43
|
+
# whose PATH carries neither node nor npx -- which is exactly when the audit
|
|
44
|
+
# cannot be flushed at all -- every commit (including each replayed commit of
|
|
45
|
+
# a rebase) printed `_flush: command not found` to stderr and silently lost
|
|
46
|
+
# the audit rows. The default makes "no usable runtime" an ordinary zero-row
|
|
47
|
+
# result instead of an error: the loop then exits after its two empty passes,
|
|
48
|
+
# which is the same observable behaviour as a flush that found nothing.
|
|
49
|
+
_flush() { echo 0; }
|
|
41
50
|
if [ -f "$toplevel/node_modules/tsx/dist/cli.mjs" ] && command -v node >/dev/null 2>&1; then
|
|
42
51
|
_flush() {
|
|
43
52
|
node "$toplevel/node_modules/tsx/dist/cli.mjs" \
|
package/hooks/pre-push
CHANGED
|
@@ -657,13 +657,18 @@ GATE_M_SKIP_KIND=""
|
|
|
657
657
|
# copy of the order.
|
|
658
658
|
HOOK_RESOLUTION_FILE="$SCRIPT_DIR/hook-module-resolution.sh"
|
|
659
659
|
|
|
660
|
+
# The `shellcheck source=` directive belongs in front of the whole `if`, not in
|
|
661
|
+
# front of one `elif` branch. ShellCheck can only attach a directive to a
|
|
662
|
+
# complete compound command; placed inside the branch it made the analyser
|
|
663
|
+
# abandon this `if` and every line after it -- 3 parse errors (SC1073/SC1123/
|
|
664
|
+
# SC1072) and ~990 lines of this hook that were never checked at all.
|
|
665
|
+
# shellcheck source=githooks/hook-module-resolution.sh
|
|
660
666
|
if [ ! -f "$HOOK_RESOLUTION_FILE" ]; then
|
|
661
667
|
echo "⚠️ hook-module-resolution.sh not found at $HOOK_RESOLUTION_FILE"
|
|
662
668
|
echo " Run: xp-gate init (or reinstall the hooks)"
|
|
663
669
|
echo "⚠️ Could not resolve adapter-common.sh. SKIP — Gate M."
|
|
664
670
|
GATE_M_SKIP_REASON="hook-module-resolution.sh not found: $HOOK_RESOLUTION_FILE"
|
|
665
671
|
GATE_M_SKIP_KIND="missing"
|
|
666
|
-
# shellcheck source=githooks/hook-module-resolution.sh
|
|
667
672
|
elif ! source "$HOOK_RESOLUTION_FILE" 2>/dev/null; then
|
|
668
673
|
echo "⚠️ hook-module-resolution.sh is corrupt: $HOOK_RESOLUTION_FILE"
|
|
669
674
|
echo " Run: node scripts/generate-hook-resolution.cjs (or reinstall)"
|
|
@@ -1189,7 +1194,11 @@ else
|
|
|
1189
1194
|
# silently LOWER the density and weaken Gate M2. Equivalence with the old
|
|
1190
1195
|
# loop was verified on 40 real test files plus overlap/edge fixtures (0
|
|
1191
1196
|
# mismatches).
|
|
1192
|
-
local
|
|
1197
|
+
# NOT `local`: this block runs at top level (inside a `for`, not a
|
|
1198
|
+
# function), where `local` is invalid (SC2168) -- bash prints
|
|
1199
|
+
# "local: can only be used in a function" and returns non-zero on every
|
|
1200
|
+
# iteration. The four names are file-scoped and each is assigned before
|
|
1201
|
+
# use below, so dropping the declaration changes no behaviour.
|
|
1193
1202
|
_mock_content="$(cat "$test_file" 2>/dev/null)" || _mock_content=""
|
|
1194
1203
|
MOCK_COUNT=0
|
|
1195
1204
|
for _mock_kw in "jest.mock" "vi.mock" "jest.spyOn" "vi.spyOn" "jest.fn" "vi.fn" \
|
package/lib/delphi-channel.js
CHANGED
|
@@ -89,7 +89,16 @@ function normaliseChannels(raw) {
|
|
|
89
89
|
* @returns {{ config?: object, error?: string }}
|
|
90
90
|
*/
|
|
91
91
|
function readMachineConfig(home) {
|
|
92
|
-
|
|
92
|
+
// Resolve through HOME first, exactly like shared-paths' resolveHomeDir().
|
|
93
|
+
// `os.homedir()` DELIBERATELY ignores process.env.HOME on Windows (it reads
|
|
94
|
+
// USERPROFILE instead -- measured: pointing HOME at a temp dir leaves
|
|
95
|
+
// os.homedir() unchanged), so a caller that sandboxed a test by setting HOME
|
|
96
|
+
// still read the developer's REAL ~/.config here. That made a real machine's
|
|
97
|
+
// `channels: ["external"]` leak into tests: nativeEnabled went false, Qoder
|
|
98
|
+
// deployment was skipped, and three assertions failed for a reason unrelated
|
|
99
|
+
// to the code under test. Same precedence as shared-paths keeps ONE answer to
|
|
100
|
+
// "where is home" in this package.
|
|
101
|
+
const root = home || process.env.HOME || process.env.USERPROFILE || os.homedir();
|
|
93
102
|
const file = path.join(root, '.config', 'xp-gate', '.delphi-config.json');
|
|
94
103
|
if (!fs.existsSync(file)) return {};
|
|
95
104
|
try {
|
package/mock-policy/AGENTS.md
CHANGED
|
@@ -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.5.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Mock layering policy enforcement — Gate M3 of pre-push hook. Ensures integration tests use real implementations for internal dependencies, mock external dependencies, and annotate pending mocks with removal plans. Combines project scope scanning, mock decision engine, and per-file validation into a single pipeline.
|
package/mutation/AGENTS.md
CHANGED
|
@@ -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.5.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
**Gate M** (incremental mutation testing) + **Gate M2** helpers (test-layer detection used by `src/mock-policy/`). Pre-push quality gate. TypeScript-only; uses Stryker.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.5",
|
|
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": {
|
|
@@ -19,6 +19,12 @@ flock -n 200 2>/dev/null || exit 0 # another instance is already checking
|
|
|
19
19
|
|
|
20
20
|
# ── Check cache validity ──
|
|
21
21
|
if [[ -f "$CACHE_FILE" ]]; then
|
|
22
|
+
# CACHED_VERSION is read but not consulted: only the timestamp drives the TTL.
|
|
23
|
+
# It must stay in this `read`, because the cache file is written as
|
|
24
|
+
# `<remote-version> <epoch>` below and the FIRST field is the version. Dropping
|
|
25
|
+
# it would bind the version string to CACHED_TS, making the arithmetic below
|
|
26
|
+
# compare against a number that is not a timestamp.
|
|
27
|
+
# shellcheck disable=SC2034 # positional read: field 1 is the cache format
|
|
22
28
|
read -r CACHED_VERSION CACHED_TS < "$CACHE_FILE" 2>/dev/null || true
|
|
23
29
|
NOW=$(date +%s 2>/dev/null || echo 0)
|
|
24
30
|
if [[ -n "$CACHED_TS" && -n "$NOW" ]]; then
|
|
@@ -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.5.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.5.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, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|
|
@@ -10,7 +10,23 @@
|
|
|
10
10
|
# 错就一起绿。只有让生产方真的产出、校验方真的读,才能发现这类偏差。
|
|
11
11
|
|
|
12
12
|
setup() {
|
|
13
|
-
|
|
13
|
+
# #814: this used to be a hard-coded `../../..`, which resolves to the repo
|
|
14
|
+
# root only for THIS copy (skills/sprint-flow/__tests__). The same file also
|
|
15
|
+
# ships under plugins/<p>/skills/ and src/npm-package/**/skills/, three and four
|
|
16
|
+
# levels deep, where the fixed depth points at plugins/claude-code or
|
|
17
|
+
# src/npm-package -- so 6 of the 7 copies failed under Gate 5 and, once this
|
|
18
|
+
# repo's own hooks are installed, made every commit impossible.
|
|
19
|
+
#
|
|
20
|
+
# Walk up until the markers of the repo are both present instead of counting
|
|
21
|
+
# `..`. Depth-counting is what broke: it encodes "where this file lives" into a
|
|
22
|
+
# constant, and every new mirror location re-breaks it.
|
|
23
|
+
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME" && pwd)"
|
|
24
|
+
while [ "$REPO_ROOT" != "/" ] && [ -n "$REPO_ROOT" ]; do
|
|
25
|
+
if [ -f "$REPO_ROOT/VERSION" ] && [ -f "$REPO_ROOT/src/npm-package/bin/xp-gate.js" ]; then
|
|
26
|
+
break
|
|
27
|
+
fi
|
|
28
|
+
REPO_ROOT="$(dirname "$REPO_ROOT")"
|
|
29
|
+
done
|
|
14
30
|
VERIFY="$REPO_ROOT/skills/sprint-flow/scripts/verify-sprint-state.sh"
|
|
15
31
|
CLI="$REPO_ROOT/src/npm-package/bin/xp-gate.js"
|
|
16
32
|
WORK="$(mktemp -d)"
|
|
@@ -23,6 +39,12 @@ teardown() {
|
|
|
23
39
|
@test "AC-688-01: accepts state written by xp-gate sprint-init" {
|
|
24
40
|
cd "$WORK"
|
|
25
41
|
git init -q .
|
|
42
|
+
# The developer machine sets a GLOBAL core.hooksPath at the installed hooks, so
|
|
43
|
+
# a bare `git commit` in the fixture would run the whole gate suite instead of
|
|
44
|
+
# creating the fixture commit. Pin it to an empty dir: this suite tests the
|
|
45
|
+
# verify script, not the hook chain.
|
|
46
|
+
mkdir -p "$WORK/empty-hooks"
|
|
47
|
+
git config core.hooksPath "$WORK/empty-hooks"
|
|
26
48
|
echo '{}' > package.json
|
|
27
49
|
git add -A
|
|
28
50
|
git -c user.email=t@t -c user.name=t commit -q -m init
|
|
@@ -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.5.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.5",
|
|
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.5.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.5.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, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|
|
@@ -10,7 +10,23 @@
|
|
|
10
10
|
# 错就一起绿。只有让生产方真的产出、校验方真的读,才能发现这类偏差。
|
|
11
11
|
|
|
12
12
|
setup() {
|
|
13
|
-
|
|
13
|
+
# #814: this used to be a hard-coded `../../..`, which resolves to the repo
|
|
14
|
+
# root only for THIS copy (skills/sprint-flow/__tests__). The same file also
|
|
15
|
+
# ships under plugins/<p>/skills/ and src/npm-package/**/skills/, three and four
|
|
16
|
+
# levels deep, where the fixed depth points at plugins/claude-code or
|
|
17
|
+
# src/npm-package -- so 6 of the 7 copies failed under Gate 5 and, once this
|
|
18
|
+
# repo's own hooks are installed, made every commit impossible.
|
|
19
|
+
#
|
|
20
|
+
# Walk up until the markers of the repo are both present instead of counting
|
|
21
|
+
# `..`. Depth-counting is what broke: it encodes "where this file lives" into a
|
|
22
|
+
# constant, and every new mirror location re-breaks it.
|
|
23
|
+
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME" && pwd)"
|
|
24
|
+
while [ "$REPO_ROOT" != "/" ] && [ -n "$REPO_ROOT" ]; do
|
|
25
|
+
if [ -f "$REPO_ROOT/VERSION" ] && [ -f "$REPO_ROOT/src/npm-package/bin/xp-gate.js" ]; then
|
|
26
|
+
break
|
|
27
|
+
fi
|
|
28
|
+
REPO_ROOT="$(dirname "$REPO_ROOT")"
|
|
29
|
+
done
|
|
14
30
|
VERIFY="$REPO_ROOT/skills/sprint-flow/scripts/verify-sprint-state.sh"
|
|
15
31
|
CLI="$REPO_ROOT/src/npm-package/bin/xp-gate.js"
|
|
16
32
|
WORK="$(mktemp -d)"
|
|
@@ -23,6 +39,12 @@ teardown() {
|
|
|
23
39
|
@test "AC-688-01: accepts state written by xp-gate sprint-init" {
|
|
24
40
|
cd "$WORK"
|
|
25
41
|
git init -q .
|
|
42
|
+
# The developer machine sets a GLOBAL core.hooksPath at the installed hooks, so
|
|
43
|
+
# a bare `git commit` in the fixture would run the whole gate suite instead of
|
|
44
|
+
# creating the fixture commit. Pin it to an empty dir: this suite tests the
|
|
45
|
+
# verify script, not the hook chain.
|
|
46
|
+
mkdir -p "$WORK/empty-hooks"
|
|
47
|
+
git config core.hooksPath "$WORK/empty-hooks"
|
|
26
48
|
echo '{}' > package.json
|
|
27
49
|
git add -A
|
|
28
50
|
git -c user.email=t@t -c user.name=t commit -q -m init
|
|
@@ -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.5.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.5.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.5.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, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|