@agentic-qe/v3 3.0.0-alpha.6 → 3.0.0-alpha.8

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 (612) hide show
  1. package/assets/agents/v3/subagents/v3-qe-code-reviewer.md +339 -0
  2. package/assets/agents/v3/subagents/v3-qe-integration-reviewer.md +344 -0
  3. package/assets/agents/v3/subagents/v3-qe-performance-reviewer.md +351 -0
  4. package/assets/agents/v3/subagents/v3-qe-security-reviewer.md +374 -0
  5. package/assets/agents/v3/subagents/v3-qe-tdd-green.md +334 -0
  6. package/assets/agents/v3/subagents/v3-qe-tdd-red.md +329 -0
  7. package/assets/agents/v3/subagents/v3-qe-tdd-refactor.md +361 -0
  8. package/assets/agents/v3/v3-qe-accessibility-auditor.md +266 -0
  9. package/assets/agents/v3/v3-qe-bdd-generator.md +279 -0
  10. package/assets/agents/v3/v3-qe-chaos-engineer.md +265 -0
  11. package/assets/agents/v3/v3-qe-code-complexity.md +298 -0
  12. package/assets/agents/v3/v3-qe-code-intelligence.md +262 -0
  13. package/assets/agents/v3/v3-qe-contract-validator.md +267 -0
  14. package/assets/agents/v3/v3-qe-coverage-specialist.md +227 -0
  15. package/assets/agents/v3/v3-qe-defect-predictor.md +251 -0
  16. package/assets/agents/v3/v3-qe-dependency-mapper.md +277 -0
  17. package/assets/agents/v3/v3-qe-deployment-advisor.md +275 -0
  18. package/assets/agents/v3/v3-qe-flaky-hunter.md +248 -0
  19. package/assets/agents/v3/v3-qe-fleet-commander.md +293 -0
  20. package/assets/agents/v3/v3-qe-gap-detector.md +260 -0
  21. package/assets/agents/v3/v3-qe-graphql-tester.md +308 -0
  22. package/assets/agents/v3/v3-qe-impact-analyzer.md +299 -0
  23. package/assets/agents/v3/v3-qe-integration-tester.md +238 -0
  24. package/assets/agents/v3/v3-qe-kg-builder.md +273 -0
  25. package/assets/agents/v3/v3-qe-learning-coordinator.md +226 -0
  26. package/assets/agents/v3/v3-qe-load-tester.md +280 -0
  27. package/assets/agents/v3/v3-qe-metrics-optimizer.md +300 -0
  28. package/assets/agents/v3/v3-qe-mutation-tester.md +301 -0
  29. package/assets/agents/v3/v3-qe-parallel-executor.md +240 -0
  30. package/assets/agents/v3/v3-qe-pattern-learner.md +271 -0
  31. package/assets/agents/v3/v3-qe-performance-tester.md +262 -0
  32. package/assets/agents/v3/v3-qe-property-tester.md +247 -0
  33. package/assets/agents/v3/v3-qe-quality-gate.md +218 -0
  34. package/assets/agents/v3/v3-qe-queen-coordinator.md +214 -0
  35. package/assets/agents/v3/v3-qe-qx-partner.md +313 -0
  36. package/assets/agents/v3/v3-qe-regression-analyzer.md +322 -0
  37. package/assets/agents/v3/v3-qe-requirements-validator.md +360 -0
  38. package/assets/agents/v3/v3-qe-responsive-tester.md +311 -0
  39. package/assets/agents/v3/v3-qe-retry-handler.md +256 -0
  40. package/assets/agents/v3/v3-qe-risk-assessor.md +273 -0
  41. package/assets/agents/v3/v3-qe-root-cause-analyzer.md +286 -0
  42. package/assets/agents/v3/v3-qe-security-auditor.md +299 -0
  43. package/assets/agents/v3/v3-qe-security-scanner.md +235 -0
  44. package/assets/agents/v3/v3-qe-tdd-specialist.md +239 -0
  45. package/assets/agents/v3/v3-qe-test-architect.md +233 -0
  46. package/assets/agents/v3/v3-qe-transfer-specialist.md +295 -0
  47. package/assets/agents/v3/v3-qe-visual-tester.md +232 -0
  48. package/assets/skills/accessibility-testing/SKILL.md +216 -0
  49. package/assets/skills/agentdb-advanced/SKILL.md +550 -0
  50. package/assets/skills/agentdb-learning/SKILL.md +545 -0
  51. package/assets/skills/agentdb-memory-patterns/SKILL.md +339 -0
  52. package/assets/skills/agentdb-optimization/SKILL.md +509 -0
  53. package/assets/skills/agentdb-vector-search/SKILL.md +339 -0
  54. package/assets/skills/agentic-jujutsu/SKILL.md +645 -0
  55. package/assets/skills/agentic-quality-engineering/SKILL.md +335 -0
  56. package/assets/skills/api-testing-patterns/SKILL.md +294 -0
  57. package/assets/skills/aqe-v2-v3-migration/skill.md +322 -0
  58. package/assets/skills/brutal-honesty-review/README.md +218 -0
  59. package/assets/skills/brutal-honesty-review/SKILL.md +235 -0
  60. package/assets/skills/brutal-honesty-review/resources/assessment-rubrics.md +295 -0
  61. package/assets/skills/brutal-honesty-review/resources/review-template.md +102 -0
  62. package/assets/skills/brutal-honesty-review/scripts/assess-code.sh +179 -0
  63. package/assets/skills/brutal-honesty-review/scripts/assess-tests.sh +223 -0
  64. package/assets/skills/bug-reporting-excellence/SKILL.md +225 -0
  65. package/assets/skills/chaos-engineering-resilience/SKILL.md +158 -0
  66. package/assets/skills/cicd-pipeline-qe-orchestrator/README.md +304 -0
  67. package/assets/skills/cicd-pipeline-qe-orchestrator/SKILL.md +315 -0
  68. package/assets/skills/cicd-pipeline-qe-orchestrator/resources/workflows/microservice-pipeline.md +239 -0
  69. package/assets/skills/cicd-pipeline-qe-orchestrator/resources/workflows/mobile-pipeline.md +375 -0
  70. package/assets/skills/cicd-pipeline-qe-orchestrator/resources/workflows/monolith-pipeline.md +268 -0
  71. package/assets/skills/code-review-quality/SKILL.md +227 -0
  72. package/assets/skills/compatibility-testing/SKILL.md +205 -0
  73. package/assets/skills/compliance-testing/SKILL.md +225 -0
  74. package/assets/skills/consultancy-practices/SKILL.md +202 -0
  75. package/assets/skills/context-driven-testing/SKILL.md +196 -0
  76. package/assets/skills/contract-testing/SKILL.md +222 -0
  77. package/assets/skills/database-testing/SKILL.md +244 -0
  78. package/assets/skills/exploratory-testing-advanced/SKILL.md +201 -0
  79. package/assets/skills/flow-nexus-neural/SKILL.md +738 -0
  80. package/assets/skills/flow-nexus-platform/SKILL.md +1157 -0
  81. package/assets/skills/flow-nexus-swarm/SKILL.md +610 -0
  82. package/assets/skills/github-code-review/SKILL.md +1140 -0
  83. package/assets/skills/github-multi-repo/SKILL.md +874 -0
  84. package/assets/skills/github-project-management/SKILL.md +1277 -0
  85. package/assets/skills/github-release-management/SKILL.md +1081 -0
  86. package/assets/skills/github-workflow-automation/SKILL.md +1065 -0
  87. package/assets/skills/hive-mind-advanced/SKILL.md +712 -0
  88. package/assets/skills/holistic-testing-pact/SKILL.md +171 -0
  89. package/assets/skills/hooks-automation/SKILL.md +1201 -0
  90. package/assets/skills/localization-testing/SKILL.md +221 -0
  91. package/assets/skills/mobile-testing/SKILL.md +219 -0
  92. package/assets/skills/mutation-testing/SKILL.md +229 -0
  93. package/assets/skills/n8n-expression-testing/SKILL.md +434 -0
  94. package/assets/skills/n8n-integration-testing-patterns/SKILL.md +540 -0
  95. package/assets/skills/n8n-security-testing/SKILL.md +599 -0
  96. package/assets/skills/n8n-trigger-testing-strategies/SKILL.md +541 -0
  97. package/assets/skills/n8n-workflow-testing-fundamentals/SKILL.md +447 -0
  98. package/assets/skills/pair-programming/SKILL.md +1202 -0
  99. package/assets/skills/performance-analysis/SKILL.md +563 -0
  100. package/assets/skills/performance-testing/SKILL.md +310 -0
  101. package/assets/skills/quality-metrics/SKILL.md +225 -0
  102. package/assets/skills/reasoningbank-agentdb/SKILL.md +446 -0
  103. package/assets/skills/reasoningbank-intelligence/SKILL.md +201 -0
  104. package/assets/skills/refactoring-patterns/SKILL.md +205 -0
  105. package/assets/skills/regression-testing/SKILL.md +227 -0
  106. package/assets/skills/risk-based-testing/SKILL.md +206 -0
  107. package/assets/skills/security-testing/SKILL.md +306 -0
  108. package/assets/skills/sherlock-review/SKILL.md +250 -0
  109. package/assets/skills/shift-left-testing/SKILL.md +225 -0
  110. package/assets/skills/shift-right-testing/SKILL.md +227 -0
  111. package/assets/skills/six-thinking-hats/README.md +190 -0
  112. package/assets/skills/six-thinking-hats/SKILL.md +280 -0
  113. package/assets/skills/six-thinking-hats/resources/examples/api-testing-example.md +345 -0
  114. package/assets/skills/six-thinking-hats/resources/templates/solo-session-template.md +167 -0
  115. package/assets/skills/six-thinking-hats/resources/templates/team-session-template.md +336 -0
  116. package/assets/skills/skill-builder/SKILL.md +910 -0
  117. package/assets/skills/sparc-methodology/SKILL.md +1115 -0
  118. package/assets/skills/stream-chain/SKILL.md +563 -0
  119. package/assets/skills/swarm-advanced/SKILL.md +973 -0
  120. package/assets/skills/swarm-orchestration/SKILL.md +179 -0
  121. package/assets/skills/tdd-london-chicago/SKILL.md +244 -0
  122. package/assets/skills/technical-writing/SKILL.md +178 -0
  123. package/assets/skills/test-automation-strategy/SKILL.md +230 -0
  124. package/assets/skills/test-data-management/SKILL.md +270 -0
  125. package/assets/skills/test-design-techniques/SKILL.md +244 -0
  126. package/assets/skills/test-environment-management/SKILL.md +243 -0
  127. package/assets/skills/test-reporting-analytics/SKILL.md +214 -0
  128. package/assets/skills/testability-scoring/README.md +71 -0
  129. package/assets/skills/testability-scoring/SKILL.md +346 -0
  130. package/assets/skills/testability-scoring/resources/templates/config.template.js +84 -0
  131. package/assets/skills/testability-scoring/resources/templates/testability-scoring.spec.template.js +532 -0
  132. package/assets/skills/testability-scoring/scripts/generate-html-report.js +1007 -0
  133. package/assets/skills/testability-scoring/scripts/run-assessment.sh +70 -0
  134. package/assets/skills/v3-qe-chaos-resilience/SKILL.md +238 -0
  135. package/assets/skills/v3-qe-code-intelligence/SKILL.md +209 -0
  136. package/assets/skills/v3-qe-contract-testing/SKILL.md +218 -0
  137. package/assets/skills/v3-qe-coverage-analysis/SKILL.md +187 -0
  138. package/assets/skills/v3-qe-defect-intelligence/SKILL.md +205 -0
  139. package/assets/skills/v3-qe-learning-optimization/SKILL.md +238 -0
  140. package/assets/skills/v3-qe-quality-assessment/SKILL.md +213 -0
  141. package/assets/skills/v3-qe-requirements-validation/SKILL.md +248 -0
  142. package/assets/skills/v3-qe-test-execution/SKILL.md +182 -0
  143. package/assets/skills/v3-qe-test-generation/SKILL.md +141 -0
  144. package/assets/skills/v3-qe-visual-accessibility/SKILL.md +242 -0
  145. package/assets/skills/verification-quality/SKILL.md +649 -0
  146. package/assets/skills/visual-testing-advanced/SKILL.md +219 -0
  147. package/assets/skills/xp-practices/SKILL.md +229 -0
  148. package/dist/cli/bundle.js +23 -13
  149. package/dist/init/agents-installer.js +4 -4
  150. package/dist/init/agents-installer.js.map +1 -1
  151. package/dist/init/init-wizard.d.ts.map +1 -1
  152. package/dist/init/init-wizard.js +15 -5
  153. package/dist/init/init-wizard.js.map +1 -1
  154. package/dist/init/skills-installer.js +4 -4
  155. package/dist/init/skills-installer.js.map +1 -1
  156. package/package.json +7 -1
  157. package/docs/analysis/V3-INIT-REQUIREMENTS-ANALYSIS.md +0 -352
  158. package/implementation/README.md +0 -90
  159. package/implementation/adrs/ADR-030-coherence-gated-quality-gates.md +0 -312
  160. package/implementation/adrs/ADR-031-strange-loop-self-awareness.md +0 -484
  161. package/implementation/adrs/ADR-032-time-crystal-scheduling.md +0 -530
  162. package/implementation/adrs/ADR-033-early-exit-testing.md +0 -634
  163. package/implementation/adrs/ADR-034-neural-topology-optimizer.md +0 -589
  164. package/implementation/adrs/ADR-035-causal-discovery.md +0 -610
  165. package/implementation/adrs/ADR-036-result-persistence.md +0 -326
  166. package/implementation/adrs/ADR-037-v3-qe-agent-naming.md +0 -105
  167. package/implementation/adrs/ADR-038-v3-qe-memory-unification.md +0 -154
  168. package/implementation/adrs/ADR-039-v3-qe-mcp-optimization.md +0 -179
  169. package/implementation/adrs/ADR-040-v3-qe-agentic-flow-integration.md +0 -240
  170. package/implementation/adrs/ADR-041-v3-qe-cli-enhancement.md +0 -296
  171. package/implementation/adrs/ADR-042-v3-qe-token-tracking-integration.md +0 -517
  172. package/implementation/adrs/v3-adrs.md +0 -2783
  173. package/implementation/planning/AQE-V3-MASTER-PLAN.md +0 -815
  174. package/security-scan-report-2026-01-11.md +0 -410
  175. package/security-verification-report-2026-01-11.md +0 -278
  176. package/src/benchmarks/performance-benchmarks.ts +0 -646
  177. package/src/benchmarks/run-benchmarks.ts +0 -324
  178. package/src/causal-discovery/causal-graph.ts +0 -450
  179. package/src/causal-discovery/discovery-engine.ts +0 -438
  180. package/src/causal-discovery/index.ts +0 -117
  181. package/src/causal-discovery/types.ts +0 -456
  182. package/src/causal-discovery/weight-matrix.ts +0 -453
  183. package/src/cli/commands/qe-tools.ts +0 -634
  184. package/src/cli/index.ts +0 -1976
  185. package/src/compatibility/agent-mapper.ts +0 -291
  186. package/src/compatibility/cli-adapter.ts +0 -277
  187. package/src/compatibility/config-migrator.ts +0 -334
  188. package/src/compatibility/index.ts +0 -112
  189. package/src/compatibility/mcp-adapter.ts +0 -248
  190. package/src/compatibility/types.ts +0 -156
  191. package/src/coordination/claims/claim-repository.ts +0 -636
  192. package/src/coordination/claims/claim-service.ts +0 -675
  193. package/src/coordination/claims/handoff-manager.ts +0 -535
  194. package/src/coordination/claims/index.ts +0 -276
  195. package/src/coordination/claims/interfaces.ts +0 -687
  196. package/src/coordination/claims/work-stealing.ts +0 -436
  197. package/src/coordination/cross-domain-router.ts +0 -492
  198. package/src/coordination/index.ts +0 -127
  199. package/src/coordination/interfaces.ts +0 -691
  200. package/src/coordination/protocol-executor.ts +0 -760
  201. package/src/coordination/protocols/code-intelligence-index.ts +0 -855
  202. package/src/coordination/protocols/defect-investigation.ts +0 -1184
  203. package/src/coordination/protocols/index.ts +0 -11
  204. package/src/coordination/protocols/learning-consolidation.ts +0 -1181
  205. package/src/coordination/protocols/morning-sync.ts +0 -1055
  206. package/src/coordination/protocols/quality-gate.ts +0 -1566
  207. package/src/coordination/protocols/security-audit.ts +0 -1587
  208. package/src/coordination/queen-coordinator.ts +0 -1176
  209. package/src/coordination/result-saver.ts +0 -780
  210. package/src/coordination/task-executor.ts +0 -1146
  211. package/src/coordination/workflow-orchestrator.ts +0 -1917
  212. package/src/domains/chaos-resilience/coordinator.ts +0 -1032
  213. package/src/domains/chaos-resilience/index.ts +0 -143
  214. package/src/domains/chaos-resilience/interfaces.ts +0 -659
  215. package/src/domains/chaos-resilience/plugin.ts +0 -691
  216. package/src/domains/chaos-resilience/services/chaos-engineer.ts +0 -1097
  217. package/src/domains/chaos-resilience/services/index.ts +0 -19
  218. package/src/domains/chaos-resilience/services/load-tester.ts +0 -799
  219. package/src/domains/chaos-resilience/services/performance-profiler.ts +0 -792
  220. package/src/domains/code-intelligence/coordinator.ts +0 -631
  221. package/src/domains/code-intelligence/index.ts +0 -86
  222. package/src/domains/code-intelligence/interfaces.ts +0 -162
  223. package/src/domains/code-intelligence/plugin.ts +0 -451
  224. package/src/domains/code-intelligence/services/impact-analyzer.ts +0 -567
  225. package/src/domains/code-intelligence/services/index.ts +0 -26
  226. package/src/domains/code-intelligence/services/knowledge-graph.ts +0 -1067
  227. package/src/domains/code-intelligence/services/semantic-analyzer.ts +0 -901
  228. package/src/domains/contract-testing/coordinator.ts +0 -1038
  229. package/src/domains/contract-testing/index.ts +0 -122
  230. package/src/domains/contract-testing/interfaces.ts +0 -458
  231. package/src/domains/contract-testing/plugin.ts +0 -746
  232. package/src/domains/contract-testing/services/api-compatibility.ts +0 -748
  233. package/src/domains/contract-testing/services/contract-validator.ts +0 -1700
  234. package/src/domains/contract-testing/services/index.ts +0 -19
  235. package/src/domains/contract-testing/services/schema-validator.ts +0 -1102
  236. package/src/domains/coverage-analysis/coordinator.ts +0 -485
  237. package/src/domains/coverage-analysis/index.ts +0 -114
  238. package/src/domains/coverage-analysis/interfaces.ts +0 -142
  239. package/src/domains/coverage-analysis/plugin.ts +0 -172
  240. package/src/domains/coverage-analysis/services/coverage-analyzer.ts +0 -449
  241. package/src/domains/coverage-analysis/services/coverage-embedder.ts +0 -733
  242. package/src/domains/coverage-analysis/services/coverage-parser.ts +0 -753
  243. package/src/domains/coverage-analysis/services/gap-detector.ts +0 -592
  244. package/src/domains/coverage-analysis/services/hnsw-index.ts +0 -728
  245. package/src/domains/coverage-analysis/services/index.ts +0 -61
  246. package/src/domains/coverage-analysis/services/risk-scorer.ts +0 -540
  247. package/src/domains/coverage-analysis/services/sublinear-analyzer.ts +0 -747
  248. package/src/domains/defect-intelligence/coordinator.ts +0 -635
  249. package/src/domains/defect-intelligence/index.ts +0 -83
  250. package/src/domains/defect-intelligence/interfaces.ts +0 -152
  251. package/src/domains/defect-intelligence/plugin.ts +0 -483
  252. package/src/domains/defect-intelligence/services/causal-root-cause-analyzer.ts +0 -494
  253. package/src/domains/defect-intelligence/services/defect-predictor.ts +0 -852
  254. package/src/domains/defect-intelligence/services/index.ts +0 -37
  255. package/src/domains/defect-intelligence/services/pattern-learner.ts +0 -738
  256. package/src/domains/defect-intelligence/services/root-cause-analyzer.ts +0 -637
  257. package/src/domains/domain-interface.ts +0 -77
  258. package/src/domains/index.ts +0 -23
  259. package/src/domains/learning-optimization/coordinator.ts +0 -1215
  260. package/src/domains/learning-optimization/index.ts +0 -127
  261. package/src/domains/learning-optimization/interfaces.ts +0 -570
  262. package/src/domains/learning-optimization/plugin.ts +0 -851
  263. package/src/domains/learning-optimization/services/index.ts +0 -29
  264. package/src/domains/learning-optimization/services/learning-coordinator.ts +0 -972
  265. package/src/domains/learning-optimization/services/metrics-optimizer.ts +0 -915
  266. package/src/domains/learning-optimization/services/production-intel.ts +0 -971
  267. package/src/domains/learning-optimization/services/transfer-specialist.ts +0 -723
  268. package/src/domains/quality-assessment/coherence/gate-controller.ts +0 -549
  269. package/src/domains/quality-assessment/coherence/index.ts +0 -211
  270. package/src/domains/quality-assessment/coherence/lambda-calculator.ts +0 -384
  271. package/src/domains/quality-assessment/coherence/partition-detector.ts +0 -469
  272. package/src/domains/quality-assessment/coherence/types.ts +0 -384
  273. package/src/domains/quality-assessment/coordinator.ts +0 -605
  274. package/src/domains/quality-assessment/index.ts +0 -97
  275. package/src/domains/quality-assessment/interfaces.ts +0 -152
  276. package/src/domains/quality-assessment/plugin.ts +0 -496
  277. package/src/domains/quality-assessment/services/coherence-gate.ts +0 -358
  278. package/src/domains/quality-assessment/services/deployment-advisor.ts +0 -571
  279. package/src/domains/quality-assessment/services/index.ts +0 -34
  280. package/src/domains/quality-assessment/services/quality-analyzer.ts +0 -670
  281. package/src/domains/quality-assessment/services/quality-gate.ts +0 -384
  282. package/src/domains/requirements-validation/coordinator.ts +0 -812
  283. package/src/domains/requirements-validation/index.ts +0 -92
  284. package/src/domains/requirements-validation/interfaces.ts +0 -303
  285. package/src/domains/requirements-validation/plugin.ts +0 -576
  286. package/src/domains/requirements-validation/services/bdd-scenario-writer.ts +0 -676
  287. package/src/domains/requirements-validation/services/index.ts +0 -20
  288. package/src/domains/requirements-validation/services/requirements-validator.ts +0 -559
  289. package/src/domains/requirements-validation/services/testability-scorer.ts +0 -639
  290. package/src/domains/security-compliance/coordinator.ts +0 -757
  291. package/src/domains/security-compliance/index.ts +0 -120
  292. package/src/domains/security-compliance/interfaces.ts +0 -434
  293. package/src/domains/security-compliance/plugin.ts +0 -509
  294. package/src/domains/security-compliance/services/compliance-validator.ts +0 -1226
  295. package/src/domains/security-compliance/services/index.ts +0 -31
  296. package/src/domains/security-compliance/services/security-auditor.ts +0 -2227
  297. package/src/domains/security-compliance/services/security-scanner.ts +0 -2354
  298. package/src/domains/security-compliance/services/semgrep-integration.ts +0 -289
  299. package/src/domains/test-execution/coordinator.ts +0 -426
  300. package/src/domains/test-execution/index.ts +0 -76
  301. package/src/domains/test-execution/interfaces.ts +0 -119
  302. package/src/domains/test-execution/plugin.ts +0 -208
  303. package/src/domains/test-execution/services/flaky-detector.ts +0 -1240
  304. package/src/domains/test-execution/services/index.ts +0 -8
  305. package/src/domains/test-execution/services/retry-handler.ts +0 -820
  306. package/src/domains/test-execution/services/test-executor.ts +0 -885
  307. package/src/domains/test-generation/coordinator.ts +0 -656
  308. package/src/domains/test-generation/index.ts +0 -77
  309. package/src/domains/test-generation/interfaces.ts +0 -118
  310. package/src/domains/test-generation/plugin.ts +0 -397
  311. package/src/domains/test-generation/services/index.ts +0 -23
  312. package/src/domains/test-generation/services/pattern-matcher.ts +0 -1725
  313. package/src/domains/test-generation/services/test-generator.ts +0 -2750
  314. package/src/domains/visual-accessibility/coordinator.ts +0 -860
  315. package/src/domains/visual-accessibility/index.ts +0 -116
  316. package/src/domains/visual-accessibility/interfaces.ts +0 -435
  317. package/src/domains/visual-accessibility/plugin.ts +0 -568
  318. package/src/domains/visual-accessibility/services/accessibility-tester.ts +0 -982
  319. package/src/domains/visual-accessibility/services/axe-core-audit.ts +0 -630
  320. package/src/domains/visual-accessibility/services/index.ts +0 -28
  321. package/src/domains/visual-accessibility/services/responsive-tester.ts +0 -934
  322. package/src/domains/visual-accessibility/services/visual-tester.ts +0 -458
  323. package/src/early-exit/early-exit-controller.ts +0 -490
  324. package/src/early-exit/early-exit-decision.ts +0 -391
  325. package/src/early-exit/index.ts +0 -115
  326. package/src/early-exit/quality-signal.ts +0 -389
  327. package/src/early-exit/speculative-executor.ts +0 -505
  328. package/src/early-exit/types.ts +0 -407
  329. package/src/feedback/coverage-learner.ts +0 -456
  330. package/src/feedback/feedback-loop.ts +0 -426
  331. package/src/feedback/index.ts +0 -72
  332. package/src/feedback/pattern-promotion.ts +0 -373
  333. package/src/feedback/quality-score-calculator.ts +0 -334
  334. package/src/feedback/test-outcome-tracker.ts +0 -450
  335. package/src/feedback/types.ts +0 -497
  336. package/src/index.ts +0 -224
  337. package/src/init/agents-installer.ts +0 -536
  338. package/src/init/index.ts +0 -80
  339. package/src/init/init-wizard.ts +0 -1061
  340. package/src/init/project-analyzer.ts +0 -696
  341. package/src/init/self-configurator.ts +0 -488
  342. package/src/init/skills-installer.ts +0 -467
  343. package/src/init/types.ts +0 -432
  344. package/src/integrations/ruvector/ast-complexity.ts +0 -470
  345. package/src/integrations/ruvector/coverage-router.ts +0 -594
  346. package/src/integrations/ruvector/diff-risk-classifier.ts +0 -759
  347. package/src/integrations/ruvector/fallback.ts +0 -942
  348. package/src/integrations/ruvector/graph-boundaries.ts +0 -809
  349. package/src/integrations/ruvector/index.ts +0 -363
  350. package/src/integrations/ruvector/interfaces.ts +0 -609
  351. package/src/integrations/ruvector/q-learning-router.ts +0 -550
  352. package/src/kernel/agent-coordinator.ts +0 -165
  353. package/src/kernel/agentdb-backend.ts +0 -504
  354. package/src/kernel/event-bus.ts +0 -129
  355. package/src/kernel/hybrid-backend.ts +0 -538
  356. package/src/kernel/index.ts +0 -28
  357. package/src/kernel/interfaces.ts +0 -257
  358. package/src/kernel/kernel.ts +0 -285
  359. package/src/kernel/memory-backend.ts +0 -169
  360. package/src/kernel/memory-factory.ts +0 -293
  361. package/src/kernel/plugin-loader.ts +0 -179
  362. package/src/learning/index.ts +0 -219
  363. package/src/learning/pattern-store.ts +0 -990
  364. package/src/learning/qe-guidance.ts +0 -832
  365. package/src/learning/qe-hooks.ts +0 -644
  366. package/src/learning/qe-patterns.ts +0 -449
  367. package/src/learning/qe-reasoning-bank.ts +0 -951
  368. package/src/learning/real-embeddings.ts +0 -277
  369. package/src/learning/real-qe-reasoning-bank.ts +0 -833
  370. package/src/learning/sqlite-persistence.ts +0 -554
  371. package/src/mcp/entry.ts +0 -59
  372. package/src/mcp/handlers/agent-handlers.ts +0 -285
  373. package/src/mcp/handlers/core-handlers.ts +0 -317
  374. package/src/mcp/handlers/domain-handlers.ts +0 -1444
  375. package/src/mcp/handlers/index.ts +0 -57
  376. package/src/mcp/handlers/memory-handlers.ts +0 -338
  377. package/src/mcp/handlers/task-handlers.ts +0 -363
  378. package/src/mcp/index.ts +0 -30
  379. package/src/mcp/metrics/index.ts +0 -14
  380. package/src/mcp/metrics/metrics-collector.ts +0 -503
  381. package/src/mcp/protocol-server.ts +0 -752
  382. package/src/mcp/security/cve-prevention.ts +0 -742
  383. package/src/mcp/security/index.ts +0 -356
  384. package/src/mcp/security/oauth21-provider.ts +0 -821
  385. package/src/mcp/security/rate-limiter.ts +0 -615
  386. package/src/mcp/security/sampling-server.ts +0 -662
  387. package/src/mcp/security/schema-validator.ts +0 -855
  388. package/src/mcp/server.ts +0 -657
  389. package/src/mcp/tool-registry.ts +0 -391
  390. package/src/mcp/tools/base.ts +0 -399
  391. package/src/mcp/tools/chaos-resilience/inject.ts +0 -699
  392. package/src/mcp/tools/code-intelligence/analyze.ts +0 -745
  393. package/src/mcp/tools/contract-testing/validate.ts +0 -708
  394. package/src/mcp/tools/coverage-analysis/index.ts +0 -770
  395. package/src/mcp/tools/defect-intelligence/predict.ts +0 -466
  396. package/src/mcp/tools/index.ts +0 -214
  397. package/src/mcp/tools/learning-optimization/optimize.ts +0 -772
  398. package/src/mcp/tools/quality-assessment/evaluate.ts +0 -385
  399. package/src/mcp/tools/registry.ts +0 -248
  400. package/src/mcp/tools/requirements-validation/validate.ts +0 -394
  401. package/src/mcp/tools/security-compliance/scan.ts +0 -365
  402. package/src/mcp/tools/test-execution/execute.ts +0 -291
  403. package/src/mcp/tools/test-generation/generate.ts +0 -544
  404. package/src/mcp/tools/visual-accessibility/index.ts +0 -791
  405. package/src/mcp/transport/index.ts +0 -31
  406. package/src/mcp/transport/stdio.ts +0 -318
  407. package/src/mcp/types.ts +0 -543
  408. package/src/neural-optimizer/index.ts +0 -111
  409. package/src/neural-optimizer/replay-buffer.ts +0 -455
  410. package/src/neural-optimizer/swarm-topology.ts +0 -508
  411. package/src/neural-optimizer/topology-optimizer.ts +0 -828
  412. package/src/neural-optimizer/types.ts +0 -481
  413. package/src/neural-optimizer/value-network.ts +0 -351
  414. package/src/optimization/auto-tuner.ts +0 -817
  415. package/src/optimization/index.ts +0 -77
  416. package/src/optimization/metric-collectors.ts +0 -474
  417. package/src/optimization/qe-workers.ts +0 -704
  418. package/src/optimization/tuning-algorithm.ts +0 -401
  419. package/src/optimization/types.ts +0 -314
  420. package/src/routing/index.ts +0 -51
  421. package/src/routing/qe-agent-registry.ts +0 -963
  422. package/src/routing/qe-task-router.ts +0 -564
  423. package/src/routing/routing-feedback.ts +0 -365
  424. package/src/routing/types.ts +0 -406
  425. package/src/shared/embeddings/embedding-cache.ts +0 -157
  426. package/src/shared/embeddings/index.ts +0 -50
  427. package/src/shared/embeddings/nomic-embedder.ts +0 -404
  428. package/src/shared/embeddings/ollama-client.ts +0 -195
  429. package/src/shared/embeddings/types.ts +0 -147
  430. package/src/shared/entities/agent.ts +0 -141
  431. package/src/shared/entities/base-entity.ts +0 -79
  432. package/src/shared/entities/index.ts +0 -6
  433. package/src/shared/events/domain-events.ts +0 -259
  434. package/src/shared/events/index.ts +0 -5
  435. package/src/shared/git/git-analyzer.ts +0 -656
  436. package/src/shared/git/index.ts +0 -11
  437. package/src/shared/http/http-client.ts +0 -420
  438. package/src/shared/http/index.ts +0 -13
  439. package/src/shared/index.ts +0 -41
  440. package/src/shared/io/file-reader.ts +0 -525
  441. package/src/shared/io/index.ts +0 -25
  442. package/src/shared/llm/cache.ts +0 -473
  443. package/src/shared/llm/circuit-breaker.ts +0 -369
  444. package/src/shared/llm/cost-tracker.ts +0 -460
  445. package/src/shared/llm/index.ts +0 -140
  446. package/src/shared/llm/interfaces.ts +0 -629
  447. package/src/shared/llm/provider-manager.ts +0 -685
  448. package/src/shared/llm/providers/claude.ts +0 -524
  449. package/src/shared/llm/providers/index.ts +0 -8
  450. package/src/shared/llm/providers/ollama.ts +0 -575
  451. package/src/shared/llm/providers/openai.ts +0 -609
  452. package/src/shared/metrics/code-metrics.ts +0 -520
  453. package/src/shared/metrics/index.ts +0 -23
  454. package/src/shared/metrics/system-metrics.ts +0 -353
  455. package/src/shared/parsers/index.ts +0 -6
  456. package/src/shared/parsers/typescript-parser.ts +0 -841
  457. package/src/shared/security/compliance-patterns.ts +0 -666
  458. package/src/shared/security/index.ts +0 -30
  459. package/src/shared/security/osv-client.ts +0 -468
  460. package/src/shared/types/index.ts +0 -150
  461. package/src/shared/value-objects/index.ts +0 -273
  462. package/src/strange-loop/healing-controller.ts +0 -833
  463. package/src/strange-loop/index.ts +0 -104
  464. package/src/strange-loop/self-model.ts +0 -494
  465. package/src/strange-loop/strange-loop.ts +0 -446
  466. package/src/strange-loop/swarm-observer.ts +0 -448
  467. package/src/strange-loop/topology-analyzer.ts +0 -565
  468. package/src/strange-loop/types.ts +0 -640
  469. package/src/time-crystal/default-phases.ts +0 -520
  470. package/src/time-crystal/index.ts +0 -164
  471. package/src/time-crystal/oscillator.ts +0 -425
  472. package/src/time-crystal/phase-executor.ts +0 -521
  473. package/src/time-crystal/scheduler.ts +0 -1025
  474. package/src/time-crystal/test-runner.ts +0 -787
  475. package/src/time-crystal/types.ts +0 -421
  476. package/src/workers/base-worker.ts +0 -304
  477. package/src/workers/daemon.ts +0 -264
  478. package/src/workers/index.ts +0 -119
  479. package/src/workers/interfaces.ts +0 -393
  480. package/src/workers/worker-manager.ts +0 -424
  481. package/src/workers/workers/compliance-checker.ts +0 -445
  482. package/src/workers/workers/coverage-tracker.ts +0 -344
  483. package/src/workers/workers/defect-predictor.ts +0 -375
  484. package/src/workers/workers/flaky-detector.ts +0 -390
  485. package/src/workers/workers/index.ts +0 -17
  486. package/src/workers/workers/learning-consolidation.ts +0 -442
  487. package/src/workers/workers/performance-baseline.ts +0 -434
  488. package/src/workers/workers/quality-gate.ts +0 -419
  489. package/src/workers/workers/regression-monitor.ts +0 -357
  490. package/src/workers/workers/security-scan.ts +0 -349
  491. package/src/workers/workers/test-health.ts +0 -359
  492. package/tests/integration/code-intelligence/knowledge-graph-real.test.ts +0 -540
  493. package/tests/integration/coordination/cross-domain-router.test.ts +0 -403
  494. package/tests/integration/coordination/protocol-executor.test.ts +0 -454
  495. package/tests/integration/coordination/workflow-orchestrator.test.ts +0 -418
  496. package/tests/integration/feedback/feedback-loop-integration.test.ts +0 -560
  497. package/tests/integration/migration/v2-to-v3-migration.test.ts +0 -471
  498. package/tests/integration/parsers/typescript-parser.test.ts +0 -463
  499. package/tests/integration/security/vulnerability-detection.test.ts +0 -628
  500. package/tests/integration/test-execution/coordinator.test.ts +0 -410
  501. package/tests/integration/test-generation/coordinator.test.ts +0 -361
  502. package/tests/mocks/index.ts +0 -228
  503. package/tests/time-crystal/default-phases.test.ts +0 -476
  504. package/tests/time-crystal/oscillator.test.ts +0 -541
  505. package/tests/time-crystal/phase-executor.test.ts +0 -653
  506. package/tests/time-crystal/scheduler.test.ts +0 -626
  507. package/tests/time-crystal/test-runner.test.ts +0 -594
  508. package/tests/unit/causal-discovery/causal-graph.test.ts +0 -504
  509. package/tests/unit/causal-discovery/causal-root-cause-analyzer.test.ts +0 -347
  510. package/tests/unit/causal-discovery/discovery-engine.test.ts +0 -435
  511. package/tests/unit/causal-discovery/weight-matrix.test.ts +0 -328
  512. package/tests/unit/cli/cli.test.ts +0 -341
  513. package/tests/unit/cli/commands.test.ts +0 -414
  514. package/tests/unit/cli/init-command.test.ts +0 -274
  515. package/tests/unit/cli/migrate-command.test.ts +0 -396
  516. package/tests/unit/coordination/claims/claim-service.test.ts +0 -949
  517. package/tests/unit/coordination/claims/handoff-manager.test.ts +0 -773
  518. package/tests/unit/coordination/claims/work-stealing.test.ts +0 -492
  519. package/tests/unit/coordination/queen-coordinator.test.ts +0 -966
  520. package/tests/unit/coordination/result-saver.test.ts +0 -653
  521. package/tests/unit/coordination/task-executor.test.ts +0 -810
  522. package/tests/unit/domains/chaos-resilience/chaos-engineer.test.ts +0 -484
  523. package/tests/unit/domains/chaos-resilience/load-tester.test.ts +0 -559
  524. package/tests/unit/domains/chaos-resilience/performance-profiler.test.ts +0 -490
  525. package/tests/unit/domains/code-intelligence/impact-analyzer.test.ts +0 -560
  526. package/tests/unit/domains/code-intelligence/knowledge-graph.test.ts +0 -460
  527. package/tests/unit/domains/code-intelligence/semantic-analyzer.test.ts +0 -584
  528. package/tests/unit/domains/contract-testing/api-compatibility.test.ts +0 -483
  529. package/tests/unit/domains/contract-testing/contract-validator.test.ts +0 -370
  530. package/tests/unit/domains/contract-testing/schema-validator.test.ts +0 -610
  531. package/tests/unit/domains/coverage-analysis/coverage-embedder.test.ts +0 -298
  532. package/tests/unit/domains/coverage-analysis/hnsw-index.test.ts +0 -292
  533. package/tests/unit/domains/coverage-analysis/sublinear-analyzer.test.ts +0 -506
  534. package/tests/unit/domains/defect-intelligence/defect-predictor.test.ts +0 -370
  535. package/tests/unit/domains/defect-intelligence/pattern-learner.test.ts +0 -546
  536. package/tests/unit/domains/defect-intelligence/root-cause-analyzer.test.ts +0 -534
  537. package/tests/unit/domains/learning-optimization/learning-coordinator.test.ts +0 -541
  538. package/tests/unit/domains/learning-optimization/metrics-optimizer.test.ts +0 -552
  539. package/tests/unit/domains/learning-optimization/production-intel.test.ts +0 -589
  540. package/tests/unit/domains/learning-optimization/transfer-specialist.test.ts +0 -453
  541. package/tests/unit/domains/quality-assessment/coherence-gate.test.ts +0 -1006
  542. package/tests/unit/domains/quality-assessment/deployment-advisor.test.ts +0 -515
  543. package/tests/unit/domains/quality-assessment/quality-analyzer.test.ts +0 -401
  544. package/tests/unit/domains/quality-assessment/quality-gate.test.ts +0 -324
  545. package/tests/unit/domains/requirements-validation/bdd-scenario-writer.test.ts +0 -479
  546. package/tests/unit/domains/requirements-validation/requirements-validator.test.ts +0 -452
  547. package/tests/unit/domains/requirements-validation/testability-scorer.test.ts +0 -505
  548. package/tests/unit/domains/security-compliance/compliance-validator.test.ts +0 -500
  549. package/tests/unit/domains/security-compliance/security-auditor.test.ts +0 -498
  550. package/tests/unit/domains/security-compliance/security-scanner.test.ts +0 -412
  551. package/tests/unit/domains/visual-accessibility/accessibility-tester.test.ts +0 -432
  552. package/tests/unit/domains/visual-accessibility/responsive-tester.test.ts +0 -506
  553. package/tests/unit/domains/visual-accessibility/visual-tester.test.ts +0 -412
  554. package/tests/unit/early-exit/early-exit-controller.test.ts +0 -548
  555. package/tests/unit/early-exit/early-exit-decision.test.ts +0 -617
  556. package/tests/unit/early-exit/index.test.ts +0 -254
  557. package/tests/unit/early-exit/quality-signal.test.ts +0 -589
  558. package/tests/unit/early-exit/speculative-executor.test.ts +0 -453
  559. package/tests/unit/feedback/coverage-learner.test.ts +0 -288
  560. package/tests/unit/feedback/feedback-loop.test.ts +0 -458
  561. package/tests/unit/feedback/pattern-promotion.test.ts +0 -390
  562. package/tests/unit/feedback/quality-score-calculator.test.ts +0 -364
  563. package/tests/unit/feedback/test-outcome-tracker.test.ts +0 -243
  564. package/tests/unit/init/init-wizard.test.ts +0 -881
  565. package/tests/unit/init/project-analyzer.test.ts +0 -807
  566. package/tests/unit/init/self-configurator.test.ts +0 -493
  567. package/tests/unit/integrations/ruvector/ast-complexity.test.ts +0 -240
  568. package/tests/unit/integrations/ruvector/coverage-router.test.ts +0 -366
  569. package/tests/unit/integrations/ruvector/diff-risk-classifier.test.ts +0 -340
  570. package/tests/unit/integrations/ruvector/graph-boundaries.test.ts +0 -355
  571. package/tests/unit/integrations/ruvector/q-learning-router.test.ts +0 -314
  572. package/tests/unit/kernel/agent-coordinator.test.ts +0 -220
  573. package/tests/unit/kernel/event-bus.test.ts +0 -197
  574. package/tests/unit/learning/qe-reasoning-bank.test.ts +0 -666
  575. package/tests/unit/learning/real-qe-reasoning-bank.benchmark.test.ts +0 -415
  576. package/tests/unit/mcp/mcp-server.test.ts +0 -544
  577. package/tests/unit/mcp/metrics/metrics-collector.test.ts +0 -340
  578. package/tests/unit/mcp/security/cve-prevention.test.ts +0 -512
  579. package/tests/unit/mcp/security/oauth21-provider.test.ts +0 -624
  580. package/tests/unit/mcp/security/rate-limiter.test.ts +0 -410
  581. package/tests/unit/mcp/security/sampling-server.test.ts +0 -420
  582. package/tests/unit/mcp/security/schema-validator.test.ts +0 -494
  583. package/tests/unit/mcp/tools/base.test.ts +0 -336
  584. package/tests/unit/mcp/tools/domain-tools.test.ts +0 -759
  585. package/tests/unit/mcp/tools/registry.test.ts +0 -240
  586. package/tests/unit/neural-optimizer/replay-buffer.test.ts +0 -403
  587. package/tests/unit/neural-optimizer/swarm-topology.test.ts +0 -473
  588. package/tests/unit/neural-optimizer/topology-optimizer.test.ts +0 -595
  589. package/tests/unit/neural-optimizer/value-network.test.ts +0 -343
  590. package/tests/unit/optimization/auto-tuner.test.ts +0 -506
  591. package/tests/unit/optimization/metric-collectors.test.ts +0 -352
  592. package/tests/unit/optimization/qe-workers.test.ts +0 -407
  593. package/tests/unit/optimization/tuning-algorithm.test.ts +0 -467
  594. package/tests/unit/routing/qe-agent-registry.test.ts +0 -229
  595. package/tests/unit/routing/qe-task-router.test.ts +0 -390
  596. package/tests/unit/routing/routing-feedback.test.ts +0 -339
  597. package/tests/unit/shared/embeddings/nomic-embedder.test.ts +0 -419
  598. package/tests/unit/shared/http/http-client.test.ts +0 -719
  599. package/tests/unit/shared/io/file-reader.test.ts +0 -511
  600. package/tests/unit/shared/llm/cache.test.ts +0 -391
  601. package/tests/unit/shared/llm/circuit-breaker.test.ts +0 -293
  602. package/tests/unit/shared/llm/cost-tracker.test.ts +0 -431
  603. package/tests/unit/shared/llm/provider-manager.test.ts +0 -550
  604. package/tests/unit/shared/llm/providers.test.ts +0 -532
  605. package/tests/unit/shared/parsers/typescript-parser.test.ts +0 -693
  606. package/tests/unit/shared/value-objects.test.ts +0 -184
  607. package/tests/unit/strange-loop/strange-loop.test.ts +0 -1170
  608. package/tests/unit/workers/base-worker.test.ts +0 -341
  609. package/tests/unit/workers/daemon.test.ts +0 -291
  610. package/tests/unit/workers/worker-manager.test.ts +0 -284
  611. package/tsconfig.json +0 -32
  612. package/vitest.config.ts +0 -27
