agentic-qe 3.3.0 → 3.3.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 (416) hide show
  1. package/README.md +6 -2
  2. package/package.json +6 -1
  3. package/v3/CHANGELOG.md +134 -0
  4. package/v3/dist/cli/bundle.js +29332 -22739
  5. package/v3/dist/cli/command-registry.d.ts +55 -0
  6. package/v3/dist/cli/command-registry.d.ts.map +1 -0
  7. package/v3/dist/cli/command-registry.js +103 -0
  8. package/v3/dist/cli/command-registry.js.map +1 -0
  9. package/v3/dist/cli/commands/code.d.ts +9 -0
  10. package/v3/dist/cli/commands/code.d.ts.map +1 -0
  11. package/v3/dist/cli/commands/code.js +254 -0
  12. package/v3/dist/cli/commands/code.js.map +1 -0
  13. package/v3/dist/cli/commands/completions.d.ts +8 -0
  14. package/v3/dist/cli/commands/completions.d.ts.map +1 -0
  15. package/v3/dist/cli/commands/completions.js +99 -0
  16. package/v3/dist/cli/commands/completions.js.map +1 -0
  17. package/v3/dist/cli/commands/coverage.d.ts +9 -0
  18. package/v3/dist/cli/commands/coverage.d.ts.map +1 -0
  19. package/v3/dist/cli/commands/coverage.js +208 -0
  20. package/v3/dist/cli/commands/coverage.js.map +1 -0
  21. package/v3/dist/cli/commands/fleet.d.ts +11 -0
  22. package/v3/dist/cli/commands/fleet.d.ts.map +1 -0
  23. package/v3/dist/cli/commands/fleet.js +338 -0
  24. package/v3/dist/cli/commands/fleet.js.map +1 -0
  25. package/v3/dist/cli/commands/migrate.d.ts +9 -0
  26. package/v3/dist/cli/commands/migrate.d.ts.map +1 -0
  27. package/v3/dist/cli/commands/migrate.js +566 -0
  28. package/v3/dist/cli/commands/migrate.js.map +1 -0
  29. package/v3/dist/cli/commands/quality.d.ts +9 -0
  30. package/v3/dist/cli/commands/quality.d.ts.map +1 -0
  31. package/v3/dist/cli/commands/quality.js +40 -0
  32. package/v3/dist/cli/commands/quality.js.map +1 -0
  33. package/v3/dist/cli/commands/security.d.ts +9 -0
  34. package/v3/dist/cli/commands/security.d.ts.map +1 -0
  35. package/v3/dist/cli/commands/security.js +124 -0
  36. package/v3/dist/cli/commands/security.js.map +1 -0
  37. package/v3/dist/cli/commands/sync.d.ts +19 -0
  38. package/v3/dist/cli/commands/sync.d.ts.map +1 -0
  39. package/v3/dist/cli/commands/sync.js +283 -0
  40. package/v3/dist/cli/commands/sync.js.map +1 -0
  41. package/v3/dist/cli/commands/test.d.ts +9 -0
  42. package/v3/dist/cli/commands/test.d.ts.map +1 -0
  43. package/v3/dist/cli/commands/test.js +166 -0
  44. package/v3/dist/cli/commands/test.js.map +1 -0
  45. package/v3/dist/cli/handlers/agent-handler.d.ts +20 -0
  46. package/v3/dist/cli/handlers/agent-handler.d.ts.map +1 -0
  47. package/v3/dist/cli/handlers/agent-handler.js +158 -0
  48. package/v3/dist/cli/handlers/agent-handler.js.map +1 -0
  49. package/v3/dist/cli/handlers/domain-handler.d.ts +20 -0
  50. package/v3/dist/cli/handlers/domain-handler.d.ts.map +1 -0
  51. package/v3/dist/cli/handlers/domain-handler.js +115 -0
  52. package/v3/dist/cli/handlers/domain-handler.js.map +1 -0
  53. package/v3/dist/cli/handlers/index.d.ts +13 -0
  54. package/v3/dist/cli/handlers/index.d.ts.map +1 -0
  55. package/v3/dist/cli/handlers/index.js +15 -0
  56. package/v3/dist/cli/handlers/index.js.map +1 -0
  57. package/v3/dist/cli/handlers/init-handler.d.ts +38 -0
  58. package/v3/dist/cli/handlers/init-handler.d.ts.map +1 -0
  59. package/v3/dist/cli/handlers/init-handler.js +288 -0
  60. package/v3/dist/cli/handlers/init-handler.js.map +1 -0
  61. package/v3/dist/cli/handlers/interfaces.d.ts +104 -0
  62. package/v3/dist/cli/handlers/interfaces.d.ts.map +1 -0
  63. package/v3/dist/cli/handlers/interfaces.js +109 -0
  64. package/v3/dist/cli/handlers/interfaces.js.map +1 -0
  65. package/v3/dist/cli/handlers/protocol-handler.d.ts +19 -0
  66. package/v3/dist/cli/handlers/protocol-handler.d.ts.map +1 -0
  67. package/v3/dist/cli/handlers/protocol-handler.js +79 -0
  68. package/v3/dist/cli/handlers/protocol-handler.js.map +1 -0
  69. package/v3/dist/cli/handlers/status-handler.d.ts +30 -0
  70. package/v3/dist/cli/handlers/status-handler.d.ts.map +1 -0
  71. package/v3/dist/cli/handlers/status-handler.js +218 -0
  72. package/v3/dist/cli/handlers/status-handler.js.map +1 -0
  73. package/v3/dist/cli/handlers/task-handler.d.ts +22 -0
  74. package/v3/dist/cli/handlers/task-handler.d.ts.map +1 -0
  75. package/v3/dist/cli/handlers/task-handler.js +271 -0
  76. package/v3/dist/cli/handlers/task-handler.js.map +1 -0
  77. package/v3/dist/cli/index.d.ts +4 -0
  78. package/v3/dist/cli/index.d.ts.map +1 -1
  79. package/v3/dist/cli/index.js +48 -2677
  80. package/v3/dist/cli/index.js.map +1 -1
  81. package/v3/dist/cli/wizards/core/index.d.ts +11 -0
  82. package/v3/dist/cli/wizards/core/index.d.ts.map +1 -0
  83. package/v3/dist/cli/wizards/core/index.js +15 -0
  84. package/v3/dist/cli/wizards/core/index.js.map +1 -0
  85. package/v3/dist/cli/wizards/core/wizard-base.d.ts +87 -0
  86. package/v3/dist/cli/wizards/core/wizard-base.d.ts.map +1 -0
  87. package/v3/dist/cli/wizards/core/wizard-base.js +120 -0
  88. package/v3/dist/cli/wizards/core/wizard-base.js.map +1 -0
  89. package/v3/dist/cli/wizards/core/wizard-command.d.ts +182 -0
  90. package/v3/dist/cli/wizards/core/wizard-command.d.ts.map +1 -0
  91. package/v3/dist/cli/wizards/core/wizard-command.js +45 -0
  92. package/v3/dist/cli/wizards/core/wizard-command.js.map +1 -0
  93. package/v3/dist/cli/wizards/core/wizard-step.d.ts +109 -0
  94. package/v3/dist/cli/wizards/core/wizard-step.d.ts.map +1 -0
  95. package/v3/dist/cli/wizards/core/wizard-step.js +384 -0
  96. package/v3/dist/cli/wizards/core/wizard-step.js.map +1 -0
  97. package/v3/dist/cli/wizards/core/wizard-utils.d.ts +117 -0
  98. package/v3/dist/cli/wizards/core/wizard-utils.d.ts.map +1 -0
  99. package/v3/dist/cli/wizards/core/wizard-utils.js +291 -0
  100. package/v3/dist/cli/wizards/core/wizard-utils.js.map +1 -0
  101. package/v3/dist/cli/wizards/coverage-wizard.d.ts +13 -68
  102. package/v3/dist/cli/wizards/coverage-wizard.d.ts.map +1 -1
  103. package/v3/dist/cli/wizards/coverage-wizard.js +127 -391
  104. package/v3/dist/cli/wizards/coverage-wizard.js.map +1 -1
  105. package/v3/dist/cli/wizards/fleet-wizard.d.ts +13 -64
  106. package/v3/dist/cli/wizards/fleet-wizard.d.ts.map +1 -1
  107. package/v3/dist/cli/wizards/fleet-wizard.js +150 -363
  108. package/v3/dist/cli/wizards/fleet-wizard.js.map +1 -1
  109. package/v3/dist/cli/wizards/index.d.ts +2 -0
  110. package/v3/dist/cli/wizards/index.d.ts.map +1 -1
  111. package/v3/dist/cli/wizards/index.js +3 -0
  112. package/v3/dist/cli/wizards/index.js.map +1 -1
  113. package/v3/dist/cli/wizards/security-wizard.d.ts +13 -64
  114. package/v3/dist/cli/wizards/security-wizard.d.ts.map +1 -1
  115. package/v3/dist/cli/wizards/security-wizard.js +152 -395
  116. package/v3/dist/cli/wizards/security-wizard.js.map +1 -1
  117. package/v3/dist/cli/wizards/test-wizard.d.ts +13 -77
  118. package/v3/dist/cli/wizards/test-wizard.d.ts.map +1 -1
  119. package/v3/dist/cli/wizards/test-wizard.js +196 -328
  120. package/v3/dist/cli/wizards/test-wizard.js.map +1 -1
  121. package/v3/dist/coordination/mincut/mincut-health-monitor.d.ts +3 -0
  122. package/v3/dist/coordination/mincut/mincut-health-monitor.d.ts.map +1 -1
  123. package/v3/dist/coordination/mincut/mincut-health-monitor.js +6 -2
  124. package/v3/dist/coordination/mincut/mincut-health-monitor.js.map +1 -1
  125. package/v3/dist/coordination/mincut/queen-integration.d.ts +3 -0
  126. package/v3/dist/coordination/mincut/queen-integration.d.ts.map +1 -1
  127. package/v3/dist/coordination/mincut/queen-integration.js +6 -1
  128. package/v3/dist/coordination/mincut/queen-integration.js.map +1 -1
  129. package/v3/dist/coordination/queen-coordinator.d.ts +13 -1
  130. package/v3/dist/coordination/queen-coordinator.d.ts.map +1 -1
  131. package/v3/dist/coordination/queen-coordinator.js +91 -3
  132. package/v3/dist/coordination/queen-coordinator.js.map +1 -1
  133. package/v3/dist/coordination/task-executor.js +2 -2
  134. package/v3/dist/coordination/task-executor.js.map +1 -1
  135. package/v3/dist/domains/chaos-resilience/plugin.js +2 -2
  136. package/v3/dist/domains/chaos-resilience/plugin.js.map +1 -1
  137. package/v3/dist/domains/code-intelligence/plugin.js +2 -2
  138. package/v3/dist/domains/code-intelligence/plugin.js.map +1 -1
  139. package/v3/dist/domains/contract-testing/plugin.js +2 -2
  140. package/v3/dist/domains/contract-testing/plugin.js.map +1 -1
  141. package/v3/dist/domains/coverage-analysis/plugin.d.ts +6 -1
  142. package/v3/dist/domains/coverage-analysis/plugin.d.ts.map +1 -1
  143. package/v3/dist/domains/coverage-analysis/plugin.js +75 -1
  144. package/v3/dist/domains/coverage-analysis/plugin.js.map +1 -1
  145. package/v3/dist/domains/defect-intelligence/plugin.js +2 -2
  146. package/v3/dist/domains/defect-intelligence/plugin.js.map +1 -1
  147. package/v3/dist/domains/domain-interface.d.ts +39 -2
  148. package/v3/dist/domains/domain-interface.d.ts.map +1 -1
  149. package/v3/dist/domains/domain-interface.js +102 -1
  150. package/v3/dist/domains/domain-interface.js.map +1 -1
  151. package/v3/dist/domains/learning-optimization/coordinator.d.ts +83 -0
  152. package/v3/dist/domains/learning-optimization/coordinator.d.ts.map +1 -1
  153. package/v3/dist/domains/learning-optimization/coordinator.js +174 -0
  154. package/v3/dist/domains/learning-optimization/coordinator.js.map +1 -1
  155. package/v3/dist/domains/learning-optimization/interfaces.d.ts +14 -0
  156. package/v3/dist/domains/learning-optimization/interfaces.d.ts.map +1 -1
  157. package/v3/dist/domains/learning-optimization/plugin.js +2 -2
  158. package/v3/dist/domains/learning-optimization/plugin.js.map +1 -1
  159. package/v3/dist/domains/quality-assessment/coordinator.d.ts +23 -0
  160. package/v3/dist/domains/quality-assessment/coordinator.d.ts.map +1 -1
  161. package/v3/dist/domains/quality-assessment/coordinator.js +139 -1
  162. package/v3/dist/domains/quality-assessment/coordinator.js.map +1 -1
  163. package/v3/dist/domains/quality-assessment/plugin.d.ts +6 -1
  164. package/v3/dist/domains/quality-assessment/plugin.d.ts.map +1 -1
  165. package/v3/dist/domains/quality-assessment/plugin.js +69 -2
  166. package/v3/dist/domains/quality-assessment/plugin.js.map +1 -1
  167. package/v3/dist/domains/requirements-validation/plugin.js +2 -2
  168. package/v3/dist/domains/requirements-validation/plugin.js.map +1 -1
  169. package/v3/dist/domains/security-compliance/plugin.js +2 -2
  170. package/v3/dist/domains/security-compliance/plugin.js.map +1 -1
  171. package/v3/dist/domains/test-execution/index.d.ts +2 -1
  172. package/v3/dist/domains/test-execution/index.d.ts.map +1 -1
  173. package/v3/dist/domains/test-execution/index.js +0 -2
  174. package/v3/dist/domains/test-execution/index.js.map +1 -1
  175. package/v3/dist/domains/test-execution/interfaces.d.ts +222 -25
  176. package/v3/dist/domains/test-execution/interfaces.d.ts.map +1 -1
  177. package/v3/dist/domains/test-execution/interfaces.js +130 -3
  178. package/v3/dist/domains/test-execution/interfaces.js.map +1 -1
  179. package/v3/dist/domains/test-execution/plugin.d.ts +6 -1
  180. package/v3/dist/domains/test-execution/plugin.d.ts.map +1 -1
  181. package/v3/dist/domains/test-execution/plugin.js +79 -1
  182. package/v3/dist/domains/test-execution/plugin.js.map +1 -1
  183. package/v3/dist/domains/test-execution/test-prioritization-types.d.ts +5 -172
  184. package/v3/dist/domains/test-execution/test-prioritization-types.d.ts.map +1 -1
  185. package/v3/dist/domains/test-execution/test-prioritization-types.js +6 -129
  186. package/v3/dist/domains/test-execution/test-prioritization-types.js.map +1 -1
  187. package/v3/dist/domains/test-execution/types/index.d.ts +7 -3
  188. package/v3/dist/domains/test-execution/types/index.d.ts.map +1 -1
  189. package/v3/dist/domains/test-execution/types/index.js +7 -17
  190. package/v3/dist/domains/test-execution/types/index.js.map +1 -1
  191. package/v3/dist/domains/test-generation/coordinator.d.ts +41 -1
  192. package/v3/dist/domains/test-generation/coordinator.d.ts.map +1 -1
  193. package/v3/dist/domains/test-generation/coordinator.js +187 -4
  194. package/v3/dist/domains/test-generation/coordinator.js.map +1 -1
  195. package/v3/dist/domains/test-generation/factories/index.d.ts +8 -0
  196. package/v3/dist/domains/test-generation/factories/index.d.ts.map +1 -0
  197. package/v3/dist/domains/test-generation/factories/index.js +8 -0
  198. package/v3/dist/domains/test-generation/factories/index.js.map +1 -0
  199. package/v3/dist/domains/test-generation/factories/test-generator-factory.d.ts +108 -0
  200. package/v3/dist/domains/test-generation/factories/test-generator-factory.d.ts.map +1 -0
  201. package/v3/dist/domains/test-generation/factories/test-generator-factory.js +158 -0
  202. package/v3/dist/domains/test-generation/factories/test-generator-factory.js.map +1 -0
  203. package/v3/dist/domains/test-generation/generators/base-test-generator.d.ts +79 -0
  204. package/v3/dist/domains/test-generation/generators/base-test-generator.d.ts.map +1 -0
  205. package/v3/dist/domains/test-generation/generators/base-test-generator.js +252 -0
  206. package/v3/dist/domains/test-generation/generators/base-test-generator.js.map +1 -0
  207. package/v3/dist/domains/test-generation/generators/index.d.ts +11 -0
  208. package/v3/dist/domains/test-generation/generators/index.d.ts.map +1 -0
  209. package/v3/dist/domains/test-generation/generators/index.js +13 -0
  210. package/v3/dist/domains/test-generation/generators/index.js.map +1 -0
  211. package/v3/dist/domains/test-generation/generators/jest-vitest-generator.d.ts +77 -0
  212. package/v3/dist/domains/test-generation/generators/jest-vitest-generator.d.ts.map +1 -0
  213. package/v3/dist/domains/test-generation/generators/jest-vitest-generator.js +365 -0
  214. package/v3/dist/domains/test-generation/generators/jest-vitest-generator.js.map +1 -0
  215. package/v3/dist/domains/test-generation/generators/mocha-generator.d.ts +56 -0
  216. package/v3/dist/domains/test-generation/generators/mocha-generator.d.ts.map +1 -0
  217. package/v3/dist/domains/test-generation/generators/mocha-generator.js +197 -0
  218. package/v3/dist/domains/test-generation/generators/mocha-generator.js.map +1 -0
  219. package/v3/dist/domains/test-generation/generators/pytest-generator.d.ts +66 -0
  220. package/v3/dist/domains/test-generation/generators/pytest-generator.d.ts.map +1 -0
  221. package/v3/dist/domains/test-generation/generators/pytest-generator.js +240 -0
  222. package/v3/dist/domains/test-generation/generators/pytest-generator.js.map +1 -0
  223. package/v3/dist/domains/test-generation/index.d.ts +2 -2
  224. package/v3/dist/domains/test-generation/index.d.ts.map +1 -1
  225. package/v3/dist/domains/test-generation/index.js +3 -3
  226. package/v3/dist/domains/test-generation/index.js.map +1 -1
  227. package/v3/dist/domains/test-generation/interfaces/index.d.ts +9 -0
  228. package/v3/dist/domains/test-generation/interfaces/index.d.ts.map +1 -0
  229. package/v3/dist/domains/test-generation/interfaces/index.js +9 -0
  230. package/v3/dist/domains/test-generation/interfaces/index.js.map +1 -0
  231. package/v3/dist/domains/test-generation/interfaces/test-generator.interface.d.ts +166 -0
  232. package/v3/dist/domains/test-generation/interfaces/test-generator.interface.d.ts.map +1 -0
  233. package/v3/dist/domains/test-generation/interfaces/test-generator.interface.js +8 -0
  234. package/v3/dist/domains/test-generation/interfaces/test-generator.interface.js.map +1 -0
  235. package/v3/dist/domains/test-generation/interfaces.d.ts +163 -24
  236. package/v3/dist/domains/test-generation/interfaces.d.ts.map +1 -1
  237. package/v3/dist/domains/test-generation/interfaces.js +2 -2
  238. package/v3/dist/domains/test-generation/plugin.d.ts +6 -1
  239. package/v3/dist/domains/test-generation/plugin.d.ts.map +1 -1
  240. package/v3/dist/domains/test-generation/plugin.js +90 -5
  241. package/v3/dist/domains/test-generation/plugin.js.map +1 -1
  242. package/v3/dist/domains/test-generation/{coherence-gate.d.ts → services/coherence-gate-service.d.ts} +4 -4
  243. package/v3/dist/domains/test-generation/services/coherence-gate-service.d.ts.map +1 -0
  244. package/v3/dist/domains/test-generation/{coherence-gate.js → services/coherence-gate-service.js} +2 -2
  245. package/v3/dist/domains/test-generation/services/coherence-gate-service.js.map +1 -0
  246. package/v3/dist/domains/test-generation/services/index.d.ts +8 -2
  247. package/v3/dist/domains/test-generation/services/index.d.ts.map +1 -1
  248. package/v3/dist/domains/test-generation/services/index.js +10 -3
  249. package/v3/dist/domains/test-generation/services/index.js.map +1 -1
  250. package/v3/dist/domains/test-generation/services/property-test-generator.d.ts +34 -0
  251. package/v3/dist/domains/test-generation/services/property-test-generator.d.ts.map +1 -0
  252. package/v3/dist/domains/test-generation/services/property-test-generator.js +306 -0
  253. package/v3/dist/domains/test-generation/services/property-test-generator.js.map +1 -0
  254. package/v3/dist/domains/test-generation/services/tdd-generator.d.ts +33 -0
  255. package/v3/dist/domains/test-generation/services/tdd-generator.d.ts.map +1 -0
  256. package/v3/dist/domains/test-generation/services/tdd-generator.js +342 -0
  257. package/v3/dist/domains/test-generation/services/tdd-generator.js.map +1 -0
  258. package/v3/dist/domains/test-generation/services/test-data-generator.d.ts +34 -0
  259. package/v3/dist/domains/test-generation/services/test-data-generator.d.ts.map +1 -0
  260. package/v3/dist/domains/test-generation/services/test-data-generator.js +245 -0
  261. package/v3/dist/domains/test-generation/services/test-data-generator.js.map +1 -0
  262. package/v3/dist/domains/test-generation/services/test-generator.d.ts +51 -160
  263. package/v3/dist/domains/test-generation/services/test-generator.d.ts.map +1 -1
  264. package/v3/dist/domains/test-generation/services/test-generator.js +101 -1858
  265. package/v3/dist/domains/test-generation/services/test-generator.js.map +1 -1
  266. package/v3/dist/domains/visual-accessibility/plugin.js +2 -2
  267. package/v3/dist/domains/visual-accessibility/plugin.js.map +1 -1
  268. package/v3/dist/init/phases/12-verification.d.ts +23 -0
  269. package/v3/dist/init/phases/12-verification.d.ts.map +1 -1
  270. package/v3/dist/init/phases/12-verification.js +185 -2
  271. package/v3/dist/init/phases/12-verification.js.map +1 -1
  272. package/v3/dist/integrations/agentic-flow/model-router/complexity-analyzer.d.ts +24 -62
  273. package/v3/dist/integrations/agentic-flow/model-router/complexity-analyzer.d.ts.map +1 -1
  274. package/v3/dist/integrations/agentic-flow/model-router/complexity-analyzer.js +45 -497
  275. package/v3/dist/integrations/agentic-flow/model-router/complexity-analyzer.js.map +1 -1
  276. package/v3/dist/integrations/agentic-flow/model-router/router.js +2 -2
  277. package/v3/dist/integrations/agentic-flow/model-router/router.js.map +1 -1
  278. package/v3/dist/integrations/agentic-flow/model-router/score-calculator.d.ts +98 -0
  279. package/v3/dist/integrations/agentic-flow/model-router/score-calculator.d.ts.map +1 -0
  280. package/v3/dist/integrations/agentic-flow/model-router/score-calculator.js +197 -0
  281. package/v3/dist/integrations/agentic-flow/model-router/score-calculator.js.map +1 -0
  282. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.d.ts +102 -0
  283. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.d.ts.map +1 -0
  284. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.js +372 -0
  285. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.js.map +1 -0
  286. package/v3/dist/integrations/agentic-flow/model-router/tier-recommender.d.ts +64 -0
  287. package/v3/dist/integrations/agentic-flow/model-router/tier-recommender.d.ts.map +1 -0
  288. package/v3/dist/integrations/agentic-flow/model-router/tier-recommender.js +120 -0
  289. package/v3/dist/integrations/agentic-flow/model-router/tier-recommender.js.map +1 -0
  290. package/v3/dist/integrations/coherence/coherence-service.d.ts.map +1 -1
  291. package/v3/dist/integrations/coherence/coherence-service.js +87 -30
  292. package/v3/dist/integrations/coherence/coherence-service.js.map +1 -1
  293. package/v3/dist/integrations/coherence/engines/spectral-adapter.d.ts.map +1 -1
  294. package/v3/dist/integrations/coherence/engines/spectral-adapter.js +124 -35
  295. package/v3/dist/integrations/coherence/engines/spectral-adapter.js.map +1 -1
  296. package/v3/dist/kernel/interfaces.d.ts +54 -1
  297. package/v3/dist/kernel/interfaces.d.ts.map +1 -1
  298. package/v3/dist/learning/dream/dream-scheduler.d.ts +302 -0
  299. package/v3/dist/learning/dream/dream-scheduler.d.ts.map +1 -0
  300. package/v3/dist/learning/dream/dream-scheduler.js +551 -0
  301. package/v3/dist/learning/dream/dream-scheduler.js.map +1 -0
  302. package/v3/dist/learning/dream/index.d.ts +1 -0
  303. package/v3/dist/learning/dream/index.d.ts.map +1 -1
  304. package/v3/dist/learning/dream/index.js +4 -0
  305. package/v3/dist/learning/dream/index.js.map +1 -1
  306. package/v3/dist/learning/memory-auditor.d.ts.map +1 -1
  307. package/v3/dist/learning/memory-auditor.js +3 -1
  308. package/v3/dist/learning/memory-auditor.js.map +1 -1
  309. package/v3/dist/mcp/bundle.js +30870 -23598
  310. package/v3/dist/mcp/handlers/core-handlers.d.ts.map +1 -1
  311. package/v3/dist/mcp/handlers/core-handlers.js +16 -2
  312. package/v3/dist/mcp/handlers/core-handlers.js.map +1 -1
  313. package/v3/dist/mcp/handlers/task-handlers.d.ts +1 -0
  314. package/v3/dist/mcp/handlers/task-handlers.d.ts.map +1 -1
  315. package/v3/dist/mcp/handlers/task-handlers.js +46 -12
  316. package/v3/dist/mcp/handlers/task-handlers.js.map +1 -1
  317. package/v3/dist/mcp/security/cve-prevention.d.ts +31 -134
  318. package/v3/dist/mcp/security/cve-prevention.d.ts.map +1 -1
  319. package/v3/dist/mcp/security/cve-prevention.js +37 -562
  320. package/v3/dist/mcp/security/cve-prevention.js.map +1 -1
  321. package/v3/dist/mcp/security/index.d.ts +5 -1
  322. package/v3/dist/mcp/security/index.d.ts.map +1 -1
  323. package/v3/dist/mcp/security/validators/command-validator.d.ts +41 -0
  324. package/v3/dist/mcp/security/validators/command-validator.d.ts.map +1 -0
  325. package/v3/dist/mcp/security/validators/command-validator.js +123 -0
  326. package/v3/dist/mcp/security/validators/command-validator.js.map +1 -0
  327. package/v3/dist/mcp/security/validators/crypto-validator.d.ts +40 -0
  328. package/v3/dist/mcp/security/validators/crypto-validator.d.ts.map +1 -0
  329. package/v3/dist/mcp/security/validators/crypto-validator.js +72 -0
  330. package/v3/dist/mcp/security/validators/crypto-validator.js.map +1 -0
  331. package/v3/dist/mcp/security/validators/index.d.ts +12 -0
  332. package/v3/dist/mcp/security/validators/index.d.ts.map +1 -0
  333. package/v3/dist/mcp/security/validators/index.js +22 -0
  334. package/v3/dist/mcp/security/validators/index.js.map +1 -0
  335. package/v3/dist/mcp/security/validators/input-sanitizer.d.ts +56 -0
  336. package/v3/dist/mcp/security/validators/input-sanitizer.d.ts.map +1 -0
  337. package/v3/dist/mcp/security/validators/input-sanitizer.js +157 -0
  338. package/v3/dist/mcp/security/validators/input-sanitizer.js.map +1 -0
  339. package/v3/dist/mcp/security/validators/interfaces.d.ts +164 -0
  340. package/v3/dist/mcp/security/validators/interfaces.d.ts.map +1 -0
  341. package/v3/dist/mcp/security/validators/interfaces.js +6 -0
  342. package/v3/dist/mcp/security/validators/interfaces.js.map +1 -0
  343. package/v3/dist/mcp/security/validators/path-traversal-validator.d.ts +50 -0
  344. package/v3/dist/mcp/security/validators/path-traversal-validator.d.ts.map +1 -0
  345. package/v3/dist/mcp/security/validators/path-traversal-validator.js +242 -0
  346. package/v3/dist/mcp/security/validators/path-traversal-validator.js.map +1 -0
  347. package/v3/dist/mcp/security/validators/regex-safety-validator.d.ts +50 -0
  348. package/v3/dist/mcp/security/validators/regex-safety-validator.d.ts.map +1 -0
  349. package/v3/dist/mcp/security/validators/regex-safety-validator.js +183 -0
  350. package/v3/dist/mcp/security/validators/regex-safety-validator.js.map +1 -0
  351. package/v3/dist/mcp/security/validators/validation-orchestrator.d.ts +66 -0
  352. package/v3/dist/mcp/security/validators/validation-orchestrator.d.ts.map +1 -0
  353. package/v3/dist/mcp/security/validators/validation-orchestrator.js +146 -0
  354. package/v3/dist/mcp/security/validators/validation-orchestrator.js.map +1 -0
  355. package/v3/dist/mcp/server.d.ts.map +1 -1
  356. package/v3/dist/mcp/server.js +1 -0
  357. package/v3/dist/mcp/server.js.map +1 -1
  358. package/v3/dist/mcp/services/reasoning-bank-service.d.ts +87 -13
  359. package/v3/dist/mcp/services/reasoning-bank-service.d.ts.map +1 -1
  360. package/v3/dist/mcp/services/reasoning-bank-service.js +291 -31
  361. package/v3/dist/mcp/services/reasoning-bank-service.js.map +1 -1
  362. package/v3/dist/mcp/tool-registry.d.ts +3 -1
  363. package/v3/dist/mcp/tool-registry.d.ts.map +1 -1
  364. package/v3/dist/mcp/tool-registry.js +155 -2
  365. package/v3/dist/mcp/tool-registry.js.map +1 -1
  366. package/v3/dist/mcp/tools/test-generation/generate.d.ts +1 -0
  367. package/v3/dist/mcp/tools/test-generation/generate.d.ts.map +1 -1
  368. package/v3/dist/mcp/tools/test-generation/generate.js +3 -2
  369. package/v3/dist/mcp/tools/test-generation/generate.js.map +1 -1
  370. package/v3/dist/routing/qe-agent-registry.d.ts +27 -0
  371. package/v3/dist/routing/qe-agent-registry.d.ts.map +1 -1
  372. package/v3/dist/routing/qe-agent-registry.js +96 -0
  373. package/v3/dist/routing/qe-agent-registry.js.map +1 -1
  374. package/v3/dist/shared/events/domain-events.d.ts +27 -0
  375. package/v3/dist/shared/events/domain-events.d.ts.map +1 -1
  376. package/v3/dist/shared/events/domain-events.js +1 -0
  377. package/v3/dist/shared/events/domain-events.js.map +1 -1
  378. package/v3/dist/sync/cloud/index.d.ts +8 -0
  379. package/v3/dist/sync/cloud/index.d.ts.map +1 -0
  380. package/v3/dist/sync/cloud/index.js +8 -0
  381. package/v3/dist/sync/cloud/index.js.map +1 -0
  382. package/v3/dist/sync/cloud/postgres-writer.d.ts +88 -0
  383. package/v3/dist/sync/cloud/postgres-writer.d.ts.map +1 -0
  384. package/v3/dist/sync/cloud/postgres-writer.js +319 -0
  385. package/v3/dist/sync/cloud/postgres-writer.js.map +1 -0
  386. package/v3/dist/sync/cloud/tunnel-manager.d.ts +75 -0
  387. package/v3/dist/sync/cloud/tunnel-manager.d.ts.map +1 -0
  388. package/v3/dist/sync/cloud/tunnel-manager.js +221 -0
  389. package/v3/dist/sync/cloud/tunnel-manager.js.map +1 -0
  390. package/v3/dist/sync/index.d.ts +35 -0
  391. package/v3/dist/sync/index.d.ts.map +1 -0
  392. package/v3/dist/sync/index.js +35 -0
  393. package/v3/dist/sync/index.js.map +1 -0
  394. package/v3/dist/sync/interfaces.d.ts +245 -0
  395. package/v3/dist/sync/interfaces.d.ts.map +1 -0
  396. package/v3/dist/sync/interfaces.js +160 -0
  397. package/v3/dist/sync/interfaces.js.map +1 -0
  398. package/v3/dist/sync/readers/index.d.ts +8 -0
  399. package/v3/dist/sync/readers/index.d.ts.map +1 -0
  400. package/v3/dist/sync/readers/index.js +8 -0
  401. package/v3/dist/sync/readers/index.js.map +1 -0
  402. package/v3/dist/sync/readers/json-reader.d.ts +95 -0
  403. package/v3/dist/sync/readers/json-reader.d.ts.map +1 -0
  404. package/v3/dist/sync/readers/json-reader.js +306 -0
  405. package/v3/dist/sync/readers/json-reader.js.map +1 -0
  406. package/v3/dist/sync/readers/sqlite-reader.d.ts +88 -0
  407. package/v3/dist/sync/readers/sqlite-reader.d.ts.map +1 -0
  408. package/v3/dist/sync/readers/sqlite-reader.js +255 -0
  409. package/v3/dist/sync/readers/sqlite-reader.js.map +1 -0
  410. package/v3/dist/sync/sync-agent.d.ts +116 -0
  411. package/v3/dist/sync/sync-agent.d.ts.map +1 -0
  412. package/v3/dist/sync/sync-agent.js +416 -0
  413. package/v3/dist/sync/sync-agent.js.map +1 -0
  414. package/v3/package.json +13 -2
  415. package/v3/dist/domains/test-generation/coherence-gate.d.ts.map +0 -1
  416. package/v3/dist/domains/test-generation/coherence-gate.js.map +0 -1
