@boyingliu01/xp-gate 0.38.4 → 0.38.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.
Files changed (46) hide show
  1. package/adapters/gate-10.sh +478 -0
  2. package/adapters/gate-12-file-hygiene.sh +315 -0
  3. package/adapters/gate-13-compiler-strictness.sh +1443 -0
  4. package/adapters/gate-6-layers.sh +375 -0
  5. package/adapters/gate-8.sh +13 -1
  6. package/adapters/iac.sh +60 -27
  7. package/adapters/shell.sh +50 -2
  8. package/build-integrity/gate-10.ts +44 -3
  9. package/gate-12-file-hygiene.sh +15 -7
  10. package/gate-8.sh +13 -1
  11. package/hooks/gate-12-file-hygiene.sh +15 -7
  12. package/hooks/gate-8.sh +13 -1
  13. package/hooks/gate-entries/gate-1-entry.sh +44 -3
  14. package/hooks/gate-entries/gate-5-entry.sh +8 -0
  15. package/hooks/post-commit +9 -0
  16. package/hooks/pre-push +11 -2
  17. package/lib/mattpocock-license-verdict.json +1 -1
  18. package/mock-policy/AGENTS.md +1 -1
  19. package/mutation/AGENTS.md +1 -1
  20. package/package.json +1 -1
  21. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  22. package/plugins/claude-code/bin/xp-gate-version-check.sh +6 -0
  23. package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
  24. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
  25. package/plugins/claude-code/skills/sprint-flow/__tests__/verify-sprint-state.test.bats +23 -1
  26. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
  27. package/plugins/dsh/package.json +1 -1
  28. package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
  29. package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
  30. package/plugins/dsh/skills/sprint-flow/__tests__/verify-sprint-state.test.bats +23 -1
  31. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
  32. package/plugins/opencode/package.json +1 -1
  33. package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
  34. package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
  35. package/plugins/opencode/skills/sprint-flow/__tests__/verify-sprint-state.test.bats +23 -1
  36. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
  37. package/plugins/qoder/plugin.json +1 -1
  38. package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
  39. package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
  40. package/plugins/qoder/skills/sprint-flow/__tests__/verify-sprint-state.test.bats +23 -1
  41. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
  42. package/principles/AGENTS.md +1 -1
  43. package/skills/delphi-review/AGENTS.md +1 -1
  44. package/skills/sprint-flow/AGENTS.md +1 -1
  45. package/skills/sprint-flow/__tests__/verify-sprint-state.test.bats +23 -1
  46. package/skills/test-specification-alignment/AGENTS.md +1 -1
@@ -199,7 +199,15 @@ fi
199
199
 
200
200
  # --- Check 5: YAML/JSON syntax validation (Issue #351) ---
201
201
  # Only check staged YAML/JSON files that have changes
202
- YAML_JSON_ERRORS=""
202
+ #
203
+ # #772: these were accumulated into a space-separated STRING and re-split with an
204
+ # unquoted `for f in $YAML_JSON_ERRORS`. Parser messages contain spaces, so one
205
+ # broken file printed as a run of fake "filenames" -- PyYAML's
206
+ # "while parsing a flow sequence" became five entries. The list under
207
+ # "YAML/JSON syntax errors:" reads as the set of files to go fix, so the split
208
+ # sent the reader hunting for files that do not exist. Arrays keep each entry
209
+ # whole no matter what the message contains.
210
+ YAML_JSON_ERRORS=()
203
211
  YAML_JSON_CHECK_COUNT=0
204
212
 
205
213
  # Detect available validators
@@ -241,7 +249,7 @@ except Exception:
241
249
  pass
242
250
  " 2>&1)
243
251
  if [ $? -ne 0 ] && [ -n "$YAML_ERROR" ]; then
244
- YAML_JSON_ERRORS="$YAML_JSON_ERRORS $file(yaml:$YAML_ERROR)"
252
+ YAML_JSON_ERRORS+=("$file(yaml:$YAML_ERROR)")
245
253
  fi
246
254
  fi
247
255
  ;;
@@ -252,12 +260,12 @@ except Exception:
252
260
  let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{JSON.parse(d)}catch(e){console.log(e.message.split('\\n')[0]);process.exit(1)}})
