@boyingliu01/xp-gate 0.31.3 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapters/java.sh +256 -4
- package/adapters/powershell.sh +45 -6
- package/bin/xp-gate.js +8 -2
- package/build-integrity/__tests__/gate-10.test.ts +88 -1
- package/build-integrity/gate-10.ts +51 -16
- package/dsh.bundle.patch.yml +15 -0
- package/gate-13-compiler-strictness.sh +1031 -0
- package/gate-3.sh +48 -13
- package/hooks/gate-13-compiler-strictness.sh +1031 -0
- package/hooks/gate-3.sh +48 -13
- package/hooks/lib/coverage-total.sh +18 -2
- package/hooks/lib/java-test-selection.sh +251 -0
- package/hooks/lib/jscpd-run.sh +9 -0
- package/hooks/lib/validate-code-walkthrough.cjs +186 -29
- package/hooks/pre-commit +269 -13
- package/lib/__tests__/detect-deps-dsh-profile.test.js +106 -0
- package/lib/__tests__/doctor-tui-skill-freshness.test.js +140 -0
- package/lib/__tests__/gate-runner.test.js +29 -2
- package/lib/__tests__/issue-586-principles-cmdline.test.js +35 -0
- package/lib/__tests__/issue-618-gate-not-run.test.js +100 -0
- package/lib/__tests__/shared-utils.test.js +21 -0
- package/lib/check.js +6 -2
- package/lib/detect-deps.js +42 -10
- package/lib/doctor-tui.js +111 -21
- package/lib/gate-runner.js +111 -37
- package/lib/mattpocock-license-verdict.json +1 -1
- package/lib/principles.js +48 -6
- package/lib/shared-utils.js +8 -0
- package/mock-policy/AGENTS.md +3 -3
- package/mock-policy/gate-m3.ts +57 -23
- package/mutation/AGENTS.md +3 -3
- package/mutation/__tests__/pitest-gradle-availability.test.ts +74 -0
- package/mutation/__tests__/test-filter-parity.test.ts +5 -2
- package/mutation/gate-m.ts +30 -24
- package/mutation/runners/mutmut-runner.ts +80 -30
- package/mutation/runners/pitest-runner.ts +60 -42
- package/package.json +14 -2
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/dsh/lib/command.d.ts +38 -0
- package/plugins/dsh/lib/command.d.ts.map +1 -0
- package/plugins/dsh/lib/command.js +87 -0
- package/plugins/dsh/lib/credentials.d.ts +39 -0
- package/plugins/dsh/lib/credentials.d.ts.map +1 -0
- package/plugins/dsh/lib/credentials.js +57 -0
- package/plugins/dsh/lib/delphi-config.d.ts +129 -0
- package/plugins/dsh/lib/delphi-config.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-config.js +369 -0
- package/plugins/dsh/lib/delphi-run.d.ts +24 -0
- package/plugins/dsh/lib/delphi-run.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi-run.js +113 -0
- package/plugins/dsh/lib/delphi.d.ts +94 -0
- package/plugins/dsh/lib/delphi.d.ts.map +1 -0
- package/plugins/dsh/lib/delphi.js +207 -0
- package/plugins/dsh/lib/dialect.d.ts +24 -0
- package/plugins/dsh/lib/dialect.d.ts.map +1 -0
- package/plugins/dsh/lib/dialect.js +36 -0
- package/plugins/dsh/lib/evidence.d.ts +70 -0
- package/plugins/dsh/lib/evidence.d.ts.map +1 -0
- package/plugins/dsh/lib/evidence.js +92 -0
- package/plugins/dsh/lib/gate-runner.d.ts +49 -0
- package/plugins/dsh/lib/gate-runner.d.ts.map +1 -0
- package/plugins/dsh/lib/gate-runner.js +95 -0
- package/plugins/dsh/lib/git-context.d.ts +26 -0
- package/plugins/dsh/lib/git-context.d.ts.map +1 -0
- package/plugins/dsh/lib/git-context.js +30 -0
- package/plugins/dsh/lib/hooks.d.ts +42 -0
- package/plugins/dsh/lib/hooks.d.ts.map +1 -0
- package/plugins/dsh/lib/hooks.js +113 -0
- package/plugins/dsh/lib/index.d.ts +20 -0
- package/plugins/dsh/lib/index.d.ts.map +1 -0
- package/plugins/dsh/lib/index.js +430 -0
- package/plugins/dsh/lib/skill-provider.d.ts +15 -0
- package/plugins/dsh/lib/skill-provider.d.ts.map +1 -0
- package/plugins/dsh/lib/skill-provider.js +205 -0
- package/plugins/dsh/lib/sprint.d.ts +60 -0
- package/plugins/dsh/lib/sprint.d.ts.map +1 -0
- package/plugins/dsh/lib/sprint.js +92 -0
- package/plugins/dsh/package.json +14 -8
- package/plugins/dsh/scripts/verify-skill-provider.mjs +113 -0
- package/plugins/dsh/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/dsh/src/command-single-form.test.ts +67 -0
- package/plugins/dsh/src/command.test.ts +21 -17
- package/plugins/dsh/src/command.ts +19 -21
- package/plugins/dsh/src/compat.test.ts +200 -0
- package/plugins/dsh/src/contract.test.ts +7 -1
- package/plugins/dsh/src/credentials.test.ts +93 -0
- package/plugins/dsh/src/credentials.ts +71 -0
- package/plugins/dsh/src/delphi-cancellation.test.ts +71 -0
- package/plugins/dsh/src/delphi-config-apikey-override.test.ts +94 -0
- package/plugins/dsh/src/delphi-config-credential-refs.test.ts +75 -0
- package/plugins/dsh/src/delphi-config.ts +146 -53
- package/plugins/dsh/src/delphi-run.ts +27 -4
- package/plugins/dsh/src/delphi.ts +133 -65
- package/plugins/dsh/src/evidence.test.ts +74 -0
- package/plugins/dsh/src/evidence.ts +141 -0
- package/plugins/dsh/src/gate-runner.test.ts +14 -6
- package/plugins/dsh/src/gate-runner.ts +68 -5
- package/plugins/dsh/src/git-context.test.ts +39 -0
- package/plugins/dsh/src/git-context.ts +38 -0
- package/plugins/dsh/src/hooks.test.ts +87 -0
- package/plugins/dsh/src/hooks.ts +126 -0
- package/plugins/dsh/src/index.test.ts +63 -6
- package/plugins/dsh/src/index.ts +340 -13
- package/plugins/dsh/src/skill-provider.test.ts +194 -0
- package/plugins/dsh/src/skill-provider.ts +231 -0
- package/plugins/dsh/src/sprint.test.ts +64 -0
- package/plugins/dsh/src/sprint.ts +122 -0
- package/plugins/dsh/src/tri-state.test.ts +123 -0
- package/plugins/opencode/index.ts +192 -58
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
- package/principles/AGENTS.md +3 -3
- package/principles/__tests__/analyze-read-failure.test.ts +70 -0
- package/principles/__tests__/baseline-entry-total-warnings.test.ts +76 -0
- package/principles/__tests__/baseline-prune.test.ts +61 -0
- package/principles/__tests__/cli-files-separators.test.ts +69 -0
- package/principles/__tests__/config-merge-warnings.test.ts +148 -0
- package/principles/adapters/__tests__/cpp-code-block.test.ts +123 -0
- package/principles/adapters/__tests__/cpp-scanner-equivalence.test.ts +67 -0
- package/principles/adapters/__tests__/typescript-block-comment-lines.test.ts +53 -0
- package/principles/adapters/__tests__/typescript-masking.test.ts +96 -0
- package/principles/adapters/cpp.ts +102 -50
- package/principles/adapters/java.ts +22 -3
- package/principles/adapters/typescript.ts +548 -178
- package/principles/analyzer.ts +36 -3
- package/principles/baseline-prune.ts +19 -7
- package/principles/baseline.ts +58 -70
- package/principles/config.ts +56 -35
- package/principles/index.ts +122 -40
- package/principles/rules/clean-code/deep-nesting.ts +36 -22
- package/principles/rules/clean-code/unused-imports.ts +30 -19
- package/principles/rules/solid/dip.ts +30 -20
- package/principles/rules/solid/lsp.ts +17 -2
- package/principles/rules/solid/ocp.ts +33 -23
- package/principles/rules/solid/srp.ts +65 -23
- package/scripts/delphi-external-review.cjs +25 -2
- package/scripts/sync-package-content.js +28 -1
- package/skills/delphi-review/AGENTS.md +3 -3
- package/skills/sprint-flow/AGENTS.md +3 -3
- package/skills/test-specification-alignment/AGENTS.md +3 -3
package/gate-3.sh
CHANGED
|
@@ -339,17 +339,38 @@ else
|
|
|
339
339
|
if [ -n "$CC_FILES" ]; then
|
|
340
340
|
echo "Checking complexity for source files..."
|
|
341
341
|
|
|
342
|
-
# Run lizard
|
|
343
|
-
# One path per line, into an array. Unquoted $CC_FILES relied on word
|
|
344
|
-
#
|
|
345
|
-
#
|
|
346
|
-
#
|
|
347
|
-
#
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
342
|
+
# Run lizard in chunks. Two reasons, both load-bearing:
|
|
343
|
+
# - One path per line, into an array. Unquoted $CC_FILES relied on word
|
|
344
|
+
# splitting, which also splits any path containing a space -- handing
|
|
345
|
+
# lizard two bogus paths and checking neither (#457 defect class, same
|
|
346
|
+
# fix as gate-4's PRINCIPLES_ARGS). Quoting the scalar would instead
|
|
347
|
+
# collapse the list into one argument. An array does both.
|
|
348
|
+
# - Chunked instead of one argv. Windows caps a single command line at
|
|
349
|
+
# 32,767 characters, and under `--all` the population is the whole tree
|
|
350
|
+
# (1,000+ sources on a mid-sized repo). The oversized argv never reached
|
|
351
|
+
# lizard, nothing was printed, and the gate graded an empty CSV as if the
|
|
352
|
+
# tree were clean. XP_GATE_LIZARD_ARGV_BUDGET lets a probe force a split
|
|
353
|
+
# without needing a huge fixture.
|
|
354
|
+
LIZARD_ARGV_BUDGET="${XP_GATE_LIZARD_ARGV_BUDGET:-8000}"
|
|
355
|
+
lizard_batches() {
|
|
356
|
+
# stdin: one path per line. stdout: lizard output, batches concatenated.
|
|
357
|
+
local _batch=() _size=0 _path
|
|
358
|
+
while IFS= read -r _path; do
|
|
359
|
+
[ -n "$_path" ] || continue
|
|
360
|
+
if [ "${#_batch[@]}" -gt 0 ] && [ $((_size + ${#_path} + 1)) -gt "$LIZARD_ARGV_BUDGET" ]; then
|
|
361
|
+
"$LIZARD_PATH" "$@" "${_batch[@]}" 2>/dev/null || true
|
|
362
|
+
_batch=()
|
|
363
|
+
_size=0
|
|
364
|
+
fi
|
|
365
|
+
_batch+=("$_path")
|
|
366
|
+
_size=$((_size + ${#_path} + 1))
|
|
367
|
+
done
|
|
368
|
+
if [ "${#_batch[@]}" -gt 0 ]; then
|
|
369
|
+
"$LIZARD_PATH" "$@" "${_batch[@]}" 2>/dev/null || true
|
|
370
|
+
fi
|
|
371
|
+
return 0
|
|
372
|
+
}
|
|
373
|
+
CC_OUTPUT=$(printf '%s\n' "$CC_FILES" | lizard_batches -C "$CCN_THRESHOLD" 2>&1)
|
|
353
374
|
|
|
354
375
|
# REQ-D (sprint-20261018-quality): baseline ratchet. When
|
|
355
376
|
# .ccn-baseline.json exists it replaces the flat threshold verdict:
|
|
@@ -366,7 +387,7 @@ else
|
|
|
366
387
|
# Route the CSV through the same verifier; on rows it cannot verify the
|
|
367
388
|
# helper exits non-zero, and this gate fails closed instead of passing
|
|
368
389
|
# an unvalidated number.
|
|
369
|
-
CC_CSV=$(
|
|
390
|
+
CC_CSV=$(printf '%s\n' "$CC_FILES" | lizard_batches --csv)
|
|
370
391
|
CC_REPORT="$(git rev-parse --show-toplevel 2>/dev/null)/scripts/ccn-report.cjs"
|
|
371
392
|
# Fail closed when the verifier is unavailable. Previously this fell
|
|
372
393
|
# through and graded the RAW lizard CSV, while CI hard-fails on the same
|
|
@@ -392,6 +413,20 @@ else
|
|
|
392
413
|
fi
|
|
393
414
|
RATCHET_LIB="$GATE_DIR/lib/ccn-ratchet.sh"
|
|
394
415
|
[ -f "$RATCHET_LIB" ] || RATCHET_LIB="$(git rev-parse --show-toplevel 2>/dev/null)/githooks/lib/ccn-ratchet.sh"
|
|
416
|
+
# Fail closed when the ratchet library is missing. Sourcing a nonexistent
|
|
417
|
+
# file only prints "No such file or directory" and leaves
|
|
418
|
+
# evaluate_ccn_ratchet undefined; the verdict then came back empty, every
|
|
419
|
+
# counter read 0 and the gate printed "✅ PASSED" — a CCN regression graded
|
|
420
|
+
# green with nothing compared. The installer never created this path
|
|
421
|
+
# (copyAdapters skipped hooks/lib), so this was the normal state after a
|
|
422
|
+
# global install, not an exotic one.
|
|
423
|
+
if [ ! -f "$RATCHET_LIB" ]; then
|
|
424
|
+
echo "❌ BLOCKED - complexity ratchet library unavailable (ccn-ratchet.sh)."
|
|
425
|
+
echo "Expected at \$GATE_DIR/lib/ccn-ratchet.sh or <repo>/githooks/lib/ccn-ratchet.sh."
|
|
426
|
+
echo "Reinstall with 'xp-gate init --global' (or 'xp-gate update-hooks') to restore it."
|
|
427
|
+
GATE_3_DETAIL="mode=ratchet ratchet=MISSING"
|
|
428
|
+
exit 1
|
|
429
|
+
fi
|
|
395
430
|
# shellcheck source=/dev/null
|
|
396
431
|
. "$RATCHET_LIB"
|
|
397
432
|
# NOTE: the thresholds must be plain assignments BEFORE the pipe. As a
|
|
@@ -436,7 +471,7 @@ else
|
|
|
436
471
|
# file,name,signature,...), so the verdict comes from the same numbers
|
|
437
472
|
# lizard uses, independent of version and table formatting. --csv here is
|
|
438
473
|
# the flat-threshold run; the ratchet branch above builds its own.
|
|
439
|
-
CC_CSV_FLAT=$("$
|
|
474
|
+
CC_CSV_FLAT=$(printf '%s\n' "$CC_FILES" | lizard_batches --csv -C "$CCN_THRESHOLD")
|
|
440
475
|
CC_WARNINGS=$(printf '%s\n' "$CC_CSV_FLAT" | awk -F, -v t="$CCN_THRESHOLD" '
|
|
441
476
|
NF > 1 && $2 + 0 > t + 0 { c++ }
|
|
442
477
|
END { print c + 0 }
|