@boyingliu01/xp-gate 0.38.24 → 0.38.27

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-7.sh CHANGED
@@ -38,9 +38,9 @@ else
38
38
  # by __tests__/gate-7-adapter-resolution.test.bats).
39
39
  IAC_ADAPTER=""
40
40
  for _candidate in \
41
- "$HOME/.config/xp-gate/adapters/iac.sh" \
42
41
  "githooks/adapters/iac.sh" \
43
- "${SCRIPT_DIR:-}/adapters/iac.sh"; do
42
+ "${SCRIPT_DIR:-}/adapters/iac.sh" \
43
+ "$HOME/.config/xp-gate/adapters/iac.sh"; do
44
44
  if [ -n "$_candidate" ] && [ -f "$_candidate" ]; then
45
45
  IAC_ADAPTER="$_candidate"
46
46
  break
package/hooks/gate-7.sh CHANGED
@@ -38,9 +38,9 @@ else
38
38
  # by __tests__/gate-7-adapter-resolution.test.bats).
39
39
  IAC_ADAPTER=""
40
40
  for _candidate in \
41
- "$HOME/.config/xp-gate/adapters/iac.sh" \
42
41
  "githooks/adapters/iac.sh" \
43
- "${SCRIPT_DIR:-}/adapters/iac.sh"; do
42
+ "${SCRIPT_DIR:-}/adapters/iac.sh" \
43
+ "$HOME/.config/xp-gate/adapters/iac.sh"; do
44
44
  if [ -n "$_candidate" ] && [ -f "$_candidate" ]; then
45
45
  IAC_ADAPTER="$_candidate"
46
46
  break
