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
@@ -3,103 +3,38 @@
3
3
  * ADR-041: V3 QE CLI Enhancement
4
4
  *
5
5
  * Interactive wizard for test generation with step-by-step configuration.
6
- * Prompts for source files, test type, coverage target, framework, and AI enhancement.
6
+ * Refactored to use Command Pattern for reduced complexity and better reusability.
7
7
  */
8
- import { createInterface } from 'readline';
9
8
  import chalk from 'chalk';
10
9
  import { existsSync, readdirSync, statSync, readFileSync } from 'fs';
11
10
  import { join, resolve, relative, extname, basename } from 'path';
11
+ import { BaseWizard, BaseWizardCommand, SingleSelectStep, BooleanStep, NumericStep, WizardPrompt, WizardFormat, WizardSuggestions, } from './core/index.js';
12
12
  // ============================================================================
13
- // Wizard Implementation
13
+ // Source Files Step (Custom)
14
14
  // ============================================================================
15
- export class TestGenerationWizard {
16
- options;
17
- cwd;
18
- constructor(options = {}) {
19
- this.options = options;
20
- this.cwd = process.cwd();
15
+ /**
16
+ * Custom step for source file selection with file resolution
17
+ */
18
+ class SourceFilesStep extends BaseWizardCommand {
19
+ id = 'sourceFiles';
20
+ stepNumber = '1/6';
21
+ title = 'Source Files';
22
+ description = 'Enter file paths, glob patterns, or directory';
23
+ defaultSourceFiles;
24
+ constructor(defaultSourceFiles) {
25
+ super(defaultSourceFiles);
26
+ this.defaultSourceFiles = defaultSourceFiles;
21
27
  }
22
- /**
23
- * Run the interactive wizard
24
- */
25
- async run() {
26
- // Non-interactive mode returns defaults
27
- if (this.options.nonInteractive) {
28
- return this.getDefaults();
29
- }
30
- const rl = createInterface({
31
- input: process.stdin,
32
- output: process.stdout,
33
- });
34
- try {
35
- // Print header
36
- this.printHeader();
37
- // Step 1: Source files
38
- const sourceFiles = await this.promptSourceFiles(rl);
39
- if (sourceFiles.length === 0) {
40
- return this.getCancelled();
41
- }
42
- // Step 2: Test type
43
- const testType = await this.promptTestType(rl);
44
- // Step 3: Coverage target
45
- const coverageTarget = await this.promptCoverageTarget(rl);
46
- // Step 4: Framework
47
- const framework = await this.promptFramework(rl);
48
- // Step 5: AI enhancement level
49
- const aiLevel = await this.promptAILevel(rl);
50
- // Step 6: Anti-pattern detection
51
- const detectAntiPatterns = await this.promptAntiPatternDetection(rl);
52
- // Print summary
53
- this.printSummary({
54
- sourceFiles,
55
- testType,
56
- coverageTarget,
57
- framework,
58
- aiLevel,
59
- detectAntiPatterns,
60
- cancelled: false,
61
- });
62
- // Confirm
63
- const confirmed = await this.promptConfirmation(rl);
64
- if (!confirmed) {
65
- return this.getCancelled();
66
- }
67
- return {
68
- sourceFiles,
69
- testType,
70
- coverageTarget,
71
- framework,
72
- aiLevel,
73
- detectAntiPatterns,
74
- cancelled: false,
75
- };
28
+ async execute(context) {
29
+ if (context.nonInteractive) {
30
+ const resolved = this.resolveSourceFiles(this.defaultSourceFiles.join(', '), context.cwd);
31
+ return this.success(resolved.length > 0 ? resolved : this.defaultSourceFiles);
76
32
  }
77
- finally {
78
- rl.close();
79
- }
80
- }
81
- /**
82
- * Print wizard header
83
- */
84
- printHeader() {
85
- console.log('');
86
- console.log(chalk.blue('========================================'));
87
- console.log(chalk.blue.bold(' Test Generation Wizard'));
88
- console.log(chalk.blue('========================================'));
89
- console.log(chalk.gray('Generate tests with AI-powered assistance'));
90
- console.log(chalk.gray('Press Ctrl+C to cancel at any time'));
91
- console.log('');
92
- }
93
- /**
94
- * Step 1: Prompt for source files
95
- */
96
- async promptSourceFiles(rl) {
97
- console.log(chalk.cyan('Step 1/6: Source Files'));
98
- console.log(chalk.gray('Enter file paths, glob patterns, or directory'));
33
+ WizardPrompt.printStepHeader(this.stepNumber, this.title, this.description);
99
34
  console.log(chalk.gray('Examples: src/services/*.ts, ./src/utils, src/auth.ts'));
100
35
  console.log('');
101
- // Show available suggestions
102
- const suggestions = this.getSourceFileSuggestions();
36
+ // Show suggestions
37
+ const suggestions = WizardSuggestions.getTestSourceFiles(context.cwd);
103
38
  if (suggestions.length > 0) {
104
39
  console.log(chalk.yellow('Suggestions:'));
105
40
  suggestions.slice(0, 5).forEach((s, i) => {
@@ -107,247 +42,28 @@ export class TestGenerationWizard {
107
42
  });
108
43
  console.log('');
109
44
  }
110
- const defaultValue = this.options.defaultSourceFiles?.join(', ') || '.';
111
- const input = await this.prompt(rl, `Source files [${chalk.gray(defaultValue)}]: `);
45
+ const defaultValue = this.defaultSourceFiles.join(', ') || '.';
46
+ const input = await WizardPrompt.prompt(context.rl, `Source files [${chalk.gray(defaultValue)}]: `);
112
47
  const value = input.trim() || defaultValue;
113
48
  // Parse input into file list
114
- return this.resolveSourceFiles(value);
115
- }
116
- /**
117
- * Step 2: Prompt for test type
118
- */
119
- async promptTestType(rl) {
120
- console.log('');
121
- console.log(chalk.cyan('Step 2/6: Test Type'));
122
- console.log(chalk.gray('Select the type of tests to generate'));
123
- console.log('');
124
- const options = [
125
- { key: '1', value: 'unit', description: 'Unit tests - isolated component testing' },
126
- { key: '2', value: 'integration', description: 'Integration tests - module interaction testing' },
127
- { key: '3', value: 'e2e', description: 'End-to-end tests - full workflow testing' },
128
- { key: '4', value: 'property', description: 'Property-based tests - invariant testing' },
129
- { key: '5', value: 'contract', description: 'Contract tests - API contract validation' },
130
- ];
131
- options.forEach(opt => {
132
- const marker = opt.value === this.options.defaultTestType ? chalk.green(' (default)') : '';
133
- console.log(chalk.white(` ${opt.key}. ${opt.value}${marker}`));
134
- console.log(chalk.gray(` ${opt.description}`));
135
- });
136
- console.log('');
137
- const defaultValue = this.options.defaultTestType || 'unit';
138
- const input = await this.prompt(rl, `Select test type [${chalk.gray(defaultValue)}]: `);
139
- const value = input.trim();
140
- if (!value)
141
- return defaultValue;
142
- // Check if input is a number
143
- const numInput = parseInt(value, 10);
144
- if (numInput >= 1 && numInput <= options.length) {
145
- return options[numInput - 1].value;
146
- }
147
- // Check if input is a valid test type
148
- const validTypes = ['unit', 'integration', 'e2e', 'property', 'contract'];
149
- if (validTypes.includes(value)) {
150
- return value;
151
- }
152
- console.log(chalk.yellow(`Invalid input, using default: ${defaultValue}`));
153
- return defaultValue;
154
- }
155
- /**
156
- * Step 3: Prompt for coverage target
157
- */
158
- async promptCoverageTarget(rl) {
159
- console.log('');
160
- console.log(chalk.cyan('Step 3/6: Coverage Target'));
161
- console.log(chalk.gray('Target code coverage percentage (0-100)'));
162
- console.log(chalk.gray('Recommended: 80% for new code, 60% for legacy'));
163
- console.log('');
164
- const defaultValue = this.options.defaultCoverageTarget || 80;
165
- const input = await this.prompt(rl, `Coverage target % [${chalk.gray(defaultValue)}]: `);
166
- const value = input.trim();
167
- if (!value)
168
- return defaultValue;
169
- const numValue = parseInt(value, 10);
170
- if (isNaN(numValue) || numValue < 0 || numValue > 100) {
171
- console.log(chalk.yellow(`Invalid input, using default: ${defaultValue}%`));
172
- return defaultValue;
173
- }
174
- return numValue;
175
- }
176
- /**
177
- * Step 4: Prompt for test framework
178
- */
179
- async promptFramework(rl) {
180
- console.log('');
181
- console.log(chalk.cyan('Step 4/6: Test Framework'));
182
- console.log(chalk.gray('Select the testing framework to use'));
183
- console.log('');
184
- const options = [
185
- { key: '1', value: 'vitest', description: 'Vitest - Fast, Vite-native testing' },
186
- { key: '2', value: 'jest', description: 'Jest - Feature-rich, widely adopted' },
187
- { key: '3', value: 'mocha', description: 'Mocha - Flexible, configurable' },
188
- { key: '4', value: 'playwright', description: 'Playwright - Browser automation (for e2e)' },
189
- ];
190
- // Detect framework from project
191
- const detectedFramework = this.detectFramework();
192
- const defaultValue = this.options.defaultFramework || detectedFramework || 'vitest';
193
- options.forEach(opt => {
194
- const marker = opt.value === detectedFramework ? chalk.green(' (detected)') :
195
- opt.value === defaultValue ? chalk.gray(' (default)') : '';
196
- console.log(chalk.white(` ${opt.key}. ${opt.value}${marker}`));
197
- console.log(chalk.gray(` ${opt.description}`));
198
- });
199
- console.log('');
200
- const input = await this.prompt(rl, `Select framework [${chalk.gray(defaultValue)}]: `);
201
- const value = input.trim();
202
- if (!value)
203
- return defaultValue;
204
- // Check if input is a number
205
- const numInput = parseInt(value, 10);
206
- if (numInput >= 1 && numInput <= options.length) {
207
- return options[numInput - 1].value;
208
- }
209
- // Check if input is a valid framework
210
- const validFrameworks = ['jest', 'vitest', 'mocha', 'playwright'];
211
- if (validFrameworks.includes(value)) {
212
- return value;
213
- }
214
- console.log(chalk.yellow(`Invalid input, using default: ${defaultValue}`));
215
- return defaultValue;
216
- }
217
- /**
218
- * Step 5: Prompt for AI enhancement level
219
- */
220
- async promptAILevel(rl) {
221
- console.log('');
222
- console.log(chalk.cyan('Step 5/6: AI Enhancement Level'));
223
- console.log(chalk.gray('Select the level of AI assistance for test generation'));
224
- console.log('');
225
- const options = [
226
- { key: '1', value: 'none', description: 'None - Template-based generation only' },
227
- { key: '2', value: 'basic', description: 'Basic - Simple pattern matching' },
228
- { key: '3', value: 'standard', description: 'Standard - AI-powered test suggestions' },
229
- { key: '4', value: 'advanced', description: 'Advanced - Full AI with edge case generation' },
230
- ];
231
- const defaultValue = this.options.defaultAILevel || 'standard';
232
- options.forEach(opt => {
233
- const marker = opt.value === defaultValue ? chalk.green(' (recommended)') : '';
234
- console.log(chalk.white(` ${opt.key}. ${opt.value}${marker}`));
235
- console.log(chalk.gray(` ${opt.description}`));
236
- });
237
- console.log('');
238
- const input = await this.prompt(rl, `Select AI level [${chalk.gray(defaultValue)}]: `);
239
- const value = input.trim();
240
- if (!value)
241
- return defaultValue;
242
- // Check if input is a number
243
- const numInput = parseInt(value, 10);
244
- if (numInput >= 1 && numInput <= options.length) {
245
- return options[numInput - 1].value;
246
- }
247
- // Check if input is a valid level
248
- const validLevels = ['none', 'basic', 'standard', 'advanced'];
249
- if (validLevels.includes(value)) {
250
- return value;
251
- }
252
- console.log(chalk.yellow(`Invalid input, using default: ${defaultValue}`));
253
- return defaultValue;
254
- }
255
- /**
256
- * Step 6: Prompt for anti-pattern detection
257
- */
258
- async promptAntiPatternDetection(rl) {
259
- console.log('');
260
- console.log(chalk.cyan('Step 6/6: Anti-Pattern Detection'));
261
- console.log(chalk.gray('Enable detection and avoidance of code anti-patterns'));
262
- console.log('');
263
- const input = await this.prompt(rl, `Enable anti-pattern detection? [${chalk.gray('Y/n')}]: `);
264
- const value = input.trim().toLowerCase();
265
- if (value === 'n' || value === 'no') {
266
- return false;
267
- }
268
- return true; // Default to yes
269
- }
270
- /**
271
- * Prompt for final confirmation
272
- */
273
- async promptConfirmation(rl) {
274
- console.log('');
275
- const input = await this.prompt(rl, `${chalk.green('Proceed with test generation?')} [${chalk.gray('Y/n')}]: `);
276
- const value = input.trim().toLowerCase();
277
- if (value === 'n' || value === 'no') {
278
- console.log(chalk.yellow('\nWizard cancelled.'));
279
- return false;
49
+ const files = this.resolveSourceFiles(value, context.cwd);
50
+ if (files.length === 0) {
51
+ console.log(chalk.yellow(' No matching files found, using provided patterns'));
52
+ return this.success(value.split(',').map(p => p.trim()).filter(p => p.length > 0));
280
53
  }
281
- return true;
282
- }
283
- /**
284
- * Print configuration summary
285
- */
286
- printSummary(result) {
287
- console.log('');
288
- console.log(chalk.blue('========================================'));
289
- console.log(chalk.blue.bold(' Configuration Summary'));
290
- console.log(chalk.blue('========================================'));
291
- console.log('');
292
- console.log(chalk.white(' Source Files:'));
293
- result.sourceFiles.slice(0, 5).forEach(f => {
294
- const relativePath = relative(this.cwd, f);
295
- console.log(chalk.gray(` - ${relativePath || f}`));
296
- });
297
- if (result.sourceFiles.length > 5) {
298
- console.log(chalk.gray(` ... and ${result.sourceFiles.length - 5} more`));
299
- }
300
- console.log('');
301
- console.log(chalk.white(` Test Type: ${chalk.cyan(result.testType)}`));
302
- console.log(chalk.white(` Coverage Target: ${chalk.cyan(result.coverageTarget + '%')}`));
303
- console.log(chalk.white(` Framework: ${chalk.cyan(result.framework)}`));
304
- console.log(chalk.white(` AI Enhancement: ${chalk.cyan(result.aiLevel)}`));
305
- console.log(chalk.white(` Anti-Patterns: ${chalk.cyan(result.detectAntiPatterns ? 'Enabled' : 'Disabled')}`));
306
- console.log('');
307
- }
308
- /**
309
- * Generic prompt helper
310
- */
311
- prompt(rl, question) {
312
- return new Promise(resolve => {
313
- rl.question(question, answer => {
314
- resolve(answer);
315
- });
316
- });
317
- }
318
- /**
319
- * Get source file suggestions based on project structure
320
- */
321
- getSourceFileSuggestions() {
322
- const suggestions = [];
323
- // Check common directories
324
- const commonDirs = ['src', 'lib', 'app', 'packages'];
325
- for (const dir of commonDirs) {
326
- const dirPath = join(this.cwd, dir);
327
- if (existsSync(dirPath) && statSync(dirPath).isDirectory()) {
328
- suggestions.push(`${dir}/**/*.ts`);
329
- suggestions.push(dir);
330
- }
331
- }
332
- // Add specific patterns for TypeScript projects
333
- if (existsSync(join(this.cwd, 'src'))) {
334
- suggestions.push('src/services/**/*.ts');
335
- suggestions.push('src/utils/**/*.ts');
336
- suggestions.push('src/components/**/*.tsx');
337
- }
338
- return suggestions;
54
+ return this.success(files);
339
55
  }
340
56
  /**
341
57
  * Resolve source files from input (glob patterns, directories, files)
342
58
  * Security: Validates that resolved paths stay within project directory to prevent path traversal
343
59
  */
344
- resolveSourceFiles(input) {
60
+ resolveSourceFiles(input, cwd) {
345
61
  const files = [];
346
62
  const parts = input.split(',').map(p => p.trim()).filter(p => p.length > 0);
347
63
  // Normalize cwd for consistent comparison (resolve removes trailing slashes and normalizes)
348
- const normalizedCwd = resolve(this.cwd);
64
+ const normalizedCwd = resolve(cwd);
349
65
  for (const part of parts) {
350
- const resolved = resolve(this.cwd, part);
66
+ const resolved = resolve(cwd, part);
351
67
  // Security: Prevent path traversal - ensure resolved path is within project directory
352
68
  if (!resolved.startsWith(normalizedCwd + '/') && resolved !== normalizedCwd) {
353
69
  console.warn(`Warning: Skipping path outside project directory: ${part}`);
@@ -366,7 +82,7 @@ export class TestGenerationWizard {
366
82
  }
367
83
  else if (part.includes('*')) {
368
84
  // Handle glob pattern - for now, just expand common patterns
369
- const baseDir = resolve(this.cwd, part.split('*')[0]);
85
+ const baseDir = resolve(cwd, part.split('*')[0]);
370
86
  // Security: Validate glob base directory is within project
371
87
  if (!baseDir.startsWith(normalizedCwd + '/') && baseDir !== normalizedCwd) {
372
88
  console.warn(`Warning: Skipping glob pattern outside project directory: ${part}`);
@@ -431,12 +147,64 @@ export class TestGenerationWizard {
431
147
  }
432
148
  return files;
433
149
  }
150
+ }
151
+ // ============================================================================
152
+ // Framework Detection Step (Custom)
153
+ // ============================================================================
154
+ /**
155
+ * Custom step for framework selection with auto-detection
156
+ */
157
+ class FrameworkSelectStep extends SingleSelectStep {
158
+ cwd;
159
+ constructor(defaultFramework, cwd) {
160
+ const detectedFramework = FrameworkSelectStep.detectFramework(cwd);
161
+ const effectiveDefault = defaultFramework || detectedFramework || 'vitest';
162
+ super({
163
+ id: 'framework',
164
+ stepNumber: '4/6',
165
+ title: 'Test Framework',
166
+ description: 'Select the testing framework to use',
167
+ options: [
168
+ {
169
+ key: '1',
170
+ value: 'vitest',
171
+ label: 'vitest',
172
+ description: 'Vitest - Fast, Vite-native testing',
173
+ isRecommended: detectedFramework === 'vitest',
174
+ },
175
+ {
176
+ key: '2',
177
+ value: 'jest',
178
+ label: 'jest',
179
+ description: 'Jest - Feature-rich, widely adopted',
180
+ isRecommended: detectedFramework === 'jest',
181
+ },
182
+ {
183
+ key: '3',
184
+ value: 'mocha',
185
+ label: 'mocha',
186
+ description: 'Mocha - Flexible, configurable',
187
+ isRecommended: detectedFramework === 'mocha',
188
+ },
189
+ {
190
+ key: '4',
191
+ value: 'playwright',
192
+ label: 'playwright',
193
+ description: 'Playwright - Browser automation (for e2e)',
194
+ isRecommended: detectedFramework === 'playwright',
195
+ },
196
+ ],
197
+ defaultValue: effectiveDefault,
198
+ validValues: ['jest', 'vitest', 'mocha', 'playwright'],
199
+ });
200
+ this.cwd = cwd;
201
+ }
434
202
  /**
435
203
  * Detect test framework from project configuration
436
204
  * Security: Uses fs.readFileSync instead of require() to prevent code execution
437
205
  */
438
- detectFramework() {
439
- const packageJsonPath = join(this.cwd, 'package.json');
206
+ static detectFramework(cwd) {
207
+ const packageJsonPath = join(cwd, 'package.json');
440
208
  if (!existsSync(packageJsonPath)) {
441
209
  return null;
442
210
  }
@@ -458,20 +226,123 @@ export class TestGenerationWizard {
458
226
  // Ignore errors (file read or JSON parse failures)
459
227
  }
460
228
  // Check for config files
461
- if (existsSync(join(this.cwd, 'vitest.config.ts')) || existsSync(join(this.cwd, 'vitest.config.js'))) {
229
+ if (existsSync(join(cwd, 'vitest.config.ts')) || existsSync(join(cwd, 'vitest.config.js'))) {
462
230
  return 'vitest';
463
231
  }
464
- if (existsSync(join(this.cwd, 'jest.config.ts')) || existsSync(join(this.cwd, 'jest.config.js'))) {
232
+ if (existsSync(join(cwd, 'jest.config.ts')) || existsSync(join(cwd, 'jest.config.js'))) {
465
233
  return 'jest';
466
234
  }
467
- if (existsSync(join(this.cwd, 'playwright.config.ts')) || existsSync(join(this.cwd, 'playwright.config.js'))) {
235
+ if (existsSync(join(cwd, 'playwright.config.ts')) || existsSync(join(cwd, 'playwright.config.js'))) {
468
236
  return 'playwright';
469
237
  }
470
238
  return null;
471
239
  }
472
- /**
473
- * Get default result for non-interactive mode
474
- */
240
+ }
241
+ // ============================================================================
242
+ // Wizard Implementation
243
+ // ============================================================================
244
+ export class TestGenerationWizard extends BaseWizard {
245
+ constructor(options = {}) {
246
+ super(options);
247
+ }
248
+ getTitle() {
249
+ return 'Test Generation Wizard';
250
+ }
251
+ getSubtitle() {
252
+ return 'Generate tests with AI-powered assistance';
253
+ }
254
+ getConfirmationPrompt() {
255
+ return 'Proceed with test generation?';
256
+ }
257
+ isNonInteractive() {
258
+ return this.options.nonInteractive ?? false;
259
+ }
260
+ getCommands() {
261
+ return [
262
+ // Step 1: Source files
263
+ new SourceFilesStep(this.options.defaultSourceFiles || ['.']),
264
+ // Step 2: Test type
265
+ new SingleSelectStep({
266
+ id: 'testType',
267
+ stepNumber: '2/6',
268
+ title: 'Test Type',
269
+ description: 'Select the type of tests to generate',
270
+ options: [
271
+ { key: '1', value: 'unit', label: 'unit', description: 'Unit tests - isolated component testing' },
272
+ { key: '2', value: 'integration', label: 'integration', description: 'Integration tests - module interaction testing' },
273
+ { key: '3', value: 'e2e', label: 'e2e', description: 'End-to-end tests - full workflow testing' },
274
+ { key: '4', value: 'property', label: 'property', description: 'Property-based tests - invariant testing' },
275
+ { key: '5', value: 'contract', label: 'contract', description: 'Contract tests - API contract validation' },
276
+ ],
277
+ defaultValue: this.options.defaultTestType || 'unit',
278
+ validValues: ['unit', 'integration', 'e2e', 'property', 'contract'],
279
+ }),
280
+ // Step 3: Coverage target
281
+ new NumericStep({
282
+ id: 'coverageTarget',
283
+ stepNumber: '3/6',
284
+ title: 'Coverage target %',
285
+ description: 'Target code coverage percentage (0-100). Recommended: 80% for new code, 60% for legacy.',
286
+ defaultValue: this.options.defaultCoverageTarget || 80,
287
+ min: 0,
288
+ max: 100,
289
+ }),
290
+ // Step 4: Framework
291
+ new FrameworkSelectStep(this.options.defaultFramework, this.cwd),
292
+ // Step 5: AI enhancement level
293
+ new SingleSelectStep({
294
+ id: 'aiLevel',
295
+ stepNumber: '5/6',
296
+ title: 'AI Enhancement Level',
297
+ description: 'Select the level of AI assistance for test generation',
298
+ options: [
299
+ { key: '1', value: 'none', label: 'none', description: 'None - Template-based generation only' },
300
+ { key: '2', value: 'basic', label: 'basic', description: 'Basic - Simple pattern matching' },
301
+ { key: '3', value: 'standard', label: 'standard', description: 'Standard - AI-powered test suggestions', isRecommended: true },
302
+ { key: '4', value: 'advanced', label: 'advanced', description: 'Advanced - Full AI with edge case generation' },
303
+ ],
304
+ defaultValue: this.options.defaultAILevel || 'standard',
305
+ validValues: ['none', 'basic', 'standard', 'advanced'],
306
+ }),
307
+ // Step 6: Anti-pattern detection
308
+ new BooleanStep({
309
+ id: 'detectAntiPatterns',
310
+ stepNumber: '6/6',
311
+ title: 'Enable anti-pattern detection',
312
+ description: 'Enable detection and avoidance of code anti-patterns',
313
+ defaultValue: true,
314
+ }),
315
+ ];
316
+ }
317
+ buildResult(results) {
318
+ return {
319
+ sourceFiles: results.sourceFiles,
320
+ testType: results.testType,
321
+ coverageTarget: results.coverageTarget,
322
+ framework: results.framework,
323
+ aiLevel: results.aiLevel,
324
+ detectAntiPatterns: results.detectAntiPatterns,
325
+ cancelled: false,
326
+ };
327
+ }
328
+ printSummary(result) {
329
+ WizardPrompt.printSummaryHeader();
330
+ console.log(chalk.white(' Source Files:'));
331
+ result.sourceFiles.slice(0, 5).forEach(f => {
332
+ const relativePath = relative(this.cwd, f);
333
+ console.log(chalk.gray(` - ${relativePath || f}`));
334
+ });
335
+ if (result.sourceFiles.length > 5) {
336
+ console.log(chalk.gray(` ... and ${result.sourceFiles.length - 5} more`));
337
+ }
338
+ console.log('');
339
+ WizardPrompt.printSummaryField('Test Type', result.testType);
340
+ WizardPrompt.printSummaryField('Coverage Target', WizardFormat.percentage(result.coverageTarget));
341
+ WizardPrompt.printSummaryField('Framework', result.framework);
342
+ WizardPrompt.printSummaryField('AI Enhancement', result.aiLevel);
343
+ WizardPrompt.printSummaryField('Anti-Patterns', WizardFormat.enabledDisabled(result.detectAntiPatterns));
344
+ console.log('');
345
+ }
475
346
  getDefaults() {
476
347
  return {
477
348
  sourceFiles: this.options.defaultSourceFiles || ['.'],
@@ -483,9 +354,6 @@ export class TestGenerationWizard {
483
354
  cancelled: false,
484
355
  };
485
356
  }
486
- /**
487
- * Get cancelled result
488
- */
489
357
  getCancelled() {
490
358
  return {
491
359
  sourceFiles: [],