@boyingliu01/xp-gate 0.41.4 → 0.41.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/adapters/iac.sh CHANGED
@@ -57,6 +57,77 @@ detect_iac_files() {
57
57
  echo "DOCKER:$dockerfile_files"
58
58
  }
59
59
 
60
+ # ---------------------------------------------------------------------------
61
+ # Resolve a checkov that can actually EXECUTE, not merely one that answers.
62
+ #
63
+ # #596 screened out a shim that HANGS on `--version`. That is not the only way a
64
+ # shim fails: on WSL with appendWindowsPath=true, a Windows shim sits in PATH
65
+ # ahead of the Linux install, answers `--version` correctly, and then exits 126
66
+ # on EVERY real scan (`bad interpreter: No such file or directory`). The gate
67
+ # correctly refuses to call that a pass -- and blocks every IaC commit, for a
68
+ # reason about the environment rather than the code. The working Linux checkov
69
+ # one PATH entry later is never reached, because the loop stopped at the first
70
+ # candidate that answered.
71
+ #
72
+ # So a candidate is accepted only when a real invocation survives. `--compact`
73
+ # against an empty directory is the cheapest thing that exercises the interpreter
74
+ # and the imports without touching a project; a shim dies on it exactly as it
75
+ # would on the real run.
76
+ #
77
+ # Sets:
78
+ # _checkov_picked absolute path of the chosen binary, or empty
79
+ # _checkov_seen_nonexec 1 when something was on PATH but nothing worked
80
+ # ---------------------------------------------------------------------------
81
+ # Resolve a checkov by searching EVERY path entry, not just the first match.
82
+ #
83
+ # #596 screened out a shim that HANGS on `--version`, and that probe stays: a
84
+ # candidate must answer before it is considered.
85
+ #
86
+ # What is added is the search itself. `command -v checkov` returns the EARLIEST
87
+ # match on PATH, and on WSL with appendWindowsPath=true that is exactly the
88
+ # Windows shim that cannot scan -- while a working Linux checkov sits one
89
+ # directory later, never reached because the loop stopped at the first answer.
90
+ # Measured on the reporter's machine: the gate blocked every IaC commit over an
91
+ # environment fault, and the working install was in PATH the whole time.
92
+ #
93
+ # WHAT THIS DOES NOT DO. It does not prove a candidate can SCAN. The failing kind
94
+ # of shim prints `--version` correctly (its first line is a valid `sh` script) and
95
+ # only dies when the interpreter behind it is needed, so no cheap check can tell
96
+ # it apart -- and the only check that would costs a full checkov start (~20 s
97
+ # cold) on EVERY commit, while breaking the invariant that a change set is
98
+ # scanned in one launch. That trade was considered and rejected: a per-commit
99
+ # cost for a WSL-only symptom is the wrong side of it. A shim that answers and
100
+ # still cannot scan falls through to the existing fail-closed verdict, which is
101
+ # correct -- it just is not the cheapest one to reach.
102
+ #
103
+ # Sets:
104
+ # _checkov_picked absolute path of the chosen binary, or empty
105
+ # _checkov_seen_nonexec 1 when something was found on PATH but none answered
106
+ # ---------------------------------------------------------------------------
107
+ _checkov_resolve() {
108
+ _checkov_picked=""
109
+ _checkov_seen_nonexec=0
110
+ local _candidate _dir _full _probe _budget=""
111
+ # #803: the budget must exceed the cost of the thing being timed. `checkov
112
+ # --version` measures 22.4 s on Windows with a cold pip cache, so a 20 s limit
113
+ # screened out a tool that worked. This probe catches a HANG, not a slow start.
114
+ command -v timeout >/dev/null 2>&1 && _budget="timeout 60 "
115
+
116
+ for _candidate in checkov checkov.exe checkov.cmd; do
117
+ for _dir in ${PATH//:/ }; do
118
+ [ -n "$_dir" ] || continue
119
+ _full="$_dir/$_candidate"
120
+ [ -f "$_full" ] && [ -x "$_full" ] || continue
121
+ _probe="${_budget}\"$_full\" --version"
122
+ if eval "$_probe" >/dev/null 2>&1; then
123
+ _checkov_picked="$_full"
124
+ return 0
125
+ fi
126
+ _checkov_seen_nonexec=1
127
+ done
128
+ done
129
+ return 0
130
+ }
60
131
  run_static_analysis() {
61
132
  local changed_files="$1"
62
133
  # Gate 1 calls this with NO argument (githooks/gate-entries/gate-1-entry.sh
@@ -72,7 +143,8 @@ run_static_analysis() {
72
143
  if [ -z "$changed_files" ] && [ -n "${CHANGED_FILES:-}" ]; then
73
144
  changed_files="$CHANGED_FILES"
74
145
  fi
75
- local iac_files=$(detect_iac_files "$changed_files")
146
+ local iac_files
147
+ iac_files=$(detect_iac_files "$changed_files")
76
148
 
77
149
  # Check if any IaC files are present
78
150
  local has_iac=false
@@ -195,6 +267,7 @@ TFEOF
195
267
  echo " syntax validation did not run."
196
268
  fi
197
269
  fi
270
+
198
271
  # #803: counts scanner/file pairs that actually ran, independent of their
199
272
  # verdict. `exit_code == 0` answers "did anything fail?"; it cannot answer "did
200
273
  # anything run?", and using it for both made a clean scan indistinguishable from
@@ -216,34 +289,9 @@ TFEOF
216
289
  # wrapper must not block the commit forever. `timeout` is absent on stock
217
290
  # macOS, so it is used only when available; the probe is a local version
218
291
  # print either way.
219
- local checkov_bin=""
220
- local _checkov_candidate
221
- local _checkov_seen_nonexec=0
222
- local _checkov_probe
223
- for _checkov_candidate in checkov checkov.exe checkov.cmd; do
224
- command -v "$_checkov_candidate" >/dev/null 2>&1 || continue
225
- if command -v timeout >/dev/null 2>&1; then
226
- # #803: the budget must exceed the cost of the thing being timed. It was 20 s,
227
- # and `checkov --version` measures 22.4 s on Windows with a cold pip cache
228
- # (python startup + imports, not network). So the probe timed out, checkov was
229
- # screened out as unusable, and the gate spent the commit pretending the tool
230
- # was not installed — while checkov 3.3.30 was on PATH and passing the very
231
- # file being committed.
232
- #
233
- # The probe exists to catch a shim that does not answer (#596), which is a
234
- # hang, not a slow start. A tool that answers in 25 s is not a broken shim, and
235
- # a false "not installed" is the more expensive error here: it silences a
236
- # scanner that works. Generous, still bounded.
237
- _checkov_probe="timeout 60 $_checkov_candidate --version"
238
- else
239
- _checkov_probe="$_checkov_candidate --version"
240
- fi
241
- if $_checkov_probe >/dev/null 2>&1; then
242
- checkov_bin=$(command -v "$_checkov_candidate")
243
- break
244
- fi
245
- _checkov_seen_nonexec=1
246
- done
292
+ _checkov_resolve
293
+ local checkov_bin="$_checkov_picked"
294
+ local _checkov_seen_nonexec="$_checkov_seen_nonexec"
247
295
  # "Not installed" and "installed but unusable" both end up without a scanner,
248
296
  # and the fallbacks below keep the gate useful -- but they are not the same
249
297
  # situation, and silently treating a broken install as absent hides a lost
@@ -263,7 +311,8 @@ TFEOF
263
311
  # anything. Counting a traceback as findings invents security issues; a
264
312
  # traceback that happens to lack the marker reports a clean pass. Both are
265
313
  # wrong, so a crash is tracked separately and answered as "unusable" (#552).
266
- local checkov_log=$(mktemp)
314
+ local checkov_log
315
+ checkov_log=$(mktemp)
267
316
  local checkov_args="--compact"
268
317
  local CHECKOV_CRASHED=0
269
318
  local checkov_scan_count=0
@@ -334,9 +383,12 @@ TFEOF
334
383
  }
335
384
 
336
385
  # Run checkov on all detected IaC files
337
- local tf_files=$(echo "$iac_files" | grep "TERRAFORM:" | sed 's/TERRAFORM://')
338
- local k8s_files=$(echo "$iac_files" | grep "KUBERNETES:" | sed 's/KUBERNETES://')
339
- local docker_files=$(echo "$iac_files" | grep "DOCKER:" | sed 's/DOCKER://')
386
+ local tf_files
387
+ tf_files=$(echo "$iac_files" | grep "TERRAFORM:" | sed 's/TERRAFORM://')
388
+ local k8s_files
389
+ k8s_files=$(echo "$iac_files" | grep "KUBERNETES:" | sed 's/KUBERNETES://')
390
+ local docker_files
391
+ docker_files=$(echo "$iac_files" | grep "DOCKER:" | sed 's/DOCKER://')
340
392
 
341
393
  if [ -n "$tf_files" ]; then
342
394
  echo "Scanning Terraform files..."
@@ -395,7 +447,8 @@ TFEOF
395
447
  return 2
396
448
  fi
397
449
 
398
- local failed_count=$(grep -c "FAILED for resource" "$checkov_log" 2>/dev/null || true)
450
+ local failed_count
451
+ failed_count=$(grep -c "FAILED for resource" "$checkov_log" 2>/dev/null || true)
399
452
  rm -f "$checkov_log"
400
453
 
401
454
  if [ "$failed_count" -gt 0 ]; then
@@ -403,13 +456,14 @@ TFEOF
403
456
  exit_code=1
404
457
  fi
405
458
  echo "checkov scan completed ($checkov_scan_count file(s) scanned)."
406
- return $exit_code
459
+ return "$exit_code"
407
460
  fi
408
461
 
409
462
  # Fallback to individual tools if checkov not available
410
463
 
411
464
  # Try hadolint for Docker
412
- local docker_files=$(echo "$iac_files" | grep "DOCKER:" | sed 's/DOCKER://')
465
+ local docker_files
466
+ docker_files=$(echo "$iac_files" | grep "DOCKER:" | sed 's/DOCKER://')
413
467
  if [ -n "$docker_files" ] && command -v hadolint >/dev/null 2>&1; then
414
468
  echo "Running hadolint for Dockerfiles..."
415
469
  for file in $docker_files; do
@@ -417,7 +471,7 @@ TFEOF
417
471
  hadolint "$file" 2>&1 | tail -20
418
472
  iac_scans_completed=$((iac_scans_completed + 1))
419
473
  local hadolint_exit=${PIPESTATUS[0]}
420
- if [ $hadolint_exit -ne 0 ]; then
474
+ if [ "$hadolint_exit" -ne 0 ]; then
421
475
  exit_code=$hadolint_exit
422
476
  fi
423
477
  fi
@@ -425,7 +479,8 @@ TFEOF
425
479
  fi
426
480
 
427
481
  # Try kube-score for Kubernetes
428
- local k8s_files=$(echo "$iac_files" | grep "KUBERNETES:" | sed 's/KUBERNETES://')
482
+ local k8s_files
483
+ k8s_files=$(echo "$iac_files" | grep "KUBERNETES:" | sed 's/KUBERNETES://')
429
484
  if [ -n "$k8s_files" ] && command -v kube-score >/dev/null 2>&1; then
430
485
  echo "Running kube-score for Kubernetes..."
431
486
  for file in $k8s_files; do
@@ -433,7 +488,7 @@ TFEOF
433
488
  kube-score score "$file" 2>&1 | tail -20
434
489
  iac_scans_completed=$((iac_scans_completed + 1))
435
490
  local kube_exit=${PIPESTATUS[0]}
436
- if [ $kube_exit -ne 0 ]; then
491
+ if [ "$kube_exit" -ne 0 ]; then
437
492
  exit_code=$kube_exit
438
493
  fi
439
494
  fi
@@ -441,7 +496,8 @@ TFEOF
441
496
  fi
442
497
 
443
498
  # Try tflint for Terraform
444
- local tf_files=$(echo "$iac_files" | grep "TERRAFORM:" | sed 's/TERRAFORM://')
499
+ local tf_files
500
+ tf_files=$(echo "$iac_files" | grep "TERRAFORM:" | sed 's/TERRAFORM://')
445
501
  if [ -n "$tf_files" ] && command -v tflint >/dev/null 2>&1; then
446
502
  echo "Running tflint for Terraform..."
447
503
  for file in $tf_files; do
@@ -449,7 +505,7 @@ TFEOF
449
505
  tflint --chdir "$(dirname "$file")" 2>&1 | tail -20
450
506
  iac_scans_completed=$((iac_scans_completed + 1))
451
507
  local tflint_exit=${PIPESTATUS[0]}
452
- if [ $tflint_exit -ne 0 ]; then
508
+ if [ "$tflint_exit" -ne 0 ]; then
453
509
  exit_code=$tflint_exit
454
510
  fi
455
511
  fi
@@ -489,7 +545,7 @@ TFEOF
489
545
  # its reader that the gate is broken, and the next honest commit looks like the
490
546
  # one that needed a bypass.
491
547
  echo "IaC scan completed: $iac_scans_completed scanner file(s) checked, no findings."
492
- return $exit_code
548
+ return "$exit_code"
493
549
  }
494
550
 
495
551
  run_lint() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.41.4",
3
+ "version": "0.41.5",
4
4
  "description": "Deterministic quality gates for AI-generated code: 15 gates, Delphi review, sprint flow. Works with Claude Code, OpenCode, Qoder.",
5
5
  "bin": {
6
6
  "xp-gate": "bin/xp-gate.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-gate",
3
- "version": "0.41.4",
3
+ "version": "0.41.5",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
6
6
  "author": {
@@ -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.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; 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.41.4.0
6
+ **Version:** 0.41.5.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": "@boyingliu01/dsh-plugin-xp-gate",
3
- "version": "0.41.4",
3
+ "version": "0.41.5",
4
4
  "description": "XP-Gate deterministic quality gates + AI workflow skills as a DeepSeek Harness (DSH) native plugin: gate-check / gate-principles / gate-arch tools + 12 SKILL.md skills",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; 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.41.4.0
6
+ **Version:** 0.41.5.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": "@boyingliu01/opencode-plugin",
3
- "version": "0.41.4",
3
+ "version": "0.41.5",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "description": "XP-Gate quality gates + AI workflow skills for OpenCode",
@@ -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.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; 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.41.4.0
6
+ **Version:** 0.41.5.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.41.4",
3
+ "version": "0.41.5",
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.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; 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.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; 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.41.4.0
6
+ **Version:** 0.41.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.