@boyingliu01/xp-gate 0.38.17 → 0.38.18

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/gate-10.sh CHANGED
@@ -424,6 +424,51 @@ console.log("");});
424
424
  # shellcheck disable=SC2034
425
425
  GATE_10_REASON="output_unparseable"
426
426
  fi
427
+ elif [ "${V_RESULTS:-0}" -eq 0 ] && printf '%s\n' "${SEMGREP_OUTPUT:-}" | grep -qi 'No code rules to run'; then
428
+ # A scan that loaded NO RULES reports results:[] and errors:[] -- a legal,
429
+ # successful, empty report, which is exactly what the PASS arm below is
430
+ # meant for. semgrep says so on stderr, and it is the only signal that
431
+ # separates this from a real clean scan:
432
+ #
433
+ # rules: [] -> "No code rules to run."
434
+ # p/security-audit -> "with 225 Code rules:"
435
+ #
436
+ # TWO EARLIER DRAFTS OF THIS CHECK WERE WRONG, and both are recorded
437
+ # because each one looked reasonable:
438
+ #
439
+ # 1. time.rules. That is semgrep's per-rule PROFILING list, empty on every
440
+ # healthy run -- a 225-rule scan reports time.rules:[]. Guarding on it
441
+ # would have turned every good scan into a SKIP.
442
+ # 2. paths.scanned == 0. Right for the empty-ruleset case, but it ALSO
443
+ # fires when the changed files are deliberately suppressed through
444
+ # .semgrepignore: measured, AC-543-02 went red because a legitimate
445
+ # "this file is ignored" result was reported as "nothing was examined".
446
+ # Deliberate suppression is a decision, not a failure.
447
+ #
448
+ # The stderr message has neither problem: it reports the rule count, which
449
+ # is the thing that actually distinguishes "could not load a ruleset" from
450
+ # "loaded a ruleset and it had nothing to say".
451
+ #
452
+ # Findings take precedence (V_RESULTS -eq 0 is required). If semgrep DID
453
+ # report something, it obviously ran, and the blocking arm must see it.
454
+ #
455
+ # #717 already found this shape once, in one language: p/security-audit
456
+ # carries no C# rules, so a .cs file with a textbook SQL injection scored 0.
457
+ # That was fixed by adding a second --config; the SHAPE -- clean because
458
+ # nothing was loaded -- stayed reachable for every other cause (registry
459
+ # unreachable mid-scan, an empty cached ruleset, a bad --config path).
460
+ #
461
+ # A security gate reporting "clean" because it loaded nothing is the
462
+ # failure the fail-closed convention exists to prevent, so this SKIPs with
463
+ # its own reason rather than folding into the clean-scan PASS.
464
+ echo " ⚠️ semgrep loaded no code rules — nothing was checked, so this is not a clean result"
465
+ echo " The ruleset was empty or could not be resolved. Try:"
466
+ echo " semgrep --config=p/security-audit <file>"
467
+ echo " ⏭️ SKIPPED - SAST (no rules loaded, nothing verified)"
468
+ GATE_10_STATUS="SKIP"
469
+ # Consumed by the sourcing parent (pre-commit report JSON), not here.
470
+ # shellcheck disable=SC2034
471
+ GATE_10_REASON="zero_rules"
427
472
  elif [ "$V_RESULTS" -eq 0 ] && { [ "$V_ERRORS" -gt 0 ] || [ "$SEMGREP_EXIT" -ne 0 ]; }; then
428
473
  # Nothing was scanned to a verdict: semgrep either failed outright
429
474
  # (nonzero exit) or completed but reported scan errors for every input
package/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
- exit 1
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
- record_gate_audit "gate-7" "iac-security" "$GATE_7_STATUS" "0" "$GATE_7_START"
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"
package/hooks/gate-10.sh CHANGED
@@ -424,6 +424,51 @@ console.log("");});
424
424
  # shellcheck disable=SC2034
425
425
  GATE_10_REASON="output_unparseable"
426
426
  fi