@@ -111,6 +111,26 @@ _xp_gate_run_chain() {
111
111
  "$fn"
112
112
  rc=$?
113
113
  if [ "$rc" -ne 0 ]; then
114
+ # Fail-fast is intended: the first blocking gate stops the commit. But the
115
+ # report prints a row for EVERY gate in XP_GATE_ORDER, so the gates below
116
+ # were being shown as plain "SKIP" -- indistinguishable from gates that
117
+ # decided to skip. Measured on a repo whose Gate 1 failed: gates 2-8 and 10
118
+ # appeared as "SKIP (warnings: 0)" and "SKIP (coverage: N/A%)" while their
119
+ # bodies had never been invoked at all.
120
+ #
121
+ # Name them. One line, before the exit, so the reader can tell "the chain
122
+ # stopped here" from "each later gate chose to skip".
123
+ local _rest="" _k="" _seen=0
124
+ for _k in $XP_GATE_ORDER; do
125
+ if [ "$_seen" = "1" ]; then
126
+ _rest="$_rest $_k"
127
+ continue
128
+ fi
129
+ [ "$_k" = "$key" ] && _seen=1
130
+ done
131
+ if [ -n "$_rest" ]; then
132
+ echo "⚠️ Chain stopped at Gate $key — these gates were NOT reached:$_rest"
133
+ fi
114
134
  exit "$rc"
115
135
  fi
116
136
 
@@ -601,7 +601,16 @@ const GATE_REGISTRY = {
601
601
  aliases: ['duplicates', 'dup', '2'],
602
602
  run: (targetPath) => {
603
603
  const jscpdConfig = findConfig(targetPath, 'jscpd.conf.json');
604
- const args = [targetPath || '.'];
604
+ // The scan root is '.' whenever we are running inside the target.
605
+ //
606
+ // jscpd 4.x does not apply its glob ignore rules to an ABSOLUTE scan path:
607
+ // measured on a fixture with three byte-identical files, one of them under
608
+ // .xp-gate/, `jscpd <abs-path> --ignore "**/.xp-gate/**,..."` reported 0
609
+ // clones while `jscpd . --ignore <same>` reported 2 (the copy excluded, the
610
+ // real duplicate kept). Passing '.' and running with cwd = target keeps both
611
+ // the ignore rules and the discovery working.
612
+ const scanRoot = !targetPath || path.resolve(targetPath) === path.resolve(process.cwd()) ? '.' : targetPath;
613
+ const args = [scanRoot];
605
614
  if (jscpdConfig) args.push('--config', jscpdConfig);
606
615
  // The ignore set is passed ONLY when the project has no config of its own.
607
616
  //
@@ -789,49 +798,46 @@ function getAliases(gateId) {
789
798
  }
790
799
 
791
800
  /**
792
- * The duplicate-scan ignore set, read from the bash library that owns it.
801
+ * The duplicate-scan ignore set for a project that has no jscpd.conf.json.
802
+ *
803
+ * jscpd 4.x takes --ignore as a GLOB (star-star/node_modules/star-star), not a
804
+ * first version of this function copied the regex from githooks/lib/jscpd-run.sh
805
+ * and passed it straight through, which silently matched nothing: measured on a
806
+ * fixture whose .xp-gate/reports copy was byte-identical to a source file,
807
+ * --ignore with the regex reported 3 clones (copy included) while a glob form
808
+ * reported 2 (copy excluded). A gate that prints an ignore flag and ignores
809
+ * nothing is worse than one with no flag.
793
810
  *
794
- * Two implementations of Gate 2 exist -- the hook runs githooks/gate-2.sh and
795
- * `xp-gate check 2` runs this file -- and they had drifted on exactly this: the
796
- * hook excluded build output, this path excluded nothing and scanned `.xp-gate/`,
797
- * the tree xp-gate itself writes one report per gate per run into. Reading the
798
- * pattern from githooks/lib/jscpd-run.sh instead of restating it here means the
799
- * two paths cannot disagree again about what counts as project source.
811
+ * Written without literal star-slash sequences on purpose: inside a block
812
+ * comment a glob like star-star/name/star-star closes the comment early and the
813
+ * rest of the file is parsed as code (measured: "node_modules is not defined" at
814
+ * module load).
800
815
  *
801
- * Returns '' when the library cannot be found (a consumer install without the
802
- * hooks tree): the scan then runs unfiltered rather than inventing a set here.
816
+ * The directory list is kept here in glob form on purpose: the bash side uses a
817
+ * regex for a different consumer (its own file-list filter), so the two are not
818
+ * interchangeable and must not be copy-pasted between each other. The names,
819
+ * though, are the same set.
803
820
  */
804
821
  function jscpdDefaultIgnorePatterns() {
805
- const candidates = [
806
- path.join(__dirname, '..', '..', '..', 'githooks', 'lib', 'jscpd-run.sh'),
807
- path.join(__dirname, '..', 'hooks', 'lib', 'jscpd-run.sh'),
808
- path.join(process.cwd(), 'githooks', 'lib', 'jscpd-run.sh'),
809
- ];
810
- for (const c of candidates) {
811
- let text;
812
- try {
813
- text = fs.readFileSync(c, 'utf8');
814
- } catch (_) {
815
- continue;
816
- }
817
- // The assignment is single-quoted and comes before any use of the variable.
818
- const m = /^JSCPD_DEFAULT_IGNORE_PATTERNS='([^']+)'/m.exec(text);
819
- if (m) return m[1];
820
- }
821
- return '';
822
+ return [
823
+ '**/node_modules/**',
824
+ '**/dist/**',
825
+ '**/build/**',
826
+ '**/target/**',
827
+ '**/coverage/**',
828
+ '**/out/**',
829
+ '**/.next/**',
830
+ '**/.nuxt/**',
831
+ '**/vendor/**',
832
+ '**/.xp-gate/**',
833
+ '**/*.log',
834
+ '**/*.txt',
835
+ '**/*.yaml',
836
+ '**/*.yml',
837
+ '**/*.md',
838
+ ].join(',');
822
839
  }
823
840
 
824
- /**
825
- * Run jscpd without reaching for the network.
826
- *
827
- * The previous implementation was `execFileSync('npx', ['-y', 'jscpd', ...])`, and
828
- * `-y` means "install it if it is not here" -- a gate that installs the tool it
829
- * was asked to detect, changing the environment it is measuring. It is also
830
- * where a concurrent run produced "Gate 2 FAILED: Command failed: npx -y jscpd .".
831
- * A project-local or global binary is used when present; `--no-install` keeps the
832
- * npx fallback from installing anything, and failing to find jscpd is reported as
833
- * "not available" instead of being retried over the network.
834
- */
835
841
  function runJscpd(args, targetPath) {
836
842
  // Invoke jscpd's JS entry through `node` rather than going through .bin/.
837
843
  //
@@ -880,7 +886,12 @@ function runJscpd(args, targetPath) {
880
886
  ];
881
887
  for (const [cmd, cmdArgs] of attempts) {
882
888
  try {
883
- execFileSync(cmd, cmdArgs, { stdio: 'inherit' });
889
+ // cwd must be the scan target. Without it jscpd runs in whatever directory
890
+ // the CLI was started from, so `xp-gate check 2 <path>` scanned the CURRENT
891
+ // directory and the path argument only affected its display name. Measured:
892
+ // a 3-copy fixture reported 0 clones because the scan happened in the xp-gate
893
+ // repo instead of the fixture.
894
+ execFileSync(cmd, cmdArgs, { stdio: 'inherit', cwd: targetPath || process.cwd() });
884
895
  return;
885
896
  } catch (err) {
886
897
  lastErr = err;
@@ -2,6 +2,6 @@
2
2
  "verdict": "PASS",
3
3
  "license_type": "MIT",
4
4
  "sha256": "0e7ac423bf2c6e223b7c5b156f8cf72da49d748e56a1641402c31f22ad07dbb5",
5
- "checked_at": "2026-11-19T06:43:03.323Z",
5
+ "checked_at": "2026-11-19T07:32:10.275Z",
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.24",
3
+ "version": "0.38.27",
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.24",
3
+ "version": "0.38.27",
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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24",
3
+ "version": "0.38.27",
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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.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.24.0
6
+ **Version:** 0.38.27.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.