agentic-qe 3.8.13 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +48 -0
  3. package/dist/adapters/a2ui/integration/agui-sync.js +2 -1
  4. package/dist/audit/witness-chain.js +15 -3
  5. package/dist/boot/fast-paths.d.ts +24 -0
  6. package/dist/boot/fast-paths.js +43 -0
  7. package/dist/boot/parallel-prefetch.d.ts +26 -0
  8. package/dist/boot/parallel-prefetch.js +36 -0
  9. package/dist/cli/bundle.js +12 -9431
  10. package/dist/cli/chunks/adapter-WBR5NXS3.js +2 -0
  11. package/dist/cli/chunks/agent-booster-wasm-PQYB7VRU.js +2 -0
  12. package/dist/cli/chunks/agent-handler-QDAB5NQS.js +33 -0
  13. package/dist/cli/chunks/aqe-learning-engine-TK4JQCGT.js +2 -0
  14. package/dist/cli/chunks/audit-S7JUYYVP.js +3 -0
  15. package/dist/cli/chunks/base-2WXOSMBQ.js +2 -0
  16. package/dist/cli/chunks/better-sqlite3-7KY2RDXO.js +2 -0
  17. package/dist/cli/chunks/brain-handler-PPEGDCN4.js +68 -0
  18. package/dist/cli/chunks/branch-enumerator-XK4V5W7L.js +7 -0
  19. package/dist/cli/chunks/browser-PALA5PL3.js +4 -0
  20. package/dist/cli/chunks/browser-workflow-42F7GK5T.js +2 -0
  21. package/dist/cli/chunks/chunk-24FKIJNC.js +15 -0
  22. package/dist/cli/chunks/chunk-263XS447.js +2 -0
  23. package/dist/cli/chunks/chunk-2BZFNEN2.js +4 -0
  24. package/dist/cli/chunks/chunk-2E5NQNSU.js +180 -0
  25. package/dist/cli/chunks/chunk-2I7J3O6V.js +2 -0
  26. package/dist/cli/chunks/chunk-3ADGXLTM.js +14 -0
  27. package/dist/cli/chunks/chunk-3IHG3WOY.js +12 -0
  28. package/dist/cli/chunks/chunk-3IUNFTIF.js +2 -0
  29. package/dist/cli/chunks/chunk-3JPRUND5.js +2 -0
  30. package/dist/cli/chunks/chunk-3NZLZHJI.js +2 -0
  31. package/dist/cli/chunks/chunk-3THRQEZ2.js +95 -0
  32. package/dist/cli/chunks/chunk-3ZOONQG6.js +2 -0
  33. package/dist/cli/chunks/chunk-4B6NCELM.js +2 -0
  34. package/dist/cli/chunks/chunk-4I2IOUS4.js +2 -0
  35. package/dist/cli/chunks/chunk-4VBTXZRM.js +2 -0
  36. package/dist/cli/chunks/chunk-4VUPRTVX.js +3 -0
  37. package/dist/cli/chunks/chunk-4YOMLWEK.js +70 -0
  38. package/dist/cli/chunks/chunk-4YS3IJ45.js +2 -0
  39. package/dist/cli/chunks/chunk-5SKGFSKD.js +2 -0
  40. package/dist/cli/chunks/chunk-5T2ZQWKF.js +27 -0
  41. package/dist/cli/chunks/chunk-62ADTHV7.js +2 -0
  42. package/dist/cli/chunks/chunk-6EOS7KX2.js +2 -0
  43. package/dist/cli/chunks/chunk-6SVX4DJC.js +6 -0
  44. package/dist/cli/chunks/chunk-72WOAVK6.js +2 -0
  45. package/dist/cli/chunks/chunk-7R6YMLVS.js +3 -0
  46. package/dist/cli/chunks/chunk-7VDBAVTY.js +2 -0
  47. package/dist/cli/chunks/chunk-AFLLQ5PP.js +15 -0
  48. package/dist/cli/chunks/chunk-AKE543X2.js +2 -0
  49. package/dist/cli/chunks/chunk-B36CDR4U.js +2 -0
  50. package/dist/cli/chunks/chunk-B6LLWYQ6.js +2 -0
  51. package/dist/cli/chunks/chunk-BDIEMZ22.js +91 -0
  52. package/dist/cli/chunks/chunk-BGXNSCXX.js +4 -0
  53. package/dist/cli/chunks/chunk-BLBRY5UD.js +2 -0
  54. package/dist/cli/chunks/chunk-BPWXXEH2.js +3029 -0
  55. package/dist/cli/chunks/chunk-BR26T7ZS.js +180 -0
  56. package/dist/cli/chunks/chunk-BTREG4IW.js +2 -0
  57. package/dist/cli/chunks/chunk-BULKFVYX.js +2 -0
  58. package/dist/cli/chunks/chunk-BXAXGEFC.js +24 -0
  59. package/dist/cli/chunks/chunk-CL6POIX4.js +2 -0
  60. package/dist/cli/chunks/chunk-CS2KS7LP.js +2 -0
  61. package/dist/cli/chunks/chunk-CWFB6BSA.js +316 -0
  62. package/dist/cli/chunks/chunk-DRT3WKQW.js +2 -0
  63. package/dist/cli/chunks/chunk-EHDQJQ6Y.js +27 -0
  64. package/dist/cli/chunks/chunk-ESVQ6MEB.js +2 -0
  65. package/dist/cli/chunks/chunk-FEKY7T6Q.js +2 -0
  66. package/dist/cli/chunks/chunk-FGA7VIFR.js +7 -0
  67. package/dist/cli/chunks/chunk-FIA6X7UL.js +2 -0
  68. package/dist/cli/chunks/chunk-GAOJV3OX.js +2 -0
  69. package/dist/cli/chunks/chunk-GKNNSCLC.js +5 -0
  70. package/dist/cli/chunks/chunk-GPQ57KA4.js +2 -0
  71. package/dist/cli/chunks/chunk-GRUUQAR6.js +2 -0
  72. package/dist/cli/chunks/chunk-HRO6OZQD.js +2 -0
  73. package/dist/cli/chunks/chunk-HY6PMO5W.js +66 -0
  74. package/dist/cli/chunks/chunk-IAV2JMIX.js +167 -0
  75. package/dist/cli/chunks/chunk-IFNIIK34.js +21 -0
  76. package/dist/cli/chunks/chunk-IGJPMN4I.js +3 -0
  77. package/dist/cli/chunks/chunk-J3KWWR6Z.js +1 -0
  78. package/dist/cli/chunks/chunk-JBANAPWG.js +2 -0
  79. package/dist/cli/chunks/chunk-JJO7Y4H3.js +604 -0
  80. package/dist/cli/chunks/chunk-JRYGQO2W.js +2 -0
  81. package/dist/cli/chunks/chunk-JXM26HEE.js +2 -0
  82. package/dist/cli/chunks/chunk-JZSDOIXA.js +2 -0
  83. package/dist/cli/chunks/chunk-KP5NUODU.js +3 -0
  84. package/dist/cli/chunks/chunk-LHJQD2VU.js +750 -0
  85. package/dist/cli/chunks/chunk-LNQIY6BP.js +2 -0
  86. package/dist/cli/chunks/chunk-MDUHYUHF.js +2 -0
  87. package/dist/cli/chunks/chunk-MV6CMOJQ.js +65 -0
  88. package/dist/cli/chunks/chunk-MZOFWJTM.js +2 -0
  89. package/dist/cli/chunks/chunk-N2NS2PHA.js +45 -0
  90. package/dist/cli/chunks/chunk-N4TL73TH.js +314 -0
  91. package/dist/cli/chunks/chunk-N5UXCLFI.js +2 -0
  92. package/dist/cli/chunks/chunk-NZ2VCPN4.js +2 -0
  93. package/dist/cli/chunks/chunk-OF4D7MYI.js +2 -0
  94. package/dist/cli/chunks/chunk-OI5NGQO2.js +2 -0
  95. package/dist/cli/chunks/chunk-OLHKGP35.js +2 -0
  96. package/dist/cli/chunks/chunk-QOVHWZEP.js +1 -0
  97. package/dist/cli/chunks/chunk-RFSN6IDA.js +79 -0
  98. package/dist/cli/chunks/chunk-RTGGL7D7.js +4 -0
  99. package/dist/cli/chunks/chunk-RU5WAHB7.js +3 -0
  100. package/dist/cli/chunks/chunk-SUSEVMZT.js +2 -0
  101. package/dist/cli/chunks/chunk-TLHP5EII.js +2 -0
  102. package/dist/cli/chunks/chunk-TWUWL5EJ.js +2 -0
  103. package/dist/cli/chunks/chunk-U5RN7YQW.js +2 -0
  104. package/dist/cli/chunks/chunk-UFUVUO3J.js +2 -0
  105. package/dist/cli/chunks/chunk-UQHYFOBX.js +16 -0
  106. package/dist/cli/chunks/chunk-VOS4NQSF.js +2 -0
  107. package/dist/cli/chunks/chunk-VSVXUTJN.js +256 -0
  108. package/dist/cli/chunks/chunk-WBQSXPBI.js +2 -0
  109. package/dist/cli/chunks/chunk-WGMPEW2T.js +2 -0
  110. package/dist/cli/chunks/chunk-WIEC7VKK.js +2 -0
  111. package/dist/cli/chunks/chunk-WJ3DLOXF.js +14 -0
  112. package/dist/cli/chunks/chunk-X3KI6JOY.js +9 -0
  113. package/dist/cli/chunks/chunk-X5IJGWYG.js +2 -0
  114. package/dist/cli/chunks/chunk-XIBDETCS.js +146 -0
  115. package/dist/cli/chunks/chunk-XLRQYLWW.js +2 -0
  116. package/dist/cli/chunks/chunk-XO6PVK2P.js +3 -0
  117. package/dist/cli/chunks/chunk-XRE2HCWG.js +3 -0
  118. package/dist/cli/chunks/chunk-XT2V2322.js +2 -0
  119. package/dist/cli/chunks/chunk-Y7BHKZFJ.js +18 -0
  120. package/dist/cli/chunks/chunk-YAGODYIG.js +59 -0
  121. package/dist/cli/chunks/chunk-YANUP2RO.js +2 -0
  122. package/dist/cli/chunks/chunk-YPFOCNOE.js +30 -0
  123. package/dist/cli/chunks/chunk-YR6ZZGH7.js +81 -0
  124. package/dist/cli/chunks/chunk-YVA65UZL.js +2 -0
  125. package/dist/cli/chunks/chunk-YW2THB5Q.js +2 -0
  126. package/dist/cli/chunks/chunk-ZAPS3UGQ.js +20 -0
  127. package/dist/cli/chunks/chunk-ZDATDCYN.js +2 -0
  128. package/dist/cli/chunks/ci-J374KDLI.js +81 -0
  129. package/dist/cli/chunks/ci-output-7JN7F6CI.js +2 -0
  130. package/dist/cli/chunks/claude-flow-setup-245JLJCN.js +2 -0
  131. package/dist/cli/chunks/client-MCSNSH2C.js +2 -0
  132. package/dist/cli/chunks/cline-installer-LBA2M5N3.js +4 -0
  133. package/dist/cli/chunks/code-U4N4WONM.js +38 -0
  134. package/dist/cli/chunks/code-index-extractor-A57Z6BO4.js +3 -0
  135. package/dist/cli/chunks/codex-installer-UXMK2N4T.js +8 -0
  136. package/dist/cli/chunks/completions-W66BSCOE.js +1364 -0
  137. package/dist/cli/chunks/complexity-analyzer-AB4OZARV.js +2 -0
  138. package/dist/cli/chunks/continuedev-installer-LRFZ2SJM.js +14 -0
  139. package/dist/cli/chunks/copilot-installer-CQ3JYBIB.js +3 -0
  140. package/dist/cli/chunks/cost-tracker-4F723RB6.js +2 -0
  141. package/dist/cli/chunks/coverage-4PUEQXAY.js +27 -0
  142. package/dist/cli/chunks/cross-domain-router-OWR5IJ5G.js +2 -0
  143. package/dist/cli/chunks/cursor-installer-JZEDEDHA.js +3 -0
  144. package/dist/cli/chunks/daemon-B7TWGHXQ.js +19 -0
  145. package/dist/cli/chunks/dag-attention-scheduler-JWO6XI6A.js +2 -0
  146. package/dist/cli/chunks/detect-L6ZZHUSX.js +2 -0
  147. package/dist/cli/chunks/domain-handler-FT5FLZWL.js +25 -0
  148. package/dist/cli/chunks/domain-transfer-5Y4FGJAJ.js +2 -0
  149. package/dist/cli/chunks/dream-4TDBIYED.js +2 -0
  150. package/dist/cli/chunks/esm-node-2PKHKOTS.js +2 -0
  151. package/dist/cli/chunks/eval-GHMPFGWV.js +15 -0
  152. package/dist/cli/chunks/fast-paths-B3R647KN.js +2 -0
  153. package/dist/cli/chunks/feature-flags-DWS7ARSX.js +2 -0
  154. package/dist/cli/chunks/feature-flags-IVQ3AL4Q.js +2 -0
  155. package/dist/cli/chunks/file-discovery-QFPA6GMV.js +2 -0
  156. package/dist/cli/chunks/fleet-EKOKMOMW.js +43 -0
  157. package/dist/cli/chunks/gnn-wrapper-OYC55N5E.js +2 -0
  158. package/dist/cli/chunks/heartbeat-handler-MBBS4IBU.js +48 -0
  159. package/dist/cli/chunks/heartbeat-scheduler-XDGMOT7X.js +2 -0
  160. package/dist/cli/chunks/hnsw-index-YO7CT23I.js +2 -0
  161. package/dist/cli/chunks/hnswlib-node-56YWVXFE.js +2 -0
  162. package/dist/cli/chunks/hooks-L5VLZGEK.js +101 -0
  163. package/dist/cli/chunks/hypergraph-engine-A4Y2ZRAG.js +2 -0
  164. package/dist/cli/chunks/hypergraph-handler-3HDGB5SZ.js +35 -0
  165. package/dist/cli/chunks/impact-analyzer-UEIGXSZ4.js +2 -0
  166. package/dist/cli/chunks/init-handler-JDET6WUN.js +68 -0
  167. package/dist/cli/chunks/init-wizard-JWZUGIPJ.js +2 -0
  168. package/dist/cli/chunks/kernel-YNDTVKIW.js +2 -0
  169. package/dist/cli/chunks/kilocode-installer-GZZG5AFW.js +4 -0
  170. package/dist/cli/chunks/kiro-installer-IWNY5TKH.js +74 -0
  171. package/dist/cli/chunks/knowledge-graph-NGJKFTSN.js +2 -0
  172. package/dist/cli/chunks/learning-722ZNSZ6.js +107 -0
  173. package/dist/cli/chunks/llm-router-DNAV746L.js +30 -0
  174. package/dist/cli/chunks/load-Y3GCUFM4.js +2 -0
  175. package/dist/cli/chunks/load-test-GZUBXFF3.js +2 -0
  176. package/dist/cli/chunks/mcp-LKPIBZ3W.js +2 -0
  177. package/dist/cli/chunks/memory-L57MLFOP.js +32 -0
  178. package/dist/cli/chunks/memory-backend-3NQIZUXE.js +2 -0
  179. package/dist/cli/chunks/memory-handlers-MDZQ7HVW.js +2 -0
  180. package/dist/cli/chunks/opencode-installer-4HUB36H5.js +3 -0
  181. package/dist/cli/chunks/orchestrator-QHSBB2UC.js +371 -0
  182. package/dist/cli/chunks/pipeline-D3QER35Z.js +19 -0
  183. package/dist/cli/chunks/platform-T4E7Q3RD.js +2 -0
  184. package/dist/cli/chunks/plugin-JHW2YPRC.js +27 -0
  185. package/dist/cli/chunks/prime-radiant-advanced-wasm-G7CFNNQV.js +2 -0
  186. package/dist/cli/chunks/protocol-executor-SPUVRDWT.js +2 -0
  187. package/dist/cli/chunks/protocol-handler-2BQQ4HDM.js +20 -0
  188. package/dist/cli/chunks/prove-UQ6JFT73.js +3 -0
  189. package/dist/cli/chunks/qe-reasoning-bank-3HBK2FVD.js +2 -0
  190. package/dist/cli/chunks/quality-JRZYMC77.js +7 -0
  191. package/dist/cli/chunks/queen-coordinator-RW3NKO5A.js +2 -0
  192. package/dist/cli/chunks/real-embeddings-GK63VF35.js +2 -0
  193. package/dist/cli/chunks/roocode-installer-F4E2LAYR.js +4 -0
  194. package/dist/cli/chunks/router-RJGHWDQ3.js +2 -0
  195. package/dist/cli/chunks/routing-feedback-ZXBXFKX6.js +2 -0
  196. package/dist/cli/chunks/routing-handler-VNKFUUGB.js +20 -0
  197. package/dist/cli/chunks/ruvector-commands-2TLNHC3A.js +8 -0
  198. package/dist/cli/chunks/rvf-dual-writer-MQW2SJLT.js +2 -0
  199. package/dist/cli/chunks/rvf-native-adapter-LKFKTMUN.js +2 -0
  200. package/dist/cli/chunks/safe-db-G22E5ROA.js +2 -0
  201. package/dist/cli/chunks/schedule-Y7VVCPYV.js +2 -0
  202. package/dist/cli/chunks/scheduler-AUQIFQB7.js +2 -0
  203. package/dist/cli/chunks/security-EBEG2OPU.js +14 -0
  204. package/dist/cli/chunks/shared-rvf-dual-writer-BVSCQAFS.js +2 -0
  205. package/dist/cli/chunks/sqlite-persistence-JAVHUGGL.js +2 -0
  206. package/dist/cli/chunks/status-handler-VZ32M4G4.js +45 -0
  207. package/dist/cli/chunks/structural-health-K6LRCKV6.js +2 -0
  208. package/dist/cli/chunks/sync-MHSHNLIM.js +23 -0
  209. package/dist/cli/chunks/task-handler-JNOIBZ2G.js +49 -0
  210. package/dist/cli/chunks/task-handlers-P5DSUKND.js +2 -0
  211. package/dist/cli/chunks/test-DO22BNIL.js +33 -0
  212. package/dist/cli/chunks/test-scheduling-VLRQZEFL.js +15 -0
  213. package/dist/cli/chunks/token-bootstrap-4VJKGVMK.js +2 -0
  214. package/dist/cli/chunks/token-usage-LG3PXRXH.js +25 -0
  215. package/dist/cli/chunks/transformers-GY7SIKEU.js +2 -0
  216. package/dist/cli/chunks/tree-sitter-wasm-parser-FT2KB66N.js +2 -0
  217. package/dist/cli/chunks/types-QJGNBKP2.js +2 -0
  218. package/dist/cli/chunks/unified-memory-XYGENQUT.js +2 -0
  219. package/dist/cli/chunks/unified-memory-hnsw-MVEGQBF3.js +2 -0
  220. package/dist/cli/chunks/unified-persistence-PFRCWEUG.js +2 -0
  221. package/dist/cli/chunks/validate-VQCRSVNQ.js +21 -0
  222. package/dist/cli/chunks/validate-swarm-A5DHAWTP.js +14 -0
  223. package/dist/cli/chunks/vibium-RZBSL4EB.js +2 -0
  224. package/dist/cli/chunks/visual-security-V47BLGJM.js +2 -0
  225. package/dist/cli/chunks/web-tree-sitter-7C4NXEOF.js +2 -0
  226. package/dist/cli/chunks/windsurf-installer-ES3KPQG3.js +7 -0
  227. package/dist/cli/chunks/witness-chain-BR63P4A7.js +2 -0
  228. package/dist/cli/chunks/workflow-JETHX4ML.js +51 -0
  229. package/dist/cli/chunks/workflow-orchestrator-7PZMX3JZ.js +2 -0
  230. package/dist/cli/chunks/wrappers-WP5RH745.js +2 -0
  231. package/dist/cli/commands/daemon.d.ts +13 -0
  232. package/dist/cli/commands/daemon.js +224 -0
  233. package/dist/cli/commands/hooks-handlers/hooks-shared.js +2 -1
  234. package/dist/cli/commands/plugin.d.ts +12 -0
  235. package/dist/cli/commands/plugin.js +135 -0
  236. package/dist/cli/commands/workflow.d.ts +10 -0
  237. package/dist/cli/commands/workflow.js +587 -0
  238. package/dist/cli/handlers/brain-handler.js +13 -8
  239. package/dist/cli/handlers/heartbeat-handler.d.ts +1 -0
  240. package/dist/cli/handlers/heartbeat-handler.js +20 -10
  241. package/dist/cli/handlers/hypergraph-handler.js +3 -3
  242. package/dist/cli/handlers/init-handler.js +10 -9
  243. package/dist/cli/handlers/interfaces.d.ts +4 -4
  244. package/dist/cli/index.js +159 -638
  245. package/dist/cli/lazy-registry.d.ts +27 -0
  246. package/dist/cli/lazy-registry.js +70 -0
  247. package/dist/context/compaction/context-budget.d.ts +71 -0
  248. package/dist/context/compaction/context-budget.js +120 -0
  249. package/dist/context/compaction/index.d.ts +96 -0
  250. package/dist/context/compaction/index.js +259 -0
  251. package/dist/context/compaction/llm-caller-adapter.d.ts +14 -0
  252. package/dist/context/compaction/llm-caller-adapter.js +47 -0
  253. package/dist/context/compaction/tier1-microcompact.d.ts +33 -0
  254. package/dist/context/compaction/tier1-microcompact.js +47 -0
  255. package/dist/context/compaction/tier2-session-summary.d.ts +72 -0
  256. package/dist/context/compaction/tier2-session-summary.js +172 -0
  257. package/dist/context/compaction/tier3-llm-compact.d.ts +65 -0
  258. package/dist/context/compaction/tier3-llm-compact.js +166 -0
  259. package/dist/context/compaction/tier4-reactive.d.ts +54 -0
  260. package/dist/context/compaction/tier4-reactive.js +129 -0
  261. package/dist/coordination/consensus/providers/claude-provider.d.ts +1 -0
  262. package/dist/coordination/consensus/providers/claude-provider.js +23 -3
  263. package/dist/domains/test-generation/generators/base-test-generator.d.ts +1 -1
  264. package/dist/domains/test-generation/generators/base-test-generator.js +11 -11
  265. package/dist/domains/test-generation/generators/go-test-generator.js +12 -12
  266. package/dist/domains/test-generation/generators/junit5-generator.js +9 -9
  267. package/dist/domains/test-generation/generators/kotlin-junit-generator.js +10 -10
  268. package/dist/domains/test-generation/generators/pytest-generator.js +8 -8
  269. package/dist/domains/test-generation/generators/swift-testing-generator.js +8 -8
  270. package/dist/domains/test-generation/generators/test-value-helpers.d.ts +20 -0
  271. package/dist/domains/test-generation/generators/test-value-helpers.js +48 -0
  272. package/dist/domains/test-generation/generators/xunit-generator.js +11 -11
  273. package/dist/hooks/cross-phase-hooks.d.ts +11 -0
  274. package/dist/hooks/cross-phase-hooks.js +73 -9
  275. package/dist/hooks/security/config-snapshot.d.ts +21 -0
  276. package/dist/hooks/security/config-snapshot.js +33 -0
  277. package/dist/hooks/security/exit-codes.d.ts +28 -0
  278. package/dist/hooks/security/exit-codes.js +33 -0
  279. package/dist/hooks/security/index.d.ts +15 -0
  280. package/dist/hooks/security/index.js +15 -0
  281. package/dist/hooks/security/ssrf-guard.d.ts +25 -0
  282. package/dist/hooks/security/ssrf-guard.js +69 -0
  283. package/dist/index.d.ts +1 -1
  284. package/dist/index.js +1 -2
  285. package/dist/init/init-wizard-hooks.js +15 -1
  286. package/dist/init/phases/07-hooks.js +2 -2
  287. package/dist/init/settings-merge.js +3 -7
  288. package/dist/kernel/kernel.js +35 -0
  289. package/dist/kernel/memory-backend.js +3 -1
  290. package/dist/mcp/bundle.js +416 -362
  291. package/dist/mcp/entry.js +132 -77
  292. package/dist/mcp/http-server.js +4 -1
  293. package/dist/mcp/index.d.ts +2 -2
  294. package/dist/mcp/index.js +5 -4
  295. package/dist/mcp/middleware/batch-executor.d.ts +46 -0
  296. package/dist/mcp/middleware/batch-executor.js +150 -0
  297. package/dist/mcp/middleware/microcompact.d.ts +97 -0
  298. package/dist/mcp/middleware/microcompact.js +179 -0
  299. package/dist/mcp/middleware/middleware-chain.d.ts +37 -0
  300. package/dist/mcp/middleware/middleware-chain.js +60 -0
  301. package/dist/mcp/protocol-server.d.ts +16 -0
  302. package/dist/mcp/protocol-server.js +140 -36
  303. package/dist/mcp/services/session-durability-middleware.d.ts +22 -0
  304. package/dist/mcp/services/session-durability-middleware.js +64 -0
  305. package/dist/mcp/services/session-resume.d.ts +29 -0
  306. package/dist/mcp/services/session-resume.js +221 -0
  307. package/dist/mcp/services/session-store.d.ts +84 -0
  308. package/dist/mcp/services/session-store.js +163 -0
  309. package/dist/mcp/tool-registry.d.ts +9 -0
  310. package/dist/mcp/tool-registry.js +30 -1
  311. package/dist/mcp/types.d.ts +1 -0
  312. package/dist/plugins/cache.d.ts +44 -0
  313. package/dist/plugins/cache.js +149 -0
  314. package/dist/plugins/index.d.ts +15 -0
  315. package/dist/plugins/index.js +15 -0
  316. package/dist/plugins/lifecycle.d.ts +67 -0
  317. package/dist/plugins/lifecycle.js +175 -0
  318. package/dist/plugins/manifest.d.ts +45 -0
  319. package/dist/plugins/manifest.js +173 -0
  320. package/dist/plugins/resolver.d.ts +37 -0
  321. package/dist/plugins/resolver.js +80 -0
  322. package/dist/plugins/security.d.ts +23 -0
  323. package/dist/plugins/security.js +125 -0
  324. package/dist/plugins/sources/github.d.ts +17 -0
  325. package/dist/plugins/sources/github.js +77 -0
  326. package/dist/plugins/sources/local.d.ts +20 -0
  327. package/dist/plugins/sources/local.js +32 -0
  328. package/dist/plugins/sources/npm.d.ts +18 -0
  329. package/dist/plugins/sources/npm.js +82 -0
  330. package/dist/shared/llm/retry.d.ts +5 -2
  331. package/dist/shared/llm/retry.js +7 -3
  332. package/dist/shared/prompt-cache-latch.d.ts +41 -0
  333. package/dist/shared/prompt-cache-latch.js +63 -0
  334. package/dist/shared/retry-engine.d.ts +77 -0
  335. package/dist/shared/retry-engine.js +194 -0
  336. package/dist/workers/daemon.d.ts +8 -0
  337. package/dist/workers/daemon.js +13 -0
  338. package/dist/workers/quality-daemon/ci-monitor.d.ts +55 -0
  339. package/dist/workers/quality-daemon/ci-monitor.js +147 -0
  340. package/dist/workers/quality-daemon/coverage-delta.d.ts +72 -0
  341. package/dist/workers/quality-daemon/coverage-delta.js +135 -0
  342. package/dist/workers/quality-daemon/git-watcher.d.ts +51 -0
  343. package/dist/workers/quality-daemon/git-watcher.js +209 -0
  344. package/dist/workers/quality-daemon/index.d.ts +119 -0
  345. package/dist/workers/quality-daemon/index.js +343 -0
  346. package/dist/workers/quality-daemon/nightly-consolidation.d.ts +74 -0
  347. package/dist/workers/quality-daemon/nightly-consolidation.js +136 -0
  348. package/dist/workers/quality-daemon/notification-service.d.ts +67 -0
  349. package/dist/workers/quality-daemon/notification-service.js +178 -0
  350. package/dist/workers/quality-daemon/persistent-memory.d.ts +31 -0
  351. package/dist/workers/quality-daemon/persistent-memory.js +30 -0
  352. package/dist/workers/quality-daemon/priority-queue.d.ts +97 -0
  353. package/dist/workers/quality-daemon/priority-queue.js +126 -0
  354. package/dist/workers/quality-daemon/test-suggester.d.ts +50 -0
  355. package/dist/workers/quality-daemon/test-suggester.js +121 -0
  356. package/dist/workers/worker-manager.js +2 -1
  357. package/package.json +1 -1
  358. package/dist/mcp/server.d.ts +0 -46
  359. package/dist/mcp/server.js +0 -802
