@boyingliu01/xp-gate 0.8.0 → 0.8.2

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 (303) hide show
  1. package/adapters/java.sh +1 -1
  2. package/adapters/plugins/book299-20132-python/README.md +21 -0
  3. package/adapters/plugins/book299-20132-python/plugin.yml +21 -0
  4. package/adapters/plugins/book299-20132-python/rules/exception/gen-0023.yml +14 -0
  5. package/adapters/plugins/book299-20132-python/rules/logging/gen-0071.yml +14 -0
  6. package/adapters/plugins/book299-20132-python/rules/style/gen-0001.yml +14 -0
  7. package/adapters/plugins/book299-20132-python/rules/style/gen-0002.yml +14 -0
  8. package/adapters/plugins/book299-20132-python/rules/style/gen-0003.yml +14 -0
  9. package/adapters/plugins/book299-20132-python/rules/style/gen-0004.yml +14 -0
  10. package/adapters/plugins/book299-20132-python/rules/style/gen-0005.yml +14 -0
  11. package/adapters/plugins/book299-20132-python/rules/style/gen-0006.yml +14 -0
  12. package/adapters/plugins/book299-20132-python/rules/style/gen-0007.yml +14 -0
  13. package/adapters/plugins/book299-20132-python/rules/style/gen-0008.yml +14 -0
  14. package/adapters/plugins/book299-20132-python/rules/style/gen-0009.yml +14 -0
  15. package/adapters/plugins/book299-20132-python/rules/style/gen-0010.yml +14 -0
  16. package/adapters/plugins/book299-20132-python/rules/style/gen-0011.yml +14 -0
  17. package/adapters/plugins/book299-20132-python/rules/style/gen-0012.yml +14 -0
  18. package/adapters/plugins/book299-20132-python/rules/style/gen-0013.yml +14 -0
  19. package/adapters/plugins/book299-20132-python/rules/style/gen-0014.yml +14 -0
  20. package/adapters/plugins/book299-20132-python/rules/style/gen-0015.yml +14 -0
  21. package/adapters/plugins/book299-20132-python/rules/style/gen-0016.yml +14 -0
  22. package/adapters/plugins/book299-20132-python/rules/style/gen-0017.yml +14 -0
  23. package/adapters/plugins/book299-20132-python/rules/style/gen-0018.yml +14 -0
  24. package/adapters/plugins/book299-20132-python/rules/style/gen-0019.yml +14 -0
  25. package/adapters/plugins/book299-20132-python/rules/style/gen-0020.yml +14 -0
  26. package/adapters/plugins/book299-20132-python/rules/style/gen-0021.yml +14 -0
  27. package/adapters/plugins/book299-20132-python/rules/style/gen-0022.yml +14 -0
  28. package/adapters/plugins/book299-20132-python/rules/style/gen-0024.yml +14 -0
  29. package/adapters/plugins/book299-20132-python/rules/style/gen-0025.yml +14 -0
  30. package/adapters/plugins/book299-20132-python/rules/style/gen-0026.yml +14 -0
  31. package/adapters/plugins/book299-20132-python/rules/style/gen-0027.yml +14 -0
  32. package/adapters/plugins/book299-20132-python/rules/style/gen-0028.yml +14 -0
  33. package/adapters/plugins/book299-20132-python/rules/style/gen-0029.yml +14 -0
  34. package/adapters/plugins/book299-20132-python/rules/style/gen-0030.yml +14 -0
  35. package/adapters/plugins/book299-20132-python/rules/style/gen-0031.yml +14 -0
  36. package/adapters/plugins/book299-20132-python/rules/style/gen-0032.yml +14 -0
  37. package/adapters/plugins/book299-20132-python/rules/style/gen-0033.yml +14 -0
  38. package/adapters/plugins/book299-20132-python/rules/style/gen-0034.yml +14 -0
  39. package/adapters/plugins/book299-20132-python/rules/style/gen-0035.yml +14 -0
  40. package/adapters/plugins/book299-20132-python/rules/style/gen-0036.yml +14 -0
  41. package/adapters/plugins/book299-20132-python/rules/style/gen-0037.yml +14 -0
  42. package/adapters/plugins/book299-20132-python/rules/style/gen-0038.yml +14 -0
  43. package/adapters/plugins/book299-20132-python/rules/style/gen-0039.yml +14 -0
  44. package/adapters/plugins/book299-20132-python/rules/style/gen-0040.yml +14 -0
  45. package/adapters/plugins/book299-20132-python/rules/style/gen-0041.yml +14 -0
  46. package/adapters/plugins/book299-20132-python/rules/style/gen-0042.yml +14 -0
  47. package/adapters/plugins/book299-20132-python/rules/style/gen-0043.yml +14 -0
  48. package/adapters/plugins/book299-20132-python/rules/style/gen-0044.yml +14 -0
  49. package/adapters/plugins/book299-20132-python/rules/style/gen-0045.yml +14 -0
  50. package/adapters/plugins/book299-20132-python/rules/style/gen-0046.yml +14 -0
  51. package/adapters/plugins/book299-20132-python/rules/style/gen-0047.yml +14 -0
  52. package/adapters/plugins/book299-20132-python/rules/style/gen-0048.yml +14 -0
  53. package/adapters/plugins/book299-20132-python/rules/style/gen-0049.yml +14 -0
  54. package/adapters/plugins/book299-20132-python/rules/style/gen-0050.yml +14 -0
  55. package/adapters/plugins/book299-20132-python/rules/style/gen-0051.yml +14 -0
  56. package/adapters/plugins/book299-20132-python/rules/style/gen-0052.yml +14 -0
  57. package/adapters/plugins/book299-20132-python/rules/style/gen-0053.yml +14 -0
  58. package/adapters/plugins/book299-20132-python/rules/style/gen-0054.yml +14 -0
  59. package/adapters/plugins/book299-20132-python/rules/style/gen-0055.yml +14 -0
  60. package/adapters/plugins/book299-20132-python/rules/style/gen-0056.yml +14 -0
  61. package/adapters/plugins/book299-20132-python/rules/style/gen-0057.yml +14 -0
  62. package/adapters/plugins/book299-20132-python/rules/style/gen-0058.yml +14 -0
  63. package/adapters/plugins/book299-20132-python/rules/style/gen-0059.yml +14 -0
  64. package/adapters/plugins/book299-20132-python/rules/style/gen-0060.yml +14 -0
  65. package/adapters/plugins/book299-20132-python/rules/style/gen-0061.yml +14 -0
  66. package/adapters/plugins/book299-20132-python/rules/style/gen-0062.yml +14 -0
  67. package/adapters/plugins/book299-20132-python/rules/style/gen-0063.yml +14 -0
  68. package/adapters/plugins/book299-20132-python/rules/style/gen-0064.yml +14 -0
  69. package/adapters/plugins/book299-20132-python/rules/style/gen-0065.yml +14 -0
  70. package/adapters/plugins/book299-20132-python/rules/style/gen-0066.yml +14 -0
  71. package/adapters/plugins/book299-20132-python/rules/style/gen-0067.yml +14 -0
  72. package/adapters/plugins/book299-20132-python/rules/style/gen-0068.yml +14 -0
  73. package/adapters/plugins/book299-20132-python/rules/style/gen-0069.yml +14 -0
  74. package/adapters/plugins/book299-20132-python/rules/style/gen-0070.yml +14 -0
  75. package/adapters/plugins/book299-20132-python/rules/style/gen-0072.yml +14 -0
  76. package/adapters/plugins/book299-20132-python/rules/style/gen-0073.yml +14 -0
  77. package/adapters/plugins/book299-20132-python/scripts/install-gradle.sh +4 -0
  78. package/adapters/plugins/book299-20132-python/scripts/install-maven.sh +20 -0
  79. package/adapters/plugins/book299-4081-c/README.md +21 -0
  80. package/adapters/plugins/book299-4081-c/plugin.yml +21 -0
  81. package/adapters/plugins/book299-4081-c/rules/collection/c/345/273/272-5-12.yml +14 -0
  82. package/adapters/plugins/book299-4081-c/rules/collection/c/345/273/272-5-8.yml +14 -0
  83. package/adapters/plugins/book299-4081-c/rules/concurrency/c/350/247/204-4-19.yml +14 -0
  84. package/adapters/plugins/book299-4081-c/rules/concurrency/c/350/247/204-4-20.yml +14 -0
  85. package/adapters/plugins/book299-4081-c/rules/exception/c/350/247/204-4-11.yml +14 -0
  86. package/adapters/plugins/book299-4081-c/rules/exception/c/350/247/204-4-12.yml +14 -0
  87. package/adapters/plugins/book299-4081-c/rules/exception/c/350/247/204-4-6.yml +14 -0
  88. package/adapters/plugins/book299-4081-c/rules/exception/c/350/247/204-4-8.yml +14 -0
  89. package/adapters/plugins/book299-4081-c/rules/exception/c/350/247/204-4-9.yml +14 -0
  90. package/adapters/plugins/book299-4081-c/rules/performance/c/345/273/272-5-13.yml +14 -0
  91. package/adapters/plugins/book299-4081-c/rules/performance/c/345/273/272-5-6.yml +14 -0
  92. package/adapters/plugins/book299-4081-c/rules/performance/c/345/273/272-5-7.yml +14 -0
  93. package/adapters/plugins/book299-4081-c/rules/performance/c/350/247/204-4-14.yml +14 -0
  94. package/adapters/plugins/book299-4081-c/rules/performance/c/350/247/204-4-2.yml +14 -0
  95. package/adapters/plugins/book299-4081-c/rules/resource/c/345/273/272-4-2.yml +14 -0
  96. package/adapters/plugins/book299-4081-c/rules/security/c/350/247/204-4-13.yml +14 -0
  97. package/adapters/plugins/book299-4081-c/rules/style/c/345/216/237-1-1.yml +14 -0
  98. package/adapters/plugins/book299-4081-c/rules/style/c/345/216/237-1-2.yml +14 -0
  99. package/adapters/plugins/book299-4081-c/rules/style/c/345/216/237-1-3.yml +14 -0
  100. package/adapters/plugins/book299-4081-c/rules/style/c/345/216/237-1-4.yml +14 -0
  101. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-2-1.yml +14 -0
  102. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-2-2.yml +14 -0
  103. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-2-3.yml +14 -0
  104. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-2-4.yml +14 -0
  105. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-3-1.yml +14 -0
  106. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-3-2.yml +14 -0
  107. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-3-3.yml +14 -0
  108. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-3-4.yml +14 -0
  109. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-3-5.yml +14 -0
  110. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-3-6.yml +14 -0
  111. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-3-7.yml +14 -0
  112. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-3-8.yml +14 -0
  113. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-4-1.yml +14 -0
  114. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-4-3.yml +14 -0
  115. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-5-1.yml +14 -0
  116. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-5-10.yml +14 -0
  117. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-5-11.yml +14 -0
  118. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-5-2.yml +14 -0
  119. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-5-3.yml +14 -0
  120. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-5-4.yml +14 -0
  121. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-5-5.yml +14 -0
  122. package/adapters/plugins/book299-4081-c/rules/style/c/345/273/272-5-9.yml +14 -0
  123. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-1.yml +14 -0
  124. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-10.yml +14 -0
  125. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-11.yml +14 -0
  126. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-12.yml +14 -0
  127. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-13.yml +14 -0
  128. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-14.yml +14 -0
  129. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-16.yml +14 -0
  130. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-17.yml +14 -0
  131. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-18.yml +14 -0
  132. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-19.yml +14 -0
  133. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-2.yml +14 -0
  134. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-20.yml +14 -0
  135. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-3.yml +14 -0
  136. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-4.yml +14 -0
  137. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-5.yml +14 -0
  138. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-6.yml +14 -0
  139. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-7.yml +14 -0
  140. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-8.yml +14 -0
  141. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-2-9.yml +14 -0
  142. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-1.yml +14 -0
  143. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-10.yml +14 -0
  144. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-11.yml +14 -0
  145. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-12.yml +14 -0
  146. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-13.yml +14 -0
  147. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-14.yml +14 -0
  148. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-15.yml +14 -0
  149. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-16.yml +14 -0
  150. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-17.yml +14 -0
  151. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-18.yml +14 -0
  152. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-19.yml +14 -0
  153. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-2.yml +14 -0
  154. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-20.yml +14 -0
  155. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-21.yml +14 -0
  156. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-22.yml +14 -0
  157. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-3.yml +14 -0
  158. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-4.yml +14 -0
  159. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-5.yml +14 -0
  160. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-6.yml +14 -0
  161. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-7.yml +14 -0
  162. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-8.yml +14 -0
  163. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-3-9.yml +14 -0
  164. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-4-1.yml +14 -0
  165. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-4-10.yml +14 -0
  166. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-4-15.yml +14 -0
  167. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-4-16.yml +14 -0
  168. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-4-17.yml +14 -0
  169. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-4-18.yml +14 -0
  170. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-4-3.yml +14 -0
  171. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-4-4.yml +14 -0
  172. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-4-5.yml +14 -0
  173. package/adapters/plugins/book299-4081-c/rules/style/c/350/247/204-4-7.yml +14 -0
  174. package/adapters/plugins/book299-4081-c/scripts/install-gradle.sh +4 -0
  175. package/adapters/plugins/book299-4081-c/scripts/install-maven.sh +20 -0
  176. package/adapters/plugins/book299-4083-javascriptes5/README.md +21 -0
  177. package/adapters/plugins/book299-4083-javascriptes5/plugin.yml +21 -0
  178. package/adapters/plugins/book299-4083-javascriptes5/rules/security/gen-0001.yml +14 -0
  179. package/adapters/plugins/book299-4083-javascriptes5/rules/security/gen-0002.yml +14 -0
  180. package/adapters/plugins/book299-4083-javascriptes5/rules/security/gen-0003.yml +14 -0
  181. package/adapters/plugins/book299-4083-javascriptes5/scripts/install-gradle.sh +4 -0
  182. package/adapters/plugins/book299-4083-javascriptes5/scripts/install-maven.sh +20 -0
  183. package/adapters/plugins/p3c-java/README.md +66 -0
  184. package/adapters/plugins/p3c-java/plugin.yml +30 -0
  185. package/adapters/plugins/p3c-java/scripts/install-gradle-p3c.sh +45 -0
  186. package/adapters/plugins/p3c-java/scripts/install-maven-p3c.sh +98 -0
  187. package/adapters/plugins/p3c-java/templates/gradle/xp-gate-p3c-gradle.gradle +68 -0
  188. package/adapters/plugins/p3c-java/templates/maven/xp-gate-p3c-profile.xml +81 -0
  189. package/adapters/plugins/whalecloud-java/README.md +98 -0
  190. package/adapters/plugins/whalecloud-java/plugin.yml +45 -0
  191. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-001.yml +17 -0
  192. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-002.yml +17 -0
  193. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-003.yml +17 -0
  194. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-004.yml +17 -0
  195. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-005.yml +17 -0
  196. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-006.yml +17 -0
  197. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-007.yml +17 -0
  198. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-008.yml +17 -0
  199. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-009.yml +17 -0
  200. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-010.yml +17 -0
  201. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-011.yml +17 -0
  202. package/adapters/plugins/whalecloud-java/rules/collection/wc-collect-012.yml +17 -0
  203. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-001.yml +17 -0
  204. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-002.yml +17 -0
  205. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-003.yml +17 -0
  206. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-004.yml +17 -0
  207. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-005.yml +17 -0
  208. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-006.yml +17 -0
  209. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-007.yml +17 -0
  210. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-008.yml +17 -0
  211. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-009.yml +17 -0
  212. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-010.yml +17 -0
  213. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-011.yml +17 -0
  214. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-012.yml +17 -0
  215. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-013.yml +17 -0
  216. package/adapters/plugins/whalecloud-java/rules/concurrency/wc-concur-014.yml +17 -0
  217. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-001.yml +17 -0
  218. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-002.yml +17 -0
  219. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-003.yml +17 -0
  220. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-004.yml +17 -0
  221. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-005.yml +17 -0
  222. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-006.yml +17 -0
  223. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-007.yml +17 -0
  224. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-008.yml +17 -0
  225. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-009.yml +17 -0
  226. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-010.yml +17 -0
  227. package/adapters/plugins/whalecloud-java/rules/exception/wc-except-011.yml +17 -0
  228. package/adapters/plugins/whalecloud-java/rules/logging/wc-log-001.yml +17 -0
  229. package/adapters/plugins/whalecloud-java/rules/logging/wc-log-002.yml +17 -0
  230. package/adapters/plugins/whalecloud-java/rules/logging/wc-log-003.yml +17 -0
  231. package/adapters/plugins/whalecloud-java/rules/logging/wc-log-004.yml +17 -0
  232. package/adapters/plugins/whalecloud-java/rules/logging/wc-log-005.yml +17 -0
  233. package/adapters/plugins/whalecloud-java/rules/logging/wc-log-006.yml +17 -0
  234. package/adapters/plugins/whalecloud-java/rules/logging/wc-log-007.yml +17 -0
  235. package/adapters/plugins/whalecloud-java/rules/performance/wc-perf-001.yml +17 -0
  236. package/adapters/plugins/whalecloud-java/rules/performance/wc-perf-002.yml +17 -0
  237. package/adapters/plugins/whalecloud-java/rules/performance/wc-perf-003.yml +17 -0
  238. package/adapters/plugins/whalecloud-java/rules/performance/wc-perf-004.yml +17 -0
  239. package/adapters/plugins/whalecloud-java/rules/performance/wc-perf-005.yml +17 -0
  240. package/adapters/plugins/whalecloud-java/rules/performance/wc-perf-006.yml +17 -0
  241. package/adapters/plugins/whalecloud-java/rules/performance/wc-perf-007.yml +17 -0
  242. package/adapters/plugins/whalecloud-java/rules/performance/wc-perf-008.yml +17 -0
  243. package/adapters/plugins/whalecloud-java/rules/resource/wc-reso-001.yml +17 -0
  244. package/adapters/plugins/whalecloud-java/rules/resource/wc-reso-002.yml +17 -0
  245. package/adapters/plugins/whalecloud-java/rules/resource/wc-reso-003.yml +17 -0
  246. package/adapters/plugins/whalecloud-java/rules/resource/wc-reso-004.yml +17 -0
  247. package/adapters/plugins/whalecloud-java/rules/resource/wc-reso-005.yml +17 -0
  248. package/adapters/plugins/whalecloud-java/rules/resource/wc-reso-006.yml +17 -0
  249. package/adapters/plugins/whalecloud-java/rules/security/wc-secu-001.yml +17 -0
  250. package/adapters/plugins/whalecloud-java/rules/security/wc-secu-002.yml +17 -0
  251. package/adapters/plugins/whalecloud-java/rules/security/wc-secu-003.yml +17 -0
  252. package/adapters/plugins/whalecloud-java/rules/security/wc-secu-004.yml +17 -0
  253. package/adapters/plugins/whalecloud-java/rules/security/wc-secu-005.yml +17 -0
  254. package/adapters/plugins/whalecloud-java/rules/style/wc-style-001.yml +17 -0
  255. package/adapters/plugins/whalecloud-java/rules/style/wc-style-002.yml +17 -0
  256. package/adapters/plugins/whalecloud-java/rules/style/wc-style-003.yml +17 -0
  257. package/adapters/plugins/whalecloud-java/rules/style/wc-style-004.yml +17 -0
  258. package/adapters/plugins/whalecloud-java/rules/style/wc-style-005.yml +17 -0
  259. package/adapters/plugins/whalecloud-java/rules/style/wc-style-006.yml +17 -0
  260. package/adapters/plugins/whalecloud-java/rules/style/wc-style-007.yml +17 -0
  261. package/adapters/plugins/whalecloud-java/rules/style/wc-style-008.yml +17 -0
  262. package/adapters/plugins/whalecloud-java/rules/style/wc-style-009.yml +17 -0
  263. package/adapters/plugins/whalecloud-java/rules/style/wc-style-010.yml +17 -0
  264. package/adapters/plugins/whalecloud-java/rules/style/wc-style-011.yml +17 -0
  265. package/adapters/plugins/whalecloud-java/rules/style/wc-style-012.yml +17 -0
  266. package/adapters/plugins/whalecloud-java/rules/style/wc-style-013.yml +17 -0
  267. package/adapters/plugins/whalecloud-java/rules/style/wc-style-014.yml +17 -0
  268. package/adapters/plugins/whalecloud-java/rules/style/wc-style-015.yml +17 -0
  269. package/adapters/plugins/whalecloud-java/rules/style/wc-style-016.yml +17 -0
  270. package/adapters/plugins/whalecloud-java/rules/style/wc-style-017.yml +17 -0
  271. package/adapters/plugins/whalecloud-java/rules/style/wc-style-018.yml +17 -0
  272. package/adapters/plugins/whalecloud-java/scripts/install-gradle-whalecloud.sh +97 -0
  273. package/adapters/plugins/whalecloud-java/scripts/install-maven-whalecloud.sh +201 -0
  274. package/adapters/plugins/whalecloud-java/templates/gradle/xp-gate-whalecloud-gradle.gradle +73 -0
  275. package/adapters/plugins/whalecloud-java/templates/maven/xp-gate-whalecloud-profile.xml +148 -0
  276. package/hooks/pre-commit +26 -23
  277. package/hooks/pre-push +7 -3
  278. package/lib/__tests__/ui-detector.test.ts +94 -0
  279. package/lib/init.js +44 -0
  280. package/lib/ui-detector.ts +3 -3
  281. package/package.json +1 -1
  282. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  283. package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
  284. package/plugins/claude-code/skills/ralph-loop/SKILL.md +41 -3
  285. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
  286. package/plugins/claude-code/skills/sprint-flow/SKILL.md +147 -4
  287. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
  288. package/plugins/opencode/package.json +1 -1
  289. package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
  290. package/plugins/opencode/skills/ralph-loop/SKILL.md +41 -3
  291. package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
  292. package/plugins/opencode/skills/sprint-flow/SKILL.md +147 -4
  293. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
  294. package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
  295. package/plugins/qoder/skills/ralph-loop/SKILL.md +41 -3
  296. package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
  297. package/plugins/qoder/skills/sprint-flow/SKILL.md +147 -4
  298. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
  299. package/skills/delphi-review/AGENTS.md +1 -1
  300. package/skills/ralph-loop/SKILL.md +41 -3
  301. package/skills/sprint-flow/AGENTS.md +1 -1
  302. package/skills/sprint-flow/SKILL.md +147 -4
  303. package/skills/test-specification-alignment/AGENTS.md +1 -1
