@boyingliu01/xp-gate 0.38.19 → 0.38.21
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 +169 -2
- package/adapters/gate-3.sh +24 -0
- package/adapters/gate-7.sh +21 -2
- package/hooks/gate-entries/gate-5-entry.sh +52 -16
- package/hooks/lib/gate-5c-alignment.sh +9 -0
- 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/lib/hooks.d.ts +4 -2
- package/plugins/dsh/lib/hooks.d.ts.map +1 -1
- package/plugins/dsh/lib/hooks.js +30 -7
- 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/dsh/src/hooks.test.ts +42 -0
- package/plugins/dsh/src/hooks.ts +30 -7
- 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/gate-10.sh
CHANGED
|
@@ -91,6 +91,125 @@ case "${XP_GATE_SASTD:-direct}" in
|
|
|
91
91
|
;;
|
|
92
92
|
esac
|
|
93
93
|
|
|
94
|
+
# ============================================================================
|
|
95
|
+
# SEMGREP RULESET CACHE
|
|
96
|
+
#
|
|
97
|
+
# `--config=p/security-audit` is a REGISTRY name: semgrep fetches the ruleset
|
|
98
|
+
# from semgrep.dev on every invocation. Nothing local is reused (~/.semgrep is
|
|
99
|
+
# settings only), so the gate waits on the network on every commit.
|
|
100
|
+
#
|
|
101
|
+
# Measured over the 420 gate-10 rows in .xp-gate/audit.jsonl:
|
|
102
|
+
# p10 314 ms | p50 10231 ms | p90 180118 ms | mean 43620 ms
|
|
103
|
+
# 243 runs <= 15 s, but 106 over 60 s and 42 at the 180 s timeout.
|
|
104
|
+
# The distribution is bimodal and the long half is not analysis. ABBA on this
|
|
105
|
+
# machine, one small file, alternating arms:
|
|
106
|
+
# A registry, network up : 5498 ms / 5370 ms (spread 2.4%)
|
|
107
|
+
# B registry, network DOWN : 108926 ms / 108791 ms (spread 0.1%)
|
|
108
|
+
# A 20x effect with near-zero within-arm spread. The 109 s is urllib3 retry
|
|
109
|
+
# backoff (MaxRetryError) against semgrep.dev, not scanning.
|
|
110
|
+
#
|
|
111
|
+
# Fetching the ruleset ONCE and passing the FILE removes the network entirely:
|
|
112
|
+
# local file, network up : 5578 ms
|
|
113
|
+
# local file, network DOWN : 5754 ms
|
|
114
|
+
# So the offline case drops 109 s -> 5.8 s, the online case is unchanged within
|
|
115
|
+
# noise, and verdicts are identical (a command-injection file reports 1 finding
|
|
116
|
+
# either way).
|
|
117
|
+
#
|
|
118
|
+
# The ruleset is a plain YAML document served at https://semgrep.dev/c/<name>
|
|
119
|
+
# (measured: 492566 bytes for p/security-audit).
|
|
120
|
+
#
|
|
121
|
+
# STALENESS IS THE RISK, and it is handled explicitly rather than ignored:
|
|
122
|
+
# - a cache younger than XP_GATE_SEMGREP_RULES_TTL_H (default 168 = 7 days) is
|
|
123
|
+
# used as-is;
|
|
124
|
+
# - an older cache is refreshed, and if the refresh fails the stale copy is
|
|
125
|
+
# still used BUT the gate announces it, because "checked with week-old rules"
|
|
126
|
+
# and "checked with current rules" are different claims and the operator has
|
|
127
|
+
# to be able to tell them apart;
|
|
128
|
+
# - no cache and no network falls back to the registry NAME so semgrep fails on
|
|
129
|
+
# its own terms and the existing runtime-error arm reports SKIP. A gate that
|
|
130
|
+
# cannot load rules must never PASS.
|
|
131
|
+
#
|
|
132
|
+
# The cache only ever holds a fetched document. It is not a place to hand-edit a
|
|
133
|
+
# ruleset and then be graded against it.
|
|
134
|
+
# @@RULES-RESOLVER-START@@
|
|
135
|
+
gate10_rules_cache_dir() {
|
|
136
|
+
printf '%s' "${XP_GATE_SEMGREP_RULES_DIR:-${XDG_CACHE_HOME:-$HOME/.cache}/xp-gate/semgrep-rules}"
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
# Download one registry ruleset to a file. Returns non-zero on any failure so the
|
|
140
|
+
# caller can decide, rather than leaving a truncated file behind that semgrep
|
|
141
|
+
# would reject as an unparseable config.
|
|
142
|
+
gate10_download() {
|
|
143
|
+
local ruleset="$1" dest="$2" url tmp
|
|
144
|
+
# p/security-audit -> https://semgrep.dev/c/p/security-audit
|
|
145
|
+
url="https://semgrep.dev/c/${ruleset}"
|
|
146
|
+
tmp="${dest}.part.$$"
|
|
147
|
+
if command -v curl >/dev/null 2>&1; then
|
|
148
|
+
# --fail so an HTTP error is a non-zero exit instead of an HTML body written
|
|
149
|
+
# to a file named .yml. Bounded timeouts: an unreachable registry must cost
|
|
150
|
+
# seconds, not the 109 s urllib3 backoff this whole block exists to avoid.
|
|
151
|
+
curl -fsS --max-time 30 --connect-timeout 10 -o "$tmp" "$url" 2>/dev/null || { rm -f "$tmp"; return 1; }
|
|
152
|
+
elif command -v wget >/dev/null 2>&1; then
|
|
153
|
+
wget -q -T 30 -O "$tmp" "$url" 2>/dev/null || { rm -f "$tmp"; return 1; }
|
|
154
|
+
else
|
|
155
|
+
return 1
|
|
156
|
+
fi
|
|
157
|
+
# A ruleset is a YAML document whose top level is a `rules:` list. Validate
|
|
158
|
+
# before installing, so a captive-portal page can never become the ruleset.
|
|
159
|
+
if [ ! -s "$tmp" ] || ! grep -q '^rules:' "$tmp" 2>/dev/null; then
|
|
160
|
+
rm -f "$tmp"
|
|
161
|
+
return 1
|
|
162
|
+
fi
|
|
163
|
+
mv -f "$tmp" "$dest" 2>/dev/null || { rm -f "$tmp"; return 1; }
|
|
164
|
+
return 0
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
# Resolve a registry name to a local file when possible.
|
|
168
|
+
#
|
|
169
|
+
# Prints the path to use for --config. Falls back to the registry name itself
|
|
170
|
+
# when no usable cache exists, which keeps semgrep's own diagnostics intact.
|
|
171
|
+
gate10_resolve_ruleset() {
|
|
172
|
+
local ruleset="$1" dir file ttl now age_days
|
|
173
|
+
dir=$(gate10_rules_cache_dir)
|
|
174
|
+
# Registry names contain '/', so flatten them: p/security-audit ->
|
|
175
|
+
# p__security-audit.yml. A flat name keeps the cache portable and greppable.
|
|
176
|
+
file="$dir/$(printf '%s' "$ruleset" | tr '/' '_').yml"
|
|
177
|
+
ttl="${XP_GATE_SEMGREP_RULES_TTL_H:-168}"
|
|
178
|
+
|
|
179
|
+
if [ -f "$file" ]; then
|
|
180
|
+
now=$(date +%s)
|
|
181
|
+
local mtime
|
|
182
|
+
mtime=$(stat -c %Y "$file" 2>/dev/null || stat -f %m "$file" 2>/dev/null || echo 0)
|
|
183
|
+
age_days=$(( (now - mtime) / 86400 ))
|
|
184
|
+
if [ "$mtime" -gt 0 ] && [ "$age_days" -lt "$ttl" ]; then
|
|
185
|
+
printf '%s' "$file"
|
|
186
|
+
return 0
|
|
187
|
+
fi
|
|
188
|
+
# Stale: try to refresh, and fall back to the stale copy with a warning.
|
|
189
|
+
if gate10_download "$ruleset" "$file" 2>/dev/null; then
|
|
190
|
+
printf '%s' "$file"
|
|
191
|
+
return 0
|
|
192
|
+
fi
|
|
193
|
+
echo " ⚠️ semgrep ruleset cache is ${age_days}d old and could not be refreshed;" >&2
|
|
194
|
+
echo " scanning with the cached ruleset (${file##*/})." >&2
|
|
195
|
+
printf '%s' "$file"
|
|
196
|
+
return 0
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
# No cache: fetch once. This is the only path that pays a network round trip,
|
|
200
|
+
# and it happens once per TTL rather than once per commit.
|
|
201
|
+
if mkdir -p "$dir" 2>/dev/null && gate10_download "$ruleset" "$file" 2>/dev/null; then
|
|
202
|
+
printf '%s' "$file"
|
|
203
|
+
return 0
|
|
204
|
+
fi
|
|
205
|
+
|
|
206
|
+
# Nothing local and nothing fetchable: hand the registry name back so semgrep
|
|
207
|
+
# fails visibly and the runtime-error arm reports SKIP with its own output.
|
|
208
|
+
printf '%s' "$ruleset"
|
|
209
|
+
return 0
|
|
210
|
+
}
|
|
211
|
+
# @@RULES-RESOLVER-END@@
|
|
212
|
+
|
|
94
213
|
# Semgrep availability check
|
|
95
214
|
SEMGREP_CMD=""
|
|
96
215
|
if command -v semgrep >/dev/null 2>&1; then
|
|
@@ -241,10 +360,13 @@ EOF
|
|
|
241
360
|
# identical "filter looks like coverage" defect this issue removed from
|
|
242
361
|
# Gate 4. p/csharp is loaded IN ADDITION so the security-audit rules still
|
|
243
362
|
# cover the other languages in a mixed commit.
|
|
244
|
-
|
|
363
|
+
# Resolved through the cache above: a local FILE when one is available, else
|
|
364
|
+
# the registry name so semgrep fails on its own terms. Measured effect on the
|
|
365
|
+
# unreachable-registry case is 109 s -> 5.8 s.
|
|
366
|
+
SEMGREP_RULES=(--config="$(gate10_resolve_ruleset "p/security-audit")")
|
|
245
367
|
if printf '%s
|
|
246
368
|
' "$SEMGREP_FILES" | grep -qE ".cs$"; then
|
|
247
|
-
SEMGREP_RULES+=(--config=p/csharp)
|
|
369
|
+
SEMGREP_RULES+=(--config="$(gate10_resolve_ruleset "p/csharp")")
|
|
248
370
|
fi
|
|
249
371
|
SEMGREP_TIMEOUT_S="${XP_GATE_SEMGREP_TIMEOUT:-180}"
|
|
250
372
|
SEMGREP_TIMED_OUT=false
|
|
@@ -424,6 +546,51 @@ console.log("");});
|
|
|
424
546
|
# shellcheck disable=SC2034
|
|
425
547
|
GATE_10_REASON="output_unparseable"
|
|
426
548
|
fi
|
|
549
|
+
elif [ "${V_RESULTS:-0}" -eq 0 ] && printf '%s\n' "${SEMGREP_OUTPUT:-}" | grep -qi 'No code rules to run'; then
|
|
550
|
+
# A scan that loaded NO RULES reports results:[] and errors:[] -- a legal,
|
|
551
|
+
# successful, empty report, which is exactly what the PASS arm below is
|
|
552
|
+
# meant for. semgrep says so on stderr, and it is the only signal that
|
|
553
|
+
# separates this from a real clean scan:
|
|
554
|
+
#
|
|
555
|
+
# rules: [] -> "No code rules to run."
|
|
556
|
+
# p/security-audit -> "with 225 Code rules:"
|
|
557
|
+
#
|
|
558
|
+
# TWO EARLIER DRAFTS OF THIS CHECK WERE WRONG, and both are recorded
|
|
559
|
+
# because each one looked reasonable:
|
|
560
|
+
#
|
|
561
|
+
# 1. time.rules. That is semgrep's per-rule PROFILING list, empty on every
|
|
562
|
+
# healthy run -- a 225-rule scan reports time.rules:[]. Guarding on it
|
|
563
|
+
# would have turned every good scan into a SKIP.
|
|
564
|
+
# 2. paths.scanned == 0. Right for the empty-ruleset case, but it ALSO
|
|
565
|
+
# fires when the changed files are deliberately suppressed through
|
|
566
|
+
# .semgrepignore: measured, AC-543-02 went red because a legitimate
|
|
567
|
+
# "this file is ignored" result was reported as "nothing was examined".
|
|
568
|
+
# Deliberate suppression is a decision, not a failure.
|
|
569
|
+
#
|
|
570
|
+
# The stderr message has neither problem: it reports the rule count, which
|
|
571
|
+
# is the thing that actually distinguishes "could not load a ruleset" from
|
|
572
|
+
# "loaded a ruleset and it had nothing to say".
|
|
573
|
+
#
|
|
574
|
+
# Findings take precedence (V_RESULTS -eq 0 is required). If semgrep DID
|
|
575
|
+
# report something, it obviously ran, and the blocking arm must see it.
|
|
576
|
+
#
|
|
577
|
+
# #717 already found this shape once, in one language: p/security-audit
|
|
578
|
+
# carries no C# rules, so a .cs file with a textbook SQL injection scored 0.
|
|
579
|
+
# That was fixed by adding a second --config; the SHAPE -- clean because
|
|
580
|
+
# nothing was loaded -- stayed reachable for every other cause (registry
|
|
581
|
+
# unreachable mid-scan, an empty cached ruleset, a bad --config path).
|
|
582
|
+
#
|
|
583
|
+
# A security gate reporting "clean" because it loaded nothing is the
|
|
584
|
+
# failure the fail-closed convention exists to prevent, so this SKIPs with
|
|
585
|
+
# its own reason rather than folding into the clean-scan PASS.
|
|
586
|
+
echo " ⚠️ semgrep loaded no code rules — nothing was checked, so this is not a clean result"
|
|
587
|
+
echo " The ruleset was empty or could not be resolved. Try:"
|
|
588
|
+
echo " semgrep --config=p/security-audit <file>"
|
|
589
|
+
echo " ⏭️ SKIPPED - SAST (no rules loaded, nothing verified)"
|
|
590
|
+
GATE_10_STATUS="SKIP"
|
|
591
|
+
# Consumed by the sourcing parent (pre-commit report JSON), not here.
|
|
592
|
+
# shellcheck disable=SC2034
|
|
593
|
+
GATE_10_REASON="zero_rules"
|
|
427
594
|
elif [ "$V_RESULTS" -eq 0 ] && { [ "$V_ERRORS" -gt 0 ] || [ "$SEMGREP_EXIT" -ne 0 ]; }; then
|
|
428
595
|
# Nothing was scanned to a verdict: semgrep either failed outright
|
|
429
596
|
# (nonzero exit) or completed but reported scan errors for every input
|
package/adapters/gate-3.sh
CHANGED
|
@@ -547,6 +547,19 @@ CC_POP_EOF
|
|
|
547
547
|
RATCHET_VERDICT=$(printf '%s\n' "$CC_CSV" | evaluate_ccn_ratchet ".ccn-baseline.json")
|
|
548
548
|
CC_VIOLATIONS=$(printf '%s\n' "$RATCHET_VERDICT" | grep -c '^BLOCK ' || true)
|
|
549
549
|
CC_LOWER=$(printf '%s\n' "$RATCHET_VERDICT" | grep -c '^LOWER ' || true)
|
|
550
|
+
# #683 landed on the flat-threshold arm below and not here. The library
|
|
551
|
+
# emits a third kind of line -- UNVERIFIED -- for "no parsable CCN row at
|
|
552
|
+
# all", and this arm counted only BLOCK lines. An UNVERIFIED verdict
|
|
553
|
+
# therefore arrived as CC_VIOLATIONS=0 and took the PASS branch:
|
|
554
|
+
#
|
|
555
|
+
# UNVERIFIED no parsable CCN row (lizard produced no measurable function)
|
|
556
|
+
# ✅ PASSED - Complexity within ratchet baseline.
|
|
557
|
+
#
|
|
558
|
+
# Measured live in this repo: both lines came from one run, with
|
|
559
|
+
# issues_found=0 in the journal. The library's own comment states the
|
|
560
|
+
# rule this branch was breaking -- "'unverified' means never 'clean'".
|
|
561
|
+
# The ratchet cannot claim a verdict over rows it could not read.
|
|
562
|
+
CC_UNVERIFIED=$(printf '%s\n' "$RATCHET_VERDICT" | grep -c '^UNVERIFIED' || true)
|
|
550
563
|
printf '%s\n' "$RATCHET_VERDICT" | grep -v '^OK ' || true
|
|
551
564
|
if [ "${CC_LOWER:-0}" -gt 0 ]; then
|
|
552
565
|
echo "ℹ️ $CC_LOWER function(s) improved below baseline — refresh with: node scripts/ccn-report.cjs --write-baseline"
|
|
@@ -557,6 +570,17 @@ CC_POP_EOF
|
|
|
557
570
|
echo "❌ BLOCKED - $CC_VIOLATIONS function(s) violate the complexity ratchet (.ccn-baseline.json)."
|
|
558
571
|
echo "Revert the increase, or refactor; refresh the baseline only via ccn-baseline-refresh commits."
|
|
559
572
|
exit 1
|
|
573
|
+
elif [ "${CC_UNVERIFIED:-0}" -gt 0 ]; then
|
|
574
|
+
# WARN, not BLOCK: a tool that could not answer is an environment
|
|
575
|
+
# fault, and the convention for a missing tool is SKIP/WARN. What it
|
|
576
|
+
# must not be is a pass.
|
|
577
|
+
echo "⚠️ WARN - complexity ratchet could not grade the change set; nothing was verified."
|
|
578
|
+
echo " Run 'npx lizard --csv <files>' by hand to see why the rows are missing."
|
|
579
|
+
GATE_3_STATUS="WARN"
|
|
580
|
+
# Consumed by the sourcing parent (pre-commit report JSON), not here.
|
|
581
|
+
# shellcheck disable=SC2034
|
|
582
|
+
GATE_3_REASON="ratchet_no_parsable_rows"
|
|
583
|
+
GATE_3_DETAIL="mode=ratchet unverified=1"
|
|
560
584
|
else
|
|
561
585
|
echo "✅ PASSED - Complexity within ratchet baseline."
|
|
562
586
|
GATE_3_STATUS="PASS"
|
package/adapters/gate-7.sh
CHANGED
|
@@ -15,6 +15,9 @@ IAC_FILES=$(git diff --cached --name-only --diff-filter=ACM 2>/dev/null | grep -
|
|
|
15
15
|
# Consumed by the sourcing parent, not here (see #548).
|
|
16
16
|
# shellcheck disable=SC2034
|
|
17
17
|
GATE_7_SCANNED_FILES=0
|
|
18
|
+
# Initialised here, not only inside the adapter branch: the journal line at the
|
|
19
|
+
# bottom runs on EVERY path, and an unset variable there is an error under set -u.
|
|
20
|
+
IAC_ISSUE_COUNT=0
|
|
18
21
|
if [ -z "$IAC_FILES" ]; then
|
|
19
22
|
# #800: "nothing to scan" must never be rendered as "scanned and clean".
|
|
20
23
|
# This branch used to print PASSED and set GATE_7_STATUS=PASS, while the report
|
|
@@ -59,13 +62,27 @@ else
|
|
|
59
62
|
if [ $IAC_EXIT -eq 0 ]; then
|
|
60
63
|
echo "✅ PASSED - IaC security scan."
|
|
61
64
|
GATE_7_STATUS="PASS"
|
|
65
|
+
IAC_ISSUE_COUNT=0
|
|
62
66
|
else
|
|
63
67
|
echo ""
|
|
64
68
|
echo "❌ BLOCKED - IaC security issues detected"
|
|
65
69
|
echo "Fix the security issues above before committing."
|
|
66
70
|
echo "Tip: Install checkov for comprehensive IaC scanning: pip install checkov"
|
|
67
71
|
GATE_7_STATUS="FAIL"
|
|
68
|
-
|
|
72
|
+
# Counted from the adapter's own output instead of the hardcoded 0 this
|
|
73
|
+
# gate used to journal on every path, including the blocked one.
|
|
74
|
+
IAC_ISSUE_COUNT=$(printf '%s\n' "$IAC_OUTPUT" | grep -cE '^[[:space:]]*(❌|FAIL|ERROR|Critical|HIGH)' || true)
|
|
75
|
+
# The journal line must be reached ON THIS PATH, and the single call site at
|
|
76
|
+
# the bottom of the file is not reached: sourcing this file means `return 1`
|
|
77
|
+
# leaves before the bottom. The earlier `exit 1` had the same effect for a
|
|
78
|
+
# different reason. Measured by driving the arm with a stubbed recorder and
|
|
79
|
+
# a failing adapter: no AUDIT row at all, on the one outcome an operator
|
|
80
|
+
# most needs to find in the journal.
|
|
81
|
+
#
|
|
82
|
+
# So record here, then `return` -- not `exit` -- so the driver keeps its
|
|
83
|
+
# single exit point and the EXIT trap fires with the same status.
|
|
84
|
+
record_gate_audit "gate-7" "iac-security" "$GATE_7_STATUS" "${IAC_ISSUE_COUNT:-0}" "$GATE_7_START"
|
|
85
|
+
return 1
|
|
69
86
|
fi
|
|
70
87
|
else
|
|
71
88
|
echo "ℹ️ SKIP - IaC adapter not found"
|
|
@@ -73,4 +90,6 @@ else
|
|
|
73
90
|
GATE_7_STATUS="SKIP"
|
|
74
91
|
fi
|
|
75
92
|
fi
|
|
76
|
-
|
|
93
|
+
# The single exit point for the journal, reached on every path now that the
|
|
94
|
+
# blocked arm returns instead of exiting.
|
|
95
|
+
record_gate_audit "gate-7" "iac-security" "$GATE_7_STATUS" "${IAC_ISSUE_COUNT:-0}" "$GATE_7_START"
|
|
@@ -258,25 +258,40 @@ else
|
|
|
258
258
|
fi
|
|
259
259
|
done <<< "$STAGED_TEST_FILES"
|
|
260
260
|
|
|
261
|
-
# --- deleted test files: WARN ---
|
|
262
|
-
DELETED_LIST=$(mktemp 2>/dev/null || echo "${TMPDIR:-/tmp}/xp-deleted-$$")
|
|
263
|
-
ADDED_LIST=$(mktemp 2>/dev/null || echo "${TMPDIR:-/tmp}/xp-added-$$")
|
|
264
|
-
# Routed through the same filter as every other staged-file scan (#649):
|
|
265
|
-
# a deleted/added file under node_modules/ or vendor/ is not project code,
|
|
266
|
-
# and treating it as one reports deletions that mean nothing.
|
|
267
|
-
git diff --cached --name-only --diff-filter=D 2>/dev/null | filter_project_paths > "$DELETED_LIST" || true
|
|
268
|
-
git diff --cached --name-only --diff-filter=A 2>/dev/null | filter_project_paths > "$ADDED_LIST" || true
|
|
269
|
-
GATE_5_DELETED_TESTS=$(classify_deleted_tests "$DELETED_LIST" "$ADDED_LIST" || true)
|
|
270
|
-
rm -f "$DELETED_LIST" "$ADDED_LIST"
|
|
271
|
-
if [ -n "$GATE_5_DELETED_TESTS" ]; then
|
|
272
|
-
echo "⚠️ WARN - test file(s) deleted with no same-named replacement:"
|
|
273
|
-
printf '%s\n' "$GATE_5_DELETED_TESTS" | sed 's/^/ /'
|
|
274
|
-
echo " Deleting a test removes the safety net (指南 §9.5). If the code is"
|
|
275
|
-
echo " genuinely gone, say so in the commit body; otherwise restore it."
|
|
276
|
-
fi
|
|
277
261
|
fi
|
|
278
262
|
fi
|
|
279
263
|
|
|
264
|
+
# --- deleted test files: WARN ---
|
|
265
|
+
#
|
|
266
|
+
# OUTSIDE the STAGED_TEST_FILES guard, deliberately. That list is built with
|
|
267
|
+
# `--diff-filter=ACM`, so it can never contain a deleted file, and a commit
|
|
268
|
+
# that ONLY deletes tests -- the one case this warning exists for -- skipped
|
|
269
|
+
# the scan entirely. Measured before this fix: staging nothing but the removal
|
|
270
|
+
# of a committed test printed "Gate 5: 2124ms (skipped - no code changes)" and
|
|
271
|
+
# SKIP(no_code_files_changed), with no mention of the deletion. That reason was
|
|
272
|
+
# not false, which is what made it dangerous: the journal showed a gate
|
|
273
|
+
# standing down for a benign cause while the safety net had disappeared.
|
|
274
|
+
#
|
|
275
|
+
# Guarded on the FUNCTION rather than on the change set: an empty deletion list
|
|
276
|
+
# is the normal case, a missing classifier is not.
|
|
277
|
+
if declare -f classify_deleted_tests >/dev/null 2>&1; then
|
|
278
|
+
DELETED_LIST=$(mktemp 2>/dev/null || echo "${TMPDIR:-/tmp}/xp-deleted-$$")
|
|
279
|
+
ADDED_LIST=$(mktemp 2>/dev/null || echo "${TMPDIR:-/tmp}/xp-added-$$")
|
|
280
|
+
# Routed through the same filter as every other staged-file scan (#649):
|
|
281
|
+
# a deleted/added file under node_modules/ or vendor/ is not project code,
|
|
282
|
+
# and treating it as one reports deletions that mean nothing.
|
|
283
|
+
git diff --cached --name-only --diff-filter=D 2>/dev/null | filter_project_paths > "$DELETED_LIST" || true
|
|
284
|
+
git diff --cached --name-only --diff-filter=A 2>/dev/null | filter_project_paths > "$ADDED_LIST" || true
|
|
285
|
+
GATE_5_DELETED_TESTS=$(classify_deleted_tests "$DELETED_LIST" "$ADDED_LIST" || true)
|
|
286
|
+
rm -f "$DELETED_LIST" "$ADDED_LIST"
|
|
287
|
+
if [ -n "$GATE_5_DELETED_TESTS" ]; then
|
|
288
|
+
echo "⚠️ WARN - test file(s) deleted with no same-named replacement:"
|
|
289
|
+
printf '%s\n' "$GATE_5_DELETED_TESTS" | sed 's/^/ /'
|
|
290
|
+
echo " Deleting a test removes the safety net (指南 §9.5). If the code is"
|
|
291
|
+
echo " genuinely gone, say so in the commit body; otherwise restore it."
|
|
292
|
+
fi
|
|
293
|
+
fi
|
|
294
|
+
|
|
280
295
|
if [ "$GATE_5_FOCUS_BLOCKED" -gt 0 ]; then
|
|
281
296
|
echo ""
|
|
282
297
|
echo "❌ BLOCKED - Gate 5: $GATE_5_FOCUS_BLOCKED test-hygiene violation(s) (see above)."
|
|
@@ -1946,6 +1961,27 @@ else
|
|
|
1946
1961
|
GATE_5_COVERAGE_APPLIES_TO="project"
|
|
1947
1962
|
fi
|
|
1948
1963
|
|
|
1964
|
+
# Gate 5c computes a verdict on every path and, until now, NOTHING read it.
|
|
1965
|
+
# Measured: grep -rn GATE_5C_STATUS across pre-commit, gate-driver and lib/*.sh
|
|
1966
|
+
# returned no matches outside the checker itself. The BLOCK arm was still
|
|
1967
|
+
# effective (gate_5c_alignment returns 1 and this body does `|| return 1`), but
|
|
1968
|
+
# the two SKIP arms printed a reason to the console and the audit row -- which
|
|
1969
|
+
# records GATE_5_DETAIL, a variable 5c never set -- could not distinguish
|
|
1970
|
+
# "alignment ran and was clean" from "alignment never ran".
|
|
1971
|
+
#
|
|
1972
|
+
# The verdict is folded into the detail rather than into GATE_5_STATUS because
|
|
1973
|
+
# 5c is a SUB-check: a sub-check that could not run does not make the tests and
|
|
1974
|
+
# coverage it sits beside unmeasured, and promoting SKIP over a PASS earned by
|
|
1975
|
+
# a real test run would trade one wrong record for another. What must survive
|
|
1976
|
+
# is the REASON, and it is prefixed so a reader can tell which sub-check it
|
|
1977
|
+
# came from.
|
|
1978
|
+
if [ -n "${GATE_5C_STATUS:-}" ] && [ -z "${GATE_5_DETAIL:-}" ]; then
|
|
1979
|
+
case "$GATE_5C_STATUS" in
|
|
1980
|
+
SKIP) GATE_5_DETAIL="alignment_skipped:${GATE_5C_REASON:-unspecified}" ;;
|
|
1981
|
+
PASS) GATE_5_DETAIL="alignment_clean" ;;
|
|
1982
|
+
esac
|
|
1983
|
+
fi
|
|
1984
|
+
|
|
1949
1985
|
record_gate_audit "gate-5" "tests-coverage" "$GATE_5_STATUS" "0" "$GATE_5_START" "${GATE_5_DETAIL:-}"
|
|
1950
1986
|
return 0
|
|
1951
1987
|
}
|
|
@@ -72,6 +72,7 @@ gate_5c_alignment() {
|
|
|
72
72
|
echo " ⏭️ Gate 5c: spec/test alignment NOT CHECKED — $req_ids_file missing"
|
|
73
73
|
echo " Run 'xp-gate check-alignment' to generate it and enable this gate."
|
|
74
74
|
GATE_5C_STATUS="SKIP"
|
|
75
|
+
GATE_5C_REASON="no_req_ids"
|
|
75
76
|
return 0
|
|
76
77
|
fi
|
|
77
78
|
|
|
@@ -81,6 +82,7 @@ gate_5c_alignment() {
|
|
|
81
82
|
echo " ⏭️ Gate 5c: spec/test alignment NOT CHECKED — req-ids.json is stale"
|
|
82
83
|
echo " specification.yaml is newer. Run 'xp-gate check-alignment' to regenerate."
|
|
83
84
|
GATE_5C_STATUS="SKIP"
|
|
85
|
+
GATE_5C_REASON="stale_req_ids"
|
|
84
86
|
return 0
|
|
85
87
|
fi
|
|
86
88
|
|
|
@@ -91,6 +93,13 @@ gate_5c_alignment() {
|
|
|
91
93
|
# "nothing to check" from "the gate is broken" (#585).
|
|
92
94
|
echo " ℹ️ Gate 5c: no test files among the staged changes — nothing to align."
|
|
93
95
|
GATE_5C_STATUS="SKIP"
|
|
96
|
+
# Consumed by the sourcing gate body: gate-5-entry.sh folds it into
|
|
97
|
+
# GATE_5_DETAIL for the audit row. shellcheck analyses this file alone, and
|
|
98
|
+
# this is the last assignment in the function, so it reads it as dead -- the
|
|
99
|
+
# two earlier ones are followed by reads on the same path. Same contract as
|
|
100
|
+
# GATE_5C_STATUS directly above.
|
|
101
|
+
# shellcheck disable=SC2034
|
|
102
|
+
GATE_5C_REASON="no_staged_test_files"
|
|
94
103
|
return 0
|
|
95
104
|
fi
|
|
96
105
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.21",
|
|
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.21.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.21.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.21.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
@@ -34,8 +34,10 @@ export declare function isEditTool(name: string): boolean;
|
|
|
34
34
|
/**
|
|
35
35
|
* Must this tool be gated by the sprint review guard?
|
|
36
36
|
*
|
|
37
|
-
* The inverse of {@link
|
|
38
|
-
* capable of writing, which is what closes the `bash` hole.
|
|
37
|
+
* The inverse of {@link UNGATED_TOOLS}: an unrecognised tool is treated as
|
|
38
|
+
* capable of writing, which is what closes the `bash` hole. The name is kept
|
|
39
|
+
* for its call sites even though an exempt tool such as `delphi-review` can
|
|
40
|
+
* write — see {@link UNGATED_TOOLS} for why membership is not "cannot write".
|
|
39
41
|
*/
|
|
40
42
|
export declare function mayModifyFiles(name: string): boolean;
|
|
41
43
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAyDH,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAsBD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKrD;AAgBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CA8B3F"}
|
package/plugins/dsh/lib/hooks.js
CHANGED
|
@@ -21,16 +21,33 @@
|
|
|
21
21
|
import { existsSync, readFileSync } from "node:fs";
|
|
22
22
|
import { join } from "node:path";
|
|
23
23
|
/**
|
|
24
|
-
* Tools
|
|
24
|
+
* Tools the sprint guard must never block. Everything else is gated.
|
|
25
25
|
*
|
|
26
26
|
* This is an ALLOWLIST on purpose. The guard used to name the write tools
|
|
27
27
|
* instead (`write`, `edit`, `str_replace_editor`), which let `bash` through —
|
|
28
28
|
* one shell command writes a file, so the guard was bypassable by the very tool
|
|
29
29
|
* a model reaches for first. A write-blacklist loses again on every new
|
|
30
|
-
* file-touching tool;
|
|
31
|
-
*
|
|
30
|
+
* file-touching tool; an allowlist loses only by being too strict, which
|
|
31
|
+
* surfaces as an over-eager denial rather than a silent hole.
|
|
32
|
+
*
|
|
33
|
+
* Membership is NOT "cannot write" — it is "cannot be used to sidestep this
|
|
34
|
+
* guard". Two groups qualify:
|
|
35
|
+
*
|
|
36
|
+
* 1. Tools that cannot modify a file at all (read, grep, todo_write, ...).
|
|
37
|
+
* 2. Tools that ARE the guard's exit. `delphi-review` runs the review this
|
|
38
|
+
* guard waits for, and `sprint`/`phase-transition` update the sprint state
|
|
39
|
+
* that carries the verdict. Gating them is a deadlock: the only way to
|
|
40
|
+
* satisfy the guard is to call a tool the guard rejects. Observed in
|
|
41
|
+
* practice — a repository with `.sprint-state/` but no verdict could not
|
|
42
|
+
* run `delphi-review` (or anything else) again, and had to be unblocked by
|
|
43
|
+
* hand-editing the state directory outside the session.
|
|
44
|
+
*
|
|
45
|
+
* Exempting `delphi-review` does not open a hole. It does not accept a caller-
|
|
46
|
+
* supplied verdict; it runs the three seats and derives one. The gate still
|
|
47
|
+
* stands between a model and the code until that review actually returns
|
|
48
|
+
* APPROVED, which is the behaviour it was built to enforce.
|
|
32
49
|
*/
|
|
33
|
-
const
|
|
50
|
+
const UNGATED_TOOLS = new Set([
|
|
34
51
|
"read",
|
|
35
52
|
"read_image",
|
|
36
53
|
"grep",
|
|
@@ -45,6 +62,10 @@ const READ_ONLY_TOOLS = new Set([
|
|
|
45
62
|
"gate-check",
|
|
46
63
|
"gate-principles",
|
|
47
64
|
"gate-arch",
|
|
65
|
+
// The guard's own exit. See the block comment above: without these the guard
|
|
66
|
+
// cannot be satisfied in a sprint that has state but no recorded verdict.
|
|
67
|
+
"delphi-review",
|
|
68
|
+
"sprint",
|
|
48
69
|
]);
|
|
49
70
|
/** Where Sprint Flow records the review verdict. */
|
|
50
71
|
const SPRINT_STATE_DIR = ".sprint-state";
|
|
@@ -81,11 +102,13 @@ export function isEditTool(name) {
|
|
|
81
102
|
/**
|
|
82
103
|
* Must this tool be gated by the sprint review guard?
|
|
83
104
|
*
|
|
84
|
-
* The inverse of {@link
|
|
85
|
-
* capable of writing, which is what closes the `bash` hole.
|
|
105
|
+
* The inverse of {@link UNGATED_TOOLS}: an unrecognised tool is treated as
|
|
106
|
+
* capable of writing, which is what closes the `bash` hole. The name is kept
|
|
107
|
+
* for its call sites even though an exempt tool such as `delphi-review` can
|
|
108
|
+
* write — see {@link UNGATED_TOOLS} for why membership is not "cannot write".
|
|
86
109
|
*/
|
|
87
110
|
export function mayModifyFiles(name) {
|
|
88
|
-
return !
|
|
111
|
+
return !UNGATED_TOOLS.has(name);
|
|
89
112
|
}
|
|
90
113
|
/**
|
|
91
114
|
* Should a save-time check run for this path?
|
|
@@ -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.21.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.21.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.21.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
@@ -133,3 +133,45 @@ describe("delphiGuardDecision tool classification", () => {
|
|
|
133
133
|
}
|
|
134
134
|
})
|
|
135
135
|
})
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @test REQ-DSH-015 sprint-phase writes are gated the way the IDE plugin gates them
|
|
139
|
+
* @intent 复现并锁定「门禁自锁」:有 .sprint-state 但没有 verdict 时,
|
|
140
|
+
* 唯一能产生 verdict 的工具 delphi-review 自己也被门禁拦住,
|
|
141
|
+
* 导致仓库永久无法解封。sprint 工具同理。
|
|
142
|
+
* @covers AC-DSH-015-01 AC-DSH-015-03
|
|
143
|
+
*
|
|
144
|
+
* This is the regression that matters most in this file. The allowlist was
|
|
145
|
+
* originally "tools that provably cannot modify a file", which excluded the two
|
|
146
|
+
* tools that END the block — so a sprint with state but no recorded verdict
|
|
147
|
+
* deadlocked, and the only escape was editing `.sprint-state` outside the
|
|
148
|
+
* session. Reproduced against a real install before the fix.
|
|
149
|
+
*/
|
|
150
|
+
describe("delphiGuardDecision deadlock", () => {
|
|
151
|
+
/** The tools that can clear the block, and therefore must never be blocked. */
|
|
152
|
+
const UNBLOCKERS = ["delphi-review", "sprint"]
|
|
153
|
+
|
|
154
|
+
it("never gates the tools that clear the block", () => {
|
|
155
|
+
// "no-verdict" is the deadlocked state: state exists, verdict does not.
|
|
156
|
+
const root = project("no-verdict")
|
|
157
|
+
for (const tool of UNBLOCKERS) {
|
|
158
|
+
expect(delphiGuardDecision(root, tool), `${tool} must not be gated`).toBeUndefined()
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
it("still gates code writes in the same state", () => {
|
|
163
|
+
// Exempting the exit must not open the gate itself.
|
|
164
|
+
const root = project("no-verdict")
|
|
165
|
+
for (const tool of ["write", "edit", "bash"]) {
|
|
166
|
+
expect(delphiGuardDecision(root, tool), `${tool} must stay gated`).toBeDefined()
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it("remains usable after a rejected review", () => {
|
|
171
|
+
// A rejection must leave the path to a re-review open.
|
|
172
|
+
const root = project("rejected")
|
|
173
|
+
for (const tool of UNBLOCKERS) {
|
|
174
|
+
expect(delphiGuardDecision(root, tool), `${tool} must not be gated`).toBeUndefined()
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
})
|
package/plugins/dsh/src/hooks.ts
CHANGED
|
@@ -23,16 +23,33 @@ import { existsSync, readFileSync } from "node:fs"
|
|
|
23
23
|
import { join } from "node:path"
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Tools
|
|
26
|
+
* Tools the sprint guard must never block. Everything else is gated.
|
|
27
27
|
*
|
|
28
28
|
* This is an ALLOWLIST on purpose. The guard used to name the write tools
|
|
29
29
|
* instead (`write`, `edit`, `str_replace_editor`), which let `bash` through —
|
|
30
30
|
* one shell command writes a file, so the guard was bypassable by the very tool
|
|
31
31
|
* a model reaches for first. A write-blacklist loses again on every new
|
|
32
|
-
* file-touching tool;
|
|
33
|
-
*
|
|
32
|
+
* file-touching tool; an allowlist loses only by being too strict, which
|
|
33
|
+
* surfaces as an over-eager denial rather than a silent hole.
|
|
34
|
+
*
|
|
35
|
+
* Membership is NOT "cannot write" — it is "cannot be used to sidestep this
|
|
36
|
+
* guard". Two groups qualify:
|
|
37
|
+
*
|
|
38
|
+
* 1. Tools that cannot modify a file at all (read, grep, todo_write, ...).
|
|
39
|
+
* 2. Tools that ARE the guard's exit. `delphi-review` runs the review this
|
|
40
|
+
* guard waits for, and `sprint`/`phase-transition` update the sprint state
|
|
41
|
+
* that carries the verdict. Gating them is a deadlock: the only way to
|
|
42
|
+
* satisfy the guard is to call a tool the guard rejects. Observed in
|
|
43
|
+
* practice — a repository with `.sprint-state/` but no verdict could not
|
|
44
|
+
* run `delphi-review` (or anything else) again, and had to be unblocked by
|
|
45
|
+
* hand-editing the state directory outside the session.
|
|
46
|
+
*
|
|
47
|
+
* Exempting `delphi-review` does not open a hole. It does not accept a caller-
|
|
48
|
+
* supplied verdict; it runs the three seats and derives one. The gate still
|
|
49
|
+
* stands between a model and the code until that review actually returns
|
|
50
|
+
* APPROVED, which is the behaviour it was built to enforce.
|
|
34
51
|
*/
|
|
35
|
-
const
|
|
52
|
+
const UNGATED_TOOLS: ReadonlySet<string> = new Set([
|
|
36
53
|
"read",
|
|
37
54
|
"read_image",
|
|
38
55
|
"grep",
|
|
@@ -47,6 +64,10 @@ const READ_ONLY_TOOLS: ReadonlySet<string> = new Set([
|
|
|
47
64
|
"gate-check",
|
|
48
65
|
"gate-principles",
|
|
49
66
|
"gate-arch",
|
|
67
|
+
// The guard's own exit. See the block comment above: without these the guard
|
|
68
|
+
// cannot be satisfied in a sprint that has state but no recorded verdict.
|
|
69
|
+
"delphi-review",
|
|
70
|
+
"sprint",
|
|
50
71
|
])
|
|
51
72
|
|
|
52
73
|
/** Where Sprint Flow records the review verdict. */
|
|
@@ -93,11 +114,13 @@ export function isEditTool(name: string): boolean {
|
|
|
93
114
|
/**
|
|
94
115
|
* Must this tool be gated by the sprint review guard?
|
|
95
116
|
*
|
|
96
|
-
* The inverse of {@link
|
|
97
|
-
* capable of writing, which is what closes the `bash` hole.
|
|
117
|
+
* The inverse of {@link UNGATED_TOOLS}: an unrecognised tool is treated as
|
|
118
|
+
* capable of writing, which is what closes the `bash` hole. The name is kept
|
|
119
|
+
* for its call sites even though an exempt tool such as `delphi-review` can
|
|
120
|
+
* write — see {@link UNGATED_TOOLS} for why membership is not "cannot write".
|
|
98
121
|
*/
|
|
99
122
|
export function mayModifyFiles(name: string): boolean {
|
|
100
|
-
return !
|
|
123
|
+
return !UNGATED_TOOLS.has(name)
|
|
101
124
|
}
|
|
102
125
|
|
|
103
126
|
/**
|
|
@@ -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.21.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.21.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.21.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.21.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.21.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.21.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.21.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.21.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.21.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|