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
package/dist/cli/index.js CHANGED
@@ -12,20 +12,7 @@
12
12
  import { toErrorMessage } from '../shared/error-utils.js';
13
13
  import { Command } from 'commander';
14
14
  import chalk from 'chalk';
15
- import { QEKernelImpl } from '../kernel/kernel';
16
- import { UnifiedMemoryManager } from '../kernel/unified-memory';
17
- import { createQueenCoordinator, } from '../coordination/queen-coordinator';
18
- import { CrossDomainEventRouter } from '../coordination/cross-domain-router';
19
- import { DefaultProtocolExecutor } from '../coordination/protocol-executor';
20
- import { WorkflowOrchestrator } from '../coordination/workflow-orchestrator';
21
15
  import { ALL_DOMAINS } from '../shared/types';
22
- import { bootstrapTokenTracking, shutdownTokenTracking } from '../init/token-bootstrap.js';
23
- import { parsePipelineFile, validatePipeline, describeCronSchedule, } from './utils/workflow-parser.js';
24
- import { parseJsonOption } from './helpers/safe-json.js';
25
- import { createPersistentScheduler, createScheduleEntry, } from './scheduler/index.js';
26
- // Import handlers and registry
27
- import { createCommandRegistry } from './command-registry.js';
28
- import { formatDuration } from './handlers/interfaces.js';
29
16
  // ============================================================================
30
17
  // Redirect internal domain logs to stderr so stdout stays clean for CI/JSON
31
18
  // ============================================================================
@@ -42,13 +29,18 @@ const INTERNAL_LOG_PREFIXES = [
42
29
  '[code-intelligence]', '[security-compliance]', '[contract-testing]',
43
30
  '[visual-accessibility]', '[chaos-resilience]', '[learning-optimization]',
44
31
  '[enterprise-integration]', '[coordination]', '[PatternLearnerService]',
45
- '[RequirementsValidation]',
32
+ '[RequirementsValidation]', '[ParserRegistry]', '[AdversarialDefense]',
33
+ '[ContinueGateIntegration]', '[ContinueGate]', '[SQLitePatternStore]',
34
+ '[TokenTracking]', '[InfraHealing]', '[ExperienceCapture]',
46
35
  ];
