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

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 (609) 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 +8 -8
  149. package/dist/init/agents-installer.js +4 -4
  150. package/dist/init/agents-installer.js.map +1 -1
  151. package/dist/init/skills-installer.js +4 -4
  152. package/dist/init/skills-installer.js.map +1 -1
  153. package/package.json +7 -1
  154. package/docs/analysis/V3-INIT-REQUIREMENTS-ANALYSIS.md +0 -352
  155. package/implementation/README.md +0 -90
  156. package/implementation/adrs/ADR-030-coherence-gated-quality-gates.md +0 -312
  157. package/implementation/adrs/ADR-031-strange-loop-self-awareness.md +0 -484
  158. package/implementation/adrs/ADR-032-time-crystal-scheduling.md +0 -530
  159. package/implementation/adrs/ADR-033-early-exit-testing.md +0 -634
  160. package/implementation/adrs/ADR-034-neural-topology-optimizer.md +0 -589
  161. package/implementation/adrs/ADR-035-causal-discovery.md +0 -610
  162. package/implementation/adrs/ADR-036-result-persistence.md +0 -326
  163. package/implementation/adrs/ADR-037-v3-qe-agent-naming.md +0 -105
  164. package/implementation/adrs/ADR-038-v3-qe-memory-unification.md +0 -154
  165. package/implementation/adrs/ADR-039-v3-qe-mcp-optimization.md +0 -179
  166. package/implementation/adrs/ADR-040-v3-qe-agentic-flow-integration.md +0 -240
  167. package/implementation/adrs/ADR-041-v3-qe-cli-enhancement.md +0 -296
  168. package/implementation/adrs/ADR-042-v3-qe-token-tracking-integration.md +0 -517
  169. package/implementation/adrs/v3-adrs.md +0 -2783
  170. package/implementation/planning/AQE-V3-MASTER-PLAN.md +0 -815
  171. package/security-scan-report-2026-01-11.md +0 -410
  172. package/security-verification-report-2026-01-11.md +0 -278
  173. package/src/benchmarks/performance-benchmarks.ts +0 -646
  174. package/src/benchmarks/run-benchmarks.ts +0 -324
  175. package/src/causal-discovery/causal-graph.ts +0 -450
  176. package/src/causal-discovery/discovery-engine.ts +0 -438
  177. package/src/causal-discovery/index.ts +0 -117
  178. package/src/causal-discovery/types.ts +0 -456
  179. package/src/causal-discovery/weight-matrix.ts +0 -453
  180. package/src/cli/commands/qe-tools.ts +0 -634
  181. package/src/cli/index.ts +0 -1976
  182. package/src/compatibility/agent-mapper.ts +0 -291
  183. package/src/compatibility/cli-adapter.ts +0 -277
  184. package/src/compatibility/config-migrator.ts +0 -334
  185. package/src/compatibility/index.ts +0 -112
  186. package/src/compatibility/mcp-adapter.ts +0 -248
  187. package/src/compatibility/types.ts +0 -156
  188. package/src/coordination/claims/claim-repository.ts +0 -636
  189. package/src/coordination/claims/claim-service.ts +0 -675
  190. package/src/coordination/claims/handoff-manager.ts +0 -535
  191. package/src/coordination/claims/index.ts +0 -276
  192. package/src/coordination/claims/interfaces.ts +0 -687
  193. package/src/coordination/claims/work-stealing.ts +0 -436
  194. package/src/coordination/cross-domain-router.ts +0 -492
  195. package/src/coordination/index.ts +0 -127
  196. package/src/coordination/interfaces.ts +0 -691
  197. package/src/coordination/protocol-executor.ts +0 -760
  198. package/src/coordination/protocols/code-intelligence-index.ts +0 -855
  199. package/src/coordination/protocols/defect-investigation.ts +0 -1184
  200. package/src/coordination/protocols/index.ts +0 -11
  201. package/src/coordination/protocols/learning-consolidation.ts +0 -1181
  202. package/src/coordination/protocols/morning-sync.ts +0 -1055
  203. package/src/coordination/protocols/quality-gate.ts +0 -1566
  204. package/src/coordination/protocols/security-audit.ts +0 -1587
  205. package/src/coordination/queen-coordinator.ts +0 -1176
  206. package/src/coordination/result-saver.ts +0 -780
  207. package/src/coordination/task-executor.ts +0 -1146
  208. package/src/coordination/workflow-orchestrator.ts +0 -1917
  209. package/src/domains/chaos-resilience/coordinator.ts +0 -1032
  210. package/src/domains/chaos-resilience/index.ts +0 -143
  211. package/src/domains/chaos-resilience/interfaces.ts +0 -659
  212. package/src/domains/chaos-resilience/plugin.ts +0 -691
  213. package/src/domains/chaos-resilience/services/chaos-engineer.ts +0 -1097
  214. package/src/domains/chaos-resilience/services/index.ts +0 -19
  215. package/src/domains/chaos-resilience/services/load-tester.ts +0 -799
  216. package/src/domains/chaos-resilience/services/performance-profiler.ts +0 -792
  217. package/src/domains/code-intelligence/coordinator.ts +0 -631
  218. package/src/domains/code-intelligence/index.ts +0 -86
  219. package/src/domains/code-intelligence/interfaces.ts +0 -162
  220. package/src/domains/code-intelligence/plugin.ts +0 -451
  221. package/src/domains/code-intelligence/services/impact-analyzer.ts +0 -567
  222. package/src/domains/code-intelligence/services/index.ts +0 -26
  223. package/src/domains/code-intelligence/services/knowledge-graph.ts +0 -1067
  224. package/src/domains/code-intelligence/services/semantic-analyzer.ts +0 -901
  225. package/src/domains/contract-testing/coordinator.ts +0 -1038
  226. package/src/domains/contract-testing/index.ts +0 -122
  227. package/src/domains/contract-testing/interfaces.ts +0 -458
  228. package/src/domains/contract-testing/plugin.ts +0 -746
  229. package/src/domains/contract-testing/services/api-compatibility.ts +0 -748
  230. package/src/domains/contract-testing/services/contract-validator.ts +0 -1700
  231. package/src/domains/contract-testing/services/index.ts +0 -19
  232. package/src/domains/contract-testing/services/schema-validator.ts +0 -1102
  233. package/src/domains/coverage-analysis/coordinator.ts +0 -485
  234. package/src/domains/coverage-analysis/index.ts +0 -114
  235. package/src/domains/coverage-analysis/interfaces.ts +0 -142
  236. package/src/domains/coverage-analysis/plugin.ts +0 -172
  237. package/src/domains/coverage-analysis/services/coverage-analyzer.ts +0 -449
  238. package/src/domains/coverage-analysis/services/coverage-embedder.ts +0 -733
  239. package/src/domains/coverage-analysis/services/coverage-parser.ts +0 -753
  240. package/src/domains/coverage-analysis/services/gap-detector.ts +0 -592
  241. package/src/domains/coverage-analysis/services/hnsw-index.ts +0 -728
  242. package/src/domains/coverage-analysis/services/index.ts +0 -61
  243. package/src/domains/coverage-analysis/services/risk-scorer.ts +0 -540
  244. package/src/domains/coverage-analysis/services/sublinear-analyzer.ts +0 -747
  245. package/src/domains/defect-intelligence/coordinator.ts +0 -635
  246. package/src/domains/defect-intelligence/index.ts +0 -83
  247. package/src/domains/defect-intelligence/interfaces.ts +0 -152
  248. package/src/domains/defect-intelligence/plugin.ts +0 -483
  249. package/src/domains/defect-intelligence/services/causal-root-cause-analyzer.ts +0 -494
  250. package/src/domains/defect-intelligence/services/defect-predictor.ts +0 -852
  251. package/src/domains/defect-intelligence/services/index.ts +0 -37
  252. package/src/domains/defect-intelligence/services/pattern-learner.ts +0 -738
  253. package/src/domains/defect-intelligence/services/root-cause-analyzer.ts +0 -637
  254. package/src/domains/domain-interface.ts +0 -77
  255. package/src/domains/index.ts +0 -23
  256. package/src/domains/learning-optimization/coordinator.ts +0 -1215
  257. package/src/domains/learning-optimization/index.ts +0 -127
  258. package/src/domains/learning-optimization/interfaces.ts +0 -570
  259. package/src/domains/learning-optimization/plugin.ts +0 -851
  260. package/src/domains/learning-optimization/services/index.ts +0 -29
  261. package/src/domains/learning-optimization/services/learning-coordinator.ts +0 -972
  262. package/src/domains/learning-optimization/services/metrics-optimizer.ts +0 -915
  263. package/src/domains/learning-optimization/services/production-intel.ts +0 -971
  264. package/src/domains/learning-optimization/services/transfer-specialist.ts +0 -723
  265. package/src/domains/quality-assessment/coherence/gate-controller.ts +0 -549
  266. package/src/domains/quality-assessment/coherence/index.ts +0 -211
  267. package/src/domains/quality-assessment/coherence/lambda-calculator.ts +0 -384
  268. package/src/domains/quality-assessment/coherence/partition-detector.ts +0 -469
  269. package/src/domains/quality-assessment/coherence/types.ts +0 -384
  270. package/src/domains/quality-assessment/coordinator.ts +0 -605
  271. package/src/domains/quality-assessment/index.ts +0 -97
  272. package/src/domains/quality-assessment/interfaces.ts +0 -152
  273. package/src/domains/quality-assessment/plugin.ts +0 -496
  274. package/src/domains/quality-assessment/services/coherence-gate.ts +0 -358
  275. package/src/domains/quality-assessment/services/deployment-advisor.ts +0 -571
  276. package/src/domains/quality-assessment/services/index.ts +0 -34
  277. package/src/domains/quality-assessment/services/quality-analyzer.ts +0 -670
  278. package/src/domains/quality-assessment/services/quality-gate.ts +0 -384
  279. package/src/domains/requirements-validation/coordinator.ts +0 -812
  280. package/src/domains/requirements-validation/index.ts +0 -92
  281. package/src/domains/requirements-validation/interfaces.ts +0 -303
  282. package/src/domains/requirements-validation/plugin.ts +0 -576
  283. package/src/domains/requirements-validation/services/bdd-scenario-writer.ts +0 -676
  284. package/src/domains/requirements-validation/services/index.ts +0 -20
  285. package/src/domains/requirements-validation/services/requirements-validator.ts +0 -559
  286. package/src/domains/requirements-validation/services/testability-scorer.ts +0 -639
  287. package/src/domains/security-compliance/coordinator.ts +0 -757
  288. package/src/domains/security-compliance/index.ts +0 -120
  289. package/src/domains/security-compliance/interfaces.ts +0 -434
  290. package/src/domains/security-compliance/plugin.ts +0 -509
  291. package/src/domains/security-compliance/services/compliance-validator.ts +0 -1226
  292. package/src/domains/security-compliance/services/index.ts +0 -31
  293. package/src/domains/security-compliance/services/security-auditor.ts +0 -2227
  294. package/src/domains/security-compliance/services/security-scanner.ts +0 -2354
  295. package/src/domains/security-compliance/services/semgrep-integration.ts +0 -289
  296. package/src/domains/test-execution/coordinator.ts +0 -426
  297. package/src/domains/test-execution/index.ts +0 -76
  298. package/src/domains/test-execution/interfaces.ts +0 -119
  299. package/src/domains/test-execution/plugin.ts +0 -208
  300. package/src/domains/test-execution/services/flaky-detector.ts +0 -1240
  301. package/src/domains/test-execution/services/index.ts +0 -8
  302. package/src/domains/test-execution/services/retry-handler.ts +0 -820
  303. package/src/domains/test-execution/services/test-executor.ts +0 -885
  304. package/src/domains/test-generation/coordinator.ts +0 -656
  305. package/src/domains/test-generation/index.ts +0 -77
  306. package/src/domains/test-generation/interfaces.ts +0 -118
  307. package/src/domains/test-generation/plugin.ts +0 -397
  308. package/src/domains/test-generation/services/index.ts +0 -23
  309. package/src/domains/test-generation/services/pattern-matcher.ts +0 -1725
  310. package/src/domains/test-generation/services/test-generator.ts +0 -2750
  311. package/src/domains/visual-accessibility/coordinator.ts +0 -860
  312. package/src/domains/visual-accessibility/index.ts +0 -116
  313. package/src/domains/visual-accessibility/interfaces.ts +0 -435
  314. package/src/domains/visual-accessibility/plugin.ts +0 -568
  315. package/src/domains/visual-accessibility/services/accessibility-tester.ts +0 -982
  316. package/src/domains/visual-accessibility/services/axe-core-audit.ts +0 -630
  317. package/src/domains/visual-accessibility/services/index.ts +0 -28
  318. package/src/domains/visual-accessibility/services/responsive-tester.ts +0 -934
  319. package/src/domains/visual-accessibility/services/visual-tester.ts +0 -458
  320. package/src/early-exit/early-exit-controller.ts +0 -490
  321. package/src/early-exit/early-exit-decision.ts +0 -391
  322. package/src/early-exit/index.ts +0 -115
  323. package/src/early-exit/quality-signal.ts +0 -389
  324. package/src/early-exit/speculative-executor.ts +0 -505
  325. package/src/early-exit/types.ts +0 -407
  326. package/src/feedback/coverage-learner.ts +0 -456
  327. package/src/feedback/feedback-loop.ts +0 -426
  328. package/src/feedback/index.ts +0 -72
  329. package/src/feedback/pattern-promotion.ts +0 -373
  330. package/src/feedback/quality-score-calculator.ts +0 -334
  331. package/src/feedback/test-outcome-tracker.ts +0 -450
  332. package/src/feedback/types.ts +0 -497
  333. package/src/index.ts +0 -224
  334. package/src/init/agents-installer.ts +0 -536
  335. package/src/init/index.ts +0 -80
  336. package/src/init/init-wizard.ts +0 -1061
  337. package/src/init/project-analyzer.ts +0 -696
  338. package/src/init/self-configurator.ts +0 -488
  339. package/src/init/skills-installer.ts +0 -467
  340. package/src/init/types.ts +0 -432
  341. package/src/integrations/ruvector/ast-complexity.ts +0 -470
  342. package/src/integrations/ruvector/coverage-router.ts +0 -594
  343. package/src/integrations/ruvector/diff-risk-classifier.ts +0 -759
  344. package/src/integrations/ruvector/fallback.ts +0 -942
  345. package/src/integrations/ruvector/graph-boundaries.ts +0 -809
  346. package/src/integrations/ruvector/index.ts +0 -363
  347. package/src/integrations/ruvector/interfaces.ts +0 -609
  348. package/src/integrations/ruvector/q-learning-router.ts +0 -550
  349. package/src/kernel/agent-coordinator.ts +0 -165
  350. package/src/kernel/agentdb-backend.ts +0 -504
  351. package/src/kernel/event-bus.ts +0 -129
  352. package/src/kernel/hybrid-backend.ts +0 -538
  353. package/src/kernel/index.ts +0 -28
  354. package/src/kernel/interfaces.ts +0 -257
  355. package/src/kernel/kernel.ts +0 -285
  356. package/src/kernel/memory-backend.ts +0 -169
  357. package/src/kernel/memory-factory.ts +0 -293
  358. package/src/kernel/plugin-loader.ts +0 -179
  359. package/src/learning/index.ts +0 -219
  360. package/src/learning/pattern-store.ts +0 -990
  361. package/src/learning/qe-guidance.ts +0 -832
  362. package/src/learning/qe-hooks.ts +0 -644
  363. package/src/learning/qe-patterns.ts +0 -449
  364. package/src/learning/qe-reasoning-bank.ts +0 -951
  365. package/src/learning/real-embeddings.ts +0 -277
  366. package/src/learning/real-qe-reasoning-bank.ts +0 -833
  367. package/src/learning/sqlite-persistence.ts +0 -554
  368. package/src/mcp/entry.ts +0 -59
  369. package/src/mcp/handlers/agent-handlers.ts +0 -285
  370. package/src/mcp/handlers/core-handlers.ts +0 -317
  371. package/src/mcp/handlers/domain-handlers.ts +0 -1444
  372. package/src/mcp/handlers/index.ts +0 -57
  373. package/src/mcp/handlers/memory-handlers.ts +0 -338
  374. package/src/mcp/handlers/task-handlers.ts +0 -363
  375. package/src/mcp/index.ts +0 -30
  376. package/src/mcp/metrics/index.ts +0 -14
  377. package/src/mcp/metrics/metrics-collector.ts +0 -503
  378. package/src/mcp/protocol-server.ts +0 -752
  379. package/src/mcp/security/cve-prevention.ts +0 -742
  380. package/src/mcp/security/index.ts +0 -356
  381. package/src/mcp/security/oauth21-provider.ts +0 -821
  382. package/src/mcp/security/rate-limiter.ts +0 -615
  383. package/src/mcp/security/sampling-server.ts +0 -662
  384. package/src/mcp/security/schema-validator.ts +0 -855
  385. package/src/mcp/server.ts +0 -657
  386. package/src/mcp/tool-registry.ts +0 -391
  387. package/src/mcp/tools/base.ts +0 -399
  388. package/src/mcp/tools/chaos-resilience/inject.ts +0 -699
  389. package/src/mcp/tools/code-intelligence/analyze.ts +0 -745
  390. package/src/mcp/tools/contract-testing/validate.ts +0 -708
  391. package/src/mcp/tools/coverage-analysis/index.ts +0 -770
  392. package/src/mcp/tools/defect-intelligence/predict.ts +0 -466
  393. package/src/mcp/tools/index.ts +0 -214
  394. package/src/mcp/tools/learning-optimization/optimize.ts +0 -772
  395. package/src/mcp/tools/quality-assessment/evaluate.ts +0 -385
  396. package/src/mcp/tools/registry.ts +0 -248
  397. package/src/mcp/tools/requirements-validation/validate.ts +0 -394
  398. package/src/mcp/tools/security-compliance/scan.ts +0 -365
  399. package/src/mcp/tools/test-execution/execute.ts +0 -291
  400. package/src/mcp/tools/test-generation/generate.ts +0 -544
  401. package/src/mcp/tools/visual-accessibility/index.ts +0 -791
  402. package/src/mcp/transport/index.ts +0 -31
  403. package/src/mcp/transport/stdio.ts +0 -318
  404. package/src/mcp/types.ts +0 -543
  405. package/src/neural-optimizer/index.ts +0 -111
  406. package/src/neural-optimizer/replay-buffer.ts +0 -455
  407. package/src/neural-optimizer/swarm-topology.ts +0 -508
  408. package/src/neural-optimizer/topology-optimizer.ts +0 -828
  409. package/src/neural-optimizer/types.ts +0 -481
  410. package/src/neural-optimizer/value-network.ts +0 -351
  411. package/src/optimization/auto-tuner.ts +0 -817
  412. package/src/optimization/index.ts +0 -77
  413. package/src/optimization/metric-collectors.ts +0 -474
  414. package/src/optimization/qe-workers.ts +0 -704
  415. package/src/optimization/tuning-algorithm.ts +0 -401
  416. package/src/optimization/types.ts +0 -314
  417. package/src/routing/index.ts +0 -51
  418. package/src/routing/qe-agent-registry.ts +0 -963
  419. package/src/routing/qe-task-router.ts +0 -564
  420. package/src/routing/routing-feedback.ts +0 -365
  421. package/src/routing/types.ts +0 -406
  422. package/src/shared/embeddings/embedding-cache.ts +0 -157
  423. package/src/shared/embeddings/index.ts +0 -50
  424. package/src/shared/embeddings/nomic-embedder.ts +0 -404
  425. package/src/shared/embeddings/ollama-client.ts +0 -195
  426. package/src/shared/embeddings/types.ts +0 -147
  427. package/src/shared/entities/agent.ts +0 -141
  428. package/src/shared/entities/base-entity.ts +0 -79
  429. package/src/shared/entities/index.ts +0 -6
  430. package/src/shared/events/domain-events.ts +0 -259
  431. package/src/shared/events/index.ts +0 -5
  432. package/src/shared/git/git-analyzer.ts +0 -656
  433. package/src/shared/git/index.ts +0 -11
  434. package/src/shared/http/http-client.ts +0 -420
  435. package/src/shared/http/index.ts +0 -13
  436. package/src/shared/index.ts +0 -41
  437. package/src/shared/io/file-reader.ts +0 -525
  438. package/src/shared/io/index.ts +0 -25
  439. package/src/shared/llm/cache.ts +0 -473
  440. package/src/shared/llm/circuit-breaker.ts +0 -369
  441. package/src/shared/llm/cost-tracker.ts +0 -460
  442. package/src/shared/llm/index.ts +0 -140
  443. package/src/shared/llm/interfaces.ts +0 -629
  444. package/src/shared/llm/provider-manager.ts +0 -685
  445. package/src/shared/llm/providers/claude.ts +0 -524
  446. package/src/shared/llm/providers/index.ts +0 -8
  447. package/src/shared/llm/providers/ollama.ts +0 -575
  448. package/src/shared/llm/providers/openai.ts +0 -609
  449. package/src/shared/metrics/code-metrics.ts +0 -520
  450. package/src/shared/metrics/index.ts +0 -23
  451. package/src/shared/metrics/system-metrics.ts +0 -353
  452. package/src/shared/parsers/index.ts +0 -6
  453. package/src/shared/parsers/typescript-parser.ts +0 -841
  454. package/src/shared/security/compliance-patterns.ts +0 -666
  455. package/src/shared/security/index.ts +0 -30
  456. package/src/shared/security/osv-client.ts +0 -468
  457. package/src/shared/types/index.ts +0 -150
  458. package/src/shared/value-objects/index.ts +0 -273
  459. package/src/strange-loop/healing-controller.ts +0 -833
  460. package/src/strange-loop/index.ts +0 -104
  461. package/src/strange-loop/self-model.ts +0 -494
  462. package/src/strange-loop/strange-loop.ts +0 -446
  463. package/src/strange-loop/swarm-observer.ts +0 -448
  464. package/src/strange-loop/topology-analyzer.ts +0 -565
  465. package/src/strange-loop/types.ts +0 -640
  466. package/src/time-crystal/default-phases.ts +0 -520
  467. package/src/time-crystal/index.ts +0 -164
  468. package/src/time-crystal/oscillator.ts +0 -425
  469. package/src/time-crystal/phase-executor.ts +0 -521
  470. package/src/time-crystal/scheduler.ts +0 -1025
  471. package/src/time-crystal/test-runner.ts +0 -787
  472. package/src/time-crystal/types.ts +0 -421
  473. package/src/workers/base-worker.ts +0 -304
  474. package/src/workers/daemon.ts +0 -264
  475. package/src/workers/index.ts +0 -119
  476. package/src/workers/interfaces.ts +0 -393
  477. package/src/workers/worker-manager.ts +0 -424
  478. package/src/workers/workers/compliance-checker.ts +0 -445
  479. package/src/workers/workers/coverage-tracker.ts +0 -344
  480. package/src/workers/workers/defect-predictor.ts +0 -375
  481. package/src/workers/workers/flaky-detector.ts +0 -390
  482. package/src/workers/workers/index.ts +0 -17
  483. package/src/workers/workers/learning-consolidation.ts +0 -442
  484. package/src/workers/workers/performance-baseline.ts +0 -434
  485. package/src/workers/workers/quality-gate.ts +0 -419
  486. package/src/workers/workers/regression-monitor.ts +0 -357
  487. package/src/workers/workers/security-scan.ts +0 -349
  488. package/src/workers/workers/test-health.ts +0 -359
  489. package/tests/integration/code-intelligence/knowledge-graph-real.test.ts +0 -540
  490. package/tests/integration/coordination/cross-domain-router.test.ts +0 -403
  491. package/tests/integration/coordination/protocol-executor.test.ts +0 -454
  492. package/tests/integration/coordination/workflow-orchestrator.test.ts +0 -418
  493. package/tests/integration/feedback/feedback-loop-integration.test.ts +0 -560
  494. package/tests/integration/migration/v2-to-v3-migration.test.ts +0 -471
  495. package/tests/integration/parsers/typescript-parser.test.ts +0 -463
  496. package/tests/integration/security/vulnerability-detection.test.ts +0 -628
  497. package/tests/integration/test-execution/coordinator.test.ts +0 -410
  498. package/tests/integration/test-generation/coordinator.test.ts +0 -361
  499. package/tests/mocks/index.ts +0 -228
  500. package/tests/time-crystal/default-phases.test.ts +0 -476
  501. package/tests/time-crystal/oscillator.test.ts +0 -541
  502. package/tests/time-crystal/phase-executor.test.ts +0 -653
  503. package/tests/time-crystal/scheduler.test.ts +0 -626
  504. package/tests/time-crystal/test-runner.test.ts +0 -594
  505. package/tests/unit/causal-discovery/causal-graph.test.ts +0 -504
  506. package/tests/unit/causal-discovery/causal-root-cause-analyzer.test.ts +0 -347
  507. package/tests/unit/causal-discovery/discovery-engine.test.ts +0 -435
  508. package/tests/unit/causal-discovery/weight-matrix.test.ts +0 -328
  509. package/tests/unit/cli/cli.test.ts +0 -341
  510. package/tests/unit/cli/commands.test.ts +0 -414
  511. package/tests/unit/cli/init-command.test.ts +0 -274
  512. package/tests/unit/cli/migrate-command.test.ts +0 -396
  513. package/tests/unit/coordination/claims/claim-service.test.ts +0 -949
  514. package/tests/unit/coordination/claims/handoff-manager.test.ts +0 -773
  515. package/tests/unit/coordination/claims/work-stealing.test.ts +0 -492
  516. package/tests/unit/coordination/queen-coordinator.test.ts +0 -966
  517. package/tests/unit/coordination/result-saver.test.ts +0 -653
  518. package/tests/unit/coordination/task-executor.test.ts +0 -810
  519. package/tests/unit/domains/chaos-resilience/chaos-engineer.test.ts +0 -484
  520. package/tests/unit/domains/chaos-resilience/load-tester.test.ts +0 -559
  521. package/tests/unit/domains/chaos-resilience/performance-profiler.test.ts +0 -490
  522. package/tests/unit/domains/code-intelligence/impact-analyzer.test.ts +0 -560
  523. package/tests/unit/domains/code-intelligence/knowledge-graph.test.ts +0 -460
  524. package/tests/unit/domains/code-intelligence/semantic-analyzer.test.ts +0 -584
  525. package/tests/unit/domains/contract-testing/api-compatibility.test.ts +0 -483
  526. package/tests/unit/domains/contract-testing/contract-validator.test.ts +0 -370
  527. package/tests/unit/domains/contract-testing/schema-validator.test.ts +0 -610
  528. package/tests/unit/domains/coverage-analysis/coverage-embedder.test.ts +0 -298
  529. package/tests/unit/domains/coverage-analysis/hnsw-index.test.ts +0 -292
  530. package/tests/unit/domains/coverage-analysis/sublinear-analyzer.test.ts +0 -506
  531. package/tests/unit/domains/defect-intelligence/defect-predictor.test.ts +0 -370
  532. package/tests/unit/domains/defect-intelligence/pattern-learner.test.ts +0 -546
  533. package/tests/unit/domains/defect-intelligence/root-cause-analyzer.test.ts +0 -534
  534. package/tests/unit/domains/learning-optimization/learning-coordinator.test.ts +0 -541
  535. package/tests/unit/domains/learning-optimization/metrics-optimizer.test.ts +0 -552
  536. package/tests/unit/domains/learning-optimization/production-intel.test.ts +0 -589
  537. package/tests/unit/domains/learning-optimization/transfer-specialist.test.ts +0 -453
  538. package/tests/unit/domains/quality-assessment/coherence-gate.test.ts +0 -1006
  539. package/tests/unit/domains/quality-assessment/deployment-advisor.test.ts +0 -515
  540. package/tests/unit/domains/quality-assessment/quality-analyzer.test.ts +0 -401
  541. package/tests/unit/domains/quality-assessment/quality-gate.test.ts +0 -324
  542. package/tests/unit/domains/requirements-validation/bdd-scenario-writer.test.ts +0 -479
  543. package/tests/unit/domains/requirements-validation/requirements-validator.test.ts +0 -452
  544. package/tests/unit/domains/requirements-validation/testability-scorer.test.ts +0 -505
  545. package/tests/unit/domains/security-compliance/compliance-validator.test.ts +0 -500
  546. package/tests/unit/domains/security-compliance/security-auditor.test.ts +0 -498
  547. package/tests/unit/domains/security-compliance/security-scanner.test.ts +0 -412
  548. package/tests/unit/domains/visual-accessibility/accessibility-tester.test.ts +0 -432
  549. package/tests/unit/domains/visual-accessibility/responsive-tester.test.ts +0 -506
  550. package/tests/unit/domains/visual-accessibility/visual-tester.test.ts +0 -412
  551. package/tests/unit/early-exit/early-exit-controller.test.ts +0 -548
  552. package/tests/unit/early-exit/early-exit-decision.test.ts +0 -617
  553. package/tests/unit/early-exit/index.test.ts +0 -254
  554. package/tests/unit/early-exit/quality-signal.test.ts +0 -589
  555. package/tests/unit/early-exit/speculative-executor.test.ts +0 -453
  556. package/tests/unit/feedback/coverage-learner.test.ts +0 -288
  557. package/tests/unit/feedback/feedback-loop.test.ts +0 -458
  558. package/tests/unit/feedback/pattern-promotion.test.ts +0 -390
  559. package/tests/unit/feedback/quality-score-calculator.test.ts +0 -364
  560. package/tests/unit/feedback/test-outcome-tracker.test.ts +0 -243
  561. package/tests/unit/init/init-wizard.test.ts +0 -881
  562. package/tests/unit/init/project-analyzer.test.ts +0 -807
  563. package/tests/unit/init/self-configurator.test.ts +0 -493
  564. package/tests/unit/integrations/ruvector/ast-complexity.test.ts +0 -240
  565. package/tests/unit/integrations/ruvector/coverage-router.test.ts +0 -366
  566. package/tests/unit/integrations/ruvector/diff-risk-classifier.test.ts +0 -340
  567. package/tests/unit/integrations/ruvector/graph-boundaries.test.ts +0 -355
  568. package/tests/unit/integrations/ruvector/q-learning-router.test.ts +0 -314
  569. package/tests/unit/kernel/agent-coordinator.test.ts +0 -220
  570. package/tests/unit/kernel/event-bus.test.ts +0 -197
  571. package/tests/unit/learning/qe-reasoning-bank.test.ts +0 -666
  572. package/tests/unit/learning/real-qe-reasoning-bank.benchmark.test.ts +0 -415
  573. package/tests/unit/mcp/mcp-server.test.ts +0 -544
  574. package/tests/unit/mcp/metrics/metrics-collector.test.ts +0 -340
  575. package/tests/unit/mcp/security/cve-prevention.test.ts +0 -512
  576. package/tests/unit/mcp/security/oauth21-provider.test.ts +0 -624
  577. package/tests/unit/mcp/security/rate-limiter.test.ts +0 -410
  578. package/tests/unit/mcp/security/sampling-server.test.ts +0 -420
  579. package/tests/unit/mcp/security/schema-validator.test.ts +0 -494
  580. package/tests/unit/mcp/tools/base.test.ts +0 -336
  581. package/tests/unit/mcp/tools/domain-tools.test.ts +0 -759
  582. package/tests/unit/mcp/tools/registry.test.ts +0 -240
  583. package/tests/unit/neural-optimizer/replay-buffer.test.ts +0 -403
  584. package/tests/unit/neural-optimizer/swarm-topology.test.ts +0 -473
  585. package/tests/unit/neural-optimizer/topology-optimizer.test.ts +0 -595
  586. package/tests/unit/neural-optimizer/value-network.test.ts +0 -343
  587. package/tests/unit/optimization/auto-tuner.test.ts +0 -506
  588. package/tests/unit/optimization/metric-collectors.test.ts +0 -352
  589. package/tests/unit/optimization/qe-workers.test.ts +0 -407
  590. package/tests/unit/optimization/tuning-algorithm.test.ts +0 -467
  591. package/tests/unit/routing/qe-agent-registry.test.ts +0 -229
  592. package/tests/unit/routing/qe-task-router.test.ts +0 -390
  593. package/tests/unit/routing/routing-feedback.test.ts +0 -339
  594. package/tests/unit/shared/embeddings/nomic-embedder.test.ts +0 -419
  595. package/tests/unit/shared/http/http-client.test.ts +0 -719
  596. package/tests/unit/shared/io/file-reader.test.ts +0 -511
  597. package/tests/unit/shared/llm/cache.test.ts +0 -391
  598. package/tests/unit/shared/llm/circuit-breaker.test.ts +0 -293
  599. package/tests/unit/shared/llm/cost-tracker.test.ts +0 -431
  600. package/tests/unit/shared/llm/provider-manager.test.ts +0 -550
  601. package/tests/unit/shared/llm/providers.test.ts +0 -532
  602. package/tests/unit/shared/parsers/typescript-parser.test.ts +0 -693
  603. package/tests/unit/shared/value-objects.test.ts +0 -184
  604. package/tests/unit/strange-loop/strange-loop.test.ts +0 -1170
  605. package/tests/unit/workers/base-worker.test.ts +0 -341
  606. package/tests/unit/workers/daemon.test.ts +0 -291
  607. package/tests/unit/workers/worker-manager.test.ts +0 -284
  608. package/tsconfig.json +0 -32
  609. package/vitest.config.ts +0 -27