@@ -0,0 +1,73 @@
1
+ // WhaleCloud Java Coding Standards Gradle config for XP-Gate.
2
+ // Layered on top of p3c-pmd baseline — adds 74 mandatory + 32 recommended
3
+ // WhaleCloud-internal rules not covered by Alibaba p3c-pmd.
4
+ //
5
+ // Usage:
6
+ // ./gradlew XP-GateWhalecloudCheck
7
+ //
8
+ // Depends on: p3c-pmd config (XP-GateP3cCheck) must also be active.
9
+
10
+ plugins {
11
+ id 'java'
12
+ id 'pmd'
13
+ id 'checkstyle'
14
+ id 'com.github.spotbugs' version '5.2.5'
15
+ }
16
+
17
+ // PMD configuration: p3c-pmd baseline + WhaleCloud overlay
18
+ pmd {
19
+ consoleOutput = true
20
+ toolVersion = '7.7.0'
21
+ ruleSetFiles = files(
22
+ 'config/pmd/whalecloud-ruleset.xml'
23
+ )
24
+ ruleSets = [
25
+ '/rulesets/java/ali-comment.xml',
26
+ '/rulesets/java/ali-concurrent.xml',
27
+ '/rulesets/java/ali-constant.xml',
28
+ '/rulesets/java/ali-exception.xml',
29
+ '/rulesets/java/ali-flowcontrol.xml',
30
+ '/rulesets/java/ali-naming.xml',
31
+ '/rulesets/java/ali-oop.xml',
32
+ '/rulesets/java/ali-orm.xml',
33
+ '/rulesets/java/ali-other.xml',
34
+ '/rulesets/java/ali-set.xml'
35
+ ]
36
+ sourceSets = [sourceSets.main, sourceSets.test]
37
+ }
38
+
39
+ // CheckStyle with WhaleCloud customized ruleset
40
+ checkstyle {
41
+ toolVersion = '10.21.3'
42
+ configFile = file('config/checkstyle/whalecloud-checkstyle.xml')
43
+ sourceSets = [sourceSets.main, sourceSets.test]
44
+ }
45
+
46
+ // SpotBugs + FindSecBugs for security analysis
47
+ spotbugs {
48
+ toolVersion = '4.7.3'
49
+ includeFilter = file('config/spotbugs/whalecloud-spotbugs.xml')
50
+ effort = 'max'
51
+ reportLevel = 'low'
52
+ sourceSets = [sourceSets.main]
53
+ }
54
+
55
+ dependencies {
56
+ spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0'
57
+ }
58
+
59
+ // Combined WhaleCloud check task
60
+ task XP-GateWhalecloudCheck {
61
+ description = 'Run all WhaleCloud Java coding standard checks (p3c-pmd + overlay + security)'
62
+ group = 'Verification'
63
+ dependsOn 'pmdMain', 'pmdTest', 'checkstyleMain', 'checkstyleTest', 'spotbugsMain'
64
+ }
65
+
66
+ // Install script: copies config files from plugin to project
67
+ def whalecloudConfigDir = "${projectDir}/config"
68
+ task installWhalecloudConfig(type: Copy) {
69
+ from "${pluginDir}/templates/gradle/config/"
70
+ into whalecloudConfigDir
71
+ description = 'Install WhaleCloud rule configuration files into project'
72
+ group = 'XP-Gate'
73
+ }
@@ -0,0 +1,148 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ WhaleCloud Java Coding Standards Maven profile for XP-Gate.
4
+ Layered on top of p3c-pmd baseline — adds 74 mandatory + 32 recommended
5
+ WhaleCloud-internal rules not covered by Alibaba p3c-pmd.
6
+
7
+ Usage:
8
+ mvn clean verify -P XP-Gate-whalecloud-java
9
+ mvn clean verify -P XP-Gate-whalecloud-java -Dpmd.failOnViolation=true
10
+
11
+ Depends on: p3c-pmd profile (XP-Gate-p3c) must also be active.
12
+
13
+ Rules covered: 106 rules across 8 categories
14
+ - wc-collection: 集合处理增强 (12 条)
15
+ - wc-concurrent: 并发编程增强 (14 条)
16
+ - wc-exception: 异常处理规范 (11 条)
17
+ - wc-logging: 日志输出规范 (7 条)
18
+ - wc-security: 安全管理规范 (10 条)
19
+ - wc-resource: 资源管理规范 (6 条)
20
+ - wc-style: 编码风格规范 (18 条)
21
+ - wc-performance: 性能优化规范 (8 条)
22
+ -->
23
+ <profile>
24
+ <id>XP-Gate-whalecloud-java</id>
25
+ <activation>
26
+ <file>
27
+ <exists>${project.basedir}/src/main</exists>
28
+ </file>
29
+ </activation>
30
+ <build>
31
+ <plugins>
32
+ <!-- PMD with custom WhaleCloud ruleset (extends p3c-pmd) -->
33
+ <plugin>
34
+ <groupId>org.apache.maven.plugins</groupId>
35
+ <artifactId>maven-pmd-plugin</artifactId>
36
+ <version>3.21.2</version>
37
+ <configuration>
38
+ <targetJdk>${java.version}</targetJdk>
39
+ <rulesets>
40
+ <!-- BASELINE: Alibaba p3c-pmd (54 rules) -->
41
+ <ruleset>/rulesets/java/ali-comment.xml</ruleset>
42
+ <ruleset>/rulesets/java/ali-concurrent.xml</ruleset>
43
+ <ruleset>/rulesets/java/ali-constant.xml</ruleset>
44
+ <ruleset>/rulesets/java/ali-exception.xml</ruleset>
45
+ <ruleset>/rulesets/java/ali-flowcontrol.xml</ruleset>
46
+ <ruleset>/rulesets/java/ali-naming.xml</ruleset>
47
+ <ruleset>/rulesets/java/ali-oop.xml</ruleset>
48
+ <ruleset>/rulesets/java/ali-orm.xml</ruleset>
49
+ <ruleset>/rulesets/java/ali-other.xml</ruleset>
50
+ <ruleset>/rulesets/java/ali-set.xml</ruleset>
51
+ <!-- OVERLAY: WhaleCloud custom rules -->
52
+ <ruleset>${project.basedir}/config/pmd/whalecloud-ruleset.xml</ruleset>
53
+ </rulesets>
54
+ <printFailingErrors>true</printFailingErrors>
55
+ <failOnViolation>true</failOnViolation>
56
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
57
+ <outputEncoding>UTF-8</outputEncoding>
58
+ <analysisCache>true</analysisCache>
59
+ <maxWarnings>0</maxWarnings>
60
+ </configuration>
61
+ <executions>
62
+ <execution>
63
+ <id>whalecloud-pmd-check</id>
64
+ <phase>verify</phase>
65
+ <goals>
66
+ <goal>check</goal>
67
+ </goals>
68
+ <configuration>
69
+ <failOnViolation>${pmd.failOnViolation}</failOnViolation>
70
+ </configuration>
71
+ </execution>
72
+ <execution>
73
+ <id>whalecloud-cpd-check</id>
74
+ <phase>verify</phase>
75
+ <goals>
76
+ <goal>cpd-check</goal>
77
+ </goals>
78
+ <configuration>
79
+ <failOnViolation>true</failOnViolation>
80
+ <minimumTokens>100</minimumTokens>
81
+ </configuration>
82
+ </execution>
83
+ </executions>
84
+ <dependencies>
85
+ <!-- p3c-pmd baseline -->
86
+ <dependency>
87
+ <groupId>com.alibaba.p3c</groupId>
88
+ <artifactId>p3c-pmd</artifactId>
89
+ <version>2.1.1</version>
90
+ </dependency>
91
+ </dependencies>
92
+ </plugin>
93
+
94
+ <!-- CheckStyle with WhaleCloud customized ruleset -->
95
+ <plugin>
96
+ <groupId>org.apache.maven.plugins</groupId>
97
+ <artifactId>maven-checkstyle-plugin</artifactId>
98
+ <version>3.3.1</version>
99
+ <configuration>
100
+ <configLocation>${project.basedir}/config/checkstyle/whalecloud-checkstyle.xml</configLocation>
101
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
102
+ <consoleOutput>true</consoleOutput>
103
+ <failsOnError>true</failsOnError>
104
+ <linkXRef>false</linkXRef>
105
+ </configuration>
106
+ <executions>
107
+ <execution>
108
+ <id>whalecloud-checkstyle</id>
109
+ <phase>verify</phase>
110
+ <goals>
111
+ <goal>check</goal>
112
+ </goals>
113
+ </execution>
114
+ </executions>
115
+ </plugin>
116
+
117
+ <!-- SpotBugs + FindSecBugs for security analysis -->
118
+ <plugin>
119
+ <groupId>com.github.spotbugs</groupId>
120
+ <artifactId>spotbugs-maven-plugin</artifactId>
121
+ <version>4.7.3.5</version>
122
+ <configuration>
123
+ <includeFilterFile>${project.basedir}/config/spotbugs/whalecloud-spotbugs.xml</includeFilterFile>
124
+ <effort>Max</effort>
125
+ <threshold>Low</threshold>
126
+ <failOnError>true</failOnError>
127
+ <includeTests>false</includeTests>
128
+ </configuration>
129
+ <executions>
130
+ <execution>
131
+ <id>whalecloud-spotbugs</id>
132
+ <phase>verify</phase>
133
+ <goals>
134
+ <goal>check</goal>
135
+ </goals>
136
+ </execution>
137
+ </executions>
138
+ <dependencies>
139
+ <dependency>
140
+ <groupId>com.h3xstream.findsecbugs</groupId>
141
+ <artifactId>findsecbugs-plugin</artifactId>
142
+ <version>1.12.0</version>
143
+ </dependency>
144
+ </dependencies>
145
+ </plugin>
146
+ </plugins>
147
+ </build>
148
+ </profile>
package/hooks/pre-commit CHANGED
@@ -576,7 +576,6 @@ elif [ "$PROJECT_LANG" = "powershell" ]; then
576
576
 
