agentic-qe 1.4.3 → 1.5.0

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 (410) hide show
  1. package/.claude/agents/qe-api-contract-validator.md +133 -27
  2. package/.claude/agents/qe-api-contract-validator.md.backup +1148 -0
  3. package/.claude/agents/qe-api-contract-validator.md.backup-20251107-134747 +1148 -0
  4. package/.claude/agents/qe-api-contract-validator.md.backup-phase2-20251107-140039 +1123 -0
  5. package/.claude/agents/qe-chaos-engineer.md +142 -23
  6. package/.claude/agents/qe-chaos-engineer.md.backup +808 -0
  7. package/.claude/agents/qe-chaos-engineer.md.backup-20251107-134747 +808 -0
  8. package/.claude/agents/qe-chaos-engineer.md.backup-phase2-20251107-140039 +787 -0
  9. package/.claude/agents/qe-code-complexity.md +111 -23
  10. package/.claude/agents/qe-code-complexity.md.backup +291 -0
  11. package/.claude/agents/qe-code-complexity.md.backup-20251107-134747 +291 -0
  12. package/.claude/agents/qe-code-complexity.md.backup-phase2-20251107-140039 +286 -0
  13. package/.claude/agents/qe-coverage-analyzer.md +306 -30
  14. package/.claude/agents/qe-coverage-analyzer.md.backup +467 -0
  15. package/.claude/agents/qe-coverage-analyzer.md.backup-20251107-134747 +467 -0
  16. package/.claude/agents/qe-coverage-analyzer.md.backup-phase2-20251107-140039 +438 -0
  17. package/.claude/agents/qe-deployment-readiness.md +84 -28
  18. package/.claude/agents/qe-deployment-readiness.md.backup +1166 -0
  19. package/.claude/agents/qe-deployment-readiness.md.backup-20251107-134747 +1166 -0
  20. package/.claude/agents/qe-deployment-readiness.md.backup-phase2-20251107-140039 +1140 -0
  21. package/.claude/agents/qe-flaky-test-hunter.md +277 -35
  22. package/.claude/agents/qe-flaky-test-hunter.md.backup +1195 -0
  23. package/.claude/agents/qe-flaky-test-hunter.md.backup-20251107-134747 +1195 -0
  24. package/.claude/agents/qe-flaky-test-hunter.md.backup-phase2-20251107-140039 +1162 -0
  25. package/.claude/agents/qe-fleet-commander.md +126 -23
  26. package/.claude/agents/qe-fleet-commander.md.backup +718 -0
  27. package/.claude/agents/qe-fleet-commander.md.backup-20251107-134747 +718 -0
  28. package/.claude/agents/qe-fleet-commander.md.backup-phase2-20251107-140039 +697 -0
  29. package/.claude/agents/qe-performance-tester.md +314 -57
  30. package/.claude/agents/qe-performance-tester.md.backup +428 -0
  31. package/.claude/agents/qe-performance-tester.md.backup-20251107-134747 +428 -0
  32. package/.claude/agents/qe-performance-tester.md.backup-phase2-20251107-140039 +372 -0
  33. package/.claude/agents/qe-production-intelligence.md +126 -27
  34. package/.claude/agents/qe-production-intelligence.md.backup +1219 -0
  35. package/.claude/agents/qe-production-intelligence.md.backup-20251107-134747 +1219 -0
  36. package/.claude/agents/qe-production-intelligence.md.backup-phase2-20251107-140039 +1194 -0
  37. package/.claude/agents/qe-quality-analyzer.md +127 -32
  38. package/.claude/agents/qe-quality-analyzer.md.backup +425 -0
  39. package/.claude/agents/qe-quality-analyzer.md.backup-20251107-134747 +425 -0
  40. package/.claude/agents/qe-quality-analyzer.md.backup-phase2-20251107-140039 +394 -0
  41. package/.claude/agents/qe-quality-gate.md +148 -33
  42. package/.claude/agents/qe-quality-gate.md.backup +446 -0
  43. package/.claude/agents/qe-quality-gate.md.backup-20251107-134747 +446 -0
  44. package/.claude/agents/qe-quality-gate.md.backup-phase2-20251107-140039 +415 -0
  45. package/.claude/agents/qe-regression-risk-analyzer.md +78 -27
  46. package/.claude/agents/qe-regression-risk-analyzer.md.backup +1009 -0
  47. package/.claude/agents/qe-regression-risk-analyzer.md.backup-20251107-134747 +1009 -0
  48. package/.claude/agents/qe-regression-risk-analyzer.md.backup-phase2-20251107-140039 +984 -0
  49. package/.claude/agents/qe-requirements-validator.md +131 -27
  50. package/.claude/agents/qe-requirements-validator.md.backup +748 -0
  51. package/.claude/agents/qe-requirements-validator.md.backup-20251107-134747 +748 -0
  52. package/.claude/agents/qe-requirements-validator.md.backup-phase2-20251107-140039 +723 -0
  53. package/.claude/agents/qe-security-scanner.md +137 -62
  54. package/.claude/agents/qe-security-scanner.md.backup +634 -0
  55. package/.claude/agents/qe-security-scanner.md.backup-20251107-134747 +634 -0
  56. package/.claude/agents/qe-security-scanner.md.backup-phase2-20251107-140039 +573 -0
  57. package/.claude/agents/qe-test-data-architect.md +129 -26
  58. package/.claude/agents/qe-test-data-architect.md.backup +1064 -0
  59. package/.claude/agents/qe-test-data-architect.md.backup-20251107-134747 +1064 -0
  60. package/.claude/agents/qe-test-data-architect.md.backup-phase2-20251107-140039 +1040 -0
  61. package/.claude/agents/qe-test-executor.md +165 -21
  62. package/.claude/agents/qe-test-executor.md.backup +389 -0
  63. package/.claude/agents/qe-test-executor.md.backup-20251107-134747 +389 -0
  64. package/.claude/agents/qe-test-executor.md.backup-phase2-20251107-140039 +369 -0
  65. package/.claude/agents/qe-test-generator.md +379 -34
  66. package/.claude/agents/qe-test-generator.md.backup +997 -0
  67. package/.claude/agents/qe-test-generator.md.backup-20251107-134747 +997 -0
  68. package/.claude/agents/qe-visual-tester.md +236 -23
  69. package/.claude/agents/qe-visual-tester.md.backup +777 -0
  70. package/.claude/agents/qe-visual-tester.md.backup-20251107-134747 +777 -0
  71. package/.claude/agents/qe-visual-tester.md.backup-phase2-20251107-140039 +756 -0
  72. package/.claude/agents/subagents/qe-code-reviewer.md +59 -0
  73. package/.claude/agents/subagents/qe-data-generator.md +60 -0
  74. package/.claude/agents/subagents/qe-integration-tester.md +77 -0
  75. package/.claude/agents/subagents/qe-performance-validator.md +55 -0
  76. package/.claude/agents/subagents/qe-security-auditor.md +51 -0
  77. package/.claude/agents/subagents/qe-test-implementer.md +371 -0
  78. package/.claude/agents/subagents/qe-test-refactorer.md +510 -0
  79. package/.claude/agents/subagents/qe-test-writer.md +603 -0
  80. package/.claude/skills/accessibility-testing/SKILL.md +764 -777
  81. package/.claude/skills/agentic-quality-engineering/SKILL.md +0 -6
  82. package/.claude/skills/api-testing-patterns/SKILL.md +0 -12
  83. package/.claude/skills/bug-reporting-excellence/SKILL.md +0 -6
  84. package/.claude/skills/chaos-engineering-resilience/SKILL.md +0 -6
  85. package/.claude/skills/code-review-quality/SKILL.md +0 -6
  86. package/.claude/skills/compatibility-testing/SKILL.md +0 -6
  87. package/.claude/skills/compliance-testing/SKILL.md +0 -6
  88. package/.claude/skills/consultancy-practices/SKILL.md +0 -6
  89. package/.claude/skills/context-driven-testing/SKILL.md +0 -6
  90. package/.claude/skills/contract-testing/SKILL.md +0 -6
  91. package/.claude/skills/database-testing/SKILL.md +0 -6
  92. package/.claude/skills/exploratory-testing-advanced/SKILL.md +0 -6
  93. package/.claude/skills/holistic-testing-pact/SKILL.md +0 -6
  94. package/.claude/skills/localization-testing/SKILL.md +0 -6
  95. package/.claude/skills/mobile-testing/SKILL.md +535 -548
  96. package/.claude/skills/mutation-testing/SKILL.md +0 -6
  97. package/.claude/skills/performance-testing/SKILL.md +0 -6
  98. package/.claude/skills/quality-metrics/SKILL.md +0 -12
  99. package/.claude/skills/refactoring-patterns/SKILL.md +0 -6
  100. package/.claude/skills/regression-testing/SKILL.md +1033 -1045
  101. package/.claude/skills/risk-based-testing/SKILL.md +0 -12
  102. package/.claude/skills/security-testing/SKILL.md +0 -6
  103. package/.claude/skills/shift-left-testing/SKILL.md +529 -535
  104. package/.claude/skills/shift-right-testing/SKILL.md +585 -591
  105. package/.claude/skills/tdd-london-chicago/SKILL.md +0 -6
  106. package/.claude/skills/technical-writing/SKILL.md +0 -6
  107. package/.claude/skills/test-automation-strategy/SKILL.md +0 -6
  108. package/.claude/skills/test-data-management/SKILL.md +1054 -1067
  109. package/.claude/skills/test-design-techniques/SKILL.md +0 -6
  110. package/.claude/skills/test-environment-management/SKILL.md +0 -6
  111. package/.claude/skills/test-reporting-analytics/SKILL.md +0 -6
  112. package/.claude/skills/visual-testing-advanced/SKILL.md +0 -6
  113. package/.claude/skills/xp-practices/SKILL.md +0 -6
  114. package/CHANGELOG.md +504 -0
  115. package/README.md +24 -16
  116. package/dist/cli/commands/init.d.ts +4 -0
  117. package/dist/cli/commands/init.d.ts.map +1 -1
  118. package/dist/cli/commands/init.js +97 -44
  119. package/dist/cli/commands/init.js.map +1 -1
  120. package/dist/core/FleetManager.d.ts.map +1 -1
  121. package/dist/core/FleetManager.js +17 -5
  122. package/dist/core/FleetManager.js.map +1 -1
  123. package/dist/core/MemoryManager.d.ts +27 -0
  124. package/dist/core/MemoryManager.d.ts.map +1 -1
  125. package/dist/core/MemoryManager.js +69 -4
  126. package/dist/core/MemoryManager.js.map +1 -1
  127. package/dist/core/PatternDatabaseAdapter.d.ts.map +1 -1
  128. package/dist/core/PatternDatabaseAdapter.js +14 -4
  129. package/dist/core/PatternDatabaseAdapter.js.map +1 -1
  130. package/dist/learning/LearningEngine.d.ts.map +1 -1
  131. package/dist/learning/LearningEngine.js +18 -4
  132. package/dist/learning/LearningEngine.js.map +1 -1
  133. package/dist/mcp/handlers/coordination/index.d.ts +14 -14
  134. package/dist/mcp/handlers/coordination/index.d.ts.map +1 -1
  135. package/dist/mcp/handlers/coordination/index.js +14 -14
  136. package/dist/mcp/handlers/coordination/index.js.map +1 -1
  137. package/dist/mcp/handlers/coordination/task-status.d.ts.map +1 -1
  138. package/dist/mcp/handlers/coordination/task-status.js +3 -5
  139. package/dist/mcp/handlers/coordination/task-status.js.map +1 -1
  140. package/dist/mcp/handlers/phase2/Phase2Tools.d.ts.map +1 -1
  141. package/dist/mcp/handlers/phase2/Phase2Tools.js +39 -10
  142. package/dist/mcp/handlers/phase2/Phase2Tools.js.map +1 -1
  143. package/dist/mcp/handlers/phase3/Phase3DomainTools.d.ts +63 -0
  144. package/dist/mcp/handlers/phase3/Phase3DomainTools.d.ts.map +1 -0
  145. package/dist/mcp/handlers/phase3/Phase3DomainTools.js +885 -0
  146. package/dist/mcp/handlers/phase3/Phase3DomainTools.js.map +1 -0
  147. package/dist/mcp/handlers/phase3/index.d.ts +6 -0
  148. package/dist/mcp/handlers/phase3/index.d.ts.map +1 -0
  149. package/dist/mcp/handlers/phase3/index.js +10 -0
  150. package/dist/mcp/handlers/phase3/index.js.map +1 -0
  151. package/dist/mcp/handlers/prediction/index.d.ts +10 -10
  152. package/dist/mcp/handlers/prediction/index.d.ts.map +1 -1
  153. package/dist/mcp/handlers/prediction/index.js +10 -10
  154. package/dist/mcp/handlers/prediction/index.js.map +1 -1
  155. package/dist/mcp/handlers/security/check-authz.d.ts +152 -0
  156. package/dist/mcp/handlers/security/check-authz.d.ts.map +1 -0
  157. package/dist/mcp/handlers/security/check-authz.js +434 -0
  158. package/dist/mcp/handlers/security/check-authz.js.map +1 -0
  159. package/dist/mcp/handlers/security/generate-report.d.ts +156 -0
  160. package/dist/mcp/handlers/security/generate-report.d.ts.map +1 -0
  161. package/dist/mcp/handlers/security/generate-report.js +469 -0
  162. package/dist/mcp/handlers/security/generate-report.js.map +1 -0
  163. package/dist/mcp/handlers/security/index.d.ts +80 -0
  164. package/dist/mcp/handlers/security/index.d.ts.map +1 -0
  165. package/dist/mcp/handlers/security/index.js +91 -0
  166. package/dist/mcp/handlers/security/index.js.map +1 -0
  167. package/dist/mcp/handlers/security/scan-comprehensive.d.ts +66 -0
  168. package/dist/mcp/handlers/security/scan-comprehensive.d.ts.map +1 -0
  169. package/dist/mcp/handlers/security/scan-comprehensive.js +296 -0
  170. package/dist/mcp/handlers/security/scan-comprehensive.js.map +1 -0
  171. package/dist/mcp/handlers/security/scan-dependencies.d.ts +148 -0
  172. package/dist/mcp/handlers/security/scan-dependencies.d.ts.map +1 -0
  173. package/dist/mcp/handlers/security/scan-dependencies.js +354 -0
  174. package/dist/mcp/handlers/security/scan-dependencies.js.map +1 -0
  175. package/dist/mcp/handlers/security/validate-auth.d.ts +128 -0
  176. package/dist/mcp/handlers/security/validate-auth.d.ts.map +1 -0
  177. package/dist/mcp/handlers/security/validate-auth.js +294 -0
  178. package/dist/mcp/handlers/security/validate-auth.js.map +1 -0
  179. package/dist/mcp/handlers/task-orchestrate.d.ts +21 -1
  180. package/dist/mcp/handlers/task-orchestrate.d.ts.map +1 -1
  181. package/dist/mcp/handlers/task-orchestrate.js +32 -2
  182. package/dist/mcp/handlers/task-orchestrate.js.map +1 -1
  183. package/dist/mcp/handlers/test/generate-integration-tests.d.ts +95 -0
  184. package/dist/mcp/handlers/test/generate-integration-tests.d.ts.map +1 -0
  185. package/dist/mcp/handlers/test/generate-integration-tests.js +286 -0
  186. package/dist/mcp/handlers/test/generate-integration-tests.js.map +1 -0
  187. package/dist/mcp/handlers/test/generate-unit-tests.d.ts +89 -0
  188. package/dist/mcp/handlers/test/generate-unit-tests.d.ts.map +1 -0
  189. package/dist/mcp/handlers/test/generate-unit-tests.js +273 -0
  190. package/dist/mcp/handlers/test/generate-unit-tests.js.map +1 -0
  191. package/dist/mcp/handlers/test/optimize-test-suite.d.ts +97 -0
  192. package/dist/mcp/handlers/test/optimize-test-suite.d.ts.map +1 -0
  193. package/dist/mcp/handlers/test/optimize-test-suite.js +282 -0
  194. package/dist/mcp/handlers/test/optimize-test-suite.js.map +1 -0
  195. package/dist/mcp/server.d.ts.map +1 -1
  196. package/dist/mcp/server.js +212 -1
  197. package/dist/mcp/server.js.map +1 -1
  198. package/dist/mcp/tools/deprecated.d.ts +1390 -0
  199. package/dist/mcp/tools/deprecated.d.ts.map +1 -0
  200. package/dist/mcp/tools/deprecated.js +859 -0
  201. package/dist/mcp/tools/deprecated.js.map +1 -0
  202. package/dist/mcp/tools/qe/api-contract/index.d.ts +138 -0
  203. package/dist/mcp/tools/qe/api-contract/index.d.ts.map +1 -0
  204. package/dist/mcp/tools/qe/api-contract/index.js +572 -0
  205. package/dist/mcp/tools/qe/api-contract/index.js.map +1 -0
  206. package/dist/mcp/tools/qe/code-quality/analyze-complexity.d.ts +110 -0
  207. package/dist/mcp/tools/qe/code-quality/analyze-complexity.d.ts.map +1 -0
  208. package/dist/mcp/tools/qe/code-quality/analyze-complexity.js +381 -0
  209. package/dist/mcp/tools/qe/code-quality/analyze-complexity.js.map +1 -0
  210. package/dist/mcp/tools/qe/code-quality/calculate-quality-metrics.d.ts +115 -0
  211. package/dist/mcp/tools/qe/code-quality/calculate-quality-metrics.d.ts.map +1 -0
  212. package/dist/mcp/tools/qe/code-quality/calculate-quality-metrics.js +461 -0
  213. package/dist/mcp/tools/qe/code-quality/calculate-quality-metrics.js.map +1 -0
  214. package/dist/mcp/tools/qe/code-quality/index.d.ts +12 -0
  215. package/dist/mcp/tools/qe/code-quality/index.d.ts.map +1 -0
  216. package/dist/mcp/tools/qe/code-quality/index.js +30 -0
  217. package/dist/mcp/tools/qe/code-quality/index.js.map +1 -0
  218. package/dist/mcp/tools/qe/coverage/analyze-with-risk-scoring.d.ts +58 -0
  219. package/dist/mcp/tools/qe/coverage/analyze-with-risk-scoring.d.ts.map +1 -0
  220. package/dist/mcp/tools/qe/coverage/analyze-with-risk-scoring.js +172 -0
  221. package/dist/mcp/tools/qe/coverage/analyze-with-risk-scoring.js.map +1 -0
  222. package/dist/mcp/tools/qe/coverage/calculate-trends.d.ts +73 -0
  223. package/dist/mcp/tools/qe/coverage/calculate-trends.d.ts.map +1 -0
  224. package/dist/mcp/tools/qe/coverage/calculate-trends.js +240 -0
  225. package/dist/mcp/tools/qe/coverage/calculate-trends.js.map +1 -0
  226. package/dist/mcp/tools/qe/coverage/detect-gaps-ml.d.ts +38 -0
  227. package/dist/mcp/tools/qe/coverage/detect-gaps-ml.d.ts.map +1 -0
  228. package/dist/mcp/tools/qe/coverage/detect-gaps-ml.js +204 -0
  229. package/dist/mcp/tools/qe/coverage/detect-gaps-ml.js.map +1 -0
  230. package/dist/mcp/tools/qe/coverage/index.d.ts +12 -0
  231. package/dist/mcp/tools/qe/coverage/index.d.ts.map +1 -0
  232. package/dist/mcp/tools/qe/coverage/index.js +23 -0
  233. package/dist/mcp/tools/qe/coverage/index.js.map +1 -0
  234. package/dist/mcp/tools/qe/coverage/recommend-tests.d.ts +46 -0
  235. package/dist/mcp/tools/qe/coverage/recommend-tests.d.ts.map +1 -0
  236. package/dist/mcp/tools/qe/coverage/recommend-tests.js +248 -0
  237. package/dist/mcp/tools/qe/coverage/recommend-tests.js.map +1 -0
  238. package/dist/mcp/tools/qe/flaky-detection/analyze-patterns.d.ts +179 -0
  239. package/dist/mcp/tools/qe/flaky-detection/analyze-patterns.d.ts.map +1 -0
  240. package/dist/mcp/tools/qe/flaky-detection/analyze-patterns.js +554 -0
  241. package/dist/mcp/tools/qe/flaky-detection/analyze-patterns.js.map +1 -0
  242. package/dist/mcp/tools/qe/flaky-detection/detect-statistical.d.ts +172 -0
  243. package/dist/mcp/tools/qe/flaky-detection/detect-statistical.d.ts.map +1 -0
  244. package/dist/mcp/tools/qe/flaky-detection/detect-statistical.js +498 -0
  245. package/dist/mcp/tools/qe/flaky-detection/detect-statistical.js.map +1 -0
  246. package/dist/mcp/tools/qe/flaky-detection/index.d.ts +35 -0
  247. package/dist/mcp/tools/qe/flaky-detection/index.d.ts.map +1 -0
  248. package/dist/mcp/tools/qe/flaky-detection/index.js +66 -0
  249. package/dist/mcp/tools/qe/flaky-detection/index.js.map +1 -0
  250. package/dist/mcp/tools/qe/flaky-detection/stabilize-auto.d.ts +159 -0
  251. package/dist/mcp/tools/qe/flaky-detection/stabilize-auto.d.ts.map +1 -0
  252. package/dist/mcp/tools/qe/flaky-detection/stabilize-auto.js +462 -0
  253. package/dist/mcp/tools/qe/flaky-detection/stabilize-auto.js.map +1 -0
  254. package/dist/mcp/tools/qe/fleet/index.d.ts +422 -0
  255. package/dist/mcp/tools/qe/fleet/index.d.ts.map +1 -0
  256. package/dist/mcp/tools/qe/fleet/index.js +652 -0
  257. package/dist/mcp/tools/qe/fleet/index.js.map +1 -0
  258. package/dist/mcp/tools/qe/performance/analyze-bottlenecks.d.ts +180 -0
  259. package/dist/mcp/tools/qe/performance/analyze-bottlenecks.d.ts.map +1 -0
  260. package/dist/mcp/tools/qe/performance/analyze-bottlenecks.js +347 -0
  261. package/dist/mcp/tools/qe/performance/analyze-bottlenecks.js.map +1 -0
  262. package/dist/mcp/tools/qe/performance/generate-report.d.ts +146 -0
  263. package/dist/mcp/tools/qe/performance/generate-report.d.ts.map +1 -0
  264. package/dist/mcp/tools/qe/performance/generate-report.js +354 -0
  265. package/dist/mcp/tools/qe/performance/generate-report.js.map +1 -0
  266. package/dist/mcp/tools/qe/performance/index.d.ts +13 -0
  267. package/dist/mcp/tools/qe/performance/index.d.ts.map +1 -0
  268. package/dist/mcp/tools/qe/performance/index.js +24 -0
  269. package/dist/mcp/tools/qe/performance/index.js.map +1 -0
  270. package/dist/mcp/tools/qe/performance/monitor-realtime.d.ts +120 -0
  271. package/dist/mcp/tools/qe/performance/monitor-realtime.d.ts.map +1 -0
  272. package/dist/mcp/tools/qe/performance/monitor-realtime.js +215 -0
  273. package/dist/mcp/tools/qe/performance/monitor-realtime.js.map +1 -0
  274. package/dist/mcp/tools/qe/performance/run-benchmark.d.ts +68 -0
  275. package/dist/mcp/tools/qe/performance/run-benchmark.d.ts.map +1 -0
  276. package/dist/mcp/tools/qe/performance/run-benchmark.js +120 -0
  277. package/dist/mcp/tools/qe/performance/run-benchmark.js.map +1 -0
  278. package/dist/mcp/tools/qe/quality-gates/assess-deployment-risk.d.ts +239 -0
  279. package/dist/mcp/tools/qe/quality-gates/assess-deployment-risk.d.ts.map +1 -0
  280. package/dist/mcp/tools/qe/quality-gates/assess-deployment-risk.js +671 -0
  281. package/dist/mcp/tools/qe/quality-gates/assess-deployment-risk.js.map +1 -0
  282. package/dist/mcp/tools/qe/quality-gates/evaluate-quality-gate.d.ts +219 -0
  283. package/dist/mcp/tools/qe/quality-gates/evaluate-quality-gate.d.ts.map +1 -0
  284. package/dist/mcp/tools/qe/quality-gates/evaluate-quality-gate.js +732 -0
  285. package/dist/mcp/tools/qe/quality-gates/evaluate-quality-gate.js.map +1 -0
  286. package/dist/mcp/tools/qe/quality-gates/generate-quality-report.d.ts +447 -0
  287. package/dist/mcp/tools/qe/quality-gates/generate-quality-report.d.ts.map +1 -0
  288. package/dist/mcp/tools/qe/quality-gates/generate-quality-report.js +551 -0
  289. package/dist/mcp/tools/qe/quality-gates/generate-quality-report.js.map +1 -0
  290. package/dist/mcp/tools/qe/quality-gates/index.d.ts +40 -0
  291. package/dist/mcp/tools/qe/quality-gates/index.d.ts.map +1 -0
  292. package/dist/mcp/tools/qe/quality-gates/index.js +56 -0
  293. package/dist/mcp/tools/qe/quality-gates/index.js.map +1 -0
  294. package/dist/mcp/tools/qe/quality-gates/validate-quality-metrics.d.ts +226 -0
  295. package/dist/mcp/tools/qe/quality-gates/validate-quality-metrics.d.ts.map +1 -0
  296. package/dist/mcp/tools/qe/quality-gates/validate-quality-metrics.js +603 -0
  297. package/dist/mcp/tools/qe/quality-gates/validate-quality-metrics.js.map +1 -0
  298. package/dist/mcp/tools/qe/regression/analyze-risk.d.ts +212 -0
  299. package/dist/mcp/tools/qe/regression/analyze-risk.d.ts.map +1 -0
  300. package/dist/mcp/tools/qe/regression/analyze-risk.js +617 -0
  301. package/dist/mcp/tools/qe/regression/analyze-risk.js.map +1 -0
  302. package/dist/mcp/tools/qe/regression/index.d.ts +36 -0
  303. package/dist/mcp/tools/qe/regression/index.d.ts.map +1 -0
  304. package/dist/mcp/tools/qe/regression/index.js +63 -0
  305. package/dist/mcp/tools/qe/regression/index.js.map +1 -0
  306. package/dist/mcp/tools/qe/regression/select-tests.d.ts +241 -0
  307. package/dist/mcp/tools/qe/regression/select-tests.d.ts.map +1 -0
  308. package/dist/mcp/tools/qe/regression/select-tests.js +601 -0
  309. package/dist/mcp/tools/qe/regression/select-tests.js.map +1 -0
  310. package/dist/mcp/tools/qe/requirements/generate-bdd-scenarios.d.ts +134 -0
  311. package/dist/mcp/tools/qe/requirements/generate-bdd-scenarios.d.ts.map +1 -0
  312. package/dist/mcp/tools/qe/requirements/generate-bdd-scenarios.js +737 -0
  313. package/dist/mcp/tools/qe/requirements/generate-bdd-scenarios.js.map +1 -0
  314. package/dist/mcp/tools/qe/requirements/index.d.ts +40 -0
  315. package/dist/mcp/tools/qe/requirements/index.d.ts.map +1 -0
  316. package/dist/mcp/tools/qe/requirements/index.js +84 -0
  317. package/dist/mcp/tools/qe/requirements/index.js.map +1 -0
  318. package/dist/mcp/tools/qe/requirements/validate-requirements.d.ts +196 -0
  319. package/dist/mcp/tools/qe/requirements/validate-requirements.d.ts.map +1 -0
  320. package/dist/mcp/tools/qe/requirements/validate-requirements.js +740 -0
  321. package/dist/mcp/tools/qe/requirements/validate-requirements.js.map +1 -0
  322. package/dist/mcp/tools/qe/security/detect-vulnerabilities.d.ts +300 -0
  323. package/dist/mcp/tools/qe/security/detect-vulnerabilities.d.ts.map +1 -0
  324. package/dist/mcp/tools/qe/security/detect-vulnerabilities.js +492 -0
  325. package/dist/mcp/tools/qe/security/detect-vulnerabilities.js.map +1 -0
  326. package/dist/mcp/tools/qe/security/index.d.ts +34 -0
  327. package/dist/mcp/tools/qe/security/index.d.ts.map +1 -0
  328. package/dist/mcp/tools/qe/security/index.js +44 -0
  329. package/dist/mcp/tools/qe/security/index.js.map +1 -0
  330. package/dist/mcp/tools/qe/security/scan-comprehensive.d.ts +240 -0
  331. package/dist/mcp/tools/qe/security/scan-comprehensive.d.ts.map +1 -0
  332. package/dist/mcp/tools/qe/security/scan-comprehensive.js +535 -0
  333. package/dist/mcp/tools/qe/security/scan-comprehensive.js.map +1 -0
  334. package/dist/mcp/tools/qe/security/validate-compliance.d.ts +299 -0
  335. package/dist/mcp/tools/qe/security/validate-compliance.d.ts.map +1 -0
  336. package/dist/mcp/tools/qe/security/validate-compliance.js +517 -0
  337. package/dist/mcp/tools/qe/security/validate-compliance.js.map +1 -0
  338. package/dist/mcp/tools/qe/shared/types.d.ts +840 -0
  339. package/dist/mcp/tools/qe/shared/types.d.ts.map +1 -0
  340. package/dist/mcp/tools/qe/shared/types.js +13 -0
  341. package/dist/mcp/tools/qe/shared/types.js.map +1 -0
  342. package/dist/mcp/tools/qe/test-data/analyze-schema.d.ts +264 -0
  343. package/dist/mcp/tools/qe/test-data/analyze-schema.d.ts.map +1 -0
  344. package/dist/mcp/tools/qe/test-data/analyze-schema.js +553 -0
  345. package/dist/mcp/tools/qe/test-data/analyze-schema.js.map +1 -0
  346. package/dist/mcp/tools/qe/test-data/generate-test-data.d.ts +167 -0
  347. package/dist/mcp/tools/qe/test-data/generate-test-data.d.ts.map +1 -0
  348. package/dist/mcp/tools/qe/test-data/generate-test-data.js +336 -0
  349. package/dist/mcp/tools/qe/test-data/generate-test-data.js.map +1 -0
  350. package/dist/mcp/tools/qe/test-data/index.d.ts +44 -0
  351. package/dist/mcp/tools/qe/test-data/index.d.ts.map +1 -0
  352. package/dist/mcp/tools/qe/test-data/index.js +90 -0
  353. package/dist/mcp/tools/qe/test-data/index.js.map +1 -0
  354. package/dist/mcp/tools/qe/test-data/mask-sensitive-data.d.ts +165 -0
  355. package/dist/mcp/tools/qe/test-data/mask-sensitive-data.d.ts.map +1 -0
  356. package/dist/mcp/tools/qe/test-data/mask-sensitive-data.js +342 -0
  357. package/dist/mcp/tools/qe/test-data/mask-sensitive-data.js.map +1 -0
  358. package/dist/mcp/tools/qe/test-generation/analyze-test-quality.d.ts +144 -0
  359. package/dist/mcp/tools/qe/test-generation/analyze-test-quality.d.ts.map +1 -0
  360. package/dist/mcp/tools/qe/test-generation/analyze-test-quality.js +432 -0
  361. package/dist/mcp/tools/qe/test-generation/analyze-test-quality.js.map +1 -0
  362. package/dist/mcp/tools/qe/test-generation/generate-integration-tests.d.ts +98 -0
  363. package/dist/mcp/tools/qe/test-generation/generate-integration-tests.d.ts.map +1 -0
  364. package/dist/mcp/tools/qe/test-generation/generate-integration-tests.js +459 -0
  365. package/dist/mcp/tools/qe/test-generation/generate-integration-tests.js.map +1 -0
  366. package/dist/mcp/tools/qe/test-generation/generate-unit-tests.d.ts +83 -0
  367. package/dist/mcp/tools/qe/test-generation/generate-unit-tests.d.ts.map +1 -0
  368. package/dist/mcp/tools/qe/test-generation/generate-unit-tests.js +483 -0
  369. package/dist/mcp/tools/qe/test-generation/generate-unit-tests.js.map +1 -0
  370. package/dist/mcp/tools/qe/test-generation/index.d.ts +56 -0
  371. package/dist/mcp/tools/qe/test-generation/index.d.ts.map +1 -0
  372. package/dist/mcp/tools/qe/test-generation/index.js +97 -0
  373. package/dist/mcp/tools/qe/test-generation/index.js.map +1 -0
  374. package/dist/mcp/tools/qe/test-generation/optimize-test-suite.d.ts +124 -0
  375. package/dist/mcp/tools/qe/test-generation/optimize-test-suite.d.ts.map +1 -0
  376. package/dist/mcp/tools/qe/test-generation/optimize-test-suite.js +362 -0
  377. package/dist/mcp/tools/qe/test-generation/optimize-test-suite.js.map +1 -0
  378. package/dist/mcp/tools/qe/visual/compare-screenshots.d.ts +119 -0
  379. package/dist/mcp/tools/qe/visual/compare-screenshots.d.ts.map +1 -0
  380. package/dist/mcp/tools/qe/visual/compare-screenshots.js +280 -0
  381. package/dist/mcp/tools/qe/visual/compare-screenshots.js.map +1 -0
  382. package/dist/mcp/tools/qe/visual/detect-regression.d.ts +138 -0
  383. package/dist/mcp/tools/qe/visual/detect-regression.d.ts.map +1 -0
  384. package/dist/mcp/tools/qe/visual/detect-regression.js +271 -0
  385. package/dist/mcp/tools/qe/visual/detect-regression.js.map +1 -0
  386. package/dist/mcp/tools/qe/visual/index.d.ts +16 -0
  387. package/dist/mcp/tools/qe/visual/index.d.ts.map +1 -0
  388. package/dist/mcp/tools/qe/visual/index.js +22 -0
  389. package/dist/mcp/tools/qe/visual/index.js.map +1 -0
  390. package/dist/mcp/tools/qe/visual/validate-accessibility.d.ts +276 -0
  391. package/dist/mcp/tools/qe/visual/validate-accessibility.d.ts.map +1 -0
  392. package/dist/mcp/tools/qe/visual/validate-accessibility.js +413 -0
  393. package/dist/mcp/tools/qe/visual/validate-accessibility.js.map +1 -0
  394. package/dist/mcp/tools.d.ts +44 -0
  395. package/dist/mcp/tools.d.ts.map +1 -1
  396. package/dist/mcp/tools.js +1980 -1
  397. package/dist/mcp/tools.js.map +1 -1
  398. package/package.json +2 -2
  399. package/dist/learning/__mocks__/LearningEngine.d.ts +0 -39
  400. package/dist/learning/__mocks__/LearningEngine.d.ts.map +0 -1
  401. package/dist/learning/__mocks__/LearningEngine.js +0 -116
  402. package/dist/learning/__mocks__/LearningEngine.js.map +0 -1
  403. package/dist/utils/__mocks__/Database.d.ts +0 -85
  404. package/dist/utils/__mocks__/Database.d.ts.map +0 -1
  405. package/dist/utils/__mocks__/Database.js +0 -125
  406. package/dist/utils/__mocks__/Database.js.map +0 -1
  407. package/dist/utils/__mocks__/Logger.d.ts +0 -26
  408. package/dist/utils/__mocks__/Logger.d.ts.map +0 -1
  409. package/dist/utils/__mocks__/Logger.js +0 -44
  410. package/dist/utils/__mocks__/Logger.js.map +0 -1
