agentic-qe 3.9.5 → 3.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +56 -0
  3. package/dist/cli/bundle.js +5 -5
  4. package/dist/cli/chunks/adapter-GE3RSG32.js +2 -0
  5. package/dist/cli/chunks/{agent-booster-wasm-AW36VJXL.js → agent-booster-wasm-MXTWTD4D.js} +2 -2
  6. package/dist/cli/chunks/{agent-handler-AQFW2CMW.js → agent-handler-6NEP2BOA.js} +2 -2
  7. package/dist/cli/chunks/{agent-memory-branch-VA6A47U5.js → agent-memory-branch-SAPEIGE2.js} +2 -2
  8. package/dist/cli/chunks/aqe-learning-engine-IYL6TK6E.js +2 -0
  9. package/dist/cli/chunks/{audit-WVJHTVUU.js → audit-53LCI6R3.js} +2 -2
  10. package/dist/cli/chunks/base-L3G3GEZY.js +2 -0
  11. package/dist/cli/chunks/{better-sqlite3-HCMGVEDO.js → better-sqlite3-UZSKFGCK.js} +2 -2
  12. package/dist/cli/chunks/{brain-handler-JZISBH2W.js → brain-handler-67NDDXVO.js} +3 -3
  13. package/dist/cli/chunks/{branch-enumerator-3TQXIETD.js → branch-enumerator-IUIGYEK5.js} +2 -2
  14. package/dist/cli/chunks/{browser-4GZXU4YT.js → browser-UFUF65LQ.js} +2 -2
  15. package/dist/cli/chunks/browser-workflow-7KTCY5FI.js +2 -0
  16. package/dist/cli/chunks/{chunk-QPW2O5TR.js → chunk-2SJQ3CYN.js} +9 -9
  17. package/dist/cli/chunks/{chunk-WTGUS7DD.js → chunk-2TRWUJWG.js} +2 -2
  18. package/dist/cli/chunks/{chunk-3VNEMHOO.js → chunk-3DXO5CWI.js} +1 -1
  19. package/dist/cli/chunks/{chunk-QHMDETCU.js → chunk-3KX7CQEM.js} +1 -1
  20. package/dist/cli/chunks/{chunk-LPVQ6QCW.js → chunk-426OO3RH.js} +2 -2
  21. package/dist/cli/chunks/{chunk-NNNH36RU.js → chunk-4B5IYFKE.js} +2 -2
  22. package/dist/cli/chunks/{chunk-GFZRXQWH.js → chunk-4NHE7AJE.js} +1 -1
  23. package/dist/cli/chunks/{chunk-KWIDDPKG.js → chunk-52MUZGZF.js} +2 -2
  24. package/dist/cli/chunks/{chunk-73LG5ELL.js → chunk-5EOM3W6Q.js} +2 -2
  25. package/dist/cli/chunks/{chunk-N66G743A.js → chunk-6MMRZYYS.js} +3 -3
  26. package/dist/cli/chunks/{chunk-OQCEI7Q4.js → chunk-6OKXGDT3.js} +2 -2
  27. package/dist/cli/chunks/{chunk-YGZBS4RW.js → chunk-6ULPQTIE.js} +2 -2
  28. package/dist/cli/chunks/{chunk-DPEX4UOC.js → chunk-7GPYOMVY.js} +1 -1
  29. package/dist/cli/chunks/{chunk-YHSIUFFY.js → chunk-7OPVTN5W.js} +2 -2
  30. package/dist/cli/chunks/{chunk-4FPCCKNQ.js → chunk-7TKZ6LK6.js} +1 -1
  31. package/dist/cli/chunks/{chunk-TRRJP27A.js → chunk-A5VULTCD.js} +1 -1
  32. package/dist/cli/chunks/{chunk-E55RROAP.js → chunk-AHB2F42G.js} +1 -1
  33. package/dist/cli/chunks/{chunk-3KYKE7B6.js → chunk-APPVAGD5.js} +1 -1
  34. package/dist/cli/chunks/{chunk-7JQOOPA2.js → chunk-AT6LBLUV.js} +2 -2
  35. package/dist/cli/chunks/{chunk-ERV3OVUG.js → chunk-BJKRAFS2.js} +2 -2
  36. package/dist/cli/chunks/{chunk-OPOTKH42.js → chunk-BPYWDM2Y.js} +3 -3
  37. package/dist/cli/chunks/{chunk-BM7VSJTE.js → chunk-BTZEKSWH.js} +2 -2
  38. package/dist/cli/chunks/{chunk-4EOSDCDM.js → chunk-BWNH22V2.js} +1 -1
  39. package/dist/cli/chunks/{chunk-ITIYGUIL.js → chunk-CDFYF33M.js} +2 -2
  40. package/dist/cli/chunks/{chunk-NDWWN2YC.js → chunk-D2C4XNF5.js} +4 -4
  41. package/dist/cli/chunks/{chunk-NGP3DRFU.js → chunk-D3KORDD5.js} +1 -1
  42. package/dist/cli/chunks/{chunk-YZ3WB4TN.js → chunk-DKBXIBRS.js} +2 -2
  43. package/dist/cli/chunks/{chunk-WV7K5A7J.js → chunk-DL46KSFX.js} +2 -2
  44. package/dist/cli/chunks/{chunk-HA4COQ66.js → chunk-DS3XAGGL.js} +2 -2
  45. package/dist/cli/chunks/{chunk-I4HGIQC2.js → chunk-ECRYU5XG.js} +2 -2
  46. package/dist/cli/chunks/{chunk-KCQ2GFRN.js → chunk-EFHR7LML.js} +2 -2
  47. package/dist/cli/chunks/{chunk-3UFAEGSS.js → chunk-EIGXGMOR.js} +1 -1
  48. package/dist/cli/chunks/{chunk-GSTDQLXR.js → chunk-EL2WLSUI.js} +2 -2
  49. package/dist/cli/chunks/{chunk-OTOQXMP6.js → chunk-FBVEHGNE.js} +3 -3
  50. package/dist/cli/chunks/{chunk-53J3R7PZ.js → chunk-FHBIJBZ3.js} +2 -2
  51. package/dist/cli/chunks/{chunk-DSOEKRQL.js → chunk-FJEIX3IS.js} +2 -2
  52. package/dist/cli/chunks/{chunk-Y6XYH7EV.js → chunk-FKJ4XZ6E.js} +2 -2
  53. package/dist/cli/chunks/{chunk-35DP6LX6.js → chunk-FOCGOVIM.js} +2 -2
  54. package/dist/cli/chunks/{chunk-3QH67ZYC.js → chunk-GGPGY5QT.js} +2 -2
  55. package/dist/cli/chunks/{chunk-3UE5GART.js → chunk-GOG6L2F7.js} +2 -2
  56. package/dist/cli/chunks/chunk-HE5VY2BI.js +2 -0
  57. package/dist/cli/chunks/{chunk-55EAFHVH.js → chunk-HEENVPYF.js} +3 -3
  58. package/dist/cli/chunks/{chunk-45WEXMKC.js → chunk-HFPT7QXQ.js} +2 -2
  59. package/dist/cli/chunks/{chunk-6FM5DJHR.js → chunk-HVJXXGB4.js} +4 -4
  60. package/dist/cli/chunks/{chunk-FDFJHGRZ.js → chunk-HWDE4RB3.js} +2 -2
  61. package/dist/cli/chunks/{chunk-5NBYV7FL.js → chunk-INJPS7RF.js} +1 -1
  62. package/dist/cli/chunks/{chunk-GFXAKQ77.js → chunk-IQLFWO5U.js} +2 -2
  63. package/dist/cli/chunks/{chunk-3DGO7NJK.js → chunk-JJSJSQNJ.js} +1 -1
  64. package/dist/cli/chunks/{chunk-PTAUZ3XL.js → chunk-JNEG6DKU.js} +1 -1
  65. package/dist/cli/chunks/{chunk-HT5EZYPZ.js → chunk-JRHKFRUB.js} +2 -2
  66. package/dist/cli/chunks/{chunk-UPFCV7MX.js → chunk-JZYCZMHN.js} +2 -2
  67. package/dist/cli/chunks/{chunk-UO2R7ZN3.js → chunk-KHEAWN23.js} +2 -2
  68. package/dist/cli/chunks/{chunk-6VB4VZCR.js → chunk-KHH5UJXY.js} +2 -2
  69. package/dist/cli/chunks/{chunk-BYD54ZUF.js → chunk-KLLHSXIC.js} +2 -2
  70. package/dist/cli/chunks/{chunk-6QKGLIIY.js → chunk-KO5HO6MY.js} +2 -2
  71. package/dist/cli/chunks/{chunk-ZFCRDCHW.js → chunk-KZSZHP32.js} +2 -2
  72. package/dist/cli/chunks/{chunk-MRTDOSHR.js → chunk-LHGZRKPO.js} +2 -2
  73. package/dist/cli/chunks/{chunk-YQTPEQO6.js → chunk-LP6EQI2P.js} +2 -2
  74. package/dist/cli/chunks/{chunk-6QR7GSNJ.js → chunk-LPLCT2HH.js} +2 -2
  75. package/dist/cli/chunks/{chunk-WIZOYPFT.js → chunk-LZ34CKYE.js} +2 -2
  76. package/dist/cli/chunks/{chunk-MYIDAWGQ.js → chunk-MR7V7QVL.js} +2 -2
  77. package/dist/cli/chunks/{chunk-ZWS7J73Q.js → chunk-MUEFXLGX.js} +1 -1
  78. package/dist/cli/chunks/chunk-N5SLJOBK.js +2 -0
  79. package/dist/cli/chunks/{chunk-T4KMG3GJ.js → chunk-NJ5IC6ZR.js} +1 -1
  80. package/dist/cli/chunks/{chunk-TRPCOY3C.js → chunk-NKX2Z546.js} +1 -1
  81. package/dist/cli/chunks/{chunk-YHKJYBWK.js → chunk-OURDPRGM.js} +1 -1
  82. package/dist/cli/chunks/{chunk-ZP237D7K.js → chunk-PFTR6XAO.js} +2 -2
  83. package/dist/cli/chunks/{chunk-ZD2FS4Q7.js → chunk-PHBE2VBN.js} +2 -2
  84. package/dist/cli/chunks/{chunk-ZJWDWM6B.js → chunk-PMZJ54WX.js} +3 -3
  85. package/dist/cli/chunks/{chunk-MBXSHGDD.js → chunk-QI5VGEKC.js} +2 -2
  86. package/dist/cli/chunks/{chunk-TSA5MUTQ.js → chunk-QKJ4LUAM.js} +2 -2
  87. package/dist/cli/chunks/{chunk-REXMKRR2.js → chunk-RGJ4RMUR.js} +8 -8
  88. package/dist/cli/chunks/{chunk-CGYTM7AB.js → chunk-SIIYQLKH.js} +2 -2
  89. package/dist/cli/chunks/{chunk-TRO45ZLC.js → chunk-SMKRBNO7.js} +1 -1
  90. package/dist/cli/chunks/{chunk-MO3IIM7L.js → chunk-SP3X35XC.js} +1 -1
  91. package/dist/cli/chunks/{chunk-KQ7VBUO4.js → chunk-SQQ57TSJ.js} +2 -2
  92. package/dist/cli/chunks/{chunk-TUMXWCB7.js → chunk-SQZ3H6WR.js} +3 -3
  93. package/dist/cli/chunks/{chunk-ALX5RJSR.js → chunk-STASZVMY.js} +2 -2
  94. package/dist/cli/chunks/{chunk-CGYOMD6X.js → chunk-SURZYSSL.js} +1 -1
  95. package/dist/cli/chunks/{chunk-74YG34UH.js → chunk-T7R5NXJW.js} +2 -2
  96. package/dist/cli/chunks/{chunk-YDBMYTOV.js → chunk-TD2WOW75.js} +2 -2
  97. package/dist/cli/chunks/{chunk-XG2JAIQT.js → chunk-TLTRL32T.js} +1 -1
  98. package/dist/cli/chunks/{chunk-KUDPFLL4.js → chunk-TT2YXNHH.js} +4 -4
  99. package/dist/cli/chunks/{chunk-IMCYFQWF.js → chunk-UDBSEFUT.js} +2 -2
  100. package/dist/cli/chunks/{chunk-GHFXURNS.js → chunk-UEFAPTBV.js} +1 -1
  101. package/dist/cli/chunks/{chunk-PGFHFPDP.js → chunk-URBXUDY3.js} +2 -2
  102. package/dist/cli/chunks/{chunk-EPH2GZQM.js → chunk-UXCEJ3AV.js} +2 -2
  103. package/dist/cli/chunks/{chunk-PVLOT5BL.js → chunk-VAKJOTGU.js} +2 -2
  104. package/dist/cli/chunks/{chunk-VKT4STAE.js → chunk-VMWLVRJO.js} +2 -2
  105. package/dist/cli/chunks/{chunk-S4F3CNSP.js → chunk-W4HUWBPK.js} +2 -2
  106. package/dist/cli/chunks/{chunk-IHXDXFUX.js → chunk-W4Y4GFRB.js} +1 -1
  107. package/dist/cli/chunks/{chunk-J4SEGMXL.js → chunk-WAP7ROO5.js} +2 -2
  108. package/dist/cli/chunks/{chunk-CNGRXBKO.js → chunk-WLYSZV5U.js} +2 -2
  109. package/dist/cli/chunks/{chunk-CQT3IEEX.js → chunk-WS4OVAWU.js} +2 -2
  110. package/dist/cli/chunks/{chunk-2XJRSIM5.js → chunk-WV3R5JFE.js} +2 -2
  111. package/dist/cli/chunks/{chunk-673PL3DG.js → chunk-XB2GVTY6.js} +1 -1
  112. package/dist/cli/chunks/{chunk-IMGRYCAT.js → chunk-XD4UFF2Y.js} +1 -1
  113. package/dist/cli/chunks/{chunk-BQUN2NB4.js → chunk-XOHRM3M7.js} +3 -3
  114. package/dist/cli/chunks/{chunk-G7XBTBM7.js → chunk-XY5FMZRA.js} +2 -2
  115. package/dist/cli/chunks/{chunk-NHIQ5HP3.js → chunk-YHZWNT45.js} +2 -2
  116. package/dist/cli/chunks/{chunk-W73AYMDP.js → chunk-YIVZ5Z4V.js} +1 -1
  117. package/dist/cli/chunks/{chunk-4QGNSNQL.js → chunk-YR5ZNQT2.js} +2 -2
  118. package/dist/cli/chunks/{chunk-X6J7VYVD.js → chunk-YTF5G3RQ.js} +2 -2
  119. package/dist/cli/chunks/{chunk-JUBICWL2.js → chunk-YV2PVXJE.js} +1 -1
  120. package/dist/cli/chunks/{chunk-6AMXWB6Y.js → chunk-ZEFDSMF4.js} +2 -2
  121. package/dist/cli/chunks/{chunk-JYJXVTUP.js → chunk-ZETZATNY.js} +2 -2
  122. package/dist/cli/chunks/{chunk-LLXBL36X.js → chunk-ZLQYGO6N.js} +1 -1
  123. package/dist/cli/chunks/{chunk-DFOANC7Z.js → chunk-ZSXSUUBS.js} +1 -1
  124. package/dist/cli/chunks/{chunk-BNYHBEDE.js → chunk-ZV7FGZNJ.js} +2 -2
  125. package/dist/cli/chunks/{chunk-I27OTSC7.js → chunk-ZWAJV4SN.js} +2 -2
  126. package/dist/cli/chunks/{ci-3ATT6NMC.js → ci-F4F3SDHP.js} +2 -2
  127. package/dist/cli/chunks/{ci-output-2JR3J753.js → ci-output-4SUMOQGO.js} +2 -2
  128. package/dist/cli/chunks/{claude-flow-setup-SG2BSEED.js → claude-flow-setup-NKXPDFMJ.js} +2 -2
  129. package/dist/cli/chunks/client-3DPPDO2H.js +2 -0
  130. package/dist/cli/chunks/{cline-installer-A26SXDX6.js → cline-installer-3FMNXEKM.js} +2 -2
  131. package/dist/cli/chunks/{code-WIXKPGAQ.js → code-5QEDZNKI.js} +2 -2
  132. package/dist/cli/chunks/{code-index-extractor-W2NO6MR3.js → code-index-extractor-RD5EAOLE.js} +2 -2
  133. package/dist/cli/chunks/{codex-installer-VBSJHXI4.js → codex-installer-UU4O2FIE.js} +2 -2
  134. package/dist/cli/chunks/{completions-JFXIUS2V.js → completions-CS6RJLYZ.js} +2 -2
  135. package/dist/cli/chunks/{complexity-analyzer-GPO4ZAIZ.js → complexity-analyzer-U4DE2QTP.js} +2 -2
  136. package/dist/cli/chunks/{continuedev-installer-OULSFVLB.js → continuedev-installer-E55EG2TB.js} +2 -2
  137. package/dist/cli/chunks/{copilot-installer-QS7EG5DW.js → copilot-installer-TVJUX3AZ.js} +2 -2
  138. package/dist/cli/chunks/{cost-tracker-D7LNB633.js → cost-tracker-IAKDLDJH.js} +2 -2
  139. package/dist/cli/chunks/{coverage-YUQ4MQYK.js → coverage-LX7UIEKV.js} +3 -3
  140. package/dist/cli/chunks/cross-domain-router-JOYTUBFT.js +2 -0
  141. package/dist/cli/chunks/{cursor-installer-UOZGHZHD.js → cursor-installer-2NJ7MK23.js} +2 -2
  142. package/dist/cli/chunks/{daemon-27TMWDPY.js → daemon-T4CPOFHM.js} +3 -3
  143. package/dist/cli/chunks/{dag-attention-scheduler-PVAFQBDL.js → dag-attention-scheduler-GAPYYUHZ.js} +2 -2
  144. package/dist/cli/chunks/{detect-FUKMZ37Y.js → detect-RU5LBCCI.js} +2 -2
  145. package/dist/cli/chunks/{domain-handler-SP3QB5VN.js → domain-handler-LKPDVPF6.js} +2 -2
  146. package/dist/cli/chunks/{domain-transfer-A2WL6HEJ.js → domain-transfer-Q76ITWBK.js} +2 -2
  147. package/dist/cli/chunks/dream-IF2HCRW4.js +2 -0
  148. package/dist/cli/chunks/esm-node-LNRP5BNU.js +2 -0
  149. package/dist/cli/chunks/{eval-6MIZUXEO.js → eval-TFFIZGTW.js} +2 -2
  150. package/dist/cli/chunks/{fast-paths-XT542LOU.js → fast-paths-V6KA3VWH.js} +2 -2
  151. package/dist/cli/chunks/{feature-flags-WBF5B6WE.js → feature-flags-DWS4XL2P.js} +2 -2
  152. package/dist/cli/chunks/{feature-flags-NWACCWCB.js → feature-flags-MYSY53UU.js} +2 -2
  153. package/dist/cli/chunks/{file-discovery-GKCJFWTD.js → file-discovery-AMKZRFLT.js} +2 -2
  154. package/dist/cli/chunks/{fleet-V2MKGNMG.js → fleet-B2BJFKEV.js} +3 -3
  155. package/dist/cli/chunks/{gnn-wrapper-HUUMTTSV.js → gnn-wrapper-SOJHQ7VC.js} +2 -2
  156. package/dist/cli/chunks/{heartbeat-handler-UY3TCEN7.js → heartbeat-handler-O7FF6NRE.js} +4 -4
  157. package/dist/cli/chunks/{heartbeat-scheduler-YWXPSCH2.js → heartbeat-scheduler-WOGW5R7J.js} +2 -2
  158. package/dist/cli/chunks/hnsw-adapter-UPX4AXOQ.js +2 -0
  159. package/dist/cli/chunks/hnsw-index-CSI2EXXR.js +2 -0
  160. package/dist/cli/chunks/{hnsw-legacy-bridge-IYYYSRK5.js → hnsw-legacy-bridge-CC5YS47X.js} +2 -2
  161. package/dist/cli/chunks/{hnswlib-node-WDWAE74R.js → hnswlib-node-FTWYRETS.js} +2 -2
  162. package/dist/cli/chunks/{hooks-DTBJK6LL.js → hooks-ETOFFBMV.js} +6 -6
  163. package/dist/cli/chunks/{hypergraph-engine-K47IBQNO.js → hypergraph-engine-FGAHFWFO.js} +2 -2
  164. package/dist/cli/chunks/{hypergraph-handler-2NDPG2N4.js → hypergraph-handler-GNWJD7E3.js} +3 -3
  165. package/dist/cli/chunks/impact-analyzer-2YVBHMES.js +2 -0
  166. package/dist/cli/chunks/init-handler-BEYOLKQO.js +69 -0
  167. package/dist/cli/chunks/init-wizard-V6GZQMMR.js +2 -0
  168. package/dist/cli/chunks/kernel-EHJ4SP2Y.js +2 -0
  169. package/dist/cli/chunks/{kilocode-installer-XZAHWQEA.js → kilocode-installer-ED6LYSEM.js} +2 -2
  170. package/dist/cli/chunks/{kiro-installer-53C7DXEF.js → kiro-installer-NG77T5YR.js} +2 -2
  171. package/dist/cli/chunks/knowledge-graph-ZYXBWGKL.js +2 -0
  172. package/dist/cli/chunks/{learning-XYW2EEVX.js → learning-P3WY3LTI.js} +3 -3
  173. package/dist/cli/chunks/{llm-router-64SKMJ7B.js → llm-router-ETSFMOWS.js} +2 -2
  174. package/dist/cli/chunks/{load-HVL4O7EY.js → load-PP3GVQT7.js} +2 -2
  175. package/dist/cli/chunks/load-test-VDZEYGKV.js +2 -0
  176. package/dist/cli/chunks/{mcp-4H2NJ3EO.js → mcp-B2VX7EKL.js} +2 -2
  177. package/dist/cli/chunks/{memory-2CD4BAJK.js → memory-SBZQ6MZ4.js} +5 -5
  178. package/dist/cli/chunks/memory-backend-IB3BU4VM.js +2 -0
  179. package/dist/cli/chunks/{memory-handlers-XRYZBE5I.js → memory-handlers-5RMGG2CR.js} +2 -2
  180. package/dist/cli/chunks/{opencode-installer-I23QAZC6.js → opencode-installer-PIDIFO2L.js} +2 -2
  181. package/dist/cli/chunks/orchestrator-FSGUODZI.js +373 -0
  182. package/dist/cli/chunks/{pipeline-7UN7LP6B.js → pipeline-BQ5MWZPT.js} +2 -2
  183. package/dist/cli/chunks/{platform-P44YUHPK.js → platform-6EJK4QMD.js} +2 -2
  184. package/dist/cli/chunks/{plugin-YWYR7FKS.js → plugin-EDGOMUJY.js} +2 -2
  185. package/dist/cli/chunks/{prime-radiant-advanced-wasm-A7CDGUK6.js → prime-radiant-advanced-wasm-4S6FYKPP.js} +2 -2
  186. package/dist/cli/chunks/protocol-executor-H2ZG7JBJ.js +2 -0
  187. package/dist/cli/chunks/{protocol-handler-BM7RLC4Z.js → protocol-handler-ETM7PMQU.js} +2 -2
  188. package/dist/cli/chunks/{prove-UVBYODRV.js → prove-YUBORZAP.js} +2 -2
  189. package/dist/cli/chunks/qe-reasoning-bank-ZCSHSKZU.js +2 -0
  190. package/dist/cli/chunks/{quality-4L42LN5Q.js → quality-XPZDC5FJ.js} +2 -2
  191. package/dist/cli/chunks/queen-coordinator-NEC373VS.js +2 -0
  192. package/dist/cli/chunks/{real-embeddings-4CYZTWHT.js → real-embeddings-KTDUTUJL.js} +2 -2
  193. package/dist/cli/chunks/{roocode-installer-UOSJS7KT.js → roocode-installer-WADVKI3P.js} +2 -2
  194. package/dist/cli/chunks/router-3PP5XRTD.js +2 -0
  195. package/dist/cli/chunks/routing-feedback-JNUFV2X3.js +2 -0
  196. package/dist/cli/chunks/{routing-handler-43G4D5UP.js → routing-handler-OOPOYHEV.js} +2 -2
  197. package/dist/cli/chunks/ruvector-commands-UPEZL4OK.js +8 -0
  198. package/dist/cli/chunks/{rvf-dual-writer-USU2IWO7.js → rvf-dual-writer-TOBBCJ7K.js} +2 -2
  199. package/dist/cli/chunks/{rvf-migration-adapter-DZMYVJJY.js → rvf-migration-adapter-U7UM2U36.js} +2 -2
  200. package/dist/cli/chunks/{rvf-migration-coordinator-AZ5JDT33.js → rvf-migration-coordinator-CUX3EU2X.js} +2 -2
  201. package/dist/cli/chunks/rvf-native-adapter-PTOZXG4W.js +2 -0
  202. package/dist/cli/chunks/safe-db-CGYNYUES.js +2 -0
  203. package/dist/cli/chunks/schedule-NRN4WOHX.js +2 -0
  204. package/dist/cli/chunks/scheduler-DRAQGYLL.js +2 -0
  205. package/dist/cli/chunks/{security-RXG4H3UK.js → security-AQ4N5YKV.js} +3 -3
  206. package/dist/cli/chunks/shared-rvf-adapter-6UVVDOHK.js +2 -0
  207. package/dist/cli/chunks/{shared-rvf-dual-writer-2PUFIGX5.js → shared-rvf-dual-writer-OKRIHVSY.js} +2 -2
  208. package/dist/cli/chunks/sqlite-persistence-3WG7PBPL.js +2 -0
  209. package/dist/cli/chunks/{status-handler-SXQKG6VP.js → status-handler-HSJLJPNG.js} +2 -2
  210. package/dist/cli/chunks/{structural-health-LPXOOMG3.js → structural-health-KWZAS7ON.js} +2 -2
  211. package/dist/cli/chunks/{sync-5NX7GQQY.js → sync-6L5Z4IWH.js} +2 -2
  212. package/dist/cli/chunks/{task-handler-Y4KVNCOI.js → task-handler-KEAIPB6G.js} +2 -2
  213. package/dist/cli/chunks/{task-handlers-CG27Z3CP.js → task-handlers-BPDN6OSM.js} +2 -2
  214. package/dist/cli/chunks/{test-PWVTWOWS.js → test-PICO6RLU.js} +4 -4
  215. package/dist/cli/chunks/{test-scheduling-5S5EBVE7.js → test-scheduling-BI3R3DX5.js} +3 -3
  216. package/dist/cli/chunks/{token-bootstrap-QMPUKGQC.js → token-bootstrap-KMQC6ALU.js} +2 -2
  217. package/dist/cli/chunks/{token-usage-OZNRTJLE.js → token-usage-QGDX7MLB.js} +2 -2
  218. package/dist/cli/chunks/{transformers-DRPOBWCW.js → transformers-UNRYJSIU.js} +2 -2
  219. package/dist/cli/chunks/{tree-sitter-wasm-parser-VLX6HQW2.js → tree-sitter-wasm-parser-U22JYPOG.js} +2 -2
  220. package/dist/cli/chunks/{types-TUF6HUPE.js → types-CYXAGOY5.js} +2 -2
  221. package/dist/cli/chunks/unified-memory-EXRANFUS.js +2 -0
  222. package/dist/cli/chunks/unified-memory-hnsw-GB752D44.js +2 -0
  223. package/dist/cli/chunks/unified-persistence-V2B3YWFD.js +2 -0
  224. package/dist/cli/chunks/{validate-H7QFV2CI.js → validate-IUY5BWAV.js} +2 -2
  225. package/dist/cli/chunks/{validate-swarm-BGH6YM4S.js → validate-swarm-FXFKSEOI.js} +2 -2
  226. package/dist/cli/chunks/{vibium-DQOGR2PH.js → vibium-DKZ64NR3.js} +2 -2
  227. package/dist/cli/chunks/visual-security-YMPI7X7V.js +2 -0
  228. package/dist/cli/chunks/{web-tree-sitter-TOI4XJIL.js → web-tree-sitter-WQDTN5CV.js} +2 -2
  229. package/dist/cli/chunks/{windsurf-installer-EUMBFA42.js → windsurf-installer-O5WOBFOQ.js} +2 -2
  230. package/dist/cli/chunks/witness-chain-7LIPUVMI.js +2 -0
  231. package/dist/cli/chunks/{witness-chain-MWPUR4Q2.js → witness-chain-F7WXEVJA.js} +2 -2
  232. package/dist/cli/chunks/{workflow-V5HI3AQR.js → workflow-47524I5G.js} +4 -4
  233. package/dist/cli/chunks/workflow-orchestrator-QPIAR4LI.js +2 -0
  234. package/dist/cli/chunks/{wrappers-VOU4IVAQ.js → wrappers-MP2HWQD7.js} +2 -2
  235. package/dist/cli/commands/init.js +1 -1
  236. package/dist/cli/commands/ruvector-commands.js +5 -2
  237. package/dist/cli/handlers/init-handler.d.ts +53 -0
  238. package/dist/cli/handlers/init-handler.js +53 -3
  239. package/dist/cli/index.js +5 -4
  240. package/dist/init/phases/04-database.js +19 -0
  241. package/dist/init/phases/06-code-intelligence.d.ts +14 -9
  242. package/dist/init/phases/06-code-intelligence.js +72 -34
  243. package/dist/init/phases/10-workers.js +2 -0
  244. package/dist/init/phases/phase-interface.d.ts +16 -4
  245. package/dist/integrations/ruvector/feature-flags.d.ts +27 -5
  246. package/dist/integrations/ruvector/feature-flags.js +15 -2
  247. package/dist/kernel/hnsw-adapter.js +1 -1
  248. package/dist/kernel/native-hnsw-backend.d.ts +100 -37
  249. package/dist/kernel/native-hnsw-backend.js +207 -192
  250. package/dist/kernel/unified-memory.js +15 -10
  251. package/dist/mcp/bundle.js +189 -189
  252. package/package.json +1 -1
  253. package/dist/cli/chunks/adapter-HOBCL2VF.js +0 -2
  254. package/dist/cli/chunks/aqe-learning-engine-77FVV2ZJ.js +0 -2
  255. package/dist/cli/chunks/base-2IXMPGJV.js +0 -2
  256. package/dist/cli/chunks/browser-workflow-AQYKV2NE.js +0 -2
  257. package/dist/cli/chunks/chunk-PMFZHFCB.js +0 -2
  258. package/dist/cli/chunks/chunk-Z2GK7COI.js +0 -2
  259. package/dist/cli/chunks/client-3CA57H5P.js +0 -2
  260. package/dist/cli/chunks/cross-domain-router-GECFIALH.js +0 -2
  261. package/dist/cli/chunks/dream-CJ4MKM5G.js +0 -2
  262. package/dist/cli/chunks/esm-node-X7U3YS4M.js +0 -2
  263. package/dist/cli/chunks/hnsw-adapter-LJGOH772.js +0 -2
  264. package/dist/cli/chunks/hnsw-index-V6SST2MB.js +0 -2
  265. package/dist/cli/chunks/impact-analyzer-MTOVFD3O.js +0 -2
  266. package/dist/cli/chunks/init-handler-VRZS6KO2.js +0 -68
  267. package/dist/cli/chunks/init-wizard-IH6PSRJY.js +0 -2
  268. package/dist/cli/chunks/kernel-3MC7WV5G.js +0 -2
  269. package/dist/cli/chunks/knowledge-graph-HLUQJ2GI.js +0 -2
  270. package/dist/cli/chunks/load-test-VVVME7GZ.js +0 -2
  271. package/dist/cli/chunks/memory-backend-O3U2QDU3.js +0 -2
  272. package/dist/cli/chunks/orchestrator-7BL6R54P.js +0 -370
  273. package/dist/cli/chunks/protocol-executor-HLNTSRYC.js +0 -2
  274. package/dist/cli/chunks/qe-reasoning-bank-JK5CK4D4.js +0 -2
  275. package/dist/cli/chunks/queen-coordinator-FLF6XYLX.js +0 -2
  276. package/dist/cli/chunks/router-DUFZW3WQ.js +0 -2
  277. package/dist/cli/chunks/routing-feedback-6U76TI6X.js +0 -2
  278. package/dist/cli/chunks/ruvector-commands-H7A7LG6Q.js +0 -8
  279. package/dist/cli/chunks/rvf-native-adapter-4UD7SUMB.js +0 -2
  280. package/dist/cli/chunks/safe-db-32Q5RXHR.js +0 -2
  281. package/dist/cli/chunks/schedule-ZHCM3L6H.js +0 -2
  282. package/dist/cli/chunks/scheduler-HBSSLDOD.js +0 -2
  283. package/dist/cli/chunks/shared-rvf-adapter-PLZVKKW7.js +0 -2
  284. package/dist/cli/chunks/sqlite-persistence-YUZMB44Y.js +0 -2
  285. package/dist/cli/chunks/unified-memory-3D4VDY4G.js +0 -2
  286. package/dist/cli/chunks/unified-memory-hnsw-AAQ5IA6M.js +0 -2
  287. package/dist/cli/chunks/unified-persistence-PY7MVJTL.js +0 -2
  288. package/dist/cli/chunks/visual-security-ZBNB7LEG.js +0 -2
  289. package/dist/cli/chunks/witness-chain-CS76OJFL.js +0 -2
  290. package/dist/cli/chunks/workflow-orchestrator-FS4HGYI7.js +0 -2