253
261
  " 2>&1)
254
262
  if [ $? -ne 0 ] && [ -n "$JSON_ERROR" ]; then
255
- YAML_JSON_ERRORS="$YAML_JSON_ERRORS $file(json:$JSON_ERROR)"
263
+ YAML_JSON_ERRORS+=("$file(json:$JSON_ERROR)")
256
264
  fi
257
265
  elif [ "$JSON_CMD" = "jq" ]; then
258
266
  JSON_ERROR=$(git show ":$file" 2>/dev/null | jq empty 2>&1)
259
267
  if [ $? -ne 0 ] && [ -n "$JSON_ERROR" ]; then
260
- YAML_JSON_ERRORS="$YAML_JSON_ERRORS $file(json:syntax error)"
268
+ YAML_JSON_ERRORS+=("$file(json:syntax error)")
261
269
  fi
262
270
  fi
263
271
  ;;
@@ -266,9 +274,9 @@ done <<EOF
266
274
  $CHANGED_YAML_JSON
267
275
  EOF
268
276
 
269
- if [ -n "$YAML_JSON_ERRORS" ]; then
277
+ if [ "${#YAML_JSON_ERRORS[@]}" -gt 0 ]; then
270
278
  echo " ❌ YAML/JSON syntax errors:"
271
- for f in $YAML_JSON_ERRORS; do
279
+ for f in "${YAML_JSON_ERRORS[@]}"; do
272
280
  echo " - $f"
273
281
  done
274
282
  HYGIENE_ISSUES=$((HYGIENE_ISSUES + 1))
@@ -289,7 +297,7 @@ if [ "$HYGIENE_ISSUES" -eq 0 ]; then
289
297
  GATE_12_STATUS="PASS"
290
298
  else
291
299
  # Hard blocks: conflict markers + YAML/JSON syntax errors
292
- if [ -n "$CONFLICT_MARKER_FILES" ] || [ -n "$YAML_JSON_ERRORS" ]; then
300
+ if [ -n "$CONFLICT_MARKER_FILES" ] || [ "${#YAML_JSON_ERRORS[@]}" -gt 0 ]; then
293
301
  echo ""
294
302
  echo "❌ BLOCKED - File hygiene violations must be fixed before commit."
295
303
  GATE_12_STATUS="BLOCK"
package/gate-8.sh CHANGED
@@ -348,7 +348,19 @@ if command -v detect-secrets-hook >/dev/null 2>&1 && [ -f ".secrets.baseline" ];
348
348
  fi
349
349
  # Temp cleanup is owned by the gate8_cleanup trap; no rm here.
350
350
  else
351
- echo " ⚠️ detect-secrets-hook unavailable (install: pip install -e \".[dev]\") — gitleaks only."
351
+ # #793: this branch used to blame the tool unconditionally. Both "the hook is
352
+ # not installed" and "the baseline file is missing" land here, so a repo with
353
+ # detect-secrets 1.5.52 on PATH was told to run `pip install -e ".[dev]"` --
354
+ # correct-looking advice that changes nothing, while the file actually missing
355
+ # (the committed `.secrets.baseline`) was never named. The two have different
356
+ # remedies and only one of them is an install, so they are split here.
357
+ if command -v detect-secrets-hook >/dev/null 2>&1; then
358
+ echo " ⚠️ detect-secrets-hook is installed but .secrets.baseline is missing."
359
+ echo " Generate it once with: detect-secrets scan > .secrets.baseline"
360
+ echo " (gitleaks still ran.)"
361
+ else
362
+ echo " ⚠️ detect-secrets-hook unavailable (install: pip install -e \".[dev]\") — gitleaks only."
363
+ fi
352
364
  fi
353
365
 
354
366
  record_gate_audit "gate-8" "secret-scanning" "$GATE_8_STATUS" "0" "$GATE_8_START"
@@ -199,7 +199,15 @@ fi
199
199
 
200
200
  # --- Check 5: YAML/JSON syntax validation (Issue #351) ---
201
201
  # Only check staged YAML/JSON files that have changes