427
+ elif [ "${V_RESULTS:-0}" -eq 0 ] && printf '%s\n' "${SEMGREP_OUTPUT:-}" | grep -qi 'No code rules to run'; then
428
+ # A scan that loaded NO RULES reports results:[] and errors:[] -- a legal,
429
+ # successful, empty report, which is exactly what the PASS arm below is
430
+ # meant for. semgrep says so on stderr, and it is the only signal that
431
+ # separates this from a real clean scan:
432
+ #
433
+ # rules: [] -> "No code rules to run."
434
+ # p/security-audit -> "with 225 Code rules:"
435
+ #
436
+ # TWO EARLIER DRAFTS OF THIS CHECK WERE WRONG, and both are recorded
437
+ # because each one looked reasonable:
438
+ #
439
+ # 1. time.rules. That is semgrep's per-rule PROFILING list, empty on every
440
+ # healthy run -- a 225-rule scan reports time.rules:[]. Guarding on it
441
+ # would have turned every good scan into a SKIP.
442
+ # 2. paths.scanned == 0. Right for the empty-ruleset case, but it ALSO
443
+ # fires when the changed files are deliberately suppressed through
444
+ # .semgrepignore: measured, AC-543-02 went red because a legitimate
445
+ # "this file is ignored" result was reported as "nothing was examined".
446
+ # Deliberate suppression is a decision, not a failure.
447
+ #
448
+ # The stderr message has neither problem: it reports the rule count, which
449
+ # is the thing that actually distinguishes "could not load a ruleset" from
450
+ # "loaded a ruleset and it had nothing to say".
451
+ #
452
+ # Findings take precedence (V_RESULTS -eq 0 is required). If semgrep DID
453
+ # report something, it obviously ran, and the blocking arm must see it.
454
+ #
455
+ # #717 already found this shape once, in one language: p/security-audit
456
+ # carries no C# rules, so a .cs file with a textbook SQL injection scored 0.
457
+ # That was fixed by adding a second --config; the SHAPE -- clean because
458
+ # nothing was loaded -- stayed reachable for every other cause (registry
459
+ # unreachable mid-scan, an empty cached ruleset, a bad --config path).
460
+ #
461
+ # A security gate reporting "clean" because it loaded nothing is the
462
+ # failure the fail-closed convention exists to prevent, so this SKIPs with
463
+ # its own reason rather than folding into the clean-scan PASS.
464
+ echo " ⚠️ semgrep loaded no code rules — nothing was checked, so this is not a clean result"
465
+ echo " The ruleset was empty or could not be resolved. Try:"
466
+ echo " semgrep --config=p/security-audit <file>"
467
+ echo " ⏭️ SKIPPED - SAST (no rules loaded, nothing verified)"
468
+ GATE_10_STATUS="SKIP"
469
+ # Consumed by the sourcing parent (pre-commit report JSON), not here.
470
+ # shellcheck disable=SC2034
471
+ GATE_10_REASON="zero_rules"
427
472
  elif [ "$V_RESULTS" -eq 0 ] && { [ "$V_ERRORS" -gt 0 ] || [ "$SEMGREP_EXIT" -ne 0 ]; }; then
428
473
  # Nothing was scanned to a verdict: semgrep either failed outright
429
474
  # (nonzero exit) or completed but reported scan errors for every input
package/hooks/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
- exit 1
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
- record_gate_audit "gate-7" "iac-security" "$GATE_7_STATUS" "0" "$GATE_7_START"
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"
@@ -2,6 +2,6 @@
2
2
  "verdict": "PASS",
3
3
  "license_type": "MIT",
4
4
  "sha256": "0e7ac423bf2c6e223b7c5b156f8cf72da49d748e56a1641402c31f22ad07dbb5",
5
- "checked_at": "2026-11-18T12:56:26.079Z",
5
+ "checked_at": "2026-11-18T13:52:47.564Z",
6
6
  "source": "network"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.38.17",
3
+ "version": "0.38.18",
4
4
  "description": "AI-driven development workflow: 6 quality gates + Delphi review + Sprint Flow",
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.38.17",
3
+ "version": "0.38.18",
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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.38.17",
3
+ "version": "0.38.18",
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.38.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.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.17.0
6
+ **Version:** 0.38.18.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.