vaspera 2.9.2 → 2.10.1

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 (327) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +58 -1
  3. package/dist/__tests__/autofix/branch-manager.test.d.ts +2 -0
  4. package/dist/__tests__/autofix/branch-manager.test.d.ts.map +1 -0
  5. package/dist/__tests__/autofix/branch-manager.test.js +60 -0
  6. package/dist/__tests__/autofix/branch-manager.test.js.map +1 -0
  7. package/dist/__tests__/autofix/commit-generator.test.d.ts +2 -0
  8. package/dist/__tests__/autofix/commit-generator.test.d.ts.map +1 -0
  9. package/dist/__tests__/autofix/commit-generator.test.js +147 -0
  10. package/dist/__tests__/autofix/commit-generator.test.js.map +1 -0
  11. package/dist/__tests__/autofix/constitution.test.d.ts +9 -0
  12. package/dist/__tests__/autofix/constitution.test.d.ts.map +1 -0
  13. package/dist/__tests__/autofix/constitution.test.js +421 -0
  14. package/dist/__tests__/autofix/constitution.test.js.map +1 -0
  15. package/dist/__tests__/autofix/pr-generator.test.d.ts +2 -0
  16. package/dist/__tests__/autofix/pr-generator.test.d.ts.map +1 -0
  17. package/dist/__tests__/autofix/pr-generator.test.js +152 -0
  18. package/dist/__tests__/autofix/pr-generator.test.js.map +1 -0
  19. package/dist/__tests__/property-test-helpers.d.ts +87 -0
  20. package/dist/__tests__/property-test-helpers.d.ts.map +1 -0
  21. package/dist/__tests__/property-test-helpers.js +136 -0
  22. package/dist/__tests__/property-test-helpers.js.map +1 -0
  23. package/dist/__tests__/scanners/ai-code/ai-detector.test.d.ts +2 -0
  24. package/dist/__tests__/scanners/ai-code/ai-detector.test.d.ts.map +1 -0
  25. package/dist/__tests__/scanners/ai-code/ai-detector.test.js +188 -0
  26. package/dist/__tests__/scanners/ai-code/ai-detector.test.js.map +1 -0
  27. package/dist/__tests__/scanners/ai-code/confidence-scorer.test.d.ts +2 -0
  28. package/dist/__tests__/scanners/ai-code/confidence-scorer.test.d.ts.map +1 -0
  29. package/dist/__tests__/scanners/ai-code/confidence-scorer.test.js +363 -0
  30. package/dist/__tests__/scanners/ai-code/confidence-scorer.test.js.map +1 -0
  31. package/dist/__tests__/scanners/ai-code/hallucination-checker.test.d.ts +2 -0
  32. package/dist/__tests__/scanners/ai-code/hallucination-checker.test.d.ts.map +1 -0
  33. package/dist/__tests__/scanners/ai-code/hallucination-checker.test.js +226 -0
  34. package/dist/__tests__/scanners/ai-code/hallucination-checker.test.js.map +1 -0
  35. package/dist/__tests__/scanners/ai-code/index.test.d.ts +2 -0
  36. package/dist/__tests__/scanners/ai-code/index.test.d.ts.map +1 -0
  37. package/dist/__tests__/scanners/ai-code/index.test.js +214 -0
  38. package/dist/__tests__/scanners/ai-code/index.test.js.map +1 -0
  39. package/dist/__tests__/scanners/dast/index.test.d.ts +2 -0
  40. package/dist/__tests__/scanners/dast/index.test.d.ts.map +1 -0
  41. package/dist/__tests__/scanners/dast/index.test.js +183 -0
  42. package/dist/__tests__/scanners/dast/index.test.js.map +1 -0
  43. package/dist/__tests__/scanners/dast/nuclei.test.d.ts +2 -0
  44. package/dist/__tests__/scanners/dast/nuclei.test.d.ts.map +1 -0
  45. package/dist/__tests__/scanners/dast/nuclei.test.js +166 -0
  46. package/dist/__tests__/scanners/dast/nuclei.test.js.map +1 -0
  47. package/dist/__tests__/scanners/dast/zap.test.d.ts +2 -0
  48. package/dist/__tests__/scanners/dast/zap.test.d.ts.map +1 -0
  49. package/dist/__tests__/scanners/dast/zap.test.js +158 -0
  50. package/dist/__tests__/scanners/dast/zap.test.js.map +1 -0
  51. package/dist/__tests__/scanners/deploy/health-checker.test.d.ts +2 -0
  52. package/dist/__tests__/scanners/deploy/health-checker.test.d.ts.map +1 -0
  53. package/dist/__tests__/scanners/deploy/health-checker.test.js +67 -0
  54. package/dist/__tests__/scanners/deploy/health-checker.test.js.map +1 -0
  55. package/dist/__tests__/scanners/deploy/index.test.d.ts +2 -0
  56. package/dist/__tests__/scanners/deploy/index.test.d.ts.map +1 -0
  57. package/dist/__tests__/scanners/deploy/index.test.js +84 -0
  58. package/dist/__tests__/scanners/deploy/index.test.js.map +1 -0
  59. package/dist/__tests__/scanners/deploy/provider-detector.test.d.ts +2 -0
  60. package/dist/__tests__/scanners/deploy/provider-detector.test.d.ts.map +1 -0
  61. package/dist/__tests__/scanners/deploy/provider-detector.test.js +88 -0
  62. package/dist/__tests__/scanners/deploy/provider-detector.test.js.map +1 -0
  63. package/dist/__tests__/scanners/deploy/types.test.d.ts +2 -0
  64. package/dist/__tests__/scanners/deploy/types.test.d.ts.map +1 -0
  65. package/dist/__tests__/scanners/deploy/types.test.js +126 -0
  66. package/dist/__tests__/scanners/deploy/types.test.js.map +1 -0
  67. package/dist/__tests__/scanners/fp-feedback.test.d.ts +2 -0
  68. package/dist/__tests__/scanners/fp-feedback.test.d.ts.map +1 -0
  69. package/dist/__tests__/scanners/fp-feedback.test.js +202 -0
  70. package/dist/__tests__/scanners/fp-feedback.test.js.map +1 -0
  71. package/dist/__tests__/scanners/fp-filter.property.test.d.ts +9 -0
  72. package/dist/__tests__/scanners/fp-filter.property.test.d.ts.map +1 -0
  73. package/dist/__tests__/scanners/fp-filter.property.test.js +253 -0
  74. package/dist/__tests__/scanners/fp-filter.property.test.js.map +1 -0
  75. package/dist/__tests__/scanners/fp-filter.test.d.ts +2 -0
  76. package/dist/__tests__/scanners/fp-filter.test.d.ts.map +1 -0
  77. package/dist/__tests__/scanners/fp-filter.test.js +234 -0
  78. package/dist/__tests__/scanners/fp-filter.test.js.map +1 -0
  79. package/dist/__tests__/scanners/fp-tracker.test.d.ts +2 -0
  80. package/dist/__tests__/scanners/fp-tracker.test.d.ts.map +1 -0
  81. package/dist/__tests__/scanners/fp-tracker.test.js +262 -0
  82. package/dist/__tests__/scanners/fp-tracker.test.js.map +1 -0
  83. package/dist/__tests__/scanners/logic/endpoint-analyzer.property.test.d.ts +10 -0
  84. package/dist/__tests__/scanners/logic/endpoint-analyzer.property.test.d.ts.map +1 -0
  85. package/dist/__tests__/scanners/logic/endpoint-analyzer.property.test.js +238 -0
  86. package/dist/__tests__/scanners/logic/endpoint-analyzer.property.test.js.map +1 -0
  87. package/dist/__tests__/scanners/logic/endpoint-analyzer.test.d.ts +2 -0
  88. package/dist/__tests__/scanners/logic/endpoint-analyzer.test.d.ts.map +1 -0
  89. package/dist/__tests__/scanners/logic/endpoint-analyzer.test.js +55 -0
  90. package/dist/__tests__/scanners/logic/endpoint-analyzer.test.js.map +1 -0
  91. package/dist/__tests__/scanners/logic/index.test.d.ts +2 -0
  92. package/dist/__tests__/scanners/logic/index.test.d.ts.map +1 -0
  93. package/dist/__tests__/scanners/logic/index.test.js +165 -0
  94. package/dist/__tests__/scanners/logic/index.test.js.map +1 -0
  95. package/dist/__tests__/scanners/logic/types.test.d.ts +2 -0
  96. package/dist/__tests__/scanners/logic/types.test.d.ts.map +1 -0
  97. package/dist/__tests__/scanners/logic/types.test.js +85 -0
  98. package/dist/__tests__/scanners/logic/types.test.js.map +1 -0
  99. package/dist/__tests__/scanners/runtime/app-launcher.test.d.ts +2 -0
  100. package/dist/__tests__/scanners/runtime/app-launcher.test.d.ts.map +1 -0
  101. package/dist/__tests__/scanners/runtime/app-launcher.test.js +94 -0
  102. package/dist/__tests__/scanners/runtime/app-launcher.test.js.map +1 -0
  103. package/dist/__tests__/scanners/runtime/golden-path-runner.test.d.ts +2 -0
  104. package/dist/__tests__/scanners/runtime/golden-path-runner.test.d.ts.map +1 -0
  105. package/dist/__tests__/scanners/runtime/golden-path-runner.test.js +195 -0
  106. package/dist/__tests__/scanners/runtime/golden-path-runner.test.js.map +1 -0
  107. package/dist/__tests__/scanners/runtime/index.test.d.ts +2 -0
  108. package/dist/__tests__/scanners/runtime/index.test.d.ts.map +1 -0
  109. package/dist/__tests__/scanners/runtime/index.test.js +120 -0
  110. package/dist/__tests__/scanners/runtime/index.test.js.map +1 -0
  111. package/dist/__tests__/scanners/runtime/types.test.d.ts +2 -0
  112. package/dist/__tests__/scanners/runtime/types.test.d.ts.map +1 -0
  113. package/dist/__tests__/scanners/runtime/types.test.js +126 -0
  114. package/dist/__tests__/scanners/runtime/types.test.js.map +1 -0
  115. package/dist/__tests__/scanners/scale/bottleneck-detector.test.d.ts +2 -0
  116. package/dist/__tests__/scanners/scale/bottleneck-detector.test.d.ts.map +1 -0
  117. package/dist/__tests__/scanners/scale/bottleneck-detector.test.js +187 -0
  118. package/dist/__tests__/scanners/scale/bottleneck-detector.test.js.map +1 -0
  119. package/dist/__tests__/scanners/scale/index.test.d.ts +2 -0
  120. package/dist/__tests__/scanners/scale/index.test.d.ts.map +1 -0
  121. package/dist/__tests__/scanners/scale/index.test.js +87 -0
  122. package/dist/__tests__/scanners/scale/index.test.js.map +1 -0
  123. package/dist/__tests__/scanners/scale/load-profiler.test.d.ts +2 -0
  124. package/dist/__tests__/scanners/scale/load-profiler.test.d.ts.map +1 -0
  125. package/dist/__tests__/scanners/scale/load-profiler.test.js +122 -0
  126. package/dist/__tests__/scanners/scale/load-profiler.test.js.map +1 -0
  127. package/dist/__tests__/scanners/scale/types.test.d.ts +2 -0
  128. package/dist/__tests__/scanners/scale/types.test.d.ts.map +1 -0
  129. package/dist/__tests__/scanners/scale/types.test.js +129 -0
  130. package/dist/__tests__/scanners/scale/types.test.js.map +1 -0
  131. package/dist/action/pr-comment.test.js +4 -0
  132. package/dist/action/pr-comment.test.js.map +1 -1
  133. package/dist/action/sarif-upload.test.js +4 -0
  134. package/dist/action/sarif-upload.test.js.map +1 -1
  135. package/dist/autofix/branch-manager.d.ts +115 -0
  136. package/dist/autofix/branch-manager.d.ts.map +1 -0
  137. package/dist/autofix/branch-manager.js +308 -0
  138. package/dist/autofix/branch-manager.js.map +1 -0
  139. package/dist/autofix/commit-generator.d.ts +55 -0
  140. package/dist/autofix/commit-generator.d.ts.map +1 -0
  141. package/dist/autofix/commit-generator.js +277 -0
  142. package/dist/autofix/commit-generator.js.map +1 -0
  143. package/dist/autofix/constitution.d.ts +77 -0
  144. package/dist/autofix/constitution.d.ts.map +1 -0
  145. package/dist/autofix/constitution.js +261 -0
  146. package/dist/autofix/constitution.js.map +1 -0
  147. package/dist/autofix/constitution.schema.d.ts +441 -0
  148. package/dist/autofix/constitution.schema.d.ts.map +1 -0
  149. package/dist/autofix/constitution.schema.js +144 -0
  150. package/dist/autofix/constitution.schema.js.map +1 -0
  151. package/dist/autofix/index.d.ts +13 -0
  152. package/dist/autofix/index.d.ts.map +1 -0
  153. package/dist/autofix/index.js +15 -0
  154. package/dist/autofix/index.js.map +1 -0
  155. package/dist/autofix/pr-generator.d.ts +57 -0
  156. package/dist/autofix/pr-generator.d.ts.map +1 -0
  157. package/dist/autofix/pr-generator.js +597 -0
  158. package/dist/autofix/pr-generator.js.map +1 -0
  159. package/dist/autofix/types.d.ts +151 -0
  160. package/dist/autofix/types.d.ts.map +1 -0
  161. package/dist/autofix/types.js +22 -0
  162. package/dist/autofix/types.js.map +1 -0
  163. package/dist/eval/fixtures.d.ts +20 -0
  164. package/dist/eval/fixtures.d.ts.map +1 -1
  165. package/dist/eval/fixtures.js +430 -0
  166. package/dist/eval/fixtures.js.map +1 -1
  167. package/dist/index.d.ts.map +1 -1
  168. package/dist/index.js +874 -0
  169. package/dist/index.js.map +1 -1
  170. package/dist/install-skills.d.ts +11 -0
  171. package/dist/install-skills.d.ts.map +1 -0
  172. package/dist/install-skills.js +81 -0
  173. package/dist/install-skills.js.map +1 -0
  174. package/dist/scanners/ai-code/ai-detector.d.ts +25 -0
  175. package/dist/scanners/ai-code/ai-detector.d.ts.map +1 -0
  176. package/dist/scanners/ai-code/ai-detector.js +192 -0
  177. package/dist/scanners/ai-code/ai-detector.js.map +1 -0
  178. package/dist/scanners/ai-code/confidence-scorer.d.ts +40 -0
  179. package/dist/scanners/ai-code/confidence-scorer.d.ts.map +1 -0
  180. package/dist/scanners/ai-code/confidence-scorer.js +148 -0
  181. package/dist/scanners/ai-code/confidence-scorer.js.map +1 -0
  182. package/dist/scanners/ai-code/hallucination-checker.d.ts +36 -0
  183. package/dist/scanners/ai-code/hallucination-checker.d.ts.map +1 -0
  184. package/dist/scanners/ai-code/hallucination-checker.js +298 -0
  185. package/dist/scanners/ai-code/hallucination-checker.js.map +1 -0
  186. package/dist/scanners/ai-code/index.d.ts +30 -0
  187. package/dist/scanners/ai-code/index.d.ts.map +1 -0
  188. package/dist/scanners/ai-code/index.js +224 -0
  189. package/dist/scanners/ai-code/index.js.map +1 -0
  190. package/dist/scanners/ai-code/types.d.ts +192 -0
  191. package/dist/scanners/ai-code/types.d.ts.map +1 -0
  192. package/dist/scanners/ai-code/types.js +37 -0
  193. package/dist/scanners/ai-code/types.js.map +1 -0
  194. package/dist/scanners/cache.d.ts.map +1 -1
  195. package/dist/scanners/cache.js +4 -0
  196. package/dist/scanners/cache.js.map +1 -1
  197. package/dist/scanners/dast/index.d.ts +39 -0
  198. package/dist/scanners/dast/index.d.ts.map +1 -0
  199. package/dist/scanners/dast/index.js +259 -0
  200. package/dist/scanners/dast/index.js.map +1 -0
  201. package/dist/scanners/dast/nuclei.d.ts +26 -0
  202. package/dist/scanners/dast/nuclei.d.ts.map +1 -0
  203. package/dist/scanners/dast/nuclei.js +354 -0
  204. package/dist/scanners/dast/nuclei.js.map +1 -0
  205. package/dist/scanners/dast/types.d.ts +306 -0
  206. package/dist/scanners/dast/types.d.ts.map +1 -0
  207. package/dist/scanners/dast/types.js +52 -0
  208. package/dist/scanners/dast/types.js.map +1 -0
  209. package/dist/scanners/dast/zap.d.ts +26 -0
  210. package/dist/scanners/dast/zap.d.ts.map +1 -0
  211. package/dist/scanners/dast/zap.js +453 -0
  212. package/dist/scanners/dast/zap.js.map +1 -0
  213. package/dist/scanners/deploy/health-checker.d.ts +38 -0
  214. package/dist/scanners/deploy/health-checker.d.ts.map +1 -0
  215. package/dist/scanners/deploy/health-checker.js +272 -0
  216. package/dist/scanners/deploy/health-checker.js.map +1 -0
  217. package/dist/scanners/deploy/index.d.ts +44 -0
  218. package/dist/scanners/deploy/index.d.ts.map +1 -0
  219. package/dist/scanners/deploy/index.js +208 -0
  220. package/dist/scanners/deploy/index.js.map +1 -0
  221. package/dist/scanners/deploy/provider-detector.d.ts +25 -0
  222. package/dist/scanners/deploy/provider-detector.d.ts.map +1 -0
  223. package/dist/scanners/deploy/provider-detector.js +177 -0
  224. package/dist/scanners/deploy/provider-detector.js.map +1 -0
  225. package/dist/scanners/deploy/types.d.ts +406 -0
  226. package/dist/scanners/deploy/types.d.ts.map +1 -0
  227. package/dist/scanners/deploy/types.js +58 -0
  228. package/dist/scanners/deploy/types.js.map +1 -0
  229. package/dist/scanners/deploy/vercel-integration.d.ts +52 -0
  230. package/dist/scanners/deploy/vercel-integration.d.ts.map +1 -0
  231. package/dist/scanners/deploy/vercel-integration.js +280 -0
  232. package/dist/scanners/deploy/vercel-integration.js.map +1 -0
  233. package/dist/scanners/fp-feedback.d.ts +140 -0
  234. package/dist/scanners/fp-feedback.d.ts.map +1 -0
  235. package/dist/scanners/fp-feedback.js +292 -0
  236. package/dist/scanners/fp-feedback.js.map +1 -0
  237. package/dist/scanners/fp-filter.d.ts +94 -0
  238. package/dist/scanners/fp-filter.d.ts.map +1 -0
  239. package/dist/scanners/fp-filter.js +397 -0
  240. package/dist/scanners/fp-filter.js.map +1 -0
  241. package/dist/scanners/fp-tracker.d.ts +125 -0
  242. package/dist/scanners/fp-tracker.d.ts.map +1 -0
  243. package/dist/scanners/fp-tracker.js +330 -0
  244. package/dist/scanners/fp-tracker.js.map +1 -0
  245. package/dist/scanners/index.d.ts.map +1 -1
  246. package/dist/scanners/index.js +56 -0
  247. package/dist/scanners/index.js.map +1 -1
  248. package/dist/scanners/index.test.js +6 -6
  249. package/dist/scanners/index.test.js.map +1 -1
  250. package/dist/scanners/logic/auth-flow-analyzer.d.ts +18 -0
  251. package/dist/scanners/logic/auth-flow-analyzer.d.ts.map +1 -0
  252. package/dist/scanners/logic/auth-flow-analyzer.js +384 -0
  253. package/dist/scanners/logic/auth-flow-analyzer.js.map +1 -0
  254. package/dist/scanners/logic/endpoint-analyzer.d.ts +29 -0
  255. package/dist/scanners/logic/endpoint-analyzer.d.ts.map +1 -0
  256. package/dist/scanners/logic/endpoint-analyzer.js +528 -0
  257. package/dist/scanners/logic/endpoint-analyzer.js.map +1 -0
  258. package/dist/scanners/logic/index.d.ts +41 -0
  259. package/dist/scanners/logic/index.d.ts.map +1 -0
  260. package/dist/scanners/logic/index.js +268 -0
  261. package/dist/scanners/logic/index.js.map +1 -0
  262. package/dist/scanners/logic/types.d.ts +254 -0
  263. package/dist/scanners/logic/types.d.ts.map +1 -0
  264. package/dist/scanners/logic/types.js +142 -0
  265. package/dist/scanners/logic/types.js.map +1 -0
  266. package/dist/scanners/runtime/app-launcher.d.ts +33 -0
  267. package/dist/scanners/runtime/app-launcher.d.ts.map +1 -0
  268. package/dist/scanners/runtime/app-launcher.js +419 -0
  269. package/dist/scanners/runtime/app-launcher.js.map +1 -0
  270. package/dist/scanners/runtime/golden-path-runner.d.ts +48 -0
  271. package/dist/scanners/runtime/golden-path-runner.d.ts.map +1 -0
  272. package/dist/scanners/runtime/golden-path-runner.js +373 -0
  273. package/dist/scanners/runtime/golden-path-runner.js.map +1 -0
  274. package/dist/scanners/runtime/index.d.ts +41 -0
  275. package/dist/scanners/runtime/index.d.ts.map +1 -0
  276. package/dist/scanners/runtime/index.js +164 -0
  277. package/dist/scanners/runtime/index.js.map +1 -0
  278. package/dist/scanners/runtime/playwright-executor.d.ts +50 -0
  279. package/dist/scanners/runtime/playwright-executor.d.ts.map +1 -0
  280. package/dist/scanners/runtime/playwright-executor.js +387 -0
  281. package/dist/scanners/runtime/playwright-executor.js.map +1 -0
  282. package/dist/scanners/runtime/types.d.ts +215 -0
  283. package/dist/scanners/runtime/types.d.ts.map +1 -0
  284. package/dist/scanners/runtime/types.js +40 -0
  285. package/dist/scanners/runtime/types.js.map +1 -0
  286. package/dist/scanners/scale/bottleneck-detector.d.ts +17 -0
  287. package/dist/scanners/scale/bottleneck-detector.d.ts.map +1 -0
  288. package/dist/scanners/scale/bottleneck-detector.js +250 -0
  289. package/dist/scanners/scale/bottleneck-detector.js.map +1 -0
  290. package/dist/scanners/scale/capacity-estimator.d.ts +17 -0
  291. package/dist/scanners/scale/capacity-estimator.d.ts.map +1 -0
  292. package/dist/scanners/scale/capacity-estimator.js +197 -0
  293. package/dist/scanners/scale/capacity-estimator.js.map +1 -0
  294. package/dist/scanners/scale/index.d.ts +37 -0
  295. package/dist/scanners/scale/index.d.ts.map +1 -0
  296. package/dist/scanners/scale/index.js +101 -0
  297. package/dist/scanners/scale/index.js.map +1 -0
  298. package/dist/scanners/scale/load-profiler.d.ts +48 -0
  299. package/dist/scanners/scale/load-profiler.d.ts.map +1 -0
  300. package/dist/scanners/scale/load-profiler.js +377 -0
  301. package/dist/scanners/scale/load-profiler.js.map +1 -0
  302. package/dist/scanners/scale/types.d.ts +529 -0
  303. package/dist/scanners/scale/types.d.ts.map +1 -0
  304. package/dist/scanners/scale/types.js +57 -0
  305. package/dist/scanners/scale/types.js.map +1 -0
  306. package/dist/scanners/secrets.d.ts.map +1 -1
  307. package/dist/scanners/secrets.js +13 -2
  308. package/dist/scanners/secrets.js.map +1 -1
  309. package/dist/scanners/types.d.ts +1 -1
  310. package/dist/scanners/types.d.ts.map +1 -1
  311. package/dist/scanners/types.js +4 -0
  312. package/dist/scanners/types.js.map +1 -1
  313. package/package.json +8 -4
  314. package/skills/vaspera-add-tests/SKILL.md +102 -0
  315. package/skills/vaspera-ai-verify/SKILL.md +166 -0
  316. package/skills/vaspera-audit/SKILL.md +67 -0
  317. package/skills/vaspera-certify/SKILL.md +130 -0
  318. package/skills/vaspera-deploy/SKILL.md +152 -0
  319. package/skills/vaspera-fix-critical/SKILL.md +52 -0
  320. package/skills/vaspera-fix-high/SKILL.md +81 -0
  321. package/skills/vaspera-fix-medium/SKILL.md +56 -0
  322. package/skills/vaspera-fix-rls/SKILL.md +85 -0
  323. package/skills/vaspera-harden/SKILL.md +102 -0
  324. package/skills/vaspera-help/SKILL.md +61 -0
  325. package/skills/vaspera-load-test/SKILL.md +167 -0
  326. package/skills/vaspera-verify/SKILL.md +70 -0
  327. package/skills/vaspera-verify-e2e/SKILL.md +117 -0
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Property-Based Testing Helpers
3
+ *
4
+ * Shared generators and utilities for property-based tests using fast-check.
5
+ *
6
+ * @module __tests__/property-test-helpers
7
+ */
8
+ import * as fc from "fast-check";
9
+ /**
10
+ * Arbitrary generators for common security testing patterns
11
+ */
12
+ export declare const arbitraries: {
13
+ /**
14
+ * Valid identifier characters for path parameters
15
+ * Matches common conventions: alphanumeric + underscore, starting with letter/underscore
16
+ */
17
+ paramName: fc.Arbitrary<string>;
18
+ /**
19
+ * Generate a valid file path segment (no special chars)
20
+ */
21
+ pathSegment: fc.Arbitrary<string>;
22
+ /**
23
+ * Generate a valid file extension
24
+ */
25
+ fileExtension: fc.Arbitrary<"ts" | "py" | "go" | "rb" | "java" | "tsx" | "js" | "jsx">;
26
+ /**
27
+ * Generate a plural noun for singularization testing
28
+ */
29
+ pluralNoun: fc.Arbitrary<"entries" | "data" | "categories" | "matches" | "users" | "products" | "orders" | "items" | "companies" | "stories" | "addresses" | "statuses" | "boxes" | "bushes" | "media" | "sheep" | "fish">;
30
+ /**
31
+ * Generate an API path prefix
32
+ */
33
+ apiPrefix: fc.Arbitrary<"" | "/api" | "/api/v1" | "/api/v2" | "/v1" | "/v2">;
34
+ };
35
+ /**
36
+ * Generate a path with Express-style parameters (:param)
37
+ */
38
+ export declare function expressPath(paramNames: string[]): string;
39
+ /**
40
+ * Generate a path with Next.js-style parameters ([param])
41
+ */
42
+ export declare function nextjsPath(paramNames: string[]): string;
43
+ /**
44
+ * Generate a path with Flask-style parameters (<param> or <param:type>)
45
+ */
46
+ export declare function flaskPath(paramNames: string[], withTypes?: boolean): string;
47
+ /**
48
+ * Generate a path with Spring-style parameters ({param})
49
+ */
50
+ export declare function springPath(paramNames: string[]): string;
51
+ /**
52
+ * Generate a test file path
53
+ */
54
+ export declare function testFilePath(stem: string, extension: string): string;
55
+ /**
56
+ * Generate a spec file path
57
+ */
58
+ export declare function specFilePath(stem: string, extension: string): string;
59
+ /**
60
+ * Generate a node_modules file path
61
+ */
62
+ export declare function nodeModulesPath(pkg: string, file: string): string;
63
+ /**
64
+ * Generate a generated code file path
65
+ */
66
+ export declare function generatedFilePath(stem: string): string;
67
+ /**
68
+ * Generate a type definition file path
69
+ */
70
+ export declare function dtsFilePath(stem: string): string;
71
+ /**
72
+ * Arbitrary for generating arrays of unique parameter names
73
+ */
74
+ export declare const uniqueParamNames: fc.Arbitrary<string[]>;
75
+ /**
76
+ * Arbitrary for generating a file path with random structure
77
+ */
78
+ export declare const filePath: fc.Arbitrary<string>;
79
+ /**
80
+ * Check if a string contains any of the given characters
81
+ */
82
+ export declare function containsAny(str: string, chars: string[]): boolean;
83
+ /**
84
+ * Path parameter delimiter characters that should never appear in extracted params
85
+ */
86
+ export declare const PARAM_DELIMITERS: string[];
87
+ //# sourceMappingURL=property-test-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-test-helpers.d.ts","sourceRoot":"","sources":["../../src/__tests__/property-test-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAyBH;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAGxD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAGvD;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,GAAE,OAAe,GACzB,MAAM,CAcR;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAGvD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,wBAES,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,QAAQ,sBAM4C,CAAC;AAElE;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAEjE;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,UAAsC,CAAC"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Property-Based Testing Helpers
3
+ *
4
+ * Shared generators and utilities for property-based tests using fast-check.
5
+ *
6
+ * @module __tests__/property-test-helpers
7
+ */
8
+ import * as fc from "fast-check";
9
+ /**
10
+ * Arbitrary generators for common security testing patterns
11
+ */
12
+ export const arbitraries = {
13
+ /**
14
+ * Valid identifier characters for path parameters
15
+ * Matches common conventions: alphanumeric + underscore, starting with letter/underscore
16
+ */
17
+ paramName: fc.stringMatching(/^[a-zA-Z_][a-zA-Z0-9_]{0,15}$/),
18
+ /**
19
+ * Generate a valid file path segment (no special chars)
20
+ */
21
+ pathSegment: fc.stringMatching(/^[a-zA-Z0-9_-]{1,20}$/),
22
+ /**
23
+ * Generate a valid file extension
24
+ */
25
+ fileExtension: fc.constantFrom("ts", "js", "tsx", "jsx", "py", "go", "rb", "java"),
26
+ /**
27
+ * Generate a plural noun for singularization testing
28
+ */
29
+ pluralNoun: fc.oneof(
30
+ // Regular plurals (add 's')
31
+ fc.constant("users"), fc.constant("products"), fc.constant("orders"), fc.constant("items"),
32
+ // -ies plurals (y -> ies)
33
+ fc.constant("categories"), fc.constant("companies"), fc.constant("stories"), fc.constant("entries"),
34
+ // -es plurals
35
+ fc.constant("addresses"), fc.constant("statuses"), fc.constant("boxes"), fc.constant("matches"), fc.constant("bushes"),
36
+ // Irregular or edge cases
37
+ fc.constant("data"), fc.constant("media"), fc.constant("sheep"), fc.constant("fish")),
38
+ /**
39
+ * Generate an API path prefix
40
+ */
41
+ apiPrefix: fc.constantFrom("/api", "/api/v1", "/api/v2", "/v1", "/v2", ""),
42
+ };
43
+ /**
44
+ * Generate a path with Express-style parameters (:param)
45
+ */
46
+ export function expressPath(paramNames) {
47
+ if (paramNames.length === 0)
48
+ return "/api/resource";
49
+ return "/api/" + paramNames.map((p) => `:${p}`).join("/");
50
+ }
51
+ /**
52
+ * Generate a path with Next.js-style parameters ([param])
53
+ */
54
+ export function nextjsPath(paramNames) {
55
+ if (paramNames.length === 0)
56
+ return "/api/resource";
57
+ return "/api/" + paramNames.map((p) => `[${p}]`).join("/");
58
+ }
59
+ /**
60
+ * Generate a path with Flask-style parameters (<param> or <param:type>)
61
+ */
62
+ export function flaskPath(paramNames, withTypes = false) {
63
+ if (paramNames.length === 0)
64
+ return "/api/resource";
65
+ const types = ["int", "string", "path", "float"];
66
+ return ("/api/" +
67
+ paramNames
68
+ .map((p, i) => {
69
+ if (withTypes && i % 2 === 0) {
70
+ return `<${p}:${types[i % types.length]}>`;
71
+ }
72
+ return `<${p}>`;
73
+ })
74
+ .join("/"));
75
+ }
76
+ /**
77
+ * Generate a path with Spring-style parameters ({param})
78
+ */
79
+ export function springPath(paramNames) {
80
+ if (paramNames.length === 0)
81
+ return "/api/resource";
82
+ return "/api/" + paramNames.map((p) => `{${p}}`).join("/");
83
+ }
84
+ /**
85
+ * Generate a test file path
86
+ */
87
+ export function testFilePath(stem, extension) {
88
+ return `src/__tests__/${stem}.test.${extension}`;
89
+ }
90
+ /**
91
+ * Generate a spec file path
92
+ */
93
+ export function specFilePath(stem, extension) {
94
+ return `src/${stem}.spec.${extension}`;
95
+ }
96
+ /**
97
+ * Generate a node_modules file path
98
+ */
99
+ export function nodeModulesPath(pkg, file) {
100
+ return `node_modules/${pkg}/${file}`;
101
+ }
102
+ /**
103
+ * Generate a generated code file path
104
+ */
105
+ export function generatedFilePath(stem) {
106
+ return `src/${stem}.generated.ts`;
107
+ }
108
+ /**
109
+ * Generate a type definition file path
110
+ */
111
+ export function dtsFilePath(stem) {
112
+ return `src/${stem}.d.ts`;
113
+ }
114
+ /**
115
+ * Arbitrary for generating arrays of unique parameter names
116
+ */
117
+ export const uniqueParamNames = fc
118
+ .array(arbitraries.paramName, { minLength: 1, maxLength: 5 })
119
+ .map((names) => [...new Set(names)]);
120
+ /**
121
+ * Arbitrary for generating a file path with random structure
122
+ */
123
+ export const filePath = fc
124
+ .tuple(fc.array(arbitraries.pathSegment, { minLength: 1, maxLength: 4 }), arbitraries.pathSegment, arbitraries.fileExtension)
125
+ .map(([dirs, name, ext]) => `${dirs.join("/")}/${name}.${ext}`);
126
+ /**
127
+ * Check if a string contains any of the given characters
128
+ */
129
+ export function containsAny(str, chars) {
130
+ return chars.some((c) => str.includes(c));
131
+ }
132
+ /**
133
+ * Path parameter delimiter characters that should never appear in extracted params
134
+ */
135
+ export const PARAM_DELIMITERS = [":", "[", "]", "<", ">", "{", "}"];
136
+ //# sourceMappingURL=property-test-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-test-helpers.js","sourceRoot":"","sources":["../../src/__tests__/property-test-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE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AS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EACjE,WAAW,CAAC,WAAW,EACvB,WAAW,CAAC,aAAa,CAC1B;KACA,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,KAAe;IACtD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ai-detector.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-detector.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/scanners/ai-code/ai-detector.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,188 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from "vitest";
2
+ import { join } from "path";
3
+ import { mkdir, writeFile, rm } from "fs/promises";
4
+ import { tmpdir } from "os";
5
+ import { detectAIPatterns, patternMatchesToIndicators, scanDirectoryForAIPatterns, calculateAILikelihood, aggregateByFile, } from "../../../scanners/ai-code/ai-detector.js";
6
+ describe("ai-detector", () => {
7
+ let testDir;
8
+ beforeEach(async () => {
9
+ testDir = join(tmpdir(), `ai-detector-test-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`);
10
+ await mkdir(testDir, { recursive: true });
11
+ });
12
+ afterEach(async () => {
13
+ await rm(testDir, { recursive: true, force: true });
14
+ });
15
+ describe("detectAIPatterns", () => {
16
+ it("detects AI generation comments", async () => {
17
+ const content = `
18
+ // Generated by ChatGPT
19
+ function test() {
20
+ return true;
21
+ }
22
+ `;
23
+ const filePath = join(testDir, "test.ts");
24
+ await writeFile(filePath, content);
25
+ const matches = await detectAIPatterns(filePath);
26
+ expect(matches.length).toBeGreaterThan(0);
27
+ expect(matches[0].pattern).toBe("ai-comment-generated");
28
+ expect(matches[0].confidence).toBe("high");
29
+ });
30
+ it("detects copilot suggestions", async () => {
31
+ const content = `
32
+ // Copilot suggestion
33
+ const x = 1;
34
+ `;
35
+ const filePath = join(testDir, "copilot.ts");
36
+ await writeFile(filePath, content);
37
+ const matches = await detectAIPatterns(filePath);
38
+ expect(matches.length).toBeGreaterThan(0);
39
+ expect(matches[0].pattern).toBe("ai-comment-assistant");
40
+ });
41
+ it("detects TODO placeholders", async () => {
42
+ const content = `
43
+ function example() {
44
+ // TODO: implement this logic here
45
+ return null;
46
+ }
47
+ `;
48
+ const filePath = join(testDir, "todo.ts");
49
+ await writeFile(filePath, content);
50
+ const matches = await detectAIPatterns(filePath);
51
+ expect(matches.length).toBeGreaterThan(0);
52
+ expect(matches.some((m) => m.pattern === "todo-placeholder")).toBe(true);
53
+ });
54
+ it("detects cursor metadata", async () => {
55
+ const content = `
56
+ // @cursor-ai generated
57
+ const y = 2;
58
+ `;
59
+ const filePath = join(testDir, "cursor.ts");
60
+ await writeFile(filePath, content);
61
+ const matches = await detectAIPatterns(filePath);
62
+ expect(matches.length).toBeGreaterThan(0);
63
+ expect(matches[0].pattern).toBe("cursor-metadata");
64
+ expect(matches[0].confidence).toBe("high");
65
+ });
66
+ it("returns empty array for clean code", async () => {
67
+ const content = `
68
+ function add(a: number, b: number): number {
69
+ return a + b;
70
+ }
71
+ `;
72
+ const filePath = join(testDir, "clean.ts");
73
+ await writeFile(filePath, content);
74
+ const matches = await detectAIPatterns(filePath);
75
+ expect(matches).toEqual([]);
76
+ });
77
+ });
78
+ describe("patternMatchesToIndicators", () => {
79
+ it("converts pattern matches to indicators", () => {
80
+ const matches = [
81
+ {
82
+ pattern: "ai-comment-generated",
83
+ file: "/test.ts",
84
+ line: 1,
85
+ match: "// Generated by ChatGPT",
86
+ confidence: "high",
87
+ },
88
+ ];
89
+ const indicators = patternMatchesToIndicators(matches);
90
+ expect(indicators.length).toBe(1);
91
+ expect(indicators[0].type).toBe("comment");
92
+ expect(indicators[0].confidence).toBe("high");
93
+ expect(indicators[0].location.file).toBe("/test.ts");
94
+ expect(indicators[0].location.line).toBe(1);
95
+ });
96
+ });
97
+ describe("scanDirectoryForAIPatterns", () => {
98
+ it("scans multiple files", async () => {
99
+ await writeFile(join(testDir, "a.ts"), "// Generated by AI\nconst a = 1;");
100
+ await writeFile(join(testDir, "b.ts"), "const b = 2;");
101
+ await writeFile(join(testDir, "c.ts"), "// @copilot-generated\nconst c = 3;");
102
+ const result = await scanDirectoryForAIPatterns(testDir);
103
+ expect(result.files).toBe(3);
104
+ expect(result.matches.length).toBe(2);
105
+ expect(result.indicators.length).toBe(2);
106
+ });
107
+ it("respects exclude patterns", async () => {
108
+ await mkdir(join(testDir, "node_modules"), { recursive: true });
109
+ await writeFile(join(testDir, "node_modules", "dep.ts"), "// Generated by AI");
110
+ await writeFile(join(testDir, "main.ts"), "const x = 1;");
111
+ const result = await scanDirectoryForAIPatterns(testDir);
112
+ expect(result.files).toBe(1);
113
+ expect(result.matches.length).toBe(0);
114
+ });
115
+ });
116
+ describe("calculateAILikelihood", () => {
117
+ it("returns 0 for empty indicators", () => {
118
+ expect(calculateAILikelihood([])).toBe(0);
119
+ });
120
+ it("scores high confidence indicators higher", () => {
121
+ const highIndicators = [
122
+ {
123
+ type: "comment",
124
+ location: { file: "a.ts", line: 1 },
125
+ description: "AI comment",
126
+ confidence: "high",
127
+ evidence: "test",
128
+ },
129
+ ];
130
+ const lowIndicators = [
131
+ {
132
+ type: "pattern",
133
+ location: { file: "b.ts", line: 1 },
134
+ description: "Low pattern",
135
+ confidence: "low",
136
+ evidence: "test",
137
+ },
138
+ ];
139
+ expect(calculateAILikelihood(highIndicators)).toBeGreaterThan(calculateAILikelihood(lowIndicators));
140
+ });
141
+ it("caps at 100", () => {
142
+ const manyIndicators = Array(10).fill({
143
+ type: "comment",
144
+ location: { file: "a.ts", line: 1 },
145
+ description: "AI",
146
+ confidence: "high",
147
+ evidence: "test",
148
+ });
149
+ expect(calculateAILikelihood(manyIndicators)).toBe(100);
150
+ });
151
+ });
152
+ describe("aggregateByFile", () => {
153
+ it("groups indicators by file", () => {
154
+ const indicators = [
155
+ {
156
+ type: "comment",
157
+ location: { file: "a.ts", line: 1 },
158
+ description: "AI",
159
+ confidence: "high",
160
+ evidence: "test",
161
+ },
162
+ {
163
+ type: "comment",
164
+ location: { file: "a.ts", line: 5 },
165
+ description: "AI 2",
166
+ confidence: "medium",
167
+ evidence: "test",
168
+ },
169
+ {
170
+ type: "pattern",
171
+ location: { file: "b.ts", line: 1 },
172
+ description: "Pattern",
173
+ confidence: "low",
174
+ evidence: "test",
175
+ },
176
+ ];
177
+ const result = aggregateByFile(indicators);
178
+ expect(result.size).toBe(2);
179
+ const aFile = result.get("a.ts");
180
+ expect(aFile?.count).toBe(2);
181
+ expect(aFile?.maxConfidence).toBe("high");
182
+ const bFile = result.get("b.ts");
183
+ expect(bFile?.count).toBe(1);
184
+ expect(bFile?.maxConfidence).toBe("low");
185
+ });
186
+ });
187
+ });
188
+ //# sourceMappingURL=ai-detector.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-detector.test.js","sourceRoot":"","sources":["../../../../src/__tests__/scanners/ai-code/ai-detector.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,a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E,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE;oBACnC,WAAW,EAAE,SAAS;oBACtB,UAAU,EAAE,KAAc;oBAC1B,QAAQ,EAAE,MAAM;iBACjB;aACF,CAAC;YAEF,MAAM,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;YAC3C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAE5B,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACjC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC7B,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAE1C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACjC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC7B,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=confidence-scorer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confidence-scorer.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/scanners/ai-code/confidence-scorer.test.ts"],"names":[],"mappings":""}