agentic-qe 3.8.14 → 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +60 -0
  3. package/dist/adapters/a2ui/integration/agui-sync.js +2 -1
  4. package/dist/audit/witness-chain.d.ts +1 -1
  5. package/dist/boot/fast-paths.d.ts +24 -0
  6. package/dist/boot/fast-paths.js +43 -0
  7. package/dist/boot/parallel-prefetch.d.ts +26 -0
  8. package/dist/boot/parallel-prefetch.js +36 -0
  9. package/dist/cli/bundle.js +12 -9431
  10. package/dist/cli/chunks/adapter-NTM4ZH3P.js +2 -0
  11. package/dist/cli/chunks/agent-booster-wasm-UH2J6BNA.js +2 -0
  12. package/dist/cli/chunks/agent-handler-ZCBWQE3X.js +33 -0
  13. package/dist/cli/chunks/agent-memory-branch-2BAVI7UW.js +2 -0
  14. package/dist/cli/chunks/aqe-learning-engine-RVX6MPYK.js +2 -0
  15. package/dist/cli/chunks/audit-G5UIJBSQ.js +3 -0
  16. package/dist/cli/chunks/base-7HKNQ6UP.js +2 -0
  17. package/dist/cli/chunks/better-sqlite3-YHIAPPVT.js +2 -0
  18. package/dist/cli/chunks/brain-handler-5EE3J5PR.js +68 -0
  19. package/dist/cli/chunks/branch-enumerator-OV54PID5.js +7 -0
  20. package/dist/cli/chunks/browser-7RZGKOEO.js +4 -0
  21. package/dist/cli/chunks/browser-workflow-UOFSQK7X.js +2 -0
  22. package/dist/cli/chunks/chunk-24E47G3D.js +604 -0
  23. package/dist/cli/chunks/chunk-35H73OPP.js +2 -0
  24. package/dist/cli/chunks/chunk-36X2O3BL.js +3 -0
  25. package/dist/cli/chunks/chunk-3JESHZQM.js +2 -0
  26. package/dist/cli/chunks/chunk-3VAKR43Z.js +2 -0
  27. package/dist/cli/chunks/chunk-3WQNW6CH.js +2 -0
  28. package/dist/cli/chunks/chunk-43M6Y6VF.js +15 -0
  29. package/dist/cli/chunks/chunk-4BHOAQJH.js +2 -0
  30. package/dist/cli/chunks/chunk-4LWXZCSD.js +146 -0
  31. package/dist/cli/chunks/chunk-4TNXEANY.js +2 -0
  32. package/dist/cli/chunks/chunk-4XBY5JDT.js +4 -0
  33. package/dist/cli/chunks/chunk-4XREPCBZ.js +2 -0
  34. package/dist/cli/chunks/chunk-5GPTM2RV.js +2 -0
  35. package/dist/cli/chunks/chunk-5KBQQP3X.js +7 -0
  36. package/dist/cli/chunks/chunk-5LDBKZ6P.js +2 -0
  37. package/dist/cli/chunks/chunk-6BSJNG2S.js +2 -0
  38. package/dist/cli/chunks/chunk-6YC24TPL.js +27 -0
  39. package/dist/cli/chunks/chunk-7ATLJCSG.js +2 -0
  40. package/dist/cli/chunks/chunk-7JQTHPCD.js +2 -0
  41. package/dist/cli/chunks/chunk-7YUOUVN7.js +2 -0
  42. package/dist/cli/chunks/chunk-7ZNINH6J.js +59 -0
  43. package/dist/cli/chunks/chunk-A57BEPL7.js +3 -0
  44. package/dist/cli/chunks/chunk-AFPMCMVX.js +45 -0
  45. package/dist/cli/chunks/chunk-AREIP4FX.js +3 -0
  46. package/dist/cli/chunks/chunk-B2I7BJLL.js +3 -0
  47. package/dist/cli/chunks/chunk-BEHP3DEF.js +66 -0
  48. package/dist/cli/chunks/chunk-C24ZDUCM.js +30 -0
  49. package/dist/cli/chunks/chunk-D4PSFWND.js +2 -0
  50. package/dist/cli/chunks/chunk-D55PSO5D.js +81 -0
  51. package/dist/cli/chunks/chunk-DC3HPOOJ.js +2 -0
  52. package/dist/cli/chunks/chunk-DMGLX76J.js +180 -0
  53. package/dist/cli/chunks/chunk-E33KQBMW.js +2 -0
  54. package/dist/cli/chunks/chunk-EQFZQPFN.js +2 -0
  55. package/dist/cli/chunks/chunk-FPRL6UDF.js +2 -0
  56. package/dist/cli/chunks/chunk-FRNB4CH2.js +2 -0
  57. package/dist/cli/chunks/chunk-FWDKVTK4.js +2 -0
  58. package/dist/cli/chunks/chunk-GFNUESMU.js +2 -0
  59. package/dist/cli/chunks/chunk-GJW6V35N.js +2 -0
  60. package/dist/cli/chunks/chunk-GLIFZWV2.js +2 -0
  61. package/dist/cli/chunks/chunk-GNUUBTSX.js +14 -0
  62. package/dist/cli/chunks/chunk-HAUXLXKZ.js +2 -0
  63. package/dist/cli/chunks/chunk-HTXSUTWL.js +9 -0
  64. package/dist/cli/chunks/chunk-I5WZ2NM2.js +95 -0
  65. package/dist/cli/chunks/chunk-I7TA453K.js +2 -0
  66. package/dist/cli/chunks/chunk-IF6GW6IY.js +27 -0
  67. package/dist/cli/chunks/chunk-IHWSNYL2.js +5 -0
  68. package/dist/cli/chunks/chunk-IJKYJGJL.js +2 -0
  69. package/dist/cli/chunks/chunk-IQPXANCE.js +14 -0
  70. package/dist/cli/chunks/chunk-JCEY7RLP.js +2 -0
  71. package/dist/cli/chunks/chunk-JSOBRKMA.js +2 -0
  72. package/dist/cli/chunks/chunk-KIGRLIU4.js +2 -0
  73. package/dist/cli/chunks/chunk-L4H54Z27.js +21 -0
  74. package/dist/cli/chunks/chunk-LCOEBFAB.js +2 -0
  75. package/dist/cli/chunks/chunk-MZ54VM6A.js +2 -0
  76. package/dist/cli/chunks/chunk-NB47YT6A.js +167 -0
  77. package/dist/cli/chunks/chunk-NG3BKE7V.js +2 -0
  78. package/dist/cli/chunks/chunk-NG4TE3OW.js +2 -0
  79. package/dist/cli/chunks/chunk-O636JKJR.js +18 -0
  80. package/dist/cli/chunks/chunk-O6QQ4HLS.js +2 -0
  81. package/dist/cli/chunks/chunk-OFNIQCGX.js +2 -0
  82. package/dist/cli/chunks/chunk-OTSJU5LH.js +2 -0
  83. package/dist/cli/chunks/chunk-POLFT2PQ.js +15 -0
  84. package/dist/cli/chunks/chunk-QAYTL6KC.js +2 -0
  85. package/dist/cli/chunks/chunk-QMFP5OKH.js +2 -0
  86. package/dist/cli/chunks/chunk-RAJO7VML.js +2 -0
  87. package/dist/cli/chunks/chunk-RKIGOARX.js +2 -0
  88. package/dist/cli/chunks/chunk-RU6Q5HOC.js +3 -0
  89. package/dist/cli/chunks/chunk-RV6SGDET.js +2 -0
  90. package/dist/cli/chunks/chunk-RWXI7XAR.js +2 -0
  91. package/dist/cli/chunks/chunk-RXVYOXDB.js +2 -0
  92. package/dist/cli/chunks/chunk-SGRN6JFB.js +2 -0
  93. package/dist/cli/chunks/chunk-SVNX4UWR.js +3029 -0
  94. package/dist/cli/chunks/chunk-TL7ABIMP.js +2 -0
  95. package/dist/cli/chunks/chunk-TOLYWONQ.js +2 -0
  96. package/dist/cli/chunks/chunk-TPXYS3WG.js +3 -0
  97. package/dist/cli/chunks/chunk-U5JQGRHZ.js +2 -0
  98. package/dist/cli/chunks/chunk-UB7RGVKO.js +2 -0
  99. package/dist/cli/chunks/chunk-UBKK7KCR.js +70 -0
  100. package/dist/cli/chunks/chunk-UMGWGX7C.js +2 -0
  101. package/dist/cli/chunks/chunk-UN4PA4M2.js +2 -0
  102. package/dist/cli/chunks/chunk-US7INRP2.js +314 -0
  103. package/dist/cli/chunks/chunk-UWDBFPHQ.js +750 -0
  104. package/dist/cli/chunks/chunk-UZZCWWIG.js +2 -0
  105. package/dist/cli/chunks/chunk-V4HM4QAO.js +24 -0
  106. package/dist/cli/chunks/chunk-V4U3CTS2.js +180 -0
  107. package/dist/cli/chunks/chunk-VCCMCFDU.js +2 -0
  108. package/dist/cli/chunks/chunk-VEWIT6VN.js +4 -0
  109. package/dist/cli/chunks/chunk-VNYGVG4Y.js +2 -0
  110. package/dist/cli/chunks/chunk-VO3OVD5D.js +4 -0
  111. package/dist/cli/chunks/chunk-VY74OMGQ.js +6 -0
  112. package/dist/cli/chunks/chunk-WDJBGXC2.js +2 -0
  113. package/dist/cli/chunks/chunk-WDV6TN7E.js +65 -0
  114. package/dist/cli/chunks/chunk-WLXEDOG4.js +2 -0
  115. package/dist/cli/chunks/chunk-WXXAAXNS.js +12 -0
  116. package/dist/cli/chunks/chunk-X4MZYBOU.js +256 -0
  117. package/dist/cli/chunks/chunk-XE2YAYU5.js +12 -0
  118. package/dist/cli/chunks/chunk-XP6XKBNW.js +2 -0
  119. package/dist/cli/chunks/chunk-XPB6ZVQY.js +2 -0
  120. package/dist/cli/chunks/chunk-XRVUSKQV.js +1 -0
  121. package/dist/cli/chunks/chunk-XSITQBYB.js +20 -0
  122. package/dist/cli/chunks/chunk-XTLA4F5Z.js +91 -0
  123. package/dist/cli/chunks/chunk-XU6L2VJY.js +2 -0
  124. package/dist/cli/chunks/chunk-XUFHYPZK.js +2 -0
  125. package/dist/cli/chunks/chunk-Y2ZEDXTV.js +16 -0
  126. package/dist/cli/chunks/chunk-YQWB4QUP.js +316 -0
  127. package/dist/cli/chunks/chunk-YUQIXT3G.js +79 -0
  128. package/dist/cli/chunks/chunk-YYYB2JN5.js +2 -0
  129. package/dist/cli/chunks/chunk-ZEUVPLGX.js +2 -0
  130. package/dist/cli/chunks/chunk-ZSRQHJEW.js +3 -0
  131. package/dist/cli/chunks/ci-N4NTYAAI.js +81 -0
  132. package/dist/cli/chunks/ci-output-XYR2PSYH.js +2 -0
  133. package/dist/cli/chunks/claude-flow-setup-FX7PRBJV.js +2 -0
  134. package/dist/cli/chunks/client-CRRENRK4.js +2 -0
  135. package/dist/cli/chunks/cline-installer-GTHQOK7U.js +4 -0
  136. package/dist/cli/chunks/code-4G6ZHVNI.js +38 -0
  137. package/dist/cli/chunks/code-index-extractor-MKJTP5AK.js +3 -0
  138. package/dist/cli/chunks/codex-installer-UGS773DT.js +8 -0
  139. package/dist/cli/chunks/completions-B3BXNXAU.js +1364 -0
  140. package/dist/cli/chunks/complexity-analyzer-PMN77CUP.js +2 -0
  141. package/dist/cli/chunks/continuedev-installer-3DYKSIP3.js +14 -0
  142. package/dist/cli/chunks/copilot-installer-IUC5HDHD.js +3 -0
  143. package/dist/cli/chunks/cost-tracker-GSGQ7O5T.js +2 -0
  144. package/dist/cli/chunks/coverage-PO72QC3P.js +27 -0
  145. package/dist/cli/chunks/cross-domain-router-FSCGJG3B.js +2 -0
  146. package/dist/cli/chunks/cursor-installer-FK53S3ZL.js +3 -0
  147. package/dist/cli/chunks/daemon-4UIQTQ73.js +19 -0
  148. package/dist/cli/chunks/dag-attention-scheduler-ZGIMLECE.js +2 -0
  149. package/dist/cli/chunks/detect-XXHLTLL7.js +2 -0
  150. package/dist/cli/chunks/domain-handler-PPGFP7P4.js +25 -0
  151. package/dist/cli/chunks/domain-transfer-Q5UAE65W.js +2 -0
  152. package/dist/cli/chunks/dream-PONKQULG.js +2 -0
  153. package/dist/cli/chunks/esm-node-XLWDJRBX.js +2 -0
  154. package/dist/cli/chunks/eval-JVJKHSTQ.js +15 -0
  155. package/dist/cli/chunks/fast-paths-3KX4ZV66.js +2 -0
  156. package/dist/cli/chunks/feature-flags-2NOVE7DL.js +2 -0
  157. package/dist/cli/chunks/feature-flags-GKHHG2I2.js +2 -0
  158. package/dist/cli/chunks/file-discovery-XFSGQNM3.js +2 -0
  159. package/dist/cli/chunks/fleet-FOIDAXLR.js +43 -0
  160. package/dist/cli/chunks/gnn-wrapper-HPCQREKP.js +2 -0
  161. package/dist/cli/chunks/heartbeat-handler-HTR3EFFV.js +48 -0
  162. package/dist/cli/chunks/heartbeat-scheduler-NZQWN7CH.js +2 -0
  163. package/dist/cli/chunks/hnsw-adapter-BNA5WUAB.js +2 -0
  164. package/dist/cli/chunks/hnsw-index-RQIIAE7S.js +2 -0
  165. package/dist/cli/chunks/hnsw-legacy-bridge-H6OA3AA3.js +2 -0
  166. package/dist/cli/chunks/hnswlib-node-FF27BDMD.js +2 -0
  167. package/dist/cli/chunks/hooks-63NZQ7NH.js +101 -0
  168. package/dist/cli/chunks/hypergraph-engine-XMSLA4XH.js +2 -0
  169. package/dist/cli/chunks/hypergraph-handler-ID6J6GS2.js +35 -0
  170. package/dist/cli/chunks/impact-analyzer-FS2UNVP4.js +2 -0
  171. package/dist/cli/chunks/init-handler-CIKZGGAY.js +68 -0
  172. package/dist/cli/chunks/init-wizard-TUU5PPY6.js +2 -0
  173. package/dist/cli/chunks/kernel-XFG42WAG.js +2 -0
  174. package/dist/cli/chunks/kilocode-installer-N7NLISYY.js +4 -0
  175. package/dist/cli/chunks/kiro-installer-U6XIPAT3.js +74 -0
  176. package/dist/cli/chunks/knowledge-graph-XV7FPU2T.js +2 -0
  177. package/dist/cli/chunks/learning-NKOF7KDJ.js +107 -0
  178. package/dist/cli/chunks/llm-router-34WHT3PH.js +30 -0
  179. package/dist/cli/chunks/load-ZW4Z3YLT.js +2 -0
  180. package/dist/cli/chunks/load-test-F4L7RTXJ.js +2 -0
  181. package/dist/cli/chunks/mcp-6R7SVGKO.js +2 -0
  182. package/dist/cli/chunks/memory-OUYCBU4M.js +32 -0
  183. package/dist/cli/chunks/memory-backend-DTJD2DWF.js +2 -0
  184. package/dist/cli/chunks/memory-handlers-WNXKZRNM.js +2 -0
  185. package/dist/cli/chunks/opencode-installer-FR75GHFU.js +3 -0
  186. package/dist/cli/chunks/orchestrator-AK7ZMVNH.js +371 -0
  187. package/dist/cli/chunks/pipeline-CFOPG7EM.js +19 -0
  188. package/dist/cli/chunks/platform-NY3ULBR7.js +2 -0
  189. package/dist/cli/chunks/plugin-LRANQYUR.js +27 -0
  190. package/dist/cli/chunks/prime-radiant-advanced-wasm-6KEIU55P.js +2 -0
  191. package/dist/cli/chunks/protocol-executor-6W4PS2D4.js +2 -0
  192. package/dist/cli/chunks/protocol-handler-ESSZGJ7R.js +20 -0
  193. package/dist/cli/chunks/prove-EF2PPY65.js +3 -0
  194. package/dist/cli/chunks/qe-reasoning-bank-7G3TZLEA.js +2 -0
  195. package/dist/cli/chunks/quality-AYBXB635.js +7 -0
  196. package/dist/cli/chunks/queen-coordinator-NFPKGMQN.js +2 -0
  197. package/dist/cli/chunks/real-embeddings-QPBXE7MA.js +2 -0
  198. package/dist/cli/chunks/roocode-installer-UF6MMBH6.js +4 -0
  199. package/dist/cli/chunks/router-F4B7Q66G.js +2 -0
  200. package/dist/cli/chunks/routing-feedback-5CIDDW7P.js +2 -0
  201. package/dist/cli/chunks/routing-handler-5TVKFU7V.js +20 -0
  202. package/dist/cli/chunks/ruvector-commands-E33VXFIA.js +8 -0
  203. package/dist/cli/chunks/rvf-dual-writer-O3AZKD24.js +2 -0
  204. package/dist/cli/chunks/rvf-migration-adapter-IKEUZ2HX.js +2 -0
  205. package/dist/cli/chunks/rvf-migration-coordinator-M4H7W4RN.js +2 -0
  206. package/dist/cli/chunks/rvf-native-adapter-UX3WAPIP.js +2 -0
  207. package/dist/cli/chunks/safe-db-QBBNXEVK.js +2 -0
  208. package/dist/cli/chunks/schedule-GFT4NN6Z.js +2 -0
  209. package/dist/cli/chunks/scheduler-CQ56T7DB.js +2 -0
  210. package/dist/cli/chunks/security-ZLWT7IU3.js +14 -0
  211. package/dist/cli/chunks/shared-rvf-adapter-EXACQ2PT.js +2 -0
  212. package/dist/cli/chunks/shared-rvf-dual-writer-G43LQDIV.js +2 -0
  213. package/dist/cli/chunks/sqlite-persistence-JHSUZPAW.js +2 -0
  214. package/dist/cli/chunks/status-handler-7P23CXUI.js +45 -0
  215. package/dist/cli/chunks/structural-health-SCNBNL7K.js +2 -0
  216. package/dist/cli/chunks/sync-BYZBBH65.js +23 -0
  217. package/dist/cli/chunks/task-handler-DWJQXZ2K.js +49 -0
  218. package/dist/cli/chunks/task-handlers-35JIXVRW.js +2 -0
  219. package/dist/cli/chunks/test-2JSS4XW7.js +33 -0
  220. package/dist/cli/chunks/test-scheduling-TWJ5I7N3.js +15 -0
  221. package/dist/cli/chunks/token-bootstrap-LLLNJT5V.js +2 -0
  222. package/dist/cli/chunks/token-usage-EQ4HM4EZ.js +25 -0
  223. package/dist/cli/chunks/transformers-PBIR5U5S.js +2 -0
  224. package/dist/cli/chunks/tree-sitter-wasm-parser-X3L2GXUX.js +2 -0
  225. package/dist/cli/chunks/types-OD43K2NP.js +2 -0
  226. package/dist/cli/chunks/unified-memory-YPHONR2T.js +2 -0
  227. package/dist/cli/chunks/unified-memory-hnsw-HJS4OXWM.js +2 -0
  228. package/dist/cli/chunks/unified-persistence-EFZRO6AW.js +2 -0
  229. package/dist/cli/chunks/validate-POMLT2KU.js +21 -0
  230. package/dist/cli/chunks/validate-swarm-UOC4JGZT.js +14 -0
  231. package/dist/cli/chunks/vibium-5JF6LAXI.js +2 -0
  232. package/dist/cli/chunks/visual-security-7KWFLYNB.js +2 -0
  233. package/dist/cli/chunks/web-tree-sitter-R7WR7J7B.js +2 -0
  234. package/dist/cli/chunks/windsurf-installer-ZSPEUBKR.js +7 -0
  235. package/dist/cli/chunks/witness-chain-CFSPCXHG.js +2 -0
  236. package/dist/cli/chunks/witness-chain-RWU6WT37.js +2 -0
  237. package/dist/cli/chunks/workflow-YNQT3OW2.js +51 -0
  238. package/dist/cli/chunks/workflow-orchestrator-Z6TAVMQP.js +2 -0
  239. package/dist/cli/chunks/wrappers-BP4FODVH.js +2 -0
  240. package/dist/cli/commands/daemon.d.ts +13 -0
  241. package/dist/cli/commands/daemon.js +224 -0
  242. package/dist/cli/commands/hooks-handlers/hooks-shared.js +2 -1
  243. package/dist/cli/commands/plugin.d.ts +12 -0
  244. package/dist/cli/commands/plugin.js +135 -0
  245. package/dist/cli/commands/ruvector-commands.js +14 -2
  246. package/dist/cli/commands/workflow.d.ts +10 -0
  247. package/dist/cli/commands/workflow.js +587 -0
  248. package/dist/cli/handlers/brain-handler.js +13 -8
  249. package/dist/cli/handlers/heartbeat-handler.d.ts +1 -0
  250. package/dist/cli/handlers/heartbeat-handler.js +20 -10
  251. package/dist/cli/handlers/hypergraph-handler.js +3 -3
  252. package/dist/cli/handlers/init-handler.js +10 -9
  253. package/dist/cli/handlers/interfaces.d.ts +4 -4
  254. package/dist/cli/index.js +159 -638
  255. package/dist/cli/lazy-registry.d.ts +27 -0
  256. package/dist/cli/lazy-registry.js +70 -0
  257. package/dist/context/compaction/context-budget.d.ts +71 -0
  258. package/dist/context/compaction/context-budget.js +120 -0
  259. package/dist/context/compaction/index.d.ts +96 -0
  260. package/dist/context/compaction/index.js +259 -0
  261. package/dist/context/compaction/llm-caller-adapter.d.ts +14 -0
  262. package/dist/context/compaction/llm-caller-adapter.js +47 -0
  263. package/dist/context/compaction/tier1-microcompact.d.ts +33 -0
  264. package/dist/context/compaction/tier1-microcompact.js +47 -0
  265. package/dist/context/compaction/tier2-session-summary.d.ts +72 -0
  266. package/dist/context/compaction/tier2-session-summary.js +172 -0
  267. package/dist/context/compaction/tier3-llm-compact.d.ts +65 -0
  268. package/dist/context/compaction/tier3-llm-compact.js +166 -0
  269. package/dist/context/compaction/tier4-reactive.d.ts +54 -0
  270. package/dist/context/compaction/tier4-reactive.js +129 -0
  271. package/dist/coordination/agent-memory-branch.d.ts +117 -0
  272. package/dist/coordination/agent-memory-branch.js +213 -0
  273. package/dist/coordination/agent-teams/mailbox.d.ts +43 -0
  274. package/dist/coordination/agent-teams/mailbox.js +130 -4
  275. package/dist/coordination/consensus/providers/claude-provider.d.ts +1 -0
  276. package/dist/coordination/consensus/providers/claude-provider.js +23 -3
  277. package/dist/coordination/handlers/handler-utils.d.ts +1 -0
  278. package/dist/coordination/handlers/handler-utils.js +9 -2
  279. package/dist/coordination/handlers/quality-handlers.js +7 -1
  280. package/dist/domains/contract-testing/coordinator.js +11 -0
  281. package/dist/domains/quality-assessment/coherence/gate-controller.d.ts +20 -1
  282. package/dist/domains/quality-assessment/coherence/gate-controller.js +64 -0
  283. package/dist/domains/quality-assessment/coherence/index.d.ts +3 -3
  284. package/dist/domains/quality-assessment/coherence/index.js +2 -2
  285. package/dist/domains/quality-assessment/coherence/types.d.ts +39 -0
  286. package/dist/domains/quality-assessment/coherence/types.js +11 -0
  287. package/dist/domains/quality-assessment/coordinator.d.ts +14 -0
  288. package/dist/domains/quality-assessment/coordinator.js +92 -0
  289. package/dist/domains/test-execution/coordinator.d.ts +19 -0
  290. package/dist/domains/test-execution/coordinator.js +102 -5
  291. package/dist/domains/test-generation/coordinator.js +11 -0
  292. package/dist/domains/test-generation/interfaces.d.ts +2 -0
  293. package/dist/domains/test-generation/services/test-generator.d.ts +9 -0
  294. package/dist/domains/test-generation/services/test-generator.js +37 -0
  295. package/dist/hooks/cross-phase-hooks.d.ts +11 -0
  296. package/dist/hooks/cross-phase-hooks.js +73 -9
  297. package/dist/hooks/security/config-snapshot.d.ts +21 -0
  298. package/dist/hooks/security/config-snapshot.js +33 -0
  299. package/dist/hooks/security/exit-codes.d.ts +28 -0
  300. package/dist/hooks/security/exit-codes.js +33 -0
  301. package/dist/hooks/security/index.d.ts +15 -0
  302. package/dist/hooks/security/index.js +15 -0
  303. package/dist/hooks/security/ssrf-guard.d.ts +25 -0
  304. package/dist/hooks/security/ssrf-guard.js +69 -0
  305. package/dist/init/agents-installer.d.ts +5 -3
  306. package/dist/init/agents-installer.js +17 -43
  307. package/dist/init/find-package-root.d.ts +22 -0
  308. package/dist/init/find-package-root.js +46 -0
  309. package/dist/init/n8n-installer.d.ts +4 -2
  310. package/dist/init/n8n-installer.js +23 -23
  311. package/dist/init/opencode-installer.d.ts +0 -5
  312. package/dist/init/opencode-installer.js +12 -39
  313. package/dist/init/skills-installer.d.ts +5 -2
  314. package/dist/init/skills-installer.js +15 -37
  315. package/dist/integrations/embeddings/index/HNSWIndex.d.ts +9 -2
  316. package/dist/integrations/embeddings/index/HNSWIndex.js +110 -35
  317. package/dist/integrations/ruvector/cognitive-routing.d.ts +67 -0
  318. package/dist/integrations/ruvector/cognitive-routing.js +208 -0
  319. package/dist/integrations/ruvector/feature-flags.d.ts +84 -0
  320. package/dist/integrations/ruvector/feature-flags.js +59 -0
  321. package/dist/integrations/ruvector/hdc-fingerprint.d.ts +76 -0
  322. package/dist/integrations/ruvector/hdc-fingerprint.js +217 -0
  323. package/dist/integrations/ruvector/hyperbolic-hnsw.d.ts +59 -0
  324. package/dist/integrations/ruvector/hyperbolic-hnsw.js +194 -0
  325. package/dist/integrations/ruvector/index.d.ts +5 -2
  326. package/dist/integrations/ruvector/index.js +13 -2
  327. package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +24 -0
  328. package/dist/integrations/ruvector/shared-rvf-adapter.js +55 -0
  329. package/dist/integrations/ruvector/shared-rvf-dual-writer.d.ts +6 -0
  330. package/dist/integrations/ruvector/shared-rvf-dual-writer.js +38 -0
  331. package/dist/integrations/ruvector/sona-persistence.d.ts +8 -0
  332. package/dist/integrations/ruvector/sona-persistence.js +10 -0
  333. package/dist/integrations/ruvector/vector-delta-tracker.d.ts +96 -0
  334. package/dist/integrations/ruvector/vector-delta-tracker.js +226 -0
  335. package/dist/kernel/agent-coordinator.d.ts +75 -1
  336. package/dist/kernel/agent-coordinator.js +250 -1
  337. package/dist/kernel/hnsw-legacy-bridge.d.ts +38 -0
  338. package/dist/kernel/hnsw-legacy-bridge.js +88 -0
  339. package/dist/kernel/hnsw-shadow-validator.d.ts +91 -0
  340. package/dist/kernel/hnsw-shadow-validator.js +139 -0
  341. package/dist/kernel/index.d.ts +1 -1
  342. package/dist/kernel/index.js +1 -1
  343. package/dist/kernel/interfaces.d.ts +39 -0
  344. package/dist/kernel/kernel.d.ts +23 -0
  345. package/dist/kernel/kernel.js +141 -1
  346. package/dist/kernel/memory-backend.js +3 -1
  347. package/dist/kernel/unified-memory.d.ts +1 -1
  348. package/dist/kernel/unified-memory.js +7 -3
  349. package/dist/learning/aqe-learning-engine.d.ts +65 -0
  350. package/dist/learning/aqe-learning-engine.js +134 -0
  351. package/dist/learning/dream/dream-engine.d.ts +6 -1
  352. package/dist/learning/dream/dream-engine.js +37 -2
  353. package/dist/learning/dream/dream-scheduler.d.ts +25 -0
  354. package/dist/learning/dream/dream-scheduler.js +120 -0
  355. package/dist/learning/dream/rvcow-branch-manager.d.ts +6 -3
  356. package/dist/learning/dream/rvcow-branch-manager.js +60 -5
  357. package/dist/learning/experience-capture.d.ts +3 -3
  358. package/dist/learning/hyperbolic-pattern-index.d.ts +82 -0
  359. package/dist/learning/hyperbolic-pattern-index.js +142 -0
  360. package/dist/learning/index.d.ts +3 -3
  361. package/dist/learning/index.js +1 -1
  362. package/dist/learning/metrics-tracker.d.ts +44 -0
  363. package/dist/learning/metrics-tracker.js +37 -0
  364. package/dist/learning/pattern-promotion.d.ts +3 -3
  365. package/dist/learning/pattern-store.d.ts +45 -2
  366. package/dist/learning/pattern-store.js +217 -4
  367. package/dist/learning/qe-patterns.d.ts +1 -1
  368. package/dist/learning/qe-reasoning-bank.js +1 -1
  369. package/dist/learning/rvf-pattern-migration.d.ts +50 -0
  370. package/dist/learning/rvf-pattern-migration.js +106 -0
  371. package/dist/learning/rvf-pattern-store.d.ts +66 -0
  372. package/dist/learning/rvf-pattern-store.js +447 -0
  373. package/dist/mcp/bundle.js +1937 -1793
  374. package/dist/mcp/entry.js +132 -77
  375. package/dist/mcp/handlers/index.d.ts +1 -0
  376. package/dist/mcp/handlers/index.js +2 -0
  377. package/dist/mcp/handlers/migration-handlers.d.ts +52 -0
  378. package/dist/mcp/handlers/migration-handlers.js +85 -0
  379. package/dist/mcp/middleware/batch-executor.d.ts +46 -0
  380. package/dist/mcp/middleware/batch-executor.js +150 -0
  381. package/dist/mcp/middleware/microcompact.d.ts +97 -0
  382. package/dist/mcp/middleware/microcompact.js +179 -0
  383. package/dist/mcp/middleware/middleware-chain.d.ts +37 -0
  384. package/dist/mcp/middleware/middleware-chain.js +60 -0
  385. package/dist/mcp/protocol-server.d.ts +12 -0
  386. package/dist/mcp/protocol-server.js +192 -36
  387. package/dist/mcp/services/session-durability-middleware.d.ts +22 -0
  388. package/dist/mcp/services/session-durability-middleware.js +64 -0
  389. package/dist/mcp/services/session-resume.d.ts +29 -0
  390. package/dist/mcp/services/session-resume.js +221 -0
  391. package/dist/mcp/services/session-store.d.ts +84 -0
  392. package/dist/mcp/services/session-store.js +163 -0
  393. package/dist/mcp/tool-registry.d.ts +9 -0
  394. package/dist/mcp/tool-registry.js +30 -1
  395. package/dist/mcp/types.d.ts +2 -1
  396. package/dist/optimization/early-exit-token-optimizer.d.ts +7 -7
  397. package/dist/optimization/early-exit-token-optimizer.js +3 -3
  398. package/dist/persistence/rvf-consistency-validator.d.ts +85 -0
  399. package/dist/persistence/rvf-consistency-validator.js +182 -0
  400. package/dist/persistence/rvf-migration-adapter.d.ts +125 -0
  401. package/dist/persistence/rvf-migration-adapter.js +303 -0
  402. package/dist/persistence/rvf-migration-coordinator.d.ts +115 -0
  403. package/dist/persistence/rvf-migration-coordinator.js +224 -0
  404. package/dist/persistence/rvf-stage-gate.d.ts +70 -0
  405. package/dist/persistence/rvf-stage-gate.js +163 -0
  406. package/dist/plugins/cache.d.ts +44 -0
  407. package/dist/plugins/cache.js +149 -0
  408. package/dist/plugins/index.d.ts +15 -0
  409. package/dist/plugins/index.js +15 -0
  410. package/dist/plugins/lifecycle.d.ts +67 -0
  411. package/dist/plugins/lifecycle.js +175 -0
  412. package/dist/plugins/manifest.d.ts +45 -0
  413. package/dist/plugins/manifest.js +173 -0
  414. package/dist/plugins/resolver.d.ts +37 -0
  415. package/dist/plugins/resolver.js +80 -0
  416. package/dist/plugins/security.d.ts +23 -0
  417. package/dist/plugins/security.js +125 -0
  418. package/dist/plugins/sources/github.d.ts +17 -0
  419. package/dist/plugins/sources/github.js +77 -0
  420. package/dist/plugins/sources/local.d.ts +20 -0
  421. package/dist/plugins/sources/local.js +32 -0
  422. package/dist/plugins/sources/npm.d.ts +18 -0
  423. package/dist/plugins/sources/npm.js +82 -0
  424. package/dist/shared/llm/retry.d.ts +5 -2
  425. package/dist/shared/llm/retry.js +7 -3
  426. package/dist/shared/prompt-cache-latch.d.ts +41 -0
  427. package/dist/shared/prompt-cache-latch.js +63 -0
  428. package/dist/shared/retry-engine.d.ts +77 -0
  429. package/dist/shared/retry-engine.js +194 -0
  430. package/dist/workers/daemon.d.ts +8 -0
  431. package/dist/workers/daemon.js +13 -0
  432. package/dist/workers/quality-daemon/ci-monitor.d.ts +55 -0
  433. package/dist/workers/quality-daemon/ci-monitor.js +147 -0
  434. package/dist/workers/quality-daemon/coverage-delta.d.ts +72 -0
  435. package/dist/workers/quality-daemon/coverage-delta.js +135 -0
  436. package/dist/workers/quality-daemon/git-watcher.d.ts +51 -0
  437. package/dist/workers/quality-daemon/git-watcher.js +209 -0
  438. package/dist/workers/quality-daemon/index.d.ts +119 -0
  439. package/dist/workers/quality-daemon/index.js +343 -0
  440. package/dist/workers/quality-daemon/nightly-consolidation.d.ts +74 -0
  441. package/dist/workers/quality-daemon/nightly-consolidation.js +136 -0
  442. package/dist/workers/quality-daemon/notification-service.d.ts +67 -0
  443. package/dist/workers/quality-daemon/notification-service.js +178 -0
  444. package/dist/workers/quality-daemon/persistent-memory.d.ts +31 -0
  445. package/dist/workers/quality-daemon/persistent-memory.js +30 -0
  446. package/dist/workers/quality-daemon/priority-queue.d.ts +97 -0
  447. package/dist/workers/quality-daemon/priority-queue.js +126 -0
  448. package/dist/workers/quality-daemon/test-suggester.d.ts +50 -0
  449. package/dist/workers/quality-daemon/test-suggester.js +121 -0
  450. package/dist/workers/worker-manager.js +2 -1
  451. package/package.json +10 -10
