@boyingliu01/xp-gate 0.27.1 → 0.27.3

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 (104) hide show
  1. package/adapter-common.sh +0 -0
  2. package/adapters/cpp.sh +0 -0
  3. package/adapters/dart.sh +0 -0
  4. package/adapters/flutter.sh +0 -0
  5. package/adapters/gate-7.sh +22 -4
  6. package/adapters/go.sh +0 -0
  7. package/adapters/iac.sh +0 -0
  8. package/adapters/java.sh +68 -6
  9. package/adapters/kotlin.sh +0 -0
  10. package/adapters/objectivec.sh +0 -0
  11. package/adapters/plugins/book299-20132-python/scripts/install-gradle.sh +0 -0
  12. package/adapters/plugins/book299-20132-python/scripts/install-maven.sh +0 -0
  13. package/adapters/plugins/book299-4081-c/scripts/install-gradle.sh +0 -0
  14. package/adapters/plugins/book299-4081-c/scripts/install-maven.sh +0 -0
  15. package/adapters/plugins/book299-4083-javascriptes5/scripts/install-gradle.sh +0 -0
  16. package/adapters/plugins/book299-4083-javascriptes5/scripts/install-maven.sh +0 -0
  17. package/adapters/powershell.sh +0 -0
  18. package/adapters/python.sh +0 -0
  19. package/adapters/shell.sh +0 -0
  20. package/adapters/swift.sh +0 -0
  21. package/adapters/typescript.sh +0 -0
  22. package/bin/xp-gate.js +0 -0
  23. package/gate-10.sh +0 -0
  24. package/gate-3.sh +0 -0
  25. package/gate-4.sh +0 -0
  26. package/gate-7.sh +22 -4
  27. package/gate-8.sh +0 -0
  28. package/gate-9.sh +0 -0
  29. package/hooks/adapter-common.sh +0 -0
  30. package/hooks/gate-10.sh +0 -0
  31. package/hooks/gate-3.sh +0 -0
  32. package/hooks/gate-4.sh +0 -0
  33. package/hooks/gate-7.sh +22 -4
  34. package/hooks/gate-8.sh +0 -0
  35. package/hooks/gate-9.sh +0 -0
  36. package/hooks/post-merge +0 -0
  37. package/hooks/pre-commit +0 -0
  38. package/hooks/pre-push +0 -0
  39. package/hooks/sprint-gate.sh +0 -0
  40. package/lib/__tests__/doctor-delphi.test.js +244 -244
  41. package/lib/__tests__/sprint-audit.test.js +207 -207
  42. package/lib/mattpocock-license-verdict.json +1 -1
  43. package/lib/sprint-audit.js +235 -235
  44. package/mock-policy/AGENTS.md +3 -3
  45. package/mutation/AGENTS.md +3 -3
  46. package/package.json +1 -1
  47. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  48. package/plugins/claude-code/bin/delphi-review-guard.sh +0 -0
  49. package/plugins/claude-code/bin/xp-gate-check +0 -0
  50. package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
  51. package/plugins/claude-code/skills/grill-with-docs/SKILL.md +1 -2
  52. package/plugins/claude-code/skills/grilling/SKILL.md +22 -5
  53. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
  54. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
  55. package/plugins/dsh/lib/command.d.ts +32 -0
  56. package/plugins/dsh/lib/command.d.ts.map +1 -0
  57. package/plugins/dsh/lib/command.js +81 -0
  58. package/plugins/dsh/lib/delphi-config.d.ts +75 -0
  59. package/plugins/dsh/lib/delphi-config.d.ts.map +1 -0
  60. package/plugins/dsh/lib/delphi-config.js +183 -0
  61. package/plugins/dsh/lib/delphi-run.d.ts +24 -0
  62. package/plugins/dsh/lib/delphi-run.d.ts.map +1 -0
  63. package/plugins/dsh/lib/delphi-run.js +92 -0
  64. package/plugins/dsh/lib/delphi.d.ts +88 -0
  65. package/plugins/dsh/lib/delphi.d.ts.map +1 -0
  66. package/plugins/dsh/lib/delphi.js +161 -0
  67. package/plugins/dsh/lib/dialect.d.ts +24 -0
  68. package/plugins/dsh/lib/dialect.d.ts.map +1 -0
  69. package/plugins/dsh/lib/dialect.js +36 -0
  70. package/plugins/dsh/lib/gate-runner.d.ts +18 -0
  71. package/plugins/dsh/lib/gate-runner.d.ts.map +1 -0
  72. package/plugins/dsh/lib/gate-runner.js +46 -0
  73. package/plugins/dsh/lib/index.d.ts +5 -0
  74. package/plugins/dsh/lib/index.d.ts.map +1 -0
  75. package/plugins/dsh/lib/index.js +162 -0
  76. package/plugins/dsh/node_modules/.vite/vitest/results.json +1 -0
  77. package/plugins/dsh/package.json +1 -1
  78. package/plugins/dsh/skills/delphi-review/AGENTS.md +3 -3
  79. package/plugins/dsh/skills/grill-with-docs/SKILL.md +1 -2
  80. package/plugins/dsh/skills/grilling/SKILL.md +22 -5
  81. package/plugins/dsh/skills/sprint-flow/AGENTS.md +3 -3
  82. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +3 -3
  83. package/plugins/dsh/src/delphi-config-global-fallback.test.ts +87 -0
  84. package/plugins/dsh/src/delphi-config.ts +67 -28
  85. package/plugins/opencode/package.json +1 -1
  86. package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
  87. package/plugins/opencode/skills/grill-with-docs/SKILL.md +1 -2
  88. package/plugins/opencode/skills/grilling/SKILL.md +22 -5
  89. package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
  90. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
  91. package/plugins/qoder/bin/sprint-flow-guard.sh +0 -0
  92. package/plugins/qoder/bin/xp-gate-check +0 -0
  93. package/plugins/qoder/plugin.json +1 -1
  94. package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
  95. package/plugins/qoder/skills/sprint-flow/AGENTS.md +3 -3
  96. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
  97. package/principles/AGENTS.md +3 -3
  98. package/scripts/delphi-external-review.cjs +26 -0
  99. package/skills/delphi-review/AGENTS.md +3 -3
  100. package/skills/grill-with-docs/SKILL.md +1 -2
  101. package/skills/grilling/SKILL.md +22 -5
  102. package/skills/sprint-flow/AGENTS.md +3 -3
  103. package/skills/test-specification-alignment/AGENTS.md +3 -3
  104. package/sprint-gate.sh +0 -0