577
577
  else
578
578
  CCN_THRESHOLD=5
579
- CCN_ERROR_THRESHOLD=10 # Changed from 15 to 10 as per standard practice
580
579
 
581
580
  # Check lizard availability
582
581
  LIZARD_CMD=""
@@ -603,22 +602,12 @@ else
603
602
  CC_WARNINGS=$(echo "$CC_OUTPUT" | grep "^Warning cnt" | awk '{print $NF}' | tr -d '[:space:]' | sed 's/[^0-9]//g' || true)
604
603
  CC_WARNINGS=${CC_WARNINGS:-0}
605
604
 
606
- # Count functions with CCN > CCN_ERROR_THRESHOLD (these block)
607
- CC_ERRORS=$(echo "$CC_OUTPUT" | awk 'NF>=6 && $2 ~ /^[0-9]+$/ && $NF ~ /@/ && $2+0 > '"$CCN_ERROR_THRESHOLD"'' | sort -u -k5,5 | wc -l)
608
-
609
- if [ "$CC_ERRORS" -gt 0 ]; then
610
- echo "$CC_OUTPUT"
611
- echo ""
612
- echo "❌ BLOCKED - Functions with CCN > $CCN_ERROR_THRESHOLD found."
613
- echo "Refactor high-complexity functions to keep below $CCN_ERROR_THRESHOLD complexity."
614
- exit
615
- fi
616
-
617
605
  if [ "$CC_WARNINGS" -gt 0 ]; then