202
- YAML_JSON_ERRORS=""
202
+ #
203
+ # #772: these were accumulated into a space-separated STRING and re-split with an
204
+ # unquoted `for f in $YAML_JSON_ERRORS`. Parser messages contain spaces, so one
205
+ # broken file printed as a run of fake "filenames" -- PyYAML's
206
+ # "while parsing a flow sequence" became five entries. The list under
207
+ # "YAML/JSON syntax errors:" reads as the set of files to go fix, so the split
208
+ # sent the reader hunting for files that do not exist. Arrays keep each entry
209
+ # whole no matter what the message contains.
210
+ YAML_JSON_ERRORS=()
203
211
  YAML_JSON_CHECK_COUNT=0
204
212
 
205
213
  # Detect available validators
@@ -241,7 +249,7 @@ except Exception:
241
249
  pass
242
250
  " 2>&1)
243
251
  if [ $? -ne 0 ] && [ -n "$YAML_ERROR" ]; then
244
- YAML_JSON_ERRORS="$YAML_JSON_ERRORS $file(yaml:$YAML_ERROR)"
252
+ YAML_JSON_ERRORS+=("$file(yaml:$YAML_ERROR)")
245
253
  fi
246
254
  fi
247
255
  ;;
@@ -252,12 +260,12 @@ except Exception:
252
260
  let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{JSON.parse(d)}catch(e){console.log(e.message.split('\\n')[0]);process.exit(1)}})
253
261
  " 2>&1)
254
262
  if [ $? -ne 0 ] && [ -n "$JSON_ERROR" ]; then
255
- YAML_JSON_ERRORS="$YAML_JSON_ERRORS $file(json:$JSON_ERROR)"
263
+ YAML_JSON_ERRORS+=("$file(json:$JSON_ERROR)")
256
264
  fi
257
265
  elif [ "$JSON_CMD" = "jq" ]; then
258
266
  JSON_ERROR=$(git show ":$file" 2>/dev/null | jq empty 2>&1)
259
267
  if [ $? -ne 0 ] && [ -n "$JSON_ERROR" ]; then
260
- YAML_JSON_ERRORS="$YAML_JSON_ERRORS $file(json:syntax error)"
268
+ YAML_JSON_ERRORS+=("$file(json:syntax error)")
261
269
  fi
262
270
  fi
263
271
  ;;
@@ -266,9 +274,9 @@ done <<EOF
266
274
  $CHANGED_YAML_JSON
267
275
  EOF
268
276
 
269
- if [ -n "$YAML_JSON_ERRORS" ]; then
277
+ if [ "${#YAML_JSON_ERRORS[@]}" -gt 0 ]; then
270
278
  echo " ❌ YAML/JSON syntax errors:"
271
- for f in $YAML_JSON_ERRORS; do
279
+ for f in "${YAML_JSON_ERRORS[@]}"; do
272
280
  echo " - $f"
273
281
  done
274
282
  HYGIENE_ISSUES=$((HYGIENE_ISSUES + 1))
@@ -289,7 +297,7 @@ if [ "$HYGIENE_ISSUES" -eq 0 ]; then
289
297
  GATE_12_STATUS="PASS"
290
298
  else
291
299
  # Hard blocks: conflict markers + YAML/JSON syntax errors
292
- if [ -n "$CONFLICT_MARKER_FILES" ] || [ -n "$YAML_JSON_ERRORS" ]; then
300
+ if [ -n "$CONFLICT_MARKER_FILES" ] || [ "${#YAML_JSON_ERRORS[@]}" -gt 0 ]; then
293
301
  echo ""
294
302
  echo "❌ BLOCKED - File hygiene violations must be fixed before commit."
295
303
  GATE_12_STATUS="BLOCK"
package/hooks/gate-8.sh CHANGED
@@ -348,7 +348,19 @@ if command -v detect-secrets-hook >/dev/null 2>&1 && [ -f ".secrets.baseline" ];
348
348
  fi
349
349
  # Temp cleanup is owned by the gate8_cleanup trap; no rm here.
350
350
  else