@@ -1,2 +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.5");process.exit(0)}
2
- import{c as a,d as c}from"./chunk-QPW2O5TR.js";import"./chunk-OTOQXMP6.js";import"./chunk-JYJXVTUP.js";import"./chunk-GSTDQLXR.js";import"./chunk-ITIYGUIL.js";import"./chunk-PTAUZ3XL.js";import"./chunk-JUBICWL2.js";import"./chunk-CQT3IEEX.js";import"./chunk-YHSIUFFY.js";import"./chunk-BM7VSJTE.js";import"./chunk-S4F3CNSP.js";import"./chunk-5NBYV7FL.js";import"./chunk-YGZBS4RW.js";import"./chunk-CGYTM7AB.js";import"./chunk-35DP6LX6.js";import"./chunk-X6J7VYVD.js";import"./chunk-ERV3OVUG.js";import"./chunk-673PL3DG.js";import"./chunk-MBXSHGDD.js";import"./chunk-EPH2GZQM.js";import"./chunk-NGP3DRFU.js";import"./chunk-KCQ2GFRN.js";import"./chunk-YHKJYBWK.js";import"./chunk-REXMKRR2.js";import"./chunk-TRPCOY3C.js";import"./chunk-TRRJP27A.js";import"./chunk-TUMXWCB7.js";import"./chunk-E55RROAP.js";import"./chunk-YQTPEQO6.js";import"./chunk-6AMXWB6Y.js";import"./chunk-6QKGLIIY.js";import"./chunk-FDFJHGRZ.js";import"./chunk-DPEX4UOC.js";import"./chunk-G7XBTBM7.js";import"./chunk-55EAFHVH.js";import"./chunk-XG2JAIQT.js";import"./chunk-ZP237D7K.js";import"./chunk-4EOSDCDM.js";import"./chunk-KQ7VBUO4.js";import"./chunk-ZWS7J73Q.js";import{a as m,b as R,d as $,e as y,f as g,i as b}from"./chunk-BNYHBEDE.js";import"./chunk-T4KMG3GJ.js";import"./chunk-BQUN2NB4.js";import"./chunk-KUDPFLL4.js";import"./chunk-UO2R7ZN3.js";import"./chunk-OPOTKH42.js";import"./chunk-IMCYFQWF.js";import"./chunk-N66G743A.js";import"./chunk-NDWWN2YC.js";import"./chunk-3VNEMHOO.js";import"./chunk-3KYKE7B6.js";import"./chunk-4FPCCKNQ.js";import"./chunk-3UE5GART.js";import"./chunk-53J3R7PZ.js";import"./chunk-6QR7GSNJ.js";import"./chunk-WV7K5A7J.js";import"./chunk-YZ3WB4TN.js";import"./chunk-6VB4VZCR.js";import"./chunk-BYD54ZUF.js";import"./chunk-ZFCRDCHW.js";import"./chunk-PGFHFPDP.js";import"./chunk-7JQOOPA2.js";import"./chunk-Y6XYH7EV.js";import"./chunk-ZD2FS4Q7.js";import"./chunk-ZJWDWM6B.js";import"./chunk-WTGUS7DD.js";import"./chunk-73LG5ELL.js";import"./chunk-HA4COQ66.js";import{b as w}from"./chunk-LPVQ6QCW.js";import"./chunk-KWIDDPKG.js";import"./chunk-HT5EZYPZ.js";import"./chunk-I4HGIQC2.js";import"./chunk-DSOEKRQL.js";import"./chunk-Z2GK7COI.js";import"./chunk-OQCEI7Q4.js";import"./chunk-I27OTSC7.js";import"./chunk-CNGRXBKO.js";import"./chunk-DFOANC7Z.js";import{a as i,c as S}from"./chunk-MYIDAWGQ.js";import"./chunk-TRO45ZLC.js";import"./chunk-VKT4STAE.js";import"./chunk-YDBMYTOV.js";import"./chunk-ALX5RJSR.js";import"./chunk-WIZOYPFT.js";import"./chunk-TSA5MUTQ.js";import"./chunk-4QGNSNQL.js";import"./chunk-UPFCV7MX.js";import"./chunk-PMFZHFCB.js";import"./chunk-3QH67ZYC.js";import"./chunk-2XJRSIM5.js";import"./chunk-GHFXURNS.js";S();async function T(e){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:s}=a();try{let t=e.namespace||"default",n=`${t}:${e.key}`;if(m()){let r=g(e.key,e.value,t,{tags:e.metadata?.tags}),o=await y.evaluateWrite(r);if(!o.allowed){if(R()&&b.recordViolation({type:"contradiction",severity:"medium",gate:"memoryWriteGate",description:`Memory write blocked for key ${e.key}: ${o.reason}`,context:{key:e.key,namespace:t,reason:o.reason,conflictingPatterns:o.conflictingPatterns}}),$())return{success:!1,error:`Memory write blocked by governance: ${o.reason}`};console.warn(`[MemoryHandler] Write allowed with warning: ${o.reason}`)}}await s.memory.set(n,e.value,{ttl:e.ttl});try{let r=`${e.key} ${JSON.stringify(e.value)}`,o=await w(r);await s.memory.storeVector(n,o,{key:e.key,namespace:t,storedAt:Date.now()})}catch(r){console.warn(`[MemoryHandler] Vector indexing failed for ${e.key}: ${i(r)}`)}return m()&&y.registerPattern(g(e.key,e.value,t)),{success:!0,data:{stored:!0,key:e.key,namespace:t,timestamp:new Date().toISOString(),persisted:!0}}}catch(t){return{success:!1,error:`Failed to store memory: ${i(t)}`}}}async function z(e){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:s}=a();try{let n=`${e.namespace||"default"}:${e.key}`,r=await s.memory.get(n);if(r===void 0)return{success:!0,data:{found:!1,key:e.key}};let o={found:!0,key:e.key,value:r,timestamp:new Date().toISOString()};return e.includeMetadata&&(o.metadata={}),{success:!0,data:o}}catch(t){return{success:!1,error:`Failed to retrieve memory: ${i(t)}`}}}function v(e){return e.includes(" ")&&!e.includes("*")&&!e.includes("?")}async function E(e){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:s}=a();try{let t=e.namespace||"default",n=e.limit||100,r=e.offset||0;if((e.semantic===!0||e.semantic!==!1&&e.pattern&&v(e.pattern))&&e.pattern)try{let l=await w(e.pattern),u=await s.memory.vectorSearch(l,n+r),M=t!=="default"?u.filter(d=>d.key.startsWith(`${t}:`)):u;return{success:!0,data:{entries:M.slice(r,r+n).map(d=>{let k=d.key.split(":");return{key:k.length>1?k.slice(1).join(":"):d.key,namespace:k.length>1?k[0]:t,score:d.score}}),total:M.length,hasMore:r+n<M.length,searchType:"semantic"}}}catch(l){console.error(`[MemoryHandler] Semantic search failed, falling back to pattern: ${i(l)}`)}let f=e.pattern?`${t}:${e.pattern}`:`${t}:*`,h=await s.memory.search(f,n+r);return{success:!0,data:{entries:h.slice(r,r+n).map(l=>{let u=l.split(":");return{key:u.slice(1).join(":"),namespace:u[0]}}),total:h.length,hasMore:r+n<h.length,searchType:"pattern"}}}catch(t){return{success:!1,error:`Failed to query memory: ${i(t)}`}}}async function K(e){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:s}=a();try{let t=e.namespace||"default",n=`${t}:${e.key}`;return{success:!0,data:{deleted:await s.memory.delete(n),key:e.key,namespace:t}}}catch(t){return{success:!1,error:`Failed to delete memory: ${i(t)}`}}}async function W(){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:e}=a();try{let s=await e.memory.search("*",1e4),t=0,n=1;try{let r=e.memory;r.getVectorStats&&(t=(await r.getVectorStats())?.vectorCount??0);let o=new Set(s.map(f=>f.split(":")[0]).filter(Boolean));n=Math.max(1,o.size)}catch{}return{success:!0,data:{entries:s.length,vectors:t,namespaces:n,size:{current:s.length,limit:Number.MAX_SAFE_INTEGER,unit:"entries"}}}}catch(s){return{success:!1,error:`Failed to get memory usage: ${i(s)}`}}}async function _(e){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:s}=a();try{let t=`shared:${e.knowledgeDomain}:${Date.now()}`,n={source:e.sourceAgentId,targets:e.targetAgentIds,domain:e.knowledgeDomain,content:e.knowledgeContent,timestamp:new Date().toISOString()};if(m()){let r=g(t,n,e.knowledgeDomain,{agentId:e.sourceAgentId}),o=await y.evaluateWrite(r);if(!o.allowed&&(R()&&b.recordViolation({type:"contradiction",severity:"medium",agentId:e.sourceAgentId,gate:"memoryWriteGate",description:`Shared knowledge blocked for domain ${e.knowledgeDomain}: ${o.reason}`,context:{sourceAgent:e.sourceAgentId,targetAgents:e.targetAgentIds,domain:e.knowledgeDomain,reason:o.reason}}),$()))return{success:!1,error:`Knowledge sharing blocked by governance: ${o.reason}`}}return await s.memory.set(t,n,{namespace:"agent-knowledge"}),m()&&y.registerPattern(g(t,n,e.knowledgeDomain)),{success:!0,data:{shared:!0,sourceAgent:e.sourceAgentId,targetAgents:e.targetAgentIds,domain:e.knowledgeDomain}}}catch(t){return{success:!1,error:`Failed to share memory: ${i(t)}`}}}export{K as handleMemoryDelete,E as handleMemoryQuery,z as handleMemoryRetrieve,_ as handleMemoryShare,T as handleMemoryStore,W as handleMemoryUsage};
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.7");process.exit(0)}
2
+ import{c as a,d as c}from"./chunk-2SJQ3CYN.js";import"./chunk-FBVEHGNE.js";import"./chunk-ZETZATNY.js";import"./chunk-EL2WLSUI.js";import"./chunk-CDFYF33M.js";import"./chunk-JNEG6DKU.js";import"./chunk-YV2PVXJE.js";import"./chunk-WS4OVAWU.js";import"./chunk-7OPVTN5W.js";import"./chunk-BTZEKSWH.js";import"./chunk-W4HUWBPK.js";import"./chunk-INJPS7RF.js";import"./chunk-6ULPQTIE.js";import"./chunk-SIIYQLKH.js";import"./chunk-FOCGOVIM.js";import"./chunk-YTF5G3RQ.js";import"./chunk-BJKRAFS2.js";import"./chunk-XB2GVTY6.js";import"./chunk-QI5VGEKC.js";import"./chunk-UXCEJ3AV.js";import"./chunk-D3KORDD5.js";import"./chunk-EFHR7LML.js";import"./chunk-OURDPRGM.js";import"./chunk-RGJ4RMUR.js";import"./chunk-NKX2Z546.js";import"./chunk-A5VULTCD.js";import"./chunk-SQZ3H6WR.js";import"./chunk-AHB2F42G.js";import"./chunk-LP6EQI2P.js";import"./chunk-ZEFDSMF4.js";import"./chunk-KO5HO6MY.js";import"./chunk-HWDE4RB3.js";import"./chunk-7GPYOMVY.js";import"./chunk-XY5FMZRA.js";import"./chunk-HEENVPYF.js";import"./chunk-TLTRL32T.js";import"./chunk-PFTR6XAO.js";import"./chunk-BWNH22V2.js";import"./chunk-SQQ57TSJ.js";import"./chunk-MUEFXLGX.js";import{a as m,b as R,d as $,e as y,f as g,i as b}from"./chunk-ZV7FGZNJ.js";import"./chunk-NJ5IC6ZR.js";import"./chunk-XOHRM3M7.js";import"./chunk-TT2YXNHH.js";import"./chunk-KHEAWN23.js";import"./chunk-BPYWDM2Y.js";import"./chunk-UDBSEFUT.js";import"./chunk-6MMRZYYS.js";import"./chunk-D2C4XNF5.js";import"./chunk-3DXO5CWI.js";import"./chunk-APPVAGD5.js";import"./chunk-7TKZ6LK6.js";import"./chunk-GOG6L2F7.js";import"./chunk-FHBIJBZ3.js";import"./chunk-LPLCT2HH.js";import"./chunk-DL46KSFX.js";import"./chunk-DKBXIBRS.js";import"./chunk-KHH5UJXY.js";import"./chunk-KLLHSXIC.js";import"./chunk-KZSZHP32.js";import"./chunk-URBXUDY3.js";import"./chunk-AT6LBLUV.js";import"./chunk-FKJ4XZ6E.js";import"./chunk-PHBE2VBN.js";import"./chunk-PMZJ54WX.js";import"./chunk-2TRWUJWG.js";import"./chunk-5EOM3W6Q.js";import"./chunk-DS3XAGGL.js";import{b as w}from"./chunk-426OO3RH.js";import"./chunk-52MUZGZF.js";import"./chunk-JRHKFRUB.js";import"./chunk-ECRYU5XG.js";import"./chunk-FJEIX3IS.js";import"./chunk-N5SLJOBK.js";import"./chunk-6OKXGDT3.js";import"./chunk-ZWAJV4SN.js";import"./chunk-WLYSZV5U.js";import"./chunk-ZSXSUUBS.js";import{a as i,c as S}from"./chunk-MR7V7QVL.js";import"./chunk-SMKRBNO7.js";import"./chunk-VMWLVRJO.js";import"./chunk-TD2WOW75.js";import"./chunk-STASZVMY.js";import"./chunk-LZ34CKYE.js";import"./chunk-QKJ4LUAM.js";import"./chunk-YR5ZNQT2.js";import"./chunk-JZYCZMHN.js";import"./chunk-HE5VY2BI.js";import"./chunk-GGPGY5QT.js";import"./chunk-WV3R5JFE.js";import"./chunk-UEFAPTBV.js";S();async function T(e){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:s}=a();try{let t=e.namespace||"default",n=`${t}:${e.key}`;if(m()){let r=g(e.key,e.value,t,{tags:e.metadata?.tags}),o=await y.evaluateWrite(r);if(!o.allowed){if(R()&&b.recordViolation({type:"contradiction",severity:"medium",gate:"memoryWriteGate",description:`Memory write blocked for key ${e.key}: ${o.reason}`,context:{key:e.key,namespace:t,reason:o.reason,conflictingPatterns:o.conflictingPatterns}}),$())return{success:!1,error:`Memory write blocked by governance: ${o.reason}`};console.warn(`[MemoryHandler] Write allowed with warning: ${o.reason}`)}}await s.memory.set(n,e.value,{ttl:e.ttl});try{let r=`${e.key} ${JSON.stringify(e.value)}`,o=await w(r);await s.memory.storeVector(n,o,{key:e.key,namespace:t,storedAt:Date.now()})}catch(r){console.warn(`[MemoryHandler] Vector indexing failed for ${e.key}: ${i(r)}`)}return m()&&y.registerPattern(g(e.key,e.value,t)),{success:!0,data:{stored:!0,key:e.key,namespace:t,timestamp:new Date().toISOString(),persisted:!0}}}catch(t){return{success:!1,error:`Failed to store memory: ${i(t)}`}}}async function z(e){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:s}=a();try{let n=`${e.namespace||"default"}:${e.key}`,r=await s.memory.get(n);if(r===void 0)return{success:!0,data:{found:!1,key:e.key}};let o={found:!0,key:e.key,value:r,timestamp:new Date().toISOString()};return e.includeMetadata&&(o.metadata={}),{success:!0,data:o}}catch(t){return{success:!1,error:`Failed to retrieve memory: ${i(t)}`}}}function v(e){return e.includes(" ")&&!e.includes("*")&&!e.includes("?")}async function E(e){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:s}=a();try{let t=e.namespace||"default",n=e.limit||100,r=e.offset||0;if((e.semantic===!0||e.semantic!==!1&&e.pattern&&v(e.pattern))&&e.pattern)try{let l=await w(e.pattern),u=await s.memory.vectorSearch(l,n+r),M=t!=="default"?u.filter(d=>d.key.startsWith(`${t}:`)):u;return{success:!0,data:{entries:M.slice(r,r+n).map(d=>{let k=d.key.split(":");return{key:k.length>1?k.slice(1).join(":"):d.key,namespace:k.length>1?k[0]:t,score:d.score}}),total:M.length,hasMore:r+n<M.length,searchType:"semantic"}}}catch(l){console.error(`[MemoryHandler] Semantic search failed, falling back to pattern: ${i(l)}`)}let f=e.pattern?`${t}:${e.pattern}`:`${t}:*`,h=await s.memory.search(f,n+r);return{success:!0,data:{entries:h.slice(r,r+n).map(l=>{let u=l.split(":");return{key:u.slice(1).join(":"),namespace:u[0]}}),total:h.length,hasMore:r+n<h.length,searchType:"pattern"}}}catch(t){return{success:!1,error:`Failed to query memory: ${i(t)}`}}}async function K(e){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:s}=a();try{let t=e.namespace||"default",n=`${t}:${e.key}`;return{success:!0,data:{deleted:await s.memory.delete(n),key:e.key,namespace:t}}}catch(t){return{success:!1,error:`Failed to delete memory: ${i(t)}`}}}async function W(){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:e}=a();try{let s=await e.memory.search("*",1e4),t=0,n=1;try{let r=e.memory;r.getVectorStats&&(t=(await r.getVectorStats())?.vectorCount??0);let o=new Set(s.map(f=>f.split(":")[0]).filter(Boolean));n=Math.max(1,o.size)}catch{}return{success:!0,data:{entries:s.length,vectors:t,namespaces:n,size:{current:s.length,limit:Number.MAX_SAFE_INTEGER,unit:"entries"}}}}catch(s){return{success:!1,error:`Failed to get memory usage: ${i(s)}`}}}async function _(e){if(!c())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{kernel:s}=a();try{let t=`shared:${e.knowledgeDomain}:${Date.now()}`,n={source:e.sourceAgentId,targets:e.targetAgentIds,domain:e.knowledgeDomain,content:e.knowledgeContent,timestamp:new Date().toISOString()};if(m()){let r=g(t,n,e.knowledgeDomain,{agentId:e.sourceAgentId}),o=await y.evaluateWrite(r);if(!o.allowed&&(R()&&b.recordViolation({type:"contradiction",severity:"medium",agentId:e.sourceAgentId,gate:"memoryWriteGate",description:`Shared knowledge blocked for domain ${e.knowledgeDomain}: ${o.reason}`,context:{sourceAgent:e.sourceAgentId,targetAgents:e.targetAgentIds,domain:e.knowledgeDomain,reason:o.reason}}),$()))return{success:!1,error:`Knowledge sharing blocked by governance: ${o.reason}`}}return await s.memory.set(t,n,{namespace:"agent-knowledge"}),m()&&y.registerPattern(g(t,n,e.knowledgeDomain)),{success:!0,data:{shared:!0,sourceAgent:e.sourceAgentId,targetAgents:e.targetAgentIds,domain:e.knowledgeDomain}}}catch(t){return{success:!1,error:`Failed to share memory: ${i(t)}`}}}export{K as handleMemoryDelete,E as handleMemoryQuery,z as handleMemoryRetrieve,_ as handleMemoryShare,T as handleMemoryStore,W as handleMemoryUsage};
@@ -1,3 +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.5");process.exit(0)}
2
- import{a as v}from"./chunk-IHXDXFUX.js";import{a as c,c as S}from"./chunk-MYIDAWGQ.js";import"./chunk-GHFXURNS.js";S();import{existsSync as n,mkdirSync as g,readdirSync as h,writeFileSync as I,copyFileSync as f}from"fs";import{join as o}from"path";var m=class{projectRoot;options;sourceDir;constructor(e){this.projectRoot=e.projectRoot,this.options={installAgents:!0,installSkills:!0,installTools:!0,overwrite:!1,...e},this.sourceDir=this.findSourceDir()}findSourceDir(){let e=o(this.projectRoot,".opencode"),s=v(import.meta.url),r=[];s&&r.push(o(s,".opencode")),r.push(o(this.projectRoot,"node_modules/agentic-qe/.opencode"));for(let t of r)if(t!==e&&this.isValidSourceDir(t))return t;return r[0]??o(this.projectRoot,"node_modules/agentic-qe/.opencode")}isValidSourceDir(e){return n(e)?n(o(e,"agents"))||n(o(e,"skills")):!1}async install(){let e=o(this.projectRoot,".opencode"),s={success:!0,agentsInstalled:[],skillsInstalled:[],toolsInstalled:[],permissionsInstalled:!1,errors:[],targetDir:e};try{if(!n(this.sourceDir))return s.errors.push(`Source .opencode directory not found: ${this.sourceDir}`),s.success=!1,s;if(this.options.installAgents){let t=this.installAgents(e);s.agentsInstalled=t.installed,s.errors.push(...t.errors)}if(this.options.installSkills){let t=this.installSkills(e);s.skillsInstalled=t.installed,s.errors.push(...t.errors)}if(this.options.installTools){let t=this.installTools(e);s.toolsInstalled=t.installed,s.errors.push(...t.errors)}let r=this.installPermissions(e);s.permissionsInstalled=r.installed,s.errors.push(...r.errors),this.generateOpenCodeConfig()}catch(r){s.success=!1,s.errors.push(`Installation failed: ${c(r)}`)}return s}installAgents(e){let s=[],r=[],t=o(this.sourceDir,"agents"),l=o(e,"agents");if(!n(t))return r.push(`Source agents directory not found: ${t}`),{installed:s,errors:r};n(l)||g(l,{recursive:!0});let u=h(t).filter(i=>i.endsWith(".yaml"));for(let i of u){let p=o(t,i),a=o(l,i);if(!(n(a)&&!this.options.overwrite))try{f(p,a),s.push(i.replace(".yaml",""))}catch(d){r.push(`Failed to install agent ${i}: ${c(d)}`)}}return{installed:s,errors:r}}installSkills(e){let s=[],r=[],t=o(this.sourceDir,"skills"),l=o(e,"skills");if(!n(t))return r.push(`Source skills directory not found: ${t}`),{installed:s,errors:r};n(l)||g(l,{recursive:!0});let u=h(t).filter(i=>i.endsWith(".yaml"));for(let i of u){let p=o(t,i),a=o(l,i);if(!(n(a)&&!this.options.overwrite))try{f(p,a),s.push(i.replace(".yaml",""))}catch(d){r.push(`Failed to install skill ${i}: ${c(d)}`)}}return{installed:s,errors:r}}installTools(e){let s=[],r=[],t=o(this.sourceDir,"tools"),l=o(e,"tools");if(!n(t))return r.push(`Source tools directory not found: ${t}`),{installed:s,errors:r};n(l)||g(l,{recursive:!0});let u=h(t).filter(i=>i.endsWith(".ts"));for(let i of u){let p=o(t,i),a=o(l,i);if(!(n(a)&&!this.options.overwrite))try{f(p,a),s.push(i.replace(".ts",""))}catch(d){r.push(`Failed to install tool ${i}: ${c(d)}`)}}return{installed:s,errors:r}}installPermissions(e){let s=[],r=o(this.sourceDir,"permissions.yaml"),t=o(e,"permissions.yaml");if(!n(r))return{installed:!1,errors:[]};if(n(t)&&!this.options.overwrite)return{installed:!1,errors:[]};try{return n(e)||g(e,{recursive:!0}),f(r,t),{installed:!0,errors:[]}}catch(l){return s.push(`Failed to install permissions.yaml: ${c(l)}`),{installed:!1,errors:s}}}generateOpenCodeConfig(){let e=o(this.projectRoot,"opencode.json");if(n(e))return;I(e,JSON.stringify({mcp:{"agentic-qe":{type:"local",command:["npx","agentic-qe","mcp"],environment:{AQE_MEMORY_PATH:".agentic-qe/memory.db",AQE_V3_MODE:"true"}}}},null,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.7");process.exit(0)}
2
+ import{a as v}from"./chunk-W4Y4GFRB.js";import{a as c,c as S}from"./chunk-MR7V7QVL.js";import"./chunk-UEFAPTBV.js";S();import{existsSync as n,mkdirSync as g,readdirSync as h,writeFileSync as I,copyFileSync as f}from"fs";import{join as o}from"path";var m=class{projectRoot;options;sourceDir;constructor(e){this.projectRoot=e.projectRoot,this.options={installAgents:!0,installSkills:!0,installTools:!0,overwrite:!1,...e},this.sourceDir=this.findSourceDir()}findSourceDir(){let e=o(this.projectRoot,".opencode"),s=v(import.meta.url),r=[];s&&r.push(o(s,".opencode")),r.push(o(this.projectRoot,"node_modules/agentic-qe/.opencode"));for(let t of r)if(t!==e&&this.isValidSourceDir(t))return t;return r[0]??o(this.projectRoot,"node_modules/agentic-qe/.opencode")}isValidSourceDir(e){return n(e)?n(o(e,"agents"))||n(o(e,"skills")):!1}async install(){let e=o(this.projectRoot,".opencode"),s={success:!0,agentsInstalled:[],skillsInstalled:[],toolsInstalled:[],permissionsInstalled:!1,errors:[],targetDir:e};try{if(!n(this.sourceDir))return s.errors.push(`Source .opencode directory not found: ${this.sourceDir}`),s.success=!1,s;if(this.options.installAgents){let t=this.installAgents(e);s.agentsInstalled=t.installed,s.errors.push(...t.errors)}if(this.options.installSkills){let t=this.installSkills(e);s.skillsInstalled=t.installed,s.errors.push(...t.errors)}if(this.options.installTools){let t=this.installTools(e);s.toolsInstalled=t.installed,s.errors.push(...t.errors)}let r=this.installPermissions(e);s.permissionsInstalled=r.installed,s.errors.push(...r.errors),this.generateOpenCodeConfig()}catch(r){s.success=!1,s.errors.push(`Installation failed: ${c(r)}`)}return s}installAgents(e){let s=[],r=[],t=o(this.sourceDir,"agents"),l=o(e,"agents");if(!n(t))return r.push(`Source agents directory not found: ${t}`),{installed:s,errors:r};n(l)||g(l,{recursive:!0});let u=h(t).filter(i=>i.endsWith(".yaml"));for(let i of u){let p=o(t,i),a=o(l,i);if(!(n(a)&&!this.options.overwrite))try{f(p,a),s.push(i.replace(".yaml",""))}catch(d){r.push(`Failed to install agent ${i}: ${c(d)}`)}}return{installed:s,errors:r}}installSkills(e){let s=[],r=[],t=o(this.sourceDir,"skills"),l=o(e,"skills");if(!n(t))return r.push(`Source skills directory not found: ${t}`),{installed:s,errors:r};n(l)||g(l,{recursive:!0});let u=h(t).filter(i=>i.endsWith(".yaml"));for(let i of u){let p=o(t,i),a=o(l,i);if(!(n(a)&&!this.options.overwrite))try{f(p,a),s.push(i.replace(".yaml",""))}catch(d){r.push(`Failed to install skill ${i}: ${c(d)}`)}}return{installed:s,errors:r}}installTools(e){let s=[],r=[],t=o(this.sourceDir,"tools"),l=o(e,"tools");if(!n(t))return r.push(`Source tools directory not found: ${t}`),{installed:s,errors:r};n(l)||g(l,{recursive:!0});let u=h(t).filter(i=>i.endsWith(".ts"));for(let i of u){let p=o(t,i),a=o(l,i);if(!(n(a)&&!this.options.overwrite))try{f(p,a),s.push(i.replace(".ts",""))}catch(d){r.push(`Failed to install tool ${i}: ${c(d)}`)}}return{installed:s,errors:r}}installPermissions(e){let s=[],r=o(this.sourceDir,"permissions.yaml"),t=o(e,"permissions.yaml");if(!n(r))return{installed:!1,errors:[]};if(n(t)&&!this.options.overwrite)return{installed:!1,errors:[]};try{return n(e)||g(e,{recursive:!0}),f(r,t),{installed:!0,errors:[]}}catch(l){return s.push(`Failed to install permissions.yaml: ${c(l)}`),{installed:!1,errors:s}}}generateOpenCodeConfig(){let e=o(this.projectRoot,"opencode.json");if(n(e))return;I(e,JSON.stringify({mcp:{"agentic-qe":{type:"local",command:["npx","agentic-qe","mcp"],environment:{AQE_MEMORY_PATH:".agentic-qe/memory.db",AQE_V3_MODE:"true"}}}},null,2)+`
3
3
  `)}};function C(y){return new m(y)}export{m as OpenCodeInstaller,C as createOpenCodeInstaller};
@@ -0,0 +1,373 @@
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.7");process.exit(0)}
2
+ import{a as ve}from"./chunk-4B5IYFKE.js";import{c as Re}from"./chunk-EFHR7LML.js";import{a as te,b as ce,c as he,d as ye,e as ke,f as be,g as we,h as Ce,i as Pe,j as Se,k as Ee}from"./chunk-T7R5NXJW.js";import"./chunk-OURDPRGM.js";import{a as Ie}from"./chunk-W4Y4GFRB.js";import"./chunk-BWNH22V2.js";import"./chunk-KHH5UJXY.js";import"./chunk-JRHKFRUB.js";import"./chunk-ECRYU5XG.js";import"./chunk-N5SLJOBK.js";import"./chunk-6OKXGDT3.js";import{b as x,d as ee}from"./chunk-WLYSZV5U.js";import{a as A,b as fe,c as ae}from"./chunk-MR7V7QVL.js";import"./chunk-VMWLVRJO.js";import{a as _,b as le}from"./chunk-TD2WOW75.js";import"./chunk-STASZVMY.js";import"./chunk-LZ34CKYE.js";import"./chunk-QKJ4LUAM.js";import"./chunk-YR5ZNQT2.js";import"./chunk-JZYCZMHN.js";import"./chunk-HE5VY2BI.js";import"./chunk-GGPGY5QT.js";import"./chunk-WV3R5JFE.js";import{a as ie}from"./chunk-UEFAPTBV.js";ae();ae();var h=class{requiresPhases;requiresEnhancements;async shouldRun(e){return!0}async execute(e){let t=Date.now();try{return{success:!0,data:await this.run(e),durationMs:Date.now()-t,message:`${this.description} completed`}}catch(s){return{success:!1,error:fe(s),durationMs:Date.now()-t,message:`${this.description} failed: ${A(s)}`}}}checkDependencies(e){if(!this.requiresPhases?.length)return!0;for(let t of this.requiresPhases)if(!e.results.get(t)?.success)return e.services.warn(`Phase ${this.name} requires ${t} which has not completed`),!1;return!0}checkEnhancements(e){if(!this.requiresEnhancements?.length)return!0;for(let t of this.requiresEnhancements)if(!(t==="claudeFlow"?e.enhancements.claudeFlow:t==="ruvector"?e.enhancements.ruvector:!1))return e.services.warn(`Phase ${this.name} requires ${t} which is not available`),!1;return!0}};ee();le();import{existsSync as q}from"fs";import{join as T}from"path";var N=class extends h{name="detection";description="Detect existing installations";order=10;critical=!0;async run(e){let{projectRoot:t}=e,s=await this.detectV2Installation(t),n=q(T(t,".agentic-qe","config.yaml")),o=s.version?.startsWith("3."),r=s.detected,i=n||o||!1,l=!r&&!i;return e.v2Detection=s,{v2Detected:r,v3Detected:i,freshInstall:l,v2Detection:s}}async detectV2Installation(e){let t=T(e,".agentic-qe","memory.db"),s=T(e,".agentic-qe","config"),n=T(e,".claude","agents"),o=T(e,".agentic-qe","config","learning.json"),r=q(t),i=q(s),l=q(n),c=q(o),d=q(T(e,".agentic-qe","config.yaml")),g,u=!1;return r&&(g=this.readVersionFromDb(t),g?u=g.startsWith("3."):g="2.x.x"),{detected:!u&&r&&(!g?.startsWith("3.")||c&&!d),memoryDbPath:r?t:void 0,configPath:i?s:void 0,agentsPath:l?n:void 0,hasMemoryDb:r,hasConfig:i,hasAgents:l,version:g}}readVersionFromDb(e){try{let t=_(e,{readonly:!0,fileMustExist:!0});try{if(!t.prepare(`
3
+ SELECT name FROM sqlite_master
4
+ WHERE type='table' AND name='kv_store'
5
+ `).get()){t.close();return}let n=t.prepare(`
6
+ SELECT value FROM kv_store
7
+ WHERE key = 'aqe_version' AND namespace = '_system'
8
+ `).get();return t.close(),n?x(n.value):void 0}catch{t.close();return}}catch{return}}};var Q=class extends h{name="analysis";description="Analyze project structure";order=20;critical=!0;requiresPhases=["detection"];async run(e){let s=await he(e.projectRoot).analyze();return e.analysis=s,e.services.log(` Project: ${s.projectName}`),e.services.log(` Languages: ${s.languages.map(n=>n.name).join(", ")}`),e.services.log(` Frameworks: ${s.frameworks.map(n=>n.name).join(", ")}`),s}};var L=class extends h{name="configuration";description="Generate configuration";order=30;critical=!0;requiresPhases=["analysis"];async run(e){if(!e.analysis)throw new Error("Analysis phase must complete before configuration");let s=ye({minimal:e.options.minimal}).recommend(e.analysis);return s=this.applyOptions(s,e),e.config=s,e.services.log(` Version: ${s.version}`),e.services.log(` Learning: ${s.learning.enabled?"enabled":"disabled"}`),e.services.log(` Workers: ${s.workers.enabled.length}`),s}applyOptions(e,t){let{options:s}=t;return s.minimal&&(e.skills.install=!1,e.learning.pretrainedPatterns=!1,e.workers.enabled=[],e.workers.daemonAutoStart=!1),s.skipPatterns&&(e.learning.pretrainedPatterns=!1),s.wizardAnswers&&(e=this.applyWizardAnswers(e,s.wizardAnswers)),e}applyWizardAnswers(e,t){switch(t["project-type"]&&t["project-type"]!=="auto"&&(e.project.type=t["project-type"]),t["learning-mode"]){case"full":e.learning.enabled=!0,e.learning.embeddingModel="transformer";break;case"basic":e.learning.enabled=!0,e.learning.embeddingModel="hash";break;case"disabled":e.learning.enabled=!1;break}return t["load-patterns"]===!1&&(e.learning.pretrainedPatterns=!1),t.hooks===!1&&(e.hooks.claudeCode=!1),t.workers===!1&&(e.workers.daemonAutoStart=!1),t.skills===!1&&(e.skills.install=!1),e}};import{existsSync as V,mkdirSync as de}from"fs";import{join as W}from"path";var H=class extends h{name="database";description="Initialize persistence database";order=40;critical=!0;requiresPhases=["configuration"];async run(e){let{projectRoot:t}=e,s=W(t,"vectors.db");V(s)&&e.services.log(` \u26A0 Stale vectors.db detected at ${s}
9
+ This file is left over from @ruvector/router (pre-v3.9.6).
10
+ It is no longer read or written by AQE. Safe to delete:
11
+ rm "${s}"`);let n=W(t,".agentic-qe");V(n)||de(n,{recursive:!0});let o=W(n,"workers");V(o)||de(o,{recursive:!0});let r=W(n,"data");V(r)||de(r,{recursive:!0});let i=W(n,"memory.db"),l=!V(i);try{let{initializeUnifiedMemory:c,resetUnifiedMemory:d}=await import("./unified-memory-EXRANFUS.js"),g=await c({dbPath:i,walMode:!0,busyTimeout:5e3}),f=g.getStats().tables.map(R=>R.name);await g.kvSet("_init_marker",{initialized:new Date().toISOString(),projectRoot:t,version:te()},"_system");let P=g.getDatabase().prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;return d(),e.services.log(` Database: ${i}`),e.services.log(` Schema version: v${P}`),e.services.log(` Tables: ${f.length} (v3 full schema)`),{dbPath:i,created:l,tablesCreated:f,schemaVersion:P}}catch(c){throw new Error(`SQLite persistence initialization FAILED: ${c}
12
+ Database path: ${i}
13
+ Ensure the directory is writable and has sufficient disk space.`)}}};import{existsSync as ne,mkdirSync as ue,writeFileSync as Ae}from"fs";import{join as $}from"path";var G=class extends h{name="learning";description="Initialize learning system";order=50;critical=!1;requiresPhases=["database","configuration"];async shouldRun(e){return e.config?.learning?.enabled??!0}async run(e){let t=e.config,{projectRoot:s,options:n}=e;if(!t.learning.enabled)return{enabled:!1,dataDir:"",hnswDir:"",patternsLoaded:0};let o=$(s,".agentic-qe","data");ne(o)||ue(o,{recursive:!0});let r=$(o,"hnsw");ne(r)||ue(r,{recursive:!0});let i=$(o,"learning-config.json"),l={embeddingModel:t.learning.embeddingModel,hnswConfig:t.learning.hnswConfig,qualityThreshold:t.learning.qualityThreshold,promotionThreshold:t.learning.promotionThreshold,databasePath:$(o,"memory.db"),hnswIndexPath:$(r,"index.bin"),initialized:new Date().toISOString()};Ae(i,JSON.stringify(l,null,2),"utf-8");let c=0;return t.learning.pretrainedPatterns&&!n.skipPatterns&&(c=await this.loadPretrainedPatterns(o,e)),e.services.log(` Data dir: ${o}`),e.services.log(` HNSW dir: ${r}`),e.services.log(` Patterns loaded: ${c}`),{enabled:!0,dataDir:o,hnswDir:r,patternsLoaded:c}}async loadPretrainedPatterns(e,t){try{let s=$(e,"patterns");ne(s)||ue(s,{recursive:!0});let n=$(s,"index.json");return ne(n)||Ae(n,JSON.stringify({version:te(),domains:[],loadedAt:new Date().toISOString()},null,2),"utf-8"),0}catch(s){return t.services.warn(`Could not load pre-trained patterns: ${s}`),0}}};ee();le();import{existsSync as Le,statSync as Ve}from"fs";import{join as se}from"path";var xe=3e4,_e=18e4,$e=["**/node_modules/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.agentic-qe/**","**/.git/**","**/.next/**","**/.nuxt/**","**/.output/**","**/__pycache__/**","**/.pytest_cache/**","**/target/**","**/vendor/**","**/.venv/**","**/venv/**","**/.tox/**","**/*.min.js","**/*.min.css","**/*.bundle.js","**/*.map","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/Pipfile.lock","**/poetry.lock","**/.env","**/.env.*"],U=class extends h{name="code-intelligence";description="Code intelligence pre-scan";order=60;critical=!1;requiresPhases=["database"];async shouldRun(e){let t=process.env.AQE_SKIP_CODE_INDEX;return t==="1"||t==="true"?(e.services.log(" Code intelligence skipped (AQE_SKIP_CODE_INDEX=1)"),e.services.log(" Run `aqe code index` later to build the KG on demand."),!1):e.options.skipCodeIndex?(e.services.log(" Code intelligence skipped (--skip-code-index)"),e.services.log(" Run `aqe code index` later to build the KG on demand."),!1):!0}async run(e){let{projectRoot:t}=e,s=se(t,".agentic-qe","memory.db");if(!Le(s))return e.services.log(" Building knowledge graph..."),await this.runCodeIntelligenceScan(t,e,!1);let n=_(s);try{if(!this.checkCodeIntelligenceIndex(n))return n.close(),e.services.log(" Building knowledge graph..."),await this.runCodeIntelligenceScan(t,e,!1);let r=this.getLastIndexedAt(n);if(!r){let c=this.getKGEntryCount(n);return n.close(),e.services.log(` Using existing index (${c} entries)`),{status:"existing",entries:c}}let i=this.getKGEntryCount(n);n.close();let l=await this.findChangedFiles(t,r);return l.length===0?(e.services.log(` Index up to date (${i} entries)`),{status:"existing",entries:i}):(e.services.log(` Delta scan: ${l.length} files changed since last index...`),await this.runCodeIntelligenceScan(t,e,!0,l))}catch(o){try{n.close()}catch{}throw o}}checkCodeIntelligenceIndex(e){try{return e.prepare(`
14
+ SELECT COUNT(*) as count FROM kv_store
15
+ WHERE namespace = 'code-intelligence:kg'
16
+ `).get().count>0}catch{return!1}}getKGEntryCount(e){try{return e.prepare(`
17
+ SELECT COUNT(*) as count FROM kv_store
18
+ WHERE namespace LIKE 'code-intelligence:kg%'
19
+ `).get().count}catch{return 0}}async runCodeIntelligenceScan(e,t,s,n){let{KnowledgeGraphService:o}=await import("./knowledge-graph-ZYXBWGKL.js"),r=se(e,".agentic-qe","memory.db"),i={type:"sqlite",sqlite:{path:r,walMode:!0}},{backend:l}=await ve(i,!0),c=new o(l,{namespace:"code-intelligence:kg",enableVectorEmbeddings:!0});try{let d;n?d=n:d=(await(await import("fast-glob")).default(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx","**/*.py"],{cwd:e,ignore:$e})).map(m=>se(e,m)),t.services.log(` Scanning ${d.length} source files...`);let g=await this.runBoundedScan(c,d,s,t);if(g.status==="timeout")return t.services.warn(` \u26A0 Code intelligence pre-scan exceeded ${_e/1e3}s phase cap. Indexed ${g.entries} entries before timeout. Last file: ${g.timeoutFile??"(unknown)"}. Init is continuing \u2014 re-run 'aqe code index' later, or report this file to https://github.com/proffesor-for-testing/agentic-qe/issues.`),g;if(g.status==="indexed"){let u=s?"Delta indexed":"Indexed";t.services.log(` ${u} ${g.entries} entries to ${r}`),await this.buildHypergraph(r,d,t)}return g}finally{try{c.destroy()}catch{}try{await l.dispose()}catch{}}}async runBoundedScan(e,t,s,n){let o=0,r=0,i=0,l="",c=Date.now(),d=!1;s||await e.clear();let g=n.projectRoot,u=m=>m.startsWith(g)?m.slice(g.length+1):m;for(let m of t){if(Date.now()-c>_e){d=!0;break}l=m,n.services.log(` [${i+1}/${t.length}] ${u(m)}`);try{let v=await this.withTimeout(e.index({paths:[m],incremental:!0,includeTests:!0}),xe,m);v.success&&(o+=v.value.nodesCreated,r+=v.value.edgesCreated)}catch(v){let P=v instanceof Error?v.message:String(v);P.startsWith("AQE_PER_FILE_TIMEOUT")?n.services.warn(` \u26A0 Skipped ${u(m)} \u2014 indexing exceeded ${xe/1e3}s`):n.services.warn(` \u26A0 Failed to index ${u(m)}: ${P}`)}i++}let f=o+r;return d?{status:"timeout",entries:f,timeoutFile:l}:{status:"indexed",entries:f}}withTimeout(e,t,s){return new Promise((n,o)=>{let r=setTimeout(()=>{o(new Error(`AQE_PER_FILE_TIMEOUT: ${s}`))},t);typeof r.unref=="function"&&r.unref(),e.then(i=>{clearTimeout(r),n(i)},i=>{clearTimeout(r),o(i)})})}async buildHypergraph(e,t,s){try{let{extractCodeIndex:n}=await import("./code-index-extractor-RD5EAOLE.js"),{createHypergraphEngine:o}=await import("./hypergraph-engine-FGAHFWFO.js"),r=_(e),i=await o({db:r,maxTraversalDepth:10,maxQueryResults:1e3,enableVectorSearch:!1}),l=await n(t),c=await i.buildFromIndexResult(l);r.close(),c.nodesCreated+c.edgesCreated>0&&s.services.log(` Hypergraph: ${c.nodesCreated} nodes, ${c.edgesCreated} edges`)}catch(n){s.services.warn?.(` Hypergraph build skipped: ${n}`)}}getLastIndexedAt(e){try{let t=e.prepare(`
20
+ SELECT value FROM kv_store
21
+ WHERE namespace = 'code-intelligence:kg'
22
+ AND key = 'metadata:index'
23
+ `).get();if(!t)return null;let s=x(t.value);if(!s.indexedAt)return null;let n=new Date(s.indexedAt);return isNaN(n.getTime())?null:n}catch{return null}}async findChangedFiles(e,t){let n=await(await import("fast-glob")).default(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx","**/*.py"],{cwd:e,ignore:$e}),o=t.getTime(),r=[];for(let i of n){let l=se(e,i);try{Ve(l).mtimeMs>o&&r.push(l)}catch{}}return r}};ee();import{existsSync as I,mkdirSync as re,readFileSync as De,writeFileSync as M}from"fs";import{join as b}from"path";var B=class extends h{name="hooks";description="Configure Claude Code hooks";order=70;critical=!1;requiresPhases=["configuration"];async shouldRun(e){return e.config?.hooks?.claudeCode??!0}async run(e){let t=e.config,{projectRoot:s}=e;if(!t.hooks.claudeCode)return{configured:!1,settingsPath:"",hookTypes:[],existingAqeDetected:!1};let n=b(s,".claude");I(n)||re(n,{recursive:!0});let o=b(n,"hooks");I(o)||re(o,{recursive:!0});let r=b(n,"settings.json"),i={};if(I(r))try{let v=De(r,"utf-8");i=x(v)}catch{i={}}let l=this.generateHooksConfig(t,s),c=Object.keys(l),d=i.hooks||{},g=this.hasExistingAqeHooks(d);g&&e.services.log(" Detected existing AQE hooks \u2014 replacing with updated config"),i.hooks=be(d,l);let u=i.env||{};i.env={...u,...we(t)};let f=Ce(t,s);for(let[v,P]of Object.entries(f))if(v==="_aqePermissions"){let R=i.permissions||{},C=R.allow||[],y=P,k=[...new Set([...C,...y])];i.permissions={...R,allow:k}}else i[v]=P;let m=i.enabledMcpjsonServers||[];m=m.filter(v=>v!=="aqe"),m.includes("agentic-qe")||m.push("agentic-qe"),i.enabledMcpjsonServers=m,M(r,JSON.stringify(i,null,2),"utf-8"),this.writeHooksReadme(o,c),this.installHookAssets(o,e);try{let v=De(r,"utf-8"),R=x(v).hooks;(!R||!this.hasExistingAqeHooks(R))&&e.services.log(" WARNING: settings.json written but AQE hooks not detected \u2014 check settings-merge logic")}catch{e.services.log(" WARNING: Could not verify settings.json after write")}return e.services.log(` Settings: ${r}`),e.services.log(` Hooks dir: ${o}`),e.services.log(` Hook types: ${c.join(", ")}`),{configured:!0,settingsPath:r,hookTypes:c,existingAqeDetected:g}}writeHooksReadme(e,t){let s=b(e,"README.txt");if(I(s))return;let n=["AQE Hooks Directory","====================","","Claude Code hooks are configured in .claude/settings.json (not as files here).","This directory contains supporting infrastructure for the learning system.","","Configured hook types: "+t.join(", "),"","Files:"," settings.json \u2014 Hook definitions (in parent .claude/ directory)"," helpers/brain-checkpoint.cjs \u2014 Auto-exports brain to aqe.rvf on session end"," cross-phase-memory.yaml \u2014 QCSD feedback loop configuration","","Manual testing:"," npx agentic-qe hooks session-start --session-id test --json",' npx agentic-qe hooks route --task "generate tests" --json'," npx agentic-qe hooks post-edit --file src/example.ts --success --json",""].join(`
24
+ `);M(s,n,"utf-8")}installHookAssets(e,t){let{projectRoot:s}=t;this.installBrainCheckpoint(s,t),this.installStatusline(s,t);let n=b(e,"cross-phase-memory.yaml");if(!I(n)){let r=[b(s,"v3","assets","hooks","cross-phase-memory.yaml"),b(s,"assets","hooks","cross-phase-memory.yaml"),b(s,"node_modules","agentic-qe","v3","assets","hooks","cross-phase-memory.yaml")],i=!1;for(let l of r)if(I(l)){let{copyFileSync:c}=ie("fs");c(l,n),t.services.log(" Installed cross-phase memory config"),i=!0;break}i||M(n,["# Cross-Phase Memory Hooks Configuration","# Generated by aqe init",'version: "1.0"',"enabled: true",""].join(`
25
+ `),"utf-8")}let o=b(e,"v3-domain-workers.json");I(o)||M(o,JSON.stringify({version:"3.0",workers:[{name:"pattern-consolidator",interval:"5m",enabled:!0},{name:"routing-accuracy-monitor",interval:"10m",enabled:!0},{name:"coverage-gap-scanner",interval:"15m",enabled:!0},{name:"flaky-test-detector",interval:"30m",enabled:!0}]},null,2),"utf-8")}hasExistingAqeHooks(e){for(let t of Object.values(e))if(Array.isArray(t)){for(let s of t)if(ke(s))return!0}return!1}installBrainCheckpoint(e,t){let s=b(e,".claude","helpers");I(s)||re(s,{recursive:!0});let n=b(s,"brain-checkpoint.cjs"),o=[b(e,".claude","helpers","brain-checkpoint.cjs"),b(e,"node_modules","agentic-qe",".claude","helpers","brain-checkpoint.cjs")];for(let r of o)if(I(r)&&r!==n){let{copyFileSync:i}=ie("fs");i(r,n),t.services.log(" Installed brain-checkpoint.cjs (copied)");return}I(n)||(M(n,this.generateBrainCheckpointScript(),"utf-8"),t.services.log(" Installed brain-checkpoint.cjs (generated)"))}installStatusline(e,t){let s=b(e,".claude","helpers");I(s)||re(s,{recursive:!0});let n=b(s,"statusline-v3.cjs"),o=[b(e,"node_modules","agentic-qe","assets","helpers","statusline-v3.cjs"),b(e,"assets","helpers","statusline-v3.cjs")];for(let r of o)if(I(r)&&r!==n){let{copyFileSync:i}=ie("fs");i(r,n),t.services.log(" Installed statusline-v3.cjs (copied)");return}I(n)||(M(n,this.generateMinimalStatuslineScript(),"utf-8"),t.services.log(" Installed statusline-v3.cjs (generated)"))}generateMinimalStatuslineScript(){return`#!/usr/bin/env node
26
+ /**
27
+ * Agentic QE v3 Statusline (minimal fallback, generated by aqe init)
28
+ * For the full statusline, reinstall: npx agentic-qe init --auto
29
+ */
30
+ const fs = require('fs');
31
+ const path = require('path');
32
+ const { execFileSync } = require('child_process');
33
+
34
+ function q(bin, args, d) { try { return execFileSync(bin, args, { encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'] }).trim(); } catch { return d || ''; } }
35
+
36
+ const dir = path.resolve(__dirname, '..', '..');
37
+ const dbPath = path.join(dir, '.agentic-qe', 'memory.db');
38
+ let patterns = 0;
39
+ try {
40
+ if (fs.existsSync(dbPath)) {
41
+ const Database = require('better-sqlite3');
42
+ const db = new Database(dbPath, { readonly: true, fileMustExist: true });
43
+ db.pragma('busy_timeout = 5000');
44
+ patterns = db.prepare("SELECT COUNT(*) AS c FROM qe_patterns WHERE usage_count > 0 OR quality_score > 0 OR name NOT LIKE 'bench-%'").get()?.c || 0;
45
+ db.close();
46
+ }
47
+ } catch { /* ignore */ }
48
+
49
+ const branch = q('git', ['branch', '--show-current']);
50
+ const branchStr = branch ? \` \\x1b[34m\u2387 \${branch}\\x1b[0m\` : '';
51
+ const patStr = patterns > 0 ? \` \\x1b[35m\u{1F393} \${patterns} patterns\\x1b[0m\` : '';
52
+
53
+ console.log(\`\\x1b[1m\\x1b[35m\u258A Agentic QE v3\\x1b[0m\${branchStr}\${patStr}\`);
54
+ `}generateBrainCheckpointScript(){return`#!/usr/bin/env node
55
+ /**
56
+ * Brain Checkpoint Helper (generated by aqe init)
57
+ *
58
+ * Usage:
59
+ * node brain-checkpoint.cjs export # Export brain to aqe.rvf (session-end)
60
+ * node brain-checkpoint.cjs verify # Verify aqe.rvf exists (session-start)
61
+ */
62
+ const { execFileSync } = require('child_process');
63
+ const fs = require('fs');
64
+ const path = require('path');
65
+
66
+ const PROJECT_ROOT = path.resolve(__dirname, '..', '..');
67
+ const AQE_DIR = path.join(PROJECT_ROOT, '.agentic-qe');
68
+ const RVF_PATH = path.join(AQE_DIR, 'aqe.rvf');
69
+ const DB_PATH = path.join(AQE_DIR, 'memory.db');
70
+ const MAX_AGE_HOURS = 24;
71
+
72
+ function log(msg) { process.stderr.write('[brain-checkpoint] ' + msg + '\\n'); }
73
+
74
+ function exportBrain() {
75
+ if (!fs.existsSync(DB_PATH)) { log('No memory.db, skipping'); return { exported: false }; }
76
+ try {
77
+ if (fs.existsSync(RVF_PATH)) fs.unlinkSync(RVF_PATH);
78
+ const idmap = RVF_PATH + '.idmap.json';
79
+ if (fs.existsSync(idmap)) fs.unlinkSync(idmap);
80
+ const result = execFileSync(
81
+ 'npx', ['agentic-qe', 'brain', 'export', '-o', RVF_PATH, '--format', 'rvf'],
82
+ { timeout: 60000, encoding: 'utf-8' }
83
+ );
84
+ const m = result.match(/Patterns:\\s+(\\d+)/);
85
+ const p = m ? m[1] : '0';
86
+ log('Exported ' + p + ' patterns to aqe.rvf');
87
+ return { exported: true, patterns: parseInt(p) };
88
+ } catch (e) {
89
+ log('Export failed: ' + e.message);
90
+ return { exported: false, reason: e.message };
91
+ }
92
+ }
93
+
94
+ function verifyBrain() {
95
+ if (!fs.existsSync(RVF_PATH)) {
96
+ log('No aqe.rvf found');
97
+ return { valid: false, reason: 'missing' };
98
+ }
99
+ const stat = fs.statSync(RVF_PATH);
100
+ const ageH = (Date.now() - stat.mtimeMs) / 3600000;
101
+ if (stat.size < 1024) { log('aqe.rvf too small'); return { valid: false, reason: 'too-small' }; }
102
+ if (ageH > MAX_AGE_HOURS) { log('aqe.rvf is ' + ageH.toFixed(1) + 'h old'); return { valid: true, stale: true }; }
103
+ log('aqe.rvf OK (' + (stat.size/1048576).toFixed(1) + ' MB)');
104
+ return { valid: true, stale: false };
105
+ }
106
+
107
+ const cmd = process.argv[2] || 'verify';
108
+ const result = cmd === 'export' ? exportBrain() : verifyBrain();
109
+ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result));
110
+ `}generateHooksConfig(e,t){return{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}]},{hooks:[{type:"command",command:`sh -c 'exec node "\${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/brain-checkpoint.cjs" verify --json'`,timeout:5e3,continueOnError:!0}]}],Stop:[{hooks:[{type:"command",command:"npx agentic-qe hooks session-end --save-state --json",timeout:5e3,continueOnError:!0}]},{hooks:[{type:"command",command:`sh -c 'exec node "\${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/brain-checkpoint.cjs" export --json'`,timeout:6e4,continueOnError:!0}]}]}}};ee();import{existsSync as We,readFileSync as He,writeFileSync as Ge}from"fs";import{join as Ue}from"path";var z=class extends h{name="mcp";description="Configure MCP server";order=80;critical=!1;requiresPhases=["configuration","database"];async run(e){let{projectRoot:t}=e;if(e.options.noMcp)return e.services.log(" MCP: skipped (--no-mcp)"),e.services.log(" CLI commands available: aqe memory, aqe test, aqe coverage, etc."),{configured:!1,mcpPath:"",serverName:""};let s={command:"aqe-mcp",args:[],env:{AQE_LEARNING_ENABLED:"true",AQE_WORKERS_ENABLED:"true",NODE_ENV:"production"}},n=Ue(t,".mcp.json"),o={};if(We(n))try{let i=He(n,"utf-8");o=x(i)}catch{o={}}o.mcpServers||(o.mcpServers={});let r=o.mcpServers;return r["agentic-qe"]=s,Ge(n,JSON.stringify(o,null,2),"utf-8"),e.services.log(` MCP config: ${n}`),e.services.log(" Server: agentic-qe"),e.services.log(" Learning: enabled"),e.services.log(" Workers: enabled"),{configured:!0,mcpPath:n,serverName:"agentic-qe"}}};import{existsSync as S,readFileSync as Be}from"fs";import{join as E}from"path";var K=class extends h{name="assets";description="Install skills and agents";order=90;critical=!1;requiresPhases=["configuration"];async run(e){let t=e.config,{projectRoot:s,options:n}=e,o=this.detectVersionUpgrade(e),r=n.upgrade||t.skills.overwrite||n.autoMode&&o,i=0,l=0,c=0,d=0,g=0,u=0,f=0,m=0,v=0;if(n.upgrade?e.services.log(" Upgrade mode: overwriting existing files"):n.autoMode&&o&&e.services.log(" Version upgrade detected: updating skills and agents"),t.skills.install){let k=await Pe({projectRoot:s,installV2Skills:t.skills.installV2,installV3Skills:t.skills.installV3,overwrite:r}).install();i=k.installed.length,k.errors.length>0&&e.services.warn(`Skills warnings: ${k.errors.join(", ")}`)}try{let k=await Se({projectRoot:s,installQEAgents:!0,installSubagents:!0,overwrite:r}).install();l=k.installed.length,k.errors.length>0&&e.services.warn(`Agents warnings: ${k.errors.join(", ")}`)}catch(y){e.services.warn(`Agents install error: ${y instanceof Error?y.message:y}`)}if(Re(s),n.withN8n){let k=await Ee({projectRoot:s,installAgents:!0,installSkills:!0,overwrite:r,n8nApiConfig:n.n8nApiConfig}).install();c=k.agentsInstalled.length,d=k.skillsInstalled.length,k.errors.length>0&&e.services.warn(`N8n warnings: ${k.errors.join(", ")}`)}let P=n.autoMode&&S(E(s,"opencode.json"));if(n.withOpenCode||P){let{createOpenCodeInstaller:y}=await import("./opencode-installer-PIDIFO2L.js"),a=await y({projectRoot:s,installAgents:!0,installSkills:!0,installTools:!0,overwrite:r}).install();g=a.agentsInstalled.length,u=a.skillsInstalled.length,a.errors.length>0&&e.services.warn(`OpenCode warnings: ${a.errors.join(", ")}`)}e.services.log(` Skills: ${i}`),e.services.log(` Agents: ${l}`),n.withN8n&&(e.services.log(` N8n agents: ${c}`),e.services.log(` N8n skills: ${d}`)),(n.withOpenCode||P)&&(e.services.log(` OpenCode agents: ${g}`),e.services.log(` OpenCode skills: ${u}`));let R=n.autoMode&&S(E(s,".kiro"));if(n.withKiro||R){let{createKiroInstaller:y}=await import("./kiro-installer-NG77T5YR.js"),a=await y({projectRoot:s,installAgents:!0,installSkills:!0,installHooks:!0,installSteering:!0,overwrite:r}).install();f=a.agentsInstalled.length,m=a.skillsInstalled.length,v=a.hooksInstalled.length,a.errors.length>0&&e.services.warn(`Kiro warnings: ${a.errors.join(", ")}`),e.services.log(` Kiro agents: ${f}`),e.services.log(` Kiro skills: ${m}`),e.services.log(` Kiro hooks: ${v}`),e.services.log(` Kiro steering: ${a.steeringInstalled.length}`),a.mcpConfigured&&e.services.log(" Kiro MCP: .kiro/settings/mcp.json")}let C=[];if(n.withCopilot||n.autoMode&&S(E(s,".vscode"))){let{createCopilotInstaller:y}=await import("./copilot-installer-TVJUX3AZ.js"),a=await y({projectRoot:s,overwrite:r}).install();a.mcpConfigured&&C.push("copilot"),a.errors.length>0&&e.services.warn(`Copilot warnings: ${a.errors.join(", ")}`),a.mcpConfigured&&e.services.log(` Copilot MCP: ${a.configPath}`),a.rulesInstalled&&e.services.log(` Copilot rules: ${a.rulesPath}`)}if(n.withCursor||n.autoMode&&S(E(s,".cursor"))){let{createCursorInstaller:y}=await import("./cursor-installer-2NJ7MK23.js"),a=await y({projectRoot:s,overwrite:r}).install();a.mcpConfigured&&C.push("cursor"),a.errors.length>0&&e.services.warn(`Cursor warnings: ${a.errors.join(", ")}`),a.mcpConfigured&&e.services.log(` Cursor MCP: ${a.configPath}`),a.rulesInstalled&&e.services.log(` Cursor rules: ${a.rulesPath}`)}if(n.withCline){let{createClineInstaller:y}=await import("./cline-installer-3FMNXEKM.js"),a=await y({projectRoot:s,overwrite:r}).install();a.mcpConfigured&&C.push("cline"),a.errors.length>0&&e.services.warn(`Cline warnings: ${a.errors.join(", ")}`),a.mcpConfigured&&e.services.log(` Cline MCP: ${a.configPath}`),a.modeInstalled&&e.services.log(` Cline mode: ${a.modePath}`)}if(n.withKiloCode||n.autoMode&&S(E(s,".kilocode"))){let{createKiloCodeInstaller:y}=await import("./kilocode-installer-ED6LYSEM.js"),a=await y({projectRoot:s,overwrite:r}).install();a.mcpConfigured&&C.push("kilocode"),a.errors.length>0&&e.services.warn(`Kilo Code warnings: ${a.errors.join(", ")}`),a.mcpConfigured&&e.services.log(` Kilo Code MCP: ${a.configPath}`),a.modeInstalled&&e.services.log(` Kilo Code mode: ${a.modePath}`)}if(n.withRooCode||n.autoMode&&S(E(s,".roo"))){let{createRooCodeInstaller:y}=await import("./roocode-installer-WADVKI3P.js"),a=await y({projectRoot:s,overwrite:r}).install();a.mcpConfigured&&C.push("roocode"),a.errors.length>0&&e.services.warn(`Roo Code warnings: ${a.errors.join(", ")}`),a.mcpConfigured&&e.services.log(` Roo Code MCP: ${a.configPath}`),a.modeInstalled&&e.services.log(` Roo Code mode: ${a.modePath}`)}if(n.withCodex||n.autoMode&&S(E(s,".codex"))){let{createCodexInstaller:y}=await import("./codex-installer-UU4O2FIE.js"),a=await y({projectRoot:s,overwrite:r}).install();a.mcpConfigured&&C.push("codex"),a.errors.length>0&&e.services.warn(`Codex warnings: ${a.errors.join(", ")}`),a.mcpConfigured&&e.services.log(` Codex MCP: ${a.configPath}`),a.agentsMdInstalled&&e.services.log(` Codex AGENTS.md: ${a.agentsMdPath}`)}if(n.withWindsurf||n.autoMode&&S(E(s,".windsurf"))){let{createWindsurfInstaller:y}=await import("./windsurf-installer-O5WOBFOQ.js"),a=await y({projectRoot:s,overwrite:r}).install();a.mcpConfigured&&C.push("windsurf"),a.errors.length>0&&e.services.warn(`Windsurf warnings: ${a.errors.join(", ")}`),a.mcpConfigured&&e.services.log(` Windsurf MCP: ${a.configPath}`),a.rulesInstalled&&e.services.log(` Windsurf rules: ${a.rulesPath}`)}if(n.withContinueDev||n.autoMode&&S(E(s,".continue"))){let{createContinueDevInstaller:y}=await import("./continuedev-installer-E55EG2TB.js"),a=await y({projectRoot:s,overwrite:r}).install();a.mcpConfigured&&C.push("continuedev"),a.errors.length>0&&e.services.warn(`Continue.dev warnings: ${a.errors.join(", ")}`),a.mcpConfigured&&e.services.log(` Continue.dev MCP: ${a.configPath}`),a.rulesInstalled&&e.services.log(` Continue.dev rules: ${a.rulesPath}`)}return C.length>0&&e.services.log(` Platforms configured: ${C.join(", ")}`),{skillsInstalled:i,agentsInstalled:l,n8nAgents:c,n8nSkills:d,openCodeAgents:g,openCodeSkills:u,kiroAgents:f,kiroSkills:m,kiroHooks:v,platformsConfigured:C}}detectVersionUpgrade(e){let t=E(e.projectRoot,".agentic-qe","config.yaml");if(!S(t))return!1;try{let o=Be(t,"utf-8").match(/version:\s*"?([^"\n]+)"?/)?.[1],r=e.config.version;return o!==void 0&&o!==r}catch{return!1}}};import{existsSync as ze,mkdirSync as Ke,writeFileSync as oe}from"fs";import{join as O}from"path";var Y=class extends h{name="workers";description="Configure background workers";order=100;critical=!1;requiresPhases=["configuration"];async shouldRun(e){let t=e.config;return t?.workers?.daemonAutoStart&&(t?.workers?.enabled?.length??0)>0}async run(e){let t=e.config,{projectRoot:s}=e;if(!t.workers.daemonAutoStart||t.workers.enabled.length===0)return{workersDir:"",workersConfigured:0,registryPath:"",daemonStarted:!1,daemonPid:null};let n=O(s,".agentic-qe","workers");ze(n)||Ke(n,{recursive:!0});let o={"learning-consolidation":18e5,"pattern-consolidator":18e5,"test-health":3e5,"coverage-tracker":6e5,"coverage-gap-scanner":6e5,"flaky-detector":9e5,"flaky-test-detector":9e5,"security-scan":18e5,"quality-gate":3e5,"compliance-checker":18e5,"defect-predictor":9e5,"regression-monitor":6e5,"routing-accuracy-monitor":9e5,"performance-baseline":36e5,"cloud-sync":3e5},r={};for(let f of t.workers.enabled)r[f]={name:f,enabled:!0,interval:t.workers.intervals[f]||o[f]||6e4,lastRun:null,status:"pending"};let i=O(n,"registry.json"),l={version:t.version,maxConcurrent:t.workers.maxConcurrent,workers:r,createdAt:new Date().toISOString(),daemonPid:null};oe(i,JSON.stringify(l,null,2),"utf-8");for(let f of t.workers.enabled){let m=O(n,`${f}.json`),v={name:f,enabled:!0,interval:t.workers.intervals[f]||o[f]||6e4,projectRoot:s,dataDir:O(s,".agentic-qe","data"),createdAt:new Date().toISOString()};oe(m,JSON.stringify(v,null,2),"utf-8")}let c=O(n,"start-daemon.cjs");oe(c,`#!/usr/bin/env node
111
+ // AQE v3 Worker Daemon Startup Script (cross-platform)
112
+ // Generated by aqe init
113
+ // Starts the MCP server with background workers enabled
114
+
115
+ const { existsSync, readFileSync, writeFileSync, appendFileSync } = require('fs');
116
+ const { join } = require('path');
117
+ const { spawn } = require('child_process');
118
+
119
+ const projectRoot = join(__dirname, '..', '..');
120
+ const workersDir = join(projectRoot, '.agentic-qe', 'workers');
121
+ const pidFile = join(workersDir, 'daemon.pid');
122
+ const logFile = join(workersDir, 'daemon.log');
123
+
124
+ // Check if already running
125
+ if (existsSync(pidFile)) {
126
+ const pid = parseInt(readFileSync(pidFile, 'utf-8').trim(), 10);
127
+ try { process.kill(pid, 0); console.log('Daemon already running (PID: ' + pid + ')'); process.exit(0); } catch {}
128
+ }
129
+
130
+ const ts = new Date().toISOString();
131
+ appendFileSync(logFile, '[' + ts + '] Starting AQE v3 Worker Daemon...\\n');
132
+
133
+ // Find the best way to run aqe-mcp
134
+ const candidates = [
135
+ join(projectRoot, 'node_modules', '.bin', 'aqe-mcp'),
136
+ join(projectRoot, 'node_modules', 'agentic-qe', 'dist', 'mcp', 'bundle.js'),
137
+ ];
138
+
139
+ let mcpCmd, mcpArgs;
140
+ const binCandidate = candidates.find(c => existsSync(c));
141
+
142
+ if (binCandidate && binCandidate.endsWith('bundle.js')) {
143
+ mcpCmd = process.execPath;
144
+ mcpArgs = [binCandidate];
145
+ } else if (binCandidate) {
146
+ mcpCmd = binCandidate;
147
+ mcpArgs = [];
148
+ } else {
149
+ mcpCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
150
+ mcpArgs = ['--yes', 'agentic-qe', 'mcp'];
151
+ }
152
+
153
+ appendFileSync(logFile, '[' + ts + '] Using: ' + mcpCmd + ' ' + mcpArgs.join(' ') + '\\n');
154
+
155
+ const env = { ...process.env, AQE_STORAGE_PATH: '.agentic-qe', AQE_LEARNING_ENABLED: 'true', AQE_WORKERS_ENABLED: 'true', AQE_HTTP_PORT: '0' };
156
+ const child = spawn(mcpCmd, mcpArgs, { cwd: projectRoot, env, detached: true, stdio: ['ignore', 'pipe', 'pipe'] });
157
+ child.stdout.on('data', d => appendFileSync(logFile, d));
158
+ child.stderr.on('data', d => appendFileSync(logFile, d));
159
+ child.unref();
160
+
161
+ writeFileSync(pidFile, String(child.pid));
162
+ appendFileSync(logFile, '[' + ts + '] Daemon started with PID: ' + child.pid + '\\n');
163
+ console.log('AQE v3 Worker Daemon started (PID: ' + child.pid + ')');
164
+ console.log('Log file: ' + logFile);
165
+ console.log('To stop: node ' + join(workersDir, 'stop-daemon.cjs'));
166
+ `);let g=O(n,"stop-daemon.cjs");return oe(g,`#!/usr/bin/env node
167
+ // AQE v3 Worker Daemon Stop Script (cross-platform)
168
+ // Generated by aqe init
169
+
170
+ const { existsSync, readFileSync, unlinkSync } = require('fs');
171
+ const { join } = require('path');
172
+
173
+ const workersDir = join(__dirname);
174
+ const pidFile = join(workersDir, 'daemon.pid');
175
+
176
+ if (!existsSync(pidFile)) { console.log('No PID file found - daemon may not be running'); process.exit(0); }
177
+
178
+ const pid = parseInt(readFileSync(pidFile, 'utf-8').trim(), 10);
179
+ try {
180
+ process.kill(pid, 0); // Check if alive
181
+ console.log('Stopping daemon (PID: ' + pid + ')...');
182
+ process.kill(pid, 'SIGTERM');
183
+ try { unlinkSync(pidFile); } catch {}
184
+ console.log('Daemon stopped');
185
+ } catch {
186
+ console.log('Daemon not running (stale PID file)');
187
+ try { unlinkSync(pidFile); } catch {}
188
+ }
189
+ `),e.services.log(` Workers dir: ${n}`),e.services.log(` Workers: ${t.workers.enabled.join(", ")}`),e.services.log(` Registry: ${i}`),{workersDir:n,workersConfigured:t.workers.enabled.length,registryPath:i,daemonStarted:!1,daemonPid:null}}};import{existsSync as Ye,readFileSync as Je,writeFileSync as pe}from"fs";import{join as je}from"path";var J=class extends h{name="claude-md";description="Generate CLAUDE.md";order=110;critical=!1;requiresPhases=["configuration"];async run(e){let t=e.config,{projectRoot:s}=e,n=je(s,"CLAUDE.md"),o=this.generateContent(t),r=!1;if(Ye(n)){let i=Je(n,"utf-8");if(i.includes("## Agentic QE v3"))return e.services.log(" CLAUDE.md already has AQE section"),{generated:!1,path:n,backupCreated:!1};let l=je(s,"CLAUDE.md.backup");pe(l,i,"utf-8"),r=!0,pe(n,i+`
190
+
191
+ `+o,"utf-8")}else pe(n,o,"utf-8");return e.services.log(` Path: ${n}`),r&&e.services.log(" Backup created"),{generated:!0,path:n,backupCreated:r}}generateContent(e){let t=e.domains.enabled.slice(0,6).join(", "),s=Math.max(0,e.domains.enabled.length-6);return`## Agentic QE v3
192
+
193
+ This project uses **Agentic QE v3** - a Domain-Driven Quality Engineering platform with 13 bounded contexts, ReasoningBank learning, HNSW vector search, and Agent Teams coordination (ADR-064).
194
+
195
+ ---
196
+
197
+ ### CRITICAL POLICIES
198
+
199
+ #### Integrity Rule (ABSOLUTE)
200
+ - NO shortcuts, fake data, or false claims
201
+ - ALWAYS implement properly, verify before claiming success
202
+ - ALWAYS use real database queries for integration tests
203
+ - ALWAYS run actual tests, not assume they pass
204
+
205
+ **We value the quality we deliver to our users.**
206
+
207
+ #### Test Execution
208
+ - NEVER run \`npm test\` without \`--run\` flag (watch mode risk)
209
+ - Use: \`npm test -- --run\`, \`npm run test:unit\`, \`npm run test:integration\` when available
210
+
211
+ #### Data Protection
212
+ - NEVER run \`rm -f\` on \`.agentic-qe/\` or \`*.db\` files without confirmation
213
+ - ALWAYS backup before database operations
214
+
215
+ #### Git Operations
216
+ - NEVER auto-commit/push without explicit user request
217
+ - ALWAYS wait for user confirmation before git operations
218
+
219
+ ---
220
+
221
+ ### Quick Reference
222
+
223
+ \`\`\`bash
224
+ # Run tests
225
+ npm test -- --run
226
+
227
+ # Check quality
228
+ aqe quality assess
229
+
230
+ # Generate tests
231
+ aqe test generate <file>
232
+
233
+ # Coverage analysis
234
+ aqe coverage <path>
235
+ \`\`\`
236
+
237
+ ### Using AQE MCP Tools
238
+
239
+ AQE exposes tools via MCP with the \`mcp__agentic-qe__\` prefix. You MUST call \`fleet_init\` before any other tool.
240
+
241
+ #### 1. Initialize the Fleet (required first step)
242
+
243
+ \`\`\`typescript
244
+ mcp__agentic-qe__fleet_init({
245
+ topology: "hierarchical",
246
+ maxAgents: 15,
247
+ memoryBackend: "hybrid"
248
+ })
249
+ \`\`\`
250
+
251
+ #### 2. Generate Tests
252
+
253
+ \`\`\`typescript
254
+ mcp__agentic-qe__test_generate_enhanced({
255
+ targetPath: "src/services/auth.ts",
256
+ framework: "vitest",
257
+ strategy: "boundary-value"
258
+ })
259
+ \`\`\`
260
+
261
+ #### 3. Analyze Coverage
262
+
263
+ \`\`\`typescript
264
+ mcp__agentic-qe__coverage_analyze_sublinear({
265
+ paths: ["src/"],
266
+ threshold: 80
267
+ })
268
+ \`\`\`
269
+
270
+ #### 4. Assess Quality
271
+
272
+ \`\`\`typescript
273
+ mcp__agentic-qe__quality_assess({
274
+ scope: "full",
275
+ includeMetrics: true
276
+ })
277
+ \`\`\`
278
+
279
+ #### 5. Store and Query Patterns (with learning persistence)
280
+
281
+ \`\`\`typescript
282
+ // Store a learned pattern
283
+ mcp__agentic-qe__memory_store({
284
+ key: "patterns/coverage-gap/{timestamp}",
285
+ namespace: "learning",
286
+ value: {
287
+ pattern: "...",
288
+ confidence: 0.95,
289
+ type: "coverage-gap",
290
+ metadata: { /* domain-specific */ }
291
+ },
292
+ persist: true
293
+ })
294
+
295
+ // Query stored patterns
296
+ mcp__agentic-qe__memory_query({
297
+ pattern: "patterns/*",
298
+ namespace: "learning",
299
+ limit: 10
300
+ })
301
+ \`\`\`
302
+
303
+ #### 6. Orchestrate Multi-Agent Tasks
304
+
305
+ \`\`\`typescript
306
+ mcp__agentic-qe__task_orchestrate({
307
+ task: "Full quality assessment of auth module",
308
+ domains: ["test-generation", "coverage-analysis", "security-compliance"],
309
+ parallel: true
310
+ })
311
+ \`\`\`
312
+
313
+ ### MCP Tool Reference
314
+
315
+ | Tool | Description |
316
+ |------|-------------|
317
+ | \`fleet_init\` | Initialize QE fleet (MUST call first) |
318
+ | \`fleet_status\` | Get fleet health and agent status |
319
+ | \`agent_spawn\` | Spawn specialized QE agent |
320
+ | \`test_generate_enhanced\` | AI-powered test generation |
321
+ | \`test_execute_parallel\` | Parallel test execution with retry |
322
+ | \`task_orchestrate\` | Orchestrate multi-agent QE tasks |
323
+ | \`coverage_analyze_sublinear\` | O(log n) coverage analysis |
324
+ | \`quality_assess\` | Quality gate evaluation |
325
+ | \`memory_store\` | Store patterns with namespace + persist |
326
+ | \`memory_query\` | Query patterns by namespace/pattern |
327
+ | \`security_scan_comprehensive\` | SAST/DAST scanning |
328
+
329
+ ### Configuration
330
+
331
+ - **Enabled Domains**: ${t}${s>0?` (+${s} more)`:""}
332
+ - **Learning**: ${e.learning.enabled?"Enabled":"Disabled"} (${e.learning.embeddingModel} embeddings)
333
+ - **Max Concurrent Agents**: ${e.agents.maxConcurrent}
334
+ - **Background Workers**: ${e.workers.enabled.length>0?e.workers.enabled.join(", "):"None"}
335
+
336
+ ### V3 QE Agents
337
+
338
+ QE agents are in \`.claude/agents/v3/\`. Use with Task tool:
339
+
340
+ \`\`\`javascript
341
+ Task({ prompt: "Generate tests", subagent_type: "qe-test-architect", run_in_background: true })
342
+ Task({ prompt: "Find coverage gaps", subagent_type: "qe-coverage-specialist", run_in_background: true })
343
+ Task({ prompt: "Security audit", subagent_type: "qe-security-scanner", run_in_background: true })
344
+ \`\`\`
345
+
346
+ ### Data Storage
347
+
348
+ - **Memory Backend**: \`.agentic-qe/memory.db\` (SQLite)
349
+ - **Configuration**: \`.agentic-qe/config.yaml\`
350
+
351
+ ---
352
+ *Generated by AQE v3 init - ${new Date().toISOString()}*
353
+ `}};import{existsSync as D,readFileSync as Xe}from"fs";import{join as F,dirname as Ze}from"path";import{mkdirSync as qe,writeFileSync as et}from"fs";le();var X=class extends h{name="verification";description="Verify installation";order=120;critical=!0;requiresPhases=["database","configuration"];async run(e){let t=e.config,{projectRoot:s}=e,n=[],o=F(s,".agentic-qe","memory.db");n.push({name:"Database exists",passed:D(o)}),n.push({name:".agentic-qe directory",passed:D(F(s,".agentic-qe"))});let r=F(s,".agentic-qe","config.yaml");await this.saveConfig(t,s),n.push({name:"Config saved",passed:D(r)});let i=await this.writeVersionToDb(t.version,s);n.push({name:"Version marker",passed:i});let l=["Database exists",".agentic-qe directory","Config saved"],c=n.filter(d=>l.includes(d.name)).every(d=>d.passed);e.services.log(" Verification checks:");for(let d of n){let g=l.includes(d.name),u=d.passed?"\u2713":g?"\u2717":"\u26A0",f=!g&&!d.passed?" (optional)":"";e.services.log(` ${u} ${d.name}${f}`)}return{verified:c,versionWritten:i,configSaved:D(r),checks:n}}async writeVersionToDb(e,t){let s=F(t,".agentic-qe","memory.db");try{let n=Ze(s);D(n)||qe(n,{recursive:!0});let o=_(s);try{o.exec(`
354
+ CREATE TABLE IF NOT EXISTS kv_store (
355
+ key TEXT NOT NULL,
356
+ namespace TEXT NOT NULL,
357
+ value TEXT NOT NULL,
358
+ expires_at INTEGER,
359
+ created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
360
+ PRIMARY KEY (namespace, key)
361
+ );
362
+ `);let r=Date.now();return o.prepare(`
363
+ INSERT OR REPLACE INTO kv_store (key, namespace, value, created_at)
364
+ VALUES (?, '_system', ?, ?)
365
+ `).run("aqe_version",JSON.stringify(e),r),o.prepare(`
366
+ INSERT OR REPLACE INTO kv_store (key, namespace, value, created_at)
367
+ VALUES (?, '_system', ?, ?)
368
+ `).run("init_timestamp",JSON.stringify(new Date().toISOString()),r),o.close(),!0}catch{return o.close(),!1}}catch{return!1}}async saveConfig(e,t){let s=F(t,".agentic-qe");D(s)||qe(s,{recursive:!0});let n=F(s,"config.yaml");if(D(n)){let r=this.loadExistingConfig(n);r&&(e=this.mergeConfigs(e,r))}let o=this.configToYAML(e);et(n,o,"utf-8")}loadExistingConfig(e){try{let t=Xe(e,"utf-8");return this.parseYAML(t)}catch{return null}}parseYAML(e){try{let t={},s=e.split(`
369
+ `),n="",o="";for(let i of s){if(i.trim().startsWith("#")||i.trim()==="")continue;let l=i.match(/^(\w+):\s*(.*)$/);if(l){n=l[1],o="";let u=l[2].trim();u&&!u.startsWith('"')?t[n]=this.parseValue(u):u?t[n]=this.parseValue(u):t[n]={};continue}let c=i.match(/^ (\w+):\s*(.*)$/);if(c&&n){o=c[1];let u=c[2].trim();t[n]||(t[n]={}),u?t[n][o]=this.parseValue(u):t[n][o]={};continue}let d=i.match(/^ ([\w-]+):\s*(.*)$/);if(d&&n&&o){let u=d[1],f=d[2].trim(),m=t[n];m[o]||(m[o]={}),typeof m[o]=="object"&&!Array.isArray(m[o])&&(m[o][u]=this.parseValue(f));continue}let g=i.match(/^ - "?([^"]*)"?$/);if(g&&n&&o){let u=t[n];Array.isArray(u[o])||(u[o]=[]),u[o].push(g[1])}}let r=[["domains","enabled"],["domains","disabled"],["workers","enabled"]];for(let[i,l]of r){let c=t[i];c&&l in c&&!Array.isArray(c[l])&&(c[l]=[])}return t}catch{return null}}parseValue(e){return e==="true"?!0:e==="false"?!1:/^\d+$/.test(e)?parseInt(e,10):/^\d+\.\d+$/.test(e)?parseFloat(e):e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}mergeConfigs(e,t){if(t.domains?.enabled&&Array.isArray(t.domains.enabled)){let s=new Set(t.domains.enabled),n=new Set(e.domains.enabled);for(let r of n)s.add(r);let o=new Set(Array.isArray(t.domains?.disabled)?t.domains.disabled:[]);e.domains.enabled=Array.from(s).filter(r=>!o.has(r))}return t.domains?.disabled&&Array.isArray(t.domains.disabled)&&(e.domains.disabled=t.domains.disabled),t.learning?.enabled!==void 0&&(e.learning.enabled=t.learning.enabled),t.hooks?.claudeCode!==void 0&&(e.hooks.claudeCode=t.hooks.claudeCode),t.hooks?.preCommit!==void 0&&(e.hooks.preCommit=t.hooks.preCommit),t.hooks?.ciIntegration!==void 0&&(e.hooks.ciIntegration=t.hooks.ciIntegration),t.workers?.enabled&&Array.isArray(t.workers.enabled)&&(e.workers.enabled=t.workers.enabled),t.workers?.daemonAutoStart!==void 0&&(e.workers.daemonAutoStart=t.workers.daemonAutoStart),t.agents?.maxConcurrent!==void 0&&(e.agents.maxConcurrent=t.agents.maxConcurrent),t.agents?.defaultTimeout!==void 0&&(e.agents.defaultTimeout=t.agents.defaultTimeout),e}configToYAML(e){return["# Agentic QE v3 Configuration","# Generated by aqe init",`# ${new Date().toISOString()}`,"#",'# NOTE: Your customizations are PRESERVED when you run "aqe init" again.','# You do NOT need to re-run "aqe init" after editing this file - changes',"# take effect immediately. The following settings are merged on reinstall:","# - domains.enabled (custom domains like visual-accessibility)","# - domains.disabled","# - learning.enabled","# - hooks.* preferences","# - workers.enabled","# - agents.maxConcurrent and defaultTimeout","",`version: "${e.version}"`,"","project:",` name: "${e.project.name}"`,` root: "${e.project.root}"`,` type: "${e.project.type}"`,"","learning:",` enabled: ${e.learning.enabled}`,` embeddingModel: "${e.learning.embeddingModel}"`," hnswConfig:",` M: ${e.learning.hnswConfig.M}`,` efConstruction: ${e.learning.hnswConfig.efConstruction}`,` efSearch: ${e.learning.hnswConfig.efSearch}`,` qualityThreshold: ${e.learning.qualityThreshold}`,` promotionThreshold: ${e.learning.promotionThreshold}`,` pretrainedPatterns: ${e.learning.pretrainedPatterns}`,"","routing:",` mode: "${e.routing.mode}"`,` confidenceThreshold: ${e.routing.confidenceThreshold}`,` feedbackEnabled: ${e.routing.feedbackEnabled}`,"","workers:"," enabled:",...e.workers.enabled.map(s=>` - "${s}"`)," intervals:",...Object.entries(e.workers.intervals).map(([s,n])=>` ${s}: ${n}`),` maxConcurrent: ${e.workers.maxConcurrent}`,` daemonAutoStart: ${e.workers.daemonAutoStart}`,"","hooks:",` claudeCode: ${e.hooks.claudeCode}`,` preCommit: ${e.hooks.preCommit}`,` ciIntegration: ${e.hooks.ciIntegration}`,"","skills:",` install: ${e.skills.install}`,` installV2: ${e.skills.installV2}`,` installV3: ${e.skills.installV3}`,` overwrite: ${e.skills.overwrite}`,"","domains:"," enabled:",...e.domains.enabled.map(s=>` - "${s}"`)," disabled:",...e.domains.disabled.map(s=>` - "${s}"`),"","agents:",` maxConcurrent: ${e.agents.maxConcurrent}`,` defaultTimeout: ${e.agents.defaultTimeout}`,""].join(`
370
+ `)}};ae();import{existsSync as j,mkdirSync as Te,readdirSync as Me,copyFileSync as Oe}from"fs";import{join as w,dirname as tt}from"path";import{fileURLToPath as nt}from"url";var st=nt(import.meta.url),Fe=tt(st);function rt(){let p=[w(Fe,"../../assets/governance"),w(Fe,"../assets/governance")],e=Ie(import.meta.url);e&&(p.push(w(e,"assets/governance")),p.push(w(e,"dist/assets/governance"))),p.push(w(process.cwd(),"node_modules/agentic-qe/assets/governance")),p.push(w(process.cwd(),"assets/governance"));for(let t of p)if(j(t))return t;throw new Error(`Governance assets not found. Package may be corrupted. Searched: ${p.join(", ")}`)}var ge=class{projectRoot;overwrite;skipShards;assetsPath;constructor(e){this.projectRoot=e.projectRoot,this.overwrite=e.overwrite??!1,this.skipShards=e.skipShards??!1,this.assetsPath=rt()}async install(){let e=[],t=[],s=[],n=w(this.projectRoot,".claude","guidance"),o=w(n,"shards");try{Te(n,{recursive:!0}),this.skipShards||Te(o,{recursive:!0})}catch(d){return s.push(`Failed to create governance directory: ${A(d)}`),{installed:e,skipped:t,errors:s,governanceDir:n,constitutionInstalled:!1,shardsInstalled:0}}let r=!1,i=w(this.assetsPath,"constitution.md"),l=w(n,"constitution.md");if(j(i))try{!j(l)||this.overwrite?(Oe(i,l),e.push("constitution.md"),r=!0):t.push("constitution.md")}catch(d){s.push(`Failed to install constitution.md: ${A(d)}`)}else s.push("constitution.md not found in assets");let c=0;if(!this.skipShards){let d=w(this.assetsPath,"shards");if(j(d))try{let g=Me(d).filter(u=>u.endsWith(".shard.md"));for(let u of g){let f=w(d,u),m=w(o,u);try{!j(m)||this.overwrite?(Oe(f,m),e.push(`shards/${u}`),c++):t.push(`shards/${u}`)}catch(v){s.push(`Failed to install ${u}: ${A(v)}`)}}}catch(g){s.push(`Failed to read shards directory: ${A(g)}`)}else s.push("Shards directory not found in assets")}return{installed:e,skipped:t,errors:s,governanceDir:n,constitutionInstalled:r,shardsInstalled:c}}isInstalled(){let e=w(this.projectRoot,".claude","guidance","constitution.md");return j(e)}getInstalledShards(){let e=w(this.projectRoot,".claude","guidance","shards");if(!j(e))return[];try{return Me(e).filter(t=>t.endsWith(".shard.md"))}catch{return[]}}};function Ne(p){return new ge(p)}var Z=class extends h{name="governance";description="Install governance configuration";order=95;critical=!1;requiresPhases=["configuration"];async shouldRun(e){return e.options.noGovernance?(e.services.log(" Governance skipped (--no-governance flag)"),!1):e.options.minimal?(e.services.log(" Governance skipped (minimal mode)"),!1):!0}async run(e){let{projectRoot:t,options:s}=e,n=s.upgrade,o=Ne({projectRoot:t,overwrite:n});if(o.isInstalled()&&!n){let i=o.getInstalledShards();return e.services.log(` Governance already installed (${i.length} shards)`),e.services.log(" Use --upgrade to overwrite existing files"),{filesInstalled:0,filesSkipped:1+i.length,constitutionInstalled:!1,shardsInstalled:0,governanceDir:`${t}/.claude/guidance`,skippedByFlag:!1}}let r=await o.install();if(r.errors.length>0)for(let i of r.errors)e.services.warn(` ${i}`);return e.services.log(` Constitution: ${r.constitutionInstalled?"installed":"skipped"}`),e.services.log(` Shards: ${r.shardsInstalled} installed, ${r.skipped.filter(i=>i.startsWith("shards/")).length} skipped`),r.installed.length>0&&(e.services.log(" Governance enabled (non-strict mode by default)"),e.services.log(" Set GOVERNANCE_STRICT_MODE=true for strict enforcement")),{filesInstalled:r.installed.length,filesSkipped:r.skipped.length,constitutionInstalled:r.constitutionInstalled,shardsInstalled:r.shardsInstalled,governanceDir:r.governanceDir,skippedByFlag:!1}}};var ot=new N,it=new Q,at=new L,lt=new H,ct=new G,dt=new U,ut=new B,pt=new z,gt=new K,mt=new Y,ft=new J,ht=new X,yt=new Z;function Qe(){return[ot,it,at,lt,ct,dt,ut,pt,gt,yt,mt,ft,ht]}var me=class{phases;context;constructor(e){this.context=this.createContext(e),this.phases=e.customPhases??Qe()}createContext(e){let t=e.withAllPlatforms;return{projectRoot:e.projectRoot,options:{autoMode:e.autoMode,upgrade:e.upgrade,skipPatterns:e.skipPatterns,skipCodeIndex:e.skipCodeIndex,minimal:e.minimal,withN8n:e.withN8n,withOpenCode:e.withOpenCode,withKiro:e.withKiro,withCopilot:e.withCopilot||t,withCursor:e.withCursor||t,withCline:e.withCline||t,withKiloCode:e.withKiloCode||t,withRooCode:e.withRooCode||t,withCodex:e.withCodex||t,withWindsurf:e.withWindsurf||t,withContinueDev:e.withContinueDev||t,withAllPlatforms:e.withAllPlatforms,n8nApiConfig:e.n8nApiConfig,wizardAnswers:e.wizardAnswers,noGovernance:e.noGovernance,noMcp:e.noMcp},config:{},enhancements:{claudeFlow:!1,ruvector:!1},results:new Map,services:{log:s=>console.log(s),warn:s=>console.warn(s),error:s=>console.error(s)}}}async initialize(){let e=Date.now(),t=[];try{let s=[...this.phases].sort((n,o)=>n.order-o.order);for(let n of s){if(!await n.shouldRun(this.context))continue;console.log(`
371
+ \u{1F4CB} ${n.description}...`);let r=await n.execute(this.context);if(this.context.results.set(n.name,r),t.push({step:n.description,status:r.success?"success":"error",message:r.message||"",durationMs:r.durationMs}),!r.success&&n.critical){if(console.error(`
372
+ \u274C Critical phase failed: ${n.name}`),n.rollback)try{await n.rollback(this.context)}catch(i){console.error(`Rollback failed: ${i}`)}return this.createFailureResult(t,e)}if(r.skipRemaining)break}return this.createSuccessResult(t,e)}catch(s){return t.push({step:"Initialization Failed",status:"error",message:A(s),durationMs:0}),this.createFailureResult(t,e)}}createSuccessResult(e,t){let s=this.context.config,n=this.context.results.get("learning"),o=this.context.results.get("code-intelligence"),r=this.context.results.get("assets"),i=this.context.results.get("hooks"),l=this.context.results.get("mcp"),c=this.context.results.get("claude-md"),d=this.context.results.get("workers");return{success:!0,config:s||ce("unknown",this.context.projectRoot),steps:e,summary:{projectAnalyzed:this.context.results.has("analysis"),configGenerated:this.context.results.has("configuration"),codeIntelligenceIndexed:o?.data?.entries??0,patternsLoaded:n?.data?.patternsLoaded??0,skillsInstalled:r?.data?.skillsInstalled??0,agentsInstalled:r?.data?.agentsInstalled??0,hooksConfigured:i?.data?.configured??!1,mcpConfigured:l?.data?.configured??!1,claudeMdGenerated:c?.data?.generated??!1,workersStarted:d?.data?.workersConfigured??0},totalDurationMs:Date.now()-t,timestamp:new Date}}createFailureResult(e,t){return{success:!1,config:ce("unknown",this.context.projectRoot),steps:e,summary:{projectAnalyzed:!1,configGenerated:!1,codeIntelligenceIndexed:0,patternsLoaded:0,skillsInstalled:0,agentsInstalled:0,hooksConfigured:!1,mcpConfigured:!1,claudeMdGenerated:!1,workersStarted:0},totalDurationMs:Date.now()-t,timestamp:new Date}}getPhase(e){return this.phases.find(t=>t.name===e)}getPhases(){return[...this.phases]}getContext(){return this.context}};function vt(p){return new me(p)}async function bs(p){return await vt({projectRoot:p,autoMode:!0}).initialize()}function ws(p){let e=[];e.push(""),e.push("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"),e.push("\u2502 AQE v3 Initialization \u2502"),e.push("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");for(let s of p.steps){let n=s.status==="success"?"\u2713":s.status==="error"?"\u2717":"\u25CB",o=s.step.substring(0,48).padEnd(48);e.push(`\u2502 ${n} ${o} ${String(s.durationMs).padStart(4)}ms \u2502`)}e.push("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"),e.push(`\u2502 Project: ${p.config.project.name.substring(0,45).padEnd(45)} \u2502`),e.push(`\u2502 Type: ${p.config.project.type.padEnd(48)} \u2502`),e.push(`\u2502 Code Intel: ${String(p.summary.codeIntelligenceIndexed).padEnd(43)} \u2502`),e.push(`\u2502 Patterns: ${String(p.summary.patternsLoaded).padEnd(45)} \u2502`),e.push(`\u2502 Skills: ${String(p.summary.skillsInstalled).padEnd(47)} \u2502`),e.push(`\u2502 Agents: ${String(p.summary.agentsInstalled).padEnd(47)} \u2502`),e.push(`\u2502 Workers: ${String(p.summary.workersStarted).padEnd(46)} \u2502`),e.push(`\u2502 Hooks: ${p.summary.hooksConfigured?"Yes":"No".padEnd(48)} \u2502`),e.push(`\u2502 MCP: ${p.summary.mcpConfigured?"Yes":"No".padEnd(50)} \u2502`),e.push(`\u2502 CLAUDE.md: ${p.summary.claudeMdGenerated?"Yes":"No".padEnd(44)} \u2502`),e.push("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");let t=p.success?"\u2713 AQE v3 initialized successfully":"\u2717 Initialization failed";return e.push(`\u2502 ${t.padEnd(57)} \u2502`),e.push("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"),e.push(""),e.join(`
373
+ `)}export{me as ModularInitOrchestrator,vt as createModularInitOrchestrator,ws as formatInitResultModular,bs as quickInitModular};
@@ -1,5 +1,5 @@
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.5");process.exit(0)}
2
- import{a as y,b as w,c as u}from"./chunk-DFOANC7Z.js";import"./chunk-GHFXURNS.js";import{Command as O}from"commander";import{resolve as A}from"path";import s from"chalk";import*as M from"node:fs/promises";import{parse as W}from"yaml";var E=["eq","neq","gt","gte","lt","lte","contains","exists"],D=["sequential","parallel"],N=/\$\{([^}]+)\}/g,k=class{parse(r,t){try{let n=this.interpolateVariables(r,t??{}),a=W(n);return this.validateAndConvert(a)}catch(n){return u(n instanceof Error?new Error(`YAML parse error: ${n.message}`):new Error(`YAML parse error: ${String(n)}`))}}async loadFromFile(r,t){try{let n=await M.readFile(r,"utf-8");return this.parse(n,t)}catch(n){return u(n instanceof Error?new Error(`Failed to read pipeline file '${r}': ${n.message}`):new Error(`Failed to read pipeline file '${r}': ${String(n)}`))}}interpolateVariables(r,t){return r.replace(N,(n,a)=>{let o=this.resolveVarPath(t,a);return o===void 0?n:String(o)})}validateSchema(r){return this.validateAndConvert(r)}validateAndConvert(r){if(!r||typeof r!="object"||Array.isArray(r))return u(new Error("YAML must parse to an object"));let t=r;if(!t.id||typeof t.id!="string")return u(new Error("Missing or invalid required field 'id' (string)"));if(!t.name||typeof t.name!="string")return u(new Error("Missing or invalid required field 'name' (string)"));if(!t.steps||!Array.isArray(t.steps)||t.steps.length===0)return u(new Error("'steps' must be a non-empty array"));let n=typeof t.description=="string"?t.description:"",a=typeof t.version=="string"?t.version:"1.0.0",o;if(t.defaultMode!==void 0){if(!D.includes(t.defaultMode))return u(new Error(`Invalid defaultMode '${String(t.defaultMode)}'. Must be one of: ${D.join(", ")}`));o=t.defaultMode}let e;if(t.timeout!==void 0){if(typeof t.timeout!="number"||t.timeout<=0)return u(new Error("'timeout' must be a positive number"));e=t.timeout}let i=Array.isArray(t.tags)?t.tags.filter(g=>typeof g=="string"):void 0,l=this.validateSteps(t.steps);if(!l.success)return l;let d;if(t.triggers!==void 0){if(!Array.isArray(t.triggers))return u(new Error("'triggers' must be an array"));let g=this.validateTriggers(t.triggers);if(!g.success)return g;d=g.value}let p=this.detectCircularDependencies(l.value);if(p)return u(new Error(`Circular dependency detected: ${p}`));let c={id:t.id,name:t.name,description:n,version:a,steps:l.value,...o!==void 0&&{defaultMode:o},...e!==void 0&&{timeout:e},...i!==void 0&&{tags:i},...d!==void 0&&{triggers:d}};return w(c)}validateSteps(r){let t=[],n=new Set;for(let a=0;a<r.length;a++){let o=r[a];if(!o||typeof o!="object"||Array.isArray(o))return u(new Error(`Step at index ${a} must be an object`));let e=o;if(!e.id||typeof e.id!="string")return u(new Error(`Step at index ${a}: missing or invalid 'id' (string)`));if(n.has(e.id))return u(new Error(`Duplicate step ID: ${e.id}`));if(n.add(e.id),!e.name||typeof e.name!="string")return u(new Error(`Step '${e.id}': missing or invalid 'name' (string)`));if(!e.domain||typeof e.domain!="string")return u(new Error(`Step '${e.id}': missing or invalid 'domain' (string)`));if(!y.includes(e.domain))return u(new Error(`Step '${e.id}': invalid domain '${e.domain}'. Must be one of: ${y.join(", ")}`));if(!e.action||typeof e.action!="string")return u(new Error(`Step '${e.id}': missing or invalid 'action' (string)`));let i=this.validateStringRecord(e.inputMapping,`Step '${e.id}'.inputMapping`);if(i!==void 0&&i instanceof Error)return u(i);let l=this.validateStringRecord(e.outputMapping,`Step '${e.id}'.outputMapping`);if(l!==void 0&&l instanceof Error)return u(l);let d;if(e.dependsOn!==void 0){if(!Array.isArray(e.dependsOn)||!e.dependsOn.every(f=>typeof f=="string"))return u(new Error(`Step '${e.id}': 'dependsOn' must be an array of strings`));for(let f of e.dependsOn)if(!r.some(j=>j.id===f))return u(new Error(`Step '${e.id}' depends on unknown step: ${f}`));d=e.dependsOn}let p;if(e.condition!==void 0){let f=this.validateCondition(e.condition,`Step '${e.id}'.condition`);if(!f.success)return f;p=f.value}let c;if(e.skipCondition!==void 0){let f=this.validateCondition(e.skipCondition,`Step '${e.id}'.skipCondition`);if(!f.success)return f;c=f.value}let g;if(e.timeout!==void 0){if(typeof e.timeout!="number"||e.timeout<=0)return u(new Error(`Step '${e.id}': 'timeout' must be a positive number`));g=e.timeout}let $;if(e.retry!==void 0){let f=this.validateRetry(e.retry,e.id);if(!f.success)return f;$=f.value}let b;if(e.rollback!==void 0){let f=this.validateRollback(e.rollback,e.id);if(!f.success)return f;b=f.value}let R=typeof e.continueOnFailure=="boolean"?e.continueOnFailure:void 0,S;if(e.approval!==void 0){let f=this.validateApproval(e.approval,e.id);if(!f.success)return f;S=f.value}let C={id:e.id,name:e.name,domain:e.domain,action:e.action,...i!==void 0&&{inputMapping:i},...l!==void 0&&{outputMapping:l},...d!==void 0&&{dependsOn:d},...p!==void 0&&{condition:p},...c!==void 0&&{skipCondition:c},...g!==void 0&&{timeout:g},...$!==void 0&&{retry:$},...b!==void 0&&{rollback:b},...R!==void 0&&{continueOnFailure:R},...S!==void 0&&{approval:S}};t.push(C)}return w(t)}validateCondition(r,t){if(!r||typeof r!="object"||Array.isArray(r))return u(new Error(`${t}: must be an object with path, operator, value`));let n=r;return!n.path||typeof n.path!="string"?u(new Error(`${t}: missing or invalid 'path' (string)`)):!n.operator||typeof n.operator!="string"?u(new Error(`${t}: missing or invalid 'operator' (string)`)):E.includes(n.operator)?n.value===void 0?u(new Error(`${t}: missing 'value'`)):w({path:n.path,operator:n.operator,value:n.value}):u(new Error(`${t}: invalid operator '${n.operator}'. Must be one of: ${E.join(", ")}`))}validateTriggers(r){let t=[];for(let n=0;n<r.length;n++){let a=r[n];if(!a||typeof a!="object"||Array.isArray(a))return u(new Error(`Trigger at index ${n} must be an object`));let o=a;if(!o.eventType||typeof o.eventType!="string")return u(new Error(`Trigger at index ${n}: missing or invalid 'eventType' (string)`));let e;if(o.sourceDomain!==void 0){if(typeof o.sourceDomain!="string"||!y.includes(o.sourceDomain))return u(new Error(`Trigger at index ${n}: invalid 'sourceDomain' '${String(o.sourceDomain)}'`));e=o.sourceDomain}let i;if(o.condition!==void 0){let d=this.validateCondition(o.condition,`Trigger at index ${n}.condition`);if(!d.success)return d;i=d.value}let l=this.validateStringRecord(o.inputMapping,`Trigger at index ${n}.inputMapping`);if(l!==void 0&&l instanceof Error)return u(l);t.push({eventType:o.eventType,...e!==void 0&&{sourceDomain:e},...i!==void 0&&{condition:i},...l!==void 0&&{inputMapping:l}})}return w(t)}validateRetry(r,t){if(!r||typeof r!="object"||Array.isArray(r))return u(new Error(`Step '${t}': 'retry' must be an object`));let n=r;return typeof n.maxAttempts!="number"||n.maxAttempts<1?u(new Error(`Step '${t}': retry.maxAttempts must be a positive integer`)):typeof n.backoffMs!="number"||n.backoffMs<0?u(new Error(`Step '${t}': retry.backoffMs must be a non-negative number`)):w({maxAttempts:n.maxAttempts,backoffMs:n.backoffMs,...typeof n.backoffMultiplier=="number"&&{backoffMultiplier:n.backoffMultiplier}})}validateRollback(r,t){if(!r||typeof r!="object"||Array.isArray(r))return u(new Error(`Step '${t}': 'rollback' must be an object`));let n=r;return!n.domain||typeof n.domain!="string"||!y.includes(n.domain)?u(new Error(`Step '${t}': rollback.domain is invalid or missing`)):!n.action||typeof n.action!="string"?u(new Error(`Step '${t}': rollback.action is required (string)`)):w({domain:n.domain,action:n.action,...n.input!==void 0&&typeof n.input=="object"&&{input:n.input}})}validateApproval(r,t){if(typeof r=="boolean")return w(r);if(!r||typeof r!="object"||Array.isArray(r))return u(new Error(`Step '${t}': 'approval' must be a boolean or object`));let n=r,a={};if(n.autoApproveAfter!==void 0){if(typeof n.autoApproveAfter!="number"||n.autoApproveAfter<0)return u(new Error(`Step '${t}': approval.autoApproveAfter must be a non-negative number`));a.autoApproveAfter=n.autoApproveAfter}if(n.message!==void 0){if(typeof n.message!="string")return u(new Error(`Step '${t}': approval.message must be a string`));a.message=n.message}return w(a)}validateStringRecord(r,t){if(r==null)return;if(typeof r!="object"||Array.isArray(r))return new Error(`${t}: must be an object with string values`);let n=r;for(let[a,o]of Object.entries(n))if(typeof o!="string")return new Error(`${t}: value for key '${a}' must be a string, got ${typeof o}`);return n}resolveVarPath(r,t){if(t in r)return r[t];let n=t.split("."),a=r;for(let o of n){if(a==null||typeof a!="object")return;a=a[o]}return a}detectCircularDependencies(r){let t=new Set,n=new Set,a=(o,e)=>{if(n.has(o))return[...e,o].join(" -> ");if(t.has(o))return null;t.add(o),n.add(o);let i=r.find(l=>l.id===o);if(i?.dependsOn)for(let l of i.dependsOn){let d=a(l,[...e,o]);if(d)return d}return n.delete(o),null};for(let o of r){let e=a(o.id,[]);if(e)return e}return null}};function h(m){let r={};for(let t of m){let n=t.indexOf("=");if(n===-1)r[t]=!0;else{let a=t.slice(0,n),o=t.slice(n+1);o==="true"?r[a]=!0:o==="false"?r[a]=!1:!isNaN(Number(o))&&o!==""?r[a]=Number(o):r[a]=o}}return r}function T(m){return h(m)}function v(m){return m.workflowOrchestrator}function X(m,r,t){let n=new k,a=new O("pipeline").description("Manage YAML deterministic pipelines (Imp-9)");return a.command("load <file>").description("Load and register a pipeline from a YAML file").option("--vars <entries...>","Variable substitutions (key=value)").action(async(o,e)=>{if(!await t())return;let i=v(m);if(!i){console.error(s.red(' Workflow orchestrator not available. Run "aqe fleet init" first.')),await r(1);return}let l=A(o),d=e.vars?h(e.vars):void 0;console.log(s.blue(`
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.7");process.exit(0)}
2
+ import{a as y,b as w,c as u}from"./chunk-ZSXSUUBS.js";import"./chunk-UEFAPTBV.js";import{Command as O}from"commander";import{resolve as A}from"path";import s from"chalk";import*as M from"node:fs/promises";import{parse as W}from"yaml";var E=["eq","neq","gt","gte","lt","lte","contains","exists"],D=["sequential","parallel"],N=/\$\{([^}]+)\}/g,k=class{parse(r,t){try{let n=this.interpolateVariables(r,t??{}),a=W(n);return this.validateAndConvert(a)}catch(n){return u(n instanceof Error?new Error(`YAML parse error: ${n.message}`):new Error(`YAML parse error: ${String(n)}`))}}async loadFromFile(r,t){try{let n=await M.readFile(r,"utf-8");return this.parse(n,t)}catch(n){return u(n instanceof Error?new Error(`Failed to read pipeline file '${r}': ${n.message}`):new Error(`Failed to read pipeline file '${r}': ${String(n)}`))}}interpolateVariables(r,t){return r.replace(N,(n,a)=>{let o=this.resolveVarPath(t,a);return o===void 0?n:String(o)})}validateSchema(r){return this.validateAndConvert(r)}validateAndConvert(r){if(!r||typeof r!="object"||Array.isArray(r))return u(new Error("YAML must parse to an object"));let t=r;if(!t.id||typeof t.id!="string")return u(new Error("Missing or invalid required field 'id' (string)"));if(!t.name||typeof t.name!="string")return u(new Error("Missing or invalid required field 'name' (string)"));if(!t.steps||!Array.isArray(t.steps)||t.steps.length===0)return u(new Error("'steps' must be a non-empty array"));let n=typeof t.description=="string"?t.description:"",a=typeof t.version=="string"?t.version:"1.0.0",o;if(t.defaultMode!==void 0){if(!D.includes(t.defaultMode))return u(new Error(`Invalid defaultMode '${String(t.defaultMode)}'. Must be one of: ${D.join(", ")}`));o=t.defaultMode}let e;if(t.timeout!==void 0){if(typeof t.timeout!="number"||t.timeout<=0)return u(new Error("'timeout' must be a positive number"));e=t.timeout}let i=Array.isArray(t.tags)?t.tags.filter(g=>typeof g=="string"):void 0,l=this.validateSteps(t.steps);if(!l.success)return l;let d;if(t.triggers!==void 0){if(!Array.isArray(t.triggers))return u(new Error("'triggers' must be an array"));let g=this.validateTriggers(t.triggers);if(!g.success)return g;d=g.value}let p=this.detectCircularDependencies(l.value);if(p)return u(new Error(`Circular dependency detected: ${p}`));let c={id:t.id,name:t.name,description:n,version:a,steps:l.value,...o!==void 0&&{defaultMode:o},...e!==void 0&&{timeout:e},...i!==void 0&&{tags:i},...d!==void 0&&{triggers:d}};return w(c)}validateSteps(r){let t=[],n=new Set;for(let a=0;a<r.length;a++){let o=r[a];if(!o||typeof o!="object"||Array.isArray(o))return u(new Error(`Step at index ${a} must be an object`));let e=o;if(!e.id||typeof e.id!="string")return u(new Error(`Step at index ${a}: missing or invalid 'id' (string)`));if(n.has(e.id))return u(new Error(`Duplicate step ID: ${e.id}`));if(n.add(e.id),!e.name||typeof e.name!="string")return u(new Error(`Step '${e.id}': missing or invalid 'name' (string)`));if(!e.domain||typeof e.domain!="string")return u(new Error(`Step '${e.id}': missing or invalid 'domain' (string)`));if(!y.includes(e.domain))return u(new Error(`Step '${e.id}': invalid domain '${e.domain}'. Must be one of: ${y.join(", ")}`));if(!e.action||typeof e.action!="string")return u(new Error(`Step '${e.id}': missing or invalid 'action' (string)`));let i=this.validateStringRecord(e.inputMapping,`Step '${e.id}'.inputMapping`);if(i!==void 0&&i instanceof Error)return u(i);let l=this.validateStringRecord(e.outputMapping,`Step '${e.id}'.outputMapping`);if(l!==void 0&&l instanceof Error)return u(l);let d;if(e.dependsOn!==void 0){if(!Array.isArray(e.dependsOn)||!e.dependsOn.every(f=>typeof f=="string"))return u(new Error(`Step '${e.id}': 'dependsOn' must be an array of strings`));for(let f of e.dependsOn)if(!r.some(j=>j.id===f))return u(new Error(`Step '${e.id}' depends on unknown step: ${f}`));d=e.dependsOn}let p;if(e.condition!==void 0){let f=this.validateCondition(e.condition,`Step '${e.id}'.condition`);if(!f.success)return f;p=f.value}let c;if(e.skipCondition!==void 0){let f=this.validateCondition(e.skipCondition,`Step '${e.id}'.skipCondition`);if(!f.success)return f;c=f.value}let g;if(e.timeout!==void 0){if(typeof e.timeout!="number"||e.timeout<=0)return u(new Error(`Step '${e.id}': 'timeout' must be a positive number`));g=e.timeout}let $;if(e.retry!==void 0){let f=this.validateRetry(e.retry,e.id);if(!f.success)return f;$=f.value}let b;if(e.rollback!==void 0){let f=this.validateRollback(e.rollback,e.id);if(!f.success)return f;b=f.value}let R=typeof e.continueOnFailure=="boolean"?e.continueOnFailure:void 0,S;if(e.approval!==void 0){let f=this.validateApproval(e.approval,e.id);if(!f.success)return f;S=f.value}let C={id:e.id,name:e.name,domain:e.domain,action:e.action,...i!==void 0&&{inputMapping:i},...l!==void 0&&{outputMapping:l},...d!==void 0&&{dependsOn:d},...p!==void 0&&{condition:p},...c!==void 0&&{skipCondition:c},...g!==void 0&&{timeout:g},...$!==void 0&&{retry:$},...b!==void 0&&{rollback:b},...R!==void 0&&{continueOnFailure:R},...S!==void 0&&{approval:S}};t.push(C)}return w(t)}validateCondition(r,t){if(!r||typeof r!="object"||Array.isArray(r))return u(new Error(`${t}: must be an object with path, operator, value`));let n=r;return!n.path||typeof n.path!="string"?u(new Error(`${t}: missing or invalid 'path' (string)`)):!n.operator||typeof n.operator!="string"?u(new Error(`${t}: missing or invalid 'operator' (string)`)):E.includes(n.operator)?n.value===void 0?u(new Error(`${t}: missing 'value'`)):w({path:n.path,operator:n.operator,value:n.value}):u(new Error(`${t}: invalid operator '${n.operator}'. Must be one of: ${E.join(", ")}`))}validateTriggers(r){let t=[];for(let n=0;n<r.length;n++){let a=r[n];if(!a||typeof a!="object"||Array.isArray(a))return u(new Error(`Trigger at index ${n} must be an object`));let o=a;if(!o.eventType||typeof o.eventType!="string")return u(new Error(`Trigger at index ${n}: missing or invalid 'eventType' (string)`));let e;if(o.sourceDomain!==void 0){if(typeof o.sourceDomain!="string"||!y.includes(o.sourceDomain))return u(new Error(`Trigger at index ${n}: invalid 'sourceDomain' '${String(o.sourceDomain)}'`));e=o.sourceDomain}let i;if(o.condition!==void 0){let d=this.validateCondition(o.condition,`Trigger at index ${n}.condition`);if(!d.success)return d;i=d.value}let l=this.validateStringRecord(o.inputMapping,`Trigger at index ${n}.inputMapping`);if(l!==void 0&&l instanceof Error)return u(l);t.push({eventType:o.eventType,...e!==void 0&&{sourceDomain:e},...i!==void 0&&{condition:i},...l!==void 0&&{inputMapping:l}})}return w(t)}validateRetry(r,t){if(!r||typeof r!="object"||Array.isArray(r))return u(new Error(`Step '${t}': 'retry' must be an object`));let n=r;return typeof n.maxAttempts!="number"||n.maxAttempts<1?u(new Error(`Step '${t}': retry.maxAttempts must be a positive integer`)):typeof n.backoffMs!="number"||n.backoffMs<0?u(new Error(`Step '${t}': retry.backoffMs must be a non-negative number`)):w({maxAttempts:n.maxAttempts,backoffMs:n.backoffMs,...typeof n.backoffMultiplier=="number"&&{backoffMultiplier:n.backoffMultiplier}})}validateRollback(r,t){if(!r||typeof r!="object"||Array.isArray(r))return u(new Error(`Step '${t}': 'rollback' must be an object`));let n=r;return!n.domain||typeof n.domain!="string"||!y.includes(n.domain)?u(new Error(`Step '${t}': rollback.domain is invalid or missing`)):!n.action||typeof n.action!="string"?u(new Error(`Step '${t}': rollback.action is required (string)`)):w({domain:n.domain,action:n.action,...n.input!==void 0&&typeof n.input=="object"&&{input:n.input}})}validateApproval(r,t){if(typeof r=="boolean")return w(r);if(!r||typeof r!="object"||Array.isArray(r))return u(new Error(`Step '${t}': 'approval' must be a boolean or object`));let n=r,a={};if(n.autoApproveAfter!==void 0){if(typeof n.autoApproveAfter!="number"||n.autoApproveAfter<0)return u(new Error(`Step '${t}': approval.autoApproveAfter must be a non-negative number`));a.autoApproveAfter=n.autoApproveAfter}if(n.message!==void 0){if(typeof n.message!="string")return u(new Error(`Step '${t}': approval.message must be a string`));a.message=n.message}return w(a)}validateStringRecord(r,t){if(r==null)return;if(typeof r!="object"||Array.isArray(r))return new Error(`${t}: must be an object with string values`);let n=r;for(let[a,o]of Object.entries(n))if(typeof o!="string")return new Error(`${t}: value for key '${a}' must be a string, got ${typeof o}`);return n}resolveVarPath(r,t){if(t in r)return r[t];let n=t.split("."),a=r;for(let o of n){if(a==null||typeof a!="object")return;a=a[o]}return a}detectCircularDependencies(r){let t=new Set,n=new Set,a=(o,e)=>{if(n.has(o))return[...e,o].join(" -> ");if(t.has(o))return null;t.add(o),n.add(o);let i=r.find(l=>l.id===o);if(i?.dependsOn)for(let l of i.dependsOn){let d=a(l,[...e,o]);if(d)return d}return n.delete(o),null};for(let o of r){let e=a(o.id,[]);if(e)return e}return null}};function h(m){let r={};for(let t of m){let n=t.indexOf("=");if(n===-1)r[t]=!0;else{let a=t.slice(0,n),o=t.slice(n+1);o==="true"?r[a]=!0:o==="false"?r[a]=!1:!isNaN(Number(o))&&o!==""?r[a]=Number(o):r[a]=o}}return r}function T(m){return h(m)}function v(m){return m.workflowOrchestrator}function X(m,r,t){let n=new k,a=new O("pipeline").description("Manage YAML deterministic pipelines (Imp-9)");return a.command("load <file>").description("Load and register a pipeline from a YAML file").option("--vars <entries...>","Variable substitutions (key=value)").action(async(o,e)=>{if(!await t())return;let i=v(m);if(!i){console.error(s.red(' Workflow orchestrator not available. Run "aqe fleet init" first.')),await r(1);return}let l=A(o),d=e.vars?h(e.vars):void 0;console.log(s.blue(`
3
3
  Loading pipeline from: ${o}
4
4
  `));let p=await n.loadFromFile(l,d);if(!p.success){console.error(s.red(` Parse error: ${p.error.message}`)),await r(1);return}let c=p.value,g=i.registerWorkflow(c);if(!g.success){console.error(s.red(` Registration error: ${g.error.message}`)),await r(1);return}console.log(s.green(" Pipeline loaded successfully.")),console.log(` ID: ${s.cyan(c.id)}`),console.log(` Name: ${s.cyan(c.name)}`),console.log(` Steps: ${s.cyan(c.steps.length)}`),console.log(` Version: ${s.cyan(c.version)}`),c.tags?.length&&console.log(` Tags: ${s.cyan(c.tags.join(", "))}`),console.log(""),await r(0)}),a.command("validate <file>").description("Validate a YAML pipeline without registering it").option("--vars <entries...>","Variable substitutions (key=value)").action(async(o,e)=>{let i=A(o),l=e.vars?h(e.vars):void 0;console.log(s.blue(`
5
5
  Validating pipeline: ${o}