618
606
  echo "$CC_OUTPUT"
619
607
  echo ""
620
- echo "⚠️ Found $CC_WARNINGS functions with CCN > $CCN_THRESHOLD (acceptable warning level)"
621
- echo " PASSED - Within error threshold (warnings allowed)."
608
+ echo " BLOCKED - $CC_WARNINGS functions with CCN > $CCN_THRESHOLD found."
609
+ echo "Refactor high-complexity functions to keep below $CCN_THRESHOLD complexity."
610
+ exit 1
622
611
  else
623
612
  echo "✅ PASSED - All functions within complexity threshold ($CCN_THRESHOLD)."
624
613
  fi
@@ -1104,19 +1093,33 @@ elif [ "$PROJECT_LANG" = "powershell" ]; then
1104
1093
 
1105
1094
  else
1106
1095
  # Check if architecture config exists
1107
- if [ -f "architecture.yaml" ] || [ -f ".architecturerc" ]; then
1096
+ if [ -f "architecture.yaml" ] || [ -f ".architecturerc" ] || [ -f ".archlint.yaml" ]; then
1108
1097
  # Different architecture tools per language
1109
1098
  case "$PROJECT_LANG" in
1110
1099
  "typescript")
1111
- if ! require_tool "archlint" "Gate 6" "npm install -g @archlinter/cli"; then
1112
- echo " ❌ BLOCKED - archlint not installed"
1113
- echo " Install with: npm install -g @archlinter/cli"
1114
- exit
1100
+ # Try local npx install first (devDependencies), fall back to global
1101
+ if npx --no-install @archlinter/cli --version >/dev/null 2>&1; then
1102
+ ARCHLINT_CMD="npx --no-install @archlinter/cli"
1103
+ elif command -v archlint >/dev/null 2>&1; then
1104
+ ARCHLINT_CMD="archlint"
1105
+ elif npx @archlinter/cli --version >/dev/null 2>&1; then
1106
+ ARCHLINT_CMD="npx @archlinter/cli"
1115
1107
  else