351
- echo " ⚠️ detect-secrets-hook unavailable (install: pip install -e \".[dev]\") — gitleaks only."
351
+ # #793: this branch used to blame the tool unconditionally. Both "the hook is
352
+ # not installed" and "the baseline file is missing" land here, so a repo with
353
+ # detect-secrets 1.5.52 on PATH was told to run `pip install -e ".[dev]"` --
354
+ # correct-looking advice that changes nothing, while the file actually missing
355
+ # (the committed `.secrets.baseline`) was never named. The two have different
356
+ # remedies and only one of them is an install, so they are split here.
357
+ if command -v detect-secrets-hook >/dev/null 2>&1; then
358
+ echo " ⚠️ detect-secrets-hook is installed but .secrets.baseline is missing."
359
+ echo " Generate it once with: detect-secrets scan > .secrets.baseline"
360
+ echo " (gitleaks still ran.)"
361
+ else
362
+ echo " ⚠️ detect-secrets-hook unavailable (install: pip install -e \".[dev]\") — gitleaks only."
363
+ fi
352
364
  fi
353
365
 
354
366
  record_gate_audit "gate-8" "secret-scanning" "$GATE_8_STATUS" "0" "$GATE_8_START"
@@ -22,6 +22,32 @@
22
22
  # Combination of: Old Gates 1 (Static), Gate 2 (Linting), Gate 5 (Shell Check)
23
23
  # v0.14.3+ (Issue #312): Skip if no code files changed
24
24
  # ============================================================================
25
+ # Select the CHANGED files that the shell arm must lint, one per line.
26
+ #
27
+ # A file is a shell script when its name ends in .sh/.bash, OR when its first
28
+ # line carries a bash/sh shebang. The shebang arm is what reaches `pre-commit`,
29
+ # `pre-push`, `post-commit` and `post-merge`: they have no extension and are the
30
+ # largest shell programs in this repository, so the previous extension-only
31
+ # filter (`grep '\.sh$'`) made them structurally exempt from the gate. The same
32
+ # rule is implemented in githooks/adapters/shell.sh -- keep the two in step.
33
+ #
34
+ # Only files that exist in the work tree are returned: a deleted file cannot be
35
+ # linted, and passing it to shellcheck would turn a deletion into a failure.
36
+ _shell_changed_files() {
37
+ local f first
38
+ for f in $CHANGED_FILES; do
39
+ [ -f "$f" ] || continue
40
+ case "$f" in
41
+ *.sh|*.bash) echo "$f"; continue ;;
42
+ esac
43
+ # No shell extension: accept only a shell shebang on line 1.
44
+ first="$(sed -n '1p' "$f" 2>/dev/null || true)"
45
+ case "$first" in
46
+ '#!'*bash*|'#!'*'/sh'|'#!'*' sh'|'#!'*'env sh'*) echo "$f" ;;
47
+ esac
48
+ done
49
+ }
50
+
25
51
  # Gate body. `return` is used instead of `exit` so the driver decides to
26
52
  # stop: see scripts/wrap-gate-entries.cjs for why the two are equivalent
27
53
  # here, and why sub-shell exits are deliberately left as `exit`.
@@ -241,8 +267,16 @@ else
241
267
  # scripts/check-no-npx-probe.sh fails the build if the npx rung returns.
242
268
  BIOME_ARGV=(biome)
243
269
  fi
244
- # shellcheck disable=SC2086 # BIOME_ARGV may hold a multi-token form on purpose
245
- BIOME_OUT=$(cd "$TS_PROJECT_DIR" && ${BIOME_ARGV[@]} check --staged . 2>&1)
270
+ # Quoted expansion. The array holds exactly one path token (either the
271
+ # bare word `biome` or an absolute node_modules path), and that path can
272
+ # contain spaces -- a project checked out under "C:/My Projects/..." is
273
+ # ordinary on Windows. Unquoted, `${BIOME_ARGV[@]}` re-splits it into
274
+ # several arguments, so biome would be invoked as a different command and
275
+ # exit 127; the 127 branch below reads that as "biome absent" and SKIPs.
276
+ # The old `disable=SC2086 # may hold a multi-token form` was inaccurate:
277
+ # every assignment site above sets a single element or an empty array,
278
+ # so no multi-token form exists to protect.
279
+ BIOME_OUT=$(cd "$TS_PROJECT_DIR" && "${BIOME_ARGV[@]}" check --staged . 2>&1)
246
280
  BIOME_STATUS=$?