@@ -0,0 +1,59 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{a as ye}from"./chunk-U5JQGRHZ.js";import{c as oe,d as ce,e as fe}from"./chunk-A57BEPL7.js";import{b as N,d as le}from"./chunk-JSOBRKMA.js";import{b as w,c as L}from"./chunk-5LDBKZ6P.js";import{a as j,b as D,c as V}from"./chunk-UN4PA4M2.js";ye();import{createRequire as be}from"module";var O;function W(){if(!O){let h=be(import.meta.url);try{O=h("typescript")}catch{try{O=h("typescript/lib/typescript.js")}catch{O=new Proxy({},{get(e,t){if(!(t==="__esModule"||typeof t=="symbol"))throw new Error("TypeScript is required for code analysis. Install it: npm install -g typescript")}})}}}return O}var p=new Proxy({},{get(h,e){return W()[e]},has(h,e){return e in W()},ownKeys(){return Object.keys(W())},getOwnPropertyDescriptor(h,e){let t=W()[e];if(t!==void 0)return{configurable:!0,enumerable:!0,value:t}}});var F=class{parseFile(e,t){return p.createSourceFile(e,t,p.ScriptTarget.Latest,!0,this.getScriptKind(e))}extractFunctions(e){let t=[],s=n=>{p.isFunctionDeclaration(n)&&n.name?t.push(this.extractFunctionDeclaration(n,e)):p.isVariableStatement(n)&&this.extractArrowFunctions(n,e,t),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractClasses(e){let t=[],s=n=>{p.isClassDeclaration(n)&&n.name&&t.push(this.extractClassDeclaration(n,e)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractImports(e){let t=[],s=n=>{p.isImportDeclaration(n)&&t.push(this.extractImportDeclaration(n)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractExports(e){let t=[],s=n=>{if(p.isExportDeclaration(n))this.extractExportDeclaration(n,t);else if(p.isExportAssignment(n))t.push({name:this.getExportAssignmentName(n),type:"unknown",isDefault:!0,isReexport:!1,sourceModule:void 0});else if(p.isFunctionDeclaration(n)&&n.name&&this.hasExportModifier(n))t.push({name:n.name.text,type:"function",isDefault:this.hasDefaultModifier(n),isReexport:!1,sourceModule:void 0});else if(p.isClassDeclaration(n)&&n.name&&this.hasExportModifier(n))t.push({name:n.name.text,type:"class",isDefault:this.hasDefaultModifier(n),isReexport:!1,sourceModule:void 0});else if(p.isVariableStatement(n)&&this.hasExportModifier(n))for(let r of n.declarationList.declarations)p.isIdentifier(r.name)&&t.push({name:r.name.text,type:"variable",isDefault:!1,isReexport:!1,sourceModule:void 0});else p.isInterfaceDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"interface",isDefault:!1,isReexport:!1,sourceModule:void 0}):p.isTypeAliasDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"type",isDefault:!1,isReexport:!1,sourceModule:void 0}):p.isEnumDeclaration(n)&&this.hasExportModifier(n)&&t.push({name:n.name.text,type:"enum",isDefault:!1,isReexport:!1,sourceModule:void 0});p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractInterfaces(e){let t=[],s=n=>{p.isInterfaceDeclaration(n)&&t.push(this.extractInterfaceDeclaration(n,e)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractEntities(e,t){let s=this.parseFile(t,e),n=[],r=this.extractFunctions(s);for(let a of r)n.push({name:a.name,type:"function",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:a.isAsync,isExported:a.isExported,parameters:a.parameters,returnType:a.returnType});let o=this.extractClasses(s);for(let a of o)n.push({name:a.name,type:"class",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:!1,isExported:a.isExported,extends:a.extends,implements:a.implements});let i=this.extractInterfaces(s);for(let a of i)n.push({name:a.name,type:"interface",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:!1,isExported:a.isExported});return n}getScriptKind(e){return e.endsWith(".tsx")?p.ScriptKind.TSX:e.endsWith(".ts")?p.ScriptKind.TS:e.endsWith(".jsx")?p.ScriptKind.JSX:e.endsWith(".js")?p.ScriptKind.JS:p.ScriptKind.TS}extractFunctionDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:e.name?.text??"anonymous",parameters:this.extractParameters(e.parameters),returnType:e.type?e.type.getText(t):void 0,startLine:s+1,endLine:n+1,isAsync:this.hasAsyncModifier(e),isExported:this.hasExportModifier(e),isGenerator:!!e.asteriskToken,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractArrowFunctions(e,t,s){for(let n of e.declarationList.declarations)if(p.isIdentifier(n.name)&&n.initializer&&p.isArrowFunction(n.initializer)){let r=n.initializer,{line:o}=t.getLineAndCharacterOfPosition(e.getStart()),{line:i}=t.getLineAndCharacterOfPosition(e.getEnd());s.push({name:n.name.text,parameters:this.extractParameters(r.parameters),returnType:r.type?r.type.getText(t):void 0,startLine:o+1,endLine:i+1,isAsync:this.hasAsyncModifier(r),isExported:this.hasExportModifier(e),isGenerator:!1,typeParameters:this.extractTypeParameters(r.typeParameters)})}}extractClassDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),r=[],o=[];for(let c of e.members)p.isMethodDeclaration(c)&&c.name?r.push(this.extractMethodDeclaration(c,t)):p.isPropertyDeclaration(c)&&c.name?o.push(this.extractPropertyDeclaration(c,t)):p.isConstructorDeclaration(c)&&(r.push(this.extractConstructor(c,t)),this.extractParameterProperties(c,o,t));let i,a=[];if(e.heritageClauses){for(let c of e.heritageClauses)if(c.token===p.SyntaxKind.ExtendsKeyword)i=c.types[0]?.expression.getText(t);else if(c.token===p.SyntaxKind.ImplementsKeyword)for(let l of c.types)a.push(l.expression.getText(t))}return{name:e.name?.text??"anonymous",methods:r,properties:o,extends:i,implements:a,isAbstract:this.hasAbstractModifier(e),isExported:this.hasExportModifier(e),startLine:s+1,endLine:n+1,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractMethodDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:this.getPropertyName(e.name,t),parameters:this.extractParameters(e.parameters),returnType:e.type?e.type.getText(t):void 0,isAsync:this.hasAsyncModifier(e),isStatic:this.hasStaticModifier(e),isAbstract:this.hasAbstractModifier(e),visibility:this.getVisibility(e),startLine:s+1,endLine:n+1}}extractConstructor(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:"constructor",parameters:this.extractParameters(e.parameters),returnType:void 0,isAsync:!1,isStatic:!1,isAbstract:!1,visibility:"public",startLine:s+1,endLine:n+1}}extractParameterProperties(e,t,s){for(let n of e.parameters)this.isParameterProperty(n)&&t.push({name:p.isIdentifier(n.name)?n.name.text:n.name.getText(s),type:n.type?n.type.getText(s):void 0,isStatic:!1,isReadonly:this.hasReadonlyModifier(n),visibility:this.getVisibility(n),hasInitializer:!!n.initializer})}isParameterProperty(e){return!!e.modifiers?.some(t=>t.kind===p.SyntaxKind.PublicKeyword||t.kind===p.SyntaxKind.PrivateKeyword||t.kind===p.SyntaxKind.ProtectedKeyword||t.kind===p.SyntaxKind.ReadonlyKeyword)}extractPropertyDeclaration(e,t){return{name:this.getPropertyName(e.name,t),type:e.type?e.type.getText(t):void 0,isStatic:this.hasStaticModifier(e),isReadonly:this.hasReadonlyModifier(e),visibility:this.getVisibility(e),hasInitializer:!!e.initializer}}extractImportDeclaration(e){let t=e.moduleSpecifier.text,s=[],n,r,o=e.importClause?.isTypeOnly??!1;if(e.importClause&&(e.importClause.name&&(n=e.importClause.name.text),e.importClause.namedBindings)){if(p.isNamespaceImport(e.importClause.namedBindings))r=e.importClause.namedBindings.name.text;else if(p.isNamedImports(e.importClause.namedBindings))for(let i of e.importClause.namedBindings.elements)s.push({name:i.propertyName?.text??i.name.text,alias:i.propertyName?i.name.text:void 0})}return{module:t,namedImports:s,defaultImport:n,namespaceImport:r,isTypeOnly:o}}extractExportDeclaration(e,t){let s=e.moduleSpecifier?e.moduleSpecifier.text:void 0;if(e.exportClause&&p.isNamedExports(e.exportClause))for(let n of e.exportClause.elements)t.push({name:n.name.text,type:"unknown",isDefault:!1,isReexport:!!s,sourceModule:s});else!e.exportClause&&s&&t.push({name:"*",type:"unknown",isDefault:!1,isReexport:!0,sourceModule:s})}extractInterfaceDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),r=[],o=[];for(let a of e.members)p.isPropertySignature(a)&&a.name?r.push({name:this.getPropertyName(a.name,t),type:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken,isReadonly:this.hasReadonlyModifier(a)}):p.isMethodSignature(a)&&a.name&&o.push({name:this.getPropertyName(a.name,t),parameters:this.extractParameters(a.parameters),returnType:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken});let i=[];if(e.heritageClauses){for(let a of e.heritageClauses)if(a.token===p.SyntaxKind.ExtendsKeyword)for(let c of a.types)i.push(c.expression.getText(t))}return{name:e.name.text,properties:r,methods:o,extends:i,isExported:this.hasExportModifier(e),startLine:s+1,endLine:n+1,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractParameters(e){return e.map(t=>{let s=t.getSourceFile();return{name:p.isIdentifier(t.name)?t.name.text:t.name.getText(s),type:t.type?t.type.getText(s):void 0,isOptional:!!t.questionToken||!!t.initializer,isRest:!!t.dotDotDotToken,defaultValue:t.initializer?t.initializer.getText(s):void 0}})}extractTypeParameters(e){return e?e.map(t=>t.name.text):[]}getPropertyName(e,t){return p.isIdentifier(e)||p.isStringLiteral(e)||p.isNumericLiteral(e)?e.text:e.getText(t)}getExportAssignmentName(e){return p.isIdentifier(e.expression)?e.expression.text:"default"}hasExportModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.ExportKeyword)}hasDefaultModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.DefaultKeyword)}hasAsyncModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.AsyncKeyword)}hasStaticModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.StaticKeyword)}hasAbstractModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.AbstractKeyword)}hasReadonlyModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.ReadonlyKeyword)}getVisibility(e){if(!p.canHaveModifiers(e))return"public";let t=p.getModifiers(e);return t?t.some(s=>s.kind===p.SyntaxKind.PrivateKeyword)?"private":t.some(s=>s.kind===p.SyntaxKind.ProtectedKeyword)?"protected":"public":"public"}},Me=new F,q=class{language="typescript";supportedExtensions=[".ts",".tsx",".js",".jsx",".mjs",".cjs"];parser=new F;async parseFile(e,t){let s=this.parser.parseFile(t,e),n=this.parser.extractFunctions(s),r=this.parser.extractClasses(s),o=this.parser.extractImports(s);return{functions:n.map(i=>this.mapFunction(i)),classes:r.map(i=>this.mapClass(i)),imports:o.map(i=>this.mapImport(i)),language:t.endsWith(".js")||t.endsWith(".jsx")||t.endsWith(".mjs")||t.endsWith(".cjs")?"javascript":"typescript",filePath:t}}mapFunction(e){return{name:e.name,parameters:e.parameters.map(t=>({name:t.name,type:t.type,isOptional:t.isOptional,defaultValue:t.defaultValue})),returnType:e.returnType,isAsync:e.isAsync,isPublic:e.isExported,complexity:1,decorators:[],genericParams:e.typeParameters,startLine:e.startLine,endLine:e.endLine}}mapClass(e){return{name:e.name,methods:e.methods.map(t=>({name:t.name,parameters:t.parameters.map(s=>({name:s.name,type:s.type,isOptional:s.isOptional,defaultValue:s.defaultValue})),returnType:t.returnType,isAsync:t.isAsync,isPublic:t.visibility==="public",complexity:1,decorators:[],genericParams:[],startLine:t.startLine,endLine:t.endLine})),properties:e.properties.map(t=>this.mapProperty(t)),isPublic:e.isExported,implements:e.implements,extends:e.extends,decorators:[],startLine:e.startLine,endLine:e.endLine}}mapProperty(e){return{name:e.name,type:e.type,isPublic:e.visibility==="public",isReadonly:e.isReadonly}}mapImport(e){return{module:e.module,namedImports:e.namedImports.map(t=>t.alias||t.name),isTypeOnly:e.isTypeOnly}}},Se=new q;fe();var E=1e3;function I(h){let e=h.split(`
3
+ `),t=[],s=[],n="",r=0,o=0,i=0,a=0;for(let c=0;c<e.length;c++){let l=e[c],d=l.trim();if(d===""||d.startsWith("//")||d.startsWith("#")||d.startsWith("*")){if(n){n+=" "+d;continue}t.push(l),s.push(c+1);continue}n||(r=c+1),n=n?n+" "+d:l;for(let u of d)u==="("?o++:u===")"?o=Math.max(0,o-1):u==="<"?i++:u===">"?i=Math.max(0,i-1):u==="["?a++:u==="]"&&(a=Math.max(0,a-1));o===0&&i===0&&a===0&&(t.push(n),s.push(r),n="")}return n&&(t.push(n),s.push(r)),{logicalLines:t,lineMap:s}}function G(h,e,t="<",s=">"){if(h[e]!==t)return;let n=1,r=e+1;for(;r<h.length&&n>0;)h[r]===t?n++:h[r]===s&&n--,r++;if(n===0)return h.substring(e+1,r-1)}function R(h,e,t){let s=[];for(let n=e-1;n>=0;n--){let r=h[n].trim();if(r.startsWith(t))s.unshift(r);else{if(r===""||r.startsWith("//")||r.startsWith("*")||r.startsWith("#"))continue;break}}return s}function S(h){let e=[],t=0,s="";for(let n of h)n==="<"||n==="("?t++:(n===">"||n===")")&&t--,n===","&&t===0?(e.push(s.trim()),s=""):s+=n;return s.trim()&&e.push(s.trim()),e}function re(h){let e=0,t=!1,s="";for(let n=0;n<h.length;n++){let r=h[n];if(t){r===s&&h[n-1]!=="\\"&&(t=!1);continue}r==='"'||r==="'"||r==="`"?(t=!0,s=r):r==="{"?e++:r==="}"&&e--}return e}var H=class{language="python";supportedExtensions=[".py"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractClasses(e),imports:this.extractImports(e),language:"python",filePath:t}}extractFunctions(e){let t=[],s=e.split(`
4
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^(\s*)(async\s+)?def\s+(\w+)\s*\(([^)]*)\)(?:\s*->\s*([^:]*\S))?\s*:/;for(let i=0;i<n.length;i++){if(n[i].length>E)continue;let a=n[i].match(o);if(a){let c=a[1].length,l=!!a[2],d=a[3],u=a[4],m=a[5]?.trim(),g=r[i]-1,f=g+1;for(let y=g+1;y<s.length;y++){let b=s[y];if(b.trim()===""||b.trim().startsWith("#"))continue;if((b.match(/^(\s*)/)?.[1].length??0)<=c&&b.trim()!==""){f=y;break}f=y+1}let x=R(s,g,"@");t.push({name:d,parameters:this.parseParams(u),returnType:m,isAsync:l,isPublic:!d.startsWith("_"),complexity:1,decorators:x,genericParams:[],startLine:r[i],endLine:f})}}return t}extractClasses(e){let t=[],s=e.split(`
5
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^(\s*)class\s+(\w+)(?:\(([^)]*)\))?\s*:/;for(let i=0;i<n.length;i++){let a=n[i].match(o);if(a){let c=a[1].length,l=a[2],d=a[3]?a[3].split(",").map(y=>y.trim()):[],u=r[i]-1,m=u+1;for(let y=u+1;y<s.length;y++){let b=s[y];if(b.trim()===""||b.trim().startsWith("#"))continue;if((b.match(/^(\s*)/)?.[1].length??0)<=c&&b.trim()!==""){m=y;break}m=y+1}let g=s.slice(u+1,m).join(`
6
+ `),f=this.extractFunctions(g).map(y=>({...y,startLine:y.startLine+u,endLine:y.endLine+u})),x=R(s,u,"@");t.push({name:l,methods:f,properties:[],isPublic:!l.startsWith("_"),implements:[],extends:d[0]||void 0,decorators:x,startLine:r[i],endLine:m})}}return t}extractImports(e){let t=[],s=e.split(`
7
+ `);for(let n of s){if(n.length>E)continue;let r=n.match(/^\s*from\s+(\S+)\s+import\s+(.+)/);if(r){let i=r[2].split(",").map(a=>a.trim().split(" as ")[0]);t.push({module:r[1],namedImports:i,isTypeOnly:!1});continue}let o=n.match(/^\s*import\s+(\S+)/);o&&t.push({module:o[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){return e.trim()?S(e).map(t=>t.trim()).filter(t=>t&&t!=="self"&&t!=="cls").map(t=>{let[s,n]=t.split(":").map(i=>i.trim()),[r,o]=s.split("=").map(i=>i.trim());return{name:r,type:n?.split("=")[0].trim()||void 0,isOptional:!!o||r.startsWith("*"),defaultValue:o||void 0}}):[]}},J=class{language="java";supportedExtensions=[".java"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractClasses(e),imports:this.extractImports(e),language:"java",filePath:t}}extractFunctions(e){let t=[],s=e.split(`
8
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(public|private|protected)?\s*(static)?\s*(async)?\s*(?:<\S+>\s+)?([\w<>,.[\]?]+(?:\s+[\w<>,.[\]?]+)*)\s+(\w+)\s*\(([^)]*)\)/;for(let i=0;i<n.length;i++){let a=n[i];if(a.includes(" class ")||a.includes(" interface ")||a.length>E)continue;let c=a.match(o);if(c){let l=c[1]||"default",d=c[5],u=c[6],m=c[4]?.trim(),g=m;if(m&&m.includes("<")){let y=m.indexOf("<"),b=G(m,y);b!==void 0&&(g=m.substring(0,y)+"<"+b+">")}let f=r[i]-1,x=R(s,f,"@");t.push({name:d,parameters:this.parseParams(u),returnType:g==="void"?void 0:g,isAsync:g?.includes("CompletableFuture")||!1,isPublic:l==="public",complexity:1,decorators:x,genericParams:[],startLine:r[i],endLine:r[i]})}}return t}extractClasses(e){let t=[],s=e.split(`
9
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(public|private|protected)?\s*(abstract)?\s*class\s+(\w+)(?:<[^{]*>)?(?:\s+extends\s+(\w+))?(?:\s+implements\s+([^{\s]+(?:\s+[^{\s]+)*))?\s*\{?/;for(let i=0;i<n.length;i++){if(n[i].length>E)continue;let a=n[i].match(o);if(a){let c=a[3],l=a[4],d=a[5]?a[5].split(",").map(g=>g.trim()):[],u=r[i]-1,m=R(s,u,"@");t.push({name:c,methods:[],properties:[],isPublic:(a[1]||"default")==="public",implements:d,extends:l,decorators:m,startLine:r[i],endLine:r[i]})}}return t}extractImports(e){let t=[],s=e.split(`
10
+ `);for(let n of s){if(n.length>E)continue;let r=n.match(/^\s*import +(static +)?(\S[^;]*);/);if(r){let o=r[2].trim(),i=o.split("."),a=i[i.length-1];t.push({module:o,namedImports:a==="*"?[]:[a],isTypeOnly:!1})}}return t}parseParams(e){return e.trim()?S(e).map(t=>{let n=t.trim().split(/\s+/).filter(i=>!i.startsWith("@")),r=n[n.length-1]||"",o=n.slice(0,-1).join(" ")||void 0;return{name:r,type:o,isOptional:!1,defaultValue:void 0}}):[]}},Q=class{language="csharp";supportedExtensions=[".cs"];async parseFile(e,t){return{functions:this.extractMethods(e),classes:this.extractClasses(e),imports:this.extractImports(e),language:"csharp",filePath:t}}extractMethods(e){let t=[],s=e.split(`
11
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(public|private|protected|internal)?\s*(static)?\s*(async)?\s*([\w<>,.[\]?]+(?:\s+[\w<>,.[\]?]+)*)\s+(\w+)\s*\(([^)]*)\)/;for(let i=0;i<n.length;i++){let a=n[i];if(a.includes(" class ")||a.includes(" interface ")||a.includes(" namespace ")||a.length>E)continue;let c=a.match(o);if(c){let l=c[1]||"private",d=!!c[3]||c[4]?.includes("Task")||!1,u=c[4]?.trim(),m=u;if(u&&u.includes("<")){let b=u.indexOf("<"),P=G(u,b);P!==void 0&&(m=u.substring(0,b)+"<"+P+">")}let g=c[5],f=c[6],x=r[i]-1,y=R(s,x,"[");t.push({name:g,parameters:this.parseParams(f),returnType:m==="void"?void 0:m,isAsync:d,isPublic:l==="public",complexity:1,decorators:y,genericParams:[],startLine:r[i],endLine:r[i]})}}return t}extractClasses(e){let t=[],s=e.split(`
12
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(public|private|protected|internal)?\s*(abstract|sealed|static|partial)?\s*class\s+(\w+)(?:<[^{]*>)?(?:\s*:\s*([^{\s]+(?:\s+[^{\s]+)*))?\s*\{?/;for(let i=0;i<n.length;i++){if(n[i].length>E)continue;let a=n[i].match(o);if(a){let c=a[3],l=a[4]?a[4].split(",").map(m=>m.trim()):[],d=r[i]-1,u=R(s,d,"[");t.push({name:c,methods:[],properties:[],isPublic:(a[1]||"internal")==="public",implements:l.slice(1),extends:l[0]||void 0,decorators:u,startLine:r[i],endLine:r[i]})}}return t}extractImports(e){let t=[],s=e.split(`
13
+ `);for(let n of s){if(n.length>E)continue;let r=n.match(/^\s*using +(static +)?(\S[^;]*);/);r&&t.push({module:r[2].trim(),namedImports:[],isTypeOnly:!1})}return t}parseParams(e){return e.trim()?S(e).map(t=>{let s=t.trim().split(/\s+/),n=s[s.length-1]||"",r=s.slice(0,-1).join(" ")||void 0;return{name:n,type:r,isOptional:r?.endsWith("?")||!1,defaultValue:void 0}}):[]}},X=class{language="go";supportedExtensions=[".go"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractStructs(e),imports:this.extractImports(e),language:"go",filePath:t}}extractFunctions(e){let t=[],s=e.split(`
14
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^\s*func\s+(?:\((\w+)\s+\*?(\w+)\)\s+)?(\w+)\s*\(([^)]*)\)\s*([\w*[\](),\s]*)\s*\{?/,i=0;for(let a=0;a<n.length;a++){let c=n[a];if(c.length>E){i+=(c.match(/\{/g)?.length??0)-(c.match(/\}/g)?.length??0);continue}let l=c.match(o);if(l&&i===0){let d=l[3],u=l[4],m=l[5]?.trim()||void 0;t.push({name:d,parameters:this.parseParams(u),returnType:m||void 0,isAsync:!1,isPublic:d[0]===d[0].toUpperCase(),complexity:1,decorators:[],genericParams:[],startLine:r[a],endLine:r[a]})}i+=re(c),i<0&&(i=0)}return t}extractStructs(e){let t=[],{logicalLines:s,lineMap:n}=I(e),r=/^\s*type\s+(\w+)\s+struct\s*\{/;for(let o=0;o<s.length;o++){let i=s[o].match(r);if(i){let a=i[1];t.push({name:a,methods:[],properties:[],isPublic:a[0]===a[0].toUpperCase(),implements:[],extends:void 0,decorators:[],startLine:n[o],endLine:n[o]})}}return t}extractImports(e){let t=[],s=/^\s*import\s+"([^"]+)"/,n=/^\s*import\s*\(/,r=/^\s*"([^"]+)"/,o=e.split(`
15
+ `),i=!1;for(let a of o)if(i){if(a.includes(")")){i=!1;continue}let c=a.match(r);c&&t.push({module:c[1],namedImports:[],isTypeOnly:!1})}else{let c=a.match(s);c?t.push({module:c[1],namedImports:[],isTypeOnly:!1}):n.test(a)&&(i=!0)}return t}parseParams(e){return e.trim()?S(e).map(t=>{let s=t.trim().split(/\s+/),n=s[0]||"",r=s.slice(1).join(" ")||void 0;return{name:n,type:r,isOptional:!1,defaultValue:void 0}}):[]}},Y=class{language="rust";supportedExtensions=[".rs"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractStructsAndImpls(e),imports:this.extractImports(e),language:"rust",filePath:t}}extractFunctions(e){let t=[],s=e.split(`
16
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(pub(?:\(crate\))? +)?(async +)?fn\s+(\w+)(?:<[^{]*>)?\s*\(([^)]*)\)(?:\s*->\s*([^{\s]+(?:\s+[^{\s]+)*))?\s*(?:where\s+[^{\s]+(?:\s+[^{\s]+)*)?\s*\{?/,i=0;for(let a=0;a<n.length;a++){let c=n[a],l=c.match(o);if(l&&i<=1){let d=!!l[1],u=!!l[2],m=l[3],g=l[4],f=l[5]?.trim(),x=r[a]-1,y=R(s,x,"#[");t.push({name:m,parameters:this.parseParams(g),returnType:f,isAsync:u,isPublic:d,complexity:1,decorators:y,genericParams:[],startLine:r[a],endLine:r[a]})}i+=re(c),i<0&&(i=0)}return t}extractStructsAndImpls(e){let t=[],s=e.split(`
17
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(pub(?:\(crate\))?\s+)?struct\s+(\w+)(?:<[^{]*>)?\s*/;for(let i=0;i<n.length;i++){let a=n[i].match(o);if(a){let c=r[i]-1,l=R(s,c,"#[");t.push({name:a[2],methods:[],properties:[],isPublic:!!a[1],implements:[],extends:void 0,decorators:l,startLine:r[i],endLine:r[i]})}}return t}extractImports(e){let t=[],s=e.split(`
18
+ `);for(let n of s){if(n.length>E)continue;let r=n.match(/^\s*use +(\S[^;]*);/);r&&t.push({module:r[1].trim(),namedImports:[],isTypeOnly:!1})}return t}parseParams(e){return e.trim()?S(e).map(t=>t.trim()).filter(t=>t&&t!=="&self"&&t!=="&mut self"&&t!=="self").map(t=>{let s=t.indexOf(":");if(s===-1)return{name:t,type:void 0,isOptional:!1,defaultValue:void 0};let n=t.substring(0,s).trim(),r=t.substring(s+1).trim();return{name:n,type:r,isOptional:!1,defaultValue:void 0}}):[]}},Z=class{language="swift";supportedExtensions=[".swift"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractClasses(e),imports:this.extractImports(e),language:"swift",filePath:t}}extractFunctions(e){let t=[],{logicalLines:s,lineMap:n}=I(e),r=/^\s*(public|private|internal|open)?\s*(static)?\s*func\s+(\w+)(?:<[^{]*>)?\s*\(([^)]*)\)(?:\s*(async))?\s*(?:throws +)?(?:->\s*([^{\s]+(?:\s+[^{\s]+)*))?\s*\{?/;for(let o=0;o<s.length;o++){if(s[o].length>E)continue;let i=s[o].match(r);if(i){let a=i[1]||"internal",c=!!i[5],l=i[3],d=i[4],u=i[6]?.trim();t.push({name:l,parameters:this.parseParams(d),returnType:u,isAsync:c,isPublic:a==="public"||a==="open",complexity:1,decorators:[],genericParams:[],startLine:n[o],endLine:n[o]})}}return t}extractClasses(e){let t=[],{logicalLines:s,lineMap:n}=I(e),r=/^\s*(public|private|internal|open)?\s*(class|struct|protocol)\s+(\w+)(?:<[^{]*>)?(?:\s*:\s*([^{\s]+(?:\s+[^{\s]+)*))?\s*\{?/;for(let o=0;o<s.length;o++){if(s[o].length>E)continue;let i=s[o].match(r);if(i){let a=i[3],c=i[4]?i[4].split(",").map(l=>l.trim()):[];t.push({name:a,methods:[],properties:[],isPublic:(i[1]||"internal")==="public"||i[1]==="open",implements:c.slice(1),extends:c[0]||void 0,decorators:[],startLine:n[o],endLine:n[o]})}}return t}extractImports(e){let t=[],s=e.split(`
19
+ `);for(let n of s){let r=n.match(/^\s*import\s+(\w+)/);r&&t.push({module:r[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){return e.trim()?S(e).map(t=>{let s=t.trim().split(":"),n=s[0]?.trim().split(/\s+/)||[],r=n[n.length-1]||"",o=s.slice(1).join(":").trim();return{name:r,type:o||void 0,isOptional:o?.endsWith("?")||!1,defaultValue:void 0}}):[]}},ee=class{language="kotlin";supportedExtensions=[".kt",".kts"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractClasses(e),imports:this.extractImports(e),language:"kotlin",filePath:t}}extractFunctions(e){let t=[],s=e.split(`
20
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(public|private|protected|internal)?\s*(suspend)?\s*fun\s+(?:<[^{]*> +)?(\w+)\s*\(([^)]*)\)(?:\s*:\s*([^{=\s]+(?:\s+[^{=\s]+)*))?\s*/,i=0;for(let a=0;a<n.length;a++){let c=n[a];if(c.length>E){i+=(c.match(/\{/g)?.length??0)-(c.match(/\}/g)?.length??0);continue}let l=c.match(o);if(l&&i<=1){let d=l[1]||"public",u=!!l[2],m=l[3],g=l[4],f=l[5]?.trim();if(f&&f.includes("<")){let b=f.indexOf("<"),P=G(f,b);P!==void 0&&(f=f.substring(0,b)+"<"+P+">")}let x=r[a]-1,y=R(s,x,"@");t.push({name:m,parameters:this.parseParams(g),returnType:f,isAsync:u,isPublic:d==="public",complexity:1,decorators:y,genericParams:[],startLine:r[a],endLine:r[a]})}i+=re(c),i<0&&(i=0)}return t}extractClasses(e){let t=[],s=e.split(`
21
+ `),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(public|private|protected|internal)?\s*(data|sealed|abstract|open)?\s*class\s+(\w+)(?:<[^{]*>)?(?:\s*(?:\([^)]*\))?\s*:\s*([^{\s]+(?:\s+[^{\s]+)*))?\s*\{?/;for(let i=0;i<n.length;i++){if(n[i].length>E)continue;let a=n[i].match(o);if(a){let c=a[3],l=a[4]?a[4].split(",").map(m=>m.trim().split("(")[0].trim()):[],d=r[i]-1,u=R(s,d,"@");t.push({name:c,methods:[],properties:[],isPublic:(a[1]||"public")==="public",implements:l.slice(1),extends:l[0]||void 0,decorators:u,startLine:r[i],endLine:r[i]})}}return t}extractImports(e){let t=[],s=e.split(`
22
+ `);for(let n of s){let r=n.match(/^\s*import\s+([^\s]+)/);r&&t.push({module:r[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){return e.trim()?S(e).map(t=>{let s=t.indexOf(":");if(s===-1)return{name:t.replace("val ","").replace("var ","").trim(),type:void 0,isOptional:!1,defaultValue:void 0};let n=t.substring(0,s).replace("val ","").replace("var ","").trim(),r=t.substring(s+1).trim(),o=r.indexOf("="),i=o>=0?r.substring(0,o).trim():r,a=o>=0;return{name:n,type:i,isOptional:a||i?.endsWith("?")||!1,defaultValue:void 0}}):[]}},te=class{language="dart";supportedExtensions=[".dart"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractClasses(e),imports:this.extractImports(e),language:"dart",filePath:t}}extractFunctions(e){let t=[],{logicalLines:s,lineMap:n}=I(e),r=/^\s*([\w<>,.?]+(?:\s+[\w<>,.?]+)*)\s+(\w+)\s*\(([^)]*)\)(?:\s*(async))?\s*\{/;for(let o=0;o<s.length;o++){let i=s[o];if(i.includes(" class ")||i.length>E)continue;let a=i.match(r);if(a){let c=a[1].trim(),l=c;if(c&&c.includes("<")){let g=c.indexOf("<"),f=G(c,g);f!==void 0&&(l=c.substring(0,g)+"<"+f+">")}let d=a[2],u=a[3],m=!!a[4]||l.includes("Future");t.push({name:d,parameters:this.parseParams(u),returnType:l==="void"?void 0:l,isAsync:m,isPublic:!d.startsWith("_"),complexity:1,decorators:[],genericParams:[],startLine:n[o],endLine:n[o]})}}return t}extractClasses(e){let t=[],{logicalLines:s,lineMap:n}=I(e),r=/^\s*(abstract +)?class\s+(\w+)(?:<[^{]*>)?(?:\s+extends\s+(\w+))?(?:\s+(?:with|implements)\s+([^{\s]+(?:\s+[^{\s]+)*))?\s*\{/;for(let o=0;o<s.length;o++){if(s[o].length>E)continue;let i=s[o].match(r);if(i){let a=i[2],c=i[3],l=i[4]?i[4].split(",").map(d=>d.trim()):[];t.push({name:a,methods:[],properties:[],isPublic:!a.startsWith("_"),implements:l,extends:c,decorators:[],startLine:n[o],endLine:n[o]})}}return t}extractImports(e){let t=[],s=e.split(`
23
+ `);for(let n of s){let r=n.match(/^\s*import\s+'([^']+)'/);r&&t.push({module:r[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){if(!e.trim())return[];let t=e.replace(/[{}[\]]/g,"");return S(t).map(s=>s.trim()).filter(s=>s).map(s=>{let n=s.replace("required ","").trim().split(/\s+/),r=n[n.length-1]||"",o=n.slice(0,-1).join(" ")||void 0;return{name:r,type:o,isOptional:s.includes("?")||s.includes("{"),defaultValue:void 0}})}},$=ce("ParserRegistry"),de=["python","java","csharp","rust","swift"],se=class h{language;supportedExtensions;wasmParser;regexParser;wasmFailCount=0;static MAX_WASM_RETRIES=3;constructor(e,t){this.wasmParser=e,this.regexParser=t,this.language=e.language,this.supportedExtensions=e.supportedExtensions}async parseFile(e,t){if(this.wasmFailCount<h.MAX_WASM_RETRIES)try{return await this.wasmParser.parseFile(e,t)}catch(s){this.wasmFailCount++;let n=s instanceof Error?s.message:String(s),r=this.wasmFailCount>=h.MAX_WASM_RETRIES;$.warn(`[${this.language}] tree-sitter WASM parser failed (attempt ${this.wasmFailCount}/${h.MAX_WASM_RETRIES}): ${n}. Falling back to regex parser (~97-98% accuracy). `+(r?"Set AQE_PARSER_REGEX_ONLY=1 to silence this warning.":"Will retry WASM on next parse."))}return this.regexParser.parseFile(e,t)}},ne=class{parsers=new Map;_wasmInitPromise=null;constructor(){this.register(new H),this.register(new J),this.register(new Q),this.register(new X),this.register(new Y),this.register(new Z),this.register(new ee),this.register(new te),this._wasmInitPromise=this._tryLoadWasmParsers()}async _tryLoadWasmParsers(){try{let e=await import("./tree-sitter-wasm-parser-X3L2GXUX.js");if(!e.isWasmAvailable()){$.info("tree-sitter WASM parsers disabled or unavailable. Using regex parsers (~97-98% accuracy). Set AQE_PARSER_REGEX_ONLY=0 or ensure web-tree-sitter is installed to enable WASM.");return}let t=e.createWasmParsers();for(let s of de){let n=t.get(s),r=this.parsers.get(s);n&&r&&this.parsers.set(s,new se(n,r))}$.info("tree-sitter WASM parsers available for: "+de.join(", "))}catch{$.info("tree-sitter WASM parser module not available. Using regex parsers for all languages.")}}register(e){this.parsers.set(e.language,e)}getParser(e){return this.parsers.get(e)}async parseFile(e,t,s){this._wasmInitPromise&&(await this._wasmInitPromise,this._wasmInitPromise=null);let n=this.parsers.get(s);if(n)return n.parseFile(e,t)}getSupportedLanguages(){return Array.from(this.parsers.keys())}supportsLanguage(e){return this.parsers.has(e)}},De=new ne;import*as M from"node:fs/promises";import*as C from"node:path";var xe=[/\.\./,/%2e%2e/i,/%252e%252e/i,/\.\.%2f/i,/%2f\.\./i,/\.\.%5c/i,/\.\.\\/,/%c0%ae/i,/%c0%2f/i,/%c1%9c/i,/\0/,/%00/i],ve=[/^\/etc\//i,/^\/proc\//i,/^\/sys\//i,/^\/dev\//i,/^\/root\//i,/^\/home\/.+\/\./i,/^[A-Z]:\\Windows/i,/^[A-Z]:\\System/i,/^[A-Z]:\\Users\\.+\\AppData/i],ie=class{name="path-traversal";getRiskLevel(){return"critical"}validate(e,t={}){let{basePath:s="",allowAbsolute:n=!1,allowedExtensions:r=[],deniedExtensions:o=[".exe",".bat",".cmd",".sh",".ps1",".dll",".so"],maxDepth:i=10,maxLength:a=4096}=t;if(e.length>a)return{valid:!1,error:`Path exceeds maximum length of ${a}`,riskLevel:"medium"};for(let g of xe)if(g.test(e))return{valid:!1,error:"Path traversal attempt detected",riskLevel:"critical"};if(!n&&(e.startsWith("/")||/^[A-Z]:/i.test(e)))return{valid:!1,error:"Absolute paths are not allowed",riskLevel:"high"};for(let g of ve)if(g.test(e))return{valid:!1,error:"Access to system paths is not allowed",riskLevel:"critical"};let c=this.normalizePath(e);if(c.includes(".."))return{valid:!1,error:"Path traversal detected after normalization",riskLevel:"critical"};if(c.split("/").filter(Boolean).length>i)return{valid:!1,error:`Path depth exceeds maximum of ${i}`,riskLevel:"low"};let d=this.getExtension(c);if(d){let g=`.${d.toLowerCase()}`,f=d.toLowerCase();if(o.length>0&&o.some(y=>y.toLowerCase()===g||y.toLowerCase()===f))return{valid:!1,error:`File extension '${d}' is not allowed`,riskLevel:"high"};if(r.length>0&&!r.some(y=>y.toLowerCase()===g||y.toLowerCase()===f))return{valid:!1,error:`File extension '${d}' is not in allowed list`,riskLevel:"medium"}}let u=s?this.joinPathsAbsolute(s,c):c,m=s.startsWith("/")?`/${this.normalizePath(s)}`:this.normalizePath(s);return s&&!u.startsWith(m)?{valid:!1,error:"Path escapes base directory",riskLevel:"critical"}:{valid:!0,normalizedPath:u,riskLevel:"none"}}normalizePath(e){let t=e.replace(/\\/g,"/");t=t.replace(/\/+/g,"/");let s=t.split("/"),n=[];for(let r of s)r==="."||r===""||(r===".."?n.length>0&&n[n.length-1]!==".."&&n.pop():n.push(r));return n.join("/")}joinPaths(...e){return e.length===0?"":e.map(t=>t.replace(/^\/+/,"").replace(/\/+$/,"")).filter(Boolean).join("/")}joinPathsAbsolute(...e){if(e.length===0)return"";let t=e[0].startsWith("/"),s=e.map(n=>{for(;n.startsWith("/");)n=n.slice(1);for(;n.endsWith("/");)n=n.slice(0,-1);return n}).filter(Boolean).join("/");return t?`/${s}`:s}getExtension(e){let t=e.match(/\.([^./\\]+)$/);return t?t[1]:null}},Ee=new ie,pe=(h,e)=>Ee.validate(h,e);le();var A=class extends Error{constructor(t,s,n,r){super(t);this.filePath=s;this.code=n;this.cause=r;this.name="FileReadError"}},z=class extends Error{constructor(t,s,n){super(t);this.filePath=s;this.cause=n;this.name="JsonParseError"}},T=class extends Error{constructor(t,s,n){super(`Path traversal detected: ${s.join(", ")}`);this.requestedPath=t;this.issues=s;this.riskLevel=n;this.name="PathTraversalError"}},ae=class{constructor(e,t){this.maxSize=e;this.ttlMs=t}cache=new Map;accessOrder=[];get(e){let t=this.cache.get(e);if(t){if(Date.now()-t.timestamp>this.ttlMs){this.delete(e);return}return this.updateAccessOrder(e),t.value}}set(e,t,s){for(this.cache.has(e)&&this.delete(e);this.cache.size>=this.maxSize&&this.accessOrder.length>0;){let n=this.accessOrder.shift();n&&this.cache.delete(n)}this.cache.set(e,{value:t,timestamp:Date.now(),size:s}),this.accessOrder.push(e)}delete(e){let t=this.cache.delete(e);if(t){let s=this.accessOrder.indexOf(e);s>-1&&this.accessOrder.splice(s,1)}return t}clear(){this.cache.clear(),this.accessOrder=[]}get size(){return this.cache.size}get totalBytes(){let e=0;return this.cache.forEach(t=>{e+=t.size}),e}updateAccessOrder(e){let t=this.accessOrder.indexOf(e);t>-1&&(this.accessOrder.splice(t,1),this.accessOrder.push(e))}prune(){let e=Date.now(),t=0,s=[];return this.cache.forEach((n,r)=>{e-n.timestamp>this.ttlMs&&s.push(r)}),s.forEach(n=>{this.delete(n),t++}),t}};function Ie(h){let e="",t=0;for(;t<h.length;){let s=h[t],n=h[t+1];s==="*"&&n==="*"?h[t+2]==="/"?(e+="(?:.*/)?",t+=3):(e+=".*",t+=2):s==="*"?(e+="[^/]*",t++):s==="?"?(e+="[^/]",t++):".+^${}()|[]\\".includes(s)?(e+="\\"+s,t++):(e+=s,t++)}return new RegExp("^"+e+"$")}async function ue(h,e,t,s){try{let n=await M.readdir(h,{withFileTypes:!0});for(let r of n){let o=C.join(h,r.name),i=C.relative(s,o);if(r.isDirectory())r.name!=="node_modules"&&!r.name.startsWith(".")&&await ue(o,e,t,s);else if(r.isFile()){let a=i.replace(/\\/g,"/");e.test(a)&&t.push(o)}}}catch(n){console.debug("[FileReader] Directory read error:",n instanceof Error?n.message:n)}}var k=class{basePath;cache;enableCache;stats={cacheHits:0,cacheMisses:0,totalReads:0,cacheSize:0,cacheEntries:0};constructor(e={}){this.basePath=e.basePath??process.cwd(),this.enableCache=e.enableCache??!0,this.cache=new ae(e.maxCacheSize??100,e.cacheTtlMs??300*1e3)}resolvePath(e){let t=C.isAbsolute(e),s=pe(e,{basePath:t?"":this.basePath,allowAbsolute:!0,deniedExtensions:[".exe",".bat",".cmd",".ps1",".dll",".so"]});if(!s.valid)throw new T(e,[s.error||"Path validation failed"],s.riskLevel);if(t&&this.basePath){let n=C.resolve(this.basePath),r=C.resolve(e);if(!r.startsWith(n))throw new T(e,["Path escapes base directory"],"critical");return r}return s.normalizedPath?s.normalizedPath:t?e:C.resolve(this.basePath,e)}async readFile(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof T)return L(s);throw s}if(this.stats.totalReads++,this.enableCache){let s=this.cache.get(t);if(s!==void 0)return this.stats.cacheHits++,this.updateCacheStats(),w(s);this.stats.cacheMisses++}try{let s=await M.readFile(t,"utf-8");return this.enableCache&&(this.cache.set(t,s,Buffer.byteLength(s,"utf-8")),this.updateCacheStats()),w(s)}catch(s){let n=s,r;switch(n.code){case"ENOENT":r="File not found: "+t;break;case"EACCES":r="Permission denied: "+t;break;case"EISDIR":r="Path is a directory: "+t;break;default:r="Failed to read file: "+t}return L(new A(r,t,n.code,n))}}async readJSON(e){let t=await this.readFile(e);if(!t.success)return t;try{let s=N(t.value);return w(s)}catch(s){let n=s,r=e;try{r=this.resolvePath(e)}catch{}return L(new z("Invalid JSON in file: "+r+" - "+n.message,r,n))}}async fileExists(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof T)return L(s);throw s}try{return await M.access(t,M.constants.F_OK),w(!0)}catch(s){let n=s;return n.code==="ENOENT"?w(!1):L(new A("Cannot check file existence: "+t,t,n.code,n))}}async listFiles(e,t){let s;try{s=t?this.resolvePath(t):this.basePath}catch(n){if(n instanceof T)return L(n);throw n}try{if(!(await M.stat(s)).isDirectory())return L(new A("Base path is not a directory: "+s,s,"ENOTDIR"));let r=Ie(e),o=[];return await ue(s,r,o,s),o.sort(),w(o)}catch(n){let r=n;return L(new A("Failed to list files in: "+s,s,r.code,r))}}invalidateCache(e){let t=this.resolvePath(e);this.cache.delete(t),this.updateCacheStats()}clearCache(){this.cache.clear(),this.updateCacheStats()}pruneCache(){let e=this.cache.prune();return this.updateCacheStats(),e}getStats(){return{...this.stats}}resetStats(){this.stats={cacheHits:0,cacheMisses:0,totalReads:0,cacheSize:this.cache.totalBytes,cacheEntries:this.cache.size}}updateCacheStats(){this.stats.cacheSize=this.cache.totalBytes,this.stats.cacheEntries=this.cache.size}};V();var v={MODEL:"all-MiniLM-L6-v2",DIMENSIONS:384,CONTEXT_WINDOW:8192,BATCH_SIZE:100,MAX_RETRIES:3,RETRY_DELAY_MS:1e3,TIMEOUT_MS:3e4,DEFAULT_OLLAMA_URL:"http://localhost:11434"};var K=class{baseUrl;maxRetries;retryDelayMs;timeoutMs;constructor(e=v.DEFAULT_OLLAMA_URL,t=v.MAX_RETRIES,s=v.RETRY_DELAY_MS,n=v.TIMEOUT_MS){this.baseUrl=e.replace(/\/$/,""),this.maxRetries=t,this.retryDelayMs=s,this.timeoutMs=n}async healthCheck(){try{let e=await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3);if(!e.ok)return!1;let t=await e.json();return t.models?t.models.some(s=>s.name?.startsWith(v.MODEL)||s.model?.startsWith(v.MODEL)):!1}catch{return!1}}async generateEmbedding(e){let t={model:v.MODEL,prompt:e},s=null;for(let n=0;n<this.maxRetries;n++)try{let r=await this.fetchWithTimeout(`${this.baseUrl}/api/embeddings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},this.timeoutMs);if(!r.ok){let i=await r.text();throw new Error(`Ollama API error (${r.status}): ${i}`)}let o=await r.json();if(o.embedding.length!==v.DIMENSIONS)throw new Error(`Invalid embedding dimensions: expected ${v.DIMENSIONS}, got ${o.embedding.length}`);return o.embedding}catch(r){if(s=D(r),s.message.includes("Invalid embedding dimensions"))throw s;if(n<this.maxRetries-1){let o=this.retryDelayMs*Math.pow(2,n);await this.sleep(o)}}throw new Error(`Failed to generate embedding after ${this.maxRetries} attempts: ${s?.message}`)}async fetchWithTimeout(e,t,s){let n=new AbortController,r=setTimeout(()=>n.abort(),s);try{return await fetch(e,{...t,signal:n.signal})}finally{clearTimeout(r)}}sleep(e){return new Promise(t=>setTimeout(t,e))}async getServerInfo(){try{let e=await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3);return e.ok?await e.json():null}catch{return null}}async ensureModelAvailable(){if(!await this.healthCheck())throw new Error(`Ollama model '${v.MODEL}' is not available. Please run: ollama pull ${v.MODEL}`)}};import{createHash as Pe}from"crypto";var U=class{cache;maxSize;hits;misses;constructor(e=1e4){this.cache=new Map,this.maxSize=e,this.hits=0,this.misses=0}hashContent(e,t){return Pe("sha256").update(`${t}:${e}`).digest("hex")}get(e,t){let s=this.hashContent(e,t),n=this.cache.get(s);return n?(this.hits++,this.cache.delete(s),this.cache.set(s,n),n.embedding):(this.misses++,null)}set(e,t,s){let n=this.hashContent(e,t);if(this.cache.size>=this.maxSize&&!this.cache.has(n)){let o=this.cache.keys().next().value;o&&this.cache.delete(o)}let r={embedding:s,timestamp:Date.now(),model:t};this.cache.set(n,r)}has(e,t){let s=this.hashContent(e,t);return this.cache.has(s)}getStats(){let e=this.hits+this.misses,t=e>0?this.hits/e:0;return{size:this.cache.size,hitRate:t,hits:this.hits,misses:this.misses}}clear(){this.cache.clear(),this.hits=0,this.misses=0}evictOlderThan(e){let s=Date.now()-e,n=0;for(let[r,o]of this.cache.entries())o.timestamp<s&&(this.cache.delete(r),n++);return n}getMemoryUsageEstimate(){return this.cache.size*3172}export(){return Array.from(this.cache.entries()).map(([e,t])=>({key:e,entry:t}))}import(e){this.cache.clear();for(let{key:t,entry:s}of e)this.cache.size<this.maxSize&&this.cache.set(t,s)}};V();var _=class{client;cache;batchSize;enableFallback;ollamaAvailable=null;constructor(e={}){this.client=new K(e.ollamaBaseUrl),this.cache=e.cache??new U(e.maxCacheSize),this.batchSize=e.batchSize??v.BATCH_SIZE,this.enableFallback=e.enableFallback??!0}async embed(e){let t=this.cache.get(e,v.MODEL);if(t)return t;let s;if(await this.isOllamaAvailable())s=await this.client.generateEmbedding(e);else if(this.enableFallback)s=this.generatePseudoEmbedding(e);else throw new Error(`Ollama is not available and fallback is disabled. Please run: ollama pull ${v.MODEL}`);return this.cache.set(e,v.MODEL,s),s}formatForEmbedding(e){let t=[];e.language&&t.push(e.language),e.type&&t.push(e.type),e.name&&t.push(e.name);let s=t.length>0?`${t.join(" ")}: `:"",n=v.CONTEXT_WINDOW*4,r=e.content.trim();if(s.length+r.length>n){let o=n-s.length-3;r=r.substring(0,o)+"..."}return s+r}async embedBatch(e){let t=[];for(let s of e){let n=await this.embed(s);t.push(n)}return t}async embedCodeChunks(e,t){let s=Date.now(),n=[],r=0,o=0,i=await this.isOllamaAvailable();if(i)await this.client.ensureModelAvailable();else if(!this.enableFallback)throw new Error(`Ollama is not available and fallback is disabled. Please run: ollama pull ${v.MODEL}`);for(let c=0;c<e.length;c+=this.batchSize){let l=e.slice(c,Math.min(c+this.batchSize,e.length)),d=await this.processBatch(l,i);n.push(...d);for(let u of d)u.cached?r++:o++;if(t){let u=c+l.length,m=e.length,f=(Date.now()-s)/u,y=(m-u)*f;t({current:u,total:m,percentage:u/m*100,estimatedTimeRemainingMs:y})}}let a=Date.now()-s;return{results:n,stats:{totalChunks:e.length,cachedHits:r,computedNew:o,totalTimeMs:a,avgTimePerChunk:a/e.length}}}async processBatch(e,t){let s=[],n=e.map(async o=>{let i=this.formatForEmbedding(o),a=Date.now(),c=this.cache.get(i,v.MODEL);if(c)return{chunkId:o.id,embedding:c,model:v.MODEL,cached:!0,computeTimeMs:Date.now()-a};try{let l;return t?l=await this.client.generateEmbedding(i):l=this.generatePseudoEmbedding(i),this.cache.set(i,v.MODEL,l),{chunkId:o.id,embedding:l,model:t?v.MODEL:"pseudo-embedding",cached:!1,computeTimeMs:Date.now()-a}}catch(l){throw new Error(`Failed to generate embedding for chunk ${o.id}: ${j(l)}`)}}),r=await Promise.all(n);return s.push(...r),s}async isOllamaAvailable(){return this.ollamaAvailable!==null?this.ollamaAvailable:(this.ollamaAvailable=await this.client.healthCheck(),this.ollamaAvailable)}resetOllamaCheck(){this.ollamaAvailable=null}generatePseudoEmbedding(e){let t=new Array(v.DIMENSIONS).fill(0),s=e.split(/\s+|[^\w]+/).filter(o=>o.length>0);for(let o=0;o<s.length;o++){let i=s[o];for(let a=0;a<i.length&&a<t.length;a++)t[(o+a)%t.length]+=i.charCodeAt(a)/1e3}let n=[[/class\s+\w+/,0],[/function\s+\w+/,1],[/async\s+|await\s+|Promise/,2],[/interface\s+\w+/,3],[/export\s+/,4],[/import\s+/,5],[/try\s*{/,6],[/\.(map|filter|reduce)\(/,7]];for(let[o,i]of n)o.test(e)&&(t[i]+=.5);let r=Math.sqrt(t.reduce((o,i)=>o+i*i,0))||1;return t.map(o=>o/r)}clearCache(){this.cache.clear()}getCacheStats(){return this.cache.getStats()}async healthCheck(){return await this.client.healthCheck()}async getServerInfo(){return await this.client.getServerInfo()}getDimensions(){return v.DIMENSIONS}getConfig(){return{model:v.MODEL,dimensions:v.DIMENSIONS,contextWindow:v.CONTEXT_WINDOW,batchSize:this.batchSize,maxRetries:v.MAX_RETRIES,enableFallback:this.enableFallback}}};V();le();var we={maxNodes:1e5,maxEdgesPerNode:500,namespace:"code-intelligence:kg",enableVectorEmbeddings:!0,embeddingDimension:384,enableLLMExtraction:!0,llmModelTier:2,llmMaxTokens:2048},me=oe.create("code-intelligence/knowledge-graph"),he=class{config;memory;nodeCache=new Map;edgeIndex=new Map;tsParser;fileReader;embedder;llmRouter;constructor(e,t={}){this.config={...we,...t},this.isKnowledgeGraphDependencies(e)?(this.memory=e.memory,this.llmRouter=e.llmRouter):(this.memory=e,this.llmRouter=void 0),this.tsParser=new F,this.fileReader=new k,this.embedder=new _({enableFallback:!0})}isKnowledgeGraphDependencies(e){return e.memory!==void 0}async index(e){let t=Date.now(),s=[],n=0,r=0;try{let{paths:o,incremental:i=!1,includeTests:a=!0,languages:c}=e;i||await this.clear();for(let d of o)try{if(c&&c.length>0){let m=this.getFileExtension(d);if(!this.matchesLanguage(m,c))continue}if(!a&&this.isTestFile(d))continue;let u=await this.indexFile(d);n+=u.nodes,r+=u.edges}catch(u){s.push({file:d,error:j(u)})}let l=Date.now()-t;return await this.storeIndexMetadata({filesIndexed:o.length-s.length,nodesCreated:n,edgesCreated:r,duration:l,indexedAt:new Date().toISOString()}),w({filesIndexed:o.length-s.length,nodesCreated:n,edgesCreated:r,duration:l,errors:s})}catch(o){return L(D(o))}}async query(e){try{let{query:t,type:s,limit:n=100}=e;return s==="cypher"?this.executeCypherQuery(t,n):this.executeNaturalLanguageQuery(t,n)}catch(t){return L(D(t))}}async mapDependencies(e){try{let{files:t,direction:s,depth:n=3}=e,r=[],o=[],i=new Set,a=[];for(let l of t)await this.traverseDependencies(l,s,n,i,r,o,[],a);let c=this.calculateDependencyMetrics(r,o);return w({nodes:r,edges:o,cycles:a,metrics:c})}catch(t){return L(D(t))}}async getNode(e){if(this.nodeCache.has(e))return this.nodeCache.get(e);let t=`${this.config.namespace}:node:${e}`,s=await this.memory.get(t);return s&&this.nodeCache.set(e,s),s}async getEdges(e,t){let s=[],n=this.edgeIndex.get(e);if(n)return this.filterEdgesByDirection(n,e,t);let r=`${this.config.namespace}:edge:*`,o=await this.memory.search(r,this.config.maxEdgesPerNode*2);for(let i of o){let a=await this.memory.get(i);a&&(t!=="outgoing"&&a.target===e||t!=="incoming"&&a.source===e)&&s.push(a)}return s}async clear(){this.nodeCache.clear(),this.edgeIndex.clear()}isLLMExtractionAvailable(){return this.config.enableLLMExtraction===!0&&this.llmRouter!==void 0}getModelForTier(e){switch(e){case 1:return"claude-3-5-haiku-20241022";case 2:return"claude-sonnet-4-20250514";case 3:return"claude-sonnet-4-20250514";case 4:return"claude-opus-4-5-20251101";default:return"claude-sonnet-4-20250514"}}async extractRelationshipsWithLLM(e,t){if(!this.llmRouter)return{semanticRelationships:[],designPatterns:[],architecturalBoundaries:[],dependencyImpacts:[]};try{let s=this.buildRelationshipExtractionPrompt(e,t),n=this.getModelForTier(this.config.llmModelTier??2),r=await this.llmRouter.chat({messages:[{role:"system",content:`You are an expert software architect analyzing code structure. Extract:
24
+ 1. Semantic relationships between code entities (inheritance, composition, dependency, collaboration)
25
+ 2. Design patterns used (Factory, Singleton, Observer, Strategy, etc.)
26
+ 3. Architectural boundaries (layers, modules, domains)
27
+ 4. Dependency impact analysis (which changes would affect which components)
28
+
29
+ Return a JSON object with:
30
+ {
31
+ "semanticRelationships": [{"source": "...", "target": "...", "type": "...", "description": "..."}],
32
+ "designPatterns": [{"pattern": "...", "participants": ["..."], "location": "...", "confidence": 0.0-1.0}],
33
+ "architecturalBoundaries": [{"name": "...", "type": "layer|module|domain", "entities": ["..."]}],
34
+ "dependencyImpacts": [{"entity": "...", "impactedBy": ["..."], "impacts": ["..."], "severity": "low|medium|high"}]
35
+ }
36
+
37
+ Be precise and only report high-confidence findings.`},{role:"user",content:s}],model:n,maxTokens:this.config.llmMaxTokens??2048,temperature:.2});return r.content?this.parseLLMRelationshipResponse(r.content):{semanticRelationships:[],designPatterns:[],architecturalBoundaries:[],dependencyImpacts:[]}}catch{return me.warn("LLM relationship extraction failed:"),{semanticRelationships:[],designPatterns:[],architecturalBoundaries:[],dependencyImpacts:[]}}}buildRelationshipExtractionPrompt(e,t){let s=`## Code to Analyze:
38
+ \`\`\`typescript
39
+ ${e}
40
+ \`\`\`
41
+
42
+ `;if(t.length>0){s+=`## Already Identified Entities:
43
+ `;for(let n of t)s+=`- ${n.type}: ${n.name} (line ${n.line}, ${n.visibility})
44
+ `;s+=`
45
+ `}return s+=`## Analysis Requirements:
46
+ `,s+=`1. Identify semantic relationships between the entities above
47
+ `,s+=`2. Detect any design patterns in use
48
+ `,s+=`3. Identify architectural boundaries or layers
49
+ `,s+=`4. Analyze which entities would be impacted by changes to others
50
+ `,s}parseLLMRelationshipResponse(e){try{let t=e.match(/\{[\s\S]*\}/);if(t){let s=N(t[0]);return{semanticRelationships:Array.isArray(s.semanticRelationships)?s.semanticRelationships:[],designPatterns:Array.isArray(s.designPatterns)?s.designPatterns:[],architecturalBoundaries:Array.isArray(s.architecturalBoundaries)?s.architecturalBoundaries:[],dependencyImpacts:Array.isArray(s.dependencyImpacts)?s.dependencyImpacts:[]}}}catch{}return{semanticRelationships:[],designPatterns:[],architecturalBoundaries:[],dependencyImpacts:[]}}async enhanceQueryWithLLM(e,t){if(!this.llmRouter||t.length===0)return{enhancedResults:t,insights:[]};try{let s=this.getModelForTier(this.config.llmModelTier??2),n=await this.llmRouter.chat({messages:[{role:"system",content:`You are a code intelligence assistant. Given a query and search results from a knowledge graph, provide:
51
+ 1. Ranking of results by relevance to the query
52
+ 2. Key insights about how the results relate to the query
53
+ 3. Suggestions for related code to explore
54
+
55
+ Return JSON: { "rankedIds": ["id1", "id2", ...], "insights": ["insight1", "insight2", ...] }`},{role:"user",content:`Query: "${e}"
56
+
57
+ Results:
58
+ ${JSON.stringify(t.map(r=>({id:r.id,label:r.label,properties:r.properties})),null,2)}`}],model:s,maxTokens:1024,temperature:.3});if(n.content)try{let r=n.content.match(/\{[\s\S]*\}/);if(r){let o=N(r[0]),i=o.rankedIds||[],a=o.insights||[],c=new Map(t.map(d=>[d.id,d])),l=[];for(let d of i){let u=c.get(d);u&&(l.push(u),c.delete(d))}return l.push(...Array.from(c.values())),{enhancedResults:l,insights:a}}}catch{}return{enhancedResults:t,insights:[]}}catch{return me.warn("LLM query enhancement failed:"),{enhancedResults:t,insights:[]}}}async indexFile(e){let t=0,s=0,n=await this.createFileNode(e);t++;let r=await this.extractEntities(e);for(let i of r){let a=await this.createEntityNode(i,e);t++,await this.createEdge(n.id,a.id,"contains"),s++}let o=await this.extractImports(e);for(let i of o){let a=this.pathToNodeId(i);await this.createEdge(n.id,a,"import"),s++}if(this.isLLMExtractionAvailable()){let i=await this.fileReader.readFile(e);if(i.success){let a=await this.extractRelationshipsWithLLM(i.value,r);s+=await this.storeLLMRelationships(n.id,a)}}return{nodes:t,edges:s}}async storeLLMRelationships(e,t){let s=0;for(let r of t.semanticRelationships){let o=`${e}:*:${r.source}`,i=`${e}:*:${r.target}`;await this.createEdge(o,i,r.type),s++}let n=this.nodeCache.get(e);return n&&(t.designPatterns.length>0&&(n.properties.designPatterns=t.designPatterns),t.architecturalBoundaries.length>0&&(n.properties.architecturalBoundaries=t.architecturalBoundaries),t.dependencyImpacts.length>0&&(n.properties.dependencyImpacts=t.dependencyImpacts),this.nodeCache.set(e,n)),s}async createFileNode(e){let s={id:this.pathToNodeId(e),label:"File",properties:{path:e,name:this.getFileName(e),extension:this.getFileExtension(e),type:this.getFileType(e)}};return await this.storeNode(s),s}async createEntityNode(e,t){let s=`${this.pathToNodeId(t)}:${e.type}:${e.name}`,n={id:s,label:e.type,properties:{name:e.name,file:t,line:e.line,visibility:e.visibility,async:e.isAsync}};if(await this.storeNode(n),this.config.enableVectorEmbeddings){let r=await this.generateEmbedding(e);await this.memory.storeVector(`${this.config.namespace}:node:${s}`,r,{nodeId:s,type:e.type,name:e.name})}return n}async createEdge(e,t,s){let n=`${e}--${s}-->${t}`,r={source:e,target:t,type:s},o=this.edgeIndex.get(e)||[];return o.push(r),this.edgeIndex.set(e,o),r}async storeNode(e){if(this.nodeCache.size>=this.config.maxNodes){let t=this.nodeCache.keys().next().value;t&&(this.nodeCache.delete(t),this.edgeIndex.delete(t))}this.nodeCache.set(e.id,e)}async extractEntities(e){let t=this.getFileExtension(e),s=[];if(["ts","tsx","js","jsx"].includes(t)){let n=await this.fileReader.readFile(e);if(n.success){let r=this.getFileName(e),o=this.tsParser.parseFile(r,n.value),i=this.tsParser.extractFunctions(o);for(let l of i)s.push({type:"function",name:l.name,line:l.startLine,visibility:"public",isAsync:l.isAsync});let a=this.tsParser.extractClasses(o);for(let l of a){s.push({type:"class",name:l.name,line:l.startLine,visibility:"public",isAsync:!1});for(let d of l.methods)s.push({type:"function",name:`${l.name}.${d.name}`,line:d.startLine,visibility:d.visibility,isAsync:d.isAsync})}let c=this.tsParser.extractInterfaces(o);for(let l of c)s.push({type:"interface",name:l.name,line:l.startLine,visibility:"public",isAsync:!1});s.length===0&&s.push({type:"module",name:r.replace(/\.[^.]+$/,""),line:1,visibility:"public",isAsync:!1})}else s.push({type:"module",name:this.getFileName(e).replace(/\.[^.]+$/,""),line:1,visibility:"public",isAsync:!1})}else if(t==="py"){let n=await this.fileReader.readFile(e);if(n.success){let o=n.value.split(`
59
+ `),i=/^class\s+(\w+)\s*(?:\([^)]*\))?\s*:/,a=/^(async\s+)?def\s+(\w+)\s*\(/,c=null,l=0;for(let d=0;d<o.length;d++){let u=o[d],m=d+1,g=u.trimStart(),f=u.length-g.length;c&&f<=l&&(c=null);let x=g.match(i);if(x){let b=x[1];s.push({type:"class",name:b,line:m,visibility:b.startsWith("_")?"private":"public",isAsync:!1}),c=b,l=f;continue}let y=g.match(a);if(y){let b=!!y[1],P=y[2],ge=c!==null&&f>l,B="public";P.startsWith("__")&&!P.endsWith("__")?B="private":P.startsWith("_")&&(B="protected"),s.push({type:"function",name:ge?`${c}.${P}`:P,line:m,visibility:B,isAsync:b})}}s.length===0&&s.push({type:"module",name:this.getFileName(e).replace(".py",""),line:1,visibility:"public",isAsync:!1})}else s.push({type:"module",name:this.getFileName(e).replace(".py",""),line:1,visibility:"public",isAsync:!1})}return s}async extractImports(e){let t=this.getFileExtension(e),s=[];if(["ts","tsx","js","jsx"].includes(t)){let n=await this.fileReader.readFile(e);if(n.success){let r=this.getFileName(e),o=this.tsParser.parseFile(r,n.value),i=this.tsParser.extractImports(o);for(let a of i)a.module.startsWith("node:")||s.push(a.module)}}return s}async executeCypherQuery(e,t){let s=[],n=[],r=new Map,o=/MATCH\s+\((\w+):(\w+)\)\s*-\[(\w+)?:?(\w+)?\]\s*->\s*\((\w+):(\w+)\)/i.exec(e);if(o){let[,a,c,,l,d,u]=o,m=await this.findNodesByLabel(c,t*2);r.set(a,m);for(let g of m.slice(0,t)){let f=await this.getEdges(g.id,"outgoing");for(let x of f){if(l&&x.type!==l)continue;let y=await this.getNode(x.target);y&&y.label===u&&(s.some(b=>b.id===g.id)||s.push(g),s.some(b=>b.id===y.id)||s.push(y),n.some(b=>b.source===x.source&&b.target===x.target&&b.type===x.type)||n.push(x))}}d&&r.set(d,s.filter(g=>g.label===u))}else{let a=/MATCH\s+\((\w+):(\w+)\)/i.exec(e);if(a){let[,c,l]=a,d=await this.findNodesByLabel(l,t);r.set(c,d),s.push(...d)}}let i=/WHERE\s+(\w+)\.(\w+)\s*=\s*['"]?([^'")\s]+)['"]?/i.exec(e);if(i){let[,a,c,l]=i,u=(r.get(a)||s).filter(f=>{let x=f.properties[c];return x!==void 0&&String(x)===l});s.length=0,s.push(...u.slice(0,t));let m=new Set(s.map(f=>f.id)),g=n.filter(f=>m.has(f.source)&&m.has(f.target));n.length=0,n.push(...g)}return w({nodes:s.slice(0,t),edges:n,metadata:{query:e,type:"cypher",resultCount:s.length,edgeCount:n.length}})}async findNodesByLabel(e,t){let s=[],n=`${this.config.namespace}:node:*`,r=await this.memory.search(n,t*2);for(let o of r){let i=await this.memory.get(o);if(i&&i.label===e&&(s.push(i),s.length>=t))break}return s}async executeNaturalLanguageQuery(e,t){if(this.config.enableVectorEmbeddings){let i=await this.generateQueryEmbedding(e),a=await this.memory.vectorSearch(i,t),c=[];for(let l of a){let d=l.metadata?.nodeId;if(d){let u=await this.getNode(d);u&&c.push(u)}}return w({nodes:c,edges:[],metadata:{query:e,type:"natural-language",resultCount:c.length,searchScores:a.map(l=>l.score)}})}let s=e.toLowerCase().split(/\s+/),n=`${this.config.namespace}:node:*`,r=await this.memory.search(n,t*3),o=[];for(let i of r){let a=await this.memory.get(i);if(a){let c=JSON.stringify(a.properties).toLowerCase();if(s.some(l=>c.includes(l))&&(o.push(a),o.length>=t))break}}return w({nodes:o,edges:[],metadata:{query:e,type:"keyword",resultCount:o.length}})}async traverseDependencies(e,t,s,n,r,o,i,a){if(s<=0||n.has(e)){let m=i.indexOf(e);m>=0&&a.push([...i.slice(m),e]);return}n.add(e),i.push(e);let c=this.pathToNodeId(e),l=await this.getEdges(c,t),d=l.filter(m=>m.target===c).length,u=l.filter(m=>m.source===c).length;r.push({id:c,path:e,type:"file",inDegree:d,outDegree:u});for(let m of l){let g={source:m.source,target:m.target,type:m.type};o.some(x=>x.source===g.source&&x.target===g.target)||o.push(g);let f=m.source===c?this.nodeIdToPath(m.target):this.nodeIdToPath(m.source);f&&await this.traverseDependencies(f,t,s-1,n,r,o,i,a)}i.pop()}calculateDependencyMetrics(e,t){let s=e.length,n=t.length,r=s>0?e.reduce((a,c)=>a+c.inDegree+c.outDegree,0)/s:0,o=0;if(e.length>0){let a=new Map;for(let l of t){let d=a.get(l.source)||[];d.push(l.target),a.set(l.source,d)}let c=new Map;for(let l of e)c.has(l.id)||this.bfsDepth(l.id,a,c),o=Math.max(o,c.get(l.id)||0)}let i=n-s+2;return{totalNodes:s,totalEdges:n,avgDegree:Math.round(r*100)/100,maxDepth:o,cyclomaticComplexity:Math.max(1,i)}}bfsDepth(e,t,s){let n=[{id:e,depth:0}];for(;n.length>0;){let r=n.shift(),o=s.get(r.id)??-1;r.depth>o&&s.set(r.id,r.depth);let i=t.get(r.id)||[];for(let a of i)(!s.has(a)||(s.get(a)??0)<r.depth+1)&&n.push({id:a,depth:r.depth+1})}}filterEdgesByDirection(e,t,s){return e.filter(n=>s==="incoming"?n.target===t:s==="outgoing"?n.source===t:!0)}async storeIndexMetadata(e){}async generateEmbedding(e){let t=`${e.type} ${e.name} ${e.visibility}${e.isAsync?" async":""}`;try{return await this.embedder.embed(t)}catch{return this.fallbackEmbedding(t)}}async generateQueryEmbedding(e){try{return await this.embedder.embed(e)}catch{return this.fallbackEmbedding(e)}}fallbackEmbedding(e){let t=new Array(this.config.embeddingDimension).fill(0),s=e.toLowerCase().split(/\s+/);for(let r=0;r<s.length;r++){let o=s[r];for(let i=0;i<o.length&&i<t.length;i++)t[(r+i)%t.length]+=o.charCodeAt(i)/1e3}let n=Math.sqrt(t.reduce((r,o)=>r+o*o,0))||1;return t.map(r=>r/n)}pathToNodeId(e){return e.replace(/[/\\]/g,":").replace(/\./g,"_")}nodeIdToPath(e){let t=e.replace(/:/g,"/").replace(/_(?=[^_]*$)/,".");return t.includes("/")?t:null}getFileName(e){return e.split(/[/\\]/).pop()||e}getFileExtension(e){let s=this.getFileName(e).split(".");return s.length>1?s.pop():""}getFileType(e){let t=this.getFileExtension(e);return{ts:"typescript",tsx:"typescript-react",js:"javascript",jsx:"javascript-react",py:"python",go:"go",java:"java",rs:"rust",rb:"ruby",cs:"csharp",swift:"swift"}[t]||"unknown"}matchesLanguage(e,t){let s={typescript:["ts","tsx"],javascript:["js","jsx"],python:["py"],go:["go"],java:["java"],rust:["rs"],csharp:["cs"],swift:["swift"]};return t.some(n=>(s[n.toLowerCase()]||[n]).includes(e))}isTestFile(e){return[/\.test\.[tj]sx?$/,/\.spec\.[tj]sx?$/,/_test\.[tj]sx?$/,/test_.*\.py$/,/.*_test\.py$/,/.*_test\.go$/].some(s=>s.test(e))}destroy(){this.nodeCache.clear(),this.edgeIndex.clear()}};export{p as a,De as b,v as c,_ as d,F as e,k as f,he as g};
@@ -0,0 +1,3 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{c}from"./chunk-UZZCWWIG.js";function u(r){switch(r.toUpperCase()){case"DEBUG":return 0;case"INFO":return 1;case"WARN":case"WARNING":return 2;case"ERROR":return 3;case"SILENT":case"NONE":case"OFF":return 4;default:return 1}}var f,l=c(()=>{"use strict";f={0:"DEBUG",1:"INFO",2:"WARN",3:"ERROR",4:"SILENT"}});var a,s,g,d=c(()=>{"use strict";l();a={includeTimestamp:!0,includeLevel:!0,timestampFormat:"short",prettyPrint:!1,maxContextDepth:3},s=class r{domain;level;config;inheritedContext;constructor(e,n=1,o={},t={}){this.domain=e,this.level=n,this.config={...a,...o},this.inheritedContext=t}debug(e,n){this.level<=0&&this.output(0,e,n)}info(e,n){this.level<=1&&this.output(1,e,n)}warn(e,n){this.level<=2&&this.output(2,e,n)}error(e,n,o){if(this.level<=3){let t={...o};if(n){t.errorName=n.name,t.errorMessage=n.message,n.stack&&(t.stack=n.stack);let i=n;i.cause!==void 0&&(t.cause=String(i.cause))}this.output(3,e,t)}}isEnabled(e){return this.level<=e}getDomain(){return this.domain}child(e){return new r(this.domain,this.level,this.config,{...this.inheritedContext,...e})}output(e,n,o){let t=this.format(e,n,o);switch(e){case 0:console.debug(t);break;case 1:console.info(t);break;case 2:console.warn(t);break;case 3:console.error(t);break}}format(e,n,o){let t=[];this.config.includeTimestamp&&t.push(this.formatTimestamp()),this.config.includeLevel&&t.push(this.formatLevel(e)),t.push(`[${this.domain}]`),t.push(n);let i=this.mergeContext(o);return i&&Object.keys(i).length>0&&t.push(this.formatContext(i)),t.join(" ")}formatTimestamp(){let e=new Date;if(this.config.timestampFormat==="iso")return`[${e.toISOString()}]`;let n=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),t=String(e.getSeconds()).padStart(2,"0"),i=String(e.getMilliseconds()).padStart(3,"0");return`[${n}:${o}:${t}.${i}]`}formatLevel(e){return`[${f[e].padEnd(5)}]`}mergeContext(e){if(!(!e&&Object.keys(this.inheritedContext).length===0))return{...this.inheritedContext,...e}}formatContext(e){try{return this.config.prettyPrint?`
3
+ `+JSON.stringify(e,this.createReplacer(),2):JSON.stringify(e,this.createReplacer())}catch{return"[unserializable context]"}}createReplacer(){let e=new WeakSet,n=0;return(o,t)=>{if(typeof t=="object"&&t!==null){if(n>=this.config.maxContextDepth)return"[object]";if(e.has(t))return"[circular]";e.add(t),n++}return t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:typeof t=="bigint"?t.toString():typeof t=="function"?"[function]":typeof t=="symbol"?t.toString():t}}},g=class{domain;constructor(e="null"){this.domain=e}debug(e,n){}info(e,n){}warn(e,n){}error(e,n,o){}isEnabled(e){return!1}getDomain(){return this.domain}child(e){return this}}});function F(r,e){return L.create(r,e)}var v,L,m=c(()=>{"use strict";l();d();v={defaultLevel:1,domainLevels:new Map,consoleConfig:a,silent:!1},L=class{static config={...v};static customProvider=null;static instances=new Map;static setLevel(e){this.config.defaultLevel=e,this.instances.clear()}static setLevelFromString(e){this.setLevel(u(e))}static getLevel(){return this.config.defaultLevel}static setDomainLevel(e,n){this.config.domainLevels.set(e,n),this.instances.delete(e)}static getDomainLevel(e){return this.config.domainLevels.get(e)??this.config.defaultLevel}static clearDomainLevel(e){this.config.domainLevels.delete(e),this.instances.delete(e)}static configure(e){this.config.consoleConfig={...this.config.consoleConfig,...e},this.instances.clear()}static setSilent(e){this.config.silent=e,this.instances.clear()}static isSilent(){return this.config.silent}static setProvider(e){this.customProvider=e,this.instances.clear()}static create(e,n){if(!n&&this.instances.has(e))return this.instances.get(e);let o=this.getDomainLevel(e),t;return this.config.silent?t=new g(e):this.customProvider?t=this.customProvider(e,o,n):t=new s(e,o,this.config.consoleConfig,n),n||this.instances.set(e,t),t}static getLogger(e,n){return this.create(e,n)}static reset(){this.config={defaultLevel:1,domainLevels:new Map,consoleConfig:{...a},silent:!1},this.customProvider=null,this.instances.clear()}static initFromEnv(){let e=process.env.LOG_LEVEL;e&&this.setLevelFromString(e);let n=process.env.LOG_TIMESTAMP;n!==void 0&&this.configure({includeTimestamp:n.toLowerCase()==="true"});let o=process.env.LOG_PRETTY;o!==void 0&&this.configure({prettyPrint:o.toLowerCase()==="true"})}static getStats(){return{cachedLoggers:this.instances.size,domains:Array.from(this.instances.keys()),domainOverrides:this.config.domainLevels.size,currentLevel:this.config.defaultLevel,silent:this.config.silent}}}});export{l as a,d as b,L as c,F as d,m as e};
@@ -0,0 +1,45 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{c as t}from"./chunk-UZZCWWIG.js";function o(e){try{return e.prepare(`
3
+ SELECT COUNT(*) as count FROM sqlite_master
4
+ WHERE type='table' AND name IN ('hypergraph_nodes', 'hypergraph_edges')
5
+ `).get().count===2}catch{return!1}}var r,a,E,n,p=t(()=>{"use strict";r=`
6
+ -- Hypergraph nodes (functions, modules, tests, files, classes)
7
+ CREATE TABLE IF NOT EXISTS hypergraph_nodes (
8
+ id TEXT PRIMARY KEY,
9
+ type TEXT NOT NULL, -- 'function', 'module', 'test', 'file', 'class'
10
+ name TEXT NOT NULL,
11
+ file_path TEXT,
12
+ line_start INTEGER,
13
+ line_end INTEGER,
14
+ complexity REAL,
15
+ coverage REAL,
16
+ metadata TEXT, -- JSON
17
+ embedding BLOB, -- Vector embedding
18
+ created_at TEXT DEFAULT (datetime('now')),
19
+ updated_at TEXT DEFAULT (datetime('now'))
20
+ );
21
+ `,a=`
22
+ -- Hypergraph edges (relationships)
23
+ CREATE TABLE IF NOT EXISTS hypergraph_edges (
24
+ id TEXT PRIMARY KEY,
25
+ source_id TEXT NOT NULL REFERENCES hypergraph_nodes(id),
26
+ target_id TEXT NOT NULL REFERENCES hypergraph_nodes(id),
27
+ type TEXT NOT NULL, -- 'calls', 'imports', 'tests', 'depends_on', 'covers'
28
+ weight REAL DEFAULT 1.0,
29
+ properties TEXT, -- JSON
30
+ created_at TEXT DEFAULT (datetime('now')),
31
+ UNIQUE(source_id, target_id, type)
32
+ );
33
+ `,E=`
34
+ -- Indexes for fast traversal
35
+ CREATE INDEX IF NOT EXISTS idx_hg_nodes_type ON hypergraph_nodes(type);
36
+ CREATE INDEX IF NOT EXISTS idx_hg_nodes_file ON hypergraph_nodes(file_path);
37
+ CREATE INDEX IF NOT EXISTS idx_hg_nodes_name ON hypergraph_nodes(name);
38
+ CREATE INDEX IF NOT EXISTS idx_hg_edges_source ON hypergraph_edges(source_id);
39
+ CREATE INDEX IF NOT EXISTS idx_hg_edges_target ON hypergraph_edges(target_id);
40
+ CREATE INDEX IF NOT EXISTS idx_hg_edges_type ON hypergraph_edges(type);
41
+ `,n=`
42
+ ${r}
43
+ ${a}
44
+ ${E}
45
+ `});export{r as a,a as b,E as c,n as d,o as e,p as f};
@@ -0,0 +1,3 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{a as L}from"./chunk-5LDBKZ6P.js";import*as w from"fs";var R={"aqe test generate":{domain:"test-generation",action:"generateTests"},"aqe test execute":{domain:"test-execution",action:"execute"},"aqe coverage analyze":{domain:"coverage-analysis",action:"analyze"},"aqe coverage gaps":{domain:"coverage-analysis",action:"detectGaps"},"aqe quality gate":{domain:"quality-assessment",action:"evaluateGate"},"aqe quality assess":{domain:"quality-assessment",action:"analyzeQuality"},"aqe security scan":{domain:"security-compliance",action:"runSASTScan"},"aqe security audit":{domain:"security-compliance",action:"runAudit"},"aqe defect predict":{domain:"defect-intelligence",action:"predictDefects"},"aqe code index":{domain:"code-intelligence",action:"index"},"aqe code impact":{domain:"code-intelligence",action:"analyzeImpact"},"aqe contract validate":{domain:"contract-testing",action:"validateContract"},"aqe chaos test":{domain:"chaos-resilience",action:"runChaosTest"},"aqe requirements validate":{domain:"requirements-validation",action:"validateRequirements"},"aqe visual test":{domain:"visual-accessibility",action:"runVisualTest"},"aqe accessibility test":{domain:"visual-accessibility",action:"runAccessibilityTest"},"aqe learn optimize":{domain:"learning-optimization",action:"optimizeAllStrategies"}},D={daily:"0 0 * * *",weekly:"0 0 * * 0",hourly:"0 * * * *",minutely:"* * * * *"},S=1e4,x=20,M=1e4,W=["__proto__","constructor","prototype"];function v(t){return!W.includes(t)}function C(t){let n=t.split(`
3
+ `);if(n.length>S)throw new Error(`YAML content exceeds maximum allowed lines (${S}). File has ${n.length} lines.`);for(let i=0;i<n.length;i++)if(n[i].length>M)throw new Error(`YAML line ${i+1} exceeds maximum allowed length (${M} characters).`);let a={};for(let i=0;i<n.length;i++){let e=n[i];if(e.trim()===""||e.trim().startsWith("#")||e.search(/\S/)!==0)continue;let o=e.match(/^([\w_-]+):\s*(.+)$/);if(o){let[,c,u]=o;v(c)&&(a[c]=f(u))}}let r=["tags","stages","triggers"];for(let i of r){let e=new RegExp(`^${i}:\\s*$`),s=-1;for(let l=0;l<n.length;l++){let d=n[l];if(!(d.trim()===""||d.trim().startsWith("#"))&&e.test(d.trim())){s=l;break}}if(s===-1)continue;let o=[];a[i]=o;let c=n[s].search(/\S/),u=s+1;for(;u<n.length;){let l=n[u];if(l.trim()===""||l.trim().startsWith("#")){u++;continue}let d=l.search(/\S/),p=l.trim();if(d<=c&&!p.startsWith("-"))break;if(p.startsWith("- ")){let m=p.slice(2).trim();if(!m.includes(":")){o.push(f(m)),u++;continue}let g={},k=m.match(/^([\w_-]+):\s*(.*)$/);if(k){let[,h,y]=k;g[h]=f(y)}let T=d;for(u++;u<n.length;){let h=n[u];if(h.trim()===""||h.trim().startsWith("#")){u++;continue}let y=h.search(/\S/),q=h.trim();if(y<=T)break;let _=q.match(/^([\w_-]+):\s*(.*)$/);if(_){let[,A,$]=_;if($===""){let b=E(n,u+1,y,1);g[A]=b.value,u=b.nextLine;continue}else g[A]=f($)}u++}o.push(g)}else u++}}return a}function E(t,n,a,r=0){if(r>x)throw new Error(`YAML nesting exceeds maximum allowed depth (${x}).`);let i={},e=null,s=null,o=n;for(;o<t.length;){let u=t[o];if(u.trim()===""||u.trim().startsWith("#")){o++;continue}let l=u.search(/\S/),d=u.trim();if(l<=a)break;if(d.startsWith("- ")){let m=d.slice(2).trim();s&&!Array.isArray(i[s])&&(i[s]=[]),s?i[s].push(f(m)):(e||(e=[]),e.push(f(m))),o++;continue}let p=d.match(/^([\w_-]+):\s*(.*)$/);if(p){let[,m,g]=p;if(!v(m)){o++;continue}g===""?(s=m,i[m]=[]):(i[m]=f(g),s=null)}o++}if(e&&Object.keys(i).length===0)return{value:e,nextLine:o};let c=Object.keys(i);return c.length===1&&Array.isArray(i[c[0]])?{value:i[c[0]],nextLine:o}:{value:i,nextLine:o}}function f(t){if(t==="")return"";if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t==="true")return!0;if(t==="false")return!1;if(t==="null"||t==="~")return null;let n=Number(t);return!isNaN(n)&&t!==""?n:t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1).split(",").map(r=>f(r.trim())):t}function K(t){let n=[];if(!w.existsSync(t))return{success:!1,errors:[`File not found: ${t}`]};let a;try{a=w.readFileSync(t,"utf-8")}catch(r){return{success:!1,errors:[`Failed to read file: ${r}`]}}return Y(a,t)}function Y(t,n){let a=[],r;try{r=C(t)}catch(s){return{success:!1,errors:[`Invalid YAML syntax: ${s}`]}}if((!r.name||typeof r.name!="string")&&a.push('Pipeline must have a "name" field'),(!r.stages||!Array.isArray(r.stages))&&a.push('Pipeline must have a "stages" array'),a.length>0)return{success:!1,errors:a};let i={name:r.name,description:r.description,version:r.version||"1.0.0",schedule:r.schedule,stages:r.stages.map((s,o)=>{let c=s;return{name:c.name||`stage-${o}`,command:c.command,params:c.params,depends_on:c.depends_on,condition:c.condition,timeout:c.timeout,retry:c.retry,continue_on_failure:c.continue_on_failure}}),triggers:r.triggers,tags:r.tags,timeout:r.timeout};for(let s=0;s<i.stages.length;s++){let o=i.stages[s];o.command||a.push(`Stage ${s+1} (${o.name}) must have a "command" field`)}if(a.length>0)return{success:!1,pipeline:i,errors:a};let e=O(i,n);return{success:!0,pipeline:i,workflow:e,errors:[]}}function O(t,n){let a=`pipeline-${t.name.replace(/\s+/g,"-").toLowerCase()}`,r=t.stages.map((e,s)=>{let o=P(e.command),c={};if(e.params)for(let[l,d]of Object.entries(e.params))v(l)&&(c[l]=`input.${l}`);let u={id:`stage-${e.name.replace(/\s+/g,"-").toLowerCase()}`,name:e.name,domain:o.domain,action:o.action,inputMapping:Object.keys(c).length>0?c:void 0,dependsOn:e.depends_on?.map(l=>`stage-${l.replace(/\s+/g,"-").toLowerCase()}`),timeout:e.timeout?e.timeout*1e3:void 0,continueOnFailure:e.continue_on_failure};return e.condition&&(u.condition={path:e.condition.path,operator:e.condition.operator,value:e.condition.value}),e.retry&&(u.retry={maxAttempts:e.retry.max_attempts||3,backoffMs:(e.retry.backoff_seconds||1)*1e3}),u}),i=t.triggers?.map(e=>{let s={eventType:I(e),sourceDomain:e.source_domain};return e.condition&&(s.condition={path:e.condition.path,operator:e.condition.operator,value:e.condition.value}),s});return{id:a,name:t.name,description:t.description||`Pipeline from ${n||"inline YAML"}`,version:t.version||"1.0.0",steps:r,triggers:i,tags:t.tags,timeout:t.timeout?t.timeout*1e3:void 0}}function P(t){let n=t.trim().replace(/\s+/g," ").toLowerCase();for(let[a,r]of Object.entries(R))if(n.startsWith(a.toLowerCase()))return r;return n.includes("test")&&n.includes("generate")?{domain:"test-generation",action:"generateTests"}:n.includes("test")&&(n.includes("execute")||n.includes("run"))?{domain:"test-execution",action:"execute"}:n.includes("coverage")?{domain:"coverage-analysis",action:"analyze"}:n.includes("quality")||n.includes("gate")?{domain:"quality-assessment",action:"evaluateGate"}:n.includes("security")||n.includes("scan")?{domain:"security-compliance",action:"runSASTScan"}:n.includes("defect")||n.includes("predict")?{domain:"defect-intelligence",action:"predictDefects"}:{domain:"learning-optimization",action:"runLearningCycle"}}function I(t){let n=t.event.toLowerCase();return n==="push"?"code-intelligence.CodePushed":n==="pull_request"||n==="pr"?"code-intelligence.PullRequestOpened":n==="schedule"?"workflow.ScheduleTrigger":n==="quality_gate"?"quality-assessment.QualityGateEvaluated":n==="test_complete"?"test-execution.TestRunCompleted":n}function F(t){let n=[],a=[];if(t.name||n.push({path:"name",message:"Pipeline name is required",severity:"error"}),!t.stages||t.stages.length===0)n.push({path:"stages",message:"Pipeline must have at least one stage",severity:"error"});else{let r=new Set;for(let e=0;e<t.stages.length;e++){let s=t.stages[e],o=`stages[${e}]`;if(r.has(s.name)&&n.push({path:`${o}.name`,message:`Duplicate stage name: ${s.name}`,severity:"error"}),r.add(s.name),s.command?P(s.command).domain==="learning-optimization"&&!s.command.toLowerCase().includes("learn")&&a.push({path:`${o}.command`,message:`Command "${s.command}" not recognized, will default to learning-optimization domain`,severity:"warning"}):n.push({path:`${o}.command`,message:"Stage must have a command",severity:"error"}),s.depends_on)for(let c of s.depends_on)t.stages.some(u=>u.name===c)||n.push({path:`${o}.depends_on`,message:`Unknown dependency: ${c}`,severity:"error"});s.timeout!==void 0&&s.timeout<=0&&n.push({path:`${o}.timeout`,message:"Timeout must be a positive number",severity:"error"}),s.retry&&s.retry.max_attempts!==void 0&&s.retry.max_attempts<1&&n.push({path:`${o}.retry.max_attempts`,message:"max_attempts must be at least 1",severity:"error"})}let i=N(t.stages);i&&n.push({path:"stages",message:`Circular dependency detected: ${i}`,severity:"error"})}if(t.schedule&&(z(t.schedule)||n.push({path:"schedule",message:`Invalid cron expression: ${t.schedule}`,severity:"error"})),t.triggers)for(let r=0;r<t.triggers.length;r++){let i=t.triggers[r],e=`triggers[${r}]`;i.event||n.push({path:`${e}.event`,message:"Trigger must have an event type",severity:"error"}),i.source_domain&&!L.includes(i.source_domain)&&a.push({path:`${e}.source_domain`,message:`Unknown domain: ${i.source_domain}`,severity:"warning"})}return{valid:n.length===0,errors:n,warnings:a}}function N(t){let n=new Set,a=new Set,r=(i,e)=>{if(a.has(i))return[...e,i].join(" -> ");if(n.has(i))return null;n.add(i),a.add(i);let s=t.find(o=>o.name===i);if(s?.depends_on)for(let o of s.depends_on){let c=r(o,[...e,i]);if(c)return c}return a.delete(i),null};for(let i of t){let e=r(i.name,[]);if(e)return e}return null}function z(t){if(Object.keys(D).includes(t))return!0;let n=t.trim().split(/\s+/);if(n.length!==5)return!1;let a=[/^(\*|[0-5]?\d)(-[0-5]?\d)?(\/\d+)?$/,/^(\*|1?\d|2[0-3])(-\d+)?(\/\d+)?$/,/^(\*|[1-9]|[12]\d|3[01])(-\d+)?(\/\d+)?$/,/^(\*|[1-9]|1[0-2])(-\d+)?(\/\d+)?$/,/^(\*|[0-7])(-[0-7])?(\/\d+)?$/];for(let r=0;r<5;r++){let i=n[r].split(",");for(let e of i)if(!a[r].test(e)&&e!=="*")return!1}return!0}function G(t){let n={"@daily":"Daily at midnight","@weekly":"Weekly on Sunday at midnight","@hourly":"Every hour","@minutely":"Every minute"};if(n[t])return n[t];if(Object.keys(D).includes(t))return{daily:"Daily at midnight",weekly:"Weekly on Sunday at midnight",hourly:"Every hour",minutely:"Every minute"}[t]||t;let a=t.trim().split(/\s+/);if(a.length!==5)return t;let[r,i,e,s,o]=a;return r==="0"&&i==="0"&&e==="*"&&s==="*"&&o==="*"?"Daily at midnight":r==="0"&&e==="*"&&s==="*"&&o==="*"?`Daily at ${i}:00`:r!=="*"&&i!=="*"&&e==="*"&&s==="*"?`Daily at ${i}:${r.padStart(2,"0")}`:i==="*"&&r==="0"?"Every hour":r!=="*"&&i==="*"?`Every hour at minute ${r}`:t}function H(t,n=new Date){let a=t.trim().split(/\s+/);if(a.length!==5)return new Date(n.getTime()+1440*60*1e3);let[r,i]=a,e=new Date(n);return i!=="*"&&r!=="*"?(e.setHours(parseInt(i,10),parseInt(r,10),0,0),e<=n&&e.setDate(e.getDate()+1)):i!=="*"?(e.setHours(parseInt(i,10),0,0,0),e<=n&&e.setDate(e.getDate()+1)):r!=="*"?(e.setMinutes(parseInt(r,10),0,0),e<=n&&e.setHours(e.getHours()+1)):(e.setSeconds(0,0),e.setMinutes(e.getMinutes()+1)),e}export{C as a,K as b,F as c,G as d,H as e};
@@ -0,0 +1,3 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{b as r,d as f}from"./chunk-JSOBRKMA.js";import{a as d}from"./chunk-UZZCWWIG.js";f();import{existsSync as i,readFileSync as a}from"node:fs";import{join as s}from"node:path";import{execSync as p}from"node:child_process";var c=null,u=0,g=6e4;function F(){c=null,u=0}function x(e){if(c&&Date.now()-u<g)return c;let n=m(e);return c=n,u=Date.now(),n}function m(e){let n=w(e);if(n)return n;let o=h(e);if(o)return o;let t=v(e);return t||{available:!1}}function w(e){let n=s(e,".claude","mcp.json");if(i(n))try{let t=r(a(n,"utf-8"));if(t.mcpServers?.ruflo||t.mcpServers?.["claude-flow"])return{available:!0,method:"mcp-config"}}catch{}let o=s(e,".claude","settings.json");if(i(o))try{let t=r(a(o,"utf-8")),l=t.mcpServers||t.mcp?.servers||{};if(l.ruflo||l["claude-flow"]||l["@anthropic/claude-flow"])return{available:!0,method:"mcp-config"}}catch{}return null}function h(e){let n=s(e,"package.json");if(!i(n))return null;try{let o=r(a(n,"utf-8")),t={...o.dependencies,...o.devDependencies};if(t.ruflo||t["@claude-flow/cli"]||t["claude-flow"])return{available:!0,method:"npm-dependency"}}catch{}return null}function v(e){for(let n of["ruflo","@claude-flow/cli"])try{return{available:!0,method:"npx-cached",version:p(`npx --no-install ${n} --version`,{encoding:"utf-8",timeout:5e3,cwd:e,stdio:["pipe","pipe","pipe"]}).trim().match(/\d+\.\d+\.\d+[\w.-]*/)?.[0]}}catch{}return null}function b(){for(let e of["ruflo","@claude-flow/cli"])try{return d.resolve(`${e}/package.json`),e}catch{}return"ruflo"}function S(){return[" Claude Flow not found \u2014 running in standalone mode.",""," Claude Flow adds optional features:"," - SONA trajectory tracking (reinforcement learning)"," - 3-tier model routing (haiku / sonnet / opus)"," - Codebase pretrain analysis",""," To install later:"," npm install -g ruflo"," claude mcp add ruflo -- npx -y ruflo@3.5.18"," aqe init --auto --with-claude-flow"].join(`
3
+ `)}export{F as a,x as b,b as c,S as d};
@@ -0,0 +1,66 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{a as I,b as H,c as C,e as S,f as L}from"./chunk-AFPMCMVX.js";import{b as T,d as P}from"./chunk-JSOBRKMA.js";import{a as f,c as O}from"./chunk-UN4PA4M2.js";import{f as x}from"./chunk-UB7RGVKO.js";L();P();var v=["function","module","test","file","class"],w=["calls","imports","tests","depends_on","covers"],E=class{ensureSchema(e){e.transaction(()=>{e.exec(I),e.exec(H),e.exec(C)})()}schemaExists(e){return S(e)}getNodeTypes(){return v}getEdgeTypes(){return w}isValidNodeType(e){return v.includes(e)}isValidEdgeType(e){return w.includes(e)}getStats(e){if(!this.schemaExists(e))return{nodeCount:0,edgeCount:0};let t=e.prepare("SELECT COUNT(*) as count FROM hypergraph_nodes").get().count,r=e.prepare("SELECT COUNT(*) as count FROM hypergraph_edges").get().count;return{nodeCount:t,edgeCount:r}}dropSchema(e){let t=e.prepare("SELECT COUNT(*) as cnt FROM hypergraph_nodes").get()?.cnt??0,r=e.prepare("SELECT COUNT(*) as cnt FROM hypergraph_edges").get()?.cnt??0;if(t>0||r>0)throw new Error(`REFUSING to drop hypergraph schema: tables contain data (${t} nodes, ${r} edges). Backup and manually drop if needed.`);e.transaction(()=>{e.exec("DROP TABLE IF EXISTS hypergraph_edges"),e.exec("DROP TABLE IF EXISTS hypergraph_nodes")})()}};function N(n){return{id:n.id,type:n.type,name:n.name,file_path:n.filePath??null,line_start:n.lineStart??null,line_end:n.lineEnd??null,complexity:n.complexity??null,coverage:n.coverage??null,metadata:n.metadata?JSON.stringify(n.metadata):null,embedding:n.embedding?M(n.embedding):null}}function l(n){return{id:n.id,type:n.type,name:n.name,filePath:n.file_path??void 0,lineStart:n.line_start??void 0,lineEnd:n.line_end??void 0,complexity:n.complexity??void 0,coverage:n.coverage??void 0,metadata:n.metadata?T(n.metadata):void 0,embedding:n.embedding?F(n.embedding):void 0,createdAt:n.created_at,updatedAt:n.updated_at}}function A(n){return{id:n.id,source_id:n.sourceId,target_id:n.targetId,type:n.type,weight:n.weight??1,properties:n.properties?JSON.stringify(n.properties):null}}function b(n){return{id:n.id,sourceId:n.source_id,targetId:n.target_id,type:n.type,weight:n.weight,properties:n.properties?T(n.properties):void 0,createdAt:n.created_at}}function _(n,e,t){return`${n}--${t}-->${e}`}function M(n){let e=Buffer.alloc(n.length*4);for(let t=0;t<n.length;t++)e.writeFloatLE(n[t],t*4);return e}function F(n){let e=[],t=n.length/4;for(let r=0;r<t;r++)e.push(n.readFloatLE(r*4));return e}O();var z={maxTraversalDepth:10,maxQueryResults:1e3,enableVectorSearch:!1},y=class{config;schemaManager;initialized=!1;constructor(e){this.config={...z,...e},this.schemaManager=new E}async initialize(){this.initialized||(this.schemaManager.ensureSchema(this.config.db),this.initialized=!0)}isInitialized(){return this.initialized}async addNode(e){this.ensureInitialized();let t=x(),r={id:t,...e},i=N(r);return this.config.db.prepare(`
3
+ INSERT INTO hypergraph_nodes (id, type, name, file_path, line_start, line_end, complexity, coverage, metadata, embedding)
4
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
5
+ `).run(i.id,i.type,i.name,i.file_path,i.line_start,i.line_end,i.complexity,i.coverage,i.metadata,i.embedding),t}async addEdge(e){this.ensureInitialized();let t=_(e.sourceId,e.targetId,e.type),r={id:t,...e},i=A(r);return this.config.db.prepare(`
6
+ INSERT OR REPLACE INTO hypergraph_edges (id, source_id, target_id, type, weight, properties)
7
+ VALUES (?, ?, ?, ?, ?, ?)
8
+ `).run(i.id,i.source_id,i.target_id,i.type,i.weight,i.properties),t}async getNode(e){this.ensureInitialized();let t=this.config.db.prepare("SELECT * FROM hypergraph_nodes WHERE id = ?").get(e);return t?l(t):null}async getEdge(e){this.ensureInitialized();let t=this.config.db.prepare("SELECT * FROM hypergraph_edges WHERE id = ?").get(e);return t?b(t):null}async updateNode(e,t){this.ensureInitialized();let r=await this.getNode(e);if(!r)throw new Error(`Node not found: ${e}`);let i={...r,...t},a=N(i);this.config.db.prepare(`
9
+ UPDATE hypergraph_nodes
10
+ SET type = ?, name = ?, file_path = ?, line_start = ?, line_end = ?,
11
+ complexity = ?, coverage = ?, metadata = ?, embedding = ?,
12
+ updated_at = datetime('now')
13
+ WHERE id = ?
14
+ `).run(a.type,a.name,a.file_path,a.line_start,a.line_end,a.complexity,a.coverage,a.metadata,a.embedding,e)}async deleteNode(e){this.ensureInitialized(),this.config.db.prepare("DELETE FROM hypergraph_edges WHERE source_id = ? OR target_id = ?").run(e,e),this.config.db.prepare("DELETE FROM hypergraph_nodes WHERE id = ?").run(e)}async deleteEdge(e){this.ensureInitialized(),this.config.db.prepare("DELETE FROM hypergraph_edges WHERE id = ?").run(e)}async findNodes(e){this.ensureInitialized();let t=[],r=[];if(e.type){let s=Array.isArray(e.type)?e.type:[e.type];t.push(`type IN (${s.map(()=>"?").join(", ")})`),r.push(...s)}e.filePath&&(e.filePath.includes("%")?t.push("file_path LIKE ?"):t.push("file_path = ?"),r.push(e.filePath)),e.name&&typeof e.name=="string"&&(t.push("name = ?"),r.push(e.name)),e.minComplexity!==void 0&&(t.push("complexity >= ?"),r.push(e.minComplexity)),e.maxComplexity!==void 0&&(t.push("complexity <= ?"),r.push(e.maxComplexity)),e.minCoverage!==void 0&&(t.push("coverage >= ?"),r.push(e.minCoverage)),e.maxCoverage!==void 0&&(t.push("coverage <= ?"),r.push(e.maxCoverage));let i=t.length>0?`WHERE ${t.join(" AND ")}`:"",a=e.limit??this.config.maxQueryResults,p=`SELECT * FROM hypergraph_nodes ${i} LIMIT ?`;r.push(a);let o=this.config.db.prepare(p).all(...r).map(l);return e.name instanceof RegExp&&(o=o.filter(s=>e.name instanceof RegExp&&e.name.test(s.name))),o}async findEdges(e){this.ensureInitialized();let t=[],r=[];if(e.type){let o=Array.isArray(e.type)?e.type:[e.type];t.push(`type IN (${o.map(()=>"?").join(", ")})`),r.push(...o)}e.sourceId&&(t.push("source_id = ?"),r.push(e.sourceId)),e.targetId&&(t.push("target_id = ?"),r.push(e.targetId)),e.minWeight!==void 0&&(t.push("weight >= ?"),r.push(e.minWeight));let i=t.length>0?`WHERE ${t.join(" AND ")}`:"",a=e.limit??this.config.maxQueryResults,p=`SELECT * FROM hypergraph_edges ${i} LIMIT ?`;return r.push(a),this.config.db.prepare(p).all(...r).map(b)}async traverse(e,t=[],r=5){this.ensureInitialized();let i=new Map,a=new Map,p=[],g=0,o=[{nodeId:e,depth:0,path:{nodes:[e],edges:[]}}],s=Math.min(r,this.config.maxTraversalDepth);for(;o.length>0;){let{nodeId:d,depth:c,path:h}=o.shift();if(!i.has(d)){let u=await this.getNode(d);u&&i.set(d,u)}if(g=Math.max(g,c),c>=s){p.push(h);continue}let m={sourceId:d};t.length>0&&(m.type=t);let R=await this.findEdges(m);if(R.length===0){p.push(h);continue}for(let u of R)if(!a.has(u.id)){a.set(u.id,u);let D={nodes:[...h.nodes,u.targetId],edges:[...h.edges,u.id]};o.push({nodeId:u.targetId,depth:c+1,path:D})}}return{nodes:Array.from(i.values()),edges:Array.from(a.values()),paths:p,maxDepthReached:g}}async findUntestedFunctions(){return this.ensureInitialized(),this.config.db.prepare(`
15
+ SELECT n.* FROM hypergraph_nodes n
16
+ WHERE n.type = 'function'
17
+ AND NOT EXISTS (
18
+ SELECT 1 FROM hypergraph_edges e
19
+ JOIN hypergraph_nodes t ON t.id = e.source_id
20
+ WHERE e.target_id = n.id
21
+ AND e.type = 'covers'
22
+ AND t.type = 'test'
23
+ )
24
+ ORDER BY n.complexity DESC NULLS LAST
25
+ LIMIT ?
26
+ `).all(this.config.maxQueryResults).map(l)}async findImpactedTests(e){if(this.ensureInitialized(),e.length===0)return[];let r=`
27
+ SELECT DISTINCT t.* FROM hypergraph_nodes t
28
+ JOIN hypergraph_edges e ON e.source_id = t.id
29
+ JOIN hypergraph_nodes f ON f.id = e.target_id
30
+ WHERE t.type = 'test'
31
+ AND e.type = 'covers'
32
+ AND f.type = 'function'
33
+ AND f.file_path IN (${e.map(()=>"?").join(", ")})
34
+ LIMIT ?
35
+ `,i=[...e,this.config.maxQueryResults];return this.config.db.prepare(r).all(...i).map(l)}async findCoverageGaps(e=50){return this.ensureInitialized(),this.config.db.prepare(`
36
+ SELECT * FROM hypergraph_nodes
37
+ WHERE type = 'function'
38
+ AND coverage IS NOT NULL
39
+ AND coverage <= ?
40
+ ORDER BY coverage ASC, complexity DESC NULLS LAST
41
+ LIMIT ?
42
+ `).all(e,this.config.maxQueryResults).map(l)}async findModuleDependencies(e){this.ensureInitialized();let t=await this.findNodes({type:"module",filePath:e,limit:1});if(t.length===0){let d=await this.findNodes({type:"file",filePath:e,limit:1});if(d.length===0)throw new Error(`Module not found: ${e}`);t.push(d[0])}let r=t[0],i=await this.findEdges({sourceId:r.id,type:["imports","depends_on"]}),a=[];for(let d of i){let c=await this.getNode(d.targetId);c&&a.push(c)}let p=await this.findEdges({targetId:r.id,type:["imports","depends_on"]}),g=[];for(let d of p){let c=await this.getNode(d.sourceId);c&&g.push(c)}let o=await this.traverse(r.id,["imports","depends_on"],5),s=o.nodes.filter(d=>d.id!==r.id);return{module:r,directDependencies:a,dependents:g,transitiveDependencies:s,maxDependencyDepth:o.maxDepthReached}}async buildFromIndexResult(e){this.ensureInitialized();let t=Date.now(),r=0,i=0,a=0,p=[];return this.config.db.transaction(()=>{for(let o of e.files)try{let s=`file:${o.path}`;this.config.db.prepare("SELECT id FROM hypergraph_nodes WHERE id = ?").get(s)?i++:(this.config.db.prepare(`
43
+ INSERT INTO hypergraph_nodes (id, type, name, file_path)
44
+ VALUES (?, 'file', ?, ?)
45
+ `).run(s,o.path.split("/").pop()||o.path,o.path),r++)}catch(s){p.push({entity:`file:${o.path}`,error:f(s)})}for(let o of e.files)for(let s of o.entities)try{let d=`${s.type}:${o.path}:${s.name}`,c=this.mapEntityTypeToNodeType(s.type);this.config.db.prepare("SELECT id FROM hypergraph_nodes WHERE id = ?").get(d)?(this.config.db.prepare(`
46
+ UPDATE hypergraph_nodes
47
+ SET line_start = ?, line_end = ?, complexity = ?, coverage = ?,
48
+ updated_at = datetime('now')
49
+ WHERE id = ?
50
+ `).run(s.lineStart,s.lineEnd,s.complexity,s.coverage,d),i++):(this.config.db.prepare(`
51
+ INSERT INTO hypergraph_nodes (id, type, name, file_path, line_start, line_end, complexity, coverage)
52
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
53
+ `).run(d,c,s.name,o.path,s.lineStart,s.lineEnd,s.complexity,s.coverage),r++)}catch(d){p.push({entity:`${s.type}:${s.name}`,error:f(d)})}for(let o of e.files){let s=`file:${o.path}`;for(let d of o.imports)try{let c=`file:${d}`;if(this.config.db.prepare("SELECT id FROM hypergraph_nodes WHERE id = ?").get(c)){let m=_(s,c,"imports");this.config.db.prepare(`
54
+ INSERT OR REPLACE INTO hypergraph_edges (id, source_id, target_id, type, weight)
55
+ VALUES (?, ?, ?, 'imports', 1.0)
56
+ `).run(m,s,c),a++}}catch(c){p.push({entity:`import:${d}`,error:f(c)})}}})(),{nodesCreated:r,nodesUpdated:i,edgesCreated:a,durationMs:Date.now()-t,errors:p}}async syncWithKnowledgeGraph(e){this.ensureInitialized();let t=Date.now(),r=0,i=0,a=0,p=0,g=await this.findNodes({});for(let s of g){let d=await e.getNode(s.id);r++}return i=(await this.findEdges({})).length,{nodesSynced:r,edgesSynced:i,nodesAdded:a,nodesRemoved:p,durationMs:Date.now()-t}}async getStats(){this.ensureInitialized();let e=this.schemaManager.getStats(this.config.db),t=this.config.db.prepare(`
57
+ SELECT type, COUNT(*) as count FROM hypergraph_nodes GROUP BY type
58
+ `).all(),r={function:0,module:0,test:0,file:0,class:0};for(let g of t)g.type in r&&(r[g.type]=g.count);let i=this.config.db.prepare(`
59
+ SELECT type, COUNT(*) as count FROM hypergraph_edges GROUP BY type
60
+ `).all(),a={calls:0,imports:0,tests:0,depends_on:0,covers:0};for(let g of i)g.type in a&&(a[g.type]=g.count);let p=this.config.db.prepare(`
61
+ SELECT
62
+ AVG(complexity) as avg_complexity,
63
+ AVG(coverage) as avg_coverage,
64
+ COUNT(CASE WHEN embedding IS NOT NULL THEN 1 END) as nodes_with_embeddings
65
+ FROM hypergraph_nodes
66
+ `).get();return{totalNodes:e.nodeCount,totalEdges:e.edgeCount,nodesByType:r,edgesByType:a,avgComplexity:p.avg_complexity??0,avgCoverage:p.avg_coverage??0,nodesWithEmbeddings:p.nodes_with_embeddings}}ensureInitialized(){if(!this.initialized)throw new Error("HypergraphEngine not initialized. Call initialize() first.")}mapEntityTypeToNodeType(e){return{function:"function",class:"class",module:"module",interface:"module",file:"file",test:"test"}[e]??"function"}};async function V(n){let e=new y(n);return await e.initialize(),e}function Y(n){return new y(n)}var k=y;export{z as a,y as b,V as c,Y as d,k as e};
@@ -0,0 +1,30 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ var i={domain:"test-generation",bestPractices:["Follow Arrange-Act-Assert (AAA) pattern for clear test structure","One logical assertion per test - test one behavior at a time","Use descriptive test names: should_returnValue_when_condition","Mock external dependencies to isolate unit under test","Test edge cases and boundary conditions, not just happy paths","Keep tests deterministic - avoid time-dependent assertions","Use test data builders or factories for complex objects","Prefer integration tests for workflows, unit tests for logic","Maintain test independence - no shared mutable state between tests","Write failing test first (TDD Red) before implementation"],antiPatterns:[{name:"God Test",description:"A single test that verifies too many behaviors",reason:"Hard to diagnose failures, brittle, slow to run",alternative:"Split into focused tests, each verifying one behavior",detection:"expect.*expect.*expect.*expect.*expect"},{name:"Mystery Guest",description:"Test relies on external data files or state not visible in test",reason:"Tests are hard to understand and maintain",alternative:"Make test data explicit within the test or use fixtures"},{name:"Eager Test",description:"Test that verifies more than needed for the current behavior",reason:"Creates unnecessary coupling, breaks easily",alternative:"Only assert what is necessary for this specific test case"},{name:"Flaky Assertion",description:"Assertions that depend on timing, order, or external state",reason:"Creates unreliable test suite, erodes trust",alternative:"Use deterministic assertions, mock time/random",detection:"setTimeout|Date\\.now|Math\\.random"},{name:"Test Code Duplication",description:"Same setup or assertion code repeated across tests",reason:"Maintenance burden, inconsistency risk",alternative:"Extract to beforeEach, helpers, or fixtures"}],frameworkGuidance:{jest:["Use describe blocks to group related tests","Prefer toEqual for deep equality, toBe for primitives","Use jest.mock() at module level for consistent mocking","Use jest.spyOn for partial mocking of objects","Enable --coverage to track test coverage"],vitest:["Use vi.mock() for module mocking","Prefer vi.fn() over jest.fn() syntax","Use vitest/ui for interactive test debugging","Enable browser mode for component tests","Use inline snapshots for small expected values"],mocha:["Use beforeEach/afterEach for setup/teardown","Combine with chai for assertions","Use sinon for spies, stubs, and mocks","Set appropriate timeouts for async tests"],pytest:["Use fixtures for reusable test setup","Use parametrize for data-driven tests","Use conftest.py for shared fixtures","Use pytest.raises for exception testing","Use pytest-cov for coverage reporting"],junit:["Use @BeforeEach and @AfterEach for setup/teardown","Use @DisplayName for readable test names","Use @ParameterizedTest for data-driven tests","Use Mockito for mocking dependencies"],testng:["Use @BeforeMethod and @AfterMethod appropriately","Use @DataProvider for parameterized tests","Configure test groups for selective execution"],playwright:["Use page.locator() for resilient element selection","Use expect(locator) for auto-waiting assertions","Use page.waitForLoadState for navigation","Use test.describe for grouping tests","Use fixtures for reusable browser contexts"],cypress:["Use cy.intercept() for API mocking","Avoid conditional testing - use deterministic state","Use data-cy attributes for stable selectors","Use cy.within() for scoped queries","Prefer cy.contains() for text-based selection"],selenium:["Use explicit waits over implicit waits","Use Page Object Model for maintainability","Handle stale element references with retry logic","Clean up browser state between tests"]},languageGuidance:{typescript:["Use type assertions in tests for better IDE support","Create typed test fixtures and builders","Use satisfies operator for test data validation","Mock types with ts-mockito or typed mocking libs"],javascript:["Use JSDoc comments for test documentation","Consider TypeScript for larger test suites","Use ESLint with testing plugins"],python:["Use type hints in test functions","Use dataclasses for test data","Follow PEP 8 naming: test_should_do_something"],java:["Use AssertJ for fluent assertions","Use Lombok for test data classes","Follow naming: shouldDoSomething_whenCondition"],go:["Use table-driven tests for multiple cases","Use testify for assertions and mocking","Place tests in _test.go files"],rust:["Use #[test] attribute for test functions","Use assert!, assert_eq!, assert_ne! macros","Place unit tests in same file with #[cfg(test)]"],csharp:["Use xUnit or NUnit for testing","Use FluentAssertions for readable assertions","Use Moq for mocking interfaces"],kotlin:["Use kotest for BDD-style testing","Use MockK for Kotlin-first mocking","Use data classes for test fixtures"]},examples:[{title:"Unit Test Template (TypeScript + Vitest)",description:"Standard AAA pattern for unit tests",content:`describe('UserService', () => {
3
+ describe('createUser', () => {
4
+ it('should create user with valid data', async () => {
5
+ // Arrange
6
+ const userData = { name: 'John', email: 'john@example.com' };
7
+ const mockRepo = { save: vi.fn().mockResolvedValue({ id: '1', ...userData }) };
8
+ const service = new UserService(mockRepo);
9
+
10
+ // Act
11
+ const result = await service.createUser(userData);
12
+
13
+ // Assert
14
+ expect(result.id).toBeDefined();
15
+ expect(result.name).toBe(userData.name);
16
+ expect(mockRepo.save).toHaveBeenCalledWith(userData);
17
+ });
18
+
19
+ it('should throw when email is invalid', async () => {
20
+ // Arrange
21
+ const userData = { name: 'John', email: 'invalid' };
22
+ const service = new UserService(mockRepo);
23
+
24
+ // Act & Assert
25
+ await expect(service.createUser(userData))
26
+ .rejects.toThrow('Invalid email');
27
+ });
28
+ });
29
+ });`,context:{language:"typescript",framework:"vitest"}}]},c={domain:"coverage-analysis",bestPractices:["Focus on risk-weighted coverage, not just percentage","Prioritize untested critical paths and business logic","Use mutation testing to validate test quality beyond line coverage","Target branch coverage over statement coverage","Use O(log n) sublinear algorithms for large codebases","Track coverage trends over time, not just snapshots","Exclude generated code, config, and third-party from metrics","Set realistic targets: 80% coverage for critical code","Identify coverage gaps by risk, not just location","Use coverage as a guide, not a goal"],antiPatterns:[{name:"Coverage Chasing",description:"Writing tests just to increase coverage percentage",reason:"Low-quality tests that exercise code without verifying behavior",alternative:"Write tests that verify behavior, measure mutation score"},{name:"Ignoring Branches",description:"Only tracking line coverage, missing conditional branches",reason:"Miss critical edge cases in conditionals",alternative:"Track branch coverage and ensure all paths tested"},{name:"Coverage Ratchet Too Tight",description:"Requiring 100% coverage on all code",reason:"Leads to test pollution, hard to maintain",alternative:"Risk-based coverage targets, allow exceptions"}],frameworkGuidance:{jest:["Use --coverage flag","Configure coverageThreshold in jest.config"],vitest:["Use --coverage flag","Use c8 or istanbul provider"],mocha:["Use nyc (Istanbul) for coverage"],pytest:["Use pytest-cov plugin","Use --cov flag"],junit:["Use JaCoCo for coverage reporting"],testng:["Use JaCoCo with TestNG"],playwright:["Use coverage API for browser code coverage"],cypress:["Use @cypress/code-coverage plugin"],selenium:["Integrate with build tool coverage (Maven/Gradle)"]},languageGuidance:{typescript:["Use c8 or istanbul for Node.js coverage"],javascript:["Use nyc or c8 for coverage"],python:["Use coverage.py or pytest-cov"],java:["Use JaCoCo or Cobertura"],go:["Use go test -cover","Use go tool cover for reports"],rust:["Use cargo-tarpaulin or grcov"],csharp:["Use coverlet or OpenCover"],kotlin:["Use JaCoCo with Kotlin support"]},examples:[]};var l={domain:"contract-testing",bestPractices:["Use contract testing for API boundaries (Pact, etc.)","Test both successful and error responses","Validate response schemas, not just status codes","Test authentication and authorization flows",'Use realistic test data, not just "test" strings',"Test rate limiting and pagination","Verify idempotency for applicable operations","Test with different content types (JSON, XML)","Document APIs with OpenAPI/Swagger specs","Use consumer-driven contracts for microservices"],antiPatterns:[{name:"Testing Implementation",description:"Tests that verify internal implementation details",reason:"Breaks when implementation changes, even if behavior unchanged",alternative:"Test the contract and behavior, not implementation"},{name:"Hardcoded URLs",description:"API URLs hardcoded in tests",reason:"Fails across environments, hard to maintain",alternative:"Use environment variables or config files"},{name:"No Schema Validation",description:"Only checking status codes, not response structure",reason:"Miss contract violations that break consumers",alternative:"Validate response against OpenAPI schema"}],frameworkGuidance:{jest:["Use supertest for HTTP testing"],vitest:["Use supertest or fetch for HTTP testing"],mocha:["Use supertest with chai-http"],pytest:["Use requests or httpx for API testing"],junit:["Use REST Assured for API testing"],testng:["Use REST Assured with TestNG"],playwright:["Use API testing with request context"],cypress:["Use cy.request() for API testing"],selenium:["Integrate with API testing libraries separately"]},languageGuidance:{typescript:["Use supertest, got, or axios"],javascript:["Use supertest, got, or axios"],python:["Use requests, httpx, or pytest-httpx"],java:["Use REST Assured or OkHttp"],go:["Use net/http/httptest package"],rust:["Use reqwest for HTTP testing"],csharp:["Use RestSharp or HttpClient"],kotlin:["Use Fuel or Ktor client"]},examples:[]},u={domain:"security-compliance",bestPractices:["Follow OWASP Top 10 for vulnerability testing","Test authentication bypass scenarios","Test SQL injection in all input fields","Test XSS in all output contexts","Verify CSRF protection on state-changing operations","Test authorization for all endpoints and actions","Scan dependencies for known vulnerabilities (SCA)","Use SAST tools in CI/CD pipeline","Test secrets management and exposure","Validate input sanitization and output encoding"],antiPatterns:[{name:"Security by Obscurity",description:"Relying on hidden endpoints or non-standard auth",reason:"Security through obscurity always fails",alternative:"Use standard authentication and authorization"},{name:"Testing Only Happy Path",description:"Only testing valid inputs",reason:"Miss injection and bypass vulnerabilities",alternative:"Test with malicious inputs and edge cases"}],frameworkGuidance:{jest:["Use for testing security functions and middleware"],vitest:["Use for testing security functions and middleware"],mocha:["Use for testing security functions"],pytest:["Use for testing security functions"],junit:["Use for testing security functions"],testng:["Use for testing security functions"],playwright:["Test for XSS, CSRF in browser context"],cypress:["Test for XSS, CSRF in browser context"],selenium:["Test for XSS, CSRF in browser context"]},languageGuidance:{typescript:["Use snyk, npm audit for dependency scanning"],javascript:["Use snyk, npm audit for dependency scanning"],python:["Use bandit for SAST, safety for SCA"],java:["Use SpotBugs, FindSecBugs for SAST"],go:["Use gosec for security scanning"],rust:["Use cargo-audit for vulnerability scanning"],csharp:["Use Security Code Scan for SAST"],kotlin:["Use detekt with security rules"]},examples:[]},d={domain:"visual-accessibility",bestPractices:["Capture screenshots at consistent viewport sizes","Use baseline images for comparison","Handle dynamic content (dates, avatars) with masks","Test across multiple browsers and devices","Use percy or chromatic for visual regression","Maintain baseline images in version control","Set appropriate diff thresholds for noise tolerance","Test responsive breakpoints systematically","Capture full-page and component screenshots","Use stable selectors for screenshot regions"],antiPatterns:[{name:"Pixel-Perfect Obsession",description:"Zero tolerance for any pixel differences",reason:"Anti-aliasing and rendering differences cause false failures",alternative:"Use appropriate diff thresholds (typically 0.1-5%)"},{name:"Unmasked Dynamic Content",description:"Not masking timestamps, avatars, ads",reason:"Causes constant baseline updates",alternative:"Mask or mock dynamic content consistently"}],frameworkGuidance:{jest:["Use jest-image-snapshot"],vitest:["Use vitest-image-snapshot"],mocha:["Use chai-image-snapshot"],pytest:["Use pytest-playwright with screenshots"],junit:["Use ashot for Java screenshot comparison"],testng:["Use ashot with TestNG"],playwright:["Use expect(page).toHaveScreenshot()"],cypress:["Use cypress-image-snapshot or percy"],selenium:["Use ashot or built-in screenshot"]},languageGuidance:{typescript:["Use playwright or puppeteer for screenshots"],javascript:["Use playwright or puppeteer for screenshots"],python:["Use playwright-python or selenium"],java:["Use ashot with Selenium"],go:["Use chromedp for browser automation"],rust:["Use headless-chrome or fantoccini"],csharp:["Use Selenium with screenshot comparison"],kotlin:["Use Selenium or Playwright with Kotlin"]},examples:[]};var p={domain:"chaos-resilience",bestPractices:["Define clear SLAs and performance budgets","Test under realistic load patterns","Monitor resource usage (CPU, memory, network)","Test both response time and throughput","Include performance tests in CI/CD","Use production-like test environments","Test with realistic data volumes","Profile before optimizing","Test under peak and sustained load","Monitor for memory leaks during extended tests"],antiPatterns:[{name:"Production Load Testing",description:"Running load tests against production",reason:"Can cause outages and affect real users",alternative:"Use staging environment with production-like data"},{name:"Single-Metric Focus",description:"Only measuring response time",reason:"Miss throughput, resource, and concurrency issues",alternative:"Track response time, throughput, errors, resources"}],frameworkGuidance:{jest:["Use for micro-benchmarks only"],vitest:["Use bench() for micro-benchmarks"],mocha:["Use for micro-benchmarks only"],pytest:["Use pytest-benchmark for micro-benchmarks"],junit:["Use JMH for micro-benchmarks"],testng:["Use JMH with TestNG"],playwright:["Use for frontend performance metrics"],cypress:["Use for frontend performance metrics"],selenium:["Limited - use dedicated perf tools"]},languageGuidance:{typescript:["Use k6, artillery, or autocannon"],javascript:["Use k6, artillery, or autocannon"],python:["Use locust for load testing"],java:["Use JMeter, Gatling, or k6"],go:["Use vegeta or hey for load testing"],rust:["Use criterion for benchmarks, drill for load"],csharp:["Use NBomber or k6"],kotlin:["Use Gatling with Kotlin DSL"]},examples:[]},o={"test-generation":i,"test-execution":i,"coverage-analysis":c,"quality-assessment":i,"defect-intelligence":i,"requirements-validation":i,"code-intelligence":c,"security-compliance":u,"contract-testing":l,"visual-accessibility":d,"chaos-resilience":p,"learning-optimization":i};function g(n){return o[n]}function m(n,s){let a=o[n],t=[...a.bestPractices];if(s.framework){let e=a.frameworkGuidance[s.framework];e&&t.push(...e.map(r=>`[${s.framework}] ${r}`))}if(s.language){let e=a.languageGuidance[s.language];e&&t.push(...e.map(r=>`[${s.language}] ${r}`))}if(s.includeAntiPatterns)for(let e of a.antiPatterns)t.push(`[AVOID] ${e.name}: ${e.description}`);return t}function f(n,s){let a=o[n],t=[];for(let e of a.antiPatterns)e.detection&&new RegExp(e.detection,"gi").test(s)&&t.push(e);return t}function h(n,s){let a=o[n],t=[];t.push(`## QE Guidance: ${n}`),t.push(""),t.push("### Best Practices");for(let e of a.bestPractices.slice(0,5))t.push(`- ${e}`);if(s.framework){let e=a.frameworkGuidance[s.framework];if(e&&e.length>0){t.push(""),t.push(`### ${s.framework} Tips`);for(let r of e.slice(0,3))t.push(`- ${r}`)}}if(s.language){let e=a.languageGuidance[s.language];if(e&&e.length>0){t.push(""),t.push(`### ${s.language} Tips`);for(let r of e.slice(0,3))t.push(`- ${r}`)}}t.push(""),t.push("### Anti-Patterns to Avoid");for(let e of a.antiPatterns.slice(0,3))t.push(`- **${e.name}**: ${e.description}`);return t.join(`
30
+ `)}export{g as a,m as b,f as c,h as d};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{createRequire as t}from"module";var o=t(import.meta.url),e=o("@xenova/transformers"),n=e,{RuvectorLayer:i,TensorCompress:a,differentiableSearch:s,hierarchicalForward:c,getCompressionLevel:l,init:p,FlashAttention:m,DotProductAttention:u,MultiHeadAttention:d,HyperbolicAttention:A,LinearAttention:f,MoEAttention:h,SonaEngine:_,pipeline:v}=e||{};export{n as a,i as b,a as c,s as d,c as e,l as f,p as g,m as h,u as i,d as j,A as k,f as l,h as m,_ as n,v as o};
@@ -0,0 +1,81 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ import{writeFileSync as p,readFileSync as m}from"node:fs";import{resolve as f,dirname as c,join as d}from"node:path";import{mkdirSync as g}from"node:fs";import{fileURLToPath as h}from"node:url";function $(){try{let e=typeof __dirname<"u"?__dirname:c(h(import.meta.url));for(let t=0;t<5;t++){let n=d(e,"package.json");try{let r=JSON.parse(m(n,"utf-8"));if(r.version)return r.version}catch{}e=c(e)}}catch{}return"unknown"}var T=["-F, --format <format>","Output format (text|json|sarif|junit|markdown)","text"],x=["-o, --output <path>","Write output to file instead of stdout"];function C(e,t,n){if(t){let r=f(t);g(c(r),{recursive:!0}),p(r,e,"utf-8"),n&&console.log(n),console.log(`Output written to: ${r}`)}else console.log(e)}function R(e){return JSON.stringify(e,null,2)}var v="https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json";function w(e){let t=i=>{switch(i.toLowerCase()){case"critical":case"high":return"error";case"medium":return"warning";case"low":case"info":return"note";default:return"warning"}},n=new Map,r=[];for(let i of e.vulnerabilities){let o=i.ruleId||`AQE/${i.type.replace(/\s+/g,"-").toLowerCase()}`;n.has(o)||n.set(o,{id:o,name:i.type,shortDescription:i.type,...i.cweId?{helpUri:`https://cwe.mitre.org/data/definitions/${i.cweId.replace("CWE-","")}.html`}:{}}),r.push({ruleId:o,level:t(i.severity),message:{text:i.message},locations:[{physicalLocation:{artifactLocation:{uri:i.file,uriBaseId:"%SRCROOT%"},region:{startLine:i.line,startColumn:1}}}],...i.cweId?{taxa:[{id:i.cweId,toolComponent:{name:"CWE"}}]}:{}})}let s={$schema:v,version:"2.1.0",runs:[{tool:{driver:{name:"agentic-qe",version:$(),informationUri:"https://github.com/proffesor-for-testing/agentic-qe",rules:Array.from(n.values()).map(i=>({id:i.id,name:i.name,shortDescription:{text:i.shortDescription},...i.helpUri?{helpUri:i.helpUri}:{},defaultConfiguration:{level:"warning"}}))}},results:r,invocations:[{executionSuccessful:!0,commandLine:`aqe security --sast --format sarif -t ${e.target}`}]}]};return JSON.stringify(s,null,2)}function a(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function I(e){let t=e.tests||[],n=e.passed+e.failed+e.skipped,r=(e.duration/1e3).toFixed(3),s=`<?xml version="1.0" encoding="UTF-8"?>
3
+ `;if(s+=`<testsuites tests="${n}" failures="${e.failed}" errors="0" time="${r}">
4
+ `,s+=` <testsuite name="aqe-test-run" tests="${n}" failures="${e.failed}" errors="0" skipped="${e.skipped}" time="${r}" id="${a(e.runId)}">
5
+ `,t.length>0)for(let i of t){let o=(i.duration/1e3).toFixed(3),l=a(i.suite||i.file||"aqe"),u=a(i.name);s+=` <testcase classname="${l}" name="${u}" time="${o}"`,!i.passed&&i.error?(s+=`>
6
+ `,s+=` <failure message="${a(i.error)}">${a(i.error)}</failure>
7
+ `,s+=` </testcase>
8
+ `):s+=` />
9
+ `}else{for(let i=0;i<e.passed;i++)s+=` <testcase classname="aqe" name="test-${i+1}" time="0" />
10
+ `;for(let i=0;i<e.failed;i++)s+=` <testcase classname="aqe" name="failed-test-${i+1}" time="0">
11
+ `,s+=` <failure message="Test failed">Test failed</failure>
12
+ `,s+=` </testcase>
13
+ `;for(let i=0;i<e.skipped;i++)s+=` <testcase classname="aqe" name="skipped-test-${i+1}" time="0">
14
+ `,s+=` <skipped />
15
+ `,s+=` </testcase>
16
+ `}return s+=` </testsuite>
17
+ `,s+=`</testsuites>
18
+ `,s}function O(e){let t=`# Coverage Report
19
+
20
+ `;if(t+=`| Metric | Value | Status |
21
+ `,t+=`|--------|-------|--------|
22
+ `,t+=`| Lines | ${e.summary.line}% | ${e.summary.line>=e.threshold?"\u2705":"\u274C"} |
23
+ `,t+=`| Branches | ${e.summary.branch}% | ${e.summary.branch>=e.threshold?"\u2705":"\u274C"} |
24
+ `,t+=`| Functions | ${e.summary.function}% | ${e.summary.function>=e.threshold?"\u2705":"\u274C"} |
25
+ `,t+=`| Statements | ${e.summary.statement}% | ${e.summary.statement>=e.threshold?"\u2705":"\u274C"} |
26
+ `,t+=`
27
+ **Threshold:** ${e.threshold}% \u2014 ${e.meetsThreshold?"\u2705 Met":"\u274C Not met"}
28
+ `,e.gaps&&e.gaps.length>0){t+=`
29
+ ## Coverage Gaps
30
+
31
+ `,t+=`| File | Uncovered Lines | Risk | Severity |
32
+ `,t+=`|------|----------------|------|----------|
33
+ `;for(let n of e.gaps.slice(0,20))t+=`| ${n.file} | ${n.lines.length} | ${(n.riskScore*100).toFixed(0)}% | ${n.severity} |
34
+ `}if(e.recommendations&&e.recommendations.length>0){t+=`
35
+ ## Recommendations
36
+
37
+ `;for(let n of e.recommendations)t+=`- ${n}
38
+ `}return t}function F(e){let t=`# Quality Gate Report
39
+
40
+ `;t+=`**Result:** ${e.passed?"\u2705 PASSED":"\u274C FAILED"}
41
+ `,t+=`**Score:** ${e.score}
42
+
43
+ `,t+=`## Checks
44
+
45
+ `,t+=`| Check | Value | Threshold | Status |
46
+ `,t+=`|-------|-------|-----------|--------|
47
+ `;for(let n of e.checks)t+=`| ${n.name} | ${n.value} | ${n.threshold} | ${n.passed?"\u2705":"\u274C"} |
48
+ `;if(e.recommendations&&e.recommendations.length>0){t+=`
49
+ ## Recommendations
50
+
51
+ `;for(let n of e.recommendations)t+=`- ${n}
52
+ `}return t}function A(e){let t=`# Security Scan Report
53
+
54
+ `;if(t+=`**Target:** ${e.target}
55
+ `,t+=`**Scan Type:** ${e.scanType}
56
+ `,t+=`**Vulnerabilities Found:** ${e.vulnerabilities.length}
57
+
58
+ `,e.vulnerabilities.length>0){t+=`## Vulnerabilities
59
+
60
+ `,t+=`| Severity | Type | File | Line | Message |
61
+ `,t+=`|----------|------|------|------|---------|
62
+ `;for(let n of e.vulnerabilities)t+=`| ${n.severity} | ${n.type} | ${n.file} | ${n.line} | ${n.message} |
63
+ `}if(e.compliance&&(t+=`
64
+ ## Compliance
65
+
66
+ `,t+=`**Status:** ${e.compliance.compliant?"\u2705 Compliant":"\u274C Non-compliant"}
67
+ `,e.compliance.issues))for(let n of e.compliance.issues)t+=`- **${n.framework}:** ${n.issue}
68
+ `;return t}function L(e){let t=e.passed+e.failed+e.skipped,n=`# Test Run Report
69
+
70
+ `;return n+=`**Run ID:** ${e.runId}
71
+ `,n+=`**Duration:** ${e.duration}ms
72
+
73
+ `,n+=`| Metric | Count |
74
+ `,n+=`|--------|-------|
75
+ `,n+=`| Total | ${t} |
76
+ `,n+=`| Passed | ${e.passed} |
77
+ `,n+=`| Failed | ${e.failed} |
78
+ `,n+=`| Skipped | ${e.skipped} |
79
+ `,n+=`
80
+ **Result:** ${e.failed===0?"\u2705 All tests passed":"\u274C Some tests failed"}
81
+ `,n}export{T as a,x as b,C as c,R as d,w as e,I as f,O as g,F as h,A as i,L as j};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.1");process.exit(0)}
2
+ var s={"test-generation":/test|spec|describe|it\(|expect|assert|mock|stub|fixture|tdd|bdd/i,"test-execution":/run|execute|parallel|retry|flaky|timeout|worker|orchestrat/i,"coverage-analysis":/coverage|branch|line|uncovered|gap|untested|percentage|sublinear/i,"quality-assessment":/quality|gate|deploy|readiness|metric|threshold|sla|score/i,"defect-intelligence":/defect|bug|predict|root.?cause|regression|failure|incident/i,"requirements-validation":/requirement|bdd|gherkin|testabil|accept|criteri|scenario/i,"code-intelligence":/semantic|knowledge|graph|ast|symbol|reference|impact|depend/i,"security-compliance":/vuln|cve|owasp|xss|sqli|injection|csrf|auth|secret|compliance|sast|dast/i,"contract-testing":/contract|pact|openapi|swagger|graphql|schema|endpoint|api/i,"visual-accessibility":/screenshot|visual|snapshot|pixel|percy|a11y|aria|wcag|screen.?reader|accessible|contrast/i,"chaos-resilience":/chaos|resilience|fault|inject|blast|recover|latency|failure|stress|load/i,"learning-optimization":/learn|pattern|optim|neural|embedding|vector|memory|adapt|train/i};function l(e){for(let[t,a]of Object.entries(s))if(a.test(e))return t;return null}function m(e){let t=[];for(let[a,n]of Object.entries(s))n.test(e)&&t.push(a);return t}function u(e){return e}function d(e){let t=Math.min(e.usageCount/100,1);return e.confidence*.3+t*.2+e.successRate*.5}var c=3;function p(e,t,a=.4){let n=e.tier==="short-term"&&e.successfulUses>=c,r=e.successRate>=.7&&e.confidence>=.6,i=t===void 0||t<a,o;return n?r?i||(o="coherence_violation"):o="low_quality":o="insufficient_usage",{meetsUsageCriteria:n,meetsQualityCriteria:r,meetsCoherenceCriteria:i,blockReason:o}}function y(e){let t=[];if(e.id||t.push("Pattern ID is required"),e.patternType||t.push("Pattern type is required"),e.qeDomain||t.push("QE domain is required"),e.name||t.push("Pattern name is required"),e.template?.content||t.push("Template content is required"),e.confidence!==void 0&&(e.confidence<0||e.confidence>1)&&t.push("Confidence must be between 0 and 1"),e.successRate!==void 0&&(e.successRate<0||e.successRate>1)&&t.push("Success rate must be between 0 and 1"),e.template?.variables){let a=new Set;for(let n of e.template.variables)a.has(n.name)&&t.push(`Duplicate variable name: ${n.name}`),a.add(n.name),e.template.content.includes(`{{${n.name}}}`)||t.push(`Variable ${n.name} not referenced in template`)}return{valid:t.length===0,errors:t}}function f(e,t){let a=e.content;for(let n of e.variables){let r=t[n.name]??n.defaultValue;if(n.required&&r===void 0)throw new Error(`Required variable ${n.name} not provided`);if(r!==void 0){let i=`{{${n.name}}}`,o=typeof r=="object"?JSON.stringify(r):String(r);a=a.split(i).join(o)}}return a}var g=Object.keys(s);export{l as a,m as b,u as c,d,c as e,p as f,y as g,f as h,g as i};