1116
- echo " Running archlint for TypeScript..."
1117
- archlint scan . -f table --quiet 2>&1 | tail -30 || echo "⚠️ Architectural smells detected (pre-existing, continuing)"
1118
- echo " ✅ TypeScript architecture validation completed."
1108
+ echo " BLOCKED - archlint not installed"
1109
+ echo " Install with: npm install --save-dev @archlinter/cli"
1110
+ exit 1
1111
+ fi
1112
+ echo " Running archlint for TypeScript..."
1113
+ ARCHLINT_OUTPUT=$($ARCHLINT_CMD scan . -f table --quiet 2>&1)
1114
+ ARCHLINT_EXIT=$?
1115
+ echo "$ARCHLINT_OUTPUT" | tail -30
1116
+ if [ "$ARCHLINT_EXIT" -ne 0 ]; then
1117
+ echo ""
1118
+ echo "❌ BLOCKED - Architecture violations detected"
1119
+ echo "Fix the architecture violations above before committing."
1120
+ exit 1
1119
1121
  fi
1122
+ echo " ✅ TypeScript architecture validation completed."
1120
1123
  ;;
1121
1124
  "python")
1122
1125
  if [ -f ".import-linter.yml" ] || [ -f "import_linter_config.yml" ]; then
@@ -1584,7 +1587,7 @@ generate_quality_report() {
1584
1587
  "name": "Cyclomatic Complexity",
1585
1588
  "status": "${GATE_3_STATUS:-PASS}",
1586
1589
  "threshold": "${CCN_THRESHOLD:-5}",
1587
- "errorThreshold": "${CCN_ERROR_THRESHOLD:-10}",
1590
+ "blockThreshold": "${CCN_THRESHOLD:-5}",
1588
1591
  "warnings": ${CC_WARNINGS:-0}
1589
1592
  },