247
281
  if [ "$BIOME_STATUS" -eq 127 ]; then
248
282
  # 127 is the shell's own "command not found": biome is genuinely absent.
@@ -524,7 +558,14 @@ else
524
558
  shell)
525
559
  # Shell: check staged shell files only. Installed hook adapters are infrastructure,
526
560
  # not project changes, and should not be linted on unrelated commits.
527
- SHELL_FILES=$(echo "$CHANGED_FILES" | grep '\.sh$' || true)
561
+ #
562
+ # The filter used to be `grep '\.sh$'`, which cannot match the extensionless
563
+ # hooks -- `pre-commit`, `pre-push`, `post-commit`, `post-merge` -- and those are
564
+ # the two largest shell programs in this repository. A file that cannot enter the
565
+ # gate cannot fail it, so the biggest shell code in the repo was structurally
566
+ # exempt. Same rule as githooks/adapters/shell.sh: a .sh/.bash name, OR a shell
567
+ # shebang on the first line for the extensionless cases.
568
+ SHELL_FILES="$(_shell_changed_files)"
528
569
 
529
570
  if [ -z "$SHELL_FILES" ]; then
530
571
  echo "✅ PASSED - No staged shell scripts to check."
@@ -322,6 +322,14 @@ else
322
322
  "${dir}/__tests__/${filename}.spec.${ext}"
323
323
  "tests/${filename}.test.${ext}"
324
324
  "tests/${filename}.spec.${ext}"
325
+ # #787: `test/` (singular) is as conventional as `tests/` (plural), and
326
+ # both live in the wild -- Jest silently accepts either, so a repo that
327
+ # picked the singular spelling was hard-BLOCKED on a file whose test was
328
+ # right there. The asymmetry made it read like a user error: identical
329
+ # content under tests/ passed, and only the path spelling decided the
330
+ # verdict, so "did you mean tests/" was not actionable advice.
331
+ "test/${filename}.test.${ext}"
332
+ "test/${filename}.spec.${ext}"
325
333
  )
326
334
 
327
335
  for pattern in "${patterns[@]}"; do
package/hooks/post-commit CHANGED
@@ -38,6 +38,15 @@ head_commit="$(git rev-parse HEAD 2>/dev/null || true)"
38
38
  if [ -n "$toplevel" ] && [ -n "$head_commit" ] \
39
39
  && [ -f "$toplevel/src/npm-package/lib/gate-audit.ts" ]; then
40
40
  _pending="$toplevel/.xp-gate/audit.pending.jsonl"
41
+ # #810: `_flush` used to be defined ONLY inside the two tool branches below,
42
+ # while the drain loop at the bottom called it unconditionally. On a machine
43
+ # whose PATH carries neither node nor npx -- which is exactly when the audit
44
+ # cannot be flushed at all -- every commit (including each replayed commit of
45
+ # a rebase) printed `_flush: command not found` to stderr and silently lost
46
+ # the audit rows. The default makes "no usable runtime" an ordinary zero-row
47
+ # result instead of an error: the loop then exits after its two empty passes,
48
+ # which is the same observable behaviour as a flush that found nothing.
49
+ _flush() { echo 0; }
41
50
  if [ -f "$toplevel/node_modules/tsx/dist/cli.mjs" ] && command -v node >/dev/null 2>&1; then
