agentic-qe 3.8.14 → 3.9.1

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 (451) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +60 -0
  3. package/dist/adapters/a2ui/integration/agui-sync.js +2 -1
  4. package/dist/audit/witness-chain.d.ts +1 -1
  5. package/dist/boot/fast-paths.d.ts +24 -0
  6. package/dist/boot/fast-paths.js +43 -0
  7. package/dist/boot/parallel-prefetch.d.ts +26 -0
  8. package/dist/boot/parallel-prefetch.js +36 -0
  9. package/dist/cli/bundle.js +12 -9431
  10. package/dist/cli/chunks/adapter-NTM4ZH3P.js +2 -0
  11. package/dist/cli/chunks/agent-booster-wasm-UH2J6BNA.js +2 -0
  12. package/dist/cli/chunks/agent-handler-ZCBWQE3X.js +33 -0
  13. package/dist/cli/chunks/agent-memory-branch-2BAVI7UW.js +2 -0
  14. package/dist/cli/chunks/aqe-learning-engine-RVX6MPYK.js +2 -0
  15. package/dist/cli/chunks/audit-G5UIJBSQ.js +3 -0
  16. package/dist/cli/chunks/base-7HKNQ6UP.js +2 -0
  17. package/dist/cli/chunks/better-sqlite3-YHIAPPVT.js +2 -0
  18. package/dist/cli/chunks/brain-handler-5EE3J5PR.js +68 -0
  19. package/dist/cli/chunks/branch-enumerator-OV54PID5.js +7 -0
  20. package/dist/cli/chunks/browser-7RZGKOEO.js +4 -0
  21. package/dist/cli/chunks/browser-workflow-UOFSQK7X.js +2 -0
  22. package/dist/cli/chunks/chunk-24E47G3D.js +604 -0
  23. package/dist/cli/chunks/chunk-35H73OPP.js +2 -0
  24. package/dist/cli/chunks/chunk-36X2O3BL.js +3 -0
  25. package/dist/cli/chunks/chunk-3JESHZQM.js +2 -0
  26. package/dist/cli/chunks/chunk-3VAKR43Z.js +2 -0
  27. package/dist/cli/chunks/chunk-3WQNW6CH.js +2 -0
  28. package/dist/cli/chunks/chunk-43M6Y6VF.js +15 -0
  29. package/dist/cli/chunks/chunk-4BHOAQJH.js +2 -0
  30. package/dist/cli/chunks/chunk-4LWXZCSD.js +146 -0
  31. package/dist/cli/chunks/chunk-4TNXEANY.js +2 -0
  32. package/dist/cli/chunks/chunk-4XBY5JDT.js +4 -0
  33. package/dist/cli/chunks/chunk-4XREPCBZ.js +2 -0
  34. package/dist/cli/chunks/chunk-5GPTM2RV.js +2 -0
  35. package/dist/cli/chunks/chunk-5KBQQP3X.js +7 -0
  36. package/dist/cli/chunks/chunk-5LDBKZ6P.js +2 -0
  37. package/dist/cli/chunks/chunk-6BSJNG2S.js +2 -0
  38. package/dist/cli/chunks/chunk-6YC24TPL.js +27 -0
  39. package/dist/cli/chunks/chunk-7ATLJCSG.js +2 -0
  40. package/dist/cli/chunks/chunk-7JQTHPCD.js +2 -0
  41. package/dist/cli/chunks/chunk-7YUOUVN7.js +2 -0
  42. package/dist/cli/chunks/chunk-7ZNINH6J.js +59 -0
  43. package/dist/cli/chunks/chunk-A57BEPL7.js +3 -0
  44. package/dist/cli/chunks/chunk-AFPMCMVX.js +45 -0
  45. package/dist/cli/chunks/chunk-AREIP4FX.js +3 -0
  46. package/dist/cli/chunks/chunk-B2I7BJLL.js +3 -0
  47. package/dist/cli/chunks/chunk-BEHP3DEF.js +66 -0
  48. package/dist/cli/chunks/chunk-C24ZDUCM.js +30 -0
  49. package/dist/cli/chunks/chunk-D4PSFWND.js +2 -0
  50. package/dist/cli/chunks/chunk-D55PSO5D.js +81 -0
  51. package/dist/cli/chunks/chunk-DC3HPOOJ.js +2 -0
  52. package/dist/cli/chunks/chunk-DMGLX76J.js +180 -0
  53. package/dist/cli/chunks/chunk-E33KQBMW.js +2 -0
  54. package/dist/cli/chunks/chunk-EQFZQPFN.js +2 -0
  55. package/dist/cli/chunks/chunk-FPRL6UDF.js +2 -0
  56. package/dist/cli/chunks/chunk-FRNB4CH2.js +2 -0
  57. package/dist/cli/chunks/chunk-FWDKVTK4.js +2 -0
  58. package/dist/cli/chunks/chunk-GFNUESMU.js +2 -0
  59. package/dist/cli/chunks/chunk-GJW6V35N.js +2 -0
  60. package/dist/cli/chunks/chunk-GLIFZWV2.js +2 -0
  61. package/dist/cli/chunks/chunk-GNUUBTSX.js +14 -0
  62. package/dist/cli/chunks/chunk-HAUXLXKZ.js +2 -0
  63. package/dist/cli/chunks/chunk-HTXSUTWL.js +9 -0
  64. package/dist/cli/chunks/chunk-I5WZ2NM2.js +95 -0
  65. package/dist/cli/chunks/chunk-I7TA453K.js +2 -0
  66. package/dist/cli/chunks/chunk-IF6GW6IY.js +27 -0
  67. package/dist/cli/chunks/chunk-IHWSNYL2.js +5 -0
  68. package/dist/cli/chunks/chunk-IJKYJGJL.js +2 -0
  69. package/dist/cli/chunks/chunk-IQPXANCE.js +14 -0
  70. package/dist/cli/chunks/chunk-JCEY7RLP.js +2 -0
  71. package/dist/cli/chunks/chunk-JSOBRKMA.js +2 -0
  72. package/dist/cli/chunks/chunk-KIGRLIU4.js +2 -0
  73. package/dist/cli/chunks/chunk-L4H54Z27.js +21 -0
  74. package/dist/cli/chunks/chunk-LCOEBFAB.js +2 -0
  75. package/dist/cli/chunks/chunk-MZ54VM6A.js +2 -0
  76. package/dist/cli/chunks/chunk-NB47YT6A.js +167 -0
  77. package/dist/cli/chunks/chunk-NG3BKE7V.js +2 -0
  78. package/dist/cli/chunks/chunk-NG4TE3OW.js +2 -0
  79. package/dist/cli/chunks/chunk-O636JKJR.js +18 -0
  80. package/dist/cli/chunks/chunk-O6QQ4HLS.js +2 -0
  81. package/dist/cli/chunks/chunk-OFNIQCGX.js +2 -0
  82. package/dist/cli/chunks/chunk-OTSJU5LH.js +2 -0
  83. package/dist/cli/chunks/chunk-POLFT2PQ.js +15 -0
  84. package/dist/cli/chunks/chunk-QAYTL6KC.js +2 -0
  85. package/dist/cli/chunks/chunk-QMFP5OKH.js +2 -0
  86. package/dist/cli/chunks/chunk-RAJO7VML.js +2 -0
  87. package/dist/cli/chunks/chunk-RKIGOARX.js +2 -0
  88. package/dist/cli/chunks/chunk-RU6Q5HOC.js +3 -0
  89. package/dist/cli/chunks/chunk-RV6SGDET.js +2 -0
  90. package/dist/cli/chunks/chunk-RWXI7XAR.js +2 -0
  91. package/dist/cli/chunks/chunk-RXVYOXDB.js +2 -0
  92. package/dist/cli/chunks/chunk-SGRN6JFB.js +2 -0
  93. package/dist/cli/chunks/chunk-SVNX4UWR.js +3029 -0
  94. package/dist/cli/chunks/chunk-TL7ABIMP.js +2 -0
  95. package/dist/cli/chunks/chunk-TOLYWONQ.js +2 -0
  96. package/dist/cli/chunks/chunk-TPXYS3WG.js +3 -0
  97. package/dist/cli/chunks/chunk-U5JQGRHZ.js +2 -0
  98. package/dist/cli/chunks/chunk-UB7RGVKO.js +2 -0
  99. package/dist/cli/chunks/chunk-UBKK7KCR.js +70 -0
  100. package/dist/cli/chunks/chunk-UMGWGX7C.js +2 -0
  101. package/dist/cli/chunks/chunk-UN4PA4M2.js +2 -0
  102. package/dist/cli/chunks/chunk-US7INRP2.js +314 -0
  103. package/dist/cli/chunks/chunk-UWDBFPHQ.js +750 -0
  104. package/dist/cli/chunks/chunk-UZZCWWIG.js +2 -0
  105. package/dist/cli/chunks/chunk-V4HM4QAO.js +24 -0
  106. package/dist/cli/chunks/chunk-V4U3CTS2.js +180 -0
  107. package/dist/cli/chunks/chunk-VCCMCFDU.js +2 -0
  108. package/dist/cli/chunks/chunk-VEWIT6VN.js +4 -0
  109. package/dist/cli/chunks/chunk-VNYGVG4Y.js +2 -0
  110. package/dist/cli/chunks/chunk-VO3OVD5D.js +4 -0
  111. package/dist/cli/chunks/chunk-VY74OMGQ.js +6 -0
  112. package/dist/cli/chunks/chunk-WDJBGXC2.js +2 -0
  113. package/dist/cli/chunks/chunk-WDV6TN7E.js +65 -0
  114. package/dist/cli/chunks/chunk-WLXEDOG4.js +2 -0
  115. package/dist/cli/chunks/chunk-WXXAAXNS.js +12 -0
  116. package/dist/cli/chunks/chunk-X4MZYBOU.js +256 -0
  117. package/dist/cli/chunks/chunk-XE2YAYU5.js +12 -0
  118. package/dist/cli/chunks/chunk-XP6XKBNW.js +2 -0
  119. package/dist/cli/chunks/chunk-XPB6ZVQY.js +2 -0
  120. package/dist/cli/chunks/chunk-XRVUSKQV.js +1 -0
  121. package/dist/cli/chunks/chunk-XSITQBYB.js +20 -0
  122. package/dist/cli/chunks/chunk-XTLA4F5Z.js +91 -0
  123. package/dist/cli/chunks/chunk-XU6L2VJY.js +2 -0
  124. package/dist/cli/chunks/chunk-XUFHYPZK.js +2 -0
  125. package/dist/cli/chunks/chunk-Y2ZEDXTV.js +16 -0
  126. package/dist/cli/chunks/chunk-YQWB4QUP.js +316 -0
  127. package/dist/cli/chunks/chunk-YUQIXT3G.js +79 -0
  128. package/dist/cli/chunks/chunk-YYYB2JN5.js +2 -0
  129. package/dist/cli/chunks/chunk-ZEUVPLGX.js +2 -0
  130. package/dist/cli/chunks/chunk-ZSRQHJEW.js +3 -0
  131. package/dist/cli/chunks/ci-N4NTYAAI.js +81 -0
  132. package/dist/cli/chunks/ci-output-XYR2PSYH.js +2 -0
  133. package/dist/cli/chunks/claude-flow-setup-FX7PRBJV.js +2 -0
  134. package/dist/cli/chunks/client-CRRENRK4.js +2 -0
  135. package/dist/cli/chunks/cline-installer-GTHQOK7U.js +4 -0
  136. package/dist/cli/chunks/code-4G6ZHVNI.js +38 -0
  137. package/dist/cli/chunks/code-index-extractor-MKJTP5AK.js +3 -0
  138. package/dist/cli/chunks/codex-installer-UGS773DT.js +8 -0
  139. package/dist/cli/chunks/completions-B3BXNXAU.js +1364 -0
  140. package/dist/cli/chunks/complexity-analyzer-PMN77CUP.js +2 -0
  141. package/dist/cli/chunks/continuedev-installer-3DYKSIP3.js +14 -0
  142. package/dist/cli/chunks/copilot-installer-IUC5HDHD.js +3 -0
  143. package/dist/cli/chunks/cost-tracker-GSGQ7O5T.js +2 -0
  144. package/dist/cli/chunks/coverage-PO72QC3P.js +27 -0
  145. package/dist/cli/chunks/cross-domain-router-FSCGJG3B.js +2 -0
  146. package/dist/cli/chunks/cursor-installer-FK53S3ZL.js +3 -0
  147. package/dist/cli/chunks/daemon-4UIQTQ73.js +19 -0
  148. package/dist/cli/chunks/dag-attention-scheduler-ZGIMLECE.js +2 -0
  149. package/dist/cli/chunks/detect-XXHLTLL7.js +2 -0
  150. package/dist/cli/chunks/domain-handler-PPGFP7P4.js +25 -0
  151. package/dist/cli/chunks/domain-transfer-Q5UAE65W.js +2 -0
  152. package/dist/cli/chunks/dream-PONKQULG.js +2 -0
  153. package/dist/cli/chunks/esm-node-XLWDJRBX.js +2 -0
  154. package/dist/cli/chunks/eval-JVJKHSTQ.js +15 -0
  155. package/dist/cli/chunks/fast-paths-3KX4ZV66.js +2 -0
  156. package/dist/cli/chunks/feature-flags-2NOVE7DL.js +2 -0
  157. package/dist/cli/chunks/feature-flags-GKHHG2I2.js +2 -0
  158. package/dist/cli/chunks/file-discovery-XFSGQNM3.js +2 -0
  159. package/dist/cli/chunks/fleet-FOIDAXLR.js +43 -0
  160. package/dist/cli/chunks/gnn-wrapper-HPCQREKP.js +2 -0
  161. package/dist/cli/chunks/heartbeat-handler-HTR3EFFV.js +48 -0
  162. package/dist/cli/chunks/heartbeat-scheduler-NZQWN7CH.js +2 -0
  163. package/dist/cli/chunks/hnsw-adapter-BNA5WUAB.js +2 -0
  164. package/dist/cli/chunks/hnsw-index-RQIIAE7S.js +2 -0
  165. package/dist/cli/chunks/hnsw-legacy-bridge-H6OA3AA3.js +2 -0
  166. package/dist/cli/chunks/hnswlib-node-FF27BDMD.js +2 -0
  167. package/dist/cli/chunks/hooks-63NZQ7NH.js +101 -0
  168. package/dist/cli/chunks/hypergraph-engine-XMSLA4XH.js +2 -0
  169. package/dist/cli/chunks/hypergraph-handler-ID6J6GS2.js +35 -0
  170. package/dist/cli/chunks/impact-analyzer-FS2UNVP4.js +2 -0
  171. package/dist/cli/chunks/init-handler-CIKZGGAY.js +68 -0
  172. package/dist/cli/chunks/init-wizard-TUU5PPY6.js +2 -0
  173. package/dist/cli/chunks/kernel-XFG42WAG.js +2 -0
  174. package/dist/cli/chunks/kilocode-installer-N7NLISYY.js +4 -0
  175. package/dist/cli/chunks/kiro-installer-U6XIPAT3.js +74 -0
  176. package/dist/cli/chunks/knowledge-graph-XV7FPU2T.js +2 -0
  177. package/dist/cli/chunks/learning-NKOF7KDJ.js +107 -0
  178. package/dist/cli/chunks/llm-router-34WHT3PH.js +30 -0
  179. package/dist/cli/chunks/load-ZW4Z3YLT.js +2 -0
  180. package/dist/cli/chunks/load-test-F4L7RTXJ.js +2 -0
  181. package/dist/cli/chunks/mcp-6R7SVGKO.js +2 -0
  182. package/dist/cli/chunks/memory-OUYCBU4M.js +32 -0
  183. package/dist/cli/chunks/memory-backend-DTJD2DWF.js +2 -0
  184. package/dist/cli/chunks/memory-handlers-WNXKZRNM.js +2 -0
  185. package/dist/cli/chunks/opencode-installer-FR75GHFU.js +3 -0
  186. package/dist/cli/chunks/orchestrator-AK7ZMVNH.js +371 -0
  187. package/dist/cli/chunks/pipeline-CFOPG7EM.js +19 -0
  188. package/dist/cli/chunks/platform-NY3ULBR7.js +2 -0
  189. package/dist/cli/chunks/plugin-LRANQYUR.js +27 -0
  190. package/dist/cli/chunks/prime-radiant-advanced-wasm-6KEIU55P.js +2 -0
  191. package/dist/cli/chunks/protocol-executor-6W4PS2D4.js +2 -0
  192. package/dist/cli/chunks/protocol-handler-ESSZGJ7R.js +20 -0
  193. package/dist/cli/chunks/prove-EF2PPY65.js +3 -0
  194. package/dist/cli/chunks/qe-reasoning-bank-7G3TZLEA.js +2 -0
  195. package/dist/cli/chunks/quality-AYBXB635.js +7 -0
  196. package/dist/cli/chunks/queen-coordinator-NFPKGMQN.js +2 -0
  197. package/dist/cli/chunks/real-embeddings-QPBXE7MA.js +2 -0
  198. package/dist/cli/chunks/roocode-installer-UF6MMBH6.js +4 -0
  199. package/dist/cli/chunks/router-F4B7Q66G.js +2 -0
  200. package/dist/cli/chunks/routing-feedback-5CIDDW7P.js +2 -0
  201. package/dist/cli/chunks/routing-handler-5TVKFU7V.js +20 -0
  202. package/dist/cli/chunks/ruvector-commands-E33VXFIA.js +8 -0
  203. package/dist/cli/chunks/rvf-dual-writer-O3AZKD24.js +2 -0
  204. package/dist/cli/chunks/rvf-migration-adapter-IKEUZ2HX.js +2 -0
  205. package/dist/cli/chunks/rvf-migration-coordinator-M4H7W4RN.js +2 -0
  206. package/dist/cli/chunks/rvf-native-adapter-UX3WAPIP.js +2 -0
  207. package/dist/cli/chunks/safe-db-QBBNXEVK.js +2 -0
  208. package/dist/cli/chunks/schedule-GFT4NN6Z.js +2 -0
  209. package/dist/cli/chunks/scheduler-CQ56T7DB.js +2 -0
  210. package/dist/cli/chunks/security-ZLWT7IU3.js +14 -0
  211. package/dist/cli/chunks/shared-rvf-adapter-EXACQ2PT.js +2 -0
  212. package/dist/cli/chunks/shared-rvf-dual-writer-G43LQDIV.js +2 -0
  213. package/dist/cli/chunks/sqlite-persistence-JHSUZPAW.js +2 -0
  214. package/dist/cli/chunks/status-handler-7P23CXUI.js +45 -0
  215. package/dist/cli/chunks/structural-health-SCNBNL7K.js +2 -0
  216. package/dist/cli/chunks/sync-BYZBBH65.js +23 -0
  217. package/dist/cli/chunks/task-handler-DWJQXZ2K.js +49 -0
  218. package/dist/cli/chunks/task-handlers-35JIXVRW.js +2 -0
  219. package/dist/cli/chunks/test-2JSS4XW7.js +33 -0
  220. package/dist/cli/chunks/test-scheduling-TWJ5I7N3.js +15 -0
  221. package/dist/cli/chunks/token-bootstrap-LLLNJT5V.js +2 -0
  222. package/dist/cli/chunks/token-usage-EQ4HM4EZ.js +25 -0
  223. package/dist/cli/chunks/transformers-PBIR5U5S.js +2 -0
  224. package/dist/cli/chunks/tree-sitter-wasm-parser-X3L2GXUX.js +2 -0
  225. package/dist/cli/chunks/types-OD43K2NP.js +2 -0
  226. package/dist/cli/chunks/unified-memory-YPHONR2T.js +2 -0
  227. package/dist/cli/chunks/unified-memory-hnsw-HJS4OXWM.js +2 -0
  228. package/dist/cli/chunks/unified-persistence-EFZRO6AW.js +2 -0
  229. package/dist/cli/chunks/validate-POMLT2KU.js +21 -0
  230. package/dist/cli/chunks/validate-swarm-UOC4JGZT.js +14 -0
  231. package/dist/cli/chunks/vibium-5JF6LAXI.js +2 -0
  232. package/dist/cli/chunks/visual-security-7KWFLYNB.js +2 -0
  233. package/dist/cli/chunks/web-tree-sitter-R7WR7J7B.js +2 -0
  234. package/dist/cli/chunks/windsurf-installer-ZSPEUBKR.js +7 -0
  235. package/dist/cli/chunks/witness-chain-CFSPCXHG.js +2 -0
  236. package/dist/cli/chunks/witness-chain-RWU6WT37.js +2 -0
  237. package/dist/cli/chunks/workflow-YNQT3OW2.js +51 -0
  238. package/dist/cli/chunks/workflow-orchestrator-Z6TAVMQP.js +2 -0
  239. package/dist/cli/chunks/wrappers-BP4FODVH.js +2 -0
  240. package/dist/cli/commands/daemon.d.ts +13 -0
  241. package/dist/cli/commands/daemon.js +224 -0
  242. package/dist/cli/commands/hooks-handlers/hooks-shared.js +2 -1
  243. package/dist/cli/commands/plugin.d.ts +12 -0
  244. package/dist/cli/commands/plugin.js +135 -0
  245. package/dist/cli/commands/ruvector-commands.js +14 -2
  246. package/dist/cli/commands/workflow.d.ts +10 -0
  247. package/dist/cli/commands/workflow.js +587 -0
  248. package/dist/cli/handlers/brain-handler.js +13 -8
  249. package/dist/cli/handlers/heartbeat-handler.d.ts +1 -0
  250. package/dist/cli/handlers/heartbeat-handler.js +20 -10
  251. package/dist/cli/handlers/hypergraph-handler.js +3 -3
  252. package/dist/cli/handlers/init-handler.js +10 -9
  253. package/dist/cli/handlers/interfaces.d.ts +4 -4
  254. package/dist/cli/index.js +159 -638
  255. package/dist/cli/lazy-registry.d.ts +27 -0
  256. package/dist/cli/lazy-registry.js +70 -0
  257. package/dist/context/compaction/context-budget.d.ts +71 -0
  258. package/dist/context/compaction/context-budget.js +120 -0
  259. package/dist/context/compaction/index.d.ts +96 -0
  260. package/dist/context/compaction/index.js +259 -0
  261. package/dist/context/compaction/llm-caller-adapter.d.ts +14 -0
  262. package/dist/context/compaction/llm-caller-adapter.js +47 -0
  263. package/dist/context/compaction/tier1-microcompact.d.ts +33 -0
  264. package/dist/context/compaction/tier1-microcompact.js +47 -0
  265. package/dist/context/compaction/tier2-session-summary.d.ts +72 -0
  266. package/dist/context/compaction/tier2-session-summary.js +172 -0
  267. package/dist/context/compaction/tier3-llm-compact.d.ts +65 -0
  268. package/dist/context/compaction/tier3-llm-compact.js +166 -0
  269. package/dist/context/compaction/tier4-reactive.d.ts +54 -0
  270. package/dist/context/compaction/tier4-reactive.js +129 -0
  271. package/dist/coordination/agent-memory-branch.d.ts +117 -0
  272. package/dist/coordination/agent-memory-branch.js +213 -0
  273. package/dist/coordination/agent-teams/mailbox.d.ts +43 -0
  274. package/dist/coordination/agent-teams/mailbox.js +130 -4
  275. package/dist/coordination/consensus/providers/claude-provider.d.ts +1 -0
  276. package/dist/coordination/consensus/providers/claude-provider.js +23 -3
  277. package/dist/coordination/handlers/handler-utils.d.ts +1 -0
  278. package/dist/coordination/handlers/handler-utils.js +9 -2
  279. package/dist/coordination/handlers/quality-handlers.js +7 -1
  280. package/dist/domains/contract-testing/coordinator.js +11 -0
  281. package/dist/domains/quality-assessment/coherence/gate-controller.d.ts +20 -1
  282. package/dist/domains/quality-assessment/coherence/gate-controller.js +64 -0
  283. package/dist/domains/quality-assessment/coherence/index.d.ts +3 -3
  284. package/dist/domains/quality-assessment/coherence/index.js +2 -2
  285. package/dist/domains/quality-assessment/coherence/types.d.ts +39 -0
  286. package/dist/domains/quality-assessment/coherence/types.js +11 -0
  287. package/dist/domains/quality-assessment/coordinator.d.ts +14 -0
  288. package/dist/domains/quality-assessment/coordinator.js +92 -0
  289. package/dist/domains/test-execution/coordinator.d.ts +19 -0
  290. package/dist/domains/test-execution/coordinator.js +102 -5
  291. package/dist/domains/test-generation/coordinator.js +11 -0
  292. package/dist/domains/test-generation/interfaces.d.ts +2 -0
  293. package/dist/domains/test-generation/services/test-generator.d.ts +9 -0
  294. package/dist/domains/test-generation/services/test-generator.js +37 -0
  295. package/dist/hooks/cross-phase-hooks.d.ts +11 -0
  296. package/dist/hooks/cross-phase-hooks.js +73 -9
  297. package/dist/hooks/security/config-snapshot.d.ts +21 -0
  298. package/dist/hooks/security/config-snapshot.js +33 -0
  299. package/dist/hooks/security/exit-codes.d.ts +28 -0
  300. package/dist/hooks/security/exit-codes.js +33 -0
  301. package/dist/hooks/security/index.d.ts +15 -0
  302. package/dist/hooks/security/index.js +15 -0
  303. package/dist/hooks/security/ssrf-guard.d.ts +25 -0
  304. package/dist/hooks/security/ssrf-guard.js +69 -0
  305. package/dist/init/agents-installer.d.ts +5 -3
  306. package/dist/init/agents-installer.js +17 -43
  307. package/dist/init/find-package-root.d.ts +22 -0
  308. package/dist/init/find-package-root.js +46 -0
  309. package/dist/init/n8n-installer.d.ts +4 -2
  310. package/dist/init/n8n-installer.js +23 -23
  311. package/dist/init/opencode-installer.d.ts +0 -5
  312. package/dist/init/opencode-installer.js +12 -39
  313. package/dist/init/skills-installer.d.ts +5 -2
  314. package/dist/init/skills-installer.js +15 -37
  315. package/dist/integrations/embeddings/index/HNSWIndex.d.ts +9 -2
  316. package/dist/integrations/embeddings/index/HNSWIndex.js +110 -35
  317. package/dist/integrations/ruvector/cognitive-routing.d.ts +67 -0
  318. package/dist/integrations/ruvector/cognitive-routing.js +208 -0
  319. package/dist/integrations/ruvector/feature-flags.d.ts +84 -0
  320. package/dist/integrations/ruvector/feature-flags.js +59 -0
  321. package/dist/integrations/ruvector/hdc-fingerprint.d.ts +76 -0
  322. package/dist/integrations/ruvector/hdc-fingerprint.js +217 -0
  323. package/dist/integrations/ruvector/hyperbolic-hnsw.d.ts +59 -0
  324. package/dist/integrations/ruvector/hyperbolic-hnsw.js +194 -0
  325. package/dist/integrations/ruvector/index.d.ts +5 -2
  326. package/dist/integrations/ruvector/index.js +13 -2
  327. package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +24 -0
  328. package/dist/integrations/ruvector/shared-rvf-adapter.js +55 -0
  329. package/dist/integrations/ruvector/shared-rvf-dual-writer.d.ts +6 -0
  330. package/dist/integrations/ruvector/shared-rvf-dual-writer.js +38 -0
  331. package/dist/integrations/ruvector/sona-persistence.d.ts +8 -0
  332. package/dist/integrations/ruvector/sona-persistence.js +10 -0
  333. package/dist/integrations/ruvector/vector-delta-tracker.d.ts +96 -0
  334. package/dist/integrations/ruvector/vector-delta-tracker.js +226 -0
  335. package/dist/kernel/agent-coordinator.d.ts +75 -1
  336. package/dist/kernel/agent-coordinator.js +250 -1
  337. package/dist/kernel/hnsw-legacy-bridge.d.ts +38 -0
  338. package/dist/kernel/hnsw-legacy-bridge.js +88 -0
  339. package/dist/kernel/hnsw-shadow-validator.d.ts +91 -0
  340. package/dist/kernel/hnsw-shadow-validator.js +139 -0
  341. package/dist/kernel/index.d.ts +1 -1
  342. package/dist/kernel/index.js +1 -1
  343. package/dist/kernel/interfaces.d.ts +39 -0
  344. package/dist/kernel/kernel.d.ts +23 -0
  345. package/dist/kernel/kernel.js +141 -1
  346. package/dist/kernel/memory-backend.js +3 -1
  347. package/dist/kernel/unified-memory.d.ts +1 -1
  348. package/dist/kernel/unified-memory.js +7 -3
  349. package/dist/learning/aqe-learning-engine.d.ts +65 -0
  350. package/dist/learning/aqe-learning-engine.js +134 -0
  351. package/dist/learning/dream/dream-engine.d.ts +6 -1
  352. package/dist/learning/dream/dream-engine.js +37 -2
  353. package/dist/learning/dream/dream-scheduler.d.ts +25 -0
  354. package/dist/learning/dream/dream-scheduler.js +120 -0
  355. package/dist/learning/dream/rvcow-branch-manager.d.ts +6 -3
  356. package/dist/learning/dream/rvcow-branch-manager.js +60 -5
  357. package/dist/learning/experience-capture.d.ts +3 -3
  358. package/dist/learning/hyperbolic-pattern-index.d.ts +82 -0
  359. package/dist/learning/hyperbolic-pattern-index.js +142 -0
  360. package/dist/learning/index.d.ts +3 -3
  361. package/dist/learning/index.js +1 -1
  362. package/dist/learning/metrics-tracker.d.ts +44 -0
  363. package/dist/learning/metrics-tracker.js +37 -0
  364. package/dist/learning/pattern-promotion.d.ts +3 -3
  365. package/dist/learning/pattern-store.d.ts +45 -2
  366. package/dist/learning/pattern-store.js +217 -4
  367. package/dist/learning/qe-patterns.d.ts +1 -1
  368. package/dist/learning/qe-reasoning-bank.js +1 -1
  369. package/dist/learning/rvf-pattern-migration.d.ts +50 -0
  370. package/dist/learning/rvf-pattern-migration.js +106 -0
  371. package/dist/learning/rvf-pattern-store.d.ts +66 -0
  372. package/dist/learning/rvf-pattern-store.js +447 -0
  373. package/dist/mcp/bundle.js +1937 -1793
  374. package/dist/mcp/entry.js +132 -77
  375. package/dist/mcp/handlers/index.d.ts +1 -0
  376. package/dist/mcp/handlers/index.js +2 -0
  377. package/dist/mcp/handlers/migration-handlers.d.ts +52 -0
  378. package/dist/mcp/handlers/migration-handlers.js +85 -0
  379. package/dist/mcp/middleware/batch-executor.d.ts +46 -0
  380. package/dist/mcp/middleware/batch-executor.js +150 -0
  381. package/dist/mcp/middleware/microcompact.d.ts +97 -0
  382. package/dist/mcp/middleware/microcompact.js +179 -0
  383. package/dist/mcp/middleware/middleware-chain.d.ts +37 -0
  384. package/dist/mcp/middleware/middleware-chain.js +60 -0
  385. package/dist/mcp/protocol-server.d.ts +12 -0
  386. package/dist/mcp/protocol-server.js +192 -36
  387. package/dist/mcp/services/session-durability-middleware.d.ts +22 -0
  388. package/dist/mcp/services/session-durability-middleware.js +64 -0
  389. package/dist/mcp/services/session-resume.d.ts +29 -0
  390. package/dist/mcp/services/session-resume.js +221 -0
  391. package/dist/mcp/services/session-store.d.ts +84 -0
  392. package/dist/mcp/services/session-store.js +163 -0
  393. package/dist/mcp/tool-registry.d.ts +9 -0
  394. package/dist/mcp/tool-registry.js +30 -1
  395. package/dist/mcp/types.d.ts +2 -1
  396. package/dist/optimization/early-exit-token-optimizer.d.ts +7 -7
  397. package/dist/optimization/early-exit-token-optimizer.js +3 -3
  398. package/dist/persistence/rvf-consistency-validator.d.ts +85 -0
  399. package/dist/persistence/rvf-consistency-validator.js +182 -0
  400. package/dist/persistence/rvf-migration-adapter.d.ts +125 -0
  401. package/dist/persistence/rvf-migration-adapter.js +303 -0
  402. package/dist/persistence/rvf-migration-coordinator.d.ts +115 -0
  403. package/dist/persistence/rvf-migration-coordinator.js +224 -0
  404. package/dist/persistence/rvf-stage-gate.d.ts +70 -0
  405. package/dist/persistence/rvf-stage-gate.js +163 -0
  406. package/dist/plugins/cache.d.ts +44 -0
  407. package/dist/plugins/cache.js +149 -0
  408. package/dist/plugins/index.d.ts +15 -0
  409. package/dist/plugins/index.js +15 -0
  410. package/dist/plugins/lifecycle.d.ts +67 -0
  411. package/dist/plugins/lifecycle.js +175 -0
  412. package/dist/plugins/manifest.d.ts +45 -0
  413. package/dist/plugins/manifest.js +173 -0
  414. package/dist/plugins/resolver.d.ts +37 -0
  415. package/dist/plugins/resolver.js +80 -0
  416. package/dist/plugins/security.d.ts +23 -0
  417. package/dist/plugins/security.js +125 -0
  418. package/dist/plugins/sources/github.d.ts +17 -0
  419. package/dist/plugins/sources/github.js +77 -0
  420. package/dist/plugins/sources/local.d.ts +20 -0
  421. package/dist/plugins/sources/local.js +32 -0
  422. package/dist/plugins/sources/npm.d.ts +18 -0
  423. package/dist/plugins/sources/npm.js +82 -0
  424. package/dist/shared/llm/retry.d.ts +5 -2
  425. package/dist/shared/llm/retry.js +7 -3
  426. package/dist/shared/prompt-cache-latch.d.ts +41 -0
  427. package/dist/shared/prompt-cache-latch.js +63 -0
  428. package/dist/shared/retry-engine.d.ts +77 -0
  429. package/dist/shared/retry-engine.js +194 -0
  430. package/dist/workers/daemon.d.ts +8 -0
  431. package/dist/workers/daemon.js +13 -0
  432. package/dist/workers/quality-daemon/ci-monitor.d.ts +55 -0
  433. package/dist/workers/quality-daemon/ci-monitor.js +147 -0
  434. package/dist/workers/quality-daemon/coverage-delta.d.ts +72 -0
  435. package/dist/workers/quality-daemon/coverage-delta.js +135 -0
  436. package/dist/workers/quality-daemon/git-watcher.d.ts +51 -0
  437. package/dist/workers/quality-daemon/git-watcher.js +209 -0
  438. package/dist/workers/quality-daemon/index.d.ts +119 -0
  439. package/dist/workers/quality-daemon/index.js +343 -0
  440. package/dist/workers/quality-daemon/nightly-consolidation.d.ts +74 -0
  441. package/dist/workers/quality-daemon/nightly-consolidation.js +136 -0
  442. package/dist/workers/quality-daemon/notification-service.d.ts +67 -0
  443. package/dist/workers/quality-daemon/notification-service.js +178 -0
  444. package/dist/workers/quality-daemon/persistent-memory.d.ts +31 -0
  445. package/dist/workers/quality-daemon/persistent-memory.js +30 -0
  446. package/dist/workers/quality-daemon/priority-queue.d.ts +97 -0
  447. package/dist/workers/quality-daemon/priority-queue.js +126 -0
  448. package/dist/workers/quality-daemon/test-suggester.d.ts +50 -0
  449. package/dist/workers/quality-daemon/test-suggester.js +121 -0
  450. package/dist/workers/worker-manager.js +2 -1
  451. package/package.json +10 -10
