agentic-qe 1.0.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 (528) hide show
  1. package/.claude/agents/analysis/code-analyzer.md +209 -0
  2. package/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
  3. package/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
  4. package/.claude/agents/base-template-generator.md +42 -0
  5. package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
  6. package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
  7. package/.claude/agents/consensus/gossip-coordinator.md +63 -0
  8. package/.claude/agents/consensus/performance-benchmarker.md +851 -0
  9. package/.claude/agents/consensus/quorum-manager.md +823 -0
  10. package/.claude/agents/consensus/raft-manager.md +63 -0
  11. package/.claude/agents/consensus/security-manager.md +622 -0
  12. package/.claude/agents/core/coder.md +266 -0
  13. package/.claude/agents/core/planner.md +168 -0
  14. package/.claude/agents/core/researcher.md +190 -0
  15. package/.claude/agents/core/reviewer.md +326 -0
  16. package/.claude/agents/core/tester.md +319 -0
  17. package/.claude/agents/data/ml/data-ml-model.md +193 -0
  18. package/.claude/agents/development/backend/dev-backend-api.md +142 -0
  19. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
  20. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
  21. package/.claude/agents/flow-nexus/app-store.md +88 -0
  22. package/.claude/agents/flow-nexus/authentication.md +69 -0
  23. package/.claude/agents/flow-nexus/challenges.md +81 -0
  24. package/.claude/agents/flow-nexus/neural-network.md +88 -0
  25. package/.claude/agents/flow-nexus/payments.md +83 -0
  26. package/.claude/agents/flow-nexus/sandbox.md +76 -0
  27. package/.claude/agents/flow-nexus/swarm.md +76 -0
  28. package/.claude/agents/flow-nexus/user-tools.md +96 -0
  29. package/.claude/agents/flow-nexus/workflow.md +84 -0
  30. package/.claude/agents/github/code-review-swarm.md +538 -0
  31. package/.claude/agents/github/github-modes.md +173 -0
  32. package/.claude/agents/github/issue-tracker.md +319 -0
  33. package/.claude/agents/github/multi-repo-swarm.md +553 -0
  34. package/.claude/agents/github/pr-manager.md +191 -0
  35. package/.claude/agents/github/project-board-sync.md +509 -0
  36. package/.claude/agents/github/release-manager.md +367 -0
  37. package/.claude/agents/github/release-swarm.md +583 -0
  38. package/.claude/agents/github/repo-architect.md +398 -0
  39. package/.claude/agents/github/swarm-issue.md +573 -0
  40. package/.claude/agents/github/swarm-pr.md +428 -0
  41. package/.claude/agents/github/sync-coordinator.md +452 -0
  42. package/.claude/agents/github/workflow-automation.md +635 -0
  43. package/.claude/agents/goal/code-goal-planner.md +446 -0
  44. package/.claude/agents/goal/goal-planner.md +168 -0
  45. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +130 -0
  46. package/.claude/agents/hive-mind/queen-coordinator.md +203 -0
  47. package/.claude/agents/hive-mind/scout-explorer.md +242 -0
  48. package/.claude/agents/hive-mind/swarm-memory-manager.md +193 -0
  49. package/.claude/agents/hive-mind/worker-specialist.md +217 -0
  50. package/.claude/agents/neural/safla-neural.md +74 -0
  51. package/.claude/agents/optimization/benchmark-suite.md +665 -0
  52. package/.claude/agents/optimization/load-balancer.md +431 -0
  53. package/.claude/agents/optimization/performance-monitor.md +672 -0
  54. package/.claude/agents/optimization/resource-allocator.md +674 -0
  55. package/.claude/agents/optimization/topology-optimizer.md +808 -0
  56. package/.claude/agents/qe-api-contract-validator.md +1088 -0
  57. package/.claude/agents/qe-chaos-engineer.md +736 -0
  58. package/.claude/agents/qe-coverage-analyzer.md +282 -0
  59. package/.claude/agents/qe-deployment-readiness.md +1109 -0
  60. package/.claude/agents/qe-flaky-test-hunter.md +1121 -0
  61. package/.claude/agents/qe-fleet-commander.md +641 -0
  62. package/.claude/agents/qe-performance-tester.md +354 -0
  63. package/.claude/agents/qe-production-intelligence.md +1162 -0
  64. package/.claude/agents/qe-quality-gate.md +294 -0
  65. package/.claude/agents/qe-regression-risk-analyzer.md +947 -0
  66. package/.claude/agents/qe-requirements-validator.md +691 -0
  67. package/.claude/agents/qe-security-scanner.md +430 -0
  68. package/.claude/agents/qe-test-data-architect.md +1007 -0
  69. package/.claude/agents/qe-test-executor.md +365 -0
  70. package/.claude/agents/qe-test-generator.md +332 -0
  71. package/.claude/agents/qe-visual-tester.md +754 -0
  72. package/.claude/agents/sparc/architecture.md +472 -0
  73. package/.claude/agents/sparc/pseudocode.md +318 -0
  74. package/.claude/agents/sparc/refinement.md +525 -0
  75. package/.claude/agents/sparc/specification.md +276 -0
  76. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
  77. package/.claude/agents/swarm/adaptive-coordinator.md +396 -0
  78. package/.claude/agents/swarm/hierarchical-coordinator.md +327 -0
  79. package/.claude/agents/swarm/mesh-coordinator.md +392 -0
  80. package/.claude/agents/templates/automation-smart-agent.md +205 -0
  81. package/.claude/agents/templates/coordinator-swarm-init.md +105 -0
  82. package/.claude/agents/templates/github-pr-manager.md +177 -0
  83. package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
  84. package/.claude/agents/templates/memory-coordinator.md +187 -0
  85. package/.claude/agents/templates/migration-plan.md +746 -0
  86. package/.claude/agents/templates/orchestrator-task.md +139 -0
  87. package/.claude/agents/templates/performance-analyzer.md +199 -0
  88. package/.claude/agents/templates/sparc-coordinator.md +183 -0
  89. package/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
  90. package/.claude/agents/testing/validation/production-validator.md +395 -0
  91. package/.claude/aqe-fleet.json +47 -0
  92. package/.claude/commands/README.md +106 -0
  93. package/.claude/commands/agents/README.md +10 -0
  94. package/.claude/commands/agents/agent-capabilities.md +21 -0
  95. package/.claude/commands/agents/agent-coordination.md +28 -0
  96. package/.claude/commands/agents/agent-spawning.md +28 -0
  97. package/.claude/commands/agents/agent-types.md +26 -0
  98. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
  99. package/.claude/commands/analysis/README.md +9 -0
  100. package/.claude/commands/analysis/bottleneck-detect.md +162 -0
  101. package/.claude/commands/analysis/performance-bottlenecks.md +59 -0
  102. package/.claude/commands/analysis/performance-report.md +25 -0
  103. package/.claude/commands/analysis/token-efficiency.md +45 -0
  104. package/.claude/commands/analysis/token-usage.md +25 -0
  105. package/.claude/commands/aqe-analyze.md +344 -0
  106. package/.claude/commands/aqe-benchmark.md +466 -0
  107. package/.claude/commands/aqe-chaos.md +443 -0
  108. package/.claude/commands/aqe-execute.md +322 -0
  109. package/.claude/commands/aqe-fleet-status.md +431 -0
  110. package/.claude/commands/aqe-generate.md +301 -0
  111. package/.claude/commands/aqe-optimize.md +361 -0
  112. package/.claude/commands/aqe-report.md +411 -0
  113. package/.claude/commands/automation/README.md +9 -0
  114. package/.claude/commands/automation/auto-agent.md +122 -0
  115. package/.claude/commands/automation/self-healing.md +106 -0
  116. package/.claude/commands/automation/session-memory.md +90 -0
  117. package/.claude/commands/automation/smart-agents.md +73 -0
  118. package/.claude/commands/automation/smart-spawn.md +25 -0
  119. package/.claude/commands/automation/workflow-select.md +25 -0
  120. package/.claude/commands/coordination/README.md +9 -0
  121. package/.claude/commands/coordination/agent-spawn.md +25 -0
  122. package/.claude/commands/coordination/init.md +44 -0
  123. package/.claude/commands/coordination/orchestrate.md +43 -0
  124. package/.claude/commands/coordination/spawn.md +45 -0
  125. package/.claude/commands/coordination/swarm-init.md +85 -0
  126. package/.claude/commands/coordination/task-orchestrate.md +25 -0
  127. package/.claude/commands/flow-nexus/app-store.md +124 -0
  128. package/.claude/commands/flow-nexus/challenges.md +120 -0
  129. package/.claude/commands/flow-nexus/login-registration.md +65 -0
  130. package/.claude/commands/flow-nexus/neural-network.md +134 -0
  131. package/.claude/commands/flow-nexus/payments.md +116 -0
  132. package/.claude/commands/flow-nexus/sandbox.md +83 -0
  133. package/.claude/commands/flow-nexus/swarm.md +87 -0
  134. package/.claude/commands/flow-nexus/user-tools.md +152 -0
  135. package/.claude/commands/flow-nexus/workflow.md +115 -0
  136. package/.claude/commands/github/README.md +11 -0
  137. package/.claude/commands/github/code-review-swarm.md +514 -0
  138. package/.claude/commands/github/code-review.md +25 -0
  139. package/.claude/commands/github/github-modes.md +147 -0
  140. package/.claude/commands/github/github-swarm.md +121 -0
  141. package/.claude/commands/github/issue-tracker.md +292 -0
  142. package/.claude/commands/github/issue-triage.md +25 -0
  143. package/.claude/commands/github/multi-repo-swarm.md +519 -0
  144. package/.claude/commands/github/pr-enhance.md +26 -0
  145. package/.claude/commands/github/pr-manager.md +170 -0
  146. package/.claude/commands/github/project-board-sync.md +471 -0
  147. package/.claude/commands/github/release-manager.md +338 -0
  148. package/.claude/commands/github/release-swarm.md +544 -0
  149. package/.claude/commands/github/repo-analyze.md +25 -0
  150. package/.claude/commands/github/repo-architect.md +367 -0
  151. package/.claude/commands/github/swarm-issue.md +482 -0
  152. package/.claude/commands/github/swarm-pr.md +285 -0
  153. package/.claude/commands/github/sync-coordinator.md +301 -0
  154. package/.claude/commands/github/workflow-automation.md +442 -0
  155. package/.claude/commands/hive-mind/README.md +17 -0
  156. package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
  157. package/.claude/commands/hive-mind/hive-mind-init.md +18 -0
  158. package/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
  159. package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
  160. package/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
  161. package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
  162. package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
  163. package/.claude/commands/hive-mind/hive-mind-status.md +8 -0
  164. package/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
  165. package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
  166. package/.claude/commands/hive-mind/hive-mind.md +27 -0
  167. package/.claude/commands/hooks/README.md +11 -0
  168. package/.claude/commands/hooks/overview.md +132 -0
  169. package/.claude/commands/hooks/post-edit.md +117 -0
  170. package/.claude/commands/hooks/post-task.md +112 -0
  171. package/.claude/commands/hooks/pre-edit.md +113 -0
  172. package/.claude/commands/hooks/pre-task.md +111 -0
  173. package/.claude/commands/hooks/session-end.md +118 -0
  174. package/.claude/commands/hooks/setup.md +103 -0
  175. package/.claude/commands/memory/README.md +9 -0
  176. package/.claude/commands/memory/memory-persist.md +25 -0
  177. package/.claude/commands/memory/memory-search.md +25 -0
  178. package/.claude/commands/memory/memory-usage.md +25 -0
  179. package/.claude/commands/memory/neural.md +47 -0
  180. package/.claude/commands/memory/usage.md +46 -0
  181. package/.claude/commands/monitoring/README.md +9 -0
  182. package/.claude/commands/monitoring/agent-metrics.md +25 -0
  183. package/.claude/commands/monitoring/agents.md +44 -0
  184. package/.claude/commands/monitoring/real-time-view.md +25 -0
  185. package/.claude/commands/monitoring/status.md +46 -0
  186. package/.claude/commands/monitoring/swarm-monitor.md +25 -0
  187. package/.claude/commands/optimization/README.md +9 -0
  188. package/.claude/commands/optimization/auto-topology.md +62 -0
  189. package/.claude/commands/optimization/cache-manage.md +25 -0
  190. package/.claude/commands/optimization/parallel-execute.md +25 -0
  191. package/.claude/commands/optimization/parallel-execution.md +50 -0
  192. package/.claude/commands/optimization/topology-optimize.md +25 -0
  193. package/.claude/commands/pair/commands.md +546 -0
  194. package/.claude/commands/pair/config.md +510 -0
  195. package/.claude/commands/pair/examples.md +512 -0
  196. package/.claude/commands/pair/modes.md +348 -0
  197. package/.claude/commands/pair/session.md +407 -0
  198. package/.claude/commands/pair/start.md +209 -0
  199. package/.claude/commands/sparc/analyzer.md +52 -0
  200. package/.claude/commands/sparc/architect.md +53 -0
  201. package/.claude/commands/sparc/batch-executor.md +54 -0
  202. package/.claude/commands/sparc/coder.md +54 -0
  203. package/.claude/commands/sparc/debugger.md +54 -0
  204. package/.claude/commands/sparc/designer.md +53 -0
  205. package/.claude/commands/sparc/documenter.md +54 -0
  206. package/.claude/commands/sparc/innovator.md +54 -0
  207. package/.claude/commands/sparc/memory-manager.md +54 -0
  208. package/.claude/commands/sparc/optimizer.md +54 -0
  209. package/.claude/commands/sparc/orchestrator.md +132 -0
  210. package/.claude/commands/sparc/researcher.md +54 -0
  211. package/.claude/commands/sparc/reviewer.md +54 -0
  212. package/.claude/commands/sparc/sparc-modes.md +174 -0
  213. package/.claude/commands/sparc/swarm-coordinator.md +54 -0
  214. package/.claude/commands/sparc/tdd.md +54 -0
  215. package/.claude/commands/sparc/tester.md +54 -0
  216. package/.claude/commands/sparc/workflow-manager.md +54 -0
  217. package/.claude/commands/stream-chain/pipeline.md +121 -0
  218. package/.claude/commands/stream-chain/run.md +70 -0
  219. package/.claude/commands/swarm/README.md +15 -0
  220. package/.claude/commands/swarm/analysis.md +95 -0
  221. package/.claude/commands/swarm/development.md +96 -0
  222. package/.claude/commands/swarm/examples.md +168 -0
  223. package/.claude/commands/swarm/maintenance.md +102 -0
  224. package/.claude/commands/swarm/optimization.md +117 -0
  225. package/.claude/commands/swarm/research.md +136 -0
  226. package/.claude/commands/swarm/swarm-analysis.md +8 -0
  227. package/.claude/commands/swarm/swarm-background.md +8 -0
  228. package/.claude/commands/swarm/swarm-init.md +19 -0
  229. package/.claude/commands/swarm/swarm-modes.md +8 -0
  230. package/.claude/commands/swarm/swarm-monitor.md +8 -0
  231. package/.claude/commands/swarm/swarm-spawn.md +19 -0
  232. package/.claude/commands/swarm/swarm-status.md +8 -0
  233. package/.claude/commands/swarm/swarm-strategies.md +8 -0
  234. package/.claude/commands/swarm/swarm.md +27 -0
  235. package/.claude/commands/swarm/testing.md +131 -0
  236. package/.claude/commands/training/README.md +9 -0
  237. package/.claude/commands/training/model-update.md +25 -0
  238. package/.claude/commands/training/neural-patterns.md +74 -0
  239. package/.claude/commands/training/neural-train.md +25 -0
  240. package/.claude/commands/training/pattern-learn.md +25 -0
  241. package/.claude/commands/training/specialization.md +63 -0
  242. package/.claude/commands/truth/start.md +143 -0
  243. package/.claude/commands/verify/check.md +50 -0
  244. package/.claude/commands/verify/start.md +128 -0
  245. package/.claude/commands/workflows/README.md +9 -0
  246. package/.claude/commands/workflows/development.md +78 -0
  247. package/.claude/commands/workflows/research.md +63 -0
  248. package/.claude/commands/workflows/workflow-create.md +25 -0
  249. package/.claude/commands/workflows/workflow-execute.md +25 -0
  250. package/.claude/commands/workflows/workflow-export.md +25 -0
  251. package/.claude/helpers/checkpoint-manager.sh +251 -0
  252. package/.claude/helpers/github-safe.js +106 -0
  253. package/.claude/helpers/github-setup.sh +28 -0
  254. package/.claude/helpers/quick-start.sh +19 -0
  255. package/.claude/helpers/setup-mcp.sh +18 -0
  256. package/.claude/helpers/standard-checkpoint-hooks.sh +179 -0
  257. package/.claude/settings.json +114 -0
  258. package/.claude/settings.local.json +10 -0
  259. package/CONTRIBUTING.md +897 -0
  260. package/LICENSE +21 -0
  261. package/README.md +632 -0
  262. package/bin/aqe +959 -0
  263. package/config/fleet.yaml +50 -0
  264. package/dist/agents/ApiContractValidatorAgent.d.ts +222 -0
  265. package/dist/agents/ApiContractValidatorAgent.d.ts.map +1 -0
  266. package/dist/agents/ApiContractValidatorAgent.js +787 -0
  267. package/dist/agents/ApiContractValidatorAgent.js.map +1 -0
  268. package/dist/agents/BaseAgent.d.ts +147 -0
  269. package/dist/agents/BaseAgent.d.ts.map +1 -0
  270. package/dist/agents/BaseAgent.js +374 -0
  271. package/dist/agents/BaseAgent.js.map +1 -0
  272. package/dist/agents/CoverageAnalyzerAgent.d.ts +103 -0
  273. package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -0
  274. package/dist/agents/CoverageAnalyzerAgent.js +466 -0
  275. package/dist/agents/CoverageAnalyzerAgent.js.map +1 -0
  276. package/dist/agents/DeploymentReadinessAgent.d.ts +244 -0
  277. package/dist/agents/DeploymentReadinessAgent.d.ts.map +1 -0
  278. package/dist/agents/DeploymentReadinessAgent.js +974 -0
  279. package/dist/agents/DeploymentReadinessAgent.js.map +1 -0
  280. package/dist/agents/FlakyTestHunterAgent.d.ts +172 -0
  281. package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -0
  282. package/dist/agents/FlakyTestHunterAgent.js +867 -0
  283. package/dist/agents/FlakyTestHunterAgent.js.map +1 -0
  284. package/dist/agents/FleetCommanderAgent.d.ts +154 -0
  285. package/dist/agents/FleetCommanderAgent.d.ts.map +1 -0
  286. package/dist/agents/FleetCommanderAgent.js +924 -0
  287. package/dist/agents/FleetCommanderAgent.js.map +1 -0
  288. package/dist/agents/PerformanceTesterAgent.d.ts +194 -0
  289. package/dist/agents/PerformanceTesterAgent.d.ts.map +1 -0
  290. package/dist/agents/PerformanceTesterAgent.js +972 -0
  291. package/dist/agents/PerformanceTesterAgent.js.map +1 -0
  292. package/dist/agents/ProductionIntelligenceAgent.d.ts +224 -0
  293. package/dist/agents/ProductionIntelligenceAgent.d.ts.map +1 -0
  294. package/dist/agents/ProductionIntelligenceAgent.js +856 -0
  295. package/dist/agents/ProductionIntelligenceAgent.js.map +1 -0
  296. package/dist/agents/QualityAnalyzerAgent.d.ts +67 -0
  297. package/dist/agents/QualityAnalyzerAgent.d.ts.map +1 -0
  298. package/dist/agents/QualityAnalyzerAgent.js +453 -0
  299. package/dist/agents/QualityAnalyzerAgent.js.map +1 -0
  300. package/dist/agents/QualityGateAgent.d.ts +104 -0
  301. package/dist/agents/QualityGateAgent.d.ts.map +1 -0
  302. package/dist/agents/QualityGateAgent.js +522 -0
  303. package/dist/agents/QualityGateAgent.js.map +1 -0
  304. package/dist/agents/RegressionRiskAnalyzerAgent.d.ts +274 -0
  305. package/dist/agents/RegressionRiskAnalyzerAgent.d.ts.map +1 -0
  306. package/dist/agents/RegressionRiskAnalyzerAgent.js +1076 -0
  307. package/dist/agents/RegressionRiskAnalyzerAgent.js.map +1 -0
  308. package/dist/agents/RequirementsValidatorAgent.d.ts +195 -0
  309. package/dist/agents/RequirementsValidatorAgent.d.ts.map +1 -0
  310. package/dist/agents/RequirementsValidatorAgent.js +992 -0
  311. package/dist/agents/RequirementsValidatorAgent.js.map +1 -0
  312. package/dist/agents/SecurityScannerAgent.d.ts +126 -0
  313. package/dist/agents/SecurityScannerAgent.d.ts.map +1 -0
  314. package/dist/agents/SecurityScannerAgent.js +695 -0
  315. package/dist/agents/SecurityScannerAgent.js.map +1 -0
  316. package/dist/agents/TestDataArchitectAgent.d.ts +452 -0
  317. package/dist/agents/TestDataArchitectAgent.d.ts.map +1 -0
  318. package/dist/agents/TestDataArchitectAgent.js +1346 -0
  319. package/dist/agents/TestDataArchitectAgent.js.map +1 -0
  320. package/dist/agents/TestExecutorAgent.d.ts +101 -0
  321. package/dist/agents/TestExecutorAgent.d.ts.map +1 -0
  322. package/dist/agents/TestExecutorAgent.js +730 -0
  323. package/dist/agents/TestExecutorAgent.js.map +1 -0
  324. package/dist/agents/TestGeneratorAgent.d.ts +109 -0
  325. package/dist/agents/TestGeneratorAgent.d.ts.map +1 -0
  326. package/dist/agents/TestGeneratorAgent.js +450 -0
  327. package/dist/agents/TestGeneratorAgent.js.map +1 -0
  328. package/dist/agents/index.d.ts +51 -0
  329. package/dist/agents/index.d.ts.map +1 -0
  330. package/dist/agents/index.js +738 -0
  331. package/dist/agents/index.js.map +1 -0
  332. package/dist/cli/commands/analyze.d.ts +32 -0
  333. package/dist/cli/commands/analyze.d.ts.map +1 -0
  334. package/dist/cli/commands/analyze.js +764 -0
  335. package/dist/cli/commands/analyze.js.map +1 -0
  336. package/dist/cli/commands/fleet.d.ts +36 -0
  337. package/dist/cli/commands/fleet.d.ts.map +1 -0
  338. package/dist/cli/commands/fleet.js +745 -0
  339. package/dist/cli/commands/fleet.js.map +1 -0
  340. package/dist/cli/commands/generate.d.ts +24 -0
  341. package/dist/cli/commands/generate.d.ts.map +1 -0
  342. package/dist/cli/commands/generate.js +424 -0
  343. package/dist/cli/commands/generate.js.map +1 -0
  344. package/dist/cli/commands/init.d.ts +17 -0
  345. package/dist/cli/commands/init.d.ts.map +1 -0
  346. package/dist/cli/commands/init.js +570 -0
  347. package/dist/cli/commands/init.js.map +1 -0
  348. package/dist/cli/commands/run.d.ts +25 -0
  349. package/dist/cli/commands/run.d.ts.map +1 -0
  350. package/dist/cli/commands/run.js +558 -0
  351. package/dist/cli/commands/run.js.map +1 -0
  352. package/dist/cli/index-spec.d.ts +3 -0
  353. package/dist/cli/index-spec.d.ts.map +1 -0
  354. package/dist/cli/index-spec.js +154 -0
  355. package/dist/cli/index-spec.js.map +1 -0
  356. package/dist/cli/index-working.d.ts +7 -0
  357. package/dist/cli/index-working.d.ts.map +1 -0
  358. package/dist/cli/index-working.js +470 -0
  359. package/dist/cli/index-working.js.map +1 -0
  360. package/dist/cli/index.d.ts +9 -0
  361. package/dist/cli/index.d.ts.map +1 -0
  362. package/dist/cli/index.js +174 -0
  363. package/dist/cli/index.js.map +1 -0
  364. package/dist/core/Agent.d.ts +189 -0
  365. package/dist/core/Agent.d.ts.map +1 -0
  366. package/dist/core/Agent.js +288 -0
  367. package/dist/core/Agent.js.map +1 -0
  368. package/dist/core/EventBus.d.ts +40 -0
  369. package/dist/core/EventBus.d.ts.map +1 -0
  370. package/dist/core/EventBus.js +114 -0
  371. package/dist/core/EventBus.js.map +1 -0
  372. package/dist/core/FleetManager.d.ts +219 -0
  373. package/dist/core/FleetManager.d.ts.map +1 -0
  374. package/dist/core/FleetManager.js +354 -0
  375. package/dist/core/FleetManager.js.map +1 -0
  376. package/dist/core/MemoryManager.d.ts +119 -0
  377. package/dist/core/MemoryManager.d.ts.map +1 -0
  378. package/dist/core/MemoryManager.js +460 -0
  379. package/dist/core/MemoryManager.js.map +1 -0
  380. package/dist/core/Task.d.ts +264 -0
  381. package/dist/core/Task.d.ts.map +1 -0
  382. package/dist/core/Task.js +397 -0
  383. package/dist/core/Task.js.map +1 -0
  384. package/dist/core/coverage-analyzer.d.ts +50 -0
  385. package/dist/core/coverage-analyzer.d.ts.map +1 -0
  386. package/dist/core/coverage-analyzer.js +146 -0
  387. package/dist/core/coverage-analyzer.js.map +1 -0
  388. package/dist/core/index.d.ts +14 -0
  389. package/dist/core/index.d.ts.map +1 -0
  390. package/dist/core/index.js +20 -0
  391. package/dist/core/index.js.map +1 -0
  392. package/dist/core/quality-gate.d.ts +81 -0
  393. package/dist/core/quality-gate.d.ts.map +1 -0
  394. package/dist/core/quality-gate.js +254 -0
  395. package/dist/core/quality-gate.js.map +1 -0
  396. package/dist/coverage/coverage-collector.d.ts +62 -0
  397. package/dist/coverage/coverage-collector.d.ts.map +1 -0
  398. package/dist/coverage/coverage-collector.js +61 -0
  399. package/dist/coverage/coverage-collector.js.map +1 -0
  400. package/dist/coverage/coverage-reporter.d.ts +42 -0
  401. package/dist/coverage/coverage-reporter.d.ts.map +1 -0
  402. package/dist/coverage/coverage-reporter.js +53 -0
  403. package/dist/coverage/coverage-reporter.js.map +1 -0
  404. package/dist/index.d.ts +89 -0
  405. package/dist/index.d.ts.map +1 -0
  406. package/dist/index.js +142 -0
  407. package/dist/index.js.map +1 -0
  408. package/dist/mcp/handlers/agent-spawn.d.ts +72 -0
  409. package/dist/mcp/handlers/agent-spawn.d.ts.map +1 -0
  410. package/dist/mcp/handlers/agent-spawn.js +255 -0
  411. package/dist/mcp/handlers/agent-spawn.js.map +1 -0
  412. package/dist/mcp/handlers/base-handler.d.ts +53 -0
  413. package/dist/mcp/handlers/base-handler.d.ts.map +1 -0
  414. package/dist/mcp/handlers/base-handler.js +77 -0
  415. package/dist/mcp/handlers/base-handler.js.map +1 -0
  416. package/dist/mcp/handlers/fleet-init.d.ts +55 -0
  417. package/dist/mcp/handlers/fleet-init.d.ts.map +1 -0
  418. package/dist/mcp/handlers/fleet-init.js +149 -0
  419. package/dist/mcp/handlers/fleet-init.js.map +1 -0
  420. package/dist/mcp/handlers/fleet-status.d.ts +103 -0
  421. package/dist/mcp/handlers/fleet-status.d.ts.map +1 -0
  422. package/dist/mcp/handlers/fleet-status.js +244 -0
  423. package/dist/mcp/handlers/fleet-status.js.map +1 -0
  424. package/dist/mcp/handlers/optimize-tests.d.ts +219 -0
  425. package/dist/mcp/handlers/optimize-tests.d.ts.map +1 -0
  426. package/dist/mcp/handlers/optimize-tests.js +532 -0
  427. package/dist/mcp/handlers/optimize-tests.js.map +1 -0
  428. package/dist/mcp/handlers/predict-defects.d.ts +194 -0
  429. package/dist/mcp/handlers/predict-defects.d.ts.map +1 -0
  430. package/dist/mcp/handlers/predict-defects.js +721 -0
  431. package/dist/mcp/handlers/predict-defects.js.map +1 -0
  432. package/dist/mcp/handlers/quality-analyze.d.ts +273 -0
  433. package/dist/mcp/handlers/quality-analyze.d.ts.map +1 -0
  434. package/dist/mcp/handlers/quality-analyze.js +702 -0
  435. package/dist/mcp/handlers/quality-analyze.js.map +1 -0
  436. package/dist/mcp/handlers/task-orchestrate.d.ts +152 -0
  437. package/dist/mcp/handlers/task-orchestrate.d.ts.map +1 -0
  438. package/dist/mcp/handlers/task-orchestrate.js +629 -0
  439. package/dist/mcp/handlers/task-orchestrate.js.map +1 -0
  440. package/dist/mcp/handlers/test-execute.d.ts +132 -0
  441. package/dist/mcp/handlers/test-execute.d.ts.map +1 -0
  442. package/dist/mcp/handlers/test-execute.js +436 -0
  443. package/dist/mcp/handlers/test-execute.js.map +1 -0
  444. package/dist/mcp/handlers/test-generate.d.ts +107 -0
  445. package/dist/mcp/handlers/test-generate.d.ts.map +1 -0
  446. package/dist/mcp/handlers/test-generate.js +437 -0
  447. package/dist/mcp/handlers/test-generate.js.map +1 -0
  448. package/dist/mcp/server.d.ts +99 -0
  449. package/dist/mcp/server.d.ts.map +1 -0
  450. package/dist/mcp/server.js +214 -0
  451. package/dist/mcp/server.js.map +1 -0
  452. package/dist/mcp/services/AgentRegistry.d.ts +191 -0
  453. package/dist/mcp/services/AgentRegistry.d.ts.map +1 -0
  454. package/dist/mcp/services/AgentRegistry.js +403 -0
  455. package/dist/mcp/services/AgentRegistry.js.map +1 -0
  456. package/dist/mcp/services/HookExecutor.d.ts +165 -0
  457. package/dist/mcp/services/HookExecutor.d.ts.map +1 -0
  458. package/dist/mcp/services/HookExecutor.js +327 -0
  459. package/dist/mcp/services/HookExecutor.js.map +1 -0
  460. package/dist/mcp/start.d.ts +7 -0
  461. package/dist/mcp/start.d.ts.map +1 -0
  462. package/dist/mcp/start.js +35 -0
  463. package/dist/mcp/start.js.map +1 -0
  464. package/dist/mcp/tools.d.ts +81 -0
  465. package/dist/mcp/tools.d.ts.map +1 -0
  466. package/dist/mcp/tools.js +471 -0
  467. package/dist/mcp/tools.js.map +1 -0
  468. package/dist/optimization/sublinear-solver.d.ts +72 -0
  469. package/dist/optimization/sublinear-solver.d.ts.map +1 -0
  470. package/dist/optimization/sublinear-solver.js +263 -0
  471. package/dist/optimization/sublinear-solver.js.map +1 -0
  472. package/dist/scripts/verifyComplexity.d.ts +8 -0
  473. package/dist/scripts/verifyComplexity.d.ts.map +1 -0
  474. package/dist/scripts/verifyComplexity.js +56 -0
  475. package/dist/scripts/verifyComplexity.js.map +1 -0
  476. package/dist/types/api-contract.types.d.ts +273 -0
  477. package/dist/types/api-contract.types.d.ts.map +1 -0
  478. package/dist/types/api-contract.types.js +18 -0
  479. package/dist/types/api-contract.types.js.map +1 -0
  480. package/dist/types/errors.d.ts +104 -0
  481. package/dist/types/errors.d.ts.map +1 -0
  482. package/dist/types/errors.js +226 -0
  483. package/dist/types/errors.js.map +1 -0
  484. package/dist/types/events.d.ts +101 -0
  485. package/dist/types/events.d.ts.map +1 -0
  486. package/dist/types/events.js +6 -0
  487. package/dist/types/events.js.map +1 -0
  488. package/dist/types/index.d.ts +570 -0
  489. package/dist/types/index.d.ts.map +1 -0
  490. package/dist/types/index.js +131 -0
  491. package/dist/types/index.js.map +1 -0
  492. package/dist/utils/Config.d.ts +128 -0
  493. package/dist/utils/Config.d.ts.map +1 -0
  494. package/dist/utils/Config.js +232 -0
  495. package/dist/utils/Config.js.map +1 -0
  496. package/dist/utils/Database.d.ts +112 -0
  497. package/dist/utils/Database.d.ts.map +1 -0
  498. package/dist/utils/Database.js +352 -0
  499. package/dist/utils/Database.js.map +1 -0
  500. package/dist/utils/Logger.d.ts +58 -0
  501. package/dist/utils/Logger.d.ts.map +1 -0
  502. package/dist/utils/Logger.js +125 -0
  503. package/dist/utils/Logger.js.map +1 -0
  504. package/dist/utils/index.d.ts +9 -0
  505. package/dist/utils/index.d.ts.map +1 -0
  506. package/dist/utils/index.js +14 -0
  507. package/dist/utils/index.js.map +1 -0
  508. package/dist/utils/sublinear/coverageOptimizer.d.ts +84 -0
  509. package/dist/utils/sublinear/coverageOptimizer.d.ts.map +1 -0
  510. package/dist/utils/sublinear/coverageOptimizer.js +415 -0
  511. package/dist/utils/sublinear/coverageOptimizer.js.map +1 -0
  512. package/dist/utils/sublinear/index.d.ts +50 -0
  513. package/dist/utils/sublinear/index.d.ts.map +1 -0
  514. package/dist/utils/sublinear/index.js +390 -0
  515. package/dist/utils/sublinear/index.js.map +1 -0
  516. package/dist/utils/sublinear/matrixSolver.d.ts +132 -0
  517. package/dist/utils/sublinear/matrixSolver.d.ts.map +1 -0
  518. package/dist/utils/sublinear/matrixSolver.js +642 -0
  519. package/dist/utils/sublinear/matrixSolver.js.map +1 -0
  520. package/dist/utils/sublinear/temporalPredictor.d.ts +195 -0
  521. package/dist/utils/sublinear/temporalPredictor.d.ts.map +1 -0
  522. package/dist/utils/sublinear/temporalPredictor.js +474 -0
  523. package/dist/utils/sublinear/temporalPredictor.js.map +1 -0
  524. package/dist/utils/sublinear/testSelector.d.ts +81 -0
  525. package/dist/utils/sublinear/testSelector.d.ts.map +1 -0
  526. package/dist/utils/sublinear/testSelector.js +303 -0
  527. package/dist/utils/sublinear/testSelector.js.map +1 -0
  528. package/package.json +131 -0