42
51
  _flush() {
43
52
  node "$toplevel/node_modules/tsx/dist/cli.mjs" \
package/hooks/pre-push CHANGED
@@ -657,13 +657,18 @@ GATE_M_SKIP_KIND=""
657
657
  # copy of the order.
658
658
  HOOK_RESOLUTION_FILE="$SCRIPT_DIR/hook-module-resolution.sh"
659
659
 
660
+ # The `shellcheck source=` directive belongs in front of the whole `if`, not in
661
+ # front of one `elif` branch. ShellCheck can only attach a directive to a
662
+ # complete compound command; placed inside the branch it made the analyser
663
+ # abandon this `if` and every line after it -- 3 parse errors (SC1073/SC1123/
664
+ # SC1072) and ~990 lines of this hook that were never checked at all.
665
+ # shellcheck source=githooks/hook-module-resolution.sh
660
666
  if [ ! -f "$HOOK_RESOLUTION_FILE" ]; then
661
667
  echo "⚠️ hook-module-resolution.sh not found at $HOOK_RESOLUTION_FILE"
662
668
  echo " Run: xp-gate init (or reinstall the hooks)"
663
669
  echo "⚠️ Could not resolve adapter-common.sh. SKIP — Gate M."
664
670
  GATE_M_SKIP_REASON="hook-module-resolution.sh not found: $HOOK_RESOLUTION_FILE"
665
671
  GATE_M_SKIP_KIND="missing"
666
- # shellcheck source=githooks/hook-module-resolution.sh
667
672
  elif ! source "$HOOK_RESOLUTION_FILE" 2>/dev/null; then
668
673
  echo "⚠️ hook-module-resolution.sh is corrupt: $HOOK_RESOLUTION_FILE"
669
674
  echo " Run: node scripts/generate-hook-resolution.cjs (or reinstall)"
@@ -1189,7 +1194,11 @@ else
1189
1194
  # silently LOWER the density and weaken Gate M2. Equivalence with the old
1190
1195
  # loop was verified on 40 real test files plus overlap/edge fixtures (0
1191
1196
  # mismatches).
1192
- local _mock_content _mock_kw _mock_rest _mock_c
1197
+ # NOT `local`: this block runs at top level (inside a `for`, not a
1198
+ # function), where `local` is invalid (SC2168) -- bash prints
1199
+ # "local: can only be used in a function" and returns non-zero on every
1200
+ # iteration. The four names are file-scoped and each is assigned before
1201
+ # use below, so dropping the declaration changes no behaviour.
1193
1202
  _mock_content="$(cat "$test_file" 2>/dev/null)" || _mock_content=""
1194
1203
  MOCK_COUNT=0
1195
1204
  for _mock_kw in "jest.mock" "vi.mock" "jest.spyOn" "vi.spyOn" "jest.fn" "vi.fn" \
@@ -2,6 +2,6 @@
2
2
  "verdict": "PASS",
3
3
  "license_type": "MIT",
4
4
  "sha256": "0e7ac423bf2c6e223b7c5b156f8cf72da49d748e56a1641402c31f22ad07dbb5",
5
- "checked_at": "2026-11-14T23:06:48.655Z",
5
+ "checked_at": "2026-11-16T05:36:31.054Z",
6
6
  "source": "network"
7
7
  }