@@ -0,0 +1,316 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{b as P,c as x,d as R,f as O,g as j,h as D,i as $,j as L,k as N}from"./chunk-DMGLX76J.js";import{b as _,d as T}from"./chunk-JSOBRKMA.js";import{a as k,c as q}from"./chunk-UN4PA4M2.js";import{a as v,b as ee}from"./chunk-GFNUESMU.js";T();import{existsSync as w,mkdirSync as Q,writeFileSync as S,readFileSync as I,copyFileSync as te}from"fs";import{join as g,dirname as ne}from"path";async function M(t,e){if(!e.hooks.claudeCode)return!1;let n=g(t,".claude");w(n)||Q(n,{recursive:!0});let r=g(n,"settings.json"),s={};if(w(r))try{let u=I(r,"utf-8");s=_(u)}catch{s={}}let i={PreToolUse:[{matcher:"^(Write|Edit|MultiEdit)$",hooks:[{type:"command",command:'npx agentic-qe hooks guard --file "$TOOL_INPUT_file_path" --json',timeout:3e3,continueOnError:!0}]},{matcher:"^(Write|Edit|MultiEdit)$",hooks:[{type:"command",command:'npx agentic-qe hooks pre-edit --file "$TOOL_INPUT_file_path" --json',timeout:5e3,continueOnError:!0}]},{matcher:"^Bash$",hooks:[{type:"command",command:'npx agentic-qe hooks pre-command --command "$TOOL_INPUT_command" --json',timeout:3e3,continueOnError:!0}]},{matcher:"^Task$",hooks:[{type:"command",command:'npx agentic-qe hooks pre-task --description "$TOOL_INPUT_prompt" --json',timeout:5e3,continueOnError:!0}]}],PostToolUse:[{matcher:"^(Write|Edit|MultiEdit)$",hooks:[{type:"command",command:'npx agentic-qe hooks post-edit --file "$TOOL_INPUT_file_path" --success --json',timeout:5e3,continueOnError:!0}]},{matcher:"^Bash$",hooks:[{type:"command",command:'npx agentic-qe hooks post-command --command "$TOOL_INPUT_command" --success --json',timeout:5e3,continueOnError:!0}]},{matcher:"^Task$",hooks:[{type:"command",command:'npx agentic-qe hooks post-task --task-id "$TOOL_RESULT_agent_id" --success --json',timeout:5e3,continueOnError:!0}]}],UserPromptSubmit:[{hooks:[{type:"command",command:'npx agentic-qe hooks route --task "$PROMPT" --json',timeout:5e3,continueOnError:!0}]}],SessionStart:[{hooks:[{type:"command",command:'npx agentic-qe hooks session-start --session-id "$SESSION_ID" --json',timeout:1e4,continueOnError:!0}]}],Stop:[{hooks:[{type:"command",command:"npx agentic-qe hooks session-end --save-state --json",timeout:5e3,continueOnError:!0}]}]},d=s.hooks||{};s.hooks=O(d,i);let c=s.env||{};s.env={...c,...j(e)};let m=D(e,t);for(let[u,h]of Object.entries(m))if(u==="_aqePermissions"){let p=s.permissions||{},l=p.allow||[],y=h,C=[...new Set([...l,...y])];s.permissions={...p,allow:C}}else s[u]=h;let a=s.enabledMcpjsonServers||[];return a=a.filter(u=>u!=="aqe"),a.includes("agentic-qe")||a.push("agentic-qe"),s.enabledMcpjsonServers=a,S(r,JSON.stringify(s,null,2),"utf-8"),await re(t),!0}async function re(t){let e=g(t,".claude","hooks");w(e)||Q(e,{recursive:!0});let n=g(e,"cross-phase-memory.yaml");if(w(n))return;let r=[g(ne(import.meta.url.replace("file://","")),"..","..","assets","hooks","cross-phase-memory.yaml"),g(process.cwd(),"assets","hooks","cross-phase-memory.yaml"),g(process.cwd(),"v3","assets","hooks","cross-phase-memory.yaml")];for(let i of r)try{if(w(i)){te(i,n),console.log(" \u2713 Cross-phase memory hooks installed");return}}catch{}S(n,`# Cross-Phase Memory Hooks Configuration
3
+ # Generated by aqe init
4
+ # See: https://github.com/anthropics/agentic-qe/docs/cross-phase-memory.md
5
+
6
+ version: "1.0"
7
+ enabled: true
8
+
9
+ hooks:
10
+ # Add custom QCSD feedback loop hooks here
11
+ # See .claude/hooks/cross-phase-memory.yaml in the agentic-qe repo for examples
12
+
13
+ routing:
14
+ authorized_receivers:
15
+ strategic:
16
+ - "qe-risk-assessor"
17
+ - "qe-quality-criteria-recommender"
18
+ tactical:
19
+ - "qe-product-factors-assessor"
20
+ operational:
21
+ - "qe-test-architect"
22
+ - "qe-tdd-specialist"
23
+ quality-criteria:
24
+ - "qe-requirements-validator"
25
+ - "qe-bdd-generator"
26
+ `,"utf-8"),console.log(" \u2713 Cross-phase memory hooks created (minimal config)")}async function z(t){let e=g(t,".mcp.json"),n={};if(w(e))try{let s=I(e,"utf-8");n=_(s)}catch{n={}}n.mcpServers||(n.mcpServers={});let r=n.mcpServers;return r["agentic-qe"]={command:"npx",args:["@anthropics/agentic-qe","mcp","start"],env:{AQE_LEARNING_ENABLED:"true",AQE_VERBOSE:"false"},autoStart:!1},S(e,JSON.stringify(n,null,2),"utf-8"),!0}async function U(t,e){let n=g(t,"CLAUDE.md"),r=se(e);if(w(n)){let s=I(n,"utf-8");if(s.includes("## Agentic QE v3"))return!0;let i=g(t,"CLAUDE.md.backup");S(i,s,"utf-8"),S(n,s+`
27
+
28
+ `+r,"utf-8")}else S(n,r,"utf-8");return!0}function se(t){let e=t.domains.enabled.slice(0,6).join(", "),n=Math.max(0,t.domains.enabled.length-6);return`## Agentic QE v3
29
+
30
+ This project uses **Agentic QE v3** - a Domain-Driven Quality Engineering platform with 12 bounded contexts, ReasoningBank learning, and HNSW vector search.
31
+
32
+ ---
33
+
34
+ ## \u{1F41D} AQE FLEET ORCHESTRATION
35
+
36
+ ### Fleet Initialization
37
+
38
+ **For QE-specific tasks, initialize the AQE fleet:**
39
+
40
+ \`\`\`javascript
41
+ // Initialize AQE Fleet with MCP tool
42
+ mcp__agentic-qe__fleet_init({
43
+ config: {
44
+ topology: "hierarchical", // Queen-led for QE coordination
45
+ maxAgents: 15,
46
+ testingFocus: ["unit", "integration", "e2e", "performance"],
47
+ frameworks: ["vitest", "jest", "playwright"],
48
+ environments: ["node", "browser"]
49
+ },
50
+ projectContext: {
51
+ language: "typescript",
52
+ buildSystem: "npm"
53
+ }
54
+ })
55
+ \`\`\`
56
+
57
+ ### 12 DDD Domains \u2192 Agent Mapping
58
+
59
+ | Domain | Primary Agents | Focus Area |
60
+ |--------|---------------|------------|
61
+ | \`test-generation\` | qe-test-architect, qe-tdd-specialist | AI-powered test creation |
62
+ | \`test-execution\` | qe-parallel-executor, qe-flaky-hunter, qe-retry-handler | Parallel execution, flaky detection |
63
+ | \`coverage-analysis\` | qe-coverage-specialist, qe-gap-detector | O(log n) sublinear coverage |
64
+ | \`quality-assessment\` | qe-quality-gate, qe-deployment-advisor | Quality gates, risk scoring |
65
+ | \`defect-intelligence\` | qe-defect-predictor, qe-root-cause-analyzer | ML-powered defect prediction |
66
+ | \`learning-optimization\` | qe-learning-coordinator, qe-pattern-learner | Cross-domain pattern learning |
67
+ | \`requirements-validation\` | qe-tdd-specialist, qe-property-tester | BDD scenarios, property tests |
68
+ | \`code-intelligence\` | qe-knowledge-manager, code-analyzer | Knowledge graphs, 80% token reduction |
69
+ | \`security-compliance\` | qe-security-scanner, qe-security-auditor | OWASP, CVE detection |
70
+ | \`contract-testing\` | qe-contract-validator, qe-api-tester | Pact, schema validation |
71
+ | \`visual-accessibility\` | qe-visual-tester, qe-a11y-validator | Visual regression, WCAG |
72
+ | \`chaos-resilience\` | qe-chaos-engineer, qe-performance-tester | Fault injection, load testing |
73
+
74
+ ### Fleet MCP Tools
75
+
76
+ \`\`\`javascript
77
+ // Spawn specialized QE agent
78
+ mcp__agentic-qe__agent_spawn({
79
+ spec: {
80
+ type: "test-generator",
81
+ capabilities: ["unit-tests", "integration-tests"],
82
+ name: "test-gen-1"
83
+ },
84
+ fleetId: "fleet-123"
85
+ })
86
+
87
+ // AI-enhanced test generation
88
+ mcp__agentic-qe__test_generate_enhanced({
89
+ sourceCode: "...",
90
+ language: "typescript",
91
+ testType: "unit",
92
+ coverageGoal: 90,
93
+ aiEnhancement: true,
94
+ detectAntiPatterns: true
95
+ })
96
+
97
+ // Parallel test execution with retry
98
+ mcp__agentic-qe__test_execute_parallel({
99
+ testFiles: ["tests/**/*.test.ts"],
100
+ parallelism: 4,
101
+ retryFailures: true,
102
+ maxRetries: 3,
103
+ collectCoverage: true
104
+ })
105
+
106
+ // Orchestrate QE task across fleet
107
+ mcp__agentic-qe__task_orchestrate({
108
+ task: {
109
+ type: "comprehensive-testing",
110
+ priority: "high",
111
+ strategy: "adaptive",
112
+ maxAgents: 5
113
+ },
114
+ context: {
115
+ project: "my-project",
116
+ environment: "test"
117
+ },
118
+ fleetId: "fleet-123"
119
+ })
120
+ \`\`\`
121
+
122
+ ### QE Memory Operations
123
+
124
+ \`\`\`javascript
125
+ // Store QE pattern with namespace
126
+ mcp__agentic-qe__memory_store({
127
+ key: "coverage-pattern-auth",
128
+ value: { pattern: "...", successRate: 0.95 },
129
+ namespace: "qe-patterns",
130
+ ttl: 86400,
131
+ persist: true
132
+ })
133
+
134
+ // Query memory with pattern matching
135
+ mcp__agentic-qe__memory_query({
136
+ pattern: "coverage-*",
137
+ namespace: "qe-patterns",
138
+ limit: 10
139
+ })
140
+ \`\`\`
141
+
142
+ ### QE Task Routing by Domain
143
+
144
+ | Task Type | MCP Tool | Agents Spawned |
145
+ |-----------|----------|----------------|
146
+ | Generate tests | \`test_generate_enhanced\` | qe-test-architect, qe-tdd-specialist |
147
+ | Run tests | \`test_execute_parallel\` | qe-parallel-executor, qe-retry-handler |
148
+ | Analyze coverage | \`task_orchestrate\` (coverage) | qe-coverage-specialist, qe-gap-detector |
149
+ | Quality gate | \`task_orchestrate\` (quality-gate) | qe-quality-gate, qe-deployment-advisor |
150
+ | Security scan | \`agent_spawn\` (security-scanner) | qe-security-scanner, qe-security-auditor |
151
+ | Chaos test | \`agent_spawn\` (chaos-engineer) | qe-chaos-engineer, qe-load-tester |
152
+
153
+ ---
154
+
155
+ ## Quick Reference
156
+
157
+ \`\`\`bash
158
+ # Run tests
159
+ npm test -- --run
160
+
161
+ # Check quality
162
+ aqe quality assess
163
+
164
+ # Generate tests
165
+ aqe test generate <file>
166
+
167
+ # Coverage analysis
168
+ aqe coverage <path>
169
+ \`\`\`
170
+
171
+ ### MCP Server
172
+
173
+ The AQE v3 MCP server is configured in \`.claude/mcp.json\`. Available tools:
174
+
175
+ | Tool | Description |
176
+ |------|-------------|
177
+ | \`fleet_init\` | Initialize QE fleet with topology |
178
+ | \`agent_spawn\` | Spawn specialized QE agent |
179
+ | \`test_generate_enhanced\` | AI-powered test generation |
180
+ | \`test_execute_parallel\` | Parallel test execution with retry |
181
+ | \`task_orchestrate\` | Orchestrate multi-agent QE tasks |
182
+ | \`coverage_analyze_sublinear\` | O(log n) coverage analysis |
183
+ | \`quality_assess\` | Quality gate evaluation |
184
+ | \`memory_store\` / \`memory_query\` | Pattern storage with namespacing |
185
+ | \`security_scan_comprehensive\` | SAST/DAST scanning |
186
+ | \`fleet_status\` | Get fleet and agent status |
187
+
188
+ ### Configuration
189
+
190
+ - **Enabled Domains**: ${e}${n>0?` (+${n} more)`:""}
191
+ - **Learning**: ${t.learning.enabled?"Enabled":"Disabled"} (${t.learning.embeddingModel} embeddings)
192
+ - **Max Concurrent Agents**: ${t.agents.maxConcurrent}
193
+ - **Background Workers**: ${t.workers.enabled.length>0?t.workers.enabled.join(", "):"None"}
194
+
195
+ ### V3 QE Agents
196
+
197
+ QE agents are installed in \`.claude/agents/v3/\`. Use with Claude Code's Task tool:
198
+
199
+ \`\`\`javascript
200
+ // Example: Generate tests
201
+ Task({ prompt: "Generate unit tests for auth module", subagent_type: "qe-test-architect", run_in_background: true })
202
+
203
+ // Example: Analyze coverage
204
+ Task({ prompt: "Find coverage gaps in src/", subagent_type: "qe-coverage-specialist", run_in_background: true })
205
+
206
+ // Example: Security scan
207
+ Task({ prompt: "Run security audit", subagent_type: "qe-security-scanner", run_in_background: true })
208
+ \`\`\`
209
+
210
+ ### Integration with Claude Flow
211
+
212
+ **AQE Fleet + Claude Flow work together:**
213
+
214
+ \`\`\`javascript
215
+ // STEP 1: Initialize Claude Flow swarm for coordination
216
+ Bash("npx ruflo swarm init --topology hierarchical --max-agents 15")
217
+
218
+ // STEP 2: Initialize AQE Fleet for QE-specific work
219
+ mcp__agentic-qe__fleet_init({
220
+ config: { topology: "hierarchical", maxAgents: 10, testingFocus: ["unit", "integration"] }
221
+ })
222
+
223
+ // STEP 3: Spawn agents via Claude Code Task tool (do the actual work)
224
+ Task({ prompt: "Generate tests for auth module", subagent_type: "qe-test-architect", run_in_background: true })
225
+ Task({ prompt: "Analyze coverage gaps", subagent_type: "qe-coverage-specialist", run_in_background: true })
226
+
227
+ // STEP 4: Store learnings in both systems
228
+ mcp__agentic-qe__memory_store({ key: "pattern-1", value: "...", namespace: "qe-patterns", persist: true })
229
+ Bash("npx ruflo memory store --key 'qe-pattern-1' --value '...' --namespace patterns")
230
+ \`\`\`
231
+
232
+ ### Data Storage
233
+
234
+ - **Memory Backend**: \`.agentic-qe/memory.db\` (SQLite)
235
+ - **Pattern Storage**: \`.agentic-qe/data/memory.db\` (ReasoningBank)
236
+ - **HNSW Index**: \`.agentic-qe/data/hnsw/index.bin\`
237
+ - **Configuration**: \`.agentic-qe/config.yaml\`
238
+
239
+ ### Best Practices
240
+
241
+ 1. **Test Execution**: Always use \`npm test -- --run\` (not \`npm test\` which runs in watch mode)
242
+ 2. **Coverage Targets**: Aim for 80%+ coverage on critical paths
243
+ 3. **Quality Gates**: Run \`quality_assess\` before merging PRs
244
+ 4. **Pattern Learning**: AQE learns from successful test patterns - consistent naming helps
245
+ 5. **Fleet Coordination**: Use \`fleet_init\` before spawning multiple QE agents
246
+ 6. **Memory Persistence**: Use \`persist: true\` for patterns you want to keep across sessions
247
+
248
+ ### Troubleshooting
249
+
250
+ If MCP tools aren't working:
251
+ \`\`\`bash
252
+ # Verify MCP server is configured
253
+ cat .claude/mcp.json
254
+
255
+ # Check fleet status
256
+ mcp__agentic-qe__fleet_status({ includeAgentDetails: true })
257
+
258
+ # Reinitialize if needed
259
+ aqe init --auto
260
+ \`\`\`
261
+
262
+ ---
263
+ *Generated by AQE v3 init - ${new Date().toISOString()}*
264
+ `}q();import{existsSync as f,mkdirSync as b,writeFileSync as E}from"fs";import{join as o,dirname as ae}from"path";q();ee();T();async function F(t,e){let n=o(t,".agentic-qe","memory.db");try{let r=ae(n);f(r)||b(r,{recursive:!0});let s=v(n);try{s.exec(`
265
+ CREATE TABLE IF NOT EXISTS kv_store (
266
+ key TEXT NOT NULL,
267
+ namespace TEXT NOT NULL,
268
+ value TEXT NOT NULL,
269
+ expires_at INTEGER,
270
+ created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
271
+ PRIMARY KEY (namespace, key)
272
+ );
273
+ `);let i=Date.now();return s.prepare(`
274
+ INSERT OR REPLACE INTO kv_store (key, namespace, value, created_at)
275
+ VALUES (?, '_system', ?, ?)
276
+ `).run("aqe_version",JSON.stringify(e),i),s.prepare(`
277
+ INSERT OR REPLACE INTO kv_store (key, namespace, value, created_at)
278
+ VALUES (?, '_system', ?, ?)
279
+ `).run("init_timestamp",JSON.stringify(new Date().toISOString()),i),s.close(),console.log(` \u2713 Version ${e} written to memory.db`),!0}catch(i){return s.close(),console.warn(` \u26A0 Could not write version: ${k(i)}`),!1}}catch(r){return console.warn(` \u26A0 Could not open memory.db: ${k(r)}`),!1}}async function W(t){let e=null;try{e=(await import("./better-sqlite3-YHIAPPVT.js")).default}catch{throw new Error(`SQLite persistence REQUIRED but better-sqlite3 is not installed.
280
+ Install it with: npm install better-sqlite3
281
+ If you see native compilation errors, ensure build tools are installed:
282
+ - macOS: xcode-select --install
283
+ - Ubuntu/Debian: sudo apt-get install build-essential python3
284
+ - Alpine: apk add build-base python3`)}let n=o(t,".agentic-qe");f(n)||b(n,{recursive:!0});let r=o(n,"memory.db");try{let s=new e(r);if(s.pragma("journal_mode = WAL"),s.pragma("busy_timeout = 5000"),s.exec(`
285
+ CREATE TABLE IF NOT EXISTS kv_store (
286
+ key TEXT NOT NULL,
287
+ namespace TEXT NOT NULL,
288
+ value TEXT NOT NULL,
289
+ expires_at INTEGER,
290
+ created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
291
+ PRIMARY KEY (namespace, key)
292
+ );
293
+ CREATE INDEX IF NOT EXISTS idx_kv_namespace ON kv_store(namespace);
294
+ CREATE INDEX IF NOT EXISTS idx_kv_expires ON kv_store(expires_at) WHERE expires_at IS NOT NULL;
295
+ `),!s.prepare(`
296
+ SELECT name FROM sqlite_master WHERE type='table' AND name='kv_store'
297
+ `).get())throw new Error("Failed to create kv_store table");return s.prepare(`
298
+ INSERT OR REPLACE INTO kv_store (key, namespace, value)
299
+ VALUES (?, ?, ?)
300
+ `).run("_init_test","_system",JSON.stringify({initialized:new Date().toISOString()})),s.close(),console.log(`\u2713 SQLite persistence initialized: ${r}`),!0}catch(s){throw new Error(`SQLite persistence initialization FAILED: ${s}
301
+ Database path: ${r}
302
+ Ensure the directory is writable and has sufficient disk space.`)}}async function G(t){let e=o(t,".agentic-qe","memory.db");if(!f(e))return!1;try{let n=v(e),r=n.prepare(`
303
+ SELECT COUNT(*) as count FROM kv_store
304
+ WHERE namespace = 'code-intelligence:kg'
305
+ `).get();return n.close(),r.count>0}catch{return!1}}async function V(t){try{let{KnowledgeGraphService:e}=await import("./knowledge-graph-XV7FPU2T.js"),{InMemoryBackend:n}=await import("./memory-backend-DTJD2DWF.js"),r=new n;await r.initialize();let s=new e(r,{namespace:"code-intelligence:kg",enableVectorEmbeddings:!0}),d=await(await import("fast-glob")).default(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx","**/*.py"],{cwd:t,ignore:["node_modules/**","dist/**","coverage/**",".agentic-qe/**"]}),c=await s.index({paths:d.map(m=>o(t,m)),incremental:!1,includeTests:!0});return s.destroy(),c.success?{status:"indexed",entries:c.value.nodesCreated+c.value.edgesCreated}:{status:"error",entries:0}}catch(e){return console.warn("Code intelligence scan warning:",k(e)),{status:"skipped",entries:0}}}async function B(t){let e=o(t,".agentic-qe","memory.db");try{let n=v(e),r=n.prepare(`
306
+ SELECT COUNT(*) as count FROM kv_store
307
+ WHERE namespace LIKE 'code-intelligence:kg%'
308
+ `).get();return n.close(),r.count}catch{return 0}}async function H(t,e,n){if(!e.learning.enabled)return 0;let r=o(t,".agentic-qe","data");f(r)||b(r,{recursive:!0});let s=o(r,"hnsw");f(s)||b(s,{recursive:!0});let i=o(r,"learning-config.json"),d={embeddingModel:e.learning.embeddingModel,hnswConfig:e.learning.hnswConfig,qualityThreshold:e.learning.qualityThreshold,promotionThreshold:e.learning.promotionThreshold,databasePath:o(r,"memory.db"),hnswIndexPath:o(s,"index.bin"),initialized:new Date().toISOString()};E(i,JSON.stringify(d,null,2),"utf-8");let c=0;if(e.learning.pretrainedPatterns&&n){let m=n,a=new Map;for(let p of m.patterns){let l=p.domain||"general";a.has(l)||a.set(l,[]),a.get(l).push(p)}let u=o(r,"pretrained-index.json"),h={version:m.version,totalPatterns:m.statistics.totalPatterns,domains:Array.from(a.entries()).map(([p,l])=>({name:p,patternCount:l.length})),loadedAt:new Date().toISOString()};E(u,JSON.stringify(h,null,2),"utf-8");for(let[p,l]of a){let y=o(r,"patterns",p);f(y)||b(y,{recursive:!0});let C=o(y,"patterns.json");E(C,JSON.stringify(l,null,2),"utf-8"),c+=l.length}return c}return 0}async function J(t,e){if(!e.workers.daemonAutoStart||e.workers.enabled.length===0)return 0;let n=o(t,".agentic-qe","workers");f(n)||b(n,{recursive:!0});let r={},s={"pattern-consolidator":6e4,"coverage-gap-scanner":3e5,"flaky-test-detector":6e5,"routing-accuracy-monitor":12e4};for(let a of e.workers.enabled)r[a]={name:a,enabled:!0,interval:e.workers.intervals[a]||s[a]||6e4,lastRun:null,status:"pending"};let i=o(n,"registry.json"),d={version:e.version,maxConcurrent:e.workers.maxConcurrent,workers:r,createdAt:new Date().toISOString(),daemonPid:null};E(i,JSON.stringify(d,null,2),"utf-8");for(let a of e.workers.enabled){let u=o(n,`${a}.json`),h={name:a,enabled:!0,interval:e.workers.intervals[a]||s[a]||6e4,projectRoot:t,dataDir:o(t,".agentic-qe","data"),createdAt:new Date().toISOString()};E(u,JSON.stringify(h,null,2),"utf-8")}let c=o(n,"start-daemon.cjs");return E(c,`#!/usr/bin/env node
309
+ // AQE v3 Worker Daemon Startup Script (cross-platform)
310
+ // Generated by aqe init
311
+
312
+ console.log("AQE v3 hooks work via CLI commands (no daemon required)");
313
+ console.log("Use: npx aqe hooks session-start");
314
+ `),e.workers.enabled.length}async function X(t,e){if(!e.skills.install)return 0;let r=await $({projectRoot:t,installV2Skills:e.skills.installV2,installV3Skills:e.skills.installV3,overwrite:e.skills.overwrite}).install();return r.errors.length>0&&console.warn("Skills installation warnings:",r.errors),r.installed.length}async function K(t){let n=await L({projectRoot:t,installQEAgents:!0,installSubagents:!0,overwrite:!1}).install();return n.errors.length>0&&console.warn("Agents installation warnings:",n.errors),n.installed.length}async function Y(t,e,n){let s=await N({projectRoot:t,installAgents:!0,installSkills:!0,overwrite:!1,n8nApiConfig:n}).install();return s.errors.length>0&&console.warn("N8n installation warnings:",s.errors),e.platforms||(e.platforms={}),e.platforms.n8n={enabled:!0,installAgents:!0,installSkills:!0,installTypeScriptAgents:!1,n8nApiConfig:n},{agents:s.agentsInstalled.length,skills:s.skillsInstalled.length}}async function Z(t,e){if(!e)throw new Error("No configuration to save");let n=o(t,".agentic-qe");f(n)||b(n,{recursive:!0});let r=oe(e),s=o(n,"config.yaml");E(s,r,"utf-8")}function oe(t){let e=["# Agentic QE v3 Configuration","# Generated by aqe init",`# ${new Date().toISOString()}`,""];e.push(`version: "${t.version}"`),e.push(""),e.push("project:"),e.push(` name: "${t.project.name}"`),e.push(` root: "${t.project.root}"`),e.push(` type: "${t.project.type}"`),e.push(""),e.push("learning:"),e.push(` enabled: ${t.learning.enabled}`),e.push(` embeddingModel: "${t.learning.embeddingModel}"`),e.push(" hnswConfig:"),e.push(` M: ${t.learning.hnswConfig.M}`),e.push(` efConstruction: ${t.learning.hnswConfig.efConstruction}`),e.push(` efSearch: ${t.learning.hnswConfig.efSearch}`),e.push(` qualityThreshold: ${t.learning.qualityThreshold}`),e.push(` promotionThreshold: ${t.learning.promotionThreshold}`),e.push(` pretrainedPatterns: ${t.learning.pretrainedPatterns}`),e.push(""),e.push("routing:"),e.push(` mode: "${t.routing.mode}"`),e.push(` confidenceThreshold: ${t.routing.confidenceThreshold}`),e.push(` feedbackEnabled: ${t.routing.feedbackEnabled}`),e.push(""),e.push("workers:"),e.push(" enabled:");for(let n of t.workers.enabled)e.push(` - "${n}"`);e.push(" intervals:");for(let[n,r]of Object.entries(t.workers.intervals))e.push(` ${n}: ${r}`);e.push(` maxConcurrent: ${t.workers.maxConcurrent}`),e.push(` daemonAutoStart: ${t.workers.daemonAutoStart}`),e.push(""),e.push("hooks:"),e.push(` claudeCode: ${t.hooks.claudeCode}`),e.push(` preCommit: ${t.hooks.preCommit}`),e.push(` ciIntegration: ${t.hooks.ciIntegration}`),e.push(""),e.push("skills:"),e.push(` install: ${t.skills.install}`),e.push(` installV2: ${t.skills.installV2}`),e.push(` installV3: ${t.skills.installV3}`),e.push(` overwrite: ${t.skills.overwrite}`),e.push(""),e.push("autoTuning:"),e.push(` enabled: ${t.autoTuning.enabled}`),e.push(" parameters:");for(let n of t.autoTuning.parameters)e.push(` - "${n}"`);e.push(` evaluationPeriodMs: ${t.autoTuning.evaluationPeriodMs}`),e.push(""),e.push("domains:"),e.push(" enabled:");for(let n of t.domains.enabled)e.push(` - "${n}"`);e.push(" disabled:");for(let n of t.domains.disabled)e.push(` - "${n}"`);return e.push(""),e.push("agents:"),e.push(` maxConcurrent: ${t.agents.maxConcurrent}`),e.push(` defaultTimeout: ${t.agents.defaultTimeout}`),e.push(""),e.join(`
315
+ `)}var ie=[{id:"welcome",title:"Welcome to AQE v3",description:"This wizard will configure Agentic QE for your project.",type:"info"},{id:"project-type",title:"Project Type",description:"What type of project is this?",type:"choice",options:[{value:"auto",label:"Auto-detect",description:"Let AQE analyze your project",recommended:!0},{value:"single",label:"Single Package",description:"Standard single-package project"},{value:"monorepo",label:"Monorepo",description:"Multi-package workspace"},{value:"library",label:"Library",description:"Publishable package/library"}],default:"auto"},{id:"learning-mode",title:"Learning System",description:"How should AQE learn from your project?",type:"choice",options:[{value:"full",label:"Full Learning",description:"Transformer embeddings + SQLite persistence",recommended:!0},{value:"basic",label:"Basic Learning",description:"Hash-based embeddings, in-memory"},{value:"disabled",label:"Disabled",description:"No pattern learning"}],default:"full"},{id:"load-patterns",title:"Pre-trained Patterns",description:"Load pre-trained QE patterns for faster results?",type:"confirm",default:!0},{id:"hooks",title:"Claude Code Integration",description:"Enable Claude Code hooks for seamless integration?",type:"confirm",default:!0},{id:"workers",title:"Background Workers",description:"Start background workers for continuous monitoring?",type:"confirm",default:!0},{id:"skills",title:"Install Skills",description:"Install AQE skills (v2 methodology + v3 domain skills)?",type:"confirm",default:!0},{id:"agents",title:"Install Agents",description:"Install V3 QE agents for Claude Code Task tool?",type:"confirm",default:!0}],A=class{projectRoot;options;analyzer;configurator;steps=[];constructor(e){this.options=e,this.projectRoot=e.projectRoot,this.analyzer=x(e.projectRoot),this.configurator=R({minimal:e.minimal})}async initialize(){let e=Date.now();try{let n=await this.runStep("Project Analysis",async()=>await this.analyzer.analyze()),r=await this.runStep("Configuration Generation",async()=>this.options.autoMode?this.configurator.recommend(n):this.applyWizardAnswers(n));await this.runStep("Persistence Database Setup",async()=>await W(this.projectRoot));let s=await this.runStep("Code Intelligence Pre-Scan",async()=>{if(!await G(this.projectRoot))return console.log(" Building knowledge graph for code intelligence..."),await V(n.projectRoot);let y=await B(this.projectRoot);return console.log(` Using existing code intelligence index (${y} entries)`),{status:"existing",entries:y}}),i=await this.runStep("Learning System Setup",async()=>r.learning.enabled&&!this.options.skipPatterns?await H(this.projectRoot,r,this.options.pretrainedLibrary):0),d=await this.runStep("Hooks Configuration",async()=>r.hooks.claudeCode?await M(this.projectRoot,r):!1),c=await this.runStep("MCP Configuration",async()=>await z(this.projectRoot)),m=await this.runStep("CLAUDE.md Generation",async()=>await U(this.projectRoot,r)),a=await this.runStep("Background Workers",async()=>r.workers.daemonAutoStart?await J(this.projectRoot,r):0),u=await this.runStep("Skills Installation",async()=>r.skills.install?await X(this.projectRoot,r):0),h=await this.runStep("Agents Installation",async()=>await K(this.projectRoot)),p;if(this.options.withN8n){let l=await this.runStep("N8n Platform Installation",async()=>await Y(this.projectRoot,r,this.options.n8nApiConfig));l&&(p=l)}return await this.runStep("Save Configuration",async()=>await Z(this.projectRoot,r)),await this.runStep("Version Marker",async()=>await F(this.projectRoot,r.version)),{success:!0,config:r,steps:this.steps,summary:{projectAnalyzed:!0,configGenerated:!0,codeIntelligenceIndexed:s?.entries??0,patternsLoaded:i,skillsInstalled:u,agentsInstalled:h,hooksConfigured:d,mcpConfigured:c,claudeMdGenerated:m,workersStarted:a,n8nInstalled:p},totalDurationMs:Date.now()-e,timestamp:new Date}}catch(n){return this.steps.push({step:"Initialization Failed",status:"error",message:k(n),durationMs:0}),{success:!1,config:P("unknown",this.projectRoot),steps:this.steps,summary:{projectAnalyzed:!1,configGenerated:!1,codeIntelligenceIndexed:0,patternsLoaded:0,skillsInstalled:0,agentsInstalled:0,hooksConfigured:!1,mcpConfigured:!1,claudeMdGenerated:!1,workersStarted:0},totalDurationMs:Date.now()-e,timestamp:new Date}}}getWizardSteps(){return ie}async runStep(e,n){let r=Date.now();try{let s=await n();return this.steps.push({step:e,status:"success",message:`${e} completed successfully`,durationMs:Date.now()-r}),s}catch(s){throw this.steps.push({step:e,status:"error",message:k(s),durationMs:Date.now()-r}),s}}applyWizardAnswers(e){let n=this.options.wizardAnswers||{},r=this.configurator.recommend(e);switch(n["project-type"]&&n["project-type"]!=="auto"&&(r.project.type=n["project-type"]),n["learning-mode"]){case"full":r.learning.enabled=!0,r.learning.embeddingModel="transformer";break;case"basic":r.learning.enabled=!0,r.learning.embeddingModel="hash";break;case"disabled":r.learning.enabled=!1;break}return n["load-patterns"]===!1&&(r.learning.pretrainedPatterns=!1),n.hooks===!1&&(r.hooks.claudeCode=!1),n.workers===!1&&(r.workers.daemonAutoStart=!1),n.skills===!1&&(r.skills.install=!1),r}};function le(t){return new A(t)}async function xe(t){return await le({projectRoot:t,autoMode:!0}).initialize()}function Re(t){let e=[];e.push(""),e.push("+-------------------------------------------------------------+"),e.push("| AQE v3 Initialization |"),e.push("+-------------------------------------------------------------+");for(let r of t.steps){let s=r.status==="success"?"[OK]":r.status==="error"?"[!!]":"[ ]";e.push(`| ${s} ${r.step.padEnd(50)} ${String(r.durationMs).padStart(4)}ms |`)}e.push("+-------------------------------------------------------------+"),e.push(`| Project: ${t.config.project.name.padEnd(47)} |`),e.push(`| Type: ${t.config.project.type.padEnd(50)} |`),e.push(`| Code Intel Indexed: ${String(t.summary.codeIntelligenceIndexed).padEnd(36)} |`),e.push(`| Patterns Loaded: ${String(t.summary.patternsLoaded).padEnd(39)} |`),e.push(`| Skills Installed: ${String(t.summary.skillsInstalled).padEnd(38)} |`),e.push(`| Agents Installed: ${String(t.summary.agentsInstalled).padEnd(38)} |`),e.push(`| Workers Started: ${String(t.summary.workersStarted).padEnd(39)} |`),e.push(`| Hooks Configured: ${t.summary.hooksConfigured?"Yes":"No".padEnd(38)} |`),e.push(`| MCP Server: ${t.summary.mcpConfigured?"Yes":"No".padEnd(44)} |`),e.push(`| CLAUDE.md: ${t.summary.claudeMdGenerated?"Yes":"No".padEnd(45)} |`),e.push("+-------------------------------------------------------------+");let n=t.success?"[OK] AQE v3 initialized as self-learning platform":"[!!] Initialization failed";return e.push(`| ${n.padEnd(57)} |`),e.push("+-------------------------------------------------------------+"),e.push(""),e.join(`
316
+ `)}export{A as a,le as b,xe as c,Re as d};
@@ -0,0 +1,79 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{i as c}from"./chunk-DC3HPOOJ.js";import{a as p}from"./chunk-U5JQGRHZ.js";import{c as m}from"./chunk-A57BEPL7.js";import{b as g,d as E}from"./chunk-JSOBRKMA.js";import{a as l,b as _}from"./chunk-GFNUESMU.js";_();import b from"node:path";import{existsSync as h}from"node:fs";E();p();var T=m.create("metrics-tracker"),d=class{db=null;dbPath;initialized=!1;constructor(e=process.cwd()){this.dbPath=b.join(e,".agentic-qe","memory.db")}async initialize(){if(!this.initialized){if(!h(this.dbPath))throw new Error(`Database not found: ${this.dbPath}. Run "aqe init --auto" first.`);this.db=l(this.dbPath),this.ensureMetricsTable(),this.initialized=!0}}ensureMetricsTable(){this.db&&this.db.exec(`
3
+ CREATE TABLE IF NOT EXISTS learning_daily_snapshots (
4
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
5
+ snapshot_date TEXT NOT NULL UNIQUE,
6
+ total_patterns INTEGER DEFAULT 0,
7
+ patterns_created_today INTEGER DEFAULT 0,
8
+ total_experiences INTEGER DEFAULT 0,
9
+ experiences_today INTEGER DEFAULT 0,
10
+ total_q_values INTEGER DEFAULT 0,
11
+ avg_reward REAL DEFAULT 0.0,
12
+ avg_confidence REAL DEFAULT 0.0,
13
+ avg_quality_score REAL DEFAULT 0.0,
14
+ success_rate REAL DEFAULT 0.0,
15
+ pattern_reuse_count INTEGER DEFAULT 0,
16
+ short_term_patterns INTEGER DEFAULT 0,
17
+ long_term_patterns INTEGER DEFAULT 0,
18
+ domain_coverage_json TEXT,
19
+ created_at TEXT DEFAULT (datetime('now'))
20
+ );
21
+ CREATE INDEX IF NOT EXISTS idx_learning_daily_snapshots_date ON learning_daily_snapshots(snapshot_date DESC);
22
+ `)}async getCurrentMetrics(){if(this.initialized||await this.initialize(),!this.db)throw new Error("Database not initialized");let e=new Date().toISOString().split("T")[0],r=new Date(Date.now()-10080*60*1e3).toISOString().split("T")[0],a=this.getPatternStats(e),t=this.getExperienceStats(e),s=this.getQValueStats(),o=this.getDomainCoverage(),n=this.getHistoricalAvgReward(r);return{timestamp:new Date,totalPatterns:a.total,patternsCreatedToday:a.createdToday,totalExperiences:t.total,experiencesToday:t.recordedToday,totalQValues:s.total,avgReward:t.avgReward,avgRewardDelta:t.avgReward-n,domainCoverage:o,patternReuseCount:a.reuseCount,shortTermPatterns:a.shortTerm,longTermPatterns:a.longTerm,avgConfidence:a.avgConfidence,avgQualityScore:a.avgQualityScore,successRate:t.successRate}}getPatternStats(e){if(!this.db)return{total:0,createdToday:0,shortTerm:0,longTerm:0,avgConfidence:0,avgQualityScore:0,reuseCount:0};if(!this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_patterns'").get())return{total:0,createdToday:0,shortTerm:0,longTerm:0,avgConfidence:0,avgQualityScore:0,reuseCount:0};let a=this.db.prepare(`
23
+ SELECT
24
+ COUNT(*) as total,
25
+ SUM(CASE WHEN date(created_at) = ? THEN 1 ELSE 0 END) as created_today,
26
+ SUM(CASE WHEN tier = 'short-term' THEN 1 ELSE 0 END) as short_term,
27
+ SUM(CASE WHEN tier = 'long-term' THEN 1 ELSE 0 END) as long_term,
28
+ AVG(confidence) as avg_confidence,
29
+ AVG(quality_score) as avg_quality_score,
30
+ SUM(usage_count) as total_usage
31
+ FROM qe_patterns
32
+ `).get(e);return{total:a.total||0,createdToday:a.created_today||0,shortTerm:a.short_term||0,longTerm:a.long_term||0,avgConfidence:a.avg_confidence||0,avgQualityScore:a.avg_quality_score||0,reuseCount:a.total_usage||0}}getExperienceStats(e){if(!this.db)return{total:0,recordedToday:0,avgReward:0,successRate:0};if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='captured_experiences'").get()){let t=this.db.prepare(`
33
+ SELECT
34
+ COUNT(*) as total,
35
+ SUM(CASE WHEN date(started_at) = ? THEN 1 ELSE 0 END) as recorded_today,
36
+ AVG(quality) as avg_reward,
37
+ AVG(CASE WHEN success = 1 THEN 1.0 ELSE 0.0 END) as success_rate
38
+ FROM captured_experiences
39
+ WHERE agent != 'cli-hook'
40
+ `).get(e);return{total:t.total||0,recordedToday:t.recorded_today||0,avgReward:t.avg_reward||0,successRate:t.success_rate||0}}if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_pattern_usage'").get()){let t=this.db.prepare(`
41
+ SELECT
42
+ COUNT(*) as total,
43
+ SUM(CASE WHEN date(created_at) = ? THEN 1 ELSE 0 END) as recorded_today,
44
+ AVG(success) as success_rate
45
+ FROM qe_pattern_usage
46
+ `).get(e);return{total:t.total||0,recordedToday:t.recorded_today||0,avgReward:t.success_rate||0,successRate:t.success_rate||0}}return{total:0,recordedToday:0,avgReward:0,successRate:0}}getQValueStats(){return this.db?this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='rl_q_values'").get()?{total:this.db.prepare(`
47
+ SELECT COUNT(*) as total FROM rl_q_values
48
+ `).get().total||0}:{total:0}:{total:0}}getDomainCoverage(){let e={};for(let t of c)e[t]=0;if(!this.db||!this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_patterns'").get())return e;let a=this.db.prepare(`
49
+ SELECT qe_domain, COUNT(*) as count
50
+ FROM qe_patterns
51
+ GROUP BY qe_domain
52
+ `).all();for(let t of a)c.includes(t.qe_domain)&&(e[t.qe_domain]=t.count);return e}getHistoricalAvgReward(e){return this.db&&this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='captured_experiences'").get()&&this.db.prepare(`
53
+ SELECT AVG(quality) as avg_reward
54
+ FROM captured_experiences
55
+ WHERE started_at <= datetime(?)
56
+ AND agent != 'cli-hook'
57
+ `).get(e+" 23:59:59")?.avg_reward||0}async getDashboardData(){this.initialized||await this.initialize();let e=await this.getCurrentMetrics(),r=await this.getMetricsHistory(7),a=r.map(n=>n.patternsCreatedToday),t=r.map(n=>n.experiencesToday),s=r.map(n=>n.avgReward),o=Object.entries(e.domainCoverage).filter(([n,i])=>i>0).sort((n,i)=>i[1]-n[1]).slice(0,5).map(([n,i])=>({domain:n,count:i}));return{current:e,history:r,trends:{patternsPerDay:a,experiencesPerDay:t,avgRewardPerDay:s},topDomains:o}}async getMetricsHistory(e){if(this.initialized||await this.initialize(),!this.db)return[];let r=[];if(!this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='learning_daily_snapshots'").get())return[];let t=this.db.prepare(`
58
+ SELECT *
59
+ FROM learning_daily_snapshots
60
+ ORDER BY snapshot_date DESC
61
+ LIMIT ?
62
+ `).all(e);for(let s of t){let o={};try{o=g(s.domain_coverage_json||"{}")}catch(n){T.debug("Domain coverage JSON parse failed",{error:n instanceof Error?n.message:String(n)});for(let i of c)o[i]=0}r.push({timestamp:new Date(s.snapshot_date),totalPatterns:s.total_patterns,patternsCreatedToday:s.patterns_created_today,totalExperiences:s.total_experiences,experiencesToday:s.experiences_today,totalQValues:s.total_q_values,avgReward:s.avg_reward,avgRewardDelta:0,domainCoverage:o,patternReuseCount:s.pattern_reuse_count,shortTermPatterns:s.short_term_patterns,longTermPatterns:s.long_term_patterns,avgConfidence:s.avg_confidence,avgQualityScore:s.avg_quality_score,successRate:s.success_rate})}return r}async saveSnapshot(){if(this.initialized||await this.initialize(),!this.db)throw new Error("Database not initialized");let e=await this.getCurrentMetrics(),r=new Date().toISOString().split("T")[0];this.db.prepare(`
63
+ INSERT OR REPLACE INTO learning_daily_snapshots (
64
+ snapshot_date,
65
+ total_patterns,
66
+ patterns_created_today,
67
+ total_experiences,
68
+ experiences_today,
69
+ total_q_values,
70
+ avg_reward,
71
+ avg_confidence,
72
+ avg_quality_score,
73
+ success_rate,
74
+ pattern_reuse_count,
75
+ short_term_patterns,
76
+ long_term_patterns,
77
+ domain_coverage_json
78
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
79
+ `).run(r,e.totalPatterns,e.patternsCreatedToday,e.totalExperiences,e.experiencesToday,e.totalQValues,e.avgReward,e.avgConfidence,e.avgQualityScore,e.successRate,e.patternReuseCount,e.shortTermPatterns,e.longTermPatterns,JSON.stringify(e.domainCoverage))}async getDashboardDataWithRegret(e){let r=await this.getDashboardData();return e&&e.length>0&&(r.regretHealth=e),r}async collectUnifiedSnapshot(){this.initialized||await this.initialize();let e=await this.getCurrentMetrics();return{timestamp:Date.now(),tokenMetrics:{totalTokens:0,costUsd:0,savingsUsd:0,cacheHitRate:0},qualityMetrics:{gatePassRate:e.successRate,averageScore:e.avgQualityScore,ratchetLevel:0},learningMetrics:{patternCount:e.totalPatterns,averageConfidence:e.avgConfidence,quarantinedCount:0,transferSuccessRate:0},performanceMetrics:{avgLatencyMs:0,p95LatencyMs:0,errorRate:0}}}close(){this.db&&(this.db.close(),this.db=null,this.initialized=!1)}};function C(u){return new d(u)}export{d as a,C as b};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{a as h}from"./chunk-U5JQGRHZ.js";import{c as m}from"./chunk-A57BEPL7.js";h();var g=m.create("regret-tracker"),l=50,R=.9,d=1.1;function f(o,t){let e=o.length;if(e<2)return 0;let n=0,r=0,i=0,a=0;for(let s=0;s<e;s++)n+=o[s],r+=t[s],i+=o[s]*t[s],a+=o[s]*o[s];let u=e*a-n*n;return Math.abs(u)<1e-10?0:(e*i-n*r)/u}var c=class{domains=new Map;alertCallbacks=[];alerts=[];maxAlerts;recentWindow;constructor(t){this.maxAlerts=t?.maxAlerts??100,this.recentWindow=t?.recentWindow??20}recordDecision(t,e,n){let r=this.getOrCreateDomainState(t),i=Math.max(0,n-e);if(r.cumulativeRegret+=i,r.decisionCount++,r.points.push({decisionCount:r.decisionCount,cumulativeRegret:r.cumulativeRegret,timestamp:Date.now()}),r.decisionCount>=l){let a=this.classifyGrowthRate(r.points);r.lastGrowthRate!=="insufficient_data"&&a!==r.lastGrowthRate&&this.emitAlert(t,r.lastGrowthRate,a),r.lastGrowthRate=a}}getCumulativeRegret(t){return this.domains.get(t)?.cumulativeRegret??0}getRegretCurve(t){let e=this.domains.get(t);return e?[...e.points]:[]}getRegretGrowthRate(t){let e=this.domains.get(t);return e?this.classifyGrowthRate(e.points):"insufficient_data"}detectStagnation(t){let e=this.getRegretGrowthRate(t);return e==="linear"||e==="superlinear"}getHealthSummary(){let t=[];for(let[e,n]of this.domains){let r=this.classifyGrowthRate(n.points),i=this.computeLogLogSlope(n.points),a=this.computeRecentAvgRegret(n);t.push({domain:e,totalDecisions:n.decisionCount,cumulativeRegret:n.cumulativeRegret,growthRate:r,stagnating:r==="linear"||r==="superlinear",slope:i,recentAvgRegret:a})}return t.sort((e,n)=>e.domain.localeCompare(n.domain)),t}onAlert(t){this.alertCallbacks.push(t)}getAlerts(){return[...this.alerts]}getTrackedDomains(){return[...this.domains.keys()].sort()}getTotalDecisions(){let t=0;for(let e of this.domains.values())t+=e.decisionCount;return t}reset(t){t?this.domains.delete(t):(this.domains.clear(),this.alerts=[])}getOrCreateDomainState(t){let e=this.domains.get(t);return e||(e={points:[],cumulativeRegret:0,decisionCount:0,lastGrowthRate:"insufficient_data"},this.domains.set(t,e)),e}classifyGrowthRate(t){if(t.length<l)return"insufficient_data";let e=this.computeLogLogSlope(t);return e===void 0?"insufficient_data":e<R?"sublinear":e<=d?"linear":"superlinear"}computeLogLogSlope(t){if(t.length<l)return;let e=t.filter(i=>i.cumulativeRegret>0&&i.decisionCount>0);if(e.length<2)return;let n=e.map(i=>Math.log(i.decisionCount)),r=e.map(i=>Math.log(i.cumulativeRegret));return f(n,r)}computeRecentAvgRegret(t){if(t.points.length<2)return 0;let e=Math.min(this.recentWindow,t.points.length),n=t.points.slice(-e),r=n[0],i=n[n.length-1],a=i.cumulativeRegret-r.cumulativeRegret,u=i.decisionCount-r.decisionCount;return u<=0?0:a/u}emitAlert(t,e,n){let r={domain:t,previousRate:e,newRate:n,timestamp:Date.now(),message:`Domain "${t}" regret growth changed from ${e} to ${n}`};this.alerts.push(r),this.alerts.length>this.maxAlerts&&this.alerts.shift(),g.info("Regret growth rate transition",{domain:t,previousRate:e,newRate:n});for(let i of this.alertCallbacks)try{i(r)}catch(a){g.error("Alert callback error",a instanceof Error?a:void 0)}}};function b(o){return new c(o)}export{b as a};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{a as N,d as P}from"./chunk-XUFHYPZK.js";import{b,e as k}from"./chunk-SGRN6JFB.js";import{a as p,d as F}from"./chunk-NG3BKE7V.js";import{a as T,c as E}from"./chunk-4XREPCBZ.js";import{a as H,b as O}from"./chunk-35H73OPP.js";import{c as z,g as S}from"./chunk-UZZCWWIG.js";function x(l){let e=0;for(let t=0;t<l.length;t++)e+=l[t]*l[t];return Math.sqrt(e)}function C(l,e,t,s){let n=t*s;if(n===0)return 0;let o=0;for(let r=0;r<l.length;r++)o+=l[r]*e[r];return o/n}function U(l={}){let{name:e="default",...t}=l;return new M(e,t)}var f,w,v,I,A,M,D=z(()=>{F();P();k();E();f=null,w=null;try{let l=(O(),S(H));f=l.differentiableSearch,w=l.init}catch{}v=class{data=[];compareFn;constructor(e){this.compareFn=e}push(e){this.data.push(e),this.bubbleUp(this.data.length-1)}pop(){if(this.data.length===0)return;let e=this.data[0],t=this.data.pop();return this.data.length>0&&(this.data[0]=t,this.sinkDown(0)),e}peek(){return this.data[0]}size(){return this.data.length}bubbleUp(e){for(;e>0;){let t=e-1>>1;if(this.compareFn(this.data[e],this.data[t])<0)[this.data[e],this.data[t]]=[this.data[t],this.data[e]],e=t;else break}}sinkDown(e){let t=this.data.length;for(;;){let s=e,n=2*e+1,o=2*e+2;if(n<t&&this.compareFn(this.data[n],this.data[s])<0&&(s=n),o<t&&this.compareFn(this.data[o],this.data[s])<0&&(s=o),s!==e)[this.data[e],this.data[s]]=[this.data[s],this.data[e]],e=s;else break}}},I=class{nodes=new Map;M=b.M_CONNECTIONS;Mmax0=b.M_CONNECTIONS*2;efConstruction=b.EF_CONSTRUCTION;efSearch=b.EF_SEARCH;mL=1/Math.log(b.M_CONNECTIONS);maxLevel=16;entryPoint=null;currentMaxLevel=-1;randomLevel(){return Math.min(Math.floor(-Math.log(N())*this.mL),this.maxLevel)}similarity(e,t){let s=this.nodes.get(t);return s?p(e,s.embedding):-1}searchLayer(e,t,s){let n=t,o=this.similarity(e,n),r=!0;for(;r;){r=!1;let a=this.nodes.get(n);if(!a)break;let h=a.neighbors.get(s)??[];for(let d of h){if(!this.nodes.has(d))continue;let i=this.similarity(e,d);i>o&&(n=d,o=i,r=!0)}}return n}searchLayerBeam(e,t,s,n){let o=new Set(t),r=t.filter(i=>this.nodes.has(i)).map(i=>({id:i,score:this.similarity(e,i)})),a=new v((i,c)=>c.score-i.score),h=new v((i,c)=>i.score-c.score);for(let i of r)a.push(i),h.push(i);for(;a.size()>0;){let i=a.pop();if(h.size()>=n&&i.score<h.peek().score)break;let c=this.nodes.get(i.id);if(!c)continue;let u=c.neighbors.get(s)??[];for(let m of u){if(o.has(m)||(o.add(m),!this.nodes.has(m)))continue;let g=this.similarity(e,m),y=h.size()>=n?h.peek().score:-1/0;if(h.size()<n||g>y){let L={id:m,score:g};a.push(L),h.push(L),h.size()>n&&h.pop()}}}let d=[];for(;h.size()>0;)d.push(h.pop());return d.reverse(),d}selectNeighbors(e,t,s){return t.sort((n,o)=>o.score-n.score).slice(0,s).map(n=>n.id)}getMaxConnections(e){return e===0?this.Mmax0:this.M}add(e,t){this.nodes.has(e)&&this.remove(e);let s=this.randomLevel(),n={id:e,embedding:t,neighbors:new Map};for(let r=0;r<=s;r++)n.neighbors.set(r,[]);if(this.nodes.set(e,n),this.entryPoint===null){this.entryPoint=e,this.currentMaxLevel=s;return}let o=this.entryPoint;for(let r=this.currentMaxLevel;r>s;r--)o=this.searchLayer(t,o,r);for(let r=Math.min(s,this.currentMaxLevel);r>=0;r--){let a=this.getMaxConnections(r),h=this.searchLayerBeam(t,[o],r,this.efConstruction),d=this.selectNeighbors(t,h,a);n.neighbors.set(r,[...d]);for(let i of d){let c=this.nodes.get(i);if(!c)continue;let u=c.neighbors.get(r)??[];if(u.push(e),u.length>a){let m=u.filter(g=>this.nodes.has(g)).map(g=>({id:g,score:p(c.embedding,this.nodes.get(g).embedding)}));m.sort((g,y)=>y.score-g.score),c.neighbors.set(r,m.slice(0,a).map(g=>g.id))}else c.neighbors.set(r,u)}h.length>0&&(o=h[0].id)}s>this.currentMaxLevel&&(this.entryPoint=e,this.currentMaxLevel=s)}remove(e){let t=this.nodes.get(e);if(!t)return!1;for(let[s,n]of t.neighbors.entries())for(let o of n){let r=this.nodes.get(o);if(!r)continue;let a=r.neighbors.get(s);if(!a)continue;let h=a.indexOf(e);h!==-1&&a.splice(h,1);let d=this.getMaxConnections(s);if(a.length<d){for(let i of n)if(i!==o&&i!==e&&this.nodes.has(i)&&!a.includes(i)){a.push(i);let c=this.nodes.get(i);if(c){let u=c.neighbors.get(s)??[];!u.includes(o)&&u.length<d&&(u.push(o),c.neighbors.set(s,u))}if(a.length>=d)break}}r.neighbors.set(s,a)}if(this.nodes.delete(e),this.entryPoint===e)if(this.nodes.size===0)this.entryPoint=null,this.currentMaxLevel=-1;else{let s=null,n=-1;for(let[o,r]of this.nodes.entries()){let a=-1;for(let h of r.neighbors.keys())h>a&&(a=h);a>n&&(n=a,s=o)}this.entryPoint=s,this.currentMaxLevel=n}return!0}search(e,t){if(this.nodes.size===0||this.entryPoint===null)return[];if(this.nodes.size===1){let r=this.nodes.get(this.entryPoint);return[{id:r.id,score:p(e,r.embedding)}]}let s=this.entryPoint;for(let r=this.currentMaxLevel;r>0;r--)s=this.searchLayer(e,s,r);let n=Math.max(this.efSearch,t);return this.searchLayerBeam(e,[s],0,n).slice(0,t)}size(){return this.nodes.size}clear(){this.nodes.clear(),this.entryPoint=null,this.currentMaxLevel=-1}};A=class{ids=[];vectors=[];norms=[];idToIndex=new Map;initialized=!1;constructor(){if(w&&!this.initialized)try{w(),this.initialized=!0}catch{this.initialized=f!==null}}add(e,t){let s=new Float32Array(t),n=x(s);if(this.idToIndex.has(e)){let r=this.idToIndex.get(e);this.vectors[r]=s,this.norms[r]=n;return}let o=this.ids.length;this.ids.push(e),this.vectors.push(s),this.norms.push(n),this.idToIndex.set(e,o)}search(e,t){if(this.ids.length===0)return[];let s=Math.min(t,this.ids.length),n=this.vectors.length>0?this.vectors[0].length:0,o=e.length,r=n===o;if(f&&this.vectors.length>0&&r){let i=new Float32Array(e),c=x(i);return f(i,this.vectors,s,1).indices.map(m=>({id:this.ids[m],score:C(i,this.vectors[m],c,this.norms[m])}))}let a=new Float32Array(e),h=x(a),d=[];for(let i=0;i<this.ids.length;i++){let c=this.vectors[i];if(c.length!==a.length){i===0&&console.warn(`[RuvectorFlatIndex] Dimension mismatch: query=${a.length}, stored=${c.length}. Skipping ${this.ids.length} mismatched vectors. Re-index with correct dimensions.`);continue}else d.push({id:this.ids[i],score:C(a,c,h,this.norms[i])})}return d.sort((i,c)=>c.score-i.score),d.slice(0,s)}remove(e){let t=this.idToIndex.get(e);if(t===void 0)return!1;let s=this.ids.length-1;if(t!==s){let n=this.ids[s];this.ids[t]=n,this.vectors[t]=this.vectors[s],this.norms[t]=this.norms[s],this.idToIndex.set(n,t)}return this.ids.pop(),this.vectors.pop(),this.norms.pop(),this.idToIndex.delete(e),!0}clear(){this.ids=[],this.vectors=[],this.norms=[],this.idToIndex.clear()}size(){return this.ids.length}},M=class{adapter;constructor(e,t){this.adapter=T.create(e,t)}add(e,t){this.adapter.addByStringId(e,t)}search(e,t){return this.adapter.searchByArray(e,t)}remove(e){return this.adapter.removeByStringId(e)}clear(){this.adapter.clear()}size(){return this.adapter.size()}recall(){return this.adapter.recall()}getProvider(){return this.adapter}}});export{v as a,I as b,A as c,M as d,U as e,D as f};
@@ -0,0 +1,3 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{readFileSync as R,existsSync as v,readdirSync as y}from"fs";import{join as S}from"path";var M=100*1024,b=/mcp__([a-z][a-z0-9-]*)__([a-z][a-z0-9_]*)/g,x=/^```/;function w(e,r){let n=e.length>M?e.slice(0,M):e,o=[],i=n.split(`
3
+ `),a=!1;for(let s=0;s<i.length;s++){let p=i[s];if(x.test(p.trim())){a=!a;continue}let l,c=new RegExp(b.source,"g");for(;(l=c.exec(p))!==null;){let t=l[1],g=l[2],f=l[0],d=a?"code-block":"prose",u=d==="prose"?.9:.5;o.push({toolName:f,serverName:t,actionName:g,confidence:u,context:d,lineNumber:s+1})}}return o}function E(e){let r=new Map;for(let n of e)r.has(n.serverName)||r.set(n.serverName,[]),r.get(n.serverName).push(n);return r}function N(e){let r=[],n=[S(e,".claude","mcp.json"),S(e,".mcp.json")],o=process.env.HOME||process.env.USERPROFILE||"";o&&n.push(S(o,".claude","mcp.json"));for(let i of n)if(v(i))try{let a=R(i,"utf-8"),s=JSON.parse(a);s.mcpServers&&typeof s.mcpServers=="object"&&r.push(...Object.keys(s.mcpServers))}catch{}return[...new Set(r)]}function h(e,r,n){if(!v(e))return{agentName:r,references:[],requiredServers:[],availableServers:n,missingServers:[],warnings:[`Agent file not found: ${e}`],allSatisfied:!0};let o;try{o=R(e,"utf-8")}catch{return{agentName:r,references:[],requiredServers:[],availableServers:n,missingServers:[],warnings:[`Failed to read agent file: ${e}`],allSatisfied:!0}}let i=w(o,r),a=E(i),s=[...a.keys()],p=new Set(n),l=s.filter(t=>!p.has(t)),c=[];for(let t of l){let g=a.get(t)||[],f=Math.max(...g.map(m=>m.confidence)),d=g.length,u=[...new Set(g.map(m=>m.context))].join(", ");c.push(`[advisory] Agent "${r}" references MCP server "${t}" (${d} tool ref${d>1?"s":""}, confidence: ${f}, context: ${u}) but server is not configured. Agent may have reduced capabilities.`)}return{agentName:r,references:i,requiredServers:s,availableServers:n,missingServers:l,warnings:c,allSatisfied:l.length===0}}function C(e,r){let n=Date.now(),o=[],i=[],a=N(r);if(!v(e))return{agents:[],totalServersReferenced:0,globalMissingServers:[],agentsWithMissingDeps:[],warnings:[`Agents directory not found: ${e}`],durationMs:Date.now()-n};try{let c=y(e);for(let g of c){if(!g.endsWith(".md"))continue;let f=g.replace(".md",""),d=S(e,g),u=h(d,f,a);o.push(u),i.push(...u.warnings)}let t=S(e,"subagents");if(v(t)){let g=y(t);for(let f of g){if(!f.endsWith(".md"))continue;let d=f.replace(".md",""),u=S(t,f),m=h(u,d,a);o.push(m),i.push(...m.warnings)}}}catch(c){i.push(`Error scanning agents directory: ${c.message}`)}let s=new Set,p=new Set,l=[];for(let c of o){for(let t of c.requiredServers)s.add(t);for(let t of c.missingServers)p.add(t);c.missingServers.length>0&&l.push(c.agentName)}return{agents:o,totalServersReferenced:s.size,globalMissingServers:[...p],agentsWithMissingDeps:l,warnings:i,durationMs:Date.now()-n}}export{N as a,C as b};
@@ -0,0 +1,81 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{a as D}from"./chunk-VO3OVD5D.js";import{c as x,d as $}from"./chunk-D55PSO5D.js";import{a as j}from"./chunk-AREIP4FX.js";import"./chunk-5LDBKZ6P.js";import"./chunk-UZZCWWIG.js";import{Command as U}from"commander";import o from"chalk";import*as I from"fs";import*as p from"path";import*as F from"fs";import*as R from"path";var P={version:"1",name:"aqe-ci",phases:[{name:"Test Generation",type:"test",enabled:!0,config:{target:".",framework:"vitest",type:"unit"},continueOnFailure:!1,timeout:300},{name:"Coverage Analysis",type:"coverage",enabled:!0,config:{target:".",threshold:80},continueOnFailure:!0,timeout:300},{name:"Security Scan",type:"security",enabled:!0,config:{sast:!0},continueOnFailure:!0,timeout:300},{name:"Quality Gate",type:"quality-gate",enabled:!0,config:{},continueOnFailure:!1,timeout:60}],output:{format:"json",directory:".aqe-ci-output",combinedReport:!0},qualityGate:{enforced:!0,thresholds:{coverage:80,security:"medium",quality:70}}},Q=[".aqe-ci.yml",".aqe-ci.yaml","aqe-ci.yml","aqe-ci.yaml"];function G(s=process.cwd()){let n=R.resolve(s);for(let r=0;r<10;r++){for(let a of Q){let e=R.join(n,a);if(F.existsSync(e))return e}let l=R.dirname(n);if(l===n)break;n=l}return null}function T(s){if(!F.existsSync(s))return{success:!1,errors:[`Config file not found: ${s}`]};let n;try{n=F.readFileSync(s,"utf-8")}catch(r){return{success:!1,errors:[`Failed to read config: ${r}`]}}return N(n,s)}function N(s,n){let r=[],l;try{l=j(s)}catch(e){return{success:!1,errors:[`Invalid YAML: ${e}`]}}let a={version:l.version||P.version,name:l.name||P.name,phases:[],output:{...P.output},qualityGate:{...P.qualityGate,thresholds:{...P.qualityGate.thresholds}}};if(l.output&&typeof l.output=="object"){let e=l.output;e.format&&(a.output.format=e.format),e.directory&&(a.output.directory=e.directory),e.combined_report!==void 0&&(a.output.combinedReport=e.combined_report)}if(l.quality_gate&&typeof l.quality_gate=="object"){let e=l.quality_gate;if(e.enforced!==void 0&&(a.qualityGate.enforced=e.enforced),e.thresholds&&typeof e.thresholds=="object"){let t=e.thresholds;t.coverage!==void 0&&(a.qualityGate.thresholds.coverage=t.coverage),t.security!==void 0&&(a.qualityGate.thresholds.security=t.security),t.quality!==void 0&&(a.qualityGate.thresholds.quality=t.quality)}}if(l.phases&&Array.isArray(l.phases))for(let e=0;e<l.phases.length;e++){let t=l.phases[e];if(!t.name){r.push(`Phase ${e+1} must have a "name" field`);continue}if(!t.type){r.push(`Phase "${t.name}" must have a "type" field`);continue}let i=["test","coverage","security","quality-gate","code-intelligence","custom"];if(!i.includes(t.type)){r.push(`Phase "${t.name}" has invalid type "${t.type}". Valid: ${i.join(", ")}`);continue}let h={name:t.name,type:t.type,enabled:t.enabled!==!1,config:t.config||{},continueOnFailure:t.continue_on_failure||!1,timeout:t.timeout||300};a.phases.push(h)}else a.phases=[...P.phases];return a.phases.length===0&&r.push("Config must have at least one phase"),r.length>0?{success:!1,config:a,errors:r}:{success:!0,config:a,errors:[],configPath:n}}function E(){return{...P,phases:P.phases.map(s=>({...s,config:{...s.config}})),output:{...P.output},qualityGate:{...P.qualityGate,thresholds:{...P.qualityGate.thresholds}}}}async function W(s,n,r,l){let a=Date.now(),e=[];if(!s.enabled)return{phase:s.name,type:s.type,status:"skipped",duration:0,exitCode:0,summary:"Phase disabled",artifacts:[]};try{let t={},i="passed",h="";switch(s.type){case"test":{let f=await n.kernel.getDomainAPIAsync("test-generation");if(!f)return A(s,a,"failed",1,"Test generation domain not available",e);let C=s.config.target||".",{walkSourceFiles:m}=await import("./file-discovery-XFSGQNM3.js"),w=p.resolve(C),v=m(w,{includeTests:!1}),y=await f.generateTests({sourceFiles:v,testType:s.config.type||"unit",framework:s.config.framework||"vitest",coverageTarget:80});if(y.success&&y.value){let g=y.value;t={testsGenerated:g.tests.length,coverageEstimate:g.coverageEstimate},h=`Generated ${g.tests.length} tests (est. ${g.coverageEstimate}% coverage)`;let d=p.join(r,"test-generation.json");I.writeFileSync(d,$(g),"utf-8"),e.push(d)}else i="failed",h=y.error?.message||"Test generation failed";break}case"coverage":{let f=await n.kernel.getDomainAPIAsync("coverage-analysis");if(!f)return A(s,a,"failed",1,"Coverage analysis domain not available",e);let C=s.config.target||".",m=s.config.threshold||80,{walkSourceFiles:w}=await import("./file-discovery-XFSGQNM3.js"),v=p.resolve(C),y=w(v,{includeTests:!1}),g=D(y),d=await f.analyze({coverageData:g,threshold:m,includeFileDetails:!0});if(d.success&&d.value){let b=d.value;t={...b.summary,meetsThreshold:b.meetsThreshold,threshold:m},i=b.meetsThreshold?"passed":"warning",h=`Line: ${b.summary.line}%, Branch: ${b.summary.branch}% \u2014 ${b.meetsThreshold?"meets":"below"} ${m}% threshold`;let q=p.join(r,"coverage.json");I.writeFileSync(q,$(d.value),"utf-8"),e.push(q)}else i="failed",h=d.error?.message||"Coverage analysis failed";break}case"security":{let f=await n.kernel.getDomainAPIAsync("security-compliance");if(!f)return A(s,a,"failed",1,"Security domain not available",e);let C=s.config.target||".",{walkSourceFiles:m}=await import("./file-discovery-XFSGQNM3.js"),w=p.resolve(C),v=m(w,{includeTests:!0}),y=await f.runSASTScan(v);if(y.success&&y.value){let g=y.value,d=g.vulnerabilities||[],b=d.filter(S=>S.severity==="high"||S.severity==="critical").length;t={vulnerabilities:d.length,high:b},i=b>0?"failed":d.length>0?"warning":"passed",h=d.length===0?"No vulnerabilities found":`${d.length} vulnerabilities (${b} high/critical)`;let{toSARIF:q}=await import("./ci-output-XYR2PSYH.js"),c=p.join(r,"security.sarif");I.writeFileSync(c,q({vulnerabilities:d,target:C,scanType:"SAST"}),"utf-8"),e.push(c);let u=p.join(r,"security.json");I.writeFileSync(u,$(g),"utf-8"),e.push(u)}else i="failed",h=y.error?.message||"Security scan failed";break}case"quality-gate":{let f=await n.kernel.getDomainAPIAsync("quality-assessment");if(!f)return A(s,a,"failed",1,"Quality assessment domain not available",e);let C=await f.evaluate({runGate:!0,includeAdvice:!0});if(C.success&&C.value){let m=C.value,w=m.passed??m.meetsThreshold??!0;t={passed:w,score:m.score||m.grade,checks:m.checks},i=w?"passed":"failed",h=`Quality gate: ${w?"PASSED":"FAILED"} (score: ${m.score||m.grade||"N/A"})`;let v=p.join(r,"quality-gate.json");I.writeFileSync(v,$(m),"utf-8"),e.push(v)}else i="failed",h=C.error?.message||"Quality gate evaluation failed";break}case"code-intelligence":{let f=await n.kernel.getDomainAPIAsync("code-intelligence");if(!f)return A(s,a,"failed",1,"Code intelligence domain not available",e);let C=s.config.target||".",{walkSourceFiles:m}=await import("./file-discovery-XFSGQNM3.js"),w=p.resolve(C),v=m(w,{includeTests:!1}),y=await f.index({paths:v,incremental:!0});if(y.success&&y.value){let g=y.value;t=g,h=`Indexed ${g.filesIndexed} files, ${g.nodesCreated} nodes`;let d=p.join(r,"code-intelligence.json");I.writeFileSync(d,$(g),"utf-8"),e.push(d)}else i="warning",h=y.error?.message||"Code intelligence indexing incomplete";break}default:h=`Custom phase "${s.name}" \u2014 no built-in handler`,i="warning"}let k=Date.now()-a;return{phase:s.name,type:s.type,status:i,duration:k,exitCode:i==="failed"?1:0,summary:h,artifacts:e,details:t}}catch(t){let i=Date.now()-a;return{phase:s.name,type:s.type,status:"failed",duration:i,exitCode:1,summary:`Error: ${t instanceof Error?t.message:String(t)}`,artifacts:e}}}function A(s,n,r,l,a,e){return{phase:s.name,type:s.type,status:r,duration:Date.now()-n,exitCode:l,summary:a,artifacts:e}}function _(s){let n=`# AQE CI/CD Report
3
+
4
+ `;n+=`**Status:** ${s.overallStatus==="passed"?"PASSED":s.overallStatus==="warning"?"WARNING":"FAILED"}
5
+ `,n+=`**Duration:** ${(s.duration/1e3).toFixed(1)}s
6
+ `,n+=`**Quality Gate:** ${s.qualityGatePassed?"Passed":"Failed"}
7
+
8
+ `,n+=`## Phases
9
+
10
+ `,n+=`| Phase | Type | Status | Duration | Summary |
11
+ `,n+=`|-------|------|--------|----------|---------|
12
+ `;for(let r of s.phases){let l=r.status==="passed"?"PASS":r.status==="failed"?"FAIL":r.status==="warning"?"WARN":"SKIP";n+=`| ${r.phase} | ${r.type} | ${l} | ${(r.duration/1e3).toFixed(1)}s | ${r.summary} |
13
+ `}n+=`
14
+ ## Artifacts
15
+
16
+ `;for(let r of s.phases)if(r.artifacts.length>0){n+=`### ${r.phase}
17
+ `;for(let l of r.artifacts)n+=`- \`${p.basename(l)}\`
18
+ `;n+=`
19
+ `}return n}function H(s,n,r){let l=new U("ci").description("CI/CD pipeline orchestration");return l.command("run").description("Execute CI pipeline from .aqe-ci.yml").option("-c, --config <path>","Path to .aqe-ci.yml config file").option("--phase <phases>","Run only specific phases (comma-separated)").option("--no-quality-gate","Skip quality gate enforcement").option("-F, --format <format>","Output format (text|json|markdown)","text").option("-o, --output <path>","Write combined report to file").action(async a=>{if(await r())try{let e,t=null;if(a.config){let c=T(p.resolve(a.config));if(!c.success){console.error(o.red(`
20
+ Config errors:`));for(let u of c.errors)console.error(o.red(` - ${u}`));await n(1);return}e=c.config,t=a.config}else if(t=G(),t){let c=T(t);if(!c.success){console.error(o.red(`
21
+ Config errors:`));for(let u of c.errors)console.error(o.red(` - ${u}`));await n(1);return}e=c.config}else e=E(),t="(defaults)";if(a.phase){let c=a.phase.split(",").map(u=>u.trim().toLowerCase());e.phases=e.phases.filter(u=>c.includes(u.name.toLowerCase())||c.includes(u.type))}a.qualityGate===!1&&(e.qualityGate.enforced=!1);let i=a.format,h=new Date;i==="text"&&(console.log(o.blue(`
22
+ AQE CI Pipeline
23
+ `)),console.log(o.gray(` Config: ${t}`)),console.log(o.gray(` Phases: ${e.phases.length}`)),console.log(o.gray(` Quality Gate: ${e.qualityGate.enforced?"enforced":"advisory"}
24
+ `)));let k=p.resolve(e.output.directory);I.mkdirSync(k,{recursive:!0});let f=[],C=!1;for(let c of e.phases){if(i==="text"){let S=` [${f.length+1}/${e.phases.length}] ${c.name}...`;process.stdout.write(o.cyan(S))}let u=await W(c,s,k,e.output.format);if(f.push(u),i==="text"){let S=u.status==="passed"?o.green:u.status==="failed"?o.red:u.status==="warning"?o.yellow:o.gray,O=u.status.toUpperCase(),L=`${(u.duration/1e3).toFixed(1)}s`;process.stdout.write(`\r [${f.length}/${e.phases.length}] ${c.name} ${S(O)} (${L})
25
+ `),u.summary&&console.log(o.gray(` ${u.summary}`))}if(u.status==="failed"&&(C=!0,!c.continueOnFailure)){i==="text"&&console.log(o.red(`
26
+ Pipeline stopped: "${c.name}" failed (continue_on_failure: false)
27
+ `));break}}let m=f.some(c=>c.status==="failed"),w=f.some(c=>c.status==="warning"),v=f.find(c=>c.type==="quality-gate"),y=!e.qualityGate.enforced||!v||v.status==="passed",g=m||!y?"failed":w?"warning":"passed",d=new Date,b=d.getTime()-h.getTime(),q={config:t||"(defaults)",startedAt:h,completedAt:d,duration:b,phases:f,qualityGatePassed:y,overallStatus:g,exitCode:g==="failed"?1:0};if(e.output.combinedReport){let c=p.join(k,"ci-report.md");I.writeFileSync(c,_(q),"utf-8");let u=p.join(k,"ci-report.json");I.writeFileSync(u,$(q),"utf-8")}if(i==="json")x($(q),a.output);else if(i==="markdown")x(_(q),a.output);else{console.log("");let c=g==="passed"?o.green:g==="failed"?o.red:o.yellow;console.log(` ${c(`Pipeline: ${g.toUpperCase()}`)} (${(b/1e3).toFixed(1)}s)`),console.log(` Quality Gate: ${y?o.green("PASSED"):o.red("FAILED")}`),console.log(o.gray(` Artifacts: ${k}/`)),console.log("")}await n(q.exitCode)}catch(e){console.error(o.red(`
28
+ CI pipeline failed:`),e),await n(1)}}),l.command("init").description("Create a .aqe-ci.yml config file").option("--force","Overwrite existing config").action(async a=>{let e=G();if(e&&!a.force){console.log(o.yellow(`
29
+ Config already exists: ${e}`)),console.log(o.gray(` Use --force to overwrite
30
+ `)),await n(0);return}let t=`# AQE CI/CD Pipeline Configuration
31
+ # Documentation: https://github.com/proffesor-for-testing/agentic-qe
32
+
33
+ version: '1'
34
+ name: ${p.basename(process.cwd())}
35
+
36
+ phases:
37
+ - name: Test Generation
38
+ type: test
39
+ config:
40
+ target: .
41
+ framework: vitest
42
+ type: unit
43
+ timeout: 300
44
+
45
+ - name: Coverage Analysis
46
+ type: coverage
47
+ continue_on_failure: true
48
+ config:
49
+ target: .
50
+ threshold: 80
51
+ timeout: 300
52
+
53
+ - name: Security Scan
54
+ type: security
55
+ continue_on_failure: true
56
+ config:
57
+ sast: true
58
+ timeout: 300
59
+
60
+ - name: Quality Gate
61
+ type: quality-gate
62
+ timeout: 60
63
+
64
+ output:
65
+ format: json
66
+ directory: .aqe-ci-output
67
+ combined_report: true
68
+
69
+ quality_gate:
70
+ enforced: true
71
+ thresholds:
72
+ coverage: 80
73
+ security: medium
74
+ quality: 70
75
+ `,i=p.join(process.cwd(),".aqe-ci.yml");I.writeFileSync(i,t,"utf-8"),console.log(o.green(`
76
+ Created: ${i}`)),console.log(o.gray(" Edit the file to customize your CI pipeline")),console.log(o.gray(` Run: aqe ci run
77
+ `)),await n(0)}),l.command("validate").description("Validate .aqe-ci.yml config").option("-c, --config <path>","Path to config file").action(async a=>{let e=a.config?p.resolve(a.config):G();if(!e){console.log(o.red(`
78
+ No .aqe-ci.yml found`)),console.log(o.gray(` Run: aqe ci init
79
+ `)),await n(1);return}let t=T(e);if(t.success){console.log(o.green(`
80
+ Config valid: ${e}`)),console.log(o.gray(` Phases: ${t.config.phases.length}`));for(let i of t.config.phases){let h=i.enabled?o.green("*"):o.gray("o");console.log(` ${h} ${i.name} (${i.type})`)}console.log(o.gray(` Quality Gate: ${t.config.qualityGate.enforced?"enforced":"advisory"}`)),console.log(""),await n(0)}else{console.log(o.red(`
81
+ Config invalid: ${e}`));for(let i of t.errors)console.log(o.red(` - ${i}`));console.log(""),await n(1)}}),l}export{H as createCICommand};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-D55PSO5D.js";import"./chunk-UZZCWWIG.js";export{a as FORMAT_OPTION,b as OUTPUT_OPTION,g as coverageToMarkdown,h as qualityGateToMarkdown,i as securityToMarkdown,j as testRunToMarkdown,d as toJSON,f as toJUnit,e as toSARIF,c as writeOutput};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{b as p}from"./chunk-B2I7BJLL.js";import{b as f,d as h}from"./chunk-JSOBRKMA.js";import{a as c,c as b}from"./chunk-UN4PA4M2.js";import{a as v}from"./chunk-UZZCWWIG.js";h();b();import{existsSync as u,writeFileSync as g,readFileSync as m}from"node:fs";import{join as a}from"node:path";import{execSync as C}from"node:child_process";async function y(t,e){let o=p(t);if(e&&o.available&&console.log(`[ClaudeFlow] Detected via ${o.method}${o.version?`: v${o.version}`:""}`),!o.available)return{available:!1};let n={"mcp-config":"mcp","local-binary":"cli","npx-cached":"cli","npm-dependency":"npm"};return{available:!0,version:o.version,method:o.method?n[o.method]:void 0}}async function F(t){return{trajectories:!0,modelRouting:!0,pretrain:!0,workers:!0,patternSearch:!0}}function S(t,e){return{version:"1.0",projectRoot:t,integration:{enabled:!0,features:{trajectories:e.trajectories,modelRouting:e.modelRouting,pretrain:e.pretrain,workers:e.workers}},learning:{trajectoryStorage:e.trajectories?"claude-flow":"local",patternSearch:e.patternSearch?"claude-flow":"local"},routing:{modelRouting:e.modelRouting?"claude-flow":"rule-based",preferences:{simple:"haiku",standard:"sonnet",complex:"opus"}},pretrain:{enabled:e.pretrain,depth:"medium",autoRun:!0},workers:{enabled:e.workers,autoDispatch:["optimize","consolidate"]}}}function R(t){let e=a(t,".claude","settings.json"),o={};if(u(e))try{o=f(m(e,"utf-8"))}catch{}o.mcpServers||(o.mcpServers={});let n=o.mcpServers;!n.ruflo&&!n["claude-flow"]&&(n.ruflo={command:"npx",args:["ruflo@3.5.18","mcp"],env:{}}),g(e,JSON.stringify(o,null,2))}async function j(t,e){try{e&&console.log("[ClaudeFlow] Running pretrain analysis..."),C("npx --no-install ruflo hooks pretrain --depth medium",{encoding:"utf-8",timeout:12e4,cwd:t,stdio:["pipe","pipe","pipe"]}),e&&console.log("[ClaudeFlow] Pretrain analysis complete")}catch(o){e&&console.log("[ClaudeFlow] Pretrain analysis skipped:",c(o))}}async function D(t){let{projectRoot:e,force:o,checkOnly:n,debug:s}=t,r=await y(e,s);if(!r.available&&!o)return{available:!1,features:{trajectories:!1,modelRouting:!1,pretrain:!1,workers:!1,patternSearch:!1}};let i=await F(e);if(n)return{available:r.available,version:r.version,features:i};let w=a(e,".agentic-qe"),d=a(w,"claude-flow-integration.json");try{let l=S(e,i);g(d,JSON.stringify(l,null,2)),s&&console.log(`[ClaudeFlow] Config written to: ${d}`)}catch(l){return{available:r.available,version:r.version,features:i,error:`Failed to write config: ${c(l)}`}}try{R(e)}catch(l){s&&console.log("[ClaudeFlow] MCP config update failed:",c(l))}return i.pretrain&&await j(e,s),{available:!0,version:r.version,features:i,configPath:d}}function J(t){let e=a(t,".agentic-qe","claude-flow-integration.json");return u(e)}function N(t){let e=a(t,".agentic-qe","claude-flow-integration.json");if(!u(e))return null;try{return f(m(e,"utf-8"))}catch{return null}}function I(t){let e=a(t,".agentic-qe","claude-flow-integration.json");if(u(e))try{return v("node:fs").rmSync(e),!0}catch{return!1}return!0}export{N as getClaudeFlowConfig,J as isClaudeFlowConfigured,I as removeClaudeFlowIntegration,D as setupClaudeFlowIntegration};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{c as a,d as b,e as c}from"./chunk-XE2YAYU5.js";import"./chunk-3JESHZQM.js";import"./chunk-UN4PA4M2.js";import"./chunk-UZZCWWIG.js";c();export{a as VibiumClientImpl,b as VibiumClientProvider};
@@ -0,0 +1,4 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{b as p}from"./chunk-UBKK7KCR.js";import{a as f,c as v}from"./chunk-UN4PA4M2.js";import"./chunk-UZZCWWIG.js";v();import{existsSync as s,mkdirSync as m,readFileSync as u,writeFileSync as a}from"fs";import{join as h,dirname as d}from"path";var l=class{projectRoot;overwrite;generator;constructor(r){this.projectRoot=r.projectRoot,this.overwrite=r.overwrite??!1,this.generator=p()}async install(){let r={success:!0,mcpConfigured:!1,modeInstalled:!1,errors:[],configPath:"",modePath:""};try{let t=this.generator.generateMcpConfig("cline"),e=h(this.projectRoot,t.path);if(r.configPath=e,!s(e)||this.overwrite){let o=d(e);if(s(o)||m(o,{recursive:!0}),s(e)&&this.overwrite){let c=this.mergeExistingConfig(e,t.content);a(e,c)}else a(e,t.content);r.mcpConfigured=!0}let n=this.generator.generateBehavioralRules("cline"),i=h(this.projectRoot,n.path);if(r.modePath=i,!s(i)||this.overwrite){let o=d(i);if(s(o)||m(o,{recursive:!0}),s(i)&&this.overwrite){let c=this.mergeExistingModes(i,n.content);a(i,c)}else a(i,n.content);r.modeInstalled=!0}}catch(t){r.success=!1,r.errors.push(`Cline installation failed: ${f(t)}`)}return r}mergeExistingConfig(r,t){try{let e=JSON.parse(u(r,"utf-8")),n=JSON.parse(t);return e.mcpServers||(e.mcpServers={}),Object.assign(e.mcpServers,n.mcpServers),JSON.stringify(e,null,2)+`
3
+ `}catch{return t}}mergeExistingModes(r,t){try{let e=JSON.parse(u(r,"utf-8")),n=JSON.parse(t);if(!Array.isArray(e))return t;let i=e.filter(o=>o.slug!=="qe-engineer");return i.push(...n),JSON.stringify(i,null,2)+`
4
+ `}catch{return t}}};function x(g){return new l(g)}export{l as ClineInstaller,x as createClineInstaller};