package/adapter-common.sh CHANGED
File without changes
package/adapters/cpp.sh CHANGED
File without changes
package/adapters/dart.sh CHANGED
File without changes
File without changes
@@ -14,10 +14,28 @@ if [ -z "$IAC_FILES" ]; then
14
14
  echo "✅ PASSED - No IaC files detected in changes."
15
15
  GATE_7_STATUS="PASS"
16
16
  else
17
- # Run IaC adapter
18
- if [ -f "githooks/adapters/iac.sh" ]; then
19
- # shellcheck source=githooks/adapters/iac.sh
20
- source "githooks/adapters/iac.sh"
17
+ # Run IaC adapter. Resolution follows the documented 3-tier convention
18
+ # (adapter-common.sh): global ~/.config/xp-gate/adapters -> project
19
+ # githooks/adapters -> script dir. The old cwd-only test silently SKIPped
20
+ # IaC security in every consumer repo without an in-repo githooks/ dir,
21
+ # even with the adapter installed globally (e2e sweep 2026-10-17; pinned
22
+ # by __tests__/gate-7-adapter-resolution.test.bats).
23
+ IAC_ADAPTER=""
24
+ for _candidate in \
25
+ "$HOME/.config/xp-gate/adapters/iac.sh" \
26
+ "githooks/adapters/iac.sh" \
27
+ "${SCRIPT_DIR:-}/adapters/iac.sh"; do
28
+ if [ -n "$_candidate" ] && [ -f "$_candidate" ]; then
29
+ IAC_ADAPTER="$_candidate"
30
+ break
31
+ fi
32
+ done
33
+ if [ -n "$IAC_ADAPTER" ]; then
34
+ # Audit trail: which tier won (r14 walkthrough MAJ-02 — a silent tier-order
35
+ # regression must be visible in the gate output, not only in test diffs).
36
+ echo " IaC adapter resolved from: $IAC_ADAPTER"
37
+ # shellcheck source=/dev/null
38
+ source "$IAC_ADAPTER"
21
39
 
