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,13 +3,10 @@
3
3
  * ADR-041: V3 QE CLI Enhancement
4
4
  *
5
5
  * Interactive wizard for security scanning with step-by-step configuration.
6
- * Prompts for target directory, scan types, compliance frameworks, severity level,
7
- * fix suggestions, and report format.
6
+ * Refactored to use Command Pattern for reduced complexity and better reusability.
8
7
  */
9
- import { createInterface } from 'readline';
10
8
  import chalk from 'chalk';
11
- import { existsSync, statSync } from 'fs';
12
- import { join, resolve, relative } from 'path';
9
+ import { BaseWizard, BaseWizardCommand, SingleSelectStep, MultiSelectStep, BooleanStep, PathInputStep, WizardPrompt, WizardFormat, WizardSuggestions, } from './core/index.js';
13
10
  // ============================================================================
14
11
  // Scan Type Configuration
15
12
  // ============================================================================
@@ -82,305 +79,36 @@ const SEVERITY_CONFIG = {
82
79
  },
83
80
  };
84
81
  // ============================================================================
85
- // Wizard Implementation
82
+ // Custom Report Step
86
83
  // ============================================================================
87
- export class SecurityScanWizard {
88
- options;
89
- cwd;
90
- constructor(options = {}) {
91
- this.options = options;
92
- this.cwd = process.cwd();
93
- }
94
- /**
95
- * Run the interactive wizard
96
- */
97
- async run() {
98
- // Non-interactive mode returns defaults
99
- if (this.options.nonInteractive) {
100
- return this.getDefaults();
101
- }
102
- const rl = createInterface({
103
- input: process.stdin,
104
- output: process.stdout,
105
- });
106
- try {
107
- // Print header
108
- this.printHeader();
109
- // Step 1: Target directory
110
- const target = await this.promptTarget(rl);
111
- if (!target) {
112
- return this.getCancelled();
113
- }
114
- // Step 2: Scan types
115
- const scanTypes = await this.promptScanTypes(rl);
116
- if (scanTypes.length === 0) {
117
- return this.getCancelled();
118
- }
119
- // Step 3: Compliance frameworks
120
- const complianceFrameworks = await this.promptComplianceFrameworks(rl);
121
- // Step 4: Minimum severity level
122
- const severity = await this.promptSeverity(rl);
123
- // Step 5: Include fix suggestions
124
- const includeFixes = await this.promptIncludeFixes(rl);
125
- // Step 6: Generate report
126
- const { generateReport, reportFormat } = await this.promptReport(rl);
127
- // Print summary
128
- const result = {
129
- target,
130
- scanTypes,
131
- complianceFrameworks,
132
- severity,
133
- includeFixes,
134
- generateReport,
135
- reportFormat,
136
- cancelled: false,
137
- };
138
- this.printSummary(result);
139
- // Confirm
140
- const confirmed = await this.promptConfirmation(rl);
141
- if (!confirmed) {
142
- return this.getCancelled();
143
- }
144
- return result;
145
- }
146
- finally {
147
- rl.close();
148
- }
149
- }
150
- /**
151
- * Print wizard header
152
- */
153
- printHeader() {
154
- console.log('');
155
- console.log(chalk.blue('========================================'));
156
- console.log(chalk.blue.bold(' Security Scan Wizard'));
157
- console.log(chalk.blue('========================================'));
158
- console.log(chalk.gray('Comprehensive security scanning with SAST/DAST'));
159
- console.log(chalk.gray('Press Ctrl+C to cancel at any time'));
160
- console.log('');
161
- }
162
- /**
163
- * Step 1: Prompt for target directory/file
164
- */
165
- async promptTarget(rl) {
166
- console.log(chalk.cyan('Step 1/6: Target Directory'));
167
- console.log(chalk.gray('Enter the directory or file to scan for security issues'));
168
- console.log(chalk.gray('Examples: src/, ./lib, package.json'));
169
- console.log('');
170
- // Show suggestions
171
- const suggestions = this.getTargetSuggestions();
172
- if (suggestions.length > 0) {
173
- console.log(chalk.yellow('Detected directories:'));
174
- suggestions.slice(0, 5).forEach((s, i) => {
175
- console.log(chalk.gray(` ${i + 1}. ${s}`));
176
- });
177
- console.log('');
178
- }
179
- const defaultValue = this.options.defaultTarget || '.';
180
- const input = await this.prompt(rl, `Target directory [${chalk.gray(defaultValue)}]: `);
181
- const value = input.trim() || defaultValue;
182
- // Resolve and validate the path
183
- const resolved = resolve(this.cwd, value);
184
- if (!existsSync(resolved)) {
185
- console.log(chalk.yellow(` Warning: '${value}' does not exist, using current directory.`));
186
- return this.cwd;
187
- }
188
- return resolved;
189
- }
190
- /**
191
- * Step 2: Prompt for scan types (multi-select)
192
- */
193
- async promptScanTypes(rl) {
194
- console.log('');
195
- console.log(chalk.cyan('Step 2/6: Scan Types'));
196
- console.log(chalk.gray('Select scan types to perform (comma-separated numbers or names)'));
197
- console.log(chalk.gray('Example: 1,2,3 or sast,dependency,secret'));
198
- console.log('');
199
- const options = [
200
- { key: '1', value: 'sast' },
201
- { key: '2', value: 'dast' },
202
- { key: '3', value: 'dependency' },
203
- { key: '4', value: 'secret' },
204
- ];
205
- const defaultValue = this.options.defaultScanTypes || ['sast', 'dependency', 'secret'];
206
- options.forEach(opt => {
207
- const config = SCAN_TYPE_CONFIG[opt.value];
208
- const isDefault = defaultValue.includes(opt.value);
209
- const marker = isDefault ? chalk.green(' *') : '';
210
- console.log(chalk.white(` ${opt.key}. ${opt.value}${marker}`));
211
- console.log(chalk.gray(` ${config.name}`));
212
- console.log(chalk.gray(` ${config.description}`));
213
- });
214
- console.log('');
215
- console.log(chalk.gray(' * = included in default selection'));
216
- console.log('');
217
- const input = await this.prompt(rl, `Select scan types [${chalk.gray(defaultValue.join(','))}]: `);
218
- const value = input.trim();
219
- if (!value)
220
- return defaultValue;
221
- // Parse input - can be numbers or names
222
- const parts = value.split(',').map(p => p.trim().toLowerCase()).filter(p => p.length > 0);
223
- const result = [];
224
- for (const part of parts) {
225
- const numInput = parseInt(part, 10);
226
- if (numInput >= 1 && numInput <= options.length) {
227
- result.push(options[numInput - 1].value);
228
- }
229
- else {
230
- const validTypes = ['sast', 'dast', 'dependency', 'secret'];
231
- if (validTypes.includes(part)) {
232
- result.push(part);
233
- }
234
- }
235
- }
236
- if (result.length === 0) {
237
- console.log(chalk.yellow(` Invalid input, using default: ${defaultValue.join(',')}`));
238
- return defaultValue;
239
- }
240
- // Remove duplicates
241
- return [...new Set(result)];
242
- }
243
- /**
244
- * Step 3: Prompt for compliance frameworks (multi-select)
245
- */
246
- async promptComplianceFrameworks(rl) {
247
- console.log('');
248
- console.log(chalk.cyan('Step 3/6: Compliance Frameworks'));
249
- console.log(chalk.gray('Select compliance frameworks to check against (comma-separated)'));
250
- console.log(chalk.gray('Leave blank to skip compliance checking'));
251
- console.log('');
252
- const options = [
253
- { key: '1', value: 'owasp' },
254
- { key: '2', value: 'gdpr' },
255
- { key: '3', value: 'hipaa' },
256
- { key: '4', value: 'soc2' },
257
- { key: '5', value: 'pci-dss' },
258
- { key: '6', value: 'ccpa' },
259
- ];
260
- const defaultValue = this.options.defaultComplianceFrameworks || ['owasp'];
261
- options.forEach(opt => {
262
- const config = COMPLIANCE_CONFIG[opt.value];
263
- const isDefault = defaultValue.includes(opt.value);
264
- const marker = isDefault ? chalk.green(' *') : '';
265
- console.log(chalk.white(` ${opt.key}. ${opt.value}${marker}`));
266
- console.log(chalk.gray(` ${config.name} - ${config.description}`));
267
- });
268
- console.log('');
269
- console.log(chalk.gray(' * = included in default selection'));
270
- console.log('');
271
- const input = await this.prompt(rl, `Select frameworks [${chalk.gray(defaultValue.join(','))}]: `);
272
- const value = input.trim();
273
- if (!value)
274
- return defaultValue;
275
- // Handle 'none' or empty explicitly
276
- if (value.toLowerCase() === 'none' || value === '-') {
277
- return [];
278
- }
279
- // Parse input - can be numbers or names
280
- const parts = value.split(',').map(p => p.trim().toLowerCase()).filter(p => p.length > 0);
281
- const result = [];
282
- for (const part of parts) {
283
- const numInput = parseInt(part, 10);
284
- if (numInput >= 1 && numInput <= options.length) {
285
- result.push(options[numInput - 1].value);
286
- }
287
- else {
288
- const validFrameworks = ['owasp', 'gdpr', 'hipaa', 'soc2', 'pci-dss', 'ccpa'];
289
- if (validFrameworks.includes(part)) {
290
- result.push(part);
291
- }
292
- }
293
- }
294
- if (result.length === 0) {
295
- console.log(chalk.yellow(` Invalid input, using default: ${defaultValue.join(',')}`));
296
- return defaultValue;
297
- }
298
- // Remove duplicates
299
- return [...new Set(result)];
300
- }
301
- /**
302
- * Step 4: Prompt for minimum severity level
303
- */
304
- async promptSeverity(rl) {
305
- console.log('');
306
- console.log(chalk.cyan('Step 4/6: Minimum Severity Level'));
307
- console.log(chalk.gray('Select the minimum severity level to report'));
308
- console.log(chalk.gray('Issues below this level will be filtered out'));
309
- console.log('');
310
- const options = [
311
- { key: '1', value: 'critical' },
312
- { key: '2', value: 'high' },
313
- { key: '3', value: 'medium' },
314
- { key: '4', value: 'low' },
315
- ];
316
- const defaultValue = this.options.defaultSeverity || 'medium';
317
- options.forEach(opt => {
318
- const config = SEVERITY_CONFIG[opt.value];
319
- const marker = opt.value === defaultValue ? chalk.green(' (default)') : '';
320
- console.log(chalk.white(` ${opt.key}. ${opt.value}${marker}`));
321
- console.log(chalk.gray(` ${config.description}`));
322
- });
323
- console.log('');
324
- const input = await this.prompt(rl, `Select severity level [${chalk.gray(defaultValue)}]: `);
325
- const value = input.trim().toLowerCase();
326
- if (!value)
327
- return defaultValue;
328
- // Check if input is a number
329
- const numInput = parseInt(value, 10);
330
- if (numInput >= 1 && numInput <= options.length) {
331
- return options[numInput - 1].value;
332
- }
333
- // Check if input is a valid severity
334
- const validLevels = ['critical', 'high', 'medium', 'low'];
335
- if (validLevels.includes(value)) {
336
- return value;
337
- }
338
- console.log(chalk.yellow(` Invalid input, using default: ${defaultValue}`));
339
- return defaultValue;
84
+ /**
85
+ * Custom step for report generation with conditional format selection
86
+ */
87
+ class ReportStep extends BaseWizardCommand {
88
+ id = 'report';
89
+ stepNumber;
90
+ title = 'Report Generation';
91
+ description = 'Generate a detailed security report';
92
+ defaultGenerate;
93
+ defaultFormat;
94
+ constructor(stepNumber, defaultGenerate, defaultFormat) {
95
+ super({ generateReport: defaultGenerate, reportFormat: defaultFormat });
96
+ this.stepNumber = stepNumber;
97
+ this.defaultGenerate = defaultGenerate;
98
+ this.defaultFormat = defaultFormat;
340
99
  }
341
- /**
342
- * Step 5: Prompt for include fix suggestions
343
- */
344
- async promptIncludeFixes(rl) {
345
- console.log('');
346
- console.log(chalk.cyan('Step 5/6: Fix Suggestions'));
347
- console.log(chalk.gray('Include automated fix suggestions for detected vulnerabilities'));
348
- console.log(chalk.gray('Fixes may include code patches, dependency updates, or configuration changes'));
349
- console.log('');
350
- const defaultValue = this.options.defaultIncludeFixes !== undefined
351
- ? this.options.defaultIncludeFixes
352
- : true;
353
- const defaultStr = defaultValue ? 'Y/n' : 'y/N';
354
- const input = await this.prompt(rl, `Include fix suggestions? [${chalk.gray(defaultStr)}]: `);
355
- const value = input.trim().toLowerCase();
356
- if (value === '') {
357
- return defaultValue;
100
+ async execute(context) {
101
+ if (context.nonInteractive) {
102
+ return this.success({ generateReport: this.defaultGenerate, reportFormat: this.defaultFormat });
358
103
  }
359
- if (value === 'n' || value === 'no') {
360
- return false;
361
- }
362
- if (value === 'y' || value === 'yes') {
363
- return true;
364
- }
365
- return defaultValue;
366
- }
367
- /**
368
- * Step 6: Prompt for report generation
369
- */
370
- async promptReport(rl) {
371
- console.log('');
372
- console.log(chalk.cyan('Step 6/6: Report Generation'));
373
- console.log(chalk.gray('Generate a detailed security report'));
374
- console.log('');
375
- const defaultGenerate = this.options.defaultGenerateReport !== undefined
376
- ? this.options.defaultGenerateReport
377
- : true;
378
- const generateStr = defaultGenerate ? 'Y/n' : 'y/N';
379
- const generateInput = await this.prompt(rl, `Generate report? [${chalk.gray(generateStr)}]: `);
104
+ WizardPrompt.printStepHeader(this.stepNumber, this.title, this.description);
105
+ // First, ask if they want to generate a report
106
+ const generateStr = this.defaultGenerate ? 'Y/n' : 'y/N';
107
+ const generateInput = await WizardPrompt.prompt(context.rl, `Generate report? [${chalk.gray(generateStr)}]: `);
380
108
  const generateValue = generateInput.trim().toLowerCase();
381
109
  let generateReport;
382
110
  if (generateValue === '') {
383
- generateReport = defaultGenerate;
111
+ generateReport = this.defaultGenerate;
384
112
  }
385
113
  else if (generateValue === 'n' || generateValue === 'no') {
386
114
  generateReport = false;
@@ -389,14 +117,11 @@ export class SecurityScanWizard {
389
117
  generateReport = true;
390
118
  }
391
119
  else {
392
- generateReport = defaultGenerate;
120
+ generateReport = this.defaultGenerate;
393
121
  }
394
122
  // If not generating report, return default format
395
123
  if (!generateReport) {
396
- return {
397
- generateReport: false,
398
- reportFormat: this.options.defaultReportFormat || 'json',
399
- };
124
+ return this.success({ generateReport: false, reportFormat: this.defaultFormat });
400
125
  }
401
126
  // Prompt for format
402
127
  console.log('');
@@ -407,75 +132,159 @@ export class SecurityScanWizard {
407
132
  { key: '3', value: 'markdown', description: 'Markdown - Documentation-friendly' },
408
133
  { key: '4', value: 'text', description: 'Text - Simple console output' },
409
134
  ];
410
- const defaultFormat = this.options.defaultReportFormat || 'json';
411
135
  formatOptions.forEach(opt => {
412
- const marker = opt.value === defaultFormat ? chalk.green(' (default)') : '';
136
+ const marker = opt.value === this.defaultFormat ? chalk.green(' (default)') : '';
413
137
  console.log(chalk.white(` ${opt.key}. ${opt.value}${marker}`));
414
138
  console.log(chalk.gray(` ${opt.description}`));
415
139
  });
416
140
  console.log('');
417
- const formatInput = await this.prompt(rl, `Select format [${chalk.gray(defaultFormat)}]: `);
141
+ const formatInput = await WizardPrompt.prompt(context.rl, `Select format [${chalk.gray(this.defaultFormat)}]: `);
418
142
  const formatValue = formatInput.trim().toLowerCase();
419
143
  let reportFormat;
420
144
  if (!formatValue) {
421
- reportFormat = defaultFormat;
145
+ reportFormat = this.defaultFormat;
422
146
  }
423
147
  else {
424
- // Check if input is a number
425
148
  const numInput = parseInt(formatValue, 10);
426
149
  if (numInput >= 1 && numInput <= formatOptions.length) {
427
150
  reportFormat = formatOptions[numInput - 1].value;
428
151
  }
429
152
  else {
430
- // Check if input is a valid format
431
153
  const validFormats = ['json', 'html', 'markdown', 'text'];
432
154
  if (validFormats.includes(formatValue)) {
433
155
  reportFormat = formatValue;
434
156
  }
435
157
  else {
436
- console.log(chalk.yellow(` Invalid input, using default: ${defaultFormat}`));
437
- reportFormat = defaultFormat;
158
+ console.log(chalk.yellow(` Invalid input, using default: ${this.defaultFormat}`));
159
+ reportFormat = this.defaultFormat;
438
160
  }
439
161
  }
440
162
  }
441
- return { generateReport, reportFormat };
163
+ return this.success({ generateReport, reportFormat });
442
164
  }
443
- /**
444
- * Prompt for final confirmation
445
- */
446
- async promptConfirmation(rl) {
447
- console.log('');
448
- const input = await this.prompt(rl, `${chalk.green('Proceed with security scan?')} [${chalk.gray('Y/n')}]: `);
449
- const value = input.trim().toLowerCase();
450
- if (value === 'n' || value === 'no') {
451
- console.log(chalk.yellow('\nWizard cancelled.'));
452
- return false;
453
- }
454
- return true;
165
+ }
166
+ // ============================================================================
167
+ // Wizard Implementation
168
+ // ============================================================================
169
+ export class SecurityScanWizard extends BaseWizard {
170
+ constructor(options = {}) {
171
+ super(options);
172
+ }
173
+ getTitle() {
174
+ return 'Security Scan Wizard';
175
+ }
176
+ getSubtitle() {
177
+ return 'Comprehensive security scanning with SAST/DAST';
178
+ }
179
+ getConfirmationPrompt() {
180
+ return 'Proceed with security scan?';
181
+ }
182
+ isNonInteractive() {
183
+ return this.options.nonInteractive ?? false;
184
+ }
185
+ getCommands() {
186
+ return [
187
+ // Step 1: Target directory
188
+ new PathInputStep({
189
+ id: 'target',
190
+ stepNumber: '1/6',
191
+ title: 'Target Directory',
192
+ description: 'Enter the directory or file to scan for security issues',
193
+ examples: 'src/, ./lib, package.json',
194
+ defaultValue: this.options.defaultTarget || '.',
195
+ suggestionsProvider: WizardSuggestions.getSecurityTargets,
196
+ validatePath: true,
197
+ }),
198
+ // Step 2: Scan types
199
+ new MultiSelectStep({
200
+ id: 'scanTypes',
201
+ stepNumber: '2/6',
202
+ title: 'Scan Types',
203
+ description: 'Select scan types to perform (comma-separated numbers or names)',
204
+ instructions: 'Example: 1,2,3 or sast,dependency,secret',
205
+ options: Object.entries(SCAN_TYPE_CONFIG).map(([value, config], index) => ({
206
+ key: String(index + 1),
207
+ value: value,
208
+ label: value,
209
+ description: `${config.name}\n ${config.description}`,
210
+ })),
211
+ defaultValue: this.options.defaultScanTypes || ['sast', 'dependency', 'secret'],
212
+ validValues: ['sast', 'dast', 'dependency', 'secret'],
213
+ }),
214
+ // Step 3: Compliance frameworks
215
+ new MultiSelectStep({
216
+ id: 'complianceFrameworks',
217
+ stepNumber: '3/6',
218
+ title: 'Compliance Frameworks',
219
+ description: 'Select compliance frameworks to check against (comma-separated)',
220
+ instructions: 'Leave blank to skip compliance checking',
221
+ options: Object.entries(COMPLIANCE_CONFIG).map(([value, config], index) => ({
222
+ key: String(index + 1),
223
+ value: value,
224
+ label: value,
225
+ description: `${config.name} - ${config.description}`,
226
+ })),
227
+ defaultValue: this.options.defaultComplianceFrameworks || ['owasp'],
228
+ validValues: ['owasp', 'gdpr', 'hipaa', 'soc2', 'pci-dss', 'ccpa'],
229
+ allowEmpty: true,
230
+ }),
231
+ // Step 4: Severity level
232
+ new SingleSelectStep({
233
+ id: 'severity',
234
+ stepNumber: '4/6',
235
+ title: 'Minimum Severity Level',
236
+ description: 'Select the minimum severity level to report. Issues below this level will be filtered out.',
237
+ options: Object.entries(SEVERITY_CONFIG).map(([value, config], index) => ({
238
+ key: String(index + 1),
239
+ value: value,
240
+ label: value,
241
+ description: config.description,
242
+ })),
243
+ defaultValue: this.options.defaultSeverity || 'medium',
244
+ validValues: ['critical', 'high', 'medium', 'low'],
245
+ }),
246
+ // Step 5: Include fix suggestions
247
+ new BooleanStep({
248
+ id: 'includeFixes',
249
+ stepNumber: '5/6',
250
+ title: 'Include fix suggestions',
251
+ description: 'Include automated fix suggestions for detected vulnerabilities',
252
+ additionalInfo: 'Fixes may include code patches, dependency updates, or configuration changes',
253
+ defaultValue: this.options.defaultIncludeFixes ?? true,
254
+ }),
255
+ // Step 6: Report generation
256
+ new ReportStep('6/6', this.options.defaultGenerateReport ?? true, this.options.defaultReportFormat || 'json'),
257
+ ];
258
+ }
259
+ buildResult(results) {
260
+ const reportResult = results.report;
261
+ return {
262
+ target: results.target,
263
+ scanTypes: results.scanTypes,
264
+ complianceFrameworks: results.complianceFrameworks,
265
+ severity: results.severity,
266
+ includeFixes: results.includeFixes,
267
+ generateReport: reportResult.generateReport,
268
+ reportFormat: reportResult.reportFormat,
269
+ cancelled: false,
270
+ };
455
271
  }
456
- /**
457
- * Print configuration summary
458
- */
459
272
  printSummary(result) {
460
- console.log('');
461
- console.log(chalk.blue('========================================'));
462
- console.log(chalk.blue.bold(' Configuration Summary'));
463
- console.log(chalk.blue('========================================'));
464
- console.log('');
465
- const relativePath = relative(this.cwd, result.target) || '.';
466
- console.log(chalk.white(` Target: ${chalk.cyan(relativePath)}`));
467
- console.log(chalk.white(` Scan Types: ${chalk.cyan(result.scanTypes.join(', '))}`));
273
+ WizardPrompt.printSummaryHeader();
274
+ const relativePath = WizardFormat.relativePath(result.target, this.cwd);
275
+ WizardPrompt.printSummaryField('Target', relativePath);
276
+ WizardPrompt.printSummaryField('Scan Types', result.scanTypes.join(', '));
468
277
  if (result.complianceFrameworks.length > 0) {
469
- console.log(chalk.white(` Compliance: ${chalk.cyan(result.complianceFrameworks.join(', '))}`));
278
+ WizardPrompt.printSummaryField('Compliance', result.complianceFrameworks.join(', '));
470
279
  }
471
280
  else {
472
- console.log(chalk.white(` Compliance: ${chalk.gray('(none)')}`));
281
+ console.log(chalk.white(` Compliance: ${chalk.gray('(none)')}`));
473
282
  }
474
- console.log(chalk.white(` Min Severity: ${chalk.cyan(result.severity)}`));
475
- console.log(chalk.white(` Include Fixes: ${chalk.cyan(result.includeFixes ? 'Yes' : 'No')}`));
476
- console.log(chalk.white(` Generate Report: ${chalk.cyan(result.generateReport ? 'Yes' : 'No')}`));
283
+ WizardPrompt.printSummaryField('Min Severity', result.severity);
284
+ WizardPrompt.printSummaryField('Include Fixes', WizardFormat.yesNo(result.includeFixes));
285
+ WizardPrompt.printSummaryField('Generate Report', WizardFormat.yesNo(result.generateReport));
477
286
  if (result.generateReport) {
478
- console.log(chalk.white(` Report Format: ${chalk.cyan(result.reportFormat)}`));
287
+ WizardPrompt.printSummaryField('Report Format', result.reportFormat);
479
288
  }
480
289
  // Show scan type details
481
290
  console.log('');
@@ -486,70 +295,18 @@ export class SecurityScanWizard {
486
295
  });
487
296
  console.log('');
488
297
  }
489
- /**
490
- * Generic prompt helper
491
- */
492
- prompt(rl, question) {
493
- return new Promise(resolve => {
494
- rl.question(question, answer => {
495
- resolve(answer);
496
- });
497
- });
498
- }
499
- /**
500
- * Get target directory suggestions
501
- */
502
- getTargetSuggestions() {
503
- const suggestions = [];
504
- // Check for common source directories
505
- const commonDirs = ['src', 'lib', 'app', 'packages', 'api'];
506
- for (const dir of commonDirs) {
507
- const dirPath = join(this.cwd, dir);
508
- if (existsSync(dirPath) && statSync(dirPath).isDirectory()) {
509
- suggestions.push(dir);
510
- }
511
- }
512
- // Check for security-relevant files
513
- const securityFiles = [
514
- 'package.json',
515
- 'package-lock.json',
516
- 'yarn.lock',
517
- 'pnpm-lock.yaml',
518
- '.env',
519
- '.env.example',
520
- 'docker-compose.yml',
521
- 'Dockerfile',
522
- ];
523
- for (const file of securityFiles) {
524
- const filePath = join(this.cwd, file);
525
- if (existsSync(filePath)) {
526
- suggestions.push(file);
527
- }
528
- }
529
- return suggestions;
530
- }
531
- /**
532
- * Get default result for non-interactive mode
533
- */
534
298
  getDefaults() {
535
299
  return {
536
300
  target: this.options.defaultTarget || this.cwd,
537
301
  scanTypes: this.options.defaultScanTypes || ['sast', 'dependency', 'secret'],
538
302
  complianceFrameworks: this.options.defaultComplianceFrameworks || ['owasp'],
539
303
  severity: this.options.defaultSeverity || 'medium',
540
- includeFixes: this.options.defaultIncludeFixes !== undefined
541
- ? this.options.defaultIncludeFixes
542
- : true,
543
- generateReport: this.options.defaultGenerateReport !== undefined
544
- ? this.options.defaultGenerateReport
545
- : true,
304
+ includeFixes: this.options.defaultIncludeFixes ?? true,
305
+ generateReport: this.options.defaultGenerateReport ?? true,
546
306
  reportFormat: this.options.defaultReportFormat || 'json',
547
307
  cancelled: false,
548
308
  };
549
309
  }
550
- /**
551
- * Get cancelled result
552
- */
553
310
  getCancelled() {
554
311
  return {
555
312
  target: '.',