1590
1593
  "gate4_principles": {
package/hooks/pre-push CHANGED
@@ -21,7 +21,11 @@ URL="$2"
21
21
  PUSHED_FILES=""
22
22
  TS_FILES=""
23
23
  while read local_ref local_sha remote_ref remote_sha; do
24
- if [ "$remote_sha" = "0000000000000000000000000000000000000000" ]; then
24
+ if [ "$local_sha" = "0000000000000000000000000000000000000000" ]; then
25
+ # Branch deletion - skip validation entirely
26
+ echo " ℹ️ Branch deletion detected ($local_ref). Skipping validation."
27
+ continue
28
+ elif [ "$remote_sha" = "0000000000000000000000000000000000000000" ]; then
25
29
  # New branch - compare against empty tree
26
30
  PUSHED_FILES=$(git diff-tree -r --name-only HEAD)
27
31
  TS_FILES=$(git diff-tree -r --name-only HEAD | grep '\.ts$' || true)
@@ -115,9 +119,9 @@ else
115
119
  if [[ ! -f "src/mutation/gate-m.ts" ]]; then
116
120
  echo "⚠️ Gate M script (src/mutation/gate-m.ts) not found. SKIP — Gate M."
117
121
  else
118
- # Run mutation gate with 120s timeout
122
+ # Run mutation gate with timeout matching stryker.conf.json (timeoutMS: 600000 = 10min)
119
123
  MUTATION_OUTPUT=$(mktemp)
120
- timeout 120s npx tsx src/mutation/gate-m.ts --changed-files "$CHANGED_SOURCE_FILES" > "$MUTATION_OUTPUT" 2>&1
124
+ timeout 600s npx tsx src/mutation/gate-m.ts --changed-files "$CHANGED_SOURCE_FILES" > "$MUTATION_OUTPUT" 2>&1
121
125
  MUTATION_EXIT=$?
122
126
 
123
127
  case $MUTATION_EXIT in
@@ -357,4 +357,98 @@ describe('ui-detector', () => {
357
357
  expect(isExcluded('src/Button.test.tsx', ['**/*.test.*'])).toBe(true);
358
358
  });
359
359
  });