22
40
  # Run static analysis for IaC files
23
41
  IAC_OUTPUT=$(run_static_analysis "$IAC_FILES" 2>&1)
package/adapters/go.sh CHANGED
File without changes
package/adapters/iac.sh CHANGED
File without changes
package/adapters/java.sh CHANGED
@@ -111,13 +111,23 @@ wc_java_json_violation_count() {
111
111
  local json_file="$1"
112
112
  [ -s "$json_file" ] || return 1
113
113
 
114
- # Array-shaped: opens with [ and closes with ]. (A bare [] is valid clean
115
- # output; an object wrapper is outside the pinned contract.)
116
- [ "$(head -c 1 "$json_file")" = "[" ] || return 1
117
- local tail
114
+ # Two shapes are accepted, each closed by its own bracket:
115
+ # - bare array `[ ... ]` — the originally pinned contract ([] = clean);
116
+ # - object wrapper `{ ..., "issues": [ ... ] }` — what wc-java-lint 0.4.x
117
+ # actually emits ({summary, issues}). Rejecting it fail-closed every
118
+ # real Java commit on well-formed JSON (e2e sweep 2026-10-17; pinned by
119
+ # __tests__/issue-507-wc-java-object-json.test.bats). A truncated
120
+ # response still fails its closing-bracket test -> BLOCK.
121
+ local head1 tail shape
122
+ head1=$(head -c 1 "$json_file")
118
123
  tail=$(tr -d '[:space:]' < "$json_file" | tail -c 1)
119
- [ "$tail" = "]" ] || return 1
124
+ case "$head1" in
125
+ "[") shape=array; [ "$tail" = "]" ] || return 1 ;;
126
+ "{") shape=object; [ "$tail" = "}" ] || return 1 ;;
127
+ *) return 1 ;;
128
+ esac
120
129
 
130
+ local structural obj_count file_count rule_count sev_count
121
131
  # Strip string VALUE literals (`: "..."` -> `: ""`). Keys must survive
122
132
  # (they are the tokens being counted); values must vanish (violation
123
133
  # messages routinely contain braces or the words file/rule/severity --