36
+ /** Timestamped log pattern: [HH:MM:SS.sss] [LEVEL] */
37
+ const TIMESTAMPED_LOG_RE = /^\[\d{2}:\d{2}:\d{2}\.\d{3}\]\s+\[/;
47
38
  const originalConsoleLog = console.log.bind(console);
48
39
  console.log = (...args) => {
49
40
  const first = typeof args[0] === 'string' ? args[0] : '';
50
41
  const trimmed = first.trimStart();
51
- if (INTERNAL_LOG_PREFIXES.some(prefix => trimmed.startsWith(prefix))) {
42
+ if (INTERNAL_LOG_PREFIXES.some(prefix => trimmed.startsWith(prefix)) ||
43
+ TIMESTAMPED_LOG_RE.test(trimmed)) {
52
44
  process.stderr.write(args.map(String).join(' ') + '\n');
53
45
  return;
54
46
  }
@@ -100,6 +92,12 @@ function registerDomainWorkflowActions(kernel, orchestrator) {
100
92
  // Helper Functions
101
93
  // ============================================================================
102
94
  async function autoInitialize() {
95
+ const { QEKernelImpl } = await import('../kernel/kernel.js');
96
+ const { CrossDomainEventRouter } = await import('../coordination/cross-domain-router.js');
97
+ const { DefaultProtocolExecutor } = await import('../coordination/protocol-executor.js');
98
+ const { WorkflowOrchestrator } = await import('../coordination/workflow-orchestrator.js');
99
+ const { createQueenCoordinator } = await import('../coordination/queen-coordinator.js');
100
+ const { createPersistentScheduler } = await import('./scheduler/index.js');
103
101
  context.kernel = new QEKernelImpl({
104
102
  maxConcurrentAgents: 15,
105
103
  memoryBackend: 'sqlite',
@@ -172,6 +170,7 @@ async function cleanupAndExit(code = 0) {
172
170
  const forceExitTimer = setTimeout(() => process.exit(code), 3000);
173
171
  forceExitTimer.unref?.();
174
172
  try {
173
+ const { shutdownTokenTracking } = await import('../init/token-bootstrap.js');
175
174
  await shutdownTokenTracking();
176
175
  if (context.workflowOrchestrator) {
177
176
  await context.workflowOrchestrator.dispose();
@@ -185,6 +184,7 @@ async function cleanupAndExit(code = 0) {
185
184
  if (context.kernel) {
186
185
  await context.kernel.dispose();
187
186
  }
187
+ const { UnifiedMemoryManager } = await import('../kernel/unified-memory.js');
188
188
  UnifiedMemoryManager.resetInstance();
189
189
  }
190
190
  catch (error) {
@@ -203,638 +203,152 @@ program
203
203
  .description('Agentic QE - Domain-Driven Quality Engineering')
204
204
  .version(VERSION);
205
205
  // ============================================================================
206
- // Register Handlers via CommandRegistry
206
+ // Register Handlers (lazy — each handler loads only when its command runs)
207
207
  // ============================================================================
208
- const registry = createCommandRegistry(context, cleanupAndExit, ensureInitialized, ensureInitializedStrict);
209
- registry.registerAll(program);
210
- // ============================================================================
211
- // Workflow Command Group (ADR-041)
212
- // ============================================================================
213
- const workflowCmd = program
214
- .command('workflow')
215
- .description('Manage QE workflows and pipelines (ADR-041)');
216
- workflowCmd
217
- .command('run <file>')
218
- .description('Execute a QE pipeline from YAML file')
219
- .option('-w, --watch', 'Watch execution progress')
220
- .option('-v, --verbose', 'Show detailed output')
221
- .option('--params <json>', 'Additional parameters as JSON', '{}')
222
- .action(async (file, options) => {
223
- if (!await ensureInitialized())
224
- return;
225
- const fs = await import('fs');
226
- const pathModule = await import('path');
227
- const filePath = pathModule.resolve(file);
228
- try {
229
- console.log(chalk.blue(`\n Running workflow from: ${file}\n`));
230
- const parseResult = parsePipelineFile(filePath);
231
- if (!parseResult.success || !parseResult.workflow) {
232
- console.log(chalk.red('Failed to parse pipeline:'));
233
- for (const error of parseResult.errors) {
234
- console.log(chalk.red(` ${error}`));
235
- }
236
- await cleanupAndExit(1);
237
- }
238
- const additionalParams = parseJsonOption(options.params, 'params');
239
- const input = { ...additionalParams };
240
- if (parseResult.pipeline) {
241
- for (const stage of parseResult.pipeline.stages) {
242
- if (stage.params) {
243
- for (const [key, value] of Object.entries(stage.params)) {
244
- input[key] = value;
245
- }
246
- }
247
- }
248
- }
249
- const existingWorkflow = context.workflowOrchestrator.getWorkflow(parseResult.workflow.id);
250
- if (!existingWorkflow) {
251
- const registerResult = context.workflowOrchestrator.registerWorkflow(parseResult.workflow);
252
- if (!registerResult.success) {
253
- console.log(chalk.red(`Failed to register workflow: ${registerResult.error.message}`));
254
- await cleanupAndExit(1);
255
- }
256
- }
257
- const execResult = await context.workflowOrchestrator.executeWorkflow(parseResult.workflow.id, input);
258
- if (!execResult.success) {
259
- console.log(chalk.red(`Failed to start workflow: ${execResult.error.message}`));
260
- await cleanupAndExit(1);
261
- return;
262
- }
263
- const executionId = execResult.value;
264
- console.log(chalk.cyan(` Execution ID: ${executionId}`));
265
- console.log(chalk.gray(` Workflow: ${parseResult.workflow.name}`));
266
- console.log(chalk.gray(` Stages: ${parseResult.workflow.steps.length}`));
267
- console.log('');
268
- if (options.watch) {
269
- console.log(chalk.blue('Workflow Progress:\n'));
270
- let lastStatus;
271
- const startTime = Date.now();
272
- while (true) {
273
- const status = context.workflowOrchestrator.getWorkflowStatus(executionId);
274
- if (!status)
275
- break;
276
- if (!lastStatus ||
277
- lastStatus.progress !== status.progress ||
278
- lastStatus.status !== status.status ||
279
- JSON.stringify(lastStatus.currentSteps) !== JSON.stringify(status.currentSteps)) {
280
- process.stdout.write('\r\x1b[K');
281
- const progressBar = String.fromCharCode(0x2588).repeat(Math.floor(status.progress / 5)) +
282
- String.fromCharCode(0x2591).repeat(20 - Math.floor(status.progress / 5));
283
- const statusColor = status.status === 'completed' ? chalk.green :
284
- status.status === 'failed' ? chalk.red :
285
- status.status === 'running' ? chalk.yellow : chalk.gray;
286
- console.log(` [${progressBar}] ${status.progress}% - ${statusColor(status.status)}`);
287
- if (status.currentSteps.length > 0 && options.verbose) {
288
- console.log(chalk.gray(` Running: ${status.currentSteps.join(', ')}`));
289
- }
290
- lastStatus = status;
291
- }
292
- if (status.status === 'completed' || status.status === 'failed' || status.status === 'cancelled') {
293
- break;
294
- }
295
- await new Promise(resolve => setTimeout(resolve, 500));
296
- }
297
- const finalStatus = context.workflowOrchestrator.getWorkflowStatus(executionId);
298
- if (finalStatus) {
299
- console.log('');
300
- const duration = finalStatus.duration || (Date.now() - startTime);
301
- if (finalStatus.status === 'completed') {
302
- console.log(chalk.green(`Workflow completed successfully`));
303
- console.log(chalk.gray(` Duration: ${formatDuration(duration)}`));
304
- console.log(chalk.gray(` Completed: ${finalStatus.completedSteps.length} stages`));
305
- if (finalStatus.skippedSteps.length > 0) {
306
- console.log(chalk.yellow(` Skipped: ${finalStatus.skippedSteps.length} stages`));
307
- }
308
- }
309
- else if (finalStatus.status === 'failed') {
310
- console.log(chalk.red(`Workflow failed`));
311
- console.log(chalk.red(` Error: ${finalStatus.error}`));
312
- console.log(chalk.gray(` Failed stages: ${finalStatus.failedSteps.join(', ')}`));
313
- }
314
- else {
315
- console.log(chalk.yellow(`Workflow ${finalStatus.status}`));
316
- }
317
- }
318
- }
319
- else {
320
- console.log(chalk.green('Workflow execution started'));
321
- console.log(chalk.gray(` Use 'aqe workflow status ${executionId}' to check progress`));
322
- }
323
- console.log('');
324
- await cleanupAndExit(0);
325
- }
326
- catch (error) {
327
- console.error(chalk.red('\nFailed to run workflow:'), error);
328
- await cleanupAndExit(1);
329
- }
208
+ import { registerLazyCommand, registerLazyHandler } from './lazy-registry.js';
209
+ registerLazyHandler(program, 'init', 'Initialize the AQE v3 system', () => import('./handlers/init-handler.js').then(m => m.createInitHandler(cleanupAndExit)), context);
210
+ registerLazyHandler(program, 'status', 'Show system status', () => import('./handlers/status-handler.js').then(m => m.createStatusHandler(cleanupAndExit, ensureInitializedStrict)), context);
211
+ registerLazyHandler(program, 'health', 'Check system health', () => import('./handlers/status-handler.js').then(m => m.createHealthHandler(cleanupAndExit, ensureInitializedStrict)), context);
212
+ registerLazyHandler(program, 'task', 'Manage QE tasks', () => import('./handlers/task-handler.js').then(m => m.createTaskHandler(cleanupAndExit, ensureInitialized)), context);
213
+ registerLazyHandler(program, 'agent', 'Manage QE agents', () => import('./handlers/agent-handler.js').then(m => m.createAgentHandler(cleanupAndExit, ensureInitialized)), context);
214
+ registerLazyHandler(program, 'domain', 'Domain operations', () => import('./handlers/domain-handler.js').then(m => m.createDomainHandler(cleanupAndExit, ensureInitialized)), context);
215
+ registerLazyHandler(program, 'protocol', 'Execute coordination protocols', () => import('./handlers/protocol-handler.js').then(m => m.createProtocolHandler(cleanupAndExit, ensureInitialized)), context);
216
+ registerLazyHandler(program, 'brain', 'Export, import, and inspect QE brain state', () => import('./handlers/brain-handler.js').then(m => m.createBrainHandler(cleanupAndExit, ensureInitialized)), context);
217
+ registerLazyHandler(program, 'hypergraph', 'Query the code knowledge hypergraph', () => import('./handlers/hypergraph-handler.js').then(m => m.createHypergraphHandler(cleanupAndExit, ensureInitialized)), context, ['hg']);
218
+ registerLazyHandler(program, 'heartbeat', 'Manage the token-free heartbeat scheduler', () => import('./handlers/heartbeat-handler.js').then(m => m.createHeartbeatHandler(cleanupAndExit)), context);
219
+ registerLazyHandler(program, 'routing', 'View routing performance, economics, and accuracy', () => import('./handlers/routing-handler.js').then(m => m.createRoutingHandler(cleanupAndExit)), context);
220
+ // Workflow command lazy loaded from commands/workflow.ts
221
+ registerLazyCommand(program, {
222
+ name: 'workflow',
223
+ description: 'Manage QE workflows and pipelines (ADR-041)',
224
+ factory: () => import('./commands/workflow.js').then(m => m.createWorkflowCommand(context, cleanupAndExit, ensureInitialized)),
330
225
  });
331
- workflowCmd
332
- .command('schedule <file>')
333
- .description('Schedule a QE pipeline for recurring execution')
334
- .option('-c, --cron <expression>', 'Override cron schedule from file')
335
- .option('-e, --enable', 'Enable immediately', true)
336
- .action(async (file, options) => {
337
- if (!await ensureInitialized())
338
- return;
339
- const pathModule = await import('path');
340
- const filePath = pathModule.resolve(file);
341
- try {
342
- console.log(chalk.blue(`\nScheduling workflow from: ${file}\n`));
343
- const parseResult = parsePipelineFile(filePath);
344
- if (!parseResult.success || !parseResult.pipeline || !parseResult.workflow) {
345
- console.log(chalk.red('Failed to parse pipeline:'));
346
- for (const error of parseResult.errors) {
347
- console.log(chalk.red(` ${error}`));
348
- }
349
- await cleanupAndExit(1);
350
- }
351
- const schedule = options.cron || parseResult.pipeline.schedule;
352
- if (!schedule) {
353
- console.log(chalk.red('No schedule specified'));
354
- console.log(chalk.gray(' Add "schedule" field to YAML or use --cron option'));
355
- await cleanupAndExit(1);
356
- }
357
- const existingWorkflow = context.workflowOrchestrator.getWorkflow(parseResult.workflow.id);
358
- if (!existingWorkflow) {
359
- const registerResult = context.workflowOrchestrator.registerWorkflow(parseResult.workflow);
360
- if (!registerResult.success) {
361
- console.log(chalk.red(`Failed to register workflow: ${registerResult.error.message}`));
362
- await cleanupAndExit(1);
363
- }
364
- }
365
- const persistedSchedule = createScheduleEntry({
366
- workflowId: parseResult.workflow.id,
367
- pipelinePath: filePath,
368
- schedule,
369
- scheduleDescription: describeCronSchedule(schedule),
370
- enabled: options.enable !== false,
371
- });
372
- await context.persistentScheduler.saveSchedule(persistedSchedule);
373
- const scheduledWorkflow = {
374
- id: persistedSchedule.id,
375
- workflowId: persistedSchedule.workflowId,
376
- pipelinePath: persistedSchedule.pipelinePath,
377
- schedule: persistedSchedule.schedule,
378
- scheduleDescription: persistedSchedule.scheduleDescription,
379
- nextRun: new Date(persistedSchedule.nextRun),
380
- enabled: persistedSchedule.enabled,
381
- createdAt: new Date(persistedSchedule.createdAt),
382
- };
383
- context.scheduledWorkflows.set(scheduledWorkflow.id, scheduledWorkflow);
384
- console.log(chalk.green('Workflow scheduled successfully (persisted to disk)'));
385
- console.log(chalk.cyan(` Schedule ID: ${persistedSchedule.id}`));
386
- console.log(chalk.gray(` Workflow: ${parseResult.workflow.name}`));
387
- console.log(chalk.gray(` Schedule: ${schedule}`));
388
- console.log(chalk.gray(` Description: ${persistedSchedule.scheduleDescription}`));
389
- console.log(chalk.gray(` Next run: ${persistedSchedule.nextRun}`));
390
- console.log(chalk.gray(` Status: ${persistedSchedule.enabled ? chalk.green('enabled') : chalk.yellow('disabled')}`));
391
- console.log(chalk.yellow('\nNote: Scheduled workflows require daemon mode to run automatically'));
392
- console.log(chalk.gray(' Start daemon with: npx aqe daemon start'));
393
- console.log(chalk.gray(' Schedules are persisted to: ~/.aqe/schedules.json'));
394
- console.log('');
395
- await cleanupAndExit(0);
396
- }
397
- catch (error) {
398
- console.error(chalk.red('\nFailed to schedule workflow:'), error);
399
- await cleanupAndExit(1);
400
- }
226
+ registerLazyCommand(program, {
227
+ name: 'test',
228
+ description: 'Test generation, execution, scheduling, and load testing',
229
+ factory: () => import('./commands/test.js').then(m => m.createTestCommand(context, cleanupAndExit, ensureInitialized)),
401
230
  });
402
- workflowCmd
403
- .command('list')
404
- .description('List workflows')
405
- .option('-s, --scheduled', 'Show only scheduled workflows')
406
- .option('-a, --active', 'Show only active executions')
407
- .option('--all', 'Show all workflows (registered + scheduled + active)')
408
- .action(async (options) => {
409
- if (!await ensureInitialized())
410
- return;
411
- try {
412
- console.log(chalk.blue('\nWorkflows\n'));
413
- if (options.scheduled || options.all) {
414
- console.log(chalk.cyan('Scheduled Workflows:'));
415
- const scheduled = await context.persistentScheduler.getSchedules();
416
- if (scheduled.length === 0) {
417
- console.log(chalk.gray(' No scheduled workflows\n'));
418
- }
419
- else {
420
- for (const sched of scheduled) {
421
- const statusIcon = sched.enabled ? chalk.green('*') : chalk.gray('o');
422
- console.log(` ${statusIcon} ${chalk.white(sched.workflowId)}`);
423
- console.log(chalk.gray(` ID: ${sched.id}`));
424
- console.log(chalk.gray(` Schedule: ${sched.schedule} (${sched.scheduleDescription})`));
425
- console.log(chalk.gray(` File: ${sched.pipelinePath}`));
426
- console.log(chalk.gray(` Next run: ${sched.nextRun}`));
427
- if (sched.lastRun) {
428
- console.log(chalk.gray(` Last run: ${sched.lastRun}`));
429
- }
430
- console.log(chalk.gray(` Status: ${sched.enabled ? chalk.green('enabled') : chalk.yellow('disabled')}`));
431
- console.log('');
432
- }
433
- }
434
- }
435
- if (options.active || options.all) {
436
- console.log(chalk.cyan('Active Executions:'));
437
- const activeExecutions = context.workflowOrchestrator.getActiveExecutions();
438
- if (activeExecutions.length === 0) {
439
- console.log(chalk.gray(' No active executions\n'));
440
- }
441
- else {
442
- for (const exec of activeExecutions) {
443
- const statusColor = exec.status === 'running' ? chalk.yellow : chalk.gray;
444
- console.log(` ${statusColor('*')} ${chalk.white(exec.workflowName)}`);
445
- console.log(chalk.gray(` Execution: ${exec.executionId}`));
446
- console.log(chalk.gray(` Status: ${exec.status}`));
447
- console.log(chalk.gray(` Progress: ${exec.progress}%`));
448
- if (exec.currentSteps.length > 0) {
449
- console.log(chalk.gray(` Current: ${exec.currentSteps.join(', ')}`));
450
- }
451
- console.log('');
452
- }
453
- }
454
- }
455
- if (!options.scheduled && !options.active || options.all) {
456
- console.log(chalk.cyan('Registered Workflows:'));
457
- const workflows = context.workflowOrchestrator.listWorkflows();
458
- if (workflows.length === 0) {
459
- console.log(chalk.gray(' No registered workflows\n'));
460
- }
461
- else {
462
- for (const workflow of workflows) {
463
- console.log(` ${chalk.white(workflow.name)} (${chalk.cyan(workflow.id)})`);
464
- console.log(chalk.gray(` Version: ${workflow.version}`));
465
- console.log(chalk.gray(` Steps: ${workflow.stepCount}`));
466
- if (workflow.description) {
467
- console.log(chalk.gray(` ${workflow.description}`));
468
- }
469
- if (workflow.tags && workflow.tags.length > 0) {
470
- console.log(chalk.gray(` Tags: ${workflow.tags.join(', ')}`));
471
- }
472
- if (workflow.triggers && workflow.triggers.length > 0) {
473
- console.log(chalk.gray(` Triggers: ${workflow.triggers.join(', ')}`));
474
- }
475
- console.log('');
476
- }
477
- }
478
- }
479
- await cleanupAndExit(0);
480
- }
481
- catch (error) {
482
- console.error(chalk.red('\nFailed to list workflows:'), error);
483
- await cleanupAndExit(1);
484
- }
231
+ registerLazyCommand(program, {
232
+ name: 'coverage',
233
+ description: 'Coverage analysis shortcut',
234
+ factory: () => import('./commands/coverage.js').then(m => m.createCoverageCommand(context, cleanupAndExit, ensureInitialized)),
485
235
  });
486
- workflowCmd
487
- .command('validate <file>')
488
- .description('Validate a pipeline YAML file')
489
- .option('-v, --verbose', 'Show detailed validation results')
490
- .action(async (file, options) => {
491
- const fs = await import('fs');
492
- const pathModule = await import('path');
493
- const filePath = pathModule.resolve(file);
494
- try {
495
- console.log(chalk.blue(`\nValidating pipeline: ${file}\n`));
496
- if (!fs.existsSync(filePath)) {
497
- console.log(chalk.red(`File not found: ${filePath}`));
498
- await cleanupAndExit(1);
499
- }
500
- const parseResult = parsePipelineFile(filePath);
501
- if (!parseResult.success) {
502
- console.log(chalk.red('Parse errors:'));
503
- for (const error of parseResult.errors) {
504
- console.log(chalk.red(` * ${error}`));
505
- }
506
- await cleanupAndExit(1);
507
- }
508
- const validationResult = validatePipeline(parseResult.pipeline);
509
- if (validationResult.valid) {
510
- console.log(chalk.green('Pipeline is valid\n'));
511
- }
512
- else {
513
- console.log(chalk.red('Pipeline has errors:\n'));
514
- for (const error of validationResult.errors) {
515
- console.log(chalk.red(` x [${error.path}] ${error.message}`));
516
- }
517
- console.log('');
518
- }
519
- if (validationResult.warnings.length > 0) {
520
- console.log(chalk.yellow('Warnings:'));
521
- for (const warning of validationResult.warnings) {
522
- console.log(chalk.yellow(` * [${warning.path}] ${warning.message}`));
523
- }
524
- console.log('');
525
- }
526
- if (options.verbose && parseResult.pipeline) {
527
- const pipeline = parseResult.pipeline;
528
- console.log(chalk.cyan('Pipeline Details:\n'));
529
- console.log(chalk.gray(` Name: ${pipeline.name}`));
530
- console.log(chalk.gray(` Version: ${pipeline.version || '1.0.0'}`));
531
- if (pipeline.description) {
532
- console.log(chalk.gray(` Description: ${pipeline.description}`));
533
- }
534
- if (pipeline.schedule) {
535
- console.log(chalk.gray(` Schedule: ${pipeline.schedule} (${describeCronSchedule(pipeline.schedule)})`));
536
- }
537
- if (pipeline.tags && pipeline.tags.length > 0) {
538
- console.log(chalk.gray(` Tags: ${pipeline.tags.join(', ')}`));
539
- }
540
- console.log(chalk.cyan('\n Stages:'));
541
- for (let i = 0; i < pipeline.stages.length; i++) {
542
- const stage = pipeline.stages[i];
543
- console.log(` ${i + 1}. ${chalk.white(stage.name)}`);
544
- console.log(chalk.gray(` Command: ${stage.command}`));
545
- if (stage.params) {
546
- console.log(chalk.gray(` Params: ${JSON.stringify(stage.params)}`));
547
- }
548
- if (stage.depends_on && stage.depends_on.length > 0) {
549
- console.log(chalk.gray(` Depends on: ${stage.depends_on.join(', ')}`));
550
- }
551
- if (stage.timeout) {
552
- console.log(chalk.gray(` Timeout: ${stage.timeout}s`));
553
- }
554
- }
555
- if (pipeline.triggers && pipeline.triggers.length > 0) {
556
- console.log(chalk.cyan('\n Triggers:'));
557
- for (const trigger of pipeline.triggers) {
558
- console.log(chalk.gray(` * ${trigger.event}`));
559
- if (trigger.branches) {
560
- console.log(chalk.gray(` Branches: ${trigger.branches.join(', ')}`));
561
- }
562
- }
563
- }
564
- }
565
- if (options.verbose && parseResult.workflow) {
566
- console.log(chalk.cyan('\n Converted Workflow ID: ') + chalk.white(parseResult.workflow.id));
567
- console.log(chalk.gray(` Steps: ${parseResult.workflow.steps.length}`));
568
- for (const step of parseResult.workflow.steps) {
569
- console.log(chalk.gray(` * ${step.id}: ${step.domain}.${step.action}`));
570
- }
571
- }
572
- console.log('');
573
- await cleanupAndExit(validationResult.valid ? 0 : 1);
574
- }
575
- catch (error) {
576
- console.error(chalk.red('\nValidation failed:'), error);
577
- await cleanupAndExit(1);
578
- }
236
+ registerLazyCommand(program, {
237
+ name: 'quality',
238
+ description: 'Quality assessment shortcut',
239
+ factory: () => import('./commands/quality.js').then(m => m.createQualityCommand(context, cleanupAndExit, ensureInitialized)),
579
240
  });
580
- workflowCmd
581
- .command('status <executionId>')
582
- .description('Get workflow execution status')
583
- .option('-v, --verbose', 'Show detailed step results')
584
- .action(async (executionId, options) => {
585
- if (!await ensureInitialized())
586
- return;
587
- try {
588
- const status = context.workflowOrchestrator.getWorkflowStatus(executionId);
589
- if (!status) {
590
- console.log(chalk.red(`\nExecution not found: ${executionId}\n`));
591
- await cleanupAndExit(1);
592
- return;
593
- }
594
- console.log(chalk.blue(`\nWorkflow Execution Status\n`));
595
- const statusColor = status.status === 'completed' ? chalk.green :
596
- status.status === 'failed' ? chalk.red :
597
- status.status === 'running' ? chalk.yellow : chalk.gray;
598
- console.log(` Execution ID: ${chalk.cyan(status.executionId)}`);
599
- console.log(` Workflow: ${chalk.white(status.workflowName)} (${status.workflowId})`);
600
- console.log(` Status: ${statusColor(status.status)}`);
601
- console.log(` Progress: ${status.progress}%`);
602
- console.log(` Started: ${status.startedAt.toISOString()}`);
603
- if (status.completedAt) {
604
- console.log(` Completed: ${status.completedAt.toISOString()}`);
605
- }
606
- if (status.duration) {
607
- console.log(` Duration: ${formatDuration(status.duration)}`);
608
- }
609
- console.log(chalk.cyan('\n Step Summary:'));
610
- console.log(chalk.gray(` Completed: ${status.completedSteps.length}`));
611
- console.log(chalk.gray(` Skipped: ${status.skippedSteps.length}`));
612
- console.log(chalk.gray(` Failed: ${status.failedSteps.length}`));
613
- if (status.currentSteps.length > 0) {
614
- console.log(chalk.yellow(` Running: ${status.currentSteps.join(', ')}`));
615
- }
616
- if (status.error) {
617
- console.log(chalk.red(`\n Error: ${status.error}`));
618
- }
619
- if (options.verbose && status.stepResults.size > 0) {
620
- console.log(chalk.cyan('\n Step Results:'));
621
- for (const [stepId, result] of status.stepResults) {
622
- const stepStatusColor = result.status === 'completed' ? chalk.green :
623
- result.status === 'failed' ? chalk.red :
624
- result.status === 'skipped' ? chalk.yellow : chalk.gray;
625
- console.log(` ${stepStatusColor('*')} ${chalk.white(stepId)}: ${stepStatusColor(result.status)}`);
626
- if (result.duration) {
627
- console.log(chalk.gray(` Duration: ${formatDuration(result.duration)}`));
628
- }
629
- if (result.error) {
630
- console.log(chalk.red(` Error: ${result.error}`));
631
- }
632
- if (result.retryCount && result.retryCount > 0) {
633
- console.log(chalk.yellow(` Retries: ${result.retryCount}`));
634
- }
635
- }
636
- }
637
- console.log('');
638
- await cleanupAndExit(0);
639
- }
640
- catch (error) {
641
- console.error(chalk.red('\nFailed to get workflow status:'), error);
642
- await cleanupAndExit(1);
643
- }
241
+ registerLazyCommand(program, {
242
+ name: 'security',
243
+ description: 'Security scanning and URL validation',
244
+ factory: () => import('./commands/security.js').then(m => m.createSecurityCommand(context, cleanupAndExit, ensureInitialized)),
644
245
  });
645
- workflowCmd
646
- .command('cancel <executionId>')
647
- .description('Cancel a running workflow')
648
- .action(async (executionId) => {
649
- if (!await ensureInitialized())
650
- return;
651
- try {
652
- const result = await context.workflowOrchestrator.cancelWorkflow(executionId);
653
- if (result.success) {
654
- console.log(chalk.green(`\nWorkflow cancelled: ${executionId}\n`));
655
- }
656
- else {
657
- console.log(chalk.red(`\nFailed to cancel workflow: ${result.error.message}\n`));
658
- }
659
- await cleanupAndExit(result.success ? 0 : 1);
660
- }
661
- catch (error) {
662
- console.error(chalk.red('\nFailed to cancel workflow:'), error);
663
- await cleanupAndExit(1);
664
- }
246
+ registerLazyCommand(program, {
247
+ name: 'code',
248
+ description: 'Code intelligence analysis',
249
+ factory: () => import('./commands/code.js').then(m => m.createCodeCommand(context, cleanupAndExit, ensureInitialized)),
665
250
  });
666
- workflowCmd
667
- .command('browser-list')
668
- .description('List available browser workflow templates')
669
- .action(async () => {
670
- try {
671
- const { BrowserWorkflowTool } = await import('../mcp/tools/test-execution/browser-workflow.js');
672
- const tool = new BrowserWorkflowTool();
673
- const result = await tool.invoke({});
674
- if (result.success && result.data) {
675
- console.log(chalk.blue('\n Browser Workflow Templates:\n'));
676
- for (const t of result.data.availableTemplates) {
677
- console.log(` ${chalk.cyan(t)}`);
678
- }
679
- console.log('');
680
- }
681
- else {
682
- console.log(chalk.red(`Failed: ${result.error || 'Unknown error'}`));
683
- }
684
- await cleanupAndExit(0);
685
- }
686
- catch (error) {
687
- console.error(chalk.red('\nFailed:'), error);
688
- await cleanupAndExit(1);
689
- }
251
+ registerLazyCommand(program, {
252
+ name: 'completions',
253
+ description: 'Generate shell completions for aqe',
254
+ factory: () => import('./commands/completions.js').then(m => m.createCompletionsCommand(cleanupAndExit)),
690
255
  });
691
- workflowCmd
692
- .command('browser-load [template]')
693
- .description('Load and validate a browser workflow template or inline YAML')
694
- .option('--yaml <yaml>', 'Inline YAML workflow definition')
695
- .option('-v, --var <key=value>', 'Variable override (repeatable)', collectWorkflowVars, {})
696
- .option('-F, --format <format>', 'Output format (text|json)', 'text')
697
- .option('-o, --output <path>', 'Write output to file')
698
- .action(async (template, options) => {
699
- try {
700
- const { BrowserWorkflowTool } = await import('../mcp/tools/test-execution/browser-workflow.js');
701
- const { writeOutput, toJSON } = await import('./utils/ci-output.js');
702
- const tool = new BrowserWorkflowTool();
703
- const params = {
704
- variables: options.var || {},
705
- };
706
- if (options.yaml) {
707
- params.workflowYaml = options.yaml;
708
- }
709
- else if (template) {
710
- if (template.endsWith('.yaml') || template.endsWith('.yml')) {
711
- const fs = await import('fs');
712
- const pathModule = await import('path');
713
- const filePath = pathModule.resolve(template);
714
- if (!fs.existsSync(filePath)) {
715
- console.log(chalk.red(`\nFile not found: ${filePath}\n`));
716
- await cleanupAndExit(1);
717
- }
718
- params.workflowYaml = fs.readFileSync(filePath, 'utf-8');
719
- }
720
- else {
721
- params.templateName = template;
722
- }
723
- }
724
- else {
725
- console.log(chalk.red('\nProvide a template name or --yaml. Use "workflow browser-list" to see templates.\n'));
726
- await cleanupAndExit(1);
727
- }
728
- console.log(chalk.blue(`\n Loading browser workflow${template ? ': ' + template : ''}...\n`));
729
- const result = await tool.invoke(params);
730
- if (result.success && result.data) {
731
- const data = result.data;
732
- if (options.format === 'json') {
733
- writeOutput(toJSON(data), options.output);
734
- }
735
- else {
736
- console.log(chalk.green(` Workflow: ${data.workflowName}`));
737
- if (data.description) {
738
- console.log(chalk.gray(` ${data.description}`));
739
- }
740
- console.log(` Source: ${chalk.cyan(data.source)}`);
741
- console.log(` Steps: ${chalk.white(data.steps.length)}`);
742
- if (data.steps.length > 0) {
743
- console.log(chalk.cyan('\n Steps:'));
744
- for (const step of data.steps) {
745
- const optTag = step.optional ? chalk.gray(' (optional)') : '';
746
- const assertTag = step.assertionCount > 0 ? chalk.gray(` [${step.assertionCount} assertions]`) : '';
747
- console.log(` ${chalk.white(step.name)} — ${step.action}${optTag}${assertTag}`);
748
- }
749
- }
750
- if (data.variables.defined.length > 0) {
751
- console.log(chalk.cyan('\n Variables:'));
752
- for (const v of data.variables.defined) {
753
- const req = v.required ? chalk.red('*') : '';
754
- const def = v.hasDefault ? chalk.gray(' (has default)') : '';
755
- console.log(` ${req}${chalk.white(v.name)}: ${v.type}${def}`);
756
- }
757
- }
758
- if (!data.validation.valid) {
759
- console.log(chalk.red('\n Validation errors:'));
760
- for (const err of data.validation.errors) {
761
- console.log(chalk.red(` - ${err}`));
762
- }
763
- }
764
- console.log('');
765
- }
766
- await cleanupAndExit(data.validation.valid ? 0 : 1);
767
- }
768
- else {
769
- console.log(chalk.red(`Failed: ${result.error || 'Unknown error'}`));
770
- await cleanupAndExit(1);
771
- }
772
- }
773
- catch (error) {
774
- console.error(chalk.red('\nFailed:'), error);
775
- await cleanupAndExit(1);
776
- }
256
+ registerLazyCommand(program, {
257
+ name: 'fleet',
258
+ description: 'Fleet operations with multi-agent progress tracking',
259
+ factory: () => import('./commands/fleet.js').then(m => m.createFleetCommand(context, cleanupAndExit, ensureInitialized, registerDomainWorkflowActions)),
260
+ });
261
+ registerLazyCommand(program, {
262
+ name: 'validate',
263
+ description: 'Validation commands for skills and agents',
264
+ factory: () => import('./commands/validate-swarm.js').then(m => m.createValidateSwarmCommand(context, cleanupAndExit, ensureInitialized)),
265
+ });
266
+ registerLazyCommand(program, {
267
+ name: 'skill',
268
+ description: 'Skill validation and reporting (ADR-056)',
269
+ factory: () => import('./commands/validate.js').then(m => m.createValidateCommand(context, cleanupAndExit, ensureInitialized)),
270
+ });
271
+ registerLazyCommand(program, {
272
+ name: 'eval',
273
+ description: 'Run skill evaluation suites in parallel',
274
+ factory: () => import('./commands/eval.js').then(m => m.createEvalCommand()),
275
+ });
276
+ registerLazyCommand(program, {
277
+ name: 'ci',
278
+ description: 'CI/CD pipeline orchestration',
279
+ factory: () => import('./commands/ci.js').then(m => m.createCICommand(context, cleanupAndExit, ensureInitialized)),
280
+ });
281
+ // External command modules
282
+ registerLazyCommand(program, {
283
+ name: 'token-usage',
284
+ description: 'View and analyze token consumption metrics (ADR-042)',
285
+ factory: () => import('./commands/token-usage.js').then(m => m.createTokenUsageCommand()),
286
+ });
287
+ registerLazyCommand(program, {
288
+ name: 'llm',
289
+ description: 'LLM Router management (ADR-043)',
290
+ factory: () => import('./commands/llm-router.js').then(m => m.createLLMRouterCommand()),
291
+ });
292
+ registerLazyCommand(program, {
293
+ name: 'sync',
294
+ description: 'Sync local learning data to cloud PostgreSQL',
295
+ factory: () => import('./commands/sync.js').then(m => m.createSyncCommands()),
296
+ });
297
+ registerLazyCommand(program, {
298
+ name: 'hooks',
299
+ description: 'Self-learning QE hooks for pattern recognition and guidance',
300
+ factory: () => import('./commands/hooks.js').then(m => m.createHooksCommand()),
301
+ });
302
+ registerLazyCommand(program, {
303
+ name: 'learning',
304
+ description: 'AQE self-learning system management (standalone, no claude-flow required)',
305
+ factory: () => import('./commands/learning.js').then(m => m.createLearningCommand()),
306
+ });
307
+ registerLazyCommand(program, {
308
+ name: 'memory',
309
+ description: 'Memory store, retrieve, search, and delete operations',
310
+ factory: () => import('./commands/memory.js').then(m => m.createMemoryCommand(context, cleanupAndExit, ensureInitialized)),
311
+ });
312
+ registerLazyCommand(program, {
313
+ name: 'mcp',
314
+ description: 'Start the MCP protocol server for Claude Code integration',
315
+ factory: () => import('./commands/mcp.js').then(m => m.createMcpCommand()),
316
+ });
317
+ registerLazyCommand(program, {
318
+ name: 'platform',
319
+ description: 'Manage coding agent platform configurations',
320
+ factory: () => import('./commands/platform.js').then(m => m.createPlatformCommand()),
321
+ });
322
+ registerLazyCommand(program, {
323
+ name: 'prove',
324
+ description: 'Generate a verifiable Proof-of-Quality attestation',
325
+ factory: () => import('./commands/prove.js').then(m => m.createProveCommand(context, cleanupAndExit, ensureInitialized)),
326
+ });
327
+ registerLazyCommand(program, {
328
+ name: 'ruvector',
329
+ description: 'RuVector integration management',
330
+ factory: () => import('./commands/ruvector-commands.js').then(m => m.createRuVectorCommand()),
331
+ });
332
+ registerLazyCommand(program, {
333
+ name: 'audit',
334
+ description: 'Witness chain audit trail management',
335
+ factory: () => import('./commands/audit.js').then(m => m.createAuditCommand(context, cleanupAndExit, ensureInitialized)),
336
+ });
337
+ registerLazyCommand(program, {
338
+ name: 'pipeline',
339
+ description: 'Manage YAML deterministic pipelines (Imp-9)',
340
+ factory: () => import('./commands/pipeline.js').then(m => m.createPipelineCommand(context, cleanupAndExit, ensureInitialized)),
341
+ });
342
+ registerLazyCommand(program, {
343
+ name: 'plugin',
344
+ description: 'Manage external QE domain plugins',
345
+ factory: () => import('./commands/plugin.js').then(m => m.createPluginCommand()),
346
+ });
347
+ registerLazyCommand(program, {
348
+ name: 'daemon',
349
+ description: 'Manage the QE Quality Daemon',
350
+ factory: () => import('./commands/daemon.js').then(m => m.createDaemonCommand()),
777
351
  });
778
- function collectWorkflowVars(val, acc) {
779
- const idx = val.indexOf('=');
780
- if (idx > 0) {
781
- acc[val.substring(0, idx)] = val.substring(idx + 1);
782
- }
783
- return acc;
784
- }
785
- // ============================================================================
786
- // Shortcut Commands (test, coverage, quality, security, code)
787
- // ============================================================================
788
- import { createTestCommand } from './commands/test.js';
789
- import { createCoverageCommand } from './commands/coverage.js';
790
- import { createQualityCommand } from './commands/quality.js';
791
- import { createSecurityCommand } from './commands/security.js';
792
- import { createCodeCommand } from './commands/code.js';
793
- import { createCompletionsCommand } from './commands/completions.js';
794
- import { createFleetCommand } from './commands/fleet.js';
795
- import { createValidateSwarmCommand } from './commands/validate-swarm.js';
796
- import { createValidateCommand } from './commands/validate.js';
797
- import { createEvalCommand } from './commands/eval.js';
798
- import { createCICommand } from './commands/ci.js';
799
- // Register shortcut commands
800
- program.addCommand(createTestCommand(context, cleanupAndExit, ensureInitialized));
801
- program.addCommand(createCoverageCommand(context, cleanupAndExit, ensureInitialized));
802
- program.addCommand(createQualityCommand(context, cleanupAndExit, ensureInitialized));
803
- program.addCommand(createSecurityCommand(context, cleanupAndExit, ensureInitialized));
804
- program.addCommand(createCodeCommand(context, cleanupAndExit, ensureInitialized));
805
- program.addCommand(createCompletionsCommand(cleanupAndExit));
806
- program.addCommand(createFleetCommand(context, cleanupAndExit, ensureInitialized, registerDomainWorkflowActions));
807
- program.addCommand(createValidateSwarmCommand(context, cleanupAndExit, ensureInitialized));
808
- program.addCommand(createValidateCommand(context, cleanupAndExit, ensureInitialized));
809
- program.addCommand(createEvalCommand());
810
- program.addCommand(createCICommand(context, cleanupAndExit, ensureInitialized));
811
- // ============================================================================
812
- // External Command Modules
813
- // ============================================================================
814
- import { createTokenUsageCommand } from './commands/token-usage.js';
815
- import { createLLMRouterCommand } from './commands/llm-router.js';
816
- import { createSyncCommands } from './commands/sync.js';
817
- import { createHooksCommand } from './commands/hooks.js';
818
- import { createLearningCommand } from './commands/learning.js';
819
- import { createMemoryCommand } from './commands/memory.js';
820
- import { createMcpCommand } from './commands/mcp.js';
821
- import { createPlatformCommand } from './commands/platform.js';
822
- import { createProveCommand } from './commands/prove.js';
823
- import { createRuVectorCommand } from './commands/ruvector-commands.js';
824
- import { createAuditCommand } from './commands/audit.js';
825
- import { createPipelineCommand } from './commands/pipeline.js';
826
- program.addCommand(createTokenUsageCommand());
827
- program.addCommand(createLLMRouterCommand());
828
- program.addCommand(createSyncCommands());
829
- program.addCommand(createHooksCommand());
830
- program.addCommand(createLearningCommand());
831
- program.addCommand(createMemoryCommand(context, cleanupAndExit, ensureInitialized));
832
- program.addCommand(createMcpCommand());
833
- program.addCommand(createPlatformCommand());
834
- program.addCommand(createProveCommand(context, cleanupAndExit, ensureInitialized));
835
- program.addCommand(createRuVectorCommand());
836
- program.addCommand(createAuditCommand(context, cleanupAndExit, ensureInitialized));
837
- program.addCommand(createPipelineCommand(context, cleanupAndExit, ensureInitialized));
838
352
  // ============================================================================
839
353
  // Shutdown Handlers
840
354
  // ============================================================================
@@ -851,6 +365,13 @@ process.on('SIGTERM', async () => {
851
365
  // Main
852
366
  // ============================================================================
853
367
  async function main() {
368
+ // IMP-06: Fast path for --version / -v — skip all heavy initialization
369
+ const { isVersionFastPath } = await import('../boot/fast-paths.js');
370
+ if (isVersionFastPath(process.argv)) {
371
+ console.log(VERSION);
372
+ process.exit(0);
373
+ }
374
+ const { bootstrapTokenTracking } = await import('../init/token-bootstrap.js');
854
375
  await bootstrapTokenTracking({
855
376
  enableOptimization: true,
856
377
  enablePersistence: true,