360
+
361
+ /**
362
+ * @test #172 ui-detector CLI coverage
363
+ * @intent Cover CLI entry points (runCli, runPushMode, processOutput, runCheckBranch, runDefault)
364
+ * via real subprocess execution with NODE_V8_COVERAGE to merge coverage profiles.
365
+ * @covers ui-detector-cli-push-mode, ui-detector-cli-check-branch, ui-detector-cli-default-mode
366
+ */
367
+ describe('CLI integration (subprocess)', () => {
368
+ const { spawnSync: realSpawnSync } = require('child_process') as typeof import('child_process');
369
+ const path = require('path') as typeof import('path');
370
+ const fs = require('fs') as typeof import('fs');
371
+ const os = require('os') as typeof import('os');
372
+
373
+ const UI_DETECTOR_PATH = path.resolve(__dirname, '../ui-detector.ts');
374
+
375
+ function runCli(args: string[], stdin?: string, cwd?: string): { code: number; stdout: string; stderr: string } {
376
+ const coverageDir = process.env.NODE_V8_COVERAGE ?? path.join(process.cwd(), 'coverage', '.tmp');
377
+ const result = realSpawnSync('npx', ['tsx', UI_DETECTOR_PATH, ...args], {
378
+ cwd: cwd ?? process.cwd(),
379
+ encoding: 'utf-8',
380
+ input: stdin,
381
+ env: { ...process.env, NODE_V8_COVERAGE: coverageDir },
382
+ });
383
+ return {
384
+ code: result.status ?? -1,
385
+ stdout: result.stdout ?? '',
386
+ stderr: result.stderr ?? '',
387
+ };
388
+ }
389
+
390
+ it('runs default mode with --check-branch flag (HEAD-based detection)', () => {
391
+ const { code, stdout } = runCli(['--check-branch']);
392
+ expect(code).toBeGreaterThanOrEqual(0);
393
+ expect(code).toBeLessThanOrEqual(1);
394
+ const parsed = JSON.parse(stdout);
395
+ expect(parsed).toHaveProperty('isUiSprint');
396
+ expect(parsed).toHaveProperty('matchedFiles');
397
+ expect(parsed).toHaveProperty('matchedRules');
398
+ });
399
+
400
+ it('runs push-mode via stdin', () => {
401
+ const { code, stdout } = runCli(['--push-mode'], 'views/index.html');
402
+ expect([0, 1]).toContain(code);
403
+ const parsed = JSON.parse(stdout);
404
+ expect(parsed.isUiSprint).toBe(true);
405
+ expect(parsed.matchedFiles).toContain('views/index.html');
406
+ });
407
+
408
+ it('runs push-mode with stdin input', () => {
409
+ const { code, stdout } = runCli(['--push-mode'], 'views/login.njk\nsrc/auth.ts\n');
410
+ expect([0, 1]).toContain(code);
411
+ const parsed = JSON.parse(stdout);
412
+ expect(parsed.isUiSprint).toBe(true);
413
+ expect(parsed.matchedFiles).toContain('views/login.njk');
414
+ });
415
+
416
+ it('runs push-mode with non-UI files (exit 1)', () => {
417
+ const { code, stdout } = runCli(['--push-mode'], 'src/auth.ts\nsrc/db.ts\n');
418
+ expect(code).toBe(1);
419
+ const parsed = JSON.parse(stdout);
420
+ expect(parsed.isUiSprint).toBe(false);
421
+ expect(parsed.matchedFiles).toEqual([]);
422
+ });
423
+
424
+ it('respects .ui-gate-ignore in push-mode', () => {
425
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'ui-detector-ignore-'));
426
+ try {
427
+ fs.writeFileSync(path.join(tmp, '.ui-gate-ignore'), 'legacy/**\n');
428
+ const { code, stdout } = runCli(['--push-mode'], 'legacy/views/index.html', tmp);
429
+ expect(code).toBe(1);
430
+ const parsed = JSON.parse(stdout);
431
+ expect(parsed.isUiSprint).toBe(false);
432
+ } finally {
433
+ fs.rmSync(tmp, { recursive: true, force: true });
434
+ }
435
+ });
436
+
437
+ it('processes renamed files in push-mode', () => {
438
+ const { code, stdout } = runCli(['--push-mode'], 'src/a.tsx \u2192 src/components/B.tsx');
439
+ expect([0, 1]).toContain(code);
440
+ const parsed = JSON.parse(stdout);
441
+ expect(parsed.matchedFiles).toContain('src/components/B.tsx');
442
+ });
443
+
444
+ it('runs default mode (detectUiSprint in current repo)', () => {
445
+ const { code, stdout } = runCli([]);
446
+ expect([0, 1]).toContain(code);
447
+ const parsed = JSON.parse(stdout);
448
+ expect(parsed).toHaveProperty('isUiSprint');
449
+ expect(parsed).toHaveProperty('matchedFiles');
450
+ expect(parsed).toHaveProperty('matchedRules');
451
+ });
452
+ });
360
453
  });