@@ -131,8 +141,60 @@ wc_java_json_violation_count() {
131
141
  # variant either fails to strip values (count desync -> BLOCK, annoying but
132
142
  # safe) or, worst case, errors to empty counts and disarms the lying-tool
133
143
  # BLOCK below (fail-open). Delphi round-2 A-MAJOR-2.
134
- local structural obj_count file_count rule_count sev_count
135
144
  structural=$(sed -E 's/:([[:space:]]*)"([^"\\]|\\.)*"/:\1""/g' "$json_file" 2>/dev/null)
145
+
146
+ if [ "$shape" = "object" ]; then
147
+ # Object wrapper ({summary, issues}). Parse the ISSUES ARRAY exactly with
148
+ # brace-depth tracking (issues are JSON objects, so a record ends exactly
149
+ # where its nesting returns to the array level). For each record: all
150
+ # three keys must be present exactly once. A key outside any record —
151
+ # e.g. split triples in sibling objects, the lying-tool shape of r14
152
+ # CI-02 — makes the per-record key totals disagree with the global
153
+ # stripped counts -> BLOCK. Values were stripped first so braces inside
154
+ # messages cannot skew the depth.
155
+ file_count=$(grep -o '"file"' <<< "$structural" | wc -l | tr -d '[:space:]')
156
+ rule_count=$(grep -o '"rule"' <<< "$structural" | wc -l | tr -d '[:space:]')
157
+ sev_count=$(grep -o '"severity"' <<< "$structural" | wc -l | tr -d '[:space:]')
158
+ [ "$file_count" -eq "$rule_count" ] || return 1
159
+ [ "$file_count" -eq "$sev_count" ] || return 1
160
+ # Everything from the "issues" member onward (the tool emits it last; if
161
+ # a future format moves it, keys before it fall outside record parsing ->
162
+ # sum mismatch -> BLOCK, fail closed). Flatten to one line first: real
163
+ # output is pretty-printed across lines.
164
+ flattened=$(tr '\n' ' ' <<< "$structural")
165
+ tail_from_issues=$(sed -n 's/.*"issues"[[:space:]]*:[[:space:]]*\[/\n/p' <<< "$flattened")
166
+ [ -n "$tail_from_issues" ] || return 1
167
+ records=$(awk '
168
+ { rest = $0
169
+ depth = 0; rec = ""
170
+ for (i = 1; i <= length(rest); i++) {
171
+ c = substr(rest, i, 1)
172
+ if (depth == 0 && c == "]") break
173
+ if (c == "{") { depth++; if (depth == 1) { rec = ""; continue } }
174
+ if (c == "}") { depth--; if (depth == 0) { print rec; continue } }
175
+ if (depth >= 1) rec = rec c
176
+ }
177
+ }' <<< "$tail_from_issues")
178
+ rec_count=0
179
+ rf=0; rr=0; rs=0
180
+ while IFS= read -r _rec; do
181
+ [ -n "$_rec" ] || continue
182
+ cf=$(grep -o '"file"' <<< "$_rec" | wc -l | tr -d '[:space:]')
183
+ cr=$(grep -o '"rule"' <<< "$_rec" | wc -l | tr -d '[:space:]')
184
+ cs=$(grep -o '"severity"' <<< "$_rec" | wc -l | tr -d '[:space:]')
185
+ [ "$cf" -eq 1 ] || return 1
186
+ [ "$cr" -eq 1 ] || return 1
187
+ [ "$cs" -eq 1 ] || return 1
188
+ rf=$((rf + cf)); rr=$((rr + cr)); rs=$((rs + cs))
189
+ rec_count=$((rec_count + 1))
190
+ done <<< "$records"
191
+ [ "$rf" -eq "$file_count" ] || return 1
192
+ [ "$rr" -eq "$rule_count" ] || return 1
193
+ [ "$rs" -eq "$sev_count" ] || return 1
194
+ echo "$rec_count"
195
+ return 0
196
+ fi
197
+
136
198
  obj_count=$(grep -o '{' <<< "$structural" | wc -l | tr -d '[:space:]')
137
199
  file_count=$(grep -o '"file"' <<< "$structural" | wc -l | tr -d '[:space:]')
138
200
  rule_count=$(grep -o '"rule"' <<< "$structural" | wc -l | tr -d '[:space:]')
File without changes
File without changes
File without changes
File without changes
package/adapters/shell.sh CHANGED
File without changes
package/adapters/swift.sh CHANGED
File without changes
File without changes
package/bin/xp-gate.js CHANGED
File without changes
package/gate-10.sh CHANGED
File without changes
package/gate-3.sh CHANGED
File without changes
package/gate-4.sh CHANGED
File without changes
package/gate-7.sh CHANGED
@@ -14,10 +14,28 @@ if [ -z "$IAC_FILES" ]; then
14
14
  echo "✅ PASSED - No IaC files detected in changes."
15
15
  GATE_7_STATUS="PASS"
16
16
  else
17
- # Run IaC adapter
18
- if [ -f "githooks/adapters/iac.sh" ]; then
19
- # shellcheck source=githooks/adapters/iac.sh
20
- source "githooks/adapters/iac.sh"
17
+ # Run IaC adapter. Resolution follows the documented 3-tier convention
18
+ # (adapter-common.sh): global ~/.config/xp-gate/adapters -> project
19
+ # githooks/adapters -> script dir. The old cwd-only test silently SKIPped
20
+ # IaC security in every consumer repo without an in-repo githooks/ dir,
21
+ # even with the adapter installed globally (e2e sweep 2026-10-17; pinned
22
+ # by __tests__/gate-7-adapter-resolution.test.bats).
23
+ IAC_ADAPTER=""
24
+ for _candidate in \
25
+ "$HOME/.config/xp-gate/adapters/iac.sh" \
26
+ "githooks/adapters/iac.sh" \
27
+ "${SCRIPT_DIR:-}/adapters/iac.sh"; do
28
+ if [ -n "$_candidate" ] && [ -f "$_candidate" ]; then
29
+ IAC_ADAPTER="$_candidate"
30
+ break
31
+ fi
32
+ done
33
+ if [ -n "$IAC_ADAPTER" ]; then
34
+ # Audit trail: which tier won (r14 walkthrough MAJ-02 — a silent tier-order
35
+ # regression must be visible in the gate output, not only in test diffs).
36
+ echo " IaC adapter resolved from: $IAC_ADAPTER"
37
+ # shellcheck source=/dev/null
38
+ source "$IAC_ADAPTER"
21
39
 
22
40
  # Run static analysis for IaC files
23
41
  IAC_OUTPUT=$(run_static_analysis "$IAC_FILES" 2>&1)
package/gate-8.sh CHANGED
File without changes
package/gate-9.sh CHANGED
File without changes
File without changes
package/hooks/gate-10.sh CHANGED
File without changes
package/hooks/gate-3.sh CHANGED
File without changes
package/hooks/gate-4.sh CHANGED
File without changes
package/hooks/gate-7.sh CHANGED
@@ -14,10 +14,28 @@ if [ -z "$IAC_FILES" ]; then
14
14
  echo "✅ PASSED - No IaC files detected in changes."
15
15
  GATE_7_STATUS="PASS"
16
16
  else
17
- # Run IaC adapter
18
- if [ -f "githooks/adapters/iac.sh" ]; then
19
- # shellcheck source=githooks/adapters/iac.sh
20
- source "githooks/adapters/iac.sh"
17
+ # Run IaC adapter. Resolution follows the documented 3-tier convention
18
+ # (adapter-common.sh): global ~/.config/xp-gate/adapters -> project
19
+ # githooks/adapters -> script dir. The old cwd-only test silently SKIPped
20
+ # IaC security in every consumer repo without an in-repo githooks/ dir,
21
+ # even with the adapter installed globally (e2e sweep 2026-10-17; pinned
22
+ # by __tests__/gate-7-adapter-resolution.test.bats).
23
+ IAC_ADAPTER=""
24
+ for _candidate in \
25
+ "$HOME/.config/xp-gate/adapters/iac.sh" \
26
+ "githooks/adapters/iac.sh" \
27
+ "${SCRIPT_DIR:-}/adapters/iac.sh"; do
28
+ if [ -n "$_candidate" ] && [ -f "$_candidate" ]; then
29
+ IAC_ADAPTER="$_candidate"
30
+ break
31
+ fi
32
+ done
33
+ if [ -n "$IAC_ADAPTER" ]; then
34
+ # Audit trail: which tier won (r14 walkthrough MAJ-02 — a silent tier-order
35
+ # regression must be visible in the gate output, not only in test diffs).
36
+ echo " IaC adapter resolved from: $IAC_ADAPTER"
37
+ # shellcheck source=/dev/null
38
+ source "$IAC_ADAPTER"
21
39
 
22
40
  # Run static analysis for IaC files
23
41
  IAC_OUTPUT=$(run_static_analysis "$IAC_FILES" 2>&1)
package/hooks/gate-8.sh CHANGED
File without changes
package/hooks/gate-9.sh CHANGED
File without changes
package/hooks/post-merge CHANGED
File without changes
package/hooks/pre-commit CHANGED
File without changes
package/hooks/pre-push CHANGED
File without changes
File without changes