@@ -0,0 +1,737 @@
1
+ "use strict";
2
+ /**
3
+ * BDD Scenario Generation Tool - Gherkin/Cucumber Generation
4
+ *
5
+ * Generates comprehensive Gherkin-formatted Cucumber scenarios from requirements
6
+ * with support for scenario outlines, data-driven testing, and edge cases.
7
+ *
8
+ * Features:
9
+ * - Feature file generation with descriptive narratives
10
+ * - Scenario and Scenario Outline generation
11
+ * - Background preconditions extraction
12
+ * - Happy path, error, and edge case scenario synthesis
13
+ * - Examples table generation for data-driven tests
14
+ * - Traceability to requirements and test cases
15
+ * - Language-neutral Gherkin syntax
16
+ * - Test case count projection
17
+ *
18
+ * @module tools/qe/requirements/generate-bdd-scenarios
19
+ * @version 1.0.0
20
+ * @author Agentic QE Team - Phase 3
21
+ * @date 2025-11-09
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.generateBddScenarios = generateBddScenarios;
25
+ // ==================== Gherkin Keywords ====================
26
+ const GHERKIN_KEYWORDS = {
27
+ feature: 'Feature',
28
+ scenario: 'Scenario',
29
+ scenarioOutline: 'Scenario Outline',
30
+ background: 'Background',
31
+ given: 'Given',
32
+ when: 'When',
33
+ then: 'Then',
34
+ and: 'And',
35
+ but: 'But',
36
+ examples: 'Examples'
37
+ };
38
+ // ==================== Main BDD Generation Function ====================
39
+ /**
40
+ * Generate BDD scenarios from requirements
41
+ *
42
+ * @param params - Generation parameters
43
+ * @returns Batch BDD generation result
44
+ */
45
+ async function generateBddScenarios(params) {
46
+ const startTime = Date.now();
47
+ const requestId = generateRequestId();
48
+ try {
49
+ if (!params.requirements || params.requirements.length === 0) {
50
+ throw new Error('At least one requirement must be provided');
51
+ }
52
+ const features = [];
53
+ let totalScenarios = 0;
54
+ let totalTestCases = 0;
55
+ // Generate features for each requirement
56
+ const generationPromises = params.requirements.map((req) => generateFeatureFromRequirement(req, params.includeEdgeCases ?? true, params.includeNegativeCases ?? true, params.dataVariations ?? true, params.language ?? 'en'));
57
+ const generatedFeatures = await Promise.all(generationPromises);
58
+ features.push(...generatedFeatures);
59
+ // Calculate totals
60
+ for (const feature of features) {
61
+ totalScenarios += feature.scenarios.length;
62
+ totalTestCases += feature.scenarios.reduce((sum, s) => sum + s.testCaseCount, 0);
63
+ }
64
+ // Compile summary
65
+ const avgScenarios = Math.round((totalScenarios / features.length) * 10) / 10;
66
+ const avgTestCases = Math.round((totalTestCases / features.length) * 10) / 10;
67
+ const patternCounts = new Map();
68
+ for (const feature of features) {
69
+ for (const scenario of feature.scenarios) {
70
+ const pattern = scenario.type === 'scenario_outline' ? 'Scenario Outline' : 'Scenario';
71
+ patternCounts.set(pattern, (patternCounts.get(pattern) ?? 0) + 1);
72
+ }
73
+ }
74
+ const commonPatterns = Array.from(patternCounts.entries())
75
+ .sort((a, b) => b[1] - a[1])
76
+ .slice(0, 3)
77
+ .map(([pattern, count]) => `${pattern} (${count})`);
78
+ // Count edge cases
79
+ let edgeCaseCount = 0;
80
+ for (const feature of features) {
81
+ for (const scenario of feature.scenarios) {
82
+ if (scenario.name.includes('edge') || scenario.name.includes('boundary') || scenario.tags?.includes('@edge')) {
83
+ edgeCaseCount++;
84
+ }
85
+ }
86
+ }
87
+ const result = {
88
+ requirementsProcessed: params.requirements.length,
89
+ featuresGenerated: features.length,
90
+ totalScenarios,
91
+ totalTestCases,
92
+ features,
93
+ summary: {
94
+ avgScenariosPerRequirement: avgScenarios,
95
+ avgTestCasesPerRequirement: avgTestCases,
96
+ commonScenarioPatterns: commonPatterns,
97
+ edgeCasesCovered: edgeCaseCount,
98
+ dataVariationCoverage: params.dataVariations ? 100 : 0
99
+ }
100
+ };
101
+ return createSuccessResponse(result, requestId, Date.now() - startTime);
102
+ }
103
+ catch (error) {
104
+ return createErrorResponse(error, requestId, Date.now() - startTime);
105
+ }
106
+ }
107
+ // ==================== Feature Generation ====================
108
+ /**
109
+ * Generate a feature from a requirement
110
+ */
111
+ async function generateFeatureFromRequirement(requirement, includeEdgeCases, includeNegativeCases, dataVariations, language) {
112
+ const featureName = extractFeatureName(requirement);
113
+ const narrative = extractNarrative(requirement);
114
+ const background = generateBackground(requirement);
115
+ const scenarios = await generateScenarios(requirement, includeEdgeCases, includeNegativeCases, dataVariations);
116
+ // Calculate test cases
117
+ let totalTestCases = 0;
118
+ for (const scenario of scenarios) {
119
+ if (scenario.type === 'scenario_outline' && scenario.examples) {
120
+ totalTestCases += scenario.examples.rows.length;
121
+ }
122
+ else {
123
+ totalTestCases += 1;
124
+ }
125
+ }
126
+ const feature = {
127
+ featureName,
128
+ narrative,
129
+ background,
130
+ scenarios,
131
+ metadata: {
132
+ generatedAt: new Date().toISOString(),
133
+ requirementId: requirement.id,
134
+ scenarioCount: scenarios.length,
135
+ scenarioOutlineCount: scenarios.filter((s) => s.type === 'scenario_outline').length,
136
+ totalTestCases,
137
+ tags: requirement.priority ? [`@${requirement.priority}`] : [],
138
+ language: language === 'en' ? 'English' : language,
139
+ version: '1.0.0'
140
+ },
141
+ gherkinContent: buildGherkinContent(featureName, narrative, background, scenarios)
142
+ };
143
+ return feature;
144
+ }
145
+ /**
146
+ * Extract feature name from requirement
147
+ */
148
+ function extractFeatureName(requirement) {
149
+ return requirement.title
150
+ .replace(/^(US|REQ|STORY|FEATURE|AC|BRD)[-_\s]?\d+:?\s*/i, '')
151
+ .replace(/([a-z])([A-Z])/g, '$1 $2')
152
+ .trim();
153
+ }
154
+ /**
155
+ * Extract user story narrative
156
+ */
157
+ function extractNarrative(requirement) {
158
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
159
+ // Try to extract from text
160
+ let asA = 'a user';
161
+ let iWant = requirement.title;
162
+ let soThat = requirement.description.substring(0, 100);
163
+ // Detect user type
164
+ if (/admin|administrator/.test(text))
165
+ asA = 'an administrator';
166
+ else if (/customer|client/.test(text))
167
+ asA = 'a customer';
168
+ else if (/stakeholder|manager/.test(text))
169
+ asA = 'a stakeholder';
170
+ else if (/developer|engineer|technical/.test(text))
171
+ asA = 'a developer';
172
+ else if (/system|service/.test(text))
173
+ asA = 'the system';
174
+ // Extract value statement
175
+ const valueMatch = text.match(/so that\s+(.+?)(?:[\.\,]|$)/);
176
+ if (valueMatch) {
177
+ soThat = valueMatch[1].trim();
178
+ }
179
+ return {
180
+ title: requirement.title,
181
+ asA,
182
+ iWant: iWant.replace(/^(as a|an|the)\s+/i, ''),
183
+ soThat,
184
+ acceptanceCriteria: requirement.acceptanceCriteria
185
+ };
186
+ }
187
+ /**
188
+ * Generate background steps
189
+ */
190
+ function generateBackground(requirement) {
191
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
192
+ const steps = [];
193
+ // System preconditions
194
+ if (/(system|service|application|api|endpoint)/.test(text)) {
195
+ steps.push('the system is running and accessible');
196
+ }
197
+ // User authentication
198
+ if (/(user|login|auth|permission|access|admin)/.test(text)) {
199
+ steps.push('the user is authenticated and has proper permissions');
200
+ steps.push('the user database is accessible');
201
+ }
202
+ // Data preconditions
203
+ if (/(data|record|entity|database|table)/.test(text)) {
204
+ steps.push('the database is in a consistent state');
205
+ steps.push('all required data is available');
206
+ }
207
+ // External services
208
+ if (/(api|external|service|integration|gateway)/.test(text)) {
209
+ steps.push('all external dependencies are available');
210
+ steps.push('the API service is running');
211
+ }
212
+ // Network conditions
213
+ if (/(network|concurrent|load|performance|scale)/.test(text)) {
214
+ steps.push('stable network connectivity is available');
215
+ }
216
+ return steps.length > 0 ? { steps } : undefined;
217
+ }
218
+ // ==================== Scenario Generation ====================
219
+ /**
220
+ * Generate all scenarios for a requirement
221
+ */
222
+ async function generateScenarios(requirement, includeEdgeCases, includeNegativeCases, dataVariations) {
223
+ const scenarios = [];
224
+ // Happy path
225
+ scenarios.push(generateHappyPathScenario(requirement));
226
+ // Negative scenarios
227
+ if (includeNegativeCases) {
228
+ scenarios.push(...generateNegativeScenarios(requirement));
229
+ }
230
+ // Edge case scenarios
231
+ if (includeEdgeCases) {
232
+ scenarios.push(...generateEdgeCaseScenarios(requirement));
233
+ }
234
+ // Scenario outlines with examples
235
+ if (dataVariations) {
236
+ const outlines = generateScenarioOutlines(requirement);
237
+ scenarios.push(...outlines);
238
+ }
239
+ // Calculate test cases
240
+ for (const scenario of scenarios) {
241
+ if (scenario.type === 'scenario_outline' && scenario.examples) {
242
+ scenario.testCaseCount = scenario.examples.rows.length;
243
+ }
244
+ else {
245
+ scenario.testCaseCount = 1;
246
+ }
247
+ }
248
+ return scenarios;
249
+ }
250
+ /**
251
+ * Generate happy path scenario
252
+ */
253
+ function generateHappyPathScenario(requirement) {
254
+ const actionVerb = extractActionVerb(requirement);
255
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
256
+ const given = generateGivenSteps(requirement);
257
+ const when = generateWhenSteps(requirement, actionVerb);
258
+ const then = generateThenSteps(requirement, actionVerb);
259
+ return {
260
+ name: `Successfully ${actionVerb} ${requirement.title}`,
261
+ type: 'scenario',
262
+ description: `Happy path scenario for ${requirement.title}`,
263
+ given,
264
+ when,
265
+ then,
266
+ tags: ['@happy-path', '@smoke'],
267
+ testCaseCount: 1
268
+ };
269
+ }
270
+ /**
271
+ * Generate negative scenarios
272
+ */
273
+ function generateNegativeScenarios(requirement) {
274
+ const scenarios = [];
275
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
276
+ // Invalid input scenario
277
+ if (/(input|data|parameter|field|value)/.test(text)) {
278
+ scenarios.push({
279
+ name: 'Handle invalid input data',
280
+ type: 'scenario',
281
+ given: ['a request with invalid input data'],
282
+ when: ['the request is submitted'],
283
+ then: [
284
+ 'the system returns a validation error',
285
+ 'the error message indicates invalid input',
286
+ 'the operation is not performed'
287
+ ],
288
+ tags: ['@negative', '@validation'],
289
+ testCaseCount: 1
290
+ });
291
+ }
292
+ // Unauthorized access scenario
293
+ if (/(auth|permission|access|security|role)/.test(text)) {
294
+ scenarios.push({
295
+ name: 'Deny unauthorized access',
296
+ type: 'scenario',
297
+ given: ['a user without proper permissions'],
298
+ when: ['the user attempts to access the resource'],
299
+ then: [
300
+ 'the system returns a 403 Forbidden error',
301
+ 'access is denied',
302
+ 'the attempt is logged for audit'
303
+ ],
304
+ tags: ['@negative', '@security'],
305
+ testCaseCount: 1
306
+ });
307
+ }
308
+ // Service unavailable scenario
309
+ if (/(api|service|external|integration)/.test(text)) {
310
+ scenarios.push({
311
+ name: 'Handle service unavailability',
312
+ type: 'scenario',
313
+ given: ['the external service is unavailable'],
314
+ when: ['the operation is initiated'],
315
+ then: [
316
+ 'the system returns a service unavailable error',
317
+ 'a retry mechanism is triggered',
318
+ 'the user is notified of the temporary issue'
319
+ ],
320
+ tags: ['@negative', '@resilience'],
321
+ testCaseCount: 1
322
+ });
323
+ }
324
+ // Resource not found scenario
325
+ if (/(retrieve|get|fetch|find|search|lookup)/.test(text)) {
326
+ scenarios.push({
327
+ name: 'Handle missing resource',
328
+ type: 'scenario',
329
+ given: ['a request for a non-existent resource'],
330
+ when: ['the lookup is performed'],
331
+ then: [
332
+ 'the system returns a 404 Not Found error',
333
+ 'no data is returned',
334
+ 'an appropriate error message is displayed'
335
+ ],
336
+ tags: ['@negative', '@validation'],
337
+ testCaseCount: 1
338
+ });
339
+ }
340
+ return scenarios;
341
+ }
342
+ /**
343
+ * Generate edge case scenarios
344
+ */
345
+ function generateEdgeCaseScenarios(requirement) {
346
+ const scenarios = [];
347
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
348
+ // Boundary value scenario
349
+ if (/(limit|size|length|count|maximum|minimum|threshold)/.test(text)) {
350
+ scenarios.push({
351
+ name: 'Handle boundary values',
352
+ type: 'scenario',
353
+ description: 'Test behavior at minimum and maximum boundaries',
354
+ given: [
355
+ 'input at minimum boundary value',
356
+ 'input at maximum boundary value'
357
+ ],
358
+ when: ['the operation is performed'],
359
+ then: [
360
+ 'the system correctly handles both boundary cases',
361
+ 'no overflow or underflow errors occur',
362
+ 'expected behavior is maintained at boundaries'
363
+ ],
364
+ tags: ['@edge-case', '@boundary'],
365
+ testCaseCount: 1
366
+ });
367
+ }
368
+ // Empty/null scenario
369
+ if (/(input|data|parameter|field|value)/.test(text)) {
370
+ scenarios.push({
371
+ name: 'Handle empty or null input',
372
+ type: 'scenario',
373
+ given: [
374
+ 'an empty input',
375
+ 'a null input',
376
+ 'undefined values'
377
+ ],
378
+ when: ['the validation is performed'],
379
+ then: [
380
+ 'the system properly handles empty/null cases',
381
+ 'appropriate error messages are provided',
382
+ 'the system state is not corrupted'
383
+ ],
384
+ tags: ['@edge-case', '@validation'],
385
+ testCaseCount: 1
386
+ });
387
+ }
388
+ // Concurrent access scenario
389
+ if (/(concurrent|parallel|simultaneous|race|transaction)/.test(text)) {
390
+ scenarios.push({
391
+ name: 'Handle concurrent operations',
392
+ type: 'scenario',
393
+ description: 'Test behavior under concurrent access',
394
+ given: ['multiple users attempting simultaneous operations'],
395
+ when: ['all operations are executed concurrently'],
396
+ then: [
397
+ 'all operations complete successfully',
398
+ 'data consistency is maintained',
399
+ 'no race conditions occur',
400
+ 'proper locking mechanisms are in place'
401
+ ],
402
+ tags: ['@edge-case', '@concurrency'],
403
+ testCaseCount: 1
404
+ });
405
+ }
406
+ // Large dataset scenario
407
+ if (/(bulk|batch|large|volume|scale|many)/.test(text)) {
408
+ scenarios.push({
409
+ name: 'Handle large dataset processing',
410
+ type: 'scenario',
411
+ given: ['a large dataset with 10000+ records'],
412
+ when: ['the batch operation is performed'],
413
+ then: [
414
+ 'all records are processed successfully',
415
+ 'performance meets SLA requirements',
416
+ 'no memory leaks occur',
417
+ 'proper pagination/chunking is applied'
418
+ ],
419
+ tags: ['@edge-case', '@performance'],
420
+ testCaseCount: 1
421
+ });
422
+ }
423
+ // Special character scenario
424
+ if (/(string|text|name|email|url|input)/.test(text)) {
425
+ scenarios.push({
426
+ name: 'Handle special characters',
427
+ type: 'scenario',
428
+ given: [
429
+ 'input with special characters (!@#$%)',
430
+ 'input with unicode characters',
431
+ 'input with emoji characters'
432
+ ],
433
+ when: ['the input is processed'],
434
+ then: [
435
+ 'special characters are properly handled',
436
+ 'no injection vulnerabilities exist',
437
+ 'data integrity is maintained'
438
+ ],
439
+ tags: ['@edge-case', '@security'],
440
+ testCaseCount: 1
441
+ });
442
+ }
443
+ return scenarios;
444
+ }
445
+ /**
446
+ * Generate scenario outlines with examples
447
+ */
448
+ function generateScenarioOutlines(requirement) {
449
+ const outlines = [];
450
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
451
+ // Validation scenario outline
452
+ if (/(valid|invalid|check|validate|verify|test)/.test(text)) {
453
+ const examples = {
454
+ name: 'Various input types',
455
+ headers: ['input', 'expectedResult', 'errorMessage'],
456
+ rows: [
457
+ { input: 'valid data', expectedResult: 'success', errorMessage: 'none' },
458
+ { input: 'empty string', expectedResult: 'error', errorMessage: 'Input cannot be empty' },
459
+ { input: 'null value', expectedResult: 'error', errorMessage: 'Input is required' },
460
+ { input: 'invalid format', expectedResult: 'error', errorMessage: 'Invalid format' },
461
+ { input: 'maximum length', expectedResult: 'success', errorMessage: 'none' }
462
+ ]
463
+ };
464
+ outlines.push({
465
+ name: 'Validation with various input types',
466
+ type: 'scenario_outline',
467
+ given: ['a request with <input> data'],
468
+ when: ['the validation is performed'],
469
+ then: [
470
+ 'the system returns <expectedResult>',
471
+ 'the error message is <errorMessage>'
472
+ ],
473
+ examples,
474
+ tags: ['@data-driven', '@validation'],
475
+ testCaseCount: examples.rows.length
476
+ });
477
+ }
478
+ // User role scenario outline
479
+ if (/(user|role|permission|admin|guest|customer)/.test(text)) {
480
+ const examples = {
481
+ name: 'Different user roles',
482
+ headers: ['userRole', 'hasAccess', 'expectedAction'],
483
+ rows: [
484
+ { userRole: 'admin', hasAccess: 'yes', expectedAction: 'full access' },
485
+ { userRole: 'user', hasAccess: 'yes', expectedAction: 'limited access' },
486
+ { userRole: 'guest', hasAccess: 'no', expectedAction: 'redirected to login' },
487
+ { userRole: 'suspended', hasAccess: 'no', expectedAction: 'access denied message' }
488
+ ]
489
+ };
490
+ outlines.push({
491
+ name: 'Access control by user role',
492
+ type: 'scenario_outline',
493
+ given: ['a <userRole> user'],
494
+ when: ['they attempt to access the resource'],
495
+ then: [
496
+ 'access is <hasAccess>',
497
+ 'the expected action is <expectedAction>'
498
+ ],
499
+ examples,
500
+ tags: ['@data-driven', '@security'],
501
+ testCaseCount: examples.rows.length
502
+ });
503
+ }
504
+ // Status code scenario outline
505
+ if (/(response|status|http|api|endpoint|request)/.test(text)) {
506
+ const examples = {
507
+ name: 'API response scenarios',
508
+ headers: ['scenario', 'statusCode', 'responseType'],
509
+ rows: [
510
+ { scenario: 'successful request', statusCode: '200', responseType: 'success' },
511
+ { scenario: 'bad request', statusCode: '400', responseType: 'error' },
512
+ { scenario: 'unauthorized', statusCode: '401', responseType: 'error' },
513
+ { scenario: 'not found', statusCode: '404', responseType: 'error' },
514
+ { scenario: 'server error', statusCode: '500', responseType: 'error' }
515
+ ]
516
+ };
517
+ outlines.push({
518
+ name: 'API response handling',
519
+ type: 'scenario_outline',
520
+ given: ['a <scenario> is sent to the API'],
521
+ when: ['the API processes the request'],
522
+ then: [
523
+ 'the HTTP response code is <statusCode>',
524
+ 'the response type is <responseType>'
525
+ ],
526
+ examples,
527
+ tags: ['@data-driven', '@api'],
528
+ testCaseCount: examples.rows.length
529
+ });
530
+ }
531
+ return outlines;
532
+ }
533
+ // ==================== Step Generation ====================
534
+ /**
535
+ * Extract primary action verb
536
+ */
537
+ function extractActionVerb(requirement) {
538
+ const verbs = [
539
+ 'create', 'update', 'delete', 'retrieve', 'process',
540
+ 'validate', 'execute', 'submit', 'save', 'load',
541
+ 'authenticate', 'authorize', 'search', 'filter', 'sort'
542
+ ];
543
+ const text = requirement.title.toLowerCase();
544
+ for (const verb of verbs) {
545
+ if (text.includes(verb)) {
546
+ return verb;
547
+ }
548
+ }
549
+ return 'perform';
550
+ }
551
+ /**
552
+ * Generate Given steps
553
+ */
554
+ function generateGivenSteps(requirement) {
555
+ const steps = [];
556
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
557
+ // User/actor preconditions
558
+ if (/(user|actor|customer)/.test(text)) {
559
+ steps.push('a user with valid credentials');
560
+ }
561
+ // System state preconditions
562
+ if (/(system|application|service)/.test(text)) {
563
+ steps.push('the system is in a valid state');
564
+ }
565
+ // Data preconditions
566
+ if (/(data|record|entity|item)/.test(text)) {
567
+ steps.push('the required data exists in the system');
568
+ }
569
+ // Authentication
570
+ if (/(auth|permission|role)/.test(text)) {
571
+ steps.push('the user is properly authenticated');
572
+ }
573
+ if (steps.length === 0) {
574
+ steps.push('the system is ready to process the request');
575
+ }
576
+ return steps;
577
+ }
578
+ /**
579
+ * Generate When steps
580
+ */
581
+ function generateWhenSteps(requirement, actionVerb) {
582
+ const steps = [];
583
+ steps.push(`the user initiates the ${actionVerb} operation`);
584
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
585
+ if (/(submit|send|request)/.test(text)) {
586
+ steps.push('the request is submitted with valid data');
587
+ }
588
+ else if (/(trigger|execute)/.test(text)) {
589
+ steps.push('the operation is triggered');
590
+ }
591
+ return steps;
592
+ }
593
+ /**
594
+ * Generate Then steps
595
+ */
596
+ function generateThenSteps(requirement, actionVerb) {
597
+ const steps = [];
598
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
599
+ // Success outcome
600
+ if (/(success|complete|finish|successful)/.test(text)) {
601
+ steps.push('the operation completes successfully');
602
+ }
603
+ else {
604
+ steps.push(`the ${actionVerb} operation is completed successfully`);
605
+ }
606
+ // Response
607
+ if (/(response|return|result)/.test(text)) {
608
+ steps.push('a success response is returned');
609
+ }
610
+ // Data persistence
611
+ if (/(save|persist|store|create|update)/.test(text)) {
612
+ steps.push('the data is persisted correctly');
613
+ }
614
+ // Notification
615
+ if (/(notify|alert|inform|message)/.test(text)) {
616
+ steps.push('the user is notified of the successful operation');
617
+ }
618
+ // Logging
619
+ if (/(log|audit|track)/.test(text)) {
620
+ steps.push('the operation is logged for audit purposes');
621
+ }
622
+ if (steps.length === 1) {
623
+ steps.push('the expected outcome is achieved');
624
+ }
625
+ return steps;
626
+ }
627
+ // ==================== Gherkin Content Generation ====================
628
+ /**
629
+ * Build complete Gherkin feature file content
630
+ */
631
+ function buildGherkinContent(featureName, narrative, background, scenarios) {
632
+ const lines = [];
633
+ // Feature header
634
+ lines.push(`${GHERKIN_KEYWORDS.feature}: ${featureName}`);
635
+ lines.push('');
636
+ // Feature narrative
637
+ lines.push(` As a ${narrative.asA}`);
638
+ lines.push(` I want ${narrative.iWant}`);
639
+ lines.push(` So that ${narrative.soThat}`);
640
+ lines.push('');
641
+ // Background
642
+ if (background && background.steps.length > 0) {
643
+ lines.push(` ${GHERKIN_KEYWORDS.background}:`);
644
+ for (const step of background.steps) {
645
+ lines.push(` ${GHERKIN_KEYWORDS.given} ${step}`);
646
+ }
647
+ lines.push('');
648
+ }
649
+ // Scenarios
650
+ for (const scenario of scenarios) {
651
+ // Tags
652
+ if (scenario.tags && scenario.tags.length > 0) {
653
+ lines.push(` ${scenario.tags.map((t) => t.startsWith('@') ? t : `@${t}`).join(' ')}`);
654
+ }
655
+ // Scenario keyword
656
+ const keyword = scenario.type === 'scenario_outline' ? GHERKIN_KEYWORDS.scenarioOutline : GHERKIN_KEYWORDS.scenario;
657
+ lines.push(` ${keyword}: ${scenario.name}`);
658
+ // Given steps
659
+ for (let i = 0; i < scenario.given.length; i++) {
660
+ const keyword = i === 0 ? GHERKIN_KEYWORDS.given : GHERKIN_KEYWORDS.and;
661
+ lines.push(` ${keyword} ${scenario.given[i]}`);
662
+ }
663
+ // When steps
664
+ for (let i = 0; i < scenario.when.length; i++) {
665
+ const keyword = i === 0 ? GHERKIN_KEYWORDS.when : GHERKIN_KEYWORDS.and;
666
+ lines.push(` ${keyword} ${scenario.when[i]}`);
667
+ }
668
+ // Then steps
669
+ for (let i = 0; i < scenario.then.length; i++) {
670
+ const keyword = i === 0 ? GHERKIN_KEYWORDS.then : GHERKIN_KEYWORDS.and;
671
+ lines.push(` ${keyword} ${scenario.then[i]}`);
672
+ }
673
+ // Examples
674
+ if (scenario.examples) {
675
+ lines.push('');
676
+ lines.push(` ${GHERKIN_KEYWORDS.examples}:`);
677
+ if (scenario.examples.name) {
678
+ lines.push(` (${scenario.examples.name})`);
679
+ }
680
+ // Header row
681
+ const headers = scenario.examples.headers;
682
+ const headerRow = headers.map((h) => ` ${h} `).join('|');
683
+ lines.push(` |${headerRow}|`);
684
+ // Data rows
685
+ for (const row of scenario.examples.rows) {
686
+ const values = headers.map((h) => ` ${row[h] ?? ''} `).join('|');
687
+ lines.push(` |${values}|`);
688
+ }
689
+ }
690
+ lines.push('');
691
+ }
692
+ return lines.join('\n');
693
+ }
694
+ // ==================== Utility Functions ====================
695
+ /**
696
+ * Generate unique request ID
697
+ */
698
+ function generateRequestId() {
699
+ return `bdd-gen-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
700
+ }
701
+ /**
702
+ * Create success response
703
+ */
704
+ function createSuccessResponse(data, requestId, executionTime) {
705
+ return {
706
+ success: true,
707
+ data,
708
+ metadata: {
709
+ requestId,
710
+ timestamp: new Date().toISOString(),
711
+ executionTime,
712
+ agent: 'bdd-generator',
713
+ version: '1.0.0'
714
+ }
715
+ };
716
+ }
717
+ /**
718
+ * Create error response
719
+ */
720
+ function createErrorResponse(error, requestId, executionTime) {
721
+ return {
722
+ success: false,
723
+ error: {
724
+ code: 'BDD_GENERATION_ERROR',
725
+ message: error.message,
726
+ stack: process.env.NODE_ENV === 'development' ? error.stack : undefined
727
+ },
728
+ metadata: {
729
+ requestId,
730
+ timestamp: new Date().toISOString(),
731
+ executionTime,
732
+ agent: 'bdd-generator',
733
+ version: '1.0.0'
734
+ }
735
+ };
736
+ }
737
+ //# sourceMappingURL=generate-bdd-scenarios.js.map