@@ -1,1566 +0,0 @@
1
- /**
2
- * Agentic QE v3 - Quality Gate Protocol
3
- * Cross-domain protocol for release candidate quality gate evaluation
4
- *
5
- * Trigger: Release candidate event
6
- * Participants: Queen, Quality Gate, Coverage, Regression, Security domains
7
- * Actions: Aggregate metrics, evaluate, ML risk assessment, recommend
8
- */
9
-
10
- import { v4 as uuidv4 } from 'uuid';
11
- import {
12
- Result,
13
- ok,
14
- err,
15
- DomainName,
16
- Severity,
17
- } from '../../shared/types';
18
- import {
19
- EventBus,
20
- MemoryBackend,
21
- AgentCoordinator,
22
- } from '../../kernel/interfaces';
23
- import { createEvent } from '../../shared/events/domain-events';
24
-
25
- // ============================================================================
26
- // Protocol Events
27
- // ============================================================================
28
-
29
- export const QualityGateProtocolEvents = {
30
- QualityGateTriggered: 'coordination.QualityGateTriggered',
31
- QualityGateCompleted: 'coordination.QualityGateCompleted',
32
- DeploymentApproved: 'coordination.DeploymentApproved',
33
- DeploymentBlocked: 'coordination.DeploymentBlocked',
34
- } as const;
35
-
36
- // ============================================================================
37
- // Types
38
- // ============================================================================
39
-
40
- /**
41
- * Release candidate information
42
- */
43
- export interface ReleaseCandidate {
44
- id: string;
45
- version: string;
46
- branch: string;
47
- commitHash: string;
48
- buildId?: string;
49
- artifacts?: string[];
50
- createdAt: Date;
51
- metadata?: Record<string, unknown>;
52
- }
53
-
54
- /**
55
- * Aggregated metrics from all participating domains
56
- */
57
- export interface AggregatedMetrics {
58
- // Coverage metrics
59
- coverage: {
60
- line: number;
61
- branch: number;
62
- function: number;
63
- statement: number;
64
- trend: 'improving' | 'declining' | 'stable';
65
- };
66
-
67
- // Test execution metrics
68
- testExecution: {
69
- total: number;
70
- passed: number;
71
- failed: number;
72
- skipped: number;
73
- passRate: number;
74
- flakyTests: number;
75
- duration: number;
76
- };
77
-
78
- // Quality metrics
79
- quality: {
80
- overallScore: number;
81
- technicalDebt: number;
82
- codeSmells: number;
83
- duplications: number;
84
- criticalBugs: number;
85
- };
86
-
87
- // Security metrics
88
- security: {
89
- vulnerabilities: {
90
- critical: number;
91
- high: number;
92
- medium: number;
93
- low: number;
94
- };
95
- complianceScore: number;
96
- lastAuditDate?: Date;
97
- };
98
-
99
- // Defect intelligence metrics
100
- defects: {
101
- regressionRisk: number;
102
- predictedDefects: number;
103
- hotspotCount: number;
104
- };
105
-
106
- // Metadata
107
- collectedAt: Date;
108
- sources: DomainName[];
109
- }
110
-
111
- /**
112
- * Quality gate check result
113
- */
114
- export interface GateCheckResult {
115
- name: string;
116
- category: 'coverage' | 'tests' | 'quality' | 'security' | 'regression';
117
- passed: boolean;
118
- blocking: boolean;
119
- value: number;
120
- threshold: number;
121
- severity: Severity;
122
- message: string;
123
- }
124
-
125
- /**
126
- * ML-based risk assessment result
127
- */
128
- export interface RiskAssessment {
129
- overallRisk: number;
130
- riskLevel: Severity;
131
- confidence: number;
132
- factors: RiskFactor[];
133
- historicalComparison?: {
134
- similarReleases: number;
135
- successRate: number;
136
- };
137
- predictions: {
138
- defectProbability: number;
139
- rollbackProbability: number;
140
- incidentProbability: number;
141
- };
142
- }
143
-
144
- export interface RiskFactor {
145
- name: string;
146
- contribution: number;
147
- description: string;
148
- mitigationSuggestion?: string;
149
- }
150
-
151
- /**
152
- * Quality gate recommendation
153
- */
154
- export interface QualityGateRecommendation {
155
- decision: 'approved' | 'blocked' | 'conditional';
156
- confidence: number;
157
- summary: string;
158
- blockingIssues: string[];
159
- warnings: string[];
160
- conditions?: string[];
161
- rollbackPlan?: string;
162
- nextSteps: string[];
163
- }
164
-
165
- /**
166
- * Complete quality gate evaluation result
167
- */
168
- export interface QualityGateEvaluation {
169
- id: string;
170
- releaseCandidate: ReleaseCandidate;
171
- metrics: AggregatedMetrics;
172
- checks: GateCheckResult[];
173
- riskAssessment: RiskAssessment;
174
- recommendation: QualityGateRecommendation;
175
- duration: number;
176
- evaluatedAt: Date;
177
- }
178
-
179
- /**
180
- * Configuration for quality gate thresholds
181
- */
182
- export interface QualityGateThresholds {
183
- coverage: {
184
- line: { min: number; blocking: boolean };
185
- branch: { min: number; blocking: boolean };
186
- };
187
- tests: {
188
- passRate: { min: number; blocking: boolean };
189
- maxFlakyTests: { max: number; blocking: boolean };
190
- };
191
- quality: {
192
- minScore: { min: number; blocking: boolean };
193
- maxCriticalBugs: { max: number; blocking: boolean };
194
- };
195
- security: {
196
- maxCriticalVulns: { max: number; blocking: boolean };
197
- maxHighVulns: { max: number; blocking: boolean };
198
- minComplianceScore: { min: number; blocking: boolean };
199
- };
200
- regression: {
201
- maxRisk: { max: number; blocking: boolean };
202
- };
203
- }
204
-
205
- /**
206
- * Protocol configuration
207
- */
208
- export interface QualityGateProtocolConfig {
209
- thresholds: QualityGateThresholds;
210
- enableMLRiskAssessment: boolean;
211
- publishEvents: boolean;
212
- timeout: number;
213
- parallelMetricsCollection: boolean;
214
- storeEvaluationHistory: boolean;
215
- }
216
-
217
- // ============================================================================
218
- // Default Configuration
219
- // ============================================================================
220
-
221
- const DEFAULT_THRESHOLDS: QualityGateThresholds = {
222
- coverage: {
223
- line: { min: 80, blocking: true },
224
- branch: { min: 70, blocking: false },
225
- },
226
- tests: {
227
- passRate: { min: 100, blocking: true },
228
- maxFlakyTests: { max: 5, blocking: false },
229
- },
230
- quality: {
231
- minScore: { min: 70, blocking: false },
232
- maxCriticalBugs: { max: 0, blocking: true },
233
- },
234
- security: {
235
- maxCriticalVulns: { max: 0, blocking: true },
236
- maxHighVulns: { max: 3, blocking: false },
237
- minComplianceScore: { min: 80, blocking: false },
238
- },
239
- regression: {
240
- maxRisk: { max: 0.7, blocking: false },
241
- },
242
- };
243
-
244
- const DEFAULT_CONFIG: QualityGateProtocolConfig = {
245
- thresholds: DEFAULT_THRESHOLDS,
246
- enableMLRiskAssessment: true,
247
- publishEvents: true,
248
- timeout: 120000, // 2 minutes
249
- parallelMetricsCollection: true,
250
- storeEvaluationHistory: true,
251
- };
252
-
253
- // ============================================================================
254
- // Protocol Interface
255
- // ============================================================================
256
-
257
- export interface IQualityGateProtocol {
258
- /**
259
- * Execute quality gate evaluation for a release candidate
260
- */
261
- execute(releaseCandidate: ReleaseCandidate): Promise<Result<QualityGateEvaluation, Error>>;
262
-
263
- /**
264
- * Aggregate metrics from all participating domains
265
- */
266
- aggregateMetrics(releaseCandidate: ReleaseCandidate): Promise<Result<AggregatedMetrics, Error>>;
267
-
268
- /**
269
- * Evaluate quality gate checks against aggregated metrics
270
- */
271
- evaluateGate(metrics: AggregatedMetrics): Promise<Result<GateCheckResult[], Error>>;
272
-
273
- /**
274
- * Perform ML-based deployment risk assessment
275
- */
276
- assessRisk(
277
- metrics: AggregatedMetrics,
278
- checks: GateCheckResult[]
279
- ): Promise<Result<RiskAssessment, Error>>;
280
-
281
- /**
282
- * Generate go/no-go recommendation
283
- */
284
- generateRecommendation(
285
- releaseCandidate: ReleaseCandidate,
286
- checks: GateCheckResult[],
287
- riskAssessment: RiskAssessment
288
- ): Promise<Result<QualityGateRecommendation, Error>>;
289
-
290
- /**
291
- * Get evaluation history for a release
292
- */
293
- getEvaluationHistory(releaseId: string): Promise<QualityGateEvaluation[]>;
294
-
295
- /**
296
- * Update thresholds configuration
297
- */
298
- updateThresholds(thresholds: Partial<QualityGateThresholds>): void;
299
- }
300
-
301
- // ============================================================================
302
- // Protocol Implementation
303
- // ============================================================================
304
-
305
- export class QualityGateProtocol implements IQualityGateProtocol {
306
- private config: QualityGateProtocolConfig;
307
- private readonly participatingDomains: DomainName[] = [
308
- 'quality-assessment',
309
- 'coverage-analysis',
310
- 'defect-intelligence',
311
- 'security-compliance',
312
- 'test-execution',
313
- ];
314
-
315
- constructor(
316
- private readonly eventBus: EventBus,
317
- private readonly memory: MemoryBackend,
318
- private readonly agentCoordinator: AgentCoordinator,
319
- config: Partial<QualityGateProtocolConfig> = {}
320
- ) {
321
- this.config = {
322
- ...DEFAULT_CONFIG,
323
- ...config,
324
- thresholds: {
325
- ...DEFAULT_THRESHOLDS,
326
- ...config.thresholds,
327
- },
328
- };
329
- }
330
-
331
- /**
332
- * Execute complete quality gate evaluation
333
- */
334
- async execute(
335
- releaseCandidate: ReleaseCandidate
336
- ): Promise<Result<QualityGateEvaluation, Error>> {
337
- const evaluationId = uuidv4();
338
- const startTime = Date.now();
339
- let spawnedAgentId: string | undefined;
340
-
341
- try {
342
- // Publish triggered event
343
- if (this.config.publishEvents) {
344
- await this.publishQualityGateTriggered(evaluationId, releaseCandidate);
345
- }
346
-
347
- // Spawn coordinator agent if available
348
- spawnedAgentId = await this.spawnCoordinatorAgent(evaluationId, releaseCandidate);
349
-
350
- // Step 1: Aggregate metrics from all participating domains
351
- const metricsResult = await this.aggregateMetrics(releaseCandidate);
352
- if (!metricsResult.success) {
353
- await this.publishGateCompleted(evaluationId, releaseCandidate, 'blocked', metricsResult.error.message);
354
- return err(metricsResult.error);
355
- }
356
-
357
- // Step 2: Evaluate quality gate checks
358
- const checksResult = await this.evaluateGate(metricsResult.value);
359
- if (!checksResult.success) {
360
- await this.publishGateCompleted(evaluationId, releaseCandidate, 'blocked', checksResult.error.message);
361
- return err(checksResult.error);
362
- }
363
-
364
- // Step 3: ML-based risk assessment
365
- const riskResult = await this.assessRisk(metricsResult.value, checksResult.value);
366
- if (!riskResult.success) {
367
- await this.publishGateCompleted(evaluationId, releaseCandidate, 'blocked', riskResult.error.message);
368
- return err(riskResult.error);
369
- }
370
-
371
- // Step 4: Generate recommendation
372
- const recommendationResult = await this.generateRecommendation(
373
- releaseCandidate,
374
- checksResult.value,
375
- riskResult.value
376
- );
377
- if (!recommendationResult.success) {
378
- await this.publishGateCompleted(evaluationId, releaseCandidate, 'blocked', recommendationResult.error.message);
379
- return err(recommendationResult.error);
380
- }
381
-
382
- const duration = Date.now() - startTime;
383
-
384
- const evaluation: QualityGateEvaluation = {
385
- id: evaluationId,
386
- releaseCandidate,
387
- metrics: metricsResult.value,
388
- checks: checksResult.value,
389
- riskAssessment: riskResult.value,
390
- recommendation: recommendationResult.value,
391
- duration,
392
- evaluatedAt: new Date(),
393
- };
394
-
395
- // Store evaluation history
396
- if (this.config.storeEvaluationHistory) {
397
- await this.storeEvaluation(evaluation);
398
- }
399
-
400
- // Publish completion events
401
- if (this.config.publishEvents) {
402
- await this.publishGateCompleted(
403
- evaluationId,
404
- releaseCandidate,
405
- recommendationResult.value.decision,
406
- recommendationResult.value.summary
407
- );
408
-
409
- if (recommendationResult.value.decision === 'approved') {
410
- await this.publishDeploymentApproved(evaluationId, releaseCandidate, recommendationResult.value);
411
- } else if (recommendationResult.value.decision === 'blocked') {
412
- await this.publishDeploymentBlocked(evaluationId, releaseCandidate, recommendationResult.value);
413
- }
414
- }
415
-
416
- // Cleanup spawned agent
417
- if (spawnedAgentId) {
418
- await this.stopCoordinatorAgent(spawnedAgentId);
419
- }
420
-
421
- return ok(evaluation);
422
- } catch (error) {
423
- // Cleanup on error
424
- if (spawnedAgentId) {
425
- await this.stopCoordinatorAgent(spawnedAgentId);
426
- }
427
- const errorMessage = error instanceof Error ? error.message : String(error);
428
- await this.publishGateCompleted(evaluationId, releaseCandidate, 'blocked', errorMessage);
429
- return err(error instanceof Error ? error : new Error(errorMessage));
430
- }
431
- }
432
-
433
- /**
434
- * Aggregate metrics from all participating domains
435
- */
436
- async aggregateMetrics(
437
- releaseCandidate: ReleaseCandidate
438
- ): Promise<Result<AggregatedMetrics, Error>> {
439
- try {
440
- const sources: DomainName[] = [];
441
-
442
- // Collect metrics from each domain
443
- const [coverageData, testData, qualityData, securityData, defectData] =
444
- this.config.parallelMetricsCollection
445
- ? await Promise.all([
446
- this.getCoverageMetrics(releaseCandidate),
447
- this.getTestExecutionMetrics(releaseCandidate),
448
- this.getQualityMetrics(releaseCandidate),
449
- this.getSecurityMetrics(releaseCandidate),
450
- this.getDefectMetrics(releaseCandidate),
451
- ])
452
- : [
453
- await this.getCoverageMetrics(releaseCandidate),
454
- await this.getTestExecutionMetrics(releaseCandidate),
455
- await this.getQualityMetrics(releaseCandidate),
456
- await this.getSecurityMetrics(releaseCandidate),
457
- await this.getDefectMetrics(releaseCandidate),
458
- ];
459
-
460
- // Track which domains contributed data
461
- if (coverageData) sources.push('coverage-analysis');
462
- if (testData) sources.push('test-execution');
463
- if (qualityData) sources.push('quality-assessment');
464
- if (securityData) sources.push('security-compliance');
465
- if (defectData) sources.push('defect-intelligence');
466
-
467
- const metrics: AggregatedMetrics = {
468
- coverage: coverageData || {
469
- line: 0,
470
- branch: 0,
471
- function: 0,
472
- statement: 0,
473
- trend: 'stable',
474
- },
475
- testExecution: testData || {
476
- total: 0,
477
- passed: 0,
478
- failed: 0,
479
- skipped: 0,
480
- passRate: 0,
481
- flakyTests: 0,
482
- duration: 0,
483
- },
484
- quality: qualityData || {
485
- overallScore: 0,
486
- technicalDebt: 0,
487
- codeSmells: 0,
488
- duplications: 0,
489
- criticalBugs: 0,
490
- },
491
- security: securityData || {
492
- vulnerabilities: { critical: 0, high: 0, medium: 0, low: 0 },
493
- complianceScore: 0,
494
- },
495
- defects: defectData || {
496
- regressionRisk: 0,
497
- predictedDefects: 0,
498
- hotspotCount: 0,
499
- },
500
- collectedAt: new Date(),
501
- sources,
502
- };
503
-
504
- // Store aggregated metrics for reference
505
- await this.memory.set(
506
- `quality-gate:metrics:${releaseCandidate.id}`,
507
- metrics,
508
- { namespace: 'coordination', ttl: 86400 * 7 }
509
- );
510
-
511
- return ok(metrics);
512
- } catch (error) {
513
- return err(error instanceof Error ? error : new Error(String(error)));
514
- }
515
- }
516
-
517
- /**
518
- * Evaluate quality gate checks
519
- */
520
- async evaluateGate(
521
- metrics: AggregatedMetrics
522
- ): Promise<Result<GateCheckResult[], Error>> {
523
- try {
524
- const checks: GateCheckResult[] = [];
525
- const thresholds = this.config.thresholds;
526
-
527
- // Coverage checks
528
- checks.push(
529
- this.createCheck(
530
- 'Line Coverage',
531
- 'coverage',
532
- metrics.coverage.line,
533
- thresholds.coverage.line.min,
534
- thresholds.coverage.line.blocking,
535
- 'min',
536
- 'Line coverage percentage'
537
- )
538
- );
539
-
540
- checks.push(
541
- this.createCheck(
542
- 'Branch Coverage',
543
- 'coverage',
544
- metrics.coverage.branch,
545
- thresholds.coverage.branch.min,
546
- thresholds.coverage.branch.blocking,
547
- 'min',
548
- 'Branch coverage percentage'
549
- )
550
- );
551
-
552
- // Test execution checks
553
- checks.push(
554
- this.createCheck(
555
- 'Test Pass Rate',
556
- 'tests',
557
- metrics.testExecution.passRate,
558
- thresholds.tests.passRate.min,
559
- thresholds.tests.passRate.blocking,
560
- 'min',
561
- 'Percentage of tests passing'
562
- )
563
- );
564
-
565
- checks.push(
566
- this.createCheck(
567
- 'Flaky Tests',
568
- 'tests',
569
- metrics.testExecution.flakyTests,
570
- thresholds.tests.maxFlakyTests.max,
571
- thresholds.tests.maxFlakyTests.blocking,
572
- 'max',
573
- 'Number of flaky tests detected'
574
- )
575
- );
576
-
577
- // Quality checks
578
- checks.push(
579
- this.createCheck(
580
- 'Quality Score',
581
- 'quality',
582
- metrics.quality.overallScore,
583
- thresholds.quality.minScore.min,
584
- thresholds.quality.minScore.blocking,
585
- 'min',
586
- 'Overall code quality score'
587
- )
588
- );
589
-
590
- checks.push(
591
- this.createCheck(
592
- 'Critical Bugs',
593
- 'quality',
594
- metrics.quality.criticalBugs,
595
- thresholds.quality.maxCriticalBugs.max,
596
- thresholds.quality.maxCriticalBugs.blocking,
597
- 'max',
598
- 'Number of critical bugs'
599
- )
600
- );
601
-
602
- // Security checks
603
- checks.push(
604
- this.createCheck(
605
- 'Critical Vulnerabilities',
606
- 'security',
607
- metrics.security.vulnerabilities.critical,
608
- thresholds.security.maxCriticalVulns.max,
609
- thresholds.security.maxCriticalVulns.blocking,
610
- 'max',
611
- 'Critical security vulnerabilities'
612
- )
613
- );
614
-
615
- checks.push(
616
- this.createCheck(
617
- 'High Vulnerabilities',
618
- 'security',
619
- metrics.security.vulnerabilities.high,
620
- thresholds.security.maxHighVulns.max,
621
- thresholds.security.maxHighVulns.blocking,
622
- 'max',
623
- 'High severity vulnerabilities'
624
- )
625
- );
626
-
627
- checks.push(
628
- this.createCheck(
629
- 'Compliance Score',
630
- 'security',
631
- metrics.security.complianceScore,
632
- thresholds.security.minComplianceScore.min,
633
- thresholds.security.minComplianceScore.blocking,
634
- 'min',
635
- 'Security compliance score'
636
- )
637
- );
638
-
639
- // Regression risk check
640
- checks.push(
641
- this.createCheck(
642
- 'Regression Risk',
643
- 'regression',
644
- metrics.defects.regressionRisk,
645
- thresholds.regression.maxRisk.max,
646
- thresholds.regression.maxRisk.blocking,
647
- 'max',
648
- 'ML-predicted regression risk'
649
- )
650
- );
651
-
652
- return ok(checks);
653
- } catch (error) {
654
- return err(error instanceof Error ? error : new Error(String(error)));
655
- }
656
- }
657
-
658
- /**
659
- * ML-based risk assessment
660
- */
661
- async assessRisk(
662
- metrics: AggregatedMetrics,
663
- checks: GateCheckResult[]
664
- ): Promise<Result<RiskAssessment, Error>> {
665
- try {
666
- if (!this.config.enableMLRiskAssessment) {
667
- // Return basic risk assessment without ML
668
- return ok(this.createBasicRiskAssessment(metrics, checks));
669
- }
670
-
671
- // Calculate risk factors
672
- const factors = this.calculateRiskFactors(metrics, checks);
673
-
674
- // Calculate overall risk score (weighted average)
675
- const overallRisk = this.calculateOverallRisk(factors);
676
-
677
- // Determine risk level
678
- const riskLevel = this.riskScoreToSeverity(overallRisk);
679
-
680
- // Get historical comparison
681
- const historicalComparison = await this.getHistoricalComparison(metrics);
682
-
683
- // Calculate predictions
684
- const predictions = this.calculatePredictions(metrics, overallRisk, historicalComparison);
685
-
686
- // Calculate confidence based on data quality
687
- const confidence = this.calculateConfidence(metrics, historicalComparison);
688
-
689
- const assessment: RiskAssessment = {
690
- overallRisk,
691
- riskLevel,
692
- confidence,
693
- factors,
694
- historicalComparison,
695
- predictions,
696
- };
697
-
698
- return ok(assessment);
699
- } catch (error) {
700
- return err(error instanceof Error ? error : new Error(String(error)));
701
- }
702
- }
703
-
704
- /**
705
- * Generate go/no-go recommendation
706
- */
707
- async generateRecommendation(
708
- releaseCandidate: ReleaseCandidate,
709
- checks: GateCheckResult[],
710
- riskAssessment: RiskAssessment
711
- ): Promise<Result<QualityGateRecommendation, Error>> {
712
- try {
713
- // Separate blocking and warning issues
714
- const blockingIssues: string[] = [];
715
- const warnings: string[] = [];
716
-
717
- for (const check of checks) {
718
- if (!check.passed) {
719
- if (check.blocking) {
720
- blockingIssues.push(`${check.name}: ${check.message} (${check.value} vs threshold ${check.threshold})`);
721
- } else {
722
- warnings.push(`${check.name}: ${check.message} (${check.value} vs threshold ${check.threshold})`);
723
- }
724
- }
725
- }
726
-
727
- // Add risk-based warnings
728
- if (riskAssessment.overallRisk > 0.5) {
729
- warnings.push(`High deployment risk detected (${Math.round(riskAssessment.overallRisk * 100)}%)`);
730
- }
731
-
732
- for (const factor of riskAssessment.factors) {
733
- if (factor.contribution > 0.2) {
734
- warnings.push(`Risk factor: ${factor.description}`);
735
- }
736
- }
737
-
738
- // Determine decision
739
- let decision: QualityGateRecommendation['decision'];
740
- if (blockingIssues.length > 0) {
741
- decision = 'blocked';
742
- } else if (warnings.length > 0 || riskAssessment.riskLevel === 'high') {
743
- decision = 'conditional';
744
- } else {
745
- decision = 'approved';
746
- }
747
-
748
- // Generate summary
749
- const summary = this.generateSummary(decision, blockingIssues, warnings, riskAssessment);
750
-
751
- // Generate conditions for conditional approval
752
- const conditions = decision === 'conditional'
753
- ? this.generateConditions(warnings, riskAssessment)
754
- : undefined;
755
-
756
- // Generate rollback plan
757
- const rollbackPlan = decision !== 'blocked'
758
- ? this.generateRollbackPlan(releaseCandidate)
759
- : undefined;
760
-
761
- // Generate next steps
762
- const nextSteps = this.generateNextSteps(decision, blockingIssues, warnings);
763
-
764
- // Calculate confidence
765
- const confidence = this.calculateRecommendationConfidence(
766
- checks,
767
- riskAssessment,
768
- blockingIssues.length === 0
769
- );
770
-
771
- const recommendation: QualityGateRecommendation = {
772
- decision,
773
- confidence,
774
- summary,
775
- blockingIssues,
776
- warnings,
777
- conditions,
778
- rollbackPlan,
779
- nextSteps,
780
- };
781
-
782
- return ok(recommendation);
783
- } catch (error) {
784
- return err(error instanceof Error ? error : new Error(String(error)));
785
- }
786
- }
787
-
788
- /**
789
- * Get evaluation history for a release
790
- */
791
- async getEvaluationHistory(releaseId: string): Promise<QualityGateEvaluation[]> {
792
- const keys = await this.memory.search(
793
- `quality-gate:evaluation:${releaseId}:*`,
794
- 100
795
- );
796
-
797
- const evaluations: QualityGateEvaluation[] = [];
798
-
799
- for (const key of keys) {
800
- const evaluation = await this.memory.get<QualityGateEvaluation>(key);
801
- if (evaluation) {
802
- evaluations.push(evaluation);
803
- }
804
- }
805
-
806
- // Sort by date descending
807
- return evaluations.sort(
808
- (a, b) => new Date(b.evaluatedAt).getTime() - new Date(a.evaluatedAt).getTime()
809
- );
810
- }
811
-
812
- /**
813
- * Update thresholds configuration
814
- */
815
- updateThresholds(thresholds: Partial<QualityGateThresholds>): void {
816
- this.config.thresholds = {
817
- ...this.config.thresholds,
818
- ...thresholds,
819
- coverage: { ...this.config.thresholds.coverage, ...thresholds.coverage },
820
- tests: { ...this.config.thresholds.tests, ...thresholds.tests },
821
- quality: { ...this.config.thresholds.quality, ...thresholds.quality },
822
- security: { ...this.config.thresholds.security, ...thresholds.security },
823
- regression: { ...this.config.thresholds.regression, ...thresholds.regression },
824
- };
825
- }
826
-
827
- // ============================================================================
828
- // Private Helper Methods - Metrics Collection
829
- // ============================================================================
830
-
831
- private async getCoverageMetrics(
832
- _releaseCandidate: ReleaseCandidate
833
- ): Promise<AggregatedMetrics['coverage'] | null> {
834
- try {
835
- // Try to get latest coverage data from memory
836
- const latestCoverage = await this.memory.get<{
837
- line: number;
838
- branch: number;
839
- function: number;
840
- statement: number;
841
- }>('coverage:latest');
842
-
843
- if (!latestCoverage) {
844
- return null;
845
- }
846
-
847
- // Get previous coverage for trend
848
- const previousCoverage = await this.memory.get<{
849
- line: number;
850
- }>('coverage:previous');
851
-
852
- let trend: 'improving' | 'declining' | 'stable' = 'stable';
853
- if (previousCoverage) {
854
- const delta = latestCoverage.line - previousCoverage.line;
855
- if (delta > 0.5) trend = 'improving';
856
- else if (delta < -0.5) trend = 'declining';
857
- }
858
-
859
- return {
860
- line: latestCoverage.line,
861
- branch: latestCoverage.branch,
862
- function: latestCoverage.function,
863
- statement: latestCoverage.statement,
864
- trend,
865
- };
866
- } catch {
867
- return null;
868
- }
869
- }
870
-
871
- private async getTestExecutionMetrics(
872
- _releaseCandidate: ReleaseCandidate
873
- ): Promise<AggregatedMetrics['testExecution'] | null> {
874
- try {
875
- // Search for recent test run results
876
- const runKeys = await this.memory.search('test-execution:run:*', 10);
877
-
878
- if (runKeys.length === 0) {
879
- return null;
880
- }
881
-
882
- // Get the most recent run
883
- const latestRun = await this.memory.get<{
884
- total: number;
885
- passed: number;
886
- failed: number;
887
- skipped: number;
888
- duration: number;
889
- }>(runKeys[0]);
890
-
891
- if (!latestRun) {
892
- return null;
893
- }
894
-
895
- // Get flaky test count
896
- const flakyKeys = await this.memory.search('test-execution:flaky:*', 100);
897
-
898
- return {
899
- total: latestRun.total,
900
- passed: latestRun.passed,
901
- failed: latestRun.failed,
902
- skipped: latestRun.skipped,
903
- passRate: latestRun.total > 0 ? (latestRun.passed / latestRun.total) * 100 : 0,
904
- flakyTests: flakyKeys.length,
905
- duration: latestRun.duration,
906
- };
907
- } catch {
908
- return null;
909
- }
910
- }
911
-
912
- private async getQualityMetrics(
913
- _releaseCandidate: ReleaseCandidate
914
- ): Promise<AggregatedMetrics['quality'] | null> {
915
- try {
916
- const qualityData = await this.memory.get<{
917
- overallScore: number;
918
- technicalDebt: number;
919
- codeSmells: number;
920
- duplications: number;
921
- criticalBugs: number;
922
- }>('quality-assessment:latest');
923
-
924
- if (!qualityData) {
925
- return null;
926
- }
927
-
928
- return qualityData;
929
- } catch {
930
- return null;
931
- }
932
- }
933
-
934
- private async getSecurityMetrics(
935
- _releaseCandidate: ReleaseCandidate
936
- ): Promise<AggregatedMetrics['security'] | null> {
937
- try {
938
- const securityData = await this.memory.get<{
939
- vulnerabilities: { critical: number; high: number; medium: number; low: number };
940
- complianceScore: number;
941
- lastAuditDate?: string;
942
- }>('security-compliance:posture');
943
-
944
- if (!securityData) {
945
- return null;
946
- }
947
-
948
- return {
949
- vulnerabilities: securityData.vulnerabilities,
950
- complianceScore: securityData.complianceScore,
951
- lastAuditDate: securityData.lastAuditDate
952
- ? new Date(securityData.lastAuditDate)
953
- : undefined,
954
- };
955
- } catch {
956
- return null;
957
- }
958
- }
959
-
960
- private async getDefectMetrics(
961
- _releaseCandidate: ReleaseCandidate
962
- ): Promise<AggregatedMetrics['defects'] | null> {
963
- try {
964
- const defectData = await this.memory.get<{
965
- regressionRisk: number;
966
- predictedDefects: number;
967
- hotspotCount: number;
968
- }>('defect-intelligence:analysis');
969
-
970
- if (!defectData) {
971
- return null;
972
- }
973
-
974
- return defectData;
975
- } catch {
976
- return null;
977
- }
978
- }
979
-
980
- // ============================================================================
981
- // Private Helper Methods - Check Creation
982
- // ============================================================================
983
-
984
- private createCheck(
985
- name: string,
986
- category: GateCheckResult['category'],
987
- value: number,
988
- threshold: number,
989
- blocking: boolean,
990
- comparison: 'min' | 'max',
991
- description: string
992
- ): GateCheckResult {
993
- const passed = comparison === 'min' ? value >= threshold : value <= threshold;
994
-
995
- const severity = this.determineCheckSeverity(blocking, passed, value, threshold, comparison);
996
-
997
- const message = passed
998
- ? `${description} meets threshold`
999
- : `${description} ${comparison === 'min' ? 'below' : 'exceeds'} threshold`;
1000
-
1001
- return {
1002
- name,
1003
- category,
1004
- passed,
1005
- blocking,
1006
- value,
1007
- threshold,
1008
- severity,
1009
- message,
1010
- };
1011
- }
1012
-
1013
- private determineCheckSeverity(
1014
- blocking: boolean,
1015
- passed: boolean,
1016
- value: number,
1017
- threshold: number,
1018
- comparison: 'min' | 'max'
1019
- ): Severity {
1020
- if (passed) {
1021
- return 'info';
1022
- }
1023
-
1024
- if (blocking) {
1025
- return 'critical';
1026
- }
1027
-
1028
- // Calculate how far from threshold
1029
- const deviation = comparison === 'min'
1030
- ? (threshold - value) / threshold
1031
- : (value - threshold) / threshold;
1032
-
1033
- if (deviation > 0.5) return 'high';
1034
- if (deviation > 0.2) return 'medium';
1035
- return 'low';
1036
- }
1037
-
1038
- // ============================================================================
1039
- // Private Helper Methods - Risk Assessment
1040
- // ============================================================================
1041
-
1042
- private createBasicRiskAssessment(
1043
- metrics: AggregatedMetrics,
1044
- checks: GateCheckResult[]
1045
- ): RiskAssessment {
1046
- const failedChecks = checks.filter((c) => !c.passed);
1047
- const overallRisk = Math.min(1, failedChecks.length * 0.15 + metrics.defects.regressionRisk);
1048
-
1049
- return {
1050
- overallRisk,
1051
- riskLevel: this.riskScoreToSeverity(overallRisk),
1052
- confidence: 0.6, // Lower confidence for basic assessment
1053
- factors: [
1054
- {
1055
- name: 'Failed Checks',
1056
- contribution: failedChecks.length * 0.1,
1057
- description: `${failedChecks.length} quality checks failed`,
1058
- },
1059
- ],
1060
- predictions: {
1061
- defectProbability: overallRisk * 0.5,
1062
- rollbackProbability: overallRisk * 0.3,
1063
- incidentProbability: overallRisk * 0.2,
1064
- },
1065
- };
1066
- }
1067
-
1068
- private calculateRiskFactors(
1069
- metrics: AggregatedMetrics,
1070
- checks: GateCheckResult[]
1071
- ): RiskFactor[] {
1072
- const factors: RiskFactor[] = [];
1073
-
1074
- // Coverage risk
1075
- const coverageRisk = 1 - metrics.coverage.line / 100;
1076
- if (coverageRisk > 0.2) {
1077
- factors.push({
1078
- name: 'Low Coverage',
1079
- contribution: coverageRisk * 0.25,
1080
- description: `Test coverage at ${metrics.coverage.line}% is below recommended levels`,
1081
- mitigationSuggestion: 'Add tests for uncovered code paths',
1082
- });
1083
- }
1084
-
1085
- // Test stability risk
1086
- const testRisk = metrics.testExecution.flakyTests > 0 || metrics.testExecution.failed > 0;
1087
- if (testRisk) {
1088
- const contribution = Math.min(0.3, (metrics.testExecution.failed + metrics.testExecution.flakyTests) * 0.05);
1089
- factors.push({
1090
- name: 'Test Instability',
1091
- contribution,
1092
- description: `${metrics.testExecution.failed} failed tests, ${metrics.testExecution.flakyTests} flaky tests`,
1093
- mitigationSuggestion: 'Fix failing tests and stabilize flaky tests',
1094
- });
1095
- }
1096
-
1097
- // Security risk
1098
- const securityRisk =
1099
- metrics.security.vulnerabilities.critical * 0.4 +
1100
- metrics.security.vulnerabilities.high * 0.2 +
1101
- metrics.security.vulnerabilities.medium * 0.05;
1102
- if (securityRisk > 0) {
1103
- factors.push({
1104
- name: 'Security Vulnerabilities',
1105
- contribution: Math.min(0.5, securityRisk),
1106
- description: `${metrics.security.vulnerabilities.critical} critical, ${metrics.security.vulnerabilities.high} high vulnerabilities`,
1107
- mitigationSuggestion: 'Address security vulnerabilities before deployment',
1108
- });
1109
- }
1110
-
1111
- // Regression risk
1112
- if (metrics.defects.regressionRisk > 0.3) {
1113
- factors.push({
1114
- name: 'Regression Risk',
1115
- contribution: metrics.defects.regressionRisk * 0.3,
1116
- description: `ML model predicts ${Math.round(metrics.defects.regressionRisk * 100)}% regression risk`,
1117
- mitigationSuggestion: 'Run extended regression test suite',
1118
- });
1119
- }
1120
-
1121
- // Failed checks risk
1122
- const failedBlockingChecks = checks.filter((c) => !c.passed && c.blocking);
1123
- if (failedBlockingChecks.length > 0) {
1124
- factors.push({
1125
- name: 'Blocking Checks Failed',
1126
- contribution: Math.min(0.5, failedBlockingChecks.length * 0.2),
1127
- description: `${failedBlockingChecks.length} blocking quality checks failed`,
1128
- mitigationSuggestion: 'Address blocking issues before proceeding',
1129
- });
1130
- }
1131
-
1132
- return factors;
1133
- }
1134
-
1135
- private calculateOverallRisk(factors: RiskFactor[]): number {
1136
- if (factors.length === 0) {
1137
- return 0;
1138
- }
1139
-
1140
- // Sum contributions with diminishing returns
1141
- let totalRisk = 0;
1142
- const sortedFactors = [...factors].sort((a, b) => b.contribution - a.contribution);
1143
-
1144
- for (let i = 0; i < sortedFactors.length; i++) {
1145
- const weight = 1 / (i + 1); // Diminishing weight for additional factors
1146
- totalRisk += sortedFactors[i].contribution * weight;
1147
- }
1148
-
1149
- return Math.min(1, totalRisk);
1150
- }
1151
-
1152
- private async getHistoricalComparison(
1153
- metrics: AggregatedMetrics
1154
- ): Promise<RiskAssessment['historicalComparison'] | undefined> {
1155
- try {
1156
- const historicalKeys = await this.memory.search('quality-gate:evaluation:*', 100);
1157
-
1158
- if (historicalKeys.length < 5) {
1159
- return undefined;
1160
- }
1161
-
1162
- let similarCount = 0;
1163
- let successCount = 0;
1164
-
1165
- for (const key of historicalKeys) {
1166
- const evaluation = await this.memory.get<QualityGateEvaluation>(key);
1167
- if (!evaluation) continue;
1168
-
1169
- // Check similarity (within 10% on key metrics)
1170
- const coverageSimilar =
1171
- Math.abs(evaluation.metrics.coverage.line - metrics.coverage.line) < 10;
1172
- const qualitySimilar =
1173
- Math.abs(evaluation.metrics.quality.overallScore - metrics.quality.overallScore) < 10;
1174
-
1175
- if (coverageSimilar && qualitySimilar) {
1176
- similarCount++;
1177
- if (evaluation.recommendation.decision === 'approved') {
1178
- successCount++;
1179
- }
1180
- }
1181
- }
1182
-
1183
- if (similarCount < 3) {
1184
- return undefined;
1185
- }
1186
-
1187
- return {
1188
- similarReleases: similarCount,
1189
- successRate: successCount / similarCount,
1190
- };
1191
- } catch {
1192
- return undefined;
1193
- }
1194
- }
1195
-
1196
- private calculatePredictions(
1197
- metrics: AggregatedMetrics,
1198
- overallRisk: number,
1199
- historicalComparison?: RiskAssessment['historicalComparison']
1200
- ): RiskAssessment['predictions'] {
1201
- // Base predictions on risk score
1202
- let defectProbability = overallRisk * 0.6;
1203
- let rollbackProbability = overallRisk * 0.4;
1204
- let incidentProbability = overallRisk * 0.3;
1205
-
1206
- // Adjust based on specific metrics
1207
- if (metrics.security.vulnerabilities.critical > 0) {
1208
- incidentProbability += 0.2;
1209
- }
1210
-
1211
- if (metrics.testExecution.passRate < 100) {
1212
- defectProbability += 0.15;
1213
- }
1214
-
1215
- // Adjust based on historical data
1216
- if (historicalComparison) {
1217
- const historicalFailureRate = 1 - historicalComparison.successRate;
1218
- defectProbability = (defectProbability + historicalFailureRate) / 2;
1219
- rollbackProbability = (rollbackProbability + historicalFailureRate * 0.5) / 2;
1220
- }
1221
-
1222
- return {
1223
- defectProbability: Math.min(1, defectProbability),
1224
- rollbackProbability: Math.min(1, rollbackProbability),
1225
- incidentProbability: Math.min(1, incidentProbability),
1226
- };
1227
- }
1228
-
1229
- private calculateConfidence(
1230
- metrics: AggregatedMetrics,
1231
- historicalComparison?: RiskAssessment['historicalComparison']
1232
- ): number {
1233
- let confidence = 0.7;
1234
-
1235
- // Increase confidence based on data completeness
1236
- if (metrics.sources.length >= 4) {
1237
- confidence += 0.1;
1238
- }
1239
-
1240
- // Increase confidence if we have historical data
1241
- if (historicalComparison && historicalComparison.similarReleases >= 10) {
1242
- confidence += 0.1;
1243
- }
1244
-
1245
- // Decrease confidence if recent security audit is missing
1246
- if (!metrics.security.lastAuditDate) {
1247
- confidence -= 0.1;
1248
- }
1249
-
1250
- return Math.max(0.5, Math.min(0.95, confidence));
1251
- }
1252
-
1253
- private riskScoreToSeverity(risk: number): Severity {
1254
- if (risk >= 0.8) return 'critical';
1255
- if (risk >= 0.6) return 'high';
1256
- if (risk >= 0.4) return 'medium';
1257
- if (risk >= 0.2) return 'low';
1258
- return 'info';
1259
- }
1260
-
1261
- // ============================================================================
1262
- // Private Helper Methods - Recommendation Generation
1263
- // ============================================================================
1264
-
1265
- private generateSummary(
1266
- decision: QualityGateRecommendation['decision'],
1267
- blockingIssues: string[],
1268
- warnings: string[],
1269
- riskAssessment: RiskAssessment
1270
- ): string {
1271
- switch (decision) {
1272
- case 'approved':
1273
- return `Release approved with ${Math.round((1 - riskAssessment.overallRisk) * 100)}% confidence. All quality gates passed.`;
1274
- case 'conditional':
1275
- return `Conditional approval with ${warnings.length} warning(s). Risk level: ${riskAssessment.riskLevel}. Review recommended before proceeding.`;
1276
- case 'blocked':
1277
- return `Release blocked due to ${blockingIssues.length} critical issue(s). These must be resolved before deployment.`;
1278
- }
1279
- }
1280
-
1281
- private generateConditions(
1282
- warnings: string[],
1283
- riskAssessment: RiskAssessment
1284
- ): string[] {
1285
- const conditions: string[] = [];
1286
-
1287
- if (riskAssessment.overallRisk > 0.5) {
1288
- conditions.push('Deploy during low-traffic period');
1289
- conditions.push('Ensure on-call team is available');
1290
- }
1291
-
1292
- if (warnings.some((w) => w.includes('flaky'))) {
1293
- conditions.push('Monitor test stability for 24 hours post-deployment');
1294
- }
1295
-
1296
- if (warnings.some((w) => w.includes('coverage'))) {
1297
- conditions.push('Add tests for new functionality within 1 sprint');
1298
- }
1299
-
1300
- if (warnings.some((w) => w.includes('vulnerability') || w.includes('security'))) {
1301
- conditions.push('Security team sign-off required');
1302
- }
1303
-
1304
- conditions.push('Feature flag recommended for gradual rollout');
1305
-
1306
- return conditions;
1307
- }
1308
-
1309
- private generateRollbackPlan(releaseCandidate: ReleaseCandidate): string {
1310
- return `Rollback Plan for ${releaseCandidate.version}:
1311
- 1. Monitor key metrics for 15 minutes post-deployment
1312
- 2. If issues detected, execute: deploy rollback ${releaseCandidate.version}
1313
- 3. Verify rollback completion via health checks
1314
- 4. Notify stakeholders and create incident ticket
1315
- 5. Schedule post-mortem within 24 hours`;
1316
- }
1317
-
1318
- private generateNextSteps(
1319
- decision: QualityGateRecommendation['decision'],
1320
- blockingIssues: string[],
1321
- _warnings: string[]
1322
- ): string[] {
1323
- const steps: string[] = [];
1324
-
1325
- switch (decision) {
1326
- case 'approved':
1327
- steps.push('Proceed with deployment');
1328
- steps.push('Monitor deployment metrics');
1329
- steps.push('Notify stakeholders of successful deployment');
1330
- break;
1331
-
1332
- case 'conditional':
1333
- steps.push('Review warnings with team');
1334
- steps.push('Implement mitigation measures');
1335
- steps.push('Get sign-off from technical lead');
1336
- steps.push('Deploy with enhanced monitoring');
1337
- break;
1338
-
1339
- case 'blocked':
1340
- steps.push('Address blocking issues:');
1341
- for (const issue of blockingIssues.slice(0, 3)) {
1342
- steps.push(` - ${issue}`);
1343
- }
1344
- steps.push('Re-run quality gate after fixes');
1345
- steps.push('Update team on blockers and timeline');
1346
- break;
1347
- }
1348
-
1349
- return steps;
1350
- }
1351
-
1352
- private calculateRecommendationConfidence(
1353
- checks: GateCheckResult[],
1354
- riskAssessment: RiskAssessment,
1355
- isApproved: boolean
1356
- ): number {
1357
- let confidence = riskAssessment.confidence;
1358
-
1359
- // Increase confidence if all checks passed
1360
- const allChecksPassed = checks.every((c) => c.passed);
1361
- if (allChecksPassed) {
1362
- confidence += 0.1;
1363
- }
1364
-
1365
- // Decrease confidence if decision is marginal
1366
- if (!isApproved) {
1367
- const blockingFailed = checks.filter((c) => c.blocking && !c.passed);
1368
- if (blockingFailed.length === 1) {
1369
- confidence -= 0.1; // Marginal failure
1370
- }
1371
- }
1372
-
1373
- return Math.max(0.5, Math.min(0.95, confidence));
1374
- }
1375
-
1376
- // ============================================================================
1377
- // Private Helper Methods - Event Publishing
1378
- // ============================================================================
1379
-
1380
- private async publishQualityGateTriggered(
1381
- evaluationId: string,
1382
- releaseCandidate: ReleaseCandidate
1383
- ): Promise<void> {
1384
- const event = createEvent(
1385
- QualityGateProtocolEvents.QualityGateTriggered,
1386
- 'quality-assessment',
1387
- {
1388
- evaluationId,
1389
- releaseCandidate: {
1390
- id: releaseCandidate.id,
1391
- version: releaseCandidate.version,
1392
- branch: releaseCandidate.branch,
1393
- },
1394
- participatingDomains: this.participatingDomains,
1395
- triggeredAt: new Date().toISOString(),
1396
- }
1397
- );
1398
-
1399
- await this.eventBus.publish(event);
1400
- }
1401
-
1402
- private async publishGateCompleted(
1403
- evaluationId: string,
1404
- releaseCandidate: ReleaseCandidate,
1405
- decision: string,
1406
- summary: string
1407
- ): Promise<void> {
1408
- const event = createEvent(
1409
- QualityGateProtocolEvents.QualityGateCompleted,
1410
- 'quality-assessment',
1411
- {
1412
- evaluationId,
1413
- releaseCandidate: {
1414
- id: releaseCandidate.id,
1415
- version: releaseCandidate.version,
1416
- },
1417
- decision,
1418
- summary,
1419
- completedAt: new Date().toISOString(),
1420
- }
1421
- );
1422
-
1423
- await this.eventBus.publish(event);
1424
- }
1425
-
1426
- private async publishDeploymentApproved(
1427
- evaluationId: string,
1428
- releaseCandidate: ReleaseCandidate,
1429
- recommendation: QualityGateRecommendation
1430
- ): Promise<void> {
1431
- const event = createEvent(
1432
- QualityGateProtocolEvents.DeploymentApproved,
1433
- 'quality-assessment',
1434
- {
1435
- evaluationId,
1436
- releaseCandidate: {
1437
- id: releaseCandidate.id,
1438
- version: releaseCandidate.version,
1439
- commitHash: releaseCandidate.commitHash,
1440
- },
1441
- confidence: recommendation.confidence,
1442
- conditions: recommendation.conditions,
1443
- rollbackPlan: recommendation.rollbackPlan,
1444
- approvedAt: new Date().toISOString(),
1445
- }
1446
- );
1447
-
1448
- await this.eventBus.publish(event);
1449
- }
1450
-
1451
- private async publishDeploymentBlocked(
1452
- evaluationId: string,
1453
- releaseCandidate: ReleaseCandidate,
1454
- recommendation: QualityGateRecommendation
1455
- ): Promise<void> {
1456
- const event = createEvent(
1457
- QualityGateProtocolEvents.DeploymentBlocked,
1458
- 'quality-assessment',
1459
- {
1460
- evaluationId,
1461
- releaseCandidate: {
1462
- id: releaseCandidate.id,
1463
- version: releaseCandidate.version,
1464
- },
1465
- blockingIssues: recommendation.blockingIssues,
1466
- nextSteps: recommendation.nextSteps,
1467
- blockedAt: new Date().toISOString(),
1468
- }
1469
- );
1470
-
1471
- await this.eventBus.publish(event);
1472
- }
1473
-
1474
- // ============================================================================
1475
- // Private Helper Methods - Storage
1476
- // ============================================================================
1477
-
1478
- private async storeEvaluation(evaluation: QualityGateEvaluation): Promise<void> {
1479
- const key = `quality-gate:evaluation:${evaluation.releaseCandidate.id}:${evaluation.id}`;
1480
-
1481
- await this.memory.set(key, evaluation, {
1482
- namespace: 'coordination',
1483
- persist: true,
1484
- });
1485
-
1486
- // Also store as latest for this release
1487
- await this.memory.set(
1488
- `quality-gate:latest:${evaluation.releaseCandidate.id}`,
1489
- evaluation,
1490
- { namespace: 'coordination', persist: true }
1491
- );
1492
- }
1493
-
1494
- // ============================================================================
1495
- // Private Helper Methods - Agent Coordination
1496
- // ============================================================================
1497
-
1498
- /**
1499
- * Spawn a coordinator agent for the quality gate evaluation
1500
- */
1501
- private async spawnCoordinatorAgent(
1502
- evaluationId: string,
1503
- releaseCandidate: ReleaseCandidate
1504
- ): Promise<string | undefined> {
1505
- if (!this.agentCoordinator.canSpawn()) {
1506
- // No capacity for agent - proceed without coordination agent
1507
- return undefined;
1508
- }
1509
-
1510
- try {
1511
- const result = await this.agentCoordinator.spawn({
1512
- name: `quality-gate-${evaluationId.slice(0, 8)}`,
1513
- domain: 'quality-assessment',
1514
- type: 'coordinator',
1515
- capabilities: [
1516
- 'quality-gate-evaluation',
1517
- 'metrics-aggregation',
1518
- 'risk-assessment',
1519
- 'deployment-recommendation',
1520
- ],
1521
- config: {
1522
- evaluationId,
1523
- releaseCandidate: {
1524
- id: releaseCandidate.id,
1525
- version: releaseCandidate.version,
1526
- },
1527
- participatingDomains: this.participatingDomains,
1528
- },
1529
- });
1530
-
1531
- if (result.success) {
1532
- return result.value;
1533
- }
1534
-
1535
- // Failed to spawn - continue without agent
1536
- return undefined;
1537
- } catch {
1538
- // Error spawning agent - continue without
1539
- return undefined;
1540
- }
1541
- }
1542
-
1543
- /**
1544
- * Stop the coordinator agent after evaluation completes
1545
- */
1546
- private async stopCoordinatorAgent(agentId: string): Promise<void> {
1547
- try {
1548
- await this.agentCoordinator.stop(agentId);
1549
- } catch {
1550
- // Best effort cleanup - ignore errors
1551
- }
1552
- }
1553
- }
1554
-
1555
- // ============================================================================
1556
- // Factory Function
1557
- // ============================================================================
1558
-
1559
- export function createQualityGateProtocol(
1560
- eventBus: EventBus,
1561
- memory: MemoryBackend,
1562
- agentCoordinator: AgentCoordinator,
1563
- config?: Partial<QualityGateProtocolConfig>
1564
- ): IQualityGateProtocol {
1565
- return new QualityGateProtocol(eventBus, memory, agentCoordinator, config);
1566
- }