package/src/cli/index.ts DELETED
@@ -1,1976 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Agentic QE v3 - Command Line Interface
5
- *
6
- * Provides CLI access to the v3 DDD architecture through the Queen Coordinator.
7
- * All commands delegate to domain services via the coordination layer.
8
- */
9
-
10
- import { Command } from 'commander';
11
- import chalk from 'chalk';
12
- import { QEKernel } from '../kernel/interfaces';
13
- import { QEKernelImpl } from '../kernel/kernel';
14
- import {
15
- QueenCoordinator,
16
- createQueenCoordinator,
17
- TaskType,
18
- } from '../coordination/queen-coordinator';
19
- import { CrossDomainEventRouter } from '../coordination/cross-domain-router';
20
- import { DefaultProtocolExecutor } from '../coordination/protocol-executor';
21
- import { WorkflowOrchestrator } from '../coordination/workflow-orchestrator';
22
- import { DomainName, ALL_DOMAINS, Priority } from '../shared/types';
23
- import { InitOrchestrator, type InitOrchestratorOptions } from '../init/init-wizard';
24
-
25
- // ============================================================================
26
- // CLI State
27
- // ============================================================================
28
-
29
- interface CLIContext {
30
- kernel: QEKernel | null;
31
- queen: QueenCoordinator | null;
32
- router: CrossDomainEventRouter | null;
33
- initialized: boolean;
34
- }
35
-
36
- const context: CLIContext = {
37
- kernel: null,
38
- queen: null,
39
- router: null,
40
- initialized: false,
41
- };
42
-
43
- // ============================================================================
44
- // Helper Functions
45
- // ============================================================================
46
-
47
- function getStatusColor(status: string): string {
48
- switch (status) {
49
- case 'healthy':
50
- case 'completed':
51
- return chalk.green(status);
52
- case 'degraded':
53
- case 'running':
54
- return chalk.yellow(status);
55
- case 'unhealthy':
56
- case 'failed':
57
- return chalk.red(status);
58
- default:
59
- return chalk.gray(status);
60
- }
61
- }
62
-
63
- function formatDuration(ms: number): string {
64
- if (ms < 1000) return `${ms}ms`;
65
- if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`;
66
- if (ms < 3600000) return `${(ms / 60000).toFixed(1)}m`;
67
- return `${(ms / 3600000).toFixed(1)}h`;
68
- }
69
-
70
- function formatUptime(ms: number): string {
71
- const hours = Math.floor(ms / 3600000);
72
- const minutes = Math.floor((ms % 3600000) / 60000);
73
- const seconds = Math.floor((ms % 60000) / 1000);
74
- return `${hours}h ${minutes}m ${seconds}s`;
75
- }
76
-
77
- async function autoInitialize(): Promise<void> {
78
- // Create kernel with defaults
79
- context.kernel = new QEKernelImpl({
80
- maxConcurrentAgents: 15,
81
- memoryBackend: 'sqlite',
82
- hnswEnabled: true,
83
- lazyLoading: false,
84
- enabledDomains: [...ALL_DOMAINS],
85
- });
86
-
87
- await context.kernel.initialize();
88
-
89
- // Create cross-domain router
90
- context.router = new CrossDomainEventRouter(context.kernel.eventBus);
91
- await context.router.initialize();
92
-
93
- // Create protocol executor
94
- const getDomainAPI = <T>(domain: DomainName): T | undefined => {
95
- return context.kernel!.getDomainAPI<T>(domain);
96
- };
97
- const protocolExecutor = new DefaultProtocolExecutor(
98
- context.kernel.eventBus,
99
- context.kernel.memory,
100
- getDomainAPI
101
- );
102
-
103
- // Create workflow orchestrator
104
- const workflowOrchestrator = new WorkflowOrchestrator(
105
- context.kernel.eventBus,
106
- context.kernel.memory,
107
- context.kernel.coordinator
108
- );
109
- await workflowOrchestrator.initialize();
110
-
111
- // Create Queen Coordinator
112
- context.queen = createQueenCoordinator(
113
- context.kernel,
114
- context.router,
115
- protocolExecutor,
116
- undefined
117
- );
118
- await context.queen.initialize();
119
-
120
- context.initialized = true;
121
- }
122
-
123
- async function ensureInitialized(): Promise<boolean> {
124
- if (context.initialized && context.kernel && context.queen) {
125
- return true;
126
- }
127
-
128
- // Auto-initialize with defaults
129
- console.log(chalk.gray('Auto-initializing v3 system...'));
130
- try {
131
- await autoInitialize();
132
- console.log(chalk.green('✓ System ready\n'));
133
- return true;
134
- } catch (err) {
135
- console.error(chalk.red('Failed to auto-initialize:'), err);
136
- console.log(chalk.yellow('Try running `aqe-v3 init` manually.'));
137
- return false;
138
- }
139
- }
140
-
141
- /**
142
- * Cleanup resources and exit the process
143
- */
144
- async function cleanupAndExit(code: number = 0): Promise<never> {
145
- try {
146
- if (context.queen) {
147
- await context.queen.dispose();
148
- }
149
- if (context.router) {
150
- await context.router.dispose();
151
- }
152
- if (context.kernel) {
153
- await context.kernel.dispose();
154
- }
155
- } catch {
156
- // Ignore cleanup errors
157
- }
158
- process.exit(code);
159
- }
160
-
161
- // ============================================================================
162
- // CLI Program
163
- // ============================================================================
164
-
165
- const program = new Command();
166
-
167
- program
168
- .name('aqe-v3')
169
- .description('Agentic QE v3 - Domain-Driven Quality Engineering')
170
- .version('3.0.0-alpha.1');
171
-
172
- // ============================================================================
173
- // Init Command
174
- // ============================================================================
175
-
176
- program
177
- .command('init')
178
- .description('Initialize the AQE v3 system')
179
- .option('-d, --domains <domains>', 'Comma-separated list of domains to enable', 'all')
180
- .option('-m, --max-agents <number>', 'Maximum concurrent agents', '15')
181
- .option('--memory <backend>', 'Memory backend (sqlite|agentdb|hybrid)', 'hybrid')
182
- .option('--lazy', 'Enable lazy loading of domains')
183
- .option('--wizard', 'Run interactive setup wizard')
184
- .option('--auto', 'Auto-configure based on project analysis')
185
- .option('--minimal', 'Minimal configuration (skip optional features)')
186
- .option('--skip-patterns', 'Skip loading pre-trained patterns')
187
- .action(async (options) => {
188
- try {
189
- // Check if wizard mode requested
190
- if (options.wizard || options.auto) {
191
- console.log(chalk.blue('\n🚀 Agentic QE v3 Initialization\n'));
192
-
193
- const orchestratorOptions: InitOrchestratorOptions = {
194
- projectRoot: process.cwd(),
195
- autoMode: options.auto,
196
- minimal: options.minimal,
197
- skipPatterns: options.skipPatterns,
198
- };
199
-
200
- const orchestrator = new InitOrchestrator(orchestratorOptions);
201
-
202
- if (options.wizard) {
203
- // Show wizard steps
204
- console.log(chalk.white('📋 Setup Wizard Steps:\n'));
205
- const steps = orchestrator.getWizardSteps();
206
- for (let i = 0; i < steps.length; i++) {
207
- console.log(chalk.gray(` ${i + 1}. ${steps[i].title}`));
208
- console.log(chalk.gray(` ${steps[i].description}\n`));
209
- }
210
- }
211
-
212
- console.log(chalk.white('🔍 Analyzing project...\n'));
213
-
214
- const result = await orchestrator.initialize();
215
-
216
- // Display step results
217
- for (const step of result.steps) {
218
- const statusIcon = step.status === 'success' ? '✓' : step.status === 'error' ? '✗' : '⚠';
219
- const statusColor = step.status === 'success' ? chalk.green : step.status === 'error' ? chalk.red : chalk.yellow;
220
- console.log(statusColor(` ${statusIcon} ${step.step} (${step.durationMs}ms)`));
221
- }
222
- console.log('');
223
-
224
- if (result.success) {
225
- console.log(chalk.green('✅ AQE v3 initialized successfully!\n'));
226
-
227
- // Show summary
228
- console.log(chalk.blue('📊 Summary:'));
229
- console.log(chalk.gray(` • Patterns loaded: ${result.summary.patternsLoaded}`));
230
- console.log(chalk.gray(` • Hooks configured: ${result.summary.hooksConfigured ? 'Yes' : 'No'}`));
231
- console.log(chalk.gray(` • Workers started: ${result.summary.workersStarted}`));
232
- console.log(chalk.gray(` • Total time: ${result.totalDurationMs}ms\n`));
233
-
234
- console.log(chalk.white('Next steps:'));
235
- console.log(chalk.gray(' 1. Add MCP: claude mcp add aqe-v3 -- npx @agentic-qe/v3 mcp'));
236
- console.log(chalk.gray(' 2. Run tests: aqe-v3 test <path>'));
237
- console.log(chalk.gray(' 3. Check status: aqe-v3 status\n'));
238
- } else {
239
- console.log(chalk.red('❌ Initialization failed. Check errors above.\n'));
240
- process.exit(1);
241
- }
242
-
243
- process.exit(0);
244
- }
245
-
246
- // Standard init without wizard
247
- console.log(chalk.blue('\n🚀 Initializing Agentic QE v3...\n'));
248
-
249
- // Determine enabled domains
250
- const enabledDomains: DomainName[] =
251
- options.domains === 'all'
252
- ? [...ALL_DOMAINS]
253
- : options.domains.split(',').filter((d: string) => ALL_DOMAINS.includes(d as DomainName));
254
-
255
- console.log(chalk.gray(` Domains: ${enabledDomains.length}`));
256
- console.log(chalk.gray(` Max Agents: ${options.maxAgents}`));
257
- console.log(chalk.gray(` Memory: ${options.memory}`));
258
- console.log(chalk.gray(` Lazy Loading: ${options.lazy ? 'enabled' : 'disabled'}\n`));
259
-
260
- // Create kernel
261
- context.kernel = new QEKernelImpl({
262
- maxConcurrentAgents: parseInt(options.maxAgents, 10),
263
- memoryBackend: options.memory,
264
- hnswEnabled: true,
265
- lazyLoading: options.lazy || false,
266
- enabledDomains,
267
- });
268
-
269
- await context.kernel.initialize();
270
- console.log(chalk.green(' ✓ Kernel initialized'));
271
-
272
- // Create cross-domain router
273
- context.router = new CrossDomainEventRouter(context.kernel.eventBus);
274
- await context.router.initialize();
275
- console.log(chalk.green(' ✓ Cross-domain router initialized'));
276
-
277
- // Create protocol executor
278
- const getDomainAPI = <T>(domain: DomainName): T | undefined => {
279
- return context.kernel!.getDomainAPI<T>(domain);
280
- };
281
- const protocolExecutor = new DefaultProtocolExecutor(
282
- context.kernel.eventBus,
283
- context.kernel.memory,
284
- getDomainAPI
285
- );
286
- console.log(chalk.green(' ✓ Protocol executor initialized'));
287
-
288
- // Create workflow orchestrator
289
- const workflowOrchestrator = new WorkflowOrchestrator(
290
- context.kernel.eventBus,
291
- context.kernel.memory,
292
- context.kernel.coordinator
293
- );
294
- await workflowOrchestrator.initialize();
295
- console.log(chalk.green(' ✓ Workflow orchestrator initialized'));
296
-
297
- // Create Queen Coordinator
298
- // Note: workflowExecutor is omitted as WorkflowOrchestrator uses different interface
299
- context.queen = createQueenCoordinator(
300
- context.kernel,
301
- context.router,
302
- protocolExecutor,
303
- undefined // WorkflowExecutor - optional, can be added later
304
- );
305
- await context.queen.initialize();
306
- console.log(chalk.green(' ✓ Queen Coordinator initialized'));
307
-
308
- context.initialized = true;
309
-
310
- console.log(chalk.green('\n✅ AQE v3 initialized successfully!\n'));
311
-
312
- // Show enabled domains
313
- console.log(chalk.blue('📦 Enabled Domains:'));
314
- for (const domain of enabledDomains) {
315
- console.log(chalk.gray(` • ${domain}`));
316
- }
317
- console.log('');
318
-
319
- } catch (error) {
320
- console.error(chalk.red('\n❌ Failed to initialize:'), error);
321
- process.exit(1);
322
- }
323
- });
324
-
325
- // ============================================================================
326
- // Status Command
327
- // ============================================================================
328
-
329
- program
330
- .command('status')
331
- .description('Show system status')
332
- .option('-v, --verbose', 'Show detailed status')
333
- .action(async (options) => {
334
- if (!await ensureInitialized()) return;
335
-
336
- try {
337
- const health = context.queen!.getHealth();
338
- const metrics = context.queen!.getMetrics();
339
-
340
- console.log(chalk.blue('\n📊 AQE v3 Status\n'));
341
-
342
- // Overall health
343
- console.log(` Status: ${getStatusColor(health.status)}`);
344
- console.log(` Uptime: ${chalk.cyan(formatUptime(metrics.uptime))}`);
345
- console.log(` Work Stealing: ${health.workStealingActive ? chalk.green('active') : chalk.gray('inactive')}`);
346
-
347
- // Agents
348
- console.log(chalk.blue('\n👥 Agents:'));
349
- console.log(` Total: ${chalk.cyan(health.totalAgents)}`);
350
- console.log(` Active: ${chalk.yellow(health.activeAgents)}`);
351
- console.log(` Utilization: ${chalk.cyan((metrics.agentUtilization * 100).toFixed(1))}%`);
352
-
353
- // Tasks
354
- console.log(chalk.blue('\n📋 Tasks:'));
355
- console.log(` Received: ${chalk.cyan(metrics.tasksReceived)}`);
356
- console.log(` Completed: ${chalk.green(metrics.tasksCompleted)}`);
357
- console.log(` Failed: ${chalk.red(metrics.tasksFailed)}`);
358
- console.log(` Pending: ${chalk.yellow(health.pendingTasks)}`);
359
- console.log(` Running: ${chalk.yellow(health.runningTasks)}`);
360
- if (metrics.tasksStolen > 0) {
361
- console.log(` Stolen (work stealing): ${chalk.cyan(metrics.tasksStolen)}`);
362
- }
363
-
364
- // Protocols & Workflows
365
- if (metrics.protocolsExecuted > 0 || metrics.workflowsExecuted > 0) {
366
- console.log(chalk.blue('\n🔄 Coordination:'));
367
- console.log(` Protocols Executed: ${chalk.cyan(metrics.protocolsExecuted)}`);
368
- console.log(` Workflows Executed: ${chalk.cyan(metrics.workflowsExecuted)}`);
369
- }
370
-
371
- // Verbose domain status
372
- if (options.verbose) {
373
- console.log(chalk.blue('\n📦 Domain Status:'));
374
- for (const [domain, domainHealth] of health.domainHealth) {
375
- console.log(` ${domain}: ${getStatusColor(domainHealth.status)}`);
376
- console.log(chalk.gray(` Agents: ${domainHealth.agents.active}/${domainHealth.agents.total} active`));
377
- if (domainHealth.errors.length > 0) {
378
- console.log(chalk.red(` Errors: ${domainHealth.errors.length}`));
379
- }
380
- }
381
-
382
- // Domain utilization
383
- console.log(chalk.blue('\n📈 Domain Load:'));
384
- for (const [domain, load] of metrics.domainUtilization) {
385
- const bar = '█'.repeat(Math.min(load, 20)) + '░'.repeat(Math.max(0, 20 - load));
386
- console.log(` ${domain.padEnd(25)} ${bar} ${load}`);
387
- }
388
- }
389
-
390
- // Health issues
391
- if (health.issues.length > 0) {
392
- console.log(chalk.red('\n⚠️ Issues:'));
393
- for (const issue of health.issues) {
394
- const color = issue.severity === 'high' ? chalk.red :
395
- issue.severity === 'medium' ? chalk.yellow : chalk.gray;
396
- console.log(` ${color(`[${issue.severity}]`)} ${issue.message}`);
397
- }
398
- }
399
-
400
- console.log('');
401
- await cleanupAndExit(0);
402
-
403
- } catch (error) {
404
- console.error(chalk.red('\n❌ Failed to get status:'), error);
405
- await cleanupAndExit(1);
406
- }
407
- });
408
-
409
- // ============================================================================
410
- // Health Command
411
- // ============================================================================
412
-
413
- program
414
- .command('health')
415
- .description('Check system health')
416
- .option('-d, --domain <domain>', 'Check specific domain health')
417
- .action(async (options) => {
418
- if (!await ensureInitialized()) return;
419
-
420
- try {
421
- if (options.domain) {
422
- const domain = options.domain as DomainName;
423
- const health = context.queen!.getDomainHealth(domain);
424
-
425
- if (!health) {
426
- console.log(chalk.red(`\n❌ Domain not found: ${domain}\n`));
427
- return;
428
- }
429
-
430
- console.log(chalk.blue(`\n🏥 Health: ${domain}\n`));
431
- console.log(` Status: ${getStatusColor(health.status)}`);
432
- console.log(` Agents: ${health.agents.active}/${health.agents.total} active`);
433
- console.log(` Idle: ${health.agents.idle}`);
434
- console.log(` Failed: ${health.agents.failed}`);
435
- if (health.lastActivity) {
436
- console.log(` Last Activity: ${health.lastActivity.toISOString()}`);
437
- }
438
- if (health.errors.length > 0) {
439
- console.log(chalk.red(`\n Errors:`));
440
- health.errors.forEach(err => console.log(chalk.red(` • ${err}`)));
441
- }
442
- } else {
443
- const health = context.queen!.getHealth();
444
-
445
- console.log(chalk.blue('\n🏥 System Health\n'));
446
- console.log(` Overall: ${getStatusColor(health.status)}`);
447
- console.log(` Last Check: ${health.lastHealthCheck.toISOString()}`);
448
-
449
- // Summary by status
450
- let healthy = 0, degraded = 0, unhealthy = 0;
451
- for (const [, domainHealth] of health.domainHealth) {
452
- if (domainHealth.status === 'healthy') healthy++;
453
- else if (domainHealth.status === 'degraded') degraded++;
454
- else unhealthy++;
455
- }
456
-
457
- console.log(chalk.blue('\n📦 Domains:'));
458
- console.log(` ${chalk.green('●')} Healthy: ${healthy}`);
459
- console.log(` ${chalk.yellow('●')} Degraded: ${degraded}`);
460
- console.log(` ${chalk.red('●')} Unhealthy: ${unhealthy}`);
461
- }
462
-
463
- console.log('');
464
- await cleanupAndExit(0);
465
-
466
- } catch (error) {
467
- console.error(chalk.red('\n❌ Health check failed:'), error);
468
- await cleanupAndExit(1);
469
- }
470
- });
471
-
472
- // ============================================================================
473
- // Task Command Group
474
- // ============================================================================
475
-
476
- const taskCmd = program
477
- .command('task')
478
- .description('Manage QE tasks');
479
-
480
- taskCmd
481
- .command('submit <type>')
482
- .description('Submit a task to the Queen Coordinator')
483
- .option('-p, --priority <priority>', 'Task priority (p0|p1|p2|p3)', 'p1')
484
- .option('-d, --domain <domain>', 'Target domain')
485
- .option('-t, --timeout <ms>', 'Task timeout in ms', '300000')
486
- .option('--payload <json>', 'Task payload as JSON', '{}')
487
- .action(async (type: string, options) => {
488
- if (!await ensureInitialized()) return;
489
-
490
- try {
491
- const taskType = type as TaskType;
492
- const payload = JSON.parse(options.payload);
493
- const targetDomains = options.domain ? [options.domain as DomainName] : [];
494
-
495
- console.log(chalk.blue(`\n📝 Submitting task: ${taskType}\n`));
496
-
497
- const result = await context.queen!.submitTask({
498
- type: taskType,
499
- priority: options.priority as Priority,
500
- targetDomains,
501
- payload,
502
- timeout: parseInt(options.timeout, 10),
503
- });
504
-
505
- if (result.success) {
506
- console.log(chalk.green(`✅ Task submitted successfully`));
507
- console.log(chalk.cyan(` ID: ${result.value}`));
508
- console.log(chalk.gray(` Type: ${taskType}`));
509
- console.log(chalk.gray(` Priority: ${options.priority}`));
510
- } else {
511
- console.log(chalk.red(`❌ Failed to submit task: ${result.error.message}`));
512
- }
513
-
514
- console.log('');
515
-
516
- } catch (error) {
517
- console.error(chalk.red('\n❌ Failed to submit task:'), error);
518
- process.exit(1);
519
- }
520
- });
521
-
522
- taskCmd
523
- .command('list')
524
- .description('List all tasks')
525
- .option('-s, --status <status>', 'Filter by status')
526
- .option('-p, --priority <priority>', 'Filter by priority')
527
- .option('-d, --domain <domain>', 'Filter by domain')
528
- .action(async (options) => {
529
- if (!await ensureInitialized()) return;
530
-
531
- try {
532
- const tasks = context.queen!.listTasks({
533
- status: options.status,
534
- priority: options.priority,
535
- domain: options.domain,
536
- });
537
-
538
- console.log(chalk.blue(`\n📋 Tasks (${tasks.length})\n`));
539
-
540
- if (tasks.length === 0) {
541
- console.log(chalk.gray(' No tasks found'));
542
- } else {
543
- for (const task of tasks) {
544
- console.log(` ${chalk.cyan(task.taskId)}`);
545
- console.log(` Type: ${task.task.type}`);
546
- console.log(` Status: ${getStatusColor(task.status)}`);
547
- console.log(` Priority: ${task.task.priority}`);
548
- if (task.assignedDomain) {
549
- console.log(` Domain: ${task.assignedDomain}`);
550
- }
551
- if (task.startedAt) {
552
- console.log(chalk.gray(` Started: ${task.startedAt.toISOString()}`));
553
- }
554
- console.log('');
555
- }
556
- }
557
-
558
- } catch (error) {
559
- console.error(chalk.red('\n❌ Failed to list tasks:'), error);
560
- process.exit(1);
561
- }
562
- });
563
-
564
- taskCmd
565
- .command('cancel <taskId>')
566
- .description('Cancel a task')
567
- .action(async (taskId: string) => {
568
- if (!await ensureInitialized()) return;
569
-
570
- try {
571
- const result = await context.queen!.cancelTask(taskId);
572
-
573
- if (result.success) {
574
- console.log(chalk.green(`\n✅ Task cancelled: ${taskId}\n`));
575
- } else {
576
- console.log(chalk.red(`\n❌ Failed to cancel task: ${result.error.message}\n`));
577
- }
578
-
579
- } catch (error) {
580
- console.error(chalk.red('\n❌ Failed to cancel task:'), error);
581
- process.exit(1);
582
- }
583
- });
584
-
585
- taskCmd
586
- .command('status <taskId>')
587
- .description('Get task status')
588
- .action(async (taskId: string) => {
589
- if (!await ensureInitialized()) return;
590
-
591
- try {
592
- const task = context.queen!.getTaskStatus(taskId);
593
-
594
- if (!task) {
595
- console.log(chalk.red(`\n❌ Task not found: ${taskId}\n`));
596
- return;
597
- }
598
-
599
- console.log(chalk.blue(`\n📋 Task: ${taskId}\n`));
600
- console.log(` Type: ${task.task.type}`);
601
- console.log(` Status: ${getStatusColor(task.status)}`);
602
- console.log(` Priority: ${task.task.priority}`);
603
- if (task.assignedDomain) {
604
- console.log(` Domain: ${task.assignedDomain}`);
605
- }
606
- if (task.assignedAgents.length > 0) {
607
- console.log(` Agents: ${task.assignedAgents.join(', ')}`);
608
- }
609
- console.log(` Created: ${task.task.createdAt.toISOString()}`);
610
- if (task.startedAt) {
611
- console.log(` Started: ${task.startedAt.toISOString()}`);
612
- }
613
- if (task.completedAt) {
614
- console.log(` Completed: ${task.completedAt.toISOString()}`);
615
- const duration = task.completedAt.getTime() - task.startedAt!.getTime();
616
- console.log(` Duration: ${formatDuration(duration)}`);
617
- }
618
- if (task.error) {
619
- console.log(chalk.red(` Error: ${task.error}`));
620
- }
621
- if (task.retryCount > 0) {
622
- console.log(chalk.yellow(` Retries: ${task.retryCount}`));
623
- }
624
-
625
- console.log('');
626
-
627
- } catch (error) {
628
- console.error(chalk.red('\n❌ Failed to get task status:'), error);
629
- process.exit(1);
630
- }
631
- });
632
-
633
- // ============================================================================
634
- // Agent Command Group
635
- // ============================================================================
636
-
637
- const agentCmd = program
638
- .command('agent')
639
- .description('Manage QE agents');
640
-
641
- agentCmd
642
- .command('list')
643
- .description('List all agents')
644
- .option('-d, --domain <domain>', 'Filter by domain')
645
- .option('-s, --status <status>', 'Filter by status')
646
- .action(async (options) => {
647
- if (!await ensureInitialized()) return;
648
-
649
- try {
650
- let agents = options.domain
651
- ? context.queen!.getAgentsByDomain(options.domain as DomainName)
652
- : context.queen!.listAllAgents();
653
-
654
- if (options.status) {
655
- agents = agents.filter(a => a.status === options.status);
656
- }
657
-
658
- console.log(chalk.blue(`\n👥 Agents (${agents.length})\n`));
659
-
660
- if (agents.length === 0) {
661
- console.log(chalk.gray(' No agents found'));
662
- } else {
663
- // Group by domain
664
- const byDomain = new Map<DomainName, typeof agents>();
665
- for (const agent of agents) {
666
- if (!byDomain.has(agent.domain)) {
667
- byDomain.set(agent.domain, []);
668
- }
669
- byDomain.get(agent.domain)!.push(agent);
670
- }
671
-
672
- for (const [domain, domainAgents] of byDomain) {
673
- console.log(chalk.cyan(` ${domain}:`));
674
- for (const agent of domainAgents) {
675
- console.log(` ${agent.id}`);
676
- console.log(` Type: ${agent.type}`);
677
- console.log(` Status: ${getStatusColor(agent.status)}`);
678
- if (agent.startedAt) {
679
- console.log(chalk.gray(` Started: ${agent.startedAt.toISOString()}`));
680
- }
681
- }
682
- console.log('');
683
- }
684
- }
685
-
686
- } catch (error) {
687
- console.error(chalk.red('\n❌ Failed to list agents:'), error);
688
- process.exit(1);
689
- }
690
- });
691
-
692
- agentCmd
693
- .command('spawn <domain>')
694
- .description('Spawn an agent in a domain')
695
- .option('-t, --type <type>', 'Agent type', 'worker')
696
- .option('-c, --capabilities <caps>', 'Comma-separated capabilities', 'general')
697
- .action(async (domain: string, options) => {
698
- if (!await ensureInitialized()) return;
699
-
700
- try {
701
- const capabilities = options.capabilities.split(',');
702
-
703
- console.log(chalk.blue(`\n🚀 Spawning agent in ${domain}...\n`));
704
-
705
- const result = await context.queen!.requestAgentSpawn(
706
- domain as DomainName,
707
- options.type,
708
- capabilities
709
- );
710
-
711
- if (result.success) {
712
- console.log(chalk.green(`✅ Agent spawned successfully`));
713
- console.log(chalk.cyan(` ID: ${result.value}`));
714
- console.log(chalk.gray(` Domain: ${domain}`));
715
- console.log(chalk.gray(` Type: ${options.type}`));
716
- console.log(chalk.gray(` Capabilities: ${capabilities.join(', ')}`));
717
- } else {
718
- console.log(chalk.red(`❌ Failed to spawn agent: ${result.error.message}`));
719
- }
720
-
721
- console.log('');
722
-
723
- } catch (error) {
724
- console.error(chalk.red('\n❌ Failed to spawn agent:'), error);
725
- process.exit(1);
726
- }
727
- });
728
-
729
- // ============================================================================
730
- // Domain Command Group
731
- // ============================================================================
732
-
733
- const domainCmd = program
734
- .command('domain')
735
- .description('Domain operations');
736
-
737
- domainCmd
738
- .command('list')
739
- .description('List all domains')
740
- .action(async () => {
741
- if (!await ensureInitialized()) return;
742
-
743
- try {
744
- console.log(chalk.blue('\n📦 Domains\n'));
745
-
746
- for (const domain of ALL_DOMAINS) {
747
- const health = context.queen!.getDomainHealth(domain);
748
- const load = context.queen!.getDomainLoad(domain);
749
-
750
- console.log(` ${chalk.cyan(domain)}`);
751
- console.log(` Status: ${getStatusColor(health?.status || 'unknown')}`);
752
- console.log(` Load: ${load} tasks`);
753
- if (health) {
754
- console.log(` Agents: ${health.agents.active}/${health.agents.total}`);
755
- }
756
- console.log('');
757
- }
758
-
759
- } catch (error) {
760
- console.error(chalk.red('\n❌ Failed to list domains:'), error);
761
- process.exit(1);
762
- }
763
- });
764
-
765
- domainCmd
766
- .command('health <domain>')
767
- .description('Get domain health')
768
- .action(async (domain: string) => {
769
- if (!await ensureInitialized()) return;
770
-
771
- try {
772
- const health = context.queen!.getDomainHealth(domain as DomainName);
773
-
774
- if (!health) {
775
- console.log(chalk.red(`\n❌ Domain not found: ${domain}\n`));
776
- return;
777
- }
778
-
779
- console.log(chalk.blue(`\n🏥 ${domain} Health\n`));
780
- console.log(` Status: ${getStatusColor(health.status)}`);
781
- console.log(` Agents Total: ${health.agents.total}`);
782
- console.log(` Agents Active: ${chalk.green(health.agents.active)}`);
783
- console.log(` Agents Idle: ${chalk.yellow(health.agents.idle)}`);
784
- console.log(` Agents Failed: ${chalk.red(health.agents.failed)}`);
785
- if (health.lastActivity) {
786
- console.log(` Last Activity: ${health.lastActivity.toISOString()}`);
787
- }
788
-
789
- if (health.errors.length > 0) {
790
- console.log(chalk.red('\n Errors:'));
791
- health.errors.forEach(err => console.log(chalk.red(` • ${err}`)));
792
- }
793
-
794
- console.log('');
795
-
796
- } catch (error) {
797
- console.error(chalk.red('\n❌ Failed to get domain health:'), error);
798
- process.exit(1);
799
- }
800
- });
801
-
802
- // ============================================================================
803
- // Protocol Command Group
804
- // ============================================================================
805
-
806
- const protocolCmd = program
807
- .command('protocol')
808
- .description('Execute coordination protocols');
809
-
810
- protocolCmd
811
- .command('run <protocolId>')
812
- .description('Execute a protocol')
813
- .option('--params <json>', 'Protocol parameters as JSON', '{}')
814
- .action(async (protocolId: string, options) => {
815
- if (!await ensureInitialized()) return;
816
-
817
- try {
818
- const params = JSON.parse(options.params);
819
-
820
- console.log(chalk.blue(`\n🔄 Executing protocol: ${protocolId}\n`));
821
-
822
- const result = await context.queen!.executeProtocol(protocolId, params);
823
-
824
- if (result.success) {
825
- console.log(chalk.green(`✅ Protocol execution started`));
826
- console.log(chalk.cyan(` Execution ID: ${result.value}`));
827
- } else {
828
- console.log(chalk.red(`❌ Failed to execute protocol: ${result.error.message}`));
829
- }
830
-
831
- console.log('');
832
-
833
- } catch (error) {
834
- console.error(chalk.red('\n❌ Failed to execute protocol:'), error);
835
- process.exit(1);
836
- }
837
- });
838
-
839
- // ============================================================================
840
- // Shortcut Commands
841
- // ============================================================================
842
-
843
- // aqe-v3 test generate <source>
844
- program
845
- .command('test')
846
- .description('Test generation shortcut')
847
- .argument('<action>', 'Action (generate|execute)')
848
- .argument('[target]', 'Target file or directory')
849
- .option('-f, --framework <framework>', 'Test framework', 'vitest')
850
- .option('-t, --type <type>', 'Test type (unit|integration|e2e)', 'unit')
851
- .action(async (action: string, target: string, options) => {
852
- if (!await ensureInitialized()) return;
853
-
854
- try {
855
- if (action === 'generate') {
856
- console.log(chalk.blue(`\n🧪 Generating tests for ${target || 'current directory'}...\n`));
857
-
858
- // Get test generation domain API directly
859
- const testGenAPI = context.kernel!.getDomainAPI<{
860
- generateTests(request: { sourceFiles: string[]; testType: string; framework: string; coverageTarget?: number }): Promise<{ success: boolean; value?: unknown; error?: Error }>;
861
- }>('test-generation');
862
-
863
- if (!testGenAPI) {
864
- console.log(chalk.red('❌ Test generation domain not available'));
865
- return;
866
- }
867
-
868
- // Collect source files
869
- const fs = await import('fs');
870
- const path = await import('path');
871
- const targetPath = path.resolve(target || '.');
872
-
873
- let sourceFiles: string[] = [];
874
- if (fs.existsSync(targetPath)) {
875
- if (fs.statSync(targetPath).isDirectory()) {
876
- const walkDir = (dir: string, depth: number = 0): string[] => {
877
- if (depth > 4) return [];
878
- const result: string[] = [];
879
- const items = fs.readdirSync(dir);
880
- for (const item of items) {
881
- if (item === 'node_modules' || item === 'dist' || item === 'tests' || item.includes('.test.') || item.includes('.spec.')) continue;
882
- const fullPath = path.join(dir, item);
883
- const stat = fs.statSync(fullPath);
884
- if (stat.isDirectory()) {
885
- result.push(...walkDir(fullPath, depth + 1));
886
- } else if (item.endsWith('.ts') && !item.endsWith('.d.ts')) {
887
- result.push(fullPath);
888
- }
889
- }
890
- return result;
891
- };
892
- sourceFiles = walkDir(targetPath);
893
- } else {
894
- sourceFiles = [targetPath];
895
- }
896
- }
897
-
898
- if (sourceFiles.length === 0) {
899
- console.log(chalk.yellow('No source files found'));
900
- return;
901
- }
902
-
903
- console.log(chalk.gray(` Found ${sourceFiles.length} source files\n`));
904
-
905
- // Generate tests
906
- const result = await testGenAPI.generateTests({
907
- sourceFiles,
908
- testType: options.type as 'unit' | 'integration' | 'e2e',
909
- framework: options.framework as 'jest' | 'vitest',
910
- coverageTarget: 80,
911
- });
912
-
913
- if (result.success && result.value) {
914
- const generated = result.value as { tests: Array<{ name: string; sourceFile: string; testFile: string; assertions: number }>; coverageEstimate: number; patternsUsed: string[] };
915
- console.log(chalk.green(`✅ Generated ${generated.tests.length} tests\n`));
916
- console.log(chalk.cyan(' Tests:'));
917
- for (const test of generated.tests.slice(0, 10)) {
918
- console.log(` ${chalk.white(test.name)}`);
919
- console.log(chalk.gray(` Source: ${path.basename(test.sourceFile)}`));
920
- console.log(chalk.gray(` Assertions: ${test.assertions}`));
921
- }
922
- if (generated.tests.length > 10) {
923
- console.log(chalk.gray(` ... and ${generated.tests.length - 10} more`));
924
- }
925
- console.log(`\n Coverage Estimate: ${chalk.yellow(generated.coverageEstimate + '%')}`);
926
- if (generated.patternsUsed.length > 0) {
927
- console.log(` Patterns Used: ${chalk.cyan(generated.patternsUsed.join(', '))}`);
928
- }
929
- } else {
930
- console.log(chalk.red(`❌ Failed: ${result.error?.message || 'Unknown error'}`));
931
- }
932
-
933
- } else if (action === 'execute') {
934
- console.log(chalk.blue(`\n🧪 Executing tests in ${target || 'current directory'}...\n`));
935
-
936
- // Get test execution domain API
937
- const testExecAPI = context.kernel!.getDomainAPI<{
938
- runTests(request: { testFiles: string[]; parallel?: boolean; retryCount?: number }): Promise<{ success: boolean; value?: unknown; error?: Error }>;
939
- }>('test-execution');
940
-
941
- if (!testExecAPI) {
942
- console.log(chalk.red('❌ Test execution domain not available'));
943
- return;
944
- }
945
-
946
- // Collect test files
947
- const fs = await import('fs');
948
- const path = await import('path');
949
- const targetPath = path.resolve(target || '.');
950
-
951
- let testFiles: string[] = [];
952
- if (fs.existsSync(targetPath)) {
953
- if (fs.statSync(targetPath).isDirectory()) {
954
- const walkDir = (dir: string, depth: number = 0): string[] => {
955
- if (depth > 4) return [];
956
- const result: string[] = [];
957
- const items = fs.readdirSync(dir);
958
- for (const item of items) {
959
- if (item === 'node_modules' || item === 'dist') continue;
960
- const fullPath = path.join(dir, item);
961
- const stat = fs.statSync(fullPath);
962
- if (stat.isDirectory()) {
963
- result.push(...walkDir(fullPath, depth + 1));
964
- } else if ((item.includes('.test.') || item.includes('.spec.')) && item.endsWith('.ts')) {
965
- result.push(fullPath);
966
- }
967
- }
968
- return result;
969
- };
970
- testFiles = walkDir(targetPath);
971
- } else {
972
- testFiles = [targetPath];
973
- }
974
- }
975
-
976
- if (testFiles.length === 0) {
977
- console.log(chalk.yellow('No test files found'));
978
- return;
979
- }
980
-
981
- console.log(chalk.gray(` Found ${testFiles.length} test files\n`));
982
-
983
- const result = await testExecAPI.runTests({
984
- testFiles,
985
- parallel: true,
986
- retryCount: 2,
987
- });
988
-
989
- if (result.success && result.value) {
990
- const run = result.value as { runId: string; passed: number; failed: number; skipped: number; duration: number };
991
- const total = run.passed + run.failed + run.skipped;
992
- console.log(chalk.green(`✅ Test run complete`));
993
- console.log(`\n Results:`);
994
- console.log(` Total: ${chalk.white(total)}`);
995
- console.log(` Passed: ${chalk.green(run.passed)}`);
996
- console.log(` Failed: ${chalk.red(run.failed)}`);
997
- console.log(` Skipped: ${chalk.yellow(run.skipped)}`);
998
- console.log(` Duration: ${chalk.cyan(run.duration + 'ms')}`);
999
- } else {
1000
- console.log(chalk.red(`❌ Failed: ${result.error?.message || 'Unknown error'}`));
1001
- }
1002
- } else {
1003
- console.log(chalk.red(`\n❌ Unknown action: ${action}\n`));
1004
- await cleanupAndExit(1);
1005
- }
1006
-
1007
- console.log('');
1008
- await cleanupAndExit(0);
1009
-
1010
- } catch (error) {
1011
- console.error(chalk.red('\n❌ Failed:'), error);
1012
- await cleanupAndExit(1);
1013
- }
1014
- });
1015
-
1016
- // aqe-v3 coverage <target>
1017
- program
1018
- .command('coverage')
1019
- .description('Coverage analysis shortcut')
1020
- .argument('[target]', 'Target file or directory', '.')
1021
- .option('--risk', 'Include risk scoring')
1022
- .option('--gaps', 'Detect coverage gaps')
1023
- .action(async (target: string, options) => {
1024
- if (!await ensureInitialized()) return;
1025
-
1026
- try {
1027
- console.log(chalk.blue(`\n📊 Analyzing coverage for ${target}...\n`));
1028
-
1029
- // Get coverage analysis domain API directly
1030
- const coverageAPI = context.kernel!.getDomainAPI<{
1031
- analyze(request: { coverageData: { files: Array<{ path: string; lines: { covered: number; total: number }; branches: { covered: number; total: number }; functions: { covered: number; total: number }; statements: { covered: number; total: number }; uncoveredLines: number[]; uncoveredBranches: number[] }>; summary: { line: number; branch: number; function: number; statement: number; files: number } }; threshold?: number; includeFileDetails?: boolean }): Promise<{ success: boolean; value?: unknown; error?: Error }>;
1032
- detectGaps(request: { coverageData: { files: Array<{ path: string; lines: { covered: number; total: number }; branches: { covered: number; total: number }; functions: { covered: number; total: number }; statements: { covered: number; total: number }; uncoveredLines: number[]; uncoveredBranches: number[] }>; summary: { line: number; branch: number; function: number; statement: number; files: number } }; minCoverage?: number; prioritize?: string }): Promise<{ success: boolean; value?: unknown; error?: Error }>;
1033
- calculateRisk(request: { file: string; uncoveredLines: number[] }): Promise<{ success: boolean; value?: unknown; error?: Error }>;
1034
- }>('coverage-analysis');
1035
-
1036
- if (!coverageAPI) {
1037
- console.log(chalk.red('❌ Coverage analysis domain not available'));
1038
- return;
1039
- }
1040
-
1041
- // Collect source files and generate synthetic coverage data for analysis
1042
- const fs = await import('fs');
1043
- const path = await import('path');
1044
- const targetPath = path.resolve(target);
1045
-
1046
- let sourceFiles: string[] = [];
1047
- if (fs.existsSync(targetPath)) {
1048
- if (fs.statSync(targetPath).isDirectory()) {
1049
- const walkDir = (dir: string, depth: number = 0): string[] => {
1050
- if (depth > 4) return [];
1051
- const result: string[] = [];
1052
- const items = fs.readdirSync(dir);
1053
- for (const item of items) {
1054
- if (item === 'node_modules' || item === 'dist') continue;
1055
- const fullPath = path.join(dir, item);
1056
- const stat = fs.statSync(fullPath);
1057
- if (stat.isDirectory()) {
1058
- result.push(...walkDir(fullPath, depth + 1));
1059
- } else if (item.endsWith('.ts') && !item.endsWith('.d.ts')) {
1060
- result.push(fullPath);
1061
- }
1062
- }
1063
- return result;
1064
- };
1065
- sourceFiles = walkDir(targetPath);
1066
- } else {
1067
- sourceFiles = [targetPath];
1068
- }
1069
- }
1070
-
1071
- if (sourceFiles.length === 0) {
1072
- console.log(chalk.yellow('No source files found'));
1073
- return;
1074
- }
1075
-
1076
- console.log(chalk.gray(` Analyzing ${sourceFiles.length} files...\n`));
1077
-
1078
- // Build coverage data from file analysis
1079
- const files = sourceFiles.map(filePath => {
1080
- const content = fs.readFileSync(filePath, 'utf-8');
1081
- const lines = content.split('\n');
1082
- const totalLines = lines.length;
1083
-
1084
- // Estimate coverage based on presence of corresponding test file
1085
- const testFile = filePath.replace('.ts', '.test.ts').replace('/src/', '/tests/');
1086
- const hasTest = fs.existsSync(testFile);
1087
- const coverageRate = hasTest ? 0.75 + Math.random() * 0.2 : 0.2 + Math.random() * 0.3;
1088
-
1089
- const coveredLines = Math.floor(totalLines * coverageRate);
1090
- const uncoveredLines = Array.from({ length: totalLines - coveredLines }, (_, i) => i + coveredLines + 1);
1091
-
1092
- return {
1093
- path: filePath,
1094
- lines: { covered: coveredLines, total: totalLines },
1095
- branches: { covered: Math.floor(coveredLines * 0.8), total: totalLines },
1096
- functions: { covered: Math.floor(coveredLines * 0.9), total: Math.ceil(totalLines / 20) },
1097
- statements: { covered: coveredLines, total: totalLines },
1098
- uncoveredLines,
1099
- uncoveredBranches: uncoveredLines.slice(0, Math.floor(uncoveredLines.length / 2)),
1100
- };
1101
- });
1102
-
1103
- const totalLines = files.reduce((sum, f) => sum + f.lines.total, 0);
1104
- const coveredLines = files.reduce((sum, f) => sum + f.lines.covered, 0);
1105
- const totalBranches = files.reduce((sum, f) => sum + f.branches.total, 0);
1106
- const coveredBranches = files.reduce((sum, f) => sum + f.branches.covered, 0);
1107
- const totalFunctions = files.reduce((sum, f) => sum + f.functions.total, 0);
1108
- const coveredFunctions = files.reduce((sum, f) => sum + f.functions.covered, 0);
1109
-
1110
- const coverageData = {
1111
- files,
1112
- summary: {
1113
- line: Math.round((coveredLines / totalLines) * 100),
1114
- branch: Math.round((coveredBranches / totalBranches) * 100),
1115
- function: Math.round((coveredFunctions / totalFunctions) * 100),
1116
- statement: Math.round((coveredLines / totalLines) * 100),
1117
- files: files.length,
1118
- },
1119
- };
1120
-
1121
- // Run coverage analysis
1122
- const result = await coverageAPI.analyze({
1123
- coverageData,
1124
- threshold: 80,
1125
- includeFileDetails: true,
1126
- });
1127
-
1128
- if (result.success && result.value) {
1129
- const report = result.value as { summary: { line: number; branch: number; function: number; statement: number }; meetsThreshold: boolean; recommendations: string[] };
1130
-
1131
- console.log(chalk.cyan('📈 Coverage Summary:'));
1132
- console.log(` Lines: ${getColorForPercent(report.summary.line)(report.summary.line + '%')}`);
1133
- console.log(` Branches: ${getColorForPercent(report.summary.branch)(report.summary.branch + '%')}`);
1134
- console.log(` Functions: ${getColorForPercent(report.summary.function)(report.summary.function + '%')}`);
1135
- console.log(` Statements: ${getColorForPercent(report.summary.statement)(report.summary.statement + '%')}`);
1136
- console.log(`\n Threshold: ${report.meetsThreshold ? chalk.green('✓ Met (80%)') : chalk.red('✗ Not met (80%)')}`);
1137
-
1138
- if (report.recommendations.length > 0) {
1139
- console.log(chalk.cyan('\n Recommendations:'));
1140
- for (const rec of report.recommendations) {
1141
- console.log(chalk.gray(` • ${rec}`));
1142
- }
1143
- }
1144
- }
1145
-
1146
- // Detect gaps if requested
1147
- if (options.gaps) {
1148
- console.log(chalk.cyan('\n🔍 Coverage Gaps:'));
1149
-
1150
- const gapResult = await coverageAPI.detectGaps({
1151
- coverageData,
1152
- minCoverage: 80,
1153
- prioritize: options.risk ? 'risk' : 'size',
1154
- });
1155
-
1156
- if (gapResult.success && gapResult.value) {
1157
- const gaps = gapResult.value as { gaps: Array<{ file: string; lines: number[]; riskScore: number; severity: string; recommendation: string }>; totalUncoveredLines: number; estimatedEffort: number };
1158
-
1159
- console.log(chalk.gray(` Total uncovered lines: ${gaps.totalUncoveredLines}`));
1160
- console.log(chalk.gray(` Estimated effort: ${gaps.estimatedEffort} hours\n`));
1161
-
1162
- for (const gap of gaps.gaps.slice(0, 8)) {
1163
- const severityColor = gap.severity === 'high' ? chalk.red : gap.severity === 'medium' ? chalk.yellow : chalk.gray;
1164
- const filePath = gap.file.replace(process.cwd() + '/', '');
1165
- console.log(` ${severityColor(`[${gap.severity}]`)} ${chalk.white(filePath)}`);
1166
- console.log(chalk.gray(` ${gap.lines.length} uncovered lines, Risk: ${(gap.riskScore * 100).toFixed(0)}%`));
1167
- }
1168
- if (gaps.gaps.length > 8) {
1169
- console.log(chalk.gray(` ... and ${gaps.gaps.length - 8} more gaps`));
1170
- }
1171
- }
1172
- }
1173
-
1174
- // Calculate risk if requested
1175
- if (options.risk) {
1176
- console.log(chalk.cyan('\n⚠️ Risk Analysis:'));
1177
-
1178
- // Calculate risk for top 5 files with lowest coverage
1179
- const lowCoverageFiles = [...files]
1180
- .sort((a, b) => (a.lines.covered / a.lines.total) - (b.lines.covered / b.lines.total))
1181
- .slice(0, 5);
1182
-
1183
- for (const file of lowCoverageFiles) {
1184
- const riskResult = await coverageAPI.calculateRisk({
1185
- file: file.path,
1186
- uncoveredLines: file.uncoveredLines,
1187
- });
1188
-
1189
- if (riskResult.success && riskResult.value) {
1190
- const risk = riskResult.value as { overallRisk: number; riskLevel: string; recommendations: string[] };
1191
- const riskColor = risk.riskLevel === 'high' ? chalk.red : risk.riskLevel === 'medium' ? chalk.yellow : chalk.green;
1192
- const filePath = file.path.replace(process.cwd() + '/', '');
1193
- console.log(` ${riskColor(`[${risk.riskLevel}]`)} ${chalk.white(filePath)}`);
1194
- console.log(chalk.gray(` Risk: ${(risk.overallRisk * 100).toFixed(0)}%, Coverage: ${Math.round((file.lines.covered / file.lines.total) * 100)}%`));
1195
- }
1196
- }
1197
- }
1198
-
1199
- console.log(chalk.green('\n✅ Coverage analysis complete\n'));
1200
- await cleanupAndExit(0);
1201
-
1202
- } catch (error) {
1203
- console.error(chalk.red('\n❌ Failed:'), error);
1204
- await cleanupAndExit(1);
1205
- }
1206
- });
1207
-
1208
- function getColorForPercent(percent: number): (str: string) => string {
1209
- if (percent >= 80) return chalk.green;
1210
- if (percent >= 50) return chalk.yellow;
1211
- return chalk.red;
1212
- }
1213
-
1214
- // aqe-v3 quality
1215
- program
1216
- .command('quality')
1217
- .description('Quality assessment shortcut')
1218
- .option('--gate', 'Run quality gate evaluation')
1219
- .action(async (options) => {
1220
- if (!await ensureInitialized()) return;
1221
-
1222
- try {
1223
- console.log(chalk.blue(`\n🎯 Running quality assessment...\n`));
1224
-
1225
- const result = await context.queen!.submitTask({
1226
- type: 'assess-quality',
1227
- priority: 'p0',
1228
- targetDomains: ['quality-assessment'],
1229
- payload: { runGate: options.gate },
1230
- timeout: 300000,
1231
- });
1232
-
1233
- if (result.success) {
1234
- console.log(chalk.green(`✅ Task submitted: ${result.value}`));
1235
- console.log(chalk.gray(` Use 'aqe-v3 task status ${result.value}' to check progress`));
1236
- } else {
1237
- console.log(chalk.red(`❌ Failed: ${result.error.message}`));
1238
- }
1239
-
1240
- console.log('');
1241
-
1242
- } catch (error) {
1243
- console.error(chalk.red('\n❌ Failed:'), error);
1244
- process.exit(1);
1245
- }
1246
- });
1247
-
1248
- // aqe-v3 security
1249
- program
1250
- .command('security')
1251
- .description('Security scanning shortcut')
1252
- .option('--sast', 'Run SAST scan')
1253
- .option('--dast', 'Run DAST scan')
1254
- .option('--compliance <frameworks>', 'Check compliance (gdpr,hipaa,soc2)', '')
1255
- .option('-t, --target <path>', 'Target directory to scan', '.')
1256
- .action(async (options) => {
1257
- if (!await ensureInitialized()) return;
1258
-
1259
- try {
1260
- console.log(chalk.blue(`\n🔒 Running security scan on ${options.target}...\n`));
1261
-
1262
- // Get security domain API directly
1263
- const securityAPI = context.kernel!.getDomainAPI<{
1264
- runSASTScan(files: string[]): Promise<{ success: boolean; value?: unknown; error?: Error }>;
1265
- runDASTScan(urls: string[]): Promise<{ success: boolean; value?: unknown; error?: Error }>;
1266
- checkCompliance(frameworks: string[]): Promise<{ success: boolean; value?: unknown; error?: Error }>;
1267
- }>('security-compliance');
1268
-
1269
- if (!securityAPI) {
1270
- console.log(chalk.red('❌ Security domain not available'));
1271
- return;
1272
- }
1273
-
1274
- // Collect files from target
1275
- const fs = await import('fs');
1276
- const path = await import('path');
1277
- const targetPath = path.resolve(options.target);
1278
-
1279
- let files: string[] = [];
1280
- if (fs.existsSync(targetPath)) {
1281
- if (fs.statSync(targetPath).isDirectory()) {
1282
- // Get TypeScript files recursively using fs
1283
- const walkDir = (dir: string, depth: number = 0): string[] => {
1284
- if (depth > 4) return []; // Max depth limit
1285
- const result: string[] = [];
1286
- const items = fs.readdirSync(dir);
1287
- for (const item of items) {
1288
- if (item === 'node_modules' || item === 'dist') continue;
1289
- const fullPath = path.join(dir, item);
1290
- const stat = fs.statSync(fullPath);
1291
- if (stat.isDirectory()) {
1292
- result.push(...walkDir(fullPath, depth + 1));
1293
- } else if (item.endsWith('.ts') && !item.endsWith('.d.ts')) {
1294
- result.push(fullPath);
1295
- }
1296
- }
1297
- return result;
1298
- };
1299
- files = walkDir(targetPath);
1300
- } else {
1301
- files = [targetPath];
1302
- }
1303
- }
1304
-
1305
- if (files.length === 0) {
1306
- console.log(chalk.yellow('No files found to scan'));
1307
- return;
1308
- }
1309
-
1310
- console.log(chalk.gray(` Scanning ${files.length} files...\n`));
1311
-
1312
- // Run SAST if requested
1313
- if (options.sast) {
1314
- console.log(chalk.blue('📋 SAST Scan:'));
1315
- const sastResult = await securityAPI.runSASTScan(files);
1316
- if (sastResult.success && sastResult.value) {
1317
- const result = sastResult.value as { vulnerabilities?: Array<{ severity: string; type: string; file: string; line: number; message: string }> };
1318
- const vulns = result.vulnerabilities || [];
1319
- if (vulns.length === 0) {
1320
- console.log(chalk.green(' ✓ No vulnerabilities found'));
1321
- } else {
1322
- console.log(chalk.yellow(` ⚠ Found ${vulns.length} potential issues:`));
1323
- for (const v of vulns.slice(0, 10)) {
1324
- const color = v.severity === 'high' ? chalk.red : v.severity === 'medium' ? chalk.yellow : chalk.gray;
1325
- console.log(color(` [${v.severity}] ${v.type}: ${v.file}:${v.line}`));
1326
- console.log(chalk.gray(` ${v.message}`));
1327
- }
1328
- if (vulns.length > 10) {
1329
- console.log(chalk.gray(` ... and ${vulns.length - 10} more`));
1330
- }
1331
- }
1332
- } else {
1333
- console.log(chalk.red(` ✗ SAST failed: ${sastResult.error?.message || 'Unknown error'}`));
1334
- }
1335
- console.log('');
1336
- }
1337
-
1338
- // Run compliance check if requested
1339
- if (options.compliance) {
1340
- const frameworks = options.compliance.split(',');
1341
- console.log(chalk.blue(`📜 Compliance Check (${frameworks.join(', ')}):`));
1342
- const compResult = await securityAPI.checkCompliance(frameworks);
1343
- if (compResult.success && compResult.value) {
1344
- const result = compResult.value as { compliant: boolean; issues?: Array<{ framework: string; issue: string }> };
1345
- if (result.compliant) {
1346
- console.log(chalk.green(' ✓ Compliant with all frameworks'));
1347
- } else {
1348
- console.log(chalk.yellow(' ⚠ Compliance issues found:'));
1349
- for (const issue of (result.issues || []).slice(0, 5)) {
1350
- console.log(chalk.yellow(` [${issue.framework}] ${issue.issue}`));
1351
- }
1352
- }
1353
- } else {
1354
- console.log(chalk.red(` ✗ Compliance check failed: ${compResult.error?.message || 'Unknown error'}`));
1355
- }
1356
- console.log('');
1357
- }
1358
-
1359
- // DAST note
1360
- if (options.dast) {
1361
- console.log(chalk.gray('Note: DAST requires running application URLs. Use --target with URLs for DAST scanning.'));
1362
- }
1363
-
1364
- console.log(chalk.green('✅ Security scan complete\n'));
1365
- await cleanupAndExit(0);
1366
-
1367
- } catch (err) {
1368
- console.error(chalk.red('\n❌ Failed:'), err);
1369
- await cleanupAndExit(1);
1370
- }
1371
- });
1372
-
1373
- // aqe-v3 code (code intelligence)
1374
- program
1375
- .command('code')
1376
- .description('Code intelligence analysis')
1377
- .argument('<action>', 'Action (index|search|impact|deps)')
1378
- .argument('[target]', 'Target path or query')
1379
- .option('--depth <depth>', 'Analysis depth', '3')
1380
- .option('--include-tests', 'Include test files')
1381
- .action(async (action: string, target: string, options) => {
1382
- if (!await ensureInitialized()) return;
1383
-
1384
- try {
1385
- // Get code intelligence domain API directly
1386
- const codeAPI = context.kernel!.getDomainAPI<{
1387
- index(request: { paths: string[]; incremental?: boolean; includeTests?: boolean }): Promise<{ success: boolean; value?: unknown; error?: Error }>;
1388
- search(request: { query: string; type: string; limit?: number }): Promise<{ success: boolean; value?: unknown; error?: Error }>;
1389
- analyzeImpact(request: { changedFiles: string[]; depth?: number; includeTests?: boolean }): Promise<{ success: boolean; value?: unknown; error?: Error }>;
1390
- mapDependencies(request: { files: string[]; direction: string; depth?: number }): Promise<{ success: boolean; value?: unknown; error?: Error }>;
1391
- }>('code-intelligence');
1392
-
1393
- if (!codeAPI) {
1394
- console.log(chalk.red('❌ Code intelligence domain not available'));
1395
- return;
1396
- }
1397
-
1398
- const fs = await import('fs');
1399
- const path = await import('path');
1400
-
1401
- if (action === 'index') {
1402
- console.log(chalk.blue(`\n🗂️ Indexing codebase at ${target || '.'}...\n`));
1403
-
1404
- const targetPath = path.resolve(target || '.');
1405
- let paths: string[] = [];
1406
-
1407
- if (fs.existsSync(targetPath)) {
1408
- if (fs.statSync(targetPath).isDirectory()) {
1409
- const walkDir = (dir: string, depth: number = 0): string[] => {
1410
- if (depth > 4) return [];
1411
- const result: string[] = [];
1412
- const items = fs.readdirSync(dir);
1413
- for (const item of items) {
1414
- if (item === 'node_modules' || item === 'dist') continue;
1415
- const fullPath = path.join(dir, item);
1416
- const stat = fs.statSync(fullPath);
1417
- if (stat.isDirectory()) {
1418
- result.push(...walkDir(fullPath, depth + 1));
1419
- } else if (item.endsWith('.ts') && !item.endsWith('.d.ts')) {
1420
- result.push(fullPath);
1421
- }
1422
- }
1423
- return result;
1424
- };
1425
- paths = walkDir(targetPath);
1426
- } else {
1427
- paths = [targetPath];
1428
- }
1429
- }
1430
-
1431
- console.log(chalk.gray(` Found ${paths.length} files to index...\n`));
1432
-
1433
- const result = await codeAPI.index({
1434
- paths,
1435
- incremental: false,
1436
- includeTests: options.includeTests || false,
1437
- });
1438
-
1439
- if (result.success && result.value) {
1440
- const idx = result.value as { filesIndexed: number; nodesCreated: number; edgesCreated: number; duration: number; errors: Array<{ file: string; error: string }> };
1441
- console.log(chalk.green(`✅ Indexing complete\n`));
1442
- console.log(chalk.cyan(' Results:'));
1443
- console.log(` Files indexed: ${chalk.white(idx.filesIndexed)}`);
1444
- console.log(` Nodes created: ${chalk.white(idx.nodesCreated)}`);
1445
- console.log(` Edges created: ${chalk.white(idx.edgesCreated)}`);
1446
- console.log(` Duration: ${chalk.yellow(idx.duration + 'ms')}`);
1447
- if (idx.errors.length > 0) {
1448
- console.log(chalk.red(`\n Errors (${idx.errors.length}):`));
1449
- for (const err of idx.errors.slice(0, 5)) {
1450
- console.log(chalk.red(` ${err.file}: ${err.error}`));
1451
- }
1452
- }
1453
- } else {
1454
- console.log(chalk.red(`❌ Failed: ${result.error?.message || 'Unknown error'}`));
1455
- }
1456
-
1457
- } else if (action === 'search') {
1458
- if (!target) {
1459
- console.log(chalk.red('❌ Search query required'));
1460
- return;
1461
- }
1462
-
1463
- console.log(chalk.blue(`\n🔎 Searching for: "${target}"...\n`));
1464
-
1465
- const result = await codeAPI.search({
1466
- query: target,
1467
- type: 'semantic',
1468
- limit: 10,
1469
- });
1470
-
1471
- if (result.success && result.value) {
1472
- const search = result.value as { results: Array<{ file: string; line?: number; snippet: string; score: number }>; total: number; searchTime: number };
1473
- console.log(chalk.green(`✅ Found ${search.total} results (${search.searchTime}ms)\n`));
1474
-
1475
- for (const r of search.results) {
1476
- const filePath = r.file.replace(process.cwd() + '/', '');
1477
- console.log(` ${chalk.cyan(filePath)}${r.line ? ':' + r.line : ''}`);
1478
- console.log(chalk.gray(` ${r.snippet.slice(0, 100)}...`));
1479
- console.log(chalk.gray(` Score: ${(r.score * 100).toFixed(0)}%\n`));
1480
- }
1481
- } else {
1482
- console.log(chalk.red(`❌ Failed: ${result.error?.message || 'Unknown error'}`));
1483
- }
1484
-
1485
- } else if (action === 'impact') {
1486
- console.log(chalk.blue(`\n📊 Analyzing impact for ${target || 'recent changes'}...\n`));
1487
-
1488
- const targetPath = path.resolve(target || '.');
1489
- let changedFiles: string[] = [];
1490
-
1491
- if (fs.existsSync(targetPath)) {
1492
- if (fs.statSync(targetPath).isFile()) {
1493
- changedFiles = [targetPath];
1494
- } else {
1495
- // Get recently modified files (simulated)
1496
- const walkDir = (dir: string, depth: number = 0): string[] => {
1497
- if (depth > 2) return [];
1498
- const result: string[] = [];
1499
- const items = fs.readdirSync(dir);
1500
- for (const item of items) {
1501
- if (item === 'node_modules' || item === 'dist') continue;
1502
- const fullPath = path.join(dir, item);
1503
- const stat = fs.statSync(fullPath);
1504
- if (stat.isDirectory()) {
1505
- result.push(...walkDir(fullPath, depth + 1));
1506
- } else if (item.endsWith('.ts') && !item.endsWith('.d.ts')) {
1507
- result.push(fullPath);
1508
- }
1509
- }
1510
- return result;
1511
- };
1512
- changedFiles = walkDir(targetPath).slice(0, 10);
1513
- }
1514
- }
1515
-
1516
- const result = await codeAPI.analyzeImpact({
1517
- changedFiles,
1518
- depth: parseInt(options.depth),
1519
- includeTests: options.includeTests || false,
1520
- });
1521
-
1522
- if (result.success && result.value) {
1523
- const impact = result.value as {
1524
- directImpact: Array<{ file: string; reason: string; distance: number; riskScore: number }>;
1525
- transitiveImpact: Array<{ file: string; reason: string; distance: number; riskScore: number }>;
1526
- impactedTests: string[];
1527
- riskLevel: string;
1528
- recommendations: string[];
1529
- };
1530
-
1531
- const riskColor = impact.riskLevel === 'high' ? chalk.red : impact.riskLevel === 'medium' ? chalk.yellow : chalk.green;
1532
- console.log(` Risk Level: ${riskColor(impact.riskLevel)}\n`);
1533
-
1534
- console.log(chalk.cyan(` Direct Impact (${impact.directImpact.length} files):`));
1535
- for (const file of impact.directImpact.slice(0, 5)) {
1536
- const filePath = file.file.replace(process.cwd() + '/', '');
1537
- console.log(` ${chalk.white(filePath)}`);
1538
- console.log(chalk.gray(` Reason: ${file.reason}, Risk: ${(file.riskScore * 100).toFixed(0)}%`));
1539
- }
1540
-
1541
- if (impact.transitiveImpact.length > 0) {
1542
- console.log(chalk.cyan(`\n Transitive Impact (${impact.transitiveImpact.length} files):`));
1543
- for (const file of impact.transitiveImpact.slice(0, 5)) {
1544
- const filePath = file.file.replace(process.cwd() + '/', '');
1545
- console.log(` ${chalk.white(filePath)} (distance: ${file.distance})`);
1546
- }
1547
- }
1548
-
1549
- if (impact.impactedTests.length > 0) {
1550
- console.log(chalk.cyan(`\n Impacted Tests (${impact.impactedTests.length}):`));
1551
- for (const test of impact.impactedTests.slice(0, 5)) {
1552
- console.log(` ${chalk.gray(test)}`);
1553
- }
1554
- }
1555
-
1556
- if (impact.recommendations.length > 0) {
1557
- console.log(chalk.cyan('\n Recommendations:'));
1558
- for (const rec of impact.recommendations) {
1559
- console.log(chalk.gray(` • ${rec}`));
1560
- }
1561
- }
1562
- } else {
1563
- console.log(chalk.red(`❌ Failed: ${result.error?.message || 'Unknown error'}`));
1564
- }
1565
-
1566
- } else if (action === 'deps') {
1567
- console.log(chalk.blue(`\n🔗 Mapping dependencies for ${target || '.'}...\n`));
1568
-
1569
- const targetPath = path.resolve(target || '.');
1570
- let files: string[] = [];
1571
-
1572
- if (fs.existsSync(targetPath)) {
1573
- if (fs.statSync(targetPath).isFile()) {
1574
- files = [targetPath];
1575
- } else {
1576
- const walkDir = (dir: string, depth: number = 0): string[] => {
1577
- if (depth > 2) return [];
1578
- const result: string[] = [];
1579
- const items = fs.readdirSync(dir);
1580
- for (const item of items) {
1581
- if (item === 'node_modules' || item === 'dist') continue;
1582
- const fullPath = path.join(dir, item);
1583
- const stat = fs.statSync(fullPath);
1584
- if (stat.isDirectory()) {
1585
- result.push(...walkDir(fullPath, depth + 1));
1586
- } else if (item.endsWith('.ts') && !item.endsWith('.d.ts')) {
1587
- result.push(fullPath);
1588
- }
1589
- }
1590
- return result;
1591
- };
1592
- files = walkDir(targetPath).slice(0, 50);
1593
- }
1594
- }
1595
-
1596
- const result = await codeAPI.mapDependencies({
1597
- files,
1598
- direction: 'both',
1599
- depth: parseInt(options.depth),
1600
- });
1601
-
1602
- if (result.success && result.value) {
1603
- const deps = result.value as {
1604
- nodes: Array<{ id: string; path: string; type: string; inDegree: number; outDegree: number }>;
1605
- edges: Array<{ source: string; target: string; type: string }>;
1606
- cycles: string[][];
1607
- metrics: { totalNodes: number; totalEdges: number; avgDegree: number; maxDepth: number; cyclomaticComplexity: number };
1608
- };
1609
-
1610
- console.log(chalk.cyan(' Dependency Metrics:'));
1611
- console.log(` Nodes: ${chalk.white(deps.metrics.totalNodes)}`);
1612
- console.log(` Edges: ${chalk.white(deps.metrics.totalEdges)}`);
1613
- console.log(` Avg Degree: ${chalk.yellow(deps.metrics.avgDegree.toFixed(2))}`);
1614
- console.log(` Max Depth: ${chalk.yellow(deps.metrics.maxDepth)}`);
1615
- console.log(` Cyclomatic Complexity: ${chalk.yellow(deps.metrics.cyclomaticComplexity)}`);
1616
-
1617
- if (deps.cycles.length > 0) {
1618
- console.log(chalk.red(`\n ⚠️ Circular Dependencies (${deps.cycles.length}):`));
1619
- for (const cycle of deps.cycles.slice(0, 3)) {
1620
- console.log(chalk.red(` ${cycle.join(' → ')}`));
1621
- }
1622
- }
1623
-
1624
- console.log(chalk.cyan(`\n Top Dependencies (by connections):`));
1625
- const sortedNodes = [...deps.nodes].sort((a, b) => (b.inDegree + b.outDegree) - (a.inDegree + a.outDegree));
1626
- for (const node of sortedNodes.slice(0, 8)) {
1627
- const filePath = node.path.replace(process.cwd() + '/', '');
1628
- console.log(` ${chalk.white(filePath)}`);
1629
- console.log(chalk.gray(` In: ${node.inDegree}, Out: ${node.outDegree}, Type: ${node.type}`));
1630
- }
1631
- } else {
1632
- console.log(chalk.red(`❌ Failed: ${result.error?.message || 'Unknown error'}`));
1633
- }
1634
-
1635
- } else {
1636
- console.log(chalk.red(`\n❌ Unknown action: ${action}`));
1637
- console.log(chalk.gray(' Available: index, search, impact, deps\n'));
1638
- await cleanupAndExit(1);
1639
- }
1640
-
1641
- console.log('');
1642
- await cleanupAndExit(0);
1643
-
1644
- } catch (error) {
1645
- console.error(chalk.red('\n❌ Failed:'), error);
1646
- await cleanupAndExit(1);
1647
- }
1648
- });
1649
-
1650
- // ============================================================================
1651
- // Migrate Command - V2 to V3 Migration
1652
- // ============================================================================
1653
-
1654
- program
1655
- .command('migrate')
1656
- .description('Migrate from Agentic QE v2 to v3')
1657
- .option('--dry-run', 'Preview migration without making changes')
1658
- .option('--backup', 'Create backup before migration (recommended)', true)
1659
- .option('--skip-memory', 'Skip memory database migration')
1660
- .option('--skip-patterns', 'Skip pattern migration')
1661
- .option('--skip-config', 'Skip configuration migration')
1662
- .option('--force', 'Force migration even if v3 already exists')
1663
- .action(async (options) => {
1664
- const fs = await import('fs');
1665
- const path = await import('path');
1666
-
1667
- console.log(chalk.blue('\n🔄 Agentic QE v2 to v3 Migration\n'));
1668
-
1669
- const cwd = process.cwd();
1670
- const v2Dir = path.join(cwd, '.agentic-qe');
1671
- const v3Dir = path.join(cwd, '.aqe-v3');
1672
-
1673
- // Step 1: Detect v2 installation
1674
- console.log(chalk.white('1. Detecting v2 installation...'));
1675
-
1676
- if (!fs.existsSync(v2Dir)) {
1677
- console.log(chalk.yellow(' ⚠ No v2 installation found at .agentic-qe/'));
1678
- console.log(chalk.gray(' This might be a fresh project. Use `aqe-v3 init` instead.'));
1679
- process.exit(0);
1680
- }
1681
-
1682
- const v2Files = {
1683
- memoryDb: path.join(v2Dir, 'memory.db'),
1684
- config: path.join(v2Dir, 'config.json'),
1685
- patterns: path.join(v2Dir, 'patterns'),
1686
- };
1687
-
1688
- const hasMemory = fs.existsSync(v2Files.memoryDb);
1689
- const hasConfig = fs.existsSync(v2Files.config);
1690
- const hasPatterns = fs.existsSync(v2Files.patterns);
1691
-
1692
- console.log(chalk.green(' ✓ Found v2 installation:'));
1693
- console.log(chalk.gray(` Memory DB: ${hasMemory ? '✓' : '✗'}`));
1694
- console.log(chalk.gray(` Config: ${hasConfig ? '✓' : '✗'}`));
1695
- console.log(chalk.gray(` Patterns: ${hasPatterns ? '✓' : '✗'}\n`));
1696
-
1697
- // Step 2: Check v3 existence
1698
- console.log(chalk.white('2. Checking v3 status...'));
1699
-
1700
- if (fs.existsSync(v3Dir) && !options.force) {
1701
- console.log(chalk.yellow(' ⚠ v3 directory already exists at .aqe-v3/'));
1702
- console.log(chalk.gray(' Use --force to overwrite existing v3 installation.'));
1703
- process.exit(1);
1704
- }
1705
- console.log(chalk.green(' ✓ Ready for migration\n'));
1706
-
1707
- // Dry run mode
1708
- if (options.dryRun) {
1709
- console.log(chalk.blue('📋 Dry Run - Migration Plan:\n'));
1710
-
1711
- if (!options.skipMemory && hasMemory) {
1712
- const stats = fs.statSync(v2Files.memoryDb);
1713
- console.log(chalk.gray(` • Migrate memory.db (${(stats.size / 1024).toFixed(1)} KB)`));
1714
- console.log(chalk.gray(' From: .agentic-qe/memory.db'));
1715
- console.log(chalk.gray(' To: .aqe-v3/agentdb/'));
1716
- }
1717
-
1718
- if (!options.skipConfig && hasConfig) {
1719
- console.log(chalk.gray(' • Convert config.json to v3 format'));
1720
- console.log(chalk.gray(' From: .agentic-qe/config.json'));
1721
- console.log(chalk.gray(' To: .aqe-v3/config.json'));
1722
- }
1723
-
1724
- if (!options.skipPatterns && hasPatterns) {
1725
- const patternFiles = fs.readdirSync(v2Files.patterns);
1726
- console.log(chalk.gray(` • Migrate ${patternFiles.length} pattern files`));
1727
- console.log(chalk.gray(' From: .agentic-qe/patterns/'));
1728
- console.log(chalk.gray(' To: .aqe-v3/reasoning-bank/'));
1729
- }
1730
-
1731
- console.log(chalk.yellow('\n⚠ This is a dry run. No changes were made.'));
1732
- console.log(chalk.gray('Run without --dry-run to execute migration.\n'));
1733
- process.exit(0);
1734
- }
1735
-
1736
- // Step 3: Create backup
1737
- if (options.backup) {
1738
- console.log(chalk.white('3. Creating backup...'));
1739
- const backupDir = path.join(cwd, `.agentic-qe-backup-${Date.now()}`);
1740
-
1741
- try {
1742
- fs.mkdirSync(backupDir, { recursive: true });
1743
-
1744
- // Copy v2 directory
1745
- const copyDir = (src: string, dest: string) => {
1746
- if (!fs.existsSync(src)) return;
1747
-
1748
- if (fs.statSync(src).isDirectory()) {
1749
- fs.mkdirSync(dest, { recursive: true });
1750
- for (const file of fs.readdirSync(src)) {
1751
- copyDir(path.join(src, file), path.join(dest, file));
1752
- }
1753
- } else {
1754
- fs.copyFileSync(src, dest);
1755
- }
1756
- };
1757
-
1758
- copyDir(v2Dir, backupDir);
1759
- console.log(chalk.green(` ✓ Backup created at ${path.basename(backupDir)}\n`));
1760
- } catch (err) {
1761
- console.log(chalk.red(` ✗ Backup failed: ${err}`));
1762
- console.log(chalk.gray(' Use --no-backup to skip backup.\n'));
1763
- process.exit(1);
1764
- }
1765
- } else {
1766
- console.log(chalk.yellow('3. Backup skipped (--no-backup)\n'));
1767
- }
1768
-
1769
- // Step 4: Create v3 directory structure
1770
- console.log(chalk.white('4. Creating v3 directory structure...'));
1771
-
1772
- try {
1773
- fs.mkdirSync(v3Dir, { recursive: true });
1774
- fs.mkdirSync(path.join(v3Dir, 'agentdb'), { recursive: true });
1775
- fs.mkdirSync(path.join(v3Dir, 'reasoning-bank'), { recursive: true });
1776
- fs.mkdirSync(path.join(v3Dir, 'cache'), { recursive: true });
1777
- fs.mkdirSync(path.join(v3Dir, 'logs'), { recursive: true });
1778
- console.log(chalk.green(' ✓ Directory structure created\n'));
1779
- } catch (err) {
1780
- console.log(chalk.red(` ✗ Failed: ${err}\n`));
1781
- process.exit(1);
1782
- }
1783
-
1784
- // Step 5: Migrate memory database
1785
- if (!options.skipMemory && hasMemory) {
1786
- console.log(chalk.white('5. Migrating memory database...'));
1787
-
1788
- try {
1789
- // Copy SQLite database first (v3 can read v2 format)
1790
- const destDb = path.join(v3Dir, 'agentdb', 'memory.db');
1791
- fs.copyFileSync(v2Files.memoryDb, destDb);
1792
-
1793
- // Create index file for HNSW
1794
- const indexFile = path.join(v3Dir, 'agentdb', 'index.json');
1795
- fs.writeFileSync(indexFile, JSON.stringify({
1796
- version: '3.0.0',
1797
- migratedFrom: 'v2',
1798
- migratedAt: new Date().toISOString(),
1799
- hnswEnabled: true,
1800
- vectorDimensions: 128,
1801
- }, null, 2));
1802
-
1803
- const stats = fs.statSync(v2Files.memoryDb);
1804
- console.log(chalk.green(` ✓ Memory database migrated (${(stats.size / 1024).toFixed(1)} KB)\n`));
1805
- } catch (err) {
1806
- console.log(chalk.red(` ✗ Migration failed: ${err}\n`));
1807
- }
1808
- } else if (options.skipMemory) {
1809
- console.log(chalk.yellow('5. Memory migration skipped\n'));
1810
- } else {
1811
- console.log(chalk.gray('5. No memory database to migrate\n'));
1812
- }
1813
-
1814
- // Step 6: Migrate configuration
1815
- if (!options.skipConfig && hasConfig) {
1816
- console.log(chalk.white('6. Migrating configuration...'));
1817
-
1818
- try {
1819
- const v2ConfigRaw = fs.readFileSync(v2Files.config, 'utf-8');
1820
- const v2Config = JSON.parse(v2ConfigRaw);
1821
-
1822
- // Convert to v3 format
1823
- const v3Config = {
1824
- version: '3.0.0',
1825
- migratedFrom: v2Config.version || '2.x',
1826
- migratedAt: new Date().toISOString(),
1827
- kernel: {
1828
- eventBus: 'in-memory',
1829
- coordinator: 'queen',
1830
- },
1831
- domains: {
1832
- 'test-generation': { enabled: true },
1833
- 'test-execution': { enabled: true },
1834
- 'coverage-analysis': { enabled: true, algorithm: 'hnsw', dimensions: 128 },
1835
- 'quality-assessment': { enabled: true },
1836
- 'defect-intelligence': { enabled: true },
1837
- 'requirements-validation': { enabled: true },
1838
- 'code-intelligence': { enabled: true },
1839
- 'security-compliance': { enabled: true },
1840
- 'contract-testing': { enabled: true },
1841
- 'visual-accessibility': { enabled: false },
1842
- 'chaos-resilience': { enabled: true },
1843
- 'learning-optimization': { enabled: true },
1844
- },
1845
- memory: {
1846
- backend: 'hybrid',
1847
- path: '.aqe-v3/agentdb/',
1848
- hnsw: { M: 16, efConstruction: 200 },
1849
- },
1850
- learning: {
1851
- reasoningBank: true,
1852
- sona: true,
1853
- patternRetention: v2Config.learning?.patternRetention || 180,
1854
- },
1855
- v2Migration: {
1856
- originalConfig: v2Config,
1857
- migrationDate: new Date().toISOString(),
1858
- },
1859
- };
1860
-
1861
- const destConfig = path.join(v3Dir, 'config.json');
1862
- fs.writeFileSync(destConfig, JSON.stringify(v3Config, null, 2));
1863
- console.log(chalk.green(' ✓ Configuration migrated\n'));
1864
- } catch (err) {
1865
- console.log(chalk.red(` ✗ Config migration failed: ${err}\n`));
1866
- }
1867
- } else if (options.skipConfig) {
1868
- console.log(chalk.yellow('6. Configuration migration skipped\n'));
1869
- } else {
1870
- console.log(chalk.gray('6. No configuration to migrate\n'));
1871
- }
1872
-
1873
- // Step 7: Migrate patterns
1874
- if (!options.skipPatterns && hasPatterns) {
1875
- console.log(chalk.white('7. Migrating patterns to ReasoningBank...'));
1876
-
1877
- try {
1878
- const patternFiles = fs.readdirSync(v2Files.patterns);
1879
- let migratedCount = 0;
1880
-
1881
- for (const file of patternFiles) {
1882
- const srcPath = path.join(v2Files.patterns, file);
1883
- const destPath = path.join(v3Dir, 'reasoning-bank', file);
1884
-
1885
- if (fs.statSync(srcPath).isFile()) {
1886
- fs.copyFileSync(srcPath, destPath);
1887
- migratedCount++;
1888
- }
1889
- }
1890
-
1891
- // Create reasoning bank index
1892
- const indexPath = path.join(v3Dir, 'reasoning-bank', 'index.json');
1893
- fs.writeFileSync(indexPath, JSON.stringify({
1894
- version: '3.0.0',
1895
- migratedFrom: 'v2',
1896
- migratedAt: new Date().toISOString(),
1897
- patternCount: migratedCount,
1898
- hnswIndexed: false,
1899
- }, null, 2));
1900
-
1901
- console.log(chalk.green(` ✓ ${migratedCount} patterns migrated\n`));
1902
- } catch (err) {
1903
- console.log(chalk.red(` ✗ Pattern migration failed: ${err}\n`));
1904
- }
1905
- } else if (options.skipPatterns) {
1906
- console.log(chalk.yellow('7. Pattern migration skipped\n'));
1907
- } else {
1908
- console.log(chalk.gray('7. No patterns to migrate\n'));
1909
- }
1910
-
1911
- // Step 8: Validation
1912
- console.log(chalk.white('8. Validating migration...'));
1913
-
1914
- const validationResults = {
1915
- v3DirExists: fs.existsSync(v3Dir),
1916
- configExists: fs.existsSync(path.join(v3Dir, 'config.json')),
1917
- agentdbExists: fs.existsSync(path.join(v3Dir, 'agentdb')),
1918
- reasoningBankExists: fs.existsSync(path.join(v3Dir, 'reasoning-bank')),
1919
- };
1920
-
1921
- const allValid = Object.values(validationResults).every(v => v);
1922
-
1923
- if (allValid) {
1924
- console.log(chalk.green(' ✓ Migration validated successfully\n'));
1925
- } else {
1926
- console.log(chalk.yellow(' ⚠ Some validations failed:'));
1927
- for (const [key, value] of Object.entries(validationResults)) {
1928
- console.log(chalk.gray(` ${key}: ${value ? '✓' : '✗'}`));
1929
- }
1930
- console.log('');
1931
- }
1932
-
1933
- // Summary
1934
- console.log(chalk.blue('═══════════════════════════════════════════════'));
1935
- console.log(chalk.green.bold('✅ Migration Complete!\n'));
1936
- console.log(chalk.white('Your v2 data is now available in v3 format.'));
1937
- console.log(chalk.gray('v2 installation (.agentic-qe/) was NOT modified.\n'));
1938
-
1939
- console.log(chalk.white('Next steps:'));
1940
- console.log(chalk.gray(' 1. Run `aqe-v3 status` to verify the system'));
1941
- console.log(chalk.gray(' 2. Add v3 MCP: `claude mcp add aqe-v3 -- npx @agentic-qe/v3 mcp`'));
1942
- console.log(chalk.gray(' 3. Test with: `aqe-v3 test <path>`\n'));
1943
-
1944
- console.log(chalk.yellow('Rollback:'));
1945
- console.log(chalk.gray(' If migration failed, simply delete .aqe-v3/'));
1946
- console.log(chalk.gray(' Your v2 installation remains unchanged.\n'));
1947
-
1948
- process.exit(0);
1949
- });
1950
-
1951
- // ============================================================================
1952
- // Shutdown Handler
1953
- // ============================================================================
1954
-
1955
- process.on('SIGINT', async () => {
1956
- console.log(chalk.yellow('\n\n🛑 Shutting down...'));
1957
-
1958
- if (context.queen) {
1959
- await context.queen.dispose();
1960
- }
1961
- if (context.router) {
1962
- await context.router.dispose();
1963
- }
1964
- if (context.kernel) {
1965
- await context.kernel.dispose();
1966
- }
1967
-
1968
- console.log(chalk.green('✅ Shutdown complete\n'));
1969
- process.exit(0);
1970
- });
1971
-
1972
- // ============================================================================
1973
- // Main
1974
- // ============================================================================
1975
-
1976
- program.parse();