@boyingliu01/xp-gate 0.38.1 → 0.38.2
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/kotlin.sh +31 -7
- package/adapters/typescript.sh +95 -6
- package/gates/common-process.ts +18 -5
- package/hooks/gate-driver.sh +12 -1
- package/hooks/gate-entries/gate-0-entry.sh +27 -3
- package/hooks/gate-entries/gate-1-entry.sh +58 -1
- package/hooks/gate-entries/gate-5-entry.sh +40 -8
- package/lib/__tests__/doctor.test.js +28 -0
- package/lib/doctor.js +10 -3
- package/lib/gate-runner.js +45 -22
- 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/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/package.json +1 -1
- package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
- package/principles/AGENTS.md +1 -1
- package/principles/adapters/java.ts +53 -16
- 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/kotlin.sh
CHANGED
|
@@ -56,15 +56,39 @@ run_static_analysis() {
|
|
|
56
56
|
ktlint_out=$(ktlint "**/*.kt" 2>&1)
|
|
57
57
|
lint_rc=$?
|
|
58
58
|
printf '%s\n' "$ktlint_out" | sed -n '1,20p'
|
|
59
|
-
# Only an EXECUTED ktlint counts as having delivered a verdict.
|
|
60
|
-
# can fail to: the binary cannot run (127/126),
|
|
61
|
-
# (ktlint 1.
|
|
62
|
-
#
|
|
63
|
-
#
|
|
59
|
+
# Only an EXECUTED ktlint counts as having delivered a verdict. Four ways it
|
|
60
|
+
# can fail to: the binary cannot run (127/126), the glob matches nothing
|
|
61
|
+
# (ktlint 1.x: "No files matched"), it printed nothing at all, or everything
|
|
62
|
+
# it printed was JVM NOISE rather than a finding.
|
|
63
|
+
#
|
|
64
|
+
# That last case is what CI hit. ktlint is a JVM launcher, so a modern JDK
|
|
65
|
+
# prepends startup warnings to stderr:
|
|
66
|
+
# WARNING: A restricted method in java.lang.System has been called
|
|
67
|
+
# WARNING: sun.misc.Unsafe::objectFieldOffset has been called by ...
|
|
68
|
+
# `2>&1` captured them, so `[ -n "$ktlint_out" ]` was true and ktlint was
|
|
69
|
+
# credited with a verdict it never produced -- detekt never ran, and the gate
|
|
70
|
+
# blocked on the warnings as if they were code-quality findings. Measured on
|
|
71
|
+
# run 43404316674, where those four lines were the ENTIRE lint output.
|
|
72
|
+
#
|
|
73
|
+
# So judge ktlint by its output with those lines removed.
|
|
74
|
+
#
|
|
75
|
+
# The noise filter applies to BOTH exit paths. It used to guard only the
|
|
76
|
+
# zero-exit branch, on the reasoning that "non-zero means ktlint rejected
|
|
77
|
+
# something". CI disproved that: ktlint 1.3+ is a Gradle launcher, so when
|
|
78
|
+
# the Gradle build fails ktlint exits non-zero having found NOTHING. Run
|
|
79
|
+
# 43404316674: `Gradle compilation failed`, then two JVM WARNING pairs, and
|
|
80
|
+
# the gate blocked on that -- detekt, installed and working, never ran, and
|
|
81
|
+
# the assertion on its MagicNumber finding could never be satisfied. A
|
|
82
|
+
# non-zero exit is only a verdict if some non-noise line survives.
|
|
64
83
|
if [ "$lint_rc" -ne 127 ] && [ "$lint_rc" -ne 126 ] \
|
|
65
|
-
&& [ -n "$ktlint_out" ] \
|
|
66
84
|
&& ! printf '%s\n' "$ktlint_out" | grep -q 'No files matched'; then
|
|
67
|
-
|
|
85
|
+
if printf '%s\n' "$ktlint_out" \
|
|
86
|
+
| grep -v -e '^WARNING:' -e '^warning:' -e '^[[:space:]]*$' \
|
|
87
|
+
-e '^FAILURE: Build' -e '^[0-9]*: Task failed' \
|
|
88
|
+
-e "^Failed to query the value of property" \
|
|
89
|
+
| grep -q .; then
|
|
90
|
+
linted=1
|
|
91
|
+
fi
|
|
68
92
|
fi
|
|
69
93
|
fi
|
|
70
94
|
if [ "$linted" -eq 0 ] && command -v detekt &>/dev/null; then
|
package/adapters/typescript.sh
CHANGED
|
@@ -20,14 +20,32 @@
|
|
|
20
20
|
# AGENTS.md states for XP_GATE_NPX_PROBE, which src/gates/common-process.ts
|
|
21
21
|
# already honours on the TypeScript side.
|
|
22
22
|
#
|
|
23
|
-
#
|
|
24
|
-
# install populates.
|
|
23
|
+
# The project's own node_modules/.bin is consulted first, which is what a real
|
|
24
|
+
# install populates. Ancestors are then walked (bounded) because npm hoists: a
|
|
25
|
+
# package's tools live at the workspace root, and a gate that ran from the
|
|
26
|
+
# package directory would otherwise report "tool missing" for a tool that is
|
|
27
|
+
# installed. Nothing OUTSIDE the checkout can satisfy this check.
|
|
25
28
|
_local_bin() {
|
|
26
|
-
local tool="$1"
|
|
29
|
+
local tool="$1" dir depth=0
|
|
27
30
|
if [ -x "node_modules/.bin/$tool" ]; then
|
|
28
31
|
printf '%s\n' "node_modules/.bin/$tool"
|
|
29
32
|
return 0
|
|
30
33
|
fi
|
|
34
|
+
# Walk up to the nearest ancestor that declares a local binary, so a source
|
|
35
|
+
# tree nested inside its own project (repo/components/x/src) still resolves the
|
|
36
|
+
# project's toolchain instead of reporting SKIP. This is what `npx` did for free
|
|
37
|
+
# before the call sites stopped using it, so dropping `npx` must not narrow the
|
|
38
|
+
# search. Bounded at 6 levels: a tool has to be somewhere near the code.
|
|
39
|
+
dir="$(pwd)"
|
|
40
|
+
while [ "$depth" -lt 6 ]; do
|
|
41
|
+
depth=$((depth + 1))
|
|
42
|
+
[ "$dir" = "/" ] && break
|
|
43
|
+
dir="$(dirname "$dir")"
|
|
44
|
+
if [ -x "$dir/node_modules/.bin/$tool" ]; then
|
|
45
|
+
printf '%s\n' "$dir/node_modules/.bin/$tool"
|
|
46
|
+
return 0
|
|
47
|
+
fi
|
|
48
|
+
done
|
|
31
49
|
return 1
|
|
32
50
|
}
|
|
33
51
|
|
|
@@ -66,6 +84,26 @@ run_static_analysis() {
|
|
|
66
84
|
return 0
|
|
67
85
|
}
|
|
68
86
|
|
|
87
|
+
# True when the Biome config in the current directory actually enables linting.
|
|
88
|
+
#
|
|
89
|
+
# "Enabled" is deliberately read from the config, not inferred from the tool:
|
|
90
|
+
# a missing biome.json entirely means "no Biome in this project" and is handled
|
|
91
|
+
# by the caller. Anything unparseable is treated as "rules may exist" so an
|
|
92
|
+
# unreadable config never becomes a silent SKIP.
|
|
93
|
+
_biome_has_lint_rules() {
|
|
94
|
+
[ -f "biome.json" ] || return 0 # biome.jsonc: no cheap parse, assume rules
|
|
95
|
+
node -e '
|
|
96
|
+
const fs = require("fs");
|
|
97
|
+
const g = (v) => !!v && typeof v === "object";
|
|
98
|
+
let c;
|
|
99
|
+
try { c = JSON.parse(fs.readFileSync("biome.json", "utf8") || "{}"); } catch { process.exit(0); }
|
|
100
|
+
const linting = g(c.linter) && (c.linter.enabled !== false || g(c.linter.rules));
|
|
101
|
+
const assist = g(c.assist) && (c.assist.enabled !== false || g(c.assist.actions));
|
|
102
|
+
process.exit(linting || assist ? 0 : 1);
|
|
103
|
+
' 2>/dev/null || return 0
|
|
104
|
+
return 1
|
|
105
|
+
}
|
|
106
|
+
|
|
69
107
|
run_lint() {
|
|
70
108
|
if ! command -v npx >/dev/null 2>&1; then
|
|
71
109
|
echo "npx not available, skipping TypeScript linting"
|
|
@@ -83,8 +121,43 @@ run_lint() {
|
|
|
83
121
|
# with Biome errors was told "PASSED". Capture the status first, then trim
|
|
84
122
|
# the output. This repo has no biome.json so its own commits never showed it;
|
|
85
123
|
# every downstream project using Biome was affected (#437).
|
|
124
|
+
#
|
|
125
|
+
# The tool is resolved LOCALLY, never through `npx biome`. `npx <tool>`
|
|
126
|
+
# without `--no-install` DOWNLOADS the package when it is missing, so on a
|
|
127
|
+
# fixture that has biome.json but no biome dependency the call became a
|
|
128
|
+
# registry fetch with a hanging tail. Measured on Linux with a fixture whose
|
|
129
|
+
# root holds only biome.json + package.json + src/ (no node_modules):
|
|
130
|
+
# npx biome check . -> still running after 60 s, killed
|
|
131
|
+
# i.e. the cost landed on anyone measuring or committing, not on lint. Local
|
|
132
|
+
# resolution finds biome or reports SKIP — the policy `run_biome_lint()`
|
|
133
|
+
# below and AGENTS.md's "npx is never used to probe a tool by default"
|
|
134
|
+
# already declare for every other tool in this adapter.
|
|
135
|
+
#
|
|
136
|
+
# Resolution is local bin, then PATH. The PATH rung keeps what `npx biome`
|
|
137
|
+
# used to provide for free -- a biome a CI image or a global install put on
|
|
138
|
+
# PATH still runs -- without npx's install-on-missing contract. Written as
|
|
139
|
+
# `type -P biome` rather than `command -v biome` because the latter is the
|
|
140
|
+
# probe shape scripts/check-no-npx-probe.sh rejects; neither can install.
|
|
141
|
+
local BIOME_BIN
|
|
142
|
+
if ! BIOME_BIN=$(_local_bin biome); then
|
|
143
|
+
BIOME_BIN=$(type -P biome 2>/dev/null) || BIOME_BIN=""
|
|
144
|
+
fi
|
|
145
|
+
if [ -z "$BIOME_BIN" ]; then
|
|
146
|
+
# A decorations-only config (formatter/organize on, every linter rule off)
|
|
147
|
+
# is a "prettier replacement" setup — the common shape in this repo's own
|
|
148
|
+
# fixtures. There is nothing to lint, so starting the tool (or failing on
|
|
149
|
+
# its absence) would be noise on every commit. Decided from the config
|
|
150
|
+
# alone, with no tool and no network.
|
|
151
|
+
if _biome_has_lint_rules; then
|
|
152
|
+
echo "biome.json present but biome is not installed locally — SKIP (npx is never used to install a tool)."
|
|
153
|
+
echo "Install it with: npm install --save-dev @biomejs/biome"
|
|
154
|
+
else
|
|
155
|
+
echo "✅ PASSED - Biome check skipped: config enables no linter rules (format/organize only)."
|
|
156
|
+
fi
|
|
157
|
+
return 0
|
|
158
|
+
fi
|
|
86
159
|
local BIOME_OUTPUT
|
|
87
|
-
BIOME_OUTPUT=$(
|
|
160
|
+
BIOME_OUTPUT=$(run_without_git_context "$BIOME_BIN" check . --no-errors-on-unmatched 2>&1)
|
|
88
161
|
local EXIT_CODE=$?
|
|
89
162
|
printf '%s\n' "$BIOME_OUTPUT" | head -50
|
|
90
163
|
if [ $EXIT_CODE -ne 0 ]; then
|
|
@@ -113,8 +186,24 @@ run_lint() {
|
|
|
113
186
|
for _cfg in $_eslint_configs; do
|
|
114
187
|
if [ -f "$_cfg" ]; then
|
|
115
188
|
echo "Running ESLint linting (config: $_cfg)..."
|
|
116
|
-
npx eslint
|
|
117
|
-
|
|
189
|
+
# Same rule as the Biome arm above: resolve locally. `npx eslint .` with no
|
|
190
|
+
# local eslint installs eslint AND a deprecated flat-config shim, then
|
|
191
|
+
# fails on a fixture rather than reporting anything about the project.
|
|
192
|
+
#
|
|
193
|
+
# PATH is the second rung because `command -v` is free and finds an eslint
|
|
194
|
+
# that a CI image or a global install put there. There is deliberately NO
|
|
195
|
+
# `npx --no-install` third rung: that shape is exactly what
|
|
196
|
+
# scripts/check-no-npx-probe.sh rejects — it prevents the INSTALL but still
|
|
197
|
+
# queries the registry on every commit. A tool in neither the project nor
|
|
198
|
+
# PATH is reported as a BLOCK with an install hint.
|
|
199
|
+
local ESLINT_BIN
|
|
200
|
+
if ESLINT_BIN=$(_local_bin eslint) || ESLINT_BIN="$(type -P eslint 2>/dev/null)"; then
|
|
201
|
+
run_without_git_context "$ESLINT_BIN" .
|
|
202
|
+
return $?
|
|
203
|
+
fi
|
|
204
|
+
echo "❌ BLOCKED - eslint config found but eslint is not installed."
|
|
205
|
+
echo " Install it with: npm install --save-dev eslint (never via npx)"
|
|
206
|
+
return 1
|
|
118
207
|
fi
|
|
119
208
|
done
|
|
120
209
|
|
package/gates/common-process.ts
CHANGED
|
@@ -69,6 +69,20 @@ function npxProbeEnabled(): boolean {
|
|
|
69
69
|
/** Tier 2: npx fallback. No-op unless `XP_GATE_NPX_PROBE=1` (see npxProbeEnabled). */
|
|
70
70
|
function probeToolNpx(tool: string, cwd?: string): ToolAvailability {
|
|
71
71
|
if (!npxProbeEnabled()) return { available: false, path: '', via: 'none' };
|
|
72
|
+
return npxVersionSucceeds(tool, cwd)
|
|
73
|
+
? { available: true, path: `npx ${tool}`, via: 'npx' }
|
|
74
|
+
: { available: false, path: '', via: 'none' };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Run `npx --yes <tool> --version` and report whether it exited 0.
|
|
79
|
+
*
|
|
80
|
+
* Split out of probeToolNpx so the spawn options and the exit-status rule are not
|
|
81
|
+
* three nesting levels inside a function whose real question is one boolean. A
|
|
82
|
+
* throw is not an error here: npx being unreachable IS the answer to "is this
|
|
83
|
+
* tool available via npx", so it reads as `false` rather than propagating.
|
|
84
|
+
*/
|
|
85
|
+
function npxVersionSucceeds(tool: string, cwd?: string): boolean {
|
|
72
86
|
try {
|
|
73
87
|
const npxCheck = spawnSync('npx', ['--yes', tool, '--version'], {
|
|
74
88
|
encoding: 'utf-8',
|
|
@@ -76,11 +90,10 @@ function probeToolNpx(tool: string, cwd?: string): ToolAvailability {
|
|
|
76
90
|
shell: process.platform === 'win32',
|
|
77
91
|
cwd,
|
|
78
92
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
return { available: false, path: '', via: 'none' };
|
|
93
|
+
return npxCheck.status === 0;
|
|
94
|
+
} catch {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
84
97
|
}
|
|
85
98
|
|
|
86
99
|
/**
|
package/hooks/gate-driver.sh
CHANGED
|
@@ -47,7 +47,18 @@ XP_GATE_ORDER="0 11 12 12b 12c 13 9 1 2 3 8 10 7 5 6 4"
|
|
|
47
47
|
# directory is emitted after the LAST of these in the order above; deriving it
|
|
48
48
|
# (instead of leaving the restore inside gate 8's block) is what makes the
|
|
49
49
|
# restore survive a reorder.
|
|
50
|
-
|
|
50
|
+
#
|
|
51
|
+
# Gate 5 is the last gate that actually READS the subdirectory state: it is the
|
|
52
|
+
# only body that consults PROJECT_SUBDIR / IN_PROJECT_SUBDIR (15 references;
|
|
53
|
+
# gates 4/6/7/10 have none), because Gate 5a strips that prefix from the staged
|
|
54
|
+
# paths before probing for a paired test file. The list used to stop at 8, so the
|
|
55
|
+
# `cd` back to the repo root fired after Gate 8 -- and gates 10, 7 and 5 ran
|
|
56
|
+
# OUTSIDE the subdirectory while still stripping the prefix from their paths.
|
|
57
|
+
# Gate 5 then probed `src/...test.ts` from the repo root, where the file is
|
|
58
|
+
# `web/src/...test.ts`, and blocked a correctly paired commit. It only ever bit
|
|
59
|
+
# single-language subdirectory projects, which is the narrower of the two shapes
|
|
60
|
+
# this hook supports, so the multi-language cases stayed green.
|
|
61
|
+
XP_GATE_SUBDIR_GATES="${XP_GATE_SUBDIR_GATES:-0 11 12 12b 12c 13 9 1 2 3 8 10 7 5}"
|
|
51
62
|
|
|
52
63
|
# Source every gate body once, before the chain runs. Sourcing defines the
|
|
53
64
|
# gate_NN_run functions; it does not execute them.
|
|
@@ -151,10 +151,28 @@ if [ "$is_protected" = "true" ]; then
|
|
|
151
151
|
echo "✅ PASSED - Gate 0: Version Consistency Check (VERSION/CHANGELOG staged)"
|
|
152
152
|
else
|
|
153
153
|
# Check for doc-only changes (no source code files)
|
|
154
|
-
|
|
154
|
+
#
|
|
155
|
+
# The extension list must cover every language an adapter supports, not just
|
|
156
|
+
# the C-family languages this repo happens to be written in. It previously
|
|
157
|
+
# stopped at `*.java`, so a staged .kt/.cs/.swift/.dart/.sh/.ps1 file made
|
|
158
|
+
# Gate 0 report "doc-only changes" — and the doc-only path skips the REST OF
|
|
159
|
+
# THE CHAIN. A Kotlin-only commit therefore ran no code gate at all, while
|
|
160
|
+
# reading green. Found once the Kotlin fixtures stopped skipping themselves
|
|
161
|
+
# (the skips had hidden it): kotlin-gate reported Gate 0 "doc-only" for a
|
|
162
|
+
# fixture whose only staged file was BadCode.kt.
|
|
163
|
+
#
|
|
164
|
+
# Keep this identical to gate-5-entry.sh's CODE_EXTENSIONS, which is the list
|
|
165
|
+
# the coverage gate already trusts. A second hand-maintained copy is exactly
|
|
166
|
+
# how these two drifted apart.
|
|
155
167
|
for file in $STAGED_FILES; do
|
|
156
168
|
case "$file" in
|
|
157
|
-
*.ts|*.js|*.
|
|
169
|
+
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.py|*.go|*.java|*.kt|*.kts|*.cs|*.csx)
|
|
170
|
+
has_source=true
|
|
171
|
+
;;
|
|
172
|
+
*.cpp|*.cc|*.cxx|*.c|*.h|*.hpp|*.swift|*.m|*.mm|*.dart|*.sh|*.ps1)
|
|
173
|
+
has_source=true
|
|
174
|
+
;;
|
|
175
|
+
*.css|*.scss|*.rs)
|
|
158
176
|
has_source=true
|
|
159
177
|
;;
|
|
160
178
|
esac
|
|
@@ -166,7 +184,13 @@ if [ "$is_protected" = "true" ]; then
|
|
|
166
184
|
case "$file" in
|
|
167
185
|
src/npm-package/adapters/*|src/npm-package/scripts/*|src/npm-package/hooks/*|scripts/*|githooks/adapters/*)
|
|
168
186
|
continue ;;
|
|
169
|
-
*.ts|*.js|*.
|
|
187
|
+
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.py|*.go|*.java|*.kt|*.kts|*.cs|*.csx)
|
|
188
|
+
has_real_source=true
|
|
189
|
+
;;
|
|
190
|
+
*.cpp|*.cc|*.cxx|*.c|*.h|*.hpp|*.swift|*.m|*.mm|*.dart|*.sh|*.ps1)
|
|
191
|
+
has_real_source=true
|
|
192
|
+
;;
|
|
193
|
+
*.css|*.scss|*.rs)
|
|
170
194
|
has_real_source=true
|
|
171
195
|
;;
|
|
172
196
|
esac
|
|
@@ -194,8 +194,65 @@ else
|
|
|
194
194
|
# scopes --staged to that subdirectory (mirrors the single-language subdir
|
|
195
195
|
# mode, which executes after cd "$PROJECT_SUBDIR"). Empirically verified:
|
|
196
196
|
# `biome check --staged .` from the subdir checks the staged files under it.
|
|
197
|
-
|
|
197
|
+
#
|
|
198
|
+
# The binary is resolved LOCALLY (`npx biome` DOWNLOADS biome when the
|
|
199
|
+
# project has a config but no dependency — a registry fetch inside a
|
|
200
|
+
# commit hook). Prefer the hoisted roots, then PATH, then the original npx
|
|
201
|
+
# call so a consumer's npx-provided biome keeps working.
|
|
202
|
+
#
|
|
203
|
+
# NOT a bare `npx biome` in PATH order either: the gate-1-biome-noop suite
|
|
204
|
+
# stubs `npx` on PATH and asserts Biome actually ran, so PATH must be the
|
|
205
|
+
# rung that decides -- local bin first, then `command -v`, then npx. Putting
|
|
206
|
+
# npx before the command -v check would make the stub unreachable and the
|
|
207
|
+
# suite would prove nothing.
|
|
208
|
+
BIOME_ARGV=()
|
|
209
|
+
for _biome_root in "$TS_PROJECT_DIR" "${PROJECT_ROOT:-.}" "."; do
|
|
210
|
+
if [ -x "$_biome_root/node_modules/.bin/biome" ]; then
|
|
211
|
+
# ABSOLUTE, not "$_biome_root/node_modules/.bin/biome": the invocation
|
|
212
|
+
# below runs after `cd "$TS_PROJECT_DIR"`, so a relative candidate such
|
|
213
|
+
# as ./node_modules/.bin/biome stops resolving and the shell reports
|
|
214
|
+
# 127 ("command not found"). The gate then takes the SKIP path and
|
|
215
|
+
# silently checks nothing on exactly the subdirectory projects this
|
|
216
|
+
# branch exists for.
|
|
217
|
+
BIOME_ARGV=("$(cd "$_biome_root" && pwd)/node_modules/.bin/biome")
|
|
218
|
+
break
|
|
219
|
+
fi
|
|
220
|
+
done
|
|
221
|
+
if [ ${#BIOME_ARGV[@]} -eq 0 ]; then
|
|
222
|
+
if command -v biome >/dev/null 2>&1; then
|
|
223
|
+
BIOME_ARGV=(biome)
|
|
224
|
+
fi
|
|
225
|
+
fi
|
|
226
|
+
if [ ${#BIOME_ARGV[@]} -eq 0 ]; then
|
|
227
|
+
# Deliberately NO `npx biome` rung. npx's contract is to INSTALL the
|
|
228
|
+
# package when it is missing, so that rung did not degrade gracefully --
|
|
229
|
+
# it made every commit in a project without a local biome pay a registry
|
|
230
|
+
# round trip plus a download. Measured on a fixture holding only
|
|
231
|
+
# biome.json + package.json + src/: `npx biome check .` was still running
|
|
232
|
+
# after 60 s, killed.
|
|
233
|
+
#
|
|
234
|
+
# The replacement is a plain PATH word, NOT a skip. `biome` on PATH is
|
|
235
|
+
# resolved by the shell at call time and cannot install anything, so this
|
|
236
|
+
# keeps the old rung's reach (a CI image or global install still works)
|
|
237
|
+
# while dropping its install contract. Skipping here instead was tried and
|
|
238
|
+
# is wrong for two reasons: it changes the gate's verdict for a consumer
|
|
239
|
+
# that deliberately provides biome on PATH, and it made this branch
|
|
240
|
+
# unreachable-in-practice by returning before the tool was ever invoked.
|
|
241
|
+
# scripts/check-no-npx-probe.sh fails the build if the npx rung returns.
|
|
242
|
+
BIOME_ARGV=(biome)
|
|
243
|
+
fi
|
|
244
|
+
# shellcheck disable=SC2086 # BIOME_ARGV may hold a multi-token form on purpose
|
|
245
|
+
BIOME_OUT=$(cd "$TS_PROJECT_DIR" && ${BIOME_ARGV[@]} check --staged . 2>&1)
|
|
198
246
|
BIOME_STATUS=$?
|
|
247
|
+
if [ "$BIOME_STATUS" -eq 127 ]; then
|
|
248
|
+
# 127 is the shell's own "command not found": biome is genuinely absent.
|
|
249
|
+
# That is a SKIP (AGENTS.md: "Tool missing -> SKIP, not BLOCK"), and it is
|
|
250
|
+
# detected from the invocation's own exit status rather than from a
|
|
251
|
+
# resolver probe, so there is exactly one place that decides it.
|
|
252
|
+
echo "ℹ️ Biome config found but biome is not installed — SKIP Gate 1 Biome."
|
|
253
|
+
echo " Install it with: npm install --save-dev @biomejs/biome"
|
|
254
|
+
return 0
|
|
255
|
+
fi
|
|
199
256
|
if [ "$BIOME_STATUS" -ne 0 ]; then
|
|
200
257
|
# Biome exits 1 with `internalError/io - No files were processed` when the
|
|
201
258
|
# staged set yields nothing lintable (docs-only / config-only commit, or
|
|
@@ -876,7 +876,22 @@ else
|
|
|
876
876
|
# that has an adapter. Languages that ran nothing fall through to their own
|
|
877
877
|
# adapter's coverage branch, which already distinguishes "no evidence" (a
|
|
878
878
|
# documented failure) from "not applicable" (iac).
|
|
879
|
-
|
|
879
|
+
#
|
|
880
|
+
# #601: "tests were not run" is not the same as "there is nothing to
|
|
881
|
+
# evaluate". A repo can carry a coverage report from an earlier run (CI
|
|
882
|
+
# artifacts, a developer's last npm test) while no runner is selected for this
|
|
883
|
+
# change set. Skipping then DISCARDS a measurement that exists, and Gate 5
|
|
884
|
+
# reports PASS on a floor it never applied -- #760's defect one direction over.
|
|
885
|
+
# Measured on run 43368235868: with coverage/coverage-summary.json staged, the
|
|
886
|
+
# hook still printed "Test run was skipped — skipping coverage check" and a
|
|
887
|
+
# staged 42% never reached the threshold. The skip now also requires that no
|
|
888
|
+
# coverage evidence is present.
|
|
889
|
+
GATE_5_COVERAGE_EVIDENCE=false
|
|
890
|
+
if [ -f "coverage/coverage-summary.json" ] || [ -f "coverage/coverage-final.json" ]; then
|
|
891
|
+
GATE_5_COVERAGE_EVIDENCE=true
|
|
892
|
+
fi
|
|
893
|
+
if [ "${TESTS_SKIPPED:-false}" = "true" ] && [ "${TESTS_RAN_ANY:-false}" != "true" ] \
|
|
894
|
+
&& [ "$GATE_5_COVERAGE_EVIDENCE" != "true" ]; then
|
|
880
895
|
echo "ℹ️ Test run was skipped — skipping coverage check."
|
|
881
896
|
else
|
|
882
897
|
echo "Running coverage check..."
|
|
@@ -907,12 +922,22 @@ else
|
|
|
907
922
|
# this line had already announced a skip). A message that describes
|
|
908
923
|
# the outer decision while sitting inside an inner branch is how the
|
|
909
924
|
# same output line appeared twice with two different meanings.
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
925
|
+
# Evidence FIRST, then the skip flag -- the same precedence the outer
|
|
926
|
+
# guard at the top of this section already uses. Before this, a staged
|
|
927
|
+
# coverage artefact was ignored whenever the test run had been skipped
|
|
928
|
+
# (no changed .ts file), so the artefact the outer guard had just
|
|
929
|
+
# counted as evidence was never read: Gate 5 printed "no TS coverage
|
|
930
|
+
# to evaluate" and carried on with COV_EXIT=0. Measured consequence --
|
|
931
|
+
# a staged coverage-summary.json with `"pct": "Unknown"` (istanbul's
|
|
932
|
+
# real unusable shape) and a staged 42% BOTH passed, because the
|
|
933
|
+
# threshold comparison below never ran. "No evidence" and "evidence
|
|
934
|
+
# says 42%" must not take the same branch.
|
|
935
|
+
if [ -f "coverage/coverage-summary.json" ] || [ -f "coverage/coverage-final.json" ]; then
|
|
914
936
|
echo "TypeScript coverage collected during test run."
|
|
915
937
|
COV_EXIT=$((COV_EXIT || 0))
|
|
938
|
+
elif [ "${TESTS_SKIPPED:-false}" = "true" ]; then
|
|
939
|
+
echo "ℹ️ No TypeScript tests were selected — no TS coverage to evaluate."
|
|
940
|
+
COV_EXIT=$((COV_EXIT || 0))
|
|
916
941
|
else
|
|
917
942
|
echo "ℹ️ No coverage data produced — test run was skipped (no TS changes)."
|
|
918
943
|
COV_EXIT=$((COV_EXIT || 0))
|
|
@@ -1123,9 +1148,16 @@ else
|
|
|
1123
1148
|
case "$CURRENT_LANG" in
|
|
1124
1149
|
"typescript")
|
|
1125
1150
|
COVERAGE_ENFORCED=true
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1151
|
+
# Evidence FIRST, skip flag second -- the same precedence as the outer
|
|
1152
|
+
# guard and the stage-1 arm above. With the order reversed, a staged
|
|
1153
|
+
# coverage artefact was silently discarded whenever no test had been
|
|
1154
|
+
# selected (no changed .ts file), and Gate 5 printed
|
|
1155
|
+
# ✅ PASSED - Coverage check skipped (no test/source files changed).
|
|
1156
|
+
# The artefact and the changed file were BOTH staged -- only the phrase
|
|
1157
|
+
# "no test/source files changed" was wrong, and it read as a pass. That is
|
|
1158
|
+
# the fail-open shape this whole issue exists to remove, sitting one branch
|
|
1159
|
+
# below a sibling that had already been fixed for it.
|
|
1160
|
+
if [ -f "coverage/coverage-summary.json" ]; then
|
|
1129
1161
|
# #594: reject NaN at the SOURCE, not after the fact. Math.round() does
|
|
1130
1162
|
# not fail on a non-numeric input -- it returns NaN and console.log prints
|
|
1131
1163
|
# "NaN" -- so istanbul's "Unknown" (a file with no executable lines) sailed
|
|
@@ -181,6 +181,25 @@ describe('doctor', () => {
|
|
|
181
181
|
return path.join(tmpProject, 'githooks', 'adapters');
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Make sure the generated adapters mirror exists under src/npm-package/.
|
|
186
|
+
*
|
|
187
|
+
* It is gitignored and produced by `scripts/sync-package-content.js` at
|
|
188
|
+
* prepack time, so a clean checkout has no source for `--fix` to restore
|
|
189
|
+
* from. Runs the real generator (not a copy) so the fixture cannot drift from
|
|
190
|
+
* what actually ships.
|
|
191
|
+
*/
|
|
192
|
+
function ensureAdapterSourceGenerated() {
|
|
193
|
+
const pkgRoot = path.join(__dirname, '..', '..');
|
|
194
|
+
const mirror = path.join(pkgRoot, 'adapters');
|
|
195
|
+
if (fs.existsSync(path.join(mirror, 'typescript.sh'))) return;
|
|
196
|
+
require('node:child_process').execFileSync(
|
|
197
|
+
process.execPath,
|
|
198
|
+
[path.join(pkgRoot, 'scripts', 'sync-package-content.js')],
|
|
199
|
+
{ cwd: pkgRoot, stdio: 'ignore' }
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
184
203
|
function createXpGatePreCommit(dir) {
|
|
185
204
|
fs.mkdirSync(dir, { recursive: true });
|
|
186
205
|
fs.writeFileSync(
|
|
@@ -571,6 +590,15 @@ describe('doctor', () => {
|
|
|
571
590
|
it('AC-10: doctor --fix reinstall adapters when mode is active and adapters missing', async () => {
|
|
572
591
|
setupLocalInstall();
|
|
573
592
|
seedVersionCache();
|
|
593
|
+
// `src/npm-package/adapters/` is a GENERATED mirror since ccfc22f3 (P1-E): it
|
|
594
|
+
// is gitignored, so a fresh CI checkout does not have it. `--fix` restores
|
|
595
|
+
// adapters FROM that directory, so without it the restore is impossible,
|
|
596
|
+
// the issue survives, and doctor correctly returns 1. Locally the directory
|
|
597
|
+
// existed from an earlier build, which is why this only failed on CI.
|
|
598
|
+
//
|
|
599
|
+
// Generate it through the same prepack step that creates it in production,
|
|
600
|
+
// rather than committing copies back or skipping the case.
|
|
601
|
+
ensureAdapterSourceGenerated();
|
|
574
602
|
// Remove adapters
|
|
575
603
|
fs.rmSync(projectAdaptersDir(), { recursive: true, force: true });
|
|
576
604
|
mockExecSuccess();
|
package/lib/doctor.js
CHANGED
|
@@ -551,11 +551,18 @@ function gitLfsHookSource(filePath) {
|
|
|
551
551
|
*/
|
|
552
552
|
const HOOK_SUPPORT_FILES = [
|
|
553
553
|
'hook-module-resolution.sh',
|
|
554
|
-
// #798: the driver
|
|
555
|
-
//
|
|
554
|
+
// #798: the driver and its gate entries are support files, so they are
|
|
555
|
+
// refreshed unconditionally like the hooks themselves.
|
|
556
556
|
// Derived from the deploy manifest so this list cannot fall behind it.
|
|
557
|
+
//
|
|
558
|
+
// `lib/` is deliberately EXCLUDED even though the driver sources it: the lib/
|
|
559
|
+
// branch below carries the #488 refusal, which refuses to overwrite a shared
|
|
560
|
+
// library that holds machine-only lines. Listing lib/* here made that guard
|
|
561
|
+
// unreachable -- the unconditional copy in this loop ran first, `refused` stayed
|
|
562
|
+
// empty, and a sync silently destroyed local hardening. Two writers for one
|
|
563
|
+
// file, and the less careful one won.
|
|
557
564
|
...require('./deploy-manifest.js').MODULE_FILES.filter(
|
|
558
|
-
(rel) => rel === 'gate-driver.sh' || rel.startsWith('gate-entries/')
|
|
565
|
+
(rel) => rel === 'gate-driver.sh' || rel.startsWith('gate-entries/'),
|
|
559
566
|
),
|
|
560
567
|
];
|
|
561
568
|
|
package/lib/gate-runner.js
CHANGED
|
@@ -875,31 +875,54 @@ async function runGate(gateId, targetPath, opts = {}) {
|
|
|
875
875
|
|
|
876
876
|
if (gate.run) {
|
|
877
877
|
console.log(`━━━ Gate ${gateId}: ${gate.name} ━━━`);
|
|
878
|
-
|
|
879
|
-
// #589: pass the scope through so a handler that shells out to a fragment
|
|
880
|
-
// can resolve its file list from the tree under --all. Handlers that ignore
|
|
881
|
-
// the second argument are unaffected.
|
|
882
|
-
const result = gate.run(targetPath, opts);
|
|
883
|
-
if (result && typeof result.then === 'function') {
|
|
884
|
-
return await result;
|
|
885
|
-
}
|
|
886
|
-
// A synchronous handler's verdict MUST be propagated (#563). Gates 3, 7,
|
|
887
|
-
// 8 and 9 reach runTsGate(), which returns a plain number; reporting a
|
|
888
|
-
// manufactured 0 for them made `xp-gate check` unable to distinguish a
|
|
889
|
-
// failing gate from a passing one. Handlers that return nothing at all
|
|
890
|
-
// (gate 2, whose execFileSync throws on a non-zero exit instead) are
|
|
891
|
-
// still treated as pass, because their failure signal is the throw below.
|
|
892
|
-
if (result === GATE_NOT_RUN) return GATE_NOT_RUN;
|
|
893
|
-
return typeof result === 'number' ? result : 0;
|
|
894
|
-
} catch (err) {
|
|
895
|
-
// Covers a synchronous throw AND a rejection from the awaited handler.
|
|
896
|
-
console.error(` Gate ${gateId} FAILED: ${err.message}`);
|
|
897
|
-
return 1;
|
|
898
|
-
}
|
|
878
|
+
return invokeGateHandler(gateId, gate, targetPath, opts);
|
|
899
879
|
}
|
|
900
880
|
|
|
901
881
|
console.error(`Gate ${gateId}: ${gate.name} — no execution handler available`);
|
|
902
882
|
return 1;
|
|
903
883
|
}
|
|
904
884
|
|
|
905
|
-
|
|
885
|
+
/**
|
|
886
|
+
* Call a gate's execution handler and normalise its verdict to a number.
|
|
887
|
+
*
|
|
888
|
+
* Extracted from runGate(): that function is a dispatch (unknown gate →
|
|
889
|
+
* pre-commit-only gate → handler → no handler) and this is the one branch with
|
|
890
|
+
* real logic in it, so keeping both in one body pushed it past the 50-line limit
|
|
891
|
+
* the Boy Scout rule enforces on a file it touches.
|
|
892
|
+
*
|
|
893
|
+
* The verdict rules, unchanged from the inline version:
|
|
894
|
+
* - a promise is awaited (a rejection surfaces in the catch below);
|
|
895
|
+
* - GATE_NOT_RUN passes through untouched (#778) so "nothing ran" never
|
|
896
|
+
* exits like "ran clean";
|
|
897
|
+
* - a sync handler's number is propagated (#563) -- manufacturing 0 for gates
|
|
898
|
+
* 3/7/8/9 made `xp-gate check` unable to report a failure;
|
|
899
|
+
* - a handler that returns nothing counts as pass, because gate 2's failure
|
|
900
|
+
* signal is the throw from execFileSync, not a return value.
|
|
901
|
+
*/
|
|
902
|
+
async function invokeGateHandler(gateId, gate, targetPath, opts) {
|
|
903
|
+
try {
|
|
904
|
+
// #589: pass the scope through so a handler that shells out to a fragment can
|
|
905
|
+
// resolve its file list from the tree under --all. Handlers that ignore the
|
|
906
|
+
// second argument are unaffected.
|
|
907
|
+
const result = gate.run(targetPath, opts);
|
|
908
|
+
if (result && typeof result.then === 'function') {
|
|
909
|
+
return await result;
|
|
910
|
+
}
|
|
911
|
+
if (result === GATE_NOT_RUN) return GATE_NOT_RUN;
|
|
912
|
+
return typeof result === 'number' ? result : 0;
|
|
913
|
+
} catch (err) {
|
|
914
|
+
// Covers a synchronous throw AND a rejection from the awaited handler.
|
|
915
|
+
console.error(` Gate ${gateId} FAILED: ${err.message}`);
|
|
916
|
+
return 1;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
module.exports = { findConsumerGateVariant, GATE_REGISTRY, GATE_NOT_RUN, getGateInfo, getAllGates, runGate, resolveAlias, getAliases, runGateAdapter, findTsGateEntry, resolveGateScript, resolveTsxInvocation, findTsxCli, SOURCE_FILE_EXTENSIONS, resolveAllModeChangedFiles, describeEmptyChangedFiles, describeChangedFilesScope,
|
|
921
|
+
// AC-670-03 asserts the --all preamble END-TO-END: that an all-mode run hands
|
|
922
|
+
// the security gates a non-empty file population sourced from the list file and
|
|
923
|
+
// sets GATE_SCOPE="all". With these unexported, the case could only take its
|
|
924
|
+
// `skip "buildPreamble is not exported"` branch, so the end-to-end check it was
|
|
925
|
+
// written for never ran -- and the unit tests it defers to assert the pieces
|
|
926
|
+
// separately, which is precisely the seam this case covers. Both are pure
|
|
927
|
+
// string builders with no side effects, so exporting them costs nothing.
|
|
928
|
+
buildPreamble, buildFileSourceLines };
|
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.2.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.2.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.2",
|
|
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.2.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.2.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.
|
|
@@ -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.2.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.2",
|
|
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.2.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.2.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.
|
|
@@ -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.2.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.2.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.2.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.
|
|
@@ -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.2.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.2",
|
|
4
4
|
"displayName": "XP-Gate",
|
|
5
5
|
"description": "Extreme Programming quality gates + AI workflow skills for Qoder. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
|
|
6
6
|
"author": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.2.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.2.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.
|
|
@@ -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.2.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
package/principles/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.2.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Clean Code & SOLID principles checker — **Gate 4** of pre-commit. 14 rules × 9 language adapters, SARIF 2.1.0 output. Houses the **Boy Scout Rule** enforcement engine (Gate 6) and warning-baseline storage.
|
|
@@ -62,6 +62,31 @@ const JAVA_IO_OPERATIONS = [
|
|
|
62
62
|
'Socket',
|
|
63
63
|
];
|
|
64
64
|
|
|
65
|
+
/** True for a token that carries text, used to drop the empty slots of a split. */
|
|
66
|
+
function isNonBlank(token: string): boolean {
|
|
67
|
+
return token.trim().length > 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** True when `code` mentions this I/O operation. */
|
|
71
|
+
function mentionsIoOperation(code: string, operation: string): boolean {
|
|
72
|
+
return code.includes(operation);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The I/O operations a method body mentions, in declaration order.
|
|
77
|
+
*
|
|
78
|
+
* A plain loop rather than `JAVA_IO_OPERATIONS.filter(...)`: the ratchet scores
|
|
79
|
+
* the arrow callback as its own anonymous function, and it was the last one
|
|
80
|
+
* above the CCN-10 threshold in this adapter.
|
|
81
|
+
*/
|
|
82
|
+
function ioOperationsIn(code: string): string[] {
|
|
83
|
+
const found: string[] = [];
|
|
84
|
+
for (const operation of JAVA_IO_OPERATIONS) {
|
|
85
|
+
if (mentionsIoOperation(code, operation)) found.push(operation);
|
|
86
|
+
}
|
|
87
|
+
return found;
|
|
88
|
+
}
|
|
89
|
+
|
|
65
90
|
/**
|
|
66
91
|
* Numeric literal scan for the magic-numbers rule. Lookahead mirrors the
|
|
67
92
|
* TypeScript adapter (`(?![\w$])`): digits as call arguments (`foo(2)`) are
|
|
@@ -355,27 +380,39 @@ export class JavaAdapter extends BaseAdapter implements Adapter {
|
|
|
355
380
|
let match;
|
|
356
381
|
|
|
357
382
|
while ((match = methodRegex.exec(maskedContent)) !== null) {
|
|
358
|
-
|
|
359
|
-
const line = javaParse.lineOf(maskedContent, match.index);
|
|
360
|
-
const masked = code; // already masked (extracted from maskedContent)
|
|
361
|
-
results.push({
|
|
362
|
-
name: match[2],
|
|
363
|
-
type: 'method',
|
|
364
|
-
modifiers: match[1].split(/\s+/).filter(m => m.trim()),
|
|
365
|
-
line,
|
|
366
|
-
startLine: line,
|
|
367
|
-
length: code ? code.split('\n').length : 0,
|
|
368
|
-
paramCount: javaParse.countParams(match[3] ?? ''),
|
|
369
|
-
nestingDepth: javaParse.braceDepth(masked),
|
|
370
|
-
hasTryCatch: /catch\s*\(/.test(masked),
|
|
371
|
-
ioOperations: JAVA_IO_OPERATIONS.filter(op => masked.includes(op)),
|
|
372
|
-
code
|
|
373
|
-
});
|
|
383
|
+
results.push(this.toFunctionInfo(match, maskedContent));
|
|
374
384
|
}
|
|
375
385
|
|
|
376
386
|
return results;
|
|
377
387
|
}
|
|
378
388
|
|
|
389
|
+
/**
|
|
390
|
+
* Build one method descriptor from a regex match.
|
|
391
|
+
*
|
|
392
|
+
* Extracted from the `results.push({...})` literal that used to sit in the
|
|
393
|
+
* loop above: the object needed four arrow callbacks (`split`, `filter` for
|
|
394
|
+
* modifiers, and another `filter` for I/O operations), and the ratchet scores
|
|
395
|
+
* each callback as its own anonymous function -- two of them landed above the
|
|
396
|
+
* CCN-10 block threshold inside a method that is itself below it.
|
|
397
|
+
*/
|
|
398
|
+
private toFunctionInfo(match: RegExpExecArray, maskedContent: string): JavaFunctionInfo {
|
|
399
|
+
const code = javaParse.extractBracedBlock(maskedContent, match.index) ?? '';
|
|
400
|
+
const line = javaParse.lineOf(maskedContent, match.index);
|
|
401
|
+
return {
|
|
402
|
+
name: match[2],
|
|
403
|
+
type: 'method',
|
|
404
|
+
modifiers: match[1].split(/\s+/).filter(isNonBlank),
|
|
405
|
+
line,
|
|
406
|
+
startLine: line,
|
|
407
|
+
length: code ? code.split('\n').length : 0,
|
|
408
|
+
paramCount: javaParse.countParams(match[3] ?? ''),
|
|
409
|
+
nestingDepth: javaParse.braceDepth(code),
|
|
410
|
+
hasTryCatch: /catch\s*\(/.test(code),
|
|
411
|
+
ioOperations: ioOperationsIn(code),
|
|
412
|
+
code
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
|
|
379
416
|
extractClasses(): unknown[] {
|
|
380
417
|
const classMatches = [];
|
|
381
418
|
// Generic type parameters -- `class Box<T>`, `class Foo<T> extends Bar<T>` --
|
|
@@ -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.2.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.2.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.
|
|
@@ -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.2.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|