@@ -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.4.0
6
+ **Version:** 0.38.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Mock layering policy enforcement — Gate M3 of pre-push hook. Ensures integration tests use real implementations for internal dependencies, mock external dependencies, and annotate pending mocks with removal plans. Combines project scope scanning, mock decision engine, and per-file validation into a single pipeline.
@@ -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.4.0
6
+ **Version:** 0.38.5.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **Gate M** (incremental mutation testing) + **Gate M2** helpers (test-layer detection used by `src/mock-policy/`). Pre-push quality gate. TypeScript-only; uses Stryker.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.38.4",
3
+ "version": "0.38.5",
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.4",
3
+ "version": "0.38.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": {
@@ -19,6 +19,12 @@ flock -n 200 2>/dev/null || exit 0 # another instance is already checking
19
19
 
20
20
  # ── Check cache validity ──
21
21
  if [[ -f "$CACHE_FILE" ]]; then
22
+ # CACHED_VERSION is read but not consulted: only the timestamp drives the TTL.
23
+ # It must stay in this `read`, because the cache file is written as
24
+ # `<remote-version> <epoch>` below and the FIRST field is the version. Dropping
25
+ # it would bind the version string to CACHED_TS, making the arithmetic below
26
+ # compare against a number that is not a timestamp.
27
+ # shellcheck disable=SC2034 # positional read: field 1 is the cache format
22
28
  read -r CACHED_VERSION CACHED_TS < "$CACHE_FILE" 2>/dev/null || true
23
29
  NOW=$(date +%s 2>/dev/null || echo 0)
24
30
  if [[ -n "$CACHED_TS" && -n "$NOW" ]]; then
@@ -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.4.0
6
+ **Version:** 0.38.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.38.4.0
6
+ **Version:** 0.38.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, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -10,7 +10,23 @@
10
10
  # 错就一起绿。只有让生产方真的产出、校验方真的读,才能发现这类偏差。
11
11
 
12
12
  setup() {
13
- REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../../.." && pwd)"
13
+ # #814: this used to be a hard-coded `../../..`, which resolves to the repo
14
+ # root only for THIS copy (skills/sprint-flow/__tests__). The same file also
15
+ # ships under plugins/<p>/skills/ and src/npm-package/**/skills/, three and four
16
+ # levels deep, where the fixed depth points at plugins/claude-code or
17
+ # src/npm-package -- so 6 of the 7 copies failed under Gate 5 and, once this
18
+ # repo's own hooks are installed, made every commit impossible.
19
+ #
20
+ # Walk up until the markers of the repo are both present instead of counting
21
+ # `..`. Depth-counting is what broke: it encodes "where this file lives" into a
22
+ # constant, and every new mirror location re-breaks it.
23
+ REPO_ROOT="$(cd "$BATS_TEST_DIRNAME" && pwd)"
24
+ while [ "$REPO_ROOT" != "/" ] && [ -n "$REPO_ROOT" ]; do
25
+ if [ -f "$REPO_ROOT/VERSION" ] && [ -f "$REPO_ROOT/src/npm-package/bin/xp-gate.js" ]; then
26
+ break
27
+ fi
28
+ REPO_ROOT="$(dirname "$REPO_ROOT")"
29
+ done
14
30
  VERIFY="$REPO_ROOT/skills/sprint-flow/scripts/verify-sprint-state.sh"
15
31
  CLI="$REPO_ROOT/src/npm-package/bin/xp-gate.js"
16
32
  WORK="$(mktemp -d)"
@@ -23,6 +39,12 @@ teardown() {
23
39
  @test "AC-688-01: accepts state written by xp-gate sprint-init" {
24
40
  cd "$WORK"
25
41
  git init -q .
42
+ # The developer machine sets a GLOBAL core.hooksPath at the installed hooks, so
43
+ # a bare `git commit` in the fixture would run the whole gate suite instead of
44
+ # creating the fixture commit. Pin it to an empty dir: this suite tests the
45
+ # verify script, not the hook chain.
46
+ mkdir -p "$WORK/empty-hooks"
47
+ git config core.hooksPath "$WORK/empty-hooks"
26
48
  echo '{}' > package.json
27
49
  git add -A
28
50
  git -c user.email=t@t -c user.name=t commit -q -m init
@@ -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.4.0
6
+ **Version:** 0.38.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.38.4",
3
+ "version": "0.38.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.38.4.0
6
+ **Version:** 0.38.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.38.4.0
6
+ **Version:** 0.38.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, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -10,7 +10,23 @@
10
10
  # 错就一起绿。只有让生产方真的产出、校验方真的读,才能发现这类偏差。
11
11
 
12
12
  setup() {
13
- REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../../.." && pwd)"
13
+ # #814: this used to be a hard-coded `../../..`, which resolves to the repo
14
+ # root only for THIS copy (skills/sprint-flow/__tests__). The same file also
15
+ # ships under plugins/<p>/skills/ and src/npm-package/**/skills/, three and four
16
+ # levels deep, where the fixed depth points at plugins/claude-code or
17
+ # src/npm-package -- so 6 of the 7 copies failed under Gate 5 and, once this
18
+ # repo's own hooks are installed, made every commit impossible.
19
+ #
20
+ # Walk up until the markers of the repo are both present instead of counting
21
+ # `..`. Depth-counting is what broke: it encodes "where this file lives" into a
22
+ # constant, and every new mirror location re-breaks it.
23
+ REPO_ROOT="$(cd "$BATS_TEST_DIRNAME" && pwd)"
24
+ while [ "$REPO_ROOT" != "/" ] && [ -n "$REPO_ROOT" ]; do
25
+ if [ -f "$REPO_ROOT/VERSION" ] && [ -f "$REPO_ROOT/src/npm-package/bin/xp-gate.js" ]; then
26
+ break
27
+ fi
28
+ REPO_ROOT="$(dirname "$REPO_ROOT")"
29
+ done
14
30
  VERIFY="$REPO_ROOT/skills/sprint-flow/scripts/verify-sprint-state.sh"
15
31
  CLI="$REPO_ROOT/src/npm-package/bin/xp-gate.js"
16
32
  WORK="$(mktemp -d)"
@@ -23,6 +39,12 @@ teardown() {
23
39
  @test "AC-688-01: accepts state written by xp-gate sprint-init" {
24
40
  cd "$WORK"
25
41
  git init -q .
42
+ # The developer machine sets a GLOBAL core.hooksPath at the installed hooks, so
43
+ # a bare `git commit` in the fixture would run the whole gate suite instead of
44
+ # creating the fixture commit. Pin it to an empty dir: this suite tests the
45
+ # verify script, not the hook chain.
46
+ mkdir -p "$WORK/empty-hooks"
47
+ git config core.hooksPath "$WORK/empty-hooks"
26
48
  echo '{}' > package.json
27
49
  git add -A
28
50
  git -c user.email=t@t -c user.name=t commit -q -m init
@@ -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.4.0
6
+ **Version:** 0.38.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.38.4",
3
+ "version": "0.38.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.38.4.0
6
+ **Version:** 0.38.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.38.4.0
6
+ **Version:** 0.38.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, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -10,7 +10,23 @@
10
10
  # 错就一起绿。只有让生产方真的产出、校验方真的读,才能发现这类偏差。
11
11
 
12
12
  setup() {
13
- REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../../.." && pwd)"
13
+ # #814: this used to be a hard-coded `../../..`, which resolves to the repo
14
+ # root only for THIS copy (skills/sprint-flow/__tests__). The same file also
15
+ # ships under plugins/<p>/skills/ and src/npm-package/**/skills/, three and four
16
+ # levels deep, where the fixed depth points at plugins/claude-code or
17
+ # src/npm-package -- so 6 of the 7 copies failed under Gate 5 and, once this
18
+ # repo's own hooks are installed, made every commit impossible.
19
+ #
20
+ # Walk up until the markers of the repo are both present instead of counting
21
+ # `..`. Depth-counting is what broke: it encodes "where this file lives" into a
22
+ # constant, and every new mirror location re-breaks it.
23
+ REPO_ROOT="$(cd "$BATS_TEST_DIRNAME" && pwd)"
24
+ while [ "$REPO_ROOT" != "/" ] && [ -n "$REPO_ROOT" ]; do
25
+ if [ -f "$REPO_ROOT/VERSION" ] && [ -f "$REPO_ROOT/src/npm-package/bin/xp-gate.js" ]; then
26
+ break
27
+ fi
28
+ REPO_ROOT="$(dirname "$REPO_ROOT")"
29
+ done
14
30
  VERIFY="$REPO_ROOT/skills/sprint-flow/scripts/verify-sprint-state.sh"
15
31
  CLI="$REPO_ROOT/src/npm-package/bin/xp-gate.js"
16
32
  WORK="$(mktemp -d)"
@@ -23,6 +39,12 @@ teardown() {
23
39
  @test "AC-688-01: accepts state written by xp-gate sprint-init" {
24
40
  cd "$WORK"
25
41
  git init -q .
42
+ # The developer machine sets a GLOBAL core.hooksPath at the installed hooks, so
43
+ # a bare `git commit` in the fixture would run the whole gate suite instead of
44
+ # creating the fixture commit. Pin it to an empty dir: this suite tests the
45
+ # verify script, not the hook chain.
46
+ mkdir -p "$WORK/empty-hooks"
47
+ git config core.hooksPath "$WORK/empty-hooks"
26
48
  echo '{}' > package.json
27
49
  git add -A
28
50
  git -c user.email=t@t -c user.name=t commit -q -m init
@@ -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.4.0
6
+ **Version:** 0.38.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.38.4",
3
+ "version": "0.38.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.38.4.0
6
+ **Version:** 0.38.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.38.4.0
6
+ **Version:** 0.38.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, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.