@@ -0,0 +1,371 @@
1
+ if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
+ import{c as Re}from"./chunk-BTREG4IW.js";import{a as te,b as de,c as ve,d as ke,e as we,f as be,g as Ce,h as Pe,i as Ie,j as Se,k as Ee}from"./chunk-BR26T7ZS.js";import"./chunk-3ADGXLTM.js";import"./chunk-KP5NUODU.js";import{a as ye}from"./chunk-6EOS7KX2.js";import"./chunk-24FKIJNC.js";import"./chunk-AKE543X2.js";import"./chunk-JJO7Y4H3.js";import"./chunk-N2NS2PHA.js";import"./chunk-3JPRUND5.js";import"./chunk-4VUPRTVX.js";import{b as _,d as ee}from"./chunk-WGMPEW2T.js";import{a as x,b as he,c as le}from"./chunk-JZSDOIXA.js";import{a as $,b as ce}from"./chunk-263XS447.js";import"./chunk-MDUHYUHF.js";import"./chunk-GAOJV3OX.js";import"./chunk-62ADTHV7.js";import"./chunk-DRT3WKQW.js";import"./chunk-UFUVUO3J.js";import"./chunk-7VDBAVTY.js";import"./chunk-B36CDR4U.js";import"./chunk-2I7J3O6V.js";import{a as ae}from"./chunk-4I2IOUS4.js";le();le();var g=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(n){return{success:!1,error:he(n),durationMs:Date.now()-t,message:`${this.description} failed: ${x(n)}`}}}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();ce();import{existsSync as M}from"fs";import{join as T}from"path";var Q=class extends g{name="detection";description="Detect existing installations";order=10;critical=!0;async run(e){let{projectRoot:t}=e,n=await this.detectV2Installation(t),s=M(T(t,".agentic-qe","config.yaml")),o=n.version?.startsWith("3."),r=n.detected,i=s||o||!1,l=!r&&!i;return e.v2Detection=n,{v2Detected:r,v3Detected:i,freshInstall:l,v2Detection:n}}async detectV2Installation(e){let t=T(e,".agentic-qe","memory.db"),n=T(e,".agentic-qe","config"),s=T(e,".claude","agents"),o=T(e,".agentic-qe","config","learning.json"),r=M(t),i=M(n),l=M(s),c=M(o),u=M(T(e,".agentic-qe","config.yaml")),m,d=!1;return r&&(m=this.readVersionFromDb(t),m?d=m.startsWith("3."):m="2.x.x"),{detected:!d&&r&&(!m?.startsWith("3.")||c&&!u),memoryDbPath:r?t:void 0,configPath:i?n:void 0,agentsPath:l?s:void 0,hasMemoryDb:r,hasConfig:i,hasAgents:l,version:m}}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 s=t.prepare(`
6
+ SELECT value FROM kv_store
7
+ WHERE key = 'aqe_version' AND namespace = '_system'
8
+ `).get();return t.close(),s?_(s.value):void 0}catch{t.close();return}}catch{return}}};var L=class extends g{name="analysis";description="Analyze project structure";order=20;critical=!0;requiresPhases=["detection"];async run(e){let n=await ve(e.projectRoot).analyze();return e.analysis=n,e.services.log(` Project: ${n.projectName}`),e.services.log(` Languages: ${n.languages.map(s=>s.name).join(", ")}`),e.services.log(` Frameworks: ${n.frameworks.map(s=>s.name).join(", ")}`),n}};var V=class extends g{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 n=ke({minimal:e.options.minimal}).recommend(e.analysis);return n=this.applyOptions(n,e),e.config=n,e.services.log(` Version: ${n.version}`),e.services.log(` Learning: ${n.learning.enabled?"enabled":"disabled"}`),e.services.log(` Workers: ${n.workers.enabled.length}`),n}applyOptions(e,t){let{options:n}=t;return n.minimal&&(e.skills.install=!1,e.learning.pretrainedPatterns=!1,e.workers.enabled=[],e.workers.daemonAutoStart=!1),n.skipPatterns&&(e.learning.pretrainedPatterns=!1),n.wizardAnswers&&(e=this.applyWizardAnswers(e,n.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 ne,mkdirSync as ue}from"fs";import{join as se}from"path";var W=class extends g{name="database";description="Initialize persistence database";order=40;critical=!0;requiresPhases=["configuration"];async run(e){let{projectRoot:t}=e,n=se(t,".agentic-qe");ne(n)||ue(n,{recursive:!0});let s=se(n,"workers");ne(s)||ue(s,{recursive:!0});let o=se(n,"data");ne(o)||ue(o,{recursive:!0});let r=se(n,"memory.db"),i=!ne(r);try{let{initializeUnifiedMemory:l,resetUnifiedMemory:c}=await import("./unified-memory-XYGENQUT.js"),u=await l({dbPath:r,walMode:!0,busyTimeout:5e3}),d=u.getStats().tables.map(y=>y.name);await u.kvSet("_init_marker",{initialized:new Date().toISOString(),projectRoot:t,version:te()},"_system");let k=u.getDatabase().prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;return c(),e.services.log(` Database: ${r}`),e.services.log(` Schema version: v${k}`),e.services.log(` Tables: ${d.length} (v3 full schema)`),{dbPath:r,created:i,tablesCreated:d,schemaVersion:k}}catch(l){throw new Error(`SQLite persistence initialization FAILED: ${l}
9
+ Database path: ${r}
10
+ Ensure the directory is writable and has sufficient disk space.`)}}};import{existsSync as re,mkdirSync as pe,writeFileSync as Ae}from"fs";import{join as q}from"path";var H=class extends g{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:n,options:s}=e;if(!t.learning.enabled)return{enabled:!1,dataDir:"",hnswDir:"",patternsLoaded:0};let o=q(n,".agentic-qe","data");re(o)||pe(o,{recursive:!0});let r=q(o,"hnsw");re(r)||pe(r,{recursive:!0});let i=q(o,"learning-config.json"),l={embeddingModel:t.learning.embeddingModel,hnswConfig:t.learning.hnswConfig,qualityThreshold:t.learning.qualityThreshold,promotionThreshold:t.learning.promotionThreshold,databasePath:q(o,"memory.db"),hnswIndexPath:q(r,"index.bin"),initialized:new Date().toISOString()};Ae(i,JSON.stringify(l,null,2),"utf-8");let c=0;return t.learning.pretrainedPatterns&&!s.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 n=q(e,"patterns");re(n)||pe(n,{recursive:!0});let s=q(n,"index.json");return re(s)||Ae(s,JSON.stringify({version:te(),domains:[],loadedAt:new Date().toISOString()},null,2),"utf-8"),0}catch(n){return t.services.warn(`Could not load pre-trained patterns: ${n}`),0}}};ee();ce();import{existsSync as Ne,statSync as Qe}from"fs";import{join as oe}from"path";var xe=["**/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.*"],G=class extends g{name="code-intelligence";description="Code intelligence pre-scan";order=60;critical=!1;requiresPhases=["database"];async run(e){let{projectRoot:t}=e,n=oe(t,".agentic-qe","memory.db");if(!Ne(n))return e.services.log(" Building knowledge graph..."),await this.runCodeIntelligenceScan(t,e,!1);let s=$(n);try{if(!this.checkCodeIntelligenceIndex(s))return s.close(),e.services.log(" Building knowledge graph..."),await this.runCodeIntelligenceScan(t,e,!1);let r=this.getLastIndexedAt(s);if(!r){let c=this.getKGEntryCount(s);return s.close(),e.services.log(` Using existing index (${c} entries)`),{status:"existing",entries:c}}let i=this.getKGEntryCount(s);s.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{s.close()}catch{}throw o}}checkCodeIntelligenceIndex(e){try{return e.prepare(`
11
+ SELECT COUNT(*) as count FROM kv_store
12
+ WHERE namespace = 'code-intelligence:kg'
13
+ `).get().count>0}catch{return!1}}getKGEntryCount(e){try{return e.prepare(`
14
+ SELECT COUNT(*) as count FROM kv_store
15
+ WHERE namespace LIKE 'code-intelligence:kg%'
16
+ `).get().count}catch{return 0}}async runCodeIntelligenceScan(e,t,n,s){try{let{KnowledgeGraphService:o}=await import("./knowledge-graph-NGJKFTSN.js"),r=oe(e,".agentic-qe","memory.db"),i={type:"sqlite",sqlite:{path:r,walMode:!0}},{backend:l}=await ye(i,!0),c=new o(l,{namespace:"code-intelligence:kg",enableVectorEmbeddings:!0}),u;s?u=s:u=(await(await import("fast-glob")).default(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx","**/*.py"],{cwd:e,ignore:xe})).map(h=>oe(e,h));let m=await c.index({paths:u,incremental:n,includeTests:!0});if(c.destroy(),await l.dispose(),m.success){let d=m.value.nodesCreated+m.value.edgesCreated,w=n?"Delta indexed":"Indexed";return t.services.log(` ${w} ${d} entries to ${r}`),await this.buildHypergraph(r,u,t),{status:"indexed",entries:d}}return{status:"error",entries:0}}catch(o){return t.services.warn(`Code intelligence scan warning: ${o}`),{status:"skipped",entries:0}}}async buildHypergraph(e,t,n){try{let{extractCodeIndex:s}=await import("./code-index-extractor-A57Z6BO4.js"),{createHypergraphEngine:o}=await import("./hypergraph-engine-A4Y2ZRAG.js"),r=$(e),i=await o({db:r,maxTraversalDepth:10,maxQueryResults:1e3,enableVectorSearch:!1}),l=await s(t),c=await i.buildFromIndexResult(l);r.close(),c.nodesCreated+c.edgesCreated>0&&n.services.log(` Hypergraph: ${c.nodesCreated} nodes, ${c.edgesCreated} edges`)}catch(s){n.services.warn?.(` Hypergraph build skipped: ${s}`)}}getLastIndexedAt(e){try{let t=e.prepare(`
17
+ SELECT value FROM kv_store
18
+ WHERE namespace = 'code-intelligence:kg'
19
+ AND key = 'metadata:index'
20
+ `).get();if(!t)return null;let n=_(t.value);if(!n.indexedAt)return null;let s=new Date(n.indexedAt);return isNaN(s.getTime())?null:s}catch{return null}}async findChangedFiles(e,t){let s=await(await import("fast-glob")).default(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx","**/*.py"],{cwd:e,ignore:xe}),o=t.getTime(),r=[];for(let i of s){let l=oe(e,i);try{Qe(l).mtimeMs>o&&r.push(l)}catch{}}return r}};ee();import{existsSync as P,mkdirSync as ie,readFileSync as _e,writeFileSync as O}from"fs";import{join as b}from"path";var B=class extends g{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:n}=e;if(!t.hooks.claudeCode)return{configured:!1,settingsPath:"",hookTypes:[],existingAqeDetected:!1};let s=b(n,".claude");P(s)||ie(s,{recursive:!0});let o=b(s,"hooks");P(o)||ie(o,{recursive:!0});let r=b(s,"settings.json"),i={};if(P(r))try{let k=_e(r,"utf-8");i=_(k)}catch{i={}}let l=this.generateHooksConfig(t,n),c=Object.keys(l),u=i.hooks||{},m=this.hasExistingAqeHooks(u);m&&e.services.log(" Detected existing AQE hooks \u2014 replacing with updated config"),i.hooks=be(u,l);let d=i.env||{};i.env={...d,...Ce(t)};let w=Pe(t,n);for(let[k,y]of Object.entries(w))if(k==="_aqePermissions"){let A=i.permissions||{},C=A.allow||[],f=y,v=[...new Set([...C,...f])];i.permissions={...A,allow:v}}else i[k]=y;let h=i.enabledMcpjsonServers||[];h=h.filter(k=>k!=="aqe"),h.includes("agentic-qe")||h.push("agentic-qe"),i.enabledMcpjsonServers=h,O(r,JSON.stringify(i,null,2),"utf-8"),this.writeHooksReadme(o,c),this.installHookAssets(o,e);try{let k=_e(r,"utf-8"),A=_(k).hooks;(!A||!this.hasExistingAqeHooks(A))&&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:m}}writeHooksReadme(e,t){let n=b(e,"README.txt");if(P(n))return;let s=["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(`
21
+ `);O(n,s,"utf-8")}installHookAssets(e,t){let{projectRoot:n}=t;this.installBrainCheckpoint(n,t),this.installStatusline(n,t);let s=b(e,"cross-phase-memory.yaml");if(!P(s)){let r=[b(n,"v3","assets","hooks","cross-phase-memory.yaml"),b(n,"assets","hooks","cross-phase-memory.yaml"),b(n,"node_modules","agentic-qe","v3","assets","hooks","cross-phase-memory.yaml")],i=!1;for(let l of r)if(P(l)){let{copyFileSync:c}=ae("fs");c(l,s),t.services.log(" Installed cross-phase memory config"),i=!0;break}i||O(s,["# Cross-Phase Memory Hooks Configuration","# Generated by aqe init",'version: "1.0"',"enabled: true",""].join(`
22
+ `),"utf-8")}let o=b(e,"v3-domain-workers.json");P(o)||O(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 n of t)if(we(n))return!0}return!1}installBrainCheckpoint(e,t){let n=b(e,".claude","helpers");P(n)||ie(n,{recursive:!0});let s=b(n,"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(P(r)&&r!==s){let{copyFileSync:i}=ae("fs");i(r,s),t.services.log(" Installed brain-checkpoint.cjs (copied)");return}P(s)||(O(s,this.generateBrainCheckpointScript(),"utf-8"),t.services.log(" Installed brain-checkpoint.cjs (generated)"))}installStatusline(e,t){let n=b(e,".claude","helpers");P(n)||ie(n,{recursive:!0});let s=b(n,"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(P(r)&&r!==s){let{copyFileSync:i}=ae("fs");i(r,s),t.services.log(" Installed statusline-v3.cjs (copied)");return}P(s)||(O(s,this.generateMinimalStatuslineScript(),"utf-8"),t.services.log(" Installed statusline-v3.cjs (generated)"))}generateMinimalStatuslineScript(){return`#!/usr/bin/env node
23
+ /**
24
+ * Agentic QE v3 Statusline (minimal fallback, generated by aqe init)
25
+ * For the full statusline, reinstall: npx agentic-qe init --auto
26
+ */
27
+ const fs = require('fs');
28
+ const path = require('path');
29
+ const { execFileSync } = require('child_process');
30
+
31
+ function q(bin, args, d) { try { return execFileSync(bin, args, { encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'] }).trim(); } catch { return d || ''; } }
32
+
33
+ const dir = path.resolve(__dirname, '..', '..');
34
+ const dbPath = path.join(dir, '.agentic-qe', 'memory.db');
35
+ let patterns = 0;
36
+ try {
37
+ if (fs.existsSync(dbPath)) {
38
+ const Database = require('better-sqlite3');
39
+ const db = new Database(dbPath, { readonly: true, fileMustExist: true });
40
+ db.pragma('busy_timeout = 5000');
41
+ 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;
42
+ db.close();
43
+ }
44
+ } catch { /* ignore */ }
45
+
46
+ const branch = q('git', ['branch', '--show-current']);
47
+ const branchStr = branch ? \` \\x1b[34m\u2387 \${branch}\\x1b[0m\` : '';
48
+ const patStr = patterns > 0 ? \` \\x1b[35m\u{1F393} \${patterns} patterns\\x1b[0m\` : '';
49
+
50
+ console.log(\`\\x1b[1m\\x1b[35m\u258A Agentic QE v3\\x1b[0m\${branchStr}\${patStr}\`);
51
+ `}generateBrainCheckpointScript(){return`#!/usr/bin/env node
52
+ /**
53
+ * Brain Checkpoint Helper (generated by aqe init)
54
+ *
55
+ * Usage:
56
+ * node brain-checkpoint.cjs export # Export brain to aqe.rvf (session-end)
57
+ * node brain-checkpoint.cjs verify # Verify aqe.rvf exists (session-start)
58
+ */
59
+ const { execFileSync } = require('child_process');
60
+ const fs = require('fs');
61
+ const path = require('path');
62
+
63
+ const PROJECT_ROOT = path.resolve(__dirname, '..', '..');
64
+ const AQE_DIR = path.join(PROJECT_ROOT, '.agentic-qe');
65
+ const RVF_PATH = path.join(AQE_DIR, 'aqe.rvf');
66
+ const DB_PATH = path.join(AQE_DIR, 'memory.db');
67
+ const MAX_AGE_HOURS = 24;
68
+
69
+ function log(msg) { process.stderr.write('[brain-checkpoint] ' + msg + '\\n'); }
70
+
71
+ function exportBrain() {
72
+ if (!fs.existsSync(DB_PATH)) { log('No memory.db, skipping'); return { exported: false }; }
73
+ try {
74
+ if (fs.existsSync(RVF_PATH)) fs.unlinkSync(RVF_PATH);
75
+ const idmap = RVF_PATH + '.idmap.json';
76
+ if (fs.existsSync(idmap)) fs.unlinkSync(idmap);
77
+ const result = execFileSync(
78
+ 'npx', ['agentic-qe', 'brain', 'export', '-o', RVF_PATH, '--format', 'rvf'],
79
+ { timeout: 60000, encoding: 'utf-8' }
80
+ );
81
+ const m = result.match(/Patterns:\\s+(\\d+)/);
82
+ const p = m ? m[1] : '0';
83
+ log('Exported ' + p + ' patterns to aqe.rvf');
84
+ return { exported: true, patterns: parseInt(p) };
85
+ } catch (e) {
86
+ log('Export failed: ' + e.message);
87
+ return { exported: false, reason: e.message };
88
+ }
89
+ }
90
+
91
+ function verifyBrain() {
92
+ if (!fs.existsSync(RVF_PATH)) {
93
+ log('No aqe.rvf found');
94
+ return { valid: false, reason: 'missing' };
95
+ }
96
+ const stat = fs.statSync(RVF_PATH);
97
+ const ageH = (Date.now() - stat.mtimeMs) / 3600000;
98
+ if (stat.size < 1024) { log('aqe.rvf too small'); return { valid: false, reason: 'too-small' }; }
99
+ if (ageH > MAX_AGE_HOURS) { log('aqe.rvf is ' + ageH.toFixed(1) + 'h old'); return { valid: true, stale: true }; }
100
+ log('aqe.rvf OK (' + (stat.size/1048576).toFixed(1) + ' MB)');
101
+ return { valid: true, stale: false };
102
+ }
103
+
104
+ const cmd = process.argv[2] || 'verify';
105
+ const result = cmd === 'export' ? exportBrain() : verifyBrain();
106
+ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result));
107
+ `}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 Le,readFileSync as Ve,writeFileSync as We}from"fs";import{join as He}from"path";var U=class extends g{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 n={command:"aqe-mcp",args:[],env:{AQE_LEARNING_ENABLED:"true",AQE_WORKERS_ENABLED:"true",NODE_ENV:"production"}},s=He(t,".mcp.json"),o={};if(Le(s))try{let i=Ve(s,"utf-8");o=_(i)}catch{o={}}o.mcpServers||(o.mcpServers={});let r=o.mcpServers;return r["agentic-qe"]=n,We(s,JSON.stringify(o,null,2),"utf-8"),e.services.log(` MCP config: ${s}`),e.services.log(" Server: agentic-qe"),e.services.log(" Learning: enabled"),e.services.log(" Workers: enabled"),{configured:!0,mcpPath:s,serverName:"agentic-qe"}}};import{existsSync as E,readFileSync as Ge}from"fs";import{join as R}from"path";var z=class extends g{name="assets";description="Install skills and agents";order=90;critical=!1;requiresPhases=["configuration"];async run(e){let t=e.config,{projectRoot:n,options:s}=e,o=this.detectVersionUpgrade(e),r=s.upgrade||t.skills.overwrite||s.autoMode&&o,i=0,l=0,c=0,u=0,m=0,d=0,w=0,h=0,k=0;if(s.upgrade?e.services.log(" Upgrade mode: overwriting existing files"):s.autoMode&&o&&e.services.log(" Version upgrade detected: updating skills and agents"),t.skills.install){let v=await Ie({projectRoot:n,installV2Skills:t.skills.installV2,installV3Skills:t.skills.installV3,overwrite:r}).install();i=v.installed.length,v.errors.length>0&&e.services.warn(`Skills warnings: ${v.errors.join(", ")}`)}try{let v=await Se({projectRoot:n,installQEAgents:!0,installSubagents:!0,overwrite:r}).install();l=v.installed.length,v.errors.length>0&&e.services.warn(`Agents warnings: ${v.errors.join(", ")}`)}catch(f){e.services.warn(`Agents install error: ${f instanceof Error?f.message:f}`)}if(Re(n),s.withN8n){let v=await Ee({projectRoot:n,installAgents:!0,installSkills:!0,overwrite:r,n8nApiConfig:s.n8nApiConfig}).install();c=v.agentsInstalled.length,u=v.skillsInstalled.length,v.errors.length>0&&e.services.warn(`N8n warnings: ${v.errors.join(", ")}`)}let y=s.autoMode&&E(R(n,"opencode.json"));if(s.withOpenCode||y){let{createOpenCodeInstaller:f}=await import("./opencode-installer-4HUB36H5.js"),a=await f({projectRoot:n,installAgents:!0,installSkills:!0,installTools:!0,overwrite:r}).install();m=a.agentsInstalled.length,d=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}`),s.withN8n&&(e.services.log(` N8n agents: ${c}`),e.services.log(` N8n skills: ${u}`)),(s.withOpenCode||y)&&(e.services.log(` OpenCode agents: ${m}`),e.services.log(` OpenCode skills: ${d}`));let A=s.autoMode&&E(R(n,".kiro"));if(s.withKiro||A){let{createKiroInstaller:f}=await import("./kiro-installer-IWNY5TKH.js"),a=await f({projectRoot:n,installAgents:!0,installSkills:!0,installHooks:!0,installSteering:!0,overwrite:r}).install();w=a.agentsInstalled.length,h=a.skillsInstalled.length,k=a.hooksInstalled.length,a.errors.length>0&&e.services.warn(`Kiro warnings: ${a.errors.join(", ")}`),e.services.log(` Kiro agents: ${w}`),e.services.log(` Kiro skills: ${h}`),e.services.log(` Kiro hooks: ${k}`),e.services.log(` Kiro steering: ${a.steeringInstalled.length}`),a.mcpConfigured&&e.services.log(" Kiro MCP: .kiro/settings/mcp.json")}let C=[];if(s.withCopilot||s.autoMode&&E(R(n,".vscode"))){let{createCopilotInstaller:f}=await import("./copilot-installer-CQ3JYBIB.js"),a=await f({projectRoot:n,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(s.withCursor||s.autoMode&&E(R(n,".cursor"))){let{createCursorInstaller:f}=await import("./cursor-installer-JZEDEDHA.js"),a=await f({projectRoot:n,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(s.withCline){let{createClineInstaller:f}=await import("./cline-installer-LBA2M5N3.js"),a=await f({projectRoot:n,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(s.withKiloCode||s.autoMode&&E(R(n,".kilocode"))){let{createKiloCodeInstaller:f}=await import("./kilocode-installer-GZZG5AFW.js"),a=await f({projectRoot:n,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(s.withRooCode||s.autoMode&&E(R(n,".roo"))){let{createRooCodeInstaller:f}=await import("./roocode-installer-F4E2LAYR.js"),a=await f({projectRoot:n,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(s.withCodex||s.autoMode&&E(R(n,".codex"))){let{createCodexInstaller:f}=await import("./codex-installer-UXMK2N4T.js"),a=await f({projectRoot:n,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(s.withWindsurf||s.autoMode&&E(R(n,".windsurf"))){let{createWindsurfInstaller:f}=await import("./windsurf-installer-ES3KPQG3.js"),a=await f({projectRoot:n,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(s.withContinueDev||s.autoMode&&E(R(n,".continue"))){let{createContinueDevInstaller:f}=await import("./continuedev-installer-LRFZ2SJM.js"),a=await f({projectRoot:n,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:u,openCodeAgents:m,openCodeSkills:d,kiroAgents:w,kiroSkills:h,kiroHooks:k,platformsConfigured:C}}detectVersionUpgrade(e){let t=R(e.projectRoot,".agentic-qe","config.yaml");if(!E(t))return!1;try{let o=Ge(t,"utf-8").match(/version:\s*"?([^"\n]+)"?/)?.[1],r=e.config.version;return o!==void 0&&o!==r}catch{return!1}}};import{existsSync as K,mkdirSync as Be,writeFileSync as F,readFileSync as Ue}from"fs";import{join as S}from"path";import{spawn as ze}from"child_process";var Y=class extends g{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:n}=e;if(!t.workers.daemonAutoStart||t.workers.enabled.length===0)return{workersDir:"",workersConfigured:0,registryPath:"",daemonStarted:!1,daemonPid:null};let s=S(n,".agentic-qe","workers");K(s)||Be(s,{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 y of t.workers.enabled)r[y]={name:y,enabled:!0,interval:t.workers.intervals[y]||o[y]||6e4,lastRun:null,status:"pending"};let i=S(s,"registry.json"),l={version:t.version,maxConcurrent:t.workers.maxConcurrent,workers:r,createdAt:new Date().toISOString(),daemonPid:null};F(i,JSON.stringify(l,null,2),"utf-8");for(let y of t.workers.enabled){let A=S(s,`${y}.json`),C={name:y,enabled:!0,interval:t.workers.intervals[y]||o[y]||6e4,projectRoot:n,dataDir:S(n,".agentic-qe","data"),createdAt:new Date().toISOString()};F(A,JSON.stringify(C,null,2),"utf-8")}let c=S(s,"start-daemon.cjs");F(c,`#!/usr/bin/env node
108
+ // AQE v3 Worker Daemon Startup Script (cross-platform)
109
+ // Generated by aqe init
110
+ // Starts the MCP server with background workers enabled
111
+
112
+ const { existsSync, readFileSync, writeFileSync, appendFileSync } = require('fs');
113
+ const { join } = require('path');
114
+ const { spawn } = require('child_process');
115
+
116
+ const projectRoot = join(__dirname, '..', '..');
117
+ const workersDir = join(projectRoot, '.agentic-qe', 'workers');
118
+ const pidFile = join(workersDir, 'daemon.pid');
119
+ const logFile = join(workersDir, 'daemon.log');
120
+
121
+ // Check if already running
122
+ if (existsSync(pidFile)) {
123
+ const pid = parseInt(readFileSync(pidFile, 'utf-8').trim(), 10);
124
+ try { process.kill(pid, 0); console.log('Daemon already running (PID: ' + pid + ')'); process.exit(0); } catch {}
125
+ }
126
+
127
+ const ts = new Date().toISOString();
128
+ appendFileSync(logFile, '[' + ts + '] Starting AQE v3 Worker Daemon...\\n');
129
+
130
+ // Find the best way to run aqe-mcp
131
+ const candidates = [
132
+ join(projectRoot, 'node_modules', '.bin', 'aqe-mcp'),
133
+ join(projectRoot, 'node_modules', 'agentic-qe', 'dist', 'mcp', 'bundle.js'),
134
+ ];
135
+
136
+ let mcpCmd, mcpArgs;
137
+ const binCandidate = candidates.find(c => existsSync(c));
138
+
139
+ if (binCandidate && binCandidate.endsWith('bundle.js')) {
140
+ mcpCmd = process.execPath;
141
+ mcpArgs = [binCandidate];
142
+ } else if (binCandidate) {
143
+ mcpCmd = binCandidate;
144
+ mcpArgs = [];
145
+ } else {
146
+ mcpCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
147
+ mcpArgs = ['--yes', 'agentic-qe', 'mcp'];
148
+ }
149
+
150
+ appendFileSync(logFile, '[' + ts + '] Using: ' + mcpCmd + ' ' + mcpArgs.join(' ') + '\\n');
151
+
152
+ const env = { ...process.env, AQE_STORAGE_PATH: '.agentic-qe', AQE_LEARNING_ENABLED: 'true', AQE_WORKERS_ENABLED: 'true', AQE_HTTP_PORT: '0' };
153
+ const child = spawn(mcpCmd, mcpArgs, { cwd: projectRoot, env, detached: true, stdio: ['ignore', 'pipe', 'pipe'] });
154
+ child.stdout.on('data', d => appendFileSync(logFile, d));
155
+ child.stderr.on('data', d => appendFileSync(logFile, d));
156
+ child.unref();
157
+
158
+ writeFileSync(pidFile, String(child.pid));
159
+ appendFileSync(logFile, '[' + ts + '] Daemon started with PID: ' + child.pid + '\\n');
160
+ console.log('AQE v3 Worker Daemon started (PID: ' + child.pid + ')');
161
+ console.log('Log file: ' + logFile);
162
+ console.log('To stop: node ' + join(workersDir, 'stop-daemon.cjs'));
163
+ `);let m=S(s,"stop-daemon.cjs");F(m,`#!/usr/bin/env node
164
+ // AQE v3 Worker Daemon Stop Script (cross-platform)
165
+ // Generated by aqe init
166
+
167
+ const { existsSync, readFileSync, unlinkSync } = require('fs');
168
+ const { join } = require('path');
169
+
170
+ const workersDir = join(__dirname);
171
+ const pidFile = join(workersDir, 'daemon.pid');
172
+
173
+ if (!existsSync(pidFile)) { console.log('No PID file found - daemon may not be running'); process.exit(0); }
174
+
175
+ const pid = parseInt(readFileSync(pidFile, 'utf-8').trim(), 10);
176
+ try {
177
+ process.kill(pid, 0); // Check if alive
178
+ console.log('Stopping daemon (PID: ' + pid + ')...');
179
+ process.kill(pid, 'SIGTERM');
180
+ try { unlinkSync(pidFile); } catch {}
181
+ console.log('Daemon stopped');
182
+ } catch {
183
+ console.log('Daemon not running (stale PID file)');
184
+ try { unlinkSync(pidFile); } catch {}
185
+ }
186
+ `),e.services.log(` Workers dir: ${s}`),e.services.log(` Workers: ${t.workers.enabled.join(", ")}`);let w=!1,h=null,k;if(t.workers.daemonAutoStart)try{let y=await this.startDaemon(s,n,e);w=y.started,h=y.pid,k=y.error,w?e.services.log(` MCP daemon started (PID: ${h})`):k&&(e.services.log(" MCP daemon: skipped (will start via Claude Code)"),e.services.log(` Note: ${k}`))}catch(y){k=y instanceof Error?y.message:"Unknown error",e.services.log(" MCP daemon: skipped (Claude Code will start it)")}return{workersDir:s,workersConfigured:t.workers.enabled.length,registryPath:i,daemonStarted:w,daemonPid:h,daemonError:k}}async startDaemon(e,t,n){let s=S(e,"daemon.pid"),o=S(e,"daemon.log");if(K(s))try{let i=parseInt(Ue(s,"utf-8").trim(),10);return process.kill(i,0),{started:!0,pid:i,error:"Already running"}}catch{}let r=await this.findMcpCommand(t);return r?new Promise(i=>{try{let l={...process.env,AQE_STORAGE_PATH:".agentic-qe",AQE_LEARNING_ENABLED:"true",AQE_WORKERS_ENABLED:"true",AQE_HTTP_PORT:"0"},c=ze(r.command,r.args,{cwd:t,env:l,detached:!0,stdio:["ignore","pipe","pipe"]}),u=!1,m="";c.stderr?.on("data",d=>{m+=d.toString()}),c.on("error",d=>{i({started:!1,pid:null,error:d.message})}),setTimeout(()=>{try{if(c.pid){process.kill(c.pid,0),F(s,c.pid.toString(),"utf-8");let d=`[${new Date().toISOString()}] MCP daemon started with PID: ${c.pid}
187
+ `;F(o,d,{flag:"a"}),c.unref(),i({started:!0,pid:c.pid})}else i({started:!1,pid:null,error:m||"No PID assigned"})}catch{let d=m.includes("ERR_MODULE_NOT_FOUND")?"Missing dependencies. Run: npm install agentic-qe":m||"Process exited immediately";i({started:!1,pid:null,error:d})}},1500)}catch(l){i({started:!1,pid:null,error:l instanceof Error?l.message:"Spawn failed"})}}):{started:!1,pid:null,error:"aqe-mcp not found. Install globally with: npm install -g agentic-qe"}}async findMcpCommand(e){let t=S(e,"node_modules",".bin","aqe-mcp");if(K(t))return{command:t,args:[]};let n=S(e,"node_modules","agentic-qe","dist","mcp","bundle.js");if(K(n))return{command:"node",args:[n]};let s=S(e,"node_modules",".bin","aqe");return K(s)?{command:s,args:["mcp"]}:{command:"npx",args:["--yes","agentic-qe","mcp"]}}};import{existsSync as Ke,readFileSync as Ye,writeFileSync as me}from"fs";import{join as De}from"path";var J=class extends g{name="claude-md";description="Generate CLAUDE.md";order=110;critical=!1;requiresPhases=["configuration"];async run(e){let t=e.config,{projectRoot:n}=e,s=De(n,"CLAUDE.md"),o=this.generateContent(t),r=!1;if(Ke(s)){let i=Ye(s,"utf-8");if(i.includes("## Agentic QE v3"))return e.services.log(" CLAUDE.md already has AQE section"),{generated:!1,path:s,backupCreated:!1};let l=De(n,"CLAUDE.md.backup");me(l,i,"utf-8"),r=!0,me(s,i+`
188
+
189
+ `+o,"utf-8")}else me(s,o,"utf-8");return e.services.log(` Path: ${s}`),r&&e.services.log(" Backup created"),{generated:!0,path:s,backupCreated:r}}generateContent(e){let t=e.domains.enabled.slice(0,6).join(", "),n=Math.max(0,e.domains.enabled.length-6);return`## Agentic QE v3
190
+
191
+ 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).
192
+
193
+ ---
194
+
195
+ ### CRITICAL POLICIES
196
+
197
+ #### Integrity Rule (ABSOLUTE)
198
+ - NO shortcuts, fake data, or false claims
199
+ - ALWAYS implement properly, verify before claiming success
200
+ - ALWAYS use real database queries for integration tests
201
+ - ALWAYS run actual tests, not assume they pass
202
+
203
+ **We value the quality we deliver to our users.**
204
+
205
+ #### Test Execution
206
+ - NEVER run \`npm test\` without \`--run\` flag (watch mode risk)
207
+ - Use: \`npm test -- --run\`, \`npm run test:unit\`, \`npm run test:integration\` when available
208
+
209
+ #### Data Protection
210
+ - NEVER run \`rm -f\` on \`.agentic-qe/\` or \`*.db\` files without confirmation
211
+ - ALWAYS backup before database operations
212
+
213
+ #### Git Operations
214
+ - NEVER auto-commit/push without explicit user request
215
+ - ALWAYS wait for user confirmation before git operations
216
+
217
+ ---
218
+
219
+ ### Quick Reference
220
+
221
+ \`\`\`bash
222
+ # Run tests
223
+ npm test -- --run
224
+
225
+ # Check quality
226
+ aqe quality assess
227
+
228
+ # Generate tests
229
+ aqe test generate <file>
230
+
231
+ # Coverage analysis
232
+ aqe coverage <path>
233
+ \`\`\`
234
+
235
+ ### Using AQE MCP Tools
236
+
237
+ AQE exposes tools via MCP with the \`mcp__agentic-qe__\` prefix. You MUST call \`fleet_init\` before any other tool.
238
+
239
+ #### 1. Initialize the Fleet (required first step)
240
+
241
+ \`\`\`typescript
242
+ mcp__agentic-qe__fleet_init({
243
+ topology: "hierarchical",
244
+ maxAgents: 15,
245
+ memoryBackend: "hybrid"
246
+ })
247
+ \`\`\`
248
+
249
+ #### 2. Generate Tests
250
+
251
+ \`\`\`typescript
252
+ mcp__agentic-qe__test_generate_enhanced({
253
+ targetPath: "src/services/auth.ts",
254
+ framework: "vitest",
255
+ strategy: "boundary-value"
256
+ })
257
+ \`\`\`
258
+
259
+ #### 3. Analyze Coverage
260
+
261
+ \`\`\`typescript
262
+ mcp__agentic-qe__coverage_analyze_sublinear({
263
+ paths: ["src/"],
264
+ threshold: 80
265
+ })
266
+ \`\`\`
267
+
268
+ #### 4. Assess Quality
269
+
270
+ \`\`\`typescript
271
+ mcp__agentic-qe__quality_assess({
272
+ scope: "full",
273
+ includeMetrics: true
274
+ })
275
+ \`\`\`
276
+
277
+ #### 5. Store and Query Patterns (with learning persistence)
278
+
279
+ \`\`\`typescript
280
+ // Store a learned pattern
281
+ mcp__agentic-qe__memory_store({
282
+ key: "patterns/coverage-gap/{timestamp}",
283
+ namespace: "learning",
284
+ value: {
285
+ pattern: "...",
286
+ confidence: 0.95,
287
+ type: "coverage-gap",
288
+ metadata: { /* domain-specific */ }
289
+ },
290
+ persist: true
291
+ })
292
+
293
+ // Query stored patterns
294
+ mcp__agentic-qe__memory_query({
295
+ pattern: "patterns/*",
296
+ namespace: "learning",
297
+ limit: 10
298
+ })
299
+ \`\`\`
300
+
301
+ #### 6. Orchestrate Multi-Agent Tasks
302
+
303
+ \`\`\`typescript
304
+ mcp__agentic-qe__task_orchestrate({
305
+ task: "Full quality assessment of auth module",
306
+ domains: ["test-generation", "coverage-analysis", "security-compliance"],
307
+ parallel: true
308
+ })
309
+ \`\`\`
310
+
311
+ ### MCP Tool Reference
312
+
313
+ | Tool | Description |
314
+ |------|-------------|
315
+ | \`fleet_init\` | Initialize QE fleet (MUST call first) |
316
+ | \`fleet_status\` | Get fleet health and agent status |
317
+ | \`agent_spawn\` | Spawn specialized QE agent |
318
+ | \`test_generate_enhanced\` | AI-powered test generation |
319
+ | \`test_execute_parallel\` | Parallel test execution with retry |
320
+ | \`task_orchestrate\` | Orchestrate multi-agent QE tasks |
321
+ | \`coverage_analyze_sublinear\` | O(log n) coverage analysis |
322
+ | \`quality_assess\` | Quality gate evaluation |
323
+ | \`memory_store\` | Store patterns with namespace + persist |
324
+ | \`memory_query\` | Query patterns by namespace/pattern |
325
+ | \`security_scan_comprehensive\` | SAST/DAST scanning |
326
+
327
+ ### Configuration
328
+
329
+ - **Enabled Domains**: ${t}${n>0?` (+${n} more)`:""}
330
+ - **Learning**: ${e.learning.enabled?"Enabled":"Disabled"} (${e.learning.embeddingModel} embeddings)
331
+ - **Max Concurrent Agents**: ${e.agents.maxConcurrent}
332
+ - **Background Workers**: ${e.workers.enabled.length>0?e.workers.enabled.join(", "):"None"}
333
+
334
+ ### V3 QE Agents
335
+
336
+ QE agents are in \`.claude/agents/v3/\`. Use with Task tool:
337
+
338
+ \`\`\`javascript
339
+ Task({ prompt: "Generate tests", subagent_type: "qe-test-architect", run_in_background: true })
340
+ Task({ prompt: "Find coverage gaps", subagent_type: "qe-coverage-specialist", run_in_background: true })
341
+ Task({ prompt: "Security audit", subagent_type: "qe-security-scanner", run_in_background: true })
342
+ \`\`\`
343
+
344
+ ### Data Storage
345
+
346
+ - **Memory Backend**: \`.agentic-qe/memory.db\` (SQLite)
347
+ - **Configuration**: \`.agentic-qe/config.yaml\`
348
+
349
+ ---
350
+ *Generated by AQE v3 init - ${new Date().toISOString()}*
351
+ `}};import{existsSync as j,readFileSync as Je}from"fs";import{join as N,dirname as Xe}from"path";import{mkdirSync as $e,writeFileSync as Ze}from"fs";ce();var X=class extends g{name="verification";description="Verify installation";order=120;critical=!0;requiresPhases=["database","configuration"];async run(e){let t=e.config,{projectRoot:n}=e,s=[],o=N(n,".agentic-qe","memory.db");s.push({name:"Database exists",passed:j(o)}),s.push({name:".agentic-qe directory",passed:j(N(n,".agentic-qe"))});let r=N(n,".agentic-qe","config.yaml");await this.saveConfig(t,n),s.push({name:"Config saved",passed:j(r)});let i=await this.writeVersionToDb(t.version,n);s.push({name:"Version marker",passed:i});let l=["Database exists",".agentic-qe directory","Config saved"],c=s.filter(u=>l.includes(u.name)).every(u=>u.passed);e.services.log(" Verification checks:");for(let u of s){let m=l.includes(u.name),d=u.passed?"\u2713":m?"\u2717":"\u26A0",w=!m&&!u.passed?" (optional)":"";e.services.log(` ${d} ${u.name}${w}`)}return{verified:c,versionWritten:i,configSaved:j(r),checks:s}}async writeVersionToDb(e,t){let n=N(t,".agentic-qe","memory.db");try{let s=Xe(n);j(s)||$e(s,{recursive:!0});let o=$(n);try{o.exec(`
352
+ CREATE TABLE IF NOT EXISTS kv_store (
353
+ key TEXT NOT NULL,
354
+ namespace TEXT NOT NULL,
355
+ value TEXT NOT NULL,
356
+ expires_at INTEGER,
357
+ created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
358
+ PRIMARY KEY (namespace, key)
359
+ );
360
+ `);let r=Date.now();return o.prepare(`
361
+ INSERT OR REPLACE INTO kv_store (key, namespace, value, created_at)
362
+ VALUES (?, '_system', ?, ?)
363
+ `).run("aqe_version",JSON.stringify(e),r),o.prepare(`
364
+ INSERT OR REPLACE INTO kv_store (key, namespace, value, created_at)
365
+ VALUES (?, '_system', ?, ?)
366
+ `).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 n=N(t,".agentic-qe");j(n)||$e(n,{recursive:!0});let s=N(n,"config.yaml");if(j(s)){let r=this.loadExistingConfig(s);r&&(e=this.mergeConfigs(e,r))}let o=this.configToYAML(e);Ze(s,o,"utf-8")}loadExistingConfig(e){try{let t=Je(e,"utf-8");return this.parseYAML(t)}catch{return null}}parseYAML(e){try{let t={},n=e.split(`
367
+ `),s="",o="";for(let i of n){if(i.trim().startsWith("#")||i.trim()==="")continue;let l=i.match(/^(\w+):\s*(.*)$/);if(l){s=l[1],o="";let d=l[2].trim();d&&!d.startsWith('"')?t[s]=this.parseValue(d):d?t[s]=this.parseValue(d):t[s]={};continue}let c=i.match(/^ (\w+):\s*(.*)$/);if(c&&s){o=c[1];let d=c[2].trim();t[s]||(t[s]={}),d?t[s][o]=this.parseValue(d):t[s][o]={};continue}let u=i.match(/^ ([\w-]+):\s*(.*)$/);if(u&&s&&o){let d=u[1],w=u[2].trim(),h=t[s];h[o]||(h[o]={}),typeof h[o]=="object"&&!Array.isArray(h[o])&&(h[o][d]=this.parseValue(w));continue}let m=i.match(/^ - "?([^"]*)"?$/);if(m&&s&&o){let d=t[s];Array.isArray(d[o])||(d[o]=[]),d[o].push(m[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 n=new Set(t.domains.enabled),s=new Set(e.domains.enabled);for(let r of s)n.add(r);let o=new Set(Array.isArray(t.domains?.disabled)?t.domains.disabled:[]);e.domains.enabled=Array.from(n).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(n=>` - "${n}"`)," intervals:",...Object.entries(e.workers.intervals).map(([n,s])=>` ${n}: ${s}`),` 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(n=>` - "${n}"`)," disabled:",...e.domains.disabled.map(n=>` - "${n}"`),"","agents:",` maxConcurrent: ${e.agents.maxConcurrent}`,` defaultTimeout: ${e.agents.defaultTimeout}`,""].join(`
368
+ `)}};le();import{existsSync as D,mkdirSync as qe,readdirSync as je,copyFileSync as Me}from"fs";import{join as I,dirname as et}from"path";import{fileURLToPath as tt}from"url";var nt=tt(import.meta.url),Te=et(nt);function st(){let p=I(Te,"../../assets/governance"),e=I(Te,"../assets/governance");if(D(p))return p;if(D(e))return e;let t=I(process.cwd(),"assets/governance");if(D(t))return t;throw new Error("Governance assets not found. Package may be corrupted.")}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=st()}async install(){let e=[],t=[],n=[],s=I(this.projectRoot,".claude","guidance"),o=I(s,"shards");try{qe(s,{recursive:!0}),this.skipShards||qe(o,{recursive:!0})}catch(u){return n.push(`Failed to create governance directory: ${x(u)}`),{installed:e,skipped:t,errors:n,governanceDir:s,constitutionInstalled:!1,shardsInstalled:0}}let r=!1,i=I(this.assetsPath,"constitution.md"),l=I(s,"constitution.md");if(D(i))try{!D(l)||this.overwrite?(Me(i,l),e.push("constitution.md"),r=!0):t.push("constitution.md")}catch(u){n.push(`Failed to install constitution.md: ${x(u)}`)}else n.push("constitution.md not found in assets");let c=0;if(!this.skipShards){let u=I(this.assetsPath,"shards");if(D(u))try{let m=je(u).filter(d=>d.endsWith(".shard.md"));for(let d of m){let w=I(u,d),h=I(o,d);try{!D(h)||this.overwrite?(Me(w,h),e.push(`shards/${d}`),c++):t.push(`shards/${d}`)}catch(k){n.push(`Failed to install ${d}: ${x(k)}`)}}}catch(m){n.push(`Failed to read shards directory: ${x(m)}`)}else n.push("Shards directory not found in assets")}return{installed:e,skipped:t,errors:n,governanceDir:s,constitutionInstalled:r,shardsInstalled:c}}isInstalled(){let e=I(this.projectRoot,".claude","guidance","constitution.md");return D(e)}getInstalledShards(){let e=I(this.projectRoot,".claude","guidance","shards");if(!D(e))return[];try{return je(e).filter(t=>t.endsWith(".shard.md"))}catch{return[]}}};function Oe(p){return new ge(p)}var Z=class extends g{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:n}=e,s=n.upgrade,o=Oe({projectRoot:t,overwrite:s});if(o.isInstalled()&&!s){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 rt=new Q,ot=new L,it=new V,at=new W,lt=new H,ct=new G,dt=new B,ut=new U,pt=new z,mt=new Y,gt=new J,ft=new X,ht=new Z;function Fe(){return[rt,ot,it,at,lt,ct,dt,ut,pt,ht,mt,gt,ft]}var fe=class{phases;context;constructor(e){this.context=this.createContext(e),this.phases=e.customPhases??Fe()}createContext(e){let t=e.withAllPlatforms;return{projectRoot:e.projectRoot,options:{autoMode:e.autoMode,upgrade:e.upgrade,skipPatterns:e.skipPatterns,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:n=>console.log(n),warn:n=>console.warn(n),error:n=>console.error(n)}}}async initialize(){let e=Date.now(),t=[];try{let n=[...this.phases].sort((s,o)=>s.order-o.order);for(let s of n){if(!await s.shouldRun(this.context))continue;console.log(`
369
+ \u{1F4CB} ${s.description}...`);let r=await s.execute(this.context);if(this.context.results.set(s.name,r),t.push({step:s.description,status:r.success?"success":"error",message:r.message||"",durationMs:r.durationMs}),!r.success&&s.critical){if(console.error(`
370
+ \u274C Critical phase failed: ${s.name}`),s.rollback)try{await s.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(n){return t.push({step:"Initialization Failed",status:"error",message:x(n),durationMs:0}),this.createFailureResult(t,e)}}createSuccessResult(e,t){let n=this.context.config,s=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"),u=this.context.results.get("workers");return{success:!0,config:n||de("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:s?.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:u?.data?.workersConfigured??0},totalDurationMs:Date.now()-t,timestamp:new Date}}createFailureResult(e,t){return{success:!1,config:de("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 yt(p){return new fe(p)}async function ks(p){return await yt({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 n of p.steps){let s=n.status==="success"?"\u2713":n.status==="error"?"\u2717":"\u25CB",o=n.step.substring(0,48).padEnd(48);e.push(`\u2502 ${s} ${o} ${String(n.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(`
371
+ `)}export{fe as ModularInitOrchestrator,yt as createModularInitOrchestrator,ws as formatInitResultModular,ks as quickInitModular};
@@ -0,0 +1,19 @@
1
+ if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
+ import{a as y,b as w,c as u}from"./chunk-3ZOONQG6.js";import"./chunk-4I2IOUS4.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
+ Loading pipeline from: ${o}
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
+ Validating pipeline: ${o}
6
+ `));let d=await n.loadFromFile(i,l);if(!d.success){console.log(s.red(` Invalid: ${d.error.message}`)),await r(1);return}let p=d.value;console.log(s.green(" Valid pipeline.")),console.log(` ID: ${s.cyan(p.id)}`),console.log(` Name: ${s.cyan(p.name)}`),console.log(` Steps: ${s.cyan(p.steps.length)}`),console.log(""),await r(0)}),a.command("run <pipelineId>").description("Execute a registered pipeline").option("--input <entries...>","Input parameters (key=value)").option("--wait","Wait for execution to complete").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=e.input?T(e.input):{};console.log(s.blue(`
7
+ Running pipeline: ${o}
8
+ `));let d=await i.executeWorkflow(o,l);if(!d.success){console.error(s.red(` Failed: ${d.error.message}`)),await r(1);return}let p=d.value;if(console.log(s.green(" Pipeline started.")),console.log(` Execution ID: ${s.cyan(p)}`),e.wait){console.log(s.gray(" Waiting for completion..."));let c=i.getWorkflowStatus(p);for(;c&&(c.status==="running"||c.status==="paused");)await new Promise(g=>setTimeout(g,500)),c=i.getWorkflowStatus(p);if(c){let g=c.status==="completed"?s.green:s.red;console.log(` Status: ${g(c.status)}`),c.duration&&console.log(` Duration: ${s.cyan(`${c.duration}ms`)}`),c.error&&console.log(` Error: ${s.red(c.error)}`)}}console.log(""),await r(0)}),a.command("list").description("List all registered pipelines").action(async()=>{if(!await t())return;let o=v(m);if(!o){console.error(s.red(' Workflow orchestrator not available. Run "aqe fleet init" first.')),await r(1);return}let e=o.listWorkflows();if(console.log(s.blue(`
9
+ Registered Pipelines (${e.length})
10
+ `)),e.length===0)console.log(s.gray(" No pipelines registered."));else for(let i of e)console.log(` ${s.cyan(i.id)} \u2014 ${i.name} (${i.stepCount} steps, v${i.version})`),i.tags?.length&&console.log(` Tags: ${s.gray(i.tags.join(", "))}`);console.log(""),await r(0)}),a.command("status <executionId>").description("Show the status of a pipeline execution").action(async o=>{if(!await t())return;let e=v(m);if(!e){console.error(s.red(' Workflow orchestrator not available. Run "aqe fleet init" first.')),await r(1);return}let i=e.getWorkflowStatus(o);if(!i){console.error(s.red(` Execution not found: ${o}`)),await r(1);return}let l=i.status==="completed"?s.green:i.status==="failed"?s.red:i.status==="running"?s.yellow:s.gray;console.log(s.blue(`
11
+ Pipeline Execution Status
12
+ `)),console.log(` Execution: ${s.cyan(o)}`),console.log(` Pipeline: ${s.cyan(i.workflowName)} (${i.workflowId})`),console.log(` Status: ${l(i.status)}`),console.log(` Progress: ${s.cyan(`${i.progress}%`)}`),console.log(` Completed: ${s.cyan(i.completedSteps.join(", ")||"none")}`),i.failedSteps.length>0&&console.log(` Failed: ${s.red(i.failedSteps.join(", "))}`),i.skippedSteps.length>0&&console.log(` Skipped: ${s.gray(i.skippedSteps.join(", "))}`),i.currentSteps.length>0&&console.log(` Running: ${s.yellow(i.currentSteps.join(", "))}`),i.duration&&console.log(` Duration: ${s.cyan(`${i.duration}ms`)}`),i.error&&console.log(` Error: ${s.red(i.error)}`),console.log(""),await r(0)}),a.command("approve <executionId> <stepId>").description("Approve a step that is awaiting approval").action(async(o,e)=>{if(!await t())return;let i=v(m);if(!i){console.error(s.red(" Workflow orchestrator not available.")),await r(1);return}if(i.approveStep(o,e))console.log(s.green(`
13
+ Step '${e}' approved.
14
+ `));else{console.error(s.red(`
15
+ No pending approval found for step '${e}' in execution '${o}'.
16
+ `)),await r(1);return}await r(0)}),a.command("reject <executionId> <stepId>").description("Reject a step that is awaiting approval").option("--reason <reason>","Rejection reason").action(async(o,e,i)=>{if(!await t())return;let l=v(m);if(!l){console.error(s.red(" Workflow orchestrator not available.")),await r(1);return}if(l.rejectStep(o,e,i.reason))console.log(s.green(`
17
+ Step '${e}' rejected.`)),i.reason&&console.log(` Reason: ${s.gray(i.reason)}`),console.log("");else{console.error(s.red(`
18
+ No pending approval found for step '${e}' in execution '${o}'.
19
+ `)),await r(1);return}await r(0)}),a}export{X as createPipelineCommand};
@@ -0,0 +1,2 @@
1
+ if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
+ import{a as u}from"./chunk-4YOMLWEK.js";import{a as y,c as w}from"./chunk-JZSDOIXA.js";import{b as $}from"./chunk-4I2IOUS4.js";import{Command as v}from"commander";import o from"chalk";import{existsSync as d,readFileSync as P}from"node:fs";import m from"node:path";w();var C=$({});var p=Object.keys(u);function h(s){return p.includes(s)}function x(s,e){let t=m.join(s,e.configPath),n=m.join(s,e.rulesPath);return{configExists:d(t),rulesExists:d(n)}}function E(s,e){try{let t=P(s,"utf-8");return e==="json"?{valid:!0,data:JSON.parse(t)}:e==="toml"?t.trim().length===0?{valid:!1,error:"File is empty"}:{valid:!0}:e==="yaml"?t.trim().length===0?{valid:!1,error:"File is empty"}:{valid:!0}:{valid:!0}}catch(t){return{valid:!1,error:y(t)}}}function I(s,e){try{return P(s,"utf-8").includes("agentic-qe")}catch{return!1}}function j(){let s=new v("platform").description("Manage coding agent platform configurations");return s.command("list").description("List all supported platforms and their configuration status").action(async()=>{let e=process.cwd();console.log(""),console.log(o.bold.blue(" Supported Platforms")),console.log(o.gray(" \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")),console.log("");let t=18,n=36,r=14;console.log(o.gray(` ${"Platform".padEnd(t)}${"Config Path".padEnd(n)}${"Status".padEnd(r)}`)),console.log(o.gray(` ${"\u2500".repeat(t+n+r)}`));for(let l of p){let f=u[l],{configExists:c,rulesExists:a}=x(e,f),i=c&&a?o.green("configured"):c||a?o.yellow("partial"):o.gray("not configured");console.log(` ${o.white(f.name.padEnd(t))}${o.gray(f.configPath.padEnd(n))}${i}`)}console.log(""),console.log(o.gray(' Use "aqe platform setup <name>" to configure a platform')),console.log(o.gray(' Use "aqe init --with-all-platforms" to configure all at once')),console.log("")}),s.command("setup <name>").description("Set up a specific platform configuration").option("--overwrite","Overwrite existing configuration files").action(async(e,t)=>{let n=process.cwd();h(e)||(console.log(""),console.log(o.red(` Unknown platform: ${e}`)),console.log(o.gray(` Valid platforms: ${p.join(", ")}`)),console.log(""),process.exit(1));let r=u[e];console.log(""),console.log(o.bold.blue(` Setting up ${r.name}`)),console.log(o.gray(" \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")),console.log("");try{let l=await C(`../../init/${e}-installer.js`),c=[`create${e.charAt(0).toUpperCase()}${e.slice(1).replace(/([a-z])([A-Z])/g,"$1$2")}Installer`,`create${R(e)}Installer`],a;for(let i of c)if(typeof l[i]=="function"){a=l[i];break}if(!a){for(let i of Object.keys(l))if(i.startsWith("create")&&i.endsWith("Installer")&&typeof l[i]=="function"){a=l[i];break}}a||(console.log(o.red(` Could not find installer factory for ${e}`)),process.exit(1));let g=await a({projectRoot:n,overwrite:t.overwrite}).install();if(g.success)console.log(o.green(` ${r.name} configured successfully`)),g.mcpConfigured&&console.log(o.gray(` MCP config: ${r.configPath}`)),g.rulesInstalled&&console.log(o.gray(` Rules: ${r.rulesPath}`));else if(console.log(o.red(` ${r.name} setup failed`)),g.errors)for(let i of g.errors)console.log(o.red(` ${i}`))}catch(l){console.log(o.red(` Failed to set up ${r.name}: ${y(l)}`))}console.log("")}),s.command("verify <name>").description("Verify a platform configuration is correct").action(async e=>{let t=process.cwd();h(e)||(console.log(""),console.log(o.red(` Unknown platform: ${e}`)),console.log(o.gray(` Valid platforms: ${p.join(", ")}`)),console.log(""),process.exit(1));let n=u[e];console.log(""),console.log(o.bold.blue(` Verifying ${n.name}`)),console.log(o.gray(" \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")),console.log("");let r=!0,l=m.join(t,n.configPath);if(d(l)?console.log(o.green(` [pass] Config file exists: ${n.configPath}`)):(console.log(o.red(` [fail] Config file missing: ${n.configPath}`)),r=!1),d(l)){let c=E(l,n.configFormat);c.valid?console.log(o.green(` [pass] Config file is valid ${n.configFormat.toUpperCase()}`)):(console.log(o.red(` [fail] Config file is invalid: ${c.error}`)),r=!1),I(l,n)?console.log(o.green(" [pass] Config contains agentic-qe entry")):(console.log(o.red(" [fail] Config does not contain agentic-qe entry")),r=!1)}let f=m.join(t,n.rulesPath);d(f)?console.log(o.green(` [pass] Rules file exists: ${n.rulesPath}`)):(console.log(o.red(` [fail] Rules file missing: ${n.rulesPath}`)),r=!1),console.log(""),r?console.log(o.green(` ${n.name} configuration is valid`)):(console.log(o.yellow(` ${n.name} configuration has issues`)),console.log(o.gray(` Run "aqe platform setup ${e}" to fix`))),console.log("")}),s}function R(s){return s.charAt(0).toUpperCase()+s.slice(1)}var V=j;export{j as createPlatformCommand,V as default};
@@ -0,0 +1,27 @@
1
+ if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
+ import{a as p,b as d,c as h}from"./chunk-2BZFNEN2.js";import"./chunk-4I2IOUS4.js";import{Command as _}from"commander";import*as g from"path";import{execFileSync as v}from"child_process";var $=/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/,w=/^[a-zA-Z0-9._\-/]+$/;function E(i,n){if(!$.test(i))throw new Error(`Invalid GitHub repo "${i}": must be owner/repo with alphanumeric, dots, hyphens, underscores only`);if(n&&!w.test(n))throw new Error(`Invalid tag "${n}": must be alphanumeric with dots, hyphens, underscores, slashes only`)}var u=class{type="github";cacheDir;constructor(n){this.cacheDir=n??g.join(process.cwd(),".agentic-qe","plugins-cache")}async resolve(n){let e=await this.getPluginPath(n),t=g.join(e,"qe-plugin.json"),o=await import("fs");if(!o.existsSync(t))throw new Error(`No qe-plugin.json found in ${n}`);let r=o.readFileSync(t,"utf-8");return p(r)}async getPluginPath(n){let{repo:e,tag:t}=this.parseLocation(n);E(e,t);let o=g.join(this.cacheDir,e.replace("/","__"),t||"latest"),r=await import("fs");if(r.existsSync(o))return o;r.mkdirSync(o,{recursive:!0});try{let a=`https://github.com/${e}.git`,c=["clone","--depth","1"];t&&c.push("--branch",t),c.push(a,o),v("git",c,{stdio:"pipe",timeout:6e4})}catch(a){throw r.rmSync(o,{recursive:!0,force:!0}),new Error(`Failed to clone ${e}: ${a instanceof Error?a.message:String(a)}`)}return o}parseLocation(n){let[e,t]=n.split("@");if(!e||!e.includes("/"))throw new Error(`Invalid GitHub location "${n}". Expected "owner/repo" or "owner/repo@tag"`);return{repo:e,tag:t}}};import*as l from"path";import*as s from"fs";import{execFileSync as y}from"child_process";var P=/^(@[a-zA-Z0-9._-]+\/)?[a-zA-Z0-9._-]+$/,S=/^[a-zA-Z0-9._\-+]+$/;function x(i,n){if(!P.test(i))throw new Error(`Invalid npm package name "${i}": contains unsafe characters`);if(n&&!S.test(n))throw new Error(`Invalid version "${n}": contains unsafe characters`)}var m=class{type="npm";cacheDir;constructor(n){this.cacheDir=n??l.join(process.cwd(),".agentic-qe","plugins-cache","npm")}async resolve(n){let e=await this.getPluginPath(n),t=l.join(e,"qe-plugin.json");if(!s.existsSync(t))throw new Error(`No qe-plugin.json found in npm package ${n}`);let o=s.readFileSync(t,"utf-8");return p(o)}async getPluginPath(n){let{name:e,version:t}=this.parseLocation(n);x(e,t);let o=e.replace(/\//g,"__"),r=l.join(this.cacheDir,`${o}@${t||"latest"}`);if(s.existsSync(r)&&s.readdirSync(r).length>0)return r;s.mkdirSync(r,{recursive:!0});try{let a=t?`${e}@${t}`:e,c=y("npm",["pack",a,"--pack-destination",r],{stdio:"pipe",timeout:6e4}).toString().trim(),f=l.join(r,c);y("tar",["-xzf",f,"-C",r,"--strip-components=1"],{stdio:"pipe"}),s.existsSync(f)&&s.unlinkSync(f)}catch(a){throw s.rmSync(r,{recursive:!0,force:!0}),new Error(`Failed to fetch npm package ${n}: ${a instanceof Error?a.message:String(a)}`)}return r}parseLocation(n){let e=n.lastIndexOf("@");return e>0?{name:n.slice(0,e),version:n.slice(e+1)||void 0}:{name:n}}};function N(){let i=I(),n=new _("plugin").description("Manage external QE domain plugins").addHelpText("after",`
3
+ Examples:
4
+ aqe plugin install ./my-plugin Install from local directory
5
+ aqe plugin install owner/repo --source github Install from GitHub
6
+ aqe plugin install aqe-plugin-sap --source npm Install from npm
7
+ aqe plugin list List installed plugins
8
+ aqe plugin remove my-plugin Remove a plugin
9
+ aqe plugin info my-plugin Show plugin details
10
+ `);return n.command("install <location>").description("Install a QE plugin from a local directory, GitHub repo, or npm package").option("-s, --source <type>","Source type: local, github, npm","local").action(async(e,t)=>{try{console.log(`Installing plugin from ${t.source}: ${e}...`);let o=await i.install(e,t.source);if(o.success)console.log(`
11
+ Plugin installed successfully!`),console.log(` Name: ${o.manifest.name}`),console.log(` Version: ${o.manifest.version}`),console.log(` Domains: ${o.manifest.domains.join(", ")}`),console.log(` Cache: ${o.cachePath}
12
+ `);else{console.error(`
13
+ Installation failed:`);for(let r of o.errors)console.error(` - ${r}`);if(o.securityViolations.length>0){console.error(`
14
+ Security violations:`);for(let r of o.securityViolations)console.error(` - ${r}`)}process.exitCode=1}}catch(o){console.error(`Error: ${o instanceof Error?o.message:String(o)}`),process.exitCode=1}}),n.command("list").description("List installed QE plugins").action(()=>{let e=i.list();if(e.length===0){console.log(`
15
+ No plugins installed.
16
+ `),console.log(` Install one with: aqe plugin install <location>
17
+ `);return}console.log(`
18
+ Installed plugins (${e.length}):
19
+ `);for(let t of e)console.log(` ${t.name}@${t.version}`),console.log(` ${t.description}`),console.log(` Domains: ${t.domains.join(", ")}`),console.log("")}),n.command("remove <name>").description("Remove an installed QE plugin").option("-v, --version <version>","Remove specific version (default: all)").action((e,t)=>{if(i.remove(e,t.version)){let r=t.version?`@${t.version}`:" (all versions)";console.log(`
20
+ Removed: ${e}${r}
21
+ `)}else console.log(`
22
+ Plugin not found: ${e}
23
+ `),process.exitCode=1}),n.command("info <name>").description("Show detailed info about an installed plugin").action(e=>{let t=i.list().filter(r=>r.name===e);if(t.length===0){console.log(`
24
+ Plugin not found: ${e}
25
+ `),process.exitCode=1;return}let o=t[0];console.log(`
26
+ Plugin: ${o.name}`),console.log(` Version: ${o.version}`),console.log(` Description: ${o.description}`),console.log(` Domains: ${o.domains.join(", ")}`),console.log(` Source: ${o.source}`),console.log(` Cache: ${o.cachePath}
27
+ `)}),n}function I(){let i=new d;return new h({cache:i,sources:[new u,new m]})}export{N as createPluginCommand};
@@ -0,0 +1,2 @@
1
+ if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
+ import"./chunk-4I2IOUS4.js";import{createRequire as t}from"module";var n=t(import.meta.url),e=n("prime-radiant-advanced-wasm"),r=e,{RuvectorLayer:i,TensorCompress:a,differentiableSearch:c,hierarchicalForward:p,getCompressionLevel:s,init:d,FlashAttention:l,DotProductAttention:m,MultiHeadAttention:u,HyperbolicAttention:A,LinearAttention:f,MoEAttention:h,SonaEngine:_,pipeline:v}=e||{};export{m as DotProductAttention,l as FlashAttention,A as HyperbolicAttention,f as LinearAttention,h as MoEAttention,u as MultiHeadAttention,i as RuvectorLayer,_ as SonaEngine,a as TensorCompress,r as default,c as differentiableSearch,s as getCompressionLevel,p as hierarchicalForward,d as init,v as pipeline};
@@ -0,0 +1,2 @@
1
+ if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
+ import{a,b}from"./chunk-WIEC7VKK.js";import"./chunk-QOVHWZEP.js";import"./chunk-5SKGFSKD.js";import"./chunk-3ZOONQG6.js";import"./chunk-SUSEVMZT.js";import"./chunk-JZSDOIXA.js";import"./chunk-4I2IOUS4.js";export{a as DefaultProtocolExecutor,b as createProtocolExecutor};
@@ -0,0 +1,20 @@
1
+ if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
+ import"./chunk-N5UXCLFI.js";import{c as i}from"./chunk-WGMPEW2T.js";import"./chunk-4I2IOUS4.js";import n from"chalk";var a=class{name="protocol";description="Execute coordination protocols";cleanupAndExit;ensureInitialized;constructor(o,e){this.cleanupAndExit=o,this.ensureInitialized=e}register(o,e){o.command("protocol").description(this.description).command("run <protocolId>").description("Execute a protocol").option("--params <json>","Protocol parameters as JSON","{}").action(async(r,t)=>{await this.executeRun(r,t,e)})}async executeRun(o,e,c){if(await this.ensureInitialized())try{let r=i(e.params,"params");console.log(n.blue(`
3
+ Executing protocol: ${o}
4
+ `));let t=await c.queen.executeProtocol(o,r);t.success?(console.log(n.green(" Protocol execution started")),console.log(n.cyan(` Execution ID: ${t.value}`))):console.log(n.red(` Failed to execute protocol: ${t.error.message}`)),console.log("")}catch(r){console.error(n.red(`
5
+ Failed to execute protocol:`),r),await this.cleanupAndExit(1)}}getHelp(){return`
6
+ Execute coordination protocols.
7
+
8
+ Usage:
9
+ aqe protocol <command> [options]
10
+
11
+ Commands:
12
+ run <protocolId> Execute a protocol
13
+
14
+ Options:
15
+ --params <json> Protocol parameters as JSON (default: {})
16
+
17
+ Examples:
18
+ aqe protocol run cross-domain-sync
19
+ aqe protocol run data-validation --params '{"strict": true}'
20
+ `}};function p(s,o){return new a(s,o)}export{a as ProtocolHandler,p as createProtocolHandler};
@@ -0,0 +1,3 @@
1
+ if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
+ import"./chunk-4I2IOUS4.js";import{Command as l}from"commander";import*as c from"crypto";import*as n from"fs";import*as r from"path";function m(t){let e=JSON.stringify(t,null,0);return c.createHash("sha256").update(e).digest("hex")}async function d(t){let e={testCount:0,passRate:0,coveragePercent:0,vulnerabilities:0,qualityScore:0,patternsUsed:0};try{let a=r.join(t,"junit.xml");if(n.existsSync(a)){let o=n.readFileSync(a,"utf-8"),s=o.match(/tests="(\d+)"/),i=o.match(/failures="(\d+)"/);if(s){e.testCount=parseInt(s[1],10);let u=i?parseInt(i[1],10):0;e.passRate=e.testCount>0?(e.testCount-u)/e.testCount*100:0}}}catch{}try{let a=r.join(t,"coverage","coverage-summary.json");if(n.existsSync(a)){let o=JSON.parse(n.readFileSync(a,"utf-8"));e.coveragePercent=o?.total?.lines?.pct??0}}catch{}try{let a=r.join(t,".agentic-qe","memory.db");n.existsSync(a)&&(e.patternsUsed=1)}catch{}return e.qualityScore=Math.round(e.passRate*.4+e.coveragePercent*.3+(e.vulnerabilities===0?100:Math.max(0,100-e.vulnerabilities*10))*.3),e}function y(t,e){let a={version:"1.0.0",timestamp:new Date().toISOString(),projectRoot:t,attestation:{testsExecuted:e.testCount>0,coverageChecked:e.coveragePercent>0,securityScanned:e.vulnerabilities===0,qualityGatePassed:e.qualityScore>=70},metrics:e,generatedBy:"agentic-qe prove"},o=m(a);return{...a,hash:o}}function f(t){return["# Proof of Quality","",`**Generated:** ${t.timestamp}`,`**Project:** ${t.projectRoot}`,`**Hash:** \`${t.hash}\``,"","## Attestation","","| Check | Status |","|-------|--------|",`| Tests Executed | ${t.attestation.testsExecuted?"PASS":"FAIL"} |`,`| Coverage Checked | ${t.attestation.coverageChecked?"PASS":"FAIL"} |`,`| Security Scanned | ${t.attestation.securityScanned?"PASS":"FAIL"} |`,`| Quality Gate | ${t.attestation.qualityGatePassed?"PASSED":"FAILED"} |`,"","## Metrics","","| Metric | Value |","|--------|-------|",`| Tests | ${t.metrics.testCount} |`,`| Pass Rate | ${t.metrics.passRate.toFixed(1)}% |`,`| Coverage | ${t.metrics.coveragePercent.toFixed(1)}% |`,`| Vulnerabilities | ${t.metrics.vulnerabilities} |`,`| Quality Score | ${t.metrics.qualityScore}/100 |`,"","---",`*${t.generatedBy}*`].join(`
3
+ `)}async function p(t){let e=t.projectRoot??process.cwd(),a=await d(e),o=y(e,a),s=t.format==="markdown"?f(o):JSON.stringify(o,null,2);return t.output?(n.writeFileSync(t.output,s),console.log(`Quality attestation written to ${t.output}`)):console.log(s),o}function g(t,e,a){return new l("prove").description("Generate a verifiable Proof-of-Quality attestation").option("-F, --format <format>","Output format (json|markdown)","json").option("-o, --output <path>","Write attestation to file").action(async o=>{try{await p({format:o.format,output:o.output}),await e(0)}catch(s){console.error("Failed to generate proof-of-quality:",s),await e(1)}})}export{y as buildAttestation,d as collectMetrics,g as createProveCommand,f as formatMarkdown,p as handleProve,m as hashAttestation};