@boyingliu01/xp-gate 0.38.27 → 0.38.28

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/bin/xp-gate.js CHANGED
@@ -527,6 +527,18 @@ const COMMANDS = {
527
527
  },
528
528
  usage: 'xp-gate sprint-audit [--dir <path>] [--json]'
529
529
  },
530
+ 'language-capability': {
531
+ description: 'Report which gate surfaces actually wire each language, derived from the code (REQ-LANG-CAPABILITY)',
532
+ run: subargs => {
533
+ const { handleLanguageCapability } = require('../lib/language-capability.js');
534
+ // Exit 1 when any surface is NOT WIRED: this command exists to gate
535
+ // language onboarding, and a report that cannot fail is a report nobody
536
+ // reads. A declared "not implemented" surface does not fail it -- a
537
+ // declared gap is a decision, a missing wire is a bug.
538
+ process.exit(handleLanguageCapability(subargs));
539
+ },
540
+ usage: 'xp-gate language-capability [<language>...] [--json]'
541
+ },
530
542
  'detect-languages': {
531
543
  description: 'Detect project languages and generate .xp-gate-config.json',
532
544
  run: subargs => {
@@ -633,8 +645,12 @@ function handleAuditTail(args, auditPath) {
633
645
  const tailIdx = args.indexOf('--tail');
634
646
  const count = parseInt(args[tailIdx + 1] || '20', 10);
635
647
  try {
636
- const { readTailEntries } = require(auditPath);
637
- const entries = readTailEntries(count);
648
+ // gate-audit.ts is TypeScript; `require()` cannot load it (the message is
649
+ // "require is not defined in ES module scope", Node having parsed the .ts as
650
+ // ESM). This path kept its require() after evalGateAuditModule() was added for
651
+ // --check, so --tail and --stats stayed broken while the comment above that
652
+ // helper described all four entry points as fixed.
653
+ const entries = evalGateAuditModule(`m.readTailEntries(${Math.trunc(count)})`);
638
654
  if (entries.length === 0) {
639
655
  console.log('No audit entries found.');
640
656
  return;
@@ -648,14 +664,13 @@ function handleAuditTail(args, auditPath) {
648
664
 
649
665
  function handleAuditStats(auditPath) {
650
666
  try {
651
- const { computeStats, computeAnomalies } = require(auditPath);
652
- const stats = computeStats();
667
+ const stats = evalGateAuditModule('m.computeStats()');
653
668
  if (stats.length === 0) {
654
669
  console.log('No audit data found.');
655
670
  return;
656
671
  }
657
672
  printStatsTable(stats);
658
- printAnomalies(computeAnomalies());
673
+ printAnomalies(evalGateAuditModule('m.computeAnomalies()'));
659
674
  } catch (err) {
660
675
  console.error('Error computing stats:', err.message);
661
676
  process.exit(1);
@@ -725,7 +740,6 @@ function handleAuditCheck(args = []) {
725
740
 
726
741
  function handleAuditRecord(args, auditPath) {
727
742
  try {
728
- const { appendAuditEntry } = require(auditPath);
729
743
  const rest = args.slice(1);
730
744
  const opts = {};
731
745
  for (let i = 0; i < rest.length; i++) {
@@ -745,7 +759,9 @@ function handleAuditRecord(args, auditPath) {
745
759
  repo_path: process.cwd(),
746
760
  commit_hash: opts['commit-hash'] || 'HEAD',
747
761
  };
748
- appendAuditEntry(entry);
762
+ // Same reason as --tail/--stats: require() cannot load the .ts module. The
763
+ // entry travels as JSON so nothing is interpolated into the evaluated code.
764
+ evalGateAuditModule(`m.appendAuditEntry(${JSON.stringify(entry)})`);
749
765
  } catch (err) {
750
766
  console.error('Error recording audit entry:', err.message);
751
767
  process.exit(1);
package/hooks/pre-push CHANGED
@@ -451,12 +451,81 @@ MP_START_MS="$(_mp_now_ms)"
451
451
  MP_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || MP_ROOT=""
452
452
  MP_ROOT=$(printf '%s' "$MP_ROOT" | tr -d '
453
453
  '); [ -n "$MP_ROOT" ] || MP_ROOT="."
454
+ # Two different questions, and only the first one was being asked.
455
+ #
456
+ # check-hook-mirror.sh compares the WORKING TREE. It catches "a mirror was never
457
+ # regenerated". It cannot catch "a mirror was regenerated but never staged",
458
+ # because the directory it reads is already correct by then.
459
+ #
460
+ # Measured on this repository: two commits edited githooks/gate-driver.sh and
461
+ # githooks/gate-7.sh, ran sync-mirrors, passed this gate, and pushed. The mirrors
462
+ # in those commits were still the pre-fix files:
463
+ #
464
+ # git show HEAD:src/npm-package/hooks/gate-driver.sh | grep -c "NOT reached" -> 0
465
+ #
466
+ # npm publishes src/npm-package/**, so every consumer received the unfixed gate
467
+ # while the repository looked repaired, and CI (which checks the committed tree)
468
+ # would have disagreed with local -- the direction AGENTS.md tells the reader to
469
+ # blame on a stale local install.
470
+ #
471
+ # So ask the change-set question too: for every staged canonical file that has a
472
+ # mirror, does the STAGED mirror equal the STAGED canonical?
473
+ _mp_staged_drift() {
474
+ local _canon _mirror _pairs=0 _drift=""
475
+ # Only paths staged in THIS commit, so an unrelated dirty file cannot block.
476
+ while IFS= read -r _canon; do
477
+ [ -n "$_canon" ] || continue
478
+ case "$_canon" in
479
+ githooks/*) _mirror="src/npm-package/${_canon#githooks/}" ;;
480
+ src/principles/*) _mirror="src/npm-package/${_canon#src/}" ;;
481
+ *) continue ;;
482
+ esac
483
+ # A pair exists only when the mirror is tracked; otherwise this file has no
484
+ # mirror to fall out of step with.
485
+ git -C "$MP_ROOT" ls-files --error-unmatch "$_mirror" >/dev/null 2>&1 || continue
486
+ _pairs=$((_pairs + 1))
487
+ local _c _m
488
+ _c=$(git -C "$MP_ROOT" show ":$_canon" 2>/dev/null) || continue
489
+ _m=$(git -C "$MP_ROOT" show ":$_mirror" 2>/dev/null) || continue
490
+ [ "$_c" = "$_m" ] || _drift="$_drift $_canon<->$_mirror"
491
+ done <<EOF
492
+ $(git -C "$MP_ROOT" diff --cached --name-only --diff-filter=d 2>/dev/null)
493
+ EOF
494
+ if [ -n "$_drift" ]; then
495
+ printf '%s\n' "$_drift"
496
+ return 1
497
+ fi
498
+ MP_STAGED_PAIRS=$_pairs
499
+ return 0
500
+ }
501
+
454
502
  if [ -f "$MP_ROOT/scripts/check-hook-mirror.sh" ]; then
455
503
  if (cd "$MP_ROOT" && bash scripts/check-hook-mirror.sh); then
504
+ if ! MP_STAGED_DRIFT="$(_mp_staged_drift)"; then
505
+ GATE_MP_STATUS="FAIL"
506
+ MP_DURATION_MS=$(( $(_mp_now_ms) - MP_START_MS ))
507
+ [ "$MP_DURATION_MS" -lt 0 ] 2>/dev/null && MP_DURATION_MS=0
508
+ echo ""
509
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
510
+ echo " ❌ GATE MP FAILED — PUSH BLOCKED"
511
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
512
+ echo "The working tree is consistent, but the STAGED tree is not:"
513
+ for _d in $MP_STAGED_DRIFT; do
514
+ echo " staged canonical and staged mirror differ: $_d"
515
+ done
516
+ echo ""
517
+ echo "This is the case a working-tree comparison cannot see: the mirror was"
518
+ echo "regenerated on disk (so check-hook-mirror.sh passes) but the"
519
+ echo "regenerated file was never staged, so the commit carries the old one."
520
+ echo "npm publishes src/npm-package/** -- shipping it would give every"
521
+ echo "consumer the unfixed gate while the repository looks repaired."
522
+ echo "Fix: git add src/npm-package/... for the files listed above, then push."
523
+ exit 1
524
+ fi
456
525
  GATE_MP_STATUS="PASS"
457
526
  MP_DURATION_MS=$(( $(_mp_now_ms) - MP_START_MS ))
458
527
  [ "$MP_DURATION_MS" -lt 0 ] 2>/dev/null && MP_DURATION_MS=0
459
- echo "✅ Gate MP: gate-script mirror parity OK (${MP_DURATION_MS}ms)"
528
+ echo "✅ Gate MP: gate-script mirror parity OK (${MP_DURATION_MS}ms, working tree + ${MP_STAGED_PAIRS:-0} staged pairs)"
460
529
  else
461
530
  MP_DURATION_MS=0
462
531
  echo ""
@@ -2,6 +2,6 @@
2
2
  "verdict": "PASS",
3
3
  "license_type": "MIT",
4
4
  "sha256": "0e7ac423bf2c6e223b7c5b156f8cf72da49d748e56a1641402c31f22ad07dbb5",
5
- "checked_at": "2026-11-19T07:32:10.275Z",
5
+ "checked_at": "2026-11-19T07:54:43.796Z",
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.27",
3
+ "version": "0.38.28",
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.27",
3
+ "version": "0.38.28",
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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27",
3
+ "version": "0.38.28",
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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.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.27.0
6
+ **Version:** 0.38.28.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.