@@ -0,0 +1,365 @@
1
+ /**
2
+ * Agentic QE v3 - Jest/Vitest Test Generator
3
+ * Strategy implementation for Jest and Vitest test frameworks
4
+ *
5
+ * Generates test code using:
6
+ * - describe/it blocks
7
+ * - expect().toBe/toEqual/toBeDefined assertions
8
+ * - beforeEach/afterEach hooks
9
+ * - async/await support
10
+ *
11
+ * @module test-generation/generators
12
+ */
13
+ import { BaseTestGenerator } from './base-test-generator';
14
+ /**
15
+ * JestVitestGenerator - Test generator for Jest and Vitest frameworks
16
+ *
17
+ * Both frameworks share nearly identical APIs, so this single generator
18
+ * handles both by adjusting minor differences (e.g., vi vs jest mocking).
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const generator = new JestVitestGenerator('vitest');
23
+ * const testCode = generator.generateTests({
24
+ * moduleName: 'userService',
25
+ * importPath: './user-service',
26
+ * testType: 'unit',
27
+ * patterns: [],
28
+ * analysis: { functions: [...], classes: [...] }
29
+ * });
30
+ * ```
31
+ */
32
+ export class JestVitestGenerator extends BaseTestGenerator {
33
+ framework;
34
+ constructor(framework = 'vitest') {
35
+ super();
36
+ this.framework = framework;
37
+ }
38
+ /**
39
+ * Get the mock utility name (vi for vitest, jest for jest)
40
+ */
41
+ get mockUtil() {
42
+ return this.framework === 'vitest' ? 'vi' : 'jest';
43
+ }
44
+ /**
45
+ * Generate complete test file from analysis
46
+ */
47
+ generateTests(context) {
48
+ const { moduleName, importPath, testType, patterns, analysis } = context;
49
+ if (!analysis || (analysis.functions.length === 0 && analysis.classes.length === 0)) {
50
+ return this.generateStubTests(context);
51
+ }
52
+ const patternComment = this.generatePatternComment(patterns);
53
+ const exports = this.extractExports(analysis.functions, analysis.classes);
54
+ const importStatement = this.generateImportStatement(exports, importPath, moduleName);
55
+ const mockImport = this.framework === 'vitest' ? ', vi' : '';
56
+ let testCode = `${patternComment}import { describe, it, expect, beforeEach${mockImport} } from '${this.framework}';
57
+ ${importStatement}
58
+
59
+ `;
60
+ // Generate tests for each function
61
+ for (const fn of analysis.functions) {
62
+ testCode += this.generateFunctionTests(fn, testType);
63
+ }
64
+ // Generate tests for each class
65
+ for (const cls of analysis.classes) {
66
+ testCode += this.generateClassTests(cls, testType);
67
+ }
68
+ return testCode;
69
+ }
70
+ /**
71
+ * Generate tests for a standalone function
72
+ */
73
+ generateFunctionTests(fn, _testType) {
74
+ const testCases = this.generateTestCasesForFunction(fn);
75
+ let code = `describe('${fn.name}', () => {\n`;
76
+ for (const testCase of testCases) {
77
+ if (testCase.setup) {
78
+ code += ` ${testCase.setup}\n\n`;
79
+ }
80
+ const asyncPrefix = fn.isAsync ? 'async ' : '';
81
+ code += ` it('${testCase.description}', ${asyncPrefix}() => {\n`;
82
+ code += ` ${testCase.action}\n`;
83
+ code += ` ${testCase.assertion}\n`;
84
+ code += ` });\n\n`;
85
+ }
86
+ code += `});\n\n`;
87
+ return code;
88
+ }
89
+ /**
90
+ * Generate tests for a class
91
+ */
92
+ generateClassTests(cls, testType) {
93
+ let code = `describe('${cls.name}', () => {\n`;
94
+ code += ` let instance: ${cls.name};\n\n`;
95
+ // Setup with beforeEach
96
+ if (cls.hasConstructor && cls.constructorParams) {
97
+ const constructorArgs = cls.constructorParams
98
+ .map((p) => this.generateTestValue(p))
99
+ .join(', ');
100
+ code += ` beforeEach(() => {\n`;
101
+ code += ` instance = new ${cls.name}(${constructorArgs});\n`;
102
+ code += ` });\n\n`;
103
+ }
104
+ else {
105
+ code += ` beforeEach(() => {\n`;
106
+ code += ` instance = new ${cls.name}();\n`;
107
+ code += ` });\n\n`;
108
+ }
109
+ // Constructor test
110
+ code += ` it('should instantiate correctly', () => {\n`;
111
+ code += ` expect(instance).toBeInstanceOf(${cls.name});\n`;
112
+ code += ` });\n\n`;
113
+ // Generate tests for each public method
114
+ for (const method of cls.methods) {
115
+ if (!method.name.startsWith('_') && !method.name.startsWith('#')) {
116
+ code += this.generateMethodTests(method, cls.name, testType);
117
+ }
118
+ }
119
+ code += `});\n\n`;
120
+ return code;
121
+ }
122
+ /**
123
+ * Generate tests for a class method
124
+ */
125
+ generateMethodTests(method, _className, _testType) {
126
+ let code = ` describe('${method.name}', () => {\n`;
127
+ const validParams = method.parameters.map((p) => this.generateTestValue(p)).join(', ');
128
+ const methodCall = method.isAsync
129
+ ? `await instance.${method.name}(${validParams})`
130
+ : `instance.${method.name}(${validParams})`;
131
+ // Happy path test
132
+ const asyncPrefix = method.isAsync ? 'async ' : '';
133
+ code += ` it('should execute successfully', ${asyncPrefix}() => {\n`;
134
+ code += ` const result = ${methodCall};\n`;
135
+ code += ` expect(result).toBeDefined();\n`;
136
+ code += ` });\n`;
137
+ // Error handling tests for non-optional params
138
+ for (const param of method.parameters) {
139
+ if (!param.optional) {
140
+ const paramsWithUndefined = method.parameters
141
+ .map((p) => (p.name === param.name ? 'undefined as any' : this.generateTestValue(p)))
142
+ .join(', ');
143
+ code += `\n it('should handle invalid ${param.name}', () => {\n`;
144
+ code += ` expect(() => instance.${method.name}(${paramsWithUndefined})).toThrow();\n`;
145
+ code += ` });\n`;
146
+ }
147
+ }
148
+ code += ` });\n\n`;
149
+ return code;
150
+ }
151
+ /**
152
+ * Generate stub tests when no AST analysis is available
153
+ */
154
+ generateStubTests(context) {
155
+ const { moduleName, importPath, testType, patterns } = context;
156
+ const patternComment = this.generatePatternComment(patterns);
157
+ const basicOpsTest = this.generateBasicOpsTest(moduleName, patterns);
158
+ const edgeCaseTest = this.generateEdgeCaseTest(moduleName, patterns);
159
+ const errorHandlingTest = this.generateErrorHandlingTest(moduleName, patterns);
160
+ return `${patternComment}import { ${moduleName} } from '${importPath}';
161
+
162
+ describe('${moduleName}', () => {
163
+ describe('${testType} tests', () => {
164
+ it('should be defined', () => {
165
+ expect(${moduleName}).toBeDefined();
166
+ });
167
+
168
+ ${basicOpsTest}
169
+ ${edgeCaseTest}
170
+ ${errorHandlingTest}
171
+ });
172
+ });
173
+ `;
174
+ }
175
+ /**
176
+ * Generate coverage-focused tests for specific lines
177
+ */
178
+ generateCoverageTests(moduleName, importPath, lines) {
179
+ const funcName = this.camelCase(moduleName);
180
+ const lineRange = this.formatLineRange(lines);
181
+ return `// Coverage test for ${lineRange} in ${moduleName}
182
+ import { ${funcName} } from '${importPath}';
183
+
184
+ describe('${moduleName} coverage', () => {
185
+ describe('${lineRange}', () => {
186
+ it('should execute code path covering ${lineRange}', () => {
187
+ // Arrange: Set up test inputs to reach uncovered lines
188
+ const testInput = undefined; // Replace with appropriate input
189
+
190
+ // Act: Execute the code path
191
+ const result = ${funcName}(testInput);
192
+
193
+ // Assert: Verify the code was reached and behaves correctly
194
+ expect(result).toBeDefined();
195
+ });
196
+
197
+ it('should handle edge case for ${lineRange}', () => {
198
+ // Arrange: Set up edge case input
199
+ const edgeCaseInput = null;
200
+
201
+ // Act & Assert: Verify edge case handling
202
+ expect(() => ${funcName}(edgeCaseInput)).not.toThrow();
203
+ });
204
+ });
205
+ });
206
+ `;
207
+ }
208
+ // ============================================================================
209
+ // Pattern-Aware Stub Test Generators
210
+ // ============================================================================
211
+ /**
212
+ * Generate basic operations test based on detected patterns
213
+ */
214
+ generateBasicOpsTest(moduleName, patterns) {
215
+ const isService = patterns.some((p) => p.name.toLowerCase().includes('service') ||
216
+ p.name.toLowerCase().includes('repository'));
217
+ const isFactory = patterns.some((p) => p.name.toLowerCase().includes('factory'));
218
+ const hasAsyncPattern = patterns.some((p) => p.name.toLowerCase().includes('async') || p.name.toLowerCase().includes('promise'));
219
+ if (isService) {
220
+ return ` it('should handle basic operations', async () => {
221
+ // Service pattern: test core functionality
222
+ const instance = new ${moduleName}();
223
+ expect(instance).toBeInstanceOf(${moduleName});
224
+
225
+ // Verify service is properly initialized
226
+ const methods = Object.getOwnPropertyNames(Object.getPrototypeOf(instance))
227
+ .filter(m => m !== 'constructor');
228
+ expect(methods.length).toBeGreaterThan(0);
229
+ });`;
230
+ }
231
+ if (isFactory) {
232
+ return ` it('should handle basic operations', () => {
233
+ // Factory pattern: test object creation
234
+ const result = ${moduleName}.create ? ${moduleName}.create() : new ${moduleName}();
235
+ expect(result).toBeDefined();
236
+ expect(typeof result).not.toBe('undefined');
237
+ });`;
238
+ }
239
+ if (hasAsyncPattern) {
240
+ return ` it('should handle basic operations', async () => {
241
+ // Async pattern: test promise resolution
242
+ const instance = typeof ${moduleName} === 'function'
243
+ ? new ${moduleName}()
244
+ : ${moduleName};
245
+
246
+ // Verify async methods resolve properly
247
+ if (typeof instance.execute === 'function') {
248
+ await expect(instance.execute()).resolves.toBeDefined();
249
+ }
250
+ });`;
251
+ }
252
+ // Default implementation
253
+ return ` it('should handle basic operations', () => {
254
+ // Verify module exports expected interface
255
+ const moduleType = typeof ${moduleName};
256
+ expect(['function', 'object']).toContain(moduleType);
257
+
258
+ if (moduleType === 'function') {
259
+ // Class or function: verify instantiation
260
+ const instance = new ${moduleName}();
261
+ expect(instance).toBeDefined();
262
+ } else {
263
+ // Object module: verify properties exist
264
+ expect(Object.keys(${moduleName}).length).toBeGreaterThan(0);
265
+ }
266
+ });`;
267
+ }
268
+ /**
269
+ * Generate edge case test based on detected patterns
270
+ */
271
+ generateEdgeCaseTest(moduleName, patterns) {
272
+ const hasValidation = patterns.some((p) => p.name.toLowerCase().includes('validation') ||
273
+ p.name.toLowerCase().includes('validator'));
274
+ const hasCollection = patterns.some((p) => p.name.toLowerCase().includes('collection') ||
275
+ p.name.toLowerCase().includes('list'));
276
+ if (hasValidation) {
277
+ return ` it('should handle edge cases', () => {
278
+ // Validation pattern: test boundary conditions
279
+ const instance = new ${moduleName}();
280
+
281
+ // Test with empty values
282
+ if (typeof instance.validate === 'function') {
283
+ expect(() => instance.validate('')).toBeDefined();
284
+ expect(() => instance.validate(null)).toBeDefined();
285
+ }
286
+ });`;
287
+ }
288
+ if (hasCollection) {
289
+ return ` it('should handle edge cases', () => {
290
+ // Collection pattern: test empty and large datasets
291
+ const instance = new ${moduleName}();
292
+
293
+ // Empty collection should be handled gracefully
294
+ if (typeof instance.add === 'function') {
295
+ expect(() => instance.add(undefined)).toBeDefined();
296
+ }
297
+ if (typeof instance.get === 'function') {
298
+ expect(instance.get('nonexistent')).toBeUndefined();
299
+ }
300
+ });`;
301
+ }
302
+ // Default edge case test
303
+ return ` it('should handle edge cases', () => {
304
+ // Test null/undefined handling
305
+ const instance = typeof ${moduleName} === 'function'
306
+ ? new ${moduleName}()
307
+ : ${moduleName};
308
+
309
+ // Module should handle edge case inputs gracefully
310
+ expect(instance).toBeDefined();
311
+ expect(() => JSON.stringify(instance)).not.toThrow();
312
+ });`;
313
+ }
314
+ /**
315
+ * Generate error handling test based on detected patterns
316
+ */
317
+ generateErrorHandlingTest(moduleName, patterns) {
318
+ const hasErrorPattern = patterns.some((p) => p.name.toLowerCase().includes('error') ||
319
+ p.name.toLowerCase().includes('exception'));
320
+ const hasAsyncPattern = patterns.some((p) => p.name.toLowerCase().includes('async') || p.name.toLowerCase().includes('promise'));
321
+ if (hasAsyncPattern) {
322
+ return ` it('should handle error conditions', async () => {
323
+ // Async error handling: verify rejections are caught
324
+ const instance = typeof ${moduleName} === 'function'
325
+ ? new ${moduleName}()
326
+ : ${moduleName};
327
+
328
+ // Async operations should reject gracefully on invalid input
329
+ const asyncMethods = Object.getOwnPropertyNames(Object.getPrototypeOf(instance) || {})
330
+ .filter(m => m !== 'constructor');
331
+
332
+ // At minimum, module should be stable
333
+ expect(instance).toBeDefined();
334
+ });`;
335
+ }
336
+ if (hasErrorPattern) {
337
+ return ` it('should handle error conditions', () => {
338
+ // Error pattern: verify custom error types
339
+ try {
340
+ const instance = new ${moduleName}();
341
+ // Trigger error condition if possible
342
+ if (typeof instance.throwError === 'function') {
343
+ expect(() => instance.throwError()).toThrow();
344
+ }
345
+ } catch (error) {
346
+ expect(error).toBeInstanceOf(Error);
347
+ }
348
+ });`;
349
+ }
350
+ // Default error handling test
351
+ return ` it('should handle error conditions', () => {
352
+ // Verify error resilience
353
+ expect(() => {
354
+ const instance = typeof ${moduleName} === 'function'
355
+ ? new ${moduleName}()
356
+ : ${moduleName};
357
+ return instance;
358
+ }).not.toThrow();
359
+
360
+ // Module should not throw on inspection
361
+ expect(() => Object.keys(${moduleName})).not.toThrow();
362
+ });`;
363
+ }
364
+ }
365
+ //# sourceMappingURL=jest-vitest-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest-vitest-generator.js","sourceRoot":"","sources":["../../../../src/domains/test-generation/generators/jest-vitest-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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AA8B;QAC9B,OAAO;;;kCAGuB,UAAU;kBAC1B,UAAU;cACd,UAAU;;;;;iCAKS,UAAU;QACnC,CAAC;IACP,CAAC;CACF"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Agentic QE v3 - Mocha Test Generator
3
+ * Strategy implementation for Mocha test framework with Chai assertions
4
+ *
5
+ * Generates test code using:
6
+ * - describe/it blocks (Mocha)
7
+ * - expect().to.be/to.equal assertions (Chai)
8
+ * - function() {} style for this context
9
+ * - beforeEach/afterEach hooks
10
+ *
11
+ * @module test-generation/generators
12
+ */
13
+ import { BaseTestGenerator } from './base-test-generator';
14
+ import type { TestFramework, TestType, FunctionInfo, ClassInfo, TestGenerationContext } from '../interfaces';
15
+ /**
16
+ * MochaGenerator - Test generator for Mocha framework with Chai
17
+ *
18
+ * Uses traditional function() syntax to preserve Mocha's this context
19
+ * for features like this.timeout() and this.retries().
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const generator = new MochaGenerator();
24
+ * const testCode = generator.generateTests({
25
+ * moduleName: 'userService',
26
+ * importPath: './user-service',
27
+ * testType: 'unit',
28
+ * patterns: [],
29
+ * analysis: { functions: [...], classes: [...] }
30
+ * });
31
+ * ```
32
+ */
33
+ export declare class MochaGenerator extends BaseTestGenerator {
34
+ readonly framework: TestFramework;
35
+ /**
36
+ * Generate complete test file from analysis
37
+ */
38
+ generateTests(context: TestGenerationContext): string;
39
+ /**
40
+ * Generate tests for a standalone function
41
+ */
42
+ generateFunctionTests(fn: FunctionInfo, _testType: TestType): string;
43
+ /**
44
+ * Generate tests for a class
45
+ */
46
+ generateClassTests(cls: ClassInfo, _testType: TestType): string;
47
+ /**
48
+ * Generate stub tests when no AST analysis is available
49
+ */
50
+ generateStubTests(context: TestGenerationContext): string;
51
+ /**
52
+ * Generate coverage-focused tests for specific lines
53
+ */
54
+ generateCoverageTests(moduleName: string, importPath: string, lines: number[]): string;
55
+ }
56
+ //# sourceMappingURL=mocha-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mocha-generator.d.ts","sourceRoot":"","sources":["../../../../src/domains/test-generation/generators/mocha-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,qBAAqB,EAEtB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAW;IAE5C;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM;IA6BrD;;OAEG;IACH,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,GAAG,MAAM;IA2BpE;;OAEG;IACH,kBAAkB,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,GAAG,MAAM;IA2B/D;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM;IAwDzD;;OAEG;IACH,qBAAqB,CACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EAAE,GACd,MAAM;CAgCV"}
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Agentic QE v3 - Mocha Test Generator
3
+ * Strategy implementation for Mocha test framework with Chai assertions
4
+ *
5
+ * Generates test code using:
6
+ * - describe/it blocks (Mocha)
7
+ * - expect().to.be/to.equal assertions (Chai)
8
+ * - function() {} style for this context
9
+ * - beforeEach/afterEach hooks
10
+ *
11
+ * @module test-generation/generators
12
+ */
13
+ import { BaseTestGenerator } from './base-test-generator';
14
+ /**
15
+ * MochaGenerator - Test generator for Mocha framework with Chai
16
+ *
17
+ * Uses traditional function() syntax to preserve Mocha's this context
18
+ * for features like this.timeout() and this.retries().
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const generator = new MochaGenerator();
23
+ * const testCode = generator.generateTests({
24
+ * moduleName: 'userService',
25
+ * importPath: './user-service',
26
+ * testType: 'unit',
27
+ * patterns: [],
28
+ * analysis: { functions: [...], classes: [...] }
29
+ * });
30
+ * ```
31
+ */
32
+ export class MochaGenerator extends BaseTestGenerator {
33
+ framework = 'mocha';
34
+ /**
35
+ * Generate complete test file from analysis
36
+ */
37
+ generateTests(context) {
38
+ const { moduleName, importPath, testType, patterns, analysis } = context;
39
+ if (!analysis || (analysis.functions.length === 0 && analysis.classes.length === 0)) {
40
+ return this.generateStubTests(context);
41
+ }
42
+ const patternComment = this.generatePatternComment(patterns);
43
+ const exports = this.extractExports(analysis.functions, analysis.classes);
44
+ const importStatement = this.generateImportStatement(exports, importPath, moduleName);
45
+ let code = `${patternComment}import { expect } from 'chai';
46
+ ${importStatement}
47
+
48
+ describe('${moduleName} - ${testType} tests', function() {
49
+ `;
50
+ for (const fn of analysis.functions) {
51
+ code += this.generateFunctionTests(fn, testType);
52
+ }
53
+ for (const cls of analysis.classes) {
54
+ code += this.generateClassTests(cls, testType);
55
+ }
56
+ code += `});\n`;
57
+ return code;
58
+ }
59
+ /**
60
+ * Generate tests for a standalone function
61
+ */
62
+ generateFunctionTests(fn, _testType) {
63
+ const validParams = fn.parameters.map((p) => this.generateTestValue(p)).join(', ');
64
+ const fnCall = fn.isAsync ? `await ${fn.name}(${validParams})` : `${fn.name}(${validParams})`;
65
+ let code = ` describe('${fn.name}', function() {\n`;
66
+ code += ` it('should handle valid input', ${fn.isAsync ? 'async ' : ''}function() {\n`;
67
+ code += ` const result = ${fnCall};\n`;
68
+ code += ` expect(result).to.not.be.undefined;\n`;
69
+ code += ` });\n`;
70
+ // Test for undefined parameters
71
+ for (const param of fn.parameters) {
72
+ if (!param.optional) {
73
+ const paramsWithUndefined = fn.parameters
74
+ .map((p) => (p.name === param.name ? 'undefined' : this.generateTestValue(p)))
75
+ .join(', ');
76
+ code += `\n it('should handle undefined ${param.name}', function() {\n`;
77
+ code += ` expect(function() { ${fn.name}(${paramsWithUndefined}); }).to.throw();\n`;
78
+ code += ` });\n`;
79
+ }
80
+ }
81
+ code += ` });\n\n`;
82
+ return code;
83
+ }
84
+ /**
85
+ * Generate tests for a class
86
+ */
87
+ generateClassTests(cls, _testType) {
88
+ const constructorArgs = cls.constructorParams?.map((p) => this.generateTestValue(p)).join(', ') || '';
89
+ let code = ` describe('${cls.name}', function() {\n`;
90
+ code += ` let instance;\n\n`;
91
+ code += ` beforeEach(function() {\n`;
92
+ code += ` instance = new ${cls.name}(${constructorArgs});\n`;
93
+ code += ` });\n\n`;
94
+ code += ` it('should instantiate correctly', function() {\n`;
95
+ code += ` expect(instance).to.be.instanceOf(${cls.name});\n`;
96
+ code += ` });\n`;
97
+ for (const method of cls.methods) {
98
+ if (!method.name.startsWith('_')) {
99
+ const methodParams = method.parameters.map((p) => this.generateTestValue(p)).join(', ');
100
+ code += `\n it('${method.name} should work', ${method.isAsync ? 'async ' : ''}function() {\n`;
101
+ code += ` const result = ${method.isAsync ? 'await ' : ''}instance.${method.name}(${methodParams});\n`;
102
+ code += ` expect(result).to.not.be.undefined;\n`;
103
+ code += ` });\n`;
104
+ }
105
+ }
106
+ code += ` });\n\n`;
107
+ return code;
108
+ }
109
+ /**
110
+ * Generate stub tests when no AST analysis is available
111
+ */
112
+ generateStubTests(context) {
113
+ const { moduleName, importPath, testType, patterns } = context;
114
+ const patternComment = this.generatePatternComment(patterns);
115
+ // Determine if async tests needed based on patterns
116
+ const isAsync = patterns.some((p) => p.name.toLowerCase().includes('async') || p.name.toLowerCase().includes('promise'));
117
+ const asyncSetup = isAsync ? 'async ' : '';
118
+ return `${patternComment}import { expect } from 'chai';
119
+ import { ${moduleName} } from '${importPath}';
120
+
121
+ describe('${moduleName}', function() {
122
+ describe('${testType} tests', function() {
123
+ it('should be defined', function() {
124
+ expect(${moduleName}).to.not.be.undefined;
125
+ });
126
+
127
+ it('should handle basic operations', ${asyncSetup}function() {
128
+ // Verify module exports expected interface
129
+ const moduleType = typeof ${moduleName};
130
+ expect(['function', 'object']).to.include(moduleType);
131
+
132
+ if (moduleType === 'function') {
133
+ const instance = new ${moduleName}();
134
+ expect(instance).to.exist;
135
+ } else {
136
+ expect(Object.keys(${moduleName})).to.have.length.greaterThan(0);
137
+ }
138
+ });
139
+
140
+ it('should handle edge cases', function() {
141
+ // Verify resilience to edge inputs
142
+ const instance = typeof ${moduleName} === 'function'
143
+ ? new ${moduleName}()
144
+ : ${moduleName};
145
+ expect(instance).to.exist;
146
+ expect(function() { JSON.stringify(instance); }).to.not.throw();
147
+ });
148
+
149
+ it('should handle error conditions', function() {
150
+ // Verify error resilience
151
+ expect(function() {
152
+ const instance = typeof ${moduleName} === 'function'
153
+ ? new ${moduleName}()
154
+ : ${moduleName};
155
+ return instance;
156
+ }).to.not.throw();
157
+ });
158
+ });
159
+ });
160
+ `;
161
+ }
162
+ /**
163
+ * Generate coverage-focused tests for specific lines
164
+ */
165
+ generateCoverageTests(moduleName, importPath, lines) {
166
+ const funcName = this.camelCase(moduleName);
167
+ const lineRange = this.formatLineRange(lines);
168
+ return `// Coverage test for ${lineRange} in ${moduleName}
169
+ import { expect } from 'chai';
170
+ import { ${funcName} } from '${importPath}';
171
+
172
+ describe('${moduleName} coverage', function() {
173
+ describe('${lineRange}', function() {
174
+ it('should execute code path covering ${lineRange}', function() {
175
+ // Arrange: Set up test inputs to reach uncovered lines
176
+ const testInput = undefined; // Replace with appropriate input
177
+
178
+ // Act: Execute the code path
179
+ const result = ${funcName}(testInput);
180
+
181
+ // Assert: Verify the code was reached and behaves correctly
182
+ expect(result).to.not.be.undefined;
183
+ });
184
+
185
+ it('should handle edge case for ${lineRange}', function() {
186
+ // Arrange: Set up edge case input
187
+ const edgeCaseInput = null;
188
+
189
+ // Act & Assert: Verify edge case handling
190
+ expect(function() { ${funcName}(edgeCaseInput); }).to.not.throw();
191
+ });
192
+ });
193
+ });
194
+ `;
195
+ }
196
+ }
197
+ //# sourceMappingURL=mocha-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mocha-generator.js","sourceRoot":"","sources":["../../../../src/domains/test-generation/generators/mocha-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAU1D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAiB;IAC1C,SAAS,GAAkB,OAAO,CAAC;IAE5C;;OAEG;IACH,aAAa,CAAC,OAA8B;QAC1C,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAEzE,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YACpF,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;QAED,MAAM,cAAc,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC1E,MAAM,eAAe,GAAG,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAEtF,IAAI,IAAI,GAAG,GAAG,cAAc;EAC9B,eAAe;;YAEL,UAAU,MAAM,QAAQ;CACnC,CAAC;QAEE,KAAK,MAAM,EAAE,IAAI,QAAQ,CAAC,SAAS,EAAE,CAAC;YACpC,IAAI,IAAI,IAAI,CAAC,qBAAqB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACnD,CAAC;QAED,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,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