454
+
package/lib/init.js CHANGED
@@ -303,6 +303,7 @@ async function installLocal(args) {
303
303
  updateConfig({ lastInit: new Date().toISOString(), mode: 'local', manifest });
304
304
 
305
305
  injectKarpathyPrinciples(projectRoot);
306
+ configureOpenCodePlugin(srcDir, projectRoot);
306
307
 
307
308
  console.log('\nInstallation complete!');
308
309
  console.log('Run git commit to trigger quality gates');
@@ -348,6 +349,49 @@ async function setupGlobal(args) {
348
349
  return 0;
349
350
  }
350
351
 
352
+ function configureOpenCodePlugin(srcDir, projectRoot) {
353
+ const opencodeJsonPath = path.join(projectRoot, 'opencode.json');
354
+ const pluginSrcPath = path.join(srcDir, 'plugins', 'opencode');
355
+
356
+ if (!fs.existsSync(pluginSrcPath)) {
357
+ console.log(' OpenCode plugin: SKIP (not bundled)');
358
+ return;
359
+ }
360
+
361
+ let config = {};
362
+ if (fs.existsSync(opencodeJsonPath)) {
363
+ try {
364
+ const raw = fs.readFileSync(opencodeJsonPath, 'utf8');
365
+ config = JSON.parse(raw);
366
+ } catch (e) {
367
+ console.warn(` Warning: could not parse opencode.json: ${e.message}`);
368
+ return;
369
+ }
370
+ }
371
+
372
+ if (!Array.isArray(config.plugin)) {
373
+ config.plugin = [];
374
+ }
375
+
376
+ const normalizedSrc = path.resolve(pluginSrcPath);
377
+ const alreadyConfigured = config.plugin.some(p => path.resolve(projectRoot, p) === normalizedSrc);
378
+
379
+ if (alreadyConfigured) {
380
+ console.log(' OpenCode plugin: already configured in opencode.json');
381
+ return;
382
+ }
383
+
384
+ const relativePluginPath = path.relative(projectRoot, normalizedSrc).replace(/\\/g, '/');
385
+ config.plugin.push(relativePluginPath);
386
+
387
+ try {
388
+ fs.writeFileSync(opencodeJsonPath, JSON.stringify(config, null, 2) + '\n');
389
+ console.log(` OpenCode plugin: added to opencode.json (${relativePluginPath})`);
390
+ } catch (e) {
391
+ console.warn(` Warning: could not write opencode.json: ${e.message}`);
392
+ }
393
+ }
394
+
351
395
  function injectKarpathyPrinciples(projectRoot) {
352
396
  const agentsPath = path.join(projectRoot, 'AGENTS.md');
353
397
  if (!fs.existsSync(agentsPath)) return;
@@ -210,21 +210,21 @@ function processOutput(input: string, repoRoot: string): void {
210
210
  .map(parseRenamedFile)
211
211
  .filter((f) => f.length > 0);
212
212
  const result = collectUiMatches(files, repoRoot);
213
-
213
+
214
214
  console.log(JSON.stringify(result, null, 2));
215
215
  process.exit(result.isUiSprint ? 0 : 1);
216
216
  }
217
217
 
218
218
  function runCheckBranch(_repoRoot: string): void {
219
219
  const result = detectUiSprint('HEAD');
220
-
220
+
221
221
  console.log(JSON.stringify(result, null, 2));
222
222
  process.exit(result.isUiSprint ? 0 : 1);
223
223
  }
224
224
 
225
225
  function runDefault(_repoRoot: string): void {
226
226
  const result = detectUiSprint();
227
-
227
+
228
228
  console.log(JSON.stringify(result, null, 2));
229
229
  process.exit(result.isUiSprint ? 0 : 1);
230
230
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
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.8.0",
3
+ "version": "0.8.2",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 6 quality gates, Sprint Flow, and Delphi multi-expert review.",
6
6
  "author": {
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-05-30
4
4
  **Commit:** 4517f2b
5
5
  **Branch:** main
6
- **Version:** v0.5.1
6
+ **Version:** v0.8.1
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥91% threshold, 3 experts from ≥2 providers, domestic models only). Supports design + code-walkthrough modes.
@@ -323,6 +323,16 @@ Phase 0, 1, 3-6 行为完全不变。
323
323
  - 注入:当前 REQ + AC + permanent learnings + contextual learnings (最近 3 条)
324
324
  - 注入:AGENTS.md + git log --oneline -5 + 测试基础设施摘要
325
325
 
326
+ 3. **Pre-REQ snapshot(Issue #137)**
327
+ - 在 dispatch subagent 前记录当前 git HEAD,用于 TDD 合规的基线对比
328
+ ```bash
329
+ # 保存当前 HEAD 作为 TDD 验证基线
330
+ PRE_REQ_HASH=$(git rev-parse HEAD)
331
+ echo "[TDD-BASELINE] Pre-REQ snapshot: $PRE_REQ_HASH"
332
+ # 记录到临时文件(subagent 只读基线,避免污染)
333
+ echo "$PRE_REQ_HASH" > .sprint-state/last-req-baseline.txt
334
+ ```
335
+
326
336
  3. **Dispatch build subagent**
327
337
  - 使用 `task(category="unspecified-high", load_skills=["test-driven-development"], timeout=300)`
328
338
  - 强制 TDD 流程:RED → GREEN → REFACTOR
@@ -330,7 +340,34 @@ Phase 0, 1, 3-6 行为完全不变。
330
340
 
331
341
  4. **Run full regression tests**
332
342
  - L1: typecheck + lint on changed files
333
- - L1b: 检查测试先行比率 (新增测试行数 / 总新增行数 40%)
343
+ - **L1b: 客观测试先行验证(Issue #137)** 使用 git diff 验证新增测试行数占总新增行数比例
344
+ ```bash
345
+ # 从基线读取 pre-REQ HEAD,支持跨多个 commit 的 REQ
346
+ PRE_BASELINE=$(cat .sprint-state/last-req-baseline.txt 2>/dev/null || echo "HEAD~1")
347
+ GIT_DIFF=$(git diff "$PRE_BASELINE"..HEAD --stat --diff-filter=AM 2>/dev/null)
348
+ # 提取新增测试行数(*.test.*, *.spec.*, __tests__/* 等)
349
+ TEST_LINES=$(echo "$GIT_DIFF" | grep -E '\.(test|spec)\.[a-z]+|__tests__/' | grep -oP '\d+(?= insertion)' | paste -sd+ | bc || echo 0)
350
+ # 提取总新增行数
351
+ TOTAL_LINES=$(echo "$GIT_DIFF" | grep -oP '\d+(?= insertion)' | paste -sd+ | bc || echo 0)
352
+ # 计算比率
353
+ if [ "$TOTAL_LINES" -gt 0 ]; then
354
+ RATIO=$((TEST_LINES * 100 / TOTAL_LINES))
355
+ echo "[TDD-CHECK] Test lines: $TEST_LINES / Total lines: $TOTAL_LINES = ${RATIO}%"
356
+ [ "$RATIO" -ge 40 ] || {
357
+ echo "[TDD-FAIL] Test-first ratio ${RATIO}% < 40% threshold"
358
+ echo "[TDD-FAIL] Expected ≥ 40% test lines. Retry with tests written first."
359
+ exit 1
360
+ }
361
+ else
362
+ echo "[TDD-CHECK] No new lines in diff (possibly no changes or first commit)"
363
+ fi
364
+ ```
365
+ - **L1b-alt: 测试文件存在验证** — 当 diff 为空或无新增行时,降级检查测试文件是否出现在 changeset 中
366
+ ```bash
367
+ HAS_TEST_FILES=$(echo "$GIT_DIFF" | grep -c -E '\.(test|spec)\.[a-z]+|__tests__/' || echo 0)
368
+ [ "$HAS_TEST_FILES" -gt 0 ] || { echo "[TDD-FAIL] No test files found in changeset"; exit 1; }
369
+ echo "[TDD-CHECK] Test files present in changeset: $HAS_TEST_FILES file(s)"
370
+ ```
334
371
  - **L2: 全量测试运行**(不只是 @test 当前 REQ 的测试)
335
372
  - L3: 检查整体覆盖率 ≥ 80%
336
373
 
@@ -438,9 +475,10 @@ REQ-001 开始 → 检查 test-utils.ts → 不存在
438
475
  - [ ] Test infrastructure confirmed ready
439
476
 
440
477
  **TDD Compliance**:
441
- - [ ] Tests written BEFORE implementation
442
- - [ ] Test/implementation ratio ≥ 40%
478
+ - [ ] Tests written BEFORE implementation (verified via `git diff HEAD~1 --stat --diff-filter=AM`)
479
+ - [ ] Test/implementation ratio ≥ 40% (L1b check: test_lines / total_lines ≥ 40%)
443
480
  - [ ] Mock usage justified (if >30% mock density)
481
+ - [ ] Test files present in changeset (L1b-alt fallback)
444
482
 
445
483
  **Verification Layers**:
446
484
  - [ ] L1: typecheck + lint pass
@@ -1,7 +1,7 @@
1
1
  # SKILLS/SPRINT-FLOW KNOWLEDGE BASE
2
2
 
3
3
  **Generated:** 2026-05-30
4
- **Version:** v0.5.1
4
+ **Version:** v0.8.1
5
5
 
6
6
  ## OVERVIEW
7
7
  7-phase development pipeline: THINK→PLAN→BUILD→REVIEW→USER ACCEPT→FEEDBACK→SHIP, with ralph-loop default build mode.