@@ -0,0 +1,992 @@
1
+ "use strict";
2
+ /**
3
+ * RequirementsValidatorAgent - Validates requirements testability and generates BDD scenarios
4
+ *
5
+ * Core capabilities:
6
+ * - Testability analysis using SMART/INVEST criteria
7
+ * - BDD scenario generation in Gherkin format
8
+ * - Risk assessment with heat mapping
9
+ * - Acceptance criteria validation
10
+ * - Traceability mapping
11
+ * - Edge case identification
12
+ * - Requirement completeness check
13
+ *
14
+ * Memory namespaces:
15
+ * - aqe/requirements/* - Requirement validation data
16
+ * - aqe/bdd-scenarios/* - Generated BDD scenarios
17
+ * - aqe/risk-scores/* - Risk assessment results
18
+ * - aqe/traceability/* - Traceability matrices
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.RequirementsValidatorAgent = void 0;
22
+ const BaseAgent_1 = require("./BaseAgent");
23
+ const types_1 = require("../types");
24
+ // ============================================================================
25
+ // RequirementsValidatorAgent Implementation
26
+ // ============================================================================
27
+ class RequirementsValidatorAgent extends BaseAgent_1.BaseAgent {
28
+ constructor(config) {
29
+ super({
30
+ ...config,
31
+ id: config.id || `requirements-validator-${Date.now()}`,
32
+ type: types_1.QEAgentType.REQUIREMENTS_VALIDATOR,
33
+ capabilities: [
34
+ {
35
+ name: 'testability-analysis',
36
+ version: '1.0.0',
37
+ description: 'Evaluate requirements against INVEST criteria'
38
+ },
39
+ {
40
+ name: 'bdd-scenario-generation',
41
+ version: '1.0.0',
42
+ description: 'Generate comprehensive Gherkin scenarios'
43
+ },
44
+ {
45
+ name: 'risk-assessment',
46
+ version: '1.0.0',
47
+ description: 'Score requirements based on complexity and impact'
48
+ },
49
+ {
50
+ name: 'acceptance-criteria-validation',
51
+ version: '1.0.0',
52
+ description: 'Validate acceptance criteria using SMART framework'
53
+ },
54
+ {
55
+ name: 'traceability-mapping',
56
+ version: '1.0.0',
57
+ description: 'Create bidirectional traceability matrices'
58
+ },
59
+ {
60
+ name: 'edge-case-identification',
61
+ version: '1.0.0',
62
+ description: 'Identify edge cases using combinatorial testing'
63
+ },
64
+ {
65
+ name: 'completeness-check',
66
+ version: '1.0.0',
67
+ description: 'Validate requirement completeness using 5Ws framework'
68
+ }
69
+ ]
70
+ });
71
+ this.validationPatterns = new Map();
72
+ this.riskRules = new Map();
73
+ this.config = {
74
+ ...config,
75
+ thresholds: config.thresholds || {
76
+ minTestabilityScore: 8.0,
77
+ maxHighRiskRequirements: 3,
78
+ minBddCoverage: 100
79
+ },
80
+ validationRules: config.validationRules || [
81
+ 'SMART',
82
+ 'INVEST',
83
+ 'completeness',
84
+ 'clarity'
85
+ ],
86
+ reportFormat: config.reportFormat || 'json'
87
+ };
88
+ }
89
+ // ============================================================================
90
+ // BaseAgent Abstract Method Implementations
91
+ // ============================================================================
92
+ async initializeComponents() {
93
+ console.log(`RequirementsValidatorAgent ${this.agentId.id} initializing components`);
94
+ // Initialize validation patterns for detecting ambiguous language
95
+ this.validationPatterns.set('vague', /\b(fast|slow|good|bad|nice|easy|hard|better|worse)\b/gi);
96
+ this.validationPatterns.set('ambiguous', /\b(should|could|might|may|probably|possibly|perhaps)\b/gi);
97
+ this.validationPatterns.set('subjective', /\b(user-friendly|intuitive|simple|complex|efficient)\b/gi);
98
+ this.validationPatterns.set('passive', /\b(is|are|was|were|be|been|being)\s+\w+ed\b/gi);
99
+ // Initialize risk scoring rules
100
+ this.riskRules.set('external-api', 3);
101
+ this.riskRules.set('database-migration', 4);
102
+ this.riskRules.set('third-party-integration', 3);
103
+ this.riskRules.set('authentication', 4);
104
+ this.riskRules.set('payment-processing', 5);
105
+ this.riskRules.set('data-privacy', 5);
106
+ this.riskRules.set('performance-critical', 4);
107
+ this.riskRules.set('real-time', 4);
108
+ this.riskRules.set('distributed-system', 4);
109
+ // Register for events from other agents
110
+ this.registerEventHandler({
111
+ eventType: 'test-generator.ready',
112
+ handler: async (event) => {
113
+ console.log('Test generator is ready, can start generating tests from BDD scenarios');
114
+ }
115
+ });
116
+ this.registerEventHandler({
117
+ eventType: 'requirements.updated',
118
+ handler: async (event) => {
119
+ console.log('Requirements updated, triggering revalidation');
120
+ const requirements = event.data.requirements;
121
+ for (const req of requirements) {
122
+ await this.validateRequirement(req);
123
+ }
124
+ }
125
+ });
126
+ console.log('RequirementsValidatorAgent components initialized successfully');
127
+ }
128
+ async loadKnowledge() {
129
+ console.log('Loading requirements validator knowledge base');
130
+ // Load historical validation patterns
131
+ const historicalPatterns = await this.retrieveMemory('validation-patterns');
132
+ if (historicalPatterns) {
133
+ console.log('Loaded historical validation patterns');
134
+ }
135
+ // Load defect correlation data
136
+ const defectCorrelations = await this.retrieveSharedMemory(types_1.QEAgentType.QUALITY_ANALYZER, 'defect-correlations');
137
+ if (defectCorrelations) {
138
+ console.log('Loaded defect correlation data for risk assessment');
139
+ }
140
+ // Load project-specific validation rules
141
+ const projectRules = await this.memoryStore.retrieve('aqe/requirements/validation-rules');
142
+ if (projectRules) {
143
+ console.log('Loaded project-specific validation rules');
144
+ this.config.validationRules = [...this.config.validationRules, ...projectRules];
145
+ }
146
+ console.log('Requirements validator knowledge loaded successfully');
147
+ }
148
+ async cleanup() {
149
+ console.log(`RequirementsValidatorAgent ${this.agentId.id} cleaning up resources`);
150
+ // Save validation patterns learned during session
151
+ await this.storeMemory('validation-patterns', Array.from(this.validationPatterns.entries()));
152
+ // Save risk scoring rules
153
+ await this.storeMemory('risk-rules', Array.from(this.riskRules.entries()));
154
+ // Clear temporary validation cache
155
+ await this.memoryStore.delete('aqe/requirements/temp-validation', 'aqe');
156
+ console.log('RequirementsValidatorAgent cleanup completed');
157
+ }
158
+ async performTask(task) {
159
+ const taskType = task.type;
160
+ const taskData = task.payload;
161
+ switch (taskType) {
162
+ case 'validate-requirement':
163
+ return await this.validateRequirement(taskData.requirement);
164
+ case 'generate-bdd':
165
+ return await this.generateBddScenarios(taskData.requirement);
166
+ case 'assess-risk':
167
+ return await this.assessRisk(taskData.requirement);
168
+ case 'validate-acceptance-criteria':
169
+ return await this.validateAcceptanceCriteria(taskData.requirement);
170
+ case 'create-traceability':
171
+ return await this.createTraceabilityMap(taskData.requirement);
172
+ case 'batch-validate':
173
+ return await this.batchValidate(taskData.requirements);
174
+ case 'generate-report':
175
+ return await this.generateValidationReport(taskData.requirement);
176
+ case 'identify-edge-cases':
177
+ return await this.identifyEdgeCases(taskData.requirement);
178
+ default:
179
+ throw new Error(`Unsupported task type: ${taskType}`);
180
+ }
181
+ }
182
+ // ============================================================================
183
+ // Core Validation Capabilities
184
+ // ============================================================================
185
+ /**
186
+ * Validate a requirement for testability using SMART/INVEST criteria
187
+ */
188
+ async validateRequirement(requirement) {
189
+ console.log(`Validating requirement: ${requirement.id}`);
190
+ // Run all validation checks in parallel
191
+ const [testabilityScore, riskAssessment, bddScenarios, traceability, edgeCases, completeness] = await Promise.all([
192
+ this.calculateTestabilityScore(requirement),
193
+ this.assessRisk(requirement),
194
+ this.generateBddScenarios(requirement),
195
+ this.createTraceabilityMap(requirement),
196
+ this.identifyEdgeCases(requirement),
197
+ this.checkCompleteness(requirement)
198
+ ]);
199
+ const report = {
200
+ requirementId: requirement.id,
201
+ testabilityScore,
202
+ riskAssessment,
203
+ bddScenarios,
204
+ traceability,
205
+ edgeCases,
206
+ completeness,
207
+ timestamp: new Date()
208
+ };
209
+ // Store validation report in memory
210
+ await this.memoryStore.store(`aqe/requirements/validated/${requirement.id}`, report);
211
+ // Emit validation complete event
212
+ this.emitEvent('requirements.validated', {
213
+ requirementId: requirement.id,
214
+ testabilityScore: testabilityScore.overall,
215
+ riskLevel: riskAssessment.overallRisk,
216
+ bddScenarioCount: bddScenarios.scenarios.length
217
+ }, 'high');
218
+ console.log(`Requirement ${requirement.id} validated. Score: ${testabilityScore.overall}/10`);
219
+ return report;
220
+ }
221
+ /**
222
+ * Calculate testability score using SMART criteria
223
+ */
224
+ async calculateTestabilityScore(requirement) {
225
+ const issues = [];
226
+ const recommendations = [];
227
+ // Check Specific: Is the requirement clearly defined?
228
+ const specific = this.checkSpecific(requirement, issues, recommendations);
229
+ // Check Measurable: Are there quantifiable metrics?
230
+ const measurable = this.checkMeasurable(requirement, issues, recommendations);
231
+ // Check Achievable: Is it technically feasible?
232
+ const achievable = this.checkAchievable(requirement, issues, recommendations);
233
+ // Check Relevant: Is it aligned with business goals?
234
+ const relevant = this.checkRelevant(requirement, issues, recommendations);
235
+ // Check Time-bound: Are there performance/deadline expectations?
236
+ const timeBound = this.checkTimeBound(requirement, issues, recommendations);
237
+ // Calculate overall score (0-10 scale)
238
+ const criteriaScores = [specific, measurable, achievable, relevant, timeBound];
239
+ const overall = criteriaScores.reduce((sum, score) => sum + score, 0) / criteriaScores.length;
240
+ return {
241
+ overall: Math.round(overall * 10) / 10,
242
+ specific: specific >= 1.8,
243
+ measurable: measurable >= 1.8,
244
+ achievable: achievable >= 1.8,
245
+ relevant: relevant >= 1.8,
246
+ timeBound: timeBound >= 1.8,
247
+ issues,
248
+ recommendations
249
+ };
250
+ }
251
+ checkSpecific(req, issues, recommendations) {
252
+ let score = 2.0;
253
+ const text = `${req.title} ${req.description}`.toLowerCase();
254
+ // Check for vague language
255
+ const vagueMatches = text.match(this.validationPatterns.get('vague'));
256
+ if (vagueMatches && vagueMatches.length > 0) {
257
+ score -= 0.5;
258
+ issues.push(`Vague terms detected: ${vagueMatches.join(', ')}`);
259
+ recommendations.push('Replace vague terms with specific, measurable criteria');
260
+ }
261
+ // Check for ambiguous modal verbs
262
+ const ambiguousMatches = text.match(this.validationPatterns.get('ambiguous'));
263
+ if (ambiguousMatches && ambiguousMatches.length > 0) {
264
+ score -= 0.5;
265
+ issues.push(`Ambiguous language: ${ambiguousMatches.join(', ')}`);
266
+ recommendations.push('Use definitive language: "must", "will", "shall" instead of "should", "could", "might"');
267
+ }
268
+ // Check for missing details
269
+ if (req.description.length < 50) {
270
+ score -= 0.5;
271
+ issues.push('Description too brief, lacks sufficient detail');
272
+ recommendations.push('Expand description with specific details about behavior, inputs, and outputs');
273
+ }
274
+ return Math.max(0, score);
275
+ }
276
+ checkMeasurable(req, issues, recommendations) {
277
+ let score = 2.0;
278
+ const text = `${req.title} ${req.description}`.toLowerCase();
279
+ // Look for quantifiable metrics
280
+ const hasNumbers = /\d+/.test(text);
281
+ const hasMetrics = /(ms|seconds?|minutes?|hours?|%|percent|users?|requests?|MB|GB|KB)/i.test(text);
282
+ const hasAcceptanceCriteria = req.acceptanceCriteria && req.acceptanceCriteria.length > 0;
283
+ if (!hasNumbers && !hasMetrics) {
284
+ score -= 0.7;
285
+ issues.push('No quantifiable metrics defined');
286
+ recommendations.push('Add specific metrics: response time <200ms, success rate >99%, support 1000 concurrent users');
287
+ }
288
+ if (!hasAcceptanceCriteria) {
289
+ score -= 0.5;
290
+ issues.push('Missing acceptance criteria');
291
+ recommendations.push('Define clear acceptance criteria with measurable success conditions');
292
+ }
293
+ // Check for subjective terms
294
+ const subjectiveMatches = text.match(this.validationPatterns.get('subjective'));
295
+ if (subjectiveMatches && subjectiveMatches.length > 0) {
296
+ score -= 0.3;
297
+ issues.push(`Subjective terms: ${subjectiveMatches.join(', ')}`);
298
+ recommendations.push('Replace subjective terms with objective, measurable criteria');
299
+ }
300
+ return Math.max(0, score);
301
+ }
302
+ checkAchievable(req, issues, recommendations) {
303
+ let score = 2.0;
304
+ const text = `${req.title} ${req.description}`.toLowerCase();
305
+ // Check for technical feasibility indicators
306
+ const hasComplexity = /(complex|difficult|challenging|advanced)/i.test(text);
307
+ const hasConstraints = /(constraint|limitation|restriction)/i.test(text);
308
+ const hasRiskyKeywords = /(distributed|real-time|high-performance|scalable|fault-tolerant)/i.test(text);
309
+ if (hasComplexity && !hasConstraints) {
310
+ score -= 0.3;
311
+ issues.push('High complexity without defined constraints');
312
+ recommendations.push('Document technical constraints and feasibility analysis');
313
+ }
314
+ if (hasRiskyKeywords && !req.dependencies) {
315
+ score -= 0.4;
316
+ issues.push('Complex technical requirements without dependency analysis');
317
+ recommendations.push('Identify technical dependencies and integration points');
318
+ }
319
+ return Math.max(0, score);
320
+ }
321
+ checkRelevant(req, issues, recommendations) {
322
+ let score = 2.0;
323
+ // Check if business value or user need is articulated
324
+ const hasBusinessValue = /(value|benefit|improve|increase|reduce|enable|allow)/i.test(req.description);
325
+ const hasUserStory = /(user|customer|client|stakeholder)/i.test(req.description);
326
+ const hasType = req.type !== undefined;
327
+ if (!hasBusinessValue && !hasUserStory) {
328
+ score -= 0.7;
329
+ issues.push('Business value or user need not articulated');
330
+ recommendations.push('Add "As a [user], I want [feature] so that [benefit]" format');
331
+ }
332
+ if (!hasType) {
333
+ score -= 0.3;
334
+ issues.push('Requirement type not specified');
335
+ recommendations.push('Classify as functional, non-functional, technical, or business requirement');
336
+ }
337
+ return Math.max(0, score);
338
+ }
339
+ checkTimeBound(req, issues, recommendations) {
340
+ let score = 2.0;
341
+ const text = `${req.title} ${req.description}`.toLowerCase();
342
+ // Check for performance expectations
343
+ const hasPerformance = /(response time|latency|throughput|duration|timeout|deadline)/i.test(text);
344
+ const hasSchedule = /(sprint|release|version|phase|milestone)/i.test(text);
345
+ if (!hasPerformance) {
346
+ score -= 0.5;
347
+ issues.push('No performance or timing expectations defined');
348
+ recommendations.push('Define response time, timeout, or duration requirements');
349
+ }
350
+ if (!hasSchedule && req.priority === 'critical') {
351
+ score -= 0.5;
352
+ issues.push('Critical requirement without delivery timeline');
353
+ recommendations.push('Specify target sprint, release, or milestone');
354
+ }
355
+ return Math.max(0, score);
356
+ }
357
+ /**
358
+ * Generate BDD scenarios in Gherkin format
359
+ */
360
+ async generateBddScenarios(requirement) {
361
+ console.log(`Generating BDD scenarios for requirement: ${requirement.id}`);
362
+ const feature = this.extractFeatureName(requirement);
363
+ const background = this.generateBackground(requirement);
364
+ const scenarios = await this.generateScenarios(requirement);
365
+ const bddScenario = {
366
+ feature,
367
+ background,
368
+ scenarios,
369
+ metadata: {
370
+ requirementId: requirement.id,
371
+ generatedAt: new Date(),
372
+ scenarioCount: scenarios.length,
373
+ testCaseProjection: scenarios.reduce((sum, s) => {
374
+ if (s.type === 'scenario_outline' && s.examples) {
375
+ return sum + s.examples.rows.length;
376
+ }
377
+ return sum + 1;
378
+ }, 0)
379
+ }
380
+ };
381
+ // Store BDD scenarios in memory
382
+ await this.memoryStore.store(`aqe/bdd-scenarios/generated/${requirement.id}`, bddScenario);
383
+ // Emit event for test generator
384
+ this.emitEvent('bdd-scenarios.generated', {
385
+ requirementId: requirement.id,
386
+ scenarioCount: scenarios.length,
387
+ feature
388
+ }, 'high');
389
+ return bddScenario;
390
+ }
391
+ extractFeatureName(req) {
392
+ // Extract feature name from title, cleaning up formatting
393
+ return req.title
394
+ .replace(/^(US|REQ|STORY|FEATURE)[-_\s]?\d+:?\s*/i, '')
395
+ .replace(/([a-z])([A-Z])/g, '$1 $2')
396
+ .trim();
397
+ }
398
+ generateBackground(req) {
399
+ // Generate common preconditions
400
+ const background = [];
401
+ if (/(authentication|login|user)/i.test(req.description)) {
402
+ background.push('Given the authentication service is available');
403
+ background.push('And the user database is accessible');
404
+ }
405
+ if (/(api|endpoint|service)/i.test(req.description)) {
406
+ background.push('Given the API service is running');
407
+ background.push('And all dependencies are available');
408
+ }
409
+ return background.length > 0 ? background : undefined;
410
+ }
411
+ async generateScenarios(req) {
412
+ const scenarios = [];
413
+ // Generate happy path scenario
414
+ scenarios.push(this.generateHappyPathScenario(req));
415
+ // Generate error scenarios
416
+ scenarios.push(...this.generateErrorScenarios(req));
417
+ // Generate edge case scenarios
418
+ scenarios.push(...this.generateEdgeCaseScenarios(req));
419
+ // Generate scenario outlines for data-driven tests
420
+ const outlines = this.generateScenarioOutlines(req);
421
+ if (outlines.length > 0) {
422
+ scenarios.push(...outlines);
423
+ }
424
+ return scenarios;
425
+ }
426
+ generateHappyPathScenario(req) {
427
+ return {
428
+ name: `Successful ${this.extractActionVerb(req)}`,
429
+ type: 'scenario',
430
+ given: this.extractPreconditions(req),
431
+ when: this.extractActions(req),
432
+ then: this.extractExpectedOutcomes(req)
433
+ };
434
+ }
435
+ generateErrorScenarios(req) {
436
+ const scenarios = [];
437
+ // Generate common error scenarios
438
+ if (/(input|data|parameter)/i.test(req.description)) {
439
+ scenarios.push({
440
+ name: 'Failed with invalid input',
441
+ type: 'scenario',
442
+ given: ['a request with invalid input data'],
443
+ when: ['the request is submitted'],
444
+ then: [
445
+ 'the system returns an error response',
446
+ 'the error message indicates invalid input',
447
+ 'no data is persisted'
448
+ ]
449
+ });
450
+ }
451
+ if (/(authentication|authorization|permission)/i.test(req.description)) {
452
+ scenarios.push({
453
+ name: 'Failed with unauthorized access',
454
+ type: 'scenario',
455
+ given: ['a user without proper permissions'],
456
+ when: ['the user attempts to access the resource'],
457
+ then: [
458
+ 'the system returns 403 Forbidden',
459
+ 'access is denied',
460
+ 'the attempt is logged'
461
+ ]
462
+ });
463
+ }
464
+ return scenarios;
465
+ }
466
+ generateEdgeCaseScenarios(req) {
467
+ const scenarios = [];
468
+ // Boundary value scenarios
469
+ if (/(limit|maximum|minimum|size|length)/i.test(req.description)) {
470
+ scenarios.push({
471
+ name: 'Handle boundary values',
472
+ type: 'scenario',
473
+ given: ['input at minimum boundary', 'input at maximum boundary'],
474
+ when: ['the operation is performed'],
475
+ then: ['the system handles boundary values correctly', 'no errors occur']
476
+ });
477
+ }
478
+ // Concurrent operation scenarios
479
+ if (/(concurrent|parallel|simultaneous|race)/i.test(req.description)) {
480
+ scenarios.push({
481
+ name: 'Handle concurrent operations',
482
+ type: 'scenario',
483
+ given: ['multiple concurrent requests'],
484
+ when: ['operations are executed simultaneously'],
485
+ then: [
486
+ 'all operations complete successfully',
487
+ 'data consistency is maintained',
488
+ 'no race conditions occur'
489
+ ]
490
+ });
491
+ }
492
+ return scenarios;
493
+ }
494
+ generateScenarioOutlines(req) {
495
+ const scenarios = [];
496
+ // Generate scenario outlines for validation tests
497
+ if (/(validation|validate|verify|check)/i.test(req.description)) {
498
+ scenarios.push({
499
+ name: 'Validation with various inputs',
500
+ type: 'scenario_outline',
501
+ given: ['a request with <input> data'],
502
+ when: ['the validation is performed'],
503
+ then: ['the system returns <result>', 'the error message is <message>'],
504
+ examples: {
505
+ headers: ['input', 'result', 'message'],
506
+ rows: [
507
+ ['valid data', 'success', 'none'],
508
+ ['empty string', 'error', 'Input cannot be empty'],
509
+ ['null value', 'error', 'Input is required'],
510
+ ['invalid format', 'error', 'Invalid format']
511
+ ]
512
+ }
513
+ });
514
+ }
515
+ return scenarios;
516
+ }
517
+ extractActionVerb(req) {
518
+ const verbs = ['create', 'update', 'delete', 'retrieve', 'process', 'validate', 'execute', 'submit'];
519
+ const text = req.title.toLowerCase();
520
+ for (const verb of verbs) {
521
+ if (text.includes(verb)) {
522
+ return verb;
523
+ }
524
+ }
525
+ return 'operation';
526
+ }
527
+ extractPreconditions(req) {
528
+ const preconditions = [];
529
+ if (/(user|account|profile)/i.test(req.description)) {
530
+ preconditions.push('a registered user with valid credentials');
531
+ }
532
+ if (/(data|record|entity)/i.test(req.description)) {
533
+ preconditions.push('the required data exists in the system');
534
+ }
535
+ if (preconditions.length === 0) {
536
+ preconditions.push('the system is in a valid state');
537
+ }
538
+ return preconditions;
539
+ }
540
+ extractActions(req) {
541
+ const actions = [];
542
+ const verb = this.extractActionVerb(req);
543
+ actions.push(`the user initiates ${verb} operation`);
544
+ if (/(submit|send|post)/i.test(req.description)) {
545
+ actions.push('the request is submitted with valid data');
546
+ }
547
+ return actions;
548
+ }
549
+ extractExpectedOutcomes(req) {
550
+ const outcomes = [];
551
+ if (/(success|complete|finish)/i.test(req.description)) {
552
+ outcomes.push('the operation completes successfully');
553
+ }
554
+ if (/(return|response|result)/i.test(req.description)) {
555
+ outcomes.push('the system returns a success response');
556
+ }
557
+ if (/(save|persist|store)/i.test(req.description)) {
558
+ outcomes.push('the data is persisted correctly');
559
+ }
560
+ if (/(log|audit|track)/i.test(req.description)) {
561
+ outcomes.push('the operation is logged for audit purposes');
562
+ }
563
+ if (outcomes.length === 0) {
564
+ outcomes.push('the expected result is achieved');
565
+ }
566
+ return outcomes;
567
+ }
568
+ /**
569
+ * Assess risk level of a requirement
570
+ */
571
+ async assessRisk(requirement) {
572
+ console.log(`Assessing risk for requirement: ${requirement.id}`);
573
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
574
+ // Calculate individual risk factors (0-10 scale)
575
+ const technicalComplexity = this.assessTechnicalComplexity(text);
576
+ const externalDependencies = this.assessExternalDependencies(text);
577
+ const performanceImpact = this.assessPerformanceImpact(text);
578
+ const securityImplications = this.assessSecurityImplications(text);
579
+ const regulatoryCompliance = this.assessRegulatoryCompliance(text);
580
+ // Calculate weighted risk score
581
+ const riskScore = Math.round((technicalComplexity * 0.25 +
582
+ externalDependencies * 0.20 +
583
+ performanceImpact * 0.20 +
584
+ securityImplications * 0.25 +
585
+ regulatoryCompliance * 0.10) * 10) / 10;
586
+ // Determine overall risk level
587
+ let overallRisk;
588
+ if (riskScore >= 8)
589
+ overallRisk = 'critical';
590
+ else if (riskScore >= 6)
591
+ overallRisk = 'high';
592
+ else if (riskScore >= 4)
593
+ overallRisk = 'medium';
594
+ else
595
+ overallRisk = 'low';
596
+ // Generate mitigation strategies
597
+ const mitigation = this.generateMitigationStrategies(technicalComplexity, externalDependencies, performanceImpact, securityImplications, regulatoryCompliance);
598
+ // Calculate testing priority (1-10, higher = more testing needed)
599
+ const testingPriority = Math.min(10, Math.round(riskScore * 1.2));
600
+ const assessment = {
601
+ requirementId: requirement.id,
602
+ overallRisk,
603
+ riskScore,
604
+ factors: {
605
+ technicalComplexity,
606
+ externalDependencies,
607
+ performanceImpact,
608
+ securityImplications,
609
+ regulatoryCompliance
610
+ },
611
+ mitigation,
612
+ testingPriority
613
+ };
614
+ // Store risk assessment in memory
615
+ await this.memoryStore.store(`aqe/risk-scores/requirements/${requirement.id}`, assessment);
616
+ console.log(`Risk assessment complete. Level: ${overallRisk}, Score: ${riskScore}`);
617
+ return assessment;
618
+ }
619
+ assessTechnicalComplexity(text) {
620
+ let score = 2;
621
+ // Check for complex technical patterns
622
+ if (/(distributed|microservice|event-driven|async|concurrent)/i.test(text))
623
+ score += 2;
624
+ if (/(algorithm|optimization|performance-critical|real-time)/i.test(text))
625
+ score += 2;
626
+ if (/(machine learning|ai|neural|data science)/i.test(text))
627
+ score += 3;
628
+ if (/(blockchain|cryptography|encryption|hashing)/i.test(text))
629
+ score += 2;
630
+ return Math.min(10, score);
631
+ }
632
+ assessExternalDependencies(text) {
633
+ let score = 1;
634
+ // Check for external dependencies
635
+ if (/(third-party|external api|integration|webhook)/i.test(text))
636
+ score += 3;
637
+ if (/(payment|gateway|stripe|paypal)/i.test(text))
638
+ score += 3;
639
+ if (/(aws|azure|gcp|cloud service)/i.test(text))
640
+ score += 2;
641
+ if (/(database|redis|mongodb|postgresql)/i.test(text))
642
+ score += 1;
643
+ return Math.min(10, score);
644
+ }
645
+ assessPerformanceImpact(text) {
646
+ let score = 2;
647
+ // Check for performance implications
648
+ if (/(scale|scalability|high-volume|throughput)/i.test(text))
649
+ score += 3;
650
+ if (/(latency|response time|performance|speed)/i.test(text))
651
+ score += 2;
652
+ if (/(cache|caching|optimization|indexing)/i.test(text))
653
+ score += 1;
654
+ if (/(batch|bulk|mass|large-scale)/i.test(text))
655
+ score += 2;
656
+ return Math.min(10, score);
657
+ }
658
+ assessSecurityImplications(text) {
659
+ let score = 1;
660
+ // Check for security concerns
661
+ if (/(authentication|authorization|security|access control)/i.test(text))
662
+ score += 4;
663
+ if (/(password|credential|secret|token|key)/i.test(text))
664
+ score += 3;
665
+ if (/(encryption|decrypt|cipher|ssl|tls|https)/i.test(text))
666
+ score += 3;
667
+ if (/(pii|personal data|sensitive|confidential)/i.test(text))
668
+ score += 4;
669
+ if (/(injection|xss|csrf|vulnerability)/i.test(text))
670
+ score += 5;
671
+ return Math.min(10, score);
672
+ }
673
+ assessRegulatoryCompliance(text) {
674
+ let score = 0;
675
+ // Check for compliance requirements
676
+ if (/(gdpr|privacy|data protection|right to erasure)/i.test(text))
677
+ score += 5;
678
+ if (/(hipaa|healthcare|medical|patient)/i.test(text))
679
+ score += 5;
680
+ if (/(pci|payment card|financial|banking)/i.test(text))
681
+ score += 5;
682
+ if (/(sox|sarbanes|audit|compliance)/i.test(text))
683
+ score += 4;
684
+ return Math.min(10, score);
685
+ }
686
+ generateMitigationStrategies(technical, external, performance, security, compliance) {
687
+ const strategies = [];
688
+ if (technical >= 6) {
689
+ strategies.push('Conduct architectural review and proof-of-concept');
690
+ strategies.push('Implement comprehensive unit and integration tests');
691
+ }
692
+ if (external >= 5) {
693
+ strategies.push('Create mock services for testing');
694
+ strategies.push('Implement circuit breakers and fallback mechanisms');
695
+ strategies.push('Add retry logic with exponential backoff');
696
+ }
697
+ if (performance >= 6) {
698
+ strategies.push('Perform load testing and stress testing');
699
+ strategies.push('Implement caching strategies');
700
+ strategies.push('Add performance monitoring and alerting');
701
+ }
702
+ if (security >= 6) {
703
+ strategies.push('Conduct security audit and penetration testing');
704
+ strategies.push('Implement input validation and sanitization');
705
+ strategies.push('Add authentication and authorization tests');
706
+ strategies.push('Use security scanning tools (OWASP, Snyk)');
707
+ }
708
+ if (compliance >= 4) {
709
+ strategies.push('Document compliance requirements and controls');
710
+ strategies.push('Implement audit logging and data retention policies');
711
+ strategies.push('Create compliance test scenarios');
712
+ }
713
+ if (strategies.length === 0) {
714
+ strategies.push('Standard testing and code review practices');
715
+ }
716
+ return strategies;
717
+ }
718
+ /**
719
+ * Validate acceptance criteria using SMART framework
720
+ */
721
+ async validateAcceptanceCriteria(requirement) {
722
+ const issues = [];
723
+ const enhanced = [];
724
+ if (!requirement.acceptanceCriteria || requirement.acceptanceCriteria.length === 0) {
725
+ issues.push('No acceptance criteria defined');
726
+ enhanced.push('Define at least 3-5 acceptance criteria');
727
+ return { valid: false, score: 0, issues, enhanced };
728
+ }
729
+ let validCount = 0;
730
+ for (const criterion of requirement.acceptanceCriteria) {
731
+ const isValid = this.isAcceptanceCriteriaValid(criterion);
732
+ if (isValid.valid) {
733
+ validCount++;
734
+ enhanced.push(criterion);
735
+ }
736
+ else {
737
+ issues.push(...isValid.issues);
738
+ enhanced.push(isValid.enhanced);
739
+ }
740
+ }
741
+ const score = (validCount / requirement.acceptanceCriteria.length) * 10;
742
+ return {
743
+ valid: score >= 7.0,
744
+ score: Math.round(score * 10) / 10,
745
+ issues,
746
+ enhanced
747
+ };
748
+ }
749
+ isAcceptanceCriteriaValid(criterion) {
750
+ const issues = [];
751
+ let enhanced = criterion;
752
+ // Check for measurability
753
+ if (!/\d+/.test(criterion) && !/(complete|success|fail|error|valid|invalid)/i.test(criterion)) {
754
+ issues.push('Criterion lacks measurable metric');
755
+ enhanced = `${criterion} (Add specific metric or success condition)`;
756
+ }
757
+ // Check for clarity
758
+ if (/(should|could|might|may)/i.test(criterion)) {
759
+ issues.push('Criterion uses ambiguous language');
760
+ enhanced = enhanced.replace(/should|could|might|may/gi, 'must');
761
+ }
762
+ // Check for testability
763
+ if (criterion.length < 15) {
764
+ issues.push('Criterion too brief, may lack sufficient detail');
765
+ }
766
+ return {
767
+ valid: issues.length === 0,
768
+ issues,
769
+ enhanced
770
+ };
771
+ }
772
+ /**
773
+ * Create bidirectional traceability map
774
+ */
775
+ async createTraceabilityMap(requirement) {
776
+ const map = {
777
+ requirementId: requirement.id,
778
+ businessRequirement: this.extractBusinessRequirement(requirement),
779
+ epic: this.extractEpic(requirement),
780
+ userStory: this.extractUserStory(requirement),
781
+ acceptanceCriteria: requirement.acceptanceCriteria || [],
782
+ bddScenarios: [],
783
+ testCases: [],
784
+ codeModules: [],
785
+ deployments: []
786
+ };
787
+ // Link to BDD scenarios
788
+ const bddScenarios = await this.memoryStore.retrieve(`aqe/bdd-scenarios/generated/${requirement.id}`);
789
+ if (bddScenarios) {
790
+ map.bddScenarios = bddScenarios.scenarios.map((s) => s.name);
791
+ }
792
+ // Store traceability map
793
+ await this.memoryStore.store(`aqe/traceability/matrix/${requirement.id}`, map);
794
+ return map;
795
+ }
796
+ extractBusinessRequirement(req) {
797
+ // Extract from metadata or parse from ID
798
+ if (req.metadata?.businessRequirement) {
799
+ return req.metadata.businessRequirement;
800
+ }
801
+ const match = req.id.match(/^(BR|BIZ)-(\d+)/i);
802
+ return match ? match[0] : undefined;
803
+ }
804
+ extractEpic(req) {
805
+ if (req.metadata?.epic) {
806
+ return req.metadata.epic;
807
+ }
808
+ const match = req.id.match(/^(EPIC|EP)-(\d+)/i);
809
+ return match ? match[0] : undefined;
810
+ }
811
+ extractUserStory(req) {
812
+ if (req.metadata?.userStory) {
813
+ return req.metadata.userStory;
814
+ }
815
+ const match = req.id.match(/^(US|STORY)-(\d+)/i);
816
+ return match ? match[0] : undefined;
817
+ }
818
+ /**
819
+ * Identify edge cases using combinatorial testing
820
+ */
821
+ async identifyEdgeCases(requirement) {
822
+ const edgeCases = [];
823
+ // Boundary value edge cases
824
+ if (/(limit|size|length|count|number)/i.test(requirement.description)) {
825
+ edgeCases.push('Minimum boundary value (0 or 1)');
826
+ edgeCases.push('Maximum boundary value (at limit)');
827
+ edgeCases.push('Just below maximum boundary');
828
+ edgeCases.push('Just above minimum boundary');
829
+ }
830
+ // Null/empty edge cases
831
+ if (/(input|data|parameter|field)/i.test(requirement.description)) {
832
+ edgeCases.push('Null or undefined input');
833
+ edgeCases.push('Empty string or collection');
834
+ edgeCases.push('Whitespace-only input');
835
+ }
836
+ // Special character edge cases
837
+ if (/(text|string|name|email)/i.test(requirement.description)) {
838
+ edgeCases.push('Special characters (!@#$%)');
839
+ edgeCases.push('Unicode and non-ASCII characters');
840
+ edgeCases.push('SQL injection patterns');
841
+ edgeCases.push('XSS attack patterns');
842
+ }
843
+ // Concurrent operation edge cases
844
+ if (/(concurrent|parallel|simultaneous)/i.test(requirement.description)) {
845
+ edgeCases.push('Race condition with simultaneous updates');
846
+ edgeCases.push('Deadlock scenario');
847
+ edgeCases.push('Resource contention');
848
+ }
849
+ // Network/error edge cases
850
+ if (/(api|service|network|external)/i.test(requirement.description)) {
851
+ edgeCases.push('Network timeout');
852
+ edgeCases.push('Service unavailable (503)');
853
+ edgeCases.push('Partial response');
854
+ edgeCases.push('Malformed response');
855
+ }
856
+ return edgeCases;
857
+ }
858
+ /**
859
+ * Check requirement completeness using 5Ws framework
860
+ */
861
+ async checkCompleteness(requirement) {
862
+ const text = `${requirement.title} ${requirement.description}`.toLowerCase();
863
+ const who = /(user|customer|admin|system|service|actor|role)/i.test(text);
864
+ const what = /(create|update|delete|retrieve|process|validate|execute|perform)/i.test(text);
865
+ const when = /(trigger|event|schedule|condition|after|before|during)/i.test(text) ||
866
+ requirement.acceptanceCriteria !== undefined;
867
+ const where = /(environment|context|location|system|service|module)/i.test(text);
868
+ const why = /(benefit|value|goal|purpose|enable|improve|reduce)/i.test(text);
869
+ const how = /(via|through|using|by|with|mechanism|method)/i.test(text) ||
870
+ requirement.acceptanceCriteria !== undefined;
871
+ const completenessFactors = [who, what, when, where, why, how];
872
+ const score = (completenessFactors.filter(f => f).length / completenessFactors.length) * 10;
873
+ return {
874
+ who,
875
+ what,
876
+ when,
877
+ where,
878
+ why,
879
+ how,
880
+ score: Math.round(score * 10) / 10
881
+ };
882
+ }
883
+ /**
884
+ * Batch validate multiple requirements
885
+ */
886
+ async batchValidate(requirements) {
887
+ console.log(`Batch validating ${requirements.length} requirements`);
888
+ const reports = await Promise.all(requirements.map(req => this.validateRequirement(req)));
889
+ const passed = reports.filter(r => r.testabilityScore.overall >= this.config.thresholds.minTestabilityScore).length;
890
+ const failed = reports.length - passed;
891
+ const averageTestabilityScore = reports.reduce((sum, r) => sum + r.testabilityScore.overall, 0) / reports.length;
892
+ const highRiskCount = reports.filter(r => r.riskAssessment.overallRisk === 'high' || r.riskAssessment.overallRisk === 'critical').length;
893
+ const totalBddScenarios = reports.reduce((sum, r) => sum + r.bddScenarios.scenarios.length, 0);
894
+ return {
895
+ validated: requirements.length,
896
+ passed,
897
+ failed,
898
+ reports,
899
+ summary: {
900
+ averageTestabilityScore: Math.round(averageTestabilityScore * 10) / 10,
901
+ highRiskCount,
902
+ totalBddScenarios
903
+ }
904
+ };
905
+ }
906
+ /**
907
+ * Generate comprehensive validation report
908
+ */
909
+ async generateValidationReport(requirement) {
910
+ const report = await this.validateRequirement(requirement);
911
+ const format = this.config.reportFormat || 'json';
912
+ if (format === 'json') {
913
+ return JSON.stringify(report, null, 2);
914
+ }
915
+ if (format === 'markdown') {
916
+ return this.formatReportAsMarkdown(report);
917
+ }
918
+ if (format === 'html') {
919
+ return this.formatReportAsHtml(report);
920
+ }
921
+ return JSON.stringify(report, null, 2);
922
+ }
923
+ formatReportAsMarkdown(report) {
924
+ return `# Requirement Validation Report
925
+
926
+ ## Requirement: ${report.requirementId}
927
+
928
+ ### Testability Score: ${report.testabilityScore.overall}/10
929
+
930
+ - ✅ Specific: ${report.testabilityScore.specific ? 'Yes' : 'No'}
931
+ - ✅ Measurable: ${report.testabilityScore.measurable ? 'Yes' : 'No'}
932
+ - ✅ Achievable: ${report.testabilityScore.achievable ? 'Yes' : 'No'}
933
+ - ✅ Relevant: ${report.testabilityScore.relevant ? 'Yes' : 'No'}
934
+ - ✅ Time-bound: ${report.testabilityScore.timeBound ? 'Yes' : 'No'}
935
+
936
+ ### Issues Found
937
+ ${report.testabilityScore.issues.map(i => `- ⚠️ ${i}`).join('\n')}
938
+
939
+ ### Recommendations
940
+ ${report.testabilityScore.recommendations.map(r => `- 💡 ${r}`).join('\n')}
941
+
942
+ ### Risk Assessment: ${report.riskAssessment.overallRisk.toUpperCase()}
943
+
944
+ Risk Score: ${report.riskAssessment.riskScore}/10
945
+
946
+ **Risk Factors:**
947
+ - Technical Complexity: ${report.riskAssessment.factors.technicalComplexity}/10
948
+ - External Dependencies: ${report.riskAssessment.factors.externalDependencies}/10
949
+ - Performance Impact: ${report.riskAssessment.factors.performanceImpact}/10
950
+ - Security Implications: ${report.riskAssessment.factors.securityImplications}/10
951
+ - Regulatory Compliance: ${report.riskAssessment.factors.regulatoryCompliance}/10
952
+
953
+ ### BDD Scenarios Generated: ${report.bddScenarios.scenarios.length}
954
+
955
+ ### Edge Cases Identified: ${report.edgeCases.length}
956
+
957
+ ${report.edgeCases.map(ec => `- ${ec}`).join('\n')}
958
+
959
+ ---
960
+ *Generated: ${report.timestamp.toISOString()}*
961
+ `;
962
+ }
963
+ formatReportAsHtml(report) {
964
+ return `<!DOCTYPE html>
965
+ <html>
966
+ <head>
967
+ <title>Requirement Validation Report</title>
968
+ <style>
969
+ body { font-family: Arial, sans-serif; margin: 20px; }
970
+ h1 { color: #333; }
971
+ .score { font-size: 24px; font-weight: bold; color: ${report.testabilityScore.overall >= 8 ? 'green' : 'orange'}; }
972
+ .risk-${report.riskAssessment.overallRisk} { color: ${report.riskAssessment.overallRisk === 'low' ? 'green' : report.riskAssessment.overallRisk === 'critical' ? 'red' : 'orange'}; }
973
+ ul { line-height: 1.8; }
974
+ </style>
975
+ </head>
976
+ <body>
977
+ <h1>Requirement Validation Report</h1>
978
+ <h2>Requirement: ${report.requirementId}</h2>
979
+
980
+ <h3>Testability Score: <span class="score">${report.testabilityScore.overall}/10</span></h3>
981
+
982
+ <h3>Risk Level: <span class="risk-${report.riskAssessment.overallRisk}">${report.riskAssessment.overallRisk.toUpperCase()}</span></h3>
983
+
984
+ <h3>BDD Scenarios Generated: ${report.bddScenarios.scenarios.length}</h3>
985
+
986
+ <p><em>Generated: ${report.timestamp.toISOString()}</em></p>
987
+ </body>
988
+ </html>`;
989
+ }
990
+ }
991
+ exports.RequirementsValidatorAgent = RequirementsValidatorAgent;
992
+ //# sourceMappingURL=RequirementsValidatorAgent.js.map