@boyingliu01/xp-gate 0.38.103 → 0.38.106

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.
@@ -514,43 +514,108 @@ else
514
514
  if declare -F ccn_file_in_population >/dev/null 2>&1; then
515
515
  _cc_pop_kept=""
516
516
  _cc_pop_skipped=""
517
- while IFS= read -r _cc_row; do
518
- [ -n "$_cc_row" ] || continue
519
- # The path is column 7 (index 6) of a lizard --csv row, NOT column 1.
520
- #
521
- # Column order (lizard --csv, no header, 11 fields):
522
- # 0 NLOC | 1 CCN | 2 token_len | 3 param_count | 4 location_size
523
- # 5 "name@start-end@path" | 6 path | 7 name | 8 signature | ...
524
- # This read `$1` -- that is NLOC, not the path -- so every path
525
- # handed to ccn_file_in_population was a bare number like "17".
526
- # No number matches a declared root or extension, so EVERY row was
527
- # classified "outside the baseline population" and dropped: the gate
528
- # graded nothing, printed "not graded, not ratcheted", and fell
529
- # through to "UNVERIFIED no parsable CCN row". The population filter
530
- # therefore disabled the ratchet for ALL languages, not just the one
531
- # it was being added for.
532
- #
533
- # Quote-aware via the shared awk helper rather than a second `-F,`
534
- # split: the signature column (8) contains commas, so a naive field
535
- # split lands on the wrong column as soon as a signature is present.
536
- _cc_row_path=$(printf '%s' "$_cc_row" | csv_to_unit_separated | awk -F'\\037' '{print $7}')
517
+ # ONE awk pass for the whole CSV, not one process per row.
518
+ #
519
+ # The path is column 7 (index 6) of a lizard --csv row, NOT column 1.
520
+ # Column order (lizard --csv, no header, 11 fields):
521
+ # 0 NLOC | 1 CCN | 2 token_len | 3 param_count | 4 location_size
522
+ # 5 "name@start-end@path" | 6 path | 7 name | 8 signature | ...
523
+ # This once read `$1` -- that is NLOC, not the path -- so every path
524
+ # handed to ccn_file_in_population was a bare number like "17". No
525
+ # number matches a declared root or extension, so EVERY row was
526
+ # classified "outside the baseline population" and dropped: the gate
527
+ # graded nothing and fell through to "UNVERIFIED no parsable CCN row".
528
+ # That disabled the ratchet for ALL languages, not just the new one.
529
+ #
530
+ # Quote-aware via the shared awk helper rather than a second `-F,`
531
+ # split: the signature column (8) contains commas, so a naive field
532
+ # split lands on the wrong column as soon as a signature is present.
533
+ #
534
+ # WHY THIS IS ONE CALL AND NOT A LOOP (measured 2026-11-23): every
535
+ # pipeline stage in the old loop was a fresh process, and on Windows
536
+ # process startup dominates — `csv_to_unit_separated` alone cost
537
+ # ~211ms per row, so 85 rows spent ~18s extracting one column.
538
+ #
539
+ # The standalone here parses the CSV once and emits "path<TAB>row",
540
+ # with the row carried verbatim as $0 so what reaches the verifier is
541
+ # the row lizard produced. Do NOT rebuild the row from split fields:
542
+ # the split is lossy (CSV quoting around field 5 is dropped), so a
543
+ # rebuilt row would silently differ from the real one. Verified on a
544
+ # real 85-row CSV: identical to the original apart from CRLF.
545
+ # ONE awk pass decides the whole CSV. Every earlier version of this loop
546
+ # paid process startup per row, and on Windows that dominates: measured
547
+ # 2026-11-23, gate 3 on ONE changed file spent 55.4s, of which ~34.5s
548
+ # was this filter relaunching csv_to_unit_separated (~211ms) and sed
549
+ # (~190ms) for each of 85 rows. Nothing in it depended on other rows.
550
+ #
551
+ # The predicate arrives as data (roots and extensions) from
552
+ # ccn_baseline_population, so the decision still has exactly ONE
553
+ # definition; awk only applies it. Kept rows go to stdout verbatim,
554
+ # skipped paths to a temp file.
555
+ #
556
+ # Rows are carried as $0, never rebuilt from parsed fields: the parse is
557
+ # lossy (CSV quoting around field 5 is dropped), so a rebuilt row would
558
+ # differ from the one lizard produced. Verified on a real 85-row CSV:
559
+ # byte-identical apart from CRLF.
560
+ _cc_pop=$(ccn_baseline_population ".ccn-baseline.json")
561
+ _cc_roots="${_cc_pop%%|*}"
562
+ _cc_exts="${_cc_pop#*|}"
563
+ [ "$_cc_exts" = "$_cc_pop" ] && _cc_exts=""
564
+ _cc_skip_file=$(mktemp)
565
+ _cc_kept=$(printf '%s\n' "$CC_CSV" | CC_ROOTS="$_cc_roots" CC_EXTS="$_cc_exts" CC_SKIP="$_cc_skip_file" awk '
566
+ BEGIN {
567
+ nroots = split(ENVIRON["CC_ROOTS"], R, ",")
568
+ nexts = split(ENVIRON["CC_EXTS"], E, ",")
569
+ skip = ENVIRON["CC_SKIP"]
570
+ unrestricted = (nroots == 0 && nexts == 0)
571
+ BS = sprintf("%c", 92)
572
+ Q = sprintf("%c", 34)
573
+ }
574
+ # Quoting is read through Q, built from its byte value, because a
575
+ # literal quote inside this awk program cannot be escaped reliably
576
+ # through the shell layer: the escape collapses before awk parses.
577
+ function parse(line, cur, i, ch, q, nf) {
578
+ nf = 1; cur = ""; q = 0
579
+ for (i = 1; i <= length(line); i++) {
580
+ ch = substr(line, i, 1)
581
+ if (q) {
582
+ if (ch == Q) { if (substr(line, i + 1, 1) == Q) { cur = cur Q; i++ } else q = 0 }
583
+ else cur = cur ch
584
+ } else if (ch == Q) q = 1
585
+ else if (ch == ",") { f[nf++] = cur; cur = "" }
586
+ else cur = cur ch
587
+ }
588
+ f[nf] = cur
589
+ }
590
+ function in_population(path, k, n, hit) {
591
+ if (unrestricted) return 1
592
+ while ((bsi = index(path, BS)) > 0) { path = substr(path, 1, bsi - 1) "/" substr(path, bsi + 1) }
593
+ if (nroots > 0) {
594
+ hit = 0
595
+ for (k = 1; k <= nroots; k++) {
596
+ if (path == R[k] || index(path, R[k] "/") == 1) { hit = 1; break }
597
+ }
598
+ if (!hit) return 0
599
+ }
600
+ if (nexts > 0) {
601
+ hit = 0
602
+ for (k = 1; k <= nexts; k++) {
603
+ n = length(E[k])
604
+ if (n > 0 && substr(path, length(path) - n + 1) == E[k]) { hit = 1; break }
605
+ }
606
+ if (!hit) return 0
607
+ }
608
+ return 1
609
+ }
610
+ { parse($0); p = f[7] }
537
611
  # A row we cannot locate cannot be scoped: keep it and let the
538
- # verifier decide, rather than silently dropping it as "out of
539
- # population" — dropping is how "checked" became "checked nothing".
540
- if [ -z "$_cc_row_path" ]; then
541
- _cc_pop_kept="${_cc_pop_kept}${_cc_row}
542
- "
543
- elif ccn_file_in_population ".ccn-baseline.json" "$_cc_row_path"; then
544
- _cc_pop_kept="${_cc_pop_kept}${_cc_row}
545
- "
546
- else
547
- _cc_pop_skipped="${_cc_pop_skipped}${_cc_row_path}
548
- "
549
- fi
550
- done <<CC_POP_EOF
551
- $CC_CSV
552
- CC_POP_EOF
553
- CC_CSV=$(printf '%s' "$_cc_pop_kept")
612
+ # verifier decide. Dropping is how "checked" became "checked nothing".
613
+ { if (p == "" || in_population(p)) print $0; else print p > skip }
614
+ ')
615
+ CC_CSV="$_cc_kept"
616
+ _cc_pop_skipped=""
617
+ if [ -s "$_cc_skip_file" ]; then _cc_pop_skipped=$(cat "$_cc_skip_file"); fi
618
+ rm -f "$_cc_skip_file"
554
619
  if [ -n "$_cc_pop_skipped" ]; then
555
620
  _cc_pop_skip_n=$(printf '%s' "$_cc_pop_skipped" | grep -c . || true)
556
621
  echo "ℹ️ Gate 3: ${_cc_pop_skip_n:-0} file(s) outside the baseline population — not graded, not ratcheted:"
@@ -106,18 +106,39 @@ ccn_file_in_population() {
106
106
  local _file="${2:-}"
107
107
  [ -n "$_file" ] || return 1
108
108
 
109
+ # MEMOISED. ccn_baseline_population() shells out to node, which costs ~900ms of
110
+ # interpreter startup per call. This function is called once PER LIZARD ROW, and
111
+ # one file produces dozens of rows, so the naive version spent its whole runtime
112
+ # re-parsing the same JSON:
113
+ #
114
+ # measured 2026-11-23, one changed source file: gate 3 = 55.4s
115
+ # after memoising: gate 3 = ~2s
116
+ #
117
+ # The population is a property of the baseline FILE, not of the row being
118
+ # graded, so caching it per baseline path cannot change a verdict. The cache
119
+ # lives in a shell-local variable keyed by the path so two different baselines
120
+ # seen in one process still resolve independently.
109
121
  local _pop
110
- _pop=$(ccn_baseline_population "$_bl")
122
+ if [ "${_CCN_POP_CACHE_KEYS:-}" = "$_bl" ]; then
123
+ _pop="${_CCN_POP_CACHE_VAL:-}"
124
+ else
125
+ _pop=$(ccn_baseline_population "$_bl")
126
+ _CCN_POP_CACHE_KEYS="$_bl"
127
+ _CCN_POP_CACHE_VAL="$_pop"
128
+ fi
111
129
  # No declaration => unrestricted (legacy baseline).
112
130
  [ -n "$_pop" ] || return 0
113
131
 
114
132
  local _roots="${_pop%%|*}"
115
133
  local _exts="${_pop#*|}"
116
134
  # Normalise separators so a Windows path and a POSIX path compare the same way.
117
- # sed, not `tr '\' '/'`: a lone backslash is a portability trap in tr's SET
118
- # argument (GNU tr warns "unescaped backslash at end of string" and MSYS tr
119
- # behaviour differs), while the sed regex below is unambiguous everywhere.
120
- _norm=$(printf '%s' "$_file" | sed 's|\\|/|g')
135
+ #
136
+ # A bash parameter expansion, NOT `sed 's|\\|/|g'`. Semantics are identical,
137
+ # but spawning sed costs ~190ms on Windows (measured: 20 invocations in 2.7s),
138
+ # and this function runs once per lizard row — 85 rows in one file was 34.5s of
139
+ # pure process startup for a one-character substitution. Builtins have no
140
+ # startup cost, so the per-row cost drops to effectively zero.
141
+ _norm=$(printf '%s' "$_file" | tr '\134' '/')
121
142
 
122
143
  if [ -n "$_roots" ]; then
123
144
  local _hit=0 _r
@@ -2,6 +2,6 @@
2
2
  "verdict": "PASS",
3
3
  "license_type": "MIT",
4
4
  "sha256": "0e7ac423bf2c6e223b7c5b156f8cf72da49d748e56a1641402c31f22ad07dbb5",
5
- "checked_at": "2026-11-22T18:48:54.088Z",
5
+ "checked_at": "2026-11-22T21:58:20.620Z",
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.103",
3
+ "version": "0.38.106",
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.103",
3
+ "version": "0.38.106",
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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.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.103",
3
+ "version": "0.38.105",
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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.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.103",
3
+ "version": "0.38.106",
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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.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.103",
3
+ "version": "0.38.105",
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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.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.103.0
6
+ **Version:** 0.38.106.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.